summaryrefslogtreecommitdiffstats
path: root/funtools
diff options
context:
space:
mode:
Diffstat (limited to 'funtools')
-rw-r--r--funtools/.gitignore45
-rw-r--r--funtools/COPYING504
-rw-r--r--funtools/INSTALL312
-rw-r--r--funtools/Makefile.in755
-rw-r--r--funtools/README27
-rw-r--r--funtools/ac_c_long_long.m436
-rw-r--r--funtools/aclocal.m42
-rw-r--r--funtools/bsearch.c68
-rw-r--r--funtools/calc.h36
-rw-r--r--funtools/calc.l802
-rw-r--r--funtools/chandra.h5
-rw-r--r--funtools/conf.h.in63
-rwxr-xr-xfuntools/config.guess1462
-rwxr-xr-xfuntools/config.sub1823
-rwxr-xr-xfuntools/configure-failsafe7001
-rw-r--r--funtools/configure.ac286
-rw-r--r--funtools/copyright30
-rw-r--r--funtools/doc/asc2fits.c86
-rw-r--r--funtools/doc/changelog.html1182
-rw-r--r--funtools/doc/changelog_beta.html953
-rw-r--r--funtools/doc/combo.html117
-rw-r--r--funtools/doc/doc40.fitsbin5760 -> 0 bytes
-rw-r--r--funtools/doc/ds9.html105
-rw-r--r--funtools/doc/env.html222
-rw-r--r--funtools/doc/evcol.c130
-rw-r--r--funtools/doc/evmerge.c77
-rw-r--r--funtools/doc/evnext.c116
-rw-r--r--funtools/doc/evread.c304
-rw-r--r--funtools/doc/files.html627
-rw-r--r--funtools/doc/filters.html325
-rw-r--r--funtools/doc/funcalc.sed9
-rw-r--r--funtools/doc/funtools.ds983
-rw-r--r--funtools/doc/funtools.pdfbin447315 -> 0 bytes
-rw-r--r--funtools/doc/funtools.ps11446
-rw-r--r--funtools/doc/help.html192
-rwxr-xr-xfuntools/doc/html2man258
-rw-r--r--funtools/doc/idx.html216
-rw-r--r--funtools/doc/imblank.c106
-rw-r--r--funtools/doc/library.html2823
-rw-r--r--funtools/doc/pod/funcalc.pod572
-rw-r--r--funtools/doc/pod/funcen.pod145
-rw-r--r--funtools/doc/pod/funclose.pod53
-rw-r--r--funtools/doc/pod/funcnts.pod657
-rw-r--r--funtools/doc/pod/funcolumnactivate.pod239
-rw-r--r--funtools/doc/pod/funcolumnlookup.pod188
-rw-r--r--funtools/doc/pod/funcolumnselect.pod686
-rw-r--r--funtools/doc/pod/funcombine.pod157
-rw-r--r--funtools/doc/pod/funcone.pod191
-rw-r--r--funtools/doc/pod/fundisp.pod484
-rw-r--r--funtools/doc/pod/funds9.pod113
-rw-r--r--funtools/doc/pod/funenv.pod349
-rw-r--r--funtools/doc/pod/funfiles.pod1019
-rw-r--r--funtools/doc/pod/funfilters.pod521
-rw-r--r--funtools/doc/pod/funflush.pod107
-rw-r--r--funtools/doc/pod/funhead.pod218
-rw-r--r--funtools/doc/pod/funhist.pod252
-rw-r--r--funtools/doc/pod/funidx.pod224
-rw-r--r--funtools/doc/pod/funimage.pod314
-rw-r--r--funtools/doc/pod/funimageget.pod237
-rw-r--r--funtools/doc/pod/funimageput.pod145
-rw-r--r--funtools/doc/pod/funimagerowget.pod137
-rw-r--r--funtools/doc/pod/funimagerowput.pod122
-rw-r--r--funtools/doc/pod/funindex.pod83
-rw-r--r--funtools/doc/pod/funindexes.pod215
-rw-r--r--funtools/doc/pod/funinfoget.pod226
-rw-r--r--funtools/doc/pod/funinfoput.pod180
-rw-r--r--funtools/doc/pod/funjoin.pod233
-rw-r--r--funtools/doc/pod/funlib.pod542
-rw-r--r--funtools/doc/pod/funmerge.pod122
-rw-r--r--funtools/doc/pod/funopen.pod166
-rw-r--r--funtools/doc/pod/funparamget.pod153
-rw-r--r--funtools/doc/pod/funparamput.pod147
-rw-r--r--funtools/doc/pod/funref.pod170
-rw-r--r--funtools/doc/pod/funregions.pod571
-rw-r--r--funtools/doc/pod/funsky.pod260
-rw-r--r--funtools/doc/pod/funtable.pod296
-rw-r--r--funtools/doc/pod/funtablerowget.pod111
-rw-r--r--funtools/doc/pod/funtablerowput.pod200
-rw-r--r--funtools/doc/pod/funtbl.pod137
-rw-r--r--funtools/doc/pod/funtext.pod718
-rw-r--r--funtools/doc/pod/funtools.pod542
-rw-r--r--funtools/doc/pod/funview.pod407
-rw-r--r--funtools/doc/pod/funvu.pod404
-rw-r--r--funtools/doc/pod/regalgebra.pod286
-rw-r--r--funtools/doc/pod/regbounds.pod203
-rw-r--r--funtools/doc/pod/regcoords.pod247
-rw-r--r--funtools/doc/pod/regdiff.pod99
-rw-r--r--funtools/doc/pod/reggeometry.pod1156
-rw-r--r--funtools/doc/programs.html3497
-rw-r--r--funtools/doc/regalgebra.html278
-rw-r--r--funtools/doc/regbounds.html179
-rw-r--r--funtools/doc/regcoords.html239
-rw-r--r--funtools/doc/regdiff.html71
-rw-r--r--funtools/doc/reggeometry.html1148
-rw-r--r--funtools/doc/regions.html563
-rw-r--r--funtools/doc/sman/fun4.indexbin695374 -> 0 bytes
-rw-r--r--funtools/doc/sman/fun4.index.propbin137841 -> 0 bytes
-rw-r--r--funtools/doc/sman/fun4.index.version2
-rw-r--r--funtools/doc/sman/fun8.indexbin1125202 -> 0 bytes
-rw-r--r--funtools/doc/sman/fun8.index.propbin138033 -> 0 bytes
-rw-r--r--funtools/doc/sman/fun8.index.version2
-rw-r--r--funtools/doc/sman_conf.tmpl96
-rw-r--r--funtools/doc/szlong.c8
-rw-r--r--funtools/doc/tabcalc.c196
-rw-r--r--funtools/doc/text.html564
-rw-r--r--funtools/doc/twcs.c61
-rw-r--r--funtools/doc/view.html376
-rw-r--r--funtools/faq/Makefile.in135
-rw-r--r--funtools/faq/faq.html49
-rw-r--r--funtools/faq/faq1.html39
-rw-r--r--funtools/faq/faq2.html381
-rw-r--r--funtools/faq/faq3.html23
-rw-r--r--funtools/faq/faq4.html211
-rwxr-xr-xfuntools/faq/tdisp15
-rw-r--r--funtools/faq/tev.c56
-rw-r--r--funtools/faq/tfaq.c41
-rw-r--r--funtools/faq/tim.c55
-rw-r--r--funtools/filter/Imakefile18
-rw-r--r--funtools/filter/Makefile.in282
-rw-r--r--funtools/filter/ZHTODO4
-rw-r--r--funtools/filter/ac_c_long_long.m436
-rw-r--r--funtools/filter/aclocal.m41
-rw-r--r--funtools/filter/addld1
-rw-r--r--funtools/filter/column.c36
-rw-r--r--funtools/filter/column.h29
-rwxr-xr-xfuntools/filter/compat/install-sh238
-rw-r--r--funtools/filter/conf.h.in62
-rw-r--r--funtools/filter/config.guess1435
-rw-r--r--funtools/filter/config.sub1807
-rwxr-xr-xfuntools/filter/configure-failsafe6399
-rw-r--r--funtools/filter/configure.ac202
-rw-r--r--funtools/filter/dl.c57
-rw-r--r--funtools/filter/dl.h23
-rw-r--r--funtools/filter/events_c.h1
-rw-r--r--funtools/filter/events_py.h1
-rw-r--r--funtools/filter/evfilter.c266
-rw-r--r--funtools/filter/evfilter.py156
-rw-r--r--funtools/filter/evregions.c1532
-rw-r--r--funtools/filter/evregions_c.h1
-rw-r--r--funtools/filter/evregions_c.tmpl1532
-rw-r--r--funtools/filter/filt.l3228
-rw-r--r--funtools/filter/filter.c1041
-rw-r--r--funtools/filter/filter.h380
-rw-r--r--funtools/filter/filter_pyh.py22
-rw-r--r--funtools/filter/filtprog.c351
-rw-r--r--funtools/filter/filtprog_c.c1033
-rw-r--r--funtools/filter/idx.h166
-rw-r--r--funtools/filter/idx.l559
-rw-r--r--funtools/filter/idx.output1007
-rw-r--r--funtools/filter/idx.tab.c2177
-rw-r--r--funtools/filter/idx.tab.h83
-rw-r--r--funtools/filter/idx.y77
-rw-r--r--funtools/filter/idxacts.c2368
-rw-r--r--funtools/filter/image_c.h1
-rw-r--r--funtools/filter/imfilter.c335
-rw-r--r--funtools/filter/imregions.c2585
-rw-r--r--funtools/filter/imregions_c.h1
-rw-r--r--funtools/filter/imregions_c.tmpl2585
-rwxr-xr-xfuntools/filter/inc.sed13
-rwxr-xr-xfuntools/filter/install-sh276
-rw-r--r--funtools/filter/lex.filt.c8941
-rw-r--r--funtools/filter/lex.idx.c2829
-rw-r--r--funtools/filter/regions.h408
-rw-r--r--funtools/filter/regions_h.h1
-rw-r--r--funtools/filter/sample.c83
-rw-r--r--funtools/filter/swap.c92
-rw-r--r--funtools/filter/swap_c.h1
-rw-r--r--funtools/filter/symbols.c323
-rw-r--r--funtools/filter/tfilt.c527
-rw-r--r--funtools/filter/tfilt.ex24
-rw-r--r--funtools/filter/tl.c190
-rw-r--r--funtools/filter/tl.h25
-rw-r--r--funtools/filter/xalloc_c.h1
-rw-r--r--funtools/fitsy/Imakefile54
-rw-r--r--funtools/fitsy/Makefile.in240
-rw-r--r--funtools/fitsy/ac_c_long_long.m436
-rw-r--r--funtools/fitsy/aclocal.m41
-rw-r--r--funtools/fitsy/cardfind.c201
-rw-r--r--funtools/fitsy/cardfmt.c367
-rw-r--r--funtools/fitsy/cardins.c107
-rw-r--r--funtools/fitsy/cardpar.c173
-rwxr-xr-xfuntools/fitsy/compat/install-sh238
-rw-r--r--funtools/fitsy/conf.h.in59
-rw-r--r--funtools/fitsy/config.guess1435
-rw-r--r--funtools/fitsy/config.sub1807
-rwxr-xr-xfuntools/fitsy/configure-failsafe6199
-rw-r--r--funtools/fitsy/configure.ac168
-rw-r--r--funtools/fitsy/data95
-rw-r--r--funtools/fitsy/dataimage.c221
-rw-r--r--funtools/fitsy/datatable.c15
-rw-r--r--funtools/fitsy/doc/basicval.html77
-rw-r--r--funtools/fitsy/doc/basicval.wu62
-rw-r--r--funtools/fitsy/doc/cardfind.html112
-rw-r--r--funtools/fitsy/doc/cardfind.wu85
-rw-r--r--funtools/fitsy/doc/cardfmt.html181
-rw-r--r--funtools/fitsy/doc/cardfmt.wu144
-rw-r--r--funtools/fitsy/doc/cardins.html99
-rw-r--r--funtools/fitsy/doc/cardins.wu72
-rw-r--r--funtools/fitsy/doc/cardpar.html134
-rw-r--r--funtools/fitsy/doc/cardpar.wu99
-rw-r--r--funtools/fitsy/doc/dataimage.html58
-rw-r--r--funtools/fitsy/doc/dataimage.wu37
-rw-r--r--funtools/fitsy/doc/examples.wu36
-rw-r--r--funtools/fitsy/doc/fitsimage.html72
-rw-r--r--funtools/fitsy/doc/fitsimage.wu49
-rw-r--r--funtools/fitsy/doc/fitsy.html78
-rw-r--r--funtools/fitsy/doc/fitsy.pnuts20
-rw-r--r--funtools/fitsy/doc/fitsy.wu43
-rw-r--r--funtools/fitsy/doc/ftimage.wu41
-rw-r--r--funtools/fitsy/doc/fttable.wu35
-rw-r--r--funtools/fitsy/doc/headdata.html63
-rw-r--r--funtools/fitsy/doc/headdata.wu40
-rw-r--r--funtools/fitsy/doc/headfile.html67
-rw-r--r--funtools/fitsy/doc/headfile.wu45
-rw-r--r--funtools/fitsy/doc/headfind.html96
-rw-r--r--funtools/fitsy/doc/headfind.wu69
-rw-r--r--funtools/fitsy/doc/headget.html104
-rw-r--r--funtools/fitsy/doc/headget.wu79
-rw-r--r--funtools/fitsy/doc/headimage.html99
-rw-r--r--funtools/fitsy/doc/headimage.wu71
-rw-r--r--funtools/fitsy/doc/headinit.html115
-rw-r--r--funtools/fitsy/doc/headinit.wu86
-rw-r--r--funtools/fitsy/doc/headins.html128
-rw-r--r--funtools/fitsy/doc/headins.wu96
-rw-r--r--funtools/fitsy/doc/headset.html103
-rw-r--r--funtools/fitsy/doc/headset.wu78
-rw-r--r--funtools/fitsy/doc/headtable.html60
-rw-r--r--funtools/fitsy/doc/headtable.wu38
-rw-r--r--funtools/fitsy/doc/imageval.html42
-rw-r--r--funtools/fitsy/doc/imageval.wu27
-rw-r--r--funtools/fitsy/doc/makefile-sao51
-rw-r--r--funtools/fitsy/doc/tableval.html56
-rw-r--r--funtools/fitsy/doc/tableval.wu41
-rw-r--r--funtools/fitsy/fitsfile.c65
-rw-r--r--funtools/fitsy/fitshead.c483
-rw-r--r--funtools/fitsy/fitsimage.c392
-rw-r--r--funtools/fitsy/fitsy.h393
-rw-r--r--funtools/fitsy/ftacht.c112
-rw-r--r--funtools/fitsy/ftacht2.c151
-rw-r--r--funtools/fitsy/generic.h30
-rw-r--r--funtools/fitsy/headdata.c67
-rw-r--r--funtools/fitsy/headfile.c147
-rw-r--r--funtools/fitsy/headfind.c86
-rw-r--r--funtools/fitsy/headget.c126
-rw-r--r--funtools/fitsy/headimage.c274
-rw-r--r--funtools/fitsy/headinit.c256
-rw-r--r--funtools/fitsy/headins.c205
-rw-r--r--funtools/fitsy/headset.c132
-rw-r--r--funtools/fitsy/headsimple.c30
-rw-r--r--funtools/fitsy/headtable.c299
-rw-r--r--funtools/fitsy/headwcs.c91
-rwxr-xr-xfuntools/fitsy/install-sh276
-rw-r--r--funtools/fitsy/inverse.c93
-rw-r--r--funtools/fitsy/longlong.h12
-rw-r--r--funtools/fitsy/nd.c51
-rw-r--r--funtools/fitsy/parse.c196
-rw-r--r--funtools/fitsy/ptest.c28
-rw-r--r--funtools/fitsy/tableheader.c230
-rw-r--r--funtools/fitsy/xfile.h20
-rw-r--r--funtools/fitsy/xos.h226
-rwxr-xr-xfuntools/fun2table7
-rw-r--r--funtools/funcalc.c358
-rw-r--r--funtools/funcalc.sed11
-rw-r--r--funtools/funcen.c830
-rw-r--r--funtools/funcnts.c1693
-rwxr-xr-xfuntools/funcnts_plot.tmpl171
-rwxr-xr-xfuntools/funcnts_sed.tmpl4
-rw-r--r--funtools/funcol.c1461
-rw-r--r--funtools/funcone.c1473
-rw-r--r--funtools/funcopy.c364
-rw-r--r--funtools/fundisp.c1126
-rwxr-xr-xfuntools/funds9.tmpl180
-rw-r--r--funtools/funhead.c369
-rw-r--r--funtools/funhist.c632
-rwxr-xr-xfuntools/funhist_plot.tmpl137
-rw-r--r--funtools/funim.c1680
-rw-r--r--funtools/funimage.c581
-rwxr-xr-xfuntools/funindex.tmpl98
-rw-r--r--funtools/funinfo.c541
-rw-r--r--funtools/funjoin.c1172
-rw-r--r--funtools/funmainlib.c48
-rw-r--r--funtools/funmerge.c539
-rw-r--r--funtools/funopen.c806
-rw-r--r--funtools/funopenp.c1065
-rw-r--r--funtools/funparam.c804
-rw-r--r--funtools/funsky.c618
-rw-r--r--funtools/funtab.c1412
-rw-r--r--funtools/funtable.c609
-rwxr-xr-xfuntools/funtbl.tmpl202
-rw-r--r--funtools/funtclmainlib.c46
-rw-r--r--funtools/funtest/Makefile.in274
-rw-r--r--funtools/funtest/arg3.inc1
-rw-r--r--funtools/funtest/asc2fits.c85
-rw-r--r--funtools/funtest/ascii2fits.c99
-rw-r--r--funtools/funtest/avg2
-rw-r--r--funtools/funtest/bigfits.c87
-rw-r--r--funtools/funtest/bpix.ev3
-rw-r--r--funtools/funtest/cat.ls3
-rw-r--r--funtools/funtest/cat.txt102
-rw-r--r--funtools/funtest/comm15
-rw-r--r--funtools/funtest/conf.h.in56
-rw-r--r--funtools/funtest/evcol.c130
-rw-r--r--funtools/funtest/evcre.c115
-rw-r--r--funtools/funtest/evmerge.c77
-rw-r--r--funtools/funtest/evmerge2.c124
-rw-r--r--funtools/funtest/evnext.c116
-rw-r--r--funtools/funtest/evread.c363
-rw-r--r--funtools/funtest/evreplace.c96
-rw-r--r--funtools/funtest/evtest.c82
-rwxr-xr-xfuntools/funtest/fctest4
-rw-r--r--funtools/funtest/filt.c147
-rw-r--r--funtools/funtest/funcalc.sed11
-rwxr-xr-xfuntools/funtest/funcheck10
-rwxr-xr-xfuntools/funtest/funchecks6
-rwxr-xr-xfuntools/funtest/funcones61
-rw-r--r--funtools/funtest/fundisp1out0
-rw-r--r--funtools/funtest/funsky.c238
-rwxr-xr-xfuntools/funtest/funstack86
-rwxr-xr-xfuntools/funtest/funtest195
-rwxr-xr-xfuntools/funtest/funtesti18
-rwxr-xr-xfuntools/funtest/funtests127
-rwxr-xr-xfuntools/funtest/funtexts14
-rw-r--r--funtools/funtest/funtools1.vu10
-rw-r--r--funtools/funtest/funtools2.vu11
-rw-r--r--funtools/funtest/goo.ls0
-rw-r--r--funtools/funtest/group.calc125
-rw-r--r--funtools/funtest/imblank.c107
-rw-r--r--funtools/funtest/imtest.c156
-rwxr-xr-xfuntools/funtest/install-sh276
-rw-r--r--funtools/funtest/mif.lst4
-rw-r--r--funtools/funtest/mif1.fits2
-rw-r--r--funtools/funtest/mif2.fits2
-rw-r--r--funtools/funtest/mif3.fits2
-rw-r--r--funtools/funtest/mif4.fits2
-rw-r--r--funtools/funtest/mkdim.c96
-rw-r--r--funtools/funtest/mkev.c335
-rw-r--r--funtools/funtest/mkev2.c53
-rw-r--r--funtools/funtest/ntest.ev98
-rwxr-xr-xfuntools/funtest/nwcs109
-rw-r--r--funtools/funtest/parse.in24
-rw-r--r--funtools/funtest/pr8
-rw-r--r--funtools/funtest/qcon.c123
-rw-r--r--funtools/funtest/resample.fc70
-rw-r--r--funtools/funtest/sample.fc13
-rw-r--r--funtools/funtest/snr100.reg100
-rw-r--r--funtools/funtest/snr400.reg400
-rw-r--r--funtools/funtest/snr900.reg900
-rw-r--r--funtools/funtest/swap5
-rw-r--r--funtools/funtest/swap18
-rw-r--r--funtools/funtest/t1.reg6
-rw-r--r--funtools/funtest/t2.reg5
-rw-r--r--funtools/funtest/t3.reg4
-rw-r--r--funtools/funtest/t4.reg1
-rw-r--r--funtools/funtest/tboxell.in50
-rw-r--r--funtools/funtest/tcalc.in14
-rw-r--r--funtools/funtest/tcols.in56
-rw-r--r--funtools/funtest/tcone.in8
-rwxr-xr-xfuntools/funtest/tenv24
-rw-r--r--funtools/funtest/test.asc298
-rw-r--r--funtools/funtest/test.ev62
-rw-r--r--funtools/funtest/test.fitsbin5760 -> 0 bytes
-rw-r--r--funtools/funtest/test2.ev113
-rw-r--r--funtools/funtest/test2.rawbin3770 -> 0 bytes
-rwxr-xr-xfuntools/funtest/tevread93
-rw-r--r--funtools/funtest/tfile.in17
-rwxr-xr-xfuntools/funtest/tfuncalc178
-rwxr-xr-xfuntools/funtest/tfuncnts307
-rwxr-xr-xfuntools/funtest/tfuncone131
-rwxr-xr-xfuntools/funtest/tfundisp227
-rwxr-xr-xfuntools/funtest/tfunhead241
-rwxr-xr-xfuntools/funtest/tfunimage227
-rwxr-xr-xfuntools/funtest/tfunmerge126
-rwxr-xr-xfuntools/funtest/tfuntext140
-rwxr-xr-xfuntools/funtest/tfunview163
-rw-r--r--funtools/funtest/thead.in12
-rwxr-xr-xfuntools/funtest/timev264
-rw-r--r--funtools/funtest/tmerge.in16
-rw-r--r--funtools/funtest/tnum.in9
-rw-r--r--funtools/funtest/tparen.in50
-rw-r--r--funtools/funtest/tregions.in67
-rw-r--r--funtools/funtest/tsections.in11
-rw-r--r--funtools/funtest/ttext.in91
-rw-r--r--funtools/funtest/tview.in11
-rw-r--r--funtools/funtest/twcs.c61
-rw-r--r--funtools/funtest/unwcs.in12
-rw-r--r--funtools/funtest/wcs.in12
-rw-r--r--funtools/funtest/wtest.c123
-rw-r--r--funtools/funtest/x.fits1
-rw-r--r--funtools/funtext.c1194
-rw-r--r--funtools/funtools.h240
-rw-r--r--funtools/funtools.pc.in10
-rw-r--r--funtools/funtoolsP.h343
-rw-r--r--funtools/funtools_ds9.tmpl143
-rw-r--r--funtools/funutil.c857
-rw-r--r--funtools/funview.c632
-rw-r--r--funtools/funwcs.c130
-rw-r--r--funtools/gnu/COPYING340
-rw-r--r--funtools/gnu/Makefile.in150
-rw-r--r--funtools/gnu/conf.h.in59
-rw-r--r--funtools/gnu/copyright29
-rwxr-xr-xfuntools/gnu/install-sh276
-rw-r--r--funtools/gnu/sort.c2879
-rw-r--r--funtools/gnu/sorttest.c152
-rw-r--r--funtools/gnu/system.h187
-rwxr-xr-xfuntools/inc.sed12
-rwxr-xr-xfuntools/install-sh276
-rw-r--r--funtools/jointable.c932
-rw-r--r--funtools/lex.calc.c2951
-rw-r--r--funtools/man/man1/funcalc.1622
-rw-r--r--funtools/man/man1/funcen.1250
-rw-r--r--funtools/man/man1/funcnts.1806
-rw-r--r--funtools/man/man1/funcone.1285
-rw-r--r--funtools/man/man1/fundisp.1589
-rw-r--r--funtools/man/man1/funhead.1287
-rw-r--r--funtools/man/man1/funhist.1370
-rw-r--r--funtools/man/man1/funimage.1428
-rw-r--r--funtools/man/man1/funindex.1179
-rw-r--r--funtools/man/man1/funjoin.1326
-rw-r--r--funtools/man/man1/funmerge.1215
-rw-r--r--funtools/man/man1/funsky.1385
-rw-r--r--funtools/man/man1/funtable.1356
-rw-r--r--funtools/man/man1/funtbl.1249
-rw-r--r--funtools/man/man3/funclose.3160
-rw-r--r--funtools/man/man3/funcolumnactivate.3330
-rw-r--r--funtools/man/man3/funcolumnlookup.3220
-rw-r--r--funtools/man/man3/funcolumnselect.3664
-rw-r--r--funtools/man/man3/funflush.3212
-rw-r--r--funtools/man/man3/funimageget.3332
-rw-r--r--funtools/man/man3/funimageput.3225
-rw-r--r--funtools/man/man3/funimagerowget.3215
-rw-r--r--funtools/man/man3/funimagerowput.3202
-rw-r--r--funtools/man/man3/funinfoget.3335
-rw-r--r--funtools/man/man3/funinfoput.3246
-rw-r--r--funtools/man/man3/funlib.3525
-rw-r--r--funtools/man/man3/funopen.3272
-rw-r--r--funtools/man/man3/funparamget.3262
-rw-r--r--funtools/man/man3/funparamput.3256
-rw-r--r--funtools/man/man3/funref.3287
-rw-r--r--funtools/man/man3/funtablerowget.3216
-rw-r--r--funtools/man/man3/funtablerowput.3297
-rw-r--r--funtools/man/man7/funcombine.7248
-rw-r--r--funtools/man/man7/funds9.7216
-rw-r--r--funtools/man/man7/funenv.7352
-rw-r--r--funtools/man/man7/funfiles.7802
-rw-r--r--funtools/man/man7/funfilters.7464
-rw-r--r--funtools/man/man7/funidx.7327
-rw-r--r--funtools/man/man7/funregions.7678
-rw-r--r--funtools/man/man7/funtext.7713
-rw-r--r--funtools/man/man7/funtools.7379
-rw-r--r--funtools/man/man7/funview.7523
-rw-r--r--funtools/man/man7/regalgebra.7400
-rw-r--r--funtools/man/man7/regbounds.7305
-rw-r--r--funtools/man/man7/regcoords.7345
-rw-r--r--funtools/man/man7/regdiff.7181
-rw-r--r--funtools/man/man7/reggeometry.71271
-rwxr-xr-xfuntools/mkconfigure23
-rwxr-xr-xfuntools/mkfunmainlib68
-rwxr-xr-xfuntools/mklib880
-rw-r--r--funtools/notes/ds9.notes90
-rw-r--r--funtools/notes/index.notes30
-rw-r--r--funtools/notes/mainlib.notes68
-rw-r--r--funtools/notes/mingw.notes12
-rw-r--r--funtools/notes/tcl.notes10
-rw-r--r--funtools/notes/text.notes29
-rw-r--r--funtools/notes/view.notes261
-rw-r--r--funtools/ofuntools.h240
-rw-r--r--funtools/pkgIndex.tcl11
-rwxr-xr-xfuntools/saoconfig235
-rw-r--r--funtools/scan.c231
-rw-r--r--funtools/search.c1107
-rw-r--r--funtools/tabcalc.c296
-rw-r--r--funtools/tabcalc_c.h1
-rw-r--r--funtools/tcl.m42464
-rw-r--r--funtools/test.tcl13
-rwxr-xr-xfuntools/tfunjoin37
-rw-r--r--funtools/tmain.c272
-rw-r--r--funtools/tmain.tcl1
-rw-r--r--funtools/tperl.c39
-rw-r--r--funtools/txt/bar.txt23
-rw-r--r--funtools/txt/blank.txt1
-rw-r--r--funtools/txt/blank2.txt2
-rw-r--r--funtools/txt/comma.txt24
-rw-r--r--funtools/txt/comma2.txt24
-rw-r--r--funtools/txt/comma3.txt33
-rw-r--r--funtools/txt/crcomma.txt1
-rwxr-xr-xfuntools/txt/crnl20
-rw-r--r--funtools/txt/crspace.txt1
-rw-r--r--funtools/txt/crtab.txt1
-rw-r--r--funtools/txt/eot.txt25
-rw-r--r--funtools/txt/eot2.txt26
-rw-r--r--funtools/txt/foo112
-rw-r--r--funtools/txt/foo212
-rw-r--r--funtools/txt/headone.txt2
-rw-r--r--funtools/txt/int64.fitsbin8640 -> 0 bytes
-rw-r--r--funtools/txt/int64.tab17
-rw-r--r--funtools/txt/int64_Value.idxbin8640 -> 0 bytes
-rw-r--r--funtools/txt/nlcomma.txt23
-rwxr-xr-xfuntools/txt/nlcr20
-rw-r--r--funtools/txt/nltab.txt23
-rw-r--r--funtools/txt/null.tab6
-rw-r--r--funtools/txt/one.txt1
-rw-r--r--funtools/txt/rdb.txt26
-rw-r--r--funtools/txt/sex.tab244
-rw-r--r--funtools/txt/space.txt24
-rw-r--r--funtools/txt/sptab.txt24
-rw-r--r--funtools/txt/tab.txt26
-rw-r--r--funtools/txt/test.fitsbin14400 -> 0 bytes
-rw-r--r--funtools/txt/vis.tab175
-rw-r--r--funtools/util/Makefile.in276
-rw-r--r--funtools/util/NaN.h.in70
-rw-r--r--funtools/util/ac_c_long_long.m436
-rw-r--r--funtools/util/aclocal.m42
-rw-r--r--funtools/util/conf.h.in80
-rw-r--r--funtools/util/config.guess1435
-rw-r--r--funtools/util/config.sub1807
-rwxr-xr-xfuntools/util/configure-failsafe7191
-rw-r--r--funtools/util/configure.ac196
-rw-r--r--funtools/util/file.c629
-rw-r--r--funtools/util/file.h53
-rw-r--r--funtools/util/find.c456
-rw-r--r--funtools/util/find.h40
-rw-r--r--funtools/util/gcat.c284
-rw-r--r--funtools/util/gio.c2314
-rw-r--r--funtools/util/gio.h162
-rwxr-xr-xfuntools/util/install-sh276
-rw-r--r--funtools/util/iraf_zprocess.c469
-rw-r--r--funtools/util/longlong.h12
-rw-r--r--funtools/util/macro.c216
-rw-r--r--funtools/util/macro.h43
-rw-r--r--funtools/util/mainlib.c790
-rw-r--r--funtools/util/mainlib.h130
-rw-r--r--funtools/util/mkrtemp.c113
-rw-r--r--funtools/util/mkrtemp.h56
-rw-r--r--funtools/util/nan.c65
-rw-r--r--funtools/util/parse.c1187
-rw-r--r--funtools/util/parse.h171
-rw-r--r--funtools/util/prsetup.h66
-rw-r--r--funtools/util/strtod.c190
-rw-r--r--funtools/util/strtod.h22
-rw-r--r--funtools/util/swap.c228
-rw-r--r--funtools/util/swap.h37
-rw-r--r--funtools/util/tcl.m42464
-rw-r--r--funtools/util/tclmainlib.c504
-rw-r--r--funtools/util/tclmainlib.h31
-rw-r--r--funtools/util/tlaunch.c98
-rw-r--r--funtools/util/tlaunch2.c59
-rw-r--r--funtools/util/tparse.c89
-rw-r--r--funtools/util/winprocess.c317
-rw-r--r--funtools/util/winprocess.h44
-rw-r--r--funtools/util/word.c1097
-rw-r--r--funtools/util/word.h59
-rw-r--r--funtools/util/xalloc.c117
-rw-r--r--funtools/util/xalloc.h51
-rw-r--r--funtools/util/xfileio.h23
-rw-r--r--funtools/util/xlaunch.c657
-rw-r--r--funtools/util/xlaunch.h84
-rw-r--r--funtools/util/xport.h140
-rw-r--r--funtools/util/zlib-1.2.3/ChangeLog855
-rw-r--r--funtools/util/zlib-1.2.3/FAQ339
-rw-r--r--funtools/util/zlib-1.2.3/INDEX51
-rw-r--r--funtools/util/zlib-1.2.3/Makefile154
-rw-r--r--funtools/util/zlib-1.2.3/Makefile.in154
-rw-r--r--funtools/util/zlib-1.2.3/README125
-rw-r--r--funtools/util/zlib-1.2.3/adler32.c149
-rw-r--r--funtools/util/zlib-1.2.3/algorithm.txt209
-rw-r--r--funtools/util/zlib-1.2.3/amiga/Makefile.pup66
-rw-r--r--funtools/util/zlib-1.2.3/amiga/Makefile.sas65
-rw-r--r--funtools/util/zlib-1.2.3/as400/bndsrc132
-rw-r--r--funtools/util/zlib-1.2.3/as400/compile.clp123
-rw-r--r--funtools/util/zlib-1.2.3/as400/readme.txt111
-rw-r--r--funtools/util/zlib-1.2.3/as400/zlib.inc331
-rw-r--r--funtools/util/zlib-1.2.3/compress.c79
-rwxr-xr-xfuntools/util/zlib-1.2.3/configure459
-rw-r--r--funtools/util/zlib-1.2.3/contrib/README.contrib71
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/buffer_demo.adb106
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/mtest.adb156
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/read.adb156
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/readme.txt65
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/test.adb463
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.adb225
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.ads114
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.adb141
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.ads450
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib.adb701
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib.ads328
-rw-r--r--funtools/util/zlib-1.2.3/contrib/ada/zlib.gpr20
-rw-r--r--funtools/util/zlib-1.2.3/contrib/asm586/README.58643
-rw-r--r--funtools/util/zlib-1.2.3/contrib/asm586/match.S364
-rw-r--r--funtools/util/zlib-1.2.3/contrib/asm686/README.68634
-rw-r--r--funtools/util/zlib-1.2.3/contrib/asm686/match.S329
-rw-r--r--funtools/util/zlib-1.2.3/contrib/blast/Makefile8
-rw-r--r--funtools/util/zlib-1.2.3/contrib/blast/README4
-rw-r--r--funtools/util/zlib-1.2.3/contrib/blast/blast.c444
-rw-r--r--funtools/util/zlib-1.2.3/contrib/blast/blast.h71
-rw-r--r--funtools/util/zlib-1.2.3/contrib/blast/test.pkbin8 -> 0 bytes
-rw-r--r--funtools/util/zlib-1.2.3/contrib/blast/test.txt1
-rw-r--r--funtools/util/zlib-1.2.3/contrib/delphi/ZLib.pas557
-rw-r--r--funtools/util/zlib-1.2.3/contrib/delphi/ZLibConst.pas11
-rw-r--r--funtools/util/zlib-1.2.3/contrib/delphi/readme.txt76
-rw-r--r--funtools/util/zlib-1.2.3/contrib/delphi/zlibd32.mak93
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.build33
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.sln21
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs58
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs202
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CircularBuffer.cs83
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CodecBase.cs198
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Deflater.cs106
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.cs288
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.csproj141
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/GZipStream.cs301
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Inflater.cs105
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/UnitTests.cs274
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/LICENSE_1_0.txt23
-rw-r--r--funtools/util/zlib-1.2.3/contrib/dotzlib/readme.txt58
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/README1
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/infback9.c608
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/infback9.h37
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/inffix9.h107
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/inflate9.h47
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/inftree9.c323
-rw-r--r--funtools/util/zlib-1.2.3/contrib/infback9/inftree9.h55
-rw-r--r--funtools/util/zlib-1.2.3/contrib/inflate86/inffas86.c1157
-rw-r--r--funtools/util/zlib-1.2.3/contrib/inflate86/inffast.S1368
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream/test.cpp24
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream/zfstream.cpp329
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream/zfstream.h128
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream2/zstream.h307
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream2/zstream_test.cpp25
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream3/README35
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream3/TODO17
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream3/test.cc50
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.cc479
-rw-r--r--funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.h466
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masm686/match.asm413
-rwxr-xr-xfuntools/util/zlib-1.2.3/contrib/masmx64/bld_ml64.bat2
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.asm513
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.objbin4119 -> 0 bytes
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx64/inffas8664.c186
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.asm392
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.objbin5913 -> 0 bytes
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx64/readme.txt28
-rwxr-xr-xfuntools/util/zlib-1.2.3/contrib/masmx86/bld_ml32.bat2
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32.asm972
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32c.c62
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx86/inffas32.asm1083
-rwxr-xr-xfuntools/util/zlib-1.2.3/contrib/masmx86/mkasm.bat3
-rw-r--r--funtools/util/zlib-1.2.3/contrib/masmx86/readme.txt21
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/ChangeLogUnzip67
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/Makefile25
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/crypt.h132
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/ioapi.c177
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/ioapi.h75
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/iowin32.c270
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/iowin32.h21
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/miniunz.c585
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/minizip.c420
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/mztools.c281
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/mztools.h31
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/unzip.c1598
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/unzip.h354
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/zip.c1219
-rw-r--r--funtools/util/zlib-1.2.3/contrib/minizip/zip.h235
-rw-r--r--funtools/util/zlib-1.2.3/contrib/pascal/example.pas599
-rw-r--r--funtools/util/zlib-1.2.3/contrib/pascal/readme.txt76
-rw-r--r--funtools/util/zlib-1.2.3/contrib/pascal/zlibd32.mak93
-rw-r--r--funtools/util/zlib-1.2.3/contrib/pascal/zlibpas.pas236
-rw-r--r--funtools/util/zlib-1.2.3/contrib/puff/Makefile8
-rw-r--r--funtools/util/zlib-1.2.3/contrib/puff/README63
-rw-r--r--funtools/util/zlib-1.2.3/contrib/puff/puff.c837
-rw-r--r--funtools/util/zlib-1.2.3/contrib/puff/puff.h31
-rw-r--r--funtools/util/zlib-1.2.3/contrib/puff/zeros.rawbin1213 -> 0 bytes
-rw-r--r--funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.c275
-rw-r--r--funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.txt10
-rw-r--r--funtools/util/zlib-1.2.3/contrib/untgz/Makefile14
-rw-r--r--funtools/util/zlib-1.2.3/contrib/untgz/Makefile.msc17
-rw-r--r--funtools/util/zlib-1.2.3/contrib/untgz/untgz.c674
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/readme.txt73
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/miniunz.vcproj126
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/minizip.vcproj126
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/testzlib.vcproj126
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlib.rc32
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibstat.vcproj246
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.def92
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.sln78
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.vcproj445
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/miniunz.vcproj566
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/minizip.vcproj563
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlib.vcproj948
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlibdll.vcproj567
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlib.rc32
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibstat.vcproj870
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.def92
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.sln144
-rw-r--r--funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.vcproj1219
-rw-r--r--funtools/util/zlib-1.2.3/crc32.c423
-rw-r--r--funtools/util/zlib-1.2.3/crc32.h441
-rw-r--r--funtools/util/zlib-1.2.3/deflate.c1736
-rw-r--r--funtools/util/zlib-1.2.3/deflate.h331
-rw-r--r--funtools/util/zlib-1.2.3/example.c565
-rw-r--r--funtools/util/zlib-1.2.3/examples/README.examples42
-rw-r--r--funtools/util/zlib-1.2.3/examples/fitblk.c233
-rw-r--r--funtools/util/zlib-1.2.3/examples/gun.c693
-rw-r--r--funtools/util/zlib-1.2.3/examples/gzappend.c500
-rw-r--r--funtools/util/zlib-1.2.3/examples/gzjoin.c448
-rw-r--r--funtools/util/zlib-1.2.3/examples/gzlog.c413
-rw-r--r--funtools/util/zlib-1.2.3/examples/gzlog.h58
-rw-r--r--funtools/util/zlib-1.2.3/examples/zlib_how.html523
-rw-r--r--funtools/util/zlib-1.2.3/examples/zpipe.c191
-rw-r--r--funtools/util/zlib-1.2.3/examples/zran.c404
-rw-r--r--funtools/util/zlib-1.2.3/gzio.c1026
-rw-r--r--funtools/util/zlib-1.2.3/infback.c623
-rw-r--r--funtools/util/zlib-1.2.3/inffast.c318
-rw-r--r--funtools/util/zlib-1.2.3/inffast.h11
-rw-r--r--funtools/util/zlib-1.2.3/inffixed.h94
-rw-r--r--funtools/util/zlib-1.2.3/inflate.c1368
-rw-r--r--funtools/util/zlib-1.2.3/inflate.h115
-rw-r--r--funtools/util/zlib-1.2.3/inftrees.c329
-rw-r--r--funtools/util/zlib-1.2.3/inftrees.h55
-rwxr-xr-xfuntools/util/zlib-1.2.3/make_vms.com461
-rw-r--r--funtools/util/zlib-1.2.3/minigzip.c322
-rw-r--r--funtools/util/zlib-1.2.3/msdos/Makefile.bor109
-rw-r--r--funtools/util/zlib-1.2.3/msdos/Makefile.dj2104
-rw-r--r--funtools/util/zlib-1.2.3/msdos/Makefile.emx69
-rw-r--r--funtools/util/zlib-1.2.3/msdos/Makefile.msc106
-rw-r--r--funtools/util/zlib-1.2.3/msdos/Makefile.tc94
-rw-r--r--funtools/util/zlib-1.2.3/old/Makefile.riscos151
-rw-r--r--funtools/util/zlib-1.2.3/old/README3
-rw-r--r--funtools/util/zlib-1.2.3/old/descrip.mms48
-rw-r--r--funtools/util/zlib-1.2.3/old/os2/Makefile.os2136
-rw-r--r--funtools/util/zlib-1.2.3/old/os2/zlib.def51
-rw-r--r--funtools/util/zlib-1.2.3/old/visual-basic.txt160
-rw-r--r--funtools/util/zlib-1.2.3/old/zlib.html971
-rw-r--r--funtools/util/zlib-1.2.3/projects/README.projects41
-rw-r--r--funtools/util/zlib-1.2.3/projects/visualc6/README.txt73
-rw-r--r--funtools/util/zlib-1.2.3/projects/visualc6/example.dsp278
-rw-r--r--funtools/util/zlib-1.2.3/projects/visualc6/minigzip.dsp278
-rw-r--r--funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsp609
-rw-r--r--funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsw59
-rw-r--r--funtools/util/zlib-1.2.3/qnx/package.qpg141
-rw-r--r--funtools/util/zlib-1.2.3/trees.c1219
-rw-r--r--funtools/util/zlib-1.2.3/trees.h128
-rw-r--r--funtools/util/zlib-1.2.3/uncompr.c61
-rw-r--r--funtools/util/zlib-1.2.3/win32/DLL_FAQ.txt397
-rw-r--r--funtools/util/zlib-1.2.3/win32/Makefile.bor107
-rw-r--r--funtools/util/zlib-1.2.3/win32/Makefile.emx69
-rw-r--r--funtools/util/zlib-1.2.3/win32/Makefile.gcc141
-rw-r--r--funtools/util/zlib-1.2.3/win32/Makefile.msc126
-rw-r--r--funtools/util/zlib-1.2.3/win32/VisualC.txt3
-rw-r--r--funtools/util/zlib-1.2.3/win32/zlib.def60
-rw-r--r--funtools/util/zlib-1.2.3/win32/zlib1.rc39
-rw-r--r--funtools/util/zlib-1.2.3/zconf.h332
-rw-r--r--funtools/util/zlib-1.2.3/zconf.in.h332
-rw-r--r--funtools/util/zlib-1.2.3/zlib.3159
-rw-r--r--funtools/util/zlib-1.2.3/zlib.h1357
-rw-r--r--funtools/util/zlib-1.2.3/zutil.c318
-rw-r--r--funtools/util/zlib-1.2.3/zutil.h269
-rw-r--r--funtools/util/zprocess.c373
-rw-r--r--funtools/util/zprocess.h44
-rw-r--r--funtools/wcs/COPYING460
-rw-r--r--funtools/wcs/Files179
-rw-r--r--funtools/wcs/Makefile-orig36
-rw-r--r--funtools/wcs/Makefile.in206
-rw-r--r--funtools/wcs/NEWS473
-rw-r--r--funtools/wcs/Readme36
-rw-r--r--funtools/wcs/cel.c474
-rw-r--r--funtools/wcs/conf.h.in56
-rw-r--r--funtools/wcs/config.guess1435
-rw-r--r--funtools/wcs/config.sub1807
-rwxr-xr-xfuntools/wcs/configure-failsafe6222
-rw-r--r--funtools/wcs/configure.ac177
-rw-r--r--funtools/wcs/dateutil.c4554
-rw-r--r--funtools/wcs/distort.c407
-rw-r--r--funtools/wcs/dsspos.c318
-rw-r--r--funtools/wcs/fileutil.c818
-rw-r--r--funtools/wcs/fitsfile.c2308
-rw-r--r--funtools/wcs/fitsfile.h1286
-rw-r--r--funtools/wcs/fitshead.h438
-rw-r--r--funtools/wcs/hget.c1913
-rw-r--r--funtools/wcs/hput.c1316
-rw-r--r--funtools/wcs/iget.c531
-rw-r--r--funtools/wcs/imhfile.c1941
-rw-r--r--funtools/wcs/imio.c1543
-rw-r--r--funtools/wcs/imio.h64
-rwxr-xr-xfuntools/wcs/install-sh276
-rw-r--r--funtools/wcs/lin.c448
-rw-r--r--funtools/wcs/platepos.c391
-rw-r--r--funtools/wcs/poly.c914
-rw-r--r--funtools/wcs/proj.c4527
-rw-r--r--funtools/wcs/slasubs.c364
-rw-r--r--funtools/wcs/sph.c234
-rw-r--r--funtools/wcs/tnxpos.c1234
-rw-r--r--funtools/wcs/wcs.c2994
-rw-r--r--funtools/wcs/wcs.h963
-rw-r--r--funtools/wcs/wcscon.c2328
-rw-r--r--funtools/wcs/wcsinit.c1611
-rw-r--r--funtools/wcs/wcslib.c1334
-rw-r--r--funtools/wcs/wcslib.h476
-rw-r--r--funtools/wcs/wcstrig.c189
-rw-r--r--funtools/wcs/worldpos.c693
-rw-r--r--funtools/wcs/zpxpos.c735
800 files changed, 0 insertions, 314452 deletions
diff --git a/funtools/.gitignore b/funtools/.gitignore
deleted file mode 100644
index b31e331..0000000
--- a/funtools/.gitignore
+++ /dev/null
@@ -1,45 +0,0 @@
-*.[oa]
-*~
-*.so
-*.bak
-*.pyc
-*-orig
-*-sav
-foo*
-goo*
-node.log
-Makefile
-conf.h
-config.status
-config.log
-config.cache
-debug.html
-js9
-js9helper.pc
-.DS_Store
-funcalc
-funcen
-funcnts
-funcnts.plot
-funcnts.sed
-funcone
-fundisp
-funds9
-funhead
-funhist
-funhist.plot
-funimage
-funindex
-funjoin
-funmerge
-funsky
-funtable
-funtbl
-funtools.ds9
-funtools.pc
-gcat
-configure
-gnu/_funsort
-util/NaN.h
-autom4te.cache
-a.out.dSYM
diff --git a/funtools/COPYING b/funtools/COPYING
deleted file mode 100644
index b1e3f5a..0000000
--- a/funtools/COPYING
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/funtools/INSTALL b/funtools/INSTALL
deleted file mode 100644
index 6301ff9..0000000
--- a/funtools/INSTALL
+++ /dev/null
@@ -1,312 +0,0 @@
-Quick Summary
-=============
-
-To build and install the Funtools package, simply execute:
-
- ./mkconfigure # generate all configure scripts
- ./configure # site-specific configuration
- make # build the software
- make install # install it
- make clean # clean up unneeded temp files
-
-The configure scripts are not part of the GitHub repository, so you must
-generate them for your site (you might need to install autoconf for this
-purpose):
-
- ./mkconfigure
-
-You might want to install in a directory other than /usr/local, so as not to
-require root access. To do this, configure for a different install directory:
-
- ./configure --prefix=<top_level_install_dir>
-e.g.,
- ./configure --prefix=/soft/saord
-
-Programs will be installed in /soft/saord/bin, libraries in /soft/saord/lib,
-and include files in /soft/saord/include. Indeed, we do this at SAO and
-recommend it as a general rule, in order to keep SAORD software in one place
-that does not conflict with other installations. Note that you will need to
-add the bin directory to your path.
-
-The build ("make") takes only a minute or so on modern machines. To
-monitor its progress and/or check for errors, redirect output to a file
-and use the 'tail' command:
-
- make >& foo.log &; tail -f foo.log # csh
-or
- make 1>foo.log 2>&1 &; tail -f foo.log # sh, bash
-
-
-NB: Windows users
-=================
-
-To build funtools on a Windows platform, you first need to install
-the Cygwin package from:
-
- http://cygwin.com/
-
-From the Web page:
-
- Cygwin is a Linux-like environment for Windows. It consists of two
- parts: A DLL (cygwin1.dll) which acts as a Linux API emulation layer
- providing substantial Linux API functionality. A collection of tools
- which provide Linux look and feel.
-
-When installing cygwin, make sure you install 'gcc' and 'make' from the
-Development package. I think that's all you need ...
-
-Details of Installation
-=======================
-
-
-
-NB: These are generic installation instructions, modified for Funtools.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
- The file `configure.in' is used to create `configure' by a program
-called `autoconf'. You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 1. `cd' to the directory containing the package's source code and type
- "./configure". This runs a configuration script created by GNU
- autoconf, which configures Funtools for your system and creates a
- Makefile. The configure script allows you to customize the Funtools
- configuration for your site; for details on how you can do this,
- type "./configure -help" or refer to the autoconf documentation (not
- included here). The Funtools "configure" script supports the following
- special switch(es) in addition to the standard ones:
-
- --enable-shared=yes|link|no
- Build shared libraries in addition to the
- default static library. There are two options:
-
- If the value is "yes", shared libraries are
- built but not used to link xpa programs.
-
- If the value is "link", shared libraries are
- used to link xpa programs. If therefore becomes
- your responsibility to put the shared library
- where it can be found (or use LD_LIBRARY_PATH).
-
- --enable-dl=yes|no
- With gcc available, perform on-the-fly filtering
- by compiling a shared object and dynamically
- loading it into the executable. The default is
- to compile and link a separate slave program.
- (Surprisingly, processing speed is about the
- same for both methods.)
-
- --enable-mainlib=yes|no
- Build funtools mainlib support, which allows
- user programs to call funtools as subroutines.
- This is an experimental interface.
-
- Standard options are listed below. the most important of which
- is --prefix (to specify where to install) and --exec-prefix (where to
- install executables, if the top level is different from where libraries
- and include files are being installed. At SAO, we just use --prefix.
- We recommend --prefix be set to a directory that will hold saord software
- (e.g., --prefix=/soft/saord) in order to make management of our software
- easier.
-
- NB: be sure to use only absolute path names (those starting with "/")
- in the --prefix and --exec_prefix options. (The configure options we
- use at SAO for various machines are given as examples in the script
- file called "saoconfig" in this directory.)
-
- NB: Please avoid use of --prefix with 'make install' to change the
- install directory. We use the original value of --prefix to determine
- where compiled objects are located for linking slave filter programs.
- The slave will look in that directory for imregions.o and evregions.o.
- If you change the install directory, you will not be able to use these
- precompiled objects. Instead, each filter will have to recompile the
- region code.
-
- Compiler flags can be placed on the configure command line after the
- switches. For example, to use the icc compiler under Linux, you can
- configure this way:
-
- ./configure --prefix=... CC=icc CFLAGS="..."
-
- If you are going to be dealing with data files larger than 2Gb,
- you will need to build in large file support. For gcc and many other
- compilers, this is done using the following CFLAGS:
-
- ./configure CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
-
- Of course, you can put other switches into CFLAGS as needed:
-
- ./configure CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -g"
-
- 2. Type `make' to compile the package. This will create the libfuntools.a
- library and the Funtools utility programs (funcnts, fundisp, etc.)
-
- 3. You can build the libxpa.so shared library manually by executing:
-
- make shlib
-
- at this point.
-
- 4. Type "make install" to install Funtools libraries and binaries in
- standard places. You'll need write permission on the installation
- directories to do this. The installation directories are
- determined by the "configure" script and may be specified with
- the --prefix option to "configure". See the Makefile for information
- on what directories were chosen.
-
- 5. There are .html help files in the doc directory. You can copy
- these files to a more convenient location, if you like. We
- did not automate this step because we did not know where to
- copy these files by default. (NB: The help.html file is the
- top level index file.)
-
- 6. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make Distclean'. The latter
- also removes all Makefiles (except the one at the top level).
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. You can give `configure'
-initial values for variables by setting them in the environment:
-
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
-
-You also can use this facility to specify a compiler other than the default
-gcc (if it exists).
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/lib', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH':
-
-e.g.,
- ./configure --prefix=/soft/saord
-
-Programs will be installed in /soft/saord/bin, libraries in /soft/saord/lib,
-and include files in /soft/saord/include. We recommend this as a general rule,
-in order to keep SAORD software in one place that does not conflict with other
-installations. Note that you will need to add the bin directory to your path.
-
- You can specify separate installation prefixes for architecture-specific
-files and architecture-independent files. If you give `configure' the option
-`--exec-prefix=PATH', the package will use PATH as the prefix for installing
-programs and libraries. Documentation and other data files will still use the
-regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on. Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
- CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
- If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
- Use and save the results of the tests in FILE instead of
- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
- debugging `configure'.
-
-`--help'
- Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--version'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
-
-If you have questions, please contact us at: saord@cfa.harvard.edu.
-
- Eric Mandel
-
diff --git a/funtools/Makefile.in b/funtools/Makefile.in
deleted file mode 100644
index ca64f53..0000000
--- a/funtools/Makefile.in
+++ /dev/null
@@ -1,755 +0,0 @@
-#
-# This file is a Makefile for Funtools. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-PACKAGE = @PACKAGE_NAME@
-VERSION = @PACKAGE_VERSION@
-
-DISTNAME = funtools-${VERSION}
-DISTDIR = ../export/${DISTNAME}
-FTPDIR = ../ftp
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT = $(DESTDIR)
-
-# Directory in which to install the .a or .so binary for the FUNTOOLS library:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the program wish:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the funtools.h include file:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include/funtools
-
-# Top-level directory for manual entries:
-MAN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/share/man
-
-# Top-level directory for share entries:
-MAN_SHARE_DIR = $(INSTALL_ROOT)$(prefix)/share/funtools
-
-# util files are in the util subdirectory
-UTIL_INC = -I./util
-# UTIL_LIBS = -L./util -lutil
-
-# fitsy files are in the fitsy subdirectory
-FITSY_INC = -I./fitsy
-# FITSY_LIBS = -L./fitsy -lfitsy
-
-# wcs files are in the wcs subdirectory
-WCS_INC = -I./wcs
-# WCS_LIBS = -L./wcs -lwcs
-
-# filter files are in the filter subdirectory
-FILTER_INC = -I./filter
-# FILTER_LIBS = -L./filter -lfilter
-
-# extra includes for compiling
-INCLUDES = $(UTIL_INC) $(FILTER_INC) $(WCS_INC) $(FITSY_INC)
-
-# extra libs
-EXTRA_LIBS = @EXTRA_LIBS@
-
-# the full set of libraries for linking
-LIBS = $(UTIL_LIBS) $(FILTER_LIBS) $(WCS_LIBS) $(FITSY_LIBS) \
- $(EXTRA_LIBS) -lm
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# whether to set the FPU in double round mode
-USE_FPU_DOUBLE = @USE_FPU_DOUBLE@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# special definitions for funcalc (based on filter configuration)
-FUNCALC_CC = @FILTER_CC@
-FUNCALC_CFLAGS = @FILTER_CFLAGS@
-
-# if enabled-shared was specified, this will exand to "shlib" and trigger
-# building of the shared library
-DOSHARED = @DOSHARED@
-DOMAINLIB = @DOMAINLIB@
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = @srcdir@/install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-# which awk-like program do we have?
-PRE= @PRE@
-POST= @POST@
-AWK = @AWK@
-PIPEGLUE = @PIPEGLUE@
-GUNZIP = @GUNZIP@
-GNUPLOT = @GNUPLOT@
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-EXE = @EXEEXT@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = -I. ${CFLAGS} ${CPPFLAGS} @USE_DL@ ${INCLUDES} ${AC_FLAGS}
-
-DEPEND_SWITCHES = -I. ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-SRCS = funcol.c funcopy.c funtab.c funim.c funinfo.c \
- funopen.c funopenp.c funparam.c funtext.c funwcs.c \
- funview.c funutil.c
-
-OBJS = funcol.o funcopy.o funtab.o funim.o funinfo.o \
- funopen.o funopenp.o funparam.o funtext.o funwcs.o \
- funview.o funutil.o
-
-# these are all the modules going into the "normal" funtools library
-LIBOBJS = ${OBJS}
-
-# the default library for this package
-DEFLIB = @DEFLIB@
-
-# the actual library we are building (if this is a subpackage)
-LIB = @LIB@
-
-# this is used in the link line
-# LLIB = $(LIB)
-LLIB = @LLIB@
-
-# libraries containing main as subroutines
-MAINLIB = lib$(PACKAGE)MainLib.a
-
-PROGS = funcalc funcen funcnts funcone fundisp funhead funhist \
- funimage funjoin funmerge funsky funtable
-
-MAINLIBOBJS = funcalc_main.o funcen_main.o funcnts_main.o funcone_main.o \
- fundisp_main.o funhead_main.o funhist_main.o \
- funimage_main.o funmerge_main.o funsky_main.o funtable_main.o \
- funjoin_main.o
-
-PROGS2 = _sort
-
-TEMPLATES = funcnts_plot.tmpl funhist_plot.tmpl funcnts_sed.tmpl \
- funtools_ds9.tmpl funds9.tmpl funtbl.tmpl funindex.tmpl
-
-SCRIPTS = funcnts.plot funhist.plot funcnts.sed funds9 funtbl funindex
-
-DS9HELPERS = funtools.ds9
-
-FILES = funcalc.sed
-
-DEVEL =
-
-# Subdirectories to run make in for the primary targets.
-
-SUBLIBS = util fitsy filter
-#SUBLIBS = util fitsy wcs filter
-
-SUBDIRS = $(SUBLIBS) gnu funtest faq
-
-all: lib progs progs2 scripts ds9helpers
-
-progs: $(PROGS)
-
-progs2: $(PROGS2)
-
-scripts: $(SCRIPTS)
-
-ds9helpers: $(DS9HELPERS)
-
-devel: $(DEVEL)
-
-libutil: FORCE
- @(echo Making libutil.a in util ...; \
- cd util; $(MAKE) libutil; mv libutil.a ..)
-
-sublib: FORCE
- @for dir in $(SUBLIBS); do \
- echo " "; \
- echo Making library in $$dir ...; \
- (cd $$dir; $(MAKE)) ; \
- done
-
-lib: $(LIB) $(DOMAINLIB) $(DOSHARED)
-
-$(LIB): sublib $(LIBOBJS)
- ar cruv $(LIB) $(LIBOBJS)
- $(RANLIB) $(LIB)
-
-funmainlib.c: $(MAINLIBOBJS) mkfunmainlib
- echo $(PROGS) | ./mkfunmainlib > funmainlib.c;
-
-shlib: sublib $(LIBOBJS)
- @(rm -rf $(PACKAGE)tmp; mkdir $(PACKAGE)tmp; \
- (cd $(PACKAGE)tmp && ar x ../$(LIB)); \
- CC='$(CC)' CXX=$(CXX) \
- ./mklib -o $(PACKAGE) $(PACKAGE)tmp/*.o; \
- rm -rf $(PACKAGE)tmp;)
-
-mainlib: $(MAINLIBOBJS) funmainlib.o lex.calc.o
- @(ar cruv lib$(PACKAGE)MainLib.a \
- $(MAINLIBOBJS) funmainlib.o lex.calc.o; \
- $(RANLIB) lib$(PACKAGE)MainLib.a)
-
-shmainlib: mainlib
- @(rm -rf $(PACKAGE)tmp; mkdir $(PACKAGE)tmp; \
- (cd $(PACKAGE)tmp && ar x ../lib$(PACKAGE)MainLib.a); \
- CC='$(CC)' CXX='$(CXX)' \
- ./mklib -o $(PACKAGE)MainLib -L. -lfuntools $(PACKAGE)tmp/*.o;\
- rm -rf $(PACKAGE)tmp;)
-
-tclfun: $(LIB) tclmainlib.o tclfun.o
- @(ar cruv libtclfun.a tclmainlib.o tclfun.o; \
- $(RANLIB) libtclfun.a)
-
-shtclfun: tclfun
- @(rm -rf $(PACKAGE)tmp; mkdir $(PACKAGE)tmp; \
- (cd $(PACKAGE)tmp && ar x ../$(LIB) && ar x ../libtclfun.a); \
- CC='$(CC)' CXX='$(CXX)' \
- ./mklib -o tclfun $(PACKAGE)tmp/*.o; \
- rm -rf $(PACKAGE)tmp; \
- test -r pkgIndex.tcl && mv pkgIndex.tcl pkgIndex.tcl-old; \
- SHLIB=libtclfun.so; \
- test -r libtclfun.dylib && SHLIB=libtclfun.dylib; \
- echo "pkg_mkIndex -direct . $${SHLIB}; exit" | tclsh;)
-
-tclfun.c: FORCE
- echo $(PROGS) | ./mkfunmainlib -tcl > tclfun.c
-
-
-tclmainlib.o: util/tclmainlib.c
- $(CC) -c $(CC_SWITCHES) util/tclmainlib.c
-
-funcalc: funcalc.o lex.calc.o lib
- $(CC) $(LDFLAGS) funcalc.o lex.calc.o -o funcalc \
- $(LLIB) $(LIBS)
-
-funcen: funcen.o lib
- $(CC) $(LDFLAGS) funcen.o -o funcen $(LLIB) $(LIBS)
-
-funcnts: funcnts.o lib
- $(CC) $(LDFLAGS) funcnts.o -o funcnts $(LLIB) $(LIBS)
-
-funcone: funcone.o lib
- $(CC) $(LDFLAGS) funcone.o -o funcone $(LLIB) $(LIBS)
-
-fundisp: fundisp.o lib
- $(CC) $(LDFLAGS) fundisp.o -o fundisp $(LLIB) $(LIBS)
-
-funhist: funhist.o lib
- $(CC) $(LDFLAGS) funhist.o -o funhist $(LLIB) $(LIBS)
-
-funhead: funhead.o lib
- $(CC) $(LDFLAGS) funhead.o -o funhead $(LLIB) $(LIBS)
-
-funimage: funimage.o lib
- $(CC) $(LDFLAGS) funimage.o -o funimage $(LLIB) $(LIBS)
-
-funjoin: funjoin.o lib
- $(CC) $(LDFLAGS) funjoin.o -o funjoin $(LLIB) $(LIBS)
-
-funmerge: funmerge.o lib
- $(CC) $(LDFLAGS) funmerge.o -o funmerge $(LLIB) $(LIBS)
-
-funsky: funsky.o lib
- $(CC) $(LDFLAGS) funsky.o -o funsky $(LLIB) $(LIBS)
-
-funtable: funtable.o lib
- $(CC) $(LDFLAGS) funtable.o -o funtable $(LLIB) $(LIBS)
-
-_sort: FORCE
- @(echo " "; echo "Making in gnu ..."; cd gnu; $(MAKE))
-
-funcalc_main.o: funcalc.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funcalc_main" \
- -o funcalc_main.o funcalc.c
-funcen_main.o: funcen.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funcen_main" \
- -o funcen_main.o funcen.c
-
-funcnts_main.o: funcnts.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funcnts_main" \
- -o funcnts_main.o funcnts.c
-funcone_main.o: funcone.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funcone_main" \
- -o funcone_main.o funcone.c
-fundisp_main.o: fundisp.c
- $(CC) -c $(CC_SWITCHES) -Dmain="fundisp_main" \
- -o fundisp_main.o fundisp.c
-funhist_main.o: funhist.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funhist_main" \
- -o funhist_main.o funhist.c
-funhead_main.o: funhead.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funhead_main" \
- -o funhead_main.o funhead.c
-funimage_main.o: funimage.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funimage_main" \
- -o funimage_main.o funimage.c
-funjoin_main.o: funjoin.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funjoin_main" \
- -o funjoin_main.o funjoin.c
-funmerge_main.o: funmerge.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funmerge_main" \
- -o funmerge_main.o funmerge.c
-funsky_main.o: funsky.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funsky_main" \
- -o funsky_main.o funsky.c
-
-funtable_main.o: funtable.c
- $(CC) -c $(CC_SWITCHES) -Dmain="funtable_main" \
- -o funtable_main.o funtable.c
-
-funcnts.plot: funcnts_plot.tmpl
- sed -e 's#AWK#$(AWK)#g' funcnts_plot.tmpl > funcnts.plot
- chmod +x funcnts.plot
-
-funhist.plot: funhist_plot.tmpl
- sed -e 's#AWK#$(AWK)#g' funhist_plot.tmpl > funhist.plot
- chmod +x funhist.plot
-
-funds9: funds9.tmpl
- sed -e 's#AWK#$(AWK)#g;s#GNUPLOT#$(GNUPLOT)#g' funds9.tmpl > funds9
- chmod +x funds9
-
-funtbl: funtbl.tmpl
- sed -e 's#AWK#$(AWK)#g;' funtbl.tmpl > funtbl
- chmod +x funtbl
-
-funindex: funindex.tmpl
- cp -p funindex.tmpl funindex
- chmod +x funindex
-
-funcnts.sed: funcnts_sed.tmpl
- cp funcnts_sed.tmpl funcnts.sed
- chmod +x funcnts.sed
-
-funtools.ds9: funtools_ds9.tmpl
- sed -e 's#PRE#$(PRE)#g;s#POST#$(POST)#g;s#GUNZIP#$(GUNZIP)#g' funtools_ds9.tmpl > funtools.ds9
-
-diff:
- @-(for file in "`ls *.c`"; \
- do \
- echo $$file; \
- diff /soft/saord/funtools-*/$$file .; \
- done;)
-
-install:: install-binaries
-
-install:: $(DOSHARED)_install
-
-install::
- @for dir in $(SUBDIRS); do \
- echo " "; \
- echo Installing in $$dir ...; \
- (cd $$dir; $(MAKE) INSTALL_ROOT=$(INSTALL_ROOT) INCLUDE_INSTALL_DIR=$(INCLUDE_INSTALL_DIR) $@) ; \
- done
-
-install:: install-man
-
-install:: install-share
-
-install:: install-data
-
-FORCE:
-
-# Note: before running ranlib below, must cd to target directory because
-# some ranlibs write to current directory, and this might not always be
-# possible (e.g. if installing as root).
-
-# this nop-op gets executed if we are not building shared libraries
-_install:
-
-shlib_install:
- @-(for i in `ls *.so* *.dylib *.sl 2>/dev/null` ; \
- do \
- if [ -h $$i ] ; then \
- echo "Installing link $$i" ; \
- tar cf - $$i | (cd $(LIB_INSTALL_DIR); tar xf -) ; \
- else \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(LIB_INSTALL_DIR)/$$i ; \
- chmod 555 $(LIB_INSTALL_DIR)/$$i; \
- fi; \
- done;)
-
-install-binaries: lib $(PROGS) $(SCRIPTS) $(DS9HELPERS)
- @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir -p $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @if [ "$(LIB)" ] ; then \
- XLIB=`basename $(LIB)`; \
- echo "Installing $$XLIB"; \
- $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \
- (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \
- chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \
- fi;
- @echo "Installing funtools.h"
- @$(INSTALL_DATA) funtools.h $(INCLUDE_INSTALL_DIR)/funtools.h
- @echo "Installing funtoolsP.h"
- @$(INSTALL_DATA) funtoolsP.h $(INCLUDE_INSTALL_DIR)/funtoolsP.h
- @for i in $(PROGS) ; \
- do \
- echo "Installing $$i$(EXE)" ; \
- $(INSTALL_PROGRAM) $$i$(EXE) $(BIN_INSTALL_DIR)/$$i$(EXE) ; \
- done;
- @for i in $(SCRIPTS) ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_PROGRAM) $$i $(BIN_INSTALL_DIR)/$$i ; \
- done;
- @for i in $(DS9HELPERS) ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(BIN_INSTALL_DIR)/$$i ; \
- done;
- @for i in $(FILES) ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(BIN_INSTALL_DIR)/$$i ; \
- done;
-
-install-man:
- @if [ ! -d $(MAN_INSTALL_DIR) ] ; then \
- echo "Making directory $(MAN_INSTALL_DIR)"; \
- mkdir $(MAN_INSTALL_DIR); \
- chmod 755 $(MAN_INSTALL_DIR); \
- else true; \
- fi;
- @-(for i in `ls ./man/man?/*.?` ; \
- do \
- B=`basename $$i`; \
- E=`echo $$i | awk -F. '{print $$NF}'`; \
- M="$(MAN_INSTALL_DIR)/man$$E"; \
- if [ ! -d $$M ] ; then \
- echo "Making directory $$M"; \
- mkdir $$M; \
- chmod 755 $$M; \
- else true; \
- fi; \
- echo "Installing $$B" ; \
- $(INSTALL_DATA) $$i $$M/$$B; \
- done;)
-
-install-share:
- @if [ ! -d $(MAN_SHARE_DIR) ] ; then \
- echo "Making directory $(MAN_SHARE_DIR)"; \
- mkdir -p $(MAN_SHARE_DIR); \
- chmod 755 $(MAN_SHARE_DIR); \
- else true; \
- fi;
- @-(for i in `ls ./doc/sman/fun?.*` ; \
- do \
- B=`basename $$i`; \
- echo "Installing $$B" ; \
- $(INSTALL_DATA) $$i $(MAN_SHARE_DIR)/$$B; \
- done;)
-
-install-data: install-pkgconfig
-
-install-pkgconfig:
- @-(mkdir -p $(LIB_INSTALL_DIR)/pkgconfig; \
- echo "Installing funtools.pc" ; \
- $(INSTALL_DATA) funtools.pc $(LIB_INSTALL_DIR)/pkgconfig;)
-
-Makefile: Makefile.in
- $(SHELL) config.status
-
-RM = rm -f
-
-topclean:
- $(RM) *.a *.so *.so.? *.so.?.? *.o *.dylib \
- $(PROGS) tmain \
- $(SCRIPTS) $(DS9HELPERS) \
- $(DEVEL) *.exe \
- core core.[0-9]* errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- gmon.out *.pg *.bak \
- config.info config.log \
- doc/*~ doc/*.bak
- $(RM) -r autom4te.cache
-
-binclean:
- $(RM) ./lib/* ./include/* ./bin/*
-
-subclean:
- for dir in $(SUBDIRS); do \
- echo making clean in subdir $$dir ; \
- (cd $$dir; if [ -f Makefile ]; then $(MAKE) clean; fi); \
- done
-
-clean: topclean binclean subclean
-
-pclean:
- $(RM) $(PROGS) $(DEVEL)
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log funtools.pc
-
-Distclean: distclean
- for dir in $(SUBDIRS); do \
- echo making clean in $$dir ; \
- (cd $$dir; if [ -f Makefile ]; then $(MAKE) distclean; fi); \
- done
-
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-.c.o:
- $(CC) -c $(CC_SWITCHES) $<
-
-funopen.o: funopen.c funtools.h funtoolsP.h
-funparam.o: funparam.c funtools.h funtoolsP.h
-funim.o: funim.c funtools.h funtoolsP.h
-funtab.o: funtab.c funtools.h funtoolsP.h
-funcol.o: funcol.c funtools.h funtoolsP.h
-funcopy.o: funcopy.c funtools.h funtoolsP.h
-funutil.o: funutil.c funtools.h funtoolsP.h
-funview.o: funview.c funtools.h funtoolsP.h
-funwcs.o: funwcs.c funtools.h funtoolsP.h
-funinfo.o: funinfo.c funtools.h funtoolsP.h
-funimage.o: funimage.c funtools.h funtoolsP.h
-funhist.o: funhist.c funtools.h funtoolsP.h
-fundisp.o: fundisp.c funtools.h funtoolsP.h
-funhead.o: funhead.c funtools.h funtoolsP.h
-funcnts.o: funcnts.c funtools.h funtoolsP.h
-funcen.o: funcen.c funtools.h funtoolsP.h
-funcone.o: funcone.c funtools.h funtoolsP.h
-funjoin.o: funjoin.c funtools.h funtoolsP.h
-funmerge.o: funmerge.c funtools.h funtoolsP.h
-funsky.o: funsky.c funtools.h funtoolsP.h
-funtable.o: funtable.c funtools.h funtoolsP.h chandra.h
-funcalc.o: funcalc.c calc.h funtools.h funtoolsP.h
- $(CC) -c $(CC_SWITCHES) $< \
- -DFUN_INCLUDE="\"-I${prefix}/include\"" \
- -DFUNCALC_CC="$(FUNCALC_CC)" \
- -DFUNCALC_CFLAGS="$(FUNCALC_CFLAGS)" \
- -DFUN_LIB="\"-L${exec_prefix}/lib -lfuntools ${EXTRA_LIBS} -lm\""
-lex.calc.o: lex.calc.c tabcalc_c.h
-
-headers: tabcalc_c.h
-tabcalc_c.h: tabcalc.c
- $(RM) tabcalc_c.h
- ./inc.sed TABCALC_C < tabcalc.c > tabcalc_c.h
-
-# remake the parser
-LEX = flex -Pcalc
-
-parser: calc.l
- @($(LEX) calc.l; \
- sed "s/yytext_ptr/calctext_ptr/g" < lex.calc.c > nlex.calc.c; \
- mv nlex.calc.c lex.calc.c)
-
-funtools.h: configure.ac
- @($(RM) -r ofuntools.h; \
- MAJOR=`echo "${VERSION}" | awk -F. '{print $$1}'`; \
- MINOR=`echo "${VERSION}" | awk -F. '{print $$2}'`; \
- PATCH=`echo "${VERSION}" | awk -F. '{print $$3}'`; \
- sed "s/^#define FUN_VERSION.*/#define FUN_VERSION \"$(VERSION)\"/;s/^#define FUN_MAJOR_VERSION.*/#define FUN_MAJOR_VERSION $${MAJOR}/;s/^#define FUN_MINOR_VERSION.*/#define FUN_MINOR_VERSION $${MINOR}/;s/^#define FUN_PATCH_LEVEL.*/#define FUN_PATCH_LEVEL $${PATCH}/;" < funtools.h > nfuntools.h; \
- mv funtools.h ofuntools.h; \
- mv nfuntools.h funtools.h)
-
-
-#
-# Target to create a proper FUNTOOLS distribution from information in the
-# master source directory. DISTDIR must be defined to indicate where
-# to put the distribution. DISTDIR must be an absolute path name.
-#
-
-configure: configure.ac
- autoconf
-
-Configure: FORCE
- @for dir in $(SUBDIRS); do \
- if [ -x $$dir/configure ]; then \
- echo " "; \
- echo Autoconf in $$dir ...; \
- (cd $$dir; autoconf) ; \
- fi; \
- done
-
-Confiles:
- @(for dir in $(SUBDIRS); do \
- echo " "; \
- echo Copying configure files to $$dir ...; \
- cp -p aclocal.m4 tcl.m4 gcc33.m4 \
- conf.h.in config.sub config.guess install-sh $$dir; \
- done)
-
-dist: configure
- ($(RM) -r $(DISTDIR); \
- mkdir $(DISTDIR); \
- cp -p README INSTALL COPYING $(DISTDIR)/.; \
- cp -p *.c *.h *.l $(DISTDIR)/.; \
- cp -p Makefile.in $(DISTDIR)/.; \
- chmod 664 $(DISTDIR)/Makefile.in; \
- cp -p conf.h.in $(DISTDIR)/.; \
- chmod 664 $(DISTDIR)/conf.h.in; \
- cp -p configure.ac $(DISTDIR)/.; \
- chmod 644 $(DISTDIR)/configure.ac; \
- cp -p *.m4 $(DISTDIR)/.; \
- chmod 644 $(DISTDIR)/*.m4; \
- cp -p configure $(DISTDIR)/.; \
- chmod 755 $(DISTDIR)/configure; \
- cp -p config.sub config.guess $(DISTDIR)/.; \
- chmod 755 $(DISTDIR)/config.sub $(DISTDIR)/config.guess; \
- cp -p saoconfig $(DISTDIR)/.; \
- chmod 775 $(DISTDIR)/saoconfig; \
- cp -p install-sh $(DISTDIR)/.; \
- chmod +x $(DISTDIR)/install-sh; \
- cp -p funtools.pc.in $(DISTDIR)/.; \
- chmod +x $(DISTDIR)/funtools.pc.in; \
- cp -p inc.sed $(DISTDIR)/.; \
- chmod +x $(DISTDIR)/inc.sed; \
- cp -p mklib $(DISTDIR)/.; \
- chmod +x $(DISTDIR)/mklib; \
- cp -p mkfunmainlib $(DISTDIR)/.; \
- chmod +x $(DISTDIR)/mkfunmainlib; \
- cp -pR util filter fitsy wcs gnu $(DISTDIR)/.;\
- cp -pR funtest txt faq $(DISTDIR)/.;\
- cp -p $(TEMPLATES) $(DISTDIR)/.; \
- cp -p $(FILES) $(DISTDIR)/.; \
- mkdir $(DISTDIR)/doc; \
- cp -p ./doc/*.html ./doc/*.c $(DISTDIR)/doc/.; \
- cp -p ./doc/*.ps ./doc/*.pdf $(DISTDIR)/doc/.; \
- cp -p ./doc/Makefile $(DISTDIR)/doc/.; \
- cp -p ./doc/szlong.c $(DISTDIR)/doc/.; \
- mkdir $(DISTDIR)/doc/sman; \
- cp -p ./doc/sman/* $(DISTDIR)/doc/sman/.; \
- mkdir $(DISTDIR)/man; \
- cp -p -R ./man/* $(DISTDIR)/man/.)
-
-release: dist
- (cd $(DISTDIR); cd ..; \
- tar cf - $(DISTNAME) | \
- gzip -9 -c > $(FTPDIR)/$(DISTNAME).tar.gz)
-
-tar:
- ($(RM) -r config.cache; \
- cd ..; \
- tar cf - $(DISTNAME) | gzip -9 -c > $(DISTNAME).tar.gz)
-
-errcheck:
- @-egrep 'error|warning|ld:|collect2:|make:' foo | egrep -v "^lex.*but not used"
-
-itar:
- (cd doc/sman; \
- tar cf - . | gzip -9 -c > ../../../$(DISTNAME)-iman.tar.gz)
-
-sman:
- @(cd doc && $(MAKE) index)
-
-docs:
- @(cd doc; $(MAKE))
-
-untar:
- (make clean; cd ..; \
- $(RM) -r o$(DISTNAME); mv $(DISTNAME) o$(DISTNAME); \
- tar xfz $(DISTNAME).tar.gz)
-
-pure: funcalc.pure funcen.pure funcnts.pure funcone.pure \
- fundisp.pure funhead.pure funimage.pure funhist.pure \
- funmerge.pure funsky.pure funtable.pure \
- funjoin.pure
-
-funcen.pure: lib funcen.o
- purify $(CC) $(LDFLAGS) funcen.o -o funcen.pure \
- $(LLIB) $(LIBS)
-
-funcnts.pure: lib funcnts.o
- purify $(CC) $(LDFLAGS) funcnts.o -o funcnts.pure \
- $(LLIB) $(LIBS)
-
-funcone.pure: lib funcone.o
- purify $(CC) $(LDFLAGS) funcone.o -o funcone.pure \
- $(LLIB) $(LIBS)
-
-fundisp.pure: lib fundisp.o
- purify $(CC) $(LDFLAGS) fundisp.o -o fundisp.pure \
- $(LLIB) $(LIBS)
-
-funhead.pure: lib funhead.o
- purify $(CC) $(LDFLAGS) funhead.o -o funhead.pure \
- $(LLIB) $(LIBS)
-
-funsky.pure: lib funsky.o
- purify $(CC) $(LDFLAGS) funsky.o -o funsky.pure \
- $(LLIB) $(LIBS)
-
-funtable.pure: lib funtable.o
- purify $(CC) $(LDFLAGS) funtable.o -o funtable.pure \
- $(LLIB) $(LIBS)
-
-funimage.pure: lib funimage.o
- purify $(CC) $(LDFLAGS) funimage.o -o funimage.pure \
- $(LLIB) $(LIBS)
-
-funhist.pure: lib funhist.o
- purify $(CC) $(LDFLAGS) funhist.o -o funhist.pure \
- $(LLIB) $(LIBS)
-
-funjoin.pure: lib funjoin.o
- purify $(CC) $(LDFLAGS) funjoin.o -o funjoin.pure \
- $(LLIB) $(LIBS)
-
-funmerge.pure: lib funmerge.o
- purify $(CC) $(LDFLAGS) funmerge.o -o funmerge.pure \
- $(LLIB) $(LIBS)
-
-funcalc.pure: lib funcalc.o lex.calc.o
- purify $(CC) $(LDFLAGS) funcalc.o lex.calc.o \
- -o funcalc.pure $(LLIB) $(LIBS)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/README b/funtools/README
deleted file mode 100644
index 973e6b0..0000000
--- a/funtools/README
+++ /dev/null
@@ -1,27 +0,0 @@
-Funtools is a "minimal buy-in" FITS library and utility package
-originally developed at the the High Energy Astrophysics Division of
-SAO. Although no longer actively supported at SAO, it is still widely
-used within the astronomical community, especially among X-ray astronomers.
-
-The Funtools library provides simplified access to a wide array
-of file types: standard astronomical FITS images and binary tables,
-raw arrays and binary event lists, and even tables of ASCII column
-data. A sophisticated region filtering library (compatible with ds9)
-filters images and tables using Boolean operations between geometric
-shapes, support world coordinates, etc. Funtools also supports
-advanced capabilities such as optimized data searching using index files.
-
-Because Funtools consists of a library and a set of user programs, it
-is most appropriately built from source. Funtools has been ported to
-Solaris, Linux, Mac OSX (Darwin) and Windows 98/NT/2000/XP. Once the
-source code tar file is retrieved, Funtools can be built and installed
-easily using standard commands:
-
- ./mkconfigure # generate all configure scripts
- ./configure --prefix=[installdir] # configuration
- make # build the software
- make install # install in [installdir]
-
-See the INSTALL instructions (which are based on standard instructions
-for building software using GNU configure) for more information about
-building Funtools.
diff --git a/funtools/ac_c_long_long.m4 b/funtools/ac_c_long_long.m4
deleted file mode 100644
index fb6df1e..0000000
--- a/funtools/ac_c_long_long.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-##### http://autoconf-archive.cryp.to/ac_c_long_long.html
-#
-# SYNOPSIS
-#
-# AC_C_LONG_LONG
-#
-# DESCRIPTION
-#
-# Provides a test for the existance of the long long int type and
-# defines HAVE_LONG_LONG if it is found.
-#
-# LAST MODIFICATION
-#
-# 2006-10-30
-#
-# COPYLEFT
-#
-# Copyright (c) 2006 Caolan McNamara <caolan@skynet.ie>
-#
-# Copying and distribution of this file, with or without
-# modification, are permitted in any medium without royalty provided
-# the copyright notice and this notice are preserved.
-
-AC_DEFUN([AC_C_LONG_LONG],
-[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
-[if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- AC_TRY_COMPILE(,[long long int i;],
- ac_cv_c_long_long=yes,
- ac_cv_c_long_long=no)
- fi])
- if test $ac_cv_c_long_long = yes; then
- AC_DEFINE(HAVE_LONG_LONG, 1, [compiler understands long long])
- fi
-])
diff --git a/funtools/aclocal.m4 b/funtools/aclocal.m4
deleted file mode 100644
index b4ee113..0000000
--- a/funtools/aclocal.m4
+++ /dev/null
@@ -1,2 +0,0 @@
-builtin(include,tcl.m4)
-builtin(include,ac_c_long_long.m4)
diff --git a/funtools/bsearch.c b/funtools/bsearch.c
deleted file mode 100644
index df69ca2..0000000
--- a/funtools/bsearch.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary */
-
-/* returns first target if more than one have same value */
-static public int search(int [] array, int target)
-{
- int high = array.length, low = -1, probe;
- while (high - low > 1)
- {
- probe = (high + low) / 2;
- if (array[probe] < target)
- low = probe;
- else
- high = probe;
- }
- if (high == array.length || array[high] != target)
- return -1;
- else
- return high;
-}
-
-/* returns last target if more than one have same value */
-static public int search2(int [] array, int target)
-{
- int high = array.length, low = -1, probe;
- while (high - low > 1)
- {
- probe = (high + low) / 2;
- if (array[probe] > target)
- high = probe;
- else
- low = probe;
- }
- if (low == -1 || array[low] != target)
- return -1;
- else
- return low;
-}
-
-static public int [] range(int [] array, int floor, int ceiling)
-{
- int [] answer = new int[2];
- int high, low, probe;
-
- // work on floor
- high = array.length; low = -1;
- while (high - low > 1)
- {
- probe = (high + low) / 2;
- if (array[probe] < floor)
- low = probe;
- else
- high = probe;
- }
- answer[0] = low;
-
- // work on ceiling
- high = array.length; low = -1;
- while (high - low > 1)
- {
- probe = (high + low) / 2;
- if (array[probe] > ceiling)
- high = probe;
- else
- low = probe;
- }
- answer[1] = high;
- return answer;
-}
diff --git a/funtools/calc.h b/funtools/calc.h
deleted file mode 100644
index f3d9c6a..0000000
--- a/funtools/calc.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * calc.h
- *
- */
-#ifndef __funcalc_h
-#define __funcalc_h
-
-#include <prsetup.h>
-
-#ifndef FUNCALC_CC
-#define FUNCALC_CC NULL
-#endif
-
-#ifndef FUNCALC_CFLAGS
-#define FUNCALC_CFLAGS NULL
-#endif
-
-/* places to look for the compiler other than user's path */
-#define FUNCALC_PATH "/opt/SUNWspro/bin:/bin:/usr/bin:/usr/local/bin/:/opt/local/bin:"
-
-#define DEFAULT_FUNCALC_TMPDIR "/tmp"
-#define FUNCALC_SED "funcalc.sed"
-
-/* library declarations */
-_PRbeg
-
-void _CalcCat _PRx((char *str, char **ostr, int *olen));
-
-_PRend
-
-#endif /* __funtools.h */
diff --git a/funtools/calc.l b/funtools/calc.l
deleted file mode 100644
index 7bd14d7..0000000
--- a/funtools/calc.l
+++ /dev/null
@@ -1,802 +0,0 @@
-%option caseless
-%array
-
-%{
-#include <ctype.h>
-#include <funtoolsP.h>
-#include <macro.h>
-#include <calc.h>
-#include <tabcalc_c.h>
-
-/* define the types of event records we have to handle */
-#define REC_CUR 1
-#define REC_PREV 2
-#define REC_NEXT 4
-
-/* misc */
-#define MAX_INCLUDE_DEPTH 100
-#define SEGINC 1024
-#define MAXCODE 4
-
-/* symbols for each column we encounter */
-typedef struct calccoltab {
- struct calccoltab *next;
- char *name;
- char *sname;
- char *cname;
- char *tdim;
- int type;
- int n;
- double tlmin;
- double tlmax;
- double binsiz;
- double tscale;
- double tzero;
- int scaled;
- int exists;
- int settype;
-} *CalcCols, CalcColRec;
-
-static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
-static int include_stack_ptr = 0;
-static Fun ifun;
-static CalcCols columns;
-static int laststart;
-
-static char *prog;
-static char *command;
-static char *autodeclare;
-static char *mbuf;
-static int mlen;
-static int n;
-static int var;
-static int rectype;
-static int args;
-static int doreplace=0;
-
-static char *code[MAXCODE];
-static char *expr;
-static char **strptr=&expr;
-static int ncode[MAXCODE];
-static int nexpr;
-static int xnl;
-static int *lenptr=&nexpr;
-
-static void setn _PRx((int newn));
-static char *_CalcMake _PRx((void));
-static int _CalcColProc _PRx((char *s, int expl));
-static int _CalcColName _PRx((char *sname));
-static CalcCols _CalcColNew _PRx((Fun fun,
- char *name, char *sname, char *cname,
- int type, int n,
- double tlmin, double tlmax, double binsiz,
- double tscale, double tzero, int scaled,
- int exists, int settype));
-static CalcCols _CalcColLookup _PRx((char *cname));
-
-int _calcerror _PRx((char *msg));
-%}
-
-DIG [0-9]
-DIG2 [0-9a-fA-F]
-BINARY 0[bB][01]+
-INT1 [-+]?{DIG}+L?
-INT2 [-+]?0[xX]{DIG2}+L?
-INT ({INT1}|{INT2})
-FLOAT1 [-+]?{DIG}+\.?([eE][-+]?{DIG}+)?
-FLOAT2 [-+]?{DIG}*\.{DIG}+([eE][-+]?{DIG}+)?
-FLOAT ({FLOAT1}|{FLOAT2})
-NUM ({INT}|{FLOAT})
-
-SNAME (cur|prev|next)
-NAME [A-Za-z~_][0-9A-Za-z~_]*(\[[0-9]+\])?
-TYPE (\[{INT}\])?(:{NUM}?[a-z]?){1,4}
-COL {SNAME}->{NAME}{TYPE}?
-ECOL explicit
-FILE @[0-9A-Za-z~_/\-\.]*(\[.*\])?
-VAR [ \t]*(char|short|int|float|double)
-INCL ^#[\t ]*include[ \t]*(\".*\"|<.*>)
-DEF ^#[\t ]*define[ \t]+.*
-XCOM #
-BCOM "/*"
-ECOM "*/"
-
-%x INCLUDE
-%x VAR
-%x COM
-%x XCOM
-%x ECOL
-%%
-
-global { setn(0); var = 0; }
-local { setn(1); var = 0; }
-before { setn(2); var = 0; }
-after { setn(3); var = 0; }
-end { setn(-1); var = 0; }
-
-{FILE} {
- char *s;
- if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
- _calcerror("include files are nested too deeply");
- if( !(s = (char *)FileContents(yytext+1, 0, NULL)) )
- _calcerror("can't access include file");
- else {
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
- BEGIN INITIAL; yy_scan_string(s); BEGIN INITIAL;
- if( s ) xfree(s);
- }
-}
-
-{VAR} {
- if( var ){ BEGIN VAR; setn(1); }
- _CalcCat(yytext, strptr, lenptr);
-}
-<VAR>; {
- _CalcCat(yytext, strptr, lenptr);
- _CalcCat("\n", strptr, lenptr);
- if( var ){ BEGIN INITIAL; setn(-1); }
-}
-<VAR>. { _CalcCat(yytext, strptr, lenptr); }
-
-{INCL} { _CalcCat(yytext, strptr, lenptr); }
-
-{DEF} { _CalcCat(yytext, strptr, lenptr); }
-
-^[ \t]*{XCOM} { laststart = YY_START; xnl=0; BEGIN XCOM; }
-{XCOM} { laststart = YY_START; xnl=1; BEGIN XCOM; }
-<XCOM>\n { BEGIN laststart; if( xnl ) unput('\n'); }
-<XCOM>. { /* ignore comments up to eol */ ; }
-
-{BCOM} {
- _CalcCat(yytext, strptr, lenptr);
- laststart = YY_START; BEGIN COM;
-}
-<COM>{ECOM} { _CalcCat(yytext, strptr, lenptr); BEGIN laststart; }
-<COM>\n { _CalcCat(yytext, strptr, lenptr); }
-<COM>. { _CalcCat(yytext, strptr, lenptr); }
-
-{COL} { _CalcColProc(yytext, 0); var=0;}
-
-{ECOL} { laststart = YY_START; BEGIN ECOL; }
-<ECOL>{NAME} { _CalcColProc(yytext, 1); var=0; }
-<ECOL>[, \t] { ; }
-<ECOL>\n { BEGIN laststart; }
-
-\n { _CalcCat(yytext, strptr, lenptr);}
-
-[ \t]* { _CalcCat(yytext, strptr, lenptr);}
-
-. { _CalcCat(yytext, strptr, lenptr); var=0;}
-
-<<EOF>> {
- if ( --include_stack_ptr < 0 ){
- prog = _CalcMake();
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yyterminate();
- } else {
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yy_switch_to_buffer(include_stack[include_stack_ptr] );
- }
-}
-
-%%
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-/* setn -- set pointer to where expression is stored */
-#ifdef YY_USE_PROTOS
-static void setn(int newn)
-#else
-static void setn(newn)
- int newn;
-#endif
-{
- if( newn >=0 ){
- n = newn;
- strptr = &code[n]; lenptr = &ncode[n];
- }
- else{
- strptr = &expr; lenptr = &nexpr;
- }
-}
-
-/*
- *
- * _CalcDatatype -- return C data type as a string
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_CalcDatatype(int type)
-#else
-static char *_CalcDatatype(type)
- int type;
-#endif
-{
- switch ( type ) {
- case 'A': return "char";
- case 'X': return "char";
- case 'B': return "unsigned char";
- case 'I': return "short";
- case 'U': return "unsigned short";
- case 'J': return "int";
- case 'K': return "long long";
- case 'V': return "unsigned int";
- case 'L': return "char";
- case 'E': return "float";
- case 'D': return "double";
- }
- _calcerror("unknown/illegal data type for new column");
- return "???";
-}
-
-/*
- *
- * _CalcColName -- see if sname is a recognized column name
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_CalcColName(char *sname)
-#else
-static int _CalcColName(sname)
- char *sname;
-#endif
-{
- if( !strcasecmp(sname, "prev") ){
- strcpy(sname, "prev");
- rectype |= REC_PREV;
- return REC_PREV;
- }
- if( !strcasecmp(sname, "cur") ){
- strcpy(sname, "cur");
- rectype |= REC_CUR;
- return REC_CUR;
- }
- if( !strcasecmp(sname, "next") ){
- strcpy(sname, "next");
- rectype |= REC_NEXT;
- return REC_NEXT;
- }
- else{
- return 0;
- }
-}
-
-/*
- *
- * _CalcCB -- macro expansion callback
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_CalcCB(char *name, void *client_data)
-#else
-static char *_CalcCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- CalcCols cur;
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE*2];
- char tbuf3[SZ_LINE];
- int i, got, ip;
-
- /* start at beginning of macro buffer */
- /* allocate the macro buffer */
- if( mbuf ) xfree(mbuf);
- mbuf = NULL;
- mlen = SZ_LINE;
-
- if( !strcmp(name, "MEMBERS") ){
- if( !columns ){
- _CalcCat("int dummy;\n", &mbuf, &mlen);
- return mbuf;
- }
- for(cur=columns; cur!=NULL; cur=cur->next){
- snprintf(tbuf, SZ_LINE, "%s %s", _CalcDatatype(cur->type), cur->cname);
- _CalcCat(tbuf, &mbuf, &mlen);
- if( cur->n > 1 ){
- /* if there is no tdim, just make it a simple array */
- /* (also, do the simple thing for bit-fields) */
- if( (cur->tdim == NULL) || (cur->type == 'X') ){
- switch(cur->type){
- case 'X':
- i = (cur->n+7)/8;
- break;
- default:
- i = cur->n;
- break;
- }
- snprintf(tbuf, SZ_LINE, "[%d]", i);
- }
- /* tdim exists, so use it to declare a multidimensional array */
- else{
- newdtable(",()");
- /* I hear tdim is in Fortran order, so reverse it for C order */
- for(*tbuf = '\0', ip=0, got=0; word(cur->tdim, tbuf3, &ip); got++){
- snprintf(tbuf2, SZ_LINE, "[%s]", tbuf3);
- if( *tbuf )
- strcat(tbuf2, tbuf);
- strcpy(tbuf, tbuf2);
- }
- freedtable();
- /* but if we got nothing out of it, go back to simplicity */
- if( !got )
- snprintf(tbuf, SZ_LINE, "[%d]", cur->n);
- }
- _CalcCat(tbuf, &mbuf, &mlen);
- }
- _CalcCat(";", &mbuf, &mlen);
- if( cur->next )
- _CalcCat("\n", &mbuf, &mlen);
- }
- return mbuf;
- }
- else if( !strcmp(name, "SELECT") ){
- if( !columns ){
- return "";
- }
- for(cur=columns; cur!=NULL; cur=cur->next){
- *tbuf2 = '\0';
- if( (cur->tlmin != 0.0) || (cur->tlmax != 0.0) ){
- snprintf(tbuf2, SZ_LINE, "%f:%f", cur->tlmin, cur->tlmax);
- if( cur->binsiz != 1.0 ){
- snprintf(tbuf3, SZ_LINE, ":%f", cur->binsiz);
- strncat(tbuf2, tbuf3, SZ_LINE);
- }
- if( (cur->tscale != 1.0) || (cur->tzero != 0.0) ){
- snprintf(tbuf3, SZ_LINE, ";%f", cur->tscale);
- strncat(tbuf2, tbuf3, SZ_LINE);
- snprintf(tbuf3, SZ_LINE, ":%f", cur->tzero);
- strncat(tbuf2, tbuf3, SZ_LINE);
- }
- }
- if( *tbuf2 ){
- snprintf(tbuf, SZ_LINE, "\"%s\", \"%d%c:%s\", ",
- cur->cname, cur->n, cur->type, tbuf2);
- }
- else{
- snprintf(tbuf, SZ_LINE, "\"%s\", \"%d%c\", ",
- cur->cname, cur->n, cur->type);
- }
- _CalcCat(tbuf, &mbuf, &mlen);
- if( cur->exists )
- _CalcCat("\"rw\", ", &mbuf, &mlen);
- else
- _CalcCat("\"w\", ", &mbuf, &mlen);
- snprintf(tbuf, SZ_LINE, "FUN_OFFSET(Row, %s),", cur->cname);
- _CalcCat(tbuf, &mbuf, &mlen);
- if( cur->next )
- _CalcCat("\n", &mbuf, &mlen);
- }
- return mbuf;
- }
- else if( !strcmp(name, "RECTYPE") ){
- snprintf(tbuf, SZ_LINE, "%d", rectype);
- _CalcCat(tbuf, &mbuf, &mlen);
- return mbuf;
- }
- else if( !strcmp(name, "EXPR") ){
- if( expr && *expr )
- return(expr);
- else
- return "";
- }
- else if( !strcmp(name, "COMMAND") ){
- if( command && *command )
- return(command);
- else
- return "<build command not available>";
- }
- else if( !strcmp(name, "ARGS") ){
- if( args == 1 )
- return "1";
- else
- return "2";
- }
- else if( !strcmp(name, "AUTO") ){
- if( autodeclare && *autodeclare )
- return autodeclare;
- else
- return "";
- }
- else if( !strcmp(name, "GLOBAL") ){
- if( code[0] && *code[0] )
- return(code[0]);
- else
- return "";
- }
- else if( !strcmp(name, "LOCAL") ){
- if( code[1] && *code[1] )
- return(code[1]);
- else
- return "";
- }
- else if( !strcmp(name, "BEFORE") ){
- if( code[2] && *code[2] )
- return(code[2]);
- else
- return "";
- }
- else if( !strcmp(name, "AFTER") ){
- if( code[3] && *code[3] )
- return(code[3]);
- else
- return "";
- }
- else if( !strcmp(name, "MERGE") ){
- if( doreplace )
- strncpy(tbuf, "replace", SZ_LINE);
- else
- strncpy(tbuf, "update", SZ_LINE);
- _CalcCat(tbuf, &mbuf, &mlen);
- return mbuf;
- }
- else{
- _CalcCat("$", &mbuf, &mlen);
- _CalcCat(name, &mbuf, &mlen);
- return mbuf;
- }
-}
-
-/*
- *
- * _CalcMake -- create the string containing the program by macro expansion
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_CalcMake(void)
-#else
-static char *_CalcMake()
-#endif
-{
- char *s;
-
- /* make sure we have something */
- if( !expr || !*expr )
- expr = xstrdup(";");
- s = xstrdup(expr);
- nowhite(s, expr);
- if( s ) xfree(s);
- /* add final ';' is necessary (but not if there is any compund statement) */
- if( !strchr(expr,';') && !strchr(expr,'{') )
- _CalcCat(";", &expr, &nexpr);
- /* expand program body to add specifics of the expression */
- s = ExpandMacro(TABCALC_C, NULL, NULL, 0, _CalcCB, NULL);
- return s;
-}
-
-/* look up a column entry, add if not present */
-#ifdef YY_USE_PROTOS
-CalcCols
-_CalcColLookup(char *cname)
-#else
-CalcCols
-_CalcColLookup(cname)
- char *cname;
-#endif
-{
- CalcCols cur;
- for(cur=columns; cur!=NULL; cur=cur->next){
- if( !strcasecmp(cname, cur->cname) )
- return cur;
- }
- return NULL;
-}
-
-/* look up a symbol table entry, add if not present */
-#ifdef YY_USE_PROTOS
-CalcCols
-_CalcColNew(Fun fun, char *name, char *sname, char *cname, int type, int n,
- double tlmin, double tlmax, double binsiz,
- double tscale, double tzero, int scaled,
- int exists, int settype)
-#else
-CalcCols
-_CalcColNew(fun, name, sname,
- cname, type, n, tlmin, tlmax, binsiz,
- tscale, tzero, scaled,
- exists, settype)
- Fun fun;
- char *name, *sname, *cname;
- int type, n;
- double tlmin, tlmax, binsiz;
- double tscale, tzero;
- int scaled, exists, settype;
-#endif
-{
- CalcCols sym, cur;
- int got;
- int enter=1;
-
- if( (sym=_CalcColLookup(cname)) ){
- if( !settype ) return sym;
- enter=0;
- }
- else{
- /* allocate a new symbol record */
- if( !(sym = (CalcCols)xcalloc(1, sizeof(CalcColRec))) )
- return NULL;
- }
-
- /* fill in the blanks */
- if( sym->name ) xfree(sym->name);
- sym->name = xstrdup(name);
- if( sym->sname ) xfree(sym->sname);
- sym->sname = xstrdup(sname);
- if( sym->cname ) xfree(sym->cname);
- sym->cname = xstrdup(cname);
- sym->type = type;
- sym->n = n;
- sym->tlmin = tlmin;
- sym->tlmax = tlmax;
- sym->binsiz = binsiz;
- sym->tscale = tscale;
- sym->tzero = tzero;
- sym->scaled = scaled;
- sym->exists = exists;
- sym->settype = settype;
-
- /* get tdim value, if there is one */
- if( sym->exists && (sym->n>1) )
- sym->tdim = FunParamGets(fun, "TDIM", exists, NULL, &got);
-
- /* add to list, maintaining order */
- if( enter ){
- if( !columns ){
- columns = sym;
- }
- else{
- for(cur=columns; cur->next!=NULL; cur=cur->next)
- ;
- cur->next = sym;
- }
- }
- return sym;
-}
-
-/* process a column */
-#ifdef YY_USE_PROTOS
-static int
-_CalcColProc(char *s, int expl)
-#else
-static int _CalcColProc(s, expl)
- char *s;
- int expl;
-#endif
-{
- char *e;
- char *t;
- char name[SZ_LINE];
- char sname[SZ_LINE];
- char cname[SZ_LINE];
- char aname[SZ_LINE];
- char fname[SZ_LINE];
- int ptype;
- int poff;
- int exists;
- int dims;
- int settype=0;
- int type=0;
- int n=0;
- int scaled=0;
- double tlmin=0.0, tlmax=0.0, binsiz=1.0;
- double tscale=1.0, tzero=0.0;
-
- /* save expression */
- e = s;
-
- /* gather struct name */
- for(t=sname; *s && (*s != '-');)
- *t++ = *s++;
- *t = '\0';
- /* skip past "->" */
- if( *s && (*s == '-') ) s += 2;
-
- /* if this is not a special name, just append it and exit */
- if( !_CalcColName(sname) ){
- if( !expl ){
- _CalcCat(e, &expr, &nexpr);
- return 1;
- }
- }
-
- /* gather column name */
- for(t=cname; *s && (*s != '[') && (*s != ':');)
- *t++ = *s++;
- *t = '\0';
-
- /* explicit columns don't have the prefix */
- if( expl && *sname && !*cname ){
- strncpy(cname, sname, SZ_LINE);
- strncpy(sname, "cur", SZ_LINE);
- }
-
- /* gather array part */
- if( *s && (*s == '[') ){
- for(t=aname; *s && (*s != ':');)
- *t++ = *s++;
- *t = '\0';
- }
- else
- *aname = '\0';
- if( *aname )
- snprintf(fname, SZ_LINE, "%s->%s%s", sname, cname, aname);
- else
- snprintf(fname, SZ_LINE, "%s->%s", sname, cname);
-
- /* the expression name is the combination of sname (which we will set to
- a struct we know about) and cname (which is a struct member name) */
- snprintf(name, SZ_LINE, "%s->%s", sname, cname);
-
- /* see if this column exists or if its new */
- exists = FunColumnLookup(ifun, cname, 0, NULL, &type, NULL, NULL, &n, NULL);
-
- /* gather up specifier info */
- for(; *s; s++){
- if( *s == ':' ){
- _FunColumnType(s+1, &type, &n, &tlmin, &tlmax, &binsiz, &dims,
- &tscale, &tzero, &scaled, &ptype, &poff);
- settype = 1;
- break;
- }
- }
- if( !exists && !settype && !_CalcColLookup(cname) )
- _calcerror("new column requires a type");
- if( exists && settype )
- doreplace=1;
-
- /* add this column to the list */
- if(_CalcColNew(ifun, name, sname, cname,
- type, n, tlmin, tlmax, binsiz,
- tscale, tzero, scaled,
- exists, settype)){
- if( !expl ) _CalcCat(fname, &expr, &nexpr);
- return 1;
- }
- else{
- return _calcerror("could not enter new funcalc column");
- }
-}
-
-/*
- *
- * Semi-public Routines
- *
- *
- */
-
-/*
- *
- * _CalcCat -- add a string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-void
-_CalcCat(char *str, char **ostr, int *olen)
-#else
-void _CalcCat(str, ostr, olen)
- char *str;
- char **ostr;
- int *olen;
-#endif
-{
- int blen;
- int slen;
-
- if( (str == NULL) || (*str == '\0') )
- return;
- else
- slen = strlen(str) + 1;
-
- if( (*ostr == NULL) || (**ostr == '\0') )
- blen = 0;
- else
- blen = strlen(*ostr);
-
- while( (blen + slen) >= *olen ){
- *olen += SEGINC;
- }
- if( blen == 0 )
- *ostr = (char *)xcalloc(*olen, sizeof(char));
- else
- *ostr = (char *)xrealloc(*ostr, *olen);
- strcat(*ostr, str);
-}
-
-#ifdef YY_USE_PROTOS
-char *
-FunCalcParse(char *iname, char *oname,
- char *cmd, char *ex, char *autod, int narg)
-#else
-char *FunCalcParse(iname, oname, cmd, ex, autod, narg)
- char *iname;
- char *oname;
- char *cmd;
- char *ex;
- char *autod;
- int narg;
-#endif
-{
- int i;
-
- /* initialize global variables */
- n = 0;
- rectype = REC_CUR;
- var = 1;
- args = narg;
-
- /* save command */
- if( command ) xfree(command);
- command = xstrdup(cmd);
-
- /* save autodeclare */
- if( autodeclare ) xfree(autodeclare);
- autodeclare = xstrdup(autod);
-
- /* open the input FITS file */
- if( !(ifun = FunOpen(iname, "rc", NULL)) )
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
-
- /* parse expression */
- yy_scan_string(ex);
- yylex();
-
- /* done with input FITS file */
- FunClose(ifun);
- /* free up space */
- if( expr ){
- xfree(expr);
- expr = NULL;
- }
- nexpr = 0;
- for(i=0; i<MAXCODE; i++){
- if( code[i] ){
- xfree(code[i]);
- code[i] = NULL;
- }
- ncode[i] = 0;
- }
- if( mbuf ){
- xfree(mbuf);
- mbuf = NULL;
- mlen = 0;
- }
- /* return resulting program */
- return prog;
-}
-
-#ifdef YY_USE_PROTOS
-int
-_calcerror(char *msg)
-#else
-int _calcerror(msg)
- char *msg;
-#endif
-{
- if( *yytext )
- gerror(stderr, "%s while processing '%s'\n",
- msg ? msg : "filterr", yytext);
- else
- gerror(stderr, "%s\n", msg ? msg : "filterr");
- YY_FLUSH_BUFFER;
- yyterminate();
-}
-
-#ifdef YY_USE_PROTOS
-int yywrap(void)
-#else
-int yywrap()
-#endif
-{
- return 1;
-}
diff --git a/funtools/chandra.h b/funtools/chandra.h
deleted file mode 100644
index b46b7f4..0000000
--- a/funtools/chandra.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* essential header cards for funtools, taken from chandra/acis/hrc headers */
-
-static char *_prim="SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary Data NAXIS = 0 / No image data array present EXTEND = T / There may be standard extensions EVENT = 'EVENTS ' / A3D table containing event record END ";
-
-static char *_extn="XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 136 / width of table in bytes NAXIS2 = 0 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 44 / number of fields in each row EXTNAME = 'EVENTS ' / name of this binary table extension HDUNAME = 'EVENTS ' / ASCDM block name TTYPE1 = 'time ' / S/C TT corresponding to mid-exposure TFORM1 = '1D ' / format of field TUNIT1 = 's ' TTYPE2 = 'ccd_id ' / CCD reporting event TFORM2 = '1I ' / format of field TLMIN2 = 0 TLMAX2 = 9 TTYPE3 = 'node_id ' / CCD serial readout amplifier node TFORM3 = '1I ' / format of field TLMIN3 = 0 TLMAX3 = 3 TTYPE4 = 'expno ' / Exposure number of CCD frame containing event TFORM4 = '1J ' / format of field TLMIN4 = 0 TTYPE5 = 'chipx ' / Chip coords TFORM5 = '1I ' / format of field TUNIT5 = 'pixel ' TTYPE6 = 'chipy ' / Chip coords TFORM6 = '1I ' / format of field TUNIT6 = 'pixel ' TLMIN5 = 1 TLMAX5 = 1024 TLMIN6 = 1 TLMAX6 = 1024 TTYPE7 = 'tdetx ' / ACIS tiled detector coordinates TFORM7 = '1I ' / format of field TUNIT7 = 'pixel ' TTYPE8 = 'tdety ' / ACIS tiled detector coordinates TFORM8 = '1I ' / format of field TUNIT8 = 'pixel ' TLMIN7 = 1 TLMAX7 = 8192 TLMIN8 = 1 TLMAX8 = 8192 TTYPE9 = 'detx ' / ACIS detector coordinates TFORM9 = '1E ' / format of field TUNIT9 = 'pixel ' TLMIN9 = 5.0000000E-01 TLMAX9 = 8.1925000E+03 TTYPE10 = 'dety ' / ACIS detector coordinates TFORM10 = '1E ' / format of field TUNIT10 = 'pixel ' TLMIN10 = 5.0000000E-01 TLMAX10 = 8.1925000E+03 TTYPE11 = 'x ' / sky coordinates TFORM11 = '1E ' / format of field TUNIT11 = 'pixel ' TLMIN11 = 5.0000000E-01 TLMAX11 = 8.1925000E+03 TTYPE12 = 'y ' / sky coordinates TFORM12 = '1E ' / format of field TUNIT12 = 'pixel ' TLMIN12 = 5.0000000E-01 TLMAX12 = 8.1925000E+03 TTYPE13 = 'pha ' / total pulse height of event TFORM13 = '1J ' / format of field TUNIT13 = 'adu ' TLMIN13 = 0 TLMAX13 = 36855 TNULL13 = 0 TTYPE14 = 'energy ' / nominal energy of event (eV) TFORM14 = '1E ' / format of field TUNIT14 = 'eV ' TLMIN14 = 0.0000000E+00 TLMAX14 = 1.0000000E+06 TTYPE15 = 'pi ' / pulse invariant energy of event TFORM15 = '1J ' / format of field TUNIT15 = 'chan ' TLMIN15 = 1 TLMAX15 = 1024 TNULL15 = 0 TTYPE16 = 'fltgrade' / event grade, flight system TFORM16 = '1I ' / format of field TLMIN16 = 0 TLMAX16 = 255 TTYPE17 = 'grade ' / binned event grade TFORM17 = '1I ' / format of field TLMIN17 = 0 TLMAX17 = 7 TTYPE18 = 'status ' / event status bits TFORM18 = '32X ' / format of field TTYPE19 = 'xtime ' / Label for field TFORM19 = '1D ' / Data type for field TUNIT19 = 's ' / axis units TTYPE20 = 'crsv ' / Label for field TFORM20 = '1I ' / Data type for field TLMIN20 = 0 / Min. axis value TLMAX20 = 63 / Max. axis value TTYPE21 = 'crsu ' / Label for field TFORM21 = '1I ' / Data type for field TLMIN21 = 0 / Min. axis value TLMAX21 = 63 / Max. axis value TTYPE22 = 'amp_sf ' / Label for field TFORM22 = '1I ' / Data type for field TLMIN22 = 0 / Min. axis value TLMAX22 = 3 / Max. axis value TTYPE23 = 'av1 ' / Label for field TFORM23 = '1I ' / Data type for field TLMIN23 = 0 / Min. axis value TLMAX23 = 4095 / Max. axis value TTYPE24 = 'av2 ' / Label for field TFORM24 = '1I ' / Data type for field TLMIN24 = 0 / Min. axis value TLMAX24 = 4095 / Max. axis value TTYPE25 = 'av3 ' / Label for field TFORM25 = '1I ' / Data type for field TLMIN25 = 0 / Min. axis value TLMAX25 = 4095 / Max. axis value TTYPE26 = 'au1 ' / Label for field TFORM26 = '1I ' / Data type for field TLMIN26 = 0 / Min. axis value TLMAX26 = 4095 / Max. axis value TTYPE27 = 'au2 ' / Label for field TFORM27 = '1I ' / Data type for field TLMIN27 = 0 / Min. axis value TLMAX27 = 4095 / Max. axis value TTYPE28 = 'au3 ' / Label for field TFORM28 = '1I ' / Data type for field TLMIN28 = 0 / Min. axis value TLMAX28 = 4095 / Max. axis value TTYPE29 = 'rawx ' / Label for field TFORM29 = '1J ' / Data type for field TLMIN29 = 0 / Min. axis value TLMAX29 = 16383 / Max. axis value TUNIT29 = 'pixel ' / axis units TTYPE30 = 'rawy ' / Label for field TFORM30 = '1J ' / Data type for field TLMIN30 = 0 / Min. axis value TLMAX30 = 16383 / Max. axis value TUNIT30 = 'pixel ' / axis units TTYPE31 = 'xchipx ' / Label for field TFORM31 = '1I ' / Data type for field TLMIN31 = 1 / Min. axis value TLMAX31 = 16384 / Max. axis value TUNIT31 = 'pixel ' / axis units TTYPE32 = 'xchipy ' / Label for field TFORM32 = '1I ' / Data type for field TLMIN32 = 1 / Min. axis value TLMAX32 = 16384 / Max. axis value TUNIT32 = 'pixel ' / axis units TTYPE33 = 'xtdetx ' / Label for field TFORM33 = '1J ' / Data type for field TLMIN33 = 1 / Min. axis value TLMAX33 = 16384 / Max. axis value TUNIT33 = 'pixel ' / axis units TTYPE34 = 'xtdety ' / Label for field TFORM34 = '1J ' / Data type for field TLMIN34 = 1 / Min. axis value TLMAX34 = 16384 / Max. axis value TUNIT34 = 'pixel ' / axis units TTYPE35 = 'xdetx ' / Label for field TFORM35 = '1E ' / Data type for field TLMIN35 = 0.5000000 / Min. axis value TLMAX35 = 32768.5000000 / Max. axis value TUNIT35 = 'pixel ' / axis units TTYPE36 = 'xdety ' / Label for field TFORM36 = '1E ' / Data type for field TLMIN36 = 0.5000000 / Min. axis value TLMAX36 = 32768.5000000 / Max. axis value TUNIT36 = 'pixel ' / axis units TTYPE37 = 'xx ' / Label for field TFORM37 = '1E ' / Data type for field TLMIN37 = 0.5000000 / Min. axis value TLMAX37 = 32768.5000000 / Max. axis value TUNIT37 = 'pixel ' / axis units TTYPE38 = 'xy ' / Label for field TFORM38 = '1E ' / Data type for field TLMIN38 = 0.5000000 / Min. axis value TLMAX38 = 32768.5000000 / Max. axis value TUNIT38 = 'pixel ' / axis units TTYPE39 = 'xpha ' / Label for field TFORM39 = '1I ' / Data type for field TLMIN39 = 0 / Min. axis value TLMAX39 = 255 / Max. axis value TUNIT39 = 'chan ' / axis units TTYPE40 = 'xpi ' / Label for field TFORM40 = '1I ' / Data type for field TLMIN40 = 0 / Min. axis value TLMAX40 = 255 / Max. axis value TUNIT40 = 'chan ' / axis units TTYPE41 = 'sumamps ' / Label for field TFORM41 = '1I ' / Data type for field TLMIN41 = 0 / Min. axis value TLMAX41 = 24570 / Max. axis value TTYPE42 = 'chip_id ' / Label for field TFORM42 = '1I ' / Data type for field TTYPE43 = 'xstatus ' / Label for field TFORM43 = '32X ' / Data type for field TTYPE44 = 'screen_status ' / Label for field TFORM44 = '1I ' / Data type for field EQUINOX = 2.0000000000000E+03 / default RADECSYS= 'ICRS ' / default TCTYP5 = 'CPCX ' TCRVL5 = 0.0000000000000E+00 TCRPX5 = 5.0000000000000E-01 TCDLT5 = 2.3987000000000E-02 TCUNI5 = 'mm ' TCTYP6 = 'CPCY ' TCRVL6 = 0.0000000000000E+00 TCRPX6 = 5.0000000000000E-01 TCDLT6 = 2.3987000000000E-02 TCUNI6 = 'mm ' TCTYP9 = 'LONG-TAN' TCRVL9 = 0.0000000000000E+00 TCRPX9 = 4.0965000000000E+03 TCDLT9 = 1.3666666666667E-04 TCNAM9 = 'PHI ' TCUNI9 = 'deg ' TCTYP10 = 'NPOL-TAN' TCRVL10 = 0.0000000000000E+00 TCRPX10 = 4.0965000000000E+03 TCDLT10 = 1.3666666666667E-04 TCNAM10 = 'THETA ' TCUNI10 = 'deg ' TCTYP11 = 'RA---TAN' TCRVL11 = 2.1953403149343E+02 TCRPX11 = 4.0965000000000E+03 TCDLT11 = -1.3666666666667E-04 TCUNI11 = 'deg ' TCTYP12 = 'DEC--TAN' TCRVL12 = 3.4275710651498E+01 TCRPX12 = 4.0965000000000E+03 TCDLT12 = 1.3666666666667E-04 TCUNI12 = 'deg ' END ";
diff --git a/funtools/conf.h.in b/funtools/conf.h.in
deleted file mode 100644
index 8bc8703..0000000
--- a/funtools/conf.h.in
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Define as 1 if this compiler supports long long. */
-#undef HAVE_LONG_LONG
-
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have limits.h */
-#undef HAVE_LIMITS_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
-
diff --git a/funtools/config.guess b/funtools/config.guess
deleted file mode 100755
index 2e9ad7f..0000000
--- a/funtools/config.guess
+++ /dev/null
@@ -1,1462 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright 1992-2016 Free Software Foundation, Inc.
-
-timestamp='2016-10-02'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
-#
-# Please send patches to <config-patches@gnu.org>.
-
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2016 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
- echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine=${arch}${endian}-unknown
- ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently (or will in the future) and ABI.
- case "${UNAME_MACHINE_ARCH}" in
- earm*)
- os=netbsdelf
- ;;
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
- earm*)
- expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:LibertyBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:Sortix:*:*)
- echo ${UNAME_MACHINE}-unknown-sortix
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE=alpha ;;
- "EV4.5 (21064)")
- UNAME_MACHINE=alpha ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE=alpha ;;
- "EV5 (21164)")
- UNAME_MACHINE=alphaev5 ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE=alphaev56 ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE=alphapca56 ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE=alphapca57 ;;
- "EV6 (21264)")
- UNAME_MACHINE=alphaev6 ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE=alphaev67 ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE=alphaev68 ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE=alphaev68 ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE=alphaev68 ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE=alphaev69 ;;
- "EV7 (21364)")
- UNAME_MACHINE=alphaev7 ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE=alphaev79 ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH=i386
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH=x86_64
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
- 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH=hppa2.0n ;;
- 64) HP_ARCH=hppa2.0w ;;
- '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = hppa2.0w ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH=hppa2.0w
- else
- HP_ARCH=hppa64
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
- FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- e2k:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- k1om:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
- ;;
- mips64el:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
- riscv32:Linux:*:* | riscv64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
- x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configure will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-ACE:SUPER-UX:*:*)
- echo sxace-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = x86; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = 386; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
- amd64:Isilon\ OneFS:*:*)
- echo x86_64-unknown-onefs
- exit ;;
-esac
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script (version $timestamp), has failed to recognize the
-operating system you are using. If your script is old, overwrite
-config.guess and config.sub with the latest versions from:
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
-
-If $0 has already been updated, send the following data and any
-information you think might be pertinent to config-patches@gnu.org to
-provide the necessary information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/config.sub b/funtools/config.sub
deleted file mode 100755
index cc69b06..0000000
--- a/funtools/config.sub
+++ /dev/null
@@ -1,1823 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright 1992-2016 Free Software Foundation, Inc.
-
-timestamp='2016-09-05'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2016 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | cloudabi*-eabi* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | ba \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | e2k | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | ba-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | e2k-* | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | riscv32-* | riscv64-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- asmjs)
- basic_machine=asmjs-unknown
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- e500v[12])
- basic_machine=powerpc-unknown
- os=$os"spe"
- ;;
- e500v[12]-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=$os"spe"
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- moxiebox)
- basic_machine=moxie-unknown
- os=-moxiebox
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
- ;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* | -cloudabi* | -sortix* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos* | -phoenix*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -ios)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/configure-failsafe b/funtools/configure-failsafe
deleted file mode 100755
index e0441d4..0000000
--- a/funtools/configure-failsafe
+++ /dev/null
@@ -1,7001 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for funtools 1.4.6.
-#
-# Report bugs to <saord@cfa.harvard.edu>.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME='funtools'
-PACKAGE_TARNAME='funtools'
-PACKAGE_VERSION='1.4.6'
-PACKAGE_STRING='funtools 1.4.6'
-PACKAGE_BUGREPORT='saord@cfa.harvard.edu'
-
-ac_unique_file="./funtools.h"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subdirs_all="$ac_subdirs_all util"
-ac_subdirs_all="$ac_subdirs_all fitsy"
-ac_subdirs_all="$ac_subdirs_all filter"
-ac_subdirs_all="$ac_subdirs_all wcs"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP FILTER_CC FILTER_CFLAGS LIB DEFLIB DOSHARED LLIB USE_DL USE_FPU_DOUBLE DOMAINLIB AWK gzip gnuplot EXTRA_LIBS EXTRA_OBJS PRE POST GUNZIP GNUPLOT PIPEGLUE subdirs LIBOBJS LTLIBOBJS'
-ac_subst_files=''
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-ac_prev=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures funtools 1.4.6 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
- cat <<_ACEOF
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of funtools 1.4.6:";;
- esac
- cat <<\_ACEOF
-
-Optional Features:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-shared build shared libraries
- --enable-dl allow use of dynamic loading if available
- --enable-fpu_double set FPU in double round mode
- --enable-mainlib build funtools mainlib support
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-filter-cc=CC compiler
- --with-filter-cflags=CFLAGS compiler flags
- --with-altlib=LIB library name
- --with-zlib=LIB library name
- --with-wcslib=LIB library name
- --with-tcl directory containing tcl configuration (tclConfig.sh)
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <saord@cfa.harvard.edu>.
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
- else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
- done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
- cat <<\_ACEOF
-funtools configure 1.4.6
-generated by GNU Autoconf 2.59
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by funtools $as_me 1.4.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-{
- (set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
- *)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-}
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- sed "/^$/d" confdefs.h | sort
- echo
- fi
- test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
- ' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
- esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ac_config_headers="$ac_config_headers conf.h ./gnu/conf.h ./funtest/conf.h"
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f $ac_dir/shtool; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
- { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
- ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
- { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
- ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-
-#
-# checks that we use in most projects
-#
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CC" && break
-done
-
- CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-
-echo "$as_me:$LINENO: checking for long long int" >&5
-echo $ECHO_N "checking for long long int... $ECHO_C" >&6
-if test "${ac_cv_c_long_long+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-long long int i;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_long_long=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_long_long=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5
-echo "${ECHO_T}$ac_cv_c_long_long" >&6
- if test $ac_cv_c_long_long = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
- fi
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- RANLIB=$ac_ct_RANLIB
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in malloc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in getopt.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in values.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/un.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/ipc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/mman.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
-
-for ac_header in sys/shm.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
- ;;
-esac
-
-echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
-if test "${ac_cv_type_socklen_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/socket.h>
-
-int
-main ()
-{
-if ((socklen_t *) 0)
- return 0;
-if (sizeof (socklen_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_socklen_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_socklen_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
-if test $ac_cv_type_socklen_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SOCKLEN_T 1
-_ACEOF
-
-
-fi
-
-
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- }
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_const=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_const=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-
-fi
-
-
-
-
-
-for ac_func in strchr memcpy snprintf
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
-if test "${ac_cv_func_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define connect to an innocuous variant, in case <limits.h> declares connect.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define connect innocuous_connect
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef connect
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != connect;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
-
-if test $ac_cv_func_connect = no; then
- echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-int
-main ()
-{
-connect ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_socket_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_socket_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-if test $ac_cv_lib_socket_connect = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lsocket"
-fi
-
-fi
-echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-if test "${ac_cv_func_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define gethostbyname innocuous_gethostbyname
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef gethostbyname
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != gethostbyname;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
-
-if test $ac_cv_func_gethostbyname = no; then
- echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-int
-main ()
-{
-gethostbyname ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_nsl_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lnsl"
-fi
-
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-echo "$as_me:$LINENO: checking for filter cc" >&5
-echo $ECHO_N "checking for filter cc... $ECHO_C" >&6
-
-# Check whether --with-filter-cc or --without-filter-cc was given.
-if test "${with_filter_cc+set}" = set; then
- withval="$with_filter_cc"
- FILTER_CC=\\\"$withval\\\"
-else
- FILTER_CC=NULL
-fi;
-echo "$as_me:$LINENO: result: $FILTER_CC" >&5
-echo "${ECHO_T}$FILTER_CC" >&6
-
-
-echo "$as_me:$LINENO: checking for filter cflags" >&5
-echo $ECHO_N "checking for filter cflags... $ECHO_C" >&6
-
-# Check whether --with-filter-cflags or --without-filter-cflags was given.
-if test "${with_filter_cflags+set}" = set; then
- withval="$with_filter_cflags"
- FILTER_CFLAGS=\\\"$withval\\\"
-else
- FILTER_CFLAGS=NULL
-fi;
-echo "$as_me:$LINENO: result: $FILTER_CFLAGS" >&5
-echo "${ECHO_T}$FILTER_CFLAGS" >&6
-
-
-DEFLIB="libfuntools.a"
-echo "$as_me:$LINENO: checking for alternate target library" >&5
-echo $ECHO_N "checking for alternate target library... $ECHO_C" >&6
-
-# Check whether --with-altlib or --without-altlib was given.
-if test "${with_altlib+set}" = set; then
- withval="$with_altlib"
- alt_lib=yes LIB=$withval
-else
- alt_lib=no LIB=$DEFLIB
-fi;
-echo "$as_me:$LINENO: result: $alt_lib ($LIB)" >&5
-echo "${ECHO_T}$alt_lib ($LIB)" >&6
-
-
-
-echo "$as_me:$LINENO: checking for external zlib" >&5
-echo $ECHO_N "checking for external zlib... $ECHO_C" >&6
-
-# Check whether --with-zlib or --without-zlib was given.
-if test "${with_zlib+set}" = set; then
- withval="$with_zlib"
- zlib=yes EXTRA_LIBS="$EXTRA_LIBS $withval"
-else
- zlib=no
-fi;
-echo "$as_me:$LINENO: result: $zlib" >&5
-echo "${ECHO_T}$zlib" >&6
-
-echo "$as_me:$LINENO: checking for external wcslib" >&5
-echo $ECHO_N "checking for external wcslib... $ECHO_C" >&6
-
-# Check whether --with-wcslib or --without-wcslib was given.
-if test "${with_wcslib+set}" = set; then
- withval="$with_wcslib"
- wcslib=yes EXTRA_LIBS="$EXTRA_LIBS $withval"
-else
- wcslib=no
-fi;
-echo "$as_me:$LINENO: result: $wcslib" >&5
-echo "${ECHO_T}$wcslib" >&6
-
-echo "$as_me:$LINENO: checking for shared library build" >&5
-echo $ECHO_N "checking for shared library build... $ECHO_C" >&6
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
-
- if test "$fun_ok" = "link"; then
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- using_shlib="yes"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- echo "$as_me:$LINENO: checking for dlopen in -lc" >&5
-echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6
-if test $ac_cv_lib_c_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- using_shlib="yes"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_shlib="no"
- fi
- fi
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-
-echo "$as_me:$LINENO: checking for dynamic loading of filters " >&5
-echo $ECHO_N "checking for dynamic loading of filters ... $ECHO_C" >&6
-# Check whether --enable-dl or --disable-dl was given.
-if test "${enable_dl+set}" = set; then
- enableval="$enable_dl"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- if test x"$using_shlib" != xyes; then
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- echo "$as_me:$LINENO: checking for dlopen in -lc" >&5
-echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6
-if test $ac_cv_lib_c_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
- fi
-else
- using_dl="no"
-fi
-else
-using_dl="no"
-fi
-echo "$as_me:$LINENO: result: $using_dl ($CC)" >&5
-echo "${ECHO_T}$using_dl ($CC)" >&6
-
-
-# Check whether --enable-fpu_double or --disable-fpu_double was given.
-if test "${enable_fpu_double+set}" = set; then
- enableval="$enable_fpu_double"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-echo "$as_me:$LINENO: checking for setting fpu in double rounding mode (with gcc) " >&5
-echo $ECHO_N "checking for setting fpu in double rounding mode (with gcc) ... $ECHO_C" >&6
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_fpu_double="yes"
- USE_FPU_DOUBLE="1"
-else
- using_fpu_double="no"
- USE_FPU_DOUBLE="0"
-fi
-echo "$as_me:$LINENO: result: $using_fpu_double" >&5
-echo "${ECHO_T}$using_fpu_double" >&6
-else
- USE_FPU_DOUBLE="0"
-fi
-
-
-echo "$as_me:$LINENO: checking for mainlib build" >&5
-echo $ECHO_N "checking for mainlib build... $ECHO_C" >&6
-DOMAINLIB=""
-# Check whether --enable-mainlib or --disable-mainlib was given.
-if test "${enable_mainlib+set}" = set; then
- enableval="$enable_mainlib"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
- DOMAINLIB=mainlib
-elif test "$fun_ok" = "shared"; then
- DOMAINLIB=shmainlib
-fi
-
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-
-
- #
- # Ok, lets find the tcl configuration
- # First, look for one uninstalled.
- # the alternative search directory is invoked by --with-tcl
- #
-
- if test x"${no_tcl}" = x ; then
- # we reset no_tcl in case something fails here
- no_tcl=true
-
-# Check whether --with-tcl or --without-tcl was given.
-if test "${with_tcl+set}" = set; then
- withval="$with_tcl"
- with_tclconfig=${withval}
-fi;
- echo "$as_me:$LINENO: checking for Tcl configuration" >&5
-echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
- if test x"${withval}" != xno ; then
- if test "${ac_cv_c_tclconfig+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-
- # First check to see if --with-tcl was specified.
- if test x"${with_tclconfig}" != x ; then
- if test -f "${with_tclconfig}/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
- else
- echo "$as_me:$LINENO: result: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
-echo "${ECHO_T}${with_tclconfig} directory doesn't contain tclConfig.sh" >&6
- fi
- fi
-
- # then check for a private Tcl installation
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ../tcl \
- `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
- ../../tcl \
- `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
- ../../../tcl \
- `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
-
- # check in a few common install locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in `ls -d ${libdir} 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` \
- `ls -d /usr/contrib/lib 2>/dev/null` \
- `ls -d /usr/lib 2>/dev/null` \
- ; do
- if test -f "$i/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i; pwd)`
- break
- fi
- done
- fi
-
- # check in a few other private locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ${srcdir}/../tcl \
- `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
-
-fi
-
- else
- echo "$as_me:$LINENO: result: skipping Tcl configuration" >&5
-echo "${ECHO_T}skipping Tcl configuration" >&6
- ac_cv_c_tclconfig="none"
- fi
-
- if test x"${ac_cv_c_tclconfig}" = x ; then
- TCL_BIN_DIR="# no Tcl configs found"
- echo "$as_me:$LINENO: result: can't find Tcl configuration definitions" >&5
-echo "${ECHO_T}can't find Tcl configuration definitions" >&6
-# no Tcl is OK egm 03/25/03
-# AC_MSG_WARN(Can't find Tcl configuration definitions)
-# exit 0
- elif test x"${ac_cv_c_tclconfig}" = xnone ; then
- TCL_BIN_DIR=""
- else
- no_tcl=
- TCL_BIN_DIR=${ac_cv_c_tclconfig}
- echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
-echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6
- fi
- fi
-
-if test x"${no_tcl}" = x ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TCL 1
-_ACEOF
-
-fi
-
-for ac_prog in gawk mawk nawk awk
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_AWK+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$AWK"; then
- ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_AWK="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
- echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$AWK" && break
-done
-
-
-# Extract the first word of "gzip", so it can be a program name with args.
-set dummy gzip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_gzip+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$gzip"; then
- ac_cv_prog_gzip="$gzip" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_gzip="gzip"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_gzip" && ac_cv_prog_gzip="none"
-fi
-fi
-gzip=$ac_cv_prog_gzip
-if test -n "$gzip"; then
- echo "$as_me:$LINENO: result: $gzip" >&5
-echo "${ECHO_T}$gzip" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-if test "$gzip" = "none"; then
- GUNZIP="cat"
-else
- GUNZIP="$gzip -dcf"
-fi
-
-# Extract the first word of "gnuplot", so it can be a program name with args.
-set dummy gnuplot; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_gnuplot+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$gnuplot"; then
- ac_cv_prog_gnuplot="$gnuplot" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_gnuplot="gnuplot"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_gnuplot" && ac_cv_prog_gnuplot="none"
-fi
-fi
-gnuplot=$ac_cv_prog_gnuplot
-if test -n "$gnuplot"; then
- echo "$as_me:$LINENO: result: $gnuplot" >&5
-echo "${ECHO_T}$gnuplot" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-if test "$gnuplot" = "none"; then
- GNUPLOT="NONE"
-else
- GNUPLOT="$gnuplot"
-fi
-
-echo "$as_me:$LINENO: checking $host_os configuration" >&5
-echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
- CFLAGS="$CFLAGS -enable-auto-import"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CYGWIN
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging Cygwin" >&5
-echo "${ECHO_T}flagging Cygwin" >&6
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MINGW32
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging MinGW" >&5
-echo "${ECHO_T}flagging MinGW" >&6
- ;;
- *osf*|*Osf*)
- echo "$as_me:$LINENO: checking for snprintf in -ldb" >&5
-echo $ECHO_N "checking for snprintf in -ldb... $ECHO_C" >&6
-if test "${ac_cv_lib_db_snprintf+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldb $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char snprintf ();
-int
-main ()
-{
-snprintf ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_db_snprintf=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_db_snprintf=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_db_snprintf" >&5
-echo "${ECHO_T}$ac_cv_lib_db_snprintf" >&6
-if test $ac_cv_lib_db_snprintf = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -ldb"
-fi
-
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fno-common, -fPIC to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common, -fPIC to CFLAGS" >&6
- else
- echo "$as_me:$LINENO: result: adding -fno-common to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common to CFLAGS" >&6
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fPIC to gcc" >&5
-echo "${ECHO_T}adding -fPIC to gcc" >&6
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- ;;
-esac
-
-
-
-
-
-
-
-
-
-
- ac_config_files="$ac_config_files Makefile ./gnu/Makefile ./funtest/Makefile ./faq/Makefile"
-
-
-# generate pkg-config meta-data file
- ac_config_files="$ac_config_files funtools.pc"
-
-
-# for individual package that create libraries, we must run configure again,
-# faking the subdirs into using the funtools library as their library
-# this will run faster with --config-cache
-ac_configure_args="--with-altlib=`pwd`/$LIB $ac_configure_args"
-# AC_CONFIG_SUBDIRS(util fitsy filter wcs)
-
-
-subdirs="$subdirs util"
-
-
-
-subdirs="$subdirs fitsy"
-
-
-
-subdirs="$subdirs filter"
-
-
-
-subdirs="$subdirs wcs"
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by funtools $as_me 1.4.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-funtools config.status 1.4.6
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-
-
-
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "./gnu/Makefile" ) CONFIG_FILES="$CONFIG_FILES ./gnu/Makefile" ;;
- "./funtest/Makefile" ) CONFIG_FILES="$CONFIG_FILES ./funtest/Makefile" ;;
- "./faq/Makefile" ) CONFIG_FILES="$CONFIG_FILES ./faq/Makefile" ;;
- "funtools.pc" ) CONFIG_FILES="$CONFIG_FILES funtools.pc" ;;
- "conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;;
- "./gnu/conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ./gnu/conf.h" ;;
- "./funtest/conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ./funtest/conf.h" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@FILTER_CC@,$FILTER_CC,;t t
-s,@FILTER_CFLAGS@,$FILTER_CFLAGS,;t t
-s,@LIB@,$LIB,;t t
-s,@DEFLIB@,$DEFLIB,;t t
-s,@DOSHARED@,$DOSHARED,;t t
-s,@LLIB@,$LLIB,;t t
-s,@USE_DL@,$USE_DL,;t t
-s,@USE_FPU_DOUBLE@,$USE_FPU_DOUBLE,;t t
-s,@DOMAINLIB@,$DOMAINLIB,;t t
-s,@AWK@,$AWK,;t t
-s,@gzip@,$gzip,;t t
-s,@gnuplot@,$gnuplot,;t t
-s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t
-s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t
-s,@PRE@,$PRE,;t t
-s,@POST@,$POST,;t t
-s,@GUNZIP@,$GUNZIP,;t t
-s,@GNUPLOT@,$GNUPLOT,;t t
-s,@PIPEGLUE@,$PIPEGLUE,;t t
-s,@subdirs@,$subdirs,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- # Do quote $f, to prevent DOS paths from being IFS'd.
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
- rm -f conftest.defines
- mv conftest.tail conftest.defines
-done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
-
-cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
- if test x"$ac_file" != x-; then
- if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
- { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
- else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- rm -f $ac_file
- mv $tmp/config.h $ac_file
- fi
- else
- cat $tmp/config.h
- rm -f $tmp/config.h
- fi
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-
-#
-# CONFIG_SUBDIRS section.
-#
-if test "$no_recursion" != yes; then
-
- # Remove --cache-file and --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- for ac_arg in $ac_configure_args; do
- if test -n "$ac_prev"; then
- ac_prev=
- continue
- fi
- case $ac_arg in
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
- | --c=*)
- ;;
- --config-cache | -C)
- ;;
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- ;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
- esac
- done
-
- # Always prepend --prefix to ensure using the same prefix
- # in subdir configurations.
- ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args"
-
- ac_popdir=`pwd`
- for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
-
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- test -d $srcdir/$ac_dir || continue
-
- { echo "$as_me:$LINENO: configuring in $ac_dir" >&5
-echo "$as_me: configuring in $ac_dir" >&6;}
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
- cd $ac_dir
-
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
- elif test -f $ac_srcdir/configure; then
- ac_sub_configure="$SHELL '$ac_srcdir/configure'"
- elif test -f $ac_srcdir/configure.in; then
- ac_sub_configure=$ac_configure
- else
- { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
-echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
- ac_sub_configure=
- fi
-
- # The recursion is here.
- if test -n "$ac_sub_configure"; then
- # Make the cache file name correct relative to the subdirectory.
- case $cache_file in
- [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
- *) # Relative path.
- ac_sub_cache_file=$ac_top_builddir$cache_file ;;
- esac
-
- { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
-echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
- # The eval makes quoting arguments work.
- eval $ac_sub_configure $ac_sub_configure_args \
- --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
- { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
-echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
- cd $ac_popdir
- done
-fi
-
diff --git a/funtools/configure.ac b/funtools/configure.ac
deleted file mode 100644
index 08fc11c..0000000
--- a/funtools/configure.ac
+++ /dev/null
@@ -1,286 +0,0 @@
-# This file is an input file used by the GNU "autoconf" program to
-# generate the file "configure", which is run during XPA installation
-# to configure the system for the local environment.
-AC_INIT(funtools, 1.4.7, saord@cfa.harvard.edu, funtools)
-
-AC_CONFIG_HEADERS([conf.h ./gnu/conf.h ./funtest/conf.h])
-AC_CONFIG_SRCDIR([./funtools.h])
-AC_CANONICAL_HOST
-
-#
-# checks that we use in most projects
-#
-AC_PROG_CC
-
-AC_EXEEXT
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-AC_C_LONG_LONG
-
-AC_PROG_RANLIB
-
-AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(getopt.h)
-AC_CHECK_HEADERS(values.h)
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_HEADERS(sys/un.h)
-AC_CHECK_HEADERS(sys/ipc.h)
-AC_CHECK_HEADERS(sys/mman.h)
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
- AC_CHECK_HEADERS(sys/shm.h)
- ;;
-esac
-
-AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])
-
-AC_C_CONST
-
-AC_CHECK_FUNCS(strchr memcpy snprintf)
-
-AC_CHECK_FUNC(connect)
-if test $ac_cv_func_connect = no; then
- AC_CHECK_LIB(socket, connect, EXTRA_LIBS="$EXTRA_LIBS -lsocket")
-fi
-AC_CHECK_FUNC(gethostbyname)
-if test $ac_cv_func_gethostbyname = no; then
- AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-AC_MSG_CHECKING(for filter cc)
-AC_ARG_WITH(filter-cc, [ --with-filter-cc=CC compiler],
- FILTER_CC=\\\"$withval\\\", FILTER_CC=NULL)
-AC_MSG_RESULT($FILTER_CC)
-AC_SUBST(FILTER_CC)
-
-AC_MSG_CHECKING(for filter cflags)
-AC_ARG_WITH(filter-cflags, [ --with-filter-cflags=CFLAGS compiler flags],
- FILTER_CFLAGS=\\\"$withval\\\", FILTER_CFLAGS=NULL)
-AC_MSG_RESULT($FILTER_CFLAGS)
-AC_SUBST(FILTER_CFLAGS)
-
-DEFLIB="libfuntools.a"
-AC_MSG_CHECKING(for alternate target library)
-AC_ARG_WITH(altlib, [ --with-altlib=LIB library name],
- alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB)
-AC_MSG_RESULT($alt_lib ($LIB))
-AC_SUBST(LIB)
-AC_SUBST(DEFLIB)
-
-AC_MSG_CHECKING(for external zlib)
-AC_ARG_WITH(zlib, [ --with-zlib=LIB library name],
- zlib=yes EXTRA_LIBS="$EXTRA_LIBS $withval", zlib=no)
-AC_MSG_RESULT($zlib)
-
-AC_MSG_CHECKING(for external wcslib)
-AC_ARG_WITH(wcslib, [ --with-wcslib=LIB library name],
- wcslib=yes EXTRA_LIBS="$EXTRA_LIBS $withval", wcslib=no)
-AC_MSG_RESULT($wcslib)
-
-AC_MSG_CHECKING(for shared library build)
-AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
- AC_SUBST(DOSHARED)
- if test "$fun_ok" = "link"; then
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- using_shlib="yes"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- using_shlib="yes"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_shlib="no"
- fi
- fi
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-AC_SUBST(LLIB)
-AC_MSG_RESULT($fun_ok)
-
-AC_MSG_CHECKING([for dynamic loading of filters ])
-AC_ARG_ENABLE(dl, [ --enable-dl allow use of dynamic loading if available],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- if test x"$using_shlib" != xyes; then
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
- fi
-else
- using_dl="no"
-fi
-else
-using_dl="no"
-fi
-AC_MSG_RESULT([$using_dl ($CC)])
-AC_SUBST(USE_DL)
-
-AC_ARG_ENABLE(fpu_double, [ --enable-fpu_double set FPU in double round mode],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-AC_MSG_CHECKING([for setting fpu in double rounding mode (with gcc) ])
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_fpu_double="yes"
- USE_FPU_DOUBLE="1"
-else
- using_fpu_double="no"
- USE_FPU_DOUBLE="0"
-fi
-AC_MSG_RESULT([$using_fpu_double])
-else
- USE_FPU_DOUBLE="0"
-fi
-AC_SUBST(USE_FPU_DOUBLE)
-
-AC_MSG_CHECKING(for mainlib build)
-DOMAINLIB=""
-AC_ARG_ENABLE(mainlib, [ --enable-mainlib build funtools mainlib support],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
- DOMAINLIB=mainlib
-elif test "$fun_ok" = "shared"; then
- DOMAINLIB=shmainlib
-fi
-AC_SUBST(DOMAINLIB)
-AC_MSG_RESULT($fun_ok)
-
-SC_PATH_TCLCONFIG
-if test x"${no_tcl}" = x ; then
- AC_DEFINE([HAVE_TCL], [1], [Define if tcl is used.])
-fi
-
-AC_PROG_AWK
-
-AC_CHECK_PROG(gzip, gzip, gzip, none)
-if test "$gzip" = "none"; then
- GUNZIP="cat"
-else
- GUNZIP="$gzip -dcf"
-fi
-
-AC_CHECK_PROG(gnuplot, gnuplot, gnuplot, none)
-if test "$gnuplot" = "none"; then
- GNUPLOT="NONE"
-else
- GNUPLOT="$gnuplot"
-fi
-
-AC_MSG_CHECKING([$host_os configuration])
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
- CFLAGS="$CFLAGS -enable-auto-import"
- AC_DEFINE([HAVE_CYGWIN])
- AC_MSG_RESULT(flagging Cygwin)
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
- AC_DEFINE([HAVE_MINGW32])
- AC_MSG_RESULT(flagging MinGW)
- ;;
- *osf*|*Osf*)
- AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT([adding -fno-common, -fPIC to CFLAGS])
- else
- AC_MSG_RESULT([adding -fno-common to CFLAGS])
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT(adding -fPIC to gcc)
- else
- AC_MSG_RESULT(none)
- fi
- else
- AC_MSG_RESULT(none)
- fi
- ;;
-esac
-
-AC_SUBST(EXTRA_LIBS)
-AC_SUBST(EXTRA_OBJS)
-AC_SUBST(PRE)
-AC_SUBST(POST)
-AC_SUBST(AWK)
-AC_SUBST(GUNZIP)
-AC_SUBST(GNUPLOT)
-AC_SUBST(PIPEGLUE)
-
-AC_CONFIG_FILES(Makefile ./gnu/Makefile ./funtest/Makefile ./faq/Makefile)
-
-# generate pkg-config meta-data file
-AC_CONFIG_FILES(funtools.pc)
-
-# for individual package that create libraries, we must run configure again,
-# faking the subdirs into using the funtools library as their library
-# this will run faster with --config-cache
-ac_configure_args="--with-altlib=`pwd`/$LIB $ac_configure_args"
-# AC_CONFIG_SUBDIRS(util fitsy filter wcs)
-AC_CONFIG_SUBDIRS(util)
-AC_CONFIG_SUBDIRS(fitsy)
-AC_CONFIG_SUBDIRS(filter)
-#AC_CONFIG_SUBDIRS(wcs)
-
-AC_OUTPUT
diff --git a/funtools/copyright b/funtools/copyright
deleted file mode 100644
index dfd5e80..0000000
--- a/funtools/copyright
+++ /dev/null
@@ -1,30 +0,0 @@
-Unless otherwise indicated, all source is:
-
-Copyright (C) 1999-2007
-Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
-Funtools is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Correspondence concerning Funtools should be addressed as follows:
-
-Eric Mandel
-Smithsonian Astrophysical Observatory
-MS 3
-60 Garden St.
-Cambridge, MA 02138 USA
-
-eric@cfa.harvard.edu
-
-http://hea-www.harvard.edu/saord/funtools/
diff --git a/funtools/doc/asc2fits.c b/funtools/doc/asc2fits.c
deleted file mode 100644
index 5be9a9e..0000000
--- a/funtools/doc/asc2fits.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * asc2fits foo.fits < foo.ascii
- *
- * This is an example of generating a binary table from specific ASCII input.
- * The more general case is much harder.
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <funtools.h>
-
-#define SZ_LINE 1024
-#define MAXREC 30
-
-typedef struct EvStruct{
- int x, y, pha;
- double time;
-} *Event, EventRec;
-
-int main(int argc, char **argv)
-{
- int got, put;
- char tbuf[SZ_LINE];
- Fun fun;
- EventRec events[MAXREC];
- Event ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- if( argc < 2 ){
- fprintf( stderr, "usage: %s oname\n", argv[0]);
- exit(1);
- }
-
- /* open output file */
- if( !(fun = FunOpen(argv[1],"w", NULL)) )
- gerror(stderr, "Could not open the output file: %s\n", argv[1]);
-
- /* set up the (hardwired) columns */
- FunColumnSelect( fun, sizeof(EventRec), NULL,
- "x", "J", "w", FUN_OFFSET(Event, x),
- "y", "J", "w", FUN_OFFSET(Event, y),
- "pha", "J", "w", FUN_OFFSET(Event, pha),
- "time", "D", "w", FUN_OFFSET(Event, time),
- NULL);
-
- /* ignore first line, which is the header */
- fgets(tbuf, SZ_LINE, stdin);
-
- /* process data lines */
- got = 0;
- /* get next line */
- while( fgets(tbuf, SZ_LINE, stdin) ){
- /* ignore comments */
- if( (*tbuf == '\n') || (*tbuf == '#') )
- continue;
- /* point to next buffer to fill */
- ev = &events[got];
- /* parse data record */
- if(sscanf(tbuf, "%d %d %d %lf", &ev->x, &ev->y, &ev->pha, &ev->time) != 4)
- break;
- /* got another record */
- got++;
- /* flush this batch of records if necessary */
- if( got == MAXREC ){
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- /* reset record counter */
- got = 0;
- }
- }
- /* final flush */
- if( got ){
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/doc/changelog.html b/funtools/doc/changelog.html
deleted file mode 100644
index a4049c8..0000000
--- a/funtools/doc/changelog.html
+++ /dev/null
@@ -1,1182 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Funtools ChangeLog</TITLE>
-</HEAD>
-<BODY>
-<H2>Funtools ChangeLog</H2>
-
-<P>
-This ChangeLog covers both the Funtools library and the suite of
-applications. It will be updated as we continue to develop and improve
-Funtools. The up-to-date version can be found
-<A HREF="http://hea-www.harvard.edu/RD/funtools/changelog.html">here</A>.
-[The changelog for the initial development of Funtools, covering the
-beta releases, can be found
-<A HREF="http://hea-www.harvard.edu/RD/funtools/changelog_beta.html">here</A>.]
-
-<H2> Patch Release 1.4.6 (internal ds9 release)</H2>
-<ul>
-<p>
-<li> Upgrade wcssubs to version 3.8.7
-<p>
-<li> Port to mingw (Windows)
-</ul>
-
-<H2> Patch Release 1.4.5 (internal ds9 release)</H2>
-<ul>
-<p>
-<li> Fixed bug in funim.c which broke vcol functionality.
-<p>
-<li> Removed permission checking from Find() on cygwin systems. This was broken
-by Windows 7.
-<p>
-<li> Removed addition of -no-cpp-precomp flag from gcc 4.2 and beyond.
-</ul>
-
-<H2> Patch Release 1.4.4 (internal ds9 release)</H2>
-<ul>
-<p>
-<li> Fixed -J funcone, which was not properly outputting all rows.
-<p>
-<li> Filter: when an image is flipped, the rotation angle must be reversed.
-<p>
-<li> Filter: add support for windows-based ipc communication when using tcc
-compiler.
-</ul>
-
-<H2> Patch Release 1.4.3 (internal ds9 release)</H2>
-<ul>
-<p>
-<li> Filter: improve checks for existence of compiler, even if CC is set.
-<p>
-<li> Change launch.h to xlaunch.h to avoid conflict with OS X.
-<p>
-<li> handle flipped images in filtering
-</ul>
-
-<H2> Patch Release 1.4.2 (internal ds9 release)</H2>
-<ul>
-<p>
-<li> Port to gcc 4.2.
-<p>
-<li> Fix 1-byte filters on intel machines (missing SW1 no-op).
-<p>
-<li> Remove ambiguity from filt.l (and calc.l) using [A-z] in a
-case-insensitive lexer.
-<p>
-<li> In funsky, the default unit for RA was changed from hours to degrees.
-<p>
-<li> Fixed bug in funtable in which TCRVL header values were output as strings.
-<p>
-<li> Added support for running funtools filters in Rosetta (i.e. running PPC
-executables on an Intel Mac) by sensing and handling data swap requirements.
-Only works with FILTER_PTYPE set to 'c' (can't link against wrong architecture
-libraries).
-<p>
-<li> Fixed bug in FITS library to allow "-" in extension names.
-<p>
-<li> Code and documentation now agree that the copy extension specifier ('+')
-comes after the extension name.
-</ul>
-
-<H2> Patch Release 1.4.1 (internal ds9 release)</H2>
-<ul>
-<p>
-<li> Modified internal Launch() routine to use posix_spawn(), if necessary.
-This is required for OS X 10.5 (leopard), which frowns upon use of fork()
-and exec(). Also modified zprocess routines to use Launch().
-</ul>
-
-<H2> Public Release 1.4.0 (15 August 2007)</H2>
-
-<ul>
-<li> Public release of production-quality code, incorporating changes
-and improvements from previous beta releases, including:
-<ul>
-<li> Support for access to ASCII text column files.
-<li> Support for fast indexed access of binary tables.
-<li> Support for database views of tables, i.e. pre-set values for the filter
- specification, the columns to activate, and display format.
-<li> New programs include funcone (cone search), funindex (create index files),
- and funcen (calculate centroids within regions).
-</ul>
-
-</ul>
-
-<H2> Release 1.3.0b[n] (mainly internal SAO beta releases)</H2>
-<ul>
-
-<p>
-<li> Added -F[c] switch to change the column delimiter to the
-specified character.
-
-<p>
-<li> Extended fundisp's format switch (-f) so that it can now handle complex
-formats such as 'x=sometext%3d- y=othertest%3d.ext'.
-
-<p>
-<li> Added support for creating and processing 1D FITS images.
-
-<p>
-<li> Added vcol=colname and vcol=/colname to filter specifications to
-support use of a third value column when binning 2D images.
-
-<p>
-<li> Added switches to funcone to write out data rows are not within
-any cone (-J, -X) and centers which have no close data rows (-L).
-
-<p>
-<li> In funjoin, added ability to specify a numeric tolerance for when joining
-two files.
-
-<p>
-<li> shared memory support in gio now can create a shared segment if w+ is
-specified as the open mode.
-
-<p>
-<li> Changed reggeometry man page so that examples correctly show angles
-going counter-clockwise from the x-axis instead of from the y-axis.
-
-<p>
-<li> Added checks to funmerge to ensure that all files have the same columns.
-
-<p>
-<li> Fixed bug in text support that prevented header-less files from being
-processed properly.
-
-<p>
-<li> Added support for 64-bit images (bitpix=64) and table columns (TFORM=K).
-
-<p>
-<li> Filter code was not applying bscale/bzero to columns.
-
-<p>
-<li> Fixed funimage bug that caused a .5/block error in WCS CRPIX values
-generated from binary tables.
-
-<p>
-<li> Added feq(a,b) and div(a,b) macros to funcalc.
-
-<p>
-<li> Added support for single-line #define to funcalc.
-
-<p>
-<li> Updated wcs library to 3.6.6
-
-<p>
-<li> Fix bug in funcen in which ra,dec was not being calculated correctly
-if physical and image coords did not match up.
-
-<p>
-<li> The filter syntax "col1 = col2" now explicitly generates an error
-(you really want to do "col1 == col2").
-
-<p>
-<li> Added -o switch to include offset from the nominal target position.
-
-<p>
-<li> Fundisp now displays multi-dimensional vector columns properly.
-
-<p>
-<li> Documented support for lists of files processed as a single file
-using "list: file1 ... filen" syntax.
-
-<p>
-<li> Fixed bugs in support for pipe file type (i.e. ability to pass
-commands as a filename using "pipe: cmd arg1 ... argn" syntax).
-
-<p>
-<li> Fixed bug in funhist processing of image-based pixel histograms
-(i.e using "xy" for columns) where a region was specified. All pixels
-outside the region were erroneously being added to the bin containing
-the 0 value.
-
-<p>
-<li> Disabled multi-file processing in funds9, which was breaking support
-for pathnames containing spaces and is not used by ds9 anyway.
-
-<p>
-<li> Added support for Views of tables, i.e. pre-set values for the
-filter specification, the columns to activate, and display format
-(though the latter is for fundisp only).
-
-<p>
-<li> Added -l switch to funimage to read x, y, val columns from a list.
-
-<p>
-<li> Removed useless and meaningless section syntax foo'[*]' because it
-breaks pointer de-referencing on string columns (i.e. foo'[*xxx=='a']').
-Use foo'[*,*]' instead, as documented.
-
-<p>
-<li> String variables were not always being terminated properly in the
-filter code because FITS 'A' data is not necessarily null-terminated.
-
-<p>
-<li> Added funtools version number to all usage() displays.
-
-<p>
-<li> Added explanation of switch arguments to many usage() displays.
-
-<p>
-<li> The filter keyword row# now supports single row selection as well
-as range selection, i.e., "row#=100" along with previous "row#=100:200".
-
-<p>
-<li> fundisp now outputs "0x" before hex values.
-
-<p>
-<li> Fixed bug in filter parser which processed rangelists incorrectly
-if spaces were put into the rangelist (i.e. "pha= 1 : 3" instead of
-pha=1:3).
-
-<p>
-<li> Fixed a bug in funindex which created a wrongly named index file
-if more than one "." was in the input file name.
-
-<p>
-<li> Added support to funcone to take ra, dec, radius from a list
-(i.e. columns in a FITS file or a text file).
-
-<p>
-<li> Fixed a bug in FunColumnActivate so that if some columns are
-explicitly activated while others are de-activated, only the
-explicitly activated columns are activated (code was activating all
-columns in this case).
-
-<p>
-<li> Fixed a bug in funindex which prevented indexing tables containing
-a column named N.
-
-<p>
-<li> fundisp now encloses ASCII column values in single quotes (unless
--T is specified to output RDB format).
-
-<p>
-<li> If a filter specification only involves indexed columns, then the
-compiled filter is not used.
-
-<p>
-<li> Funmerge can now be given a list of files to merge using @list syntax.
-Also removed the restriction on how many files can be merged (was limited to
-the max number of open files).
-
-<p>
-<li> Added ability to edit (add, delete, modify) header parameters in funhead
-by specifying an output file (editing acts as a filter) and an edit command
-file (which can be stdin).
-
-<p>
-<li> Funtools now contains preliminary code to support (fast) indexed access
-of binary tables. See idx.html or "man funidx" for more details.
-
-<p>
-<li> Funtools now contains preliminary code supporting access to ASCII
-column files. See text.html or "man funtext" for more details.
-
-<p>
-<li> Fixed bug in funcalc in which columns used in an expression were
-always being replaced by new columns, with all associated parameters
-(e.g. WCS) were being deleted. Now this only happens if the column
-explicitly changes its data type.
-
-<p>
-<li> Fixed bug in funcalc in which the raw data and user data became out
-of sync for one row after every 8192 (FUN_MAXROW) rows.
-
-<p>
-<li> Fixed bug in gio in which gseek returned 0 instead of the current byte
-offset for disk files.
-
-<p>
-<li> Added funcone program to perform cone search on RA, Dec columns in
-a FITS binary table.
-
-<p>
-<li> Fixed bug in polygon, pie and rotated box region filtering for
-tables (nearby rows exactly in line between two non-vertical or
-non-horizontal vertices were being accepted incorrectly).
-
-<p>
-<li> Fixed pie and panda regions so that the angles now start from
-positive x axis == 0 degrees and run counter-clockwise, as
-documented. They were going from positive y. NB: a similar change
-was made to ds9 release 4.0b3. You must be using ds9 4.0b3 or later
-in order to have the correct behavior when generating regions in ds9
-and using them in funtools.
-
-<p>
-<li> Added -p [prog] switch to funcalc to save the generated program.
-instead of executing (and deleting) it.
-
-<p>
-<li> Upgraded zlib to 1.2.3.
-
-</ul>
-
-<H2> Patch Release 1.2.4 (internal SAO and beta release only)</H2>
-<ul>
-
-<p>
-<li> In funcalc, added support for user-specified arguments via the
--a [argstr] switch. These arguments are accessed in the compiled program
-using the supplied ARGC and ARGV(n) macros.
-
-<p>
-<li> Added -n (no header display) to fundisp to skip outputting header.
-
-<p>
-<li> Added checks for various types of blank filters.
-
-<p>
-<li> Added macros NROW (current row number) and WRITE_ROW (write current
-row to disk) to funcalc.
-
-<p>
-<li> funcalc no longer requires that at least one data column be
-specified in the compiled expression.
-
-<p>
-<li> Added FUN_NROWS to FunInfoGet() to return the total number of rows in
-an input table (i.e. value of NAXIS2).
-
-<p>
-<li> The compiled funcalc program now includes stdlib.h and unistd.h.
-
-<p>
-<li> The util/NaN.h header file is now modified at configure time to
-contain endian status for the target architecture. References to
-specific platforms have been removed.
-
-<P>
-<li> Added -m switch to funtable to output multiple files, one for
-each input region (and a separate file for events that pass the
-filters but are not in any region).
-
-<p>
-<li> Added ability to add new parameters (FunParamPutx) after writing
-data if space is previously reserved in the form of a blank parameter
-whose value is the name of the param to be updated. (Also requires the
-append argument of FunParamPutx be set to 2).
-
-<p>
-<li> Added ability to build shared libraries. With --enable-shared=yes,
-shared library is built but not used. With --enable-shared=link,
-shared library is linked against (requires proper installation and/or
-use of LD_LIBRARY_PATH).
-
-<p>
-<li> Added -v [column] support to funcnts so that counts in a table
-can be accumulated using values from a specified column (instead of
-the default case where an integral count is accumulated for each event
-in a region).
-
-<p>
-<li> Added funcen program to calculate centroids within regions
-(binary tables only). Also added support for a funcen-based centroid
-tool to funtools.ds9.
-
-<p>
-<li> Fixed bug which prevented successful filtering of columns containing
-arrays.
-
-<p>
-<li> Added filter check to ensure that a column is not incorrectly used
-as an array.
-
-<p>
-<li> Fundisp now displays column arrays indexed from 0, not 1.
-
-<p>
-<li> Added -i [interval] support to funcnts so that multiple intervals
-can be processed in a single pass through the data. For example,
-specifying -i "pha=1:5;pha=6:10;pha=11:15" will generate results in
-each of 3 pha bands.
-
-<p>
-<li> Fixed calculation of LTV quantities when binning floating point
-column data (value was off by 0.5).
-
-<p>
-<li> Added support for 'D' in floating point header values.
-
-<p>
-<li> Added -a switch to funimage and funtable to append output image or
-table to an existing FITS file (as an IMAGE or BINTABLE extension).
-
-<p>
-<li> Added support for column scaling (TSCAL and TZERO) on input columns.
-Note that the default column type is changed to accommodate scaling (e.g.
-a column of type 'I' is changed to 'J', 'J' is changed to 'D') so that
-the scaled values can be handled properly by programs such as fundisp
-(which utilize default types).
-
-<p>
-<li> Added support to FunColumnSelect() for handling structs of arrays
-(i.e. where returned columns are contiguous) instead of the default array
-of structs (returned row are contiguous). This is done by specifying
-"org=structofarrays" in the plist and passing a single struct containing
-the arrays.
-
-<p>
-<li> When writing an rdb/starbase file, fundisp now outputs the full
-column name, regardless of the width of the column (which ordinarily
-is truncated to match).
-
-<p>
-<li> Fixed support for large files by changing all file positions variables
-from "long" declarations to "off_t.
-
-<p>
-<li> Fixed bug in funcalc incorrectly processed multiple array
-references (e.g. cur->foo[0]=cur->x;cur->foo[1]=cur->y;) within a single
-line of code.
-
-<p>
-<li> Added FILTER_CFLAGS environment variable for all filtering. Also added
---with-filter-cc and --with-filter-cflags options on configure to allow
-specification of a default C compiler and associated CFLAGS for filtering.
-All of this is necessary in order to support 64-bit libraries under Solaris.
-
-<p>
-<li> Added the funtbl script to extract a table from Funtools ASCII output.
-
-<p>
-<li> Added code to funimage to update IRAF DATASEC keyword.
-
-<p>
-<li> Added checks to ensure that image dimensions are positive.
-
-<p>
-<li> Fixed a bug in funimage where int data was being scaled using BSCALE and
-BZERO but these keywords also were being retained in the output image header.
-Now the data are not scaled unless the output data type is float (in which
-case the scaling parameters are removed).
-
-<p>
-<li> Fixed a bug in funmerge which prevented merging of files unless one of
-the -f, -w, or -x switches were used.
-
-<p>
-<li> Fixed a bug in funtable and fundisp which caused the special '$n' column
-to be output incorrectly.
-
-<p>
-<li> Fixed sort option in funtable, which previously worked only if the
-record size was an even divisor of 8192 (and returned garbage otherwise).
-
-<p>
-<li> Fixed bug in filters involving FITS data type 'X' (bitfield).
-
-<p>
-<li> Fixed bug in funcnts in which the output angles and radii were
-being displayed incorrectly when multiple panda shapes were specified.
-
-<p>
-<li> Fixed bug in pandas and pies using n= syntax when first angle
-specified was greater than second. The resulting mask was of
-the correct shape but contained only a single region.
-
-<p>
-<li> Table row access routines will now decrease maxrows if memory cannot be
-allocated for maxrows*sizeof(row), i.e. if the size of a row is so large that
-space for maxrows cannot be allocated.
-
-<p>
-<li> The FUN_MAXBUFSIZE environment variable was added to limit the
-max buffer size that will be allocated to hold table row data. The
-default is 5Mb.
-
-<p>
-<li> Generated PostScript and PDF versions of the help pages.
-
-<p>
-<li> Moved OPTIONS section before (often-lengthy) DESCRIPTION section in
-man pages.
-
-<p>
-<li> All memory allocation now does error checking on the result
-(except wcs library, which is external code).
-
-<p>
-<li> Removed some compiler warnings that surfaced when using gcc -O2.
-
-<p>
-<li> Updated wcs library to 3.5.5.
-
-<p>
-<li> Upgraded zlib to 1.2.1.
-
-</ul>
-
-<H2> Patch Release 1.2.3 (12 January 2004)</H2>
-<ul>
-
-<p>
-<li> Generated man pages from the html pages. These are installed
-automatically at build time.
-
-<p>
-<li> Changed instances of sprintf() to snprintf() to protect
-against buffer overflow.
-
-<p>
-<li> Fixed a number of compiler warnings in non-ANSI compilers.
-
-<p>
-<li> Increased SZ_LINE parameter value from 1024 to 4096.
-
-</ul>
-
-<H2> Patch Release 1.2.3b1 (19 August 2003)</H2>
-<ul>
-
-<p>
-<li> The rule for using comma to separate a table filter expression
-and a region expression has been changed. The rule now states:
-<ul>
-<LI> if both expressions contain a region, the operator used is <B>or</B>.
-<LI> if one (or both) expression(s) does not contain a region, the operator
-used is <B>and</B>.
-</ul>
-This rule handles the cases of pure regions and pure column filters properly.
-It unambiguously assigns the boolean <B>and</B> to all mixed cases. Thus:
-<PRE>
- foo.fits[circle(10,10,3),pi=1:5]
-</PRE>
-and
-<PRE>
- foo.fits[pi=1:5,circle(10,10,3)]
-</PRE>
-both are equivalent to:
-<PRE>
- foo.fits[circle(10,10,3) && pi=1:5]
-</PRE>
-
-<p>
-<li> When include files are used in filters, they now have implied
-parentheses surrounding them. Thus, if a region file foo.reg contains two
-regions (e.g. circle 1 2 3 and circle 4 5 6), the syntax:
-<pre>
- pha=4:5&&@foo.reg
-</pre>
-is equivalent to:
-<pre>
- pha=4:5 && (circle 1 2 3 || cir 4 5 6)
-</pre>
-instead of:
-<pre>
- pha=4:5 && circle 1 2 3 || cir 4 5 6
-</pre>
-and the pha filter is applied to both regions.
-
-<p>
-<li> Filters and comments now can be terminated with the string
-literal "\n" as well as ";" and the new-line character. This means
-that a region can have comments embedded in it:
-<pre>
- funcnts foo.fits "circle 512 512 10 # color=red\n circle 512 512 20"
-</pre>
-
-<p>
-<li> Added capability to update the value of an existing parameter
-after writing the table or image (assuming the output image is a
-disk file or is being redirected into a file).
-
-<p>
-<li> Improved handling of parentheses in filter expressions.
-
-<p>
-<li> Fixed a bug in image (not event) regions in which circles and
-annuli with radius of 1 pixel were not being processed. No counts and
-no area would be found in such regions.
-
-<p>
-<li> Fixed a bug in funcnts in which the radii column values for out of sync
-if multiple annuli were specified (instead of a single varargs or accel
-annulus).
-
-<p>
-<li> By default, fundisp will display integer image data as floats
-if the BSCALE and BZERO header parameters are present.
-
-<p>
-<li> Added -L switch to funhead to output starbase list format.
-
-<p>
-<li> Changed the name of the routine _FunColumnSelect to
-FunColumnSelectArr, in order to emphasize that it is not
-a private routine.
-
-<p>
-<li> Funcalc now checks to ensure that a column was specified as part of
-the expression.
-
-<p>
-<li> Funcalc local variables in the compiled program now use a "__" prefix
-to avoid conflicts with user-defined variables.
-
-<p>
-<li> Unofficial unsigned short (bitpix=-16) image data now is scaled
-correctly using BSCALE and BZERO header parameters.
-
-<p>
-<li> Ported to Intel icc and gcc 3.3 compilers.
-
-<p>
-<li> Updated wcs library to 3.5.1.
-
-<p>
-<li> Changed license from public domain to GNU GPL.
-
-</ul>
-
-<H2> Patch Release 1.2.2 (18 May 2003)</H2>
-<ul>
-
-<p>
-<li> Fixed funcalc so that it now actually compiles an expression and
-runs it, instead of getting a "filter compilation error". Oops!
-
-<p>
-<li> Fixed bug in FunOpen in which the bracket specification was being
-removed from the filename if a disk file was opened for "w" or "a".
-
-<p>
-<li> Fixed bug in FunFlush which prevented two successive calls to
-FunImagePut from writing the second extension header properly.
-
-<p>
-<li> All filter routines now use gerror(stderr, ...) call instead of
-fprintf(stderr, ...) so that output to stderr can be turned off (via
-setgerror(level) or GERROR environment variable).
-
-<p>
-<li> All standard Funtools programs check for GERROR environment
-variable before setting gerror flag.
-
-<p>
-<li> Some error messages about invalid region arguments were not being
-printed.
-
-<p>
-<li> FITS parameters/headers now conform more closely to FITS standard:
-<ul>
-<li> Blank keywords are treated in the same way as COMMENTS and HISTORY cards
-<li> XTENSION keywords are now exactly 8 characters long
-<li> 'E' is output instead of 'e' in floating point param values
-<li> PCOUNT and GCOUNT are output correctly for image extensions
-<li> EXTEND=T is output in primary header
-<li> COMMENTS and HISTORY start in column 9
-</ul>
-
-</ul>
-
-<H2> Patch Release 1.2.1 (24 April 2003)</H2>
-<ul>
-
-<p>
-<li> Varargs ellipse and box annular regions were being
-processed incorrectly when the following conditions all were met:
-<ul>
-<li> the region was specified in physical or wcs coordinates
-<li> the data file contained LTM/LTV keywords, i.e., it
-was blocked with respect to the original data file
-<li> the program being run was an image program (e.g. funcnts, funimage)
-</ul>
-Varargs ellipse and boxes are regions of the form:
-<pre>
- ellipse x y a1 b1 a2 b2 ... an bn [angle]
- box x y l1 w1 l2 w2 ... ln wn [angle]
-</pre>
-where at least 2 sets of axis (length) values were specified to form
-an annulus (i.e. simple ellipses and boxes worked properly). With all
-of the above conditions met, a region in physical coordinates saw its
-second length argument converted incorrectly from physical coordinates
-to image coordinates. In simple terms, this means that funcnts did not
-process elliptical or box regions in physical coords on blocked images
-properly. Note that blocking on the command line (e.g. foo.fits[*,*,2])
-did work when no LTM/LTV keywords existed in the file.
-
-<p>
-<li> The fundisp -f switch now supports specification of
-column-specific display formats as well as a more convenient way to
-specify datatype-specific display formats. Both use keyword=value
-specifiers. For columns, use:
-<pre>
- fundisp -f "colname1=format1 colname2=format2 ..." ...
-</pre>
-e.g.
-<pre>
- fundisp -f "time=%13.2f pha=%3d" ...
-</pre>
-You also can specify display formats for individual datatypes using the FITS
-binary table TFORM variables as the keywords:
-<pre>
- fundisp -f "D=double_format E=float_format J=int_format etc."
-</pre>
-e.g.
-<pre>
- fundisp -f "D=%13.2f I=%3d" ...
-</pre>
-The old position-dependent syntax is deprecated.
-
-<p>
-<li> Fundisp will now print out a single 16-bit (or 32-bit) unsigned
-int for a column whose data format is 16X (or 32X), instead of
-printing 2 (or 4) unsigned chars.
-
-<p>
-<li> Fixed bug in which fundisp was not able to display bitfield data for
-raw event lists.
-
-<p>
-<li> Previously, when binning columns used implicitly in a region
-and explicitly in a filter could suffer from a case sensitivity problem.
-This has been fixed.
-
-<p>
-<li> Fixed internal mask=all switch on fundisp.
-
-<p>
-<li> Filter include files now simply include text without changing the state
-of the filter. They therefore can be used in expression. That is, if foo1
-contains "pi==1" and foo2 contains "pha==2" then the following expressions
-are equivalent:
-<pre>
- "[@foo1&&@foo2]" is equivalent to "[pi==1&&pha==2]"
- "[pha==1||@foo2]" is equivalent to "[pi==1||pha==2]"
- "[@foo1,@foo2]" is equivalent to "[pi==1,pha==2]"
-</pre>
-
-<p>
-<li> Fixed bug in filter specification which caused a SEGV if a varargs-style
-region was enclosed in parens.
-
-<p>
-<li> Updated wcs library to 3.3.2.
-
-</ul>
-
-<H2> Public Release 1.2.0 (24 March 2003)</H2>
-<ul>
-
-<p>
-<li> BSCALE and BZERO are now always applied to int pixel data, instead of
-only being applied if the desired output is floating point.
-
-</ul>
-
-<H2> Beta Release 1.2.b3 (4 February 2003)</H2>
-<ul>
-
-<p>
-<li> In FunColumnSelect, added the ability to specify an offset into
-an array in the type specification, using the extended syntax:
-<PRE>
- [@][n]&lt;type&gt[[poff]][:[tlmin[:tlmax[:binsiz]]]]
-</PRE>
-The [poff] string specifies the offset. For example, a type specification
-such as "@I[2]" specifies the third (i.e., starting from 0) element in
-the array pointed to by the pointer value. A value of "@2I[4]" specifies
-the fifth and sixth values in the array.
-
-<p>
-<li> Added a non-varargs version of FunColumnSelect called _FunColumnSelect:
-<pre>
-int _FunColumnSelect(Fun fun, int size, char *plist,
- char **names, char **types, char **modes, int *offsets,
- int nargs);
-</pre>
-
-<p>
-<li> Added support for sorting binary tables by column name using:
-funtable -s "col1 col2 ... coln" ...
-
-<p>
-<li> Added the FUN_RAW macro which, when applied to the "name" parameter
-of FunParamGets(), returns the 80-character raw FITS card instead of
-only the value.
-
-<p>
-<li> Added support for comparing column values with binary masks of the
-form 0b[01]+, e.g.:
-<pre>
- (status&0b111)==0b001
-</pre>
-Previously, such masks had to be specified in decimal, octal, or hex.
-
-<p>
-<li> Completed support for type 'L' (logical) in fundisp and in filtering of
-binary tables.
-
-<p>
-<li> Fixed bug in funhist that was improperly setting the number of bins
-when the data was of type float.
-
-<p>
-<li> Fixed bug in filter/Makefile where the filter OBJPATH #define was
-being passed to the wrong module.
-
-</ul>
-
-<H2> Beta Release 1.2.b2 (7 October 2002)</H2>
-<ul>
-
-<p>
-<li> Updated wcs library to 3.1.3.
-
-<p>
-<li> Added support for reading gzip'ed files via stdin.
-
-</ul>
-
-<H2> Beta Release 1.2.b1 (24 September 2002)</H2>
-<ul>
-
-<p>
-<li> Added the following accelerators to region filtering:
-<pre>
- shape: arguments:
- ----- ---------
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- BOX xcenter ycenter xwlo yhin xwout yhhi n=[number] (angle)
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- ELLIPSE xcenter ycenter xwlo yhin xwout yhhi n=[number] (angle)
-</pre>
-
-<p>
-<li> Added the following new pandas (Pie AND Annulus) to region filtering:
-<pre>
- shape: arguments:
- ----- ---------
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # same as panda
- BPANDA xcen ycen ang1 ang2 nang ixlo iylo ixhi iyhi nrad (ang) # box
- EPANDA xcen ycen ang1 ang2 nang ixlo iylo ixhi iyhi nrad (ang) # ellipse
-</pre>
-
-<p>
-<li> Added support for filtering images using simple FITS image masks,
-i.e. 8-bit or 16-bit FITS images where the value of a pixel is the
-region id number for that pixel (and therefore must be greater than
-0). The image section being filtered must either be the same size as the
-mask dimensions or else be an even multiple of the mask. This works with
-image-style filtering, i.e., funcnts can utilize a mask on both
-images and binary tables.
-
-<p>
-<li> Added '$n' to fundisp column specification to allow display of
-ordinal value of each row passing the filter.
-
-<p>
-<li> Added code to support region filtering on image sections.
-
-<p>
-<li> Fixed bugs which prevented filtering more than one ASCII region file.
-
-<p>
-<li> Fixed bug occasionally causing filter slave processes to become zombies.
-
-<p>
-<li> Fixed bugs in event filtering: annulus with inner radius of 0
-(i.e., a circle) was rejecting events with coordinates xcen, ycen.
-Also, pie with angles of 0 and 360 was rejecting some events.
-Image filtering (e.g. funcnts) did not have these problems.
-
-<p>
-<li> Filters now accept global exclude regions without an include region.
-In such a case, the field region is implied. That is, "-circle(x,y,r)"
-is equivalent to "field; -circle(x,y,r)", etc.
-
-<p>
-<li> Fixed panda so that it can be used as a global exclude.
-
-<p>
-<li> Allow empty ds9 region file (comments and globals only) to be
-a valid filter. Totally ignore zero length region or include file.
-
-<p>
-<li> Fixed funcnts bug that was displaying 0 value as inner radius of
-a circle, instead of just one radius value.
-
-</ul>
-
-<H2> Public Release 1.1.0 (22 April 2002)</H2>
-
-<p>
-New features include:
-<ul>
-<p>
-<li> Funtools programs now accept gzip'ed files as valid input.
-
-<p>
-<li> Improved security via replacement of system() function.
-
-<p>
-<li> fundisp, funcnts, funhist can output starbase/rdb format (tabs between columns, form-feeds between tables).
-
-<p>
-<li> Improved support for Windows platform, as well as new support for Mac OSX.
-</ul>
-
-<H2> Pre-Release 1.1.0e (10 April 2002)</H2>
-<UL>
-
-<P>
-<LI> Added enough support to skip over variable length arrays in BINTABLES.
-We will add full support if this non-standard construct becomes more widely
-used.
-
-<P>
-<LI> Fixed bug in underlying fitsy _gread() routine that was returning
-an arbitrary bytes-read value if the input fd was invalid.
-
-</UL>
-
-<H2> Pre-Release 1.1.0e (19 March 2002)</H2>
-<UL>
-
-<P>
-<LI> Added additional check for Windows/PC to filter/Nan.h.
-
-<P>
-<LI> Upgraded zlib library to 1.1.4 (fix double free security hole).
-
-</UL>
-
-
-<H2> Pre-Release 1.1.0e (27 February 2002)</H2>
-<UL>
-
-<P>
-<LI> Changed filter/process.[ch] to filter/zprocess.[ch] to avoid name
-collision with Cygwin include file.
-
-<P>
-<LI> Added -a switch to funhead to display all headers in a FITS file.
-
-</UL>
-
-<H2> Pre-Release 1.1.0e (11 February 2002)</H2>
-<UL>
-
-<P>
-<LI> Fixed filter parser so that it ignores ds9 "ruler" and "text" markers
-only up to the first \n or ; (was ignoring to last \n).
-
-<P>
-<LI> The NBLOCK parameter in fitsy/headdata.c was too large for Mac OS X
-(max size of a declared char buf seems to be about .5 Mb).
-
-</UL>
-
-<H2> Beta Release 1.0.1b5 (31 January 2002)</H2>
-<UL>
-
-<P>
-<LI> Fixed bug introduced in calculated IRAF LTM values in 1.0.1b3.
-
-<P>
-<LI> Fixed bug in filter parser giving wrong answers when two range
-lists were combined with and explicit boolean operator:
-<PRE>
- $ fundisp $S"[x=512&&y=511,512]"
-</PRE>
-incorrectly acted like:
-<PRE>
- fundisp $S"[(x=512&&y=511)||(y=512)]"
-</PRE>
-instead of:
-<PRE>
- fundisp $S"[x=512&&(y=511||y=512)]"
-</PRE>
-In general, we recommend use of explicit parentheses.
-
-<P>
-<LI> Fixed filter/NaN.h to recognize Compaq Alpha again (broken by their last change to cc).
-
-<P>
-<LI> Removed redundant varargs definitions that conflicted with Alpha compiler definitions.
-
-<P>
-<LI> Added blank line to inc.sed to work around Apple Mac OS X bug in which the
-"i" (insert) command was treating final \\ as continuation \ in the text.
-
-<P>
-<LI> Added include of mkrtemp.h to mkrtemp.c to get conditional compilation
-for Mac OSX.
-
-<P>
-<LI> Added support for --with-zlib to fitsy so that ds9 could use its own
-copy of zlib (and not build the copy in fitsy).
-
-<P>
-<LI> Removed config.cache and Makefile files from distribution tar file.
-
-</UL>
-
-<H2> Beta Release 1.0.1b4 (26 January 2002)</H2>
-<UL>
-
-<P>
-<LI> Make explicit that column filters are not permitted in an image
-expression (such as the funcnts region arguments).
-
-<P>
-<LI> Fix bug in region parser in which a region (without parens),
-followed immediately by an operator:
-<PRE>
- circle 512 512 .5&&pi==1
-</PRE>
-was not processing the final argument of the region correctly.
-
-<P>
-<LI> Ignore new "tile" directive in filters (used by ds9).
-
-</UL>
-
-<H2> Beta Release 1.0.1b3 (4 January 2002)</H2>
-<UL>
-
-<P>
-<LI> Made modifications to Makefile.in to make releases easier.
-
-<P>
-<LI> Added instructions Makefile.in so that funtools.h will always
-have correct #defines for FUN_VERSION, FUN_MAJOR_VERSION,
-FUN_MINOR_VERSION, and FUN_PATCH_LEVEL.
-
-<P>
-<LI> Allow #include statements in funcalc program files.
-
-<P>
-<LI> funimage now updates all 4 CDX_Y values by the block factor.
-
-<P>
-<LI> Minor changes to make funtools work under darwin (Mac OS X).
-
-</UL>
-
-<H2> Beta Release 1.0.1b2 (14 November 2001)</H2>
-<UL>
-
-<P>
-<LI> Fixed FunOpen() bug (introduced in b1) in which filenames without
-extensions SEGV'ed on open. Yikes!
-
-<P>
-<LI> Funmerge now extends the tlmin/tlmax values of the output
-binning columns so that merged events from widely separated files are
-valid in the output table.
-
-<P>
-<LI> In funhist, added -w switch to specify bin width (lo:hi:width)
-instead of number of bins (lo:hi:num). Added support for this new
-width option in funtools.ds9.
-
-<P>
-<LI> If a tdbin value was set using bincols=(name:tlmin:tlmax:tdbin, ...),
-the WCS parameters were not being updated properly.
-
-<P>
-<LI> Cleaned up build support for zlib.
-
-</UL>
-
-<H2> Beta Release 1.0.1b1 (6 November 2001)</H2>
-<UL>
-
-<P>
-<LI> Added support for gzip'ed files to the underlying fitsy/gio
-library. This means that all funtools programs now accept gzip'ed
-files as valid input:
-<PRE>
- funcnts foo.fits.gz "circle 504 512 10"
-</PRE>
-It is no longer necessary to run gunzip and pipe the results to
-stdin of a funtools program.
-
-<P>
-<LI> Funtools tasks are now placed in a sub-menu in the DS9 Analysis
-menu, instead of at the top level.
-
-<P>
-<LI> Fixed a bug in funcnts in which the bottom-most pixel of a small
-circle or annulus region could be missed when the region is only one
-pixel wide for that value of y.
-
-<P>
-<LI> Added -n switch to funhist so that table histograms could be
-normalized by the width of the bin (val/(hi_edge-lo_edge)).
-
-<P>
-<LI> Added -T switch to fundisp, funcnts, funhist to output in
-starbase/rdb format (uses tabs instead of spaces between columns,
-form-feeds between tables, etc.)
-
-<P>
-<LI> Fixed a bug in which the field() region was not being properly
-processed in combination with an image section. This could affect
-funcnts processing of image data where an image section was specified
-(though it usually resulted in a funcnts error).
-
-<P>
-<LI> Fixed bug in display of binary table header for vector columns.
-
-<P>
-<LI> Filters now recognize hex constants (starting with 0x) and long
-constants (ending with L).
-
-<P>
-<LI>Filenames containing a ':' are now only treated as sockets if they
-actually are in the form of a valid ip:port.
-
-<P>
-<LI>Replaced funtools.ds9 with a new version that calls a new funds9
-script, instead of calling funcnts or funhist directly. The new script
-supports gzip'ed files and bracket specifications on filenames at the
-same time, which the direct call could not. Also the new script has
-better error reporting.
-
-<P>
-<LI> Replaced system() call used to compile filter and funcalc
-expression with a special launch() call, which performs execvp()
-directly without going through sh. (launch() works under DOS and has
-fewer security problems.)
-
-<P>
-<LI> Fixed image filter code in which the field() region was being ignored
-if it was combined with one or more exclude regions (and no other include
-regions), resulting in no valid pixels.
-
-<P>
-<LI> Changed use of getdtable() to FD_SETSIZE in calls to select().
-
-<P>
-<LI> Added code to guard against FITS binary tables without proper TFORMx
-parameters.
-
-<P>
-<LI> Added support to FunParamGets so that it returns the raw FITS card
-if the specified input name is NULL and the input n value is positive.
-
-<P>
-<LI> Fixed bug in underlying fitsy code that set the comment in a
-header parameter.
-
-</UL>
-
-
-<H2> Public Release 1.0.0 (31 July 2001)</H2>
-<UL>
-<P>
-<LI> "a new day with no mistakes ... yet"
-</UL>
-
-<HR>
-<A HREF="./help.html">Index to the Funtools Help Pages</A>
-<H5>Last updated: 22 April 2002</H5>
-</BODY>
-</HTML>
diff --git a/funtools/doc/changelog_beta.html b/funtools/doc/changelog_beta.html
deleted file mode 100644
index 4e3ccd3..0000000
--- a/funtools/doc/changelog_beta.html
+++ /dev/null
@@ -1,953 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Funtools ChangeLog</TITLE>
-</HEAD>
-<BODY>
-<H2>Funtools ChangeLog</H2>
-
-<P>
-This ChangeLog covers both the Funtools library and the suite of
-applications. It will be updated as we continue to develop and improve
-Funtools. The up-to-date version can be found <A
-HREF="http://hea-www.harvard.edu/RD/funtools/changelog.html">here</A>.
-
-<H2>Beta release 1.0.b28 (06/26/01)</H2>
-<UL>
-
-<P>
-<LI> In funcnts, removed extra new-lines from the primary table,
-inadvertently added in cases where zero-area rows are skipped.
-
-<P>
-<LI> Added code to support columns in binary tables that do not have names.
-
-<P>
-<LI> Changed the ds9 radial plot so that the radius (x value) for each
-plotted point is taken to be the middle of the annulus, (Rin+Rout)/2,
-instead of just the inner annulus, Rin.
-
-</UL>
-
-<H2>Beta release 1.0.b27 (06/21/01)</H2>
-<UL>
-
-<P>
-<LI> Added missing new-lines in funcnts primary tables that did not
-have -r switch.
-
-<P>
-<LI> Filtering with dynamic shared objects (gcc only) now links the
-region code into the shared object, instead of relying on finding the
-region code in global space.
-
-<P>
-<LI> A few minor changes to column headers in funcnts.
-</UL>
-
-<H2>Beta release 1.0.b26 (05/21/01)</H2>
-<UL>
-<P>
-<LI> Fixed funcnts to work properly when the background region
-overlaps the source and therefore explicitly excludes the source.
-It was simply ignoring the source regions in such a case.
-
-<P>
-Added a second DS9 init file, funcnts2.ds9, which contains funcnts
-and radial profile routines that work from the image stored in DS9's
-memory, rather than the original FITS file. This is useful in cases
-where no original FITS file exists (e.g., a temp file was created
-by a program and sent to DS9).
-
-<P>
-<LI> Fixed funcnts so that region specified with a variable number of
-arguments must come last (as is the case with panda and the n=
-accelerator). Thus, a region specification such as "pie 504 512 10 20
-30 & circle 504 512 10" is now properly an error. Using "circle 504 512 10
-& pie 504 512 10 20 30" instead ensures that the circle is applied to
-each pie.
-
-<P>
-<LI> Fixed funcnts output of radii/angles when boolean expressions
-such as "pie & annulus" are specified.
-
-<P>
-<LI> Enhanced funcnts so that -r outputs valid radii for circular regions.
-
-</UL>
-
-<H2>Beta release 1.0.b25 (4/19/01)</H2>
-<UL>
-
-<P>
-<LI> Added support to funtable to generate a FITS binary table
-from an image. By default, a 3-column table is generated, where the
-columns are "X", "Y", and "VALUE". For each pixel in the image, a
-single row (event) is generated with the "X" and "Y" columns assigned
-the dim1 and dim2 values of the image pixel, respectively and the
-"VALUE" column assigned the value of the pixel. If the -i
-("individual" rows) switch is specified, then only the "X" and "Y"
-columns are generated. However the number of rows (events) are written
-out for each image pixel is equal to the value of that image pixel(or
-1, whichever is larger).
-
-<P>
-<LI> Added -z switch to funcnts to display shapes in primary table
-that have no area. This is useful when automatic processing assumes
-that there are a set number of rows.
-
-<P>
-<LI> Reworked how the "$region" column is handled. A "$region" column
-can now be added to a table already having a "region" column. If a
-"region" column already exists, the new column will be "region1". If
-that exists, we try "region2", etc.
-
-<P>
-<LI> Added the header parameters EXTNAME="IMAGE" and EXTVER=1 when an
-image extension of created automatically.
-
-<P>
-<LI> When funcnts is run with -r, the rad1, rad2, ang1, and ang2 columns
-are filled in with "NA" if the shape is not annulus, pie, or panda (instead
-of being left blank).
-
-<P>
-<LI> Changed funcnts to display arc-sec/pixel instead of degrees/pixel in the
-output header.
-
-<P>
-<LI> Fixed bug in FunColumnSelect() that prevented a new table from
-being created that consists only of new columns.
-
-<P>
-<LI> Fixed processing of blank values in FunImageRowGet() (was a SEGV).
-
-<P>
-<LI> Fixed fundisp processing of images (SEGV upon completion, trying to
-free space only used by tables).
-
-<P>
-<LI> Fixed bug in funcalc which left executable in /tmp space if -n
-(no execute) was specified.
-
-<P>
-<LI>Fixed various bugs processing raw event files, especially on
-little-endian machines and reading these files via stdin.
-
-<P>
-<LI> Changed rad1, rad2 columns to radius1, radius2 in funcnts.
-
-<P>
-<LI> Purified dynamically loaded filter code (since purify now can work
-with gcc).
-
-</UL>
-
-<H2>Beta release 1.0.b24 (03/26/01)</H2>
-<UL>
-
-<P>
-<LI> First release of <B>funcalc</B>, the Funtools table calculator.
-funcalc is a calculator program that allows arbitrary
-expressions to be constructed, compiled, and executed on columns in a
-Funtools table (FITS binary table or raw event file). It works by
-integrating user-supplied expression(s) into a template C program,
-then compiling and executing the program. funcalc expressions
-are valid C statements, although some important simplifications (such
-as automatic declaration of variables) are supported.
-
-Within a funcalc expression, reference is made to a
-column of the <B>current</B> row using the C syntax
-<B>cur->[colname]</B>, e.g. cur->x, cur->pha, etc. Local scalar
-variables can either be defined using C syntax at very the beginning
-of the expression, or else they can be defined automatically by
-funcalc (to be of type double). Thus, for example, a swap of
-columns x and y in a table can be performed using either of the following
-equivalent funcalc expressions:
-<PRE>
- double temp;
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;
-</PRE>
-or:
-<PRE>
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;
-</PRE>
-When this expression is executed using a command such as:
-<PRE>
- funcalc -f swap.expr itest.ev otest.ev
-</PRE>
-the resulting file will have values of the x and y columns swapped.
-Many other features are available in funcalc to make table
-manipulation easy. See the Funtools program.html documentation.
-
-<P>
-<LI> First release of the <B>funtools.ds9</B> set-up file for adding
-Funtools analysis programs to the DS9 Analysis menu. This set-up file
-is installed in the same bin directory where Funtools programs are
-installed and can be loaded into DS9 from the <B>Load Analysis
-Commands ...</B> option of the <B>Analysis</B> menu. Alternatively,
-you can tell DS9 to load this file each time it starts by adding the
-file to the <B>Edit</B>-><B>Preferences</B>-><B>Analysis
-Menu</B>-><B>Analysis File</B> menu option.
-
-<P>
-<LI> Added support for non-integral binning of binary tables. The bincols
-specifier on the command line now can take the form:
-<PRE>
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-</PRE>
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-<PRE>
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-</PRE>
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters (respectively) are present in the
-FITS binary table header for the column in question. Note that if
-only one parameter is specified, it is assumed to be tlmax, and tlmin
-defaults to 1. If two parameters are specified, they are assumed to be
-tlmin and tlmax.
-
-<P>
-<LI> Added "mask=transparent" support to the plist argument in
-FunTableRowGet(). If this string is passed in the call's plist
-argument, then all events are passed back to the user. This is useful
-when FunColumnSelect() specifies "$region" as a column in order to
-return the regionid value for each event. In such a case, events
-found in a region have regionid >0, events passing the filter but not
-in a region have regionid == -1, events not passing the filter have
-regionid ==0.
-
-<P>
-<LI> Added FUN_WCS0 to the FUN_WCS option available to FunInfoGet().
-The original FUN_WCS option returns WCS Library handle (for use with
-Doug Mink's wcssubs library) suitable for use with images, regardless
-of whether the data are images or tables. For this structure, the WCS
-reference point (CRPIX) has been converted to image coordinates if the
-underlying file is a table (and therefore in physical coordinates). The
-new FUN_WCS0 structure has not had its WCS reference point converted
-to image coordinates. It therefore is useful when passing processing
-physical coordinates from a table.
-
-<P>
-<LI> Added -G switch to funcnts to print out floating point values
-with maximum %.14g precision.
-
-<P>
-<LI> Added -l switch to fundisp, which displays the pixels of an image as
-a list with X, Y, VAL columns.
-
-<P>
-<LI> Added support for images to funhist. The program will create
-a histogram of the values found in each pixel, or it can perform
-a projection over either axis.
-
-<P>
-<LI> All Funtools programs now accept "-" to mean "stdin" or "stdout",
-when the io mode is "r" or "w", respectively.
-
-<P>
-<LI> Changed behavior of the prec (precision) argument in FunParamPutd()
-(and the underlying fitsy routine ft_cardfmt()) so that if the double
-value being put is less than 0.1 or greater than or equal to
-10**(20-2-prec), then %20.[prec]e format is used, otherwise
-%20.[prec]f format is used.
-
-<P>
-<LI> Fixed behavior of "merge=replace" in FunColumnSelect() so that if
-tlmin/tlmax values are not specified in the replacing column, but are
-specified in the replaced column, then the original tlmin/tlmax values
-are used in the replacing column.
-
-<P>
-<LI> Improved funcnts error-handling when no valid region is specified.
-
-<P>
-<LI> Fixed region parsing of '#' comment character so that comments
-are terminated by new-lines, but not ';'. This is more intuitive behavior.
-
-<P>
-<LI> Fixed region parser so that a region (without parens), followed by
-a column expression (e.g., "circle 5 5 1,pha==4") is processed correctly.
-
-<P>
-<LI> Fixed funcnts so that the timecorr parameter specified by -t
-[timecorr] can be in lower case.
-
-<P>
-<LI> Fixed panda region shapes when processing a blocked image. The
-number of pies and number of annuli (args 5 and 8) were incorrectly
-being divided by the block factor (i.e., they were being treated as
-sizes).
-
-<P>
-<LI> Fixed bug in funcnts that resulted in slightly smaller
-integerized pixel boundaries being used when filtering events. This
-does not affect ordinary event filtering(in fundisp, funtable, etc.).
-In funcnts (which filters binary table events using image-style pixel
-filtering), this bug could result in fewer photons being counted than
-is the case when the equivalent image is used.
-
-<P>
-<LI> Fixed funcnts to work with raw event files on little-endian machines.
-
-<P>
-<LI> Fixed funhist so that it will read data from a pipe.
-
-<P>
-<LI> Fixed region parser (and funcnts) so that an include file ending
-with a comment stops the comment at the end of the include file.
-
-<P>
-<LI> Clarified the meaning of the "," operator (should it be "or" or
-"and") between a region and a non-region expression in a filter: if
-the second operand in the expression contains a region, the operator
-is "or", otherwise it is "and".
-
-<P>
-<LI> Fixed bug in funmerge, which was not handling integerization of
-negatively-valued physical pixels properly (not actually used in any
-known application).
-
-</UL>
-
-<H2>Beta release 1.0.b23 (02/16/01)</H2>
-<UL>
-<P>
-<LI> Fixed funcnts to report area correctly in arc-seconds.
-
-<P>
-<LI> Fixed funcnts to report radii correctly when summing.
-
-<P>
-<LI> Fixed bug in fundisp: a SEGV when trying to display an ASCII column
-from a binary table.
-
-</UL>
-
-<H2>Beta release 1.0.b22 (02/15/01)</H2>
-<UL>
-
-<P>
-<LI> Funcnts now will automatically output appropriate columns from
-the primary table in units of arc-seconds instead of pixels if WCS info
-is present. Use -p to force the output to be in pixels.
-
-<P>
-<LI> Added qualitative exposure correction to funcnts by means of the switch
-"-e source_exp[;background_exp]". For each region, the average exposure is
-calculated and net counts (and background) are divided by the average
-exposure. See programs.html for more info.
-
-<P>
-<LI> Added qualitative time correction to funcnts by means of the switch
-"-t source_time[;background_time]". The net counts (and background) are
-divided by this time. See programs.html for more info.
-
-<P>
-<LI> Improved funcnts output. For example, column units are displayed
-(since surf_bri units now can be cnts/pix**2, cnts/arcsec**2, etc.)
-
-<P>
-<LI> Changed funcnts.gnuplot and funhist.gnuplot scripts to funcnts.plot
-and funhist.plot, respectively. The new scripts take an argument
-such as "gnuplot" or "ds9" and output data appropriate for each
-target. Also enhanced funcnts.plot so that it senses the axis units
-automatically.
-
-<P>
-<LI> Fixed bug in funcnts when handling regions whose centers are out of the
-image. Processing often resulted in BUS ERROR or zero counts, and it took
-forever to reach those results
-
-<P>
-<LI> Fixed bug in FunImagePut() when outputting float data on
-little-endian machines (PCs/Dec Alpha) -- an erroneous error was
-signaled trying to convert from native to IEEE before writing.
-
-<P>
-<LI> Fixed bug in fundisp when displaying the mask of a double/float
-image using the mask=all option.
-
-<P>
-<LI> Fixed bug in fitsy/headimage/ft_imageloadhead(fits), in which the
-default value for LTV[1,2] was incorrectly set to 1.0, not 0.0. This
-means that region physical coordinates applied to FITS images and
-arrays that did not have LTM/LTV keywords were 1 pixel off.
-
-<P>
-<LI> Fixed obscure bug in region circle processing when a block factor
-is specified in the section command but the circle has radius less
-than the block.
-
-<P>
-<LI> Fixed bug in FunImageGet which was returning the full image in
-cases where a region was specified but no image pixels were in the
-region. An empty image is now returned.
-</UL>
-
-<H2>Beta release 1.0.b21 (02/01/01)</H2>
-<UL>
-
-<P>
-<LI> In funcnts, added ability to specify a separate background file.
-When using a separate background file, the background area will be
-normalized by the ration of the pixel sizes of the two files, if
-requisite WCS info is available.
-
-<P>
-<LI> In funcnts, added -r switch to output radii (and angle)
-information. This is useful with annulus and panda shapes when
-plotting radial profiles. An example plot script, funcnts.gnuplot, is
-available for use with gnuplot (3.7 and higher):
-<PRE>
- funcnts ... | funcnts.gnuplot
-</PRE>
-
-<P>
-<LI> First version of the funhist program, which creates a 1D
-histogram by binning the specified column in a binary table. The
-tabular output can be plotted using funhist.gnuplot:
-<PRE>
- funhist snr.ev x | funhist.gnuplot
-</PRE>
-
-<P>
-<LI> Added additional error messages to funcnts when invalid binning
-parameters are found for one or more binary table binning columns.
-
-<P>
-<LI> Fixed bug in FunImagePut() which sometimes occurred when
-dimensions were passed in the calling sequence. If, in addition, a
-reference handle was passed in the FunOpen() call, then the output
-dimensions are erroneously taken from the reference file, not the
-passed dimensions.
-
-<P>
-<LI> Fixed bug in filter lex code (filt.l) in which yyrestart was
-being called incorrectly with the string to be parsed as the argument
-(should be NULL).
-
-<P>
-<LI> Fixed bug in filter code in which the Sun cc compiler was creating
-a useless .o file in the working directory.
-
-<P>
-<LI> Fixed bug in region parser which made it impossible to specify
-angles with a 'd' or 'r' suffix unless WCS info was in the file. (The
-use of 'd' or 'r' with angle is independent of WCS but the check was
-there anyway.)
-
-</UL>
-
-<H2>Beta release 1.0.b20 (11/29/00)</H2>
-<UL>
-
-<P>
-<LI> Fixed a serious bug in which exclude regions were being ignored
-when multiple annuli were specified. That is, in a region specification
-such as:
-<PRE>
- annulus 512 512 0 100 n=4; -circle 510 510 20
-</PRE>
-or
-<PRE>
- annulus 512 512 0 25 50 75 100; -circle 510 510 20
-</PRE>
-the excluded region was not being sensed properly. Note that
-single regions did work properly with exclude regions.
-
-<P>
-<LI> Optimized funcnts so that the time for processing an event list
-(binary table) is no longer proportional to the number of pixels in
-the image. The unoptimized code was taking forever with Chandra ACIS
-images (8192**2 pixels), even with relatively few events.
-
-<P>
-<LI> Fixed bugs that gave incorrect answers when image regions were
-combined with image sections.
-
-<P>
-<LI> Fixed bug in parsing image section of the form: "foo.fits[*,6:9,2]",
-i.e. the default ("*") x dimensions, followed by specified y dimensions.
-
-<P>
-<LI> Added -g option to funcnts to change some output formats from
-12.3f to 12.3g to accommodate display of very small numbers.
-</UL>
-
-<H2>Beta release 1.0.b19 (11/21/00)</H2>
-<UL>
-<P>
-<LI> Fixed bug in filter code that caused a SEGV on Solaris machines
-when the first specified spatial region is an exclude region. Our
-user-supplied qsort/compare algorithm was confusing the Solaris qsort()
-routine, causing it to SEGV by trying to process a record prior to the
-beginning of the passed array of records.
-</UL>
-
-<H2>Beta release 1.0.b18 (11/13/00)</H2>
-<UL>
-<P>
-<LI> Fixed bug in handling bitpix=-32 (single float) images.
-
-<P>
-<LI> Fixed gio gskip routine to better handle skip of 0 bytes.
-</UL>
-
-<H2>Beta release 1.0.b17 (11/10/00)</H2>
-<UL>
-
-<P>
-<LI> Fixed working of $REGION keyword in funtable.
-
-<P>
-<LI> Removed FunFlush() from end of funtable (it was redundant).
-
-<P>
-<LI> Fixed bug in gopen() handling of "pipe:".
-
-<P>
-<LI> Fixed bug in gseek() where pipes, streams, and sockets were
-not skipping bytes properly (that can do skips, but cannot do other
-sorts of seek).
-
-</UL>
-
-<H2>Beta release 1.0.b16 (10/23/00)</H2>
-<UL>
-
-<P>
-<LI> Added -s switch to funcnts to support display of summed results
-(as well as individual results for each region), i.e. each row in the
-summed bkgd-subtracted table contains the sum of counts and areas from
-previous rows.
-
-<P>
-<LI> Added -f [format] switch to fundisp to allow control over the
-display format for each data type.
-
-<P>
-<LI> Fixed bug in which regions could be incorrectly re-ordered. This
-was a problem with annular ellipses and rectangles created by ds9 and
-then used in funcnts (the only program where the order of the regions is
-important).
-</UL>
-
-<H2>Beta release 1.0.b15 (10/11/00)</H2>
-<UL>
-
-<P>
-<LI> Changed the names of routines FunEventsGet() and FunEventsPut()
-to FunTableRowGet() and FunTableRowPut(), respectively. The old names
-are still valid (using #define in funtools.h), so no code change is
-required.
-
-<P>
-<LI> Changed funevents program name to funtable, in line with API changes.
-
-<P>
-<LI> Renamed FunInfoGet/Put() parameter FUN_EVSIZE to FUN_ROWSIZE, in
-order to reflect change from use of "events" to use of "row" in
-funtools binary table support. The old name is still supported as
-an alias.
-
-<P>
-<LI> Completed first version of funmerge program to merge FITS binary tables.
-
-<P>
-<LI> Fixed bug in line region shape that was causing a SEGV with event data.
-
-<P>
-<LI> Fixed minor compiler warnings using "gcc-Wall".
-
-<P>
-<LI> Added the ability for FunOpen() to open a list of event files and
-read events from this list synchronously or asynchronously. This
-facility is part of an experimental set of parallel processing
-techniques that are being added to funtools. Documentation will be
-forthcoming when we know which techniques have value!
-</UL>
-
-<H2>Beta release 1.0.b14 (9/22/00)</H2>
-<UL>
-
-<P>
-<LI> Added first version of funmerge program to merge FITS binary tables.
-
-<P>
-<LI> Changed the output format of funcnts so that the main results
-(background-subtracted table) are displayed first. This means that the
-result columns always start at line 4 in the file (after a 1-line
-comment and a 2-line header) and end at the first blank line. The
-fixed format makes it easier for programs such as sed to extract
-results for further processing. For example:
-
-<PRE>
- csh> cat fun.sed
- 1,/---- .*/d
- /^$/,$d
-
- csh> funcnts snr.ev[pha==1] "annulus 512 512 0 200 n=8" | sed -f fun.sed
- 1 49.000 7.000 0.000 0.000 1941 0.025 0.004
- 2 91.000 9.539 0.000 0.000 5884 0.015 0.002
- 3 129.000 11.358 0.000 0.000 9820 0.013 0.001
- 4 159.000 12.610 0.000 0.000 13752 0.012 0.001
- 5 176.000 13.266 0.000 0.000 17652 0.010 0.001
- 6 183.000 13.528 0.000 0.000 21612 0.008 0.001
- 7 137.000 11.705 0.000 0.000 25528 0.005 0.000
- 8 198.000 14.071 0.000 0.000 29420 0.007 0.000
-</PRE>
-
-<P>
-<LI> Fixed bug in row# processing in which all range was ignored if
-lo range value was 1 (e.g., row#=1:7).
-
-<P>
-<LI> Fixed bug in event header processing in which the multiple
-instances of keywords HISTORY, COMMENT, and CONTINUE were not all
-being copied from the old to the new header (e.g. in funevents).
-
-<P>
-<LI> Fixed processing of ARRAY() and EVENTS() specifiers in FunOpen().
-
-<P>
-<LI> Fixed 'make clean' directive so that it also cleans funtools subdirs.
-</UL>
-
-<H2>Beta release 1.0.b12 (9/5/00)</H2>
-<UL>
-
-<P>
-<LI> Improved the performance of panda regions so that the funcnts
-"wall time" now is proportional to the size of the panda region, not
-the size of the image. (The latter is the case with the pie shape; use
-of panda is recommended over pie.) This means that it is possible to
-run funcnts on an ACIS file at zoom 1 (8192x8192) in seconds rather
-than (tens of) minutes.
-
-<P>
-<LI> Added support for INET sockets to gio and hence, to funtools.
-This means that you can read/write from/to sockets on other machines,
-creating a distributed pipeline. For example:
-<PRE>
- on m1: funevents foo.ev m2:1428
- on m2: funevents :1428 m3:1428
- on m3: funevents :1428 ...
-</PRE>
-etc. Tests indicate that this is faster than pipes on a single
-machine, once the CPU is saturated on that machine. (But note that it
-is not faster until the CPU is saturated, due to the efficiency of
-Unix pipes and the I/O wait time on non-saturated CPUs.) This new
-facility implements the parallel processing technique called "process
-decomposition" for pipelines, in which a pipeline process is run on
-several machines at once, with different machines handling separate
-parts of the pipeline process.
-<P>
-NB: socket support requires that the libraries:
-<PRE>
- -lsocket -lnsl
-</PRE>
-be added to the Solaris link line.
-
-<P>
-<LI> Added support for the row#=lo:hi keyword to process specific rows
-in a FITS binary table. For example:
-<PRE>
- funevents "test.ev[row#=3:8]" stdout ...
-or
- funevents "test.ev[row#=(3,8)]" stdout ...
-</PRE>
-will only process rows 3 to 8 (inclusive) of the test.ev file. Along
-with image section specification, use of the row#= keyword implements
-the parallel processing technique called "data decomposition", in
-which several copies of a single program operate on different parts of
-a single data file.
-
-<P>
-<LI> Added guard code to image region processing to catch illegal event
-values.
-
-<P>
-<LI> Fixed bug when writing FITS image extensions in which dim1, dim2,
-and bitpix were being output as 0.
-
-<P>
-<LI> reversed the y row order of displayed images in fundisp, so that pixel
-(1,1) is in the lower left corner, as is the case for ds9 image display.
-</UL>
-
-<H2>Beta release 1.0.b11 (8/10/00)</H2>
-<UL>
-
-<P>
-<LI> Fixed annulus accelerators and panda regions -- again. Old
-problems (from the original implementation) were uncovered related to
-the use of these shapes in boolean expressions. Documented an old
-restriction that panda and accelerators must be put last in a boolean
-expression and added code to signal an error if they are not placed last.
-
-<P>
-<LI> The behavior of the point shape was changed so that multiple x,y
-pairs in a single shape specifier now are assigned different region
-ids. This makes the behavior of points and annuli consistent with one
-another.
-</UL>
-
-<H2>Beta release 1.0.b10 (8/08/00)</H2>
-<UL>
-
-<P>
-<LI> Fixed annulus accelerators and panda regions. These were
-broken when dynamic loading was implemented.
-
-<P>
-<LI> Fixed a bug in the event filter body code (i.e., the basis for
-the slave filter program). Reading the data sometimes incorrectly
-calculated the number of events being passed -- which only showed up
-occasionally on the Alpha!
-</UL>
-
-<H2>Beta release 1.0.b9 (8/03/00)</H2>
-<UL>
-<P>
-<LI> Removed compilation of some extraneous routines from wcs library.
-Also renamed wcssubs directory to wcs.
-
-<P>
-<LI> Added calls to hlength() before wcsinit(). This is necessary in
-ds9 (and is a safeguard in other programs) because once hlength() is
-called before any invocation of wcsinit(), it must always be used.
-
-<P>
-<LI> Fixed bug in filter code in which CTYPE1 and CTYPE2 param values
-were not being passed to wcsinit() as valid FITS strings: the single
-quotes were missing.
-
-<P>
-<LI> Fixed a bug in fitsy in which the card buffer was not being
-null-terminated properly when a "card insert" call reallocated space
-for more cards.
-
-<P>
-<LI> Added protective code so that one cannot set FILTER_PTYPE to
-"dynamic" if dynamic filter objects are not available.
-
-<P>
-<LI> Ported to Debian Linux, which (believe it or not) required
-removal of extraneous strdup() and strstr() declarations in the code
-(apparently these are macros in that version of Debian gcc, so you
-cannot declare them).
-</UL>
-
-<H2>Beta release 1.0.b8 (8/01/00)</H2>
-<UL>
-
-<P>
-<LI> Added new filter ptype ("contained"), which builds a separate
-process by compiling both the main routine and the region code. This
-is different from the "process" ptype, which compiles the main
-routine, but links in pre-compiled region code (in order to make the
-program build more quickly). It is needed by ds9 so that the latter
-does not have to keep track of the compiled region code module.
-</UL>
-
-<H2>Beta release 1.0.b7 (7/25/00)</H2>
-<UL>
-
-<P>
-<LI> Changed filter code so that, in simple cases, we can access the
-contents of a file. This is needed so that funcnts can work properly in one
-oft-used case, i.e., if the file foo contains:
-<PRE>
- circle 5 5 1
- circle 4 4 1
-</PRE>
-then:
-<PRE>
- funcnts foo.fits @foo
-</PRE>
-now will display the 2 regions in its output, instead of displaying the
-near useless "@foo". This only works for simple cases where only a file
-is input, not in odd combinations like:
-<PRE>
- funcnts foo.fits "@foo,circle 1 1 1"
-</PRE>
-
-<P>
-<LI> Added programming tutorial and enhanced the programming
-reference documentation.
-
-<P>
-<LI> Ported to Windows via the Cygwin environment from
-RedHat. We tested on an NT box, which has decent multi-tasking
-support. Whether it works on Windows95 is unknown.
-
-<P>
-<LI> Upgraded WCS libraries to 2.8.3.
-
-<P>
-<LI> Ported to new and strict SGI C compiler, which uncovered
-lots of unused variables, etc.
-
-<P>
-<LI> Fixed FunParamPut status return.
-</UL>
-
-<H2>Beta release 1.0.b6 (7/15/00)</H2>
-<UL>
-
-<P>
-<LI> Ran Purify with each high level program and each funtest
-program.
-<P>
-<LI> Changed behavior of merge=update option of
-FunColumnSelect() so that the update of the user column value only
-takes place if the user mode has "w" in it. Previously, merge=update
-overrode the mode flag and always updated the user value. Note that
-all calls to FunColumnSelect with merge=update must change "r" to "rw"
-in order to have that user column merged. (The merge=replace already
-was checking the mode flag -- the fact that they were doing different
-things is a bug.)
-<P>
-<LI> Added ability to FunOpen extensions by HDU name. (I
-thought I had already done this!)
-<P>
-<LI> Fixed bug that was adding a NULL table at the end of
-most binary table files (i.e., those that were not copying the rest of
-the input file).
-<P>
-<LI> Re-ported to Alpha. The problem found most often was the
-casting of pointers to ints when doing pointer calculations, i.e.:
-<PRE>
- char *s, *t;
- n = ((int)s - (int)t);
-</PRE>
-which is invalid on the 64-bit Alpha. Instead use:
-<PRE>
- char *s, *t;
- n = (s - t);
-</PRE>
-Also broadened the check for use of dlopen in configure to match Alpha's
-library configurations (On Alpha, dlopen is in libc).
-
-<P>
-<LI> Changed FunColumnActivate() so that funtools will
-process columns in the sorted order specified by that routine. Thus:
-<PRE>
- fundisp foo.ev "time y x"
-</PRE>
-will display columns in that order.
-
-<P>
-Sorting does not take place if the activate list contains only exclude
-columns (since there is nothing to sort). Also, you can turn off
-sorting altogether (mimicking the old behavior) by calling
-FunColumnActivate() with a "sort=false" in the plist argument:
-<PRE>
- FunColumnActivate(fun, "y x", "sort=false");
-</PRE>
-or by adding "sort=false" to the activate string itself:
-<PRE>
- # by default, its sorted
- fundisp $E "time y x"
- TIME Y X
- ---------------- ------- -------
- 6.8500 -7 -7
- 6.8600 -7 -7
-</PRE>
-while:
-<PRE>
- # turn off sorting
- ./fundisp $E "time y x sort=false"
- X Y TIME
- ------- ------- ----------------
- -7 -7 6.8500
- -7 -7 6.8600
- -7 -7 6.8700
-</PRE>
-</UL>
-
-<H2>Beta release 1.0.b5 (7/8/00)</H2>
-<UL>
-
-<P>
-<LI> Changed all FunParamSet calls to FunParamPut, to make the
-naming consistent with FunImagePut, FunEventsPut, etc.
-
-<P>
-<LI> Fixed bugs preventing tlmin/tlmax from being changed by the
-user in binary tables. Also tlmin/tlmax are now written out using a
-data type that matches the data type of the respective column.
-
-<P>
-<LI> Extended filter syntax to allow "," as separator between
-filename and filters (as well as brackets), i.e.:
-<PRE>
- foo.fits,events # event extension
- foo.fits,pha==1 # filter on default extension
- foo.fits,1 # first extension
-</PRE>
-Note that all but simple expressions will need to be quoted because
-of the shell:
-<PRE>
- foo.fits,pha==1&&pi==2 # & tells shell to run in bkgd
- foo.fits,pha==1||pi==2 # similar problems with pipes
- foo.fits,circle(1,2,3) # parens are grabbed by shell
-</PRE>
-
-<P>
-<LI> Fixed configure so that --with-lib is no longer necessary
-to generate a single funtools.a library. Removed this argument from
-saoconfig. Note that:
-<PRE>
- ./configure
-</PRE>
-
-now works properly again, so saoconfig should not be used.
-
-<P>
-<LI> Changed FunFlush() mode argument (single characters) to a
-plist argument (keyword arguments). In particular,
-<PRE>
- FunFlush(fun, "C");
-</PRE>
-is now:
-<PRE>
- FunFlush(fun, "copy=remaining");
-(or FunFlush(fun, "copy=remainder"); )
-</PRE>
-
-This syntax extension allows FunFlush to support the copy of the
-extension associated with the reference handle, which allows one to
-copy any extension from an input file to an output file:
-<PRE>
- /* open a new input extension */
- ifun = FunOpen(...);
- /* make this new extension the output reference extension */
- FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
- /* copy the current reference extension to output */
- FunFlush(ofun, "copy=reference");
-</PRE>
-
-<P>
-<LI> Fixed bugs in region parser that caused pure floating
-point positions (i.e., numbers w/o format characters) always to be
-interpreted as pixels. Also fixed galactic and ecliptic conversions.
-</UL>
-
-<HR>
-<P>
-<A HREF="./help.html">Index to the Funtools Help Pages</A>
-
-<HR>
-<A HREF="./help.html">Index to the Funtools Help Pages</A>
-
-<H5>Last updated: November 17, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/combo.html b/funtools/doc/combo.html
deleted file mode 100644
index ab0bc28..0000000
--- a/funtools/doc/combo.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!-- =defdoc funcombine funcombine n -->
-<HTML>
-<HEAD>
-<TITLE>Combining Region and Table Filters</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funcombine NAME -->
-<H2><A NAME="funcombine">FunCombine: Combining Region and Table Filters</A></H2>
-
-<!-- =section funcombine SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document discusses the conventions for combining region and table
-filters, especially with regards to the comma operator.
-
-
-<!-- =section funcombine DESCRIPTION -->
-<H2><A NAME="conventions">Comma Conventions</A></H2>
-<P>
-Filter specifications consist of a series of boolean expressions,
-separated by commas. These expressions can be table filters,
-spatial region filters, or combinations thereof. Unfortunately,
-common usage requires that the comma operator must act differently
-in different situations. Therefore, while its use is intuitive in
-most cases, commas can be a source of confusion.
-
-<P>
-According to long-standing usage in IRAF, when a comma separates two
-table filters, it takes on the meaning of a boolean <B>and</B>. Thus:
-<PRE>
- foo.fits[pha==1,pi==2]
-</PRE>
-is equivalent to:
-<PRE>
- foo.fits[pha==1 && pi==2]
-</PRE>
-
-When a comma separates two spatial region filters, however, it has
-traditionally taken on the meaning of a boolean <B>or</B>. Thus:
-<PRE>
- foo.fits[circle(10,10,3),ellipse(20,20,8,5)]
-</PRE>
-is equivalent to:
-<PRE>
- foo.fits[circle(10,10,3) || ellipse(20,20,8,5)]
-</PRE>
-(except that in the former case, each region is given a unique id
-in programs such as funcnts).
-
-<P>
-Region and table filters can be combined:
-<PRE>
- foo.fits[circle(10,10,3),pi=1:5]
-</PRE>
-or even:
-<PRE>
- foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
-</PRE>
-In these cases, it is not obvious whether the command should utilize an
-<B>or</B> or <B>and</B> operator. We therefore arbitrarily chose to
-implement the following rule:
-<UL>
-<LI> if both expressions contain a region, the operator used is <B>or</B>.
-<LI> if one (or both) expression(s) does not contain a region, the operator
-used is <B>and</B>.
-</UL>
-This rule handles the cases of pure regions and pure column filters properly.
-It unambiguously assigns the boolean <B>and</B> to all mixed cases. Thus:
-<PRE>
- foo.fits[circle(10,10,3),pi=1:5]
-</PRE>
-and
-<PRE>
- foo.fits[pi=1:5,circle(10,10,3)]
-</PRE>
-both are equivalent to:
-<PRE>
- foo.fits[circle(10,10,3) && pi=1:5]
-</PRE>
-
-<P>
-[NB: This arbitrary rule <b>replaces the previous arbitrary rule</b>
-(pre-funtools 1.2.3) which stated:
-<UL>
-<LI> if the 2nd expression contains a region, the operator used is <B>or</B>.
-<LI> if the 2nd expression does not contain a region, the operator
-used is <B>and</B>.
-</UL>
-In that scenario, the <B>or</B> operator was implied by:
-<PRE>
- pha==4,circle 5 5 1
-</PRE>
-while the <B>and</B> operator was implied by
-<PRE>
- circle 5 5 1,pha==4
-</PRE>
-Experience showed that this non-commutative treatment of the comma
-operator was confusing and led to unexpected results.]
-
-<P>
-The comma rule must be considered provisional: comments and complaints
-are welcome to help clarify the matter. Better still, we recommend
-that the comma operator be avoided in such cases in favor of an
-explicit boolean operator.
-
-<!-- =section funcombine SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 16, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/doc40.fits b/funtools/doc/doc40.fits
deleted file mode 100644
index 8ac4dcc..0000000
--- a/funtools/doc/doc40.fits
+++ /dev/null
Binary files differ
diff --git a/funtools/doc/ds9.html b/funtools/doc/ds9.html
deleted file mode 100644
index eefdfb6..0000000
--- a/funtools/doc/ds9.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!-- =defdoc funds9 funds9 n -->
-<HTML>
-<HEAD>
-<TITLE>Funtools and DS9 Image Display</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funds9 NAME -->
-<H2><A NAME="funds9">FunDS9: Funtools and DS9 Image Display</A></H2>
-
-<!-- =section funds9 SYNOPSIS -->
-<H2>Summary</H2>
-Describes how funtools can be integrated into the ds9 Analysis menu.
-
-<!-- =section funds9 DESCRIPTION -->
-<H2>Description</H2>
-<P>
-<A HREF="http://hea-www.harvard.edu/saord/ds9/index.html">
-SAOImage/DS9</A> is an astronomical imaging and data visualization
-application used by astronomers around the world. DS9 can display
-standard astronomical FITS images and binary tables, but also has
-support for displaying raw array files, shared memory files, and data
-files automatically retrieved via FTP and HTTP. Standard functional
-capabilities include multiple frame buffers, colormap and region
-manipulation, and many data scaling algorithms. DS9's advanced
-features include TrueColor visuals, deep frame buffers, true
-PostScript printing, and display of image mosaics. The program's
-support of image tiling, "blinking", arbitrary zoom, rotation, and pan
-is unparalleled in astronomy. It also has innovative support for
-automatic retrieval and display of standard image data such as the
-Digital Sky Survey (using servers at SAO, StScI, or ESO).
-
-<P>
-DS9 can communicate with external programs such as Funtools using the
-<A HREF="http://hea-www.harvard.edu/saord/xpa/index.html">XPA</A>
-messaging system. In addition, programs can be integrated directly
-into the DS9 GUI by means of a configurable Analysis menu. By
-default, the DS9 Analysis menu contains algorithms deemed essential to
-the core functions of DS9, e.g., display cross-cuts of data,
-iso-intensity contours, and WCS grids. However, new programs can be
-added to DS9 by creating a set-up file which can be loaded into DS9
-to reconfigure the Analysis menu.
-
-<PRE>
-The basic format of the analysis set-up file is:
-<P>
- #
- # Analysis command descriptions:
- # menu label/description
- # file templates for this command
- # "menu" (add to menu) |"bind" (bind to key)
- # analysis command line
-</PRE>
-
-For example, the funcnts program can be specified in this way:
-<PRE>
- Funcnts (counts in source/bkgd regions; options: none)
- *
- menu
- funcnts $filename $regions(source,,) $regions(background,,) | $text
-</PRE>
-As shown above, DS9 supports a macro facility to provide information
-as well as task support to command lines. For example, the $regions
-macro is expanded by DS9 to provide the current source and/or
-background region to the analysis command. The $text macro is expanded
-to generate a text window display. It also is possible to query for
-parameters using a $param macro, plot data using a $plot macro,
-etc. See the DS9 documentation for further details.
-
-<P>
-A set-up file called <A HREF="./funtools.ds9">funtools.ds9</A> will
-load some useful Funtools applications (counts in regions, radial
-profile, X-ray light curve and energy spectrum, 1D histogram) into the DS9
-Analysis menu (version 2.1 and above). The file resides in the bin
-directory where Funtools programs are installed. It can be manually
-loaded into DS9 from the <B>Load Analysis Commands ...</B> option of
-the <B>Analysis</B> menu. Alternatively, you can tell DS9 to load
-this file automatically at start-up time by adding the pathname to the
-<B>Edit</B>-><B>Preferences</B>-><B>Analysis Menu</B>-><B>Analysis
-File</B> menu option. (NB: make sure you select
-<B>Edit</B>-><B>Preferences</B>-><B>Save Preferences</B> after setting
-the pathname.)
-
-<P>
-The tasks in this setup file generally process the original disk-based
-FITS file. Funcnts-based results (radial profile, counts in regions)
-are presented in WCS units, if present in the FITS header. For
-situations where a disk file is not available (e.g., image data
-generated and sent to DS9's 'fits' XPA access point), versions of the
-radial profile and counts in regions tasks also are also offered
-utilizing DS9's internal image data. Results are presented in pixels.
-Aside from the units, the results should be identical to the file-based
-results.
-
-<!-- =section funds9 SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 16, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/env.html b/funtools/doc/env.html
deleted file mode 100644
index c060017..0000000
--- a/funtools/doc/env.html
+++ /dev/null
@@ -1,222 +0,0 @@
-<!-- =defdoc funenv funenv n -->
-<HTML>
-<HEAD>
-<TITLE>Funtools Environment Variables</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funenv NAME -->
-<H2><A NAME="funenv">FunEnv: Funtools Environment Variables</A></H2>
-
-<!-- =section funenv SYNOPSIS -->
-<H2>Summary</H2>
-Describes the environment variables which can be used to tailor the overall
-Funtools environment.
-
-<!-- =section funenv DESCRIPTION -->
-<H2>Description</H2>
-<P>
-The following environment variables are supported by Funtools:
-<DL>
-<P>
-<DT><B>FITS_EXTNAME</B>
-<DD> The <B>FITS_EXTNAME</B> environment variable specifies the
-default FITS extension name when <A HREF="./library.html#funopen">FunOpen()</A> is called on a file lacking
-a primary image. Thus,
-<PRE>
- setenv FITS_EXTNAME "NEWEV"
-</PRE>
-will allow you to call <A HREF="./library.html#funopen">FunOpen()</A> on files without specifying NEWEV in
-the
-<A HREF="./files.html">Funtools bracket specification</A>.
-If no FITS_EXTNAME variable is defined and the extension name also is
-not passed in the bracket specification, then the default will be to
-look for standard X-ray event table extension names "EVENTS" or
-"STDEVT" (we are, after all, and X-ray astronomy group at heart!).
-
-<P>
-<DT><B>FITS_EXTNUM</B>
-<DD> The <B>FITS_EXTNUM</B> environment variable specifies the
-default FITS extension number when <A HREF="./library.html#funopen">FunOpen()</A> is called on a file lacking
-a primary image. Thus,
-<PRE>
- setenv FITS_EXTNUM 7
-</PRE>
-will allow you to call <A HREF="./library.html#funopen">FunOpen()</A> on files to open the seventh
-extension without specifying the number in the
-<A HREF="./files.html">Funtools bracket specification</A>.
-
-<P>
-<DT><B>FITS_BINCOLS</B> and <B>EVENTS_BINCOLS</B>
-<DD> These environment variable specifies the default binning key for
-FITS binary tables and raw event files, respectively. They can be
-over-ridden using the <B>bincols=[naxis1,naxis2]</B> keyword in a
-<A HREF="./files.html">Funtools bracket specification</A>.
-The value of each environment variable
-is a pair of comma-delimited columns, enclosed in parentheses, to use
-for binning. For example, if you want to bin on detx and dety by
-default, then use:
-<PRE>
- setenv FITS_BINCOLS "(detx,dety)"
-</PRE>
-in preference to adding a bincols specification to each filename:
-<PRE>
- foo.fits[bincols=(detx,dety)]
-</PRE>
-
-<P>
-<DT><B>FITS_BITPIX</B> and <B>EVENTS_BITPIX</B>
-<DD> These environment variable specifies the default bitpix value for
-binning FITS binary tables and raw event files, respectively. They can
-be over-ridden using the <B>bitpix=[value]</B> keyword in a
-<A HREF="./files.html">Funtools bracket specification</A>. The value
-of each environment variable is one of the standard FITS bitpix values
-(8,16,32,-32,-64). For example, if you want binning routines to
-create a floating array, then use:
-<PRE>
- setenv FITS_BITPIX -32
-</PRE>
-in preference to adding a bitpix specification to each filename:
-<PRE>
- foo.fits[bitpix=-32]
-</PRE>
-
-<P>
-<DT><B>ARRAY</B>
-<DD> The <B>ARRAY</B> environment variable specifies the default
-definition of an array file for Funtools.
-It is used if there is no array specification passed in the
-<B>ARRAY()</B> directive in a
-<A HREF="./files.html#arrays">Non-FITS Array specification</A>.
-The value of the environment variable is a valid array specification such as:
-<PRE>
- setenv ARRAY "s100.150"
- foo.arr[ARRAY()]
-</PRE>
-This can be defined in preference to adding the specification to each filename:
-<PRE>
- foo.arr[ARRAY(s100.150)]
-</PRE>
-
-<P>
-<DT><B>EVENTS</B>
-<DD> The <B>EVENTS</B> environment variable specifies the default
-definition of an raw event file for Funtools.
-It is used if there is no EVENTS specification passed in the
-<B>EVENTS()</B> directive in a
-<A HREF="./files.html#events">Non-FITS EVENTS specification</A>.
-The value of the environment variable is a valid EVENTS specification such as:
-<PRE>
- setenv EVENTS "x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024"
- foo.ev[EVENTS()]
-</PRE>
-This can be defined in preference to adding the specification to each filename:
-<PRE>
- foo.ev[EVENTS(x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024)]
-</PRE>
-</DL>
-
-The following filter-related environment variables are supported by Funtools:
-<DL>
-
-<P>
-<DT><B>FILTER_PTYPE</B>
-<DD> The <B>FILTER_PTYPE</B> environment variable specifies how to
-build a filter. There are three possible methods:
-<DL>
-<DT>process or p
-<DD>The filter is compiled and linked against the funtools library (which
-must therefore be accessible in the original install directory) to produce
-a slave program. This program is fed events or image data and returns
-filter results.
-
-<DT>dynamic or d (gcc only)
-<DD>The filter is compiled and linked against the funtools library (which
-must therefore be accessible in the original install directory) to produce
-a dynamic shared object, which is loaded into the funtools program and
-executed as a subroutine. (Extensive testing has shown that, contrary to
-expectations, this method is no faster than using a slave process.)
-
-<DT>contained or c
-<DD>The filter and all supporting region code is compiled and linked
-without reference to the funtools library to produce a slave program
-(which is fed events or image data and returns filter results). This method
-is slower than the other two, because of the time it takes to compile the
-region filtering code. It is used by stand-alone programs such as ds9,
-which do not have access to the funtools library.
-</DL>
-
-By default, <B>dynamic</B> is generally used for gcc compilers and
-<B>process</B> for other compilers. However the filter building algorithm
-will check for required external files and will use <B>contained</B> is
-these are missing.
-
-<P>
-<DT><B>FUN_MAXROW</B>
-<DD> The <B>FUN_MAXROW</B> environment variable is used by core
-row-processing Funtools programs (funtable, fundisp, funcnts, funhist,
-funmerge, and funcalc) to set the maximum number of rows read at once
-(i.e. it sets the third argument to the FunTableRowGet() call). The
-default is 8192. Note that this variable is a convention only: it will
-not be a part of a non-core Funtools program unless code is explicitly
-added, since each call to FunTableRowGet() specifies its own maximum
-number of rows to read. NB: if you make this value very large, you
-probably will need to increase <B>FUN_MAXBUFSIZE</B> (see below) as well.
-
-<P>
-<DT><B>FUN_MAXBUFSIZE</B>
-<DD> The <B>FUN_MAXBUFSIZE</B> environment variable is used to limit the
-max buffer size that will be allocated to hold table row data. This
-buffer size is calculated to be the row size of the table multiplied
-by the maximum number of rows read at once (see above). Since the
-row size is unlimited (and we have examples of it being larger than 5
-Mb), it is possible that the total buffer size will exceed the machine
-capabilities. We therefore set a default value of 5Mb for the max buffer
-size, and adjust maxrow so that the total size calculated is less than
-this max buffer size. (If the row size is greater than this max buffer
-size, then maxrow is set to 1.) This environment variable will change
-the max buffer size allowed.
-
-<P>
-<DT><B>FILTER_CC</B>
-<DD> The <B>FILTER_CC</B> environment variable specifies the compiler to
-use for compiling a filter specification. You also can use the <B>CC</B>
-environment variable. If neither has been set, then gcc will be used
-if available. Otherwise cc is used if available.
-
-<P>
-<DT><B>FILTER_EXTRA</B>
-<DD> The <B>FILTER_EXTRA</B> environment variable specifies extra options
-to add to a filter compile command line. In principle, you can add libraries,
-include files, and compiler switches. This variable should be used with care.
-
-<P>
-<DT><B>FILTER_TMPDIR</B>
-<DD> The <B>FILTER_TMPDIR</B> environment variable specifies the temporary
-directory for filter compilation intermediate files. You also can use
-the <B>TMPDIR</B> and <B>TMP</B> variables. By default, /tmp is used
-as the temporary directory.
-
-<P>
-<DT><B>FILTER_KEEP</B>
-<DD> The <B>FILTER_KEEP</B> environment variable specifies whether the
-intermediate filter files (i.e. C source file and compile log file)
-should be saved after a filter is built. The default is "false", so that
-these intermediate files are deleted. This variable is useful for debugging,
-but care should be taken to reset its value to false when debugging is
-complete.
-
-</DL>
-
-<!-- =section funenv SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 16, 2005</H5>
-
-</BODY>
-</HTML>
-
diff --git a/funtools/doc/evcol.c b/funtools/doc/evcol.c
deleted file mode 100644
index 1e40df9..0000000
--- a/funtools/doc/evcol.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * evcol.c -- example program for processing all extensions and adding a
- * column to the binary tables
- *
- */
-#include <funtools.h>
-#include <word.h>
-
-#define MAXROW 8192
-
-typedef struct evstruct{
- char shape[17];
- int mycol;
-} *Ev, EvRec;
-
-int main (int argc, char **argv)
-{
- int i, got;
- int idx;
- int tlmax;
- int ext=1;
- int total=1;
- int haveshape=0;
- char *s[3];
- char tbuf[SZ_LINE];
- Fun fun, fun2;
- Ev ebuf, ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 3 )
- gerror(stderr, "usage: %s iname oname\n", argv[0]);
-
- /* open a new output FITS file */
- if( !(fun2 = FunOpen(argv[2], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* process each input extension in turn */
- for(ext=0; ;ext++){
- /* get new extension name */
- sprintf(tbuf, "%s[%d]", argv[1], ext);
- /* open it -- if we cannot open it, we are done */
- if( !(fun=FunOpen(tbuf, "r", NULL)) )
- break;
-
- /* make the new extension the reference handle for the output file */
- FunInfoPut(fun2, FUN_IFUN, &fun, 0);
-
- /* if its not a binary table, just write it out */
- for(i=0; i<=2; i++) s[i] = NULL;
- if( !(s[0]=FunParamGets(fun, "XTENSION", 0, NULL, &got)) ||
- strcmp(s[0], "BINTABLE")){
- if( s[0] ) free(s[0]);
- FunFlush(fun2, "copy=reference");
- FunClose(fun);
- continue;
- }
- else{
- if( (s[1]=FunParamGets(fun, "EXTNAME", 0, NULL, &got)) ){
- fprintf(stdout, "processing %s", s[1]);
- if( (s[2]=FunParamGets(fun, "HDUNAME", 0, NULL, &got)) )
- fprintf(stdout, " %s", s[2]);
- fprintf(stdout, "\n");
- }
- }
- for(i=0; i<=2; i++) if( s[i] ) free(s[i]);
-
- /* select columns from this new extension for merging */
- /* we have some special code to test various bugs with bpix.fits */
- if( (idx = FunColumnLookup(fun, "SHAPE", 0,
- NULL, NULL, NULL, NULL, NULL, NULL)) ){
- haveshape = 1;
- FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "SHAPE", "16A", "rw", FUN_OFFSET(Ev, shape),
- "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
- NULL);
- }
- else{
- FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
- NULL);
- }
-
- /* we have some special code to test various bugs with bpix.fits */
- /* we need to increase tlmax value of the "component" column */
- if( (idx = FunColumnLookup(fun, "COMPONENT", 0,
- NULL, NULL, NULL, NULL, NULL, NULL)) ){
- if( (tlmax=FunParamGeti(fun, "TLMAX", idx, -1, &got)) && got )
- FunParamPuti(fun2, "TLMAX", idx, tlmax+100, NULL, 0);
- }
-
- /* get input rows (let routine allocate the row array) */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- /* make sure ascii vector is null-terminated */
- ev->shape[17] = '\0';
- /* used with bpix.ev */
- if( haveshape ){
- cluc(ev->shape);
- fprintf(stdout, "\tshape: %s\n", ev->shape);
- }
- ev->mycol = total++;
- }
- /* write out this batch of rows, along with the new column */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* write out one more record with special marker */
- ev = ebuf;
- strcpy(ev->shape, "hexagon ");
- ev->mycol = -1;
- FunTableRowPut(fun2, (char *)ev, 1, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
- /* flush output extension (write padding, etc.) */
- FunFlush(fun2, NULL);
- /* close the input extension */
- FunClose(fun);
- }
-
- /* all done -- close output */
- FunClose(fun2);
- return(0);
-}
diff --git a/funtools/doc/evmerge.c b/funtools/doc/evmerge.c
deleted file mode 100644
index 6b7cebc..0000000
--- a/funtools/doc/evmerge.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * evmerge.c -- example program for merging user values into a table file
- *
- */
-#include <funtools.h>
-#include <word.h>
-
-#define MAXROW 8192
-
-typedef struct evstruct{
- double time;
- int time2;
-} *Ev, EvRec;
-
-int main (int argc, char **argv)
-{
- int i, got;
- char tbuf[SZ_LINE];
- Fun fun, fun2;
- Ev ebuf, ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 4 )
- gerror(stderr, "usage: %s iname oname mergetype [columns]\n", argv[0]);
-
- /* open input file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* "merge=[type]" merges original input columns with new ones, where type is:
- * update -- add new columns, update value of existing ones (same data type)
- * replace -- add new columns, replace data type and value of existing ones
- * append -- only add new columns, do not "replace" or "update" existing ones
- * If tbuf argument is NULL, no merging is performed -- only user-specified
- * columns are output.
- */
- if( isfalse(argv[3]) )
- *tbuf = '\0';
- else
- sprintf(tbuf, "merge=%s", argv[3]);
- FunColumnSelect(fun, sizeof(EvRec), tbuf,
- "time", "D", "rw", FUN_OFFSET(Ev, time),
- "time2", "J", "w", FUN_OFFSET(Ev, time2),
- NULL);
-
- /* activate specified columns -- these will be written to the output file */
- if( argc >= 5 )
- FunColumnActivate(fun, argv[4], NULL);
-
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ev->time2 = (int)(ev->time+.5);
- ev->time = -(ev->time/10.0);
- }
- /* write out this batch of rows with the new column */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
- /* clean up -- close output before input to perform flush automatically */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/doc/evnext.c b/funtools/doc/evnext.c
deleted file mode 100644
index 4a7fa09..0000000
--- a/funtools/doc/evnext.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * evnext.c -- example program for changing the time of an row to have
- * the value from the next row
- *
- */
-
-#include <funtools.h>
-
-#define MAXROW 100
-
-typedef struct evstruct{
- double time;
-} *Ev, EvRec;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int got, ogot;
- char *oraw;
- char *nraw;
- char *null=NULL;
- Ev ebuf, oebuf=NULL;
- Ev ev, nev, oev;
- Fun fun, fun2;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 3 )
- gerror(stderr, "usage: %s iname oname [columns]\n", argv[0]);
-
- /* open file */
- if( !(fun = FunOpen(argv[1], "r", NULL)) )
- gerror(stderr, "could not FunOpen %s\n", argv[1]);
-
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* specify columns we want */
- got = FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "time", "1D", "rw", FUN_OFFSET(Ev, time),
- NULL);
- /* activate specified columns -- these will be written to the output file */
- if( argc >= 4 )
- FunColumnActivate(fun, argv[3], NULL);
-
- /* get rows */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process the last row from previous batch, if we have it */
- if( oebuf ){
- /* this is the old array of rows -- we point to the last one */
- oev = oebuf+(ogot-1);
- /* this is the new array of rows -- we point to the first one */
- ev = ebuf;
- /* change time value of old row to new row's value */
- oev->time = ev->time;
- /* now we have to write out this last row */
- /* first, save pointer to the new raw data */
- FunInfoGet(fun, FUN_RAWBUF, &nraw);
- /* put back old pointer so we merge it with last row */
- FunInfoPut(fun, FUN_RAWBUF, &oraw);
- /* write out last row merging with its raw data */
- /* (its arg 4 that tells funtools to merge with the last raw row) */
- FunTableRowPut(fun2, oebuf, 1, ogot-1, NULL);
- /* free up old raw data */
- if( oraw ) free(oraw);
- /* free up old user data */
- if( oebuf ) free(oebuf);
- /* finally, put back new raw data pointer, so we can process new batch */
- FunInfoPut(fun, FUN_RAWBUF, &nraw);
- }
- /* process the got-1 rows by replacing the time with time from
- the succeeding row */
- for(i=0; i<(got-1); i++){
- /* point to the i'th row */
- ev = ebuf+i;
- nev = ebuf+(i+1);
- ev->time = nev->time;
- }
- /* if we processed at least one row this time ... */
- if( got > 1 ){
- /* write out got-1 rows with the raw columns */
- FunTableRowPut(fun2, (char *)ebuf, (got-1), 0, NULL);
- }
- /* if we have a "last" row to process next time ... */
- if( got ){
- /* save the user row for when we have the next batch */
- oebuf = ebuf;
- /* save pointer to raw data */
- FunInfoGet(fun, FUN_RAWBUF, &oraw);
- /* null out rawbuf pointer so Funtools does not free it automatically */
- FunInfoPut(fun, FUN_RAWBUF, &null);
- /* save old value of got */
- ogot = got;
- }
- }
-
- /* clean up last saved batch */
- if( oraw ) free(oraw);
- if( oebuf ) free(oebuf);
-
- /* close and return */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/doc/evread.c b/funtools/doc/evread.c
deleted file mode 100644
index aad5a13..0000000
--- a/funtools/doc/evread.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- *
- * evread.c -- example program for reading rows in different ways
- *
- */
-
-#include <funtools.h>
-
-#define MAXROW 10000
-
-extern char *optarg;
-extern int optind;
-
-/* single event (used in array of structs) */
-typedef struct evstruct{
- short region;
- double x, y;
- int pi, pha;
- double time;
- double dx, dy;
-} *Ev, EvRec;
-
-/* arrays of columns (used in struct of arrays) */
-typedef struct aevstruct{
- short region[MAXROW];
- double x[MAXROW], y[MAXROW];
- int pi[MAXROW], pha[MAXROW];
- double time[MAXROW];
- double dx[MAXROW], dy[MAXROW];
-} *AEv, AEvRec;
-
-/* pointers to arrays of columns (used in struct of arrays) */
-typedef struct pevstruct{
- short *region;
- double *x, *y;
- int *pi, *pha;
- double *time;
- double *dx, *dy;
-} *PEv, PEvRec;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int c;
- int got;
- int put;
- int args;
- int doev=0;
- int doualloc=0;
- char *mode="r";
- char *iname;
- char *oname=NULL;
- char *params=NULL;
- Fun fun=NULL;
- Fun ofun=NULL;
- void *buf=NULL;
- Ev ev, ebuf=NULL;
- AEv aev, abuf=NULL;
- PEv pev, pbuf=NULL;
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "aepuw:")) != -1){
- switch(c){
- case 'a':
- doev = 1;
- params = "org=soa";
- break;
- case 'e':
- doev = 0;
- params = "org=aos";
- break;
- case 'f':
- doev = 3;
- params = "org=aos";
- break;
- case 'p':
- doev = 2;
- params = "org=soa";
- break;
- case 'u':
- doualloc = 1;
- break;
- case 'w':
- oname = optarg;
- mode = "rw";
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- if( args == 0 )
- iname = "test.ev[EVENTS]";
- else
- iname = argv[optind];
-
- /* open input file */
- if( !(fun = FunOpen(iname, "r", NULL)) ){
- gerror(stderr, "could not FunOpen %s\n", iname);
- exit(1);
- }
-
- /* open output file, if necessary */
- if( oname ){
- if( !(ofun = FunOpen(oname, "w", fun)) ){
- gerror(stderr, "could not FunOpen outout %s\n", oname);
- exit(1);
- }
- }
-
- /* specify columns we want */
- switch(doev){
- /* array of structs */
- case 0:
- got = FunColumnSelect(fun, sizeof(EvRec), params,
- "$region", "I", mode, FUN_OFFSET(Ev, region),
- "x", "D:10:10", mode, FUN_OFFSET(Ev, x),
- "y", "D:10:10", mode, FUN_OFFSET(Ev, y),
- "dx", "D:10:10", mode, FUN_OFFSET(Ev, dx),
- "dy", "D:10:10", mode, FUN_OFFSET(Ev, dy),
- "pi", "J", mode, FUN_OFFSET(Ev, pi),
- "pha", "J", mode, FUN_OFFSET(Ev, pha),
- "time", "1D", mode, FUN_OFFSET(Ev, time),
- NULL);
- if( doualloc ){
- ebuf = calloc(MAXROW, sizeof(EvRec));
- buf = ebuf;
- }
- break;
- /* struct of arrays */
- case 1:
- got = FunColumnSelect(fun, sizeof(AEvRec), params,
- "$region", "I", mode, FUN_OFFSET(AEv, region),
- "x", "D:10:10", mode, FUN_OFFSET(AEv, x),
- "y", "D:10:10", mode, FUN_OFFSET(AEv, y),
- "dx", "D:10:10", mode, FUN_OFFSET(AEv, dx),
- "dy", "D:10:10", mode, FUN_OFFSET(AEv, dy),
- "pi", "J", mode, FUN_OFFSET(AEv, pi),
- "pha", "J", mode, FUN_OFFSET(AEv, pha),
- "time", "1D", mode, FUN_OFFSET(AEv, time),
- NULL);
- if( doualloc ){
- abuf = calloc(1, sizeof(AEvRec));
- buf = abuf;
- }
- break;
- /* struct of pointers */
- case 2:
- got = FunColumnSelect(fun, sizeof(PEvRec), params,
- "$region", "@I", mode, FUN_OFFSET(PEv, region),
- "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
- "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
- "dx", "@D:10:10", mode, FUN_OFFSET(PEv, dx),
- "dy", "@D:10:10", mode, FUN_OFFSET(PEv, dy),
- "pi", "@J", mode, FUN_OFFSET(PEv, pi),
- "pha", "@J", mode, FUN_OFFSET(PEv, pha),
- "time", "@1D", mode, FUN_OFFSET(PEv, time),
- NULL);
- if( doualloc ){
- pbuf = calloc(1, sizeof(PEvRec));
- pbuf->region = calloc(MAXROW, sizeof(short));
- pbuf->x = calloc(MAXROW, sizeof(double));
- pbuf->y = calloc(MAXROW, sizeof(double));
- pbuf->pi = calloc(MAXROW, sizeof(int));
- pbuf->pha = calloc(MAXROW, sizeof(int));
- pbuf->time = calloc(MAXROW, sizeof(double));
- pbuf->dx = calloc(MAXROW, sizeof(double));
- pbuf->dy = calloc(MAXROW, sizeof(double));
- buf = pbuf;
- }
- break;
- /* array of structs containing pointers */
- case 3:
- got = FunColumnSelect(fun, sizeof(PEvRec), params,
- "$region", "@I", mode, FUN_OFFSET(PEv, region),
- "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
- "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
- "dx", "@D:10:10", mode, FUN_OFFSET(PEv, dx),
- "dy", "@D:10:10", mode, FUN_OFFSET(PEv, dy),
- "pi", "@J", mode, FUN_OFFSET(PEv, pi),
- "pha", "@J", mode, FUN_OFFSET(PEv, pha),
- "time", "@1D", mode, FUN_OFFSET(PEv, time),
- NULL);
- if( doualloc ){
- pbuf = calloc(1, sizeof(PEvRec));
- pbuf->region = calloc(1, sizeof(short));
- pbuf->x = calloc(1, sizeof(double));
- pbuf->y = calloc(1, sizeof(double));
- pbuf->pi = calloc(1, sizeof(int));
- pbuf->pha = calloc(1, sizeof(int));
- pbuf->time = calloc(1, sizeof(double));
- pbuf->dx = calloc(1, sizeof(double));
- pbuf->dy = calloc(1, sizeof(double));
- buf = pbuf;
- }
- break;
- default:
- gerror(stderr, "unknown params value: %d\n", doev);
- break;
- }
-
- /* get rows */
- while( (buf = (void *)FunTableRowGet(fun, buf, MAXROW, NULL, &got)) ){
- /* output if necessary */
- if( ofun ){
- if( (put=FunTableRowPut(ofun, buf, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- /* and display */
- switch(doev){
- case 0:
- for(i=0; i<got; i++){
- ev = (Ev)buf+i;
- fprintf(stdout, "%d\t%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- (int)ev->region,
- ev->x, ev->y,
- ev->pi, ev->pha,
- ev->dx, ev->dy,
- ev->time);
- fflush(stdout);
- }
- break;
- case 1:
- aev = (AEv)buf;
- for(i=0; i<got; i++){
- fprintf(stdout, "%d\t%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- (int)aev->region[i],
- aev->x[i], aev->y[i],
- aev->pi[i], aev->pha[i],
- aev->dx[i], aev->dy[i],
- aev->time[i]);
- fflush(stdout);
- }
- break;
- case 2:
- pev = (PEv)buf;
- for(i=0; i<got; i++){
- fprintf(stdout, "%d\t%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- (int)pev->region[i],
- pev->x[i], pev->y[i],
- pev->pi[i], pev->pha[i],
- pev->dx[i], pev->dy[i],
- pev->time[i]);
- fflush(stdout);
- }
- break;
- case 3:
- for(i=0; i<got; i++){
- pev = (PEv)buf+i;
- fprintf(stdout, "%d\t%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- (int)pev->region[0],
- pev->x[0], pev->y[0],
- pev->pi[0], pev->pha[0],
- pev->dx[0], pev->dy[0],
- pev->time[0]);
- fflush(stdout);
- }
- break;
- default:
- gerror(stderr, "unknown params value: %d\n", doev);
- break;
- }
- /* if funtools did allocation, free it now */
- if( !doualloc ){
- if( buf ) xfree(buf);
- buf = NULL;
- }
- }
-
- /* clean up */
- if( doualloc ){
- switch(doev){
- case 0:
- if( ebuf ) xfree(ebuf);
- break;
- case 1:
- if( abuf ) xfree(abuf);
- break;
- case 2:
- if( pbuf->region ) xfree(pbuf->region);
- if( pbuf->x ) xfree(pbuf->x);
- if( pbuf->y ) xfree(pbuf->y);
- if( pbuf->pi ) xfree(pbuf->pi);
- if( pbuf->pha ) xfree(pbuf->pha);
- if( pbuf->time ) xfree(pbuf->time);
- if( pbuf->dx ) xfree(pbuf->dx);
- if( pbuf->dy ) xfree(pbuf->dy);
- if( pbuf ) xfree(pbuf);
- break;
- }
- }
- if( ofun ) FunClose(ofun);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/doc/files.html b/funtools/doc/files.html
deleted file mode 100644
index 0d903a4..0000000
--- a/funtools/doc/files.html
+++ /dev/null
@@ -1,627 +0,0 @@
-<!-- =defdoc funfiles funfiles n -->
-<HTML>
-<HEAD>
-<TITLE>Funtools Data Files</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funfiles NAME -->
-<H2><A NAME="files">FunFiles: Funtools Data Files</A></H2>
-
-<!-- =section funfiles SYNOPSIS -->
-<H2>Summary</H2>
-This document describes the data file formats (FITS, array, raw
-events) as well as the file types (gzip, socket, etc.) supported
-by Funtools.
-
-<!-- =section funfiles DESCRIPTION -->
-<H2>Description</H2>
-<P>
-Funtools supports FITS images and binary tables, and binary files
-containing array (homogeneous) data or event (heterogeneous) data.
-IRAF-style brackets are appended to the filename to specify various
-kinds of information needed to characterize these data:
-<PRE>
- file[ext|ind|ARRAY()|EVENTS(),section][filters]
- or
- file[ext|ind|ARRAY()|EVENTS(),section,filters]
-</PRE>
-where:
-<UL>
-<LI> <B>file</B> is the Funtools file name
-<LI> <B>ext</B> is the FITS extension name
-<LI> <B>ind</B> is the FITS extension number
-<LI> <B>ARRAY()</B> is an array specification
-<LI> <B>EVENTS()</B> is an event specification
-<LI> <B>section</B> is the image section specification
-<LI> <B>filters</B> are spatial region and table (row) filters
-</UL>
-
-<H2><A NAME="formats">Supported Data Formats</A></H2>
-<P>
-Funtools programs (and the underlying libraries) support the
-following data file formats:
-<UL>
-<LI> FITS images (and image extensions)
-<LI> FITS binary tables
-<LI> binary files containing an array of homogeneous data
-<LI> binary files containing events, i.e. records of heterogeneous data
-<LI> column-based text files, which are documented <A HREF="./text.html">here</A>
-<LI> non-disk files and lists of files
-</UL>
-Information needed to identify and characterize
-the event or image data can be specified on the command line
-using IRAF-style bracket notation appended to the filename:
-<PRE>
- foo.fits # open FITS default extension
- image.fits[3] # open FITS extension #3
- events.fits[EVENTS] # open EVENTS extension
- array.file[ARRAY(s1024)] # open 1024x1024 short array
- events.file[EVENTS(x:1024,y:1024...)] # open non-FITS event list
-</PRE>
-Note that in many Unix shells (e.g., csh and tcsh), filenames must
-be enclosed in quotes to protect the brackets from shell processing.
-
-<H2><A NAME="fits">FITS Images and Binary Tables</A></H2>
-<P>
-When <A HREF="./library.html#funopen">FunOpen()</A> opens a FITS file
-without a bracket specifier, the default behavior is to look for a
-valid image in the primary HDU. In the absence of a primary image,
-Funtools will try to open an extension named either <B>EVENTS</B> or
-<B>STDEVT</B>, if one of these exists. This default behavior supports
-both FITS image processing and standard X-ray event list processing
-(which, after all, is what we at SAO/HEAD do).
-
-<P>
-In order to open a FITS binary table or image extension explicitly, it
-is necessary to specify either the extension name or the extension
-number in brackets:
-<PRE>
- foo.fits[1] # open extension #1: the primary HDU
- foo.fits[3] # open extension #3 of a FITS file
- foo.fits[GTI] # open GTI extension of a FITS file
-</PRE>
-The ext argument specifies the name of the FITS extension (i.e. the
-value of the EXTENSION header parameter in a FITS extension), while
-the index specifies the value of the FITS EXTVER header parameter.
-Following FITS conventions, extension numbers start at 1.
-
-<P>
-When a FITS data file is opened for reading using
-<A HREF="./library.html#funopen">FunOpen()</A>, the specified extension
-is automatically located and is used to initialize the Funtools internal
-data structures.
-
-<H2><A NAME="events">Non-FITS Raw Event Files</A></H2>
-
-In addition to FITS tables, Funtools programs and libraries can operate
-on non-FITS files containing heterogeneous event records. To specify
-such an event file, use:
-
-<UL>
-<LI> file[EVENTS(event-spec)]
-<LI> file[EVENTS()]
-</UL>
-where <B>event-spec</B> is a string that specified the names, data
-types, and optional image dimensions for each element of the event
-record:
-<UL>
-<LI> [name]:[n][type]:[(lodim:)hidim]
-</UL>
-
-<P>
-Data types follow standard conventions for FITS binary tables, but include
-two extra unsigned types ('U' and 'V'):
-<UL>
-<LI> <B>B</B> -- unsigned 8-bit char
-<LI> <B>I</B> -- signed 16-bit int
-<LI> <B>J</B> -- signed 32-bit int
-<LI> <B>K</B> -- signed 64-bit int
-<LI> <B>E</B> -- 32-bit float
-<LI> <B>D</B> -- 64-bit float
-<LI> <B>U</B> -- unsigned 16-bit int
-<LI> <B>V</B> -- unsigned 32-bit int
-</UL>
-An optional integer value <B>n</B> can be prefixed to the type to indicate
-that the element is an array of n values. For example:
-<PRE>
- foo.fits[EVENTS(x:I,y:I,status:4J)]
-</PRE>
-defines x and y as 16-bit ints and status as an array of 4 32-bit ints.
-
-<P>
-Furthermore, image dimensions can be attached to the event specification
-in order to tell Funtools how to bin the events into an image. They
-follow the conventions for the FITS TLMIN/TLMAX keywords. If the low
-image dimension is not specified, it defaults to 1. Thus:
-
-<UL>
-<LI> RAWX:J:1:100
-<LI> RAWX:J:100
-</UL>
-both specify that the dimension of this column runs from 1 to 100.
-
-<P>
-NB: it is required that all padding be specified in the record
-definition. Thus, when writing out whole C structs instead of
-individual record elements, great care must be taken to include
-the compiler-added padding in the event definition.
-
-<P>
-For example, suppose a FITS binary table has the following set of column
-definitions:
-<PRE>
- TTYPE1 = 'X ' / Label for field
- TFORM1 = '1I ' / Data type for field
- TLMIN1 = 1 / Min. axis value
- TLMAX1 = 10 / Max. axis value
- TTYPE2 = 'Y ' / Label for field
- TFORM2 = '1I ' / Data type for field
- TLMIN2 = 2 / Min. axis value
- TLMAX2 = 11 / Max. axis value
- TTYPE3 = 'PHA ' / Label for field
- TFORM3 = '1I ' / Data type for field
- TTYPE4 = 'PI ' / Label for field
- TFORM4 = '1J ' / Data type for field
- TTYPE5 = 'TIME ' / Label for field
- TFORM5 = '1D ' / Data type for field
- TTYPE6 = 'DX ' / Label for field
- TFORM6 = '1E ' / Data type for field
- TLMIN6 = 1 / Min. axis value
- TLMAX6 = 10 / Max. axis value
- TTYPE7 = 'DY ' / Label for field
- TFORM7 = '1E ' / Data type for field
- TLMIN7 = 3 / Min. axis value
- TLMAX7 = 12 / Max. axis value
-</PRE>
-
-An raw event file containing these same data would have the event
-specification:
-<PRE>
- EVENTS(X:I:10,Y:I:2:11,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:3:12)
-</PRE>
-
-<P>
-If no event specification string is included within the EVENTS() operator,
-then the event specification is taken from the <B>EVENTS</B> environment
-variable:
-<PRE>
- setenv EVENTS "X:I:10,Y:I:10,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:10"
-</PRE>
-
-<P>
-In addition to knowing the data structure, it is necessary to know the
-<EM>endian</EM> ordering of the data, i.e., whether or not the data is
-in <EM>bigendian</EM> format, so that we can convert to the native
-format for this platform. This issue does not arise for FITS Binary
-Tables because all FITS files use big-endian ordering, regardless of
-platform. But for non-FITS data, big-endian data produced on a Sun
-workstation but read on a Linux PC needs to be byte-swapped, since PCs
-use little-endian ordering. To specify an ordering, use the
-<EM>bigendian=</EM> or <EM>endian=</EM> keywords on the command-line
-or the EVENTS_BIGENDIAN or EVENTS_ENDIAN environment variables. The
-value of the <EM>bigendian</EM> variables should be "true" or "false",
-while the value of the <EM>endian</EM> variables should be "little" or
-"big".
-
-<P>
-For example, a PC can access data produced by a Sun using:
-<PRE>
- hrc.nepr[EVENTS(),bigendian=true]
-or
- hrc.nepr[EVENTS(),endian=big]
-or
- setenv EVENTS_BIGENDIAN true
-or
- setenv EVENTS_ENDIAN big
-</PRE>
-If none of these are specified, the data are assumed to follow the
-format for that platform and no byte-swapping is performed.
-
-<H2><A NAME="arrays">Non-FITS Array Files</A></H2>
-
-In addition to FITS images, Funtools programs and libraries can operate
-on non-FITS files containing arrays of homogeneous data. To specify
-an array file, use:
-<UL>
-<LI> file[ARRAY(array-spec)]
-<LI> file[ARRAY()]
-</UL>
-
-where array-spec is of the form:
-<UL>
-<LI> [type][dim1][.dim2][:skip][endian]
-</UL>
-
-and where [type] is:
-<UL>
-<LI> b (8-bit unsigned char)
-<LI> s (16-bit short int)
-<LI> u (16-bit unsigned short int)
-<LI> i (32-bit int)
-<LI> r,f (32-bit float)
-<LI> d (64-bit float)
-</UL>
-
-<P>
-The dim1 specification is required, but dim2 is optional and defaults
-to dim1. The skip specification is optional and defaults to 0. The
-optional endian specification can be 'l' or 'b' and defaults to the
-endian type for the current machine.
-
-<P>
-If no array specification is included within the ARRAY() operator,
-then the array specification is taken from the <B>ARRAY</B> environment
-variable. For example:
-
-<PRE>
- foo.arr[ARRAY(r512)] # bitpix=-32 dim1=512 dim2=512
- foo.arr[ARRAY(r512.400)] # bitpix=-32 dim1=512 dim2=400
- foo.arr[ARRAY(r512.400]) # bitpix=-32 dim1=512 dim2=400
- foo.arr[ARRAY(r512.400:2880)] # bitpix=-32 dim1=512 dim2=400 skip=2880
- foo.arr[ARRAY(r512l)] # bitpix=-32 dim1=512 dim2=512 endian=little
- setenv ARRAY "r512.400:2880"
- foo.arr[ARRAY()] # bitpix=-32 dim1=512 dim2=400 skip=2880
-</PRE>
-
-<H2><A NAME="sections">Specifying Image Sections</A></H2>
-
-Once a data file (and possibly, a FITS extension) has been specified,
-the next (optional) part of a bracket specification can be used to
-select image <B>section</B> information, i.e., to specify the x,y
-limits of an image section, as well as the blocking factor to apply to
-that section. This information can be added to any file specification but
-only is used by Funtools image processing routines.
-
-<P>
-The format of the image section specification is one of the following:
-<UL>
-<LI> file[xy0:xy1,block]
-<LI> file[x0:x1,y0:y1,block]
-<LI> file[x0:x1,*,block]
-<LI> file[*,y0:y1,block]
-<LI> file[*,block]
-</UL>
-where the limit values can be ints or "*" for default. A single "*"
-can be used instead of val:val, as shown. Note that blocking is
-applied to the section after it is extracted.
-
-<P>
-In addition to image sections specified by the lo and hi x,y limits, image
-sections using center positions can be specified:
-<UL>
-<LI> file[dim1@xcen,dim2@ycen]
-<LI> file[xdim2@xcen@ycen]
-<LI> file[dim1@xcen,dim2@ycen,block]
-<LI> file[dim@xcen@ycen,block]
-</UL>
-Note that the (float) values for dim, dim1, dim2, xcen, ycen must be
-specified or else the expression does not make sense!
-
-<P>
-In all cases, block is optional and defaults to 1. An 's' or 'a' can
-be appended to signify "sum" or "average" blocking (default is "sum").
-Section specifications are given in image coordinates by default. If you
-wish to specify physical coordinates, add a 'p' as the last character
-of the section specification, before the closing bracket.
-For example:
-<PRE>
-<UL>
-<LI> file[-8:-7,-8:-7p]
-<LI> file[-8:-7,-8:-7,2p]
-</UL>
-</PRE>
-A section can be specified in any Funtools file name. If the operation
-to be applied to that file is an imaging operation, then the
-specification will be utilized. If the operation is purely a table
-operation, then the section specification is ignored.
-
-<P>
-Do not be confused by:
-<PRE>
- foo.fits[2]
- foo.fits[*,2]
-</PRE>
-The former specifies opening the second extension of the FITS file.
-The latter specifies application of block 2 to the image section.
-
-<P>
-Note that the section specification must come after
-any of FITS <B>ext</B> name or <B>ind</B> number,
-but all sensible defaults are supported:
-<UL>
-<LI> file[ext]
-<LI> file[ext,index]
-<LI> file[index]
-<LI> file[ext,section]
-<LI> file[ext,index,section]
-<LI> file[index,section]
-<LI> file[section]
-</UL>
-
-<H2><A NAME="binning">Binning FITS Binary Tables and Non-FITS Event Files</H2>
-
-If a FITS binary table or a non-FITS raw event file is to be binned
-into a 2D image (e.g., using the
-<A HREF="./programs.html#funimage">funimage</A>
-program), it is necessary to specify the two columns to be used for the
-binning, as well as the dimensions of the image. Funtools first looks
-for a specifier of the form:
-<PRE>
- bincols=([xnam[:tlmin[:tlmax:[binsiz]]]],[ynam[:tlmin[:tlmax[:binsiz]]]])
-</PRE>
-in bracket syntax, and uses the column names thus specified. The tlmin, tlmax,
-and binsiz specifiers determine the image binning dimensions using:
-<PRE>
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-</PRE>
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters are present in the FITS binary
-table header, respectively. If only one parameter is specified, it is
-assumed to be tlmax, and tlmin defaults to 1. If two parameters are
-specified, they are assumed to be tlmin and tlmax.
-
-For example, to bin an HRC event list columns "VPOS" and "UPOS", use:
-<PRE>
- hrc.nepr[bincols=(VPOS,UPOS)]
-</PRE>
-or
-<PRE>
- hrc.nepr[bincols=(VPOS:49152,UPOS:4096)]
-</PRE>
-Note that you can optionally specify the dimensions of these columns
-to cover cases where neither TLMAX keywords are defined in
-the header. If either dimension is specified, then both must be specified.
-
-<P>
-You can set the FITS_BINCOLS or EVENTS_BINCOLS environment variable as
-an alternative to adding the "bincols=" specifier to each file name
-for FITS binary tables and raw event files, respectively. If no
-binning keywords or environment variables are specified, or if the
-specified columns are not in the binary table, the Chandra parameters
-CPREF (or PREFX) are searched for in the FITS binary table header.
-Failing this, columns named "X" and "Y" are sought. If these are not
-found, the code looks for columns containing the characters "X" and
-"Y". Thus, you can bin on "DETX" and "DETX" columns without
-specifying them, if these are the only column names containing the "X"
-and "Y" characters.
-
-<p>
-Ordinarily, each event or row contributes one count to an image pixel
-during the 2D binning process. Thus, if five events all have the same
-(x,y) position, the image pixel value for that position will have a
-value of five. It is possible to specify a variable contribution
-for each event by using the vcol=[colname] filter spec:
-<PRE>
- vcol=[colname]
-</PRE>
-The vcol colname is a column containing a numeric value in each event row
-that will be used as the contribution of the given event to its image
-pixel. For example, consider an event file that has the following content:
-<PRE>
- x:e:4 y:e:4 v:e
- ------ ------ ----
- 1 1 1.0
- 2 2 2.0
- 3 3 3.0
- 4 4 0.0
- 1 1 1.0
- 2 2 2.0
- 3 3 3.0
- 4 4 4.0
-</PRE>
-There are two events with x,y value of (1,1) so ordinarily a 2D image will
-have a value of 2 in the (1,1) pixel. If the v column is specified as the
-value column:
-<PRE>
- foo.fits'[vcol=v]'
-</PRE>
-then each pixel will contain the additive sum of the associated (x,y)
-column values from the v column. For example, image pixel (1,1) will
-contain 1. + 1. = 2, image pixel (2,2) will contain (2 + 2) = 4, etc.
-
-<p>
-An important variation on the use of a value column to specify the
-contribution an event makes to an image pixel is when the value column
-contains the reciprocal of the event contribution. For this case, the
-column name should be prefixed with a / (divide sign) thus:
-<PRE>
- foo.fits'[vcol=/v]'
-</PRE>
-Each image pixel value will then be the sum of the reciprocals of the value
-column. A zero in the value column results in NaN (not a number).
-Thus, in the above example, image pixel (1.1) will contain 1/1 + 1/1 = 2,
-image pixel (2,2) will contain (1/2 + 1/2) = 1, etc. Image pixel (4,4)
-will contain (1/0 + 1/4) = NaN.
-
-<p>
-You can set the FITS_VCOL or EVENTS_VCOL environment variable as
-an alternative to adding the "vcol=" specifier to each file name
-for FITS binary tables and raw event files, respectively.
-
-<P>
-Finally, when binning events, the data type of the resulting 2D image
-must be specified. This can be done with the "bitpix=[n]" keyword in
-the bracket specification. For example:
-<PRE>
- events.fits[bincols=(VPOS,UPOS),bitpix=-32]
-</PRE>
-will create a floating point image binned on columns VPOS and UPOS.
-If no bitpix keyword is specified, bitpix=32 is assumed. As with
-bincols values, you also can use the FITS_BITPIX and EVENTS_BITPIX
-environment variables to set this value for FITS binary tables and
-raw event files, respectively.
-
-<P>
-The <b>funimage</b> program also allows you to create a 1D image projection
-along any column of a table by using the <b>bincols=[column]</b>
-filter specification and specifying a single column.
-For example, the following command projects a 1D image along
-the chipx column of a table:
-<PRE>
- funimage ev.fits'[bincols=chipx]' im.fits
-</PRE>
-See <A HREF="./programs.html#funimage">funimage</A> for more
-information about creating 1D and 2D images.
-
-<P>
-Finally, please note that Funtools supports most FITS standards.
-We will add missing support as required by the community. In general,
-however, we do not support non-standard extensions. For example, we
-sense the presence of the binary table 'variable length array'
-proposed extension and we pass it along when copying and filtering
-files, but we do not process it. We will add support for new standards
-as they become official.
-
-<H2><A NAME="filters">Table and Spatial Region Filters</H2>
-<P>
-Note that, in addition extensions and image sections, Funtools bracket
-notation can be used to specify table and spatial region filters. These
-filters are always placed after the image section information. They
-can be specified in the same bracket or in a separate bracket
-immediately following:
-<UL>
-<LI> file[ext|ind|ARRAY()|EVENTS(),section][filters]
-<LI> file[ext|ind|ARRAY()|EVENTS(),section,filters]
-</UL>
-where:
-<UL>
-<LI> <B>file</B> is the Funtools file name
-<LI> <B>ARRAY()</B> is an array specification
-<LI> <B>EVENTS()</B> is an event list specification
-<LI> <B>ext</B> is the FITS extension name
-<LI> <B>ind</B> is the FITS extension number
-<LI> <B>section</B> is the image section to extract
-<LI> <B>filters</B> are spatial region and table (row) filters to apply
-</UL>
-
-The topics of table and region filtering are covered in detail in:
-<UL>
-<LI><A HREF="./filters.html">Table Filtering</A>
-<LI><A HREF="./regions.html">Spatial Region Filtering</A>
-</UL>
-
-<H2><A NAME="types">Disk Files and Other Supported File Types</A></H2>
-<P>
-The specified <B>file</B> usually is an ordinary disk file. In
-addition, gzip'ed files are supported in Funtools: gzip'ed input files
-are automatically uncompressed as they are read, and gzip'ed output
-files are compressed as they are written. NB: if a FITS binary table
-is written in gzip format, the number of rows in the table will be set
-to -1. Such a file will work with Funtools programs but will not work
-with other FITS programs such as ds9.
-
-<P>
-The special keywords "stdin" and "stdout" designate Unix standard
-input and standard output, respectively. The string "-" (hyphen) will
-be taken to mean "stdin" if the file is opened for reading and
-"stdout" if the file is opened for writing.
-
-<P>
-A file also can be an INET socket on the same or another machine using
-the syntax:
-<PRE>
- machine:port
-</PRE>
-Thus, for example:
-<PRE>
- karapet:1428
-</PRE>
-specifies that I/O should be performed to/from port 1428 on the
-machine karapet. If no machine name is specified, the default is to
-use the current machine:
-<PRE>
- :1428
-</PRE>
-This means to open port 1428 on the current machine. Socket support
-allows you to generate a distributed pipe:
-<PRE>
- on karapet: funtask1 in.fits bynars:1428
- on bynars: funtask2 :1428 out.fits
-</PRE>
-The socket mechanism thus supports simple parallel processing using
-<B>process decomposition</B>. Note that parallel processing using
-<B>data decomposition</B> is supported via the <B>section</B> specifier (see
-below), and the <B>row#</B> specifier, which is part of
-<A HREF="./filters.html">Table Filtering</A>.
-
-<P>
-A file also can be a pointer to shared memory using the syntax:
-<PRE>
- shm:[id|@key][:size]
-</PRE>
-A shared memory segment is specified with a <B>shm:</B> prefix,
-followed by either the shared memory id or the shared memory key
-(where the latter is prefixed by the '@' character). The size (in
-bytes) of the shared memory segment can then be appended (preceded by
-the ':' character). If the size specification is absent, the code will
-attempt to determine the length automatically.
-
-If the open mode contains the string "w+", then the memory segment will be
-created if it does not exist. (It also will be released and deleted when the
-file is closed.) In the case where a memory segment is being created, the
-length of the segment is required.
-
-<P>
-A file also can be Unix piped command (i.e. a program to run) using the syntax:
-<PRE>
- "pipe: command arg1 ... argn"
-</PRE>
-The output from the command must be a valid FITS file. It is important
-to use quotes to protect spaces so that command arguments are passed
-correctly. A silly example is:
-<PRE>
- fundisp "pipe: funtable 'foo.fits[cir 512 512 .1]' stdout"
-</PRE>
-This seemed like a good idea at the time ...
-
-<H2><A NAME="types">Lists of Files</A></H2>
-
-<P>
-Funtools also will process a list of files as a single file using the
-syntax:
-<PRE>
- "list: file1 file2 ... filen"
-</PRE>
-The files in the list are separated by whitespace. Any of the
-above file types can be used. For example, if two files, foo1.fits and
-foo2.fits, are part of the same observation, they can be processed as
-a single file (using their own filters):
-<PRE>
- fundisp "list: foo1.fits[cir(512,512,10)] foo2.fits[cir(511,511,10)]"
- X Y PHA PI TIME DX DY
- -------- -------- -------- -------- --------------------- -------- --------
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
- 511 511 5 5 79488631.09462625 580 575
- 511 511 10 11 79488780.60006675 580 573
- 511 511 4 4 79494562.35474326 580 575
- 511 511 6 6 79488203.01561825 580 575
- 511 511 6 6 79488017.99730176 580 575
- 511 511 4 4 79494332.45355175 580 575
- 511 511 9 10 79492685.94014275 581 574
- 511 511 5 5 79487708.71298325 580 575
- 511 511 8 9 79493719.00160225 581 573
-</PRE>
-Again, note that it is important to avoid spaces in the filters
-because the list separator also is whitespace. To protect whitespace
-in a filter, enclose the file specification in quotes:
-<PRE>
- fundisp "list: 'foo1.fits[cir 512 512 .1]' foo2.fits[cir(511,511,.1)]"
-</PRE>
-
-<!-- =section funfiles SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: February 15, 2006</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/filters.html b/funtools/doc/filters.html
deleted file mode 100644
index bd78fea..0000000
--- a/funtools/doc/filters.html
+++ /dev/null
@@ -1,325 +0,0 @@
-<!-- =defdoc funfilters funfilters n -->
-<HTML>
-<HEAD>
-<TITLE>Table Filtering</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funfilters NAME -->
-<H2><A NAME="funfilters">Funfilters: Filtering Rows in a Table</A></H2>
-
-<!-- =section funfilters SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document contains a summary of the user interface for
-filtering rows in binary tables.
-
-<!-- =section funfilters DESCRIPTION -->
-<H2>Description</H2>
-<P>
-Table filtering allows a program to select rows from an table (e.g.,
-X-ray event list) by checking each row against one or more expressions
-involving the columns in the table. When a table is filtered, only
-valid rows satisfying these expressions are passed through for processing.
-
-<P>
-A filter expression is specified using bracket notation appended to
-the filename of the data being processed:
-<PRE>
- foo.fits[pha==1&&pi==2]
-</PRE>
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-<PRE>
- foo.fits[@my.reg]
-</PRE>
-Filters must be placed after the extension and image section
-information, when such information is present. The correct order is:
-<UL>
-<LI> file[fileinfo,sectioninfo][filters]
-<LI> file[fileinfo,sectioninfo,filters]
-</UL>
-where:
-<UL>
-<LI> <B>file</B> is the Funtools file name
-<LI> <B>fileinfo</B> is an ARRAY, EVENT, FITS extension, or FITS index
-<LI> <B>sectioninfo</B> is the image section to extract
-<LI> <B>filters</B> are spatial region and table (row) filters to apply
-</UL>
-See <A HREF="./files.html">Funtools Files</A> for more information
-on file and image section specifications.
-
-<H2>Filter Expressions</H2>
-
-<P>
-Table filtering can be performed on columns of data in a FITS
-binary table or a raw event file. Table filtering is accomplished by
-means of <B>table filter specifications</B>. An table filter
-specification consists of one or more <B>filter expressions</B> Filter
-specifications also can contain comments and local/global processing
-directives.
-
-<P>
-More specifically, a filter specification consist of one or more lines
-containing:
-<PRE>
- # comment until end of line
- # include the following file in the table descriptor
- @file
- # each row expression can contain filters separated by operators
- [filter_expression] BOOLOP [filter_expression2], ...
- # each row expression can contain filters separated by the comma operator
- [filter_expression1], [filter_expression2], ...
- # the special row# keyword allows a range of rows to be processed
- row#=m:n
- # or a single row
- row#=m
- # regions are supported -- but are described elsewhere
- [spatial_region_expression]
-</PRE>
-
-<P>
-A single filter expression consists of an arithmetic, logical, or
-other operations involving one or more column values from a
-table. Columns can be compared to other columns, to header values,
-or to numeric constants. Standard math functions can be applied to
-columns. Separate filter expressions can be combined using boolean operators.
-Standard C semantics can be used when constructing expressions, with
-the usual precedence and associativity rules holding sway:
-<PRE>
- Operator Associativity
- -------- -------------
- () left to right
- !! (logical not) right to left
- ! (bitwise not) - (unary minus) right to left
- * / left to right
- + - left to right
- &lt; &lt;= &gt; &gt;= left to right
- == != left to right
- & (bitwise and) left to right
- ^ (bitwise exclusive or) left to right
- | (bitwise inclusive or) left to right
- && (logical and) left to right
- || (logical or) left to right
- = right to left
-</PRE>
-For example, if energy and pha are columns in a table,
-then the following are valid expressions:
-<PRE>
- pha>1
- energy == pha
- (pha>1) && (energy<=2)
- max(pha,energy)>=2.5
-</PRE>
-
-<P>
-Comparison values can be integers or floats. Integer comparison values can be
-specified in decimal, octal (using '0' as prefix), hex (using '0x' as prefix)
-or binary (using '0b' as prefix). Thus, the following all specify the same
-comparison test of a status mask:
-<PRE>
- (status & 15) == 8 # decimal
- (status & 017) == 010 # octal
- (status & 0xf) == 0x8 # hex
- (status & 0b1111) == 0b1000 # binary
-</PRE>
-<P>
-The special keyword row# allows you to process a range of rows.
-When row# is specified, the filter code skips to the designated
-row and only processes the specified number of rows. The
-"*" character can be utilized as the high limit value to denote
-processing of the remaining rows. Thus:
-<PRE>
- row#=100:109
-</PRE>
-processes 10 rows, starting with row 100 (counting from 1),
-while:
-<PRE>
- row#=100:*
-</PRE>
-specifies that all but the first 99 rows are to be processed.
-
-<P>
-Spatial region filtering allows a program to select regions of an
-image or rows of a table (e.g., X-ray events) using simple geometric
-shapes and boolean combinations of shapes. For a complete description
-of regions, see <A HREF="./regions.html">Spatial Region Filtering</A>.
-
-<H2><A NAME="separators">Separators Also Are Operators</A></H2>
-<P>
-As mentioned previously, multiple filter expressions can be specified
-in a filter descriptor, separated by commas or new-lines.
-When such a comma or new-line separator is used, the boolean AND operator
-is automatically generated in its place. Thus and expression such as:
-<PRE>
- pha==1,pi=2:4
-</PRE>
-is equivalent to:
-<PRE>
- (pha==1) && (pi>=2&&pi<=4)
-</PRE>
-<P>
-[Note that the behavior of separators is different for filter expressions
-and spatial region expressions. The former uses AND as the operator, while
-the latter user OR. See
-<A HREF="./combo.html">Combining Region and Table Filters</A>
-for more information about these conventions and how they are treated
-when combined.]
-
-<H2><A NAME="range">Range Lists</A></H2><P>
-<P>
-Aside from the standard C syntax, filter expressions can make use of
-IRAF-style <B>range lists</B> which specify a range of values. The
-syntax requires that the column name be followed by an '=' sign, which
-is followed by one or more comma-delimited range expressions of the form:
-<PRE>
- col = vv # col == vv in range
- col = :vv # col <= vv in range
- col = vv: # col >= vv in range
- col = vv1:vv2 # vv1 <= col <= vv2 in range
-</PRE>
-The vv's above must be numeric constants; the right hand side of a
-range list cannot contain a column name or header value.
-<P>
-Note that, unlike an ordinary comma separator, the comma separator used
-between two or more range expressions denotes OR. Thus, when two or
-more range expressions are combined with a comma separator, the resulting
-expression is a shortcut for more complicated boolean logic. For example:
-<PRE>
- col = :3,6:8,10:
-</PRE>
-is equivalent to:
-<PRE>
- (col<=3) || (col>=6 && col <=8) || (col >=10)
-</PRE>
-Note also that the single-valued rangelist:
-<PRE>
- col = val
-</PRE>
-is equivalent to the C-based filter expression:
-<PRE>
- col == val
-</PRE>
-assuming, of course, that val is a numeric constant.
-
-<H2><A NAME="math">Math Operations and Functions</A></H2><P>
-<P>
-It is permissible to specify C math functions as part of the filter syntax.
-When the filter parser recognizes a function call, it automatically
-includes the math.h and links in the C math library. Thus, it is
-possible to filter rows by expressions such as these:
-<UL>
-<LI>(pi+pha)>(2+log(pi)-pha)
-<LI> min(pi,pha)*14>x
-<LI> max(pi,pha)==(pi+1)
-<LI> feq(pi,pha)
-<LI> div(pi,pha)>0
-</UL>
-The function feq(a,b) returns true (1) if the difference between a and b
-(taken as double precision values) is less than approximately 10E-15.
-The function div(a,b) divides a by b, but returns NaN (not a number)
-if b is 0. It is a safe way to avoid floating point errors when
-dividing one column by another.
-
-<H2><A NAME="include">Include Files</A></H2><P>
-<P>
-The special <B>@filename</B> directive specifies an include file
-containing filter expressions. This file is processed as part of
-the overall filter descriptor:
-<PRE>
- foo.fits[pha==1,@foo]
-</PRE>
-
-<H2><A NAME="header">Header Parameters</A></H2><P>
-<P>
-The filter syntax supports comparison between a column value and a
-header parameter value of a FITS binary tables (raw event files have no
-such header). The header parameters can be taken from the binary
-table header or the primary header. For example, assuming there is a
-header value MEAN_PHA in one of these headers, you can select photons
-having exactly this value using:
-
-<UL>
-<LI> pha==MEAN_PHA
-</UL>
-
-<H2>Examples</H2>
-<P>
-Table filtering is more easily described by means of examples.
-Consider data containing the following table structure:
-<UL>
-<LI> double TIME
-<LI> int X
-<LI> int Y
-<LI> short PI
-<LI> short PHA
-<LI> int DX
-<LI> int DY
-</UL>
-
-<P>
-Tables can be filtered on these columns using IRAF/QPOE range syntax or
-any valid C syntax. The following examples illustrate the possibilities:
-<DL>
-
-<P>
-<DT> pha=10
-<DT> pha==10
-<DD> select rows whose pha value is exactly 10
-
-<P>
-<DT> pha=10:50
-<DD> select rows whose pha value is in the range of 10 to 50
-
-<P>
-<DT> pha=10:50,100
-<DD> select rows whose pha value is in the range of 10 to 50 or is
-equal to 100
-
-<P>
-<DT> pha>=10 && pha<=50
-<DD> select rows whose pha value is in the range of 10 to 50
-
-<P>
-<DT> pi=1,2&&pha>3
-<DD> select rows whose pha value is 1 or 2 and whose pi value is 3
-
-<P>
-<DT> pi=1,2 || pha>3
-<DD> select rows whose pha value is 1 or 2 or whose pi value is 3
-
-<P>
-<DT> pha==pi+1
-<DD> select rows whose pha value is 1 less than the pi value
-
-<P>
-<DT> (pha==pi+1) && (time>50000.0)
-<DD> select rows whose pha value is 1 less than the pi value
-and whose time value is greater than 50000
-
-<P>
-<DT>(pi+pha)>20
-<DD> select rows in which the sum of the pi and pha values is greater
-than 20
-
-<P>
-<DT> pi%2==1
-<DD> select rows in which the pi value is odd
-</DL>
-
-<P>
-Currently, integer range list limits cannot be specified in binary
-notation (use decimal, hex, or octal instead). Please contact us if
-this is a problem.
-
-<!-- =section funfilters SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 17, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/funcalc.sed b/funtools/doc/funcalc.sed
deleted file mode 100644
index d865a5d..0000000
--- a/funtools/doc/funcalc.sed
+++ /dev/null
@@ -1,9 +0,0 @@
-# cc <foo.c> 2>&1 | sed -n -f funauto.sed
-# Linux gcc (and others)
-s/.*`\([^)]*\)' undeclared (first use in this function).*/\1/p
-# Solaris cc
-s/.*undefined symbol: \([^)]*\)/\1/p
-# Dec Alpha/OSF cc
-s/.*In this statement, "\([^)]*\)" is not declared.*/\1/p
-# SGI cc
-s/.*The identifier "\([^)]*\)" is undefined.*/\1/p
diff --git a/funtools/doc/funtools.ds9 b/funtools/doc/funtools.ds9
deleted file mode 100644
index f445a36..0000000
--- a/funtools/doc/funtools.ds9
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Analysis command descriptions:
-# menu label/description
-# file templates for this command (* for all files)
-# "menu" (add to menu) |"bind" (bind to key)
-# analysis command line
-#
-
-hmenu Funtools
-
-# 1D histogram params for a table
-param thist
-column entry "Enter column name to histogram" pi "(histo)"
-bins entry "Enter [min:max:]bins" 0 "('0' for default number of bins)"
-norm checkbox "Normalize by binsize?" 0
-end
-
-# 1D histogram params for an image
-param ihist
-bins entry "Enter [min:max:]bins" 0 "('0' for default number of bins)"
-end
-
-# Light Curve params
-param ltc
-bins entry "Enter [min:max:]bins" 0 "('0' for default number of bins)"
-norm checkbox "Normalize by time?" 0
-end
-
-Funtools Overview
-*
-menu
-echo "Funtools Tasks in DS9\r\rThe tasks in this section of the Analysis menu utilize the Funtools programs\r'funcnts' and 'funhist'. With the exceptions noted below, they all work off the \roriginal disk-based FITS file. The funcnts-based tasks (radial profile, counts\rin regions) present their results using WCS units, if the appropriate info is\rpresent in the FITS header. \r\rFor situations where a disk file is not available (e.g., image data generated\rby a program and sent to DS9's 'fits' XPA access point), alternate versions of\rthe radial profile and counts in regions tasks are offered that work from DS9's\rinternal image data. In these two cases, results are presented in pixels. Aside\rfrom the units, the results should be identical to the file-based results.\r\rFor more sophisticated analysis, please consider using the underlying Funtools\rtasks directly. These are documented at:\r\r http://hea-www.harvard.edu/RD/funtools/programs.html\r\r" | $text
-
-Radial Profile Plot (annulus regions; options: none)
-*
-menu
-funds9 funcnts_plot "$xpa" "$filename" "$regions(source,,)" "$regions(background,,)" | $plot(stdin)
-
-Histogram Plot (any column; options: column name, number of bins)
-*
-menu
-$param(thist); funds9 funhist_plot "$xpa" "$filename[$regions]" "$norm" "$column" "$bins" | $plot(stdin)
-
-Light Curve Plot ("time" column; options: number of bins)
-*
-menu
-$param(ltc); funds9 funhist_plot "$xpa" "$filename[$regions]" "$norm" time "$bins" | $plot(stdin)
-
-Energy Spectrum Plot ("pi" column; options: none)
-*
-menu
-funds9 funhist_plot "$xpa" "$filename[$regions]" "0" "pi" "$bins" | $plot(stdin)
-
-Counts in Regions (any regions; options: none)
-*
-menu
-funds9 funcnts "$xpa" "$filename" "$regions(source,,)" "$regions(background,,)" | $text
-
-Column Histogram (any column; options: colname, <min:max:>bins)
-*
-menu
-$param(thist); funds9 funhist "$xpa" "$filename[$regions]" "$norm" "$column" "$bins" | $text
-
-Image Histogram (options: <min:max:>bins)
-*
-menu
-$param(ihist); $data | funhist "stdin[$regions]" xy "$bins" | $text
-
----
-
-Radial Profile Plot in Pixels using DS9's Internal Image Data (annulus regions)
-*
-menu
-$data | funcnts -rpG stdin $regions(source,,) $regions(background,,) | funcnts.plot -file "$filename" ds9 | $plot(stdin)
-
-Counts in Regions in Pixels using DS9's Internal Image Data (any regions)
-*
-menu
-$data | funcnts -rp stdin $regions(source,,) $regions(background,,) | $text
-
----
-
-end
diff --git a/funtools/doc/funtools.pdf b/funtools/doc/funtools.pdf
deleted file mode 100644
index 56575ac..0000000
--- a/funtools/doc/funtools.pdf
+++ /dev/null
Binary files differ
diff --git a/funtools/doc/funtools.ps b/funtools/doc/funtools.ps
deleted file mode 100644
index 210149e..0000000
--- a/funtools/doc/funtools.ps
+++ /dev/null
@@ -1,11446 +0,0 @@
-%!PS
-%%Title: The Funtools Help Facility
-%%Creator: html2ps version 1.0 beta5
-%%EndComments
-save
-2000 dict begin
-/d {bind def} bind def
-/D {def} d
-/t true D
-/f false D
-/FL [/Times-Roman
-/Times-Italic
-/Times-Bold
-/Times-BoldItalic
-/Courier
-/Courier-Oblique
-/Courier-Bold
-/Courier-BoldOblique
-/Helvetica
-/Helvetica-Oblique
-/Helvetica-Bold
-/Helvetica-BoldOblique] D
-/WF t D
-/WI 0 D
-/F 1 D
-/IW 471 F div D
-/IL 621 F div D
-/PS 791 D
-/EF [0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 2 2] D
-/EZ [11 9 19 17 15 13 12 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 8 8] D
-/Ey [0 0 2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] D
-/EG [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1] D
-/Tm [1 1 0.8 0.8 0.8 0.8 0.8 0.8 0 0 0 0 0 0 0.5 1 1 1 1 0 0 1.3 0 0] D
-/Bm [1 1 0.5 0.5 0.5 0.5 0.5 0.5 0 0 0 0 0 0 0.5 1 1 1 1 0 0 1 0 0] D
-/Lm [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 2 0 0 2 0 0 0] D
-/Rm [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0] D
-/EU [-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0] D
-/NO t D
-/YY [[{()}1][{()}0][{()}2]] D
-/ZZ [[{()}1][{()}0][{()}2]] D
-/Ts EZ 0 get D
-/TU f D
-/Xp t D
-/AU t D
-/SN 0 D
-/Cf f D
-/Tp f D
-/Fe f D
-/TI 1 Ts mul D
-/Fm 14 D
-/xL 71 D
-/xR 71 D
-/yL 706 D
-/yR 706 D
-/Wl 471 F div D
-/Wr 471 F div D
-/hL 621 F div D
-/hR 621 F div D
-/FE {newpath Fm neg Fm M CP BB IW Fm add Fm L IW Fm add IL Fm add neg L CP BB
- Fm neg IL Fm add neg L closepath} D
-/LA {PM 0 eq{/IW Wl D /IL hL D}{/IW Wr D /IL hR D}ie /W IW D /LL W D /LS W D
- TU PM 0 eq and{IW 56 F div add SA{Sf div}if 0 translate}
- {PM 0 eq{xL yL}{xR yR}ie translate F SA{Sf mul}if dup scale
- CS CF FS Cf{CA CL get VC}if /Bb f D}ie 0 0 M
- TF not Tc or {Cf{gsave SA{1 Sf div dup scale}if Cb VC FE fill grestore}if}if}D
-/Pi 0 Ts mul D
-/SG [0.8 1 1] D
-/Ab 15 D
-/J 0 D
-/Tc t D
-/NH 6 D
-/Nf f D
-/Pa f D
-/LH 1.2 D
-/XR f D
-/Xr {/pN E D ( [p ) WB pN WB (] )WB} D
-/Db [16#FF 16#FF 16#FF] D
-/Dt [16#00 16#00 16#00] D
-/eA f D
-/Fi f D
-/bT f D
-/Lc t D
-/Dl [16#00 16#00 16#00] D
-/LX f D
-/Br 0.25 D
-/IA ([IMAGE]) D
-/DS {/PF f D()WB NL NP()pop RC ZF} D
-/Gb f D
-/Mb t D
-/Hc [16#00 16#00 16#00] D
-/Bl 3 D
-/MI -15.2 D
-/DX (DRAFT) D
-/Di 0 D
-/Tt 113.385826771654 D
-/Th {()2 Al()BR (
- ) 0 1 -1 H()4 FZ Ti ES()EH (
- ) 0 2 -1 H() ME 0 get join EH()Ea()BR()} D
-/tH {()0 1 -1 H (Table of Contents) EH()} D
-/FD 2 D
-/Dy 2 D
-/cD [16#F0 16#F0 16#F0] D
-/FW 0.6 D
-/FU [16#00 16#00 16#00] D
-/ET {/RM f D /A0 0 D /PN SN D /OU t D /Ou t D /W IW D /LL W D D1
- Ms not TP and{Ip}if /TF f D} D
-[{true statusdict/setduplexmode get exec} stopped cleartomark
-%-- End of variable part --
-/MySymbol 10 dict dup begin
- /FontType 3 D /FontMatrix [.001 0 0 .001 0 0 ] D /FontBBox [25 -10 600 600] D
- /Encoding 256 array D 0 1 255{Encoding exch /.notdef put}for
- Encoding (e) 0 get /euro put
- /Metrics 2 dict D Metrics begin
- /.notdef 0 D
- /euro 651 D
- end
- /BBox 2 dict D BBox begin
- /.notdef [0 0 0 0] D
- /euro [25 -10 600 600] D
- end
- /CharacterDefs 2 dict D CharacterDefs begin
- /.notdef {} D
- /euro{newpath 114 600 moveto 631 600 lineto 464 200 lineto 573 200 lineto
- 573 0 lineto -94 0 lineto 31 300 lineto -10 300 lineto closepath clip
- 50 setlinewidth newpath 656 300 moveto 381 300 275 0 360 arc stroke
- -19 350 moveto 600 0 rlineto -19 250 moveto 600 0 rlineto stroke}d
- end
- /BuildChar{0 begin
- /char E D /fontdict E D /charname fontdict /Encoding get char get D
- fontdict begin
- Metrics charname get 0 BBox charname get aload pop setcachedevice
- CharacterDefs charname get exec
- end
- end}D
- /BuildChar load 0 3 dict put /UniqueID 1 D
-end
-definefont pop
-
-/Cd {aload length 2 idiv dup dict begin {D} repeat currentdict end} D
-/EX {EC cvx exec} D
-/DU {} d
-/BB {pop pop}d
-/ie {ifelse} d
-/E {exch} d
-/M {moveto} d
-/R {rmoveto} d
-/L {lineto} d
-/RL {rlineto} d
-/CP {currentpoint} d
-/SW {stringwidth} d
-/GI {getinterval} d
-/PI {putinterval} d
-/Sg {setgray} d
-/LW {setlinewidth} d
-/S {dup () ne OU and{0 Co R AT 3 eq LB and HF not and A1 0 ne A2 0 ne or and
- {A2 0 32 A1 0 6 -1 roll awidthshow}{show}ie 0 Co neg R}{pop}ie
- OU PH 3 eq or{/Ms t D}if} D
-/U {OU{gsave CP currentfont /FontInfo get /UnderlinePosition get
- 0 E currentfont /FontMatrix get dtransform E pop add newpath M dup SW pop
- CJ 0 RL stroke grestore}if} D
-/B {OU Br 0 gt and{CP Ts neg Ts .33 mul R gsave 0 Sg
- CP newpath Ts Br mul 0 360 arc closepath UI 2 mod 0 eq{stroke}{fill}ie
- grestore M CP E Ts Br 1 add mul sub E BB /Ms t D}if}D
-/NP {Ms TP not or PA and OU and{TP{OR}if f1{mF k2 /mF E D /YC 0 D}if
- TP TU not PM 0 eq or and{showpage}if DU Ip TE not{LA}if 0.6 LW
- /CI 0 D /TP t D /Hs f D /hl 6 D /Hv 6 D /HI hi D /Ms f D}if Bs XO BO M} D
-/Np {LE sub CP E pop gt PL 0 eq and{NP}if}D
-/Ip {/PN PN 1 add D /Pn RM{1}{4}ie PN Ns D /PM PN SN sub 2 mod D} D
-/GP {E dup 3 -1 roll get PN 1 add 2 mod get dup type /integertype eq
- {get 0 get}{E pop}ie}d
-/Fc {dup 2 GP exec SW pop /S1 E D dup 1 GP exec SW pop /S2 E D 0 GP exec SW
- pop /S3 E D S1 0 gt{S2 2 mul S1 add S3 2 mul S1 add 2 copy lt{E}if pop}{0}ie
- S2 S3 add 2 copy lt{E}if pop IW .9 mul div dup 1 gt{1 E div}{pop 1}ie}D
-/OR {Df{Sd}if tp not{gsave SA{1 Sf div dup scale}if Fe{Cf{FU VC}if FW LW
- 1 setlinejoin FE stroke}if /YO {60 F div dup 40 gt{pop 40}if}D /cs CS D
- /cf CF D /CF 0 D /pf PF D /PF f D /Fn FN D /At AT D /AT 0 D /FN EF Hf 1 add
- get D Fz Fs FS ZZ Fc Fz mul Fs FS EU Hf 1 add get dup type /arraytype eq
- Cf and{VC}{pop 0 Sg}ie IW IL neg YO sub M ZZ 1 GP exec dup SW pop neg 0 R Sh
- 0 IL neg YO sub M ZZ 0 GP exec Sh ZZ 2 GP exec dup SW pop IW E sub 2 div
- IL neg YO sub M Sh Fz Fs FS NO{/AW IW Pn SW pop sub D AW 2 div IL neg YO sub
- S1 0 gt S2 AW .45 mul gt or S3 AW .45 mul gt or{Fz 2 mul sub}if M Pn Sh}if
- EU Hf get dup type /arraytype eq Cf and{VC}{pop 0 Sg}ie YY Fc /FN EF Hf get D
- Hz mul HS FS IW YO M YY 1 GP exec dup SW pop neg 0 R Sh 0 YO M YY 0 GP exec Sh
- YY 2 GP exec dup SW pop IW E sub 2 div YO M Sh /FN Fn D /AT At D t Pb XO SZ
- SL get neg R /PF pf D grestore /CF 0 D cs cf FS}if}D
-/Sh {dup () ne{CP Hz 4 div sub BB show CP CS add BB}{pop}ie}D
-/Pb {/OU E D /Ou OU D /PB t D 0 0 M Ba{/Sa save D /BP t D /Fl t D RC /PL 0 D
- /PH 0 D /W IW D /LE IL .7 mul D /EO 0 D SI ZF /YA 0 D /BO 0 D /C1 () D
- BA 0 Ts neg R Bb{Xl Yl Xh Yh}if Bb CP Sa restore M
- {/Yh E D /Xh E D /Yl E D /Xl E D}if /Fl t D}if
- BL /OU t D /HM f D /Ou t D /PB f D} D
-/Bs {/BP Ba not D}D
-/reencodeISO {
- dup dup findfont dup length dict begin{1 index /FID ne{D}{pop pop}ie}forall
- /Encoding ISOLatin1Encoding D currentdict end definefont} D
-/ISOLatin1Encoding [
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright
-/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash
-/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon
-/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N
-/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright
-/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m
-/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/space/exclamdown/cent/sterling/currency/yen/brokenbar
-/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot
-/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior
-/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine
-/guillemotright/onequarter/onehalf/threequarters/questiondown
-/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
-/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute
-/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis
-/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave
-/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex
-/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis
-/yacute/thorn/ydieresis
-] D
-[128/backslash 129/parenleft 130/parenright 141/circumflex 142/tilde
-143/perthousand 144/dagger 145/daggerdbl 146/Ydieresis 147/scaron 148/Scaron
-149/oe 150/OE 151/guilsinglleft 152/guilsinglright 153/quotesinglbase
-154/quotedblbase 155/quotedblleft 156/quotedblright 157/endash 158/emdash
-159/trademark]
-aload length 2 idiv 1 1 3 -1 roll{pop ISOLatin1Encoding 3 1 roll put}for
-/colorimage where{pop}{
- /colorimage {
- pop pop /Pr E D {/Cv Pr D /Gr Cv length 3 idiv string D 0 1 Gr length 1 sub
- {Gr E dup /i E 3 mul D Cv i get 0.299 mul Cv i 1 add get 0.587 mul add
- Cv i 2 add get 0.114 mul add cvi put}for Gr} image} D
-}ie
-/pdfmark where{pop}{userdict /pdfmark /cleartomark load put}ie
-WF{FL{reencodeISO D}forall}{4 1 FL length 1 sub{FL E get reencodeISO D}for}ie
-/Symbol dup dup findfont dup length dict begin
- {1 index /FID ne{D}{pop pop}ie}forall /Encoding [Encoding aload pop]
- dup 128 /therefore put D currentdict end definefont D
-
-/SF {/CS E D SZ SL CS put FO SL FN put /YI CS LH neg mul D dup ST cvs ( ) join
- CS ST cvs join C1 E join ( NF ) join /C1 E D CS NF /Wf WF FN 0 gt or D
- /BW Wf{( ) SW pop}{0}ie D}D
-/NF {/cS E D /cF E D cF 0 ge{FL cF get}{cF -1 eq{/Symbol}{/MySymbol}ie}ie
- findfont cS scalefont setfont} D
-/FS {CF or /CF E D FR SL CF put CF CF 0 ge{FN 4 mul add}if E SF} D
-/PC {SH /BP f D fin not GL not and{NL}if /HM t D /LL LS D} D
-/BS {/TX E D Wf{/fin f D /CW 0 D /LK 0 D /SC 0 D
- /RT TX D {RT ( ) search{/NW E D pop /RT E D /WH NW SW pop D CW WH add LL gt
- {TX SC LK SC sub 1 sub NN GI GL{SH cF cS OC
- 2 copy cS ne E cF ne or{NF}{pop pop}ie}{PC /CW WH BW add D}ie
- /SC LK D}
- {GL{JC}if
- /CW CW WH add BW add D /HM t D}ie /GL f D /Ph f D
- /LK LK NW length 1 add add D}{pop exit}ie}loop
- /fin t D TX SC LK SC sub GI SH RT () ne{GL not{CC}if}if
- /LC TX length D /WH RT SW pop D CW WH add Hy{HC SW pop add}if LL gt
- {RT GL{SH cF cS OC 2 copy cS ne E cF ne or{NF}{pop pop}ie
- Hy{/Ph t D}if /LL LS D}{NL /LL LS D SH}ie}
- {RT PC Hy{CC}if /Ph Ph Hy or D}ie RT () ne{/GL t D /HM t D}if}
- {TX SW pop LL le{TX SH}{/NW () D 0 2 TX length 1 sub
- {/CW E D TX 0 CW GI dup SW pop LL gt{pop NW SH /HM t D NL/LL W XO sub MR sub D
- /CW CW 2 sub NN D /TX TX CW TX length CW sub GI D TX BS exit}
- {/NW E D}ie}for}ie}ie /HM t D}D
-/CC {C0 length 0 gt{JC}if /C0 [C1 L1 YA YB Mf NS NB TB AF Bw] D
- /C1 () D /L0 L1 D /YA 0 D /YB 0 D /Mf 0 D /NS 0 D /NB 0 D}D
-/JC {C0 aload length 0 gt{pop pop pop NB add /NB E D NS add /NS E D
- dup Mf gt{/Mf E D}{pop}ie dup YB gt{/YB E D}{pop}ie
- dup YA gt{/YA E D}{pop}ie pop C1 join /C1 E D /C0 [] D}if}D
-/OC {C0 length 0 gt{C1 L1 L0 sub YA YB Mf NS NB TB AF Bw GL C0 aload pop
- /Bw E D /AF E D /TB E D /NB E D /NS E D /Mf E D /YB E D /YA E D /C0 [] D
- /L1 E D /C1 E D Ph{HC SH}if NL /GL E D /Bw E D /AF E D /TB E D /NB E D /NS E D
- /Mf E D /YB E D /YA E D /L1 E D /LL W L1 sub XO sub MR sub WH sub D /CW 0 D
- C1 E join /C1 E D}if}D
-/BT {/LB t D dup length string copy RS dup dup () ne E ( ) ne and
- {/CI 0 D /LS LL D /LL W L1 sub XO sub MR sub D BS}
- {dup ( ) eq{/GL f D}if dup () eq L1 0 eq or{pop}{SH /BP f D /Ph f D}ie}ie
- /LB f D} D
-/BL {CP E pop XO E M} D
-/NL {JC /GL f D /SK W XO sub MR sub L1 sub TB{Bw add}if D
- /YA LF{Mf HM Fl not and PF or{LH mul}if}{0 /LF t D}ie YA 2 copy lt{E}if pop D
- C1 () ne{/FB YB Mf SA{Sf mul}if 4 div 2 copy lt{E}if pop D}if Fl{/Ya YA D}if
- CP E pop YA sub YB sub LE neg lt Fl not and PB not and{NP}if NT TL BL
- OU PF not and PB or{/RE L1 TB{Bw sub}if
- W XO sub MR sub div YA YB add LE BO add div 2 copy lt{E}if pop D
- RE 1 gt{BL 1 RE div dup scale}if}if
- AT 2 le{SK AT mul 2 div YA neg R}if
- AT 3 eq{0 YA neg R TB{/NB NB 1 sub D /NS NS 1 sub D}if /NB NB 1 sub NN D
- /A3 NS 6 mul NB add D NS NB add 0 eq
- {/A1 0 D /A2 0 D}
- {NS 0 eq{/A1 SK NB div dup J gt{pop 0}if D /A2 0 D}{J A3 mul SK lt
- {/A1 J D /A2 SK J NB mul sub NS div dup Ab gt{/A1 0 D pop 0}if D}
- {/A1 SK A3 div D /A2 A1 6 mul D}ie}ie}ie /A1 A1 NN D /A2 A2 NN D}if
- AT 4 eq{0 YA neg R PH 2 le{PD 0 lt{/PD L1 D}if PD M1 gt{/M1 PD D}if
- L1 PD sub M2 gt{/M2 L1 PD sub D}if}{DV ID 1 sub get 0 ge{Lo 0 R}if}ie}if
- F0 cF ne Cs cS ne or{F0 Cs NF}if
- /ms Ms D /Ms f D CP FB sub
- C1 cvx exec XO EO sub L1 add TB{BW sub}if dup LM gt{/LM E D}{pop}ie
- PH 0 eq PH 4 eq or Ms and{HF not{/PO t D /AH t D}if
- BB CP YA add E AT 3 eq LB and{A1 sub}if TB{BW sub}if E BB}
- {pop pop}ie Ms HM PH 3 eq and or{/BP f D /Fl f D}if
- /Lo 0 D /L1 0 D /F0 cF D /Cs cS D BP not{0 YB NN neg R}if
- OU f1 and mF not and{k2 /f1 f D}if
- OU PF not and PB or{RE 1 gt{RE dup scale}if}if /Ms ms Ms or D
- /C1 AF{(Cp )}{()}ie D /YA 0 D /YB 0 D BL
- AT 4 eq LB not and PH 3 ge and
- {ID DV length lt{DV ID get dup 0 ge{DO E sub /Lo E D /L1 Lo D}{pop}ie
- /ID ID 1 add D}if}if /T t D CD{/LN LN 1 add D PD}if
- /PD -1 D /NS 0 D /NB 0 D /TB f D /Ph f D /Mf 0 D /HM f D} D
-/RS {/TM E D /CN 0 D TM{10 eq{TM CN ( ) PI}if /CN CN 1 add D}forall
- /CN 0 D /BK HM EN and{0}{1}ie D TM
- {dup 32 ne{TM CN 3 2 roll put /CN CN 1 add D /BK 0 D}
- {pop BK 0 eq{TM CN 32 put /CN CN 1 add D}if /BK 1 D}ie}forall
- TM 0 CN GI dup dup () ne E ( ) ne and
- {dup CN 1 sub get 32 eq{/EN f D}{/EN t D}ie}if} D
-/join {2 copy length E length add string dup 4 2 roll 2 index 0 3 index
- PI E length E PI}d
-/WR {(\n) search{dup () ne BP not or
- {Li 4 le CP E pop YI Li mul add LE add 0 lt and PL 0 eq and{NP}if
- SH NL pop /Li Li 1 sub D WR}{pop pop WR}ie}{SH}ie /CI 0 D /BP f D} D
-/SH {dup dup () ne E ( ) ne and PF or CS Mf gt and{/Mf CS D}if
- T not Wf and{( ) E join /T t D}if dup BP{/MF CS D}if
- AT 3 eq{2 copy length dup 0 gt{/NB E NB add D
- {( ) search{/NS NS 1 add D pop pop}{pop exit}ie}loop}{pop pop}ie}if
- CD PD 0 lt and{dup DC search{SW pop /PD E L1 add D pop pop}{pop}ie}if
- 0 Np dup SW pop L1 add /L1 E D dup () ne
- {C1 (\() join E join (\)) join AU AF and UF or Wf and{( U ) join}if
- sF{( s ) join}if ( S ) join
- /C1 E D dup length 1 sub get 32 eq /TB E D /Bw BW D}{pop pop}ie} D
-/BG {AI LG BC add add 0 eq} D
-/ON {OU{Ty AR AI NN get dup 1 add Ln Ns Ty 2 mod 0 eq{(. )}{(\) )}ie join
- dup SW pop neg 0 R CP E 0 lt{0 E M}{pop}ie CP BB show /Ms t D}if} D
-/Ln {AR AI 3 -1 roll put}D
-/SP {dup CI lt BP not and{dup CI sub 0 E R /CI E D}{pop}ie} D
-/BN {PF{WR /HM f D}{BT NL}ie} D
-/NN {dup 0 lt{pop 0}if} D
-/h {(h) HI ST cvs join cvx exec dup 1 get E Nf{0 get E join}{pop}ie} D
-/H {/fn FN D /Hi E 1 add D 1 sub /HL E D /H2 HL 2 add D /GS EZ H2 get D
- E Tm H2 get GS mul BE dup 0 gt{1 sub}{pop EG H2 get dup 0 lt{pop AT}if}ie NA
- WW Np /SL SL 1 add D /FN EF H2 get D GS Ey H2 get FS
- EU H2 get Sc Hs not HL Hl lt and Hs HL hl lt and or Hi 0 eq or
- {/HI Hi D /Hs t D /hl HL D /Hv HL D}if HL Hl lt{/hi Hi D}if
- Nf HI 0 gt and{(h) Hi ST cvs join cvx exec 0 get WB}if
- /HF t D /AH f D /PO f D} D
-/EH {Bm H2 get GS mul BE OA /SL SL 1 sub NN D /CF 0 D /FN fn D
- SZ SL get FR SL get FS /HF f D /GS Ts D ()Ec} D
-/P {E PF{WR}{PO{EP}{BN}ie Ts 4 mul Np AE not{Tm 0 get Ts mul neg SP}if
- dup 0 ge AH and{Pi Pd}if}ie 1 sub dup 0 lt{pop AV AL get}if /AT E D /PO t D} D
-/EP {PF{WR}{BN Ts 4 mul Np}ie AE not{Bm 0 get Ts mul neg SP}if
- /AT AV AL get D /PO f D} D
-/BE {E PO{EP}{BN}ie Ts 4 mul Np neg SP} D
-/HR {/Aw W EO sub D /RW E dup 0 gt{Aw mul}{neg}ie dup Aw gt{pop Aw}if D /RZ E D
- E BN Ts neg SP 1 sub 2 div Aw RW sub mul EO add CP E pop M PF{0 Ps neg R}if
- 0 Np OU{gsave RZ LW Cf{Hc VC}{0 Sg}ie CP BB RW 0 RL CP BB stroke grestore}if
- /CI 0 D /BP f D PF not{Ts neg SP}if /Ms t D} D
-/AD {I NL EG 14 get dup 0 lt{pop AT}if NA /AE t D Tm 14 get Ts mul neg SP
- Cf{EU 14 get dup -1 eq{pop CA CL get}if Sc}if} D
-/DA {BN ()ES OA /AE f D ()Ec Bm 14 get Ts mul neg SP} D
-/PR {/MW E D /Li E D Tm 1 get Ps mul BE 0 NA /FN Fp D /PF t D SI /SL SL 1 add D
- /CF 0 D Ps CS mul Ts div MW WC mul CS mul Ts div dup LL gt PL 0 eq and
- {LL div div}{pop}ie Ey 1 get FS CP E pop LE add YI neg div cvi dup Li lt
- AH and{4 lt YI Li mul 5 mul LE add 0 gt or PL 0 eq and{NP}if}{pop}ie
- EU 1 get Sc /GS Ps D}D
-/RP {WR NL () /PF f D SI /FN 0 D ES Bm 1 get Ps mul neg SP OA /GS Ts D} D
-/SI {/XO Lm 15 get BC NN mul Lm 16 get AI UI sub NN mul add
- Lm 17 get UI NN mul add Lm 20 get LG NN mul add Ts mul
- PF{Lm 1 get Ps mul add}if EO add D
- /MR Rm 15 get BC NN mul Rm 16 get AI UI sub NN mul add
- Rm 17 get UI NN mul add Rm 20 get LG NN mul add Ts mul
- PF{Rm 1 get Ps mul add}if D /LL W XO sub MR sub D} D
-/DT {/cC E D BN /LG LG 1 sub D SI /LG LG 1 add D WW 2 div Np BL} D
-/DD {WB Cc 0 eq cC 0 eq and L1 0 eq or Lm 20 get Ts mul L1 sub TB{BW add}if
- Ts 2 div lt or NL /LF E D SI BL /cC 0 D} D
-/DL {Dc LG Cc put /Cc E D BG{Tm 18 get Ts mul BE}{BN}ie /LG LG 1 add D BL} D
-/LD {BN LG 0 gt{/LG LG 1 sub D}if /Cc Dc LG get D SI
- BG{()Bm 18 get Ts mul BE}if BL} D
-/UL {BG{Tm 17 get Ts mul BE}{BN}ie NR AI NN 0 put /UI UI 1 add D
- /AI AI 1 add D SI BL} D
-/LU {BN /UI UI 1 sub D /AI AI 1 sub D SI BG{()Bm 17 get Ts mul BE}if BL} D
-/OL {E BG{Tm 16 get Ts mul BE}{BN}ie TR AI NN Ty put /Ty E D NR AI NN 1 put
- /AI AI 1 add D SI BL 1 Ln} D
-/LO {BN /AI AI 1 sub D /Ty TR AI get D SI BG{()Bm 16 get Ts mul BE}if BL} D
-/LI {E BN -1 SP /BP f D /CI 0 D 0 Np NR AI 1 sub NN get 1 eq
- {dup dup 0 gt E 4 le and{/Ty E D}{pop}ie
- /L1 L1 Ty AR AI NN get Ns SW pop XO sub dup 0 lt{pop 0}if add D ( ON )}
- {pop ( B )}ie C1 E join /C1 E D CS Mf gt{/Mf CS D}if BL} D
-/BQ {Tm 15 get Ts mul BE /BC BC 1 add D SI BL} D
-/QB {Bm 15 get Ts mul BE /BC BC 1 sub D SI BL} D
-/Al {E EP 1 sub dup 0 lt{pop AV AL get}if NA} D
-/Ea {EP OA} D
-/WB {PF{WR}{BT}ie} D
-/F1 {WB /FN 0 D CS 0 FS} D
-/F2 {WB /FN WI D CS 0 FS} D
-/HY {/Hy t D WB /Hy f D} D
-/YH {WB} D
-/A {/LT E D LT 1 eq{/RN E D}if /Lh E D WB /C1 C1 ( Cp ) join D
- Lc AF not and{Cl Sc}if /AF t D} D
-/EA {Lc AF and{Ec}{WB}ie TL Pa AF and Lh 0 ne and
- {( \() Lh join (\)) join /AF f D WB}if /AF f D} D
-/TL {C1 ( Tl ) apa /C1 E D} d
-/apa {AF OU and Lh 0 ne LT 1 eq or and{LT 1 eq{RN ( /) E ST cvs join}
- {(\() Lh join (\)) join}ie E join join}{pop}ie} d
-/Cp {/Xc CP /Yc E D D} D
-/SS {Cf{dup 0 ge{EU E get dup -1 eq{pop CA CL get}if}{pop CA CL get}ie Sc}
- {pop}ie SZ SL get /SL SL 1 add D} D
-/I {WB 8 SS 1 FS} D
-/EM {WB 8 SS /CF CF 1 xor D 0 FS} D
-/BD {WB 9 SS 2 FS} D
-/TT {WB 10 SS /FN Fp D 0 FS} D
-/KB {WB 11 SS /FN Fp D 2 FS} D
-/CT {WB 12 SS 1 FS} D
-/SM {WB 13 SS /FN Fp D 0 FS} D
-/Q {/QL QL 1 add D QO QL 2 mod get La get join WB} D
-/EQ {QC QL 2 mod get La get join WB /QL QL 1 sub D} D
-/RO {WB -1 SS /CF 0 D 0 FS} D
-/SY {WB -1 SS -1 FS} D
-/MY {WB -1 SS -2 FS} D
-/ES {WB /SL SL 1 sub NN D /CF 0 D /FN FO SL get D SZ SL get FR SL get FS ()Ec}D
-/FZ {3 sub 1.2 E exp GS mul E WB TL /C1 C1 ( Cp ) join D /SL SL 1 add D 0 FS} D
-/Ef {WB TL ()ES /C1 C1 ( Cp ) join D} D
-/BZ {dup /Bf E D FZ}D
-/Sc {dup -1 ne Cf and{/CL CL 1 add D dup 0 eq{pop [0 0 0]}if
- dup CA E CL E put VS ( VC ) join C1 E join /C1 E D}{pop}ie} D
-/Ec {WB Cf{/CL CL 1 sub NN D CA CL get VS ( VC ) join C1 E join /C1 E D}if} D
-/VS {dup type /arraytype eq{([) E {ST cvs join ( ) join}forall (]) join}if} D
-/VC {{255 div}forall setrgbcolor} D
-/Sl {dup type /integertype ne{Ds}if /La E D WB}d
-/UN {WB /UF t D} D
-/NU {WB /UF f D} D
-/SE {WB /sF t D} D
-/XE {WB /sF f D} D
-/sM {/C1 C1 ( k1 ) join D}d
-/eM {/C1 C1 ( k2 ) join D}d
-/k1 {/YC CP E pop Ts add D /mF t D /f1 t D}d
-/k2 {gsave 3 LW -9 CP E pop Ts 0.2 mul sub M -9 YC L stroke grestore /mF f D}d
-/Ac {/AC E D WB}d
-/Ca {eA{( \()join AC join(\) )join}if WB}d
-/s {OU{gsave 0 CS .25 mul R dup SW pop CJ 0 RL stroke grestore}if}D
-/CJ {AT 3 eq LB and{E dup dup length 1 sub A1 mul E
- {( ) search{pop pop E A2 add E}{pop exit}ie}loop 3 -1 roll add
- W CP pop sub 2 copy gt{E}if pop}if}D
-/So {/Co E D} D
-/SO {C1 Yo ST cvs join ( So ) join /C1 E D (j) SW pop 2 div Pd} D
-/Se {E WB CS E div Pd}D
-/Pd {dup type /stringtype eq{SW pop}if dup /L1 E L1 add D
- ST cvs ( 0 R ) join C1 E join /C1 E D} D
-/Sp {0.35 CO} D
-/Sb {-0.2 CO} D
-/CO {OV Io Yo put /Yo E CS mul Yo add D /Io Io 1 add D -1.5 Io mul 3 add FZ SO
- CS Yo add dup YA gt{/YA E D}{pop}ie
- Yo neg dup YB gt{/YB E D}{pop}ie} D
-/Es {ES /Io Io 1 sub NN D /Yo OV Io get D SO} D
-/SB {/N2 0 D 0 1 NI{/N E D{IX N2 get 0 lt{/N2 N2 1 add D}{exit}ie}loop
- /K WS N get FC N get mul D /NY AY N2 get D /BV NY array D
- 0 1 NY 1 sub{/TM K string D currentfile TM readhexstring pop pop BV E TM put}
- for BM N BV put /N2 N2 1 add D}for} D
-/IC [{/MA E D /MB 0 D}{2 div /MA E D /MB MA D}{/MB E CS sub D /MA CS D}
- {pop /MA YS AB mul D /MB 1 AB sub YS mul D}{pop /MA 0 D /MB 0 D}] D
-/IP {BV N get /N N 1 add D} D
-/II {/K E D IX K get 0 lt{/EC E D}if /TY E D
- TY 4 eq{/Y E D /X E D}if TY 3 eq{/AB E D}if
- /XW AX K get D /YW AY K get D /IS SG IT K get get D /XS XW IS mul D
- /YS YW IS mul D YS IC TY get exec /MA MA Fl not{3 add}if D} D
-/IM {II /ty TY D /xs XS D /ys YS D /ya YA D /yb YB D /ma MA D /mb MB D /k K D
- /ec EC D /BP f D /CI 0 D WB TL L1 xs add dup XO add MR add W gt
- {pop /ma ma Fl{3 add}if D NL /YA ma D /YB mb D /YS ys D /L1 xs D}
- {/L1 E D ma YA gt{/YA ma D}if mb YB gt{/YB mb D}if}ie /TB f D
- OU{CP E pop YS sub LE neg lt Fl not and PB not and{NP /YA ma D /YB mb D}if
- /BP f D ty ST cvs ( ) join IX k get 0 lt{(\() join ec join (\) ) join}if
- k ST cvs join ty 3 eq{AB ST cvs ( ) join E join}if
- ty 4 eq{X ST cvs ( ) join Y ST cvs join ( ) join E join}if C1 E join
- ( DI ) join FP 2 eq FP 1 eq AF and or{( FM ) join}if
- ( Il Cp ) apa /C1 E D /EN f D}if /HM t D /T f D} D
-/DI {II /Xc CP /Yc E D D /YN YW neg D /HM t D /CI 0 D /K2 IX K get D gsave
- TY 4 eq{OX X IS mul add OY FY add YS sub Y IS mul sub}
- {/FY YS D CP MB sub 2 copy /OY E D /OX E D}ie
- translate K2 0 ge{/DP AZ K2 get D /BV BM K2 get D XS YS scale /N 0 D XW YW DP
- [XW 0 0 YN 0 YW] {IP} FC K2 get 1 eq{image}{f 3 colorimage}ie}
- {EX}ie grestore XS 0 R /Ms t D} D
-/FM {gsave 0 Sg CP MB sub translate XS neg 0 M 0 YS RL XS 0 RL 0 YS neg RL
- XS neg 0 RL stroke grestore} D
-/NA {/AT E D /AL AL 1 add D AV AL AT put} D
-/OA {AL 0 gt{/AL AL 1 sub D /AT AV AL get D}if} D
-/D1 {/BR {CP E pop E BN Mb{CP E pop eq{0 YI R}if}{pop}ie} D
- /Sn {OU{C1 E ST cvs join ( Ld ) join /C1 E D}{pop}ie} D} D
-/D1 {/BR {BN} D /Sn {OU {C1 E ST cvs join ( Ld ) join /C1 E D} {pop} ie} D} D
-/TC {/TF t D /ML 0 D HN{SW pop dup ML gt{/ML E D}{pop}ie}forall NP /RM RM not D
- RC /OU Tc D Ep /PN 0 D Ms not TP and{Ip}if /W IW ML sub Ts sub D
- /A0 0 D TH{/BR {( ) join BT} D /Sn {pop} D /Au () D}if} D
-/TN {0 eq{E EA PF HF or not XR and{HN E get Xr}{pop}ie}
- {OU{Tn 0 ge{() BN}if /Tn E D}{pop}ie WB}ie} D
-/NT {OU LB not and Tn 0 ge and{PL 0 eq{Ms not{CS CF FS}if CP dup
- /y E YA sub D W 9 sub CS -1.8 mul XO L1 add 2 add{y M (.) show}for
- HN Tn get dup SW pop IW E sub y M show CP BB M}if /Tn -1 D}if} D
-/Ld {/DN E D HN DN Pn put [/View [/XYZ -4 Fl{PS}{CP YA add US E pop}ie null]
- /Dest DN ST cvs cvn /DEST pdfmark} D
-/C {ND 1 eq{1 sub}if TI mul /XO E D NL Nf not{pop()}if 0 3 -1 roll 1 A} D
-/OP {BP not{NP}if PN 2 mod 0 eq{/Ms t D NP}if}D
-/Ep {Xp PN 2 mod 0 eq and OU and{/Pn (-) D showpage /PM 1 D LA}if}D
-/Dg [73 86 88 76 67 68 77] D
-/Rd [0 [1 1 0][2 1 0][3 1 0][2 1 1][1 1 1][2 2 1][3 3 1][4 4 1][2 1 2]] D
-/Ns {/m E D /c E 32 mul D /j m 1000 idiv D /p j 12 add string D
- c 96 le m 0 gt and{c 32 le {/i 0 D /d 77 D /l 100 D /m m j 1000 mul sub D
- j -1 1 {pop p i d c add put /i i 1 add D}for
- 4 -2 0 {/j E D /n m l idiv D /m m n l mul sub D /d Dg j get D
- n 0 gt {/x Rd n get D x 0 get -1 1 {pop p i d c add put /i i 1 add D}for
- p i x 1 get sub Dg x 2 get j add get c add put}if /l l 10 idiv D
- }for p 0 i GI}
- {/i ST length 1 sub D m {1 sub dup 0 ge{dup 26 mod c add 1 add
- ST i 3 -1 roll put 26 idiv dup 0 eq{pop exit}if}if /i i 1 sub D}loop
- ST i ST length i sub GI}ie}
- {m p cvs}ie} D
-/US {matrix currentmatrix matrix defaultmatrix matrix invertmatrix
- matrix concatmatrix transform} D
-/GB {Gb{US}if}D
-/Tl {/Rn E D Xc CP pop ne{
- [/Rect [Xc 1 sub Yc cS 0.25 mul sub GB CP E 1 add E cS 0.85 mul add GB]
- /Subtype /Link /Border [0 0 Cf Lc and LX and AU or{0}{1}ie] Rn type
- /nametype eq {/Dest Rn}{/Action [/Subtype /URI /URI Rn] Cd}ie
- /ANN pdfmark}if} D
-/Il {/Rn E D [/Rect [Xc Yc GB Xc XS add Yc YS add GB] /Subtype /Link
- /Border [0 0 0] Rn type /nametype eq{/Dest Rn}
- {/Action [/Subtype /URI /URI Rn] Cd}ie /ANN pdfmark} D
-/XP {[{/Z Bz 2 div D Z 0 R Z Z RL Z neg Z RL Z neg Z neg RL Z Z neg RL
- Fi cH 1 eq and{fill}if} {Bz 0 RL 0 Bz RL Bz neg 0 RL 0 Bz neg RL
- Fi cH 1 eq and{fill}if} {0 -5 R Bz 0 RL 0 21 RL Bz neg 0 RL 0 -21 RL}]} D
-/MS {/Sm E D WB}D
-/O {BN()Sm BX} D
-/O {BN()0 Sm BX} D
-/BX {/Bt E D Bt 2 lt{/Ch E D CS 0.8 mul}{11 mul}ie W XO sub MR sub
- 2 copy gt{E}if pop /HZ E D Bt 2 eq{Fi not{pop()}if ( )E join /Ft E D TT
- /PF t D /MW 1 D /Li 1 D /Fw Ft SW pop D Fw HZ gt{/HZ Fw 8 add D}if
- HZ ST cvs( )join}{WB Ch ST cvs( )join}ie L1 HZ add XO add MR add W gt{NL}if
- Bt 2 eq{Ft ES Fw neg HM{CS sub}if Pd}if Bt ST cvs join( Bx )join
- Bt 2 eq HM and{CS Pd}if C1 E join /C1 E D /L1 L1 HZ add D /T f D
- ( ) Pd /PF f D Bt 2 lt{YA CS .8 mul lt{/YA CS .8 mul D}if}
- {YB 5 lt{/YB 5 D}if YA 21 lt{/YA 21 D}if}ie /CI 0 D} D
-/Bx {dup 2 eq{E /Bz E D}{E /cH E D /Bz CS .8 mul D}ie
- OU {gsave 0 Sg XP E get exec stroke grestore}{pop}ie Bz 0 R /Ms t D}D
-/SD {FD 4 mul Dy add DZ NF newpath 0 0 M DX t charpath pathbbox
- 3 -1 roll sub /DY E D E dup /X1 E D sub WM mul WX DY mul add WM DG mul E div
- /DF E D /DR WX DF mul DY mul WM div 2 div D} d
-/Sd {gsave 0 IL Di mul neg translate IL IW atan Di 0 eq{neg}if rotate
- FD 4 mul Dy add DZ NF DR X1 sub DY 2 div neg M cD VC DX show grestore} d
-/Pt {/tp t D Tp{NP /Pn (TP) D 0 Tt neg R Th BN NP Ep ET RC ZF}if /tp f D} D
-/RC {/AI 0 D /LG 0 D /BC 0 D /UI 0 D /PF f D /Cc 0 D /cC 0 D /Dc 10 array D
- /NR [0 1 9{pop 0}for] D /La Ds D /AR 10 array D /TR 10 array D /AV 30 array D
- SI /AL -1 D /AT A0 D AT NA /OV 9 array D /Yo 0 D /Co 0 D /Io 0 D /Hy f D
- /Ph f D /CL -1 D Ct Sc}D
-/ZF {/FR [0 1 30{pop 0}for] D /SZ [0 1 30{pop 0}for] D /FO [0 1 30{pop 0}for] D
- /SL 0 D /CF 0 D /FN 0 D 0 Ts SF}D
-/QO [[(\234)(\233)(\253\240)(\232)(\273)(\253)][(')(`)(\253\240)(\231)(\273)(\253)]] D
-/QC [[(\234)(\234)(\240\273)(\233)(\253)(\273)][(')(')(\240\273)(`)(\253)(\273)]] D
-/Hf EF length 2 sub D
-/Hz EZ Hf get D
-/HS Ey Hf get D
-/Fz EZ Hf 1 add get D
-/Fs Ey Hf 1 add get D
-/LE IL D
-/Ps EZ 1 get D
-/Fp EF 1 get D
-/XO 0 D
-/YI 0 D
-/CI 0 D
-/FP 0 D
-/WW Ts 7 mul D
-/Mf 0 D
-/YA 0 D
-/YB 0 D
-/Cs Ts D
-/GS Ts D
-/F0 0 D
-/NS 0 D
-/NB 0 D
-/N 0 D
-/C0 [] D
-/C1 () D
-/Lo 0 D
-/L1 0 D
-/LM 0 D
-/PH 0 D
-/EC 0 D
-/Lh 0 D
-/LT 0 D
-/CH 1 string D
-/ST 16 string D
-/CA 9 array D
-/HC (\255) D
-/HM f D
-/PF f D
-/EN f D
-/TB f D
-/UF f D
-/sF f D
-/AE f D
-/AF f D
-/BP t D
-/CD f D
-/PA t D
-/GL f D
-/T t D
-/HF f D
-/AH f D
-/SA f D
-/PB f D
-/f1 f D
-/mF f D
-/OX 0 D
-/OY 0 D
-/FY 0 D
-/EO 0 D
-/FB 0 D
-/PL 0 D
-/Bw 0 D
-/PD -1 D
-/TP f D
-/tp f D
-/TH f D
-/Ty 4 D
-/Tn -1 D
-/Fl t D
-/LB t D
-/PM 1 D
-/Ms f D
-/Ba f D
-/Bb f D
-/Hl 3 D
-/hl 6 D
-/Hv 6 D
-/Hs f D
-/HI 0 D
-/hi 0 D
-/PO t D
-/TE f D
-/LF t D
-/BO 0 D
-/Sm 1 D
-/Bf 3 D
-/A1 0 D
-/A2 0 D
-/Ds 1 D
-/QL -1 D
-/Cb Db D
-/Ct Dt D
-/Cl Dl D
-[/Creator (html2ps version 1.0 beta5) /Author () /Keywords () /Subject ()
- /Title (The Funtools Help Facility) /DOCINFO pdfmark
-/ND 18 D
-/HN [(1) (1) (1) (1) (8) (9) (19) (21) (28) (30) (33) (37) (38) (41) (42) (45)
-(48) (51) (53) (??) (54) (56) (56) (87) (57) (58) (60) (62) (64) (65) (76)
-(77) (66) (73) (75) (82) (85) (78) (80) (86) (87) (57) (91) (91) (92) (92)
-(94) (102) (111) (95) (96) (100) (117) (123) (127) (136) (152) (157) (161)
-(164) (165) (167) (171) (1) (1) (1) (3) (1) (1) (1) (8) (9) (19) (21) (28)
-(30) (33) (37) (38) (41) (42) (45) (48) (50) (51) (51) (51) (51) (52) (53)
-(53) (53) (53) (53) (54) (56) (56) (57) (57) (58) (60) (62) (64) (65) (66)
-(73) (75) (76) (77) (80) (82) (85) (86) (87) (87) (87) (88) (90) (91) (98)
-(91) (91) (91) (91) (92) (92) (94) (95) (96) (98) (99) (100) (101) (102)
-(102) (102) (102) (102) (103) (104) (105) (105) (108) (109) (110) (111)
-(111) (111) (111) (111) (111) (112) (113) (114) (114) (115) (116) (116)
-(116) (117) (119) (119) (120) (120) (120) (117) (117) (117) (117) (119)
-(119) (120) (120) (120) (121) (122) (123) (123) (123) (123) (126) (127)
-(127) (127) (127) (127) (129) (129) (130) (131) (131) (132) (132) (133)
-(135) (136) (136) (136) (136) (146) (151) (152) (152) (152) (152) (156)
-(157) (157) (157) (157) (157) (158) (159) (160) (161) (161) (161) (161)
-(161) (161) (162) (162) (163) (164) (164) (164) (164) (164) (165) (165)
-(165) (165) (165) (166) (167) (167) (167) (167) (170) (171) (171) (171)
-(171) (171) (172) (172) (172) (175) (178) (178) (179) (180) (181) (181)
-(182) (182) (183) (183) (184) (184) (184) (184) (185) (185) (185) (186)
-(187) (187)] D
-/h0 [()(Table of Contents)] D
-/h1 [(0.1\240\240)(Funtools: FITS Users Need Tools)] D
-/h2 [(0.2\240\240)(Summary)] D
-/h3 [(0.3\240\240)(Description)] D
-/h4 [(0.3.0.0.1\240\240)(Last updated: January 6, 2006)] D
-/h5 [(0.4\240\240)(Funtools Programs)] D
-/h6 [(0.5\240\240)(Summary)] D
-/h7 [(0.6\240\240)(funcalc - Funtools calculator \(for binary tables\))] D
-/h8 [(0.7\240\240)(funcen - find centroid \(for binary tables\))] D
-/h9 [(0.8\240\240)(funcnts - count photons in specified regions, with bkgd subtraction)] D
-/h10 [(0.9\240\240)(funcone - cone search of a binary table containing RA, Dec columns)] D
-/h11 [(0.10\240\240)(fundisp - display data in a Funtools data file)] D
-/h12 [(0.11\240\240)(funhead - display a header in a Funtools file)] D
-/h13 [(0.12\240\240)(funhist - create a 1D histogram of a column \(from a FITS binary table or raw event file\) or an image)] D
-/h14 [(0.13\240\240)(funimage - create a FITS image from a Funtools data file)] D
-/h15 [(0.14\240\240)(funindex - create an index for a column of a FITS binary table)] D
-/h16 [(0.15\240\240)(funjoin - join two or more FITS binary tables on specified columns)] D
-/h17 [(0.16\240\240)(funmerge - merge one or more Funtools table files)] D
-/h18 [(0.17\240\240)(funsky - convert between image and sky coordinates)] D
-/h19 [(0.18\240\240)(funtable - copy selected rows from a Funtools file to a FITS binary table)] D
-/h20 [(0.19\240\240)(funtbl - extract a table from Funtools ASCII output)] D
-/h21 [(0.19.0.0.1\240\240)(Last updated: April 1, 2007)] D
-/h22 [(0.20\240\240)(FunDS9: Funtools and DS9 Image Display)] D
-/h23 [(0.21\240\240)(Summary)] D
-/h24 [(0.22\240\240)(Description)] D
-/h25 [(0.22.0.0.1\240\240)(Last updated: November 16, 2005)] D
-/h26 [(0.23\240\240)(FunLib: the Funtools Programming Interface)] D
-/h27 [(0.24\240\240)(Summary)] D
-/h28 [(0.25\240\240)(Introduction to the Funtools Programming Interface)] D
-/h29 [(0.26\240\240)(Funtools Programming Tutorial)] D
-/h30 [(0.27\240\240)(Compiling and Linking)] D
-/h31 [(0.28\240\240)(A Short Digression on Subroutine Order)] D
-/h32 [(0.29\240\240)(Funtools Programming Examples)] D
-/h33 [(0.30\240\240)(The Funtools Programming Reference Manual)] D
-/h34 [(0.31\240\240)(FunOpen - open a Funtools data file)] D
-/h35 [(0.32\240\240)(FunImageGet - get an image or image section)] D
-/h36 [(0.33\240\240)(FunImagePut - put an image to a Funtools file)] D
-/h37 [(0.34\240\240)(FunImageRowGet - get row\(s\) of an image)] D
-/h38 [(0.35\240\240)(FunImageRowPut - put row\(s\) of an image)] D
-/h39 [(0.36\240\240)(FunColumnSelect - select Funtools columns)] D
-/h40 [(0.37\240\240)(FunColumnActivate - activate Funtools columns)] D
-/h41 [(0.38\240\240)(FunColumnLookup - lookup a Funtools column)] D
-/h42 [(0.39\240\240)(FunTableRowGet - get Funtools rows)] D
-/h43 [(0.40\240\240)(FunTableRowPut - put Funtools rows)] D
-/h44 [(0.41\240\240)(FunParamPut - put a Funtools param value)] D
-/h45 [(0.42\240\240)(FunInfoGet - get information from Funtools struct)] D
-/h46 [(0.43\240\240)(FunInfoPut - put information into a Funtools struct)] D
-/h47 [(0.44\240\240)(FunFlush - flush data to output file)] D
-/h48 [(0.45\240\240)(FunClose - close a Funtools data file)] D
-/h49 [(0.46\240\240)(FunRef: the Funtools Reference Handle)] D
-/h50 [(0.47\240\240)(Summary)] D
-/h51 [(0.48\240\240)(Description)] D
-/h52 [(0.48.0.0.1\240\240)(Last updated: December 1, 2005)] D
-/h53 [(0.49\240\240)(FunFiles: Funtools Data Files)] D
-/h54 [(0.50\240\240)(Summary)] D
-/h55 [(0.51\240\240)(Description)] D
-/h56 [(0.52\240\240)(Supported Data Formats)] D
-/h57 [(0.53\240\240)(FITS Images and Binary Tables)] D
-/h58 [(0.54\240\240)(Non-FITS Raw Event Files)] D
-/h59 [(0.55\240\240)(Non-FITS Array Files)] D
-/h60 [(0.56\240\240)(Specifying Image Sections)] D
-/h61 [(0.57\240\240)(Binning FITS Binary Tables and Non-FITS Event Files)] D
-/h62 [(0.58\240\240)(Table and Spatial Region Filters)] D
-/h63 [(0.59\240\240)(Disk Files and Other Supported File Types)] D
-/h64 [(0.60\240\240)(Lists of Files)] D
-/h65 [(0.60.0.0.1\240\240)(Last updated: February 15, 2006)] D
-/h66 [(0.61\240\240)(Funtext: Support for Column-based Text Files)] D
-/h67 [(0.62\240\240)(Summary)] D
-/h68 [(0.63\240\240)(Description)] D
-/h69 [(0.64\240\240)(Standard Text Files)] D
-/h70 [(0.65\240\240)(Comments Convert to Header Params)] D
-/h71 [(0.66\240\240)(Multiple Tables in a Single File)] D
-/h72 [(0.67\240\240)(TEXT\(\) Specifier)] D
-/h73 [(0.68\240\240)(Text\(\) Keyword Options)] D
-/h74 [(0.69\240\240)(Environment Variables)] D
-/h75 [(0.70\240\240)(Restrictions and Problems)] D
-/h76 [(0.70.0.0.1\240\240)(Last updated: August 3, 2007)] D
-/h77 [(0.71\240\240)(Funview: Database View Support for Tables)] D
-/h78 [(0.72\240\240)(Summary)] D
-/h79 [(0.73\240\240)(Description)] D
-/h80 [(0.74\240\240)(Database Views)] D
-/h81 [(0.75\240\240)(Funtools View Attributes)] D
-/h82 [(0.76\240\240)(Invoking a Funtools View \(in Place of an Input File\))] D
-/h83 [(0.77\240\240)(Basic View Matching Rules)] D
-/h84 [(0.78\240\240)(More on View Matching Rules: Single vs. Multiple Matches)] D
-/h85 [(0.79\240\240)(View Lists: Applying a View to Any File)] D
-/h86 [(0.80\240\240)(Overriding Values Associated with a View)] D
-/h87 [(0.81\240\240)(Environment Variables)] D
-/h88 [(0.82\240\240)(Restrictions and Problems)] D
-/h89 [(0.82.0.0.1\240\240)(Last updated: August 3, 2007)] D
-/h90 [(0.83\240\240)(Funfilters: Filtering Rows in a Table)] D
-/h91 [(0.84\240\240)(Summary)] D
-/h92 [(0.85\240\240)(Description)] D
-/h93 [(0.86\240\240)(Filter Expressions)] D
-/h94 [(0.87\240\240)(Separators Also Are Operators)] D
-/h95 [(0.88\240\240)(Range Lists)] D
-/h96 [(0.89\240\240)(Math Operations and Functions)] D
-/h97 [(0.90\240\240)(Include Files)] D
-/h98 [(0.91\240\240)(Header Parameters)] D
-/h99 [(0.92\240\240)(Examples)] D
-/h100 [(0.92.0.0.1\240\240)(Last updated: November 17, 2005)] D
-/h101 [(0.93\240\240)(Funidx: Using Indexes to Filter Rows in a Table)] D
-/h102 [(0.94\240\240)(Summary)] D
-/h103 [(0.95\240\240)(Description)] D
-/h104 [(0.95.0.0.1\240\240)(Last updated: August 3, 2007)] D
-/h105 [(0.96\240\240)(Regions: Spatial Region Filtering)] D
-/h106 [(0.97\240\240)(Summary)] D
-/h107 [(0.98\240\240)(Description)] D
-/h108 [(0.99\240\240)(Region Expressions)] D
-/h109 [(0.100\240\240)(Columns Used in Region Filtering)] D
-/h110 [(0.101\240\240)(Region Algebra)] D
-/h111 [(0.102\240\240)(Region Separators Also Are Operators)] D
-/h112 [(0.103\240\240)(Region Exclusion)] D
-/h113 [(0.104\240\240)(Include Files)] D
-/h114 [(0.105\240\240)(Global and Local Properties of Regions)] D
-/h115 [(0.106\240\240)(Coordinate Systems)] D
-/h116 [(0.107\240\240)(Specifying Positions, Sizes, and Angles)] D
-/h117 [(0.107.0.0.1\240\240)(Last updated: November 17, 2005)] D
-/h118 [(0.108\240\240)(RegGeometry: Geometric Shapes in Spatial Region Filtering)] D
-/h119 [(0.109\240\240)(Summary)] D
-/h120 [(0.110\240\240)(Geometric shapes)] D
-/h121 [(0.111\240\240)(Region accelerators)] D
-/h122 [(0.111.0.0.1\240\240)(Last updated: March 12, 2007)] D
-/h123 [(0.112\240\240)(RegAlgebra: Boolean Algebra on Spatial Regions)] D
-/h124 [(0.113\240\240)(Summary)] D
-/h125 [(0.114\240\240)(Description)] D
-/h126 [(0.114.0.0.1\240\240)(Last updated: November 17, 2005)] D
-/h127 [(0.115\240\240)(RegCoords: Spatial Region Coordinates)] D
-/h128 [(0.116\240\240)(Summary)] D
-/h129 [(0.117\240\240)(Pixel coordinate systems)] D
-/h130 [(0.118\240\240)(World Coordinate Systems)] D
-/h131 [(0.119\240\240)(WCS Positions and Sizes)] D
-/h132 [(0.120\240\240)(NB: The Meaning of Pure Numbers Are Context Sensitive)] D
-/h133 [(0.120.0.0.1\240\240)(Last updated: November 17, 2005)] D
-/h134 [(0.121\240\240)(RegBounds: Region Boundaries)] D
-/h135 [(0.122\240\240)(Summary)] D
-/h136 [(0.123\240\240)(Description)] D
-/h137 [(0.124\240\240)(Image boundaries : radially-symmetric shapes \(circle, annuli, ellipse\))] D
-/h138 [(0.125\240\240)(Image Boundaries: non-radially symmetric shapes \(polygons, boxes\))] D
-/h139 [(0.126\240\240)(Row Boundaries are Analytic)] D
-/h140 [(0.127\240\240)(Image Boundaries vs. Row Boundaries: Practical Considerations)] D
-/h141 [(0.127.0.0.1\240\240)(Last updated: November 16, 2005)] D
-/h142 [(0.128\240\240)(RegDiff:Differences Between Funtools and IRAF Regions)] D
-/h143 [(0.129\240\240)(Summary)] D
-/h144 [(0.130\240\240)(Description)] D
-/h145 [(0.130.0.0.1\240\240)(Last updated: November 16, 2005)] D
-/h146 [(0.131\240\240)(FunCombine: Combining Region and Table Filters)] D
-/h147 [(0.132\240\240)(Summary)] D
-/h148 [(0.133\240\240)(Comma Conventions)] D
-/h149 [(0.133.0.0.1\240\240)(Last updated: November 16, 2005)] D
-/h150 [(0.134\240\240)(FunEnv: Funtools Environment Variables)] D
-/h151 [(0.135\240\240)(Summary)] D
-/h152 [(0.136\240\240)(Description)] D
-/h153 [(0.136.0.0.1\240\240)(Last updated: November 16, 2005)] D
-/h154 [(0.137\240\240)(Funtools ChangeLog)] D
-/h155 [(0.138\240\240)(Patch Release 1.4.5 \(internal ds9 release\))] D
-/h156 [(0.139\240\240)(Patch Release 1.4.4 \(internal ds9 release\))] D
-/h157 [(0.140\240\240)(Patch Release 1.4.3 \(internal ds9 release\))] D
-/h158 [(0.141\240\240)(Patch Release 1.4.2 \(internal ds9 release\))] D
-/h159 [(0.142\240\240)(Patch Release 1.4.1 \(internal ds9 release\))] D
-/h160 [(0.143\240\240)(Public Release 1.4.0 \(15 August 2007\))] D
-/h161 [(0.144\240\240)(Release 1.3.0b[n] \(mainly internal SAO beta releases\))] D
-/h162 [(0.145\240\240)(Patch Release 1.2.4 \(internal SAO and beta release only\))] D
-/h163 [(0.146\240\240)(Patch Release 1.2.3 \(12 January 2004\))] D
-/h164 [(0.147\240\240)(Patch Release 1.2.3b1 \(19 August 2003\))] D
-/h165 [(0.148\240\240)(Patch Release 1.2.2 \(18 May 2003\))] D
-/h166 [(0.149\240\240)(Patch Release 1.2.1 \(24 April 2003\))] D
-/h167 [(0.150\240\240)(Public Release 1.2.0 \(24 March 2003\))] D
-/h168 [(0.151\240\240)(Beta Release 1.2.b3 \(4 February 2003\))] D
-/h169 [(0.152\240\240)(Beta Release 1.2.b2 \(7 October 2002\))] D
-/h170 [(0.153\240\240)(Beta Release 1.2.b1 \(24 September 2002\))] D
-/h171 [(0.154\240\240)(Public Release 1.1.0 \(22 April 2002\))] D
-/h172 [(0.155\240\240)(Pre-Release 1.1.0e \(10 April 2002\))] D
-/h173 [(0.156\240\240)(Pre-Release 1.1.0e \(19 March 2002\))] D
-/h174 [(0.157\240\240)(Pre-Release 1.1.0e \(27 February 2002\))] D
-/h175 [(0.158\240\240)(Pre-Release 1.1.0e \(11 February 2002\))] D
-/h176 [(0.159\240\240)(Beta Release 1.0.1b5 \(31 January 2002\))] D
-/h177 [(0.160\240\240)(Beta Release 1.0.1b4 \(26 January 2002\))] D
-/h178 [(0.161\240\240)(Beta Release 1.0.1b3 \(4 January 2002\))] D
-/h179 [(0.162\240\240)(Beta Release 1.0.1b2 \(14 November 2001\))] D
-/h180 [(0.163\240\240)(Beta Release 1.0.1b1 \(6 November 2001\))] D
-/h181 [(0.164\240\240)(Public Release 1.0.0 \(31 July 2001\))] D
-/h182 [(0.164.0.0.1\240\240)(Last updated: 22 April 2002)] D
-/Hr [-63 63 64 65 -66 -66 66 -67 67 68 69 70 71 72 73 74 75 76 77 78 79
-80 81 82 -83 -83 83 -85 85 86 87 -88 -88 88 -91 91 92 93 94 95 96 97 98
-99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 -117
--117 117 -120 120 121 122 123 124 125 126 127 128 129 130 131 -132 -132
-132 -134 134 135 136 137 138 139 140 141 142 143 -144 -144 144 -146 146
-147 148 149 150 151 152 153 154 155 156 157 -158 -158 158 -165 165 166 167
-168 169 170 171 172 173 174 -175 -175 175 -177 177 178 179 -180 -180 180
--182 182 183 184 185 186 187 188 189 190 191 192 193 -194 -194 194 -196
-196 197 198 199 -200 -200 200 -202 202 203 204 -205 -205 205 -207 207 208
-209 210 211 212 -213 -213 213 -215 215 216 217 218 219 220 221 -222 -222
-222 -224 224 225 226 -227 -227 227 -230 230 231 232 -233 -233 233 -235 235
-236 237 -238 -238 238 -239 239 240 241 242 243 244 245 246 247 248 249 250
-251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 -267 -267
-267]D
-/HV [1 2 2 2 3 4 5 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 4 5 1 2 2 2 3 4
-5 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 4 5 1 2 2 2 2
-2 2 2 2 2 2 2 2 3 4 5 1 2 2 2 2 2 2 2 2 2 2 3 4 5 1 2 2 2 2 2 2 2 2 2 2
-2 2 3 4 5 1 2 2 2 2 2 2 2 2 2 2 3 4 5 1 2 2 2 3 4 5 1 2 2 2 2 2 2 2 2 2
-2 2 2 3 4 5 1 2 2 2 2 3 4 5 1 2 2 2 3 4 5 1 2 2 2 2 2 2 3 4 5 1 2 2 2 2
-2 2 2 3 4 5 1 2 2 2 3 4 5 1 2 2 2 3 4 5 1 2 2 2 3 4 5 1 2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 4 5]D
-/Cn [3 0 0 1 1 1 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 3 0 0 1 1 1
-0 26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 12 0 0 0
-0 0 0 0 0 0 0 0 1 1 1 0 10 0 0 0 0 0 0 0 0 0 1 1 1 0 12 0 0 0 0 0 0 0 0
-0 0 0 1 1 1 0 10 0 0 0 0 0 0 0 0 0 1 1 1 0 3 0 0 1 1 1 0 12 0 0 0 0 0 0
-0 0 0 0 0 1 1 1 0 4 0 0 0 1 1 1 0 3 0 0 1 1 1 0 6 0 0 0 0 0 1 1 1 0 7 0
-0 0 0 0 0 1 1 1 0 3 0 0 1 1 1 0 3 0 0 1 1 1 0 3 0 0 1 1 1 0 28 0 0 0 0 0
-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0]D
-Hr length 0 gt{[/PageMode /UseOutlines /DOCVIEW pdfmark}if
-/Hn 1 D
-0 1 Hr length 1 sub{
- /Bn E D [Cn Bn get dup 0 gt{/Count E HV Bn get Bl ge{neg}if}{pop}ie
- /Dest Hr Bn get dup abs ST cvs cvn E 0 ge{(h)Hn ST cvs join cvx exec
- dup 1 get E Nf{0 get E join}{pop}ie /Hn Hn 1 add D}{()}ie
- /Title E dup length 255 gt{0 255 getinterval}if /OUT pdfmark}for
-ZF /FN Fp D Ps 0 FS /WC Wf{( )}{<A1A1>}ie SW pop D
-ET RC ZF
-/Df f D
-/R1 (http://hea-www.harvard.edu/saord/ds9/index.html) D
-/R2 (http://hea-www.harvard.edu/saord/xpa/index.html) D
-/R3 (ftp://cfa-ftp.harvard.edu/pub/gsc/WCSTools/home.html) D
-/R4 (http://tdc-www.harvard.edu/software/wcstools/) D
-/R5 (http://hea-www.harvard.edu/RD/funtools/changelog.html) D
-/R6 (http://hea-www.harvard.edu/RD/funtools/changelog_beta.html) D
-/Ba f D /BO 0 D Bs
-/UR (help.html) D
-/Ti (The Funtools Help Facility) D
-/Au () D
-/Df f D
-/ME [()] D
- TC
-
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-
-/Ba f D /BO 0 D Bs
-/UR (help.html) D
-/Ti (The Funtools Help Facility) D
-/Au () D
-/Df f D
-/ME [()] D
- TC
-
-NP RC ZF
-()1 Sl()WB 0 Sn(
-
-
-)0 2 0 H(Funtools:)WB 63 Sn()WB 1 Sn( FITS Users Need Tools)EA()EH(
-
-
-)0 2 1 H(Summary)WB 64 Sn()EH(
-This document is the Table of Contents for Funtools.
-
-
-)0 2 2 H(Description)WB 65 Sn()EH(
-Funtools, is a "minimal buy-in" FITS library and utility package developed
-at the the High Energy Astrophysics Division of SAO. The Funtools
-library provides simplified access to a wide array of file types:
-standard astronomical FITS images and binary tables, raw arrays and
-binary event lists, and even tables of ASCII column data. A
-sophisticated region filtering library \201compatible with ds9\202 filters
-images and tables using boolean operations between geometric shapes,
-support world coordinates, etc. Funtools also supports advanced
-capabilities such as optimized data searching using index files.
-
-The main goal of the Funtools project has been to develop a minimal buy-in
-FITS library for researchers who are occasional \201but serious\202 coders. In
-this case, "minimal buy-in" means "easy to learn, easy to use, and easy to
-re-learn next month". We have tried to achieve this goal by emphasizing two
-essential capabilities. The first is the ability to develop FITS programs
-without knowing much about FITS, i.e., without having to deal with the
-arcane rules for generating a properly formatted FITS file. The second is
-to support the use of already-familiar C/Unix facilities, especially C
-structs and Unix stdio. Taken together, these two capabilities should allow
-researchers to leverage their existing programming expertise while
-minimizing the need to learn new and complex coding rules.
-
-
-)0 P(Choose from the following topics:
-
-)0 P()UL()-1 LI()0 2 1 A(Funtools User Programs)2 1 TN TL()Ec /AF f D(
-)UL()-1 LI()0 3 1 A(funcalc: Funtools calculator \201for binary tables\202)3 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 4 1 A(funcen: find centroid \201for binary tables\202)4 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 5 1 A(funcnts: count photons in specified regions)5 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 6 1 A(funcone: cone search on RA, Dec columns)6 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 7 1 A(fundisp: display data in a Funtools data file)7 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 8 1 A(funhead: display a header in a Funtools file)8 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 9 1 A(funhist: create a 1D histogram of a column)9 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 10 1 A(funimage: create a FITS image from a Funtools data file)10 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 11 1 A(funindex: create an index on a column in a binary table)11 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 12 1 A(funjoin: join two or more FITS binary tables on specified columns)12 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 13 1 A(funmerge: merge one or more Funtools table files)13 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 14 1 A(funsky: convert between image and sky coordinates, using WCS info from a FITS header)14 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 15 1 A(funtable: copy selected rows from a Funtools file to a FITS binary table)15 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 16 1 A(funtbl: extract a table from
-Funtools ASCII output)16 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 17 1 A(funtools and ds9 image display)17 1 TN TL()Ec /AF f D(
-)LU(
-
-)-1 LI()0 18 1 A(Funtools Programming)18 1 TN TL()Ec /AF f D(
-)UL()-1 LI()0 19 1 A(Funtools Programming Summary)19 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 20 1 A(Funtools Programming Tutorial)20 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 21 1 A(A Short Digression on Subroutine Order)21 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 22 1 A(Compiling and Linking)22 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 23 1 A(The Funtools Reference Handle)23 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 24 1 A(The Funtools Programming Reference Manual)24 1 TN TL()Ec /AF f D(
-)UL()-1 LI( )0 25 1 A(FunOpen: open a Funtools file)25 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 26 1 A(FunImageGet: retrieve image data)26 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 27 1 A(FunImagePut: output image data)27 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 28 1 A(FunImageRowGet: retrieve image data by row)28 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 29 1 A(FunImageRowPut: output image data by row)29 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 30 1 A(FunTableRowGet: retrieve rows from a table)30 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 31 1 A(FunTableRowPut: output rows to a table)31 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 32 1 A(FunColumnSelect: select columns in a table for access)32 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 33 1 A(FunColumnActivate: activate columns in a table for read/write)33 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 34 1 A(FunColumnLookup: lookup info about the columns in a table)34 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 35 1 A(FunInfoGet: get info about an image or table)35 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 36 1 A(FunInfoPut: put info about an image or table)36 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 37 1 A(FunParamGet: get header param)37 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 38 1 A(FunParamPut: put header param)38 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 39 1 A(FunFlush: flush I/O in a Funtools file)39 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 40 1 A(FunClose: close a Funtools file)40 1 TN TL()Ec /AF f D(
-)LU(
-
-)-1 LI()0 41 1 A(Funtools Programming Examples)41 1 TN TL()Ec /AF f D(
-
-)UL(
-)-1 LI()0 2 A(evmerge: merge new columns with existing columns)EA(
-)-1 LI()0 2 A(evcols: add column and rows to binary tables)EA(
-)-1 LI()0 2 A(imblank: blank out image values below a threshold)EA()LU()LU(
-
-)-1 LI()0 42 1 A(Funtools Data Files)42 1 TN TL()Ec /AF f D(
-
-)UL(
-)-1 LI()0 43 1 A(Supported Data Formats)43 1 TN TL()Ec /AF f D(
-)UL()-1 LI()0 44 1 A(FITS File and Extensions)44 1 TN TL()Ec /AF f D(
-)-1 LI()0 45 1 A(Non-FITS Raw Event Files)45 1 TN TL()Ec /AF f D(
-)-1 LI()0 46 1 A(Non-FITS Array Files)46 1 TN TL()Ec /AF f D(
-)-1 LI()0 47 1 A(Column-based Text \201ASCII\202 Files)47 1 TN TL()Ec /AF f D(
-)-1 LI()0 48 1 A(Database Views of Tables)48 1 TN TL()Ec /AF f D()LU(
-)-1 LI()0 49 1 A(Image Sections and Blocking)49 1 TN TL()Ec /AF f D(
-)-1 LI()0 50 1 A(Binning FITS Binary Tables and Non-FITS Event Files)EH(
-)-1 LI()0 51 1 A(Disk Files and Other Supported File Types)50 1 TN TL()Ec /AF f D()LU(
-
-)-1 LI(Funtools Data Filtering
-)UL()-1 LI()0 52 1 A(Table Filtering)51 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 53 1 A(Fast Table Filtering using Indexes)52 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 54 1 A(Spatial Region Filtering)53 1 TN TL()Ec /AF f D(
-
-)UL()-1 LI()0 55 1 A(Region Geometry)54 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 56 1 A(Region Algebra)55 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 57 1 A(Region Coordinates)56 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 58 1 A(Region Boundaries)57 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 59 1 A(Differences Between Funtools and IRAF Regions)58 1 TN TL()Ec /AF f D(
-)LU(
-)-1 LI()0 60 1 A(Combining Table and Region Filters)59 1 TN TL()Ec /AF f D(
-)LU(
-
-)-1 LI( Miscellaneous
-)UL()-1 LI()0 61 1 A(Funtools Environment Variables)60 1 TN TL()Ec /AF f D(
-
-)-1 LI()0 62 1 A(Funtools ChangeLog)61 1 TN TL()Ec /AF f D()LU(
-)LU(
-
-
-
-)0 5 3 H(Last)WB 66 Sn( updated: January 6, 2006)EH(
-
-
-)WB NL NP Ep ET /Tc f D
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (programs.html) D
-/Ti (Funtools Programs) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 2 Sn(
-)0 2 4 H(Funtools)WB 67 Sn( Programs)EH(
-
-)0 2 5 H(Summary)WB 68 Sn()EH(
-
-)0 P() 27 129 PR()0 3 1 A(funcalc)3 0 TN TL()Ec /AF f D( [-n] [-a argstr] [-e expr] [-f file] [-l link] [-p prog] [-u] <iname> [oname [columns]]
-
-)0 4 1 A(funcen)4 0 TN TL()Ec /AF f D( [-i] [-n iter] [-t tol] [-v lev] <iname> <region>
-
-)0 5 1 A(funcnts)5 0 TN TL()Ec /AF f D( [switches] <source_file> [source_region] [bkgd_file] [bkgd_region|bkgd_cnts]
-
-)0 6 1 A(funcone)6 0 TN TL()Ec /AF f D( [-n] [-x|-X|-j|-J] [[-l|-L] list] [-r ra_col] [-d dec_col] <iname> <oname> <ra[hdr]> <dec[hdr]> <radius[dr'"]> [columns]
-
-)0 7 1 A(fundisp)7 0 TN TL()Ec /AF f D( [-f format] [-l] [-n] [-T] <iname> [columns|bitpix=n]
-
-)0 8 1 A(funhead)8 0 TN TL()Ec /AF f D( [-a] [-l] [-s] [-t] [-L] <iname> [oname ename]
-
-)0 9 1 A(funhist)9 0 TN TL()Ec /AF f D( [-n|-w|-T] <iname> [column] [[lo_edge:hi_edge:]bins]
-
-)0 10 1 A(funimage)10 0 TN TL()Ec /AF f D( [-a] [-l] [-p x|y] <iname> <oname> [bitpix=n]
-
-)0 11 1 A(funindex)11 0 TN TL()Ec /AF f D( <iname> <key> [oname]
-
-)0 12 1 A(funjoin)12 0 TN TL()Ec /AF f D( [switches] <ifile1> <ifile2> ... <ifilen> <ofile>
-
-)0 13 1 A(funmerge)13 0 TN TL()Ec /AF f D( <iname1> <iname2> ... <oname>
-
-)0 14 1 A(funsky)14 0 TN TL()Ec /AF f D( [switches] <iname1> [<lname2> <col1> <col2>]
-
-)0 15 1 A(funtable)15 0 TN TL()Ec /AF f D( [-a] [-i|-z] [-m] [-s cols] <iname> <oname> [columns]
-
-)0 16 1 A(funtbl)16 0 TN TL()Ec /AF f D( [-c cols] [-h] [-n table] [-p prog] [-s sep] [-T] <iname>)RP(
-
-
-
-
-)0 2 6 H(funcalc)WB 69 Sn()WB 3 Sn( - Funtools calculator \201for binary tables\202)EA()EH(
-
-)BD() 1 90 PR(funcalc [-n] [-a argstr] [-e expr] [-f file] [-l link] [-p prog] <iname> [oname [columns]])RP()ES(
-
-
-)0 P() 7 73 PR( -a argstr # user arguments to pass to the compiled program
- -e expr # funcalc expression
- -f file # file containing funcalc expression
- -l libs # libs to add to link command
- -n # output generated code instead of compiling and executing
- -p prog # generate named program, no execution
- -u # die if any variable is undeclared \201don't auto-declare\202)RP(
-
-
-)0 P()BD(funcalc)ES( is a calculator program that allows arbitrary
-expressions to be constructed, compiled, and executed on columns in a
-Funtools table \201FITS binary table or raw event file\202. It works by
-integrating user-supplied expression\201s\202 into a template C program,
-then compiling and executing the program. )BD(funcalc)ES( expressions
-are C statements, although some important simplifications \201such
-as automatic declaration of variables\202 are supported.
-
-)0 P()BD(funcalc)ES( expressions can be specified in three ways: on the
-command line using the )BD(-e [expression])ES( switch, in a file using
-the )BD(-f [file])ES( switch, or from stdin \201if neither )BD(-e)ES( nor
-)BD(-f)ES( is specified\202. Of course a file containing )BD(funcalc)ES(
-expressions can be read from stdin.
-
-)0 P(Each invocation of )BD(funcalc)ES( requires an input Funtools table
-file to be specified as the first command line argument. The output
-Funtools table file is the second optional argument. It is needed only
-if an output FITS file is being created \201i.e., in cases where the
-)BD(funcalc)ES( expression only prints values, no output file is
-needed\202. If input and output file are both specified, a third optional
-argument can specify the list of columns to activate \201using
-)0 33 1 A(FunColumnActivate\201\202)33 0 TN TL()Ec /AF f D(\202. Note
-that )BD(funcalc)ES( determines whether or not to generate code for
-writing an output file based on the presence or absence of an
-output file argument.
-
-)0 P(A )BD(funcalc)ES( expression executes on each row of a table and
-consists of one or more C statements that operate on the columns of
-that row \201possibly using temporary variables\202. Within an expression,
-reference is made to a column of the )BD(current)ES( row using the C
-struct syntax )BD(cur->[colname])ES(, e.g. cur->x, cur->pha, etc.
-Local scalar variables can be defined using C declarations at very the
-beginning of the expression, or else they can be defined automatically
-by )BD(funcalc)ES( \201to be of type double\202. Thus, for example, a swap of
-columns x and y in a table can be performed using either of the
-following equivalent )BD(funcalc)ES( expressions:
-
-) 4 18 PR( double temp;
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;)RP(
-
-or:
-
-) 3 18 PR( temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;)RP(
-
-When this expression is executed using a command such as:
-) 1 40 PR( funcalc -f swap.expr itest.ev otest.ev)RP(
-the resulting file will have values of the x and y columns swapped.
-
-)0 P(By default, the data type of the variable for a column is the same as
-the data type of the column as stored in the file. This can be changed
-by appending ":[dtype]" to the first reference to that column. In the
-example above, to force x and y to be output as doubles, specify the
-type 'D' explicitly:
-) 3 20 PR( temp = cur->x:D;
- cur->x = cur->y:D;
- cur->y = temp;)RP(
-
-Data type specifiers follow standard FITS table syntax for defining
-columns using TFORM:
-)UL()-1 LI(A: ASCII characters
-)-1 LI(B: unsigned 8-bit char
-)-1 LI(I: signed 16-bit int
-)-1 LI(U: unsigned 16-bit int \201not standard FITS\202
-)-1 LI(J: signed 32-bit int
-)-1 LI(V: unsigned 32-bit int \201not standard FITS\202
-)-1 LI(E: 32-bit float
-)-1 LI(D: 64-bit float
-)-1 LI(X: bits \201treated as an array of chars\202)LU(
-Note that only the first reference to a column should contain the
-explicit data type specifier.
-
-)0 P(Of course, it is important to handle the data type of the columns
-correctly. One of the most frequent cause of error in )BD(funcalc)ES(
-programming is the implicit use of the wrong data type for a column in
-expression. For example, the calculation:
-) 1 43 PR( dx = \201cur->x - cur->y\202/\201cur->x + cur->y\202;)RP(
-usually needs to be performed using floating point arithmetic. In
-cases where the x and y columns are integers, this can be done by
-reading the columns as doubles using an explicit type specification:
-) 1 47 PR( dx = \201cur->x:D - cur->y:D\202/\201cur->x + cur->y\202;)RP(
-
-Alternatively, it can be done using C type-casting in the expression:
-) 1 75 PR( dx = \201\201double\202cur->x - \201double\202cur->y\202/\201\201double\202cur->x + \201double\202cur->y\202;)RP(
-
-)0 P(In addition to accessing columns in the current row, reference also
-can be made to the )BD(previous)ES( row using )BD(prev->[colname])ES(,
-and to the )BD(next)ES( row using )BD(next->[colname])ES(. Note that if
-)BD(prev->[colname])ES( is specified in the )BD(funcalc)ES(
-expression, the very first row is not processed. If
-)BD(next->[colname])ES( is specified in the )BD(funcalc)ES(
-expression, the very last row is not processed. In this way,
-)BD(prev)ES( and )BD(next)ES( are guaranteed always to point to valid
-rows. For example, to print out the values of the current x column
-and the previous y column, use the C fprintf function in a
-)BD(funcalc)ES( expression:
-) 1 46 PR( fprintf\201stdout, "%d %d\200n", cur->x, prev->y\202;)RP(
-
-)0 P(New columns can be specified using the same )BD(cur->[colname])ES(
-syntax by appending the column type \201and optional tlmin/tlmax/binsiz
-specifiers\202, separated by colons. For example, cur->avg:D will define
-a new column of type double. Type specifiers are the same those
-used above to specify new data types for existing columns.
-
-)0 P(For example, to create and output a new column that is the average value of the
-x and y columns, a new "avg" column can be defined:
-) 1 36 PR( cur->avg:D = \201cur->x + cur->y\202/2.0)RP(
-Note that the final ';' is not required for single-line expressions.
-
-)0 P(As with FITS TFORM data type specification, the column data type
-specifier can be preceded by a numeric count to define an array, e.g.,
-"10I" means a vector of 10 short ints, "2E" means two single precision
-floats, etc. A new column only needs to be defined once in a
-)BD(funcalc)ES( expression, after which it can be used without
-re-specifying the type. This includes reference to elements of a
-column array:
-
-) 2 41 PR( cur->avg[0]:2D = \201cur->x + cur->y\202/2.0;
- cur->avg[1] = \201cur->x - cur->y\202/2.0;)RP(
-
-)0 P(The 'X' \201bits\202 data type is treated as a char array of dimension
-\201numeric_count/8\202, i.e., 16X is processed as a 2-byte char array. Each
-8-bit array element is accessed separately:
-) 2 24 PR( cur->stat[0]:16X = 1;
- cur->stat[1] = 2;)RP(
-Here, a 16-bit column is created with the MSB is set to 1 and the LSB set to 2.
-
-)0 P(By default, all processed rows are written to the specified output
-file. If you want to skip writing certain rows, simply execute the C
-"continue" statement at the end of the )BD(funcalc)ES( expression,
-since the writing of the row is performed immediately after the
-expression is executed. For example, to skip writing rows whose
-average is the same as the current x value:
-
-) 4 41 PR( cur->avg[0]:2D = \201cur->x + cur->y\202/2.0;
- cur->avg[1] = \201cur->x - cur->y\202/2.0;
- if\201 cur->avg[0] == cur->x \202
- continue;)RP(
-
-)0 P(If no output file argument is specified on the )BD(funcalc)ES( command
-line, no output file is opened and no rows are written. This is useful
-in expressions that simply print output results instead of generating
-a new file:
-) 5 73 PR( fpv = \201cur->av3:D-cur->av1:D\202/\201cur->av1+cur->av2:D+cur->av3\202;
- fbv = cur->av2/\201cur->av1+cur->av2+cur->av3\202;
- fpu = \201\201double\202cur->au3-cur->au1\202/\201\201double\202cur->au1+cur->au2+cur->au3\202;
- fbu = cur->au2/\201double\202\201cur->au1+cur->au2+cur->au3\202;
- fprintf\201stdout, "%f\200t%f\200t%f\200t%f\200n", fpv, fbv, fpu, fbu\202;)RP(
-In the above example, we use both explicit type specification
-\201for "av" columns\202 and type casting \201for "au" columns\202 to ensure that
-all operations are performed in double precision.
-
-)0 P(When an output file is specified, the selected input table is
-processed and output rows are copied to the output file. Note that
-the output file can be specified as "stdout" in order to write the
-output rows to the standard output. If the output file argument is
-passed, an optional third argument also can be passed to specify which
-columns to process.
-
-)0 P(In a FITS binary table, it sometimes is desirable to copy all of the
-other FITS extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. See )BD(funtable)ES( for a related example.
-
-)0 P()BD(funcalc)ES( works by integrating the user-specified expression
-into a template C program called )0 2 A(tabcalc.c)EA(.
-The completed program then is compiled and executed. Variable
-declarations that begin the )BD(funcalc)ES( expression are placed in
-the local declaration section of the template main program. All other
-lines are placed in the template main program's inner processing
-loop. Other details of program generation are handled
-automatically. For example, column specifiers are analyzed to build a
-C struct for processing rows, which is passed to
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( and used
-in )0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D(. If
-an unknown variable is used in the expression, resulting in a
-compilation error, the program build is retried after defining the
-unknown variable to be of type double.
-
-)0 P(Normally, )BD(funcalc)ES( expression code is added to
-)BD(funcalc)ES( row processing loop. It is possible to add code
-to other parts of the program by placing this code inside
-special directives of the form:
-) 3 26 PR( [directive name]
- ... code goes here ...
- end)RP(
-
-The directives are:
-)UL()-1 LI()BD(global)ES( add code and declarations in global space, before the main routine.
-
-)-1 LI()BD(local)ES( add declarations \201and code\202 just after the local declarations in
-main
-
-)-1 LI()BD(before)ES( add code just before entering the main row processing loop
-
-)-1 LI()BD(after)ES( add code just after exiting the main row processing loop)LU(
-
-Thus, the following )BD(funcalc)ES( expression will declare global
-variables and make subroutine calls just before and just after the
-main processing loop:
-) 16 62 PR( global
- double v1, v2;
- double init\201void\202;
- double finish\201double v\202;
- end
- before
- v1 = init\201\202;
- end
- ... process rows, with calculations using v1 ...
- after
- v2 = finish\201v1\202;
- if\201 v2 < 0.0 \202{
- fprintf\201stderr, "processing failed %g -> %g\200n", v1, v2\202;
- exit\2011\202;
- }
- end)RP(
-Routines such as init\201\202 and finish\201\202 above are passed to the generated
-program for linking using the )BD(-l [link directives ...])ES(
-switch. The string specified by this switch will be added to the link
-line used to build the program \201before the funtools library\202. For
-example, assuming that init\201\202 and finish\201\202 are in the library
-libmysubs.a in the /opt/special/lib directory, use:
-) 1 47 PR( funcalc -l "-L/opt/special/lib -lmysubs" ...)RP(
-
-)0 P(User arguments can be passed to a compiled funcalc program using a string
-argument to the "-a" switch. The string should contain all of the
-user arguments. For example, to pass the integers 1 and 2, use:
-) 1 22 PR( funcalc -a "1 2" ...)RP(
-The arguments are stored in an internal array and are accessed as
-strings via the ARGV\201n\202 macro. For example, consider the following
-expression:
-) 11 60 PR( local
- int pmin, pmax;
- end
-
- before
- pmin=atoi\201ARGV\2010\202\202;
- pmax=atoi\201ARGV\2011\202\202;
- end
-
- if\201 \201cur->pha >= pmin\202 && \201cur->pha <= pmax\202 \202
- fprintf\201stderr, "%d %d %d\200n", cur->x, cur->y, cur->pha\202;)RP(
-This expression will print out x, y, and pha values for all rows in which
-the pha value is between the two user-input values:
-) 11 51 PR( funcalc -a '1 12' -f foo snr.ev'[cir 512 512 .1]'
- 512 512 6
- 512 512 8
- 512 512 5
- 512 512 5
- 512 512 8
-
- funcalc -a '5 6' -f foo snr.ev'[cir 512 512 .1]'
- 512 512 6
- 512 512 5
- 512 512 5)RP(
-
-)0 P(Note that it is the user's responsibility to ensure that the correct
-number of arguments are passed. The ARGV\201n\202 macro returns a NULL if a
-requested argument is outside the limits of the actual number of args,
-usually resulting in a SEGV if processed blindly. To check the
-argument count, use the ARGC macro:
-) 12 42 PR( local
- long int seed=1;
- double limit=0.8;
- end
-
- before
- if\201 ARGC >= 1 \202 seed = atol\201ARGV\2010\202\202;
- if\201 ARGC >= 2 \202 limit = atof\201ARGV\2011\202\202;
- srand48\201seed\202;
- end
-
- if \201 drand48\201\202 > limit \202 continue;)RP(
-
-)0 P(The macro WRITE_ROW expands to the FunTableRowPut\201\202 call that writes
-the current row. It can be used to write the row more than once. In
-addition, the macro NROW expands to the row number currently being
-processed. Use of these two macros is shown in the following example:
-) 7 41 PR( if\201 cur->pha:I == cur->pi:I \202 continue;
- a = cur->pha;
- cur->pha = cur->pi;
- cur->pi = a;
- cur->AVG:E = \201cur->pha+cur->pi\202/2.0;
- cur->NR:I = NROW;
- if\201 NROW < 10 \202 WRITE_ROW;)RP(
-
-)0 P(If the )BD(-p [prog])ES( switch is specified, the expression is not
-executed. Rather, the generated executable is saved with the specified
-program name for later use.
-
-)0 P(If the )BD(-n)ES( switch is specified, the expression is not
-executed. Rather, the generated code is written to stdout. This is
-especially useful if you want to generate a skeleton file and add your
-own code, or if you need to check compilation errors. Note that the
-comment at the start of the output gives the compiler command needed
-to build the program on that platform. \201The command can change from
-platform to platform because of the use of different libraries,
-compiler switches, etc.\202
-
-)0 P(As mentioned previously, )BD(funcalc)ES( will declare a scalar
-variable automatically \201as a double\202 if that variable has been used
-but not declared. This facility is implemented using a sed script
-named )0 2 A(funcalc.sed)EA(, which processes the
-compiler output to sense an undeclared variable error. This script
-has been seeded with the appropriate error information for gcc, and for
-cc on Solaris, DecAlpha, and SGI platforms. If you find that automatic
-declaration of scalars is not working on your platform, check this sed
-script; it might be necessary to add to or edit some of the error
-messages it senses.
-
-)0 P(In order to keep the lexical analysis of )BD(funcalc)ES( expressions
-\201reasonably\202 simple, we chose to accept some limitations on how
-accurately C comments, spaces, and new-lines are placed in the
-generated program. In particular, comments associated with local
-variables declared at the beginning of an expression \201i.e., not in a
-)BD(local...end)ES( block\202 will usually end up in the inner loop, not
-with the local declarations:
-) 8 69 PR( /* this comment will end up in the wrong place \201i.e, inner loop\202 */
- double a; /* also in wrong place */
- /* this will be in the the right place \201inner loop\202 */
- if\201 cur->x:D == cur->y:D \202 continue; /* also in right place */
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- cur->avg:E = \201cur->x+cur->y\202/2.0;)RP(
-Similarly, spaces and new-lines sometimes are omitted or added in a
-seemingly arbitrary manner. Of course, none of these stylistic
-blemishes affect the correctness of the generated code.
-
-)0 P(Because )BD(funcalc)ES( must analyze the user expression using the data
-file\201s\202 passed on the command line, the input file\201s\202 must be opened
-and read twice: once during program generation and once during
-execution. As a result, it is not possible to use stdin for the
-input file: )BD(funcalc)ES( cannot be used as a filter. We will
-consider removing this restriction at a later time.
-
-)0 P(Along with C comments, )BD(funcalc)ES( expressions can have one-line
-internal comments that are not passed on to the generated C
-program. These internal comment start with the )BD(#)ES( character and
-continue up to the new-line:
-) 7 56 PR( double a; # this is not passed to the generated C file
- # nor is this
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- /* this comment is passed to the C file */
- cur->avg:E = \201cur->x+cur->y\202/2.0;)RP(
-
-)0 P(As previously mentioned, input columns normally are identified by
-their being used within the inner event loop. There are rare cases
-where you might want to read a column and process it outside the main
-loop. For example, qsort might use a column in its sort comparison
-routine that is not processed inside the inner loop \201and therefore not
-implicitly specified as a column to be read\202. To ensure that such a
-column is read by the event loop, use the )BD(explicit)ES( keyword.
-The arguments to this keyword specify columns that should be read into
-the input record structure even though they are not mentioned in the
-inner loop. For example:
- ) 1 17 PR( explicit pi pha)RP(
-will ensure that the pi and pha columns are read for each row,
-even if they are not processed in the inner event loop. The )BD(explicit)ES(
-statement can be placed anywhere.
-
-)0 P(Finally, note that )BD(funcalc)ES( currently works on expressions
-involving FITS binary tables and raw event files. We will consider
-adding support for image expressions at a later point, if there is
-demand for such support from the community.
-
-
-
-
-)0 2 7 H(funcen)WB 70 Sn()WB 4 Sn( - find centroid \201for binary tables\202)EA()EH(
-
-)BD() 1 56 PR(funcen [-i] [-n iter] [-t tol] [-v lev] <iname> <region>)RP()ES(
-
-
-)0 P() 4 64 PR( -i # use image filtering \201default: event filtering\202
- -n iter # max number of iterations \201default: 0\202
- -t tol # pixel tolerance distance \201default: 1.0\202
- -v [0,1,2,3] # output verbosity level \201default: 0\202)RP(
-
-
-)0 P()BD(funcen)ES( iteratively calculates the centroid position within one
-or more regions of a Funtools table \201FITS binary table or raw event
-file\202. Starting with an input table, an initial region specification,
-and an iteration count, the program calculates the average x and y
-position within the region and then uses this new position as the
-region center for the next iteration. Iteration terminates when the
-maximum number of iterations is reached or when the input tolerance
-distance is met for that region. A count of events in the final region
-is then output, along with the pixel position value \201and, where
-available, WCS position\202.
-
-)0 P(The first argument to the program specifies the Funtools table file to
-process. Since the file must be read repeatedly, a value of "stdin"
-is not permitted when the number of iterations is non-zero. Use
-)0 42 1 A(Funtools Bracket Notation)42 0 TN TL()Ec /AF f D( to specify FITS
-extensions and filters.
-
-)0 P(The second required argument is the initial region descriptor. Multiple
-regions are permitted. However, compound regions \201accelerators,
-variable argument regions and regions connected via boolean algebra\202
-are not permitted. Points and polygons also are illegal. These
-restrictions might be lifted in a future version, if warranted.
-
-)0 P(The )BD(-n)ES( \201iteration number\202 switch specifies the maximum number of
-iterations to perform. The default is 0, which means that the program will
-simply count and display the number of events in the initial region\201s\202.
-Note that when iterations is 0, the data can be input via stdin.
-
-)0 P(The )BD(-t)ES( \201tolerance\202 switch specifies a floating point tolerance
-value. If the distance between the current centroid position value and
-the last position values is less than this value, iteration terminates.
-The default value is 1 pixel.
-
-)0 P(The )BD(-v)ES( \201verbosity\202 switch specifies the verbosity level of the
-output. The default is 0, which results in a single line of output for
-each input region consisting of the following values:
-) 1 30 PR( counts x y [ra dec coordsys])RP(
-The last 3 WCS values are output if WCS information is available in the
-data file header. Thus, for example:
-) 5 47 PR( [sh] funcen -n 0 snr.ev "cir 505 508 5"
- 915 505.00 508.00 345.284038 58.870920 j2000
-
- [sh] funcen -n 3 snr.ev "cir 505 508 5"
- 1120 504.43 509.65 345.286480 58.874587 j2000)RP(
-The first example simply counts the number of events in the initial region.
-The second example iterates the centroid calculation three times to determine
-a final "best" position.
-
-)0 P(
-Higher levels of verbosity obviously imply more verbose output. At
-level 1, the output essentially contains the same information as level
-0, but with keyword formatting:
-
- [sh] funcen -v 1 -n 3 snr.ev "cir 505 508 5"
- event_file: snr.ev
- initial_region: cir 505 508 5
- tolerance: 1.0000
- iterations: 1
-
- events: 1120
- x,y\201physical\202: 504.43 509.65
- ra,dec\201j2000\202: 345.286480 58.874587
- final_region1: cir 504.43 509.65 5)RP(
-Level 2 outputs results from intermediate calculations as well.
-
-)0 P(Ordinarily, region filtering is performed using analytic \201event\202
-filtering, i.e. that same style of filtering as is performed by
-)BD(fundisp)ES( and )BD(funtable)ES(. Use the )BD(-i)ES( switch to specify image
-filtering, i.e. the same style filtering as is performed by )BD(funcnts)ES(.
-Thus, you can perform a quick calculation of counts in regions, using
-either the analytic or image filtering method, by specifying the
- )BD(-n 0)ES( and optional )BD(-i)ES( switches. These two method often
-give different results because of how boundary events are processed:
-) 5 46 PR( [sh] funcen snr.ev "cir 505 508 5"
- 915 505.00 508.00 345.284038 58.870920 j2000
-
- [sh] funcen -i snr.ev "cir 505 508 5"
- 798 505.00 508.00 345.284038 58.870920 j2000)RP(
-See )0 58 1 A(Region Boundaries)58 0 TN TL()Ec /AF f D( for more information
-about how boundaries are calculated using these two methods.
-
-
-
-
-)0 2 8 H(funcnts)WB 71 Sn()WB 5 Sn( - count photons in specified regions, with bkgd subtraction)EA()EH(
-
-
-)BD() 1 86 PR(funcnts [switches] <source_file> [source_region] [bkgd_file] [bkgd_region|bkgd_value])RP()ES(
-
-
-)0 P() 16 79 PR( -e "source_exposure[;bkgd_exposure]"
- # source \201bkgd\202 FITS exposure image using matching files
- -w "source_exposure[;bkgd_exposure]"
- # source \201bkgd\202 FITS exposure image using WCS transform
- -t "source_timecorr[;bkgd_timecorr]"
- # source \201bkgd\202 time correction value or header parameter name
- -g # output using nice g format
- -G # output using %.14g format \201maximum precision\202
- -i "[column;]int1;int2..." # column-based intervals
- -m # match individual source and bkgd regions
- -p # output in pixels, even if wcs is present
- -r # output inner/outer radii \201and angles\202 for annuli \201and pandas\202
- -s # output summed values
- -v "scol[;bcol]" # src and bkgd value columns for tables
- -T # output in starbase/rdb format
- -z # output regions with zero area)ES()RP(
-
-
-)0 P()BD(funcnts)ES( counts photons in the specified source regions and
-reports the results for each region. Regions are specified using the
-)0 54 1 A(Spatial Region Filtering)54 0 TN TL()Ec /AF f D( mechanism.
-Photons are also counted in the specified bkgd regions applied to the
-same data file or a different data file. \201Alternatively, a constant
-background value in counts/pixel**2 can be specified.\202 The bkgd regions
-are either paired one-to-one with source regions or pooled and
-normalized by area, and then subtracted from the source counts in each
-region. Displayed results include the bkgd-subtracted counts in each
-region, as well as the error on the counts, the area in
-each region, and the surface brightness \201cnts/area**2\202 calculated for
-each region.
-
-)0 P(The first argument to the program specifies the FITS input image, array, or
-raw event file to process. If "stdin" is specified, data are read from
-the standard input. Use )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions, image sections, and filters.
-
-)0 P(The optional second argument is the source region descriptor. If no
-region is specified, the entire field is used.
-
-)0 P(The background arguments can take one of two forms, depending on
-whether a separate background file is specified. If the source
-file is to be used for background as well, the third argument can be
-either the background region, or a constant value denoting background
-cnts/pixel. Alternatively, the third argument can be a background
-data file, in which case the fourth argument is the background region.
-If no third argument is specified, a constant value of 0 is used
-\201i.e., no background\202.
-
-)0 P(In summary, the following command arguments are valid:
-) 5 77 PR( [sh] funcnts sfile # counts in source file
- [sh] funcnts sfile sregion # counts in source region
- [sh] funcnts sfile sregion bregion # bkgd reg. is from source file
- [sh] funcnts sfile sregion bvalue # bkgd reg. is constant
- [sh] funcnts sfile sregion bfile bregion # bkgd reg. is from separate file)RP(
-
-)0 P(NB: unlike other Funtools programs, source and background regions are
-specified as separate arguments on the command line, rather than being
-placed inside brackets as part of the source and background filenames.
-This is because regions in funcnts are not simply used as data
-filters, but also are used to calculate areas, exposure, etc. If you
-put the source region inside the brackets \201i.e. use it simply as a
-filter\202 rather than specifying it as argument two, the program still
-will only count photons that pass the region filter. However, the area
-calculation will be performed on the whole field, since field\201\202 is the
-default source region. This rarely is the desired behavior. On the
-other hand, with FITS binary tables, it often is useful to put a column
-filter in the filename brackets, so that only events matching the
-column filter are counted inside the region.
-
-)0 P(For example, to extract the counts within a radius of 22 pixels from the
-center of the FITS binary table snr.ev and subtract the background determined
-from the same image within an annulus of radii 50-100 pixels:
-) 33 82 PR( [sh] funcnts snr.ev "circle\201502,512,22\202" "annulus\201502,512,50,100\202"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-
-
- # the following source and background components were used:
- source region\201s\202
- ----------------
- circle\201502,512,22\202
-
- reg counts pixels
- ---- ------------ ---------
- 1 4382.000 1513
-
- background region\201s\202
- --------------------
- annulus\201502,512,50,100\202
-
- reg counts pixels)WR(
- ---- ------------ ---------
- all 8656.000 23572)RP(
-The area units for the output columns labeled "area", "surf_bri"
-\201surface brightness\202 and "surf_err" will be given either in
-arc-seconds \201if appropriate WCS information is in the data file
-header\201s\202\202 or in pixels. If the data file has WCS info, but you do not
-want arc-second units, use the )BD(-p)ES( switch to force output in
-pixels. Also, regions having zero area are not normally included in
-the primary \201background-subtracted\202 table, but are included in the
-secondary source and bkgd tables. If you want these regions to be
-included in the primary table, use the )BD(-z)ES( switch.
-
-)0 P(Note that a simple sed command will extract the background-subtracted results
-for further analysis:
-) 6 79 PR( [sh] cat funcnts.sed
- 1,/---- .*/d
- /^$/,$d
-
- [sh] sed -f funcnts.sed funcnts.out
- 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001)RP(
-
-)0 P(If separate source and background files are specified, )BD(funcnts)ES( will
-attempt to normalize the the background area so that the background
-pixel size is the same as the source pixel size. This normalization
-can only take place if the appropriate WCS information is contained in
-both files \201e.g. degrees/pixel values in CDELT\202. If either
-file does not contain the requisite size information, the normalization
-is not performed. In this case, it is the user's responsibility to
-ensure that the pixel sizes are the same for the two files.
-
-)0 P(Normally, if more than one background region is specified, )BD(funcnts)ES(
-will combine them all into a single region and use this background
-region to produce the background-subtracted results for each source
-region. The )BD(-m)ES( \201match multiple backgrounds\202 switch tells
-)BD(funcnts)ES( to make a one to one correspondence between background and
-source regions, instead of using a single combined background region.
-For example, the default case is to combine 2 background
-regions into a single region and then apply that region to each of the
-source regions:
-
-) 35 82 PR( [sh] funcnts snr.ev "annulus\201502,512,0,22,n=2\202" "annulus\201502,512,50,100,n=2\202"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002
- 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000
-
-
- # the following source and background components were used:
- source region\201s\202
- ----------------
- annulus\201502,512,0,22,n=2\202
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region\201s\202
- --------------------
- annulus\201502,512,50,100,n=2\202)WR(
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572)RP(
-Note that the basic region filter rule "each photon is counted once
-and no photon is counted more than once" still applies when using The
-)BD(-m)ES( to match background regions. That is, if two background
-regions overlap, the overlapping pixels will be counted in only one of
-them. In a worst-case scenario, if two background regions are the same
-region, the first will get all the counts and area and the second
-will get none.
-
-)0 P(Using the )BD(-m)ES( switch causes )BD(funcnts)ES( to use each of the two
-background regions independently with each of the two source regions:
-
-) 36 82 PR( [sh] funcnts -m snr.ev "annulus\201502,512,0,22,n=2\202" "ann\201502,512,50,100,n=2\202"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3087.015 56.954 150.985 2.395 23872.00 0.129 0.002
- 2 755.959 34.295 388.041 5.672 72959.99 0.010 0.000
-
-
- # the following source and background components were used:
- source region\201s\202
- ----------------
- annulus\201502,512,0,22,n=2\202
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region\201s\202
- --------------------
- ann\201502,512,50,100,n=2\202)WR(
-
- reg counts pixels
- ---- ------------ ---------
- 1 3975.000 9820
- 2 4681.000 13752)RP(
-
-)0 P(Note that most floating point quantities are displayed using "f"
-format. You can change this to "g" format using the )BD(-g)ES(
-switch. This can be useful when the counts in each pixel is very
-small or very large. If you want maximum precision and don't care
-about the columns lining up nicely, use )BD(-G)ES(, which outputs
-all floating values as %.14g.
-
-)0 P(When counting photons using the annulus and panda \201pie and annuli\202
-shapes, it often is useful to have access to the radii \201and panda
-angles\202 for each separate region. The )BD(-r)ES( switch will add radii
-and angle columns to the output table:
-
-) 37 122 PR( [sh] funcnts -r snr.ev "annulus\201502,512,0,22,n=2\202" "ann\201502,512,50,100,n=2\202"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
- # radii: arcsecs
- # angles: degrees
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err radius1 radius2 angle1 angle2
- ---- ------------ --------- ------------ --------- --------- --------- --------- --------- --------- --------- ---------
- 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002 0.00 88.00 NA NA
- 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000 88.00 176.00 NA NA
-
-
- # the following source and background components were used:
- source region\201s\202
- ----------------
- annulus\201502,512,0,22,n=2\202
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region\201s\202)WR(
- --------------------
- ann\201502,512,50,100,n=2\202
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572)RP(
-
-)0 P(Radii are given in units of pixels or arc-seconds \201depending on the
-presence of WCS info\202, while the angle values \201when present\202 are in
-degrees. These columns can be used to plot radial profiles. For
-example, the script )BD(funcnts.plot)ES( in the funtools
-distribution\202 will plot a radial profile using gnuplot \201version 3.7 or
-above\202. A simplified version of this script is shown below:
-
-) 74 79 PR( #!/bin/sh
-
- if [ x"$1" = xgnuplot ]; then
- if [ x`which gnuplot 2>/dev/null` = x ]; then
- echo "ERROR: gnuplot not available"
- exit 1
- fi
- awk '
- BEGIN{HEADER=1; DATA=0; FILES=""; XLABEL="unknown"; YLABEL="unknown"}
- HEADER==1{
- if\201 $1 == "#" && $2 == "data" && $3 == "file:" \202{
- if\201 FILES != "" \202 FILES = FILES ","
- FILES = FILES $4
- }
- else if\201 $1 == "#" && $2 == "radii:" \202{
- XLABEL = $3
- }
- else if\201 $1 == "#" && $2 == "surf_bri:" \202{
- YLABEL = $3
- }
- else if\201 $1 == "----" \202{
- printf "set nokey; set title \200"funcnts\201%s\202\200"\200n", FILES
- printf "set xlabel \200" radius\201%s\202\200"\200n", XLABEL
- printf "set ylabel \200"surf_bri\201%s\202\200"\200n", YLABEL
- print "plot \200"-\200" using 3:4:6:7:8 with boxerrorbars"
- HEADER = 0
- DATA = 1
- next
- }
- }
- DATA==1{)WR(
- if\201 NF == 12 \202{
- print $9, $10, \201$9+$10\202/2, $7, $8, $7-$8, $7+$8, $10-$9
- }
- else{
- exit
- }
- }
- ' | gnuplot -persist - 1>/dev/null 2>&1
-
- elif [ x"$1" = xds9 ]; then
- awk '
- BEGIN{HEADER=1; DATA=0; XLABEL="unknown"; YLABEL="unknown"}
- HEADER==1{
- if\201 $1 == "#" && $2 == "data" && $3 == "file:" \202{
- if\201 FILES != "" \202 FILES = FILES ","
- FILES = FILES $4
- }
- else if\201 $1 == "#" && $2 == "radii:" \202{
- XLABEL = $3
- }
- else if\201 $1 == "#" && $2 == "surf_bri:" \202{
- YLABEL = $3
- }
- else if\201 $1 == "----" \202{
- printf "funcnts\201%s\202 radius\201%s\202 surf_bri\201%s\202 3\200n", FILES, XLABEL, YLABEL
- HEADER = 0
- DATA = 1
- next
- }
- })WR(
- DATA==1{
- if\201 NF == 12 \202{
- print $9, $7, $8
- }
- else{
- exit
- }
- }
- '
- else
- echo "funcnts -r ... | funcnts.plot [ds9|gnuplot]"
- exit 1
- fi)RP(
-
-Thus, to run )BD(funcnts)ES( and plot the results using gnuplot \201version 3.7
-or above\202, use:
-) 1 75 PR( funcnts -r snr.ev "annulus\201502,512,0,50,n=5\202" ... | funcnts.plot gnuplot)RP(
-
-)0 P(The )BD(-s)ES( \201sum\202 switch causes )BD(funcnts)ES( to produce an
-additional table of summed \201integrated\202 background subtracted values,
-along with the default table of individual values:
-
-) 51 82 PR( [sh] funcnts -s snr.ev "annulus\201502,512,0,50,n=5\202" "annulus\201502,512,50,100\202"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # summed background-subtracted results
- upto net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
- 2 3776.817 65.254 457.183 4.914 79679.98 0.047 0.001
- 3 4025.492 71.972 1031.508 11.087 179775.96 0.022 0.000
- 4 4185.149 80.109 1840.851 19.786 320831.94 0.013 0.000
- 5 4415.540 90.790 2873.460 30.885 500799.90 0.009 0.000
-
-
- # background-subtracted results
- reg counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
- 2 895.818 35.423 345.182 3.710 60159.99 0.015 0.001
- 3 248.675 29.345 574.325 6.173 100095.98 0.002 0.000
- 4 159.657 32.321 809.343 8.699 141055.97 0.001 0.000
- 5 230.390 37.231 1032.610 11.099 179967.96 0.001 0.000
-
- )WR(
- # the following source and background components were used:
- source region\201s\202
- ----------------
- annulus\201502,512,0,50,n=5\202
-
- reg counts pixels sumcnts sumpix
- ---- ------------ --------- ------------ ---------
- 1 2993.000 305 2993.000 305
- 2 1241.000 940 4234.000 1245
- 3 823.000 1564 5057.000 2809
- 4 969.000 2204 6026.000 5013
- 5 1263.000 2812 7289.000 7825
-
- background region\201s\202
- --------------------
- annulus\201502,512,50,100\202
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572)RP(
-
-)0 P(The )BD(-t)ES( and )BD(-e)ES( switches can be used to apply timing and
-exposure corrections, respectively, to the data. Please note that
-these corrections are meant to be used qualitatively, since
-application of more accurate correction factors is a complex and
-mission-dependent effort. The algorithm for applying these simple
-corrections is as follows:
-) 9 63 PR( C = Raw Counts in Source Region
- Ac= Area of Source Region
- Tc= Exposure time for Source Data
- Ec= Average exposure in Source Region, from exposure map
-
- B= Raw Counts in Background Region
- Ab= Area of Background Region
- Tb= \201Exposure\202 time for Background Data
- Eb= Average exposure in Background Region, from exposure map)RP(
-Then, Net Counts in Source region is
-) 1 37 PR( Net= C - B * \201Ac*Tc*Ec\202/\201Ab*Tb*Eb\202)RP(
-with the standard propagation of errors for the Error on Net.
-The net rate would then be
-) 1 27 PR( Net Rate = Net/\201Ac*Tc*Ec\202)RP(
-The average exposure in each region is calculated by summing up the
-pixel values in the exposure map for the given region and then
-dividing by the number of pixels in that region. Exposure maps often
-are generated at a block factor > 1 \201e.g., block 4 means that each
-exposure pixel contains 4x4 pixels at full resolution\202 and
-)BD(funcnts)ES( will deal with the blocking automatically. Using the
-)BD(-e)ES( switch, you can supply both source and background exposure
-files \201separated by ";"\202, if you have separate source and background
-data files. If you do not supply a background exposure file to go with
-a separate background data file, )BD(funcnts)ES( assumes that exposure
-already has been applied to the background data file. In addition, it
-assumes that the error on the pixels in the background data file is
-zero.
-
-)0 P(NB: The )BD(-e)ES( switch assumes that the exposure map overlays the
-image file )BD(exactly)ES(, except for the block factor. Each pixel in
-the image is scaled by the block factor to access the corresponding
-pixel in the exposure map. If your exposure map does not line up
-exactly with the image, )BD(do not use)ES( the )BD(-e)ES( exposure
-correction. In this case, it still is possible to perform exposure
-correction )BD(if)ES( both the image and the exposure map have valid
-WCS information: use the )BD(-w)ES( switch so that the transformation
-from image pixel to exposure pixel uses the WCS information. That is,
-each pixel in the image region will be transformed first from image
-coordinates to sky coordinates, then from sky coordinates to exposure
-coordinates. Please note that using )BD(-w)ES( can increase the time
-required to process the exposure correction considerably.
-
-)0 P(A time correction can be applied to both source and
-background data using the )BD(-t)ES( switch. The value for the correction can
-either be a numeric constant or the name of a header parameter in
-the source \201or background\202 file:
-) 2 74 PR( [sh] funcnts -t 23.4 ... # number for source
- [sh] funcnts -t "LIVETIME;23.4" ... # param for source, numeric for bkgd)RP(
-When a time correction is specified, it is applied to the net counts
-as well \201see algorithm above\202, so that the units of surface brightness
-become cnts/area**2/sec.
-
-)0 P(The )BD(-i)ES( \201interval\202 switch is used to run )BD(funcnts)ES( on multiple
-column-based intervals with only a single pass through the data. It is
-equivalent to running )BD(funcnts)ES( several times with a different column
-filter added to the source and background data each time. For each
-interval, the full )BD(funcnts)ES( output is generated, with a linefeed
-character \201^L\202 inserted between each run. In addition, the output for
-each interval will contain the interval specification in its header.
-Intervals are very useful for generating X-ray hardness ratios
-efficiently. Of course, they are only supported when the input data
-are contained in a table.
-
-)0 P(Two formats are supported for interval specification. The most general
-format is semi-colon-delimited list of filters to be used as intervals:
-) 1 73 PR( funcnts -i "pha=1:5;pha=6:10;pha=11:15" snr.ev "circle\201502,512,22\202" ...)RP(
-Conceptually, this will be equivalent to running )BD(funcnts)ES( three times:
-) 3 50 PR( funcnts snr.ev'[pha=1:5]' "circle\201502,512,22\202"
- funcnts snr.ev'[pha=6:10]' "circle\201502,512,22\202"
- funcnts snr.ev'[pha=11:15]' "circle\201502,512,22\202")RP(
-However, using the )BD(-i)ES( switch will require only one pass through
-the data.
-
-)0 P(Note that complex filters can be used to specify intervals:
-) 1 64 PR( funcnts -i "pha=1:5&)SY(\160)ES(=4;pha=6:10&)SY(\160)ES(=5;pha=11:15&)SY(\160)ES(=6" snr.ev ...)RP(
-The program simply runs the data through each filter in turn and generates
-three )BD(funcnts)ES( outputs, separated by the line-feed character.
-
-)0 P(In fact, although the intent is to support intervals for hardness ratios,
-the specified filters do not have to be intervals at all. Nor does one
-"interval" filter have to be related to another. For example:
-) 1 75 PR( funcnts -i "pha=1:5;pi=6:10;energy=11:15" snr.ev "circle\201502,512,22\202" ...)RP(
-is equivalent to running )BD(funcnts)ES( three times with unrelated filter
-specifications.
-
-)0 P(A second interval format is supported for the simple case in which a
-single column is used to specify multiple homogeneous intervals for
-that column. In this format, a column name is specified first,
-followed by intervals:
-) 1 65 PR( funcnts -i "pha;1:5;6:10;11:15" snr.ev "circle\201502,512,22\202" ...)RP(
-This is equivalent to the first example, but requires less typing. The
-)BD(funcnts)ES( program will simply prepend "pha=" before each of the specified
-intervals. \201Note that this format does not contain the "=" character in
-the column argument.\202
-
-)0 P(Ordinarily, when )BD(funcnts)ES( is run on a FITS binary table \201or a
-raw event table\202, one integral count is accumulated for each row
-\201event\202 contained within a given region. The )BD(-v "scol[;bcol]")ES(
-\201value column\202 switch will accumulate counts using the value from the
-specified column for the given event. If only a single column is
-specified, it is used for both the source and background regions. Two
-separate columns, separated by a semi-colon, can be specified for source
-and background. The special token '$none' can be used to specify that
-a value column is to be used for one but not the other. For example,
-'pha;$none' will use the pha column for the source but use integral
-counts for the background, while '$none;pha' will do the converse.
-If the value column is of type logical, then the value used will be 1
-for T and 0 for F. Value columns are used, for example, to integrate
-probabilities instead of integral counts.
-
-)0 P(If the )BD(-T)ES( \201rdb table\202 switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces and line-feed will be inserted between
-tables.
-
-)0 P(Finally, note that )BD(funcnts)ES( is an image program, even though it
-can be run directly on FITS binary tables. This means that image
-filtering is applied to the rows in order to ensure that the same
-results are obtained regardless of whether a table or the equivalent
-binned image is used. Because of this, however, the number of counts
-found using )BD(funcnts)ES( can differ from the number of events found
-using row-filter programs such as )BD(fundisp)ES( or )BD(funtable)ES(
-For more information about these difference, see the discussion of
-)0 58 1 A(Region Boundaries)58 0 TN TL()Ec /AF f D(.
-
-
-
-
-)0 2 9 H(funcone)WB 72 Sn()WB 6 Sn( - cone search of a binary table containing RA, Dec columns)EA()EH(
-
-
-)BD() 1 81 PR(funcone <switches> <iname> <oname> <ra[hdr]> <dec[hdr]> <radius[dr'"]> [columns])RP()ES(
-
-
-)0 P() 9 84 PR( -d deccol:[hdr] # Dec column name, units \201def: DEC:d\202
- -j # join columns from list file
- -J # join columns from list file, output all rows
- -l listfile # read centers and radii from a list
- -L listfile # read centers and radii from a list, output list rows
- -n # don't use cone limits as a filter
- -r racol:[hdr] # RA column name, units \201def: RA:h\202
- -x # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols
- -X # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols, output all rows)RP(
-
-
-)0 P(Funcone performs a cone search on the RA and Dec columns of a FITS
-binary table. The distance from the center RA, Dec position to the RA,
-Dec in each row in the table is calculated. Rows whose distance is
-less than the specified radius are output.
-
-)0 P(The first argument to the program specifies the FITS file, raw event
-file, or raw array file. If "stdin" is specified, data are read from
-the standard input. Use )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions, and filters. The second
-argument is the output FITS file. If "stdout" is specified, the FITS
-binary table is written to the standard output.
-
-)0 P(
-The third and fourth required arguments are the RA and Dec center
-position. By default, RA is specified in hours while Dec is specified
-in degrees. You can change the units of either of these by appending
-the character "d" \201degrees\202, "h" \201hours\202 or "r" \201radians\202. Sexagesimal
-notation is supported, with colons or spaces separating hms and dms.
-\201When using spaces, please ensure that the entire string is quoted.\202
-
-)0 P(The fifth required argument is the radius of the cone search. By default,
-the radius value is given in degrees. The units can be changed by appending
-the character "d" \201degrees\202, "r" \201radians\202, "'" \201arc minutes\202 or
-'"' \201arc seconds\202.
-
-)0 P(By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional sixth argument in the form:
-) 1 31 PR( "column1 column1 ... columnN")RP(
-A seventh argument allows you to output selected columns from the list
-file when )BD(-j)ES( switch is used. Note that the RA and Dec columns
-used in the cone calculation must not be de-selected.
-
-)0 P(Also by default, the RA and Dec column names are named "RA" and "Dec",
-and are given in units of hours and degrees respectively. You can
-change both the name and the units using the -r [RA] and/or -d [Dec]
-switches. Once again, one of "h", "d", or "r" is appended to the
-column name to specify units but in this case, there must be a colon ":"
-between the name and the unit specification.
-
-)0 P(If the )BD(-l [listfile])ES( switch is used, then one or more of the
-center RA, center Dec, and radius can be taken from a list file \201which
-can be a FITS table or an ASCII column text file\202. In this case, the
-third \201center RA\202, fourth \201center Dec\202, and fifth \201radius\202 command
-line arguments can either be a column name in the list file \201if that
-parameter varies\202 or else a numeric value \201if that parameter is
-static\202. When a column name is specified for the RA, Dec, or radius,
-you can append a colon followed by "h", "d", or "r" to specify units
-\201also ' and " for radius\202. The cone search algorithm is run once for
-each row in the list, taking RA, Dec, and radius values from the
-specified columns or from static numeric values specified on the
-command line.
-
-)0 P(When using a list, all valid rows from each iteration are written to a
-single output file. Use the )BD(-x)ES( switch to help delineate which
-line of the list file was used to produce the given output row\201s\202.
-This switch causes the values for the center RA, Dec, radius, and row
-number to be appended to the output file, in columns called RA_CEN,
-DEC_CEN, RAD_CEN and CONE_KEY, respectively. Alternatively, the
-)BD(-j)ES( \201join\202 switch will append all columns from the list row to
-the output row \201essentially a join of the list row and input row\202,
-along with the CONE_KEY row number. These two switches are mutually
-exclusive.
-
-)0 P(The )BD(-X)ES( and )BD(-J)ES( switches write out the same data as their
-lower case counterparts for each row satisfying a cone search. In
-addition, these switches also write out rows from the event file that
-do not satisfy any cone search. In such cases, that CONE_KEY column
-will be given a value of -1 and the center and list position information
-will be set to zero for the given row. Thus, all rows of the input
-event file are guaranteed to be output, with rows satisfying at least
-one cone search having additional search information.
-
-)0 P(The )BD(-L)ES( switch acts similarly to the )BD(-l)ES( switch in that it
-takes centers from a list file. However, it also implicitly sets the
--j switch, so that output rows are the join of the input event row and
-the center position row. In addition, this switch also writes out all
-center position rows for which no event satisfies the cone search
-criteria of that row. The CONE_KEY column will be given a value of -2
-for center rows that were not close to any data row and the event
-columns will be zeroed out for such rows. In this way, all centers
-rows are guaranteed to be output at least once.
-
-)0 P(If any of "all row" switches \201)BD(-X)ES(, )BD(-J)ES(, or )BD(-L)ES(\202 are
-specified, then a new column named JSTAT is added to the output table.
-The positive values in this column indicate the center position row number
-\201starting from 1\202 in the list file that this data row successful matched
-in a cone search. A value of -1 means that the data row did not match
-any center position. A value of -2 means that the center position was
-not matched by any data row.
-
-)0 P(Given a center position and radius, the cone search algorithm
-calculates limit parameters for a box enclosing the specified cone,
-and only tests rows whose positions values lie within those limits.
-For small files, the overhead associated with this cone limit
-filtering can cause the program to run more slowly than if all events
-were tested. You can turn off cone limit filtering using the )BD(-n)ES(
-switch to see if this speeds up the processing \201especially useful when
-processing a large list of positions\202.
-
-)0 P(For example, the default cone search uses columns "RA" and "Dec" in hours
-and degrees \201respectively\202 and RA position in hours, Dec and radius in degrees:
-) 1 42 PR( funone in.fits out.fits 23.45 34.56 0.01)RP(
-To specify the RA position in degrees:
-) 1 44 PR( funcone in.fits out.fits 23.45d 34.56 0.01)RP(
-To get RA and Dec from a list but use a static value for radius \201and
-also write identifying info for each row in the list\202:
-) 1 57 PR( funcone -x -l list.txt in.fits out.fits MYRA MYDec 0.01)RP(
-User specified columns in degrees, RA position in hours \201sexagesimal
-notation\202, Dec position in degrees \201sexagesimal notation\202 and radius
-in arc minutes:
-) 1 66 PR( funcone -r myRa:d -d myDec in.fits out.fits 12:30:15.5 30:12 15')RP(
-
-
-
-
-)0 2 10 H(fundisp)WB 73 Sn()WB 7 Sn( - display data in a Funtools data file)EA()EH(
-
-
-)BD() 1 62 PR(fundisp [-f format] [-l] [-n] [-T] <iname> [columns|bitpix=n])RP()ES(
-
-
-)0 P() 5 68 PR( -f # format string for display
- -l # display image as a list containing the columns X, Y, VAL
- -n # don't output header
- -F [c] # use specified character as column separator \201def: space\202
- -T # output in rdb/starbase format \201tab separators\202)RP(
-
-
-)0 P()BD(fundisp)ES( displays the data in the specified
-)0 42 1 A(FITS Extension)42 0 TN TL()Ec /AF f D(
-and/or
-)0 49 1 A(Image Section)49 0 TN TL()Ec /AF f D(
-of a FITS file, or in a
-)0 49 1 A(Section)49 0 TN TL()Ec /AF f D(
-of a non-FITS array or raw event file.
-)0 P(The first argument to the program specifies the FITS input image, array, or
-raw event file to display. If "stdin" is specified, data are read from
-the standard input. Use )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions, image sections, and filters.
-
-)0 P(If the data being displayed are columns \201either in a FITS binary table
-or a raw event file\202, the individual rows are listed. Filters can be
-added using bracket notation. Thus:
-) 13 75 PR( [sh] fundisp "test.ev[time-\201int\202time>.15]"
- X Y PHA PI TIME DX DY
- ------- ------- ------- --------- ---------------- ---------- ----------
- 10 8 10 8 17.1600 8.50 10.50
- 9 9 9 9 17.1600 9.50 9.50
- 10 9 10 9 18.1600 9.50 10.50
- 10 9 10 9 18.1700 9.50 10.50
- 8 10 8 10 17.1600 10.50 8.50
- 9 10 9 10 18.1600 10.50 9.50
- 9 10 9 10 18.1700 10.50 9.50
- 10 10 10 10 19.1600 10.50 10.50
- 10 10 10 10 19.1700 10.50 10.50
- 10 10 10 10 19.1800 10.50 10.50)RP(
-[NB: The FITS binary table test file test.ev, as well as the FITS
-image test.fits, are contained in the funtools funtest directory.]
-
-)0 P(When a table is being displayed using )BD(fundisp)ES(, a second optional
-argument can be used to specify the columns to display. For example:
-) 12 56 PR( [sh] fundisp "test.ev[time-\201int\202time>=.99]" "x y time"
- X Y TIME
- -------- -------- ---------------------
- 5 -6 40.99000000
- 4 -5 59.99000000
- -1 0 154.99000000
- -2 1 168.99000000
- -3 2 183.99000000
- -4 3 199.99000000
- -5 4 216.99000000
- -6 5 234.99000000
- -7 6 253.99000000)RP(
-
-)0 P(The special column )BD($REGION)ES( can be specified to display the
-region id of each row:
-) 12 89 PR( [sh $] fundisp "test.ev[time-\201int\202time>=.99&&annulus\2010 0 0 10 n=3\202]" 'x y time $REGION'
- X Y TIME REGION
- -------- -------- --------------------- ----------
- 5 -6 40.99000000 3
- 4 -5 59.99000000 2
- -1 0 154.99000000 1
- -2 1 168.99000000 1
- -3 2 183.99000000 2
- -4 3 199.99000000 2
- -5 4 216.99000000 2
- -6 5 234.99000000 3
- -7 6 253.99000000 3)RP(
-)0 P(Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are displayed.
-)0 P(Columns can be excluded from display using a minus sign before the
-column:
-) 12 64 PR( [sh $] fundisp "test.ev[time-\201int\202time>=.99]" "-time"
- X Y PHA PI DX DY
- -------- -------- -------- ---------- ----------- -----------
- 5 -6 5 -6 5.50 -6.50
- 4 -5 4 -5 4.50 -5.50
- -1 0 -1 0 -1.50 0.50
- -2 1 -2 1 -2.50 1.50
- -3 2 -3 2 -3.50 2.50
- -4 3 -4 3 -4.50 3.50
- -5 4 -5 4 -5.50 4.50
- -6 5 -6 5 -6.50 5.50
- -7 6 -7 6 -7.50 6.50)RP(
-All columns except the time column are displayed.
-)0 P(The special column )BD($N)ES( can be specified to display the
-ordinal value of each row. Thus, continuing the previous example:
-) 12 74 PR( fundisp "test.ev[time-\201int\202time>=.99]" '-time $n'
- X Y PHA PI DX DY N
- ------- -------- -------- ---------- ----------- ----------- ----------
- 5 -6 5 -6 5.50 -6.50 337
- 4 -5 4 -5 4.50 -5.50 356
- -1 0 -1 0 -1.50 0.50 451
- -2 1 -2 1 -2.50 1.50 465
- -3 2 -3 2 -3.50 2.50 480
- -4 3 -4 3 -4.50 3.50 496
- -5 4 -5 4 -5.50 4.50 513
- -6 5 -6 5 -6.50 5.50 531
- -7 6 -7 6 -7.50 6.50 550)RP(
-Note that the column specification is enclosed in single quotes to protect
-'$n' from begin expanded by the shell.
-
-)0 P(In general, the rules for activating and de-activating columns are:
-)UL()-1 LI( If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-)-1 LI( If only include columns are specified, then only the specified columns
-are activated.
-)-1 LI( If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.)LU(
-In addition to specifying columns names explicitly, the special
-symbols )BD(+)ES( and )BD(-)ES( can be used to activate and
-de-activate )BD(all)ES( columns. This is useful if you want to
-activate the $REGION column along with all other columns. According
-to the rules, the syntax "$REGION" only activates the region column
-and de-activates the rest. Use "+ $REGION" to activate all
-columns as well as the region column.
-
-)0 P(If the data being displayed are image data \201either in a FITS primary
-image, a FITS image extension, or an array file\202, an mxn pixel display
-is produced, where m and n are the dimensions of the image. By
-default, pixel values are displayed using the same data type as in the
-file. However, for integer data where the BSCALE and BZERO header parameters
-are present, the data is displayed as floats. In either case, the
-display data type can be overridden using an optional second argument
-of the form:
-) 1 10 PR( bitpix=n)RP(
-where n is 8,16,32,-32,-64, for unsigned char, short, int, float and double,
-respectively.
-
-)0 P(Of course, running )BD(fundisp)ES( on anything but the smallest image
-usually results in a display whose size makes it unreadable.
-Therefore, one can uses bracket notation \201see below\202
-to apply section and/or blocking to the image before generating a
-display. For example:
-) 9 66 PR( [sh] fundisp "test.fits[2:6,2:7]" bitpix=-32
- 2 3 4 5 6
- ---------- ---------- ---------- ---------- ----------
- 2: 3.00 4.00 5.00 6.00 7.00
- 3: 4.00 5.00 6.00 7.00 8.00
- 4: 5.00 6.00 7.00 8.00 9.00
- 5: 6.00 7.00 8.00 9.00 10.00
- 6: 7.00 8.00 9.00 10.00 11.00
- 7: 8.00 9.00 10.00 11.00 12.00)RP(
-
-)0 P(Note that is is possible to display a FITS binary table as an image
-simply by passing the table through )BD(funimage)ES( first:
-) 9 68 PR( [sh] ./funimage test.ev stdout | fundisp "stdin[2:6,2:7]" bitpix=8
- 2 3 4 5 6
- ------- ------- ------- ------- -------
- 2: 3 4 5 6 7
- 3: 4 5 6 7 8
- 4: 5 6 7 8 9
- 5: 6 7 8 9 10
- 6: 7 8 9 10 11
- 7: 8 9 10 11 12)RP(
-
-If the )BD(-l)ES( \201list\202 switch is used, then an image is displayed as a
-list containing the columns: X, Y, VAL. For example:
-) 33 45 PR( fundisp -l "test1.fits[2:6,2:7]" bitpix=-32
- X Y VAL
- ---------- ---------- -----------
- 2 2 6.00
- 3 2 1.00
- 4 2 1.00
- 5 2 1.00
- 6 2 1.00
- 2 3 1.00
- 3 3 5.00
- 4 3 1.00
- 5 3 1.00
- 6 3 1.00
- 2 4 1.00
- 3 4 1.00
- 4 4 4.00
- 5 4 1.00
- 6 4 1.00
- 2 5 1.00
- 3 5 1.00
- 4 5 1.00
- 5 5 3.00
- 6 5 1.00
- 2 6 1.00
- 3 6 1.00
- 4 6 1.00
- 5 6 1.00
- 6 6 2.00
- 2 7 1.00
- 3 7 1.00
- 4 7 1.00)WR(
- 5 7 1.00
- 6 7 1.00)RP(
-
-)0 P(If the )BD(-n)ES( \201nohead\202 switch is used, then no header is output for
-tables. This is useful, for example, when fundisp output is being
-directed into gnuplot.
-
-)0 P(The )BD(fundisp)ES( program uses a default set of display formats:
-) 10 33 PR( datatype TFORM format
- -------- ----- --------
- double D "%21.8f"
- float E "%11.2f"
- int J "%10d"
- short I "%8d"
- byte B "%6d"
- string A "%12.12s"
- bits X "%8x"
- logical L "%1x")RP(
-Thus, the default display of 1 double and 2 shorts gives:
-) 7 42 PR( [sh] fundisp snr.ev "time x y"
-
- TIME X Y
- --------------------- -------- --------
- 79494546.56818075 546 201
- 79488769.94469175 548 201
- ...)RP(
-You can change the display format for individual columns or for all
-columns of a given data types by means of the -f switch. The format
-string that accompanies -f is a space-delimited list of keyword=format
-values. The keyword values can either be column names \201in which case
-the associated format pertains only to that column\202 or FITS table
-TFORM specifiers \201in which case the format pertains to all columns
-having that data type\202. For example, you can change the double and
-short formats for all columns like this:
-) 7 53 PR( [sh] fundisp -f "D=%22.11f I=%3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- ---
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...)RP(
-
-)0 P(Alternatively, you can change the format of the time and x columns like this:
-) 7 56 PR( [sh] fundisp -f "time=%22.11f x=%3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- --------
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...)RP(
-Note that there is a potential conflict if a column has the same name
-as one of the TFORM specifiers. In the examples above, the the "X"
-column in the table has the same name as the X \201bit\202 datatype. To
-resolve this conflict, the format string is processed such that
-TFORM datatype specifiers are checked for first, using a
-case-sensitive comparison. If the specified format value is not an
-upper case TFORM value, then a case-insensitive check is made on the
-column name. This means that, in the examples above, "X=%3d" will refer
-to the X \201bit\202 datatype, while "x=%3d" will refer to the X column:
-) 15 38 PR( [sh] fundisp -f "X=%3d" snr.ev "x y"
-
- X Y
- -------- --------
- 546 201
- 548 201
- ...
-
- [sh] fundisp -f "x=%3d" snr.ev "x y"
-
- X Y
- --- --------
- 546 201
- 548 201
- ...)RP(
-As a rule, therefore, it is best always to specify the column name in
-lower case and TFORM data types in upper case.
-
-)0 P(The )BD(-f [format])ES( will change the format for a single execution
-of fundisp. You also can use the )BD(FUN_FORMAT)ES( envronment variable
-to change the format for all invocations of fundisp. The format of this
-environment variable's value is identical to that used with
-the )BD(-f)ES( switch. This global value can be overridden in
-individual cases by use of the )BD(-f [format])ES( switch.
-
-)0 P(Caveats: Please also note that it is the user's responsibility to
-match the format specifier to the column data type correctly. Also
-note that, in order to maintain visual alignment between names and
-columns, the column name will be truncated \201on the left\202 if the
-format width is less than the length of the name. However, truncation
-is not performed if the output is in RDB format \201using the -T switch\202.
-
-)0 P([An older-style format string is supported but deprecated. It
-consists of space-delimited C format statements for all data types,
-specified in the following order:
-) 1 40 PR( double float int short byte string bit.)RP(
-This order of the list is based on the assumption that people generally
-will want to change the float formats.
-)0 P(If "-" is entered instead of a format statement for a given data type, the
-default format is used. Also, the format string can be terminated without
-specifying all formats, and defaults will be used for the rest of the
-list. Note that you must supply a minimum field width, i.e., "%6d" and
-"%-6d" are legal, "%d" is not legal.
-
-By using -f [format], you can change the double and short formats like this:
-) 7 51 PR( [sh] fundisp -f "22.11f - - 3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- ---
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...)RP(
-NB: This format is deprecated and will be removed in a future release.]
-
-)0 P(The )BD(-F[c])ES( switch can be used to specify a \201single-character\202
-column separator \201where the default is a space\202. Note that column
-formatting will almost certainly also add spaces to pad individual
-columns to the required width. These can be removed with a program
-such as sed, at the cost of generating unaligned columns. For example:
-) 26 117 PR(fundisp -F',' snr.ev'[cir 512 512 .1]'
- X, Y, PHA, PI, TIME, DX, DY
---------,--------,--------,--------,---------------------,--------,--------
- 512, 512, 6, 7, 79493997.45854475, 578, 574
- 512, 512, 8, 9, 79494575.58943175, 579, 573
- 512, 512, 5, 6, 79493631.03866175, 578, 575
- 512, 512, 5, 5, 79493290.86521725, 578, 575
- 512, 512, 8, 9, 79493432.00990875, 579, 573
-
-fundisp -F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,PHA,PI,TIME,DX,DY
---------,--------,--------,--------,---------------------,--------,--------
- 512,512,6,7,79493997.45854475,578,574
- 512,512,8,9,79494575.58943175,579,573
- 512,512,5,6,79493631.03866175,578,575
- 512,512,5,5,79493290.86521725,578,575
- 512,512,8,9,79493432.00990875,579,573
-
-fundisp -f "x=%3d y=%3d pi=%1d pha=%1d time=%20.11f dx=%3d dy=%3d" -F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,A,I,TIME,DX,DY
----,---,-,-,--------------------,---,---
-512,512,6,7,79493997.45854474604,578,574
-512,512,8,9,79494575.58943174779,579,573
-512,512,5,6,79493631.03866174817,578,575
-512,512,5,5,79493290.86521725357,578,575
-512,512,8,9,79493432.00990875065,579,573)RP(
-
-)0 P(If the )BD(-T)ES( \201rdb table\202 switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces. This format is not available when
-displaying image pixels \201except in conjunction with the )BD(-l)ES(
-switch\202.
-
-)0 P(Finally, note that )BD(fundisp)ES( can be used to create column filters from
-the auxiliary tables in a FITS file. For example, the following shell code
-will generate a good-time interval \201GTI\202 filter for X-ray data files that
-contain a standard GTI extension:
-) 3 68 PR( #!/bin/sh
- sed '1,/---- .*/d
- /^$/,$d' | awk 'tot>0{printf "||"};{printf "time="$1":"$2; tot++}')RP(
-If this script is placed in a file called "mkgti", it can be used in a
-command such as:
-) 1 46 PR( fundisp foo.fits"[GTI]" | mkgti > gti.filter)RP(
-The resulting filter file can then be used in various funtools programs:
-) 1 37 PR( funcnts foo.fits"[@gti.filter]" ...)RP(
-to process only the events in the good-time intervals.
-
-
-
-
-)0 2 11 H(funhead)WB 74 Sn()WB 8 Sn( - display a header in a Funtools file)EA()EH(
-
-
-)BD() 1 50 PR(funhead [-a] [-s] [-t] [-L] <iname> [oname ename])RP()ES(
-
-
-)0 P() 4 60 PR( -a # display all extension headers
- -s # display 79 chars instead of 80 before the new-line
- -t # prepend data type char to each line of output
- -L # output in rdb/starbase list format)RP(
-
-
-)0 P()BD(funhead)ES( displays the FITS header parameters in the specified
-)0 42 1 A(FITS Extension)42 0 TN TL()Ec /AF f D(.
-)0 P(The first argument to the program specifies the Funtools input file
-to display. If "stdin" is specified, data are read from
-the standard input. )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( is used to specify particular FITS extension to process.
-Normally, the full 80 characters of each header card is output,
-followed by a new-line.
-
-)0 P(If the )BD(-a)ES( switch is specified, the header from each FITS
-extensions in the file is displayed. Note, however, that the )BD(-a)ES(
-switch does not work with FITS files input via stdin. We hope to
-remove this restriction in a future release.
-
-)0 P(If the )BD(-s)ES( switch is specified, only 79 characters are output
-before the new-line. This helps the display on 80 character terminals.
-
-)0 P(If the )BD(-t)ES( switch is specified, the data type of the parameter
-is output as a one character prefix, followed by 77 characters of the
-param. The parameter data types are defined as: FUN_PAR_UNKNOWN
-\201'u'\202, FUN_PAR_COMMENT \201'c'\202, FUN_PAR_LOGICAL \201'l'\202, FUN_PAR_INTEGER
-\201'i'\202, FUN_PAR_STRING \201's'\202, FUN_PAR_REAL \201'r'\202, FUN_PAR_COMPLEX \201'x'\202.
-
-)0 P(If the )BD(-L)ES( \201rdb table\202 switch is used, the output will conform
-to starbase/rdb data base list format.
-
-)0 P(For example to display the EVENTS extension \201binary table\202:
-) 17 65 PR( [sh] funhead "foo.fits[EVENTS]"
- XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
- BITPIX = 8 / Binary data
- NAXIS = 2 / Table is a matrix
- NAXIS1 = 20 / Width of table in bytes
- NAXIS2 = 30760 / Number of entries in table
- PCOUNT = 0 / Random parameter count
- GCOUNT = 1 / Group count
- TFIELDS = 7 / Number of fields in each row
- EXTNAME = 'EVENTS ' / Table name
- EXTVER = 1 / Version number of table
- TFORM1 = '1I ' / Data type for field
- TTYPE1 = 'X ' / Label for field
- TUNIT1 = ' ' / Physical units for field
- TFORM2 = '1I ' / Data type for field
- etc. ...
- END)RP(
-
-)0 P(To display the third header:
-) 14 65 PR( [sh] funhead "foo.fits[3]"
- XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
- BITPIX = 8 / Binary data
- NAXIS = 2 / Table is a matrix
- NAXIS1 = 32 / Width of table in bytes
- NAXIS2 = 40 / Number of entries in table
- PCOUNT = 0 / Random parameter count
- GCOUNT = 1 / Group count
- TFIELDS = 7 / Number of fields in each row
- EXTNAME = 'TGR ' / Table name
- EXTVER = 1 / Version number of table
- TFORM1 = '1D ' / Data type for field
- etc. ...
- END)RP(
-
-)0 P(To display the primary header \201i.e., extension 0\202:
-) 8 59 PR( sh> funhead "coma.fits[0]"
- SIMPLE = T /STANDARD FITS FORMAT
- BITPIX = 16 /2-BYTE TWOS-COMPL INTEGER
- NAXIS = 2 /NUMBER OF AXES
- NAXIS1 = 800 /
- NAXIS2 = 800 /
- DATATYPE= 'INTEGER*2' /SHORT INTEGER
- END)RP(
-
-)0 P(The funhead program also can edit \201i.e. add, delete, or modify\202 or
-display individual headers parameters. Edit mode is signalled by the
-presence of two additional command-line arguments: output file and
-edit command file, in that order. Edit mode acts as a filter: the
-output file will contain the entire input FITS file, including other
-extensions. The edit command file can be "stdin", in which case edit
-command are read from the standard input.
-
-)0 P(The edit command file contains parameter comments \201having '#' in the
-first column\202 and delete and assignment\201modify or add\202 operations. A
-delete operation is specified by preceding the parameter name with a
-minus sign "-". A display operation \201very useful in interactive
-sessions, i.e., where the edit commands are taken from stdin\202 is
-specified by preceding the parameter name with a question mark "?". In
-either case, a parameter value need not be specified. An assignment
-operation is specified in the same two ways that a parameter is
-specified in a text header \201but without the comment character that
-precedes header params\202, i.e.:
-
-)UL()-1 LI( FITS-style comments have an equal sign "=" between the keyword and
-value and an optional slash "/" to signify a comment. The strict FITS
-rules on column positions are not enforced.
-
-)-1 LI( Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed.)LU(
-
-)0 P(For example, the following interactive session checks for the
-existence of parameters, adds new parameters, modifies them, and
-modifies and deletes existing parameters:
-) 20 55 PR( sh$ ./funhead snr.ev foo.fits -
- # look for FOO1
- ? FOO1
- WARNING: FOO1 not found
- # add new foo1
- FOO1 = 100
- # add foo2
- FOO2 = 200
- # reset foo1 to a different value
- FOO1 -1
- # delete foo2
- -FOO2
- # change existing value
- EXTVER 2
- ? XS-SORT
- XS-SORT = 'EOF ' / type of event sort
- # delete existing value
- -XS-SORT
- # exit
- ^D)RP(
-
-)0 P(See )0 47 1 A(Column-based Text Files)47 0 TN TL()Ec /AF f D(
-for more information about header parameter format.
-
-)0 P(
-)0 P(
-
-
-)0 2 12 H(funhist)WB 75 Sn()WB 9 Sn( - create a 1D histogram of a column \201from a FITS binary table or raw event file\202 or an image)EA()EH(
-
-
-)BD() 1 51 PR(funhist [-n|-w|-T] <iname> [column] [[lo:hi:]bins])RP()ES(
-
-
-)0 P() 3 61 PR( -n # normalize bin value by the width of each bin
- -w # specify bin width instead of number of bins in arg3
- -T # output in rdb/starbase format \201tab separators\202)RP(
-
-
-)0 P()BD(funhist)ES( creates a one-dimensional histogram from the specified
-columns of a )0 42 1 A(FITS Extension)42 0 TN TL()Ec /AF f D(
-binary table of a FITS file \201or from a non-FITS raw event file\202, or
-from a FITS image or array, and writes that histogram as an ASCII
-table. Alternatively, the program can perform a 1D projection of one
-of the image axes.
-
-)0 P(The first argument to the program is required, and specifies the
-Funtools file: FITS table or image, raw event file, or array. If
-"stdin" is specified, data are read from the standard input. Use
-)0 42 1 A(Funtools Bracket Notation)42 0 TN TL()Ec /AF f D( to specify FITS
-extensions, and filters.
-
-)0 P(For a table, the second argument also is required. It specifies the
-column to use in generating the histogram. If the data file is of
-type image \201or array\202, the column is optional: if "x" \201or "X"\202, "y"
-\201or "Y"\202 is specified, then a projection is performed over the x
-\201dim1\202 or y \201dim2\202 axes, respectively. \201That is, this projection will
-give the same results as a histogram performed on a table containing
-the equivalent x,y event rows.\202 If no column name is specified or
-"xy" \201or "XY"\202 is specified for the image, then a histogram is
-performed on the values contained in the image pixels.
-
-)0 P(The argument that follows is optional and specifies the number of bins
-to use in creating the histogram and, if desired, the range of bin
-values. For image and table histograms, the range should specify the
-min and max data values. For image histograms on the x and y axes,
-the range should specify the min and max image bin values. If this
-argument is omitted, the number of output bins for a table is
-calculated either from the TLMIN/TLMAX headers values \201if these exist
-in the table FITS header for the specified column\202 or by going through
-the data to calculate the min and max value. For an image, the number
-of output bins is calculated either from the DATAMIN/DATAMAX header
-values, or by going through the data to calculate min and max value.
-\201Note that this latter calculation might fail if the image cannot be
-fit in memory.\202 If the data are floating point \201table or image\202 and
-the number of bins is not specified, an arbitrary default of 128 is
-used.
-
-)0 P(For binary table processing, the )BD(-w)ES( \201bin width\202 switch can be used
-to specify the width of each bin rather than the number of bins. Thus:
-) 1 29 PR( funhist test.ev pha 1:100:5)RP(
-means that 5 bins of width 20 are used in the histogram, while:
-) 1 32 PR( funhist -w test.ev pha 1:100:5)RP(
-means that 20 bins of width 5 are used in the histogram.
-
-)0 P(The data are divvied up into the specified number of bins and the
-resulting 1D histogram \201or projection\202 is output in ASCII table
-format. For a table, the output displays the low_edge \201inclusive\202 and
-hi_edge \201exclusive\202 values for the data. For example, a 15-row table
-containing a "pha" column whose values range from -7.5 to 7.5
-can be processed thus:
-
-) 47 62 PR( [sh] funhist test.ev pha
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: -7.5 7.5 15
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 22 -7.50000000 -6.50000000
- 2 21 -6.50000000 -5.50000000
- 3 20 -5.50000000 -4.50000000
- 4 19 -4.50000000 -3.50000000
- 5 18 -3.50000000 -2.50000000
- 6 17 -2.50000000 -1.50000000
- 7 16 -1.50000000 -0.50000000
- 8 30 -0.50000000 0.50000000
- 9 16 0.50000000 1.50000000
- 10 17 1.50000000 2.50000000
- 11 18 2.50000000 3.50000000
- 12 19 3.50000000 4.50000000
- 13 20 4.50000000 5.50000000
- 14 21 5.50000000 6.50000000
- 15 22 6.50000000 7.50000000
-
- [sh] funhist test.ev pha 1:6
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 6
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 16 0.50000000 1.50000000)WR(
- 2 17 1.50000000 2.50000000
- 3 18 2.50000000 3.50000000
- 4 19 3.50000000 4.50000000
- 5 20 4.50000000 5.50000000
- 6 21 5.50000000 6.50000000
-
- [sh] funhist test.ev pha 1:6:3
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 3
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 33 0.50000000 2.50000000
- 2 37 2.50000000 4.50000000
- 3 41 4.50000000 6.50000000)RP(
-
-)0 P(For a table histogram, the )BD(-n)ES(\201normalize\202 switch can be used to
-normalize the bin value by the width of the bin \201i.e., hi_edge-lo_edge\202:
-) 11 74 PR( [sh] funhist -n test.ev pha 1:6:3
- # data file: test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 3
- # width normalization \201val/\201hi_edge-lo_edge\202\202 is applied
-
- bin value lo_edge hi_edge
- ------ --------------------- --------------------- ---------------------
- 1 16.50000000 0.50000000 2.50000000
- 2 6.16666667 2.50000000 4.50000000
- 3 4.10000000 4.50000000 6.50000000)RP(
-This could used, for example, to produce a light curve with values
-having units of counts/second instead of counts.
-
-)0 P(For an image histogram, the output displays the low and high image
-values \201both inclusive\202 used to generate the histogram. For example,
-in the following example, 184 pixels had a value of 1, 31 had a value
-of 2, while only 2 had a value of 3,4,5,6, or 7:
-) 13 74 PR( [sh] funhist test.fits
- # data file: /home/eric/data/test.fits
- # min,max,bins: 1 7 7
-
- bin value lo_val hi_val
- ------ --------------------- --------------------- ---------------------
- 1 184.00000000 1.00000000 1.00000000
- 2 31.00000000 2.00000000 2.00000000
- 3 2.00000000 3.00000000 3.00000000
- 4 2.00000000 4.00000000 4.00000000
- 5 2.00000000 5.00000000 5.00000000
- 6 2.00000000 6.00000000 6.00000000
- 7 2.00000000 7.00000000 7.00000000)RP(
-
-)0 P(For the axis projection of an image, the output displays the low and
-high image bins \201both inclusive\202 used to generate the projection. For
-example, in the following example, 21 counts had their X bin value of
-2, etc.:
-) 23 74 PR( [sh] funhist test.fits x 2:7
- # data file: /home/eric/data/test.fits
- # column: X
- # min,max,bins: 2 7 6
-
- bin value lo_bin hi_bin
- ------ --------------------- --------------------- ---------------------
- 1 21.00000000 2.00000000 2.00000000
- 2 20.00000000 3.00000000 3.00000000
- 3 19.00000000 4.00000000 4.00000000
- 4 18.00000000 5.00000000 5.00000000
- 5 17.00000000 6.00000000 6.00000000
- 6 16.00000000 7.00000000 7.00000000
-
- [sh] funhist test.fits x 2:7:2
- # data file: /home/eric/data/test.fits
- # column: X
- # min,max,bins: 2 7 2
-
- bin value lo_bin hi_bin
- ------ --------------------- --------------------- ---------------------
- 1 60.00000000 2.00000000 4.00000000
- 2 51.00000000 5.00000000 7.00000000)RP(
-
-)0 P(You can use gnuplot or other plotting programs to graph the
-results, using a script such as:
-) 7 119 PR( #!/bin/sh
- sed -e '1,/---- .*/d
- /^$/,$d' | \200
- awk '\200
- BEGIN{print "set nokey; set title \200"funhist\200"; set xlabel \200"bin\200"; set ylabel \200"counts\200"; plot \200"-\200" with boxes"} \200
- {print $3, $2, $4-$3}' | \200
- gnuplot -persist - 1>/dev/null 2>&1)RP(
-
-Similar plot commands are supplied in the script )BD(funhist.plot)ES(:
-) 1 49 PR( funhist test.ev pha ... | funhist.plot gnuplot)RP(
-
-
-
-
-)0 2 13 H(funimage)WB 76 Sn()WB 10 Sn( - create a FITS image from a Funtools data file)EA()EH(
-
-
-)BD() 3 73 PR(funimage [-a] <iname> <oname> [bitpix=n]
-funimage [-l] <iname> <oname> <xcol:xdims> <ycol:ydims> <vcol> [bitpix=n]
-funimage [-p x|y] <iname> <oname> [bitpix=n])RP()ES(
-
-
-)0 P() 3 65 PR( -a # append to existing output file as an image extension
- -l # input is a list file containing xcol, ycol, value
- -p [x|y] # project along x or y axis to create a 1D image)RP(
-
-
-)0 P()BD(funimage)ES( creates a primary FITS image from the specified
-)0 42 1 A(FITS Extension)42 0 TN TL()Ec /AF f D(
-and/or
-)0 49 1 A(Image Section)49 0 TN TL()Ec /AF f D(
-of a FITS file, or from an
-)0 49 1 A(Image Section)49 0 TN TL()Ec /AF f D(
-of a non-FITS array, or from a raw event file.
-)0 P(The first argument to the program specifies the FITS input image,
-array, or raw event file to process. If "stdin" is specified, data are
-read from the standard input. Use )0 42 1 A(Funtools
-Bracket Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions, image sections, and
-filters. The second argument is the output FITS file. If "stdout" is
-specified, the FITS image is written to the standard output. By
-default, the output pixel values are of the same data type as those of the
-input file \201or type "int" when binning a table\202, but this can be
-overridden using an optional third argument of the form:
-) 1 10 PR( bitpix=n)RP(
-where n is 8,16,32,-32,-64, for unsigned char, short, int, float and double,
-respectively.
-
-)0 P(If the input data are of type image, the appropriate section is
-extracted and blocked \201based on how the
-)0 49 1 A(Image Section)49 0 TN TL()Ec /AF f D( is specified\202, and
-the result is written to the FITS primary image. When an integer
-image containing the BSCALE and BZERO keywords is converted to float,
-the pixel values are scaled and the scaling keywords are deleted from the
-output header. When converting integer scaled data to integer
-\201possibly of a different size\202, the pixels are not scaled and the
-scaling keywords are retained.
-
-)0 P(If the input data is a binary table or raw event file, these are
-binned into an image, from which a section is extracted and blocked,
-and written to a primary FITS image. In this case, it is necessary to
-specify the two columns that will be used in the 2D binning. This can
-be done on the command line using the )BD(bincols=\201x,y\202)ES( keyword:
-) 1 46 PR( funcnts "foo.ev[EVENTS,bincols=\201detx,dety\202]")RP(
-The full form of the )BD(bincols=)ES( specifier is:
-) 1 77 PR( bincols=\201[xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]]\202)RP(
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-) 2 56 PR( dim = \201tlmax - tlmin\202/binsiz \201floating point data\202
- dim = \201tlmax - tlmin\202/binsiz + 1 \201integer data\202)RP(
-Using this syntax, it is possible to bin any two columns of a binary
-table at any bin size. Note that the tlmin, tlmax, and binsiz
-specifiers can be omitted if TLMIN, TLMAX, and TDBIN header parameters
-\201respectively\202 are present in the FITS binary table header for the
-column in question. Note also that if only one parameter is specified,
-it is assumed to be tlmax, and tlmin defaults to 1. If two parameters
-are specified, they are assumed to be tlmin and tlmax.
-See )0 50 1 A(Binning FITS Binary Tables and Non-FITS
-Event Files)50 0 TN TL()Ec /AF f D( for more information about binning parameters.
-
-)0 P(By default, a new 2D FITS image file is created and the image is written
-to the primary HDU. If the )BD(-a)ES( \201append\202 switch is specified,
-the image is appended to an existing FITS file as an IMAGE extension.
-\201If the output file does not exist, the switch is effectively ignored
-and the image is written to the primary HDU.\202 This can be useful in a
-shell programming environment when processing multiple FITS images
-that you want to combine into a single final FITS file.
-
-)0 P()BD(funimage)ES( also can take input from a table containing columns of
-x, y, and value \201e.g., the output from )BD(fundisp -l)ES( which
-displays each image x and y and the number of counts at that
-position.\202 When the )BD(-l)ES( \201list\202 switch is used, the input file is
-taken to be a FITS or ASCII table containing \201at least\202 three columns
-that specify the x and y image coordinates and the value of that
-image pixel. In this case, )BD(funimage)ES( requires four extra
-arguments: xcolumn:xdims, ycolumn:ydims, vcolumn and bitpix=n. The x
-and y col:dim information takes the form:
-) 3 55 PR( name:dim # values range from 1 to dim
- name:min:max # values range from min to max
- name:min:max:binsiz # dimensions scaled by binsize)RP(
-In particular, the min value should be used whenever the
-minimum coordinate value is something other than one. For example:
-) 2 69 PR(
- funimage -l foo.lst foo.fits xcol:0:512 ycol:0:512 value bitpix=-32)RP(
-
-)0 P(The list feature also can be used to read unnamed columns from standard
-input: simply replace the column name with a null string. Note
-that the dimension information is still required:
-) 5 60 PR( funimage -l stdin foo.fits "":0:512 "":0:512 "" bitpix=-32
- 240 250 1
- 255 256 2
- ...
- ^D)RP(
-
-)0 P(The list feature provides a simple way to generate a blank image.
-If you pass a )0 47 1 A(Column-based Text File)47 0 TN TL()Ec /AF f D(
-to funimage in which the text header contains the required image
-information, then funimage will correctly make a blank image. For
-example, consider the following text file \201called foo.txt\202:
-) 3 20 PR( x:I:1:10 y:I:1:10
- ------ ------
- 0 0)RP(
-This text file defines two columns, x and y, each of data type 32-bit int and
-image dimension 10. The command:
-) 1 36 PR( funimage foo.txt foo.fits bitpix=8)RP(
-will create an empty FITS image called foo.fits containing a 10x10
-image of unsigned char:
-) 13 75 PR( fundisp foo.fits
- 1 2 3 4 5 6 7 8 9 10
- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
- 10: 0 0 0 0 0 0 0 0 0 0
- 9: 0 0 0 0 0 0 0 0 0 0
- 8: 0 0 0 0 0 0 0 0 0 0
- 7: 0 0 0 0 0 0 0 0 0 0
- 6: 0 0 0 0 0 0 0 0 0 0
- 5: 0 0 0 0 0 0 0 0 0 0
- 4: 0 0 0 0 0 0 0 0 0 0
- 3: 0 0 0 0 0 0 0 0 0 0
- 2: 0 0 0 0 0 0 0 0 0 0
- 1: 1 0 0 0 0 0 0 0 0 0)RP(
-
-Note that the text file must contain at least
-one row of data. However, in the present example, event position 0,0 is
-outside the limits of the image and will be ignored. \201You can, of course,
-use real x,y values to seed the image with data.\202
-
-)0 P(Furthermore, you can use the TEXT filter specification to obviate the need for
-an input text file altogether. The following command will create the same
-10x10 char image without an actual input file:
-) 3 69 PR( funimage stdin'[TEXT\201x:I:10,y:I:10\202]' foo.fits bitpix=8 < /dev/null
-or
- funimage /dev/null'[TEXT\201x:I:10,y:I:10\202]' foo.fits bitpix=8)RP(
-
-)0 P(You also can use either of these methods to generate a region mask simply
-by appending a region inside the filter brackets and specfying )BD(mask=all)ES(
-along with the bitpix. For example, the following command will generate a
-10x10 char mask using 3 regions:
-) 2 76 PR( funimage stdin'[TEXT\201x:I:10,y:I:10\202,cir\2015,5,4\202,point\20110,1\202,-cir\2015,5,2\202]' \200
- foo.fits bitpix=8,mask=all < /dev/null)RP(
-The resulting mask looks like this:
-) 13 75 PR( fundisp foo.fits
- 1 2 3 4 5 6 7 8 9 10
- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
- 10: 0 0 0 0 0 0 0 0 0 0
- 9: 0 0 0 0 0 0 0 0 0 0
- 8: 0 0 1 1 1 1 1 0 0 0
- 7: 0 1 1 1 1 1 1 1 0 0
- 6: 0 1 1 0 0 0 1 1 0 0
- 5: 0 1 1 0 0 0 1 1 0 0
- 4: 0 1 1 0 0 0 1 1 0 0
- 3: 0 1 1 1 1 1 1 1 0 0
- 2: 0 0 1 1 1 1 1 0 0 0
- 1: 0 0 0 0 0 0 0 0 0 2)RP(
-
-)0 P(You can use )BD(funimage)ES( to create 1D image projections along the x
-or y axis using the )BD(-p [x|y])ES( switch. This capability works for
-both images and tables. For example consider a FITS table named ev.fits
-containing the following rows:
-) 17 19 PR( X Y
- -------- --------
- 1 1
- 1 2
- 1 3
- 1 4
- 1 5
- 2 2
- 2 3
- 2 4
- 2 5
- 3 3
- 3 4
- 3 5
- 4 4
- 4 5
- 5 5)RP(
-A corresponding 5x5 image, called dim2.fits, would therefore contain:
-) 7 59 PR( 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 5: 1 1 1 1 1
- 4: 1 1 1 1 0
- 3: 1 1 1 0 0
- 2: 1 1 0 0 0
- 1: 1 0 0 0 0)RP(
-A projection along the y axis can be performed on either the table or
-the image:
-) 9 59 PR( funimage -p y ev.fits stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-
- funimage -p y dim2.fits stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5)RP(
-
-)0 P(Furthermore, you can create a 1D image projection along any column of
-a table by using the )BD(bincols=[column])ES( filter specification and
-specifying a single column. For example, the following command
-projects the same 1D image along the y axis of a table as use of
-the )BD(-p y)ES( switch:
-) 4 59 PR( funimage ev.fits'[bincols=y]' stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5)RP(
-
-)0 P(Examples:
-)0 P(Create a FITS image from a FITS binary table:
-) 1 33 PR( [sh] funimage test.ev test.fits)RP(
-
-)0 P(Display the FITS image generated from a blocked section of FITS binary table:
-) 5 60 PR( [sh] funimage "test.ev[2:8,3:7,2]" stdout | fundisp stdin
- 1 2 3
- --------- --------- ---------
- 1: 20 28 36
- 2: 28 36 44)RP(
-
-
-
-
-)0 2 14 H(funindex)WB 77 Sn()WB 11 Sn( - create an index for a column of a FITS binary table)EA()EH(
-
-
-)BD() 1 42 PR(funindex <switches> <iname> <key> [oname])RP()ES(
-
-
-)0 P() 7 71 PR( NB: these options are not compatible with Funtools processing. Please
- use the defaults instead.
- -c # compress output using gzip"
- -a # ASCII output, ignore -c \201default: FITS table\202"
- -f # FITS table output \201default: FITS table\202"
- -l # long output, i.e. with key value\201s\202 \201default: long\202"
- -s # short output, i.e. no key value\201s\202 \201default: long\202")RP(
-
-
-)0 P(The funindex script creates an index for the specified column \201key\202 by
-running funtable -s \201sort\202 and then saving the column value and the
-record number for each sorted row. This index will be used automatically
- by funtools filtering of that column, provided the index file's modification
-date is later than that of the data file.
-
-)0 P(
-The first required argument is the name of the FITS binary table
-to index. Please note that text files cannot be indexed at this time.
-The second required argument is the column \201key\202 name to index. While
-multiple keys can be specified in principle, the funtools index processing
-assume a single key and will not recognize files containing multiple keys.
-
-)0 P(By default, the output index file name is [root]_[key].idx, where [root]
-is the root of the input file. Funtools looks for this specific file name
-when deciding whether to use an index for faster filtering. Therefore, the
-optional third argument \201output file name\202 should not be used for funtools
-processing.
-
-)0 P(For example, to create an index on column Y for a given FITS file, use:
-) 1 21 PR( funindex foo.fits Y)RP(
-This will generate an index named foo_y.idx, which will be used by funtools
-for filters involving the Y column.
-
-
-
-
-)0 2 15 H(funjoin)WB 78 Sn()WB 12 Sn( - join two or more FITS binary tables on specified columns)EA()EH(
-
-
-)BD() 1 57 PR(funjoin [switches] <ifile1> <ifile2> ... <ifilen> <ofile>)RP()ES(
-
-
-)0 P() 11 74 PR( -a cols # columns to activate in all files
- -a1 cols ... an cols # columns to activate in each file
- -b 'c1:bvl,c2:bv2' # blank values for common columns in all files
- -bn 'c1:bv1,c2:bv2' # blank values for columns in specific files
- -j col # column to join in all files
- -j1 col ... jn col # column to join in each file
- -m min # min matches to output a row
- -M max # max matches to output a row
- -s # add 'jfiles' status column
- -S col # add col as status column
- -t tol # tolerance for joining numeric cols [2 files only])RP(
-
-
-)BD(funjoin)ES( joins rows from two or more \201up to 32\202
-)0 42 1 A(FITS Binary Table files)42 0 TN TL()Ec /AF f D(, based on the values
-of specified join columns in each file. NB: the join columns must have
-an index file associated with it. These files are generated using the
-)BD(funindex)ES( program.
-
-)0 P(The first argument to the program specifies the first input FITS table
-or raw event file. If "stdin" is specified, data are read from the
-standard input. Subsequent arguments specify additional event files
-and tables to join. The last argument is the output FITS file.
-
-)0 P(NB: Do )BD(not)ES( use )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions and row filters when running
-funjoin or you will get wrong results. Rows are accessed and joined
-using the index files directly, and this bypasses all filtering.
-
-)0 P(The join columns are specified using the )BD(-j col)ES( switch \201which
-specifies a column name to use for all files\202 or with )BD(-j1 col1)ES(,
-)BD(-j2 col2)ES(, ... )BD(-jn coln)ES( switches \201which specify a column
-name to use for each file\202. A join column must be specified for each file.
-If both )BD(-j col)ES( and )BD(-jn coln)ES( are specified for a given
-file, then the latter is used. Join columns must either be of type
-string or type numeric; it is illegal to mix numeric and string
-columns in a given join. For example, to join three files using the
-same key column for each file, use:
-) 1 52 PR( funjoin -j key in1.fits in2.fits in3.fits out.fits)RP(
-A different key can be specified for the third file in this way:
-) 1 65 PR( funjoin -j key -j3 otherkey in1.fits in2.fits in3.fits out.fits)RP(
-
-)0 P(The )BD(-a "cols")ES( switch \201and )BD(-a1 "col1")ES(,
-)BD(-a2 "cols2")ES( counterparts\202 can be used to specify columns to
-activate \201i.e. write to the output file\202 for each input file. By
-default, all columns are output.
-
-)0 P(If two or more columns from separate files have the same name, the
-second \201and subsequent\202 columns are renamed to have an underscore
-and a numeric value appended.
-
-)0 P(The )BD(-m min)ES( and )BD(-M max)ES( switches specify the minimum
-and maximum number of joins required to write out a row. The default
-minimum is 0 joins \201i.e. all rows are written out\202 and the default maximum
-is 63 \201the maximum number of possible joins with a limit of 32 input files\202.
-For example, to write out only those rows in which exactly two files
-have columns that match \201i.e. one join\202:
-) 1 66 PR( funjoin -j key -m 1 -M 1 in1.fits in2.fits in3.fits ... out.fits)RP(
-
-)0 P(A given row can have the requisite number of joins without all of the
-files being joined \201e.g. three files are being joined but only two
-have a given join key value\202. In this case, all of the columns of the
-non-joined file are written out, by default, using blanks \201zeros or NULLs\202.
-The )BD(-b c1:bv1,c2:bv2)ES( and
-)BD(-b1 'c1:bv1,c2:bv2' -b2 'c1:bv1,c2:bv2' ...)ES(
-switches can be used to set the blank value for columns common to all
-files and/or columns in a specified file, respectively. Each blank value
-string contains a comma-separated list of column:blank_val specifiers.
-For floating point values \201single or double\202, a case-insensitive string
-value of "nan" means that the IEEE NaN \201not-a-number\202 should be
-used. Thus, for example:
-) 1 62 PR( funjoin -b "AKEY:???" -b1 "A:-1" -b3 "G:NaN,E:-1,F:-100" ...)RP(
-means that a non-joined AKEY column in any file will contain the
-string "???", the non-joined A column of file 1 will contain a value
-of -1, the non-joined G column of file 3 will contain IEEE NaNs, while
-the non-joined E and F columns of the same file will contain values -1
-and -100, respectively. Of course, where common and specific blank values
-are specified for the same column, the specific blank value is used.
-
-)0 P(To distinguish which files are non-blank components of a given row,
-the )BD(-s)ES( \201status\202 switch can be used to add a bitmask column named
-"JFILES" to the output file. In this column, a bit is set for each
-non-blank file composing the given row, with bit 0 corresponds to the
-first file, bit 1 to the second file, and so on. The file names
-themselves are stored in the FITS header as parameters named JFILE1,
-JFILE2, etc. The )BD(-S col)ES( switch allows you to change the name
-of the status column from the default "JFILES".
-
-)0 P(A join between rows is the Cartesian product of all rows in one file
-having a given join column value with all rows in a second file having
-the same value for its join column and so on. Thus, if file1 has 2
-rows with join column value 100, file2 has 3 rows with the same value,
-and file3 has 4 rows, then the join results in 2*3*4=24 rows being output.
-
-)0 P(The join algorithm directly processes the index file associated with
-the join column of each file. The smallest value of all the current
-columns is selected as a base, and this value is used to join
-equal-valued columns in the other files. In this way, the index files
-are traversed exactly once.
-
-)0 P(The )BD(-t tol)ES( switch specifies a tolerance value for numeric
-columns. At present, a tolerance value can join only two files at a
-time. \201A completely different algorithm is required to join more than
-two files using a tolerance, somethng we might consider implementing
-in the future.\202
-
-)0 P(The following example shows many of the features of funjoin. The input files
-t1.fits, t2.fits, and t3.fits contain the following columns:
-) 28 49 PR( [sh] fundisp t1.fits
- AKEY KEY A B
- ----------- ------ ------ ------
- aaa 0 0 1
- bbb 1 3 4
- ccc 2 6 7
- ddd 3 9 10
- eee 4 12 13
- fff 5 15 16
- ggg 6 18 19
- hhh 7 21 22
-
-fundisp t2.fits
- AKEY KEY C D
- ----------- ------ ------ ------
- iii 8 24 25
- ggg 6 18 19
- eee 4 12 13
- ccc 2 6 7
- aaa 0 0 1
-
-fundisp t3.fits
- AKEY KEY E F G
------------- ------ -------- -------- -----------
- ggg 6 18 19 100.10
- jjj 9 27 28 200.20
- aaa 0 0 1 300.30
- ddd 3 9 10 400.40)RP(
-
-)0 P(Given these input files, the following funjoin command:
-) 3 59 PR( funjoin -s -a1 "-B" -a2 "-D" -a3 "-E" -b \200
- "AKEY:???" -b1 "AKEY:XXX,A:255" -b3 "G:NaN,E:-1,F:-100" \200
- -j key t1.fits t2.fits t3.fits foo.fits)RP(
-will join the files on the KEY column, outputting all columns except B
-\201in t1.fits\202, D \201in t2.fits\202 and E \201in t3.fits\202, and setting blank
-values for AKEY \201globally, but overridden for t1.fits\202 and A \201in file
-1\202 and G, E, and F \201in file 3\202. A JFILES column will be output to
-flag which files were used in each row:
-) 12 105 PR( AKEY KEY A AKEY_2 KEY_2 C AKEY_3 KEY_3 F G JFILES
- ------------ ------ ------ ------------ ------ ------ ------------ ------ -------- ----------- --------
- aaa 0 0 aaa 0 0 aaa 0 1 300.30 7
- bbb 1 3 ??? 0 0 ??? 0 -100 nan 1
- ccc 2 6 ccc 2 6 ??? 0 -100 nan 3
- ddd 3 9 ??? 0 0 ddd 3 10 400.40 5
- eee 4 12 eee 4 12 ??? 0 -100 nan 3
- fff 5 15 ??? 0 0 ??? 0 -100 nan 1
- ggg 6 18 ggg 6 18 ggg 6 19 100.10 7
- hhh 7 21 ??? 0 0 ??? 0 -100 nan 1
- XXX 0 255 iii 8 24 ??? 0 -100 nan 2
- XXX 0 255 ??? 0 0 jjj 9 28 200.20 4)RP(
-
-
-
-)0 2 16 H(funmerge)WB 79 Sn()WB 13 Sn( - merge one or more Funtools table files)EA()EH(
-
-
-)BD() 1 61 PR(funmerge [-w|-x] -f [colname] <iname1> <iname2> ... <oname>)RP()ES(
-
-
-)0 P() 3 68 PR( -f # output a column specifying file from which this event came
- -w # adjust position values using WCS info
- -x # adjust position values using WCS info and save old values)RP(
-
-
-)0 P()BD(funmerge)ES( merges FITS data from one or more
-)0 42 1 A(FITS Binary Table files)42 0 TN TL()Ec /AF f D(
-or raw event files.
-)0 P(The first argument to the program specifies the first input FITS table
-or raw event file. If "stdin" is specified, data are read from the
-standard input. Use )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions and row filters. Subsequent
-arguments specify additional event files and tables to merge. \201NB: Stdin
-cannot not be used for any of these additional input file arguments.\202
-The last argument is the output FITS file. The columns in each input table
-must be identical.
-
-)0 P(If an input file begins with the '@' character, it is processed as an
-include file, i.e., as a text file containing event file names \201as
-well as blank lines and/or comment lines starting with the '#' sign\202.
-If standard input is specified as an include file \201'@stdin'\202, then
-file names are read from the standard input until EOF \201^D\202. Event
-files and include files can be mixed on a command line.
-
-)0 P(Rows from each table are written sequentially to the output
-file. If the switch )BD(-f [colname])ES( is specified on the command
-line, an additional column is added to each row containing the number
-of the file from which that row was taken \201starting from one\202. In
-this case, the corresponding file names are stored in the header
-parameters having the prefix )BD(FUNFIL)ES(, i.e., FUNFIL01,
-FUNFIL02, etc.
-
-)0 P(Using the )BD(-w)ES( switch \201or )BD(-x)ES( switch as described
-below\202, )BD(funmerge)ES( also can adjust the position column values
-using the WCS information in each file. \201By position columns, we mean
-the columns that the table is binned on, i.e., those columns defined
-by the )BD(bincols=)ES( switch, or \201X,Y\202 by default.\202 To perform WCS
-alignment, the WCS of the first file is taken as the base WCS. Each
-position in subsequent files is adjusted by first converting it to the
-sky coordinate in its own WCS coordinate system, then by converting
-this sky position to the sky position of the base WCS, and finally
-converting back to a pixel position in the base system. Note that in
-order to perform WCS alignment, the appropriate WCS and TLMIN/TLMAX
-keywords must already exist in each FITS file.
-)0 P(When performing WCS alignment, you can save the original positions in
-the output file by using the )BD(-x)ES( \201for "xtra"\202 switch instead
-of the )BD(-w)ES( switch \201i.e., using this switch also implies using
-)BD(-w)ES(\202 The old positions are saved in columns having the same
-name as the original positional columns, with the added prefix "OLD_".
-)0 P(Examples:
-
-)0 P(Merge two tables, and preserve the originating file number for
-each row in the column called "FILE" \201along with the corresponding
-file name in the header\202:
-) 1 51 PR( [sh] funmerge -f "FILE" test.ev test2.ev merge.ev)RP(
-
-)0 P(Merge two tables with WCS alignment, saving the old position values in
-2 additional columns:
-) 1 44 PR( [sh] funmerge -x test.ev test2.ev merge.ev)RP(
-
-)0 P(This program only works on raw event files and binary tables. We have
-not yet implemented image and array merging.
-
-
-
-
-)0 2 17 H(funsky)WB 80 Sn()WB 14 Sn( - convert between image and sky coordinates)EA()EH(
-
-
-)BD() 4 72 PR( funsky iname[ext] # RA,Dec \201deg\202 or image pix from stdin
- funsky iname[ext] [lname] # RA, Dec \201deg\202 or image pix from list
- funsky iname[ext] [col1] [col2] # named cols:units from stdin
- funsky iname[ext] [lname] [col1] [col2] # named cols:units from list)RP()ES(
-
-
-)0 P() 5 73 PR( -d # always use integer tlmin conversion \201as ds9 does\202
- -r # convert x,y to RA,Dec \201default: convert RA,Dec to x,y\202
- -o # include offset from the nominal target position \201in arcsec\202
- -v # display input values also \201default: display output only\202
- -T # output display in rdb format \201w/header,tab delimiters\202)RP(
-
-
-)0 P(Funsky converts input sky coordinates \201RA, Dec\202 to image coordinates \201or vice
-versa\202 using the WCS information contained in the specified FITS file. Several
-calling sequences are supported in order to make it easy to specify
-coordinate positions in different ways.
-
-)0 P(The first required argument is always the input FITS file \201or
-extension\202 containing the WCS information in an extension header. Note
-that the data from this file is not used. By default, the program
-converts input RA and Dec values to X and Y using this WCS
-information. If the WCS is associated with a FITS image, then the X,Y
-values are image values. If the WCS is associated with a binary table,
-then the X, Y values are physical values. To convert X,Y to RA and
-Dec, use the )BD(-r)ES( \201reverse\202 switch.
-
-)0 P(If no other command arguments are supplied, then the input positions
-are read from the standard input. Each line is assumed to contain a
-single coordinate position consisting of an RA in degrees \201or X in
-pixels\202 followed by a Dec in degrees \201or Y in pixels\202. The usual
-delimiters are supported \201spaces, commas, tabs\202. For example:
-) 9 52 PR( # read from stdin, default column names and units
- [sh] funsky snr.ev
- 22.982695 58.606523 # input RA \201hrs\202, Dec\201deg\202
- 510.00 510.00
- 22.982127 58.607634 # input
- 512.00 510.50
- 22.981700 58.614301 # input
- 513.50 513.50
- ^D # end of input)RP(
-
-)0 P(If a second argument is supplied, this argument is assumed to be
-a file containing RA \201X\202 and Dec \201Y\202 positions. The file can either be
-an ASCII table or a FITS binary table. The order of columns is
-unimportant, if the table has a column header. In this case, the
-names of the columns must be one of "RA", "DEC", or "X", "Y" for sky
-to image and image to sky conversions, respectively. If the table has
-no header, then once again, RA \201X\202 is assumed to first, followed
-by DEC \201Y\202.
-For example:
-) 12 50 PR( # read from file, default column names and units
- [sh] cat hd.in
- RA DEC
- --------- ---------
- 22.982695 58.606523
- 22.982127 58.607634
- 22.981700 58.614301
-
- [sh] funsky snr.ev hd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50)RP(
-
-)0 P(If three arguments are supplied, then the input positions again are
-read from the standard input. Each line is assumed to contain a single
-coordinate position consisting of an RA \201or X in pixels\202 followed by a
-Dec \201or Y in pixels\202, with the usual delimiters supported. However,
-the second and third arguments now specify the column names and/or
-sky units using a colon-delimited syntax:
-) 1 19 PR( [colname]:[h|d|r])RP(
-If the colname is omitted, the names default to "RA", "DEC", "X", "Y",
-"COL1", or "COL2" as above. If the units are omitted, the default is degrees
-for both RA and Dec. When the -r switch is used \201convert from image
-to sky\202 the units are applied to the output instead of the input. The following
-examples will serve to illustrate the options:
-) 36 66 PR( # read from stdin, specifying column names \201def. units: degrees\202
- [sh] cat hd.in
- MYRA MYDEC
- --------- ---------
- 22.982695 58.606523
- 22.982127 58.607634
- 22.981700 58.614301
-
- [sh] funsky snr.ev MYRA MYDEC < hd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read from stdin, specifying column names and units
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev MYRA:d MYDEC:d < dd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read stdin, convert image to sky, specifying output sky units
- [sh] cat im.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50)WR(
-
- [sh] cat im.in | funsky -r snr.ev :d :d
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301)RP(
-
-)0 P(Finally, four command arguments specify both and input file and column names
-and/or units:
-) 22 64 PR( [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read file, convert image to sky, specifying output sky units
- [sh] cat im.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] funsky -r snr.ev im.in :d :d
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301)RP(
-
-)0 P(By default, the output of funsky consists only of the converted coordinate
-position\201s\202, one per output line. This makes parsing in shell scripts easy.
-Use the )BD(-v)ES( \201verbose\202 switch to specify that the input
-coordinates should be pre-pended to each line. For example:
-) 16 53 PR( [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] funsky -v snr.ev dd.in MYRA:d MYDEC:d
- 344.740432 58.606523 510.00 510.00
- 344.731900 58.607634 512.00 510.50
- 344.725500 58.614301 513.50 513.50)RP(
-
-)0 P(In addition, a full starbase table can be output using the )BD(-T)ES(
-\201table\202 switch. This switch can be used with or without the -v
-switch. If the -T and -v are both specified, then a descriptive header
-parameters are output before the table \201mainly to remind you of the
-sky units\202:
-) 23 62 PR( # output table in non-verbose mode
- [sh] funsky -T snr.ev dd.in MYRA:d MYDEC:d
- X Y
- ------------ ------------
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # output table in verbose mode
- [sh] funsky -T -v snr.ev dd.in MYRA:d MYDEC:d
- # IFILE = /Users/eric/data/snr.ev
- # ICOL1 = MYRA
- # ICOL2 = MYDEC
- # IUNITS1 = d
- # IUNITS2 = d
- # OCOL1 = X
- # OCOL2 = Y
-
- MYRA MYDEC X Y
- ------------ ------------ ------------ ------------
- 344.740432 58.606523 510.00 510.00
- 344.731900 58.607634 512.00 510.50
- 344.725500 58.614301 513.50 513.50)RP(
-
-)0 P(Finally, the )BD(-d)ES( \201ds9\202 switch mimicks ds9's use of integer TLMIN
-and TLMAX values for all coordinate transformations. FITS conventions
-seem to call for use of floating point TLMIN and TLMAX when the data are
-floats. This convention is followed by funsky but results in a
-small discrepancy with ds9's converted values for floating point
-data. We will remedy this conflict in the future, maybe.
-
-
-
-
-)0 2 18 H(funtable)WB 81 Sn()WB 15 Sn( - copy selected rows from a Funtools file to a FITS binary table)EA()EH(
-
-
-)BD() 1 62 PR(funtable [-a] [-i|-z] [-m] [-s cols] <iname> <oname> [columns])RP()ES(
-
-
-)0 P() 5 61 PR( -a # append to existing output file as a table extension
- -i # for image data, only generate X and Y columns
- -m # for tables, write a separate file for each region
- -s "col1 ..." # columns on which to sort
- -z # for image data, output zero-valued pixels)RP(
-
-
-)0 P()BD(funtable)ES( selects rows from the specified
-)0 42 1 A(FITS Extension)42 0 TN TL()Ec /AF f D(
-\201binary table only\202 of a FITS file, or from a non-FITS raw event
-file, and writes those rows to a FITS binary table file. It also
-will create a FITS binary table from an image or a raw array file.
-
-)0 P(The first argument to the program specifies the FITS file, raw event
-file, or raw array file. If "stdin" is specified, data are read from
-the standard input. Use )0 42 1 A(Funtools Bracket
-Notation)42 0 TN TL()Ec /AF f D( to specify FITS extensions, and filters. The second
-argument is the output FITS file. If "stdout" is specified, the FITS
-binary table is written to the standard output. By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional third argument in the form:
-) 1 31 PR( "column1 column1 ... columnN")RP(
-
-)0 P(The )BD(funtable)ES( program generally is used to select rows from a
-FITS binary table using
-)0 52 1 A(Table Filters)52 0 TN TL()Ec /AF f D(
-and/or
-)0 54 1 A(Spatial Region Filters)54 0 TN TL()Ec /AF f D(.
-For example, you can copy only selected rows \201and output only selected
-columns\202 by executing in a command such as:
-) 13 75 PR( [sh] funtable "test.ev[pha==1&)SY(\160)ES(==10]" stdout "x y pi pha" | fundisp stdin
- X Y PHA PI
- ------- ------- ------- ---------
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10)RP(
-)0 P(The special column )BD($REGION)ES( can be specified to write the
-region id of each row:
-) 12 113 PR( [sh $] funtable "test.ev[time-\201int\202time>=.99&&annulus\2010 0 0 10 n=3\202]" stdout 'x y time $REGION' | fundisp stdin
- X Y TIME REGION
- -------- -------- --------------------- ----------
- 5 -6 40.99000000 3
- 4 -5 59.99000000 2
- -1 0 154.99000000 1
- -2 1 168.99000000 1
- -3 2 183.99000000 2
- -4 3 199.99000000 2
- -5 4 216.99000000 2
- -6 5 234.99000000 3
- -7 6 253.99000000 3)RP(
-)0 P(Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are written.
-)0 P(Columns can be excluded from display using a minus sign before the
-column:
-) 12 79 PR( [sh $] funtable "test.ev[time-\201int\202time>=.99]" stdout "-time" | fundisp stdin
- X Y PHA PI DX DY
- -------- -------- -------- ---------- ----------- -----------
- 5 -6 5 -6 5.50 -6.50
- 4 -5 4 -5 4.50 -5.50
- -1 0 -1 0 -1.50 0.50
- -2 1 -2 1 -2.50 1.50
- -3 2 -3 2 -3.50 2.50
- -4 3 -4 3 -4.50 3.50
- -5 4 -5 4 -5.50 4.50
- -6 5 -6 5 -6.50 5.50
- -7 6 -7 6 -7.50 6.50)RP(
-All columns except the time column are written.
-)0 P(In general, the rules for activating and de-activating columns are:
-)UL()-1 LI( If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-)-1 LI( If only include columns are specified, then only the specified columns
-are activated.
-)-1 LI( If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.)LU(
-In addition to specifying columns names explicitly, the special
-symbols )EM(+)ES( and )EM(-)ES( can be used to activate and
-de-activate )EM(all)ES( columns. This is useful if you want to
-activate the $REGION column along with all other columns. According
-to the rules, the syntax "$REGION" only activates the region column
-and de-activates the rest. Use "+ $REGION" to activate all
-columns as well as the region column.
-
-)0 P(Ordinarily, only the selected table is copied to the output file. In
-a FITS binary table, it sometimes is desirable to copy all of the
-other FITS extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. For example, the first command below copies only the EVENT table,
-while the second command copies other extensions as well:
-) 2 64 PR( [sh] funtable "/proj/rd/data/snr.ev[EVENTS]" events.ev
- [sh] funtable "/proj/rd/data/snr.ev[EVENTS+]" eventsandmore.ev)RP(
-
-)0 P(If the input file is an image or a raw array file, then
-)BD(funtable)ES( will generate a FITS binary table from the pixel
-values in the image. Note that it is not possible to specify the
-columns to output \201using command-line argument 3\202. Instead, there are
-two ways to create such a binary table from an image. By default, a
-3-column table is generated, where the columns are "X", "Y", and
-"VALUE". For each pixel in the image, a single row \201event\202 is
-generated with the "X" and "Y" columns assigned the dim1 and dim2
-values of the image pixel, respectively and the "VALUE" column
-assigned the value of the pixel. With sort of table, running
-)BD(funhist)ES( on the "VALUE" column will give the same results as
-running )BD(funhist)ES( on the original image.
-
-)0 P(If the )BD(-i)ES( \201"individual" rows\202 switch is specified, then only
-the "X" and "Y" columns are generated. In this case, each positive
-pixel value in the image generates n rows \201events\202, where n is equal
-to the integerized value of that pixel \201plus 0.5, for floating point
-data\202. In effect, )BD(-i)ES( approximately recreates the rows of a
-table that would have been binned into the input image. \201Of course,
-this is only approximately correct, since the resulting x,y positions
-are integerized.\202
-
-)0 P(If the )BD(-s [col1 col2 ... coln])ES( \201"sort"\202 switch is specified,
-the output rows of a binary table will be sorted using the
-specified columns as sort keys. The sort keys must be scalar columns
-and also must be part of the output file \201i.e. you cannot sort on a
-column but not include it in the output\202. This facility uses the
-)BD(_sort)ES( program \201included with funtools\202, which must be accessible
-via your path.
-
-)0 P(For binary tables, the )BD(-m)ES( \201"multiple files"\202 switch will
-generate a separate file for each region in the filter specification
-i.e. each file contains only the rows from that region. Rows
-which pass the filter but are not in any region also are put in a
-separate file.
-
-)0 P(The separate output file names generated by the )BD(-m)ES( switch are
-produced automatically from the root output file to contain the region id of
-the associated region. \201Note that region ids start at 1, so that the
-file name associated with id 0 contains rows that pass the filter but
-are not in any given region.\202 Output file names are generated as follows:
-
-)UL()-1 LI( A $n specification can be used anywhere in the root file name \201suitably
-quoted to protect it from the shell\202 and will be expanded to be the id
-number of the associated region. For example:
-) 1 78 PR( funtable -m input.fits'[cir\201512,512,1\202;cir\201520,520,1\202...]' 'foo.goo_$n.fits')RP(
-will generate files named foo.goo_0.fits \201for rows not in any region but
-still passing the filter\202, foo.goo_1.fits \201rows in region id #1, the first
-region\202, foo.goo_2.fits \201rows in region id #2\202, etc. Note that single quotes
-in the output root are required to protect the '$' from the shell.
-
-)-1 LI( If $n is not specified, then the region id will be placed before
-the first dot \201.\202 in the filename. Thus:
-) 1 73 PR( funtable -m input.fits'[cir\201512,512,1\202;cir\201520,520,1\202...]' foo.evt.fits)RP(
-will generate files named foo0.evt.fits \201for rows not in any region but
-still passing the filter\202, foo1.evt.fits \201rows in region id #1\202,
-foo2.evt.fits \201rows in region id #2\202, etc.
-
-)-1 LI( If no dot is specified in the root output file name, then
-the region id will be appended to the filename. Thus:
-) 1 70 PR( funtable -m input.fits'[cir\201512,512,1\202;cir\201520,520,1\202...]' 'foo_evt')RP(
-will generate files named foo_evt0 \201for rows not in any region but
-still passing the filter\202, foo_evt1 \201rows in region id #1\202,
-foo_evt2 \201rows in region id #2\202, etc.)LU(
-The multiple file mechanism provide a simple way to generate
-individual source data files with a single pass through the data.
-
-)0 P(By default, a new FITS file is created and the binary table is written
-to the first extension. If the )BD(-a)ES( \201append\202 switch is specified,
-the table is appended to an existing FITS file as a BINTABLE extension.
-Note that the output FITS file must already exist.
-
-)0 P(If the )BD(-z)ES( \201"zero" pixel values\202 switch is specified and
-)BD(-i)ES( is not specified, then pixels having a zero value will
-be output with their "VALUE" column set to zero. Obviously, this
-switch does not make sense when individual events are output.
-
-
-
-
-)0 2 19 H(funtbl)WB 82 Sn()WB 16 Sn( - extract a table from Funtools ASCII output)EA()EH(
-
-
-)BD() 1 61 PR(funtable [-c cols] [-h] [-n table] [-p prog] [-s sep] <iname>)RP()ES(
-
-
-)0 P([NB: This program has been deprecated in favor of the ASCII text processing
-support in funtools. You can now perform fundisp on funtools ASCII output
-files \201specifying the table using bracket notation\202 to extract tables
-and columns.]
-
-The )BD(funtbl)ES( script extracts a specified table \201without the
-header and comments\202 from a funtools ASCII output file and writes the
-result to the standard output. The first non-switch argument is the
-ASCII input file name \201i.e. the saved output from funcnts, fundisp,
-funhist, etc.\202. If no filename is specified, stdin is read. The
--n switch specifies which table \201starting from 1\202 to extract. The
-default is to extract the first table. The -c switch is a
-space-delimited list of column numbers to output, e.g. -c "1 3 5"
-will extract the first three odd-numbered columns. The default is to
-extract all columns. The -s switch specifies the separator string to
-put between columns. The default is a single space. The -h switch
-specifies that column names should be added in a header line before
-the data is output. Without the switch, no header is prepended. The
--p program switch allows you to specify an awk-like program to run
-instead of the default \201which is host-specific and is determined at
-build time\202. The -T switch will output the data in rdb format \201i.e.,
-with a 2-row header of column names and dashes, and with data columns
-separated by tabs\202. The -help switch will print out a message
-describing program usage.
-
-)0 P(For example, consider the output from the following funcnts command:
-) 37 82 PR( [sh] funcnts -sr snr.ev "ann 512 512 0 9 n=3"
- # source
- # data file: /proj/rd/data/snr.ev
- # arcsec/pixel: 8
- # background
- # constant value: 0.000000
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # summed background-subtracted results
- upto net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
- 2 625.000 25.000 0.000 0.000 6976.00 0.090 0.004
- 3 1442.000 37.974 0.000 0.000 15936.00 0.090 0.002
-
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
- 2 478.000 21.863 0.000 0.000 5376.00 0.089 0.004
- 3 817.000 28.583 0.000 0.000 8960.00 0.091 0.003
-
-
- # the following source and background components were used:
- source_region\201s\202
- ----------------
- ann 512 512 0 9 n=3)WR(
-
- reg counts pixels sumcnts sumpix
- ---- ------------ --------- ------------ ---------
- 1 147.000 25 147.000 25
- 2 478.000 84 625.000 109
- 3 817.000 140 1442.000 249)RP(
-)0 P(There are four tables in this output. To extract the last one, you
-can execute:
-) 4 60 PR( [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -n 4
- 1 147.000 25 147.000 25
- 2 478.000 84 625.000 109
- 3 817.000 140 1442.000 249)RP(
-Note that the output has been re-formatted so that only a single space
-separates each column, with no extraneous header or comment information.
-
-)0 P(To extract only columns 1,2, and 4 from the last example \201but with a header
-prepended and tabs between columns\202, you can execute:
-) 5 82 PR( [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -c "1 2 4" -h -n 4 -s "\200t"
- #reg counts sumcnts
- 1 147.000 147.000
- 2 478.000 625.000
- 3 817.000 1442.000)RP(
-)0 P(Of course, if the output has previously been saved in a file named
-foo.out, the same result can be obtained by executing:
-) 5 48 PR( [sh] funtbl -c "1 2 4" -h -n 4 -s "\200t" foo.out
- #reg counts sumcnts
- 1 147.000 147.000
- 2 478.000 625.000
- 3 817.000 1442.000)RP(
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 20 H(Last)WB 83 Sn( updated: April 1, 2007)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (ds9.html) D
-/Ti (Funtools and DS9 Image Display) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 17 Sn(
-
-
-)0 2 21 H(FunDS9:)WB 85 Sn()WB 84 Sn( Funtools and DS9 Image Display)EA()EH(
-
-
-)0 2 22 H(Summary)WB 86 Sn()EH(
-Describes how funtools can be integrated into the ds9 Analysis menu.
-
-
-)0 2 23 H(Description)WB 87 Sn()EH(
-)0 P()R1 2 A(SAOImage/DS9)EA( is an astronomical imaging and data visualization
-application used by astronomers around the world. DS9 can display
-standard astronomical FITS images and binary tables, but also has
-support for displaying raw array files, shared memory files, and data
-files automatically retrieved via FTP and HTTP. Standard functional
-capabilities include multiple frame buffers, colormap and region
-manipulation, and many data scaling algorithms. DS9's advanced
-features include TrueColor visuals, deep frame buffers, true
-PostScript printing, and display of image mosaics. The program's
-support of image tiling, "blinking", arbitrary zoom, rotation, and pan
-is unparalleled in astronomy. It also has innovative support for
-automatic retrieval and display of standard image data such as the
-Digital Sky Survey \201using servers at SAO, StScI, or ESO\202.
-
-)0 P(DS9 can communicate with external programs such as Funtools using the
-)R2 2 A(XPA)EA(
-messaging system. In addition, programs can be integrated directly
-into the DS9 GUI by means of a configurable Analysis menu. By
-default, the DS9 Analysis menu contains algorithms deemed essential to
-the core functions of DS9, e.g., display cross-cuts of data,
-iso-intensity contours, and WCS grids. However, new programs can be
-added to DS9 by creating a set-up file which can be loaded into DS9
-to reconfigure the Analysis menu.
-
-) 7 48 PR(The basic format of the analysis set-up file is:
-)0 P( #
- # Analysis command descriptions:
- # menu label/description
- # file templates for this command
- # "menu" \201add to menu\202 |"bind" \201bind to key\202
- # analysis command line)RP(
-
-For example, the funcnts program can be specified in this way:
-) 4 69 PR( Funcnts \201counts in source/bkgd regions; options: none\202
- *
- menu
- funcnts $filename $regions\201source,,\202 $regions\201background,,\202 | $text)RP(
-As shown above, DS9 supports a macro facility to provide information
-as well as task support to command lines. For example, the $regions
-macro is expanded by DS9 to provide the current source and/or
-background region to the analysis command. The $text macro is expanded
-to generate a text window display. It also is possible to query for
-parameters using a $param macro, plot data using a $plot macro,
-etc. See the DS9 documentation for further details.
-
-)0 P(A set-up file called )0 2 A(funtools.ds9)EA( will
-load some useful Funtools applications \201counts in regions, radial
-profile, X-ray light curve and energy spectrum, 1D histogram\202 into the DS9
-Analysis menu \201version 2.1 and above\202. The file resides in the bin
-directory where Funtools programs are installed. It can be manually
-loaded into DS9 from the )BD(Load Analysis Commands ...)ES( option of
-the )BD(Analysis)ES( menu. Alternatively, you can tell DS9 to load
-this file automatically at start-up time by adding the pathname to the
-)BD(Edit)ES(->)BD(Preferences)ES(->)BD(Analysis Menu)ES(->)BD(Analysis
-File)ES( menu option. \201NB: make sure you select
-)BD(Edit)ES(->)BD(Preferences)ES(->)BD(Save Preferences)ES( after setting
-the pathname.\202
-
-)0 P(The tasks in this setup file generally process the original disk-based
-FITS file. Funcnts-based results \201radial profile, counts in regions\202
-are presented in WCS units, if present in the FITS header. For
-situations where a disk file is not available \201e.g., image data
-generated and sent to DS9's 'fits' XPA access point\202, versions of the
-radial profile and counts in regions tasks also are also offered
-utilizing DS9's internal image data. Results are presented in pixels.
-Aside from the units, the results should be identical to the file-based
-results.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 24 H(Last)WB 88 Sn( updated: November 16, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (library.html) D
-/Ti (Funtools Programming) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 18 Sn(
-
-
-)0 2 25 H(FunLib:)WB 91 Sn()WB 89 Sn( the Funtools Programming Interface)EA()EH(
-
-
-)0 2 26 H(Summary)WB 92 Sn()EH(
-A description of the Funtools library.
-
-
-)0 2 27 H(Introduction)WB 93 Sn()WB 90 Sn( to the Funtools Programming Interface)EH()EA(
-)0 P(To create a Funtools application, you need to include
-the funtools.h definitions file in your code:
-) 1 23 PR( #include <funtools.h>)RP(
-
-You then call Funtools subroutines and functions to access Funtools data.
-The most important routines are:
-)UL(
-)0 P()-1 LI( )0 25 1 A(FunOpen)25 0 TN TL()Ec /AF f D(: open a Funtools file
-)-1 LI()0 35 1 A(FunInfoGet)35 0 TN TL()Ec /AF f D(: get info about an image or table
-)-1 LI()0 26 1 A(FunImageGet)26 0 TN TL()Ec /AF f D(: retrieve image data
-)-1 LI()0 28 1 A(FunImageRowGet)28 0 TN TL()Ec /AF f D(: retrieve image data by row
-)-1 LI()0 27 1 A(FunImagePut)27 0 TN TL()Ec /AF f D(: output image data
-)-1 LI()0 29 1 A(FunImageRowPut)29 0 TN TL()Ec /AF f D(: output image data by row
-)-1 LI()0 32 1 A(FunColumnSelect)32 0 TN TL()Ec /AF f D(: select columns in a table for access
-)-1 LI()0 30 1 A(FunTableRowGet)30 0 TN TL()Ec /AF f D(: retrieve rows from a table
-)-1 LI()0 31 1 A(FunTableRowPut)31 0 TN TL()Ec /AF f D(: output rows to a table
-)-1 LI( )0 40 1 A(FunClose)40 0 TN TL()Ec /AF f D(: close a Funtools file)LU(
-
-Your program must be linked against the libfuntools.a library,
-along with the math library. The following libraries also might be required
-on your system:
-)UL()-1 LI( -lsocket -lnsl for socket support
-)-1 LI( -ldl for dynamic loading)LU(
-)0 P(For example, on a Solaris system using gcc, use the following link line:
-) 1 53 PR( gcc -o foo foo.c -lfuntools -lsocket -lnsl -ldl -lm)RP(
-On a Solaris system using Solaris cc, use the following link line:
-) 1 48 PR( gcc -o foo foo.c -lfuntools -lsocket -lnsl -lm)RP(
-On a Linux system using gcc, use the following link line:
-) 1 38 PR( gcc -o foo foo.c -lfuntools -ldl -lm)RP(
-Once configure has built a Makefile on your platform, the required
-"extra" libraries \201aside from -lm, which always is required\202 are
-specified in that file's EXTRA_LIBS variable. For example, under
-Linux you will find:
-) 3 26 PR( grep EXTRA_LIBS Makefile
- EXTRA_LIBS = -ldl
- ...)RP(
-
-)0 P(The Funtools library contains both the zlib library
-\201http://www.gzip.org/zlib/\202 and Doug Mink's WCS library
-\201http://tdc-www.harvard.edu/software/wcstools/\202. It is not necessary
-to put these libraries on a Funtools link line. Include files
-necessary for using these libraries are installed in the Funtools
-include directory.
-
-)0 2 28 H(Funtools)WB 94 Sn()WB 20 Sn( Programming Tutorial)EA()EH(
-
-The
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(
-function is used to open a FITS file, an array, or a raw event file:
-) 4 79 PR( /* open the input FITS file for reading */
- ifun = FunOpen\201iname, "r", NULL\202;
- /* open the output FITS file for writing, and connect it to the input file */
- ofun = FunOpen\201iname, "w", ifun\202;)RP(
-A new output file can inherit header parameters automatically from
-existing input file by passing the input Funtools handle as the last
-argument to the new file's
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(
-call as shown above.
-
-)0 P(For image data, you then can call
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D(
-to read an image into memory.
-) 3 61 PR( float buf=NULL;
- /* extract and bin the data section into an image buffer */
- buf = FunImageGet\201fun, NULL, "bitpix=-32"\202;)RP(
-If the \201second\202 buf argument to this call is NULL, buffer space is allocated
-automatically. The \201third\202 plist argument can be used to specify the
-return data type of the array. If NULL is specified, the data type of
-the input file is used.
-
-)0 P(To process an image buffer, you would generally make a call to
-)0 35 1 A(FunInfoGet\201\202)35 0 TN TL()Ec /AF f D( to determine the
-dimensions of the image \201which may have been changed from the original
-file dimensions due to )0 49 1 A(Funtools image
-sectioning)49 0 TN TL()Ec /AF f D( on the command line\202. In a FITS image, the index along
-the dim1 axis varies most rapidly, followed by the dim2 axis, etc.
-Thus, to access each pixel in an 2D image, use a double loop such as:)RP(
- buf = FunImageGet\201fun, NULL, "bitpix=-32"\202;
- FunInfoGet\201fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0\202;
- for\201i=1; i<=dim2; i++\202{
- for\201j=1; j<=dim1; j++\202{
- ... process buf[\201\201i-1\202*dim1\202+\201j-1\202] ...
- }
- })RP(
-or:
-) 5 65 PR( buf = FunImageGet\201fun, NULL, "bitpix=-32"\202;
- FunInfoGet\201fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0\202;
- for\201i=0; i<\201dim1*dim2\202; i++\202{
- ... process buf[i] ...
- })RP(
-Finally, you can write the resulting image to disk using
-)0 27 1 A(FunImagePut\201\202)27 0 TN TL()Ec /AF f D(:
-) 1 48 PR( FunImagePut\201fun2, buf, dim1, dim2, -32, NULL\202;)RP(
-Note that Funtools automatically takes care of book-keeping tasks such as
-reading and writing FITS headers \201although you can, of course, write
-your own header or add your own parameters to a header\202.
-
-)0 P(For binary tables and raw event files, a call to
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(
-will be followed by a call to the
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-routine to select columns to be read from the input file and/or
-written to the output file:
-
-) 8 69 PR( typedef struct evstruct{
- double time;
- int time2;
- } *Ev, EvRec;
- FunColumnSelect\201fun, sizeof\201EvRec\202, NULL,
- "time", "D", "rw", FUN_OFFSET\201Ev, time\202,
- "time2", "J", "w", FUN_OFFSET\201Ev, time2\202,
- NULL\202;)RP(
-Columns whose \201third\202 mode argument contains an "r" are "readable",
-i.e., columns will be read from the input file and converted into the
-data type specified in the call's second argument. These columns
-values then are stored in the specified offset of the user record
-structure. Columns whose mode argument contains a "w" are
-"writable", i.e., these values will be written to the output file.
-The
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-routine also offers the option of automatically merging user
-columns with the original input columns when writing the output
-rows.
-
-)0 P(Once a set of columns has been specified, you can retrieve rows using
-)0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D(,
-and write the rows using
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D(:
-) 17 70 PR( Ev ebuf, ev;
- /* get rows -- let routine allocate the array */
- while\201 \201ebuf = \201Ev\202FunTableRowGet\201fun, NULL, MAXROW, NULL, &got\202\202 \202{
- /* process all rows */
- for\201i=0; i<got; i++\202{
- /* point to the i'th row */
- ev = ebuf+i;
- /* time2 is generated here */
- ev->time2 = \201int\202\201ev->time+.5\202;
- /* change the input time as well */
- ev->time = -\201ev->time/10.0\202;
- }
- /* write out this batch of rows with the new column */
- FunTableRowPut\201fun2, \201char *\202ebuf, got, 0, NULL\202;
- /* free row data */
- if\201 ebuf \202 free\201ebuf\202;
- })RP(
-The input rows are retrieved into an array of user structs, which
-can be accessed serially as shown above. Once again, Funtools
-automatically takes care of book-keeping tasks such as reading and writing
-FITS headers \201although you can, of course, write your own header or
-add your own parameters to a header\202.
-
-)0 P(When all processing is done, you can call
-)0 40 1 A(FunClose\201\202)40 0 TN TL()Ec /AF f D(
-to close the file\201s\202:
-) 2 17 PR( FunClose\201fun2\202;
- FunClose\201fun\202;)RP(
-
-)0 P(These are the basics of processing FITS files \201and arrays or raw event
-data\202 using Funtools. The routines in these examples are described in
-more detail below, along with a few other routines that support
-parameter access, data flushing, etc.
-
-)0 2 29 H(Compiling)WB 95 Sn()WB 22 Sn( and Linking)EA()EH(
-)0 P(To create a Funtools application, a software developer will include
-the funtools.h definitions file in Funtools code:
-) 1 23 PR( #include <funtools.h>)RP(
-The program is linked against the libfuntools.a library, along with the
-math library \201and the dynamic load library, if the latter is available
-on your system\202:
-) 1 38 PR( gcc -o foo foo.c -lfuntools -ldl -lm)RP(
-)0 P(If gcc is used, Funtools filtering can be performed using dynamically
-loaded shared objects that are built at run-time. Otherwise, filtering
-is performed using a slave process.
-)0 P(Funtools has been built on the following systems:
-)UL()-1 LI( Sun/Solaris 5.X
-)-1 LI( Linux/RedHat Linux 5.X,6.X,7.X
-)-1 LI( Dec Alpha/OSF1 V4.X
-)-1 LI( WindowsNT/Cygwin 1.0
-)-1 LI( SGI/IRIX64 6.5)LU(
-
-)0 2 30 H(A)WB 96 Sn()WB 21 Sn( Short Digression on Subroutine Order)EA()EH(
-)0 P(There is a natural order for all I/O access libraries. You would not
-think of reading a file without first opening it, or writing a file
-after closing it. A large part of the experiment in funtools is to use
-the idea of "natural order" as a means of making programming
-easier. We do this by maintaining the state of processing for a given
-funtools file, so that we can do things like write headers and flush
-extension padding at the right time, without you having to do it.
-
-)0 P(For example, if you open a new funtools file for writing using
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(,
-then generate an array of image data and call
-)0 27 1 A(FunImagePut\201\202)27 0 TN TL()Ec /AF f D(,
-funtools knows to write the image header automatically.
-There is no need to think about writing a standard header.
-Of course, you can add parameters to the file first by
-calling one of the
-)0 38 1 A(FunParamPut\201\202)38 0 TN TL()Ec /AF f D(
-routines, and these parameters will automatically be added
-to the header when it is written out. There still is no
-need to write the header explicitly.
-
-)0 P(Maintaining state in this way means that there are certain rules of
-order which should be maintained in any funtools program. In particular,
-we strongly recommend the following ordering rules be adhered to:
-
-)UL()-1 LI( When specifying that input extensions be copied to an output file
-via a reference handle, open the output file )BD(before)ES( reading the
-input file. \201Otherwise the initial copy will not occur\202.
-
-)-1 LI( Always write parameters to an output file using one of the
-)0 38 1 A(FunParamPut\201\202)38 0 TN TL()Ec /AF f D( calls
-)BD(before)ES( writing any data. \201This is a good idea for all FITS
-libraries, to avoid having to recopy data is the FITS header needs
-to be extended by adding a single parameter.\202
-
-)-1 LI( If you retrieve an image, and need to know the data
-type, use the FUN_SECT_BITPIX option of
-)0 35 1 A(FunInfoGet\201\202)35 0 TN TL()Ec /AF f D(,
-)BD(after)ES( calling
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D(, since
-it is possible to change the value of BITPIX from the latter.
-
-)-1 LI( When specifying that input extensions be copied to an output file
-via a reference handle, close the output file )BD(before)ES( closing
-input file, or else use
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D(
-explicitly on the output file
-)BD(before)ES( closing the input file. \201Otherwise the final copy will
-not occur\202.)LU(
-
-)0 P(We believe that these are the natural rules that are implied in most
-FITS programming tasks. However, we recognize that making explicit use
-of "natural order" to decide what automatic action to take on behalf
-of the programmer is experimental. Therefore, if you find that your
-needs are not compatible with our preferred order, please let us know
--- it will be most illuminating for us as we evaluate this experiment.
-
-)0 2 31 H(Funtools)WB 97 Sn()WB 41 Sn( Programming Examples)EA()EH(
-)0 P(The following complete coding examples are provided to illustrate the
-simplicity of Funtools applications. They can be found in the funtest
-subdirectory of the Funtools distribution. In many cases, you should
-be able to modify one of these programs to generate your own Funtools
-program:
-)UL()-1 LI()0 2 A(evread.c)EA(: read and write binary tables
-)-1 LI()0 2 A(evcols.c)EA(: add column and rows to binary tables
-)-1 LI()0 2 A(evmerge.c)EA(: merge new columns with existing columns
-)-1 LI()0 2 A(evnext.c)EA(: manipulate raw data pointers
-)-1 LI()0 2 A(imblank.c)EA(: blank out image values below a threshold
-)-1 LI()0 2 A(asc2fits.c)EA(: convert a specific ASCII table to FITS binary table)LU(
-
-)0 2 32 H(The)WB 98 Sn()WB 24 Sn( Funtools Programming Reference Manual)EA()EH(
-)0 P() 45 116 PR(#include <funtools.h>
-
-Fun )0 25 1 A(FunOpen\201char *name, char *mode, Fun ref\202)25 0 TN TL()Ec /AF f D(
-
-void *)0 26 1 A(FunImageGet\201Fun fun, void *buf, char *plist\202)26 0 TN TL()Ec /AF f D(
-
-int )0 27 1 A(FunImagePut\201Fun fun, void *buf, int dim1, int dim2, int bitpix, char *plist\202)27 0 TN TL()Ec /AF f D(
-
-void * )0 28 1 A(FunImageRowGet\201Fun fun, void *buf, int rstart, int rstop, char *plist\202)28 0 TN TL()Ec /AF f D(
-
-void * )0 29 1 A(FunImageRowPut\201Fun fun, void *buf, int rstart, int rstop, int dim1, int dim2, int bitpix, char *plist\202)29 0 TN TL()Ec /AF f D(
-
-int )0 32 1 A(FunColumnSelect\201Fun fun, int size, char *plist, ...\202)32 0 TN TL()Ec /AF f D(
-
-void )0 33 1 A(FunColumnActivate\201Fun fun, char *s, char *plist\202)33 0 TN TL()Ec /AF f D(
-
-int )0 34 1 A(FunColumnLookup\201Fun fun, char *s, int which, char **name, int *type, int *mode, int *offset, int *n, int *width\202)34 0 TN TL()Ec /AF f D(
-
-void *)0 30 1 A(FunTableRowGet\201Fun fun, void *rows, int maxrow, char *plist, int *nrow\202)30 0 TN TL()Ec /AF f D(
-
-int )0 31 1 A(FunTableRowPut\201Fun fun, void *rows, int nev, int idx, char *plist\202)31 0 TN TL()Ec /AF f D(
-
-int )0 37 1 A(FunParamGetb\201Fun fun, char *name, int n, int defval, int *got\202)37 0 TN TL()Ec /AF f D(
-
-int )0 37 1 A(FunParamGeti\201Fun fun, char *name, int n, int defval, int *got\202)37 0 TN TL()Ec /AF f D(
-
-double )0 37 1 A(FunParamGetd\201Fun fun, char *name, int n, double defval, int *got\202)37 0 TN TL()Ec /AF f D(
-
-char *)0 37 1 A(FunParamGets\201Fun fun, char *name, int n, char *defval, int *got\202)37 0 TN TL()Ec /AF f D(
-
-int )0 38 1 A(FunParamPutb\201Fun fun, char *name, int n, int value, char *comm, int append\202)38 0 TN TL()Ec /AF f D()WR(
-
-int )0 38 1 A(FunParamPuti\201Fun fun, char *name, int n, int value, char *comm, int append\202)38 0 TN TL()Ec /AF f D(
-
-int )0 38 1 A(FunParamPutd\201Fun fun, char *name, int n, double value, int prec, char *comm, int append\202)38 0 TN TL()Ec /AF f D(
-
-int )0 38 1 A(FunParamPuts\201Fun fun, char *name, int n, char *value, char *comm, int append\202)38 0 TN TL()Ec /AF f D(
-
-int )0 35 1 A(FunInfoGet\201Fun fun, int type, ...\202)35 0 TN TL()Ec /AF f D(
-
-int )0 36 1 A(FunInfoPut\201Fun fun, int type, ...\202)36 0 TN TL()Ec /AF f D(
-
-void )0 39 1 A(FunFlush\201Fun fun, char *plist\202)39 0 TN TL()Ec /AF f D(
-
-void )0 40 1 A(FunClose\201Fun fun\202)40 0 TN TL()Ec /AF f D()RP(
-
-
-
-
-)0 2 33 H(FunOpen)WB 99 Sn()WB 25 Sn( - open a Funtools data file)EA()EH(
-
-
-)BD() 3 47 PR( #include <funtools.h>
-
- Fun FunOpen\201char *name, char *mode, Fun ref\202;)RP()ES(
-
-
-)0 P(The )BD(FunOpen\201\202)ES( routine opens a Funtools data file for reading or
-appending, or creates a new FITS file for writing. The )BD(name)ES(
-argument specifies the name of the Funtools data file to open. You can
-use IRAF-style bracket notation to specify
-)0 42 1 A(Funtools Files, Extensions, and Filters)42 0 TN TL()Ec /AF f D(.
-A separate call should be made each time a different FITS extension is
-accessed:
-) 7 65 PR( Fun fun;
- char *iname;
- ...
- if\201 !\201fun = FunOpen\201iname, "r", NULL\202\202 \202{
- fprintf\201stderr, "could not FunOpen input file: %s\200n", iname\202;
- exit\2011\202;
- })RP(
-)0 P(If )BD(mode)ES( is "r", the file is opened for reading, and processing
-is set up to begin at the specified extension. For reading,
-)BD(name)ES( can be )BD(stdin)ES(, in which case the standard input is read.
-
-)0 P(If )BD(mode)ES( is "w", the file is created if it does not exist, or
-opened and truncated for writing if it does exist. Processing starts
-at the beginning of the file. The )BD(name)ES( can be )BD(stdout)ES(,
-in which case the standard output is readied for processing.
-
-)0 P(If )BD(mode)ES( is "a", the file is created if it does not exist, or
-opened if it does exist. Processing starts at the end of the file.
-The )BD(name)ES( can be )BD(stdout)ES(, in which case the standard
-output is readied for processing.
-
-)0 P(When a Funtools file is opened for writing or appending, a previously
-opened )0 23 1 A(Funtools reference
-handle)23 0 TN TL()Ec /AF f D( can be specified as the third argument. This handle
-typically is associated with the input Funtools file that will be used
-to generate the data for the output data. When a reference file is
-specified in this way, the output file will inherit the \201extension\202
-header parameters from the input file:
-) 8 67 PR( Fun fun, fun2;
- ...
- /* open input file */
- if\201 !\201fun = FunOpen\201argv[1], "r", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen input file: %s\200n", argv[1]\202;
- /* open the output FITS image, inheriting params from input */
- if\201 !\201fun2 = FunOpen\201argv[2], "w", fun\202\202 \202
- gerror\201stderr, "could not FunOpen output file: %s\200n", argv[2]\202;)RP(
-Thus, in the above example, the output FITS binary table file will
-inherit all of the parameters associated with the input binary table
-extension.
-)0 P(A file opened for writing with a
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D( also
-inherits the selected columns \201i.e. those columns chosen for
-processing using the
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( routine\202
-from the reference file as its default columns. This makes it easy to
-open an output file in such a way that the columns written to the
-output file are the same as the columns read in the input file. Of
-course, column selection can easily be tailored using the
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( routine.
-In particular, it is easy to merge user-defined columns with the input
-columns to generate a new file. See the
-)0 2 A(evmerge)EA( for a complete example.
-
-)0 P(In addition, when a
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(
-is supplied in a )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( call,
-it is possible also to specify that all other extensions from the
-reference file \201other than the input extension being processed\202 should
-be copied from the reference file to the output file. This is useful,
-for example, in a case where you are processing a FITS binary table
-or image and you want to copy all of the other extensions to
-the output file as well. Copy of other extensions is controlled by
-adding a "C" or "c" to the mode string of the
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( call )BD(of the input
-reference file)ES(. If "C" is specified, then other extensions are
-)BD(always)ES( copied \201i.e., copy is forced by the application\202. If
-"c" is used, then other extensions are copied if the user requests
-copying by adding a plus sign "+" to the extension name in the bracket
-specification. For example, the )BD(funtable)ES( program utilizes
-"c" mode, giving users the option of copying all other extensions:
-) 6 67 PR( /* open input file -- allow user copy of other extensions */
- if\201 !\201fun = FunOpen\201argv[1], "rc", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen input file: %s\200n", argv[1]\202;
- /* open the output FITS image, inheriting params from input */
- if\201 !\201fun2 = FunOpen\201argv[2], "w", fun\202\202 \202
- gerror\201stderr, "could not FunOpen output file: %s\200n", argv[2]\202;)RP(
-
-Thus, )BD(funtable)ES( supports either of these command lines:
-) 4 60 PR( # copy only the EVENTS extension
- csh> funtable "test.ev[EVENTS,circle\201512,512,10\202]" foo.ev
- # copy ALL extensions
- csh> funtable "test.ev[EVENTS+,circle\201512,512,10\202]" foo.ev)RP(
-
-)0 P(Use of a )0 23 1 A(Funtools reference
-handle)23 0 TN TL()Ec /AF f D( implies that the input file is opened before the output
-file. However, it is important to note that if copy mode \201"c" or "C"\202
-is specified for the input file, the actual input file open is delayed
-until just after the output file is opened, since the copy of prior
-extensions to the output file takes place while Funtools is seeking to
-the specified input extension. This implies that the output file
-should be opened before any I/O is done on the input file or else the
-copy will fail. Note also that the copy of subsequent extension will
-be handled automatically by
-)0 40 1 A(FunClose\201\202)40 0 TN TL()Ec /AF f D(
-if the output file is
-closed before the input file. Alternatively, it can be done explicitly
-by )0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D(, but again, this
-assumes that the input file still is open.
-
-)0 P(Upon success )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( returns a
-Fun handle that is used in subsequent Funtools calls. On error, NULL
-is returned.
-
-
-
-
-)0 2 34 H(FunImageGet)WB 100 Sn()WB 26 Sn( - get an image or image section)EA()EH(
-
-
-)BD() 3 52 PR( #include <funtools.h>
-
- void *FunImageGet\201Fun fun, void *buf, char *plist\202)RP()ES(
-
-
-)0 P(The )BD(FunImageGet\201\202)ES( routine returns an binned image array of the
-specified section of a Funtools data file. If the input data are
-already of type image, the array is generated by extracting the
-specified image section and then binning it according to the specified
-bin factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-)BD(bincols=)ES( keyword \201using appropriate default columns as
-necessary\202, after which the image section and bin factors are
-applied. In both cases, the data is automatically converted from FITS
-to native format, if necessary.
-)0 P(The first argument is the Funtools handle returned by
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(. The second )BD(buf)ES(
-argument is a pointer to a data buffer to fill. If NULL is specified,
-FunImageGet will allocate a buffer of the appropriate size. Generally
-speaking, you always want Funtools to allocate the buffer because
-the image dimensions will be determined by
-)0 49 1 A(Funtools image sectioning)49 0 TN TL()Ec /AF f D(
-on the command line.
-)0 P(The third )BD(plist)ES( \201i.e., parameter list\202 argument is a string
-containing one or more comma-delimited )BD(keyword=value)ES(
-parameters. It can be used to specify the return data type using the
-)BD(bitpix=)ES( keyword. If no such keyword is specified in the plist
-string, the data type of the returned image is the same as the data type
-of the original input file, or is of type int for FITS binary tables.
-
-)0 P(If the )BD(bitpix=)ES( keyword is supplied in the plist string, the data
-type of the returned image will be one of the supported FITS image
-data types:
-)UL()-1 LI( 8 unsigned char
-)-1 LI( 16 short
-)-1 LI( 32 int
-)-1 LI( -32 float
-)-1 LI( -64 double)LU(
-For example:
-) 4 57 PR( void *buf;
- /* extract data section into an image buffer */
- if\201 !\201buf = FunImageGet\201fun, NULL, NULL\202\202 \202
- gerror\201stderr, "could not FunImageGet: %s\200n", iname\202;)RP(
-will allocate buf and retrieve the image in the file data format. In
-this case, you will have to determine the data type \201using the
-FUN_SECT_BITPIX value in the
-)0 35 1 A(FunInfoGet\201\202)35 0 TN TL()Ec /AF f D(
-routine\202
-and then use a switch statement to process each data type:
-) 17 65 PR( int bitpix;
- void *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- ...
- buf = FunImageGet\201fun, NULL, NULL\202;
- FunInfoGet\201fun, FUN_SECT_BITPIX, &bitpix, 0\202;
- /* set appropriate data type buffer to point to image buffer */
- switch\201bitpix\202{
- case 8:
- cbuf = \201unsigned char *\202buf; break;
- case 16:
- sbuf = \201short *\202buf; break;
- case 32:
- ibuf = \201int *\202buf; break;
- ...)RP(
-See the
-)0 2 A(imblank example code)EA(
-for more details on how to process an image when the data type is not
-specified beforehand.
-
-)0 P(It often is easier to specify the data type directly:
-) 4 57 PR( double *buf;
- /* extract data section into a double image buffer */
- if\201 !\201buf = FunImageGet\201fun, NULL, "bitpix=-64"\202\202 \202
- gerror\201stderr, "could not FunImageGet: %s\200n", iname\202;)RP(
-will extract the image while converting to type double.
-
-)0 P(On success, a pointer to the image buffer is returned. \201This will be
-the same as the second argument, if NULL is not passed to the latter.\202
-On error, NULL is returned.
-
-)0 P(In summary, to retrieve image or row data into a binned image, you simply
-call FunOpen\201\202 followed by
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D(. Generally, you
-then will want to call
-)0 35 1 A(FunInfoGet\201\202)35 0 TN TL()Ec /AF f D(
-to retrieve the
-axis dimensions \201and data type\202 of the section you are processing
-\201so as to take account of sectioning and blocking of the original data\202:
-) 20 73 PR( double *buf;
- int i, j;
- int dim1, dim2;
- ... other declarations, etc.
-
- /* open the input FITS file */
- if\201 !\201fun = FunOpen\201argv[1], "rc", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen input file: %s\200n", argv[1]\202;
-
- /* extract and bin the data section into a double float image buffer */
- if\201 !\201buf = FunImageGet\201fun, NULL, "bitpix=-64"\202\202 \202
- gerror\201stderr, "could not FunImageGet: %s\200n", argv[1]\202;
-
- /* get dimension information from funtools structure */
- FunInfoGet\201fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0\202;
-
- /* loop through pixels and reset values below limit to value */
- for\201i=0; i<dim1*dim2; i++\202{
- if\201 buf[i] <= blimit \202 buf[i] = bvalue;
- })RP(
-
-)0 P(Another useful plist string value is "mask=all", which returns an
-image populated with regions id values. Image pixels within a region
-will contain the associated region id \201region values start at 1\202, and
-otherwise will contain a 0 value. Thus, the returned image is a
-region mask which can be used to process the image data \201which
-presumably is retrieved by a separate call to FunImageGet\202 pixel by
-pixel.
-
-)0 P(If a FITS binary table or a non-FITS raw event file is being binned
-into an image, it is necessary to specify the two columns that will be
-used in the 2D binning. This usually is done on the command line
-using the )BD(bincols=\201x,y\202)ES( keyword:
-) 1 46 PR( funcnts "foo.ev[EVENTS,bincols=\201detx,dety\202]")RP(
-
-)0 P(The full form of the )BD(bincols=)ES( specifier is:
-) 1 77 PR( bincols=\201[xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]]\202)RP(
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-) 2 56 PR( dim = \201tlmax - tlmin\202/binsiz \201floating point data\202
- dim = \201tlmax - tlmin\202/binsiz + 1 \201integer data\202)RP(
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters \201respectively\202 are present in the
-FITS binary table header for the column in question. Note that if
-only one parameter is specified, it is assumed to be tlmax, and tlmin
-defaults to 1. If two parameters are specified, they are assumed to be
-tlmin and tlmax.
-
-)0 P(If )BD(bincols)ES( is not specified on the command line, Funtools tries
-to use appropriate defaults: it looks for the environment variable
-FITS_BINCOLS \201or FITS_BINKEY\202. Then it looks for the Chandra
-parameters CPREF \201or PREFX\202 in the FITS binary table header. Failing
-this, it looks for columns named "X" and "Y" and if these are not
-found, it looks for columns containing the characters "X" and "Y".
-)0 P(See )0 50 1 A(Binning FITS Binary Tables and
-Non-FITS Event Files)50 0 TN TL()Ec /AF f D( for more information.
-
-
-
-
-)0 2 35 H(FunImagePut)WB 101 Sn()WB 27 Sn( - put an image to a Funtools file)EA()EH(
-
-)BD() 4 69 PR( #include <funtools.h>
-
- int FunImagePut\201Fun fun, void *buf, int dim1, int dim2, int bitpix,
- char *plist\202)RP()ES(
-
-
-The )BD(FunImagePut\201\202)ES( routine outputs an image array to a FITS
-file. The image is written either as a primary header/data unit or as
-an image extension, depending on whether other data have already been
-written to the file. That is, if the current file position is at the
-beginning of the file, a primary HDU is written. Otherwise, an
-image extension is written.
-
-)0 P(The first argument is the Funtools handle returned by
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(. The second )BD(buf)ES(
-argument is a pointer to a data buffer to write. The )BD(dim1)ES(and
-)BD(dim2)ES( arguments that follow specify the dimensions of the image,
-where dim1 corresponds to naxis1 and dim2 corresponds to naxis2. The
-)BD(bitpix)ES( argument specifies the data type of the image and can
-have the following FITS-standard values:
-)UL()-1 LI( 8 unsigned char
-)-1 LI( 16 short
-)-1 LI( 32 int
-)-1 LI( -32 float
-)-1 LI( -64 double)LU(
-
-)0 P(When )0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D( is first
-called for a given image, Funtools checks to see if the primary header
-has already been written \201by having previously written an image or a
-binary table.\202 If not, this image is written to the primary HDU.
-Otherwise, it is written to an image extension.
-)0 P(Thus, a simple program to generate a FITS image might look like this:
-) 16 67 PR( int i;
- int dim1=512, dim2=512;
- double *dbuf;
- Fun fun;
- dbuf = malloc\201dim1*dim2*sizeof\201double\202\202;
- /* open the output FITS image, preparing to copy input params */
- if\201 !\201fun = FunOpen\201argv[1], "w", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen output file: %s\200n", argv[1]\202;
- for\201i=0; i<\201dim1*dim2\202; i++\202{
- ... fill dbuf ...
- }
- /* put the image \201header will be generated automatically */
- if\201 !FunImagePut\201fun, buf, dim1, dim2, -64, NULL\202 \202
- gerror\201stderr, "could not FunImagePut: %s\200n", argv[1]\202;
- FunClose\201fun\202;
- free\201dbuf\202;)RP(
-
-)0 P(In addition, if a
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(
-was specified when this table was opened, the
-parameters from this
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(
-are merged into the new image
-header. Furthermore, if a reference image was specified during
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(, the values of
-)BD(dim1)ES(, )BD(dim2)ES(, and )BD(bitpix)ES( in the calling sequence
-can all be set to 0. In this case, default values are taken from the
-reference image section. This is useful if you are reading an image
-section in its native data format, processing it, and then writing
-that section to a new FITS file. See the
-)0 2 A(imblank example code)EA(.
-
-)0 P(The data are assumed to be in the native machine format and will
-automatically be swapped to FITS big-endian format if necessary. This
-behavior can be over-ridden with the )BD(convert=[true|false])ES(
-keyword in the )BD(plist)ES( param list string.
-
-)0 P(When you are finished writing the image, you should call
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( to write out the FITS
-image padding. However, this is not necessary if you subsequently call
-FunClose\201\202 without doing any other I/O to the FITS file.
-
-
-
-
-)0 2 36 H(FunImageRowGet)WB 102 Sn()WB 28 Sn( - get row\201s\202 of an image)EA()EH(
-
-
-)BD() 4 65 PR( #include <funtools.h>
-
- void *FunImageRowGet\201Fun fun, void *buf, int rstart, int rstop,
- char *plist\202)RP()ES(
-
-
-)0 P(The )BD(FunImageRowGet\201\202)ES( routine returns one or more image rows
-from the specified section of a Funtools data file. If the input data
-are of type image, the array is generated by extracting the specified
-image rows and then binning them according to the specified bin
-factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-)BD(bincols=)ES( keyword \201using appropriate default columns as needed\202,
-after which the image section and bin factors are applied.
-
-)0 P(The first argument is the Funtools handle returned by
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(. The second )BD(buf)ES(
-argument is a pointer to a data buffer to fill. If NULL is specified,
-FunImageGet\201\202 will allocate a buffer of the appropriate size.
-
-)0 P(The third and fourth arguments specify the first and last row to
-retrieve. Rows are counted starting from 1, up to the value of
-FUN_YMAX\201fun\202. The final )BD(plist)ES( \201i.e., parameter list\202 argument
-is a string containing one or more comma-delimited
-)BD(keyword=value)ES( parameters. It can be used to specify the return
-data type using the )BD(bitpix=)ES( keyword. If no such keyword is
-specified in the plist string, the data type of the image is the same
-as the data type of the original input file, or is of type int for
-FITS binary tables.
-
-)0 P(If the )BD(bitpix=)ES(value is supplied in the plist string, the data
-type of the returned image will be one of the supported FITS image
-data types:
-)UL()-1 LI( 8 unsigned char
-)-1 LI( 16 short
-)-1 LI( 32 int
-)-1 LI( -32 float
-)-1 LI( -64 double)LU(
-
-)0 P(For example:
-) 17 65 PR( double *drow;
- Fun fun;
- ... open files ...
- /* get section dimensions */
- FunInfoGet\201fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0\202;
- /* allocate one line's worth */
- drow = malloc\201dim1*sizeof\201double\202\202;
- /* retrieve and process each input row \201starting at 1\202 */
- for\201i=1; i <= dim2; i++\202{
- if\201 !FunImageRowGet\201fun, drow, i, i, "bitpix=-64"\202 \202
- gerror\201stderr, "can't FunImageRowGet: %d %s\200n", i, iname\202;
- /* reverse the line */
- for\201j=1; j<=dim1; j++\202{
- ... process drow[j-1] ...
- }
- }
- ...)RP(
-
-)0 P(On success, a pointer to the image buffer is returned. \201This will be
-the same as the second argument, if NULL is not passed to the latter.\202
-On error, NULL is returned. Note that the considerations described
-above for specifying binning columns in
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D( also apply to
-)BD(FunImageRowGet\201\202)ES(.
-
-
-
-
-)0 2 37 H(FunImageRowPut)WB 103 Sn()WB 29 Sn( - put row\201s\202 of an image)EA()EH(
-
-
-)BD() 4 67 PR( #include <funtools.h>
-
- void *FunImageRowPut\201Fun fun, void *buf, int rstart, int rstop,
- int dim1, int dim2, int bitpix, char *plist\202)RP()ES(
-
-
-)0 P(The )BD(FunImageRowPut\201\202)ES( routine writes one or more image rows to
-the specified FITS image file. The first argument is the Funtools
-handle returned by )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(.
-The second )BD(buf)ES( argument is a pointer to the row data buffer,
-while the third and fourth arguments specify the starting and ending
-rows to write. Valid rows values range from 1 to dim2, i.e., row is
-one-valued.
-
-)0 P(The )BD(dim1)ES(and )BD(dim2)ES( arguments that follow specify the
-dimensions, where dim1 corresponds to naxis1 and dim2 corresponds to
-naxis2. The )BD(bitpix)ES( argument data type of the image and can
-have the following FITS-standard values:
-)UL()-1 LI( 8 unsigned char
-)-1 LI( 16 short
-)-1 LI( 32 int
-)-1 LI( -32 float
-)-1 LI( -64 double)LU(
-
-For example:
-) 16 65 PR( double *drow;
- Fun fun, fun2;
- ... open files ...
- /* get section dimensions */
- FunInfoGet\201fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0\202;
- /* allocate one line's worth */
- drow = malloc\201dim1*sizeof\201double\202\202;
- /* retrieve and process each input row \201starting at 1\202 */
- for\201i=1; i <= dim2; i++\202{
- if\201 !FunImageRowGet\201fun, drow, i, i, "bitpix=-64"\202 \202
- gerror\201stderr, "can't FunImageRowGet: %d %s\200n", i, iname\202;
- ... process drow ...
- if\201 !FunImageRowPut\201fun2, drow, i, i, 64, NULL\202 \202
- gerror\201stderr, "can't FunImageRowPut: %d %s\200n", i, oname\202;
- }
- ...)RP(
-
-)0 P(The data are assumed to be in the native machine format and will
-automatically be swapped to big-endian FITS format if necessary. This
-behavior can be over-ridden with the )BD(convert=[true|false])ES(
-keyword in the )BD(plist)ES( param list string.
-
-)0 P(When you are finished writing the image, you should call
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( to write out the FITS
-image padding. However, this is not necessary if you subsequently call
-FunClose\201\202 without doing any other I/O to the FITS file.
-
-
-
-
-)0 2 38 H(FunColumnSelect)WB 104 Sn()WB 32 Sn( - select Funtools columns)EA()EH(
-
-)BD() 11 73 PR( #include <funtools.h>
-
- int FunColumnSelect\201Fun fun, int size, char *plist,
- char *name1, char *type1, char *mode1, int offset1,
- char *name2, char *type2, char *mode2, int offset2,
- ...,
- NULL\202
-
- int FunColumnSelectArr\201Fun fun, int size, char *plist,
- char **names, char **types, char **modes,
- int *offsets, int nargs\202;)RP()ES(
-
-
-The )BD(FunColumnSelect\201\202)ES( routine is used to select the columns
-from a Funtools binary table extension or raw event file for
-processing. This routine allows you to specify how columns in a file
-are to be read into a user record structure or written from a user
-record structure to an output FITS file.
-
-)0 P(The first argument is the Fun handle associated with this set of
-columns. The second argument specifies the size of the user record
-structure into which columns will be read. Typically, the sizeof\201\202
-macro is used to specify the size of a record structure. The third
-argument allows you to specify keyword directives for the selection
-and is described in more detail below.
-
-)0 P(Following the first three required arguments is a variable length list of
-column specifications. Each column specification will consist of four
-arguments:
-)UL()-1 LI( )BD(name)ES(: the name of the column
-
-)-1 LI( )BD(type)ES(: the data type of the column as it will be stored in
-the user record struct \201not the data type of the input file\202. The
-following basic data types are recognized:
-)UL()-1 LI(A: ASCII characters
-)-1 LI(B: unsigned 8-bit char
-)-1 LI(I: signed 16-bit int
-)-1 LI(U: unsigned 16-bit int \201not standard FITS\202
-)-1 LI(J: signed 32-bit int
-)-1 LI(V: unsigned 32-bit int \201not standard FITS\202
-)-1 LI(E: 32-bit float
-)-1 LI(D: 64-bit float)LU(
-The syntax used is similar to that which defines the TFORM parameter
-in FITS binary tables. That is, a numeric repeat value can precede
-the type character, so that "10I" means a vector of 10 short ints, "E"
-means a single precision float, etc. Note that the column value from
-the input file will be converted to the specified data type as the
-data is read by
-)0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D(.
-
-)0 P([ A short digression regarding bit-fields: Special attention is
-required when reading or writing the FITS bit-field type
-\201"X"\202. Bit-fields almost always have a numeric repeat character
-preceding the 'X' specification. Usually this value is a multiple of 8
-so that bit-fields fit into an integral number of bytes. For all
-cases, the byte size of the bit-field B is \201N+7\202/8, where N is the
-numeric repeat character.
-
-)0 P(A bit-field is most easily declared in the user struct as an array of
-type char of size B as defined above. In this case, bytes are simply
-moved from the file to the user space. If, instead, a short or int
-scalar or array is used, then the algorithm for reading the bit-field
-into the user space depends on the size of the data type used along
-with the value of the repeat character. That is, if the user data
-size is equal to the byte size of the bit-field, then the data is
-simply moved \201possibly with endian-based byte-swapping\202 from one to
-the other. If, on the other hand, the data storage is larger than the
-bit-field size, then a data type cast conversion is performed to move
-parts of the bit-field into elements of the array. Examples will help
-make this clear:
-
-)UL()-1 LI( If the file contains a 16X bit-field and user space specifies a 2B
-char array[2], then the bit-field is moved directly into the char array.
-
-)-1 LI( If the file contains a 16X bit-field and user space specifies a 1I
-scalar short int, then the bit-field is moved directly into the short int.
-
-)-1 LI( If the file contains a 16X bit-field and user space specifies a 1J
-scalar int, then the bit-field is type-cast to unsigned int before
-being moved \201use of unsigned avoids possible sign extension\202.
-
-)-1 LI( If the file contains a 16X bit-field and user space specifies a 2J
-int array[2], then the bit-field is handled as 2 chars, each of which
-are type-cast to unsigned int before being moved \201use of unsigned
-avoids possible sign extension\202.
-
-)-1 LI( If the file contains a 16X bit-field and user space specifies a 1B
-char, then the bit-field is treated as a char, i.e., truncation will
-occur.
-
-)-1 LI( If the file contains a 16X bit-field and user space specifies a 4J
-int array[4], then the results are undetermined.
-)LU(
-For all user data types larger than char, the bit-field is byte-swapped
-as necessary to convert to native format, so that bits in the
-resulting data in user space can be tested, masked, etc. in the same
-way regardless of platform.]
-
-)0 P(In addition to setting data type and size, the )BD(type)ES(
-specification allows a few ancillary parameters to be set, using the
-full syntax for )BD(type)ES(:
-) 1 53 PR( [@][n]<type>[[['B']poff]][:[tlmin[:tlmax[:binsiz]]]])RP(
-
-)0 P(The special character "@" can be prepended to this specification to
-indicated that the data element is a pointer in the user record,
-rather than an array stored within the record.
-
-)0 P(The [n] value is an integer that specifies the
-number of elements that are in this column \201default is 1\202. TLMIN,
-TLMAX, and BINSIZ values also can be specified for this column after
-the type, separated by colons. If only one such number is specified,
-it is assumed to be TLMAX, and TLMIN and BINSIZ are set to 1.
-
-)0 P(The [poff] value can be used to specify the offset into an
-array. By default, this offset value is set to zero and the data
-specified starts at the beginning of the array. The offset usually
-is specified in terms of the data type of the column. Thus an offset
-specification of [5] means a 20-byte offset if the data type is a
-32-bit integer, and a 40-byte offset for a double. If you want to
-specify a byte offset instead of an offset tied to the column data type,
-precede the offset value with 'B', e.g. [B6] means a 6-bye offset,
-regardless of the column data type.
-
-The [poff] is especially useful in conjunction with the pointer @
-specification, since it allows the data element to anywhere stored
-anywhere in the allocated array. For example, a specification such as
-"@I[2]" specifies the third \201i.e., starting from 0\202 element in the
-array pointed to by the pointer value. A value of "@2I[4]" specifies
-the fifth and sixth values in the array. For example, consider the
-following specification: ) 12 67 PR( typedef struct EvStruct{
- short x[4], *atp;
- } *Event, EventRec;
- /* set up the \201hardwired\202 columns */
- FunColumnSelect\201 fun, sizeof\201EventRec\202, NULL,
- "2i", "2I ", "w", FUN_OFFSET\201Event, x\202,
- "2i2", "2I[2]", "w", FUN_OFFSET\201Event, x\202,
- "at2p", "@2I", "w", FUN_OFFSET\201Event, atp\202,
- "at2p4", "@2I[4]", "w", FUN_OFFSET\201Event, atp\202,
- "atp9", "@I[9]", "w", FUN_OFFSET\201Event, atp\202,
- "atb20", "@I[B20]", "w", FUN_OFFSET\201Event, atb\202,
- NULL\202;)RP(
-Here we have specified the following columns:
-)UL()-1 LI( 2i: two short ints in an array which is stored as part the
-record
-)-1 LI( 2i2: the 3rd and 4th elements of an array which is stored
-as part of the record
-)-1 LI( an array of at least 10 elements, not stored in the record but
-allocated elsewhere, and used by three different columns:
-)UL()-1 LI( at2p: 2 short ints which are the first 2 elements of the allocated array
-)-1 LI( at2p4: 2 short ints which are the 5th and 6th elements of
-the allocated array
-)-1 LI( atp9: a short int which is the 10th element of the allocated array)LU(
-)-1 LI( atb20: a short int which is at byte offset 20 of another allocated array)LU(
-In this way, several columns can be specified, all of which are in a
-single array. )BD(NB)ES(: it is the programmer's responsibility to
-ensure that specification of a positive value for poff does not point
-past the end of valid data.
-
-)-1 LI( )BD(read/write mode)ES(: "r" means that the column is read from an
-input file into user space by
-)0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D(, "w" means that
-the column is written to an output file. Both can specified at the same
-time.
-
-)-1 LI( )BD(offset)ES(: the offset into the user data to store
-this column. Typically, the macro FUN_OFFSET\201recname, colname\202 is used
-to define the offset into a record structure.)LU(
-
-)0 P(When all column arguments have been specified, a final NULL argument
-must added to signal the column selection list.
-
-)0 P(As an alternative to the varargs
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-routine, a non-varargs routine called
-)0 32 1 A(FunColumnSelectArr\201\202)32 0 TN TL()Ec /AF f D(
-also is available. The first three arguments \201fun, size, plist\202 of this
-routine are the same as in
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(.
-Instead of a variable
-argument list, however,
-)0 32 1 A(FunColumnSelectArr\201\202)32 0 TN TL()Ec /AF f D(
-takes 5 additional arguments. The first 4 arrays arguments contain the
-names, types, modes, and offsets, respectively, of the columns being
-selected. The final argument is the number of columns that are
-contained in these arrays. It is the user's responsibility to free
-string space allocated in these arrays.
-
-)0 P(Consider the following example:
-) 12 54 PR( typedef struct evstruct{
- int status;
- float pi, pha, *phas;
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect\201fun, sizeof\201EvRec\202, NULL,
- "status", "J", "r", FUN_OFFSET\201Ev, status\202,
- "pi", "E", "r", FUN_OFFSET\201Ev, pi\202,
- "pha", "E", "r", FUN_OFFSET\201Ev, pha\202,
- "phas", "@9E", "r", FUN_OFFSET\201Ev, phas\202,
- NULL\202;)RP(
-)0 P(Each time a row is read into the Ev struct, the "status" column is
-converted to an int data type \201regardless of its data type in the
-file\202 and stored in the status value of the struct. Similarly, "pi"
-and "pha", and the phas vector are all stored as floats. Note that the
-"@" sign indicates that the "phas" vector is a pointer to a 9 element
-array, rather than an array allocated in the struct itself. The row
-record can then be processed as required:
-) 9 70 PR( /* get rows -- let routine allocate the row array */
- while\201 \201ebuf = \201Ev\202FunTableRowGet\201fun, NULL, MAXROW, NULL, &got\202\202 \202{
- /* process all rows */
- for\201i=0; i<got; i++\202{
- /* point to the i'th row */
- ev = ebuf+i;
- ev->pi = \201ev->pi+.5\202;
- ev->pha = \201ev->pi-.5\202;
- })RP(
-
-)0 P()0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-can also be called to define "writable" columns in order to generate a FITS
-Binary Table, without reference to any input columns. For
-example, the following will generate a 4-column FITS binary table when
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D( is used to
-write Ev records:
-
-) 12 56 PR( typedef struct evstruct{
- int status;
- float pi, pha
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect\201fun, sizeof\201EvRec\202, NULL,
- "status", "J", "w", FUN_OFFSET\201Ev, status\202,
- "pi", "E", "w", FUN_OFFSET\201Ev, pi\202,
- "pha", "E", "w", FUN_OFFSET\201Ev, pha\202,
- "energy", "D", "w", FUN_OFFSET\201Ev, energy\202,
- NULL\202;)RP(
-All columns are declared to be write-only, so presumably the column
-data is being generated or read from some other source.
-
-)0 P(In addition,
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-can be called to define )BD(both)ES( "readable" and "writable" columns.
-In this case, the "read" columns
-are associated with an input file, while the "write" columns are
-associated with the output file. Of course, columns can be specified as both
-"readable" and "writable", in which case they are read from input
-and \201possibly modified data values are\202 written to the output.
-The
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-call itself is made by passing the input Funtools handle, and it is
-assumed that the output file has been opened using this input handle
-as its
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(.
-
-)0 P(Consider the following example:
-) 13 54 PR( typedef struct evstruct{
- int status;
- float pi, pha, *phas;
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect\201fun, sizeof\201EvRec\202, NULL,
- "status", "J", "r", FUN_OFFSET\201Ev, status\202,
- "pi", "E", "rw", FUN_OFFSET\201Ev, pi\202,
- "pha", "E", "rw", FUN_OFFSET\201Ev, pha\202,
- "phas", "@9E", "rw", FUN_OFFSET\201Ev, phas\202,
- "energy", "D", "w", FUN_OFFSET\201Ev, energy\202,
- NULL\202;)RP(
-As in the "read" example above, each time an row is read into the Ev
-struct, the "status" column is converted to an int data type
-\201regardless of its data type in the file\202 and stored in the status
-value of the struct. Similarly, "pi" and "pha", and the phas vector
-are all stored as floats. Since the "pi", "pha", and "phas" variables
-are declared as "writable" as well as "readable", they also will be
-written to the output file. Note, however, that the "status" variable
-is declared as "readable" only, and hence it will not be written to
-an output file. Finally, the "energy" column is declared as
-"writable" only, meaning it will not be read from the input file. In
-this case, it can be assumed that "energy" will be calculated in the
-program before being output along with the other values.
-
-)0 P(In these simple cases, only the columns specified as "writable" will
-be output using
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D(. However,
-it often is the case that you want to merge the user columns back in
-with the input columns, even in cases where not all of the input
-column names are explicitly read or even known. For this important
-case, the )BD(merge=[type])ES( keyword is provided in the plist string.
-
-)0 P(The )BD(merge=[type])ES( keyword tells Funtools to merge the columns from
-the input file with user columns on output. It is normally used when
-an input and output file are opened and the input file provides the
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(
-for the output file. In this case, each time
-)0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D( is called, the
-raw input rows are saved in a special buffer. If
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D( then is called
-\201before another call to
-)0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D(\202, the contents
-of the raw input rows are merged with the user rows according to the
-value of )BD(type)ES( as follows:
-
-)UL()-1 LI( )BD(update)ES(: add new user columns, and update value of existing ones \201maintaining the input data type\202
-
-)-1 LI( )BD(replace)ES(: add new user columns, and replace the data type
-and value of existing ones. \201Note that if tlmin/tlmax values are not
-specified in the replacing column, but are specified in the original
-column being replaced, then the original tlmin/tlmax values are used
-in the replacing column.\202
-
-)-1 LI( )BD(append)ES(: only add new columns, do not "replace" or "update" existing ones)LU(
-
-)0 P(Consider the example above. If )BD(merge=update)ES( is specified in the
-plist string, then "energy" will be added to the input columns, and
-the values of "pi", "pha", and "phas" will be taken from the user
-space \201i.e., the values will be updated from the original values, if
-they were changed by the program\202. The data type for "pi", "pha", and
-"phas" will be the same as in the original file. If
-)BD(merge=replace)ES( is specified, both the data type and value of
-these three input columns will be changed to the data type and value
-in the user structure. If )BD(merge=append)ES( is specified, none of
-these three columns will be updated, and only the "energy" column will
-be added. Note that in all cases, "status" will be written from the
-input data, not from the user record, since it was specified as read-only.
-
-)0 P(Standard applications will call
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-to define user columns. However, if this routine is not called, the
-default behavior is to transfer all input columns into user space. For
-this purpose a default record structure is defined such that each data
-element is properly aligned on a valid data type boundary. This
-mechanism is used by programs such as fundisp and funtable to process
-columns without needing to know the specific names of those columns.
-It is not anticipated that users will need such capabilities \201contact
-us if you do!\202
-
-)0 P(By default, )0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-reads/writes rows to/from an "array of structs", where each struct contains
-the column values for a single row of the table. This means that the
-returned values for a given column are not contiguous. You can
-set up the IO to return a "struct of arrays" so that each of the
-returned columns are contiguous by specifying )BD(org=structofarrays)ES(
-\201abbreviation: )BD(org=soa)ES(\202 in the plist.
-\201The default case is )BD(org=arrayofstructs)ES( or )BD(org=aos)ES(.\202
-
-)0 P(For example, the default setup to retrieve rows from a table would be
-to define a record structure for a single event and then call
- )0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-as follows:
-) 14 73 PR( typedef struct evstruct{
- short region;
- double x, y;
- int pi, pha;
- double time;
- } *Ev, EvRec;
-
- got = FunColumnSelect\201fun, sizeof\201EvRec\202, NULL,
- "x", "D:10:10", mode, FUN_OFFSET\201Ev, x\202,
- "y", "D:10:10", mode, FUN_OFFSET\201Ev, y\202,
- "pi", "J", mode, FUN_OFFSET\201Ev, pi\202,
- "pha", "J", mode, FUN_OFFSET\201Ev, pha\202,
- "time", "1D", mode, FUN_OFFSET\201Ev, time\202,
- NULL\202;)RP(
-Subsequently, each call to
-FunTableRowGet\201\202)EA(
-will return an array of structs, one for each returned row. If instead you
-wanted to read columns into contiguous arrays, you specify )BD(org=soa)ES(:
-) 14 72 PR( typedef struct aevstruct{
- short region[MAXROW];
- double x[MAXROW], y[MAXROW];
- int pi[MAXROW], pha[MAXROW];
- double time[MAXROW];
- } *AEv, AEvRec;
-
- got = FunColumnSelect\201fun, sizeof\201AEvRec\202, "org=soa",
- "x", "D:10:10", mode, FUN_OFFSET\201AEv, x\202,
- "y", "D:10:10", mode, FUN_OFFSET\201AEv, y\202,
- "pi", "J", mode, FUN_OFFSET\201AEv, pi\202,
- "pha", "J", mode, FUN_OFFSET\201AEv, pha\202,
- "time", "1D", mode, FUN_OFFSET\201AEv, time\202,
- NULL\202;)RP(
-Note that the only modification to the call is in the plist string.
-
-)0 P(Of course, instead of using staticly allocated arrays, you also can specify
-dynamically allocated pointers:
-) 16 75 PR( /* pointers to arrays of columns \201used in struct of arrays\202 */
- typedef struct pevstruct{
- short *region;
- double *x, *y;
- int *pi, *pha;
- double *time;
- } *PEv, PEvRec;
-
- got = FunColumnSelect\201fun, sizeof\201PEvRec\202, "org=structofarrays",
- "$region", "@I", mode, FUN_OFFSET\201PEv, region\202,
- "x", "@D:10:10", mode, FUN_OFFSET\201PEv, x\202,
- "y", "@D:10:10", mode, FUN_OFFSET\201PEv, y\202,
- "pi", "@J", mode, FUN_OFFSET\201PEv, pi\202,
- "pha", "@J", mode, FUN_OFFSET\201PEv, pha\202,
- "time", "@1D", mode, FUN_OFFSET\201PEv, time\202,
- NULL\202;)RP(
-Here, the actual storage space is either allocated by the user or by the
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( call\202.
-
-)0 P(In all of the above cases, the same call is made to retrieve rows, e.g.:
-) 1 64 PR( buf = \201void *\202FunTableRowGet\201fun, NULL, MAXROW, NULL, &got\202;)RP(
-However, the individual data elements are accessed differently.
-For the default case of an "array of structs", the
-individual row records are accessed using:
-) 5 69 PR( for\201i=0; i<got; i++\202{
- ev = \201Ev\202buf+i;
- fprintf\201stdout, "%.2f\200t%.2f\200t%d\200t%d\200t%.4f\200t%.4f\200t%21.8f\200n",
- ev->x, ev->y, ev->pi, ev->pha, ev->dx, ev->dy, ev->time\202;
- })RP(
-For a struct of arrays or a struct of array pointers, we have a single struct
-through which we access individual columns and rows using:
-) 6 63 PR( aev = \201AEv\202buf;
- for\201i=0; i<got; i++\202{
- fprintf\201stdout, "%.2f\200t%.2f\200t%d\200t%d\200t%.4f\200t%.4f\200t%21.8f\200n",
- aev->x[i], aev->y[i], aev->pi[i], aev->pha[i],
- aev->dx[i], aev->dy[i], aev->time[i]\202;
- })RP(
-Support for struct of arrays in the
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D(
-call is handled analogously.
-
-)0 P(See the )0 2 A(evread example code)EA(
-and
-)0 2 A(evmerge example code)EA(
-for working examples of how
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( is used.
-
-
-
-
-)0 2 39 H(FunColumnActivate)WB 105 Sn()WB 33 Sn( - activate Funtools columns)EA()EH(
-
-
-)BD() 3 55 PR( #include <funtools.h>
-
- void FunColumnActivate\201Fun fun, char *s, char *plist\202)RP()ES(
-
-
-)0 P(The )BD(FunColumnActivate\201\202)ES( routine determines which columns \201set up
-by )0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(\202
-ultimately will be read and/or written. By default, all columns that
-are selected using
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-are activated. The
-)0 33 1 A(FunColumnActivate\201\202)33 0 TN TL()Ec /AF f D(
-routine can be used to turn off/off activation of specific columns.
-
-)0 P(The first argument is the Fun handle associated with this set of
-columns. The second argument is a space-delimited list of columns to
-activate or de-activate. Columns preceded by "+" are activated and
-columns preceded by a "-" are de-activated. If a column is named
-without "+" or "-", it is activated. The reserved strings "$region"
-and '$n' are used to activate a special columns containing the filter
-region value and row value, respectively, associated with
-this row. For example, if a filter containing two circular regions is
-specified as part of the Funtools file name, this column will contain
-a value of 1 or 2, depending on which region that row was in. The
-reserved strings "$x" and "$y" are used to activate the current
-binning columns. Thus, if the columns DX and DY are specified as
-binning columns:
-) 1 42 PR( [sh $] fundisp foo.fits[bincols=\201DX,DY\202])RP(
-then "$x" and "$y" will refer to these columns in a call to
-)0 33 1 A(FunColumnActivate\201\202)33 0 TN TL()Ec /AF f D(.
-
-)0 P(In addition, if the activation string contains only columns to be
-activated, then the routine will de-activate all other columns.
-Similarly, if the activation string contains only
-columns to de-activate, then the routine will activate all other columns
-before activating the list. This makes it simple to change the
-activation state of all columns without having to know all of the
-column names. For example:
-)UL()-1 LI( )BD("pi pha time")ES( # only these three columns will be active
-)-1 LI( )BD("-pi -pha -time")ES( # all but these columns will be active
-)-1 LI( )BD("pi -pha")ES( # only pi is active, pha is not, others are not
-)-1 LI( )BD("+pi -pha")ES( # same as above
-)-1 LI( )BD("pi -pha -time")ES( # only pi is active, all others are not
-)-1 LI( )BD("pi pha")ES( # pha and pi are active, all others are not
-)-1 LI( )BD("pi pha -x -y")ES( # pha and pi are active, all others are not)LU(
-
-)0 P(You can use the column activation list to reorder columns, since
-columns are output in the order specified. For example:
-) 19 77 PR( # default output order
- fundisp snr.ev'[cir 512 512 .1]'
- X Y PHA PI TIME DX DY
- -------- -------- -------- -------- --------------------- -------- --------
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-
- # re-order the output by specifying explicit order
- fundisp snr.ev'[cir 512 512 .1]' "time x y dy dx pi pha"
- TIME X Y DY DX PI PHA
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 512 512 574 578 7 6
- 79494575.58943175 512 512 573 579 9 8
- 79493631.03866175 512 512 575 578 6 5
- 79493290.86521725 512 512 575 578 5 5
- 79493432.00990875 512 512 573 579 9 8)RP(
-
-)0 P(A "+" sign by itself means to activate all columns, so that you can reorder
-just a few columns without specifying all of them:
-) 9 77 PR( # reorder 3 columns and then output the rest
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha +"
- TIME PI PHA Y X DX DY
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 7 6 512 512 578 574
- 79494575.58943175 9 8 512 512 579 573
- 79493631.03866175 6 5 512 512 578 575
- 79493290.86521725 5 5 512 512 578 575
- 79493432.00990875 9 8 512 512 579 573)RP(
-The column activation/deactivation is performed in the order of the
-specified column arguments. This means you can mix "+", "-" \201which
-de-activates all columns\202 and specific column names to reorder and
-select columns in one command. For example, consider the following:
-) 9 59 PR( # reorder and de-activate
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha + -x -y"
- TIME PI PHA DX DY
- --------------------- -------- -------- -------- --------
- 79493997.45854475 7 6 578 574
- 79494575.58943175 9 8 579 573
- 79493631.03866175 6 5 578 575
- 79493290.86521725 5 5 578 575
- 79493432.00990875 9 8 579 573)RP(
-We first activate "time", "pi", and "pha" so that they are output first.
-We then activate all of the other columns, and then de-activate "x" and "y".
-Note that this is different from:
-) 9 77 PR( # probably not what you want ...
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha -x -y +"
- TIME PI PHA Y X DX DY
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 7 6 512 512 578 574
- 79494575.58943175 9 8 512 512 579 573
- 79493631.03866175 6 5 512 512 578 575
- 79493290.86521725 5 5 512 512 578 575
- 79493432.00990875 9 8 512 512 579 573)RP(
-Here, "x" and "y" are de-activated, but then all columns including "x" and
-"y" are again re-activated.
-
-)0 P(Typically,
-)0 33 1 A(FunColumnActivate\201\202)33 0 TN TL()Ec /AF f D( uses a
-list of columns that are passed into the program from the command line. For
-example, the code for funtable contains the following:
-) 9 66 PR( char *cols=NULL;
-
- /* open the input FITS file */
- if\201 !\201fun = FunOpen\201argv[1], "rc", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen input file: %s\200n", argv[1]\202;
-
- /* set active flag for specified columns */
- if\201 argc >= 4 \202 cols = argv[3];
- FunColumnActivate\201fun, cols, NULL\202;)RP(
-
-The )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( call sets the
-default columns to be all columns in the input file. The
-)0 33 1 A(FunColumnActivate\201\202)33 0 TN TL()Ec /AF f D( call
-then allows the user to control which columns ultimately will be
-activated \201i.e., in this case, written to the new file\202. For example:
-) 1 39 PR( funtable test.ev foo.ev "pi pha time")RP(
-will process only the three columns mentioned, while:
-) 1 33 PR( funtable test.ev foo.ev "-time")RP(
-will process all columns except "time".
-
-)0 P(If )0 33 1 A(FunColumnActivate\201\202)33 0 TN TL()Ec /AF f D(
-is called with a null string, then the environment variable
-)BD(FUN_COLUMNS)ES( will be used to provide a global value, if present.
-This is the reason why we call the routine even if no columns
-are specified on the command line \201see example above\202, instead
-of calling it this way:
-) 4 45 PR( /* set active flag for specified columns */
- if\201 argc >= 4 \202{
- FunColumnActivate\201fun, argv[3], NULL\202;
- })RP(
-
-
-
-
-)0 2 40 H(FunColumnLookup)WB 106 Sn()WB 34 Sn( - lookup a Funtools column)EA()EH(
-
-)BD() 5 56 PR( #include <funtools.h>
-
- int FunColumnLookup\201Fun fun, char *s, int which,
- char **name, int *type, int *mode,
- int *offset, int *n, int *width\202)RP()ES(
-
-
-)0 P(The )BD(FunColumnLookup\201\202)ES( routine returns information about a named
-\201or indexed\202 column. The first argument is the Fun handle associated
-with this set of columns. The second argument is the name of the
-column to look up. If the name argument is NULL, the argument that
-follows is the zero-based index into the column array of the column
-for which information should be returned. The next argument is a
-pointer to a char *, which will contain the name of the column. The
-arguments that follow are the addresses of int values into which
-the following information will be returned:
-)UL()-1 LI( )BD(type)ES(: data type of column:
-)UL()-1 LI(A: ASCII characters
-)-1 LI(B: unsigned 8-bit char
-)-1 LI(I: signed 16-bit int
-)-1 LI(U: unsigned 16-bit int \201not standard FITS\202
-)-1 LI(J: signed 32-bit int
-)-1 LI(V: unsigned 32-bit int \201not standard FITS\202
-)-1 LI(E: 32-bit float
-)-1 LI(D: 64-bit float)LU(
-)-1 LI( )BD(mode)ES(: bit flag status of column, including:
-)UL()-1 LI( COL_ACTIVE 1 is column activated?
-)-1 LI( COL_IBUF 2 is column in the raw input data?
-)-1 LI( COL_PTR 4 is column a pointer to an array?
-)-1 LI( COL_READ 010 is read mode selected?
-)-1 LI( COL_WRITE 020 is write mode selected?
-)-1 LI( COL_REPLACEME 040 is this column being replaced by user data?)LU(
-)-1 LI( )BD(offset)ES(: byte offset in struct
-)-1 LI( )BD(n)ES(: number of elements \201i.e. size of vector\202 in this column
-)-1 LI( )BD(width)ES(: size in bytes of this column)LU(
-If the named column exists, the routine returns a positive integer,
-otherwise zero is returned. \201The positive integer is the index+1 into
-the column array where this column was located.\202
-
-If NULL is passed as the return address of one \201or more\202 of these
-values, no data is passed back for that information. For
-example:
-) 2 76 PR( if\201 !FunColumnLookup\201fun, "phas", 0, NULL NULL, NULL, NULL, &npha, NULL\202 \202
- gerror\201stderr, "can't find phas column\200n"\202;)RP(
-only returns information about the size of the phas vector.
-
-
-
-
-)0 2 41 H(FunTableRowGet)WB 107 Sn()WB 30 Sn( - get Funtools rows)EA()EH(
-
-
-)BD() 4 68 PR( #include <funtools.h>
-
- void *FunTableRowGet\201Fun fun, void *rows, int maxrow, char *plist,
- int *nrow\202)RP()ES(
-
-
-)0 P(The )BD(FunTableRowGet\201\202)ES( routine retrieves rows from a Funtools
-binary table or raw event file, and places the values of columns
-selected by )0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(
-into an array of user structs. Selected column values are
-automatically converted to the specified user data type \201and to native
-data format\202 as necessary.
-
-)0 P(The first argument is the Fun handle associated with this row data.
-The second )BD(rows)ES( argument is the array of user structs into
-which the selected columns will be stored. If NULL is passed, the
-routine will automatically allocate space for this array. \201This
-includes proper allocation of pointers within each struct, if the "@"
-pointer type is used in the selection of columns. Note that if you
-pass NULL in the second argument, you should free this space using the
-standard free\201\202 system call when you are finished with the array of
-rows.\202 The third )BD(maxrow)ES( argument specifies the maximum number
-of rows to be returned. Thus, if )BD(rows)ES( is allocated by the
-user, it should be at least of size maxrow*sizeof\201evstruct\202.
-
-)0 P(The fourth )BD(plist)ES( argument is a param list string. Currently,
-the keyword/value pair "mask=transparent" is supported in the plist
-argument. If this string is passed in the call's plist argument, then
-all rows are passed back to the user \201instead of just rows passing
-the filter\202. This is only useful when
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( also is
-used to specify "$region" as a column to return for each row. In
-such a case, rows found within a region have a returned region value
-greater than 0 \201corresponding to the region id of the region in which
-they are located\202, rows passing the filter but not in a region have
-region value of -1, and rows not passing any filter have region
-value of 0. Thus, using "mask=transparent" and the returned region
-value, a program can process all rows and decide on an action based
-on whether a given row passed the filter or not.
-
-)0 P(The final argument is a pointer to an int variable that will return
-the actual number of rows returned. The routine returns a pointer to
-the array of stored rows, or NULL if there was an error. \201This pointer
-will be the same as the second argument, if the latter is non-NULL\202.
-) 16 69 PR( /* get rows -- let routine allocate the row array */
- while\201 \201buf = \201Ev\202FunTableRowGet\201fun, NULL, MAXROW, NULL, &got\202\202 \202{
- /* process all rows */
- for\201i=0; i<got; i++\202{
- /* point to the i'th row */
- ev = buf+i;
- /* rearrange some values. etc. */
- ev->energy = \201ev->pi+ev->pha\202/2.0;
- ev->pha = -ev->pha;
- ev->pi = -ev->pi;
- }
- /* write out this batch of rows */
- FunTableRowPut\201fun2, buf, got, 0, NULL\202;
- /* free row data */
- if\201 buf \202 free\201buf\202;
- })RP(
-As shown above, successive calls to
-)0 30 1 A(FunTableRowGet\201\202)30 0 TN TL()Ec /AF f D( will return the
-next set of rows from the input file until all rows have been read,
-i.e., the routine behaves like sequential Unix I/O calls such as
-fread\201\202. See )0 2 A(evmerge example code)EA( for a
-more complete example.
-
-)0 P(Note that FunTableRowGet\201\202 also can be called as FunEventsGet\201\202, for
-backward compatibility.
-
-
-
-
-)0 2 42 H(FunTableRowPut)WB 108 Sn()WB 31 Sn( - put Funtools rows)EA()EH(
-
-
-) 1 70 PR()BD(int FunTableRowPut\201Fun fun, void *rows, int nev, int idx, char *plist\202)ES()RP(
-
-
-The )BD(FunTableRowPut\201\202)ES( routine writes rows to a FITS binary
-table, taking its input from an array of user structs that contain
-column values selected by a previous call to
-)0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D(. Selected
-column values are automatically converted from native data format to
-FITS data format as necessary.
-
-)0 P(The first argument is the Fun handle associated with this row data.
-The second )BD(rows)ES( argument is the array of user structs to
-output. The third )BD(nrow)ES( argument specifies the number number of
-rows to write. The routine will write )BD(nrow)ES( records, starting
-from the location specified by )BD(rows)ES(.
-
-)0 P(The fourth )BD(idx)ES( argument is the index of the first raw input
-row to write, in the case where rows from the user buffer are
-being merged with their raw input row counterparts \201see below\202. Note
-that this )BD(idx)ES( value is has nothing to do with the
-row buffer specified in argument 1. It merely matches the row
-being written with its corresponding \201hidden\202 raw row. Thus, if you
-read a number of rows, process them, and then write them out all at
-once starting from the first user row, the value of )BD(idx)ES(
-should be 0:
-) 14 70 PR( Ev ebuf, ev;
- /* get rows -- let routine allocate the row array */
- while\201 \201ebuf = \201Ev\202FunTableRowGet\201fun, NULL, MAXROW, NULL, &got\202\202 \202{
- /* process all rows */
- for\201i=0; i<got; i++\202{
- /* point to the i'th row */
- ev = ebuf+i;
- ...
- }
- /* write out this batch of rows, starting with the first */
- FunTableRowPut\201fun2, \201char *\202ebuf, got, 0, NULL\202;
- /* free row data */
- if\201 ebuf \202 free\201ebuf\202;
- })RP(
-
-)0 P(On the other hand, if you write out the rows one at a time \201possibly
-skipping rows\202, then, when writing the i'th row from the input
-array of rows, set )BD(idx)ES( to the value of i:
-) 14 70 PR( Ev ebuf, ev;
- /* get rows -- let routine allocate the row array */
- while\201 \201ebuf = \201Ev\202FunTableRowGet\201fun, NULL, MAXROW, NULL, &got\202\202 \202{
- /* process all rows */
- for\201i=0; i<got; i++\202{
- /* point to the i'th row */
- ev = ebuf+i;
- ...
- /* write out the current \201i.e., i'th\202 row */
- FunTableRowPut\201fun2, \201char *\202ev, 1, i, NULL\202;
- }
- /* free row data */
- if\201 ebuf \202 free\201ebuf\202;
- })RP(
-
-)0 P(The final argument is a param list string that is not currently used.
-The routine returns the number of rows output. This should be equal
-to the value passed in the third )BD(nrowFunParamGet)WB 37 Sn( - get a Funtools param value)EA()EH(
-
-
-)BD() 9 74 PR( #include <funtools.h>
-
- int FunParamGetb\201Fun fun, char *name, int n, int defval, int *got\202
-
- int FunParamGeti\201Fun fun, char *name, int n, int defval, int *got\202
-
- double FunParamGetd\201Fun fun, char *name, int n, double defval, int *got\202
-
- char *FunParamGets\201Fun fun, char *name, int n, char *defval, int *got\202)RP()ES(
-
-
-)0 P(The four routines )BD(FunParamGetb\201\202)ES(, )BD(FunParamGeti\201\202)ES(,
-)BD(FunParamGetd\201\202)ES(, and )BD(FunParamGets\201\202)ES(, return the value of
-a FITS header parameter as a boolean, int, double, and string,
-respectively. The string returned by )BD(FunParamGets\201\202)ES( is a malloc'ed
-copy of the header value and should be freed when no longer needed.
-
-)0 P(The first argument is the Fun handle associated with the FITS header
-being accessed. Normally, the header is associated with the FITS
-extension that you opened with )BD(FunOpen\201\202)ES(. However, you can use
-FunInfoPut\201\202 to specify access of the primary header. In particular,
-if you set the FUN_PRIMARYHEADER parameter to 1, then the primary
-header is used for all parameter access until the value is reset to
-0. For example:
-) 9 75 PR( int val;
- FunParamGeti\201fun, "NAXIS", 1, 0, &got\202; # current header
- val=1;
- FunInfoPut\201fun, FUN_PRIMARYHEADER, &val, 0\202; # switch to ...
- FunParamGeti\201fun, "NAXIS", 1, 0, &got\202; # ... primary header
- FunParamGeti\201fun, "NAXIS", 2, 0, &got\202; # ... primary header
- val=0;
- FunInfoPut\201fun, FUN_PRIMARYHEADER, &val, 0\202; # switch back to ...
- FunParamGeti\201fun, "NAXIS", 2, 0, &got\202; # current header)RP(
-
-)0 P(Alternatively, you can use the FUN_PRIMARY macro to access parameters
-from the primary header on a per-parameter basis:
-) 2 72 PR( FunParamGeti\201fun, "NAXIS1", 0, 0, &got\202; # current header
- FunParamGeti\201FUN_PRIMARY\201fun\202, "NAXIS1", 0, 0, &got\202; # primary header)RP(
-)BD(NB: FUN_PRIMARY is deprecated.)ES(
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread-safe. We recommend use of FunInfoPut\201\202 to switch between the
-extension header and the primary header.
-
-)0 P(For output data, access to the primary header is only possible until
-the header is written out, which usually takes place when the first
-data are written.
-
-)0 P(The second argument is the name of the parameter to access. The third
-)BD(n)ES( argument, if non-zero, is an integer that will be added as a
-suffix to the parameter name. This makes it easy to use a simple loop
-to process parameters having the same root name. For example, to
-gather up all values of TLMIN and TLMAX for each column in a binary
-table, you can use:
-) 4 74 PR( for\201i=0, got=1; got; i++\202{
- fun->cols[i]->tlmin = \201int\202FunParamGeti\201fun, "TLMIN", i+1, 0.0, &got\202;
- fun->cols[i]->tlmax = \201int\202FunParamGeti\201fun, "TLMAX", i+1, 0.0, &got\202;
- })RP(
-
-)0 P(The fourth )BD(defval)ES( argument is the default value to return if
-the parameter does not exist. Note that the data type of this
-parameter is different for each specific FunParamGet\201\202 call. The final
-)BD(got)ES( argument will be 0 if no param was found. Otherwise the
-data type of the parameter is returned as follows: FUN_PAR_UNKNOWN
-\201'u'\202, FUN_PAR_COMMENT \201'c'\202, FUN_PAR_LOGICAL \201'l'\202, FUN_PAR_INTEGER
-\201'i'\202, FUN_PAR_STRING \201's'\202, FUN_PAR_REAL \201'r'\202, FUN_PAR_COMPLEX \201'x'\202.
-
-)0 P(These routines return the value of the header parameter, or the
-specified default value if the header parameter does not exist. The
-returned value is a malloc'ed string and should be freed when no
-longer needed.
-
-)0 P(By default, )BD(FunParamGets\201\202)ES( returns the string value of the
-named parameter. However, you can use FunInfoPut\201\202 to retrieve the
-raw 80-character FITS card instead. In particular, if you set the
-FUN_RAWPARAM parameter to 1, then card images will be returned by
-FunParamGets\201\202 until the value is reset to 0.
-
-)0 P(Alternatively, if the FUN_RAW macro is applied to the name, then the
-80-character raw FITS card is returned instead.
-)BD(NB: FUN_RAW is deprecated.)ES(
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread-safe. We recommend use of FunInfoPut\201\202 to switch between the
-extension header and the primary header.
-
-)0 P(Note that in addition to the behaviors described above, the
-routine )BD(FunParamGets\201\202)ES( will return the 80 raw characters of the
-)BD(nth)ES( FITS card \201including the comment\202 if )BD(name)ES( is specified as
-NULL and )BD(n)ES( is positive. For example, to loop through all FITS
-header cards in a given extension and print out the raw card, use:
-) 9 55 PR( for\201i=1; ;i++\202{
- if\201 \201s = FunParamGets\201fun, NULL, i, NULL, &got\202\202 \202{
- fprintf\201stdout, "%.80s\200n", s\202;
- free\201s\202;
- }
- else{
- break;
- }
- })RP(
-
-
-
-
-)0 2 43 H(FunParamPut)WB 109 Sn()WB 38 Sn( - put a Funtools param value)EA()EH(
-
-
-)BD() 13 71 PR( #include <funtools.h>
-
- int FunParamPutb\201Fun fun, char *name, int n, int value, char *comm,
- int append\202
-
- int FunParamPuti\201Fun fun, char *name, int n, int value, char *comm,
- int append\202
-
- int FunParamPutd\201Fun fun, char *name, int n, double value, int prec,
- char *comm, int append\202
-
- int FunParamPuts\201Fun fun, char *name, int n, char *value, char *comm,
- int append\202)RP()ES(
-
-
-)0 P(The four routines )BD(FunParamPutb\201\202)ES(, )BD(FunParamPuti\201\202)ES(,
-)BD(FunParamPutd\201\202)ES(, and )BD(FunParamPuts\201\202)ES(, will set the value
-of a FITS header parameter as a boolean, int, double, and string,
-respectively.
-
-)0 P(The first argument is the Fun handle associated with the FITS header
-being accessed. Normally, the header is associated with the FITS
-extension that you opened with )BD(FunOpen\201\202)ES(.
-However, you can use FunInfoPut\201\202 to specify that use of the primary
-header. In particular, if you set the FUN_PRIMARYHEADER parameter to
-1, then the primary header is used for all parameter access until the
-value is reset to 0. For example:
-) 5 69 PR( int val;
- FunParamPuti\201fun, "NAXIS1", 0, 10, NULL, 1\202; # current header
- val=1;
- FunInfoPut\201fun, FUN_PRIMARYHEADER, &val, 0\202; # switch to ...
- FunParamPuti\201fun, "NAXIS1", 0, 10, NULL, 1\202; # primary header)RP(
-\201You also can use the deprecated FUN_PRIMARY macro, to access
-parameters from the primary header.\202
-
-)0 P(The second argument is the )BD(name)ES( of the parameter. \201
-In accordance with FITS standards, the special names )BD(COMMENT)ES(
-and )BD(HISTORY)ES(, as well as blank names, are output without the "= "
-value indicator in columns 9 and 10.
-
-)0 P(The third )BD(n)ES( argument, if non-zero, is an integer that will be
-added as a suffix to the parameter name. This makes it easy to use a
-simple loop to process parameters having the same root name. For
-example, to set the values of TLMIN and TLMAX for each column in a
-binary table, you can use:
-) 4 70 PR( for\201i=0; i<got; i++\202{
- FunParamPutd\201fun, "TLMIN", i+1, tlmin[i], 7, "min column val", 1\202;
- FunParamPutd\201fun, "TLMAX", i+1, tlmax[i], 7, "max column val", 1\202;
- })RP(
-
-)0 P(The fourth )BD(defval)ES( argument is the value to set. Note that the
-data type of this argument is different for each specific
-FunParamPut\201\202 call. The )BD(comm)ES( argument is the comment
-string to add to this header parameter. Its value can be NULL. The
-final )BD(append)ES( argument determines whether the parameter is added
-to the header if it does not exist. If set to a non-zero value, the
-header parameter will be appended to the header if it does not exist.
-If set to 0, the value will only be used to change an existing parameter.
-
-)0 P(Note that the double precision routine FunParamPutd\201\202 supports an
-extra )BD(prec)ES( argument after the )BD(value)ES( argument, in order
-to specify the precision when converting the double value to ASCII. In
-general a 20.[prec] format is used \201since 20 characters are alloted to
-a floating point number in FITS\202 as follows: if the double value being
-put to the header is less than 0.1 or greater than or equal to
-10**\20120-2-[prec]\202, then %20.[prec]e format is used \201i.e., scientific
-notation\202; otherwise %20.[prec]f format is used \201i.e., numeric
-notation\202.
-
-)0 P(As a rule, parameters should be set before writing the table or image.
-It is, however, possible to update the value of an )BD(existing)ES(
-parameter after writing an image or table \201but not to add a new
-one\202. Such updating only works if the parameter already exists and if
-the output file is seekable, i.e. if it is a disk file or is stdout
-being redirected to a disk file.
-
-)0 P(It is possible to add a new parameter to a header after the data has
-been written, but only if space has previously been reserved. To reserve
-space, add a blank parameter whose value is the name of the parameter you
-eventually will update. Then, when writing the new parameter, specify a
-value of 2 for the append flag. The parameter writing routine will
-first look to update an existing parameter, as usual. If an existing
-parameter is not found, an appropriately-valued blank parameter will be
-searched for and replaced. For example:
-) 8 71 PR( /* add blank card to be used as a place holder for IPAR1 update */
- FunParamPuts\201fun, NULL, 0, "IPAR1", "INTEGER Param", 0\202;
- ...
- /* write header and data */
- FunTableRowPut\201fun, events, got, 0, NULL\202;
- ...
- /* update param in file after writing data -- note append = 2 here */
- FunParamPuti\201fun, "IPAR", 1, 400, "INTEGER Param", 2\202;)RP(
-
-)0 P(The parameter routines return a 1 if the routine was successful and a 0 on
-failure. In general, the major reason for failure is that you did not
-set the append argument to a non-zero value and the parameter did not
-already exist in the file.
-
-
-
-
-)0 2 44 H(FunInfoGet)WB 110 Sn()WB 35 Sn( - get information from Funtools struct)EA()EH(
-
-
-)BD() 3 52 PR( #include <funtools.h>
-
- int FunInfoGet\201Fun fun, int type, char *addr, ...\202)RP()ES(
-
-
-)0 P(The )BD(FunInfoGet\201\202)ES( routine returns information culled from the
-Funtools structure. The first argument is the Fun handle from which
-information is to be retrieved. This first required argument is followed
-by a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to retrieve and the
-address where the information is to be stored. The list is terminated by a 0.
-The routine returns the number of get actions performed.
-
-)0 P(The full list of available information is described below. Please note
-that only a few of these will be useful to most application developers.
-For imaging applications, the most important types are:
-) 3 47 PR( FUN_SECT_DIM1 int /* dim1 for section */
- FUN_SECT_DIM2 int /* dim2 for section */
- FUN_SECT_BITPIX int /* bitpix for section */)RP(
-These would be used to determine the dimensions and data type of image
-data retrieved using the
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D( routine. For
-example:
-) 17 68 PR( /* extract and bin the data section into an image buffer */
- buf = FunImageGet\201fun, NULL, NULL\202;
- /* get required information from funtools structure.
- this should come after the FunImageGet\201\202 call, in case the call
- changed sect_bitpix */
- FunInfoGet\201fun,
- FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- 0\202;
- /* loop through pixels and reset values below limit to value */
- for\201i=0; i<dim1*dim2; i++\202{
- switch\201bitpix\202{
- case 8:
- if\201 cbuf[i] <= blimit \202 cbuf[i] = bvalue;
- ...
- })RP(
-It is important to bear in mind that the call to
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D(
-can change the value of FUN_SECT_BITPIX \201e.g. if "bitpix=n" is passed
-in the param list\202. Therefore, a call to
-)0 35 1 A(FunInfoGet\201\202)35 0 TN TL()Ec /AF f D(
-should be made )BD(after)ES( the call to
-)0 26 1 A(FunImageGet\201\202)26 0 TN TL()Ec /AF f D(,
-in order to retrieve the updated bitpix value.
-See the )0 2 A(imblank example code)EA( for more
-details.
-
-)0 P(It also can be useful to retrieve the World Coordinate System
-information from the Funtools structure. Funtools uses the the WCS
-Library developed by Doug Mink at SAO, which is available
-)R3 2 A(here)EA(.
-\201More information about the WCSTools project in general can be found
-)R4 2 A(here)EA(.\202
-The )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( routine initializes
-two WCS structures that can be used with this WCS Library.
-Applications can retrieve either of these two WCS structures using
-)BD(FunInfoGet\201\202)ES(:
-) 2 75 PR( FUN_WCS struct WorldCoor * /* wcs structure, for image coordinates*/
- FUN_WCS0 struct WorldCoor * /* wcs structure, for physical coordinates */)RP(
-The structure retrieved by FUN_WCS is a WCS library handle containing
-parameters suitable for use with image coordinates, regardless of whether the
-data are images or tables. For this structure, the WCS reference point
-\201CRPIX\202 has been converted to image coordinates if the underlying file
-is a table \201and therefore in physical coordinates\202. You therefore must
-ensure that the positions being passed to a routine like pix2wcs are in
-image coordinates. The FUN_WCS0 structure has not had its WCS
-reference point converted to image coordinates. It therefore is useful
-when passing processing physical coordinates from a table.
-
-)0 P(Once a WCS structure has been retrieved, it can be used as the first
-argument to the WCS library routines. \201If the structure is NULL, no
-WCS information was contained in the file.\202 The two important WCS routines
-that Funtools uses are:
-) 5 66 PR( #include <wcs.h>
- void pix2wcs \201wcs,xpix,ypix,xpos,ypos\202
- struct WorldCoor *wcs; /* World coordinate system structure */
- double xpix,ypix; /* x and y coordinates in pixels */
- double *xpos,*ypos; /* RA and Dec in degrees \201returned\202 */)RP(
-
-which converts pixel coordinates to sky coordinates, and:
-
-) 5 67 PR( void wcs2pix \201wcs, xpos, ypos, xpix, ypix, offscl\202
- struct WorldCoor *wcs; /* World coordinate system structure */
- double xpos,ypos; /* World coordinates in degrees */
- double *xpix,*ypix; /* coordinates in pixels */
- int *offscl; /* 0 if within bounds, else off scale */)RP(
-which converts sky coordinates to pixel coordinates. Again, please note
-that the wcs structure returned by FUN_WCS assumes that image coordinates
-are passed to the pix2wcs routine, while FUN_WCS0 assumes that physical
-coordinates are passed.
-
-)0 P(Note that funtools.h file automatically includes wcs.h. An example
-program that utilizes these WCS structure to call WCS Library routines
-is )0 2 A(twcs.c)EA(.
-
-)0 P(The following is the complete list of information that can be returned:
-) 52 79 PR( name type comment
- --------- -------- ---------------------------------------------
- FUN_FNAME char * /* file name */
- FUN_GIO GIO /* gio handle */
- FUN_HEADER FITSHead /* fitsy header struct */
- FUN_TYPE int /* TY_TABLE,TY_IMAGE,TY_EVENTS,TY_ARRAY */
- FUN_BITPIX int /* bits/pixel in file */
- FUN_MIN1 int /* tlmin of axis1 -- tables */
- FUN_MAX1 int /* tlmax of axis1 -- tables */
- FUN_MIN2 int /* tlmin of axis2 -- tables */
- FUN_MAX2 int /* tlmax of axis2 -- tables */
- FUN_DIM1 int /* dimension of axis1 */
- FUN_DIM2 int /* dimension of axis2 */
- FUN_ENDIAN int /* 0=little, 1=big endian */
- FUN_FILTER char * /* supplied filter */
- FUN_IFUN FITSHead /* pointer to reference header */
- FUN_IFUN0 FITSHead /* same as above, but no reset performed */
- /* image information */
- FUN_DTYPE int /* data type for images */
- FUN_DLEN int /* length of image in bytes */
- FUN_DPAD int /* padding to end of extension */
- FUN_DOBLANK int /* was blank keyword defined? */
- FUN_BLANK int /* value for blank */
- FUN_SCALED int /* was bscale/bzero defined? */
- FUN_BSCALE double /* bscale value */
- FUN_BZERO double /* bzero value */
- /* table information */
- FUN_NROWS int /* number of rows in file \201naxis2\202 */
- FUN_ROWSIZE int /* size of user row struct */
- FUN_BINCOLS char * /* specified binning columns */
- FUN_OVERFLOW int /* overflow detected during binning? */)WR(
- /* array information */
- FUN_SKIP int /* bytes to skip in array header */
- /* section information */
- FUN_SECT_X0 int /* low dim1 value of section */
- FUN_SECT_X1 int /* hi dim1 value of section */
- FUN_SECT_Y0 int /* low dim2 value of section */
- FUN_SECT_Y1 int /* hi dim2 value of section */
- FUN_SECT_BLOCK int /* section block factor */
- FUN_SECT_BTYPE int /* 's' \201sum\202, 'a' \201average\202 for binning */
- FUN_SECT_DIM1 int /* dim1 for section */
- FUN_SECT_DIM2 int /* dim2 for section */
- FUN_SECT_BITPIX int /* bitpix for section */
- FUN_SECT_DTYPE int /* data type for section */
- FUN_RAWBUF char * /* pointer to raw row buffer */
- FUN_RAWSIZE int /* byte size of raw row records */
- /* column information */
- FUN_NCOL int /* number of row columns defined */
- FUN_COLS FunCol /* array of row columns */
- /* WCS information */
- FUN_WCS struct WorldCoor * /* wcs structure, converted for images*/
- FUN_WCS0 struct WorldCoor * /* wcs structure, not converted */)RP(
-
-)0 P(Row applications would not normally need any of this information.
-An example of how these values can be used in more complex programs is
-the )0 2 A(evnext example code)EA(. In this program, the
-time value for each row is changed to be the value of the succeeding
-row. The program thus reads the time values for a batch of rows,
-changes the time values to be the value for the succeeding row, and
-then merges these changed time values back with the other columns to
-the output file. It then reads the next batch, etc.
-
-)0 P(This does not work for the last row read in each batch, since there
-is no succeeding row until the next batch is read. Therefore, the
-program saves that last row until it has read the next batch, then
-processes the former before starting on the new batch. In order to
-merge the last row successfully, the code uses FUN_RAWBUF to save
-and restore the raw input data associated with each batch of
-rows. Clearly, this requires some information about how funtools
-works internally. We are happy to help you write such programs as the
-need arises.
-
-
-
-
-)0 2 45 H(FunInfoPut)WB 111 Sn()WB 36 Sn( - put information into a Funtools struct)EA()EH(
-
-
-)BD() 3 52 PR( #include <funtools.h>
-
- int FunInfoPut\201Fun fun, int type, char *addr, ...\202)RP()ES(
-
-
-)0 P(The )BD(FunInfoPut\201\202)ES( routine puts information into a Funtools
-structure. The first argument is the Fun handle from which
-information is to be retrieved. After this first required argument
-comes a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to store and the
-address of the new information to store in the struct. The variable
-list is terminated by a 0. The routine returns the number of put
-actions performed.
-
-)0 P(The full list of available information is described above with the
-)0 36 1 A(FunInfoPut\201\202)36 0 TN TL()Ec /AF f D( routine. Although
-use of this routine is expected to be uncommon, there is one
-important situation in which it plays an essential part: writing
-multiple extensions to a single output file.
-
-)0 P(For input, multiple extensions are handled by calling
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( for each extension to be
-processed. When opening multiple inputs, it sometimes is the case that
-you will want to process them and then write them \201including their
-header parameters\202 to a single output file. To accomplish this, you
-open successive input extensions using
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( and then call
-)BD(FunInfoPut\201\202)ES( to set the
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(
-of the output file to that of the newly opened input extension:
-) 4 71 PR( /* open a new input extension */
- ifun=FunOpen\201tbuf, "r", NULL\202\202 \202
- /* make the new extension the reference handle for the output file */
- FunInfoPut\201ofun, FUN_IFUN, &ifun, 0\202;)RP(
-
-Resetting FUN_IFUN has same effect as when a funtools handle is passed
-as the final argument to
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(. The state of the output
-file is reset so that a new extension is ready to be written.
-Thus, the next I/O call on the output extension will output the
-header, as expected.
-
-)0 P(For example, in a binary table, after resetting FUN_IFUN you can then
-call )0 32 1 A(FunColumnSelect\201\202)32 0 TN TL()Ec /AF f D( to
-select the columns for output. When you then call
-)0 27 1 A(FunImagePut\201\202)27 0 TN TL()Ec /AF f D( or )0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D(, a new
-extension will be written that contains the header parameters from the
-reference extension. Remember to call
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( to complete output of a
-given extension.
-
-)0 P(A complete example of this capability is given
-in the )0 2 A(evcol example code)EA(.
-The central algorithm is:
-)UL()-1 LI( open the output file without a reference handle
-)-1 LI( loop: open each input extension in turn
-)UL()-1 LI( set the reference handle for output to the newly opened input extension
-)-1 LI( read the input rows or image and perform processing
-)-1 LI( write new rows or image to the output file
-)-1 LI( flush the output
-)-1 LI( close input extension)LU(
-)-1 LI( close output file)LU(
-Note that )0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( is called
-after processing each input extension in order to ensure that the
-proper padding is written to the output file. A call to
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( also ensures that the
-extension header is written to the output file in the case where there
-are no rows to output.
-
-)0 P(If you wish to output a new extension without using a
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(, you can
-call FunInfoPut\201\202 to reset the FUN_OPS value directly. For a binary
-table, you would then call FunColumnSelect\201\202 to set up the columns for
-this new extension.
-) 6 59 PR( /* reset the operations performed on this handle */
- int ops=0;
- FunInfoPut\201ofun, FUN_OPS, &ops, 0\202;
- FunColumnSelect\201fun, sizeof\201EvRec\202, NULL,
- "MYCOL", "J", "w", FUN_OFFSET\201Ev, mycol\202,
- NULL\202;)RP(
-Once the FUN_OPS variable has been reset, the next I/O call on the
-output extension will output the header, as expected.
-
-
-
-
-)0 2 46 H(FunFlush)WB 112 Sn()WB 39 Sn( - flush data to output file)EA()EH(
-
-
-)BD() 3 37 PR( #include <funtools.h>
-
- void FunFlush\201Fun fun, char *plist\202)RP()ES(
-
-
-)0 P(The )BD(FunFlush)ES( routine will flush data to a FITS output file. In
-particular, it can be called after all rows have been written \201using
-the )0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D( routine\202
-in order to add the null padding that is required to complete a FITS
-block. It also should be called after completely writing an image using
-)0 27 1 A(FunImagePut\201\202)27 0 TN TL()Ec /AF f D( or after writing
-the final row of an image using
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D(.
-
-)0 P(The )BD(plist)ES( \201i.e., parameter list\202 argument is a string
-containing one or more comma-delimited )BD(keyword=value)ES(
-parameters. If the plist string contains the parameter
-"copy=remainder" and the file was opened with a reference file, which,
-in turn, was opened for extension copying \201i.e. the input
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( mode also was "c" or "C"\202,
-then FunFlush also will copy the remainder of the FITS extensions from
-the input reference file to the output file. This normally would be
-done only at the end of processing.
-
-)0 P(Note that )0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( is called
-with "copy=remainder" in the mode string by FunClose\201\202. This means
-that if you close the output file before the reference input file, it
-is not necessary to call
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( explicitly, unless you
-are writing more than one extension. See the
-)0 2 A(evmerge example code)EA(. However, it is safe to
-call )0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( more than once
-without fear of re-writing either the padding or the copied
-extensions.
-
-)0 P(In addition, if )0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D( is
-called on an output file with the plist set to "copy=reference" and if
-the file was opened with a reference file, the reference extension is
-written to the output file. This mechanism provides a simple way to
-copy input extensions to an output file without processing the former.
-For example, in the code fragment below, an input extension is set to
-be the reference file for a newly opened output extension. If that
-reference extension is not a binary table, it is written to the output
-file:
-) 22 73 PR( /* process each input extension in turn */
- for\201ext=0; ;ext++\202{
- /* get new extension name */
- sprintf\201tbuf, "%s[%d]", argv[1], ext\202;
- /* open input extension -- if we cannot open it, we are done */
- if\201 !\201ifun=FunOpen\201tbuf, "r", NULL\202\202 \202
- break;
- /* make the new extension the reference handle for the output file */
- FunInfoPut\201ofun, FUN_IFUN, &ifun, 0\202;
- /* if its not a binary table, just write it out */
- if\201 !\201s=FunParamGets\201ifun, "XTENSION", 0, NULL, &got\202\202 ||
- strcmp\201s, "BINTABLE"\202\202{
- if\201 s \202 free\201s\202;
- FunFlush\201ofun, "copy=reference"\202;
- FunClose\201ifun\202;
- continue;
- }
- else{
- /* process binary table */
- ....
- }
- })RP(
-
-
-
-
-)0 2 47 H(FunClose)WB 113 Sn()WB 40 Sn( - close a Funtools data file)EA()EH(
-
-
-)BD() 3 24 PR( #include <funtools.h>
-
- void FunClose\201Fun fun\202)RP()ES(
-
-
-)0 P(The )BD(FunClose\201\202)ES( routine closes a previously-opened Funtools data
-file, freeing control structures. If a
-)0 23 1 A(Funtools reference handle)23 0 TN TL()Ec /AF f D(
-was passed to
-the )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( call for this file,
-and if copy mode also was specified for that file, then
-)0 40 1 A(FunClose\201\202)40 0 TN TL()Ec /AF f D( also will copy the
-remaining extensions from the input file to the output file \201if the
-input file still is open\202. Thus, we recommend always closing the
-output Funtools file )BD(before)ES( the input file. \201Alternatively,
-you can call )0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D(
-explicitly\202.
-
-
-
-
-)0 2 48 H(FunRef:)WB 114 Sn()WB 23 Sn( the Funtools Reference Handle)EA()EH(
-
-
-)0 2 49 H(Summary)WB 115 Sn()EH(
-A description of how to use a Funtools reference handle to connect a
-Funtools input file to an output file.
-
-
-)0 2 50 H(Description)WB 116 Sn()EH(
-)0 P(The Funtools reference handle connects a Funtools input file to a
-Funtools output file so that parameters \201or even whole extensions\202 can
-be copied from the one to the other. To make the connection, the Funtools
-handle of the input file is passed to the
-final argument of the
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( call for the output file:
-) 4 67 PR( if\201 !\201ifun = FunOpen\201argv[1], "r", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen input file: %s\200n", argv[1]\202;
- if\201 !\201ofun = FunOpen\201argv[2], "w", ifun\202\202 \202
- gerror\201stderr, "could not FunOpen output file: %s\200n", argv[2]\202;)RP(
-It does not matter what type of input or output file \201or extension\202 is
-opened, or whether they are the same type. When the output image or
-binary table is written using
-)0 27 1 A(FunImagePut\201\202)27 0 TN TL()Ec /AF f D(
-or
-)0 31 1 A(FunTableRowPut\201\202)31 0 TN TL()Ec /AF f D(
-an appropriate header will be written first, with parameters copied
-from the input extension. Of course, invalid parameters will be
-removed first, e.g., if the input is a binary table and the output is
-an image, then binary table parameters such as TFORM, TUNIT,
-etc. parameters will not be copied to the output.
-
-)0 P(Use of a reference handle also allows default values to be passed
-to
-)0 27 1 A(FunImagePut\201\202)27 0 TN TL()Ec /AF f D( in order to
-write out an output image with the same dimensions and data type
-as the input image. To use the defaults from the input, a value
-of 0 is entered for dim1, dim2, and bitpix. For example:
-) 5 40 PR( fun = FunOpen\201argv[1], "r", NULL\202;
- fun2 = FunOpen\201argv[2], "w", fun\202;
- buf = FunImageGet\201fun, NULL, NULL\202;
- ... process image data ...
- FunImagePut\201fun2, buf, 0, 0, 0, NULL\202;)RP(
-Of course, you often want to get information about the data type
-and dimensions of the image for processing. The above code
-is equivalent to the following:
-) 7 61 PR( fun = FunOpen\201argv[1], "r", NULL\202;
- fun2 = FunOpen\201argv[2], "w", fun\202;
- buf = FunImageGet\201fun, NULL, NULL\202;
- FunInfoGet\201fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2,
- FUN_SECT_BITPIX, &bitpix, 0\202;
- ... process image data ...
- FunImagePut\201fun2, buf, dim1, dim2, bitpix, NULL\202;)RP(
-
-)0 P(It is possible to change the reference handle for a given output Funtools
-handle using the
-)0 36 1 A(FunInfoPut\201\202)36 0 TN TL()Ec /AF f D( routine:
-) 2 71 PR( /* make the new extension the reference handle for the output file */
- FunInfoPut\201fun2, FUN_IFUN, &fun, 0\202;)RP(
-When this is done, Funtools specially resets the output file to start
-a new output extension, which is connected to the new input reference
-handle. You can use this mechanism to process multiple input extensions
-into a single output file, by successively opening the former and
-setting the reference handle for the latter. For example:
-) 18 73 PR( /* open a new output FITS file */
- if\201 !\201fun2 = FunOpen\201argv[2], "w", NULL\202\202 \202
- gerror\201stderr, "could not FunOpen output file: %s\200n", argv[2]\202;
- /* process each input extension in turn */
- for\201ext=0; ;ext++\202{
- /* get new extension name */
- sprintf\201tbuf, "%s[%d]", argv[1], ext\202;
- /* open it -- if we cannot open it, we are done */
- if\201 !\201fun=FunOpen\201tbuf, "r", NULL\202\202 \202
- break;
- /* make the new extension the reference handle for the output file */
- FunInfoPut\201fun2, FUN_IFUN, &fun, 0\202;
- ... process ...
- /* flush output extension \201write padding, etc.\202 */
- FunFlush\201fun2, NULL\202;
- /* close the input extension */
- FunClose\201fun\202;
- })RP(
-In this example, the output file is opened first. Then each successive
-input extension is opened, and the output reference handle is set to
-the newly opened input handle. After data processing is performed, the
-output extension is flushed and the input extension is closed, in
-preparation for the next input extension.
-)0 P(Finally, a reference handle can be used to copy other extensions from
-the input file to the output file. Copy of other extensions is
-controlled by adding a "C" or "c" to the mode string of the
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(
-call )BD(of the input reference file)ES(. If "C" is specified, then
-other extensions are )BD(always)ES( copied \201i.e., copy is forced by the
-application\202. If "c" is used, then other extensions are copied if the
-user requests copying by adding a plus sign "+" to the extension name
-in the bracket specification. For example, the )BD(funtable)ES(
-program utilizes user-specified "c" mode so that the second example
-below will copy all extensions:
-) 4 60 PR( # copy only the EVENTS extension
- csh> funtable "test.ev[EVENTS,circle\201512,512,10\202]" foo.ev
- # copy ALL extensions
- csh> funtable "test.ev[EVENTS+,circle\201512,512,10\202]" foo.ev)RP(
-When extension copy is specified in the input file, the call to
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(
-on the input file delays the actual file open until the output file
-also is opened \201or until I/O is performed on the input file, which
-ever happens first\202. Then, when the output file is opened, the input
-file is also opened and input extensions are copied to the output
-file, up to the specific extension being opened. Processing of input
-and output extensions then proceed.
-)0 P(When extension processing is complete, the remaining extensions need to
-be copied from input to output. This can be done explicitly, using the
-)0 39 1 A(FunFlush\201\202)39 0 TN TL()Ec /AF f D(
-call with the "copy=remaining" plist:
-) 1 34 PR( FunFlush\201fun, "copy=remaining"\202;)RP(
-Alternatively, this will happen automatically, if the output file
-is closed )BD(before)ES( the input file:
-) 5 77 PR( /* we could explicitly flush remaining extensions that need copying */
- /* FunFlush\201fun2, "copy=remaining"\202; */
- /* but if we close output before input, end flush is done automatically */
- FunClose\201fun2\202;
- FunClose\201fun\202;)RP(
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 51 H(Last)WB 117 Sn( updated: December 1, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (files.html) D
-/Ti (Funtools Data Files) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 42 Sn(
-
-
-)0 2 52 H(FunFiles:)WB 120 Sn()WB 118 Sn( Funtools Data Files)EA()EH(
-
-
-)0 2 53 H(Summary)WB 121 Sn()EH(
-This document describes the data file formats \201FITS, array, raw
-events\202 as well as the file types \201gzip, socket, etc.\202 supported
-by Funtools.
-
-
-)0 2 54 H(Description)WB 122 Sn()EH(
-)0 P(Funtools supports FITS images and binary tables, and binary files
-containing array \201homogeneous\202 data or event \201heterogeneous\202 data.
-IRAF-style brackets are appended to the filename to specify various
-kinds of information needed to characterize these data:
-) 3 49 PR( file[ext|ind|ARRAY\201\202|EVENTS\201\202,section][filters]
- or
- file[ext|ind|ARRAY\201\202|EVENTS\201\202,section,filters])RP(
-where:
-)UL()-1 LI( )BD(file)ES( is the Funtools file name
-)-1 LI( )BD(ext)ES( is the FITS extension name
-)-1 LI( )BD(ind)ES( is the FITS extension number
-)-1 LI( )BD(ARRAY\201\202)ES( is an array specification
-)-1 LI( )BD(EVENTS\201\202)ES( is an event specification
-)-1 LI( )BD(section)ES( is the image section specification
-)-1 LI( )BD(filters)ES( are spatial region and table \201row\202 filters)LU(
-
-)0 2 55 H(Supported)WB 123 Sn()WB 43 Sn( Data Formats)EA()EH(
-)0 P(Funtools programs \201and the underlying libraries\202 support the
-following data file formats:
-)UL()-1 LI( FITS images \201and image extensions\202
-)-1 LI( FITS binary tables
-)-1 LI( binary files containing an array of homogeneous data
-)-1 LI( binary files containing events, i.e. records of heterogeneous data
-)-1 LI( column-based text files, which are documented )0 47 1 A(here)47 0 TN TL()Ec /AF f D(
-)-1 LI( non-disk files and lists of files)LU(
-Information needed to identify and characterize
-the event or image data can be specified on the command line
-using IRAF-style bracket notation appended to the filename:
-) 5 69 PR( foo.fits # open FITS default extension
- image.fits[3] # open FITS extension #3
- events.fits[EVENTS] # open EVENTS extension
- array.file[ARRAY\201s1024\202] # open 1024x1024 short array
- events.file[EVENTS\201x:1024,y:1024...\202] # open non-FITS event list)RP(
-Note that in many Unix shells \201e.g., csh and tcsh\202, filenames must
-be enclosed in quotes to protect the brackets from shell processing.
-
-)0 2 56 H(FITS)WB 124 Sn()WB 44 Sn( Images and Binary Tables)EA()EH(
-)0 P(When )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( opens a FITS file
-without a bracket specifier, the default behavior is to look for a
-valid image in the primary HDU. In the absence of a primary image,
-Funtools will try to open an extension named either )BD(EVENTS)ES( or
-)BD(STDEVT)ES(, if one of these exists. This default behavior supports
-both FITS image processing and standard X-ray event list processing
-\201which, after all, is what we at SAO/HEAD do\202.
-
-)0 P(In order to open a FITS binary table or image extension explicitly, it
-is necessary to specify either the extension name or the extension
-number in brackets:
-) 3 71 PR( foo.fits[1] # open extension #1: the primary HDU
- foo.fits[3] # open extension #3 of a FITS file
- foo.fits[GTI] # open GTI extension of a FITS file)RP(
-The ext argument specifies the name of the FITS extension \201i.e. the
-value of the EXTENSION header parameter in a FITS extension\202, while
-the index specifies the value of the FITS EXTVER header parameter.
-Following FITS conventions, extension numbers start at 1.
-
-)0 P(When a FITS data file is opened for reading using
-)0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D(, the specified extension
-is automatically located and is used to initialize the Funtools internal
-data structures.
-
-)0 2 57 H(Non-FITS)WB 125 Sn()WB 45 Sn( Raw Event Files)EA()EH(
-
-In addition to FITS tables, Funtools programs and libraries can operate
-on non-FITS files containing heterogeneous event records. To specify
-such an event file, use:
-
-)UL()-1 LI( file[EVENTS\201event-spec\202]
-)-1 LI( file[EVENTS\201\202])LU(
-where )BD(event-spec)ES( is a string that specified the names, data
-types, and optional image dimensions for each element of the event
-record:
-)UL()-1 LI( [name]:[n][type]:[\201lodim:\202hidim])LU(
-
-)0 P(Data types follow standard conventions for FITS binary tables, but include
-two extra unsigned types \201'U' and 'V'\202:
-)UL()-1 LI( )BD(B)ES( -- unsigned 8-bit char
-)-1 LI( )BD(I)ES( -- signed 16-bit int
-)-1 LI( )BD(J)ES( -- signed 32-bit int
-)-1 LI( )BD(K)ES( -- signed 64-bit int
-)-1 LI( )BD(E)ES( -- 32-bit float
-)-1 LI( )BD(D)ES( -- 64-bit float
-)-1 LI( )BD(U)ES( -- unsigned 16-bit int
-)-1 LI( )BD(V)ES( -- unsigned 32-bit int)LU(
-An optional integer value )BD(n)ES( can be prefixed to the type to indicate
-that the element is an array of n values. For example:
-) 1 37 PR( foo.fits[EVENTS\201x:I,y:I,status:4J\202])RP(
-defines x and y as 16-bit ints and status as an array of 4 32-bit ints.
-
-)0 P(Furthermore, image dimensions can be attached to the event specification
-in order to tell Funtools how to bin the events into an image. They
-follow the conventions for the FITS TLMIN/TLMAX keywords. If the low
-image dimension is not specified, it defaults to 1. Thus:
-
-)UL()-1 LI( RAWX:J:1:100
-)-1 LI( RAWX:J:100)LU(
-both specify that the dimension of this column runs from 1 to 100.
-
-)0 P(NB: it is required that all padding be specified in the record
-definition. Thus, when writing out whole C structs instead of
-individual record elements, great care must be taken to include
-the compiler-added padding in the event definition.
-
-)0 P(For example, suppose a FITS binary table has the following set of column
-definitions:
-) 22 54 PR( TTYPE1 = 'X ' / Label for field
- TFORM1 = '1I ' / Data type for field
- TLMIN1 = 1 / Min. axis value
- TLMAX1 = 10 / Max. axis value
- TTYPE2 = 'Y ' / Label for field
- TFORM2 = '1I ' / Data type for field
- TLMIN2 = 2 / Min. axis value
- TLMAX2 = 11 / Max. axis value
- TTYPE3 = 'PHA ' / Label for field
- TFORM3 = '1I ' / Data type for field
- TTYPE4 = 'PI ' / Label for field
- TFORM4 = '1J ' / Data type for field
- TTYPE5 = 'TIME ' / Label for field
- TFORM5 = '1D ' / Data type for field
- TTYPE6 = 'DX ' / Label for field
- TFORM6 = '1E ' / Data type for field
- TLMIN6 = 1 / Min. axis value
- TLMAX6 = 10 / Max. axis value
- TTYPE7 = 'DY ' / Label for field
- TFORM7 = '1E ' / Data type for field
- TLMIN7 = 3 / Min. axis value
- TLMAX7 = 12 / Max. axis value)RP(
-
-An raw event file containing these same data would have the event
-specification:
-) 1 61 PR( EVENTS\201X:I:10,Y:I:2:11,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:3:12\202)RP(
-
-)0 P(If no event specification string is included within the EVENTS\201\202 operator,
-then the event specification is taken from the )BD(EVENTS)ES( environment
-variable:
-) 1 65 PR( setenv EVENTS "X:I:10,Y:I:10,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:10")RP(
-
-)0 P(In addition to knowing the data structure, it is necessary to know the
-)EM(endian)ES( ordering of the data, i.e., whether or not the data is
-in )EM(bigendian)ES( format, so that we can convert to the native
-format for this platform. This issue does not arise for FITS Binary
-Tables because all FITS files use big-endian ordering, regardless of
-platform. But for non-FITS data, big-endian data produced on a Sun
-workstation but read on a Linux PC needs to be byte-swapped, since PCs
-use little-endian ordering. To specify an ordering, use the
-)EM(bigendian=)ES( or )EM(endian=)ES( keywords on the command-line
-or the EVENTS_BIGENDIAN or EVENTS_ENDIAN environment variables. The
-value of the )EM(bigendian)ES( variables should be "true" or "false",
-while the value of the )EM(endian)ES( variables should be "little" or
-"big".
-
-)0 P(For example, a PC can access data produced by a Sun using:
-) 7 35 PR( hrc.nepr[EVENTS\201\202,bigendian=true]
-or
- hrc.nepr[EVENTS\201\202,endian=big]
-or
- setenv EVENTS_BIGENDIAN true
-or
- setenv EVENTS_ENDIAN big)RP(
-If none of these are specified, the data are assumed to follow the
-format for that platform and no byte-swapping is performed.
-
-)0 2 58 H(Non-FITS)WB 126 Sn()WB 46 Sn( Array Files)EA()EH(
-
-In addition to FITS images, Funtools programs and libraries can operate
-on non-FITS files containing arrays of homogeneous data. To specify
-an array file, use:
-)UL()-1 LI( file[ARRAY\201array-spec\202]
-)-1 LI( file[ARRAY\201\202])LU(
-
-where array-spec is of the form:
-)UL()-1 LI( [type][dim1][.dim2][:skip][endian])LU(
-
-and where [type] is:
-)UL()-1 LI( b \2018-bit unsigned char\202
-)-1 LI( s \20116-bit short int\202
-)-1 LI( u \20116-bit unsigned short int\202
-)-1 LI( i \20132-bit int\202
-)-1 LI( r,f \20132-bit float\202
-)-1 LI( d \20164-bit float\202)LU(
-
-)0 P(The dim1 specification is required, but dim2 is optional and defaults
-to dim1. The skip specification is optional and defaults to 0. The
-optional endian specification can be 'l' or 'b' and defaults to the
-endian type for the current machine.
-
-)0 P(If no array specification is included within the ARRAY\201\202 operator,
-then the array specification is taken from the )BD(ARRAY)ES( environment
-variable. For example:
-
-) 7 76 PR( foo.arr[ARRAY\201r512\202] # bitpix=-32 dim1=512 dim2=512
- foo.arr[ARRAY\201r512.400\202] # bitpix=-32 dim1=512 dim2=400
- foo.arr[ARRAY\201r512.400]\202 # bitpix=-32 dim1=512 dim2=400
- foo.arr[ARRAY\201r512.400:2880\202] # bitpix=-32 dim1=512 dim2=400 skip=2880
- foo.arr[ARRAY\201r512l\202] # bitpix=-32 dim1=512 dim2=512 endian=little
- setenv ARRAY "r512.400:2880"
- foo.arr[ARRAY\201\202] # bitpix=-32 dim1=512 dim2=400 skip=2880)RP(
-
-)0 2 59 H(Specifying)WB 127 Sn()WB 49 Sn( Image Sections)EA()EH(
-
-Once a data file \201and possibly, a FITS extension\202 has been specified,
-the next \201optional\202 part of a bracket specification can be used to
-select image )BD(section)ES( information, i.e., to specify the x,y
-limits of an image section, as well as the blocking factor to apply to
-that section. This information can be added to any file specification but
-only is used by Funtools image processing routines.
-
-)0 P(The format of the image section specification is one of the following:
-)UL()-1 LI( file[xy0:xy1,block]
-)-1 LI( file[x0:x1,y0:y1,block]
-)-1 LI( file[x0:x1,*,block]
-)-1 LI( file[*,y0:y1,block]
-)-1 LI( file[*,block])LU(
-where the limit values can be ints or "*" for default. A single "*"
-can be used instead of val:val, as shown. Note that blocking is
-applied to the section after it is extracted.
-
-)0 P(In addition to image sections specified by the lo and hi x,y limits, image
-sections using center positions can be specified:
-)UL()-1 LI( file[dim1@xcen,dim2@ycen]
-)-1 LI( file[xdim2@xcen@ycen]
-)-1 LI( file[dim1@xcen,dim2@ycen,block]
-)-1 LI( file[dim@xcen@ycen,block])LU(
-Note that the \201float\202 values for dim, dim1, dim2, xcen, ycen must be
-specified or else the expression does not make sense!
-
-)0 P(In all cases, block is optional and defaults to 1. An 's' or 'a' can
-be appended to signify "sum" or "average" blocking \201default is "sum"\202.
-Section specifications are given in image coordinates by default. If you
-wish to specify physical coordinates, add a 'p' as the last character
-of the section specification, before the closing bracket.
-For example:
-) 2 21 PR()UL()-1 LI( file[-8:-7,-8:-7p]
-)-1 LI( file[-8:-7,-8:-7,2p])LU()RP(
-A section can be specified in any Funtools file name. If the operation
-to be applied to that file is an imaging operation, then the
-specification will be utilized. If the operation is purely a table
-operation, then the section specification is ignored.
-
-)0 P(Do not be confused by:
-) 2 15 PR( foo.fits[2]
- foo.fits[*,2])RP(
-The former specifies opening the second extension of the FITS file.
-The latter specifies application of block 2 to the image section.
-
-)0 P(Note that the section specification must come after
-any of FITS )BD(ext)ES( name or )BD(ind)ES( number,
-but all sensible defaults are supported:
-)UL()-1 LI( file[ext]
-)-1 LI( file[ext,index]
-)-1 LI( file[index]
-)-1 LI( file[ext,section]
-)-1 LI( file[ext,index,section]
-)-1 LI( file[index,section]
-)-1 LI( file[section])LU(
-
-)0 2 60 H(Binning)WB 128 Sn()WB 50 Sn( FITS Binary Tables and Non-FITS Event Files)EH(
-
-If a FITS binary table or a non-FITS raw event file is to be binned
-into a 2D image \201e.g., using the
-)0 10 1 A(funimage)10 0 TN TL()Ec /AF f D(
-program\202, it is necessary to specify the two columns to be used for the
-binning, as well as the dimensions of the image. Funtools first looks
-for a specifier of the form:
-) 1 74 PR( bincols=\201[xnam[:tlmin[:tlmax:[binsiz]]]],[ynam[:tlmin[:tlmax[:binsiz]]]]\202)RP(
-in bracket syntax, and uses the column names thus specified. The tlmin, tlmax,
-and binsiz specifiers determine the image binning dimensions using:
-) 2 56 PR( dim = \201tlmax - tlmin\202/binsiz \201floating point data\202
- dim = \201tlmax - tlmin\202/binsiz + 1 \201integer data\202)RP(
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters are present in the FITS binary
-table header, respectively. If only one parameter is specified, it is
-assumed to be tlmax, and tlmin defaults to 1. If two parameters are
-specified, they are assumed to be tlmin and tlmax.
-
-For example, to bin an HRC event list columns "VPOS" and "UPOS", use:
-) 1 31 PR( hrc.nepr[bincols=\201VPOS,UPOS\202])RP(
-or
-) 1 42 PR( hrc.nepr[bincols=\201VPOS:49152,UPOS:4096\202])RP(
-Note that you can optionally specify the dimensions of these columns
-to cover cases where neither TLMAX keywords are defined in
-the header. If either dimension is specified, then both must be specified.
-
-)0 P(You can set the FITS_BINCOLS or EVENTS_BINCOLS environment variable as
-an alternative to adding the "bincols=" specifier to each file name
-for FITS binary tables and raw event files, respectively. If no
-binning keywords or environment variables are specified, or if the
-specified columns are not in the binary table, the Chandra parameters
-CPREF \201or PREFX\202 are searched for in the FITS binary table header.
-Failing this, columns named "X" and "Y" are sought. If these are not
-found, the code looks for columns containing the characters "X" and
-"Y". Thus, you can bin on "DETX" and "DETX" columns without
-specifying them, if these are the only column names containing the "X"
-and "Y" characters.
-
-)0 P(Ordinarily, each event or row contributes one count to an image pixel
-during the 2D binning process. Thus, if five events all have the same
-\201x,y\202 position, the image pixel value for that position will have a
-value of five. It is possible to specify a variable contribution
-for each event by using the vcol=[colname] filter spec:
-) 1 15 PR( vcol=[colname])RP(
-The vcol colname is a column containing a numeric value in each event row
-that will be used as the contribution of the given event to its image
-pixel. For example, consider an event file that has the following content:
-) 10 24 PR( x:e:4 y:e:4 v:e
- ------ ------ ----
- 1 1 1.0
- 2 2 2.0
- 3 3 3.0
- 4 4 0.0
- 1 1 1.0
- 2 2 2.0
- 3 3 3.0
- 4 4 4.0)RP(
-There are two events with x,y value of \2011,1\202 so ordinarily a 2D image will
-have a value of 2 in the \2011,1\202 pixel. If the v column is specified as the
-value column:
-) 1 20 PR( foo.fits'[vcol=v]')RP(
-then each pixel will contain the additive sum of the associated \201x,y\202
-column values from the v column. For example, image pixel \2011,1\202 will
-contain 1. + 1. = 2, image pixel \2012,2\202 will contain \2012 + 2\202 = 4, etc.
-
-)0 P(An important variation on the use of a value column to specify the
-contribution an event makes to an image pixel is when the value column
-contains the reciprocal of the event contribution. For this case, the
-column name should be prefixed with a / \201divide sign\202 thus:
-) 1 21 PR( foo.fits'[vcol=/v]')RP(
-Each image pixel value will then be the sum of the reciprocals of the value
-column. A zero in the value column results in NaN \201not a number\202.
-Thus, in the above example, image pixel \2011.1\202 will contain 1/1 + 1/1 = 2,
-image pixel \2012,2\202 will contain \2011/2 + 1/2\202 = 1, etc. Image pixel \2014,4\202
-will contain \2011/0 + 1/4\202 = NaN.
-
-)0 P(You can set the FITS_VCOL or EVENTS_VCOL environment variable as
-an alternative to adding the "vcol=" specifier to each file name
-for FITS binary tables and raw event files, respectively.
-
-)0 P(Finally, when binning events, the data type of the resulting 2D image
-must be specified. This can be done with the "bitpix=[n]" keyword in
-the bracket specification. For example:
-) 1 45 PR( events.fits[bincols=\201VPOS,UPOS\202,bitpix=-32])RP(
-will create a floating point image binned on columns VPOS and UPOS.
-If no bitpix keyword is specified, bitpix=32 is assumed. As with
-bincols values, you also can use the FITS_BITPIX and EVENTS_BITPIX
-environment variables to set this value for FITS binary tables and
-raw event files, respectively.
-
-)0 P(The )BD(funimage)ES( program also allows you to create a 1D image projection
-along any column of a table by using the )BD(bincols=[column])ES(
-filter specification and specifying a single column.
-For example, the following command projects a 1D image along
-the chipx column of a table:
-) 1 43 PR( funimage ev.fits'[bincols=chipx]' im.fits)RP(
-See )0 10 1 A(funimage)10 0 TN TL()Ec /AF f D( for more
-information about creating 1D and 2D images.
-
-)0 P(Finally, please note that Funtools supports most FITS standards.
-We will add missing support as required by the community. In general,
-however, we do not support non-standard extensions. For example, we
-sense the presence of the binary table 'variable length array'
-proposed extension and we pass it along when copying and filtering
-files, but we do not process it. We will add support for new standards
-as they become official.
-
-)0 2 61 H(Table)WB 129 Sn()WB 119 Sn( and Spatial Region Filters)EH(
-)0 P(Note that, in addition extensions and image sections, Funtools bracket
-notation can be used to specify table and spatial region filters. These
-filters are always placed after the image section information. They
-can be specified in the same bracket or in a separate bracket
-immediately following:
-)UL()-1 LI( file[ext|ind|ARRAY\201\202|EVENTS\201\202,section][filters]
-)-1 LI( file[ext|ind|ARRAY\201\202|EVENTS\201\202,section,filters])LU(
-where:
-)UL()-1 LI( )BD(file)ES( is the Funtools file name
-)-1 LI( )BD(ARRAY\201\202)ES( is an array specification
-)-1 LI( )BD(EVENTS\201\202)ES( is an event list specification
-)-1 LI( )BD(ext)ES( is the FITS extension name
-)-1 LI( )BD(ind)ES( is the FITS extension number
-)-1 LI( )BD(section)ES( is the image section to extract
-)-1 LI( )BD(filters)ES( are spatial region and table \201row\202 filters to apply)LU(
-
-The topics of table and region filtering are covered in detail in:
-)UL()-1 LI()0 52 1 A(Table Filtering)52 0 TN TL()Ec /AF f D(
-)-1 LI()0 54 1 A(Spatial Region Filtering)54 0 TN TL()Ec /AF f D()LU(
-
-)0 2 62 H(Disk)WB 130 Sn()WB 51 Sn( Files and Other Supported File Types)EA()EH(
-)0 P(The specified )BD(file)ES( usually is an ordinary disk file. In
-addition, gzip'ed files are supported in Funtools: gzip'ed input files
-are automatically uncompressed as they are read, and gzip'ed output
-files are compressed as they are written. NB: if a FITS binary table
-is written in gzip format, the number of rows in the table will be set
-to -1. Such a file will work with Funtools programs but will not work
-with other FITS programs such as ds9.
-
-)0 P(The special keywords "stdin" and "stdout" designate Unix standard
-input and standard output, respectively. The string "-" \201hyphen\202 will
-be taken to mean "stdin" if the file is opened for reading and
-"stdout" if the file is opened for writing.
-
-)0 P(A file also can be an INET socket on the same or another machine using
-the syntax:
-) 1 14 PR( machine:port)RP(
-Thus, for example:
-) 1 14 PR( karapet:1428)RP(
-specifies that I/O should be performed to/from port 1428 on the
-machine karapet. If no machine name is specified, the default is to
-use the current machine:
-) 1 7 PR( :1428)RP(
-This means to open port 1428 on the current machine. Socket support
-allows you to generate a distributed pipe:
-) 2 48 PR( on karapet: funtask1 in.fits bynars:1428
- on bynars: funtask2 :1428 out.fits)RP(
-The socket mechanism thus supports simple parallel processing using
-)BD(process decomposition)ES(. Note that parallel processing using
-)BD(data decomposition)ES( is supported via the )BD(section)ES( specifier \201see
-below\202, and the )BD(row#)ES( specifier, which is part of
-)0 52 1 A(Table Filtering)52 0 TN TL()Ec /AF f D(.
-
-)0 P(A file also can be a pointer to shared memory using the syntax:
-) 1 22 PR( shm:[id|@key][:size])RP(
-A shared memory segment is specified with a )BD(shm:)ES( prefix,
-followed by either the shared memory id or the shared memory key
-\201where the latter is prefixed by the '@' character\202. The size \201in
-bytes\202 of the shared memory segment can then be appended \201preceded by
-the ':' character\202. If the size specification is absent, the code will
-attempt to determine the length automatically.
-
-If the open mode contains the string "w+", then the memory segment will be
-created if it does not exist. \201It also will be released and deleted when the
-file is closed.\202 In the case where a memory segment is being created, the
-length of the segment is required.
-
-)0 P(A file also can be Unix piped command \201i.e. a program to run\202 using the syntax:
-) 1 31 PR( "pipe: command arg1 ... argn")RP(
-The output from the command must be a valid FITS file. It is important
-to use quotes to protect spaces so that command arguments are passed
-correctly. A silly example is:
-) 1 60 PR( fundisp "pipe: funtable 'foo.fits[cir 512 512 .1]' stdout")RP(
-This seemed like a good idea at the time ...
-
-)0 2 63 H(Lists)WB 131 Sn()WB 51 Sn( of Files)EA()EH(
-
-)0 P(Funtools also will process a list of files as a single file using the
-syntax:
-) 1 31 PR( "list: file1 file2 ... filen")RP(
-The files in the list are separated by whitespace. Any of the
-above file types can be used. For example, if two files, foo1.fits and
-foo2.fits, are part of the same observation, they can be processed as
-a single file \201using their own filters\202:
-) 17 77 PR( fundisp "list: foo1.fits[cir\201512,512,10\202] foo2.fits[cir\201511,511,10\202]"
- X Y PHA PI TIME DX DY
- -------- -------- -------- -------- --------------------- -------- --------
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
- 511 511 5 5 79488631.09462625 580 575
- 511 511 10 11 79488780.60006675 580 573
- 511 511 4 4 79494562.35474326 580 575
- 511 511 6 6 79488203.01561825 580 575
- 511 511 6 6 79488017.99730176 580 575
- 511 511 4 4 79494332.45355175 580 575
- 511 511 9 10 79492685.94014275 581 574
- 511 511 5 5 79487708.71298325 580 575
- 511 511 8 9 79493719.00160225 581 573)RP(
-Again, note that it is important to avoid spaces in the filters
-because the list separator also is whitespace. To protect whitespace
-in a filter, enclose the file specification in quotes:
-) 1 72 PR( fundisp "list: 'foo1.fits[cir 512 512 .1]' foo2.fits[cir\201511,511,.1\202]")RP(
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 64 H(Last)WB 132 Sn( updated: February 15, 2006)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (text.html) D
-/Ti (Column-based Text Files) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 47 Sn(
-
-
-)0 2 65 H(Funtext:)WB 134 Sn()WB 133 Sn( Support for Column-based Text Files)EA()EH(
-
-
-)0 2 66 H(Summary)WB 135 Sn()EH(
-)0 P(This document contains a summary of the options for processing column-based
-text files.
-
-
-)0 2 67 H(Description)WB 136 Sn()EH(
-
-)0 P(Funtools will automatically sense and process "standard"
-column-based text files as if they were FITS binary tables without any
-change in Funtools syntax. In particular, you can filter text files
-using the same syntax as FITS binary tables:
-) 3 54 PR( fundisp foo.txt'[cir 512 512 .1]'
- fundisp -T foo.txt > foo.rdb
- funtable foo.txt'[pha=1:10,cir 512 512 10]' foo.fits)RP(
-
-)0 P(The first example displays a filtered selection of a text file. The
-second example converts a text file to an RDB file. The third example
-converts a filtered selection of a text file to a FITS binary table.
-
-)0 P(Text files can also be used in Funtools image programs. In this case,
-you must provide binning parameters \201as with raw event files\202, using
-the bincols keyword specifier:
-
-) 1 75 PR( bincols=\201[xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]])RP(
-
-For example:
-) 1 64 PR( funcnts foo'[bincols=\201x:1024,y:1024\202]' "ann 512 512 0 10 n=10")RP(
-
-)0 2 68 H(Standard)WB 137 Sn( Text Files)EH(
-
-)0 P(Standard text files have the following characteristics:
-
-)UL()-1 LI( Optional comment lines start with #
-)-1 LI( Optional blank lines are considered comments
-)-1 LI( An optional table header consists of the following \201in order\202:
-)UL( )-1 LI( a single line of alpha-numeric column names
- )-1 LI( an optional line of unit strings containing the same number of cols
- )-1 LI( an optional line of dashes containing the same number of cols)LU(
-)-1 LI( Data lines follow the optional header and \201for the present\202 consist of
- the same number of columns as the header.
-)-1 LI( Standard delimiters such as space, tab, comma, semi-colon, and bar.)LU(
-
-)0 P(Examples:
-
-) 26 46 PR( # rdb file
- foo1 foo2 foo3 foos
- ---- ---- ---- ----
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
- # multiple consecutive whitespace and dashes
- foo1 foo2 foo3 foos
- --- ---- ---- ----
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
- # comma delims and blank lines
- foo1,foo2,foo3,foos
-
- 1,2.2,3,xxxx
- 10,20.2,30,yyyy
-
- # bar delims with null values
- foo1|foo2|foo3|foos
- 1||3|xxxx
- 10|20.2||yyyy
-
- # header-less data
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy)RP(
-
-)0 P(The default set of token delimiters consists of spaces, tabs, commas,
-semi-colons, and vertical bars. Several parsers are used
-simultaneously to analyze a line of text in different ways. One way
-of analyzing a line is to allow a combination of spaces, tabs, and
-commas to be squashed into a single delimiter \201no null values between
-consecutive delimiters\202. Another way is to allow tab, semi-colon, and
-vertical bar delimiters to support null values, i.e. two consecutive
-delimiters implies a null value \201e.g. RDB file\202. A successful parser
-is one which returns a consistent number of columns for all rows, with
-each column having a consistent data type. More than one parser can
-be successful. For now, it is assumed that successful parsers all
-return the same tokens for a given line. \201Theoretically, there are
-pathological cases, which will be taken care of as needed\202. Bad parsers
-are discarded on the fly.
-
-)0 P(If the header does not exist, then names "col1", "col2", etc. are
-assigned to the columns to allow filtering. Furthermore, data types
-for each column are determined by the data types found in the columns
-of the first data line, and can be one of the following: string, int,
-and double. Thus, all of the above examples return the following
-display:
-) 4 58 PR( fundisp foo'[foo1>5]'
- FOO1 FOO2 FOO3 FOOS
- ---------- --------------------- ---------- ------------
- 10 20.20000000 30 yyyy)RP(
-
-)0 2 69 H(Comments)WB 138 Sn( Convert to Header Params)EH(
-
-)0 P(Comments which precede data rows are converted into header parameters and
-will be written out as such using funimage or funhead. Two styles of comments
-are recognized:
-
-)0 P(1. FITS-style comments have an equal sign "=" between the keyword and
-value and an optional slash "/" to signify a comment. The strict FITS
-rules on column positions are not enforced. In addition, strings only
-need to be quoted if they contain whitespace. For example, the following
-are valid FITS-style comments:
-
-) 5 55 PR( # fits0 = 100
- # fits1 = /usr/local/bin
- # fits2 = "/usr/local/bin /opt/local/bin"
- # fits3c = /usr/local/bin /opt/local/bin /usr/bin
- # fits4c = "/usr/local/bin /opt/local/bin" / path dir)RP(
-
-Note that the fits3c comment is not quoted and therefore its value is the
-single token "/usr/local/bin" and the comment is "opt/local/bin /usr/bin".
-This is different from the quoted comment in fits4c.
-
-)0 P(2. Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed. If a string
-is quoted, then slash "/" after the string will signify a comment.
-For example:
-
-) 9 54 PR( # com1 /usr/local/bin
- # com2 "/usr/local/bin /opt/local/bin"
- # com3 /usr/local/bin /opt/local/bin /usr/bin
- # com4c "/usr/local/bin /opt/local/bin" / path dir
-
- # com11: /usr/local/bin
- # com12: "/usr/local/bin /opt/local/bin"
- # com13: /usr/local/bin /opt/local/bin /usr/bin
- # com14c: "/usr/local/bin /opt/local/bin" / path dir)RP(
-
-)0 P(Note that com3 and com13 are not quoted, so the whole string is part of
-the value, while comz4c and com14c are quoted and have comments following
-the values.
-
-)0 P(Some text files have column name and data type information in the header.
-You can specify the format of column information contained in the
-header using the "hcolfmt=" specification. See below for a detailed
-description.
-
-)0 2 70 H(Multiple)WB 139 Sn( Tables in a Single File)EH(
-
-)0 P(
-Multiple tables are supported in a single file. If an RDB-style file
-is sensed, then a ^L \201vertical tab\202 will signify end of
-table. Otherwise, an end of table is sensed when a new header \201i.e.,
-all alphanumeric columns\202 is found. \201Note that this heuristic does not
-work for single column tables where the column type is ASCII and the
-table that follows also has only one column.\202 You also can specify
-characters that signal an end of table condition using the )BD(eot=)ES(
-keyword. See below for details.
-
-)0 P(You can access the nth table \201starting from 1\202 in a multi-table file
-by enclosing the table number in brackets, as with a FITS extension:
-
-) 1 18 PR( fundisp foo'[2]')RP(
-The above example will display the second table in the file.
-\201Index values start at 1 in oder to maintain logical compatibility
-with FITS files, where extension numbers also start at 1\202.
-
-
-)0 2 71 H(TEXT\201\202)WB 140 Sn( Specifier)EH(
-
-)0 P(As with ARRAY\201\202 and EVENTS\201\202 specifiers for raw image arrays and raw
-event lists respectively, you can use TEXT\201\202 on text files to pass
-key=value options to the parsers. An empty set of keywords is
-equivalent to not having TEXT\201\202 at all, that is:
-
-) 2 23 PR( fundisp foo
- fundisp foo'[TEXT\201\202]')RP(
-
-are equivalent. A multi-table index number is placed before the TEXT\201\202
-specifier as the first token, when indexing into a multi-table:
-
- fundisp foo'[2,TEXT\201...\202]'
-
-)0 P(The filter specification is placed after the TEXT\201\202 specifier, separated
-by a comma, or in an entirely separate bracket:
-
-) 2 47 PR( fundisp foo'[TEXT\201...\202,circle 512 512 .1]'
- fundisp foo'[2,TEXT\201...\202][circle 512 512 .1]')RP(
-
-)0 2 72 H(Text\201\202)WB 141 Sn( Keyword Options)EH(
-
-)0 P(
-The following is a list of keywords that can be used within the TEXT\201\202
-specifier \201the first three are the most important\202:
-
-)0 DL(
-)0 P()0 DT( delims="[delims]"
-)DD(Specify token delimiters for this file. Only a single parser having these
-delimiters will be used to process the file.
-) 2 40 PR( fundisp foo.fits'[TEXT\201delims="!"\202]'
- fundisp foo.fits'[TEXT\201delims="\200t%"\202]')RP(
-
-)0 P()0 DT( comchars="[comchars]"
-)DD( Specify comment characters. You must include "\200n" to allow blank lines.
-These comment characters will be used for all standard parsers \201unless delims
-are also specified\202.
-) 1 42 PR( fundisp foo.fits'[TEXT\201comchars="!\200n"\202]')RP(
-
-)0 P()0 DT( cols="[name1:type1 ...]"
-)DD( Specify names and data type of columns. This overrides header
-names and/or data types in the first data row or default names and
-data types for header-less tables.
-) 1 70 PR( fundisp foo.fits'[TEXT\201cols="x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e"\202]')RP(
-)0 P(If the column specifier is the only keyword, then the cols= is not
-required \201in analogy with EVENTS\201\202\202:
-) 1 63 PR( fundisp foo.fits'[TEXT\201x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e\202]')RP(
-Of course, an index is allowed in this case:
-) 1 65 PR( fundisp foo.fits'[2,TEXT\201x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e\202]')RP(
-
-)0 P()0 DT( eot="[eot delim]"
-)DD( Specify end of table string specifier for multi-table files. RDB
-files support ^L. The end of table specifier is a string and the whole
-string must be found alone on a line to signify EOT. For example:
-) 1 37 PR( fundisp foo.fits'[TEXT\201eot="END"\202]')RP(
-will end the table when a line contains "END" is found. Multiple lines
-are supported, so that:
-) 1 43 PR( fundisp foo.fits'[TEXT\201eot="END\200nGAME"\202]')RP(
-will end the table when a line contains "END" followed by a line
-containing "GAME".
-)0 P(In the absence of an EOT delimiter, a new table will be sensed when a new
-header \201all alphanumeric columns\202 is found.
-
-)0 P()0 DT( null1="[datatype]"
-)DD( Specify data type of a single null value in row 1.
-Since column data types are determined by the first row, a null value
-in that row will result in an error and a request to specify names and
-data types using cols=. If you only have a one null in row 1, you don't
-need to specify all names and columns. Instead, use null1="type" to
-specify its data type.
-
-)0 P()0 DT( alen=[n]
-)DD(Specify size in bytes for ASCII type columns.
-FITS binary tables only support fixed length ASCII columns, so a
-size value must be specified. The default is 16 bytes.
-
-)0 P()0 DT( nullvalues=["true"|"false"]
-)DD(Specify whether to expect null values.
-Give the parsers a hint as to whether null values should be allowed. The
-default is to try to determine this from the data.
-
-)0 P()0 DT( whitespace=["true"|"false"]
-)DD( Specify whether surrounding white space should be kept as part of
-string tokens. By default surrounding white space is removed from
-tokens.
-
-)0 P()0 DT( header=["true"|"false"]
-)DD(Specify whether to require a header. This is needed by tables
-containing all string columns \201and with no row containing dashes\202, in
-order to be able to tell whether the first row is a header or part of
-the data. The default is false, meaning that the first row will be
-data. If a row dashes are present, the previous row is considered the
-column name row.
-
-)0 P()0 DT( units=["true"|"false"]
-)DD(Specify whether to require a units line.
-Give the parsers a hint as to whether a row specifying units should be
-allowed. The default is to try to determine this from the data.
-
-)0 P()0 DT( i2f=["true"|"false"]
-)DD(Specify whether to allow int to float conversions.
-If a column in row 1 contains an integer value, the data type for that
-column will be set to int. If a subsequent row contains a float in
-that same column, an error will be signaled. This flag specifies that,
-instead of an error, the float should be silently truncated to
-int. Usually, you will want an error to be signaled, so that you can
-specify the data type using cols= \201or by changing the value of
-the column in row 1\202.
-
-)0 P()0 DT( comeot=["true"|"false"|0|1|2]
-)DD(Specify whether comment signifies end of table.
-If comeot is 0 or false, then comments do not signify end of table and
-can be interspersed with data rows. If the value is true or 1 \201the
-default for standard parsers\202, then non-blank lines \201e.g. lines
-beginning with '#'\202 signify end of table but blanks are allowed
-between rows. If the value is 2, then all comments, including blank
-lines, signify end of table.
-
-)0 P()0 DT( lazyeot=["true"|"false"]
-)DD(Specify whether "lazy" end of table should be permitted \201default is
-true for standard formats, except rdb format where explicit ^L is required
-between tables\202. A lazy EOT can occur when a new table starts directly
-after an old one, with no special EOT delimiter. A check for this EOT
-condition is begun when a given row contains all string tokens. If, in
-addition, there is a mismatch between the number of tokens in the
-previous row and this row, or a mismatch between the number of string
-tokens in the prev row and this row, a new table is assumed to have
-been started. For example:
-) 9 20 PR( ival1 sval3
- ----- -----
- 1 two
- 3 four
-
- jval1 jval2 tval3
- ----- ----- ------
- 10 20 thirty
- 40 50 sixty)RP(
-Here the line "jval1 ..." contains all string tokens. In addition,
-the number of tokens in this line \2013\202 differs from the number of
-tokens in the previous line \2012\202. Therefore a new table is assumed
-to have started. Similarly:
-) 9 20 PR( ival1 ival2 sval3
- ----- ----- -----
- 1 2 three
- 4 5 six
-
- jval1 jval2 tval3
- ----- ----- ------
- 10 20 thirty
- 40 50 sixty)RP(
-Again, the line "jval1 ..." contains all string tokens. The number of
-string tokens in the previous row \2011\202 differs from the number of
-tokens in the current row\2013\202. We therefore assume a new table as been
-started. This lazy EOT test is not performed if lazyeot is explicitly
-set to false.
-
-)0 P()0 DT( hcolfmt=[header column format]
-)DD( Some text files have column name and data type information in the header.
-For example, VizieR catalogs have headers containing both column names
-and data types:
-) 3 95 PR( #Column e_Kmag \201F6.3\202 ?\201k_msigcom\202 K total magnitude uncertainty \2014\202 [ucd=ERROR]
- #Column Rflg \201A3\202 \201rd_flg\202 Source of JHK default mag \2016\202 [ucd=REFER_CODE]
- #Column Xflg \201I1\202 [0,2] \201gal_contam\202 Extended source contamination \20110\202 [ucd=CODE_MISC])RP(
-
-while Sextractor files have headers containing column names alone:
-
-) 4 79 PR( # 1 X_IMAGE Object position along x [pixel]
- # 2 Y_IMAGE Object position along y [pixel]
- # 3 ALPHA_J2000 Right ascension of barycenter \201J2000\202 [deg]
- # 4 DELTA_J2000 Declination of barycenter \201J2000\202 [deg])RP(
-The hcolfmt specification allows you to describe which header lines
-contain column name and data type information. It consists of a string
-defining the format of the column line, using "$col" \201or "$name"\202 to
-specify placement of the column name, "$fmt" to specify placement of the
-data format, and "$skip" to specify tokens to ignore. You also can
-specify tokens explicitly \201or, for those users familiar with how
-sscanf works, you can specify scanf skip specifiers using "%*"\202.
-For example, the VizieR hcolfmt above might be specified in several ways:
-) 3 67 PR( Column $col \201$fmt\202 # explicit specification of "Column" string
- $skip $col \201$fmt\202 # skip one token
- %*s $col \201$fmt\202 # skip one string \201using scanf format\202)RP(
-while the Sextractor format might be specified using:
-) 2 59 PR( $skip $col # skip one token
- %*d $col # skip one int \201using scanf format\202)RP(
-You must ensure that the hcolfmt statement only senses actual column
-definitions, with no false positives or negatives. For example, the
-first Sextractor specification, "$skip $col", will consider any header
-line containing two tokens to be a column name specifier, while the
-second one, "%*d $col", requires an integer to be the first token. In
-general, it is preferable to specify formats as explicitly as
-possible.
-
-)0 P(Note that the VizieR-style header info is sensed automatically by the
-funtools standard VizieR-like parser, using the hcolfmt "Column $col
-\201$fmt\202". There is no need for explicit use of hcolfmt in this case.
-
-)0 P()0 DT( debug=["true"|"false"]
-)DD(Display debugging information during parsing.
-)LD(
-
-)0 2 73 H(Environment)WB 142 Sn( Variables)EH(
-
-)0 P(
-Environment variables are defined to allow many of these TEXT\201\202 values to be
-set without having to include them in TEXT\201\202 every time a file is processed:
-
-) 10 36 PR( keyword environment variable
- ------- --------------------
- delims TEXT_DELIMS
- comchars TEXT_COMCHARS
- cols TEXT_COLUMNS
- eot TEXT_EOT
- null1 TEXT_NULL1
- alen TEXT_ALEN
- bincols TEXT_BINCOLS
- hcolfmt TEXT_HCOLFMT)RP(
-
-)0 2 74 H(Restrictions)WB 143 Sn( and Problems)EH(
-
-)0 P(
-As with raw event files, the '+' \201copy extensions\202 specifier is not
-supported for programs such as funtable.
-
-)0 P(String to int and int to string data conversions are allowed by the
-text parsers. This is done more by force of circumstance than by
-conviction: these transitions often happens with VizieR catalogs,
-which we want to support fully. One consequence of allowing these
-transitions is that the text parsers can get confused by columns which
-contain a valid integer in the first row and then switch to a
-string. Consider the following table:
-) 4 20 PR( xxx yyy zzz
- ---- ---- ----
- 111 aaa bbb
- ccc 222 ddd)RP(
-The xxx column has an integer value in row one a string in row two,
-while the yyy column has the reverse. The parser will erroneously
-treat the first column as having data type int:
-) 5 38 PR( fundisp foo.tab
- XXX YYY ZZZ
- ---------- ------------ ------------
- 111 'aaa' 'bbb'
- 1667457792 '222' 'ddd')RP(
-while the second column is processed correctly. This situation can be avoided
-in any number of ways, all of which force the data type of the first column
-to be a string. For example, you can edit the file and explicitly quote the
-first row of the column:
-) 10 40 PR( xxx yyy zzz
- ---- ---- ----
- "111" aaa bbb
- ccc 222 ddd
-
- [sh] fundisp foo.tab
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd')RP(
-You can edit the file and explicitly set the data type of the first column:
-) 10 40 PR( xxx:3A yyy zzz
- ------ ---- ----
- 111 aaa bbb
- ccc 222 ddd
-
- [sh] fundisp foo.tab
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd')RP(
-You also can explicitly set the column names and data types of all columns,
-without editing the file:
-) 5 52 PR( [sh] fundisp foo.tab'[TEXT\201xxx:3A,yyy:3A,zzz:3a\202]'
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd')RP(
-The issue of data type transitions \201which to allow and which to disallow\202
-is still under discussion.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 75 H(Last)WB 144 Sn( updated: August 3, 2007)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (view.html) D
-/Ti (Database View Support for Tables) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 48 Sn(
-
-
-)0 2 76 H(Funview:)WB 146 Sn()WB 145 Sn( Database View Support for Tables)EA()EH(
-
-
-)0 2 77 H(Summary)WB 147 Sn()EH(
-)0 P(This document contains a summary of the options for utilizing
-database-inspired Views of tables.
-
-
-)0 2 78 H(Description)WB 148 Sn()EH(
-
-)0 2 79 H(Database)WB 149 Sn( Views)EH(
-)0 P(In database parlance, a )BD(View)ES( defines a "virtual table", i.e.,
-a description of row and/or column selection filters \201but with no
-permanent storage space allocated\202. When used in place of a table, a
-View selects the specified rows and/or columns from one or more real
-tables. Views enable you to see complicated data tables in a more
-convenient format. They also can be used as a security mechanism, by
-restricting user access to specific columns and/or rows. [See:
-) 1 72 PR(http://www.cs.unibo.it/~ciaccia/COURSES/RESOURCES/SQLTutorial/sqlch5.htm)RP(
-for a good discussion of SQL Views.]
-
-)0 P(Funtools supports an expanded notion of Views for all tabular data
-\201FITS tables, raw binary tables, and ASCII column files\202. Funtools
-Views allow you to pre-set values for the filter specification, the
-columns to activate, and display format \201though the latter is for
-fundisp only\202. Setting the filter and column activation values
-provides functionality equivalent to that of a classical database
-View, while the ability to set the format is similar to classical
-report writing capabilities.
-
-)0 2 80 H(Funtools)WB 150 Sn( View Attributes)EH(
-)0 P(A Funtools View is a text file containing one or more of the following
-columns:
-) 7 46 PR( column description
- ------ -----------------------------
- view name of view
- file data file name or template
- filter filter specification
- columns columns to activate
- format fundisp format specification)RP(
-All of the attribute columns are optional, including
-the )BD(view)ES( name itself. This means that a View can be named or
-unnamed. Unnamed Views can refer to a specific file or a template of
-files \201obviously if neither the view or the file column is specified,
-the input View specification will never be used\202. You can specify any
-combination of filter, column, and format parameters. \201It also is
-possible to apply file-specific View to other files; see the discussion
-on )BD(View Lists)ES( below\202. Each column has a size limit of 1024 characters.
-
-)0 P(For example, consider the following View file:
-) 13 70 PR( view file format columns filter
- ---- ---------------------- ------ ------------ -------
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
- x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
- x1 ${HOME}/data/snr.ev cir 512 512 .1
- x1a ${HOME}/data/snr.ev x y pi pha
- x0 ${HOME}/data/snr.ev
- xf I=%4d
- xc x y pi pha
- xr cir 512 512 .1
- *.ev x y pi pha
- *.fit x y dx dy cir 400 400 3
- *.fits I=%3d x y dx dy cir 400 400 3)RP(
-This database example is in rdb format, i.e. using tab delimiters and
-permitting null values. Any valid ASCII table format is acceptable,
-but if you use a format that does not permit null values, it will be
-necessary to quote the null strings.
-
-)0 P(The first five entries \201x3, x2, x1, x1a, x0\202 are named entries defining
-default values specifically for the snr.ev data file. Typically, you
-would use these Views by specifying View name, and the corresponding
-file, filter, column, and format values would be used. Note that the x0
-View is essentially an alias for the pathname of this file.
-
-)0 P(The next three entries define defaults that can be applied to any
-file. You typically would use these View names in conjunction with
-a specific file name \201see )BD(View Lists)ES( below\202 so that the associated
-parameter\201s\202 were applied to that file.
-
-)0 P(The last three entry in the database define unnamed Views that
-pertains to all files ending with the specified templates. In these
-cases, any View that specifies a file name matching the file template
-would be processed with the associated parameter attributes.
-
-)0 2 81 H(Invoking)WB 151 Sn( a Funtools View \201in Place of an Input File\202)EH(
-)0 P(To use a Funtools View, you simply pre-pend the "v:" prefix to a View name or
-a file name where an input file name usually is specified. For example:
-) 1 14 PR( fundisp v:x3)RP(
-specifies that the View named x3 \201with its file name and associated
-parameters\202 is processed as the input file to fundisp. Using the
-example database, above, this is equivalent to:
-) 1 73 PR( fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha")RP(
-That is, the format is used with fundisp's -f \201format\202 switch, while the
-filename and extension are composed of the x3 View's filename and
-region filter.
-
-)0 P(Similarly, executing a command such as:
-) 1 19 PR( fundisp v:foo.fit)RP(
-will match the unnamed View associated with the template "*.fit".
-This is equivalent to executing:
-) 1 46 PR( fundisp foo.fit'[cir 400 400 3]' "x y dx dy")RP(
-Of course, if you omit the "v:" prefix, then no View processing takes place:
-) 2 66 PR( fundisp foo.fit # process foo.fit without any View parameters
- fundisp x3 # error \201assuming there is no file named x3\202)RP(
-
-)0 2 82 H(Basic)WB 152 Sn( View Matching Rules)EH(
-
-)0 P(When a "v:" prefix is recognized, Funtools searches for a View database
-file in the following order:
-) 5 59 PR( location description
- ------------ ------------------------------------
- FUN_VIEWFILE environment variable \201any file name\202
- ./.funtools.vu hidden file, default name
- $HOME/.funtools.vu hidden file, default name)RP(
-The first View database file located is used to construct a new
-filename, as well as an activation column specification and a format
-specification. The following rules are used:
-
-)0 P(1. An attempt is made to match the input name \201i.e., the part of the
-input View after the "v:" prefix\202 against the )BD(view)ES( column value
-\201if present\202 of each row in the database. If a match is found, the
-values of all non-blank columns are saved for later use. Also note
-that the first match terminates the search: i.e., )BD(the order of the
-database rows matters)ES(.
-
-)0 P(2. If no )BD(view)ES( match is made, an attempt is made to match the input
-name against the )BD(file)ES( column value \201if present\202. Matching is
-performed on the full pathname of both the input name and the
-database file name, and on the non-directory \201root\202 part of these
-files. This means that the root specification:
-) 1 18 PR( fundisp v:snr.ev)RP(
-will match a row in the database that has a full pathname in the file,
-allowing you to use a )BD(file)ES(-matched View without having to
-specify the full pathname. In this example, the "v:snr.ev" View
-specification will match the first row \201v:x3\202 in the database:
-) 1 67 PR( x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1)RP(
-even though the row contains a fully qualified pathname as the file
-value. Once again, values of all non-blank columns are saved, and the
-first match terminates the search.
-
-)0 P(3. If neither a )BD(view)ES( or a )BD(view)ES( match has been found,
-then a simple template match is attempted against the )BD(view)ES(
-values. Template matching supports a simplified version of file
-globbing \201not a regular expression\202, with support for a single "*"
-\201all characters\202, "?" \201single character\202, or "[...]" \201range\202 specification.
-
-)0 P(4. If no template match was found on the )BD(view)ES( column, then a
-simple template match is attempted against the )BD(file)ES( columns.
-
-)0 P(5. If no match is found, then the filename \201minus the "v:" prefix\202 is
-returned.
-
-)0 2 83 H(More)WB 153 Sn( on View Matching Rules: Single vs. Multiple Matches )EH(
-
-The matching rules described above stop after the first match,
-regardless of whether that match provides values for all three
-parameters \201filter, columns, and format\202. In cases where a )BD(view)ES(
-or )BD(file)ES( match does not provide all three values, it is possible
-that a template match might do so. With regard to the example View
-database above, the x1 View provides only a filter, while omitting
-both the format and columns values. But note that the final rows in
-the database could provide the values via a template match on the
-filename. This sort of multiple matching is especially valuable in
-order to provide "global" values to several Views.
-
-)0 P(Obviously, multiple matching might not be wanted in every
-case. Therefore, we support both multiple matching and single matching
-according to the value of the FUN_VIEWMATCH environment variable. If
-the FUN_VIEWMATCH environment variable exists and if its value begins
-with "s", then a single match is used and missing parameters are not
-filled in with subsequent template matches on the file name. That is,
-matching rules above are followed exactly as explained above. If the
-value of this environment variable begins with "m" \201or does not exist\202,
-then multiple matches are used to try to fill in missing parameters.
-In this case, template matching always takes place and missing values are
-taken from these template matches.
-
-)0 P(Thus, in the example above, the View specification:
-) 1 14 PR( fundisp v:x1)RP(
-will take the file name and filter value from the x1 View:
-) 1 70 PR( x1 ${HOME}/data/snr.ev cir 512 512 .1)RP(
-The column value then will be taken from the "*.ev" file template match
-against the x1 file name:
-) 1 52 PR( *.ev x y pi pha)RP(
-Note once again that order is important: missing values are taken in the
-order in which the template matches are processed.
-
-)0 2 84 H(View)WB 154 Sn( Lists: Applying a View to Any File)EH(
-
-)0 P(It is possible to apply a named View, or even several Views, to any
-data file by appending a )BD(viewlist)ES( immediately after the standard "v:"
-prefix. A viewlist takes the form:
-) 1 15 PR( :v1,v2,...vn:)RP(
-where v1, v2, etc. are named Views. The two ":" colon characters surrounding
-the list are required. Thus, the syntax for applying a viewlist to a file is:
-) 1 34 PR( v::view1,view2,...viewn:filename)RP(
-Note that the name after the last ":" is assumed to be a file; it is
-not permissible \201or sensible\202 to use a View name.
-
-)0 P(For example, the View specification:
-) 1 19 PR( fundisp v::x2:foo)RP(
-applies the x2 View to the file foo \201even if there is a View named foo\202
-and \201in using our example database\202 is equivalent to:
-) 1 45 PR( ./fundisp foo'[cir 512 512 .1] "x y pi pha")RP(
-The same command can be effected using a list of Views:
-) 1 23 PR( fundisp v::x1,x1a:foo)RP(
-
-)0 P(What happens if a viewlist is used and the file also matches a
-template? Consider, for example, this View specification:
-) 1 23 PR( fundisp v::x2:foo.fit)RP(
-Here, the x2 View will supply filter and column values, while the
-template *.fit can also supply \201different\202 filter and column
-values. In this case, the explicitly specified Views of the viewlist
-trump the matched view values.
-
-)0 P(On the other hand, if a file template match can supply a View value
-that is not supplied by the viewlist, then that value will be taken
-from the file template match. For example:
-) 1 24 PR( fundisp v::x2:foo.fits)RP(
-does not explicitly supply a format value, but the file match on *.fits
-can and does. You can avoid supplying missing values using file template
-matching by replacing the first ":" with a "-" in a viewlist
-specification:
-) 1 24 PR( fundisp v:-x2:foo.fits)RP(
-The use of ":+" to explicitly allow file template matching is also
-supported, but is the same as the default case. Note that the nuances
-of viewlist support are subject to change as our experience and
-understanding grow.
-
-)0 2 85 H(Overriding)WB 155 Sn( Values Associated with a View)EH(
-
-)0 P(To override values associated with a View, simply supply the override
-values in the correct place on the command line. Thus, given
-the example database described above, the command:
-) 1 14 PR( fundisp v:x3)RP(
-specifies that the View named x3, along with its file name and
-associated parameters, be processed as the input file to fundisp in
-this way:
-) 1 73 PR( fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha")RP(
-To override one or more of these values, simply specify a new value
-for the format, filter, or columns. For example, if your input View file
-contains a filter, then the View will use that filter as an override
-of the View filter:
-) 1 31 PR( fundisp v:x3'[cir 400 400 3]')RP(
-will use the columns and format of the x3 View but not the x3 filter. Further
-examples are:
-) 2 67 PR( fundisp v:x3 "x y dx dy" # activate a different set of columns
- fundisp -f "I=%3d" v:x3 # use a different format statement)RP(
-
-)0 P(Note that extension names, extension index values, and other
-non-filter specifications )BD(do not)ES( override the View
-filter. Thus:
-) 1 22 PR( fundisp v:foo.fit[3])RP(
-will still use the filter associated with the .fit template \201see above\202, since
-the "3" is an extension index, not a filter.
-
-)0 2 86 H(Environment)WB 156 Sn( Variables)EH(
-
-The following environment variables are used by Funtools Views:
-)0 DL()0 DT()BD(FUN_VIEWNAME)ES(
-)DD( The )BD(FUN_VIEWNAME)ES( environment variable specifies the
-name and location of the View database file. If not present, the
-files ./.funtools.vu and $HOME/.funtools.vu are searched for, in
-that order.
-
-)0 DT()BD(FUN_VIEWMATCH)ES(
-)DD( The )BD(FUN_VIEWMATCH)ES( environment variable specifies whether a
-single match or multiple match algorithm is used to locate parameter
-values. If the value of this environment variable begins with "s",
-then a single match is used and missing parameters are not filled in
-with subsequent template matches on the file name. If the value begins
-with "m", then multiple matches are used to try to fill in missing
-parameters. The default is to use multiple matches.)LD(
-
-)0 2 87 H(Restrictions)WB 157 Sn( and Problems)EH(
-
-Support for overriding a filter \201while not overriding extension names,
-extension indexes, etc.\202 requires that we can sense the presence of a
-filter in a bracket specification. It is unclear yet whether our
-algorithm is perfect.
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 88 H(Last)WB 158 Sn( updated: August 3, 2007)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (filters.html) D
-/Ti (Table Filtering) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 52 Sn(
-
-
-)0 2 89 H(Funfilters:)WB 165 Sn()WB 159 Sn( Filtering Rows in a Table)EA()EH(
-
-
-)0 2 90 H(Summary)WB 166 Sn()EH(
-)0 P(This document contains a summary of the user interface for
-filtering rows in binary tables.
-
-
-)0 2 91 H(Description)WB 167 Sn()EH(
-)0 P(Table filtering allows a program to select rows from an table \201e.g.,
-X-ray event list\202 by checking each row against one or more expressions
-involving the columns in the table. When a table is filtered, only
-valid rows satisfying these expressions are passed through for processing.
-
-)0 P(A filter expression is specified using bracket notation appended to
-the filename of the data being processed:
-) 1 23 PR( foo.fits[pha==1&)SY(\160)ES(==2])RP(
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-) 1 19 PR( foo.fits[@my.reg])RP(
-Filters must be placed after the extension and image section
-information, when such information is present. The correct order is:
-)UL()-1 LI( file[fileinfo,sectioninfo][filters]
-)-1 LI( file[fileinfo,sectioninfo,filters])LU(
-where:
-)UL()-1 LI( )BD(file)ES( is the Funtools file name
-)-1 LI( )BD(fileinfo)ES( is an ARRAY, EVENT, FITS extension, or FITS index
-)-1 LI( )BD(sectioninfo)ES( is the image section to extract
-)-1 LI( )BD(filters)ES( are spatial region and table \201row\202 filters to apply)LU(
-See )0 42 1 A(Funtools Files)42 0 TN TL()Ec /AF f D( for more information
-on file and image section specifications.
-
-)0 2 92 H(Filter)WB 168 Sn( Expressions)EH(
-
-)0 P(Table filtering can be performed on columns of data in a FITS
-binary table or a raw event file. Table filtering is accomplished by
-means of )BD(table filter specifications)ES(. An table filter
-specification consists of one or more )BD(filter expressions)ES( Filter
-specifications also can contain comments and local/global processing
-directives.
-
-)0 P(More specifically, a filter specification consist of one or more lines
-containing:
-) 13 75 PR( # comment until end of line
- # include the following file in the table descriptor
- @file
- # each row expression can contain filters separated by operators
- [filter_expression] BOOLOP [filter_expression2], ...
- # each row expression can contain filters separated by the comma operator
- [filter_expression1], [filter_expression2], ...
- # the special row# keyword allows a range of rows to be processed
- row#=m:n
- # or a single row
- row#=m
- # regions are supported -- but are described elsewhere
- [spatial_region_expression])RP(
-
-)0 P(A single filter expression consists of an arithmetic, logical, or
-other operations involving one or more column values from a
-table. Columns can be compared to other columns, to header values,
-or to numeric constants. Standard math functions can be applied to
-columns. Separate filter expressions can be combined using boolean operators.
-Standard C semantics can be used when constructing expressions, with
-the usual precedence and associativity rules holding sway:
-) 15 55 PR( Operator Associativity
- -------- -------------
- \201\202 left to right
- !! \201logical not\202 right to left
- ! \201bitwise not\202 - \201unary minus\202 right to left
- * / left to right
- + - left to right
- < <= > >= left to right
- == != left to right
- & \201bitwise and\202 left to right
- ^ \201bitwise exclusive or\202 left to right
- | \201bitwise inclusive or\202 left to right
- && \201logical and\202 left to right
- || \201logical or\202 left to right
- = right to left)RP(
-For example, if energy and pha are columns in a table,
-then the following are valid expressions:
-) 4 24 PR( pha>1
- energy == pha
- \201pha>1\202 && \201energy<=2\202
- max\201pha,energy\202>=2.5)RP(
-
-)0 P(Comparison values can be integers or floats. Integer comparison values can be
-specified in decimal, octal \201using '0' as prefix\202, hex \201using '0x' as prefix\202
-or binary \201using '0b' as prefix\202. Thus, the following all specify the same
-comparison test of a status mask:
-) 4 40 PR( \201status & 15\202 == 8 # decimal
- \201status & 017\202 == 010 # octal
- \201status & 0xf\202 == 0x8 # hex
- \201status & 0b1111\202 == 0b1000 # binary)RP(
-)0 P(The special keyword row# allows you to process a range of rows.
-When row# is specified, the filter code skips to the designated
-row and only processes the specified number of rows. The
-"*" character can be utilized as the high limit value to denote
-processing of the remaining rows. Thus:
-) 1 14 PR( row#=100:109)RP(
-processes 10 rows, starting with row 100 \201counting from 1\202,
-while:
-) 1 12 PR( row#=100:*)RP(
-specifies that all but the first 99 rows are to be processed.
-
-)0 P(Spatial region filtering allows a program to select regions of an
-image or rows of a table \201e.g., X-ray events\202 using simple geometric
-shapes and boolean combinations of shapes. For a complete description
-of regions, see )0 54 1 A(Spatial Region Filtering)54 0 TN TL()Ec /AF f D(.
-
-)0 2 93 H(Separators)WB 169 Sn()WB 160 Sn( Also Are Operators)EA()EH(
-)0 P(As mentioned previously, multiple filter expressions can be specified
-in a filter descriptor, separated by commas or new-lines.
-When such a comma or new-line separator is used, the boolean AND operator
-is automatically generated in its place. Thus and expression such as:
-) 1 15 PR( pha==1,pi=2:4)RP(
-is equivalent to:
-) 1 26 PR( \201pha==1\202 && \201pi>=2&)SY(\160)ES(<=4\202)RP(
-)0 P([Note that the behavior of separators is different for filter expressions
-and spatial region expressions. The former uses AND as the operator, while
-the latter user OR. See
-)0 60 1 A(Combining Region and Table Filters)60 0 TN TL()Ec /AF f D(
-for more information about these conventions and how they are treated
-when combined.]
-
-)0 2 94 H(Range)WB 170 Sn()WB 161 Sn( Lists)EA()EH()0 P(
-)0 P(Aside from the standard C syntax, filter expressions can make use of
-IRAF-style )BD(range lists)ES( which specify a range of values. The
-syntax requires that the column name be followed by an '=' sign, which
-is followed by one or more comma-delimited range expressions of the form:
-) 4 52 PR( col = vv # col == vv in range
- col = :vv # col <= vv in range
- col = vv: # col >= vv in range
- col = vv1:vv2 # vv1 <= col <= vv2 in range)RP(
-The vv's above must be numeric constants; the right hand side of a
-range list cannot contain a column name or header value.
-)0 P(Note that, unlike an ordinary comma separator, the comma separator used
-between two or more range expressions denotes OR. Thus, when two or
-more range expressions are combined with a comma separator, the resulting
-expression is a shortcut for more complicated boolean logic. For example:
-) 1 18 PR( col = :3,6:8,10:)RP(
-is equivalent to:
-) 1 47 PR( \201col<=3\202 || \201col>=6 && col <=8\202 || \201col >=10\202)RP(
-Note also that the single-valued rangelist:
-) 1 11 PR( col = val)RP(
-is equivalent to the C-based filter expression:
-) 1 12 PR( col == val)RP(
-assuming, of course, that val is a numeric constant.
-
-)0 2 95 H(Math)WB 171 Sn()WB 162 Sn( Operations and Functions)EA()EH()0 P(
-)0 P(It is permissible to specify C math functions as part of the filter syntax.
-When the filter parser recognizes a function call, it automatically
-includes the math.h and links in the C math library. Thus, it is
-possible to filter rows by expressions such as these:
-)UL()-1 LI(\201pi+pha\202>\2012+log\201pi\202-pha\202
-)-1 LI( min\201pi,pha\202*14>x
-)-1 LI( max\201pi,pha\202==\201pi+1\202
-)-1 LI( feq\201pi,pha\202
-)-1 LI( div\201pi,pha\202>0)LU(
-The function feq\201a,b\202 returns true \2011\202 if the difference between a and b
-\201taken as double precision values\202 is less than approximately 10E-15.
-The function div\201a,b\202 divides a by b, but returns NaN \201not a number\202
-if b is 0. It is a safe way to avoid floating point errors when
-dividing one column by another.
-
-)0 2 96 H(Include)WB 172 Sn()WB 163 Sn( Files)EA()EH()0 P(
-)0 P(The special )BD(@filename)ES( directive specifies an include file
-containing filter expressions. This file is processed as part of
-the overall filter descriptor:
-) 1 23 PR( foo.fits[pha==1,@foo])RP(
-
-)0 2 97 H(Header)WB 173 Sn()WB 164 Sn( Parameters)EA()EH()0 P(
-)0 P(The filter syntax supports comparison between a column value and a
-header parameter value of a FITS binary tables \201raw event files have no
-such header\202. The header parameters can be taken from the binary
-table header or the primary header. For example, assuming there is a
-header value MEAN_PHA in one of these headers, you can select photons
-having exactly this value using:
-
-)UL()-1 LI( pha==MEAN_PHA)LU(
-
-)0 2 98 H(Examples)WB 174 Sn()EH(
-)0 P(Table filtering is more easily described by means of examples.
-Consider data containing the following table structure:
-)UL()-1 LI( double TIME
-)-1 LI( int X
-)-1 LI( int Y
-)-1 LI( short PI
-)-1 LI( short PHA
-)-1 LI( int DX
-)-1 LI( int DY)LU(
-
-)0 P(Tables can be filtered on these columns using IRAF/QPOE range syntax or
-any valid C syntax. The following examples illustrate the possibilities:
-)0 DL(
-)0 P()0 DT( pha=10
-)0 DT( pha==10
-)DD( select rows whose pha value is exactly 10
-
-)0 P()0 DT( pha=10:50
-)DD( select rows whose pha value is in the range of 10 to 50
-
-)0 P()0 DT( pha=10:50,100
-)DD( select rows whose pha value is in the range of 10 to 50 or is
-equal to 100
-
-)0 P()0 DT( pha>=10 && pha<=50
-)DD( select rows whose pha value is in the range of 10 to 50
-
-)0 P()0 DT( pi=1,2&&pha>3
-)DD( select rows whose pha value is 1 or 2 and whose pi value is 3
-
-)0 P()0 DT( pi=1,2 || pha>3
-)DD( select rows whose pha value is 1 or 2 or whose pi value is 3
-
-)0 P()0 DT( pha==pi+1
-)DD( select rows whose pha value is 1 less than the pi value
-
-)0 P()0 DT( \201pha==pi+1\202 && \201time>50000.0\202
-)DD( select rows whose pha value is 1 less than the pi value
-and whose time value is greater than 50000
-
-)0 P()0 DT(\201pi+pha\202>20
-)DD( select rows in which the sum of the pi and pha values is greater
-than 20
-
-)0 P()0 DT( pi%2==1
-)DD( select rows in which the pi value is odd)LD(
-
-)0 P(Currently, integer range list limits cannot be specified in binary
-notation \201use decimal, hex, or octal instead\202. Please contact us if
-this is a problem.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 99 H(Last)WB 175 Sn( updated: November 17, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (idx.html) D
-/Ti (Table Filtering with Indexes) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 53 Sn(
-
-
-)0 2 100 H(Funidx:)WB 177 Sn()WB 176 Sn( Using Indexes to Filter Rows in a Table)EA()EH(
-
-
-)0 2 101 H(Summary)WB 178 Sn()EH(
-)0 P(This document contains a summary of the user interface for
-filtering rows in binary tables with indexes.
-
-
-)0 2 102 H(Description)WB 179 Sn()EH(
-)0 P(Funtools )0 52 1 A(Table Filtering)52 0 TN TL()Ec /AF f D( allows rows in a
-table to be selected based on the values of one or more columns in the
-row. Because the actual filter code is compiled on the fly, it is very
-efficient. However, for very large files \201hundreds of Mb or larger\202,
-evaluating the filter expression on each row can take a long time. Therefore,
-funtools supports index files for columns, which are used automatically during
-filtering to reduce dramatically the number of row evaluations performed.
-The speed increase for indexed filtering can be an order of magnitude or
-more, depending on the size of the file.
-
-)0 P(The )0 11 1 A(funindex)11 0 TN TL()Ec /AF f D( program creates an
-index on one or more columns in a binary table. For example, to create an index
-for the column pi in the file huge.fits, use:
-) 1 23 PR( funindex huge.fits pi)RP(
-This will create an index named huge_pi.idx.
-
-)0 P(When a filter expression is initialized for row evaluation, funtools
-looks for an index file for each column in the filter expression. If
-found, and if the file modification date of the index file is later
-than that of the data file, then the index will be used to reduce the
-number of rows that are evaluated in the filter. When
-)0 54 1 A(Spatial Region Filtering)54 0 TN TL()Ec /AF f D( is part of the
-expression, the columns associated with the region are checked for index
-files.
-
-)0 P(If an index file is not available for a given column, then in general,
-all rows must be checked when that column is part of a filter
-expression. This is not true, however, when a non-indexed column is
-part of an AND expression. In this case, only the rows that pass the
-other part of the AND expression need to be checked. Thus, in some cases,
-filtering speed can increase significantly even if all columns are not
-indexed.
-
-)0 P(Also note that certain types of filter expression syntax cannot make
-use of indices. For example, calling functions with column names as
-arguments implies that all rows must be checked against the function
-value. Once again, however, if this function is part of an AND
-expression, then a significant improvement in speed still is possible
-if the other part of the AND expression is indexed.
-
-)0 P(For example, note below the dramatic speedup in searching a 1 Gb
-file using an AND filter, even when one of the columns \201pha\202 has no
-index:
-
-) 49 69 PR( time fundisp \200
- huge.fits'[idx_activate=0,idx_debug=1,pha=2348&&cir 4000 4000 1]' \200
- "x y pha"
- x y pha
- ---------- ----------- ----------
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 42.36u 13.07s 6:42.89 13.7%
-
- time fundisp \200
- huge.fits'[idx_activate=1,idx_debug=1,pha=2348&&cir 4000 4000 1]' \200
- "x y pha"
- x y pha
- ---------- ----------- ----------
- idxeq: [INDEF]
- idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
- idxand\2011\202: INDEF [IDX_OR_SORT] )WR(
- idxall\2011\202: [IDX_OR_SORT]
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 1.55u 0.37s 1:19.80 2.4%)RP(
-
-When all columns are indexed, the increase in speed can be even more dramatic:
-) 50 67 PR( time fundisp \200
- huge.fits'[idx_activate=0,idx_debug=1,pi=770&&cir 4000 4000 1]' \200
- "x y pi"
- x y pi
- ---------- ----------- ----------
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 42.60u 12.63s 7:28.63 12.3%
-
- time fundisp \200
- huge.fits'[idx_activate=1,idx_debug=1,pi=770&&cir 4000 4000 1]' \200
- "x y pi"
- x y pi
- ---------- ----------- ----------
- idxeq: pi start=9473025,stop=9492240 => pi[ROW 9473025:9492240]
- idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
- idxor sort/merge: pi[ROW 9473025:9492240] [IDX_OR_SORT] )WR(
- idxmerge\2015\202: [IDX_OR_SORT] pi[ROW]
- idxall\2011\202: [IDX_OR_SORT]
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 1.67u 0.30s 0:24.76 7.9%)RP(
-
-)0 P(The miracle of indexed filtering \201and indeed, of any indexing\202 is the
-speed of the binary search on the index, which is of order log2\201n\202
-instead of n. \201The funtools binary search method is taken from
-http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary, to whom
-grateful acknowledgement is made.\202 This means that the larger the
-file, the better the performance. Conversely, it also means that for
-small files, using an index \201and the overhead involved\202 can slow
-filtering down somewhat. Our tests indicate that on a file containing
-a few tens of thousands of rows, indexed filtering can be 10 to 20
-percent slower than non-indexed filtering. Of course, your mileage
-will vary with conditions \201disk access speed, amount of available
-memory, process load, etc.\202
-
-)0 P(Any problem encountered during index processing will result in
-indexing being turned off, and replaced by filtering all rows. You can turn
-filtering off manually by setting the idx_activate variable to 0 \201in a filter
-expression\202 or the FILTER_IDX_ACTIVATE environment variable to 0 \201in the global
-environment\202. Debugging output showing how the indexes are being processed can
-be displayed to stderr by setting the idx_debug variable to 1 \201in a filter
-expression\202 or the FILTER_IDX_DEBUG environment variable to 1 \201in the global
-environment\202.
-
-)0 P(Currently, indexed filtering only works with FITS binary tables and raw
-event files. It does not work with text files. This restriction might be
-removed in a future release.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 103 H(Last)WB 180 Sn( updated: August 3, 2007)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (regions.html) D
-/Ti (Spatial Region Filtering) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 54 Sn(
-
-
-)0 2 104 H(Regions:)WB 182 Sn()WB 181 Sn( Spatial Region Filtering)EA()EH(
-
-
-)0 2 105 H(Summary)WB 183 Sn()EH(
-)0 P(This document contains a summary of the user interface for spatial
-region filtering images and tables.
-
-
-)0 2 106 H(Description)WB 184 Sn()EH(
-)0 P(Spatial region filtering allows a program to select regions of an
-image or rows of a table \201e.g., X-ray events\202 to process using
-simple geometric shapes and boolean combinations of shapes. When an
-image is filtered, only pixels found within these shapes are
-processed. When a table is filtered, only rows found within these
-shapes are processed.
-
-)0 P(Spatial region filtering for images and tables is accomplished by
-means of )BD(region specifications)ES(. A region specification
-consists of one or more )BD(region expressions)ES(, which are geometric
-shapes,combined according to the rules of boolean algebra. Region
-specifications also can contain comments and local/global processing
-directives.
-
-)0 P(Typically, region specifications are specified using bracket notation
-appended to the filename of the data being processed:
-) 1 31 PR( foo.fits[circle\201512,512,100\202])RP(
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-) 1 19 PR( foo.fits[@my.reg])RP(
-
-)0 P(When region filters are passed in bracket notation in this manner, the
-filtering is set up automatically when the file is opened and all
-processing occurs through the filter. Programs also can use the filter
-library API to open filters explicitly.
-
-)0 2 107 H(Region)WB 185 Sn( Expressions)EH(
-
-More specifically, region specifications consist of one or more lines
-containing:
-) 9 68 PR( # comment until end of line
- global keyword=value keyword=value ... # set global value\201s\202
- # include the following file in the region descriptor
- @file
- # use the FITS image as a mask \201cannot be used with other regions\202
- @fitsimage
- # each region expression contains shapes separated by operators
- [region_expression1], [region_expression2], ...
- [region_expression], [region_expression], ...)RP(
-
-)0 P(A single region expression consists of:
-) 8 72 PR( # parens and commas are optional, as is the + sign
- [+-]shape\201num , num , ...\202 OP1 shape num num num OP2 shape ...
-
-e.g.:
-
- \201[+-]shape\201num , num , ...\202 && shape num num || shape\201num, num\202
- # a comment can come after a region -- reserved for local properties
- [+-]shape\201num , num , ...\202 # local properties go here, e.g. color=red)RP(
-
-)0 P(Thus, a region descriptor consists of one or more )BD(region
-expressions)ES( or )BD(regions)ES(, separated by comas, new-lines, or
-semi-colons. Each )BD(region)ES( consists of one or more )BD(geometric
-shapes)ES( combined using standard boolean operation. Several types
-of shapes are supported, including:
-
-) 11 57 PR( shape: arguments:
- ----- ----------------------------------------
- ANNULUS xcenter ycenter inner_radius outer_radius
- BOX xcenter ycenter xwidth yheight \201angle\202
- CIRCLE xcenter ycenter radius
- ELLIPSE xcenter ycenter xwidth yheight \201angle\202
- FIELD none
- LINE x1 y1 x2 y2
- PIE xcenter ycenter angle1 angle2
- POINT x1 y1
- POLYGON x1 y1 x2 y2 ... xn yn)RP(
-
-)0 P(In addition, the following regions accept )BD(accelerator)ES( syntax:
-
-) 13 73 PR( shape arguments
- ----- ------------------------------------------
- ANNULUS xcenter ycenter radius1 radius2 ... radiusn
- ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn \201angle\202
- BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] \201angle\202
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn \201angle\202
- ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] \201angle\202
- PIE xcenter ycenter angle1 angle2 \201angle3\202 \201angle4\202 \201angle5\202 ...
- PIE xcenter ycenter angle1 angle2 \201n=[number]\202
- POINT x1 y1 x2 y2 ... xn yn)RP(
-Note that the circle accelerators are simply aliases for the annulus
-accelerators. See )0 55 1 A(region geometry)55 0 TN TL()Ec /AF f D(
-for more information about accelerators.
-
-)0 P(Finally, the following are combinations of pie with different shapes
-\201called "panda" for "Pie AND Annulus"\202 allow for easy specification of
-radial sections:
-
-) 6 75 PR( shape: arguments:
- ----- ---------
- PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad \201ang\202 # box
- EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad \201ang\202 # ellipse)RP(
-
-The panda and cpanda specify combinations of annulus and circle with pie,
-respectively and give identical results. The bpanda combines box and pie,
-while epanda combines ellipse and pie.
-See )0 55 1 A(region geometry)55 0 TN TL()Ec /AF f D(
-for more information about pandas.
-
-)0 P(The following "shapes" are ignored by funtools \201generated by ds9\202:
-) 8 62 PR( shape: arguments:
- ----- ---------
- PROJECTION x1 y1 x2 y2 width # NB: ignored by funtools
- RULER x1 y1 x2 y2 # NB: ignored by funtools
- TEXT x y # NB: ignored by funtools
- GRID # NB: ignored by funtools
- TILE # NB: ignored by funtools
- COMPASS # NB: ignored by funtools)RP(
-
-)0 P(All arguments to regions are real values; integer values are
-automatically converted to real where necessary. All angles are in
-degrees and run from the positive image x-axis to the positive image
-y-axis. If a rotation angle is part of the associated WCS header, that
-angle is added implicitly as well.
-
-)0 P(Note that 3-letter abbreviations are supported for all shapes, so that
-you can specify "circle" or "cir".
-
-)0 P()0 2 108 H(Columns)WB 186 Sn( Used in Region Filtering)EH(
-)0 P(By default, the x,y values in a region expression refer to the two
-"image binning" columns, i.e. the columns that would be used to
-bin the data into an image. For images, these are just the 2 dimensions
-of the image. For tables, these usually default to x and y but
-can be changed as required. For example, in Funtools, new binning
-columns are specified using a bincols=\201col1,col2\202 statement within
-the bracket string on the command line.
-)0 P(Alternate columns for region filtering can be specified by the syntax:
-) 1 25 PR( \201col1,col2\202=region\201...\202)RP(
-e.g.:
-) 3 34 PR( \201X,Y\202=annulus\201x,y,ri,ro\202
- \201PHA,PI\202=circle\201x,y,r\202
- \201DX,DY\202=ellipse\201x,y,a,b[,angle]\202)RP(
-
-)0 P()0 2 109 H(Region)WB 187 Sn( Algebra)EH(
-
-\201See also )0 56 1 A(Region Algebra)56 0 TN TL()Ec /AF f D( for more complete
-information.\202
-
-)0 P(Region shapes can be combined together using Boolean operators:
-) 6 72 PR( Symbol Operation Use
- -------- --------- -----------------------------------
- ! not Exclude this shape from this region
- & or && and Include only the overlap of these shapes
- | or || inclusive or Include all of both shapes
- ^ exclusive or Include both shapes except their overlap)RP(
-Note that the !region syntax must be combined with another region in order
-that we be able to assign a region id properly. That is,
-) 1 21 PR( !circle\201512,512,10\202)RP(
-is not a legal region because there is no valid region id to work with.
-To get the full field without a circle, combine the above with field\201\202,
-as in:
-) 1 32 PR( field\201\202 && !circle\201512,512,10\202)RP(
-
-)0 2 110 H()WB 188 Sn( Region Separators Also Are Operators)EH(
-
-)0 P(As mentioned previously, multiple region expressions can be specified
-in a region descriptor, separated by commas, new-lines, or
-semi-colons. When such a separator is used, the boolean OR operator
-is automatically generated in its place but, unlike explicit use of
-the OR operator, the region ID is incremented \201starting from 1\202.
-
-)0 P(For example, the two shapes specified in this example are given the
-same region value:
-) 1 50 PR( foo.fits[circle\201512,512,10\202||circle\201400,400,20\202])RP(
-On the other hand, the two shapes defined in the following example are
-given different region values:
-) 1 49 PR( foo.fits[circle\201512,512,10\202,circle\201400,400,20\202])RP(
-
-)0 P(Of course these two examples will both mask the same table rows or
-pixels. However, in programs that distinguish region id's \201such as
-)0 5 1 A(funcnts)5 0 TN TL()Ec /AF f D( \202, they will act
-differently. The explicit OR operator will result in one region
-expression consisting of two shapes having the same region id and
-funcnts will report a single region. The comma operator will cause
-funcnts to report two region expressions, each with one shape, in
-its output.
-
-)0 P(In general, commas are used to separate region expressions entered
-in bracket notation on the command line:
-) 2 57 PR( # regions are added to the filename in bracket notation
- foo.fits[circle\201512,512,100\202,circle\201400,400,20\202])RP(
-New-lines are used to separate region
-expressions in a file:
-) 4 58 PR( # regions usually are separated by new-lines in a file
- # use @filename to include this file on the command line
- circle\201512,512,100\202
- circle\201400,400,20\202)RP(
-Semi-colons are provided for backward compatibility with the original
-IRAF/PROS implementation and can be used in either case.
-
-)0 P(If a pixel is covered by two different regions expressions, it is
-given the mask value of the )BD(first)ES( region that contains that
-pixel. That is, successive regions )BD(do not)ES( overwrite previous
-regions in the mask, as was the case with the original PROS regions.
-In this way, an individual pixel is covered by one and only one
-region. This means that one must sometimes be careful about the order
-in which regions are defined. If region N is fully contained within
-region M, then N should be defined )BD(before)ES( M, or else it will be
-"covered up" by the latter.
-
-)0 2 111 H(Region)WB 189 Sn( Exclusion)EH(
-)0 P(Shapes also can be globally excluded from all the region specifiers in
-a region descriptor by using a minus sign before a region:
-
-) 4 73 PR( operator arguments:
- -------- -----------
- - Globally exclude the region expression following '-' sign
- from ALL regions specified in this file)RP(
-The global exclude region can be used by itself; in such a case, field\201\202 is
-implied.
-
-)0 P(A global exclude differs from the local exclude \201i.e. a shape prefixed
-by the logical not "!" symbol\202 in that global excludes are logically
-performed last, so that no region will contain pixels from a globally
-excluded shape. A local exclude is used in a boolean expression with
-an include shape, and only excludes pixels from that include shape.
-Global excludes cannot be used in boolean expressions.
-
-)0 2 112 H(Include)WB 190 Sn( Files)EH(
-
-)0 P(The )BD(@filename)ES( directive specifies an include file
-containing region expressions. This file is processed as part of
-the overall region descriptor:
-) 1 35 PR( foo.fits[circle\201512,512,10\202,@foo])RP(
-A filter include file simply includes text without changing the state
-of the filter. It therefore can be used in expression. That is, if the
-file foo1 contains "pi==1" and foo2 contains "pha==2" then
-the following expressions are equivalent:
-) 3 57 PR( "[@foo1&&@foo2]" is equivalent to "[pi==1&&pha==2]"
- "[pha==1||@foo2]" is equivalent to "[pi==1||pha==2]"
- "[@foo1,@foo2]" is equivalent to "[pi==1,pha==2]")RP(
-Be careful that you specify evaluation order properly using
-parenthesis, especially if the include file contains multiple
-filter statements. For example, consider a file containing two
-regions such as:
-) 2 19 PR( circle 512 512 10
- circle 520 520 10)RP(
-If you want to include only events \201or pixels\202 that are in these regions
-and have a pi value of 4, then the correct syntax is:
-) 1 17 PR( pi==4&&\201@foo\202)RP(
-since this is equivalent to:
-) 1 53 PR( pi==4 && \201circle 512 512 10 || circle 520 520 10\202)RP(
-If you leave out the parenthesis, you are filtering this statement:
-) 1 52 PR( pi==4 && circle 512 512 10 || circle 520 520 10\202)RP(
-which is equivalent to:
-) 1 54 PR( \201pi==4 && circle 512 512 10\202 || circle 520 520 10\202)RP(
-The latter syntax only applies the pi test to the first region.
-
-)0 P(For image-style filtering, the )BD(@filename)ES( can specify an 8-bit
-or 16-bit FITS image. In this case, the pixel values in the mask image
-are used as the region mask. The valid pixels in the mask must have
-positive values. Zero values are excluded from the mask and negative
-values are not allowed. Moreover, the region id value is taken as
-the image pixel value and the total number of regions is taken to be
-the highest pixel value. The dimensions of the image mask must be less
-than or equal to the image dimensions of the data. The mask will be
-replicated as needed to match the size of the image. \201Thus, best
-results are obtained when the data dimensions are an even multiple of
-the mask dimensions.\202
-
-)0 P(An image mask can be used in any image filtering operation, regardless
-of whether the data is of type image or table. For example, the
-)0 5 1 A(funcnts)5 0 TN TL()Ec /AF f D( \202
-program performs image filtering on images or tables, and so
-FITS image masks are valid input for either type of data in this
-program.. An image mask cannot be used in a program such as
-)0 7 1 A(fundisp)7 0 TN TL()Ec /AF f D( \202
-when the input data is a table, because fundisp displays
-rows of a table and processes these rows using event-style filtering.
-
-)0 2 113 H(Global)WB 191 Sn( and Local Properties of Regions)EH(
-
-)0 P(The ds9 image display program describes a host of properties such as
-color, font, fix/free state, etc. Such properties can be specified
-globally \201for all regions\202 or locally \201for an individual region\202.
-The )BD(global)ES( keyword specifies properties and qualifiers for all
-regions, while local properties are specified in comments on the same
-line as the region:
-) 4 30 PR( global color=red
- circle\20110,10,2\202
- circle\20120,20,3\202 # color=blue
- circle\20130,30,4\202)RP(
-The first and third circles will be red, which the second circle will
-be blue. Note that funtools currently ignores region properties, as
-they are used in display only.
-
-)0 2 114 H()WB 192 Sn( Coordinate Systems)EH(
-
-For each region, it is important to specify the coordinate system
-used to interpret the region, i.e., to set the context in which position and
-size values are interpreted. For this purpose, the following keywords
-are recognized:
-
-) 12 68 PR( name description
- ---- ------------------------------------------
- PHYSICAL pixel coords of original file using LTM/LTV
- IMAGE pixel coords of current file
- FK4, B1950 sky coordinate systems
- FK5, J2000 sky coordinate systems
- GALACTIC sky coordinate systems
- ECLIPTIC sky coordinate systems
- ICRS currently same as J2000
- LINEAR linear wcs as defined in file
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV)RP(
-
-)0 P()0 2 115 H(Specifying)WB 193 Sn( Positions, Sizes, and Angles)EH(
-
-The arguments to region shapes can be floats or integers describing
-positions and sizes. They can be specified as pure numbers or using
-explicit formatting directives:
-
-) 21 57 PR( position arguments description
- ------------------ ------------------------------
- [num] context-dependent \201see below\202
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
- [num]:[num]:[num] hms for 'odd' position arguments
- [num]:[num]:[num] dms for 'even' position arguments
- [num]h[num]m[num]s explicit hms
- [num]d[num]m[num]s explicit dms
-
- size arguments description
- -------------- -----------
- [num] context-dependent \201see below\202
- [num]" arc seconds
- [num]' arc minutes
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels)RP(
-
-
-When a "pure number" \201i.e. one without a format directive such as 'd'
-for 'degrees'\202 is specified, its interpretation depends on the context
-defined by the 'coordsys' keyword. In general, the rule is:
-
-)0 P()BD(All pure numbers have implied units corresponding to the current
-coordinate system.)ES(
-
-)0 P(If no such system is explicitly specified, the default system is
-implicitly assumed to be PHYSICAL.
-
-)0 P(In practice this means that for IMAGE and PHYSICAL systems, pure
-numbers are pixels. Otherwise, for all systems other than linear,
-pure numbers are degrees. For LINEAR systems, pure numbers are in the
-units of the linear system. This rule covers both positions and
-sizes.
-
-)0 P(The input values to each shape can be specified in several coordinate
-systems including:
-
-) 12 68 PR( name description
- ---- ----------------------------
- IMAGE pixel coords of current file
- LINEAR linear wcs as defined in file
- FK4, B1950 various sky coordinate systems
- FK5, J2000
- GALACTIC
- ECLIPTIC
- ICRS
- PHYSICAL pixel coords of original file using LTM/LTV
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV)RP(
-
-)0 P(If no coordinate system is specified, PHYSICAL is assumed. PHYSICAL or
-a World Coordinate System such as J2000 is preferred and most general.
-The coordinate system specifier should appear at the beginning of the
-region description, on a separate line \201in a file\202, or followed by a
-new-line or semicolon; e.g.,
-
-) 2 26 PR( global coordsys physical
- circle 6500 9320 200)RP(
-
-The use of celestial input units automatically implies WORLD
-coordinates of the reference image. Thus, if the world coordinate
-system of the reference image is J2000, then
-
-) 1 27 PR( circle 10:10:0 20:22:0 3')RP(
-
-is equivalent to:
-
-) 1 35 PR( circle 10:10:0 20:22:0 3' # j2000)RP()RP(
-Note that by using units as described above, you may mix coordinate
-systems within a region specifier; e.g.,
-
-) 1 32 PR( circle 6500 9320 3' # physical)RP(
-
-)0 P(Note that, for regions which accept a rotation angle:
-
-) 2 29 PR(ellipse \201x, y, r1, r2, angle\202
-box\201x, y, w, h, angle\202)RP(
-
-the angle is relative to the specified coordinate system. In
-particular, if the region is specified in WCS coordinates, the angle
-is related to the WCS system, not x/y image coordinate axis. For WCS
-systems with no rotation, this obviously is not an issue. However,
-some images do define an implicit rotation \201e.g., by using a non-zero
-CROTA value in the WCS parameters\202 and for these images, the angle
-will be relative to the WCS axes. In such case, a region specification
-such as:
-
-) 1 54 PR(fk4;ellipse\20122:59:43.985, +58:45:26.92,320", 160", 30\202)RP(
-
-will not, in general, be the same region specified as:
-
-) 1 38 PR(physical;ellipse\201465, 578, 40, 20, 30\202)RP(
-
-even when positions and sizes match. The angle is relative to WCS axes
-in the first case, and relative to physical x,y axes in the second.
-
-
-)0 P(More detailed descriptions are available for:
-)0 55 1 A(Region Geometry)55 0 TN TL()Ec /AF f D(,
-)0 56 1 A(Region Algebra)56 0 TN TL()Ec /AF f D(,
-)0 57 1 A(Region Coordinates)57 0 TN TL()Ec /AF f D(, and
-)0 58 1 A(Region Boundaries)58 0 TN TL()Ec /AF f D(.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 116 H(Last)WB 194 Sn( updated: November 17, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (reggeometry.html) D
-/Ti (Region Geometry) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 55 Sn(
-
-
-)0 2 117 H(RegGeometry:)WB 196 Sn()WB 195 Sn( Geometric Shapes in Spatial Region Filtering)EA()EH(
-
-
-)0 2 118 H(Summary)WB 197 Sn()EH(
-)0 P(This document describes the geometry of regions available for spatial
-filtering in IRAF/PROS analysis.
-
-
-)0 2 119 H(Geometric)WB 198 Sn( shapes)EH(
-)0 P(Several geometric shapes are used to describe regions. The valid
-shapes are:
-
-) 11 57 PR( shape: arguments:
- ----- ----------------------------------------
- ANNULUS xcenter ycenter inner_radius outer_radius
- BOX xcenter ycenter xwidth yheight \201angle\202
- CIRCLE xcenter ycenter radius
- ELLIPSE xcenter ycenter xwidth yheight \201angle\202
- FIELD none
- LINE x1 y1 x2 y2
- PIE xcenter ycenter angle1 angle2
- POINT x1 y1
- POLYGON x1 y1 x2 y2 ... xn yn)RP(
-
-
-All arguments are real values; integer values are automatically
-converted to real where necessary. All angles are in degrees and
-specify angles that run counter-clockwise from the positive y-axis.
-
-)0 P(Shapes can be specified using "command" syntax:
-) 1 23 PR( [shape] arg1 arg2 ...)RP(
-or using "routine" syntax:
-) 1 26 PR( [shape]\201arg1, arg2, ...\202)RP(
-or by any combination of the these. \201Of course, the parentheses must
-balance and there cannot be more commas than necessary.\202 The shape
-keywords are case-insensitive. Furthermore, any shape can be
-specified by a three-character unique abbreviation. For example, one
-can specify three circular regions as:
-
-) 1 64 PR( "foo.fits[CIRCLE 512 512 50;CIR\201128 128, 10\202;cir\201650,650,20\202]")RP(
-
-\201Quotes generally are required to protect the region descriptor
-from being processed by the Unix shell.\202
-
-)2 1 1 HR(
-)0 P(The )BD(annulus)ES( shape specifies annuli, centered at xcenter,
-ycenter, with inner and outer radii \201r1, r2\202. For example,
-) 1 20 PR( ANNULUS 25 25 5 10)RP(
-specifies an annulus centered at 25.0 25.0 with an inner radius of 5.0 and
-an outer radius of 10. Assuming \201as will be done for all examples in this
-document, unless otherwise noted\202 this shape is used in a mask of size 40x40,
-it will look like this:
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:....................111111111...........
- 33:...................11111111111..........
- 32:.................111111111111111........
- 31:.................111111111111111........
- 30:................11111111111111111.......
- 29:...............1111111.....1111111......
- 28:...............111111.......111111......
- 27:...............11111.........11111......
- 26:...............11111.........11111......
- 25:...............11111.........11111......
- 24:...............11111.........11111......
- 23:...............11111.........11111......
- 22:...............111111.......111111......
- 21:...............1111111.....1111111......
- 20:................11111111111111111.......
- 19:.................111111111111111........
- 18:.................111111111111111........
- 17:...................11111111111..........
- 16:....................111111111...........
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................)WR(
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-
-)2 1 1 HR(
-)0 P(The )BD(box)ES( shape specifies an orthogonally oriented box,
-centered at xcenter, ycenter, of size xwidth, yheight. It requires four
-arguments and accepts an optional fifth argument to specify a rotation angle.
-When the rotation angle is specified \201in degrees\202, the box is rotated by
-an angle that runs counter-clockwise from the positive y-axis.
-
-)0 P(The )BD(box)ES( shape specifies a rotated box, centered at
-xcenter, ycenter, of size xwidth, yheight. The box is rotated by an angle
-specified in degrees that runs counter-clockwise from the positive y-axis.
-If the angle argument is omitted, it defaults to 0.
-
-)2 1 1 HR(
-)0 P(The )BD(circle)ES( shape specifies a circle, centered at xcenter,
-ycenter, of radius r. It requires three arguments.
-
-)2 1 1 HR(
-)0 P(The )BD(ellipse)ES( shape specifies an ellipse, centered at
-xcenter, ycenter, with y-axis width a and the y-axis length b defined such
-that:
-) 1 27 PR( x**2/a**2 + y**2/b**2 = 1)RP(
-Note that a can be less than, equal to, or greater than b. The ellipse
-is rotated the specified number of degrees. The rotation is done according
-to astronomical convention, counter-clockwise from the positive y-axis.
-An ellipse defined by:
-) 1 23 PR( ELLIPSE 20 20 5 10 45)RP(
-will look like this:
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:............111111......................
- 26:............11111111....................
- 25:............111111111...................
- 24:............11111111111.................
- 23:............111111111111................
- 22:............111111111111................
- 21:.............111111111111...............
- 20:.............1111111111111..............
- 19:..............111111111111..............
- 18:...............111111111111.............
- 17:...............111111111111.............
- 16:................11111111111.............
- 15:..................111111111.............
- 14:...................11111111.............
- 13:.....................111111.............
- 12:........................................)WR(
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-
-
-)2 1 1 HR(
-)0 P(The )BD(field)ES( shape specifies the entire field as a
-region. It is not usually specified explicitly, but is used implicitly in the
-case where no regions are specified, that is, in cases where either a null
-string or some abbreviation of the string "none" is input.
-)BD(Field)ES( takes no arguments.
-
-)2 1 1 HR(
-)0 P(The )BD(pie)ES( shape specifies an angular wedge of the entire field,
-centered at xcenter, ycenter. The wedge runs between the two specified angles.
-The angles are given in degrees, running counter-clockwise from the positive
-x-axis. For example,
-) 1 18 PR( PIE 20 20 90 180)RP(
-defines a region from 90 degrees to 180 degrees, i.e., quadrant 2 of the
-Cartesian plane. The display of such a region looks like this:
-
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:11111111111111111111....................
- 39:11111111111111111111....................
- 38:11111111111111111111....................
- 37:11111111111111111111....................
- 36:11111111111111111111....................
- 35:11111111111111111111....................
- 34:11111111111111111111....................
- 33:11111111111111111111....................
- 32:11111111111111111111....................
- 31:11111111111111111111....................
- 30:11111111111111111111....................
- 29:11111111111111111111....................
- 28:11111111111111111111....................
- 27:11111111111111111111....................
- 26:11111111111111111111....................
- 25:11111111111111111111....................
- 24:11111111111111111111....................
- 23:11111111111111111111....................
- 22:11111111111111111111....................
- 21:11111111111111111111....................
- 20:........................................
- 19:........................................
- 18:........................................
- 17:........................................
- 16:........................................
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................)WR(
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-The pie slice specified is always a counter-clockwise sweep between
-the angles, starting at the first angle and ending at the second. Thus:
-) 1 17 PR( PIE 10 15 30 60)RP(
-describes a 30 degree sweep from 2 o'clock to 1 o'clock, while:
-) 1 17 PR( PIE 10 15 60 30)RP(
-describes a 330 degree counter-clockwise sweep from 1 o'clock to 2 o'clock
-passing through 12 o'clock \2010 degrees\202. Note in both of these examples that
-the center of the slice can be anywhere on the plane. The second mask looks
-like this:
-
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:111111111111111111111111................
- 39:11111111111111111111111.................
- 38:11111111111111111111111.................
- 37:1111111111111111111111..................
- 36:1111111111111111111111..................
- 35:111111111111111111111...................
- 34:11111111111111111111....................
- 33:11111111111111111111....................
- 32:1111111111111111111....................1
- 31:1111111111111111111..................111
- 30:111111111111111111.................11111
- 29:111111111111111111................111111
- 28:11111111111111111...............11111111
- 27:1111111111111111..............1111111111
- 26:1111111111111111.............11111111111
- 25:111111111111111............1111111111111
- 24:111111111111111..........111111111111111
- 23:11111111111111.........11111111111111111
- 22:11111111111111........111111111111111111
- 21:1111111111111.......11111111111111111111
- 20:111111111111......1111111111111111111111
- 19:111111111111....111111111111111111111111
- 18:11111111111....1111111111111111111111111
- 17:11111111111..111111111111111111111111111
- 16:1111111111.11111111111111111111111111111
- 15:1111111111111111111111111111111111111111
- 14:1111111111111111111111111111111111111111
- 13:1111111111111111111111111111111111111111
- 12:1111111111111111111111111111111111111111)WR(
- 11:1111111111111111111111111111111111111111
- 10:1111111111111111111111111111111111111111
- 9:1111111111111111111111111111111111111111
- 8:1111111111111111111111111111111111111111
- 7:1111111111111111111111111111111111111111
- 6:1111111111111111111111111111111111111111
- 5:1111111111111111111111111111111111111111
- 4:1111111111111111111111111111111111111111
- 3:1111111111111111111111111111111111111111
- 2:1111111111111111111111111111111111111111
- 1:1111111111111111111111111111111111111111)RP(
-The pie slice goes to the edge of the field. To limit its scope, pie
-usually is is combined with other shapes, such as circles and annuli,
-using boolean operations. \201See below and in "help regalgebra"\202.
-
-)0 P(Pie Performance Notes:
-)0 P(Pie region processing time is proportional to the size of the image,
-and not the size of the region. This is because the pie shape is the
-only infinite length shape, and we essentially must check all y rows
-for inclusion \201unlike other regions, where the y limits can be
-calculated beforehand\202. Thus, pie can run very slowly on large images.
-In particular, it will run MUCH more slowly than the panda shape in
-image-based region operations \201such as funcnts\202. We recommend use of
-panda over pie where ever possible.
-
-)0 P(If you must use pie, always try to put it last in a boolean &&
-expression. The reason for this is that the filter code is optimized
-to exit as soon as the result is know. Since pie is the slowest
-region, it is better to avoid executing it if another region can decide
-the result. Consider, for example, the difference in time required to
-process a Chandra ACIS file when a pie and circle are combined in
-two different orders:
-
-) 5 74 PR( time ./funcnts nacis.fits "circle 4096 4096 100 && pie 4096 4096 10 78"
-2.87u 0.38s 0:35.08 9.2%
-
- time ./funcnts nacis.fits "pie 4096 4096 10 78 && circle 4096 4096 100 "
-89.73u 0.36s 1:03.50 141.8%)RP(
-
-)0 P(Black-magic performance note:
-
-)0 P(Panda region processing uses a )BD(quick test)ES( pie region instead of
-the normal pie region when combining its annulus and pie shapes. This
-)BD(qtpie)ES( shape differs from the normal pie in that it utilizes the
-y limits from the previous region with which it is combined. In a
-panda shape, which is a series of annuli combined with pies, the
-processing time is thus reduced to that of the annuli.
-
-)0 P(You can use the qtpie shape instead of pie in cases where you are
-combining pie with another shape using the && operator. This will
-cause the pie limits to be set using limits from the other shape, and
-will speed up the processing considerably. For example, the above
-execution of funcnts can be improved considerably using this technique:
-
-) 2 75 PR( time ./funcnts nacis.fits "circle 4096 4096 100 && qtpie 4096 4096 10 78"
-4.66u 0.33s 0:05.87 85.0%)RP(
-
-)0 P(We emphasize that this is a quasi-documented feature and might change in
-the future. The qtpie shape is not recognized by ds9 or other programs.
-
-)2 1 1 HR(
-)0 P(The )BD(line)ES( shape allows single pixels in a line between \201x1,y1\202 and
-\201x2,y2\202 to be included or excluded. For example:
-) 44 49 PR( LINE \2015,6, 24,25\202
-) 43 49 PR(displays as:
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:.......................1................
- 24:......................1.................
- 23:.....................1..................
- 22:....................1...................
- 21:...................1....................
- 20:..................1.....................
- 19:.................1......................
- 18:................1.......................
- 17:...............1........................
- 16:..............1.........................
- 15:.............1..........................
- 14:............1...........................)WR(
- 13:...........1............................)WR(
- 12:..........1.............................)WR(
- 11:.........1..............................
- 10:........1...............................
- 9:.......1................................
- 8:......1.................................
- 7:.....1..................................
- 6:....1...................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-
-)2 1 1 HR(
-)0 P(The )BD(point)ES( shape allows single pixels to be included or
-excluded. Although the \201x,y\202 values are real numbers, they are truncated
-to integer and the corresponding pixel is included or excluded, as specified.
-
-)0 P(Several points can be put in one region declaration; unlike the
-original IRAF implementation, each now is given a different region mask value.
-This makes it easier, for example, for funcnts to determine the number of
-photons in the individual pixels. For example,
-) 1 37 PR( POINT \2015,6, 10,11, 20,20, 35,30\202)RP(
-will give the different region mask values to all four points, as shown below:
-
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:..................................4.....
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:........................................
- 24:........................................
- 23:........................................
- 22:........................................
- 21:........................................
- 20:...................3....................
- 19:........................................
- 18:........................................
- 17:........................................
- 16:........................................
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................)WR(
- 11:.........2..............................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:....1...................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-
-)2 1 1 HR(
-)0 P(The )BD(polygon)ES( shape specifies a polygon with vertices
-\201x1, y1\202 ... \201xn, yn\202. The polygon is closed automatically: one should
-not specify the last vertex to be the same as the first. Any number of
-vertices are allowed. For example, the following polygon defines a
-right triangle as shown below:
-) 1 33 PR( POLYGON \20110,10, 10,30, 30,30\202)RP(
-
-looks like this:
-
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:..........11111111111111111111..........
- 29:..........1111111111111111111...........
- 28:..........111111111111111111............
- 27:..........11111111111111111.............
- 26:..........1111111111111111..............
- 25:..........111111111111111...............
- 24:..........11111111111111................
- 23:..........1111111111111.................
- 22:..........111111111111..................
- 21:..........11111111111...................
- 20:..........1111111111....................
- 19:..........111111111.....................
- 18:..........11111111......................
- 17:..........1111111.......................
- 16:..........111111........................
- 15:..........11111.........................
- 14:..........1111..........................
- 13:..........111...........................
- 12:..........11............................)WR(
- 11:..........1.............................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-Note that polygons can get twisted upon themselves if edge lines
-cross. Thus:
-) 1 37 PR( POL \20110,10, 20,20, 20,10, 10,20\202)RP(
-will produce an area which is two triangles, like butterfly wings, as shown
-below:
-
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:........................................
- 24:........................................
- 23:........................................
- 22:........................................
- 21:........................................
- 20:........................................
- 19:..........1........1....................
- 18:..........11......11....................
- 17:..........111....111....................
- 16:..........1111..1111....................
- 15:..........1111111111....................
- 14:..........1111..1111....................
- 13:..........111....111....................
- 12:..........11......11....................)WR(
- 11:..........1........1....................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-
-)2 1 1 HR(
-)0 P(The following are combinations of pie with different shapes
-\201called "panda" for "Pie AND Annulus"\202 allow for easy specification of
-radial sections:
-) 6 76 PR( shape: arguments:
- ----- ---------
- PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad \201ang\202 # box
- EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad \201ang\202 # ellipse)RP(
-
-The )BD(panda)ES( \201)BD(P)ES(ies )BD(AND)ES( )BD(A)ES(nnuli\202 shape can be
-used to create combinations of pie and annuli markers. It is analogous
-to a Cartesian product on those shapes, i.e., the result is several
-shapes generated by performing a boolean AND between pies and
-annuli. Thus, the panda and cpanda specify combinations of annulus and
-circle with pie, respectively and give identical results. The bpanda
-combines box and pie, while epanda combines ellipse and pie.
-
-)0 P(Consider the example shown below:
-) 1 31 PR( PANDA\20120,20, 0,360,3, 0,15,4\202)RP(
-Here, 3 pie slices centered at 20, 20 are combined with 4 annuli, also
-centered at 20, 20. The result is a mask with 12 regions \201displayed in
-base 16 to save characters\202:
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:..............44444444444...............
- 33:............444444444444444.............
- 32:...........88444444444444444............
- 31:.........888844443333344444444..........
- 30:........88888833333333333444444.........
- 29:........88888733333333333344444.........
- 28:.......8888877733333333333344444........
- 27:......888887777332222233333344444.......
- 26:......888877777622222222333334444.......
- 25:.....88887777766622222222333334444......
- 24:.....88887777666622222222233334444......
- 23:.....88887777666651111222233334444......
- 22:.....88877776666551111122223333444......
- 21:.....88877776666555111122223333444......
- 20:.....888777766665559999aaaabbbbccc......
- 19:.....888777766665559999aaaabbbbccc......
- 18:.....888777766665599999aaaabbbbccc......
- 17:.....88887777666659999aaaabbbbcccc......
- 16:.....888877776666aaaaaaaaabbbbcccc......
- 15:.....888877777666aaaaaaaabbbbbcccc......
- 14:......8888777776aaaaaaaabbbbbcccc.......
- 13:......888887777bbaaaaabbbbbbccccc.......
- 12:.......88888777bbbbbbbbbbbbccccc........)WR(
- 11:........888887bbbbbbbbbbbbccccc.........
- 10:........888888bbbbbbbbbbbcccccc.........
- 9:.........8888ccccbbbbbcccccccc..........
- 8:...........88ccccccccccccccc............
- 7:............ccccccccccccccc.............
- 6:..............ccccccccccc...............
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-
-)2 1 1 HR(
-)0 P(Several regions with different mask values can be combined in the
-same mask. This supports comparing data from the different regions.
-\201For information on how to combine different shapes into a single
-region, see "help regalgebra".\202 For example, consider the following
-set of regions:
-) 3 24 PR( ANNULUS 25 25 5 10
- ELLIPSE 20 20 5 10 315
- BOX 15 15 5 10)RP(
-The resulting mask will look as follows:
-
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:....................111111111...........
- 33:...................11111111111..........
- 32:.................111111111111111........
- 31:.................111111111111111........
- 30:................11111111111111111.......
- 29:...............1111111.....1111111......
- 28:...............111111.......111111......
- 27:...............11111.222222..11111......
- 26:...............111112222222..11111......
- 25:...............111112222222..11111......
- 24:...............111112222222..11111......
- 23:...............111112222222..11111......
- 22:...............111111222222.111111......
- 21:..............211111112222.1111111......
- 20:............322211111111111111111.......
- 19:............32222111111111111111........
- 18:............22222111111111111111........
- 17:............222222211111111111..........
- 16:............22222222111111111...........
- 15:............222222222...................
- 14:............22222222....................
- 13:............222222......................
- 12:............33333.......................)WR(
- 11:............33333.......................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-Note that when a pixel is in 2 or more regions, it is arbitrarily
-assigned to a one of the regions in question \201often based on how a
-give C compiler optimizes boolean expressions\202.
-
-)0 P()0 2 120 H(Region)WB 199 Sn( accelerators)EH(
-
-)0 P(Two types of \200fBaccelerators)ES(, to simplify region specification,
-are provided as natural extensions to the ways shapes are described.
-These are: extended lists of parameters, specifying multiple regions,
-valid for annulus, box, circle, ellipse, pie, and points; and
-)BD(n=)ES(, valid for annulus, box, circle, ellipse, and pie \201not
-point\202. In both cases, one specification is used to define several
-different regions, that is, to define shapes with different mask
-values in the region mask.
-
-)0 P(The following regions accept )BD(accelerator)ES( syntax:
-) 13 73 PR( shape arguments
- ----- ------------------------------------------
- ANNULUS xcenter ycenter radius1 radius2 ... radiusn
- ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn \201angle\202
- BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] \201angle\202
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn \201angle\202
- ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] \201angle\202
- PIE xcenter ycenter angle1 angle2 \201angle3\202 \201angle4\202 \201angle5\202 ...
- PIE xcenter ycenter angle1 angle2 \201n=[number]\202
- POINT x1 y1 x2 y2 ... xn yn)RP(
-Note that the circle accelerators are simply aliases for the annulus
-accelerators.
-
-)0 P(For example, several annuli at the same center can be specified in one
-region expression by specifying more than two radii. If )BD(N)ES(
-radii are specified, then )BD(N)ES(-1 annuli result, with the outer
-radius of each preceding annulus being the inner radius of the
-succeeding annulus. Each annulus is considered a separate region, and
-is given a separate mask value. For example,
-) 1 30 PR( ANNULUS 20 20 0 2 5 10 15 20)RP(
-specifies five different annuli centered at 20 20, and is equivalent to:
-) 5 25 PR( ANNULUS 20.0 20.0 0 2
- ANNULUS 20.0 20.0 2 5
- ANNULUS 20.0 20.0 5 10
- ANNULUS 20.0 20.0 10 15
- ANNULUS 20.0 20.0 15 20)RP(
-The mask is shown below:
-
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:.............5555555555555..............
- 38:...........55555555555555555............
- 37:.........555555555555555555555..........
- 36:........55555555555555555555555.........
- 35:......555555555555555555555555555.......
- 34:.....55555555544444444444555555555......
- 33:....5555555544444444444444455555555.....
- 32:....5555555444444444444444445555555.....
- 31:...555555444444444444444444444555555....
- 30:..55555544444444444444444444444555555...
- 29:..55555544444443333333334444444555555...
- 28:.5555554444444333333333334444444555555..
- 27:.5555544444433333333333333344444455555..
- 26:555555444444333333333333333444444555555.
- 25:555554444443333333333333333344444455555.
- 24:555554444433333332222233333334444455555.
- 23:555554444433333322222223333334444455555.
- 22:555554444433333222222222333334444455555.
- 21:555554444433333222111222333334444455555.
- 20:555554444433333222111222333334444455555.
- 19:555554444433333222111222333334444455555.
- 18:555554444433333222222222333334444455555.
- 17:555554444433333322222223333334444455555.
- 16:555554444433333332222233333334444455555.
- 15:555554444443333333333333333344444455555.
- 14:555555444444333333333333333444444555555.
- 13:.5555544444433333333333333344444455555..
- 12:.5555554444444333333333334444444555555..)WR(
- 11:..55555544444443333333334444444555555...
- 10:..55555544444444444444444444444555555...
- 9:...555555444444444444444444444555555....
- 8:....5555555444444444444444445555555.....
- 7:....5555555544444444444444455555555.....
- 6:.....55555555544444444444555555555......
- 5:......555555555555555555555555555.......
- 4:........55555555555555555555555.........
- 3:.........555555555555555555555..........
- 2:...........55555555555555555............
- 1:.............5555555555555..............)RP(
-
-)0 P(For boxes and ellipses, if an odd number of arguments is specified,
-then the last argument is assumed to be an angle. Otherwise, the
-angle is assumed to be zero. For example:
-) 1 38 PR( ellipse 20 20 3 5 6 10 9 15 12 20 45)RP(
-specifies an 3 ellipses at a 45 degree angle:
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........33333333........................
- 35:......333333333333......................
- 34:.....3333333333333333...................
- 33:....333333333333333333..................
- 32:....33333332222233333333................
- 31:...3333332222222222333333...............
- 30:...33333222222222222233333..............
- 29:...333332222222222222223333.............
- 28:...3333222222211112222223333............
- 27:...33332222211111111222223333...........
- 26:...333322222111111111122223333..........
- 25:...3333222211111111111122223333.........
- 24:....3332222111111..1111122223333........
- 23:....333322211111.....11112222333........
- 22:....33332222111.......11112223333.......
- 21:.....33322221111.......11122223333......
- 20:.....33332221111.......11112223333......
- 19:.....33332222111.......11112222333......
- 18:......33332221111.......11122223333.....
- 17:.......33322221111.....111112223333.....
- 16:.......3333222211111..1111112222333.....
- 15:........3333222211111111111122223333....
- 14:.........333322221111111111222223333....
- 13:..........33332222211111111222223333....
- 12:...........3333222222111122222223333....)WR(
- 11:............333322222222222222233333....
- 10:.............33333222222222222233333....
- 9:..............3333332222222222333333....
- 8:...............33333333222223333333.....
- 7:.................333333333333333333.....
- 6:..................3333333333333333......
- 5:.....................333333333333.......
- 4:.......................33333333.........
- 3:........................................
- 2:........................................
- 1:........................................)RP(
-Note in the above example that the lower limit is not part of the
-region for boxes, circles, and ellipses. This makes circles and annuli
-equivalent, i.e.:
-) 2 26 PR( circle 20 20 5 10 15 20
- annulus 20 20 5 10 15 20)RP(
-both give the following region mask:
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:.............3333333333333..............
- 38:...........33333333333333333............
- 37:.........333333333333333333333..........
- 36:........33333333333333333333333.........
- 35:......333333333333333333333333333.......
- 34:.....33333333322222222222333333333......
- 33:....3333333322222222222222233333333.....
- 32:....3333333222222222222222223333333.....
- 31:...333333222222222222222222222333333....
- 30:..33333322222222222222222222222333333...
- 29:..33333322222221111111112222222333333...
- 28:.3333332222222111111111112222222333333..
- 27:.3333322222211111111111111122222233333..
- 26:333333222222111111111111111222222333333.
- 25:333332222221111111111111111122222233333.
- 24:33333222221111111.....11111112222233333.
- 23:3333322222111111.......1111112222233333.
- 22:333332222211111.........111112222233333.
- 21:333332222211111.........111112222233333.
- 20:333332222211111.........111112222233333.
- 19:333332222211111.........111112222233333.
- 18:333332222211111.........111112222233333.
- 17:3333322222111111.......1111112222233333.
- 16:33333222221111111.....11111112222233333.
- 15:333332222221111111111111111122222233333.
- 14:333333222222111111111111111222222333333.
- 13:.3333322222211111111111111122222233333..
- 12:.3333332222222111111111112222222333333..)WR(
- 11:..33333322222221111111112222222333333...
- 10:..33333322222222222222222222222333333...
- 9:...333333222222222222222222222333333....
- 8:....3333333222222222222222223333333.....
- 7:....3333333322222222222222233333333.....
- 6:.....33333333322222222222333333333......
- 5:......333333333333333333333333333.......
- 4:........33333333333333333333333.........
- 3:.........333333333333333333333..........
- 2:...........33333333333333333............
- 1:.............3333333333333..............)RP(
-
-)0 P(As a final example, specifying several angles in one pie slice
-expression is equivalent to specifying several separate slices with
-the same center. As with the annulus, if )BD(N)ES( angles are
-specified, then )BD(N)ES(-1 slices result, with the ending angle of
-each preceding slice being the starting angle of the succeeding slice.
-Each slice is considered a separate region, and is given a separate
-mask value. For example,
-) 1 26 PR( PIE 12 12 315 45 115 270)RP(
-specifies three regions as shown below:
-) 42 51 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:2222222222222222222222222222222222222222
- 39:2222222222222222222222222222222222222221
- 38:2222222222222222222222222222222222222211
- 37:2222222222222222222222222222222222222111
- 36:2222222222222222222222222222222222221111
- 35:3222222222222222222222222222222222211111
- 34:3222222222222222222222222222222222111111
- 33:3322222222222222222222222222222221111111
- 32:3322222222222222222222222222222211111111
- 31:3332222222222222222222222222222111111111
- 30:3332222222222222222222222222221111111111
- 29:3333222222222222222222222222211111111111
- 28:3333222222222222222222222222111111111111
- 27:3333322222222222222222222221111111111111
- 26:3333322222222222222222222211111111111111
- 25:3333322222222222222222222111111111111111
- 24:3333332222222222222222221111111111111111
- 23:3333332222222222222222211111111111111111
- 22:3333333222222222222222111111111111111111
- 21:3333333222222222222221111111111111111111
- 20:3333333322222222222211111111111111111111
- 19:3333333322222222222111111111111111111111
- 18:3333333332222222221111111111111111111111
- 17:3333333332222222211111111111111111111111
- 16:3333333333222222111111111111111111111111
- 15:3333333333222221111111111111111111111111
- 14:3333333333322211111111111111111111111111
- 13:3333333333322111111111111111111111111111
- 12:33333333333.1111111111111111111111111111)WR(
- 11:3333333333331111111111111111111111111111
- 10:333333333333.111111111111111111111111111
- 9:333333333333..11111111111111111111111111
- 8:333333333333...1111111111111111111111111
- 7:333333333333....111111111111111111111111
- 6:333333333333.....11111111111111111111111
- 5:333333333333......1111111111111111111111
- 4:333333333333.......111111111111111111111
- 3:333333333333........11111111111111111111
- 2:333333333333.........1111111111111111111
- 1:333333333333..........111111111111111111)RP(
-
-)0 P(The annulus, box, circle, ellipse, and pie shapes also accept an
-)BD(n=[int])ES( syntax for specifying multiple regions. The
-)BD(n=[int])ES(syntax interprets the previous \201shape-dependent\202
-arguments as lower and upper limits for the region and creates n
-shapes with evenly spaced boundaries. For example, if )BD(n=[int])ES(
-is specified in an annulus, the two immediately preceding radii
-\201)BD(rn)ES( and )BD(rm)ES(\202 are divided into )BD(int)ES( annuli, such
-that the inner radius of the first is )BD(rn)ES( and the outer radius
-of the last is )BD(rm)ES(. For example,
-) 1 24 PR( ANNULUS 20 20 5 20 n=3)RP(
-is equivalent to:
-) 1 26 PR( ANNULUS 20 20 5 10 15 20)RP(
-If this syntax is used with an ellipse or box, then the two preceding
-pairs of values are taken to be lower and upper limits for a set of
-ellipses or boxes. A circle uses the two preceding arguments for upper
-and lower radii. For pie, the two preceding angles are divided into n
-wedges such that the starting angle of the first is the lower bound
-and the ending angle of the last is the upper bound. In all cases,
-the )BD(n=[int])ES( syntax allows any single alphabetic character
-before the "=", i.e, i=3, z=3, etc. are all equivalent.
-
-)0 P(Also note that for boxes and ellipses, the optional angle argument is
-always specified after the )BD(n=[int])ES( syntax. For example:
-) 45 57 PR( ellipse 20 20 4 6 16 24 n=3 45
-) 44 57 PR(specifies 3 elliptical regions at an angle of 45 degrees:
-
-) 42 45 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........33333333........................
- 39:.....33333333333333.....................
- 38:....33333333333333333...................
- 37:...33333333333333333333.................
- 36:..33333333333333333333333...............
- 35:.3333333333222223333333333..............
- 34:3333333322222222222233333333............
- 33:33333332222222222222223333333...........
- 32:333333222222222222222222333333..........
- 31:3333322222222222222222222333333.........
- 30:33333222222222111122222222333333........
- 29:333332222222111111112222222333333.......
- 28:3333222222211111111111222222333333......
- 27:3333222222111111111111112222233333......
- 26:33332222221111111111111112222233333.....
- 25:33332222211111111.111111112222233333....
- 24:333322222111111......111111222223333....
- 23:333322222111111.......111112222233333...
- 22:33333222221111.........11111222223333...
- 21:333332222211111.........11112222233333..
- 20:.33332222211111.........11111222223333..
- 19:.33333222221111.........111112222233333.
- 18:..33332222211111.........11112222233333.
- 17:..333332222211111.......111111222233333.
- 16:...333322222111111......111111222223333.
- 15:...333332222211111111.111111112222233333)WR(
- 14:....333332222211111111111111122222233333)WR(
- 13:.....33333222221111111111111122222233333
- 12:.....33333322222211111111111222222233333)WR(
- 11:......3333332222222111111112222222333333
- 10:.......333333222222221111222222222333333
- 9:........33333322222222222222222222333333
- 8:.........333333222222222222222222333333.
- 7:..........33333332222222222222223333333.
- 6:...........3333333322222222222233333333.
- 5:.............3333333333222223333333333..
- 4:..............33333333333333333333333...
- 3:................33333333333333333333....
- 2:..................33333333333333333.....
- 1:....................33333333333333......)RP(
-
-)0 P(Both the variable argument syntax and the )BD(n=[int])ES( syntax must
-occur alone in a region descriptor \201aside from the optional angle for
-boxes and ellipses\202. They cannot be combined. Thus, it is not valid
-to precede or follow an )BD(n=[int])ES( accelerator with more angles or
-radii, as in this example:
-) 3 49 PR( # INVALID -- one too many angles before a=5 ...
- # and no angles are allowed after a=5
- PIE 12 12 10 25 50 a=5 85 135)RP(
-Instead, use three separate specifications, such as:
-) 3 21 PR( PIE 12 12 10 25
- PIE 12 12 25 50 a=5
- PIE 12 12 85 135)RP(
-The original \201IRAF\202 implementation of region filtering permitted this
-looser syntax, but we found it caused more confusion than it was worth
-and therefore removed it.
-
-)0 P(NB: Accelerators may be combined with other shapes in a boolean
-expression in any order. \201This is a change starting with funtools
-v1.1.1. Prior to this release, the accelerator shape had to be
-specified last\202. The actual region mask id values returned depend on the
-order in which the shapes are specified, although the total number of
-pixels or rows that pass the filter will be consistent. For this
-reason, use of accelerators in boolean expressions is discouraged in
-programs such as funcnts, where region mask id values are used
-to count events or image pixels.
-
-)0 P([All region masks displayed in this document were generated using the
-)BD(fundisp)ES( routine and the undocumented "mask=all" argument \201with
-spaced removed using sed \202:
-) 2 72 PR( fundisp "funtools/funtest/test40.fits[ANNULUS 25 25 5 10]" mask=all |\200
- sed 's/ //g')RP(
-Note that you must supply an image of the appropriate size -- in this case,
-a FITS image of dimension 40x40 is used.]
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 121 H(Last)WB 200 Sn( updated: March 12, 2007)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (regalgebra.html) D
-/Ti (Region Algebra) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 56 Sn(
-
-
-)0 2 122 H(RegAlgebra:)WB 202 Sn()WB 201 Sn( Boolean Algebra on Spatial Regions)EA()EH(
-
-
-)0 2 123 H(Summary)WB 203 Sn()EH(
-)0 P(This document describes the boolean arithmetic defined for
-region expressions.
-
-
-)0 2 124 H(Description)WB 204 Sn()EH(
-)0 P(When defining a region, several shapes can be combined using boolean
-operations. The boolean operators are \201in order of precedence\202:
-) 6 53 PR( Symbol Operator Associativity
- ------ -------- -------------
- ! not right to left
- & and left to right
- ^ exclusive or left to right
- | inclusive or left to right)RP(
-For example, to create a mask consisting of a large circle with a
-smaller box removed, one can use the )BD(and)ES( and )BD(not)ES(
-operators:
-) 1 36 PR( CIRCLE\20111,11,15\202 & !BOX\20111,11,3,6\202)RP(
-
-and the resulting mask is:
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:1111111111111111111111..................
- 2:1111111111111111111111..................
- 3:11111111111111111111111.................
- 4:111111111111111111111111................
- 5:111111111111111111111111................
- 6:1111111111111111111111111...............
- 7:1111111111111111111111111...............
- 8:1111111111111111111111111...............
- 9:111111111...1111111111111...............
- 10:111111111...1111111111111...............
- 11:111111111...1111111111111...............
- 12:111111111...1111111111111...............
- 13:111111111...1111111111111...............
- 14:111111111...1111111111111...............
- 15:1111111111111111111111111...............
- 16:1111111111111111111111111...............
- 17:111111111111111111111111................
- 18:111111111111111111111111................
- 19:11111111111111111111111.................
- 20:1111111111111111111111..................
- 21:1111111111111111111111..................
- 22:111111111111111111111...................
- 23:..11111111111111111.....................
- 24:...111111111111111......................
- 25:.....11111111111........................
- 26:........................................
- 27:........................................
- 28:........................................
- 29:........................................)WR(
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................)RP(
-A three-quarter circle can be defined as:
-) 1 40 PR( CIRCLE\20120,20,10\202 & !PIE\20120,20,270,360\202)RP(
-
-and looks as follows:
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:........................................
- 2:........................................
- 3:........................................
- 4:........................................
- 5:........................................
- 6:........................................
- 7:........................................
- 8:........................................
- 9:........................................
- 10:........................................
- 11:...............111111111................
- 12:..............11111111111...............
- 13:............111111111111111.............
- 14:............111111111111111.............
- 15:...........11111111111111111............
- 16:..........1111111111111111111...........
- 17:..........1111111111111111111...........
- 18:..........1111111111111111111...........
- 19:..........1111111111111111111...........
- 20:..........1111111111111111111...........
- 21:..........1111111111....................
- 22:..........1111111111....................
- 23:..........1111111111....................
- 24:..........1111111111....................
- 25:...........111111111....................
- 26:............11111111....................
- 27:............11111111....................
- 28:..............111111....................
- 29:...............11111....................)WR(
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................)RP(
-Two non-intersecting ellipses can be made into the same region:
-) 1 40 PR( ELL\20120,20,10,20,90\202 | ELL\2011,1,20,10,0\202)RP(
-
-and looks as follows:
-) 42 49 PR( 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:11111111111111111111....................
- 2:11111111111111111111....................
- 3:11111111111111111111....................
- 4:11111111111111111111....................
- 5:1111111111111111111.....................
- 6:111111111111111111......................
- 7:1111111111111111........................
- 8:111111111111111.........................
- 9:111111111111............................
- 10:111111111...............................
- 11:...........11111111111111111............
- 12:........111111111111111111111111........
- 13:.....11111111111111111111111111111......
- 14:....11111111111111111111111111111111....
- 15:..11111111111111111111111111111111111...
- 16:.1111111111111111111111111111111111111..
- 17:111111111111111111111111111111111111111.
- 18:111111111111111111111111111111111111111.
- 19:111111111111111111111111111111111111111.
- 20:111111111111111111111111111111111111111.
- 21:111111111111111111111111111111111111111.
- 22:111111111111111111111111111111111111111.
- 23:111111111111111111111111111111111111111.
- 24:.1111111111111111111111111111111111111..
- 25:..11111111111111111111111111111111111...
- 26:...11111111111111111111111111111111.....
- 27:.....11111111111111111111111111111......
- 28:.......111111111111111111111111.........
- 29:...........11111111111111111............)WR(
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................)RP(
-You can use several boolean operations in a single region expression,
-to create arbitrarily complex regions. With the important exception
-below, you can apply the operators in any order, using parentheses if
-necessary to override the natural precedences of the operators.
-
-)0 P(NB: Using a panda shape is always much more efficient than explicitly
-specifying "pie & annulus", due to the ability of panda to place a
-limit on the number of pixels checked in the pie shape. If you are
-going to specify the intersection of pie and annulus, use panda
-instead.
-
-)0 P(As described in "help regreometry", the )BD(PIE)ES( slice goes to the
-edge of the field. To limit its scope, )BD(PIE)ES( usually is is
-combined with other shapes, such as circles and annuli, using boolean
-operations. In this context, it is worth noting that that there is a
-difference between )BD(-PIE)ES( and )BD(&!PIE)ES(. The former is a
-global exclude of all pixels in the )BD(PIE)ES( slice, while the latter
-is a local excludes of pixels affecting only the region\201s\202 with which
-the )BD(PIE)ES( is combined. For example, the following region uses
-)BD(&!PIE)ES( as a local exclude of a single circle. Two other circles
-are also defined and are unaffected by the local exclude:
-) 21 56 PR( CIRCLE\2011,8,1\202
- CIRCLE\2018,8,7\202&!PIE\2018,8,60,120\202&!PIE\2018,8,240,300\202
- CIRCLE\20115,8,2\202
-
- 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- - - - - - - - - - - - - - - -
- 15: . . . . . . . . . . . . . . .
- 14: . . . . 2 2 2 2 2 2 2 . . . .
- 13: . . . 2 2 2 2 2 2 2 2 2 . . .
- 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 10: . . . . 2 2 2 2 2 2 2 . . . .
- 9: . . . . . . 2 2 2 . . . . 3 3
- 8: 1 . . . . . . . . . . . . 3 3
- 7: . . . . . . 2 2 2 . . . . 3 3
- 6: . . . . 2 2 2 2 2 2 2 . . . .
- 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 3: . . . 2 2 2 2 2 2 2 2 2 . . .
- 2: . . . . 2 2 2 2 2 2 2 . . . .
- 1: . . . . . . . . . . . . . . .)RP(
-Note that the two other regions are not affected by the )BD(&!PIE)ES(,
-which only affects the circle with which it is combined.
-
-)0 P(On the other hand, a )BD(-PIE)ES( is an global exclude that does
-affect other regions with which it overlaps:
-) 23 39 PR( CIRCLE\2011,8,1\202
- CIRCLE\2018,8,7\202
- -PIE\2018,8,60,120\202
- -PIE\2018,8,240,300\202
- CIRCLE\20115,8,2\202
-
- 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- - - - - - - - - - - - - - - -
- 15: . . . . . . . . . . . . . . .
- 14: . . . . 2 2 2 2 2 2 2 . . . .
- 13: . . . 2 2 2 2 2 2 2 2 2 . . .
- 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 10: . . . . 2 2 2 2 2 2 2 . . . .
- 9: . . . . . . 2 2 2 . . . . . .
- 8: . . . . . . . . . . . . . . .
- 7: . . . . . . 2 2 2 . . . . . .
- 6: . . . . 2 2 2 2 2 2 2 . . . .
- 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 3: . . . 2 2 2 2 2 2 2 2 2 . . .
- 2: . . . . 2 2 2 2 2 2 2 . . . .
- 1: . . . . . . . . . . . . . . .)RP(
-The two smaller circles are entirely contained within the two exclude
-)BD(PIE)ES( slices and therefore are excluded from the region.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 125 H(Last)WB 205 Sn( updated: November 17, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (regcoords.html) D
-/Ti (Spatial Region Coordinates) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 57 Sn(
-
-
-)0 2 126 H(RegCoords:)WB 207 Sn()WB 206 Sn( Spatial Region Coordinates)EA()EH(
-
-
-)0 2 127 H(Summary)WB 208 Sn()EH(
-)0 P(This document describes the specification of coordinate systems, and the
-interpretation of coordinate values, for spatial region filtering.
-
-
-)0 2 128 H(Pixel)WB 209 Sn( coordinate systems)EH(
-)0 P(The default coordinate system for regions is PHYSICAL, which means
-that region position and size values are taken from the original
-data. \201Note that this is a change from the original IRAF/PROS
-implementation, in which the IMAGE coordinate system was the default.\202
-PHYSICAL coordinates always refer to pixel positions on the original
-image \201using IRAF LTM and LTV keywords\202. With PHYSICAL coordinates,
-if a set of coordinates specifies the position of an object in an
-original FITS file, the same coordinates will specify the same object
-in any FITS derived from the original. Physical coordinates are
-invariant with blocking of FITS files or taking sections of images,
-even when a blocked section is written to a new file.
-
-)0 P(Thus, although a value in pixels refers, by default, to the PHYSICAL
-coordinate system, you may specify that position values refer to the
-image coordinate system using the )BD(global)ES( or )BD(local)ES(
-properties commands:
-
-) 2 23 PR( global coordsys image
- circle 512 512 100)RP(
-
-The )BD(global)ES( command changes the coordinate system for all
-regions that follow, while the )BD(local)ES( command changes the
-coordinate system only for the region immediately following:
-) 3 22 PR( local coordsys image
- circle 512 512 100
- circle 1024 1024 200)RP(
-This changes the coordinate system only for the region that follows.
-In the above example, the second region uses the global coordinate
-system \201PHYSICAL by default\202.
-
-)0 P()0 2 129 H(World)WB 210 Sn( Coordinate Systems)EH(
-
-If World Coordinate System information is contained in the data file
-being filtered, it also is possible to define regions using a sky
-coordinate system. Supported systems include:
-
-) 10 67 PR( name description
- ---- -----------
- PHYSICAL pixel coords of original file using LTM/LTV
- IMAGE pixel coords of current file
- FK4, B1950 sky coordinate systems
- FK5, J2000 sky coordinate systems
- GALACTIC sky coordinate systems
- ECLIPTIC sky coordinate systems
- ICRS currently same as J2000
- LINEAR linear wcs as defined in file)RP(
-
-In addition, two mosaic coordinate systems have been defined that
-utilize the \201evolving\202 IRAF mosaic keywords:
-
-) 4 68 PR( name description
- ---- -----------
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV)RP(
-Again, to use one of these coordinate systems, the )BD(global)ES( or
-)BD(local)ES( properties commands are used:
-
-) 1 26 PR( global coordsys galactic)RP(
-
-)0 2 130 H(WCS)WB 211 Sn( Positions and Sizes)EH(
-
-In addition to pixels, positional values in a WCS-enabled region can
-be specified using sexagesimal or degrees format:
-
-) 11 57 PR( position arguments description
- ------------------ -----------
- [num] context-dependent \201see below\202
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
- [num]:[num]:[num] hms for 'odd' position arguments
- [num]:[num]:[num] dms for 'even' position arguments
- [num]h[num]m[num]s explicit hms
- [num]d[num]m[num]s explicit dms)RP(
-
-If ':' is used as sexagesimal separator, the value is considered to be
-specifying hours/minutes/seconds if it is the first argument of a
-positional pair, and degrees/minutes/seconds for the second argument
-of a pair \201except for galactic coordinates, which always use degrees\202:
-
-) 7 78 PR( argument description
- ----------- -----------
- 10:20:30.0 10 hours, 20 minutes, 30 seconds for 1st positional argument
- 10 degrees, 20 minutes, 30 seconds for 2nd positional argument
- 10h20m30.0 10 hours, 20 minutes, 30 seconds
- 10d20m30.0 10 degrees, 20 minutes, 30 seconds
- 10.20d 10.2 degrees)RP(
-
-Similarly, the units of size values are defined by the formating
-character\201s\202 attached to a number:
-
-) 9 53 PR( size arguments description
- -------------- -----------
- [num] context-dependent \201see below\202
- [num]" arc seconds
- [num]' arc minutes
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels)RP(
-
-For example:
-) 8 34 PR( argument description
- ----------- -----------
- 10 ten pixels
- 10' ten minutes of arc
- 10" ten seconds of arc
- 10d ten degrees
- 10p ten pixels
- 0.5r half of a radian)RP(
-
-)0 P(An example of using sky coordinate systems follows:
-
-) 4 65 PR( global coordsys B1950
- -box 175.54d 20.01156d 10' 10'
- local coordsys J2000
- pie 179.57d 22.4d 0 360 n=4 && annulus 179.57d 22.4d 3' 24' n=5)RP(
-
-At the FK4 1950 coordinates 175.54d RA, 20.01156d DEC exclude a 10
-minute by 10 minute box. Then at the FK5 2000 coordinates 179.57d RA
-22.4d DEC draw a radial profile regions pattern with 4 quadrants and 5
-annuli ranging from 3 minutes to 24 minutes in diameter. In this
-example, the default coordinate system is overridden by the commands
-in the regions spec.
-
-)0 2 131 H(NB:)WB 212 Sn( The Meaning of Pure Numbers Are Context Sensitive)EH(
-
-)0 P(When a "pure number" \201i.e. one without a format directive such as 'd'
-for 'degrees'\202 is specified as a position or size, its interpretation
-depends on the context defined by the 'coordsys' keyword. In general,
-the rule is:
-
-)0 P()BD(All pure numbers have implied units corresponding to the current
-coordinate system.)ES(
-
-)0 P(If no coordinate system is explicitly specified, the default system is
-implicitly assumed to be PHYSICAL. In practice this means that for
-IMAGE and PHYSICAL systems, pure numbers are pixels. Otherwise,
-for all systems other than LINEAR, pure numbers are degrees. For
-LINEAR systems, pure numbers are in the units of the linear system.
-This rule covers both positions and sizes.
-
-)0 P(As a corollary, when a sky-formatted number is used with the IMAGE
-or PHYSICAL coordinate system \201which includes the default case of no
-coordsys being specified\202, the formatted number is assumed to be in
-the units of the WCS contained in the current file. If no sky WCS is
-specified, an error results.
-
-)0 P(Examples:
-
-) 2 43 PR( circle\201512,512,10\202
- ellipse 202.44382d 47.181656d 0.01d 0.02d)RP(
-
-)0 P(In the absence of a specified coordinate system, the circle uses the
-default PHYSICAL units of pixels, while the ellipse explicitly uses degrees,
-presumably to go with the WCS in the current file.
-
-) 5 43 PR( global coordsys=fk5
- global color=green font="system 10 normal"
- circle 202.44382 47.181656 0.01
- circle 202.44382 47.181656 10p
- ellipse\201512p,512p,10p,15p,20\202)RP(
-
-
-)0 P(Here, the circles use the FK5 units of degrees \201except for the
-explicit use of pixels in the second radius\202, while the ellipse
-explicitly specifies pixels. The ellipse angle is in degrees.
-
-)0 P(Note that Chandra data format appears to use "coordsys=physical"
-implicitly. Therefore, for most Chandra applications, valid regions
-can be generated safely by asking ds9 to save/display regions in
-pixels using the PHYSICAL coordsys.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 132 H(Last)WB 213 Sn( updated: November 17, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (regbounds.html) D
-/Ti (Spatial Region Boundaries) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 58 Sn(
-
-
-)0 2 133 H(RegBounds:)WB 215 Sn()WB 214 Sn( Region Boundaries)EA()EH(
-
-
-)0 2 134 H(Summary)WB 216 Sn()EH(
-Describes how spatial region boundaries are handled.
-
-
-)0 2 135 H(Description)WB 217 Sn()EH(
-)0 P(The golden rule for spatial region filtering was first enunciated by
-Leon VanSpeybroeck in 1986:
-
-)0 P()BD(Each photon will be counted once, and no photon will be counted
-more than once)ES(.
-
-)0 P(This means that we must be careful about boundary
-conditions. For example, if a circle is contained in an annulus such
-that the inner radius of the annulus is the same as the radius of the
-circle, then photons on that boundary must always be assigned to one
-or the other region. That is, the number of photons in both regions
-must equal the sum of the number of photons in each region taken
-separately.
-
-With this in mind, the rules for determining whether a boundary image
-pixel or table row are assigned to a region are defined below.
-
-)0 2 136 H(Image)WB 218 Sn( boundaries : radially-symmetric shapes \201circle, annuli, ellipse\202)EH(
-
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies non-radially-symmetric shapes. When a
-pixel center is exactly on the boundary, the pixel assignment rule is:
-
-)UL()-1 LI( the outer boundary of a symmetric shape does not include such pixels
-)-1 LI( the inner boundary of a symmetric shape \201annulus\202 includes such pixels)LU(
-
-In this way, an annulus with radius from 0 to 1, centered exactly on a
-pixel, includes the pixel on which it is centered, but none of its
-neighbors.
-
-These rules ensure that when defining concentric shapes, no pixels are
-omitted between concentric regions and no pixels are claimed by two
-regions. When applied to small symmetric shapes, the shape is less
-likely to be skewed, as would happen with non-radially-symmetric
-rules. These rules differ from the rules for box-like shapes, which
-are more likely to be positioned adjacent to one another.
-
-)0 2 137 H(Image)WB 219 Sn( Boundaries: non-radially symmetric shapes \201polygons, boxes\202)EH(
-
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies radially-symmetric shapes. When a pixel
-center is exactly on the boundary of a non-radially symmetric region,
-the pixel is included in the right or upper region, but not the left
-or lower region. This ensures that geometrically adjoining regions
-touch but don't overlap.
-
-)0 2 138 H(Row)WB 220 Sn( Boundaries are Analytic)EH(
-
-When filtering table rows, the boundary rules are the same as for
-images, except that the calculation is not done on the center of a
-pixel, \201since table rows, especially X-ray events rows, often have
-discrete, floating point positions\202 but are calculated exactly. That
-is, an row is inside the boundary without regard to its integerized
-pixel value. For rows that are exactly on a region boundary, the
-above rules are applied to ensure that all rows are counted once and
-no row is counted more than once.
-
-)0 P(Because row boundaries are calculated differently from image boundaries,
-certain programs will give different results when filtering the same
-region file. In particular, fundisp/funtable \201which utilize analytic
-row filtering\202 perform differently from funcnts \201which performs image
-filtering, even on tables\202.
-
-)0 2 139 H(Image)WB 221 Sn( Boundaries vs. Row Boundaries: Practical Considerations)EH(
-
-)0 P(You will sometimes notice a discrepancy between running funcnts on an
-binary table file and running fundisp on the same file with the same filter.
-For example, consider the following:
-) 2 49 PR( fundisp test1.fits"[box\2014219,3887,6,6,0\202]" | wc
- 8893 320148 3752846)RP(
-Since fundisp has a 2-line header, there are actually 8891 photons
-that pass the filter. But then run funtable and select only the
-rows that pass this filter, placing them in a new file:
-) 1 58 PR( ./funtable test1.fits"[box\2014219,3887,6,6,0\202]" test2.fits)RP(
-Now run funcnts using the original filter on the derived file:
-) 12 61 PR( ./funcnts test2.fits "physical; box\2014219,3887,6,6,0\202"
-
- [... lot of processed output ...]
-
- # the following source and background components were used:
- source region\201s\202
- ----------------
- physical; box\2014219,3887,6,6,0\202
-
- reg counts pixels
- ---- ------------ ---------
- 1 7847.000 36)RP(
-There are 1044 rows \201events\202 that pass the row filter in fundisp \201or
-funtable\202 but fail to make it through funcnts. Why?
-
-)0 P(The reason can be traced to how analytic row filtering \201fundisp, funtable\202
-differs from integerized pixel filtering\201funcnts, funimage\202. Consider the
-region:
-) 1 22 PR( box\2014219,3887,6,6,0\202)RP(
-Analytically \201i.e., using row filtering\202, positions will pass this
-filter successfully if:
-) 2 19 PR( 4216 <= x <= 4222
- 3884 <= y <= 3890)RP(
-For example, photons with position values of x=4216.4 or y=3884.08 will pass.
-
-)0 P(Integerized image filtering is different in that the pixels that will
-pass this filter have centers at:
-) 2 40 PR( x = 4217, 4218, 4219, 4220, 4221, 4222
- y = 3885, 3886, 3887, 3888, 3889, 3890)RP(
-Note that there are 6 pixels in each direction, as specified by the region.
-That means that positions will pass the filter successfully if:
-) 2 24 PR( 4217 <= \201int\202x <= 4222
- 3885 <= \201int\202y <= 3890)RP(
-Photons with position values of x=4216.4 or y=3884.08 will NOT pass.
-
-)0 P(Note that the position values are integerized, in effect, binned into
-image values. This means that x=4222.4 will pass this filter, but not
-the analytic filter above. We do this to maintain the design goal that
-either all counts in a pixel are included in an integerized filter, or
-else none are included.
-
-)0 P([It could be argued that the correct photon limits for floating point
-row data really should be:
-) 2 23 PR( 4216.5 <= x <= 4222.5
- 3884.5 <= y <= 3890.5)RP(
-since each pixel extends for .5 on either side of the center. We chose
-to the maintain integerized algorithm for all image-style filtering so
-that funcnts would give the exact same results regardless of whether
-a table or a derived non-blocked binned image is used.]
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 140 H(Last)WB 222 Sn( updated: November 16, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (regdiff.html) D
-/Ti (Differences Between Funtools and IRAF Regions) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 59 Sn(
-
-
-)0 2 141 H(RegDiff:Differences)WB 224 Sn()WB 223 Sn( Between Funtools and IRAF Regions)EA()EH(
-
-
-)0 2 142 H(Summary)WB 225 Sn()EH(
-Describes the differences between Funtools/ds9 regions and the old IRAF/PROS
-regions.
-
-
-)0 2 143 H(Description)WB 226 Sn()EH(
-)0 P(We have tried to make Funtools regions compatible with their
-predecessor, IRAF/PROS regions. For simple regions and simple boolean
-algebra between regions, there should be no difference between the two
-implementations. The following is a list of differences and
-incompatibilities between the two:
-
-)UL(
-)0 P()-1 LI(If a pixel is covered by two different regions expressions,
-Funtools assigns the mask value of the )BD(first)ES( region that
-contains that pixel. That is, successive regions )BD(do not)ES(
-overwrite previous regions in the mask, as was the case with the
-original PROS regions. This means that one must define overlapping
-regions in the reverse order in which they were defined in PROS. If
-region N is fully contained within region M, then N should be defined
-)BD(before)ES( M, or else it will be "covered up" by the latter. This
-change is necessitated by the use of optimized filter compilation, i.e.,
-Funtools only tests individual regions until a proper match is made.
-
-)0 P()-1 LI( The )BD(PANDA)ES( region has replaced the old PROS syntax in which
-a )BD(PIE)ES( accelerator was combined with an )BD(ANNULUS)ES( accelerator
-using )BD(AND)ES(. That is,
-) 1 48 PR( ANNULUS\20120,20,0,15,n=4\202 & PIE\20120,20,0,360,n=3\202)RP(
-has been replaced by:
-) 1 29 PR( PANDA\20120,20,0,360,3,0,15,4\202)RP(
-The PROS syntax was inconsistent with the meaning of the )BD(AND)ES( operator.
-
-)0 P()-1 LI( The meaning of pure numbers \201i.e., without format specifiers\202 in
-regions has been clarified, as has the syntax for specifying coordinate
-systems. See the general discussion on
-)0 54 1 A(Spatial Region Filtering)54 0 TN TL()Ec /AF f D(
-for more information.
-)LU(
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 144 H(Last)WB 227 Sn( updated: November 16, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (combo.html) D
-/Ti (Combining Region and Table Filters) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 60 Sn(
-
-
-)0 2 145 H(FunCombine:)WB 230 Sn()WB 228 Sn( Combining Region and Table Filters)EA()EH(
-
-
-)0 2 146 H(Summary)WB 231 Sn()EH(
-)0 P(This document discusses the conventions for combining region and table
-filters, especially with regards to the comma operator.
-
-
-
-)0 2 147 H(Comma)WB 232 Sn()WB 229 Sn( Conventions)EA()EH(
-)0 P(Filter specifications consist of a series of boolean expressions,
-separated by commas. These expressions can be table filters,
-spatial region filters, or combinations thereof. Unfortunately,
-common usage requires that the comma operator must act differently
-in different situations. Therefore, while its use is intuitive in
-most cases, commas can be a source of confusion.
-
-)0 P(According to long-standing usage in IRAF, when a comma separates two
-table filters, it takes on the meaning of a boolean )BD(and)ES(. Thus:
-) 1 24 PR( foo.fits[pha==1,pi==2])RP(
-is equivalent to:
-) 1 27 PR( foo.fits[pha==1 && pi==2])RP(
-
-When a comma separates two spatial region filters, however, it has
-traditionally taken on the meaning of a boolean )BD(or)ES(. Thus:
-) 1 46 PR( foo.fits[circle\20110,10,3\202,ellipse\20120,20,8,5\202])RP(
-is equivalent to:
-) 1 49 PR( foo.fits[circle\20110,10,3\202 || ellipse\20120,20,8,5\202])RP(
-\201except that in the former case, each region is given a unique id
-in programs such as funcnts\202.
-
-)0 P(Region and table filters can be combined:
-) 1 34 PR( foo.fits[circle\20110,10,3\202,pi=1:5])RP(
-or even:
-) 1 61 PR( foo.fits[pha==1&&circle\20110,10,3\202,pi==2&&ellipse\20120,20,8,5\202])RP(
-In these cases, it is not obvious whether the command should utilize an
-)BD(or)ES( or )BD(and)ES( operator. We therefore arbitrarily chose to
-implement the following rule:
-)UL()-1 LI( if both expressions contain a region, the operator used is )BD(or)ES(.
-)-1 LI( if one \201or both\202 expression\201s\202 does not contain a region, the operator
-used is )BD(and)ES(.)LU(
-This rule handles the cases of pure regions and pure column filters properly.
-It unambiguously assigns the boolean )BD(and)ES( to all mixed cases. Thus:
-) 1 34 PR( foo.fits[circle\20110,10,3\202,pi=1:5])RP(
-and
-) 1 34 PR( foo.fits[pi=1:5,circle\20110,10,3\202])RP(
-both are equivalent to:
-) 1 37 PR( foo.fits[circle\20110,10,3\202 && pi=1:5])RP(
-
-)0 P([NB: This arbitrary rule )BD(replaces the previous arbitrary rule)ES(
-\201pre-funtools 1.2.3\202 which stated:
-)UL()-1 LI( if the 2nd expression contains a region, the operator used is )BD(or)ES(.
-)-1 LI( if the 2nd expression does not contain a region, the operator
-used is )BD(and)ES(.)LU(
-In that scenario, the )BD(or)ES( operator was implied by:
-) 1 21 PR( pha==4,circle 5 5 1)RP(
-while the )BD(and)ES( operator was implied by
-) 1 21 PR( circle 5 5 1,pha==4)RP(
-Experience showed that this non-commutative treatment of the comma
-operator was confusing and led to unexpected results.]
-
-)0 P(The comma rule must be considered provisional: comments and complaints
-are welcome to help clarify the matter. Better still, we recommend
-that the comma operator be avoided in such cases in favor of an
-explicit boolean operator.
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 148 H(Last)WB 233 Sn( updated: November 16, 2005)EH(
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (env.html) D
-/Ti (Funtools Environment Variables) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 61 Sn(
-
-
-)0 2 149 H(FunEnv:)WB 235 Sn()WB 234 Sn( Funtools Environment Variables)EA()EH(
-
-
-)0 2 150 H(Summary)WB 236 Sn()EH(
-Describes the environment variables which can be used to tailor the overall
-Funtools environment.
-
-
-)0 2 151 H(Description)WB 237 Sn()EH(
-)0 P(The following environment variables are supported by Funtools:
-)0 DL()0 P()0 DT()BD(FITS_EXTNAME)ES(
-)DD( The )BD(FITS_EXTNAME)ES( environment variable specifies the
-default FITS extension name when )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( is called on a file lacking
-a primary image. Thus,
-) 1 29 PR( setenv FITS_EXTNAME "NEWEV")RP(
-will allow you to call )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( on files without specifying NEWEV in
-the
-)0 42 1 A(Funtools bracket specification)42 0 TN TL()Ec /AF f D(.
-If no FITS_EXTNAME variable is defined and the extension name also is
-not passed in the bracket specification, then the default will be to
-look for standard X-ray event table extension names "EVENTS" or
-"STDEVT" \201we are, after all, and X-ray astronomy group at heart!\202.
-
-)0 P()0 DT()BD(FITS_EXTNUM)ES(
-)DD( The )BD(FITS_EXTNUM)ES( environment variable specifies the
-default FITS extension number when )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( is called on a file lacking
-a primary image. Thus,
-) 1 22 PR( setenv FITS_EXTNUM 7)RP(
-will allow you to call )0 25 1 A(FunOpen\201\202)25 0 TN TL()Ec /AF f D( on files to open the seventh
-extension without specifying the number in the
-)0 42 1 A(Funtools bracket specification)42 0 TN TL()Ec /AF f D(.
-
-)0 P()0 DT()BD(FITS_BINCOLS)ES( and )BD(EVENTS_BINCOLS)ES(
-)DD( These environment variable specifies the default binning key for
-FITS binary tables and raw event files, respectively. They can be
-over-ridden using the )BD(bincols=[naxis1,naxis2])ES( keyword in a
-)0 42 1 A(Funtools bracket specification)42 0 TN TL()Ec /AF f D(.
-The value of each environment variable
-is a pair of comma-delimited columns, enclosed in parentheses, to use
-for binning. For example, if you want to bin on detx and dety by
-default, then use:
-) 1 35 PR( setenv FITS_BINCOLS "\201detx,dety\202")RP(
-in preference to adding a bincols specification to each filename:
-) 1 31 PR( foo.fits[bincols=\201detx,dety\202])RP(
-
-)0 P()0 DT()BD(FITS_BITPIX)ES( and )BD(EVENTS_BITPIX)ES(
-)DD( These environment variable specifies the default bitpix value for
-binning FITS binary tables and raw event files, respectively. They can
-be over-ridden using the )BD(bitpix=[value])ES( keyword in a
-)0 42 1 A(Funtools bracket specification)42 0 TN TL()Ec /AF f D(. The value
-of each environment variable is one of the standard FITS bitpix values
-\2018,16,32,-32,-64\202. For example, if you want binning routines to
-create a floating array, then use:
-) 1 24 PR( setenv FITS_BITPIX -32)RP(
-in preference to adding a bitpix specification to each filename:
-) 1 22 PR( foo.fits[bitpix=-32])RP(
-
-)0 P()0 DT()BD(ARRAY)ES(
-)DD( The )BD(ARRAY)ES( environment variable specifies the default
-definition of an array file for Funtools.
-It is used if there is no array specification passed in the
-)BD(ARRAY\201\202)ES( directive in a
-)0 46 1 A(Non-FITS Array specification)46 0 TN TL()Ec /AF f D(.
-The value of the environment variable is a valid array specification such as:
-) 2 25 PR( setenv ARRAY "s100.150"
- foo.arr[ARRAY\201\202])RP(
-This can be defined in preference to adding the specification to each filename:
-) 1 26 PR( foo.arr[ARRAY\201s100.150\202])RP(
-
-)0 P()0 DT()BD(EVENTS)ES(
-)DD( The )BD(EVENTS)ES( environment variable specifies the default
-definition of an raw event file for Funtools.
-It is used if there is no EVENTS specification passed in the
-)BD(EVENTS\201\202)ES( directive in a
-)0 45 1 A(Non-FITS EVENTS specification)45 0 TN TL()Ec /AF f D(.
-The value of the environment variable is a valid EVENTS specification such as:
-) 2 73 PR( setenv EVENTS "x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024"
- foo.ev[EVENTS\201\202])RP(
-This can be defined in preference to adding the specification to each filename:
-) 1 73 PR( foo.ev[EVENTS\201x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024\202])RP()LD(
-
-The following filter-related environment variables are supported by Funtools:
-)0 DL(
-)0 P()0 DT()BD(FILTER_PTYPE)ES(
-)DD( The )BD(FILTER_PTYPE)ES( environment variable specifies how to
-build a filter. There are three possible methods:
-)0 DL()0 DT(process or p
-)DD(The filter is compiled and linked against the funtools library \201which
-must therefore be accessible in the original install directory\202 to produce
-a slave program. This program is fed events or image data and returns
-filter results.
-
-)0 DT(dynamic or d \201gcc only\202
-)DD(The filter is compiled and linked against the funtools library \201which
-must therefore be accessible in the original install directory\202 to produce
-a dynamic shared object, which is loaded into the funtools program and
-executed as a subroutine. \201Extensive testing has shown that, contrary to
-expectations, this method is no faster than using a slave process.\202
-
-)0 DT(contained or c
-)DD(The filter and all supporting region code is compiled and linked
-without reference to the funtools library to produce a slave program
-\201which is fed events or image data and returns filter results\202. This method
-is slower than the other two, because of the time it takes to compile the
-region filtering code. It is used by stand-alone programs such as ds9,
-which do not have access to the funtools library.)LD(
-
-By default, )BD(dynamic)ES( is generally used for gcc compilers and
-)BD(process)ES( for other compilers. However the filter building algorithm
-will check for required external files and will use )BD(contained)ES( is
-these are missing.
-
-)0 P()0 DT()BD(FUN_MAXROW)ES(
-)DD( The )BD(FUN_MAXROW)ES( environment variable is used by core
-row-processing Funtools programs \201funtable, fundisp, funcnts, funhist,
-funmerge, and funcalc\202 to set the maximum number of rows read at once
-\201i.e. it sets the third argument to the FunTableRowGet\201\202 call\202. The
-default is 8192. Note that this variable is a convention only: it will
-not be a part of a non-core Funtools program unless code is explicitly
-added, since each call to FunTableRowGet\201\202 specifies its own maximum
-number of rows to read. NB: if you make this value very large, you
-probably will need to increase )BD(FUN_MAXBUFSIZE)ES( \201see below\202 as well.
-
-)0 P()0 DT()BD(FUN_MAXBUFSIZE)ES(
-)DD( The )BD(FUN_MAXBUFSIZE)ES( environment variable is used to limit the
-max buffer size that will be allocated to hold table row data. This
-buffer size is calculated to be the row size of the table multiplied
-by the maximum number of rows read at once \201see above\202. Since the
-row size is unlimited \201and we have examples of it being larger than 5
-Mb\202, it is possible that the total buffer size will exceed the machine
-capabilities. We therefore set a default value of 5Mb for the max buffer
-size, and adjust maxrow so that the total size calculated is less than
-this max buffer size. \201If the row size is greater than this max buffer
-size, then maxrow is set to 1.\202 This environment variable will change
-the max buffer size allowed.
-
-)0 P()0 DT()BD(FILTER_CC)ES(
-)DD( The )BD(FILTER_CC)ES( environment variable specifies the compiler to
-use for compiling a filter specification. You also can use the )BD(CC)ES(
-environment variable. If neither has been set, then gcc will be used
-if available. Otherwise cc is used if available.
-
-)0 P()0 DT()BD(FILTER_EXTRA)ES(
-)DD( The )BD(FILTER_EXTRA)ES( environment variable specifies extra options
-to add to a filter compile command line. In principle, you can add libraries,
-include files, and compiler switches. This variable should be used with care.
-
-)0 P()0 DT()BD(FILTER_TMPDIR)ES(
-)DD( The )BD(FILTER_TMPDIR)ES( environment variable specifies the temporary
-directory for filter compilation intermediate files. You also can use
-the )BD(TMPDIR)ES( and )BD(TMP)ES( variables. By default, /tmp is used
-as the temporary directory.
-
-)0 P()0 DT()BD(FILTER_KEEP)ES(
-)DD( The )BD(FILTER_KEEP)ES( environment variable specifies whether the
-intermediate filter files \201i.e. C source file and compile log file\202
-should be saved after a filter is built. The default is "false", so that
-these intermediate files are deleted. This variable is useful for debugging,
-but care should be taken to reset its value to false when debugging is
-complete.
-)LD(
-
-
-
-
-
-)0 P()0 0 1 A(Go to Funtools Help Index)0 0 TN TL()Ec /AF f D(
-
-)0 5 152 H(Last)WB 238 Sn( updated: November 16, 2005)EH(
-
-
-)WB NL
-/Cb Db D /Ct [16#00 16#00 16#00] D /Cl [16#00 16#00 16#00] D /CL -1 D Ct Sc
-DS
-/Ba f D /BO 0 D Bs
-/UR (changelog.html) D
-/Ti (Funtools ChangeLog) D
-/Au () D
-/Df f D
-/ME [()] D
-
-0 BO R
-()1 Sl()WB 62 Sn(
-)0 2 153 H(Funtools)WB 239 Sn( ChangeLog)EH(
-
-)0 P(This ChangeLog covers both the Funtools library and the suite of
-applications. It will be updated as we continue to develop and improve
-Funtools. The up-to-date version can be found
-)R5 2 A(here)EA(.
-[The changelog for the initial development of Funtools, covering the
-beta releases, can be found
-)R6 2 A(here)EA(.]
-
-)0 2 154 H()WB 240 Sn( Patch Release 1.4.5 \201internal ds9 release\202)EH(
-)UL()0 P()-1 LI( Removed permission checking from Find\201\202 on cygwin systems. This was broken
-by Windows 7.
-)0 P()-1 LI( Removed addition of -no-cpp-precomp flag from gcc 4.2 and beyond.)LU(
-
-)0 2 155 H()WB 241 Sn( Patch Release 1.4.4 \201internal ds9 release\202)EH(
-)UL()0 P()-1 LI( Fixed -J funcone, which was not properly outputting all rows.
-)0 P()-1 LI( Filter: when an image is flipped, the rotation angle must be reversed.
-)0 P()-1 LI( Filter: add support for windows-based ipc communication when using tcc
-compiler.)LU(
-
-)0 2 156 H()WB 242 Sn( Patch Release 1.4.3 \201internal ds9 release\202)EH(
-)UL()0 P()-1 LI( Filter: improve checks for existence of compiler, even if CC is set.
-)0 P()-1 LI( Change launch.h to xlaunch.h to avoid conflict with OS X.
-)0 P()-1 LI( handle flipped images in filtering)LU(
-
-)0 2 157 H()WB 243 Sn( Patch Release 1.4.2 \201internal ds9 release\202)EH(
-)UL()0 P(
-)-1 LI( Port to gcc 4.2.
-)0 P()-1 LI( Fix 1-byte filters on intel machines \201missing SW1 no-op\202.
-)0 P()-1 LI( Remove ambiguity from filt.l \201and calc.l\202 using [A-z] in a
-case-insensitive lexer.
-)0 P()-1 LI( In funsky, the default unit for RA was changed from hours to degrees.
-)0 P()-1 LI( Fixed bug in funtable in which TCRVL header values were output as strings.
-)0 P()-1 LI( Added support for running funtools filters in Rosetta \201i.e. running PPC
-executables on an Intel Mac\202 by sensing and handling data swap requirements.
-Only works with FILTER_PTYPE set to 'c' \201can't link against wrong architecture
-libraries\202.
-)0 P()-1 LI( Fixed bug in FITS library to allow "-" in extension names.
-)0 P()-1 LI( Code and documentation now agree that the copy extension specifier \201'+'\202
-comes after the extension name.)LU(
-
-)0 2 158 H()WB 244 Sn( Patch Release 1.4.1 \201internal ds9 release\202)EH(
-)UL()0 P()-1 LI( Modified internal Launch\201\202 routine to use posix_spawn\201\202, if necessary.
-This is required for OS X 10.5 \201leopard\202, which frowns upon use of fork\201\202
-and exec\201\202. Also modified zprocess routines to use Launch\201\202.)LU(
-
-)0 2 159 H()WB 245 Sn( Public Release 1.4.0 \20115 August 2007\202)EH(
-
-)UL()-1 LI( Public release of production-quality code, incorporating changes
-and improvements from previous beta releases, including:
-)UL()-1 LI( Support for access to ASCII text column files.
-)-1 LI( Support for fast indexed access of binary tables.
-)-1 LI( Support for database views of tables, i.e. pre-set values for the filter
- specification, the columns to activate, and display format.
-)-1 LI( New programs include funcone \201cone search\202, funindex \201create index files\202,
- and funcen \201calculate centroids within regions\202.)LU(
-)LU(
-
-)0 2 160 H()WB 246 Sn( Release 1.3.0b[n] \201mainly internal SAO beta releases\202)EH(
-)UL(
-)0 P()-1 LI( Added -F[c] switch to change the column delimiter to the
-specified character.
-
-)0 P()-1 LI( Extended fundisp's format switch \201-f\202 so that it can now handle complex
-formats such as 'x=sometext%3d- y=othertest%3d.ext'.
-
-)0 P()-1 LI( Added support for creating and processing 1D FITS images.
-
-)0 P()-1 LI( Added vcol=colname and vcol=/colname to filter specifications to
-support use of a third value column when binning 2D images.
-
-)0 P()-1 LI( Added switches to funcone to write out data rows are not within
-any cone \201-J, -X\202 and centers which have no close data rows \201-L\202.
-
-)0 P()-1 LI( In funjoin, added ability to specify a numeric tolerance for when joining
-two files.
-
-)0 P()-1 LI( shared memory support in gio now can create a shared segment if w+ is
-specified as the open mode.
-
-)0 P()-1 LI( Changed reggeometry man page so that examples correctly show angles
-going counter-clockwise from the x-axis instead of from the y-axis.
-
-)0 P()-1 LI( Added checks to funmerge to ensure that all files have the same columns.
-
-)0 P()-1 LI( Fixed bug in text support that prevented header-less files from being
-processed properly.
-
-)0 P()-1 LI( Added support for 64-bit images \201bitpix=64\202 and table columns \201TFORM=K\202.
-
-)0 P()-1 LI( Filter code was not applying bscale/bzero to columns.
-
-)0 P(
-)-1 LI( Fixed funimage bug that caused a .5/block error in WCS CRPIX values
-generated from binary tables.
-
-)0 P()-1 LI( Added feq\201a,b\202 and div\201a,b\202 macros to funcalc.
-
-)0 P()-1 LI( Added support for single-line #define to funcalc.
-
-)0 P()-1 LI( Updated wcs library to 3.6.6
-
-)0 P()-1 LI( Fix bug in funcen in which ra,dec was not being calculated correctly
-if physical and image coords did not match up.
-
-)0 P()-1 LI( The filter syntax "col1 = col2" now explicitly generates an error
-\201you really want to do "col1 == col2"\202.
-
-)0 P()-1 LI( Added -o switch to include offset from the nominal target position.
-
-)0 P()-1 LI( Fundisp now displays multi-dimensional vector columns properly.
-
-)0 P()-1 LI( Documented support for lists of files processed as a single file
-using "list: file1 ... filen" syntax.
-
-)0 P()-1 LI( Fixed bugs in support for pipe file type \201i.e. ability to pass
-commands as a filename using "pipe: cmd arg1 ... argn" syntax\202.
-
-)0 P()-1 LI( Fixed bug in funhist processing of image-based pixel histograms
-\201i.e using "xy" for columns\202 where a region was specified. All pixels
-outside the region were erroneously being added to the bin containing
-the 0 value.
-
-)0 P()-1 LI( Disabled multi-file processing in funds9, which was breaking support
-for pathnames containing spaces and is not used by ds9 anyway.
-
-)0 P()-1 LI( Added support for Views of tables, i.e. pre-set values for the
-filter specification, the columns to activate, and display format
-\201though the latter is for fundisp only\202.
-
-)0 P()-1 LI( Added -l switch to funimage to read x, y, val columns from a list.
-
-)0 P()-1 LI( Removed useless and meaningless section syntax foo'[*]' because it
-breaks pointer de-referencing on string columns \201i.e. foo'[*xxx=='a']'\202.
-Use foo'[*,*]' instead, as documented.
-
-)0 P()-1 LI( String variables were not always being terminated properly in the
-filter code because FITS 'A' data is not necessarily null-terminated.
-
-)0 P()-1 LI( Added funtools version number to all usage\201\202 displays.
-
-)0 P()-1 LI( Added explanation of switch arguments to many usage\201\202 displays.
-
-)0 P()-1 LI( The filter keyword row# now supports single row selection as well
-as range selection, i.e., "row#=100" along with previous "row#=100:200".
-
-)0 P()-1 LI( fundisp now outputs "0x" before hex values.
-
-)0 P()-1 LI( Fixed bug in filter parser which processed rangelists incorrectly
-if spaces were put into the rangelist \201i.e. "pha= 1 : 3" instead of
-pha=1:3\202.
-
-)0 P()-1 LI( Fixed a bug in funindex which created a wrongly named index file
-if more than one "." was in the input file name.
-
-)0 P()-1 LI( Added support to funcone to take ra, dec, radius from a list
-\201i.e. columns in a FITS file or a text file\202.
-
-)0 P()-1 LI( Fixed a bug in FunColumnActivate so that if some columns are
-explicitly activated while others are de-activated, only the
-explicitly activated columns are activated \201code was activating all
-columns in this case\202.
-
-)0 P()-1 LI( Fixed a bug in funindex which prevented indexing tables containing
-a column named N.
-
-)0 P()-1 LI( fundisp now encloses ASCII column values in single quotes \201unless
--T is specified to output RDB format\202.
-
-)0 P()-1 LI( If a filter specification only involves indexed columns, then the
-compiled filter is not used.
-
-)0 P()-1 LI( Funmerge can now be given a list of files to merge using @list syntax.
-Also removed the restriction on how many files can be merged \201was limited to
-the max number of open files\202.
-
-)0 P()-1 LI( Added ability to edit \201add, delete, modify\202 header parameters in funhead
-by specifying an output file \201editing acts as a filter\202 and an edit command
-file \201which can be stdin\202.
-
-)0 P()-1 LI( Funtools now contains preliminary code to support \201fast\202 indexed access
-of binary tables. See idx.html or "man funidx" for more details.
-
-)0 P()-1 LI( Funtools now contains preliminary code supporting access to ASCII
-column files. See text.html or "man funtext" for more details.
-
-)0 P()-1 LI( Fixed bug in funcalc in which columns used in an expression were
-always being replaced by new columns, with all associated parameters
-\201e.g. WCS\202 were being deleted. Now this only happens if the column
-explicitly changes its data type.
-
-)0 P()-1 LI( Fixed bug in funcalc in which the raw data and user data became out
-of sync for one row after every 8192 \201FUN_MAXROW\202 rows.
-
-)0 P()-1 LI( Fixed bug in gio in which gseek returned 0 instead of the current byte
-offset for disk files.
-
-)0 P()-1 LI( Added funcone program to perform cone search on RA, Dec columns in
-a FITS binary table.
-
-)0 P()-1 LI( Fixed bug in polygon, pie and rotated box region filtering for
-tables \201nearby rows exactly in line between two non-vertical or
-non-horizontal vertices were being accepted incorrectly\202.
-
-)0 P()-1 LI( Fixed pie and panda regions so that the angles now start from
-positive x axis == 0 degrees and run counter-clockwise, as
-documented. They were going from positive y. NB: a similar change
-was made to ds9 release 4.0b3. You must be using ds9 4.0b3 or later
-in order to have the correct behavior when generating regions in ds9
-and using them in funtools.
-
-)0 P()-1 LI( Added -p [prog] switch to funcalc to save the generated program.
-instead of executing \201and deleting\202 it.
-
-)0 P()-1 LI( Upgraded zlib to 1.2.3.
-)LU(
-
-)0 2 161 H()WB 247 Sn( Patch Release 1.2.4 \201internal SAO and beta release only\202)EH(
-)UL(
-)0 P()-1 LI( In funcalc, added support for user-specified arguments via the
--a [argstr] switch. These arguments are accessed in the compiled program
-using the supplied ARGC and ARGV\201n\202 macros.
-
-)0 P()-1 LI( Added -n \201no header display\202 to fundisp to skip outputting header.
-
-)0 P()-1 LI( Added checks for various types of blank filters.
-
-)0 P(
-)-1 LI( Added macros NROW \201current row number\202 and WRITE_ROW \201write current
-row to disk\202 to funcalc.
-
-)0 P()-1 LI( funcalc no longer requires that at least one data column be
-specified in the compiled expression.
-
-)0 P()-1 LI( Added FUN_NROWS to FunInfoGet\201\202 to return the total number of rows in
-an input table \201i.e. value of NAXIS2\202.
-
-)0 P(
-)-1 LI( The compiled funcalc program now includes stdlib.h and unistd.h.
-
-)0 P()-1 LI( The util/NaN.h header file is now modified at configure time to
-contain endian status for the target architecture. References to
-specific platforms have been removed.
-
-)0 P()-1 LI( Added -m switch to funtable to output multiple files, one for
-each input region \201and a separate file for events that pass the
-filters but are not in any region\202.
-
-)0 P()-1 LI( Added ability to add new parameters \201FunParamPutx\202 after writing
-data if space is previously reserved in the form of a blank parameter
-whose value is the name of the param to be updated. \201Also requires the
-append argument of FunParamPutx be set to 2\202.
-
-)0 P(
-)-1 LI( Added ability to build shared libraries. With --enable-shared=yes,
-shared library is built but not used. With --enable-shared=link,
-shared library is linked against \201requires proper installation and/or
-use of LD_LIBRARY_PATH\202.
-
-)0 P()-1 LI( Added -v [column] support to funcnts so that counts in a table
-can be accumulated using values from a specified column \201instead of
-the default case where an integral count is accumulated for each event
-in a region\202.
-
-)0 P()-1 LI( Added funcen program to calculate centroids within regions
-\201binary tables only\202. Also added support for a funcen-based centroid
-tool to funtools.ds9.
-
-)0 P()-1 LI( Fixed bug which prevented successful filtering of columns containing
-arrays.
-
-)0 P()-1 LI( Added filter check to ensure that a column is not incorrectly used
-as an array.
-
-)0 P()-1 LI( Fundisp now displays column arrays indexed from 0, not 1.
-
-)0 P()-1 LI( Added -i [interval] support to funcnts so that multiple intervals
-can be processed in a single pass through the data. For example,
-specifying -i "pha=1:5;pha=6:10;pha=11:15" will generate results in
-each of 3 pha bands.
-
-)0 P()-1 LI( Fixed calculation of LTV quantities when binning floating point
-column data \201value was off by 0.5\202.
-
-)0 P()-1 LI( Added support for 'D' in floating point header values.
-
-)0 P()-1 LI( Added -a switch to funimage and funtable to append output image or
-table to an existing FITS file \201as an IMAGE or BINTABLE extension\202.
-
-)0 P()-1 LI( Added support for column scaling \201TSCAL and TZERO\202 on input columns.
-Note that the default column type is changed to accommodate scaling \201e.g.
-a column of type 'I' is changed to 'J', 'J' is changed to 'D'\202 so that
-the scaled values can be handled properly by programs such as fundisp
-\201which utilize default types\202.
-
-)0 P(
-)-1 LI( Added support to FunColumnSelect\201\202 for handling structs of arrays
-\201i.e. where returned columns are contiguous\202 instead of the default array
-of structs \201returned row are contiguous\202. This is done by specifying
-"org=structofarrays" in the plist and passing a single struct containing
-the arrays.
-
-)0 P()-1 LI( When writing an rdb/starbase file, fundisp now outputs the full
-column name, regardless of the width of the column \201which ordinarily
-is truncated to match\202.
-
-)0 P()-1 LI( Fixed support for large files by changing all file positions variables
-from "long" declarations to "off_t.
-
-)0 P()-1 LI( Fixed bug in funcalc incorrectly processed multiple array
-references \201e.g. cur->foo[0]=cur->x;cur->foo[1]=cur->y;\202 within a single
-line of code.
-
-)0 P()-1 LI( Added FILTER_CFLAGS environment variable for all filtering. Also added
---with-filter-cc and --with-filter-cflags options on configure to allow
-specification of a default C compiler and associated CFLAGS for filtering.
-All of this is necessary in order to support 64-bit libraries under Solaris.
-
-)0 P()-1 LI( Added the funtbl script to extract a table from Funtools ASCII output.
-
-)0 P()-1 LI( Added code to funimage to update IRAF DATASEC keyword.
-
-)0 P()-1 LI( Added checks to ensure that image dimensions are positive.
-
-)0 P()-1 LI( Fixed a bug in funimage where int data was being scaled using BSCALE and
-BZERO but these keywords also were being retained in the output image header.
-Now the data are not scaled unless the output data type is float \201in which
-case the scaling parameters are removed\202.
-
-)0 P()-1 LI( Fixed a bug in funmerge which prevented merging of files unless one of
-the -f, -w, or -x switches were used.
-
-)0 P()-1 LI( Fixed a bug in funtable and fundisp which caused the special '$n' column
-to be output incorrectly.
-
-)0 P()-1 LI( Fixed sort option in funtable, which previously worked only if the
-record size was an even divisor of 8192 \201and returned garbage otherwise\202.
-
-)0 P()-1 LI( Fixed bug in filters involving FITS data type 'X' \201bitfield\202.
-
-)0 P()-1 LI( Fixed bug in funcnts in which the output angles and radii were
-being displayed incorrectly when multiple panda shapes were specified.
-
-)0 P()-1 LI( Fixed bug in pandas and pies using n= syntax when first angle
-specified was greater than second. The resulting mask was of
-the correct shape but contained only a single region.
-
-)0 P()-1 LI( Table row access routines will now decrease maxrows if memory cannot be
-allocated for maxrows*sizeof\201row\202, i.e. if the size of a row is so large that
-space for maxrows cannot be allocated.
-
-)0 P()-1 LI( The FUN_MAXBUFSIZE environment variable was added to limit the
-max buffer size that will be allocated to hold table row data. The
-default is 5Mb.
-
-)0 P()-1 LI( Generated PostScript and PDF versions of the help pages.
-
-)0 P()-1 LI( Moved OPTIONS section before \201often-lengthy\202 DESCRIPTION section in
-man pages.
-
-)0 P()-1 LI( All memory allocation now does error checking on the result
-\201except wcs library, which is external code\202.
-
-)0 P()-1 LI( Removed some compiler warnings that surfaced when using gcc -O2.
-
-)0 P()-1 LI( Updated wcs library to 3.5.5.
-
-)0 P()-1 LI( Upgraded zlib to 1.2.1.
-)LU(
-
-)0 2 162 H()WB 248 Sn( Patch Release 1.2.3 \20112 January 2004\202)EH(
-)UL(
-)0 P()-1 LI( Generated man pages from the html pages. These are installed
-automatically at build time.
-
-)0 P()-1 LI( Changed instances of sprintf\201\202 to snprintf\201\202 to protect
-against buffer overflow.
-
-)0 P()-1 LI( Fixed a number of compiler warnings in non-ANSI compilers.
-
-)0 P()-1 LI( Increased SZ_LINE parameter value from 1024 to 4096.
-)LU(
-
-)0 2 163 H()WB 249 Sn( Patch Release 1.2.3b1 \20119 August 2003\202)EH(
-)UL(
-)0 P()-1 LI( The rule for using comma to separate a table filter expression
-and a region expression has been changed. The rule now states:
-)UL()-1 LI( if both expressions contain a region, the operator used is )BD(or)ES(.
-)-1 LI( if one \201or both\202 expression\201s\202 does not contain a region, the operator
-used is )BD(and)ES(.)LU(
-This rule handles the cases of pure regions and pure column filters properly.
-It unambiguously assigns the boolean )BD(and)ES( to all mixed cases. Thus:
-) 1 34 PR( foo.fits[circle\20110,10,3\202,pi=1:5])RP(
-and
-) 1 34 PR( foo.fits[pi=1:5,circle\20110,10,3\202])RP(
-both are equivalent to:
-) 1 37 PR( foo.fits[circle\20110,10,3\202 && pi=1:5])RP(
-
-)0 P()-1 LI( When include files are used in filters, they now have implied
-parentheses surrounding them. Thus, if a region file foo.reg contains two
-regions \201e.g. circle 1 2 3 and circle 4 5 6\202, the syntax:
-) 1 21 PR( pha=4:5&&@foo.reg)RP(
-is equivalent to:
-) 1 42 PR( pha=4:5 && \201circle 1 2 3 || cir 4 5 6\202)RP(
-instead of:
-) 1 40 PR( pha=4:5 && circle 1 2 3 || cir 4 5 6)RP(
-and the pha filter is applied to both regions.
-
-)0 P()-1 LI( Filters and comments now can be terminated with the string
-literal "\200n" as well as ";" and the new-line character. This means
-that a region can have comments embedded in it:
-) 1 72 PR( funcnts foo.fits "circle 512 512 10 # color=red\200n circle 512 512 20")RP(
-
-)0 P()-1 LI( Added capability to update the value of an existing parameter
-after writing the table or image \201assuming the output image is a
-disk file or is being redirected into a file\202.
-
-)0 P()-1 LI( Improved handling of parentheses in filter expressions.
-
-)0 P(
-)-1 LI( Fixed a bug in image \201not event\202 regions in which circles and
-annuli with radius of 1 pixel were not being processed. No counts and
-no area would be found in such regions.
-
-)0 P()-1 LI( Fixed a bug in funcnts in which the radii column values for out of sync
-if multiple annuli were specified \201instead of a single varargs or accel
-annulus\202.
-
-)0 P()-1 LI( By default, fundisp will display integer image data as floats
-if the BSCALE and BZERO header parameters are present.
-
-)0 P()-1 LI( Added -L switch to funhead to output starbase list format.
-
-)0 P()-1 LI( Changed the name of the routine _FunColumnSelect to
-FunColumnSelectArr, in order to emphasize that it is not
-a private routine.
-
-)0 P()-1 LI( Funcalc now checks to ensure that a column was specified as part of
-the expression.
-
-)0 P()-1 LI( Funcalc local variables in the compiled program now use a "__" prefix
-to avoid conflicts with user-defined variables.
-
-)0 P()-1 LI( Unofficial unsigned short \201bitpix=-16\202 image data now is scaled
-correctly using BSCALE and BZERO header parameters.
-
-)0 P()-1 LI( Ported to Intel icc and gcc 3.3 compilers.
-
-)0 P()-1 LI( Updated wcs library to 3.5.1.
-
-)0 P()-1 LI( Changed license from public domain to GNU GPL.
-)LU(
-
-)0 2 164 H()WB 250 Sn( Patch Release 1.2.2 \20118 May 2003\202)EH(
-)UL(
-)0 P(
-)-1 LI( Fixed funcalc so that it now actually compiles an expression and
-runs it, instead of getting a "filter compilation error". Oops!
-
-)0 P()-1 LI( Fixed bug in FunOpen in which the bracket specification was being
-removed from the filename if a disk file was opened for "w" or "a".
-
-)0 P()-1 LI( Fixed bug in FunFlush which prevented two successive calls to
-FunImagePut from writing the second extension header properly.
-
-)0 P()-1 LI( All filter routines now use gerror\201stderr, ...\202 call instead of
-fprintf\201stderr, ...\202 so that output to stderr can be turned off \201via
-setgerror\201level\202 or GERROR environment variable\202.
-
-)0 P()-1 LI( All standard Funtools programs check for GERROR environment
-variable before setting gerror flag.
-
-)0 P()-1 LI( Some error messages about invalid region arguments were not being
-printed.
-
-)0 P()-1 LI( FITS parameters/headers now conform more closely to FITS standard:
-)UL()-1 LI( Blank keywords are treated in the same way as COMMENTS and HISTORY cards
-)-1 LI( XTENSION keywords are now exactly 8 characters long
-)-1 LI( 'E' is output instead of 'e' in floating point param values
-)-1 LI( PCOUNT and GCOUNT are output correctly for image extensions
-)-1 LI( EXTEND=T is output in primary header
-)-1 LI( COMMENTS and HISTORY start in column 9)LU(
-)LU(
-
-)0 2 165 H()WB 251 Sn( Patch Release 1.2.1 \20124 April 2003\202)EH(
-)UL(
-)0 P()-1 LI( Varargs ellipse and box annular regions were being
-processed incorrectly when the following conditions all were met:
-)UL()-1 LI( the region was specified in physical or wcs coordinates
-)-1 LI( the data file contained LTM/LTV keywords, i.e., it
-was blocked with respect to the original data file
-)-1 LI( the program being run was an image program \201e.g. funcnts, funimage\202)LU(
-Varargs ellipse and boxes are regions of the form:
-) 2 43 PR( ellipse x y a1 b1 a2 b2 ... an bn [angle]
- box x y l1 w1 l2 w2 ... ln wn [angle])RP(
-where at least 2 sets of axis \201length\202 values were specified to form
-an annulus \201i.e. simple ellipses and boxes worked properly\202. With all
-of the above conditions met, a region in physical coordinates saw its
-second length argument converted incorrectly from physical coordinates
-to image coordinates. In simple terms, this means that funcnts did not
-process elliptical or box regions in physical coords on blocked images
-properly. Note that blocking on the command line \201e.g. foo.fits[*,*,2]\202
-did work when no LTM/LTV keywords existed in the file.
-
-)0 P()-1 LI( The fundisp -f switch now supports specification of
-column-specific display formats as well as a more convenient way to
-specify datatype-specific display formats. Both use keyword=value
-specifiers. For columns, use:
-) 1 58 PR( fundisp -f "colname1=format1 colname2=format2 ..." ...)RP(
-e.g.
-) 1 40 PR( fundisp -f "time=%13.2f pha=%3d" ...)RP(
-You also can specify display formats for individual datatypes using the FITS
-binary table TFORM variables as the keywords:
-) 1 65 PR( fundisp -f "D=double_format E=float_format J=int_format etc.")RP(
-e.g.
-) 1 35 PR( fundisp -f "D=%13.2f I=%3d" ...)RP(
-The old position-dependent syntax is deprecated.
-
-)0 P()-1 LI( Fundisp will now print out a single 16-bit \201or 32-bit\202 unsigned
-int for a column whose data format is 16X \201or 32X\202, instead of
-printing 2 \201or 4\202 unsigned chars.
-
-)0 P()-1 LI( Fixed bug in which fundisp was not able to display bitfield data for
-raw event lists.
-
-)0 P()-1 LI( Previously, when binning columns used implicitly in a region
-and explicitly in a filter could suffer from a case sensitivity problem.
-This has been fixed.
-
-)0 P()-1 LI( Fixed internal mask=all switch on fundisp.
-
-)0 P()-1 LI( Filter include files now simply include text without changing the state
-of the filter. They therefore can be used in expression. That is, if foo1
-contains "pi==1" and foo2 contains "pha==2" then the following expressions
-are equivalent:
-) 3 57 PR( "[@foo1&&@foo2]" is equivalent to "[pi==1&&pha==2]"
- "[pha==1||@foo2]" is equivalent to "[pi==1||pha==2]"
- "[@foo1,@foo2]" is equivalent to "[pi==1,pha==2]")RP(
-
-)0 P()-1 LI( Fixed bug in filter specification which caused a SEGV if a varargs-style
-region was enclosed in parens.
-
-)0 P()-1 LI( Updated wcs library to 3.3.2.
-)LU(
-
-)0 2 166 H()WB 252 Sn( Public Release 1.2.0 \20124 March 2003\202)EH(
-)UL(
-)0 P()-1 LI( BSCALE and BZERO are now always applied to int pixel data, instead of
-only being applied if the desired output is floating point.
-)LU(
-
-)0 2 167 H()WB 253 Sn( Beta Release 1.2.b3 \2014 February 2003\202)EH(
-)UL(
-)0 P()-1 LI( In FunColumnSelect, added the ability to specify an offset into
-an array in the type specification, using the extended syntax:
-) 1 48 PR( [@][n]<type>[[poff]][:[tlmin[:tlmax[:binsiz]]]])RP(
-The [poff] string specifies the offset. For example, a type specification
-such as "@I[2]" specifies the third \201i.e., starting from 0\202 element in
-the array pointed to by the pointer value. A value of "@2I[4]" specifies
-the fifth and sixth values in the array.
-
-)0 P()-1 LI( Added a non-varargs version of FunColumnSelect called _FunColumnSelect:
-) 3 76 PR(int _FunColumnSelect\201Fun fun, int size, char *plist,
- char **names, char **types, char **modes, int *offsets,
- int nargs\202;)RP(
-
-)0 P()-1 LI( Added support for sorting binary tables by column name using:
-funtable -s "col1 col2 ... coln" ...
-
-)0 P()-1 LI( Added the FUN_RAW macro which, when applied to the "name" parameter
-of FunParamGets\201\202, returns the 80-character raw FITS card instead of
-only the value.
-
-)0 P()-1 LI( Added support for comparing column values with binary masks of the
-form 0b[01]+, e.g.:
-) 1 23 PR( \201status&0b111\202==0b001)RP(
-Previously, such masks had to be specified in decimal, octal, or hex.
-
-)0 P()-1 LI( Completed support for type 'L' \201logical\202 in fundisp and in filtering of
-binary tables.
-
-)0 P()-1 LI( Fixed bug in funhist that was improperly setting the number of bins
-when the data was of type float.
-
-)0 P()-1 LI( Fixed bug in filter/Makefile where the filter OBJPATH #define was
-being passed to the wrong module.
-)LU(
-
-)0 2 168 H()WB 254 Sn( Beta Release 1.2.b2 \2017 October 2002\202)EH(
-)UL(
-)0 P()-1 LI( Updated wcs library to 3.1.3.
-
-)0 P()-1 LI( Added support for reading gzip'ed files via stdin.
-)LU(
-
-)0 2 169 H()WB 255 Sn( Beta Release 1.2.b1 \20124 September 2002\202)EH(
-)UL(
-)0 P()-1 LI( Added the following accelerators to region filtering:
-) 8 73 PR( shape: arguments:
- ----- ---------
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn \201angle\202
- BOX xcenter ycenter xwlo yhin xwout yhhi n=[number] \201angle\202
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn \201angle\202
- ELLIPSE xcenter ycenter xwlo yhin xwout yhhi n=[number] \201angle\202)RP(
-
-)0 P()-1 LI( Added the following new pandas \201Pie AND Annulus\202 to region filtering:
-) 5 77 PR( shape: arguments:
- ----- ---------
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # same as panda
- BPANDA xcen ycen ang1 ang2 nang ixlo iylo ixhi iyhi nrad \201ang\202 # box
- EPANDA xcen ycen ang1 ang2 nang ixlo iylo ixhi iyhi nrad \201ang\202 # ellipse)RP(
-
-)0 P()-1 LI( Added support for filtering images using simple FITS image masks,
-i.e. 8-bit or 16-bit FITS images where the value of a pixel is the
-region id number for that pixel \201and therefore must be greater than
-0\202. The image section being filtered must either be the same size as the
-mask dimensions or else be an even multiple of the mask. This works with
-image-style filtering, i.e., funcnts can utilize a mask on both
-images and binary tables.
-
-)0 P()-1 LI( Added '$n' to fundisp column specification to allow display of
-ordinal value of each row passing the filter.
-
-)0 P()-1 LI( Added code to support region filtering on image sections.
-
-)0 P()-1 LI( Fixed bugs which prevented filtering more than one ASCII region file.
-
-)0 P()-1 LI( Fixed bug occasionally causing filter slave processes to become zombies.
-
-)0 P()-1 LI( Fixed bugs in event filtering: annulus with inner radius of 0
-\201i.e., a circle\202 was rejecting events with coordinates xcen, ycen.
-Also, pie with angles of 0 and 360 was rejecting some events.
-Image filtering \201e.g. funcnts\202 did not have these problems.
-
-)0 P()-1 LI( Filters now accept global exclude regions without an include region.
-In such a case, the field region is implied. That is, "-circle\201x,y,r\202"
-is equivalent to "field; -circle\201x,y,r\202", etc.
-
-)0 P()-1 LI( Fixed panda so that it can be used as a global exclude.
-
-)0 P()-1 LI( Allow empty ds9 region file \201comments and globals only\202 to be
-a valid filter. Totally ignore zero length region or include file.
-
-)0 P(
-)-1 LI( Fixed funcnts bug that was displaying 0 value as inner radius of
-a circle, instead of just one radius value.
-)LU(
-
-)0 2 170 H()WB 256 Sn( Public Release 1.1.0 \20122 April 2002\202)EH(
-
-)0 P(New features include:
-)UL()0 P()-1 LI( Funtools programs now accept gzip'ed files as valid input.
-
-)0 P()-1 LI( Improved security via replacement of system\201\202 function.
-
-)0 P()-1 LI( fundisp, funcnts, funhist can output starbase/rdb format \201tabs between columns, form-feeds between tables\202.
-
-)0 P()-1 LI( Improved support for Windows platform, as well as new support for Mac OSX.)LU(
-
-)0 2 171 H()WB 257 Sn( Pre-Release 1.1.0e \20110 April 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Added enough support to skip over variable length arrays in BINTABLES.
-We will add full support if this non-standard construct becomes more widely
-used.
-
-)0 P()-1 LI( Fixed bug in underlying fitsy _gread\201\202 routine that was returning
-an arbitrary bytes-read value if the input fd was invalid.
-)LU(
-
-)0 2 172 H()WB 258 Sn( Pre-Release 1.1.0e \20119 March 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Added additional check for Windows/PC to filter/Nan.h.
-
-)0 P()-1 LI( Upgraded zlib library to 1.1.4 \201fix double free security hole\202.
-)LU(
-
-
-)0 2 173 H()WB 259 Sn( Pre-Release 1.1.0e \20127 February 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Changed filter/process.[ch] to filter/zprocess.[ch] to avoid name
-collision with Cygwin include file.
-
-)0 P()-1 LI( Added -a switch to funhead to display all headers in a FITS file.
-)LU(
-
-)0 2 174 H()WB 260 Sn( Pre-Release 1.1.0e \20111 February 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Fixed filter parser so that it ignores ds9 "ruler" and "text" markers
-only up to the first \200n or ; \201was ignoring to last \200n\202.
-
-)0 P()-1 LI( The NBLOCK parameter in fitsy/headdata.c was too large for Mac OS X
-\201max size of a declared char buf seems to be about .5 Mb\202.
-)LU(
-
-)0 2 175 H()WB 261 Sn( Beta Release 1.0.1b5 \20131 January 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Fixed bug introduced in calculated IRAF LTM values in 1.0.1b3.
-
-)0 P()-1 LI( Fixed bug in filter parser giving wrong answers when two range
-lists were combined with and explicit boolean operator:
-) 1 34 PR( $ fundisp $S"[x=512&&y=511,512]")RP(
-incorrectly acted like:
-) 1 39 PR( fundisp $S"[\201x=512&&y=511\202||\201y=512\202]")RP(
-instead of:
-) 1 37 PR( fundisp $S"[x=512&&\201y=511||y=512\202]")RP(
-In general, we recommend use of explicit parentheses.
-
-)0 P()-1 LI( Fixed filter/NaN.h to recognize Compaq Alpha again \201broken by their last change to cc\202.
-
-)0 P()-1 LI( Removed redundant varargs definitions that conflicted with Alpha compiler definitions.
-
-)0 P()-1 LI( Added blank line to inc.sed to work around Apple Mac OS X bug in which the
-"i" \201insert\202 command was treating final \200\200 as continuation \200 in the text.
-
-)0 P(
-)-1 LI( Added include of mkrtemp.h to mkrtemp.c to get conditional compilation
-for Mac OSX.
-
-)0 P()-1 LI( Added support for --with-zlib to fitsy so that ds9 could use its own
-copy of zlib \201and not build the copy in fitsy\202.
-
-)0 P()-1 LI( Removed config.cache and Makefile files from distribution tar file.
-)LU(
-
-)0 2 176 H()WB 262 Sn( Beta Release 1.0.1b4 \20126 January 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Make explicit that column filters are not permitted in an image
-expression \201such as the funcnts region arguments\202.
-
-)0 P()-1 LI( Fix bug in region parser in which a region \201without parens\202,
-followed immediately by an operator:
-) 1 24 PR( circle 512 512 .5&)SY(\160)ES(==1)RP(
-was not processing the final argument of the region correctly.
-
-)0 P()-1 LI( Ignore new "tile" directive in filters \201used by ds9\202.
-)LU(
-
-)0 2 177 H()WB 263 Sn( Beta Release 1.0.1b3 \2014 January 2002\202)EH(
-)UL(
-
-)0 P()-1 LI( Made modifications to Makefile.in to make releases easier.
-
-)0 P()-1 LI( Added instructions Makefile.in so that funtools.h will always
-have correct #defines for FUN_VERSION, FUN_MAJOR_VERSION,
-FUN_MINOR_VERSION, and FUN_PATCH_LEVEL.
-
-)0 P()-1 LI( Allow #include statements in funcalc program files.
-
-)0 P()-1 LI( funimage now updates all 4 CDX_Y values by the block factor.
-
-)0 P()-1 LI( Minor changes to make funtools work under darwin \201Mac OS X\202.
-)LU(
-
-)0 2 178 H()WB 264 Sn( Beta Release 1.0.1b2 \20114 November 2001\202)EH(
-)UL(
-
-)0 P()-1 LI( Fixed FunOpen\201\202 bug \201introduced in b1\202 in which filenames without
-extensions SEGV'ed on open. Yikes!
-
-)0 P()-1 LI( Funmerge now extends the tlmin/tlmax values of the output
-binning columns so that merged events from widely separated files are
-valid in the output table.
-
-)0 P()-1 LI( In funhist, added -w switch to specify bin width \201lo:hi:width\202
-instead of number of bins \201lo:hi:num\202. Added support for this new
-width option in funtools.ds9.
-
-)0 P()-1 LI( If a tdbin value was set using bincols=\201name:tlmin:tlmax:tdbin, ...\202,
-the WCS parameters were not being updated properly.
-
-)0 P()-1 LI( Cleaned up build support for zlib.
-)LU(
-
-)0 2 179 H()WB 265 Sn( Beta Release 1.0.1b1 \2016 November 2001\202)EH(
-)UL(
-
-)0 P()-1 LI( Added support for gzip'ed files to the underlying fitsy/gio
-library. This means that all funtools programs now accept gzip'ed
-files as valid input:
-) 1 41 PR( funcnts foo.fits.gz "circle 504 512 10")RP(
-It is no longer necessary to run gunzip and pipe the results to
-stdin of a funtools program.
-
-)0 P()-1 LI( Funtools tasks are now placed in a sub-menu in the DS9 Analysis
-menu, instead of at the top level.
-
-)0 P()-1 LI( Fixed a bug in funcnts in which the bottom-most pixel of a small
-circle or annulus region could be missed when the region is only one
-pixel wide for that value of y.
-
-)0 P()-1 LI( Added -n switch to funhist so that table histograms could be
-normalized by the width of the bin \201val/\201hi_edge-lo_edge\202\202.
-
-)0 P()-1 LI( Added -T switch to fundisp, funcnts, funhist to output in
-starbase/rdb format \201uses tabs instead of spaces between columns,
-form-feeds between tables, etc.\202
-
-)0 P()-1 LI( Fixed a bug in which the field\201\202 region was not being properly
-processed in combination with an image section. This could affect
-funcnts processing of image data where an image section was specified
-\201though it usually resulted in a funcnts error\202.
-
-)0 P()-1 LI( Fixed bug in display of binary table header for vector columns.
-
-)0 P()-1 LI( Filters now recognize hex constants \201starting with 0x\202 and long
-constants \201ending with L\202.
-
-)0 P()-1 LI(Filenames containing a ':' are now only treated as sockets if they
-actually are in the form of a valid ip:port.
-
-)0 P()-1 LI(Replaced funtools.ds9 with a new version that calls a new funds9
-script, instead of calling funcnts or funhist directly. The new script
-supports gzip'ed files and bracket specifications on filenames at the
-same time, which the direct call could not. Also the new script has
-better error reporting.
-
-)0 P()-1 LI( Replaced system\201\202 call used to compile filter and funcalc
-expression with a special launch\201\202 call, which performs execvp\201\202
-directly without going through sh. \201launch\201\202 works under DOS and has
-fewer security problems.\202
-
-)0 P()-1 LI( Fixed image filter code in which the field\201\202 region was being ignored
-if it was combined with one or more exclude regions \201and no other include
-regions\202, resulting in no valid pixels.
-
-)0 P()-1 LI( Changed use of getdtable\201\202 to FD_SETSIZE in calls to select\201\202.
-
-)0 P()-1 LI( Added code to guard against FITS binary tables without proper TFORMx
-parameters.
-
-)0 P()-1 LI( Added support to FunParamGets so that it returns the raw FITS card
-if the specified input name is NULL and the input n value is positive.
-
-)0 P()-1 LI( Fixed bug in underlying fitsy code that set the comment in a
-header parameter.
-)LU(
-
-
-)0 2 180 H()WB 266 Sn( Public Release 1.0.0 \20131 July 2001\202)EH(
-)UL(
-)0 P()-1 LI( "a new day with no mistakes ... yet")LU(
-
-)2 1 1 HR()0 0 1 A(Index to the Funtools Help Pages)0 0 TN TL()Ec /AF f D(
-)0 5 181 H(Last)WB 267 Sn( updated: 22 April 2002)EH(
-)WB NL
-/TE t D NP TU PM 0 eq and{/Pn () D showpage}if end restore
diff --git a/funtools/doc/help.html b/funtools/doc/help.html
deleted file mode 100644
index e32f9bf..0000000
--- a/funtools/doc/help.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<!-- =defdoc funtools funtools n -->
-<HTML>
-<HEAD>
-<TITLE>The Funtools Help Facility</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funtools NAME -->
-<H2><A NAME="funtools">Funtools: FITS Users Need Tools</A></H2>
-
-<!-- =section funtools SYNOPSIS -->
-<H2>Summary</H2>
-This document is the Table of Contents for Funtools.
-
-<!-- =section funtools DESCRIPTION -->
-<H2>Description</H2>
-Funtools, is a "minimal buy-in" FITS library and utility package developed
-at the the High Energy Astrophysics Division of SAO. The Funtools
-library provides simplified access to a wide array of file types:
-standard astronomical FITS images and binary tables, raw arrays and
-binary event lists, and even tables of ASCII column data. A
-sophisticated region filtering library (compatible with ds9) filters
-images and tables using boolean operations between geometric shapes,
-support world coordinates, etc. Funtools also supports advanced
-capabilities such as optimized data searching using index files.
-
-The main goal of the Funtools project has been to develop a minimal buy-in
-FITS library for researchers who are occasional (but serious) coders. In
-this case, "minimal buy-in" means "easy to learn, easy to use, and easy to
-re-learn next month". We have tried to achieve this goal by emphasizing two
-essential capabilities. The first is the ability to develop FITS programs
-without knowing much about FITS, i.e., without having to deal with the
-arcane rules for generating a properly formatted FITS file. The second is
-to support the use of already-familiar C/Unix facilities, especially C
-structs and Unix stdio. Taken together, these two capabilities should allow
-researchers to leverage their existing programming expertise while
-minimizing the need to learn new and complex coding rules.
-
-<!-- =section funtools DESCRIPTION -->
-<P>
-Choose from the following topics:
-
-<P>
-<UL>
-<LI><A HREF="./programs.html">Funtools User Programs</A>
-<UL>
-<LI><A HREF="./programs.html#funcalc">funcalc: Funtools calculator (for binary tables)</A>
-<!-- =text [funcalc(1)] -->
-<LI><A HREF="./programs.html#funcen">funcen: find centroid (for binary tables)</A>
-<!-- =text [funcen(1)] -->
-<LI><A HREF="./programs.html#funcnts">funcnts: count photons in specified regions</A>
-<!-- =text [funcnts(1)] -->
-<LI><A HREF="./programs.html#funcone">funcone: cone search on RA, Dec columns</A>
-<!-- =text [funcone(1)] -->
-<LI><A HREF="./programs.html#fundisp">fundisp: display data in a Funtools data file</A>
-<!-- =text [fundisp(1)] -->
-<LI><A HREF="./programs.html#funhead">funhead: display a header in a Funtools file</A>
-<!-- =text [funhead(1)] -->
-<LI><A HREF="./programs.html#funhist">funhist: create a 1D histogram of a column</A>
-<!-- =text [funhist(1)] -->
-<LI><A HREF="./programs.html#funimage">funimage: create a FITS image from a Funtools data file</A>
-<!-- =text [funimage(1)] -->
-<LI><A HREF="./programs.html#funindex">funindex: create an index on a column in a binary table</A>
-<!-- =text [funindex(1)] -->
-<LI><A HREF="./programs.html#funjoin">funjoin: join two or more FITS binary tables on specified columns</A>
-<!-- =text [funjoin(1)] -->
-<LI><A HREF="./programs.html#funmerge">funmerge: merge one or more Funtools table files</A>
-<!-- =text [funmerge(1)] -->
-<LI><A HREF="./programs.html#funsky">funsky: convert between image and sky coordinates, using WCS info from a FITS header</A>
-<!-- =text [funsky(1)] -->
-<LI><A HREF="./programs.html#funtable">funtable: copy selected rows from a Funtools file to a FITS binary table</A>
-<!-- =text [funtable(1)] -->
-<LI><A HREF="./programs.html#funtbl">funtbl: extract a table from
-Funtools ASCII output</A>
-<!-- =text [funtbl(1)] -->
-<LI><A HREF="./ds9.html">funtools and ds9 image display</A>
-<!-- =text [funds9(n)] -->
-</UL>
-
-<LI><A HREF="./library.html">Funtools Programming</A>
-<UL>
-<LI><A HREF="./library.html#summary">Funtools Programming Summary</A>
-<!-- =text [funlib(3)] -->
-<LI><A HREF="./library.html#tutorial">Funtools Programming Tutorial</A>
-<!-- =text [funlib(3)] -->
-<LI><A HREF="./library.html#order">A Short Digression on Subroutine Order</A>
-<!-- =text [funlib(3)] -->
-<LI><A HREF="./library.html#compiling">Compiling and Linking</A>
-<!-- =text [funlib(3)] -->
-<LI><A HREF="./library.html#refhandle">The Funtools Reference Handle</A>
-<!-- =text [funlib(3)] -->
-<LI><A HREF="./library.html#reference">The Funtools Programming Reference Manual</A>
-<UL>
-<LI> <A HREF="./library.html#funopen">FunOpen: open a Funtools file</A>
-<!-- =text [funopen(3)] -->
-<LI><A HREF="./library.html#funimageget">FunImageGet: retrieve image data</A>
-<!-- =text [funimageget(3)] -->
-<LI><A HREF="./library.html#funimageput">FunImagePut: output image data</A>
-<!-- =text [funimageput(3)] -->
-<LI><A HREF="./library.html#funimagerowget">FunImageRowGet: retrieve image data by row</A>
-<!-- =text [funimagerowget(3)] -->
-<LI><A HREF="./library.html#funimagerowput">FunImageRowPut: output image data by row</A>
-<!-- =text [funimagerowput(3)] -->
-<LI><A HREF="./library.html#funtablerowget">FunTableRowGet: retrieve rows from a table</A>
-<!-- =text [funtablerowget(3)] -->
-<LI><A HREF="./library.html#funtablerowput">FunTableRowPut: output rows to a table</A>
-<!-- =text [funtablerowput(3)] -->
-<LI><A HREF="./library.html#funcolumnselect">FunColumnSelect: select columns in a table for access</A>
-<!-- =text [funcolumnselect(3)] -->
-<LI><A HREF="./library.html#funcolumnactivate">FunColumnActivate: activate columns in a table for read/write</A>
-<!-- =text [funcolumnactivate(3)] -->
-<LI><A HREF="./library.html#funcolumnlookup">FunColumnLookup: lookup info about the columns in a table</A>
-<!-- =text [funcolumnlookup(3)] -->
-<LI><A HREF="./library.html#funinfoget">FunInfoGet: get info about an image or table</A>
-<!-- =text [funinfoget(3)] -->
-<LI><A HREF="./library.html#funinfoput">FunInfoPut: put info about an image or table</A>
-<!-- =text [funinfoput(3)] -->
-<LI><A HREF="./library.html#funparamget">FunParamGet: get header param</A>
-<!-- =text [funparamget(3)] -->
-<LI><A HREF="./library.html#funparamput">FunParamPut: put header param</A>
-<!-- =text [funparamput(3)] -->
-<LI><A HREF="./library.html#funflush">FunFlush: flush I/O in a Funtools file</A>
-<!-- =text [funflush(3)] -->
-<LI><A HREF="./library.html#funclose">FunClose: close a Funtools file</A>
-<!-- =text [funclose(3)] -->
-</UL>
-
-<LI><A HREF="./library.html#examples">Funtools Programming Examples</A>
-<!-- =text [funlib(3)] -->
-<UL>
-<LI><A HREF="./evmerge.c">evmerge: merge new columns with existing columns</A>
-<LI><A HREF="./evcol.c">evcols: add column and rows to binary tables</A>
-<LI><A HREF="./imblank.c">imblank: blank out image values below a threshold</A>
-</UL>
-</UL>
-
-<LI><A HREF="./files.html">Funtools Data Files</A>
-<!-- =text [funfiles(n)] -->
-<UL>
-<LI><A HREF="./files.html#formats">Supported Data Formats</A>
-<UL>
-<LI><A HREF="./files.html#fits">FITS File and Extensions</A>
-<LI><A HREF="./files.html#events">Non-FITS Raw Event Files</A>
-<LI><A HREF="./files.html#arrays">Non-FITS Array Files</A>
-<LI><A HREF="./text.html">Column-based Text (ASCII) Files</A>
-<LI><A HREF="./view.html">Database Views of Tables</A>
-</UL>
-<LI><A HREF="./files.html#sections">Image Sections and Blocking</A>
-<LI><A HREF="./files.html#binning">Binning FITS Binary Tables and Non-FITS Event Files</H2>
-<LI><A HREF="./files.html#types">Disk Files and Other Supported File Types</A>
-</UL>
-
-<LI>Funtools Data Filtering
-<UL>
-<LI><A HREF="./filters.html">Table Filtering</A>
-<!-- =text [funfilters(n)] -->
-<LI><A HREF="./idx.html">Fast Table Filtering using Indexes</A>
-<!-- =text [funidx(n)] -->
-<LI><A HREF="./regions.html">Spatial Region Filtering</A>
-<!-- =text [funregions(n)] -->
-<UL>
-<LI><A HREF="./reggeometry.html">Region Geometry</A>
-<!-- =text [reggeometry(n)] -->
-<LI><A HREF="./regalgebra.html">Region Algebra</A>
-<!-- =text [regalgebra(n)] -->
-<LI><A HREF="./regcoords.html">Region Coordinates</A>
-<!-- =text [regcoords(n)] -->
-<LI><A HREF="./regbounds.html">Region Boundaries</A>
-<!-- =text [regbounds(n)] -->
-<LI><A HREF="./regdiff.html">Differences Between Funtools and IRAF Regions</A>
-<!-- =text [regdiff(n)] -->
-</UL>
-<LI><A HREF="./combo.html">Combining Table and Region Filters</A>
-<!-- =text [funcombine(n)] -->
-</UL>
-
-<LI> Miscellaneous
-<UL>
-<LI><A HREF="./env.html">Funtools Environment Variables</A>
-<!-- =text [funenv(n)] -->
-<LI><A HREF="./changelog.html">Funtools ChangeLog</A>
-</UL>
-
-</UL>
-
-<!-- =stop -->
-
-<H5>Last updated: January 6, 2006</H5>
-
-</BODY>
-</HTML>
-
diff --git a/funtools/doc/html2man b/funtools/doc/html2man
deleted file mode 100755
index 4e60799..0000000
--- a/funtools/doc/html2man
+++ /dev/null
@@ -1,258 +0,0 @@
-#!/usr/bin/perl
-#
-# See COPYRIGHT
-#
-# Script to generate a pod file from an html source (the same one as for text files too)
-# and later this pod file it passed through pod2man
-#
-# Use:
-# html2man [ <man-dir> [<version-dir>] ] <file.html
-#
-# <Man-dir> is the directory where the man pages will be created
-# (current directory by default). If a file name is given instead of
-# directory then the directory of that file is used.
-# <Version-dir> is the directory containing the ttf2pt1 files version.h
-# and CHANGES.html which are used to generate the release name and date
-# for the man page (by default looks in current directory and then in up to
-# 5 ancestor directories).
-# If the version files can not be found then the release defaults to
-# "current" and the date defaults to today.
-#
-# Special formatting in the html file is:
-# All controls are hidden within HTML comments that must occupy a whole separate line
-# Such a line looks like:
-# <!-- =<html2man_directive> <arguments> -->
-# <!-- ==<pod_directive> <arguments> -->
-# Any sort of directive must be followed by a space. The pod directives are
-# automatically surrounded by empty lines in the output file.
-# The html2man directives are:
-#
-# <!-- =defdoc <docid> <file> <section> -->
-# Define a man page. Multiple man pages can be defined in the same HTML
-# file. <Docid> is a short name by which this man page will be referred in the
-# other directives. <File> is the name of the man page, and <section> is the
-# section of the manual (do not confuse with sections within a man page).
-#
-# <!-- =section <docid> <page_section_name> -->
-# All the text following this directive is copied (with translation)
-# into the specified section of the specified man page. The sections
-# may appear in arbitrary order, they will be rearranged to the standard
-# order before output. Only standard section names are permitted (see @stdsect
-# below). The pod directives which occur outside of man sections are ignored,
-# just like the common text. The translation of HTML tags is:
-#
-# <br> - to paragraph break
-# <b> - to B<>
-# <i> - to I<>
-# <tt> - to C<>
-# <a href> - to F<>
-# <ul>, <li>, </ul> - to =over 2, =item *, =back
-# &nbsp;, &amp;, &lt;, &gt - to their symbols, appropriately encoded
-#
-# The rest of HTML tags is removed
-#
-# If the same section is started more than once, the text from the
-# second appearance will be added to the first, etc.
-#
-# <!-- =stop -->
-# Stop copying text to the man page.
-#
-# <!-- =cont -->
-# Continue copying text to the man page, same section as before.
-#
-# <!-- =text <text> -->
-# Insert this <text> into the man page (works only when copying is enabled).
-# Characters &lt;, &gt;, &amp; are converted as usual.
-
-@mons = qw(January February March April May June July August September October November December);
-
-$dir = $ARGV[0];
-$maindir = $ARGV[1];
-
-if($dir eq "") {
- $dir = ".";
-} elsif( ! -d $dir ) {
- if( ! ($dir =~ s|\/[^/]*$||) ) {
- $dir = ".";
- }
-}
-if($maindir eq "") {
- $maindir = ".";
- for($i=0; $i<5; $i++) {
- if(-f "$maindir/version.h") {
- last;
- }
- $maindir = "../$maindir";
- }
-}
-
-if( open(VERFILE, "<$maindir/version.h") ) {
- while(<VERFILE>) {
- if( /^\s*\#define\s+TTF2PT1_VERSION\s+\"(.*)\"/ ) {
- $release = "version $1";
- }
- }
- close(VERFILE);
- if( $release =~ /SNAP-([0-9][0-9])([0-9][0-9])([0-9][0-9])/ ) {
- $date = sprintf("%s %d, 20%02d", $mons[$2-1], $3, $1);
- } elsif( open(CFILE, "<$maindir/CHANGES.html") ) {
- while(<CFILE>) {
- if( /\<H4\>/) {
- last;
- }
- }
- $_ = <CFILE>;
- chomp;
- if( $_ =~ s/^.*?-- // ) {
- $date = $_;
- }
- close(CFILE);
- }
-}
-
-if($release eq "") {
- if( open(VERFILE, "<../Makefile") ) {
- while(<VERFILE>) {
- if( /^VERSION\s+=\s+(.*)/ ) {
- $release = "version $1";
- }
- }
- close(VERFILE);
- }
-}
-
-if($release eq "") {
- $release = "current";
-}
-if($date eq "") {
- @lt = localtime(time);
- $date = sprintf("%s %d, %d", $mons[$lt[4]], $lt[3], 1900+$lt[5]);
-}
-
-#printf(STDERR "date=%s release=%s\n", $date, $release);
-
-$writemode = 0;
-
-while(<STDIN>) {
- if( s/^\<\!\-\- \=(\S+)\s+//) {
- $cmd = $1;
- s/\s*\-\-\>\s*$//;
- #printf(STDERR "cmd=%s args=%s\n", $cmd, $_);
- if($cmd =~ /^=/) {
- if($writemode) {
- $text{$tosect} .= "\n\n$cmd $_\n\n";
- }
- } elsif($cmd eq "defdoc") {
- @sl = split;
- push(@allids, $sl[0]);
- $file{$sl[0]} = $sl[1];
- $mansect{$sl[0]} = $sl[2];
- } elsif($cmd eq "section") {
- # tosect includes the file id
- $tosect = $_;
- $text{$tosect} .= "\n\n";
- $writemode = 1;
- } elsif($cmd eq "stop") {
- $writemode = 0;
- $text{$tosect} .= "\n";
- } elsif($cmd eq "cont") {
- $writemode = 1;
- } elsif($cmd eq "text") {
- if($writemode) {
- s/\&lt\;/</gi;
- s/\&gt\;/>/gi;
- s/\&amp\;/\&/gi;
- $text{$tosect} .= "$_\n";
- }
- }
- } elsif($writemode) {
-# s/^\s+//;
-
- s/\{/\&lbr;/g;
- s/\}/\&rbr;/g;
-
- s/\<br\>/\n\n/gi;
- #s/\<blockquote\>/\n\n=over 4\n\n/gi;
- #s/\<\/blockquote\>/\n\n=back\n\n/gi;
- s/\<ul\>/\n\n=over 4\n\n/gi;
- s/\<\/ul\>/\n\n=back\n\n/gi;
- s/\<li\>\s*/\n\n=item \*\n\n/gi;
-
- s/\<dl\>/\n\n=over 4\n\n/gi;
- s/\<\/dl\>/\n\n=back\n\n/gi;
- s/\<dt\>\s*/\n\n=item \*\n\n/gi;
- s/\<dd\>\s*/\n\n/gi;
-
- s/\<i\>(.*?)\<\/i\>/I\{\1\}/gi;
- s/\<em\>(.*?)\<\/em\>/I\{\1\}/gi;
- s/\<b\>(.*?)\<\/b\>/B\{\1\}/gi;
- s/\<tt\>(.*?)\<\/tt\>/C\{\1\}/gi;
- s/\<a href\=\.*?\>(.*?)\<\/a\>/F\{\1\}/gi;
- s/\<h2\>summary\<\/h2\>//gi;
- s/\<h2\>description\<\/h2\>//gi;
- s/\<h2\>examples\<\/h2\>//gi;
- s/\<h2\>options\<\/h2\>//gi;
- s/\<h2\>(.*?)\<\/h2\>/B\{\1\}/gi;
- s/\<.*?\>//g;
- s/\{/\</g;
- s/\}/\>/g;
-
- s/\&nbsp\;/S< >/gi;
- s/\&amp\;/\&/gi;
-# s/\&lt\;/E<lt>/gi;
-# s/\&gt\;/E<gt>/gi;
- s/\&lt\;/\</gi;
- s/\&gt\;/\>/gi;
- #s/\|/E<verbar>/g;
- #s/\//E<sol>/g;
- s/\&lbr\;/\{/g;
- s/\&rbr\;/\}/g;
-
- #printf(STDERR "section=%s add=%s", $tosect, $_);
- $text{$tosect} .= $_;
- }
-}
-
-@stdsect = (
- "NAME",
- "SYNOPSIS",
- "OPTIONS",
- "DESCRIPTION",
- "RETURN VALUE",
- "ERRORS",
- "EXAMPLES",
- "ENVIRONMENT",
- "FILES",
- "SEE ALSO",
- "NOTES",
- "CAVEATS",
- "DIAGNOSTICS",
- "BUGS",
- "RESTRICTIONS",
- "AUTHOR",
- "HISTORY" );
-
-#printf(STDERR "allids= @allids\n");
-for $id (@allids) {
- print(STDERR "creating man page $id $file{$id} $mansect{$id}\n\n");
- die "Unable to create pod file $dir/$file{$id}.pod"
- unless open(PODF, ">./pod/$file{$id}.pod");
- print(PODF "=pod\n\n");
- for $sect (@stdsect) {
- $sid = "$id $sect";
- #printf(STDERR "trying %s\n", $sid);
- if(defined $text{$sid}) {
- #printf(STDERR " section %s\n", $sid);
- print(PODF "=head1 $sect\n\n$text{$sid}\n\n");
- }
- }
- print(PODF "=cut\n");
- close(PODF);
- die "Unable to generate the man page $dir/$file{$id}.1"
- if system("pod2man --section=\"$mansect{$id}\" --release=\"$release\" "
- . "--center=\"SAORD Documentation\" --date=\"$date\" "
- . "--name=\"$file{$id}\" "
- . "./pod/$file{$id}.pod > $dir/man$mansect{$id}/$file{$id}.$mansect{$id}");
-
- unlink("$dir/$file{$id}.pod");
-}
diff --git a/funtools/doc/idx.html b/funtools/doc/idx.html
deleted file mode 100644
index a08b10b..0000000
--- a/funtools/doc/idx.html
+++ /dev/null
@@ -1,216 +0,0 @@
-<!-- =defdoc funidx funidx n -->
-<HTML>
-<HEAD>
-<TITLE>Table Filtering with Indexes</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funidx NAME -->
-<H2><A NAME="funidx">Funidx: Using Indexes to Filter Rows in a Table</A></H2>
-
-<!-- =section funidx SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document contains a summary of the user interface for
-filtering rows in binary tables with indexes.
-
-<!-- =section funidx DESCRIPTION -->
-<H2>Description</H2>
-<P>
-Funtools <A HREF="./filters.html">Table Filtering</A> allows rows in a
-table to be selected based on the values of one or more columns in the
-row. Because the actual filter code is compiled on the fly, it is very
-efficient. However, for very large files (hundreds of Mb or larger),
-evaluating the filter expression on each row can take a long time. Therefore,
-funtools supports index files for columns, which are used automatically during
-filtering to reduce dramatically the number of row evaluations performed.
-The speed increase for indexed filtering can be an order of magnitude or
-more, depending on the size of the file.
-
-<P>
-The <A HREF="./programs.html#funindex">funindex</A> program creates an
-index on one or more columns in a binary table. For example, to create an index
-for the column pi in the file huge.fits, use:
-<PRE>
- funindex huge.fits pi
-</PRE>
-This will create an index named huge_pi.idx.
-
-<P>
-When a filter expression is initialized for row evaluation, funtools
-looks for an index file for each column in the filter expression. If
-found, and if the file modification date of the index file is later
-than that of the data file, then the index will be used to reduce the
-number of rows that are evaluated in the filter. When
-<A HREF="./regions.html">Spatial Region Filtering</A> is part of the
-expression, the columns associated with the region are checked for index
-files.
-
-<P>
-If an index file is not available for a given column, then in general,
-all rows must be checked when that column is part of a filter
-expression. This is not true, however, when a non-indexed column is
-part of an AND expression. In this case, only the rows that pass the
-other part of the AND expression need to be checked. Thus, in some cases,
-filtering speed can increase significantly even if all columns are not
-indexed.
-
-<P>
-Also note that certain types of filter expression syntax cannot make
-use of indices. For example, calling functions with column names as
-arguments implies that all rows must be checked against the function
-value. Once again, however, if this function is part of an AND
-expression, then a significant improvement in speed still is possible
-if the other part of the AND expression is indexed.
-
-<P>
-For example, note below the dramatic speedup in searching a 1 Gb
-file using an AND filter, even when one of the columns (pha) has no
-index:
-
-<PRE>
- time fundisp \
- huge.fits'[idx_activate=0,idx_debug=1,pha=2348&&cir 4000 4000 1]' \
- "x y pha"
- x y pha
- ---------- ----------- ----------
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 42.36u 13.07s 6:42.89 13.7%
-
- time fundisp \
- huge.fits'[idx_activate=1,idx_debug=1,pha=2348&&cir 4000 4000 1]' \
- "x y pha"
- x y pha
- ---------- ----------- ----------
- idxeq: [INDEF]
- idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
- idxand(1): INDEF [IDX_OR_SORT]
- idxall(1): [IDX_OR_SORT]
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 1.55u 0.37s 1:19.80 2.4%
-</PRE>
-
-When all columns are indexed, the increase in speed can be even more dramatic:
-<PRE>
- time fundisp \
- huge.fits'[idx_activate=0,idx_debug=1,pi=770&&cir 4000 4000 1]' \
- "x y pi"
- x y pi
- ---------- ----------- ----------
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 42.60u 12.63s 7:28.63 12.3%
-
- time fundisp \
- huge.fits'[idx_activate=1,idx_debug=1,pi=770&&cir 4000 4000 1]' \
- "x y pi"
- x y pi
- ---------- ----------- ----------
- idxeq: pi start=9473025,stop=9492240 => pi[ROW 9473025:9492240]
- idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
- idxor sort/merge: pi[ROW 9473025:9492240] [IDX_OR_SORT]
- idxmerge(5): [IDX_OR_SORT] pi[ROW]
- idxall(1): [IDX_OR_SORT]
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 1.67u 0.30s 0:24.76 7.9%
-</PRE>
-
-<P>
-The miracle of indexed filtering (and indeed, of any indexing) is the
-speed of the binary search on the index, which is of order log2(n)
-instead of n. (The funtools binary search method is taken from
-http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary, to whom
-grateful acknowledgement is made.) This means that the larger the
-file, the better the performance. Conversely, it also means that for
-small files, using an index (and the overhead involved) can slow
-filtering down somewhat. Our tests indicate that on a file containing
-a few tens of thousands of rows, indexed filtering can be 10 to 20
-percent slower than non-indexed filtering. Of course, your mileage
-will vary with conditions (disk access speed, amount of available
-memory, process load, etc.)
-
-<p>
-Any problem encountered during index processing will result in
-indexing being turned off, and replaced by filtering all rows. You can turn
-filtering off manually by setting the idx_activate variable to 0 (in a filter
-expression) or the FILTER_IDX_ACTIVATE environment variable to 0 (in the global
-environment). Debugging output showing how the indexes are being processed can
-be displayed to stderr by setting the idx_debug variable to 1 (in a filter
-expression) or the FILTER_IDX_DEBUG environment variable to 1 (in the global
-environment).
-
-<p>
-Currently, indexed filtering only works with FITS binary tables and raw
-event files. It does not work with text files. This restriction might be
-removed in a future release.
-
-<!-- =section funidx SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: August 3, 2007</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/imblank.c b/funtools/doc/imblank.c
deleted file mode 100644
index bdd736e..0000000
--- a/funtools/doc/imblank.c
+++ /dev/null
@@ -1,106 +0,0 @@
-#include <funtools.h>
-#include <stdlib.h>
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int bitpix, dim1, dim2;
- int total;
- double blimit, bvalue;
- char *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- float *fbuf;
- double *dbuf;
- Fun fun, fun2;
-
- if( argc < 4 ){
- fprintf(stderr, "usage: %s iname oname blimit bvalue\n", argv[0]);
- exit(1);
- }
-
- /* get blank limit and optional blank value */
- blimit = atof(argv[3]);
- bvalue = 0;
- if( argc >= 5 )
- bvalue = atof(argv[4]);
-
- /* exit on gio errors */
- setgerror(2);
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* open the output FITS image, preparing to copy input params */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* extract and bin the data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, NULL)) )
- gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
-
- /* get required information from funtools structure.
- this should come after the ImageGet call, in case that call
- changed fun_sect_bitpix value */
- FunInfoGet(fun,
- FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- 0);
-
- /* set appropriate data type buffer to point to image buffer */
- switch(bitpix){
- case 8:
- cbuf = (unsigned char *)buf; break;
- case 16:
- sbuf = (short *)buf; break;
- case 32:
- ibuf = (int *)buf; break;
- case -32:
- fbuf = (float *)buf; break;
- case -64:
- dbuf = (double *)buf; break;
- }
-
- /* loop through pixels and reset values below limit to value */
- total = dim1*dim2;
- for(i=0; i<total; i++){
- switch(bitpix){
- case 8:
- if( cbuf[i] <= blimit ) cbuf[i] = bvalue;
- break;
- case 16:
- if( sbuf[i] <= blimit ) sbuf[i] = bvalue;
- break;
- case 32:
- if( ibuf[i] <= blimit ) ibuf[i] = bvalue;
- break;
- case -32:
- if( fbuf[i] <= blimit ) fbuf[i] = bvalue;
- break;
- case -64:
- if( dbuf[i] <= blimit ) dbuf[i] = bvalue;
- break;
- }
- }
-
- /* write the output image, updating the FITS header from the orig file */
- if( !FunImagePut(fun2, buf, 0, 0, 0, NULL) )
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
-
- /* free up space */
- if( buf ) free(buf);
-
- /* close output first so that flush happens automatically */
- FunClose(fun2);
- FunClose(fun);
-}
diff --git a/funtools/doc/library.html b/funtools/doc/library.html
deleted file mode 100644
index 9bc725d..0000000
--- a/funtools/doc/library.html
+++ /dev/null
@@ -1,2823 +0,0 @@
-<!-- =defdoc funlib funlib 3 -->
-<HTML>
-<HEAD>
-<TITLE>Funtools Programming</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funlib NAME -->
-<H2><A NAME="funlib">FunLib: the Funtools Programming Interface</A></H2>
-
-<!-- =section funlib SYNOPSIS -->
-<H2>Summary</H2>
-A description of the Funtools library.
-
-<!-- =section funlib DESCRIPTION -->
-<H2><A NAME="intro">Introduction to the Funtools Programming Interface</H2></A>
-<P>
-To create a Funtools application, you need to include
-the funtools.h definitions file in your code:
-<PRE>
- #include &lt;funtools.h&gt;
-</PRE>
-
-You then call Funtools subroutines and functions to access Funtools data.
-The most important routines are:
-<UL>
-
-<P>
-<LI> <A HREF="./library.html#funopen">FunOpen</A>: open a Funtools file
-<LI><A HREF="./library.html#funinfoget">FunInfoGet</A>: get info about an image or table
-<LI><A HREF="./library.html#funimageget">FunImageGet</A>: retrieve image data
-<LI><A HREF="./library.html#funimagerowget">FunImageRowGet</A>: retrieve image data by row
-<LI><A HREF="./library.html#funimageput">FunImagePut</A>: output image data
-<LI><A HREF="./library.html#funimagerowput">FunImageRowPut</A>: output image data by row
-<LI><A HREF="./library.html#funcolumnselect">FunColumnSelect</A>: select columns in a table for access
-<LI><A HREF="./library.html#funtablerowget">FunTableRowGet</A>: retrieve rows from a table
-<LI><A HREF="./library.html#funtablerowput">FunTableRowPut</A>: output rows to a table
-<LI> <A HREF="./library.html#funclose">FunClose</A>: close a Funtools file
-</UL>
-
-Your program must be linked against the libfuntools.a library,
-along with the math library. The following libraries also might be required
-on your system:
-<UL>
-<LI> -lsocket -lnsl for socket support
-<LI> -ldl for dynamic loading
-</UL>
-<P>
-For example, on a Solaris system using gcc, use the following link line:
-<PRE>
- gcc -o foo foo.c -lfuntools -lsocket -lnsl -ldl -lm
-</PRE>
-On a Solaris system using Solaris cc, use the following link line:
-<PRE>
- gcc -o foo foo.c -lfuntools -lsocket -lnsl -lm
-</PRE>
-On a Linux system using gcc, use the following link line:
-<PRE>
- gcc -o foo foo.c -lfuntools -ldl -lm
-</PRE>
-Once configure has built a Makefile on your platform, the required
-"extra" libraries (aside from -lm, which always is required) are
-specified in that file's EXTRA_LIBS variable. For example, under
-Linux you will find:
-<PRE>
- grep EXTRA_LIBS Makefile
- EXTRA_LIBS = -ldl
- ...
-</PRE>
-
-<P>
-The Funtools library contains both the zlib library
-(http://www.gzip.org/zlib/) and Doug Mink's WCS library
-(http://tdc-www.harvard.edu/software/wcstools/). It is not necessary
-to put these libraries on a Funtools link line. Include files
-necessary for using these libraries are installed in the Funtools
-include directory.
-
-<H2><A NAME="tutorial">Funtools Programming Tutorial</A></H2>
-
-The
-<A HREF="./library.html#funopen">FunOpen()</A>
-function is used to open a FITS file, an array, or a raw event file:
-<PRE>
- /* open the input FITS file for reading */
- ifun = FunOpen(iname, "r", NULL);
- /* open the output FITS file for writing, and connect it to the input file */
- ofun = FunOpen(iname, "w", ifun);
-</PRE>
-A new output file can inherit header parameters automatically from
-existing input file by passing the input Funtools handle as the last
-argument to the new file's
-<A HREF="./library.html#funopen">FunOpen()</A>
-call as shown above.
-
-<P>
-For image data, you then can call
-<A HREF="./library.html#funimageget">FunImageGet()</A>
-to read an image into memory.
-<PRE>
- float buf=NULL;
- /* extract and bin the data section into an image buffer */
- buf = FunImageGet(fun, NULL, "bitpix=-32");
-</PRE>
-If the (second) buf argument to this call is NULL, buffer space is allocated
-automatically. The (third) plist argument can be used to specify the
-return data type of the array. If NULL is specified, the data type of
-the input file is used.
-
-<P>
-To process an image buffer, you would generally make a call to
-<A HREF="./library.html#funinfoget">FunInfoGet()</A> to determine the
-dimensions of the image (which may have been changed from the original
-file dimensions due to <A HREF="./files.html#sections">Funtools image
-sectioning</A> on the command line). In a FITS image, the index along
-the dim1 axis varies most rapidly, followed by the dim2 axis, etc.
-Thus, to access each pixel in an 2D image, use a double loop such as:
-</PRE>
- buf = FunImageGet(fun, NULL, "bitpix=-32");
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- for(i=1; i<=dim2; i++){
- for(j=1; j<=dim1; j++){
- ... process buf[((i-1)*dim1)+(j-1)] ...
- }
- }
-</PRE>
-or:
-<PRE>
- buf = FunImageGet(fun, NULL, "bitpix=-32");
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- for(i=0; i&lt;(dim1*dim2); i++){
- ... process buf[i] ...
- }
-</PRE>
-Finally, you can write the resulting image to disk using
-<A HREF="./library.html#funimageput">FunImagePut()</A>:
-<PRE>
- FunImagePut(fun2, buf, dim1, dim2, -32, NULL);
-</PRE>
-Note that Funtools automatically takes care of book-keeping tasks such as
-reading and writing FITS headers (although you can, of course, write
-your own header or add your own parameters to a header).
-
-<P>
-For binary tables and raw event files, a call to
-<A HREF="./library.html#funopen">FunOpen()</A>
-will be followed by a call to the
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-routine to select columns to be read from the input file and/or
-written to the output file:
-
-<PRE>
- typedef struct evstruct{
- double time;
- int time2;
- } *Ev, EvRec;
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "time", "D", "rw", FUN_OFFSET(Ev, time),
- "time2", "J", "w", FUN_OFFSET(Ev, time2),
- NULL);
-</PRE>
-Columns whose (third) mode argument contains an "r" are "readable",
-i.e., columns will be read from the input file and converted into the
-data type specified in the call's second argument. These columns
-values then are stored in the specified offset of the user record
-structure. Columns whose mode argument contains a "w" are
-"writable", i.e., these values will be written to the output file.
-The
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-routine also offers the option of automatically merging user
-columns with the original input columns when writing the output
-rows.
-
-<P>
-Once a set of columns has been specified, you can retrieve rows using
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A>,
-and write the rows using
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A>:
-<PRE>
- Ev ebuf, ev;
- /* get rows -- let routine allocate the array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i&lt;got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- /* time2 is generated here */
- ev->time2 = (int)(ev->time+.5);
- /* change the input time as well */
- ev->time = -(ev->time/10.0);
- }
- /* write out this batch of rows with the new column */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-</PRE>
-The input rows are retrieved into an array of user structs, which
-can be accessed serially as shown above. Once again, Funtools
-automatically takes care of book-keeping tasks such as reading and writing
-FITS headers (although you can, of course, write your own header or
-add your own parameters to a header).
-
-<P>
-When all processing is done, you can call
-<A HREF="./library.html#funclose">FunClose()</A>
-to close the file(s):
-<PRE>
- FunClose(fun2);
- FunClose(fun);
-</PRE>
-
-<P>
-These are the basics of processing FITS files (and arrays or raw event
-data) using Funtools. The routines in these examples are described in
-more detail below, along with a few other routines that support
-parameter access, data flushing, etc.
-
-<H2><A NAME="compiling">Compiling and Linking</A></H2>
-<P>
-To create a Funtools application, a software developer will include
-the funtools.h definitions file in Funtools code:
-<PRE>
- #include &lt;funtools.h&gt;
-</PRE>
-The program is linked against the libfuntools.a library, along with the
-math library (and the dynamic load library, if the latter is available
-on your system):
-<PRE>
- gcc -o foo foo.c -lfuntools -ldl -lm
-</PRE>
-<P>
-If gcc is used, Funtools filtering can be performed using dynamically
-loaded shared objects that are built at run-time. Otherwise, filtering
-is performed using a slave process.
-<P>
-Funtools has been built on the following systems:
-<UL>
-<LI> Sun/Solaris 5.X
-<LI> Linux/RedHat Linux 5.X,6.X,7.X
-<LI> Dec Alpha/OSF1 V4.X
-<LI> WindowsNT/Cygwin 1.0
-<LI> SGI/IRIX64 6.5
-</UL>
-
-<H2><A NAME="order">A Short Digression on Subroutine Order</A></H2>
-<P>
-There is a natural order for all I/O access libraries. You would not
-think of reading a file without first opening it, or writing a file
-after closing it. A large part of the experiment in funtools is to use
-the idea of "natural order" as a means of making programming
-easier. We do this by maintaining the state of processing for a given
-funtools file, so that we can do things like write headers and flush
-extension padding at the right time, without you having to do it.
-
-<P>
-For example, if you open a new funtools file for writing using
-<A HREF="./library.html#funopen">FunOpen()</A>,
-then generate an array of image data and call
-<A HREF="./library.html#funimageput">FunImagePut()</A>,
-funtools knows to write the image header automatically.
-There is no need to think about writing a standard header.
-Of course, you can add parameters to the file first by
-calling one of the
-<A HREF="./library.html#funparamput">FunParamPut()</A>
-routines, and these parameters will automatically be added
-to the header when it is written out. There still is no
-need to write the header explicitly.
-
-<P>
-Maintaining state in this way means that there are certain rules of
-order which should be maintained in any funtools program. In particular,
-we strongly recommend the following ordering rules be adhered to:
-
-<UL>
-<LI> When specifying that input extensions be copied to an output file
-via a reference handle, open the output file <B>before</B> reading the
-input file. (Otherwise the initial copy will not occur).
-
-<LI> Always write parameters to an output file using one of the
-<A HREF="./library.html#funparamput">FunParamPut()</A> calls
-<B>before</B> writing any data. (This is a good idea for all FITS
-libraries, to avoid having to recopy data is the FITS header needs
-to be extended by adding a single parameter.)
-
-<LI> If you retrieve an image, and need to know the data
-type, use the FUN_SECT_BITPIX option of
-<A HREF="./library.html#funinfoget">FunInfoGet()</A>,
-<B>after</B> calling
-<A HREF="./library.html#funimageget">FunImageGet()</A>, since
-it is possible to change the value of BITPIX from the latter.
-
-<LI> When specifying that input extensions be copied to an output file
-via a reference handle, close the output file <B>before</B> closing
-input file, or else use
-<A HREF="./library.html#funflush">FunFlush()</A>
-explicitly on the output file
-<B>before</B> closing the input file. (Otherwise the final copy will
-not occur).
-</UL>
-
-<P>
-We believe that these are the natural rules that are implied in most
-FITS programming tasks. However, we recognize that making explicit use
-of "natural order" to decide what automatic action to take on behalf
-of the programmer is experimental. Therefore, if you find that your
-needs are not compatible with our preferred order, please let us know
--- it will be most illuminating for us as we evaluate this experiment.
-
-<H2><A NAME="examples">Funtools Programming Examples</A></H2>
-<P>
-The following complete coding examples are provided to illustrate the
-simplicity of Funtools applications. They can be found in the funtest
-subdirectory of the Funtools distribution. In many cases, you should
-be able to modify one of these programs to generate your own Funtools
-program:
-<UL>
-<LI><A HREF="./evread.c">evread.c</A>: read and write binary tables
-<LI><A HREF="./evcol.c">evcols.c</A>: add column and rows to binary tables
-<LI><A HREF="./evmerge.c">evmerge.c</A>: merge new columns with existing columns
-<LI><A HREF="./evnext.c">evnext.c</A>: manipulate raw data pointers
-<LI><A HREF="./imblank.c">imblank.c</A>: blank out image values below a threshold
-<LI><A HREF="./asc2fits.c">asc2fits.c</A>: convert a specific ASCII table to FITS binary table
-</UL>
-
-<H2><A NAME="reference">The Funtools Programming Reference Manual</A></H2>
-<P>
-<PRE>
-#include &lt;funtools.h&gt;
-
-Fun <A HREF="./library.html#funopen">FunOpen(char *name, char *mode, Fun ref)</A>
-
-void *<A HREF="./library.html#funimageget">FunImageGet(Fun fun, void *buf, char *plist)</A>
-
-int <A HREF="./library.html#funimageput">FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix, char *plist)</A>
-
-void * <A HREF="./library.html#funimagerowget">FunImageRowGet(Fun fun, void *buf, int rstart, int rstop, char *plist)</A>
-
-void * <A HREF="./library.html#funimagerowput">FunImageRowPut(Fun fun, void *buf, int rstart, int rstop, int dim1, int dim2, int bitpix, char *plist)</A>
-
-int <A HREF="./library.html#funcolumnselect">FunColumnSelect(Fun fun, int size, char *plist, ...)</A>
-
-void <A HREF="./library.html#funcolumnactivate">FunColumnActivate(Fun fun, char *s, char *plist)</A>
-
-int <A HREF="./library.html#funcolumnlookup">FunColumnLookup(Fun fun, char *s, int which, char **name, int *type, int *mode, int *offset, int *n, int *width)</A>
-
-void *<A HREF="./library.html#funtablerowget">FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist, int *nrow)</A>
-
-int <A HREF="./library.html#funtablerowput">FunTableRowPut(Fun fun, void *rows, int nev, int idx, char *plist)</A>
-
-int <A HREF="./library.html#funparamget">FunParamGetb(Fun fun, char *name, int n, int defval, int *got)</A>
-
-int <A HREF="./library.html#funparamget">FunParamGeti(Fun fun, char *name, int n, int defval, int *got)</A>
-
-double <A HREF="./library.html#funparamget">FunParamGetd(Fun fun, char *name, int n, double defval, int *got)</A>
-
-char *<A HREF="./library.html#funparamget">FunParamGets(Fun fun, char *name, int n, char *defval, int *got)</A>
-
-int <A HREF="./library.html#funparamput">FunParamPutb(Fun fun, char *name, int n, int value, char *comm, int append)</A>
-
-int <A HREF="./library.html#funparamput">FunParamPuti(Fun fun, char *name, int n, int value, char *comm, int append)</A>
-
-int <A HREF="./library.html#funparamput">FunParamPutd(Fun fun, char *name, int n, double value, int prec, char *comm, int append)</A>
-
-int <A HREF="./library.html#funparamput">FunParamPuts(Fun fun, char *name, int n, char *value, char *comm, int append)</A>
-
-int <A HREF="./library.html#funinfoget">FunInfoGet(Fun fun, int type, ...)</A>
-
-int <A HREF="./library.html#funinfoput">FunInfoPut(Fun fun, int type, ...)</A>
-
-void <A HREF="./library.html#funflush">FunFlush(Fun fun, char *plist)</A>
-
-void <A HREF="./library.html#funclose">FunClose(Fun fun)</A>
-</PRE>
-
-<!-- =defdoc funopen funopen 3 -->
-
-<!-- =section funopen NAME -->
-<H2><A NAME="funopen">FunOpen - open a Funtools data file</A></H2>
-
-<!-- =section funopen SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- Fun FunOpen(char *name, char *mode, Fun ref);
-</PRE>
-</B>
-
-<!-- =section funopen DESCRIPTION -->
-<P>
-The <B>FunOpen()</B> routine opens a Funtools data file for reading or
-appending, or creates a new FITS file for writing. The <B>name</B>
-argument specifies the name of the Funtools data file to open. You can
-use IRAF-style bracket notation to specify
-<A HREF="./files.html">Funtools Files, Extensions, and Filters</A>.
-A separate call should be made each time a different FITS extension is
-accessed:
-<PRE>
- Fun fun;
- char *iname;
- ...
- if( !(fun = FunOpen(iname, "r", NULL)) ){
- fprintf(stderr, "could not FunOpen input file: %s\n", iname);
- exit(1);
- }
-</PRE>
-<P>
-If <B>mode</B> is "r", the file is opened for reading, and processing
-is set up to begin at the specified extension. For reading,
-<B>name</B> can be <B>stdin</B>, in which case the standard input is read.
-
-<P>
-If <B>mode</B> is "w", the file is created if it does not exist, or
-opened and truncated for writing if it does exist. Processing starts
-at the beginning of the file. The <B>name</B> can be <B>stdout</B>,
-in which case the standard output is readied for processing.
-
-<P>
-If <B>mode</B> is "a", the file is created if it does not exist, or
-opened if it does exist. Processing starts at the end of the file.
-The <B>name</B> can be <B>stdout</B>, in which case the standard
-output is readied for processing.
-
-<P>
-When a Funtools file is opened for writing or appending, a previously
-opened <A HREF="./library.html#refhandle">Funtools reference
-handle</A> can be specified as the third argument. This handle
-typically is associated with the input Funtools file that will be used
-to generate the data for the output data. When a reference file is
-specified in this way, the output file will inherit the (extension)
-header parameters from the input file:
-<PRE>
- Fun fun, fun2;
- ...
- /* open input file */
- if( !(fun = FunOpen(argv[1], "r", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-</PRE>
-Thus, in the above example, the output FITS binary table file will
-inherit all of the parameters associated with the input binary table
-extension.
-<P>
-A file opened for writing with a
-<A HREF="./library.html#refhandle">Funtools reference handle</A> also
-inherits the selected columns (i.e. those columns chosen for
-processing using the
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> routine)
-from the reference file as its default columns. This makes it easy to
-open an output file in such a way that the columns written to the
-output file are the same as the columns read in the input file. Of
-course, column selection can easily be tailored using the
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> routine.
-In particular, it is easy to merge user-defined columns with the input
-columns to generate a new file. See the
-<A HREF="./evmerge.c">evmerge</A> for a complete example.
-
-<P>
-In addition, when a
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-is supplied in a <A HREF="./library.html#funopen">FunOpen()</A> call,
-it is possible also to specify that all other extensions from the
-reference file (other than the input extension being processed) should
-be copied from the reference file to the output file. This is useful,
-for example, in a case where you are processing a FITS binary table
-or image and you want to copy all of the other extensions to
-the output file as well. Copy of other extensions is controlled by
-adding a "C" or "c" to the mode string of the
-<A HREF="./library.html#funopen">FunOpen()</A> call <B>of the input
-reference file</B>. If "C" is specified, then other extensions are
-<B>always</B> copied (i.e., copy is forced by the application). If
-"c" is used, then other extensions are copied if the user requests
-copying by adding a plus sign "+" to the extension name in the bracket
-specification. For example, the <B>funtable</B> program utilizes
-"c" mode, giving users the option of copying all other extensions:
-<PRE>
- /* open input file -- allow user copy of other extensions */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-</PRE>
-
-Thus, <B>funtable</B> supports either of these command lines:
-<PRE>
- # copy only the EVENTS extension
- csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
- # copy ALL extensions
- csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
-</PRE>
-
-<P>
-Use of a <A HREF="./library.html#refhandle">Funtools reference
-handle</A> implies that the input file is opened before the output
-file. However, it is important to note that if copy mode ("c" or "C")
-is specified for the input file, the actual input file open is delayed
-until just after the output file is opened, since the copy of prior
-extensions to the output file takes place while Funtools is seeking to
-the specified input extension. This implies that the output file
-should be opened before any I/O is done on the input file or else the
-copy will fail. Note also that the copy of subsequent extension will
-be handled automatically by
-<A HREF="./library.html#funclose">FunClose()</A>
-if the output file is
-closed before the input file. Alternatively, it can be done explicitly
-by <A HREF="./library.html#funflush">FunFlush()</A>, but again, this
-assumes that the input file still is open.
-
-<P>
-Upon success <A HREF="./library.html#funopen">FunOpen()</A> returns a
-Fun handle that is used in subsequent Funtools calls. On error, NULL
-is returned.
-
-<!-- =defdoc funimageget funimageget 3 -->
-
-<!-- =section funimageget NAME -->
-<H2><A NAME="funimageget">FunImageGet - get an image or image section</A></H2>
-
-<!-- =section funimageget SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void *FunImageGet(Fun fun, void *buf, char *plist)
-</PRE>
-</B>
-
-<!-- =section funimageget DESCRIPTION -->
-<P>
-The <B>FunImageGet()</B> routine returns an binned image array of the
-specified section of a Funtools data file. If the input data are
-already of type image, the array is generated by extracting the
-specified image section and then binning it according to the specified
-bin factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-<B>bincols=</B> keyword (using appropriate default columns as
-necessary), after which the image section and bin factors are
-applied. In both cases, the data is automatically converted from FITS
-to native format, if necessary.
-<P>
-The first argument is the Funtools handle returned by
-<A HREF="./library.html#funopen">FunOpen()</A>. The second <B>buf</B>
-argument is a pointer to a data buffer to fill. If NULL is specified,
-FunImageGet will allocate a buffer of the appropriate size. Generally
-speaking, you always want Funtools to allocate the buffer because
-the image dimensions will be determined by
-<A HREF="./files.html#sections">Funtools image sectioning</A>
-on the command line.
-<P>
-The third <B>plist</B> (i.e., parameter list) argument is a string
-containing one or more comma-delimited <B>keyword=value</B>
-parameters. It can be used to specify the return data type using the
-<B>bitpix=</B> keyword. If no such keyword is specified in the plist
-string, the data type of the returned image is the same as the data type
-of the original input file, or is of type int for FITS binary tables.
-
-<P>
-If the <B>bitpix=</B> keyword is supplied in the plist string, the data
-type of the returned image will be one of the supported FITS image
-data types:
-<UL>
-<LI> 8 unsigned char
-<LI> 16 short
-<LI> 32 int
-<LI> -32 float
-<LI> -64 double
-</UL>
-For example:
-<PRE>
- void *buf;
- /* extract data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, NULL)) )
- gerror(stderr, "could not FunImageGet: %s\n", iname);
-</PRE>
-will allocate buf and retrieve the image in the file data format. In
-this case, you will have to determine the data type (using the
-FUN_SECT_BITPIX value in the
-<A HREF="./library.html#funinfoget">FunInfoGet()</A>
-routine)
-and then use a switch statement to process each data type:
-<PRE>
- int bitpix;
- void *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- ...
- buf = FunImageGet(fun, NULL, NULL);
- FunInfoGet(fun, FUN_SECT_BITPIX, &bitpix, 0);
- /* set appropriate data type buffer to point to image buffer */
- switch(bitpix){
- case 8:
- cbuf = (unsigned char *)buf; break;
- case 16:
- sbuf = (short *)buf; break;
- case 32:
- ibuf = (int *)buf; break;
- ...
-</PRE>
-See the
-<A HREF="./imblank.c">imblank example code</A>
-for more details on how to process an image when the data type is not
-specified beforehand.
-
-<P>
-It often is easier to specify the data type directly:
-<PRE>
- double *buf;
- /* extract data section into a double image buffer */
- if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) )
- gerror(stderr, "could not FunImageGet: %s\n", iname);
-</PRE>
-will extract the image while converting to type double.
-
-<P>
-On success, a pointer to the image buffer is returned. (This will be
-the same as the second argument, if NULL is not passed to the latter.)
-On error, NULL is returned.
-
-<P>
-In summary, to retrieve image or row data into a binned image, you simply
-call FunOpen() followed by
-<A HREF="./library.html#funimageget">FunImageGet()</A>. Generally, you
-then will want to call
-<A HREF="./library.html#funinfoget">FunInfoGet()</A>
-to retrieve the
-axis dimensions (and data type) of the section you are processing
-(so as to take account of sectioning and blocking of the original data):
-<PRE>
- double *buf;
- int i, j;
- int dim1, dim2;
- ... other declarations, etc.
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* extract and bin the data section into a double float image buffer */
- if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) )
- gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
-
- /* get dimension information from funtools structure */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-
- /* loop through pixels and reset values below limit to value */
- for(i=0; i&lt;dim1*dim2; i++){
- if( buf[i] <= blimit ) buf[i] = bvalue;
- }
-</PRE>
-
-<P>
-Another useful plist string value is "mask=all", which returns an
-image populated with regions id values. Image pixels within a region
-will contain the associated region id (region values start at 1), and
-otherwise will contain a 0 value. Thus, the returned image is a
-region mask which can be used to process the image data (which
-presumably is retrieved by a separate call to FunImageGet) pixel by
-pixel.
-
-<P>
-If a FITS binary table or a non-FITS raw event file is being binned
-into an image, it is necessary to specify the two columns that will be
-used in the 2D binning. This usually is done on the command line
-using the <B>bincols=(x,y)</B> keyword:
-<PRE>
- funcnts "foo.ev[EVENTS,bincols=(detx,dety)]"
-</PRE>
-
-<P>
-The full form of the <B>bincols=</B> specifier is:
-<PRE>
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-</PRE>
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-<PRE>
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-</PRE>
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters (respectively) are present in the
-FITS binary table header for the column in question. Note that if
-only one parameter is specified, it is assumed to be tlmax, and tlmin
-defaults to 1. If two parameters are specified, they are assumed to be
-tlmin and tlmax.
-
-<P>
-If <B>bincols</B> is not specified on the command line, Funtools tries
-to use appropriate defaults: it looks for the environment variable
-FITS_BINCOLS (or FITS_BINKEY). Then it looks for the Chandra
-parameters CPREF (or PREFX) in the FITS binary table header. Failing
-this, it looks for columns named "X" and "Y" and if these are not
-found, it looks for columns containing the characters "X" and "Y".
-<P>
-See <A HREF="./files.html#binning">Binning FITS Binary Tables and
-Non-FITS Event Files</A> for more information.
-
-<!-- =defdoc funimageput funimageput 3 -->
-
-<!-- =section funimageput NAME -->
-<H2><A NAME="funimageput">FunImagePut - put an image to a Funtools file</A></H2>
-<!-- =section funimageput SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix,
- char *plist)
-</PRE>
-</B>
-
-<!-- =section funimageput DESCRIPTION -->
-The <B>FunImagePut()</B> routine outputs an image array to a FITS
-file. The image is written either as a primary header/data unit or as
-an image extension, depending on whether other data have already been
-written to the file. That is, if the current file position is at the
-beginning of the file, a primary HDU is written. Otherwise, an
-image extension is written.
-
-<P>
-The first argument is the Funtools handle returned by
-<A HREF="./library.html#funopen">FunOpen()</A>. The second <B>buf</B>
-argument is a pointer to a data buffer to write. The <B>dim1</B>and
-<B>dim2</B> arguments that follow specify the dimensions of the image,
-where dim1 corresponds to naxis1 and dim2 corresponds to naxis2. The
-<B>bitpix</B> argument specifies the data type of the image and can
-have the following FITS-standard values:
-<UL>
-<LI> 8 unsigned char
-<LI> 16 short
-<LI> 32 int
-<LI> -32 float
-<LI> -64 double
-</UL>
-
-<P>
-When <A HREF="./library.html#funtablerowput">FunTableRowPut()</A> is first
-called for a given image, Funtools checks to see if the primary header
-has already been written (by having previously written an image or a
-binary table.) If not, this image is written to the primary HDU.
-Otherwise, it is written to an image extension.
-<P>
-Thus, a simple program to generate a FITS image might look like this:
-<PRE>
- int i;
- int dim1=512, dim2=512;
- double *dbuf;
- Fun fun;
- dbuf = malloc(dim1*dim2*sizeof(double));
- /* open the output FITS image, preparing to copy input params */
- if( !(fun = FunOpen(argv[1], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[1]);
- for(i=0; i&lt;(dim1*dim2); i++){
- ... fill dbuf ...
- }
- /* put the image (header will be generated automatically */
- if( !FunImagePut(fun, buf, dim1, dim2, -64, NULL) )
- gerror(stderr, "could not FunImagePut: %s\n", argv[1]);
- FunClose(fun);
- free(dbuf);
-</PRE>
-
-<P>
-In addition, if a
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-was specified when this table was opened, the
-parameters from this
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-are merged into the new image
-header. Furthermore, if a reference image was specified during
-<A HREF="./library.html#funopen">FunOpen()</A>, the values of
-<B>dim1</B>, <B>dim2</B>, and <B>bitpix</B> in the calling sequence
-can all be set to 0. In this case, default values are taken from the
-reference image section. This is useful if you are reading an image
-section in its native data format, processing it, and then writing
-that section to a new FITS file. See the
-<A HREF="./imblank.c">imblank example code</A>.
-
-<P>
-The data are assumed to be in the native machine format and will
-automatically be swapped to FITS big-endian format if necessary. This
-behavior can be over-ridden with the <B>convert=[true|false]</B>
-keyword in the <B>plist</B> param list string.
-
-<p>
-When you are finished writing the image, you should call
-<A HREF="./library.html#funflush">FunFlush()</A> to write out the FITS
-image padding. However, this is not necessary if you subsequently call
-FunClose() without doing any other I/O to the FITS file.
-
-<!-- =defdoc funimagerowget funimagerowget 3 -->
-
-<!-- =section funimagerowget NAME -->
-<H2><A NAME="funimagerowget">FunImageRowGet - get row(s) of an image</A></H2>
-
-<!-- =section funimagerowget SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void *FunImageRowGet(Fun fun, void *buf, int rstart, int rstop,
- char *plist)
-</PRE>
-</B>
-
-<!-- =section funimagerowget DESCRIPTION -->
-<P>
-The <B>FunImageRowGet()</B> routine returns one or more image rows
-from the specified section of a Funtools data file. If the input data
-are of type image, the array is generated by extracting the specified
-image rows and then binning them according to the specified bin
-factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-<B>bincols=</B> keyword (using appropriate default columns as needed),
-after which the image section and bin factors are applied.
-
-<P>
-The first argument is the Funtools handle returned by
-<A HREF="./library.html#funopen">FunOpen()</A>. The second <B>buf</B>
-argument is a pointer to a data buffer to fill. If NULL is specified,
-FunImageGet() will allocate a buffer of the appropriate size.
-
-<P>
-The third and fourth arguments specify the first and last row to
-retrieve. Rows are counted starting from 1, up to the value of
-FUN_YMAX(fun). The final <B>plist</B> (i.e., parameter list) argument
-is a string containing one or more comma-delimited
-<B>keyword=value</B> parameters. It can be used to specify the return
-data type using the <B>bitpix=</B> keyword. If no such keyword is
-specified in the plist string, the data type of the image is the same
-as the data type of the original input file, or is of type int for
-FITS binary tables.
-
-<P>
-If the <B>bitpix=</B>value is supplied in the plist string, the data
-type of the returned image will be one of the supported FITS image
-data types:
-<UL>
-<LI> 8 unsigned char
-<LI> 16 short
-<LI> 32 int
-<LI> -32 float
-<LI> -64 double
-</UL>
-
-<P>
-For example:
-<PRE>
- double *drow;
- Fun fun;
- ... open files ...
- /* get section dimensions */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* allocate one line's worth */
- drow = malloc(dim1*sizeof(double));
- /* retrieve and process each input row (starting at 1) */
- for(i=1; i <= dim2; i++){
- if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", i, iname);
- /* reverse the line */
- for(j=1; j<=dim1; j++){
- ... process drow[j-1] ...
- }
- }
- ...
-</PRE>
-
-<P>
-On success, a pointer to the image buffer is returned. (This will be
-the same as the second argument, if NULL is not passed to the latter.)
-On error, NULL is returned. Note that the considerations described
-above for specifying binning columns in
-<A HREF="./library.html#funimageget">FunImageGet()</A> also apply to
-<B>FunImageRowGet()</B>.
-
-<!-- =defdoc funimagerowput funimagerowput 3 -->
-
-<!-- =section funimagerowput NAME -->
-<H2><A NAME="funimagerowput">FunImageRowPut - put row(s) of an image</A></H2>
-
-<!-- =section funimagerowput SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void *FunImageRowPut(Fun fun, void *buf, int rstart, int rstop,
- int dim1, int dim2, int bitpix, char *plist)
-</PRE>
-</B>
-
-<!-- =section funimagerowput DESCRIPTION -->
-<P>
-The <B>FunImageRowPut()</B> routine writes one or more image rows to
-the specified FITS image file. The first argument is the Funtools
-handle returned by <A HREF="./library.html#funopen">FunOpen()</A>.
-The second <B>buf</B> argument is a pointer to the row data buffer,
-while the third and fourth arguments specify the starting and ending
-rows to write. Valid rows values range from 1 to dim2, i.e., row is
-one-valued.
-
-<P>
-The <B>dim1</B>and <B>dim2</B> arguments that follow specify the
-dimensions, where dim1 corresponds to naxis1 and dim2 corresponds to
-naxis2. The <B>bitpix</B> argument data type of the image and can
-have the following FITS-standard values:
-<UL>
-<LI> 8 unsigned char
-<LI> 16 short
-<LI> 32 int
-<LI> -32 float
-<LI> -64 double
-</UL>
-
-For example:
-<PRE>
- double *drow;
- Fun fun, fun2;
- ... open files ...
- /* get section dimensions */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* allocate one line's worth */
- drow = malloc(dim1*sizeof(double));
- /* retrieve and process each input row (starting at 1) */
- for(i=1; i <= dim2; i++){
- if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", i, iname);
- ... process drow ...
- if( !FunImageRowPut(fun2, drow, i, i, 64, NULL) )
- gerror(stderr, "can't FunImageRowPut: %d %s\n", i, oname);
- }
- ...
-</PRE>
-
-<P>
-The data are assumed to be in the native machine format and will
-automatically be swapped to big-endian FITS format if necessary. This
-behavior can be over-ridden with the <B>convert=[true|false]</B>
-keyword in the <B>plist</B> param list string.
-
-<p>
-When you are finished writing the image, you should call
-<A HREF="./library.html#funflush">FunFlush()</A> to write out the FITS
-image padding. However, this is not necessary if you subsequently call
-FunClose() without doing any other I/O to the FITS file.
-
-<!-- =defdoc funcolumnselect funcolumnselect 3 -->
-
-<!-- =section funcolumnselect NAME -->
-<H2><A NAME="funcolumnselect">FunColumnSelect - select Funtools columns</A></H2>
-<!-- =section funcolumnselect SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunColumnSelect(Fun fun, int size, char *plist,
- char *name1, char *type1, char *mode1, int offset1,
- char *name2, char *type2, char *mode2, int offset2,
- ...,
- NULL)
-
- int FunColumnSelectArr(Fun fun, int size, char *plist,
- char **names, char **types, char **modes,
- int *offsets, int nargs);
-</PRE>
-</B>
-
-<!-- =section funcolumnselect DESCRIPTION -->
-The <B>FunColumnSelect()</B> routine is used to select the columns
-from a Funtools binary table extension or raw event file for
-processing. This routine allows you to specify how columns in a file
-are to be read into a user record structure or written from a user
-record structure to an output FITS file.
-
-<P>
-The first argument is the Fun handle associated with this set of
-columns. The second argument specifies the size of the user record
-structure into which columns will be read. Typically, the sizeof()
-macro is used to specify the size of a record structure. The third
-argument allows you to specify keyword directives for the selection
-and is described in more detail below.
-
-<P>
-Following the first three required arguments is a variable length list of
-column specifications. Each column specification will consist of four
-arguments:
-<UL>
-<LI> <B>name</B>: the name of the column
-
-<LI> <B>type</B>: the data type of the column as it will be stored in
-the user record struct (not the data type of the input file). The
-following basic data types are recognized:
-<UL>
-<LI>A: ASCII characters
-<LI>B: unsigned 8-bit char
-<LI>I: signed 16-bit int
-<LI>U: unsigned 16-bit int (not standard FITS)
-<LI>J: signed 32-bit int
-<LI>V: unsigned 32-bit int (not standard FITS)
-<LI>E: 32-bit float
-<LI>D: 64-bit float
-</UL>
-The syntax used is similar to that which defines the TFORM parameter
-in FITS binary tables. That is, a numeric repeat value can precede
-the type character, so that "10I" means a vector of 10 short ints, "E"
-means a single precision float, etc. Note that the column value from
-the input file will be converted to the specified data type as the
-data is read by
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A>.
-
-<P>
-[ A short digression regarding bit-fields: Special attention is
-required when reading or writing the FITS bit-field type
-("X"). Bit-fields almost always have a numeric repeat character
-preceding the 'X' specification. Usually this value is a multiple of 8
-so that bit-fields fit into an integral number of bytes. For all
-cases, the byte size of the bit-field B is (N+7)/8, where N is the
-numeric repeat character.
-
-<p>
-A bit-field is most easily declared in the user struct as an array of
-type char of size B as defined above. In this case, bytes are simply
-moved from the file to the user space. If, instead, a short or int
-scalar or array is used, then the algorithm for reading the bit-field
-into the user space depends on the size of the data type used along
-with the value of the repeat character. That is, if the user data
-size is equal to the byte size of the bit-field, then the data is
-simply moved (possibly with endian-based byte-swapping) from one to
-the other. If, on the other hand, the data storage is larger than the
-bit-field size, then a data type cast conversion is performed to move
-parts of the bit-field into elements of the array. Examples will help
-make this clear:
-
-<UL>
-<LI> If the file contains a 16X bit-field and user space specifies a 2B
-char array[2], then the bit-field is moved directly into the char array.
-
-<LI> If the file contains a 16X bit-field and user space specifies a 1I
-scalar short int, then the bit-field is moved directly into the short int.
-
-<LI> If the file contains a 16X bit-field and user space specifies a 1J
-scalar int, then the bit-field is type-cast to unsigned int before
-being moved (use of unsigned avoids possible sign extension).
-
-<LI> If the file contains a 16X bit-field and user space specifies a 2J
-int array[2], then the bit-field is handled as 2 chars, each of which
-are type-cast to unsigned int before being moved (use of unsigned
-avoids possible sign extension).
-
-<LI> If the file contains a 16X bit-field and user space specifies a 1B
-char, then the bit-field is treated as a char, i.e., truncation will
-occur.
-
-<LI> If the file contains a 16X bit-field and user space specifies a 4J
-int array[4], then the results are undetermined.
-
-</UL>
-For all user data types larger than char, the bit-field is byte-swapped
-as necessary to convert to native format, so that bits in the
-resulting data in user space can be tested, masked, etc. in the same
-way regardless of platform.]
-
-<P>
-In addition to setting data type and size, the <B>type</B>
-specification allows a few ancillary parameters to be set, using the
-full syntax for <B>type</B>:
-<PRE>
- [@][n]&lt;type&gt;[[['B']poff]][:[tlmin[:tlmax[:binsiz]]]]
-</PRE>
-
-<P>
-The special character "@" can be prepended to this specification to
-indicated that the data element is a pointer in the user record,
-rather than an array stored within the record.
-
-<P>
-The [n] value is an integer that specifies the
-number of elements that are in this column (default is 1). TLMIN,
-TLMAX, and BINSIZ values also can be specified for this column after
-the type, separated by colons. If only one such number is specified,
-it is assumed to be TLMAX, and TLMIN and BINSIZ are set to 1.
-
-<P>
-The [poff] value can be used to specify the offset into an
-array. By default, this offset value is set to zero and the data
-specified starts at the beginning of the array. The offset usually
-is specified in terms of the data type of the column. Thus an offset
-specification of [5] means a 20-byte offset if the data type is a
-32-bit integer, and a 40-byte offset for a double. If you want to
-specify a byte offset instead of an offset tied to the column data type,
-precede the offset value with 'B', e.g. [B6] means a 6-bye offset,
-regardless of the column data type.
-
-The [poff] is especially useful in conjunction with the pointer @
-specification, since it allows the data element to anywhere stored
-anywhere in the allocated array. For example, a specification such as
-"@I[2]" specifies the third (i.e., starting from 0) element in the
-array pointed to by the pointer value. A value of "@2I[4]" specifies
-the fifth and sixth values in the array. For example, consider the
-following specification: <PRE>
-
- typedef struct EvStruct{
- short x[4], *atp;
- } *Event, EventRec;
- /* set up the (hardwired) columns */
- FunColumnSelect( fun, sizeof(EventRec), NULL,
- "2i", "2I ", "w", FUN_OFFSET(Event, x),
- "2i2", "2I[2]", "w", FUN_OFFSET(Event, x),
- "at2p", "@2I", "w", FUN_OFFSET(Event, atp),
- "at2p4", "@2I[4]", "w", FUN_OFFSET(Event, atp),
- "atp9", "@I[9]", "w", FUN_OFFSET(Event, atp),
- "atb20", "@I[B20]", "w", FUN_OFFSET(Event, atb),
- NULL);
-</PRE>
-Here we have specified the following columns:
-<UL>
-<LI> 2i: two short ints in an array which is stored as part the
-record
-<LI> 2i2: the 3rd and 4th elements of an array which is stored
-as part of the record
-<LI> an array of at least 10 elements, not stored in the record but
-allocated elsewhere, and used by three different columns:
-<UL>
-<LI> at2p: 2 short ints which are the first 2 elements of the allocated array
-<LI> at2p4: 2 short ints which are the 5th and 6th elements of
-the allocated array
-<LI> atp9: a short int which is the 10th element of the allocated array
-</UL>
-<LI> atb20: a short int which is at byte offset 20 of another allocated array
-</UL>
-In this way, several columns can be specified, all of which are in a
-single array. <B>NB</B>: it is the programmer's responsibility to
-ensure that specification of a positive value for poff does not point
-past the end of valid data.
-
-<LI> <B>read/write mode</B>: "r" means that the column is read from an
-input file into user space by
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A>, "w" means that
-the column is written to an output file. Both can specified at the same
-time.
-
-<LI> <B>offset</B>: the offset into the user data to store
-this column. Typically, the macro FUN_OFFSET(recname, colname) is used
-to define the offset into a record structure.
-</UL>
-
-<P>
-When all column arguments have been specified, a final NULL argument
-must added to signal the column selection list.
-
-<P>
-As an alternative to the varargs
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-routine, a non-varargs routine called
-<A HREF="./library.html#funcolumnselect">FunColumnSelectArr()</A>
-also is available. The first three arguments (fun, size, plist) of this
-routine are the same as in
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>.
-Instead of a variable
-argument list, however,
-<A HREF="./library.html#funcolumnselect">FunColumnSelectArr()</A>
-takes 5 additional arguments. The first 4 arrays arguments contain the
-names, types, modes, and offsets, respectively, of the columns being
-selected. The final argument is the number of columns that are
-contained in these arrays. It is the user's responsibility to free
-string space allocated in these arrays.
-
-<P>
-Consider the following example:
-<PRE>
- typedef struct evstruct{
- int status;
- float pi, pha, *phas;
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "status", "J", "r", FUN_OFFSET(Ev, status),
- "pi", "E", "r", FUN_OFFSET(Ev, pi),
- "pha", "E", "r", FUN_OFFSET(Ev, pha),
- "phas", "@9E", "r", FUN_OFFSET(Ev, phas),
- NULL);
-</PRE>
-<P>
-Each time a row is read into the Ev struct, the "status" column is
-converted to an int data type (regardless of its data type in the
-file) and stored in the status value of the struct. Similarly, "pi"
-and "pha", and the phas vector are all stored as floats. Note that the
-"@" sign indicates that the "phas" vector is a pointer to a 9 element
-array, rather than an array allocated in the struct itself. The row
-record can then be processed as required:
-<PRE>
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i&lt;got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ev->pi = (ev->pi+.5);
- ev->pha = (ev->pi-.5);
- }
-</PRE>
-
-<P>
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-can also be called to define "writable" columns in order to generate a FITS
-Binary Table, without reference to any input columns. For
-example, the following will generate a 4-column FITS binary table when
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A> is used to
-write Ev records:
-
-<PRE>
- typedef struct evstruct{
- int status;
- float pi, pha
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "status", "J", "w", FUN_OFFSET(Ev, status),
- "pi", "E", "w", FUN_OFFSET(Ev, pi),
- "pha", "E", "w", FUN_OFFSET(Ev, pha),
- "energy", "D", "w", FUN_OFFSET(Ev, energy),
- NULL);
-</PRE>
-All columns are declared to be write-only, so presumably the column
-data is being generated or read from some other source.
-
-<P>
-In addition,
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-can be called to define <B>both</B> "readable" and "writable" columns.
-In this case, the "read" columns
-are associated with an input file, while the "write" columns are
-associated with the output file. Of course, columns can be specified as both
-"readable" and "writable", in which case they are read from input
-and (possibly modified data values are) written to the output.
-The
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-call itself is made by passing the input Funtools handle, and it is
-assumed that the output file has been opened using this input handle
-as its
-<A HREF="./library.html#refhandle">Funtools reference handle</A>.
-
-<P>
-Consider the following example:
-<PRE>
- typedef struct evstruct{
- int status;
- float pi, pha, *phas;
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "status", "J", "r", FUN_OFFSET(Ev, status),
- "pi", "E", "rw", FUN_OFFSET(Ev, pi),
- "pha", "E", "rw", FUN_OFFSET(Ev, pha),
- "phas", "@9E", "rw", FUN_OFFSET(Ev, phas),
- "energy", "D", "w", FUN_OFFSET(Ev, energy),
- NULL);
-</PRE>
-As in the "read" example above, each time an row is read into the Ev
-struct, the "status" column is converted to an int data type
-(regardless of its data type in the file) and stored in the status
-value of the struct. Similarly, "pi" and "pha", and the phas vector
-are all stored as floats. Since the "pi", "pha", and "phas" variables
-are declared as "writable" as well as "readable", they also will be
-written to the output file. Note, however, that the "status" variable
-is declared as "readable" only, and hence it will not be written to
-an output file. Finally, the "energy" column is declared as
-"writable" only, meaning it will not be read from the input file. In
-this case, it can be assumed that "energy" will be calculated in the
-program before being output along with the other values.
-
-<P>
-In these simple cases, only the columns specified as "writable" will
-be output using
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A>. However,
-it often is the case that you want to merge the user columns back in
-with the input columns, even in cases where not all of the input
-column names are explicitly read or even known. For this important
-case, the <B>merge=[type]</B> keyword is provided in the plist string.
-
-<P>
-The <B>merge=[type]</B> keyword tells Funtools to merge the columns from
-the input file with user columns on output. It is normally used when
-an input and output file are opened and the input file provides the
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-for the output file. In this case, each time
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A> is called, the
-raw input rows are saved in a special buffer. If
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A> then is called
-(before another call to
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A>), the contents
-of the raw input rows are merged with the user rows according to the
-value of <B>type</B> as follows:
-
-<UL>
-<LI> <B>update</B>: add new user columns, and update value of existing ones (maintaining the input data type)
-
-<LI> <B>replace</B>: add new user columns, and replace the data type
-and value of existing ones. (Note that if tlmin/tlmax values are not
-specified in the replacing column, but are specified in the original
-column being replaced, then the original tlmin/tlmax values are used
-in the replacing column.)
-
-<LI> <B>append</B>: only add new columns, do not "replace" or "update" existing ones
-</UL>
-
-<P>
-Consider the example above. If <B>merge=update</B> is specified in the
-plist string, then "energy" will be added to the input columns, and
-the values of "pi", "pha", and "phas" will be taken from the user
-space (i.e., the values will be updated from the original values, if
-they were changed by the program). The data type for "pi", "pha", and
-"phas" will be the same as in the original file. If
-<B>merge=replace</B> is specified, both the data type and value of
-these three input columns will be changed to the data type and value
-in the user structure. If <B>merge=append</B> is specified, none of
-these three columns will be updated, and only the "energy" column will
-be added. Note that in all cases, "status" will be written from the
-input data, not from the user record, since it was specified as read-only.
-
-<P>
-Standard applications will call
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-to define user columns. However, if this routine is not called, the
-default behavior is to transfer all input columns into user space. For
-this purpose a default record structure is defined such that each data
-element is properly aligned on a valid data type boundary. This
-mechanism is used by programs such as fundisp and funtable to process
-columns without needing to know the specific names of those columns.
-It is not anticipated that users will need such capabilities (contact
-us if you do!)
-
-<p>
-By default, <A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-reads/writes rows to/from an "array of structs", where each struct contains
-the column values for a single row of the table. This means that the
-returned values for a given column are not contiguous. You can
-set up the IO to return a "struct of arrays" so that each of the
-returned columns are contiguous by specifying <B>org=structofarrays</B>
-(abbreviation: <B>org=soa</B>) in the plist.
-(The default case is <B>org=arrayofstructs</B> or <B>org=aos</B>.)
-
-<P>
-For example, the default setup to retrieve rows from a table would be
-to define a record structure for a single event and then call
- <A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-as follows:
-<PRE>
- typedef struct evstruct{
- short region;
- double x, y;
- int pi, pha;
- double time;
- } *Ev, EvRec;
-
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "x", "D:10:10", mode, FUN_OFFSET(Ev, x),
- "y", "D:10:10", mode, FUN_OFFSET(Ev, y),
- "pi", "J", mode, FUN_OFFSET(Ev, pi),
- "pha", "J", mode, FUN_OFFSET(Ev, pha),
- "time", "1D", mode, FUN_OFFSET(Ev, time),
- NULL);
-</PRE>
-Subsequently, each call to
-<HREF="./library.html#funtablerowget">FunTableRowGet()</A>
-will return an array of structs, one for each returned row. If instead you
-wanted to read columns into contiguous arrays, you specify <B>org=soa</B>:
-<PRE>
- typedef struct aevstruct{
- short region[MAXROW];
- double x[MAXROW], y[MAXROW];
- int pi[MAXROW], pha[MAXROW];
- double time[MAXROW];
- } *AEv, AEvRec;
-
- got = FunColumnSelect(fun, sizeof(AEvRec), "org=soa",
- "x", "D:10:10", mode, FUN_OFFSET(AEv, x),
- "y", "D:10:10", mode, FUN_OFFSET(AEv, y),
- "pi", "J", mode, FUN_OFFSET(AEv, pi),
- "pha", "J", mode, FUN_OFFSET(AEv, pha),
- "time", "1D", mode, FUN_OFFSET(AEv, time),
- NULL);
-</PRE>
-Note that the only modification to the call is in the plist string.
-
-<P>
-Of course, instead of using staticly allocated arrays, you also can specify
-dynamically allocated pointers:
-<PRE>
- /* pointers to arrays of columns (used in struct of arrays) */
- typedef struct pevstruct{
- short *region;
- double *x, *y;
- int *pi, *pha;
- double *time;
- } *PEv, PEvRec;
-
- got = FunColumnSelect(fun, sizeof(PEvRec), "org=structofarrays",
- "$region", "@I", mode, FUN_OFFSET(PEv, region),
- "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
- "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
- "pi", "@J", mode, FUN_OFFSET(PEv, pi),
- "pha", "@J", mode, FUN_OFFSET(PEv, pha),
- "time", "@1D", mode, FUN_OFFSET(PEv, time),
- NULL);
-</PRE>
-Here, the actual storage space is either allocated by the user or by the
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> call).
-
-<P>
-In all of the above cases, the same call is made to retrieve rows, e.g.:
-<PRE>
- buf = (void *)FunTableRowGet(fun, NULL, MAXROW, NULL, &got);
-</PRE>
-However, the individual data elements are accessed differently.
-For the default case of an "array of structs", the
-individual row records are accessed using:
-<PRE>
- for(i=0; i&lt;got; i++){
- ev = (Ev)buf+i;
- fprintf(stdout, "%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- ev->x, ev->y, ev->pi, ev->pha, ev->dx, ev->dy, ev->time);
- }
-</PRE>
-For a struct of arrays or a struct of array pointers, we have a single struct
-through which we access individual columns and rows using:
-<PRE>
- aev = (AEv)buf;
- for(i=0; i&lt;got; i++){
- fprintf(stdout, "%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- aev->x[i], aev->y[i], aev->pi[i], aev->pha[i],
- aev->dx[i], aev->dy[i], aev->time[i]);
- }
-</PRE>
-Support for struct of arrays in the
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A>
-call is handled analogously.
-
-<P>
-See the <A HREF="./evread.c">evread example code</A>
-and
-<A HREF="./evmerge.c">evmerge example code</A>
-for working examples of how
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> is used.
-
-<!-- =defdoc funcolumnactivate funcolumnactivate 3 -->
-
-<!-- =section funcolumnactivate NAME -->
-<H2><A NAME="funcolumnactivate">FunColumnActivate - activate Funtools columns</A></H2>
-
-<!-- =section funcolumnactivate SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void FunColumnActivate(Fun fun, char *s, char *plist)
-</PRE>
-</B>
-
-<!-- =section funcolumnactivate DESCRIPTION -->
-<P>
-The <B>FunColumnActivate()</B> routine determines which columns (set up
-by <A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>)
-ultimately will be read and/or written. By default, all columns that
-are selected using
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-are activated. The
-<A HREF="./library.html#funcolumnactivate">FunColumnActivate()</A>
-routine can be used to turn off/off activation of specific columns.
-
-<P>
-The first argument is the Fun handle associated with this set of
-columns. The second argument is a space-delimited list of columns to
-activate or de-activate. Columns preceded by "+" are activated and
-columns preceded by a "-" are de-activated. If a column is named
-without "+" or "-", it is activated. The reserved strings "$region"
-and '$n' are used to activate a special columns containing the filter
-region value and row value, respectively, associated with
-this row. For example, if a filter containing two circular regions is
-specified as part of the Funtools file name, this column will contain
-a value of 1 or 2, depending on which region that row was in. The
-reserved strings "$x" and "$y" are used to activate the current
-binning columns. Thus, if the columns DX and DY are specified as
-binning columns:
-<PRE>
- [sh $] fundisp foo.fits[bincols=(DX,DY)]
-</PRE>
-then "$x" and "$y" will refer to these columns in a call to
-<A HREF="./library.html#funcolumnactivate">FunColumnActivate()</A>.
-
-<P>
-In addition, if the activation string contains only columns to be
-activated, then the routine will de-activate all other columns.
-Similarly, if the activation string contains only
-columns to de-activate, then the routine will activate all other columns
-before activating the list. This makes it simple to change the
-activation state of all columns without having to know all of the
-column names. For example:
-<UL>
-<LI> <B>"pi pha time"</B> # only these three columns will be active
-<LI> <B>"-pi -pha -time"</B> # all but these columns will be active
-<LI> <B>"pi -pha"</B> # only pi is active, pha is not, others are not
-<LI> <B>"+pi -pha"</B> # same as above
-<LI> <B>"pi -pha -time"</B> # only pi is active, all others are not
-<LI> <B>"pi pha"</B> # pha and pi are active, all others are not
-<LI> <B>"pi pha -x -y"</B> # pha and pi are active, all others are not
-</UL>
-
-<p>
-You can use the column activation list to reorder columns, since
-columns are output in the order specified. For example:
-<PRE>
- # default output order
- fundisp snr.ev'[cir 512 512 .1]'
- X Y PHA PI TIME DX DY
- -------- -------- -------- -------- --------------------- -------- --------
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-
- # re-order the output by specifying explicit order
- fundisp snr.ev'[cir 512 512 .1]' "time x y dy dx pi pha"
- TIME X Y DY DX PI PHA
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 512 512 574 578 7 6
- 79494575.58943175 512 512 573 579 9 8
- 79493631.03866175 512 512 575 578 6 5
- 79493290.86521725 512 512 575 578 5 5
- 79493432.00990875 512 512 573 579 9 8
-</PRE>
-
-<P>
-A "+" sign by itself means to activate all columns, so that you can reorder
-just a few columns without specifying all of them:
-<PRE>
- # reorder 3 columns and then output the rest
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha +"
- TIME PI PHA Y X DX DY
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 7 6 512 512 578 574
- 79494575.58943175 9 8 512 512 579 573
- 79493631.03866175 6 5 512 512 578 575
- 79493290.86521725 5 5 512 512 578 575
- 79493432.00990875 9 8 512 512 579 573
-</PRE>
-The column activation/deactivation is performed in the order of the
-specified column arguments. This means you can mix "+", "-" (which
-de-activates all columns) and specific column names to reorder and
-select columns in one command. For example, consider the following:
-<PRE>
- # reorder and de-activate
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha + -x -y"
- TIME PI PHA DX DY
- --------------------- -------- -------- -------- --------
- 79493997.45854475 7 6 578 574
- 79494575.58943175 9 8 579 573
- 79493631.03866175 6 5 578 575
- 79493290.86521725 5 5 578 575
- 79493432.00990875 9 8 579 573
-</PRE>
-We first activate "time", "pi", and "pha" so that they are output first.
-We then activate all of the other columns, and then de-activate "x" and "y".
-Note that this is different from:
-<PRE>
- # probably not what you want ...
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha -x -y +"
- TIME PI PHA Y X DX DY
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 7 6 512 512 578 574
- 79494575.58943175 9 8 512 512 579 573
- 79493631.03866175 6 5 512 512 578 575
- 79493290.86521725 5 5 512 512 578 575
- 79493432.00990875 9 8 512 512 579 573
-</PRE>
-Here, "x" and "y" are de-activated, but then all columns including "x" and
-"y" are again re-activated.
-
-<p>
-Typically,
-<A HREF="./library.html#funcolumnactivate">FunColumnActivate()</A> uses a
-list of columns that are passed into the program from the command line. For
-example, the code for funtable contains the following:
-<PRE>
- char *cols=NULL;
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* set active flag for specified columns */
- if( argc >= 4 ) cols = argv[3];
- FunColumnActivate(fun, cols, NULL);
-</PRE>
-
-The <A HREF="./library.html#funopen">FunOpen()</A> call sets the
-default columns to be all columns in the input file. The
-<A HREF="./library.html#funcolumnactivate">FunColumnActivate()</A> call
-then allows the user to control which columns ultimately will be
-activated (i.e., in this case, written to the new file). For example:
-<PRE>
- funtable test.ev foo.ev "pi pha time"
-</PRE>
-will process only the three columns mentioned, while:
-<PRE>
- funtable test.ev foo.ev "-time"
-</PRE>
-will process all columns except "time".
-
-<P>
-If <A HREF="./library.html#funcolumnactivate">FunColumnActivate()</A>
-is called with a null string, then the environment variable
-<B>FUN_COLUMNS</B> will be used to provide a global value, if present.
-This is the reason why we call the routine even if no columns
-are specified on the command line (see example above), instead
-of calling it this way:
-<PRE>
- /* set active flag for specified columns */
- if( argc >= 4 ){
- FunColumnActivate(fun, argv[3], NULL);
- }
-</PRE>
-
-<!-- =defdoc funcolumnlookup funcolumnlookup 3 -->
-
-<!-- =section funcolumnlookup NAME -->
-<H2><A NAME="funcolumnlookup">FunColumnLookup - lookup a Funtools column</A></H2>
-<!-- =section funcolumnlookup SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunColumnLookup(Fun fun, char *s, int which,
- char **name, int *type, int *mode,
- int *offset, int *n, int *width)
-</PRE>
-</B>
-
-<!-- =section funcolumnlookup DESCRIPTION -->
-<P>
-The <B>FunColumnLookup()</B> routine returns information about a named
-(or indexed) column. The first argument is the Fun handle associated
-with this set of columns. The second argument is the name of the
-column to look up. If the name argument is NULL, the argument that
-follows is the zero-based index into the column array of the column
-for which information should be returned. The next argument is a
-pointer to a char *, which will contain the name of the column. The
-arguments that follow are the addresses of int values into which
-the following information will be returned:
-<UL>
-<LI> <B>type</B>: data type of column:
-<UL>
-<LI>A: ASCII characters
-<LI>B: unsigned 8-bit char
-<LI>I: signed 16-bit int
-<LI>U: unsigned 16-bit int (not standard FITS)
-<LI>J: signed 32-bit int
-<LI>V: unsigned 32-bit int (not standard FITS)
-<LI>E: 32-bit float
-<LI>D: 64-bit float
-</UL>
-<LI> <B>mode</B>: bit flag status of column, including:
-<UL>
-<LI> COL_ACTIVE 1 is column activated?
-<LI> COL_IBUF 2 is column in the raw input data?
-<LI> COL_PTR 4 is column a pointer to an array?
-<LI> COL_READ 010 is read mode selected?
-<LI> COL_WRITE 020 is write mode selected?
-<LI> COL_REPLACEME 040 is this column being replaced by user data?
-</UL>
-<LI> <B>offset</B>: byte offset in struct
-<LI> <B>n</B>: number of elements (i.e. size of vector) in this column
-<LI> <B>width</B>: size in bytes of this column
-</UL>
-If the named column exists, the routine returns a positive integer,
-otherwise zero is returned. (The positive integer is the index+1 into
-the column array where this column was located.)
-
-If NULL is passed as the return address of one (or more) of these
-values, no data is passed back for that information. For
-example:
-<PRE>
- if( !FunColumnLookup(fun, "phas", 0, NULL NULL, NULL, NULL, &npha, NULL) )
- gerror(stderr, "can't find phas column\n");
-</PRE>
-only returns information about the size of the phas vector.
-
-<!-- =defdoc funtablerowget funtablerowget 3 -->
-
-<!-- =section funtablerowget NAME -->
-<H2><A NAME="funtablerowget">FunTableRowGet - get Funtools rows</A></H2>
-
-<!-- =section funtablerowget SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void *FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist,
- int *nrow)
-</PRE>
-</B>
-
-<!-- =section funtablerowget DESCRIPTION -->
-<P>
-The <B>FunTableRowGet()</B> routine retrieves rows from a Funtools
-binary table or raw event file, and places the values of columns
-selected by <A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>
-into an array of user structs. Selected column values are
-automatically converted to the specified user data type (and to native
-data format) as necessary.
-
-<P>
-The first argument is the Fun handle associated with this row data.
-The second <B>rows</B> argument is the array of user structs into
-which the selected columns will be stored. If NULL is passed, the
-routine will automatically allocate space for this array. (This
-includes proper allocation of pointers within each struct, if the "@"
-pointer type is used in the selection of columns. Note that if you
-pass NULL in the second argument, you should free this space using the
-standard free() system call when you are finished with the array of
-rows.) The third <B>maxrow</B> argument specifies the maximum number
-of rows to be returned. Thus, if <B>rows</B> is allocated by the
-user, it should be at least of size maxrow*sizeof(evstruct).
-
-<P>
-The fourth <B>plist</B> argument is a param list string. Currently,
-the keyword/value pair "mask=transparent" is supported in the plist
-argument. If this string is passed in the call's plist argument, then
-all rows are passed back to the user (instead of just rows passing
-the filter). This is only useful when
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> also is
-used to specify "$region" as a column to return for each row. In
-such a case, rows found within a region have a returned region value
-greater than 0 (corresponding to the region id of the region in which
-they are located), rows passing the filter but not in a region have
-region value of -1, and rows not passing any filter have region
-value of 0. Thus, using "mask=transparent" and the returned region
-value, a program can process all rows and decide on an action based
-on whether a given row passed the filter or not.
-
-<P>
-The final argument is a pointer to an int variable that will return
-the actual number of rows returned. The routine returns a pointer to
-the array of stored rows, or NULL if there was an error. (This pointer
-will be the same as the second argument, if the latter is non-NULL).
-<PRE>
- /* get rows -- let routine allocate the row array */
- while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i&lt;got; i++){
- /* point to the i'th row */
- ev = buf+i;
- /* rearrange some values. etc. */
- ev->energy = (ev->pi+ev->pha)/2.0;
- ev->pha = -ev->pha;
- ev->pi = -ev->pi;
- }
- /* write out this batch of rows */
- FunTableRowPut(fun2, buf, got, 0, NULL);
- /* free row data */
- if( buf ) free(buf);
- }
-</PRE>
-As shown above, successive calls to
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A> will return the
-next set of rows from the input file until all rows have been read,
-i.e., the routine behaves like sequential Unix I/O calls such as
-fread(). See <A HREF="./evmerge.c">evmerge example code</A> for a
-more complete example.
-
-<P>
-Note that FunTableRowGet() also can be called as FunEventsGet(), for
-backward compatibility.
-
-<!-- =defdoc funtablerowput funtablerowput 3 -->
-
-<!-- =section funtablerowput NAME -->
-<H2><A NAME="funtablerowput">FunTableRowPut - put Funtools rows</A></H2>
-
-<!-- =section funtablerowput SYNOPSIS -->
-<PRE>
-<B>
-int FunTableRowPut(Fun fun, void *rows, int nev, int idx, char *plist)
-</B>
-</PRE>
-
-<!-- =section funtablerowput DESCRIPTION -->
-The <B>FunTableRowPut()</B> routine writes rows to a FITS binary
-table, taking its input from an array of user structs that contain
-column values selected by a previous call to
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>. Selected
-column values are automatically converted from native data format to
-FITS data format as necessary.
-
-<P>
-The first argument is the Fun handle associated with this row data.
-The second <B>rows</B> argument is the array of user structs to
-output. The third <B>nrow</B> argument specifies the number number of
-rows to write. The routine will write <B>nrow</B> records, starting
-from the location specified by <B>rows</B>.
-
-<P>
-The fourth <B>idx</B> argument is the index of the first raw input
-row to write, in the case where rows from the user buffer are
-being merged with their raw input row counterparts (see below). Note
-that this <B>idx</B> value is has nothing to do with the
-row buffer specified in argument 1. It merely matches the row
-being written with its corresponding (hidden) raw row. Thus, if you
-read a number of rows, process them, and then write them out all at
-once starting from the first user row, the value of <B>idx</B>
-should be 0:
-<PRE>
- Ev ebuf, ev;
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i&lt;got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ...
- }
- /* write out this batch of rows, starting with the first */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-</PRE>
-
-<P>
-On the other hand, if you write out the rows one at a time (possibly
-skipping rows), then, when writing the i'th row from the input
-array of rows, set <B>idx</B> to the value of i:
-<PRE>
- Ev ebuf, ev;
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i&lt;got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ...
- /* write out the current (i.e., i'th) row */
- FunTableRowPut(fun2, (char *)ev, 1, i, NULL);
- }
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-</PRE>
-
-<P>
-The final argument is a param list string that is not currently used.
-The routine returns the number of rows output. This should be equal
-to the value passed in the third <B>nrow</B argument.
-
-<P>
-When <A HREF="./library.html#funtablerowput">FunTableRowPut()</A> is first
-called for a given binary table, Funtools checks to see of the primary
-header has already been written (either by writing a previous row
-table or by writing an image.) If not, a dummy primary header is
-written to the file specifying that an extension should be expected.
-After this, a binary table header is automatically written containing
-information about the columns that will populate this table. In
-addition, if a
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-was specified when this table was opened, the parameters from this
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-are merged into the new binary table header.
-
-<P>
-In a typical Funtools row loop, you read rows using
-<A HREF="./library.html#funtablerowget">FunTableRowGet()</A>() and write
-rows using FunTableRowPut(). The columns written by
-FunTableRowPut()() are those defined as writable by a previous call to
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A>. If
-that call to FunColumnSelect also specified
-<B>merge=[update|replace|append]</B>, then the entire corresponding
-raw input row record will be merged with the output row according
-to the <B>merge</B> specification (see
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> above).
-
-<P>
-A call to write rows can either be done once, after all rows in
-the input batch have been processed, or it can be done (slightly less
-efficiently) one row at a time (or anything in between). We do
-recommend that you write all rows associated with a given batch of
-input rows before reading new rows. This is <B>required</B> if
-you are merging the output rows with the raw input rows (since
-the raw rows are destroyed with each successive call to get new rows).
-
-For example:
-<PRE>
- Ev buf, ev;
- ...
- /* get rows -- let routine allocate the row array */
- while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* point to the i'th row */
- ev = buf + i;
- .... process
- }
- /* write out this batch of rows */
- FunTableRowPut(fun2, buf, got, 0, NULL);
- /* free row data */
- if( buf ) free(buf);
- }
-</PRE>
-
-or
-
-<PRE>
- Ev buf, ev;
- ...
- /* get rows -- let routine allocate the row array */
- while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i&lt;got; i++){
- /* point to the i'th row */
- ev = buf + i;
- ... process
- /* write out this batch of rows with the new column */
- if( dowrite )
- FunTableRowPut(fun2, buf, 1, i, NULL);
- }
- /* free row data */
- if( buf ) free(buf);
- }
-</PRE>
-
-<P>
-Note that the difference between these calls is that the first one
-outputs <B>got</B> rows all at once and therefore passes
-<B>idx=0</B> in argument four, so that merging starts at the first raw
-input row. In the second case, a check it made on each row to see
-if it needs to be output. If so, the value of <B>idx</B> is passed as
-the value of the <B>i</B> variable which points to the current row
-being processed in the batch of input rows.
-
-<P>
-As shown above, successive calls to
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A> will write
-rows sequentially. When you are finished writing all rows in a
-table, you should call
-<A HREF="./library.html#funflush">FunFlush()</A> to write out the FITS
-binary table padding. However, this is not necessary if you
-subsequently call FunClose() without doing any other I/O to the FITS
-file.
-
-<P>
-Note that FunTableRowPut() also can be called as FunEventsPut(), for
-backward compatibility.
-
-<!-- =defdoc funparamget funparamget 3 -->
-
-<!-- =section funparamget NAME -->
-<H2><A NAME="funparamget">FunParamGet - get a Funtools param value</A></H2>
-
-<!-- =section funparamget SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunParamGetb(Fun fun, char *name, int n, int defval, int *got)
-
- int FunParamGeti(Fun fun, char *name, int n, int defval, int *got)
-
- double FunParamGetd(Fun fun, char *name, int n, double defval, int *got)
-
- char *FunParamGets(Fun fun, char *name, int n, char *defval, int *got)
-</PRE>
-</B>
-
-<!-- =section funparamget DESCRIPTION -->
-<P>
-The four routines <B>FunParamGetb()</B>, <B>FunParamGeti()</B>,
-<B>FunParamGetd()</B>, and <B>FunParamGets()</B>, return the value of
-a FITS header parameter as a boolean, int, double, and string,
-respectively. The string returned by <B>FunParamGets()</B> is a malloc'ed
-copy of the header value and should be freed when no longer needed.
-
-<P>
-The first argument is the Fun handle associated with the FITS header
-being accessed. Normally, the header is associated with the FITS
-extension that you opened with <B>FunOpen()</B>. However, you can use
-FunInfoPut() to specify access of the primary header. In particular,
-if you set the FUN_PRIMARYHEADER parameter to 1, then the primary
-header is used for all parameter access until the value is reset to
-0. For example:
-<PRE>
- int val;
- FunParamGeti(fun, "NAXIS", 1, 0, &got); # current header
- val=1;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch to ...
- FunParamGeti(fun, "NAXIS", 1, 0, &got); # ... primary header
- FunParamGeti(fun, "NAXIS", 2, 0, &got); # ... primary header
- val=0;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch back to ...
- FunParamGeti(fun, "NAXIS", 2, 0, &got); # current header
-</PRE>
-
-<P>
-Alternatively, you can use the FUN_PRIMARY macro to access parameters
-from the primary header on a per-parameter basis:
-<PRE>
- FunParamGeti(fun, "NAXIS1", 0, 0, &got); # current header
- FunParamGeti(FUN_PRIMARY(fun), "NAXIS1", 0, 0, &got); # primary header
-</PRE>
-<B>NB: FUN_PRIMARY is deprecated.</B>
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread-safe. We recommend use of FunInfoPut() to switch between the
-extension header and the primary header.
-
-<P>
-For output data, access to the primary header is only possible until
-the header is written out, which usually takes place when the first
-data are written.
-
-<P>
-The second argument is the name of the parameter to access. The third
-<B>n</B> argument, if non-zero, is an integer that will be added as a
-suffix to the parameter name. This makes it easy to use a simple loop
-to process parameters having the same root name. For example, to
-gather up all values of TLMIN and TLMAX for each column in a binary
-table, you can use:
-<PRE>
- for(i=0, got=1; got; i++){
- fun->cols[i]->tlmin = (int)FunParamGeti(fun, "TLMIN", i+1, 0.0, &got);
- fun->cols[i]->tlmax = (int)FunParamGeti(fun, "TLMAX", i+1, 0.0, &got);
- }
-</PRE>
-
-<P>
-The fourth <B>defval</B> argument is the default value to return if
-the parameter does not exist. Note that the data type of this
-parameter is different for each specific FunParamGet() call. The final
-<B>got</B> argument will be 0 if no param was found. Otherwise the
-data type of the parameter is returned as follows: FUN_PAR_UNKNOWN
-('u'), FUN_PAR_COMMENT ('c'), FUN_PAR_LOGICAL ('l'), FUN_PAR_INTEGER
-('i'), FUN_PAR_STRING ('s'), FUN_PAR_REAL ('r'), FUN_PAR_COMPLEX ('x').
-
-<p>
-These routines return the value of the header parameter, or the
-specified default value if the header parameter does not exist. The
-returned value is a malloc'ed string and should be freed when no
-longer needed.
-
-<P>
-By default, <B>FunParamGets()</B> returns the string value of the
-named parameter. However, you can use FunInfoPut() to retrieve the
-raw 80-character FITS card instead. In particular, if you set the
-FUN_RAWPARAM parameter to 1, then card images will be returned by
-FunParamGets() until the value is reset to 0.
-
-<P>
-Alternatively, if the FUN_RAW macro is applied to the name, then the
-80-character raw FITS card is returned instead.
-<B>NB: FUN_RAW is deprecated.</B>
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread-safe. We recommend use of FunInfoPut() to switch between the
-extension header and the primary header.
-
-<P>
-Note that in addition to the behaviors described above, the
-routine <B>FunParamGets()</B> will return the 80 raw characters of the
-<B>nth</B> FITS card (including the comment) if <B>name</B> is specified as
-NULL and <B>n</B> is positive. For example, to loop through all FITS
-header cards in a given extension and print out the raw card, use:
-<PRE>
- for(i=1; ;i++){
- if( (s = FunParamGets(fun, NULL, i, NULL, &got)) ){
- fprintf(stdout, "%.80s\n", s);
- free(s);
- }
- else{
- break;
- }
- }
-</PRE>
-
-<!-- =defdoc funparamput funparamput 3 -->
-
-<!-- =section funparamput NAME -->
-<H2><A NAME="funparamput">FunParamPut - put a Funtools param value</A></H2>
-
-<!-- =section funparamput SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunParamPutb(Fun fun, char *name, int n, int value, char *comm,
- int append)
-
- int FunParamPuti(Fun fun, char *name, int n, int value, char *comm,
- int append)
-
- int FunParamPutd(Fun fun, char *name, int n, double value, int prec,
- char *comm, int append)
-
- int FunParamPuts(Fun fun, char *name, int n, char *value, char *comm,
- int append)
-</PRE>
-</B>
-
-<!-- =section funparamput DESCRIPTION -->
-<P>
-The four routines <B>FunParamPutb()</B>, <B>FunParamPuti()</B>,
-<B>FunParamPutd()</B>, and <B>FunParamPuts()</B>, will set the value
-of a FITS header parameter as a boolean, int, double, and string,
-respectively.
-
-<P>
-The first argument is the Fun handle associated with the FITS header
-being accessed. Normally, the header is associated with the FITS
-extension that you opened with <B>FunOpen()</B>.
-However, you can use FunInfoPut() to specify that use of the primary
-header. In particular, if you set the FUN_PRIMARYHEADER parameter to
-1, then the primary header is used for all parameter access until the
-value is reset to 0. For example:
-<PRE>
- int val;
- FunParamPuti(fun, "NAXIS1", 0, 10, NULL, 1); # current header
- val=1;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch to ...
- FunParamPuti(fun, "NAXIS1", 0, 10, NULL, 1); # primary header
-</PRE>
-(You also can use the deprecated FUN_PRIMARY macro, to access
-parameters from the primary header.)
-
-<p>
-The second argument is the <b>name</b> of the parameter. (
-In accordance with FITS standards, the special names <b>COMMENT</b>
-and <b>HISTORY</b>, as well as blank names, are output without the "= "
-value indicator in columns 9 and 10.
-
-<p>
-The third <B>n</B> argument, if non-zero, is an integer that will be
-added as a suffix to the parameter name. This makes it easy to use a
-simple loop to process parameters having the same root name. For
-example, to set the values of TLMIN and TLMAX for each column in a
-binary table, you can use:
-<PRE>
- for(i=0; i&lt;got; i++){
- FunParamPutd(fun, "TLMIN", i+1, tlmin[i], 7, "min column val", 1);
- FunParamPutd(fun, "TLMAX", i+1, tlmax[i], 7, "max column val", 1);
- }
-</PRE>
-
-<P>
-The fourth <B>defval</B> argument is the value to set. Note that the
-data type of this argument is different for each specific
-FunParamPut() call. The <B>comm</B> argument is the comment
-string to add to this header parameter. Its value can be NULL. The
-final <B>append</B> argument determines whether the parameter is added
-to the header if it does not exist. If set to a non-zero value, the
-header parameter will be appended to the header if it does not exist.
-If set to 0, the value will only be used to change an existing parameter.
-
-<P>
-Note that the double precision routine FunParamPutd() supports an
-extra <B>prec</B> argument after the <B>value</B> argument, in order
-to specify the precision when converting the double value to ASCII. In
-general a 20.[prec] format is used (since 20 characters are alloted to
-a floating point number in FITS) as follows: if the double value being
-put to the header is less than 0.1 or greater than or equal to
-10**(20-2-[prec]), then %20.[prec]e format is used (i.e., scientific
-notation); otherwise %20.[prec]f format is used (i.e., numeric
-notation).
-
-<P>
-As a rule, parameters should be set before writing the table or image.
-It is, however, possible to update the value of an <B>existing</B>
-parameter after writing an image or table (but not to add a new
-one). Such updating only works if the parameter already exists and if
-the output file is seekable, i.e. if it is a disk file or is stdout
-being redirected to a disk file.
-
-<P>
-It is possible to add a new parameter to a header after the data has
-been written, but only if space has previously been reserved. To reserve
-space, add a blank parameter whose value is the name of the parameter you
-eventually will update. Then, when writing the new parameter, specify a
-value of 2 for the append flag. The parameter writing routine will
-first look to update an existing parameter, as usual. If an existing
-parameter is not found, an appropriately-valued blank parameter will be
-searched for and replaced. For example:
-<PRE>
- /* add blank card to be used as a place holder for IPAR1 update */
- FunParamPuts(fun, NULL, 0, "IPAR1", "INTEGER Param", 0);
- ...
- /* write header and data */
- FunTableRowPut(fun, events, got, 0, NULL);
- ...
- /* update param in file after writing data -- note append = 2 here */
- FunParamPuti(fun, "IPAR", 1, 400, "INTEGER Param", 2);
-</PRE>
-
-<P>
-The parameter routines return a 1 if the routine was successful and a 0 on
-failure. In general, the major reason for failure is that you did not
-set the append argument to a non-zero value and the parameter did not
-already exist in the file.
-
-<!-- =defdoc funinfoget funinfoget 3 -->
-
-<!-- =section funinfoget NAME -->
-<H2><A NAME="funinfoget">FunInfoGet - get information from Funtools struct</A></H2>
-
-<!-- =section funinfoget SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunInfoGet(Fun fun, int type, char *addr, ...)
-</PRE>
-</B>
-
-<!-- =section funinfoget DESCRIPTION -->
-<P>
-The <B>FunInfoGet()</B> routine returns information culled from the
-Funtools structure. The first argument is the Fun handle from which
-information is to be retrieved. This first required argument is followed
-by a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to retrieve and the
-address where the information is to be stored. The list is terminated by a 0.
-The routine returns the number of get actions performed.
-
-<P>
-The full list of available information is described below. Please note
-that only a few of these will be useful to most application developers.
-For imaging applications, the most important types are:
-<PRE>
- FUN_SECT_DIM1 int /* dim1 for section */
- FUN_SECT_DIM2 int /* dim2 for section */
- FUN_SECT_BITPIX int /* bitpix for section */
-</PRE>
-These would be used to determine the dimensions and data type of image
-data retrieved using the
-<A HREF="./library.html#funimageget">FunImageGet()</A> routine. For
-example:
-<PRE>
- /* extract and bin the data section into an image buffer */
- buf = FunImageGet(fun, NULL, NULL);
- /* get required information from funtools structure.
- this should come after the FunImageGet() call, in case the call
- changed sect_bitpix */
- FunInfoGet(fun,
- FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- 0);
- /* loop through pixels and reset values below limit to value */
- for(i=0; i&lt;dim1*dim2; i++){
- switch(bitpix){
- case 8:
- if( cbuf[i] <= blimit ) cbuf[i] = bvalue;
- ...
- }
-</PRE>
-It is important to bear in mind that the call to
-<A HREF="./library.html#funimageget">FunImageGet()</A>
-can change the value of FUN_SECT_BITPIX (e.g. if "bitpix=n" is passed
-in the param list). Therefore, a call to
-<A HREF="./library.html#funinfoget">FunInfoGet()</A>
-should be made <B>after</B> the call to
-<A HREF="./library.html#funimageget">FunImageGet()</A>,
-in order to retrieve the updated bitpix value.
-See the <A HREF="./imblank.c">imblank example code</A> for more
-details.
-
-<P>
-It also can be useful to retrieve the World Coordinate System
-information from the Funtools structure. Funtools uses the the WCS
-Library developed by Doug Mink at SAO, which is available
-<A HREF="ftp://cfa-ftp.harvard.edu/pub/gsc/WCSTools/home.html">here</A>.
-(More information about the WCSTools project in general can be found
-<A HREF="http://tdc-www.harvard.edu/software/wcstools/">here</A>.)
-The <A HREF="./library.html#funopen">FunOpen()</A> routine initializes
-two WCS structures that can be used with this WCS Library.
-Applications can retrieve either of these two WCS structures using
-<B>FunInfoGet()</B>:
-<PRE>
- FUN_WCS struct WorldCoor * /* wcs structure, for image coordinates*/
- FUN_WCS0 struct WorldCoor * /* wcs structure, for physical coordinates */
-</PRE>
-The structure retrieved by FUN_WCS is a WCS library handle containing
-parameters suitable for use with image coordinates, regardless of whether the
-data are images or tables. For this structure, the WCS reference point
-(CRPIX) has been converted to image coordinates if the underlying file
-is a table (and therefore in physical coordinates). You therefore must
-ensure that the positions being passed to a routine like pix2wcs are in
-image coordinates. The FUN_WCS0 structure has not had its WCS
-reference point converted to image coordinates. It therefore is useful
-when passing processing physical coordinates from a table.
-
-<P>
-Once a WCS structure has been retrieved, it can be used as the first
-argument to the WCS library routines. (If the structure is NULL, no
-WCS information was contained in the file.) The two important WCS routines
-that Funtools uses are:
-<PRE>
- #include &lt;wcs.h&gt
- void pix2wcs (wcs,xpix,ypix,xpos,ypos)
- struct WorldCoor *wcs; /* World coordinate system structure */
- double xpix,ypix; /* x and y coordinates in pixels */
- double *xpos,*ypos; /* RA and Dec in degrees (returned) */
-</PRE>
-
-which converts pixel coordinates to sky coordinates, and:
-
-<PRE>
- void wcs2pix (wcs, xpos, ypos, xpix, ypix, offscl)
- struct WorldCoor *wcs; /* World coordinate system structure */
- double xpos,ypos; /* World coordinates in degrees */
- double *xpix,*ypix; /* coordinates in pixels */
- int *offscl; /* 0 if within bounds, else off scale */
-</PRE>
-which converts sky coordinates to pixel coordinates. Again, please note
-that the wcs structure returned by FUN_WCS assumes that image coordinates
-are passed to the pix2wcs routine, while FUN_WCS0 assumes that physical
-coordinates are passed.
-
-<P>
-Note that funtools.h file automatically includes wcs.h. An example
-program that utilizes these WCS structure to call WCS Library routines
-is <A HREF="./twcs.c">twcs.c</A>.
-
-<P>
-The following is the complete list of information that can be returned:
-<PRE>
- name type comment
- --------- -------- ---------------------------------------------
- FUN_FNAME char * /* file name */
- FUN_GIO GIO /* gio handle */
- FUN_HEADER FITSHead /* fitsy header struct */
- FUN_TYPE int /* TY_TABLE,TY_IMAGE,TY_EVENTS,TY_ARRAY */
- FUN_BITPIX int /* bits/pixel in file */
- FUN_MIN1 int /* tlmin of axis1 -- tables */
- FUN_MAX1 int /* tlmax of axis1 -- tables */
- FUN_MIN2 int /* tlmin of axis2 -- tables */
- FUN_MAX2 int /* tlmax of axis2 -- tables */
- FUN_DIM1 int /* dimension of axis1 */
- FUN_DIM2 int /* dimension of axis2 */
- FUN_ENDIAN int /* 0=little, 1=big endian */
- FUN_FILTER char * /* supplied filter */
- FUN_IFUN FITSHead /* pointer to reference header */
- FUN_IFUN0 FITSHead /* same as above, but no reset performed */
- /* image information */
- FUN_DTYPE int /* data type for images */
- FUN_DLEN int /* length of image in bytes */
- FUN_DPAD int /* padding to end of extension */
- FUN_DOBLANK int /* was blank keyword defined? */
- FUN_BLANK int /* value for blank */
- FUN_SCALED int /* was bscale/bzero defined? */
- FUN_BSCALE double /* bscale value */
- FUN_BZERO double /* bzero value */
- /* table information */
- FUN_NROWS int /* number of rows in file (naxis2) */
- FUN_ROWSIZE int /* size of user row struct */
- FUN_BINCOLS char * /* specified binning columns */
- FUN_OVERFLOW int /* overflow detected during binning? */
- /* array information */
- FUN_SKIP int /* bytes to skip in array header */
- /* section information */
- FUN_SECT_X0 int /* low dim1 value of section */
- FUN_SECT_X1 int /* hi dim1 value of section */
- FUN_SECT_Y0 int /* low dim2 value of section */
- FUN_SECT_Y1 int /* hi dim2 value of section */
- FUN_SECT_BLOCK int /* section block factor */
- FUN_SECT_BTYPE int /* 's' (sum), 'a' (average) for binning */
- FUN_SECT_DIM1 int /* dim1 for section */
- FUN_SECT_DIM2 int /* dim2 for section */
- FUN_SECT_BITPIX int /* bitpix for section */
- FUN_SECT_DTYPE int /* data type for section */
- FUN_RAWBUF char * /* pointer to raw row buffer */
- FUN_RAWSIZE int /* byte size of raw row records */
- /* column information */
- FUN_NCOL int /* number of row columns defined */
- FUN_COLS FunCol /* array of row columns */
- /* WCS information */
- FUN_WCS struct WorldCoor * /* wcs structure, converted for images*/
- FUN_WCS0 struct WorldCoor * /* wcs structure, not converted */
-</PRE>
-
-<P>
-Row applications would not normally need any of this information.
-An example of how these values can be used in more complex programs is
-the <A HREF="./evnext.c">evnext example code</A>. In this program, the
-time value for each row is changed to be the value of the succeeding
-row. The program thus reads the time values for a batch of rows,
-changes the time values to be the value for the succeeding row, and
-then merges these changed time values back with the other columns to
-the output file. It then reads the next batch, etc.
-
-<P>
-This does not work for the last row read in each batch, since there
-is no succeeding row until the next batch is read. Therefore, the
-program saves that last row until it has read the next batch, then
-processes the former before starting on the new batch. In order to
-merge the last row successfully, the code uses FUN_RAWBUF to save
-and restore the raw input data associated with each batch of
-rows. Clearly, this requires some information about how funtools
-works internally. We are happy to help you write such programs as the
-need arises.
-
-<!-- =defdoc funinfoput funinfoput 3 -->
-
-<!-- =section funinfoput NAME -->
-<H2><A NAME="funinfoput">FunInfoPut - put information into a Funtools struct</A></H2>
-
-<!-- =section funinfoput SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- int FunInfoPut(Fun fun, int type, char *addr, ...)
-</PRE>
-</B>
-
-<!-- =section funinfoput DESCRIPTION -->
-<P>
-The <B>FunInfoPut()</B> routine puts information into a Funtools
-structure. The first argument is the Fun handle from which
-information is to be retrieved. After this first required argument
-comes a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to store and the
-address of the new information to store in the struct. The variable
-list is terminated by a 0. The routine returns the number of put
-actions performed.
-
-<P>
-The full list of available information is described above with the
-<A HREF="./library.html#funinfoput">FunInfoPut()</A> routine. Although
-use of this routine is expected to be uncommon, there is one
-important situation in which it plays an essential part: writing
-multiple extensions to a single output file.
-
-<P>
-For input, multiple extensions are handled by calling
-<A HREF="./library.html#funopen">FunOpen()</A> for each extension to be
-processed. When opening multiple inputs, it sometimes is the case that
-you will want to process them and then write them (including their
-header parameters) to a single output file. To accomplish this, you
-open successive input extensions using
-<A HREF="./library.html#funopen">FunOpen()</A> and then call
-<B>FunInfoPut()</B> to set the
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-of the output file to that of the newly opened input extension:
-<PRE>
- /* open a new input extension */
- ifun=FunOpen(tbuf, "r", NULL)) )
- /* make the new extension the reference handle for the output file */
- FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
-</PRE>
-
-Resetting FUN_IFUN has same effect as when a funtools handle is passed
-as the final argument to
-<A HREF="./library.html#funopen">FunOpen()</A>. The state of the output
-file is reset so that a new extension is ready to be written.
-Thus, the next I/O call on the output extension will output the
-header, as expected.
-
-<P>
-For example, in a binary table, after resetting FUN_IFUN you can then
-call <A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> to
-select the columns for output. When you then call
-<A HREF="./library.html#funimageput">FunImagePut()</A> or <A
-HREF="./library.html#funtablerowput">FunTableRowPut()</A>, a new
-extension will be written that contains the header parameters from the
-reference extension. Remember to call
-<A HREF="./library.html#funflush">FunFlush()</A> to complete output of a
-given extension.
-
-<P>
-A complete example of this capability is given
-in the <A HREF="./evcol.c">evcol example code</A>.
-The central algorithm is:
-<UL>
-<LI> open the output file without a reference handle
-<LI> loop: open each input extension in turn
-<UL>
-<LI> set the reference handle for output to the newly opened input extension
-<LI> read the input rows or image and perform processing
-<LI> write new rows or image to the output file
-<LI> flush the output
-<LI> close input extension
-</UL>
-<LI> close output file
-</UL>
-Note that <A HREF="./library.html#funflush">FunFlush()</A> is called
-after processing each input extension in order to ensure that the
-proper padding is written to the output file. A call to
-<A HREF="./library.html#funflush">FunFlush()</A> also ensures that the
-extension header is written to the output file in the case where there
-are no rows to output.
-
-<P>
-If you wish to output a new extension without using a
-<A HREF="./library.html#refhandle">Funtools reference handle</A>, you can
-call FunInfoPut() to reset the FUN_OPS value directly. For a binary
-table, you would then call FunColumnSelect() to set up the columns for
-this new extension.
-<PRE>
- /* reset the operations performed on this handle */
- int ops=0;
- FunInfoPut(ofun, FUN_OPS, &ops, 0);
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
- NULL);
-</PRE>
-Once the FUN_OPS variable has been reset, the next I/O call on the
-output extension will output the header, as expected.
-
-<!-- =defdoc funflush funflush 3 -->
-
-<!-- =section funflush NAME -->
-<H2><A NAME="funflush">FunFlush - flush data to output file</A></H2>
-
-<!-- =section funflush SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void FunFlush(Fun fun, char *plist)
-</PRE>
-</B>
-
-<!-- =section funflush DESCRIPTION -->
-<P>
-The <B>FunFlush</B> routine will flush data to a FITS output file. In
-particular, it can be called after all rows have been written (using
-the <A HREF="./library.html#funtablerowput">FunTableRowPut()</A> routine)
-in order to add the null padding that is required to complete a FITS
-block. It also should be called after completely writing an image using
-<A HREF="./library.html#funimageput">FunImagePut()</A> or after writing
-the final row of an image using
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A>.
-
-<P>
-The <B>plist</B> (i.e., parameter list) argument is a string
-containing one or more comma-delimited <B>keyword=value</B>
-parameters. If the plist string contains the parameter
-"copy=remainder" and the file was opened with a reference file, which,
-in turn, was opened for extension copying (i.e. the input
-<A HREF="./library.html#funopen">FunOpen()</A> mode also was "c" or "C"),
-then FunFlush also will copy the remainder of the FITS extensions from
-the input reference file to the output file. This normally would be
-done only at the end of processing.
-
-<P>
-Note that <A HREF="./library.html#funflush">FunFlush()</A> is called
-with "copy=remainder" in the mode string by FunClose(). This means
-that if you close the output file before the reference input file, it
-is not necessary to call
-<A HREF="./library.html#funflush">FunFlush()</A> explicitly, unless you
-are writing more than one extension. See the
-<A HREF="./evmerge.c">evmerge example code</A>. However, it is safe to
-call <A HREF="./library.html#funflush">FunFlush()</A> more than once
-without fear of re-writing either the padding or the copied
-extensions.
-
-<P>
-In addition, if <A HREF="./library.html#funflush">FunFlush()</A> is
-called on an output file with the plist set to "copy=reference" and if
-the file was opened with a reference file, the reference extension is
-written to the output file. This mechanism provides a simple way to
-copy input extensions to an output file without processing the former.
-For example, in the code fragment below, an input extension is set to
-be the reference file for a newly opened output extension. If that
-reference extension is not a binary table, it is written to the output
-file:
-<PRE>
- /* process each input extension in turn */
- for(ext=0; ;ext++){
- /* get new extension name */
- sprintf(tbuf, "%s[%d]", argv[1], ext);
- /* open input extension -- if we cannot open it, we are done */
- if( !(ifun=FunOpen(tbuf, "r", NULL)) )
- break;
- /* make the new extension the reference handle for the output file */
- FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
- /* if its not a binary table, just write it out */
- if( !(s=FunParamGets(ifun, "XTENSION", 0, NULL, &got)) ||
- strcmp(s, "BINTABLE")){
- if( s ) free(s);
- FunFlush(ofun, "copy=reference");
- FunClose(ifun);
- continue;
- }
- else{
- /* process binary table */
- ....
- }
- }
-</PRE>
-
-<!-- =defdoc funclose funclose 3 -->
-
-<!-- =section funclose NAME -->
-<H2><A NAME="funclose">FunClose - close a Funtools data file</A></H2>
-
-<!-- =section funclose SYNOPSIS -->
-<B>
-<PRE>
- #include &lt;funtools.h&gt;
-
- void FunClose(Fun fun)
-</PRE>
-</B>
-
-<!-- =section funclose DESCRIPTION -->
-<P>
-The <B>FunClose()</B> routine closes a previously-opened Funtools data
-file, freeing control structures. If a
-<A HREF="./library.html#refhandle">Funtools reference handle</A>
-was passed to
-the <A HREF="./library.html#funopen">FunOpen()</A> call for this file,
-and if copy mode also was specified for that file, then
-<A HREF="./library.html#funclose">FunClose()</A> also will copy the
-remaining extensions from the input file to the output file (if the
-input file still is open). Thus, we recommend always closing the
-output Funtools file <B>before</B> the input file. (Alternatively,
-you can call <A HREF="./library.html#funflush">FunFlush()</A>
-explicitly).
-
-<!-- =defdoc funref funref 3 -->
-
-<!-- =section funref NAME -->
-<H2><A NAME="refhandle">FunRef: the Funtools Reference Handle</A></H2>
-
-<!-- =section funref SYNOPSIS -->
-<H2>Summary</H2>
-A description of how to use a Funtools reference handle to connect a
-Funtools input file to an output file.
-
-<!-- =section funref DESCRIPTION -->
-<H2>Description</H2>
-<P>
-The Funtools reference handle connects a Funtools input file to a
-Funtools output file so that parameters (or even whole extensions) can
-be copied from the one to the other. To make the connection, the Funtools
-handle of the input file is passed to the
-final argument of the
-<A HREF="./library.html#funopen">FunOpen()</A> call for the output file:
-<PRE>
- if( !(ifun = FunOpen(argv[1], "r", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
- if( !(ofun = FunOpen(argv[2], "w", ifun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-</PRE>
-It does not matter what type of input or output file (or extension) is
-opened, or whether they are the same type. When the output image or
-binary table is written using
-<A HREF="./library.html#funimageput">FunImagePut()</A>
-or
-<A HREF="./library.html#funtablerowput">FunTableRowPut()</A>
-an appropriate header will be written first, with parameters copied
-from the input extension. Of course, invalid parameters will be
-removed first, e.g., if the input is a binary table and the output is
-an image, then binary table parameters such as TFORM, TUNIT,
-etc. parameters will not be copied to the output.
-
-<P>
-Use of a reference handle also allows default values to be passed
-to
-<A HREF="./library.html#funimageput">FunImagePut()</A> in order to
-write out an output image with the same dimensions and data type
-as the input image. To use the defaults from the input, a value
-of 0 is entered for dim1, dim2, and bitpix. For example:
-<PRE>
- fun = FunOpen(argv[1], "r", NULL);
- fun2 = FunOpen(argv[2], "w", fun);
- buf = FunImageGet(fun, NULL, NULL);
- ... process image data ...
- FunImagePut(fun2, buf, 0, 0, 0, NULL);
-</PRE>
-Of course, you often want to get information about the data type
-and dimensions of the image for processing. The above code
-is equivalent to the following:
-<PRE>
- fun = FunOpen(argv[1], "r", NULL);
- fun2 = FunOpen(argv[2], "w", fun);
- buf = FunImageGet(fun, NULL, NULL);
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2,
- FUN_SECT_BITPIX, &bitpix, 0);
- ... process image data ...
- FunImagePut(fun2, buf, dim1, dim2, bitpix, NULL);
-</PRE>
-
-<P>
-It is possible to change the reference handle for a given output Funtools
-handle using the
-<A HREF="./library.html#funinfoput">FunInfoPut()</A> routine:
-<PRE>
- /* make the new extension the reference handle for the output file */
- FunInfoPut(fun2, FUN_IFUN, &fun, 0);
-</PRE>
-When this is done, Funtools specially resets the output file to start
-a new output extension, which is connected to the new input reference
-handle. You can use this mechanism to process multiple input extensions
-into a single output file, by successively opening the former and
-setting the reference handle for the latter. For example:
-<PRE>
- /* open a new output FITS file */
- if( !(fun2 = FunOpen(argv[2], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
- /* process each input extension in turn */
- for(ext=0; ;ext++){
- /* get new extension name */
- sprintf(tbuf, "%s[%d]", argv[1], ext);
- /* open it -- if we cannot open it, we are done */
- if( !(fun=FunOpen(tbuf, "r", NULL)) )
- break;
- /* make the new extension the reference handle for the output file */
- FunInfoPut(fun2, FUN_IFUN, &fun, 0);
- ... process ...
- /* flush output extension (write padding, etc.) */
- FunFlush(fun2, NULL);
- /* close the input extension */
- FunClose(fun);
- }
-</PRE>
-In this example, the output file is opened first. Then each successive
-input extension is opened, and the output reference handle is set to
-the newly opened input handle. After data processing is performed, the
-output extension is flushed and the input extension is closed, in
-preparation for the next input extension.
-<P>
-Finally, a reference handle can be used to copy other extensions from
-the input file to the output file. Copy of other extensions is
-controlled by adding a "C" or "c" to the mode string of the
-<A HREF="./library.html#funopen">FunOpen()</A>
-call <B>of the input reference file</B>. If "C" is specified, then
-other extensions are <B>always</B> copied (i.e., copy is forced by the
-application). If "c" is used, then other extensions are copied if the
-user requests copying by adding a plus sign "+" to the extension name
-in the bracket specification. For example, the <B>funtable</B>
-program utilizes user-specified "c" mode so that the second example
-below will copy all extensions:
-<PRE>
- # copy only the EVENTS extension
- csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
- # copy ALL extensions
- csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
-</PRE>
-When extension copy is specified in the input file, the call to
-<A HREF="./library.html#funopen">FunOpen()</A>
-on the input file delays the actual file open until the output file
-also is opened (or until I/O is performed on the input file, which
-ever happens first). Then, when the output file is opened, the input
-file is also opened and input extensions are copied to the output
-file, up to the specific extension being opened. Processing of input
-and output extensions then proceed.
-<P>
-When extension processing is complete, the remaining extensions need to
-be copied from input to output. This can be done explicitly, using the
-<A HREF="./library.html#funflush">FunFlush()</A>
-call with the "copy=remaining" plist:
-<PRE>
- FunFlush(fun, "copy=remaining");
-</PRE>
-Alternatively, this will happen automatically, if the output file
-is closed <B>before</B> the input file:
-<PRE>
- /* we could explicitly flush remaining extensions that need copying */
- /* FunFlush(fun2, "copy=remaining"); */
- /* but if we close output before input, end flush is done automatically */
- FunClose(fun2);
- FunClose(fun);
-</PRE>
-
-<!-- =section funlib SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funopen SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funimageget SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funimageput SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funimagerowget SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funimagerowput SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funcolumnselect SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funcolumnactivate SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funcolumnlookup SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funtablerowget SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funtablerowput SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funparamget SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funparamput SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funinfoget SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funinfoput SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funflush SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funclose SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funref SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: December 1, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/pod/funcalc.pod b/funtools/doc/pod/funcalc.pod
deleted file mode 100644
index f63cfc8..0000000
--- a/funtools/doc/pod/funcalc.pod
+++ /dev/null
@@ -1,572 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funcalc - Funtools calculator (for binary tables)>
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funcalc [-n] [-a argstr] [-e expr] [-f file] [-l link] [-p prog] <iname> [oname [columns]]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -a argstr # user arguments to pass to the compiled program
- -e expr # funcalc expression
- -f file # file containing funcalc expression
- -l libs # libs to add to link command
- -n # output generated code instead of compiling and executing
- -p prog # generate named program, no execution
- -u # die if any variable is undeclared (don't auto-declare)
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funcalc> is a calculator program that allows arbitrary
-expressions to be constructed, compiled, and executed on columns in a
-Funtools table (FITS binary table or raw event file). It works by
-integrating user-supplied expression(s) into a template C program,
-then compiling and executing the program. B<funcalc> expressions
-are C statements, although some important simplifications (such
-as automatic declaration of variables) are supported.
-
-
-B<funcalc> expressions can be specified in three ways: on the
-command line using the B<-e [expression]> switch, in a file using
-the B<-f [file]> switch, or from stdin (if neither B<-e> nor
-B<-f> is specified). Of course a file containing B<funcalc>
-expressions can be read from stdin.
-
-
-Each invocation of B<funcalc> requires an input Funtools table
-file to be specified as the first command line argument. The output
-Funtools table file is the second optional argument. It is needed only
-if an output FITS file is being created (i.e., in cases where the
-B<funcalc> expression only prints values, no output file is
-needed). If input and output file are both specified, a third optional
-argument can specify the list of columns to activate (using
-FunColumnActivate()). Note
-that B<funcalc> determines whether or not to generate code for
-writing an output file based on the presence or absence of an
-output file argument.
-
-
-A B<funcalc> expression executes on each row of a table and
-consists of one or more C statements that operate on the columns of
-that row (possibly using temporary variables). Within an expression,
-reference is made to a column of the B<current> row using the C
-struct syntax B<cur->[colname]>, e.g. cur->x, cur->pha, etc.
-Local scalar variables can be defined using C declarations at very the
-beginning of the expression, or else they can be defined automatically
-by B<funcalc> (to be of type double). Thus, for example, a swap of
-columns x and y in a table can be performed using either of the
-following equivalent B<funcalc> expressions:
-
-
- double temp;
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;
-
-
-or:
-
-
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;
-
-
-When this expression is executed using a command such as:
-
- funcalc -f swap.expr itest.ev otest.ev
-
-the resulting file will have values of the x and y columns swapped.
-
-
-By default, the data type of the variable for a column is the same as
-the data type of the column as stored in the file. This can be changed
-by appending ":[dtype]" to the first reference to that column. In the
-example above, to force x and y to be output as doubles, specify the
-type 'D' explicitly:
-
- temp = cur->x:D;
- cur->x = cur->y:D;
- cur->y = temp;
-
-
-Data type specifiers follow standard FITS table syntax for defining
-columns using TFORM:
-
-
-=over 4
-
-
-
-
-=item *
-
-A: ASCII characters
-
-
-=item *
-
-B: unsigned 8-bit char
-
-
-=item *
-
-I: signed 16-bit int
-
-
-=item *
-
-U: unsigned 16-bit int (not standard FITS)
-
-
-=item *
-
-J: signed 32-bit int
-
-
-=item *
-
-V: unsigned 32-bit int (not standard FITS)
-
-
-=item *
-
-E: 32-bit float
-
-
-=item *
-
-D: 64-bit float
-
-
-=item *
-
-X: bits (treated as an array of chars)
-
-
-=back
-
-
-Note that only the first reference to a column should contain the
-explicit data type specifier.
-
-
-Of course, it is important to handle the data type of the columns
-correctly. One of the most frequent cause of error in B<funcalc>
-programming is the implicit use of the wrong data type for a column in
-expression. For example, the calculation:
-
- dx = (cur->x - cur->y)/(cur->x + cur->y);
-
-usually needs to be performed using floating point arithmetic. In
-cases where the x and y columns are integers, this can be done by
-reading the columns as doubles using an explicit type specification:
-
- dx = (cur->x:D - cur->y:D)/(cur->x + cur->y);
-
-
-Alternatively, it can be done using C type-casting in the expression:
-
- dx = ((double)cur->x - (double)cur->y)/((double)cur->x + (double)cur->y);
-
-
-
-In addition to accessing columns in the current row, reference also
-can be made to the B<previous> row using B<prev->[colname]>,
-and to the B<next> row using B<next->[colname]>. Note that if
-B<prev->[colname]> is specified in the B<funcalc>
-expression, the very first row is not processed. If
-B<next->[colname]> is specified in the B<funcalc>
-expression, the very last row is not processed. In this way,
-B<prev> and B<next> are guaranteed always to point to valid
-rows. For example, to print out the values of the current x column
-and the previous y column, use the C fprintf function in a
-B<funcalc> expression:
-
- fprintf(stdout, "%d %d\n", cur->x, prev->y);
-
-
-
-New columns can be specified using the same B<cur->[colname]>
-syntax by appending the column type (and optional tlmin/tlmax/binsiz
-specifiers), separated by colons. For example, cur->avg:D will define
-a new column of type double. Type specifiers are the same those
-used above to specify new data types for existing columns.
-
-
-For example, to create and output a new column that is the average value of the
-x and y columns, a new "avg" column can be defined:
-
- cur->avg:D = (cur->x + cur->y)/2.0
-
-Note that the final ';' is not required for single-line expressions.
-
-
-As with FITS TFORM data type specification, the column data type
-specifier can be preceded by a numeric count to define an array, e.g.,
-"10I" means a vector of 10 short ints, "2E" means two single precision
-floats, etc. A new column only needs to be defined once in a
-B<funcalc> expression, after which it can be used without
-re-specifying the type. This includes reference to elements of a
-column array:
-
-
- cur->avg[0]:2D = (cur->x + cur->y)/2.0;
- cur->avg[1] = (cur->x - cur->y)/2.0;
-
-
-
-The 'X' (bits) data type is treated as a char array of dimension
-(numeric_count/8), i.e., 16X is processed as a 2-byte char array. Each
-8-bit array element is accessed separately:
-
- cur->stat[0]:16X = 1;
- cur->stat[1] = 2;
-
-Here, a 16-bit column is created with the MSB is set to 1 and the LSB set to 2.
-
-
-By default, all processed rows are written to the specified output
-file. If you want to skip writing certain rows, simply execute the C
-"continue" statement at the end of the B<funcalc> expression,
-since the writing of the row is performed immediately after the
-expression is executed. For example, to skip writing rows whose
-average is the same as the current x value:
-
-
- cur->avg[0]:2D = (cur->x + cur->y)/2.0;
- cur->avg[1] = (cur->x - cur->y)/2.0;
- if( cur->avg[0] == cur->x )
- continue;
-
-
-
-If no output file argument is specified on the B<funcalc> command
-line, no output file is opened and no rows are written. This is useful
-in expressions that simply print output results instead of generating
-a new file:
-
- fpv = (cur->av3:D-cur->av1:D)/(cur->av1+cur->av2:D+cur->av3);
- fbv = cur->av2/(cur->av1+cur->av2+cur->av3);
- fpu = ((double)cur->au3-cur->au1)/((double)cur->au1+cur->au2+cur->au3);
- fbu = cur->au2/(double)(cur->au1+cur->au2+cur->au3);
- fprintf(stdout, "%f\t%f\t%f\t%f\n", fpv, fbv, fpu, fbu);
-
-In the above example, we use both explicit type specification
-(for "av" columns) and type casting (for "au" columns) to ensure that
-all operations are performed in double precision.
-
-
-When an output file is specified, the selected input table is
-processed and output rows are copied to the output file. Note that
-the output file can be specified as "stdout" in order to write the
-output rows to the standard output. If the output file argument is
-passed, an optional third argument also can be passed to specify which
-columns to process.
-
-
-In a FITS binary table, it sometimes is desirable to copy all of the
-other FITS extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. See B<funtable> for a related example.
-
-
-B<funcalc> works by integrating the user-specified expression
-into a template C program called tabcalc.c.
-The completed program then is compiled and executed. Variable
-declarations that begin the B<funcalc> expression are placed in
-the local declaration section of the template main program. All other
-lines are placed in the template main program's inner processing
-loop. Other details of program generation are handled
-automatically. For example, column specifiers are analyzed to build a
-C struct for processing rows, which is passed to
-FunColumnSelect() and used
-in FunTableRowGet(). If
-an unknown variable is used in the expression, resulting in a
-compilation error, the program build is retried after defining the
-unknown variable to be of type double.
-
-
-Normally, B<funcalc> expression code is added to
-B<funcalc> row processing loop. It is possible to add code
-to other parts of the program by placing this code inside
-special directives of the form:
-
- [directive name]
- ... code goes here ...
- end
-
-
-The directives are:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<global> add code and declarations in global space, before the main routine.
-
-
-
-=item *
-
-B<local> add declarations (and code) just after the local declarations in
-main
-
-
-
-=item *
-
-B<before> add code just before entering the main row processing loop
-
-
-
-=item *
-
-B<after> add code just after exiting the main row processing loop
-
-
-=back
-
-
-
-Thus, the following B<funcalc> expression will declare global
-variables and make subroutine calls just before and just after the
-main processing loop:
-
- global
- double v1, v2;
- double init(void);
- double finish(double v);
- end
- before
- v1 = init();
- end
- ... process rows, with calculations using v1 ...
- after
- v2 = finish(v1);
- if( v2 < 0.0 ){
- fprintf(stderr, "processing failed %g -> %g\n", v1, v2);
- exit(1);
- }
- end
-
-Routines such as init() and finish() above are passed to the generated
-program for linking using the B<-l [link directives ...]>
-switch. The string specified by this switch will be added to the link
-line used to build the program (before the funtools library). For
-example, assuming that init() and finish() are in the library
-libmysubs.a in the /opt/special/lib directory, use:
-
- funcalc -l "-L/opt/special/lib -lmysubs" ...
-
-
-
-User arguments can be passed to a compiled funcalc program using a string
-argument to the "-a" switch. The string should contain all of the
-user arguments. For example, to pass the integers 1 and 2, use:
-
- funcalc -a "1 2" ...
-
-The arguments are stored in an internal array and are accessed as
-strings via the ARGV(n) macro. For example, consider the following
-expression:
-
- local
- int pmin, pmax;
- end
-
- before
- pmin=atoi(ARGV(0));
- pmax=atoi(ARGV(1));
- end
-
- if( (cur->pha >= pmin) && (cur->pha <= pmax) )
- fprintf(stderr, "%d %d %d\n", cur->x, cur->y, cur->pha);
-
-This expression will print out x, y, and pha values for all rows in which
-the pha value is between the two user-input values:
-
- funcalc -a '1 12' -f foo snr.ev'[cir 512 512 .1]'
- 512 512 6
- 512 512 8
- 512 512 5
- 512 512 5
- 512 512 8
-
- funcalc -a '5 6' -f foo snr.ev'[cir 512 512 .1]'
- 512 512 6
- 512 512 5
- 512 512 5
-
-
-
-Note that it is the user's responsibility to ensure that the correct
-number of arguments are passed. The ARGV(n) macro returns a NULL if a
-requested argument is outside the limits of the actual number of args,
-usually resulting in a SEGV if processed blindly. To check the
-argument count, use the ARGC macro:
-
- local
- long int seed=1;
- double limit=0.8;
- end
-
- before
- if( ARGC >= 1 ) seed = atol(ARGV(0));
- if( ARGC >= 2 ) limit = atof(ARGV(1));
- srand48(seed);
- end
-
- if ( drand48() > limit ) continue;
-
-
-
-The macro WRITE_ROW expands to the FunTableRowPut() call that writes
-the current row. It can be used to write the row more than once. In
-addition, the macro NROW expands to the row number currently being
-processed. Use of these two macros is shown in the following example:
-
- if( cur->pha:I == cur->pi:I ) continue;
- a = cur->pha;
- cur->pha = cur->pi;
- cur->pi = a;
- cur->AVG:E = (cur->pha+cur->pi)/2.0;
- cur->NR:I = NROW;
- if( NROW < 10 ) WRITE_ROW;
-
-
-
-If the B<-p [prog]> switch is specified, the expression is not
-executed. Rather, the generated executable is saved with the specified
-program name for later use.
-
-
-If the B<-n> switch is specified, the expression is not
-executed. Rather, the generated code is written to stdout. This is
-especially useful if you want to generate a skeleton file and add your
-own code, or if you need to check compilation errors. Note that the
-comment at the start of the output gives the compiler command needed
-to build the program on that platform. (The command can change from
-platform to platform because of the use of different libraries,
-compiler switches, etc.)
-
-
-As mentioned previously, B<funcalc> will declare a scalar
-variable automatically (as a double) if that variable has been used
-but not declared. This facility is implemented using a sed script
-named funcalc.sed, which processes the
-compiler output to sense an undeclared variable error. This script
-has been seeded with the appropriate error information for gcc, and for
-cc on Solaris, DecAlpha, and SGI platforms. If you find that automatic
-declaration of scalars is not working on your platform, check this sed
-script; it might be necessary to add to or edit some of the error
-messages it senses.
-
-
-In order to keep the lexical analysis of B<funcalc> expressions
-(reasonably) simple, we chose to accept some limitations on how
-accurately C comments, spaces, and new-lines are placed in the
-generated program. In particular, comments associated with local
-variables declared at the beginning of an expression (i.e., not in a
-B<local...end> block) will usually end up in the inner loop, not
-with the local declarations:
-
- /* this comment will end up in the wrong place (i.e, inner loop) */
- double a; /* also in wrong place */
- /* this will be in the the right place (inner loop) */
- if( cur->x:D == cur->y:D ) continue; /* also in right place */
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- cur->avg:E = (cur->x+cur->y)/2.0;
-
-Similarly, spaces and new-lines sometimes are omitted or added in a
-seemingly arbitrary manner. Of course, none of these stylistic
-blemishes affect the correctness of the generated code.
-
-
-Because B<funcalc> must analyze the user expression using the data
-file(s) passed on the command line, the input file(s) must be opened
-and read twice: once during program generation and once during
-execution. As a result, it is not possible to use stdin for the
-input file: B<funcalc> cannot be used as a filter. We will
-consider removing this restriction at a later time.
-
-
-Along with C comments, B<funcalc> expressions can have one-line
-internal comments that are not passed on to the generated C
-program. These internal comment start with the B<#> character and
-continue up to the new-line:
-
- double a; # this is not passed to the generated C file
- # nor is this
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- /* this comment is passed to the C file */
- cur->avg:E = (cur->x+cur->y)/2.0;
-
-
-
-As previously mentioned, input columns normally are identified by
-their being used within the inner event loop. There are rare cases
-where you might want to read a column and process it outside the main
-loop. For example, qsort might use a column in its sort comparison
-routine that is not processed inside the inner loop (and therefore not
-implicitly specified as a column to be read). To ensure that such a
-column is read by the event loop, use the B<explicit> keyword.
-The arguments to this keyword specify columns that should be read into
-the input record structure even though they are not mentioned in the
-inner loop. For example:
-
- explicit pi pha
-
-will ensure that the pi and pha columns are read for each row,
-even if they are not processed in the inner event loop. The B<explicit>
-statement can be placed anywhere.
-
-
-Finally, note that B<funcalc> currently works on expressions
-involving FITS binary tables and raw event files. We will consider
-adding support for image expressions at a later point, if there is
-demand for such support from the community.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funcen.pod b/funtools/doc/pod/funcen.pod
deleted file mode 100644
index 3f10795..0000000
--- a/funtools/doc/pod/funcen.pod
+++ /dev/null
@@ -1,145 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funcen - find centroid (for binary tables)>
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funcen [-i] [-n iter] [-t tol] [-v lev] <iname> <region>
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -i # use image filtering (default: event filtering)
- -n iter # max number of iterations (default: 0)
- -t tol # pixel tolerance distance (default: 1.0)
- -v [0,1,2,3] # output verbosity level (default: 0)
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funcen> iteratively calculates the centroid position within one
-or more regions of a Funtools table (FITS binary table or raw event
-file). Starting with an input table, an initial region specification,
-and an iteration count, the program calculates the average x and y
-position within the region and then uses this new position as the
-region center for the next iteration. Iteration terminates when the
-maximum number of iterations is reached or when the input tolerance
-distance is met for that region. A count of events in the final region
-is then output, along with the pixel position value (and, where
-available, WCS position).
-
-
-The first argument to the program specifies the Funtools table file to
-process. Since the file must be read repeatedly, a value of "stdin"
-is not permitted when the number of iterations is non-zero. Use
-Funtools Bracket Notation to specify FITS
-extensions and filters.
-
-
-The second required argument is the initial region descriptor. Multiple
-regions are permitted. However, compound regions (accelerators,
-variable argument regions and regions connected via boolean algebra)
-are not permitted. Points and polygons also are illegal. These
-restrictions might be lifted in a future version, if warranted.
-
-
-The B<-n> (iteration number) switch specifies the maximum number of
-iterations to perform. The default is 0, which means that the program will
-simply count and display the number of events in the initial region(s).
-Note that when iterations is 0, the data can be input via stdin.
-
-
-The B<-t> (tolerance) switch specifies a floating point tolerance
-value. If the distance between the current centroid position value and
-the last position values is less than this value, iteration terminates.
-The default value is 1 pixel.
-
-
-The B<-v> (verbosity) switch specifies the verbosity level of the
-output. The default is 0, which results in a single line of output for
-each input region consisting of the following values:
-
- counts x y [ra dec coordsys]
-
-The last 3 WCS values are output if WCS information is available in the
-data file header. Thus, for example:
-
- [sh] funcen -n 0 snr.ev "cir 505 508 5"
- 915 505.00 508.00 345.284038 58.870920 j2000
-
- [sh] funcen -n 3 snr.ev "cir 505 508 5"
- 1120 504.43 509.65 345.286480 58.874587 j2000
-
-The first example simply counts the number of events in the initial region.
-The second example iterates the centroid calculation three times to determine
-a final "best" position.
-
-
-Higher levels of verbosity obviously imply more verbose output. At
-level 1, the output essentially contains the same information as level
-0, but with keyword formatting:
-
- [sh] funcen -v 1 -n 3 snr.ev "cir 505 508 5"
- event_file: snr.ev
- initial_region: cir 505 508 5
- tolerance: 1.0000
- iterations: 1
-
- events: 1120
- x,y(physical): 504.43 509.65
- ra,dec(j2000): 345.286480 58.874587
- final_region1: cir 504.43 509.65 5
-
-Level 2 outputs results from intermediate calculations as well.
-
-
-Ordinarily, region filtering is performed using analytic (event)
-filtering, i.e. that same style of filtering as is performed by
-B<fundisp> and B<funtable>. Use the B<-i> switch to specify image
-filtering, i.e. the same style filtering as is performed by B<funcnts>.
-Thus, you can perform a quick calculation of counts in regions, using
-either the analytic or image filtering method, by specifying the
- B<-n 0> and optional B<-i> switches. These two method often
-give different results because of how boundary events are processed:
-
- [sh] funcen snr.ev "cir 505 508 5"
- 915 505.00 508.00 345.284038 58.870920 j2000
-
- [sh] funcen -i snr.ev "cir 505 508 5"
- 798 505.00 508.00 345.284038 58.870920 j2000
-
-See Region Boundaries for more information
-about how boundaries are calculated using these two methods.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funclose.pod b/funtools/doc/pod/funclose.pod
deleted file mode 100644
index 48357a3..0000000
--- a/funtools/doc/pod/funclose.pod
+++ /dev/null
@@ -1,53 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunClose - close a Funtools data file>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void FunClose(Fun fun)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunClose()> routine closes a previously-opened Funtools data
-file, freeing control structures. If a
-Funtools reference handle
-was passed to
-the FunOpen() call for this file,
-and if copy mode also was specified for that file, then
-FunClose() also will copy the
-remaining extensions from the input file to the output file (if the
-input file still is open). Thus, we recommend always closing the
-output Funtools file B<before> the input file. (Alternatively,
-you can call FunFlush()
-explicitly).
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funcnts.pod b/funtools/doc/pod/funcnts.pod
deleted file mode 100644
index 7d5dfe5..0000000
--- a/funtools/doc/pod/funcnts.pod
+++ /dev/null
@@ -1,657 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funcnts - count photons in specified regions, with bkgd subtraction>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funcnts [switches] <source_file> [source_region] [bkgd_file] [bkgd_region|bkgd_value]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -e "source_exposure[;bkgd_exposure]"
- # source (bkgd) FITS exposure image using matching files
- -w "source_exposure[;bkgd_exposure]"
- # source (bkgd) FITS exposure image using WCS transform
- -t "source_timecorr[;bkgd_timecorr]"
- # source (bkgd) time correction value or header parameter name
- -g # output using nice g format
- -G # output using %.14g format (maximum precision)
- -i "[column;]int1;int2..." # column-based intervals
- -m # match individual source and bkgd regions
- -p # output in pixels, even if wcs is present
- -r # output inner/outer radii (and angles) for annuli (and pandas)
- -s # output summed values
- -v "scol[;bcol]" # src and bkgd value columns for tables
- -T # output in starbase/rdb format
- -z # output regions with zero area
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funcnts> counts photons in the specified source regions and
-reports the results for each region. Regions are specified using the
-Spatial Region Filtering mechanism.
-Photons are also counted in the specified bkgd regions applied to the
-same data file or a different data file. (Alternatively, a constant
-background value in counts/pixel**2 can be specified.) The bkgd regions
-are either paired one-to-one with source regions or pooled and
-normalized by area, and then subtracted from the source counts in each
-region. Displayed results include the bkgd-subtracted counts in each
-region, as well as the error on the counts, the area in
-each region, and the surface brightness (cnts/area**2) calculated for
-each region.
-
-
-The first argument to the program specifies the FITS input image, array, or
-raw event file to process. If "stdin" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify FITS extensions, image sections, and filters.
-
-
-The optional second argument is the source region descriptor. If no
-region is specified, the entire field is used.
-
-
-The background arguments can take one of two forms, depending on
-whether a separate background file is specified. If the source
-file is to be used for background as well, the third argument can be
-either the background region, or a constant value denoting background
-cnts/pixel. Alternatively, the third argument can be a background
-data file, in which case the fourth argument is the background region.
-If no third argument is specified, a constant value of 0 is used
-(i.e., no background).
-
-
-In summary, the following command arguments are valid:
-
- [sh] funcnts sfile # counts in source file
- [sh] funcnts sfile sregion # counts in source region
- [sh] funcnts sfile sregion bregion # bkgd reg. is from source file
- [sh] funcnts sfile sregion bvalue # bkgd reg. is constant
- [sh] funcnts sfile sregion bfile bregion # bkgd reg. is from separate file
-
-
-
-NB: unlike other Funtools programs, source and background regions are
-specified as separate arguments on the command line, rather than being
-placed inside brackets as part of the source and background filenames.
-This is because regions in funcnts are not simply used as data
-filters, but also are used to calculate areas, exposure, etc. If you
-put the source region inside the brackets (i.e. use it simply as a
-filter) rather than specifying it as argument two, the program still
-will only count photons that pass the region filter. However, the area
-calculation will be performed on the whole field, since field() is the
-default source region. This rarely is the desired behavior. On the
-other hand, with FITS binary tables, it often is useful to put a column
-filter in the filename brackets, so that only events matching the
-column filter are counted inside the region.
-
-
-For example, to extract the counts within a radius of 22 pixels from the
-center of the FITS binary table snr.ev and subtract the background determined
-from the same image within an annulus of radii 50-100 pixels:
-
- [sh] funcnts snr.ev "circle(502,512,22)" "annulus(502,512,50,100)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- circle(502,512,22)
-
- reg counts pixels
- ---- ------------ ---------
- 1 4382.000 1513
-
- background region(s)
- --------------------
- annulus(502,512,50,100)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-
-The area units for the output columns labeled "area", "surf_bri"
-(surface brightness) and "surf_err" will be given either in
-arc-seconds (if appropriate WCS information is in the data file
-header(s)) or in pixels. If the data file has WCS info, but you do not
-want arc-second units, use the B<-p> switch to force output in
-pixels. Also, regions having zero area are not normally included in
-the primary (background-subtracted) table, but are included in the
-secondary source and bkgd tables. If you want these regions to be
-included in the primary table, use the B<-z> switch.
-
-
-Note that a simple sed command will extract the background-subtracted results
-for further analysis:
-
- [sh] cat funcnts.sed
- 1,/---- .*/d
- /^$/,$d
-
- [sh] sed -f funcnts.sed funcnts.out
- 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-
-
-
-If separate source and background files are specified, B<funcnts> will
-attempt to normalize the the background area so that the background
-pixel size is the same as the source pixel size. This normalization
-can only take place if the appropriate WCS information is contained in
-both files (e.g. degrees/pixel values in CDELT). If either
-file does not contain the requisite size information, the normalization
-is not performed. In this case, it is the user's responsibility to
-ensure that the pixel sizes are the same for the two files.
-
-
-Normally, if more than one background region is specified, B<funcnts>
-will combine them all into a single region and use this background
-region to produce the background-subtracted results for each source
-region. The B<-m> (match multiple backgrounds) switch tells
-B<funcnts> to make a one to one correspondence between background and
-source regions, instead of using a single combined background region.
-For example, the default case is to combine 2 background
-regions into a single region and then apply that region to each of the
-source regions:
-
-
- [sh] funcnts snr.ev "annulus(502,512,0,22,n=2)" "annulus(502,512,50,100,n=2)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002
- 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,22,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region(s)
- --------------------
- annulus(502,512,50,100,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-
-Note that the basic region filter rule "each photon is counted once
-and no photon is counted more than once" still applies when using The
-B<-m> to match background regions. That is, if two background
-regions overlap, the overlapping pixels will be counted in only one of
-them. In a worst-case scenario, if two background regions are the same
-region, the first will get all the counts and area and the second
-will get none.
-
-
-Using the B<-m> switch causes B<funcnts> to use each of the two
-background regions independently with each of the two source regions:
-
-
- [sh] funcnts -m snr.ev "annulus(502,512,0,22,n=2)" "ann(502,512,50,100,n=2)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3087.015 56.954 150.985 2.395 23872.00 0.129 0.002
- 2 755.959 34.295 388.041 5.672 72959.99 0.010 0.000
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,22,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region(s)
- --------------------
- ann(502,512,50,100,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3975.000 9820
- 2 4681.000 13752
-
-
-
-Note that most floating point quantities are displayed using "f"
-format. You can change this to "g" format using the B<-g>
-switch. This can be useful when the counts in each pixel is very
-small or very large. If you want maximum precision and don't care
-about the columns lining up nicely, use B<-G>, which outputs
-all floating values as %.14g.
-
-
-When counting photons using the annulus and panda (pie and annuli)
-shapes, it often is useful to have access to the radii (and panda
-angles) for each separate region. The B<-r> switch will add radii
-and angle columns to the output table:
-
-
- [sh] funcnts -r snr.ev "annulus(502,512,0,22,n=2)" "ann(502,512,50,100,n=2)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
- # radii: arcsecs
- # angles: degrees
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err radius1 radius2 angle1 angle2
- ---- ------------ --------- ------------ --------- --------- --------- --------- --------- --------- --------- ---------
- 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002 0.00 88.00 NA NA
- 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000 88.00 176.00 NA NA
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,22,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region(s)
- --------------------
- ann(502,512,50,100,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-
-
-
-Radii are given in units of pixels or arc-seconds (depending on the
-presence of WCS info), while the angle values (when present) are in
-degrees. These columns can be used to plot radial profiles. For
-example, the script B<funcnts.plot> in the funtools
-distribution) will plot a radial profile using gnuplot (version 3.7 or
-above). A simplified version of this script is shown below:
-
-
- #!/bin/sh
-
- if [ x"$1" = xgnuplot ]; then
- if [ x`which gnuplot 2>/dev/null` = x ]; then
- echo "ERROR: gnuplot not available"
- exit 1
- fi
- awk '
- BEGIN{HEADER=1; DATA=0; FILES=""; XLABEL="unknown"; YLABEL="unknown"}
- HEADER==1{
- if( $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( FILES != "" ) FILES = FILES ","
- FILES = FILES $4
- }
- else if( $1 == "#" && $2 == "radii:" ){
- XLABEL = $3
- }
- else if( $1 == "#" && $2 == "surf_bri:" ){
- YLABEL = $3
- }
- else if( $1 == "----" ){
- printf "set nokey; set title \"funcnts(%s)\"\n", FILES
- printf "set xlabel \" radius(%s)\"\n", XLABEL
- printf "set ylabel \"surf_bri(%s)\"\n", YLABEL
- print "plot \"-\" using 3:4:6:7:8 with boxerrorbars"
- HEADER = 0
- DATA = 1
- next
- }
- }
- DATA==1{
- if( NF == 12 ){
- print $9, $10, ($9+$10)/2, $7, $8, $7-$8, $7+$8, $10-$9
- }
- else{
- exit
- }
- }
- ' | gnuplot -persist - 1>/dev/null 2>&1
-
- elif [ x"$1" = xds9 ]; then
- awk '
- BEGIN{HEADER=1; DATA=0; XLABEL="unknown"; YLABEL="unknown"}
- HEADER==1{
- if( $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( FILES != "" ) FILES = FILES ","
- FILES = FILES $4
- }
- else if( $1 == "#" && $2 == "radii:" ){
- XLABEL = $3
- }
- else if( $1 == "#" && $2 == "surf_bri:" ){
- YLABEL = $3
- }
- else if( $1 == "----" ){
- printf "funcnts(%s) radius(%s) surf_bri(%s) 3\n", FILES, XLABEL, YLABEL
- HEADER = 0
- DATA = 1
- next
- }
- }
- DATA==1{
- if( NF == 12 ){
- print $9, $7, $8
- }
- else{
- exit
- }
- }
- '
- else
- echo "funcnts -r ... | funcnts.plot [ds9|gnuplot]"
- exit 1
- fi
-
-
-Thus, to run B<funcnts> and plot the results using gnuplot (version 3.7
-or above), use:
-
- funcnts -r snr.ev "annulus(502,512,0,50,n=5)" ... | funcnts.plot gnuplot
-
-
-
-The B<-s> (sum) switch causes B<funcnts> to produce an
-additional table of summed (integrated) background subtracted values,
-along with the default table of individual values:
-
-
- [sh] funcnts -s snr.ev "annulus(502,512,0,50,n=5)" "annulus(502,512,50,100)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # summed background-subtracted results
- upto net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
- 2 3776.817 65.254 457.183 4.914 79679.98 0.047 0.001
- 3 4025.492 71.972 1031.508 11.087 179775.96 0.022 0.000
- 4 4185.149 80.109 1840.851 19.786 320831.94 0.013 0.000
- 5 4415.540 90.790 2873.460 30.885 500799.90 0.009 0.000
-
-
- # background-subtracted results
- reg counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
- 2 895.818 35.423 345.182 3.710 60159.99 0.015 0.001
- 3 248.675 29.345 574.325 6.173 100095.98 0.002 0.000
- 4 159.657 32.321 809.343 8.699 141055.97 0.001 0.000
- 5 230.390 37.231 1032.610 11.099 179967.96 0.001 0.000
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,50,n=5)
-
- reg counts pixels sumcnts sumpix
- ---- ------------ --------- ------------ ---------
- 1 2993.000 305 2993.000 305
- 2 1241.000 940 4234.000 1245
- 3 823.000 1564 5057.000 2809
- 4 969.000 2204 6026.000 5013
- 5 1263.000 2812 7289.000 7825
-
- background region(s)
- --------------------
- annulus(502,512,50,100)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-
-
-
-The B<-t> and B<-e> switches can be used to apply timing and
-exposure corrections, respectively, to the data. Please note that
-these corrections are meant to be used qualitatively, since
-application of more accurate correction factors is a complex and
-mission-dependent effort. The algorithm for applying these simple
-corrections is as follows:
-
- C = Raw Counts in Source Region
- Ac= Area of Source Region
- Tc= Exposure time for Source Data
- Ec= Average exposure in Source Region, from exposure map
-
- B= Raw Counts in Background Region
- Ab= Area of Background Region
- Tb= (Exposure) time for Background Data
- Eb= Average exposure in Background Region, from exposure map
-
-Then, Net Counts in Source region is
-
- Net= C - B * (Ac*Tc*Ec)/(Ab*Tb*Eb)
-
-with the standard propagation of errors for the Error on Net.
-The net rate would then be
-
- Net Rate = Net/(Ac*Tc*Ec)
-
-The average exposure in each region is calculated by summing up the
-pixel values in the exposure map for the given region and then
-dividing by the number of pixels in that region. Exposure maps often
-are generated at a block factor > 1 (e.g., block 4 means that each
-exposure pixel contains 4x4 pixels at full resolution) and
-B<funcnts> will deal with the blocking automatically. Using the
-B<-e> switch, you can supply both source and background exposure
-files (separated by ";"), if you have separate source and background
-data files. If you do not supply a background exposure file to go with
-a separate background data file, B<funcnts> assumes that exposure
-already has been applied to the background data file. In addition, it
-assumes that the error on the pixels in the background data file is
-zero.
-
-
-NB: The B<-e> switch assumes that the exposure map overlays the
-image file B<exactly>, except for the block factor. Each pixel in
-the image is scaled by the block factor to access the corresponding
-pixel in the exposure map. If your exposure map does not line up
-exactly with the image, B<do not use> the B<-e> exposure
-correction. In this case, it still is possible to perform exposure
-correction B<if> both the image and the exposure map have valid
-WCS information: use the B<-w> switch so that the transformation
-from image pixel to exposure pixel uses the WCS information. That is,
-each pixel in the image region will be transformed first from image
-coordinates to sky coordinates, then from sky coordinates to exposure
-coordinates. Please note that using B<-w> can increase the time
-required to process the exposure correction considerably.
-
-
-A time correction can be applied to both source and
-background data using the B<-t> switch. The value for the correction can
-either be a numeric constant or the name of a header parameter in
-the source (or background) file:
-
- [sh] funcnts -t 23.4 ... # number for source
- [sh] funcnts -t "LIVETIME;23.4" ... # param for source, numeric for bkgd
-
-When a time correction is specified, it is applied to the net counts
-as well (see algorithm above), so that the units of surface brightness
-become cnts/area**2/sec.
-
-
-The B<-i> (interval) switch is used to run B<funcnts> on multiple
-column-based intervals with only a single pass through the data. It is
-equivalent to running B<funcnts> several times with a different column
-filter added to the source and background data each time. For each
-interval, the full B<funcnts> output is generated, with a linefeed
-character (^L) inserted between each run. In addition, the output for
-each interval will contain the interval specification in its header.
-Intervals are very useful for generating X-ray hardness ratios
-efficiently. Of course, they are only supported when the input data
-are contained in a table.
-
-
-Two formats are supported for interval specification. The most general
-format is semi-colon-delimited list of filters to be used as intervals:
-
- funcnts -i "pha=1:5;pha=6:10;pha=11:15" snr.ev "circle(502,512,22)" ...
-
-Conceptually, this will be equivalent to running B<funcnts> three times:
-
- funcnts snr.ev'[pha=1:5]' "circle(502,512,22)"
- funcnts snr.ev'[pha=6:10]' "circle(502,512,22)"
- funcnts snr.ev'[pha=11:15]' "circle(502,512,22)"
-
-However, using the B<-i> switch will require only one pass through
-the data.
-
-
-Note that complex filters can be used to specify intervals:
-
- funcnts -i "pha=1:5&&pi=4;pha=6:10&&pi=5;pha=11:15&&pi=6" snr.ev ...
-
-The program simply runs the data through each filter in turn and generates
-three B<funcnts> outputs, separated by the line-feed character.
-
-
-In fact, although the intent is to support intervals for hardness ratios,
-the specified filters do not have to be intervals at all. Nor does one
-"interval" filter have to be related to another. For example:
-
- funcnts -i "pha=1:5;pi=6:10;energy=11:15" snr.ev "circle(502,512,22)" ...
-
-is equivalent to running B<funcnts> three times with unrelated filter
-specifications.
-
-
-A second interval format is supported for the simple case in which a
-single column is used to specify multiple homogeneous intervals for
-that column. In this format, a column name is specified first,
-followed by intervals:
-
- funcnts -i "pha;1:5;6:10;11:15" snr.ev "circle(502,512,22)" ...
-
-This is equivalent to the first example, but requires less typing. The
-B<funcnts> program will simply prepend "pha=" before each of the specified
-intervals. (Note that this format does not contain the "=" character in
-the column argument.)
-
-
-Ordinarily, when B<funcnts> is run on a FITS binary table (or a
-raw event table), one integral count is accumulated for each row
-(event) contained within a given region. The B<-v "scol[;bcol]">
-(value column) switch will accumulate counts using the value from the
-specified column for the given event. If only a single column is
-specified, it is used for both the source and background regions. Two
-separate columns, separated by a semi-colon, can be specified for source
-and background. The special token '$none' can be used to specify that
-a value column is to be used for one but not the other. For example,
-'pha;$none' will use the pha column for the source but use integral
-counts for the background, while '$none;pha' will do the converse.
-If the value column is of type logical, then the value used will be 1
-for T and 0 for F. Value columns are used, for example, to integrate
-probabilities instead of integral counts.
-
-
-If the B<-T> (rdb table) switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces and line-feed will be inserted between
-tables.
-
-
-Finally, note that B<funcnts> is an image program, even though it
-can be run directly on FITS binary tables. This means that image
-filtering is applied to the rows in order to ensure that the same
-results are obtained regardless of whether a table or the equivalent
-binned image is used. Because of this, however, the number of counts
-found using B<funcnts> can differ from the number of events found
-using row-filter programs such as B<fundisp> or B<funtable>
-For more information about these difference, see the discussion of
-Region Boundaries.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funcolumnactivate.pod b/funtools/doc/pod/funcolumnactivate.pod
deleted file mode 100644
index d5f6e3a..0000000
--- a/funtools/doc/pod/funcolumnactivate.pod
+++ /dev/null
@@ -1,239 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunColumnActivate - activate Funtools columns>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void FunColumnActivate(Fun fun, char *s, char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunColumnActivate()> routine determines which columns (set up
-by FunColumnSelect())
-ultimately will be read and/or written. By default, all columns that
-are selected using
-FunColumnSelect()
-are activated. The
-FunColumnActivate()
-routine can be used to turn off/off activation of specific columns.
-
-
-The first argument is the Fun handle associated with this set of
-columns. The second argument is a space-delimited list of columns to
-activate or de-activate. Columns preceded by "+" are activated and
-columns preceded by a "-" are de-activated. If a column is named
-without "+" or "-", it is activated. The reserved strings "$region"
-and '$n' are used to activate a special columns containing the filter
-region value and row value, respectively, associated with
-this row. For example, if a filter containing two circular regions is
-specified as part of the Funtools file name, this column will contain
-a value of 1 or 2, depending on which region that row was in. The
-reserved strings "$x" and "$y" are used to activate the current
-binning columns. Thus, if the columns DX and DY are specified as
-binning columns:
-
- [sh $] fundisp foo.fits[bincols=(DX,DY)]
-
-then "$x" and "$y" will refer to these columns in a call to
-FunColumnActivate().
-
-
-In addition, if the activation string contains only columns to be
-activated, then the routine will de-activate all other columns.
-Similarly, if the activation string contains only
-columns to de-activate, then the routine will activate all other columns
-before activating the list. This makes it simple to change the
-activation state of all columns without having to know all of the
-column names. For example:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<"pi pha time"> # only these three columns will be active
-
-
-=item *
-
-B<"-pi -pha -time"> # all but these columns will be active
-
-
-=item *
-
-B<"pi -pha"> # only pi is active, pha is not, others are not
-
-
-=item *
-
-B<"+pi -pha"> # same as above
-
-
-=item *
-
-B<"pi -pha -time"> # only pi is active, all others are not
-
-
-=item *
-
-B<"pi pha"> # pha and pi are active, all others are not
-
-
-=item *
-
-B<"pi pha -x -y"> # pha and pi are active, all others are not
-
-
-=back
-
-
-
-
-You can use the column activation list to reorder columns, since
-columns are output in the order specified. For example:
-
- # default output order
- fundisp snr.ev'[cir 512 512 .1]'
- X Y PHA PI TIME DX DY
- -------- -------- -------- -------- --------------------- -------- --------
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-
- # re-order the output by specifying explicit order
- fundisp snr.ev'[cir 512 512 .1]' "time x y dy dx pi pha"
- TIME X Y DY DX PI PHA
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 512 512 574 578 7 6
- 79494575.58943175 512 512 573 579 9 8
- 79493631.03866175 512 512 575 578 6 5
- 79493290.86521725 512 512 575 578 5 5
- 79493432.00990875 512 512 573 579 9 8
-
-
-
-A "+" sign by itself means to activate all columns, so that you can reorder
-just a few columns without specifying all of them:
-
- # reorder 3 columns and then output the rest
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha +"
- TIME PI PHA Y X DX DY
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 7 6 512 512 578 574
- 79494575.58943175 9 8 512 512 579 573
- 79493631.03866175 6 5 512 512 578 575
- 79493290.86521725 5 5 512 512 578 575
- 79493432.00990875 9 8 512 512 579 573
-
-The column activation/deactivation is performed in the order of the
-specified column arguments. This means you can mix "+", "-" (which
-de-activates all columns) and specific column names to reorder and
-select columns in one command. For example, consider the following:
-
- # reorder and de-activate
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha + -x -y"
- TIME PI PHA DX DY
- --------------------- -------- -------- -------- --------
- 79493997.45854475 7 6 578 574
- 79494575.58943175 9 8 579 573
- 79493631.03866175 6 5 578 575
- 79493290.86521725 5 5 578 575
- 79493432.00990875 9 8 579 573
-
-We first activate "time", "pi", and "pha" so that they are output first.
-We then activate all of the other columns, and then de-activate "x" and "y".
-Note that this is different from:
-
- # probably not what you want ...
- fundisp snr.ev'[cir 512 512 .1]' "time pi pha -x -y +"
- TIME PI PHA Y X DX DY
- --------------------- -------- -------- -------- -------- -------- --------
- 79493997.45854475 7 6 512 512 578 574
- 79494575.58943175 9 8 512 512 579 573
- 79493631.03866175 6 5 512 512 578 575
- 79493290.86521725 5 5 512 512 578 575
- 79493432.00990875 9 8 512 512 579 573
-
-Here, "x" and "y" are de-activated, but then all columns including "x" and
-"y" are again re-activated.
-
-
-Typically,
-FunColumnActivate() uses a
-list of columns that are passed into the program from the command line. For
-example, the code for funtable contains the following:
-
- char *cols=NULL;
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* set active flag for specified columns */
- if( argc >= 4 ) cols = argv[3];
- FunColumnActivate(fun, cols, NULL);
-
-
-The FunOpen() call sets the
-default columns to be all columns in the input file. The
-FunColumnActivate() call
-then allows the user to control which columns ultimately will be
-activated (i.e., in this case, written to the new file). For example:
-
- funtable test.ev foo.ev "pi pha time"
-
-will process only the three columns mentioned, while:
-
- funtable test.ev foo.ev "-time"
-
-will process all columns except "time".
-
-
-If FunColumnActivate()
-is called with a null string, then the environment variable
-B<FUN_COLUMNS> will be used to provide a global value, if present.
-This is the reason why we call the routine even if no columns
-are specified on the command line (see example above), instead
-of calling it this way:
-
- /* set active flag for specified columns */
- if( argc >= 4 ){
- FunColumnActivate(fun, argv[3], NULL);
- }
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funcolumnlookup.pod b/funtools/doc/pod/funcolumnlookup.pod
deleted file mode 100644
index bfdf5c0..0000000
--- a/funtools/doc/pod/funcolumnlookup.pod
+++ /dev/null
@@ -1,188 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunColumnLookup - lookup a Funtools column>
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunColumnLookup(Fun fun, char *s, int which,
- char **name, int *type, int *mode,
- int *offset, int *n, int *width)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunColumnLookup()> routine returns information about a named
-(or indexed) column. The first argument is the Fun handle associated
-with this set of columns. The second argument is the name of the
-column to look up. If the name argument is NULL, the argument that
-follows is the zero-based index into the column array of the column
-for which information should be returned. The next argument is a
-pointer to a char *, which will contain the name of the column. The
-arguments that follow are the addresses of int values into which
-the following information will be returned:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<type>: data type of column:
-
-
-=over 4
-
-
-
-
-=item *
-
-A: ASCII characters
-
-
-=item *
-
-B: unsigned 8-bit char
-
-
-=item *
-
-I: signed 16-bit int
-
-
-=item *
-
-U: unsigned 16-bit int (not standard FITS)
-
-
-=item *
-
-J: signed 32-bit int
-
-
-=item *
-
-V: unsigned 32-bit int (not standard FITS)
-
-
-=item *
-
-E: 32-bit float
-
-
-=item *
-
-D: 64-bit float
-
-
-=back
-
-
-
-
-=item *
-
-B<mode>: bit flag status of column, including:
-
-
-=over 4
-
-
-
-
-=item *
-
-COL_ACTIVE 1 is column activated?
-
-
-=item *
-
-COL_IBUF 2 is column in the raw input data?
-
-
-=item *
-
-COL_PTR 4 is column a pointer to an array?
-
-
-=item *
-
-COL_READ 010 is read mode selected?
-
-
-=item *
-
-COL_WRITE 020 is write mode selected?
-
-
-=item *
-
-COL_REPLACEME 040 is this column being replaced by user data?
-
-
-=back
-
-
-
-
-=item *
-
-B<offset>: byte offset in struct
-
-
-=item *
-
-B<n>: number of elements (i.e. size of vector) in this column
-
-
-=item *
-
-B<width>: size in bytes of this column
-
-
-=back
-
-
-If the named column exists, the routine returns a positive integer,
-otherwise zero is returned. (The positive integer is the index+1 into
-the column array where this column was located.)
-
-If NULL is passed as the return address of one (or more) of these
-values, no data is passed back for that information. For
-example:
-
- if( !FunColumnLookup(fun, "phas", 0, NULL NULL, NULL, NULL, &npha, NULL) )
- gerror(stderr, "can't find phas column\n");
-
-only returns information about the size of the phas vector.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funcolumnselect.pod b/funtools/doc/pod/funcolumnselect.pod
deleted file mode 100644
index ce65d38..0000000
--- a/funtools/doc/pod/funcolumnselect.pod
+++ /dev/null
@@ -1,686 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunColumnSelect - select Funtools columns>
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunColumnSelect(Fun fun, int size, char *plist,
- char *name1, char *type1, char *mode1, int offset1,
- char *name2, char *type2, char *mode2, int offset2,
- ...,
- NULL)
-
- int FunColumnSelectArr(Fun fun, int size, char *plist,
- char **names, char **types, char **modes,
- int *offsets, int nargs);
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-The B<FunColumnSelect()> routine is used to select the columns
-from a Funtools binary table extension or raw event file for
-processing. This routine allows you to specify how columns in a file
-are to be read into a user record structure or written from a user
-record structure to an output FITS file.
-
-
-The first argument is the Fun handle associated with this set of
-columns. The second argument specifies the size of the user record
-structure into which columns will be read. Typically, the sizeof()
-macro is used to specify the size of a record structure. The third
-argument allows you to specify keyword directives for the selection
-and is described in more detail below.
-
-
-Following the first three required arguments is a variable length list of
-column specifications. Each column specification will consist of four
-arguments:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<name>: the name of the column
-
-
-
-=item *
-
-B<type>: the data type of the column as it will be stored in
-the user record struct (not the data type of the input file). The
-following basic data types are recognized:
-
-
-=over 4
-
-
-
-
-=item *
-
-A: ASCII characters
-
-
-=item *
-
-B: unsigned 8-bit char
-
-
-=item *
-
-I: signed 16-bit int
-
-
-=item *
-
-U: unsigned 16-bit int (not standard FITS)
-
-
-=item *
-
-J: signed 32-bit int
-
-
-=item *
-
-V: unsigned 32-bit int (not standard FITS)
-
-
-=item *
-
-E: 32-bit float
-
-
-=item *
-
-D: 64-bit float
-
-
-=back
-
-
-The syntax used is similar to that which defines the TFORM parameter
-in FITS binary tables. That is, a numeric repeat value can precede
-the type character, so that "10I" means a vector of 10 short ints, "E"
-means a single precision float, etc. Note that the column value from
-the input file will be converted to the specified data type as the
-data is read by
-FunTableRowGet().
-
-
-[ A short digression regarding bit-fields: Special attention is
-required when reading or writing the FITS bit-field type
-("X"). Bit-fields almost always have a numeric repeat character
-preceding the 'X' specification. Usually this value is a multiple of 8
-so that bit-fields fit into an integral number of bytes. For all
-cases, the byte size of the bit-field B is (N+7)/8, where N is the
-numeric repeat character.
-
-
-A bit-field is most easily declared in the user struct as an array of
-type char of size B as defined above. In this case, bytes are simply
-moved from the file to the user space. If, instead, a short or int
-scalar or array is used, then the algorithm for reading the bit-field
-into the user space depends on the size of the data type used along
-with the value of the repeat character. That is, if the user data
-size is equal to the byte size of the bit-field, then the data is
-simply moved (possibly with endian-based byte-swapping) from one to
-the other. If, on the other hand, the data storage is larger than the
-bit-field size, then a data type cast conversion is performed to move
-parts of the bit-field into elements of the array. Examples will help
-make this clear:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-If the file contains a 16X bit-field and user space specifies a 2B
-char array[2], then the bit-field is moved directly into the char array.
-
-
-
-=item *
-
-If the file contains a 16X bit-field and user space specifies a 1I
-scalar short int, then the bit-field is moved directly into the short int.
-
-
-
-=item *
-
-If the file contains a 16X bit-field and user space specifies a 1J
-scalar int, then the bit-field is type-cast to unsigned int before
-being moved (use of unsigned avoids possible sign extension).
-
-
-
-=item *
-
-If the file contains a 16X bit-field and user space specifies a 2J
-int array[2], then the bit-field is handled as 2 chars, each of which
-are type-cast to unsigned int before being moved (use of unsigned
-avoids possible sign extension).
-
-
-
-=item *
-
-If the file contains a 16X bit-field and user space specifies a 1B
-char, then the bit-field is treated as a char, i.e., truncation will
-occur.
-
-
-
-=item *
-
-If the file contains a 16X bit-field and user space specifies a 4J
-int array[4], then the results are undetermined.
-
-
-
-=back
-
-
-For all user data types larger than char, the bit-field is byte-swapped
-as necessary to convert to native format, so that bits in the
-resulting data in user space can be tested, masked, etc. in the same
-way regardless of platform.]
-
-
-In addition to setting data type and size, the B<type>
-specification allows a few ancillary parameters to be set, using the
-full syntax for B<type>:
-
- [@][n]<type>[[['B']poff]][:[tlmin[:tlmax[:binsiz]]]]
-
-
-
-The special character "@" can be prepended to this specification to
-indicated that the data element is a pointer in the user record,
-rather than an array stored within the record.
-
-
-The [n] value is an integer that specifies the
-number of elements that are in this column (default is 1). TLMIN,
-TLMAX, and BINSIZ values also can be specified for this column after
-the type, separated by colons. If only one such number is specified,
-it is assumed to be TLMAX, and TLMIN and BINSIZ are set to 1.
-
-
-The [poff] value can be used to specify the offset into an
-array. By default, this offset value is set to zero and the data
-specified starts at the beginning of the array. The offset usually
-is specified in terms of the data type of the column. Thus an offset
-specification of [5] means a 20-byte offset if the data type is a
-32-bit integer, and a 40-byte offset for a double. If you want to
-specify a byte offset instead of an offset tied to the column data type,
-precede the offset value with 'B', e.g. [B6] means a 6-bye offset,
-regardless of the column data type.
-
-The [poff] is especially useful in conjunction with the pointer @
-specification, since it allows the data element to anywhere stored
-anywhere in the allocated array. For example, a specification such as
-"@I[2]" specifies the third (i.e., starting from 0) element in the
-array pointed to by the pointer value. A value of "@2I[4]" specifies
-the fifth and sixth values in the array. For example, consider the
-following specification:
-
- typedef struct EvStruct{
- short x[4], *atp;
- } *Event, EventRec;
- /* set up the (hardwired) columns */
- FunColumnSelect( fun, sizeof(EventRec), NULL,
- "2i", "2I ", "w", FUN_OFFSET(Event, x),
- "2i2", "2I[2]", "w", FUN_OFFSET(Event, x),
- "at2p", "@2I", "w", FUN_OFFSET(Event, atp),
- "at2p4", "@2I[4]", "w", FUN_OFFSET(Event, atp),
- "atp9", "@I[9]", "w", FUN_OFFSET(Event, atp),
- "atb20", "@I[B20]", "w", FUN_OFFSET(Event, atb),
- NULL);
-
-Here we have specified the following columns:
-
-
-=over 4
-
-
-
-
-=item *
-
-2i: two short ints in an array which is stored as part the
-record
-
-
-=item *
-
-2i2: the 3rd and 4th elements of an array which is stored
-as part of the record
-
-
-=item *
-
-an array of at least 10 elements, not stored in the record but
-allocated elsewhere, and used by three different columns:
-
-
-=over 4
-
-
-
-
-=item *
-
-at2p: 2 short ints which are the first 2 elements of the allocated array
-
-
-=item *
-
-at2p4: 2 short ints which are the 5th and 6th elements of
-the allocated array
-
-
-=item *
-
-atp9: a short int which is the 10th element of the allocated array
-
-
-=back
-
-
-
-
-=item *
-
-atb20: a short int which is at byte offset 20 of another allocated array
-
-
-=back
-
-
-In this way, several columns can be specified, all of which are in a
-single array. B<NB>: it is the programmer's responsibility to
-ensure that specification of a positive value for poff does not point
-past the end of valid data.
-
-
-
-=item *
-
-B<read/write mode>: "r" means that the column is read from an
-input file into user space by
-FunTableRowGet(), "w" means that
-the column is written to an output file. Both can specified at the same
-time.
-
-
-
-=item *
-
-B<offset>: the offset into the user data to store
-this column. Typically, the macro FUN_OFFSET(recname, colname) is used
-to define the offset into a record structure.
-
-
-=back
-
-
-
-
-When all column arguments have been specified, a final NULL argument
-must added to signal the column selection list.
-
-
-As an alternative to the varargs
-FunColumnSelect()
-routine, a non-varargs routine called
-FunColumnSelectArr()
-also is available. The first three arguments (fun, size, plist) of this
-routine are the same as in
-FunColumnSelect().
-Instead of a variable
-argument list, however,
-FunColumnSelectArr()
-takes 5 additional arguments. The first 4 arrays arguments contain the
-names, types, modes, and offsets, respectively, of the columns being
-selected. The final argument is the number of columns that are
-contained in these arrays. It is the user's responsibility to free
-string space allocated in these arrays.
-
-
-Consider the following example:
-
- typedef struct evstruct{
- int status;
- float pi, pha, *phas;
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "status", "J", "r", FUN_OFFSET(Ev, status),
- "pi", "E", "r", FUN_OFFSET(Ev, pi),
- "pha", "E", "r", FUN_OFFSET(Ev, pha),
- "phas", "@9E", "r", FUN_OFFSET(Ev, phas),
- NULL);
-
-
-Each time a row is read into the Ev struct, the "status" column is
-converted to an int data type (regardless of its data type in the
-file) and stored in the status value of the struct. Similarly, "pi"
-and "pha", and the phas vector are all stored as floats. Note that the
-"@" sign indicates that the "phas" vector is a pointer to a 9 element
-array, rather than an array allocated in the struct itself. The row
-record can then be processed as required:
-
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ev->pi = (ev->pi+.5);
- ev->pha = (ev->pi-.5);
- }
-
-
-
-FunColumnSelect()
-can also be called to define "writable" columns in order to generate a FITS
-Binary Table, without reference to any input columns. For
-example, the following will generate a 4-column FITS binary table when
-FunTableRowPut() is used to
-write Ev records:
-
-
- typedef struct evstruct{
- int status;
- float pi, pha
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "status", "J", "w", FUN_OFFSET(Ev, status),
- "pi", "E", "w", FUN_OFFSET(Ev, pi),
- "pha", "E", "w", FUN_OFFSET(Ev, pha),
- "energy", "D", "w", FUN_OFFSET(Ev, energy),
- NULL);
-
-All columns are declared to be write-only, so presumably the column
-data is being generated or read from some other source.
-
-
-In addition,
-FunColumnSelect()
-can be called to define B<both> "readable" and "writable" columns.
-In this case, the "read" columns
-are associated with an input file, while the "write" columns are
-associated with the output file. Of course, columns can be specified as both
-"readable" and "writable", in which case they are read from input
-and (possibly modified data values are) written to the output.
-The
-FunColumnSelect()
-call itself is made by passing the input Funtools handle, and it is
-assumed that the output file has been opened using this input handle
-as its
-Funtools reference handle.
-
-
-Consider the following example:
-
- typedef struct evstruct{
- int status;
- float pi, pha, *phas;
- double energy;
- } *Ev, EvRec;
-
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "status", "J", "r", FUN_OFFSET(Ev, status),
- "pi", "E", "rw", FUN_OFFSET(Ev, pi),
- "pha", "E", "rw", FUN_OFFSET(Ev, pha),
- "phas", "@9E", "rw", FUN_OFFSET(Ev, phas),
- "energy", "D", "w", FUN_OFFSET(Ev, energy),
- NULL);
-
-As in the "read" example above, each time an row is read into the Ev
-struct, the "status" column is converted to an int data type
-(regardless of its data type in the file) and stored in the status
-value of the struct. Similarly, "pi" and "pha", and the phas vector
-are all stored as floats. Since the "pi", "pha", and "phas" variables
-are declared as "writable" as well as "readable", they also will be
-written to the output file. Note, however, that the "status" variable
-is declared as "readable" only, and hence it will not be written to
-an output file. Finally, the "energy" column is declared as
-"writable" only, meaning it will not be read from the input file. In
-this case, it can be assumed that "energy" will be calculated in the
-program before being output along with the other values.
-
-
-In these simple cases, only the columns specified as "writable" will
-be output using
-FunTableRowPut(). However,
-it often is the case that you want to merge the user columns back in
-with the input columns, even in cases where not all of the input
-column names are explicitly read or even known. For this important
-case, the B<merge=[type]> keyword is provided in the plist string.
-
-
-The B<merge=[type]> keyword tells Funtools to merge the columns from
-the input file with user columns on output. It is normally used when
-an input and output file are opened and the input file provides the
-Funtools reference handle
-for the output file. In this case, each time
-FunTableRowGet() is called, the
-raw input rows are saved in a special buffer. If
-FunTableRowPut() then is called
-(before another call to
-FunTableRowGet()), the contents
-of the raw input rows are merged with the user rows according to the
-value of B<type> as follows:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-B<update>: add new user columns, and update value of existing ones (maintaining the input data type)
-
-
-
-=item *
-
-B<replace>: add new user columns, and replace the data type
-and value of existing ones. (Note that if tlmin/tlmax values are not
-specified in the replacing column, but are specified in the original
-column being replaced, then the original tlmin/tlmax values are used
-in the replacing column.)
-
-
-
-=item *
-
-B<append>: only add new columns, do not "replace" or "update" existing ones
-
-
-=back
-
-
-
-
-Consider the example above. If B<merge=update> is specified in the
-plist string, then "energy" will be added to the input columns, and
-the values of "pi", "pha", and "phas" will be taken from the user
-space (i.e., the values will be updated from the original values, if
-they were changed by the program). The data type for "pi", "pha", and
-"phas" will be the same as in the original file. If
-B<merge=replace> is specified, both the data type and value of
-these three input columns will be changed to the data type and value
-in the user structure. If B<merge=append> is specified, none of
-these three columns will be updated, and only the "energy" column will
-be added. Note that in all cases, "status" will be written from the
-input data, not from the user record, since it was specified as read-only.
-
-
-Standard applications will call
-FunColumnSelect()
-to define user columns. However, if this routine is not called, the
-default behavior is to transfer all input columns into user space. For
-this purpose a default record structure is defined such that each data
-element is properly aligned on a valid data type boundary. This
-mechanism is used by programs such as fundisp and funtable to process
-columns without needing to know the specific names of those columns.
-It is not anticipated that users will need such capabilities (contact
-us if you do!)
-
-
-By default, FunColumnSelect()
-reads/writes rows to/from an "array of structs", where each struct contains
-the column values for a single row of the table. This means that the
-returned values for a given column are not contiguous. You can
-set up the IO to return a "struct of arrays" so that each of the
-returned columns are contiguous by specifying B<org=structofarrays>
-(abbreviation: B<org=soa>) in the plist.
-(The default case is B<org=arrayofstructs> or B<org=aos>.)
-
-
-For example, the default setup to retrieve rows from a table would be
-to define a record structure for a single event and then call
- FunColumnSelect()
-as follows:
-
- typedef struct evstruct{
- short region;
- double x, y;
- int pi, pha;
- double time;
- } *Ev, EvRec;
-
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "x", "D:10:10", mode, FUN_OFFSET(Ev, x),
- "y", "D:10:10", mode, FUN_OFFSET(Ev, y),
- "pi", "J", mode, FUN_OFFSET(Ev, pi),
- "pha", "J", mode, FUN_OFFSET(Ev, pha),
- "time", "1D", mode, FUN_OFFSET(Ev, time),
- NULL);
-
-Subsequently, each call to
-FunTableRowGet()
-will return an array of structs, one for each returned row. If instead you
-wanted to read columns into contiguous arrays, you specify B<org=soa>:
-
- typedef struct aevstruct{
- short region[MAXROW];
- double x[MAXROW], y[MAXROW];
- int pi[MAXROW], pha[MAXROW];
- double time[MAXROW];
- } *AEv, AEvRec;
-
- got = FunColumnSelect(fun, sizeof(AEvRec), "org=soa",
- "x", "D:10:10", mode, FUN_OFFSET(AEv, x),
- "y", "D:10:10", mode, FUN_OFFSET(AEv, y),
- "pi", "J", mode, FUN_OFFSET(AEv, pi),
- "pha", "J", mode, FUN_OFFSET(AEv, pha),
- "time", "1D", mode, FUN_OFFSET(AEv, time),
- NULL);
-
-Note that the only modification to the call is in the plist string.
-
-
-Of course, instead of using staticly allocated arrays, you also can specify
-dynamically allocated pointers:
-
- /* pointers to arrays of columns (used in struct of arrays) */
- typedef struct pevstruct{
- short *region;
- double *x, *y;
- int *pi, *pha;
- double *time;
- } *PEv, PEvRec;
-
- got = FunColumnSelect(fun, sizeof(PEvRec), "org=structofarrays",
- "$region", "@I", mode, FUN_OFFSET(PEv, region),
- "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
- "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
- "pi", "@J", mode, FUN_OFFSET(PEv, pi),
- "pha", "@J", mode, FUN_OFFSET(PEv, pha),
- "time", "@1D", mode, FUN_OFFSET(PEv, time),
- NULL);
-
-Here, the actual storage space is either allocated by the user or by the
-FunColumnSelect() call).
-
-
-In all of the above cases, the same call is made to retrieve rows, e.g.:
-
- buf = (void *)FunTableRowGet(fun, NULL, MAXROW, NULL, &got);
-
-However, the individual data elements are accessed differently.
-For the default case of an "array of structs", the
-individual row records are accessed using:
-
- for(i=0; i<got; i++){
- ev = (Ev)buf+i;
- fprintf(stdout, "%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- ev->x, ev->y, ev->pi, ev->pha, ev->dx, ev->dy, ev->time);
- }
-
-For a struct of arrays or a struct of array pointers, we have a single struct
-through which we access individual columns and rows using:
-
- aev = (AEv)buf;
- for(i=0; i<got; i++){
- fprintf(stdout, "%.2f\t%.2f\t%d\t%d\t%.4f\t%.4f\t%21.8f\n",
- aev->x[i], aev->y[i], aev->pi[i], aev->pha[i],
- aev->dx[i], aev->dy[i], aev->time[i]);
- }
-
-Support for struct of arrays in the
-FunTableRowPut()
-call is handled analogously.
-
-
-See the evread example code
-and
-evmerge example code
-for working examples of how
-FunColumnSelect() is used.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funcombine.pod b/funtools/doc/pod/funcombine.pod
deleted file mode 100644
index 946d304..0000000
--- a/funtools/doc/pod/funcombine.pod
+++ /dev/null
@@ -1,157 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunCombine: Combining Region and Table Filters>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document discusses the conventions for combining region and table
-filters, especially with regards to the comma operator.
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-B<Comma Conventions>
-
-Filter specifications consist of a series of boolean expressions,
-separated by commas. These expressions can be table filters,
-spatial region filters, or combinations thereof. Unfortunately,
-common usage requires that the comma operator must act differently
-in different situations. Therefore, while its use is intuitive in
-most cases, commas can be a source of confusion.
-
-
-According to long-standing usage in IRAF, when a comma separates two
-table filters, it takes on the meaning of a boolean B<and>. Thus:
-
- foo.fits[pha==1,pi==2]
-
-is equivalent to:
-
- foo.fits[pha==1 && pi==2]
-
-
-When a comma separates two spatial region filters, however, it has
-traditionally taken on the meaning of a boolean B<or>. Thus:
-
- foo.fits[circle(10,10,3),ellipse(20,20,8,5)]
-
-is equivalent to:
-
- foo.fits[circle(10,10,3) || ellipse(20,20,8,5)]
-
-(except that in the former case, each region is given a unique id
-in programs such as funcnts).
-
-
-Region and table filters can be combined:
-
- foo.fits[circle(10,10,3),pi=1:5]
-
-or even:
-
- foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
-
-In these cases, it is not obvious whether the command should utilize an
-B<or> or B<and> operator. We therefore arbitrarily chose to
-implement the following rule:
-
-
-=over 4
-
-
-
-
-=item *
-
-if both expressions contain a region, the operator used is B<or>.
-
-
-=item *
-
-if one (or both) expression(s) does not contain a region, the operator
-used is B<and>.
-
-
-=back
-
-
-This rule handles the cases of pure regions and pure column filters properly.
-It unambiguously assigns the boolean B<and> to all mixed cases. Thus:
-
- foo.fits[circle(10,10,3),pi=1:5]
-
-and
-
- foo.fits[pi=1:5,circle(10,10,3)]
-
-both are equivalent to:
-
- foo.fits[circle(10,10,3) && pi=1:5]
-
-
-
-[NB: This arbitrary rule B<replaces the previous arbitrary rule>
-(pre-funtools 1.2.3) which stated:
-
-
-=over 4
-
-
-
-
-=item *
-
-if the 2nd expression contains a region, the operator used is B<or>.
-
-
-=item *
-
-if the 2nd expression does not contain a region, the operator
-used is B<and>.
-
-
-=back
-
-
-In that scenario, the B<or> operator was implied by:
-
- pha==4,circle 5 5 1
-
-while the B<and> operator was implied by
-
- circle 5 5 1,pha==4
-
-Experience showed that this non-commutative treatment of the comma
-operator was confusing and led to unexpected results.]
-
-
-The comma rule must be considered provisional: comments and complaints
-are welcome to help clarify the matter. Better still, we recommend
-that the comma operator be avoided in such cases in favor of an
-explicit boolean operator.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funcone.pod b/funtools/doc/pod/funcone.pod
deleted file mode 100644
index a766ca6..0000000
--- a/funtools/doc/pod/funcone.pod
+++ /dev/null
@@ -1,191 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funcone - cone search of a binary table containing RA, Dec columns>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funcone <switches> <iname> <oname> <ra[hdr]> <dec[hdr]> <radius[dr'"]> [columns]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -d deccol:[hdr] # Dec column name, units (def: DEC:d)
- -j # join columns from list file
- -J # join columns from list file, output all rows
- -l listfile # read centers and radii from a list
- -L listfile # read centers and radii from a list, output list rows
- -n # don't use cone limits as a filter
- -r racol:[hdr] # RA column name, units (def: RA:h)
- -x # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols
- -X # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols, output all rows
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-Funcone performs a cone search on the RA and Dec columns of a FITS
-binary table. The distance from the center RA, Dec position to the RA,
-Dec in each row in the table is calculated. Rows whose distance is
-less than the specified radius are output.
-
-
-The first argument to the program specifies the FITS file, raw event
-file, or raw array file. If "stdin" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify FITS extensions, and filters. The second
-argument is the output FITS file. If "stdout" is specified, the FITS
-binary table is written to the standard output.
-
-
-The third and fourth required arguments are the RA and Dec center
-position. By default, RA is specified in hours while Dec is specified
-in degrees. You can change the units of either of these by appending
-the character "d" (degrees), "h" (hours) or "r" (radians). Sexagesimal
-notation is supported, with colons or spaces separating hms and dms.
-(When using spaces, please ensure that the entire string is quoted.)
-
-
-The fifth required argument is the radius of the cone search. By default,
-the radius value is given in degrees. The units can be changed by appending
-the character "d" (degrees), "r" (radians), "'" (arc minutes) or
-'"' (arc seconds).
-
-
-By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional sixth argument in the form:
-
- "column1 column1 ... columnN"
-
-A seventh argument allows you to output selected columns from the list
-file when B<-j> switch is used. Note that the RA and Dec columns
-used in the cone calculation must not be de-selected.
-
-
-Also by default, the RA and Dec column names are named "RA" and "Dec",
-and are given in units of hours and degrees respectively. You can
-change both the name and the units using the -r [RA] and/or -d [Dec]
-switches. Once again, one of "h", "d", or "r" is appended to the
-column name to specify units but in this case, there must be a colon ":"
-between the name and the unit specification.
-
-
-If the B<-l [listfile]> switch is used, then one or more of the
-center RA, center Dec, and radius can be taken from a list file (which
-can be a FITS table or an ASCII column text file). In this case, the
-third (center RA), fourth (center Dec), and fifth (radius) command
-line arguments can either be a column name in the list file (if that
-parameter varies) or else a numeric value (if that parameter is
-static). When a column name is specified for the RA, Dec, or radius,
-you can append a colon followed by "h", "d", or "r" to specify units
-(also ' and " for radius). The cone search algorithm is run once for
-each row in the list, taking RA, Dec, and radius values from the
-specified columns or from static numeric values specified on the
-command line.
-
-
-When using a list, all valid rows from each iteration are written to a
-single output file. Use the B<-x> switch to help delineate which
-line of the list file was used to produce the given output row(s).
-This switch causes the values for the center RA, Dec, radius, and row
-number to be appended to the output file, in columns called RA_CEN,
-DEC_CEN, RAD_CEN and CONE_KEY, respectively. Alternatively, the
-B<-j> (join) switch will append all columns from the list row to
-the output row (essentially a join of the list row and input row),
-along with the CONE_KEY row number. These two switches are mutually
-exclusive.
-
-
-The B<-X> and B<-J> switches write out the same data as their
-lower case counterparts for each row satisfying a cone search. In
-addition, these switches also write out rows from the event file that
-do not satisfy any cone search. In such cases, that CONE_KEY column
-will be given a value of -1 and the center and list position information
-will be set to zero for the given row. Thus, all rows of the input
-event file are guaranteed to be output, with rows satisfying at least
-one cone search having additional search information.
-
-
-The B<-L> switch acts similarly to the B<-l> switch in that it
-takes centers from a list file. However, it also implicitly sets the
--j switch, so that output rows are the join of the input event row and
-the center position row. In addition, this switch also writes out all
-center position rows for which no event satisfies the cone search
-criteria of that row. The CONE_KEY column will be given a value of -2
-for center rows that were not close to any data row and the event
-columns will be zeroed out for such rows. In this way, all centers
-rows are guaranteed to be output at least once.
-
-
-If any of "all row" switches (B<-X>, B<-J>, or B<-L>) are
-specified, then a new column named JSTAT is added to the output table.
-The positive values in this column indicate the center position row number
-(starting from 1) in the list file that this data row successful matched
-in a cone search. A value of -1 means that the data row did not match
-any center position. A value of -2 means that the center position was
-not matched by any data row.
-
-
-Given a center position and radius, the cone search algorithm
-calculates limit parameters for a box enclosing the specified cone,
-and only tests rows whose positions values lie within those limits.
-For small files, the overhead associated with this cone limit
-filtering can cause the program to run more slowly than if all events
-were tested. You can turn off cone limit filtering using the B<-n>
-switch to see if this speeds up the processing (especially useful when
-processing a large list of positions).
-
-
-For example, the default cone search uses columns "RA" and "Dec" in hours
-and degrees (respectively) and RA position in hours, Dec and radius in degrees:
-
- funone in.fits out.fits 23.45 34.56 0.01
-
-To specify the RA position in degrees:
-
- funcone in.fits out.fits 23.45d 34.56 0.01
-
-To get RA and Dec from a list but use a static value for radius (and
-also write identifying info for each row in the list):
-
- funcone -x -l list.txt in.fits out.fits MYRA MYDec 0.01
-
-User specified columns in degrees, RA position in hours (sexagesimal
-notation), Dec position in degrees (sexagesimal notation) and radius
-in arc minutes:
-
- funcone -r myRa:d -d myDec in.fits out.fits 12:30:15.5 30:12 15'
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/fundisp.pod b/funtools/doc/pod/fundisp.pod
deleted file mode 100644
index 8f36d86..0000000
--- a/funtools/doc/pod/fundisp.pod
+++ /dev/null
@@ -1,484 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<fundisp - display data in a Funtools data file>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-fundisp [-f format] [-l] [-n] [-T] <iname> [columns|bitpix=n]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -f # format string for display
- -l # display image as a list containing the columns X, Y, VAL
- -n # don't output header
- -F [c] # use specified character as column separator (def: space)
- -T # output in rdb/starbase format (tab separators)
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<fundisp> displays the data in the specified
-FITS Extension
-and/or
-Image Section
-of a FITS file, or in a
-Section
-of a non-FITS array or raw event file.
-
-The first argument to the program specifies the FITS input image, array, or
-raw event file to display. If "stdin" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify FITS extensions, image sections, and filters.
-
-
-If the data being displayed are columns (either in a FITS binary table
-or a raw event file), the individual rows are listed. Filters can be
-added using bracket notation. Thus:
-
- [sh] fundisp "test.ev[time-(int)time>.15]"
- X Y PHA PI TIME DX DY
- ------- ------- ------- --------- ---------------- ---------- ----------
- 10 8 10 8 17.1600 8.50 10.50
- 9 9 9 9 17.1600 9.50 9.50
- 10 9 10 9 18.1600 9.50 10.50
- 10 9 10 9 18.1700 9.50 10.50
- 8 10 8 10 17.1600 10.50 8.50
- 9 10 9 10 18.1600 10.50 9.50
- 9 10 9 10 18.1700 10.50 9.50
- 10 10 10 10 19.1600 10.50 10.50
- 10 10 10 10 19.1700 10.50 10.50
- 10 10 10 10 19.1800 10.50 10.50
-
-[NB: The FITS binary table test file test.ev, as well as the FITS
-image test.fits, are contained in the funtools funtest directory.]
-
-
-When a table is being displayed using B<fundisp>, a second optional
-argument can be used to specify the columns to display. For example:
-
- [sh] fundisp "test.ev[time-(int)time>=.99]" "x y time"
- X Y TIME
- -------- -------- ---------------------
- 5 -6 40.99000000
- 4 -5 59.99000000
- -1 0 154.99000000
- -2 1 168.99000000
- -3 2 183.99000000
- -4 3 199.99000000
- -5 4 216.99000000
- -6 5 234.99000000
- -7 6 253.99000000
-
-
-
-The special column B<$REGION> can be specified to display the
-region id of each row:
-
- [sh $] fundisp "test.ev[time-(int)time>=.99&&annulus(0 0 0 10 n=3)]" 'x y time $REGION'
- X Y TIME REGION
- -------- -------- --------------------- ----------
- 5 -6 40.99000000 3
- 4 -5 59.99000000 2
- -1 0 154.99000000 1
- -2 1 168.99000000 1
- -3 2 183.99000000 2
- -4 3 199.99000000 2
- -5 4 216.99000000 2
- -6 5 234.99000000 3
- -7 6 253.99000000 3
-
-
-Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are displayed.
-
-Columns can be excluded from display using a minus sign before the
-column:
-
- [sh $] fundisp "test.ev[time-(int)time>=.99]" "-time"
- X Y PHA PI DX DY
- -------- -------- -------- ---------- ----------- -----------
- 5 -6 5 -6 5.50 -6.50
- 4 -5 4 -5 4.50 -5.50
- -1 0 -1 0 -1.50 0.50
- -2 1 -2 1 -2.50 1.50
- -3 2 -3 2 -3.50 2.50
- -4 3 -4 3 -4.50 3.50
- -5 4 -5 4 -5.50 4.50
- -6 5 -6 5 -6.50 5.50
- -7 6 -7 6 -7.50 6.50
-
-All columns except the time column are displayed.
-
-The special column B<$N> can be specified to display the
-ordinal value of each row. Thus, continuing the previous example:
-
- fundisp "test.ev[time-(int)time>=.99]" '-time $n'
- X Y PHA PI DX DY N
- ------- -------- -------- ---------- ----------- ----------- ----------
- 5 -6 5 -6 5.50 -6.50 337
- 4 -5 4 -5 4.50 -5.50 356
- -1 0 -1 0 -1.50 0.50 451
- -2 1 -2 1 -2.50 1.50 465
- -3 2 -3 2 -3.50 2.50 480
- -4 3 -4 3 -4.50 3.50 496
- -5 4 -5 4 -5.50 4.50 513
- -6 5 -6 5 -6.50 5.50 531
- -7 6 -7 6 -7.50 6.50 550
-
-Note that the column specification is enclosed in single quotes to protect
-'$n' from begin expanded by the shell.
-
-
-In general, the rules for activating and de-activating columns are:
-
-
-=over 4
-
-
-
-
-=item *
-
-If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-
-
-=item *
-
-If only include columns are specified, then only the specified columns
-are activated.
-
-
-=item *
-
-If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.
-
-
-=back
-
-
-In addition to specifying columns names explicitly, the special
-symbols B<+> and B<-> can be used to activate and
-de-activate B<all> columns. This is useful if you want to
-activate the $REGION column along with all other columns. According
-to the rules, the syntax "$REGION" only activates the region column
-and de-activates the rest. Use "+ $REGION" to activate all
-columns as well as the region column.
-
-
-If the data being displayed are image data (either in a FITS primary
-image, a FITS image extension, or an array file), an mxn pixel display
-is produced, where m and n are the dimensions of the image. By
-default, pixel values are displayed using the same data type as in the
-file. However, for integer data where the BSCALE and BZERO header parameters
-are present, the data is displayed as floats. In either case, the
-display data type can be overridden using an optional second argument
-of the form:
-
- bitpix=n
-
-where n is 8,16,32,-32,-64, for unsigned char, short, int, float and double,
-respectively.
-
-
-Of course, running B<fundisp> on anything but the smallest image
-usually results in a display whose size makes it unreadable.
-Therefore, one can uses bracket notation (see below)
-to apply section and/or blocking to the image before generating a
-display. For example:
-
- [sh] fundisp "test.fits[2:6,2:7]" bitpix=-32
- 2 3 4 5 6
- ---------- ---------- ---------- ---------- ----------
- 2: 3.00 4.00 5.00 6.00 7.00
- 3: 4.00 5.00 6.00 7.00 8.00
- 4: 5.00 6.00 7.00 8.00 9.00
- 5: 6.00 7.00 8.00 9.00 10.00
- 6: 7.00 8.00 9.00 10.00 11.00
- 7: 8.00 9.00 10.00 11.00 12.00
-
-
-
-Note that is is possible to display a FITS binary table as an image
-simply by passing the table through B<funimage> first:
-
- [sh] ./funimage test.ev stdout | fundisp "stdin[2:6,2:7]" bitpix=8
- 2 3 4 5 6
- ------- ------- ------- ------- -------
- 2: 3 4 5 6 7
- 3: 4 5 6 7 8
- 4: 5 6 7 8 9
- 5: 6 7 8 9 10
- 6: 7 8 9 10 11
- 7: 8 9 10 11 12
-
-
-If the B<-l> (list) switch is used, then an image is displayed as a
-list containing the columns: X, Y, VAL. For example:
-
- fundisp -l "test1.fits[2:6,2:7]" bitpix=-32
- X Y VAL
- ---------- ---------- -----------
- 2 2 6.00
- 3 2 1.00
- 4 2 1.00
- 5 2 1.00
- 6 2 1.00
- 2 3 1.00
- 3 3 5.00
- 4 3 1.00
- 5 3 1.00
- 6 3 1.00
- 2 4 1.00
- 3 4 1.00
- 4 4 4.00
- 5 4 1.00
- 6 4 1.00
- 2 5 1.00
- 3 5 1.00
- 4 5 1.00
- 5 5 3.00
- 6 5 1.00
- 2 6 1.00
- 3 6 1.00
- 4 6 1.00
- 5 6 1.00
- 6 6 2.00
- 2 7 1.00
- 3 7 1.00
- 4 7 1.00
- 5 7 1.00
- 6 7 1.00
-
-
-
-If the B<-n> (nohead) switch is used, then no header is output for
-tables. This is useful, for example, when fundisp output is being
-directed into gnuplot.
-
-
-The B<fundisp> program uses a default set of display formats:
-
- datatype TFORM format
- -------- ----- --------
- double D "%21.8f"
- float E "%11.2f"
- int J "%10d"
- short I "%8d"
- byte B "%6d"
- string A "%12.12s"
- bits X "%8x"
- logical L "%1x"
-
-Thus, the default display of 1 double and 2 shorts gives:
-
- [sh] fundisp snr.ev "time x y"
-
- TIME X Y
- --------------------- -------- --------
- 79494546.56818075 546 201
- 79488769.94469175 548 201
- ...
-
-You can change the display format for individual columns or for all
-columns of a given data types by means of the -f switch. The format
-string that accompanies -f is a space-delimited list of keyword=format
-values. The keyword values can either be column names (in which case
-the associated format pertains only to that column) or FITS table
-TFORM specifiers (in which case the format pertains to all columns
-having that data type). For example, you can change the double and
-short formats for all columns like this:
-
- [sh] fundisp -f "D=%22.11f I=%3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- ---
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...
-
-
-
-Alternatively, you can change the format of the time and x columns like this:
-
- [sh] fundisp -f "time=%22.11f x=%3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- --------
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...
-
-Note that there is a potential conflict if a column has the same name
-as one of the TFORM specifiers. In the examples above, the the "X"
-column in the table has the same name as the X (bit) datatype. To
-resolve this conflict, the format string is processed such that
-TFORM datatype specifiers are checked for first, using a
-case-sensitive comparison. If the specified format value is not an
-upper case TFORM value, then a case-insensitive check is made on the
-column name. This means that, in the examples above, "X=%3d" will refer
-to the X (bit) datatype, while "x=%3d" will refer to the X column:
-
- [sh] fundisp -f "X=%3d" snr.ev "x y"
-
- X Y
- -------- --------
- 546 201
- 548 201
- ...
-
- [sh] fundisp -f "x=%3d" snr.ev "x y"
-
- X Y
- --- --------
- 546 201
- 548 201
- ...
-
-As a rule, therefore, it is best always to specify the column name in
-lower case and TFORM data types in upper case.
-
-
-The B<-f [format]> will change the format for a single execution
-of fundisp. You also can use the B<FUN_FORMAT> envronment variable
-to change the format for all invocations of fundisp. The format of this
-environment variable's value is identical to that used with
-the B<-f> switch. This global value can be overridden in
-individual cases by use of the B<-f [format]> switch.
-
-
-Caveats: Please also note that it is the user's responsibility to
-match the format specifier to the column data type correctly. Also
-note that, in order to maintain visual alignment between names and
-columns, the column name will be truncated (on the left) if the
-format width is less than the length of the name. However, truncation
-is not performed if the output is in RDB format (using the -T switch).
-
-
-[An older-style format string is supported but deprecated. It
-consists of space-delimited C format statements for all data types,
-specified in the following order:
-
- double float int short byte string bit.
-
-This order of the list is based on the assumption that people generally
-will want to change the float formats.
-
-If "-" is entered instead of a format statement for a given data type, the
-default format is used. Also, the format string can be terminated without
-specifying all formats, and defaults will be used for the rest of the
-list. Note that you must supply a minimum field width, i.e., "%6d" and
-"%-6d" are legal, "%d" is not legal.
-
-By using -f [format], you can change the double and short formats like this:
-
- [sh] fundisp -f "22.11f - - 3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- ---
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...
-
-NB: This format is deprecated and will be removed in a future release.]
-
-
-The B<-F[c]> switch can be used to specify a (single-character)
-column separator (where the default is a space). Note that column
-formatting will almost certainly also add spaces to pad individual
-columns to the required width. These can be removed with a program
-such as sed, at the cost of generating unaligned columns. For example:
-
-fundisp -F',' snr.ev'[cir 512 512 .1]'
- X, Y, PHA, PI, TIME, DX, DY
---------,--------,--------,--------,---------------------,--------,--------
- 512, 512, 6, 7, 79493997.45854475, 578, 574
- 512, 512, 8, 9, 79494575.58943175, 579, 573
- 512, 512, 5, 6, 79493631.03866175, 578, 575
- 512, 512, 5, 5, 79493290.86521725, 578, 575
- 512, 512, 8, 9, 79493432.00990875, 579, 573
-
-fundisp -F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,PHA,PI,TIME,DX,DY
---------,--------,--------,--------,---------------------,--------,--------
- 512,512,6,7,79493997.45854475,578,574
- 512,512,8,9,79494575.58943175,579,573
- 512,512,5,6,79493631.03866175,578,575
- 512,512,5,5,79493290.86521725,578,575
- 512,512,8,9,79493432.00990875,579,573
-
-fundisp -f "x=%3d y=%3d pi=%1d pha=%1d time=%20.11f dx=%3d dy=%3d" -F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,A,I,TIME,DX,DY
----,---,-,-,--------------------,---,---
-512,512,6,7,79493997.45854474604,578,574
-512,512,8,9,79494575.58943174779,579,573
-512,512,5,6,79493631.03866174817,578,575
-512,512,5,5,79493290.86521725357,578,575
-512,512,8,9,79493432.00990875065,579,573
-
-
-
-
-If the B<-T> (rdb table) switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces. This format is not available when
-displaying image pixels (except in conjunction with the B<-l>
-switch).
-
-
-Finally, note that B<fundisp> can be used to create column filters from
-the auxiliary tables in a FITS file. For example, the following shell code
-will generate a good-time interval (GTI) filter for X-ray data files that
-contain a standard GTI extension:
-
- #!/bin/sh
- sed '1,/---- .*/d
- /^$/,$d' | awk 'tot>0{printf "||"};{printf "time="$1":"$2; tot++}'
-
-If this script is placed in a file called "mkgti", it can be used in a
-command such as:
-
- fundisp foo.fits"[GTI]" | mkgti > gti.filter
-
-The resulting filter file can then be used in various funtools programs:
-
- funcnts foo.fits"[@gti.filter]" ...
-
-to process only the events in the good-time intervals.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funds9.pod b/funtools/doc/pod/funds9.pod
deleted file mode 100644
index e1b5cc2..0000000
--- a/funtools/doc/pod/funds9.pod
+++ /dev/null
@@ -1,113 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunDS9: Funtools and DS9 Image Display>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-Describes how funtools can be integrated into the ds9 Analysis menu.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-
-SAOImage/DS9 is an astronomical imaging and data visualization
-application used by astronomers around the world. DS9 can display
-standard astronomical FITS images and binary tables, but also has
-support for displaying raw array files, shared memory files, and data
-files automatically retrieved via FTP and HTTP. Standard functional
-capabilities include multiple frame buffers, colormap and region
-manipulation, and many data scaling algorithms. DS9's advanced
-features include TrueColor visuals, deep frame buffers, true
-PostScript printing, and display of image mosaics. The program's
-support of image tiling, "blinking", arbitrary zoom, rotation, and pan
-is unparalleled in astronomy. It also has innovative support for
-automatic retrieval and display of standard image data such as the
-Digital Sky Survey (using servers at SAO, StScI, or ESO).
-
-
-DS9 can communicate with external programs such as Funtools using the
-XPA
-messaging system. In addition, programs can be integrated directly
-into the DS9 GUI by means of a configurable Analysis menu. By
-default, the DS9 Analysis menu contains algorithms deemed essential to
-the core functions of DS9, e.g., display cross-cuts of data,
-iso-intensity contours, and WCS grids. However, new programs can be
-added to DS9 by creating a set-up file which can be loaded into DS9
-to reconfigure the Analysis menu.
-
-
-The basic format of the analysis set-up file is:
-
- #
- # Analysis command descriptions:
- # menu label/description
- # file templates for this command
- # "menu" (add to menu) |"bind" (bind to key)
- # analysis command line
-
-
-For example, the funcnts program can be specified in this way:
-
- Funcnts (counts in source/bkgd regions; options: none)
- *
- menu
- funcnts $filename $regions(source,,) $regions(background,,) | $text
-
-As shown above, DS9 supports a macro facility to provide information
-as well as task support to command lines. For example, the $regions
-macro is expanded by DS9 to provide the current source and/or
-background region to the analysis command. The $text macro is expanded
-to generate a text window display. It also is possible to query for
-parameters using a $param macro, plot data using a $plot macro,
-etc. See the DS9 documentation for further details.
-
-
-A set-up file called funtools.ds9 will
-load some useful Funtools applications (counts in regions, radial
-profile, X-ray light curve and energy spectrum, 1D histogram) into the DS9
-Analysis menu (version 2.1 and above). The file resides in the bin
-directory where Funtools programs are installed. It can be manually
-loaded into DS9 from the B<Load Analysis Commands ...> option of
-the B<Analysis> menu. Alternatively, you can tell DS9 to load
-this file automatically at start-up time by adding the pathname to the
-B<Edit>->B<Preferences>->B<Analysis Menu>->Analysis
-File menu option. (NB: make sure you select
-B<Edit>->B<Preferences>->B<Save Preferences> after setting
-the pathname.)
-
-
-The tasks in this setup file generally process the original disk-based
-FITS file. Funcnts-based results (radial profile, counts in regions)
-are presented in WCS units, if present in the FITS header. For
-situations where a disk file is not available (e.g., image data
-generated and sent to DS9's 'fits' XPA access point), versions of the
-radial profile and counts in regions tasks also are also offered
-utilizing DS9's internal image data. Results are presented in pixels.
-Aside from the units, the results should be identical to the file-based
-results.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funenv.pod b/funtools/doc/pod/funenv.pod
deleted file mode 100644
index 0717a17..0000000
--- a/funtools/doc/pod/funenv.pod
+++ /dev/null
@@ -1,349 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunEnv: Funtools Environment Variables>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-Describes the environment variables which can be used to tailor the overall
-Funtools environment.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-The following environment variables are supported by Funtools:
-
-
-=over 4
-
-
-
-
-
-=item *
-
-B<FITS_EXTNAME>
-
-
-The B<FITS_EXTNAME> environment variable specifies the
-default FITS extension name when FunOpen() is called on a file lacking
-a primary image. Thus,
-
- setenv FITS_EXTNAME "NEWEV"
-
-will allow you to call FunOpen() on files without specifying NEWEV in
-the
-Funtools bracket specification.
-If no FITS_EXTNAME variable is defined and the extension name also is
-not passed in the bracket specification, then the default will be to
-look for standard X-ray event table extension names "EVENTS" or
-"STDEVT" (we are, after all, and X-ray astronomy group at heart!).
-
-
-
-
-=item *
-
-B<FITS_EXTNUM>
-
-
-The B<FITS_EXTNUM> environment variable specifies the
-default FITS extension number when FunOpen() is called on a file lacking
-a primary image. Thus,
-
- setenv FITS_EXTNUM 7
-
-will allow you to call FunOpen() on files to open the seventh
-extension without specifying the number in the
-Funtools bracket specification.
-
-
-
-
-=item *
-
-B<FITS_BINCOLS> and B<EVENTS_BINCOLS>
-
-
-These environment variable specifies the default binning key for
-FITS binary tables and raw event files, respectively. They can be
-over-ridden using the B<bincols=[naxis1,naxis2]> keyword in a
-Funtools bracket specification.
-The value of each environment variable
-is a pair of comma-delimited columns, enclosed in parentheses, to use
-for binning. For example, if you want to bin on detx and dety by
-default, then use:
-
- setenv FITS_BINCOLS "(detx,dety)"
-
-in preference to adding a bincols specification to each filename:
-
- foo.fits[bincols=(detx,dety)]
-
-
-
-
-
-=item *
-
-B<FITS_BITPIX> and B<EVENTS_BITPIX>
-
-
-These environment variable specifies the default bitpix value for
-binning FITS binary tables and raw event files, respectively. They can
-be over-ridden using the B<bitpix=[value]> keyword in a
-Funtools bracket specification. The value
-of each environment variable is one of the standard FITS bitpix values
-(8,16,32,-32,-64). For example, if you want binning routines to
-create a floating array, then use:
-
- setenv FITS_BITPIX -32
-
-in preference to adding a bitpix specification to each filename:
-
- foo.fits[bitpix=-32]
-
-
-
-
-
-=item *
-
-B<ARRAY>
-
-
-The B<ARRAY> environment variable specifies the default
-definition of an array file for Funtools.
-It is used if there is no array specification passed in the
-B<ARRAY()> directive in a
-Non-FITS Array specification.
-The value of the environment variable is a valid array specification such as:
-
- setenv ARRAY "s100.150"
- foo.arr[ARRAY()]
-
-This can be defined in preference to adding the specification to each filename:
-
- foo.arr[ARRAY(s100.150)]
-
-
-
-
-
-=item *
-
-B<EVENTS>
-
-
-The B<EVENTS> environment variable specifies the default
-definition of an raw event file for Funtools.
-It is used if there is no EVENTS specification passed in the
-B<EVENTS()> directive in a
-Non-FITS EVENTS specification.
-The value of the environment variable is a valid EVENTS specification such as:
-
- setenv EVENTS "x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024"
- foo.ev[EVENTS()]
-
-This can be defined in preference to adding the specification to each filename:
-
- foo.ev[EVENTS(x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024)]
-
-
-
-=back
-
-
-
-The following filter-related environment variables are supported by Funtools:
-
-
-=over 4
-
-
-
-
-
-
-=item *
-
-B<FILTER_PTYPE>
-
-
-The B<FILTER_PTYPE> environment variable specifies how to
-build a filter. There are three possible methods:
-
-
-=over 4
-
-
-
-
-=item *
-
-process or p
-
-
-The filter is compiled and linked against the funtools library (which
-must therefore be accessible in the original install directory) to produce
-a slave program. This program is fed events or image data and returns
-filter results.
-
-
-
-=item *
-
-dynamic or d (gcc only)
-
-
-The filter is compiled and linked against the funtools library (which
-must therefore be accessible in the original install directory) to produce
-a dynamic shared object, which is loaded into the funtools program and
-executed as a subroutine. (Extensive testing has shown that, contrary to
-expectations, this method is no faster than using a slave process.)
-
-
-
-=item *
-
-contained or c
-
-
-The filter and all supporting region code is compiled and linked
-without reference to the funtools library to produce a slave program
-(which is fed events or image data and returns filter results). This method
-is slower than the other two, because of the time it takes to compile the
-region filtering code. It is used by stand-alone programs such as ds9,
-which do not have access to the funtools library.
-
-
-=back
-
-
-
-By default, B<dynamic> is generally used for gcc compilers and
-B<process> for other compilers. However the filter building algorithm
-will check for required external files and will use B<contained> is
-these are missing.
-
-
-
-
-=item *
-
-B<FUN_MAXROW>
-
-
-The B<FUN_MAXROW> environment variable is used by core
-row-processing Funtools programs (funtable, fundisp, funcnts, funhist,
-funmerge, and funcalc) to set the maximum number of rows read at once
-(i.e. it sets the third argument to the FunTableRowGet() call). The
-default is 8192. Note that this variable is a convention only: it will
-not be a part of a non-core Funtools program unless code is explicitly
-added, since each call to FunTableRowGet() specifies its own maximum
-number of rows to read. NB: if you make this value very large, you
-probably will need to increase B<FUN_MAXBUFSIZE> (see below) as well.
-
-
-
-
-=item *
-
-B<FUN_MAXBUFSIZE>
-
-
-The B<FUN_MAXBUFSIZE> environment variable is used to limit the
-max buffer size that will be allocated to hold table row data. This
-buffer size is calculated to be the row size of the table multiplied
-by the maximum number of rows read at once (see above). Since the
-row size is unlimited (and we have examples of it being larger than 5
-Mb), it is possible that the total buffer size will exceed the machine
-capabilities. We therefore set a default value of 5Mb for the max buffer
-size, and adjust maxrow so that the total size calculated is less than
-this max buffer size. (If the row size is greater than this max buffer
-size, then maxrow is set to 1.) This environment variable will change
-the max buffer size allowed.
-
-
-
-
-=item *
-
-B<FILTER_CC>
-
-
-The B<FILTER_CC> environment variable specifies the compiler to
-use for compiling a filter specification. You also can use the B<CC>
-environment variable. If neither has been set, then gcc will be used
-if available. Otherwise cc is used if available.
-
-
-
-
-=item *
-
-B<FILTER_EXTRA>
-
-
-The B<FILTER_EXTRA> environment variable specifies extra options
-to add to a filter compile command line. In principle, you can add libraries,
-include files, and compiler switches. This variable should be used with care.
-
-
-
-
-=item *
-
-B<FILTER_TMPDIR>
-
-
-The B<FILTER_TMPDIR> environment variable specifies the temporary
-directory for filter compilation intermediate files. You also can use
-the B<TMPDIR> and B<TMP> variables. By default, /tmp is used
-as the temporary directory.
-
-
-
-
-=item *
-
-B<FILTER_KEEP>
-
-
-The B<FILTER_KEEP> environment variable specifies whether the
-intermediate filter files (i.e. C source file and compile log file)
-should be saved after a filter is built. The default is "false", so that
-these intermediate files are deleted. This variable is useful for debugging,
-but care should be taken to reset its value to false when debugging is
-complete.
-
-
-
-=back
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funfiles.pod b/funtools/doc/pod/funfiles.pod
deleted file mode 100644
index 7efb464..0000000
--- a/funtools/doc/pod/funfiles.pod
+++ /dev/null
@@ -1,1019 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunFiles: Funtools Data Files>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-This document describes the data file formats (FITS, array, raw
-events) as well as the file types (gzip, socket, etc.) supported
-by Funtools.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-Funtools supports FITS images and binary tables, and binary files
-containing array (homogeneous) data or event (heterogeneous) data.
-IRAF-style brackets are appended to the filename to specify various
-kinds of information needed to characterize these data:
-
- file[ext|ind|ARRAY()|EVENTS(),section][filters]
- or
- file[ext|ind|ARRAY()|EVENTS(),section,filters]
-
-where:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<file> is the Funtools file name
-
-
-=item *
-
-B<ext> is the FITS extension name
-
-
-=item *
-
-B<ind> is the FITS extension number
-
-
-=item *
-
-B<ARRAY()> is an array specification
-
-
-=item *
-
-B<EVENTS()> is an event specification
-
-
-=item *
-
-B<section> is the image section specification
-
-
-=item *
-
-B<filters> are spatial region and table (row) filters
-
-
-=back
-
-
-
-B<Supported Data Formats>
-
-Funtools programs (and the underlying libraries) support the
-following data file formats:
-
-
-=over 4
-
-
-
-
-=item *
-
-FITS images (and image extensions)
-
-
-=item *
-
-FITS binary tables
-
-
-=item *
-
-binary files containing an array of homogeneous data
-
-
-=item *
-
-binary files containing events, i.e. records of heterogeneous data
-
-
-=item *
-
-column-based text files, which are documented here
-
-
-=item *
-
-non-disk files and lists of files
-
-
-=back
-
-
-Information needed to identify and characterize
-the event or image data can be specified on the command line
-using IRAF-style bracket notation appended to the filename:
-
- foo.fits # open FITS default extension
- image.fits[3] # open FITS extension #3
- events.fits[EVENTS] # open EVENTS extension
- array.file[ARRAY(s1024)] # open 1024x1024 short array
- events.file[EVENTS(x:1024,y:1024...)] # open non-FITS event list
-
-Note that in many Unix shells (e.g., csh and tcsh), filenames must
-be enclosed in quotes to protect the brackets from shell processing.
-
-B<FITS Images and Binary Tables>
-
-When FunOpen() opens a FITS file
-without a bracket specifier, the default behavior is to look for a
-valid image in the primary HDU. In the absence of a primary image,
-Funtools will try to open an extension named either B<EVENTS> or
-B<STDEVT>, if one of these exists. This default behavior supports
-both FITS image processing and standard X-ray event list processing
-(which, after all, is what we at SAO/HEAD do).
-
-
-In order to open a FITS binary table or image extension explicitly, it
-is necessary to specify either the extension name or the extension
-number in brackets:
-
- foo.fits[1] # open extension #1: the primary HDU
- foo.fits[3] # open extension #3 of a FITS file
- foo.fits[GTI] # open GTI extension of a FITS file
-
-The ext argument specifies the name of the FITS extension (i.e. the
-value of the EXTENSION header parameter in a FITS extension), while
-the index specifies the value of the FITS EXTVER header parameter.
-Following FITS conventions, extension numbers start at 1.
-
-
-When a FITS data file is opened for reading using
-FunOpen(), the specified extension
-is automatically located and is used to initialize the Funtools internal
-data structures.
-
-B<Non-FITS Raw Event Files>
-
-In addition to FITS tables, Funtools programs and libraries can operate
-on non-FITS files containing heterogeneous event records. To specify
-such an event file, use:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-file[EVENTS(event-spec)]
-
-
-=item *
-
-file[EVENTS()]
-
-
-=back
-
-
-where B<event-spec> is a string that specified the names, data
-types, and optional image dimensions for each element of the event
-record:
-
-
-=over 4
-
-
-
-
-=item *
-
-[name]:[n][type]:[(lodim:)hidim]
-
-
-=back
-
-
-
-
-Data types follow standard conventions for FITS binary tables, but include
-two extra unsigned types ('U' and 'V'):
-
-
-=over 4
-
-
-
-
-=item *
-
-B<B> -- unsigned 8-bit char
-
-
-=item *
-
-B<I> -- signed 16-bit int
-
-
-=item *
-
-B<J> -- signed 32-bit int
-
-
-=item *
-
-B<K> -- signed 64-bit int
-
-
-=item *
-
-B<E> -- 32-bit float
-
-
-=item *
-
-B<D> -- 64-bit float
-
-
-=item *
-
-B<U> -- unsigned 16-bit int
-
-
-=item *
-
-B<V> -- unsigned 32-bit int
-
-
-=back
-
-
-An optional integer value B<n> can be prefixed to the type to indicate
-that the element is an array of n values. For example:
-
- foo.fits[EVENTS(x:I,y:I,status:4J)]
-
-defines x and y as 16-bit ints and status as an array of 4 32-bit ints.
-
-
-Furthermore, image dimensions can be attached to the event specification
-in order to tell Funtools how to bin the events into an image. They
-follow the conventions for the FITS TLMIN/TLMAX keywords. If the low
-image dimension is not specified, it defaults to 1. Thus:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-RAWX:J:1:100
-
-
-=item *
-
-RAWX:J:100
-
-
-=back
-
-
-both specify that the dimension of this column runs from 1 to 100.
-
-
-NB: it is required that all padding be specified in the record
-definition. Thus, when writing out whole C structs instead of
-individual record elements, great care must be taken to include
-the compiler-added padding in the event definition.
-
-
-For example, suppose a FITS binary table has the following set of column
-definitions:
-
- TTYPE1 = 'X ' / Label for field
- TFORM1 = '1I ' / Data type for field
- TLMIN1 = 1 / Min. axis value
- TLMAX1 = 10 / Max. axis value
- TTYPE2 = 'Y ' / Label for field
- TFORM2 = '1I ' / Data type for field
- TLMIN2 = 2 / Min. axis value
- TLMAX2 = 11 / Max. axis value
- TTYPE3 = 'PHA ' / Label for field
- TFORM3 = '1I ' / Data type for field
- TTYPE4 = 'PI ' / Label for field
- TFORM4 = '1J ' / Data type for field
- TTYPE5 = 'TIME ' / Label for field
- TFORM5 = '1D ' / Data type for field
- TTYPE6 = 'DX ' / Label for field
- TFORM6 = '1E ' / Data type for field
- TLMIN6 = 1 / Min. axis value
- TLMAX6 = 10 / Max. axis value
- TTYPE7 = 'DY ' / Label for field
- TFORM7 = '1E ' / Data type for field
- TLMIN7 = 3 / Min. axis value
- TLMAX7 = 12 / Max. axis value
-
-
-An raw event file containing these same data would have the event
-specification:
-
- EVENTS(X:I:10,Y:I:2:11,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:3:12)
-
-
-
-If no event specification string is included within the EVENTS() operator,
-then the event specification is taken from the B<EVENTS> environment
-variable:
-
- setenv EVENTS "X:I:10,Y:I:10,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:10"
-
-
-
-In addition to knowing the data structure, it is necessary to know the
-I<endian> ordering of the data, i.e., whether or not the data is
-in I<bigendian> format, so that we can convert to the native
-format for this platform. This issue does not arise for FITS Binary
-Tables because all FITS files use big-endian ordering, regardless of
-platform. But for non-FITS data, big-endian data produced on a Sun
-workstation but read on a Linux PC needs to be byte-swapped, since PCs
-use little-endian ordering. To specify an ordering, use the
-I<bigendian=> or I<endian=> keywords on the command-line
-or the EVENTS_BIGENDIAN or EVENTS_ENDIAN environment variables. The
-value of the I<bigendian> variables should be "true" or "false",
-while the value of the I<endian> variables should be "little" or
-"big".
-
-
-For example, a PC can access data produced by a Sun using:
-
- hrc.nepr[EVENTS(),bigendian=true]
-or
- hrc.nepr[EVENTS(),endian=big]
-or
- setenv EVENTS_BIGENDIAN true
-or
- setenv EVENTS_ENDIAN big
-
-If none of these are specified, the data are assumed to follow the
-format for that platform and no byte-swapping is performed.
-
-B<Non-FITS Array Files>
-
-In addition to FITS images, Funtools programs and libraries can operate
-on non-FITS files containing arrays of homogeneous data. To specify
-an array file, use:
-
-
-=over 4
-
-
-
-
-=item *
-
-file[ARRAY(array-spec)]
-
-
-=item *
-
-file[ARRAY()]
-
-
-=back
-
-
-
-where array-spec is of the form:
-
-
-=over 4
-
-
-
-
-=item *
-
-[type][dim1][.dim2][:skip][endian]
-
-
-=back
-
-
-
-and where [type] is:
-
-
-=over 4
-
-
-
-
-=item *
-
-b (8-bit unsigned char)
-
-
-=item *
-
-s (16-bit short int)
-
-
-=item *
-
-u (16-bit unsigned short int)
-
-
-=item *
-
-i (32-bit int)
-
-
-=item *
-
-r,f (32-bit float)
-
-
-=item *
-
-d (64-bit float)
-
-
-=back
-
-
-
-
-The dim1 specification is required, but dim2 is optional and defaults
-to dim1. The skip specification is optional and defaults to 0. The
-optional endian specification can be 'l' or 'b' and defaults to the
-endian type for the current machine.
-
-
-If no array specification is included within the ARRAY() operator,
-then the array specification is taken from the B<ARRAY> environment
-variable. For example:
-
-
- foo.arr[ARRAY(r512)] # bitpix=-32 dim1=512 dim2=512
- foo.arr[ARRAY(r512.400)] # bitpix=-32 dim1=512 dim2=400
- foo.arr[ARRAY(r512.400]) # bitpix=-32 dim1=512 dim2=400
- foo.arr[ARRAY(r512.400:2880)] # bitpix=-32 dim1=512 dim2=400 skip=2880
- foo.arr[ARRAY(r512l)] # bitpix=-32 dim1=512 dim2=512 endian=little
- setenv ARRAY "r512.400:2880"
- foo.arr[ARRAY()] # bitpix=-32 dim1=512 dim2=400 skip=2880
-
-
-B<Specifying Image Sections>
-
-Once a data file (and possibly, a FITS extension) has been specified,
-the next (optional) part of a bracket specification can be used to
-select image B<section> information, i.e., to specify the x,y
-limits of an image section, as well as the blocking factor to apply to
-that section. This information can be added to any file specification but
-only is used by Funtools image processing routines.
-
-
-The format of the image section specification is one of the following:
-
-
-=over 4
-
-
-
-
-=item *
-
-file[xy0:xy1,block]
-
-
-=item *
-
-file[x0:x1,y0:y1,block]
-
-
-=item *
-
-file[x0:x1,*,block]
-
-
-=item *
-
-file[*,y0:y1,block]
-
-
-=item *
-
-file[*,block]
-
-
-=back
-
-
-where the limit values can be ints or "*" for default. A single "*"
-can be used instead of val:val, as shown. Note that blocking is
-applied to the section after it is extracted.
-
-
-In addition to image sections specified by the lo and hi x,y limits, image
-sections using center positions can be specified:
-
-
-=over 4
-
-
-
-
-=item *
-
-file[dim1@xcen,dim2@ycen]
-
-
-=item *
-
-file[xdim2@xcen@ycen]
-
-
-=item *
-
-file[dim1@xcen,dim2@ycen,block]
-
-
-=item *
-
-file[dim@xcen@ycen,block]
-
-
-=back
-
-
-Note that the (float) values for dim, dim1, dim2, xcen, ycen must be
-specified or else the expression does not make sense!
-
-
-In all cases, block is optional and defaults to 1. An 's' or 'a' can
-be appended to signify "sum" or "average" blocking (default is "sum").
-Section specifications are given in image coordinates by default. If you
-wish to specify physical coordinates, add a 'p' as the last character
-of the section specification, before the closing bracket.
-For example:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-file[-8:-7,-8:-7p]
-
-
-=item *
-
-file[-8:-7,-8:-7,2p]
-
-
-=back
-
-
-
-A section can be specified in any Funtools file name. If the operation
-to be applied to that file is an imaging operation, then the
-specification will be utilized. If the operation is purely a table
-operation, then the section specification is ignored.
-
-
-Do not be confused by:
-
- foo.fits[2]
- foo.fits[*,2]
-
-The former specifies opening the second extension of the FITS file.
-The latter specifies application of block 2 to the image section.
-
-
-Note that the section specification must come after
-any of FITS B<ext> name or B<ind> number,
-but all sensible defaults are supported:
-
-
-=over 4
-
-
-
-
-=item *
-
-file[ext]
-
-
-=item *
-
-file[ext,index]
-
-
-=item *
-
-file[index]
-
-
-=item *
-
-file[ext,section]
-
-
-=item *
-
-file[ext,index,section]
-
-
-=item *
-
-file[index,section]
-
-
-=item *
-
-file[section]
-
-
-=back
-
-
-
-B<Binning FITS Binary Tables and Non-FITS Event Files>
-
-If a FITS binary table or a non-FITS raw event file is to be binned
-into a 2D image (e.g., using the
-funimage
-program), it is necessary to specify the two columns to be used for the
-binning, as well as the dimensions of the image. Funtools first looks
-for a specifier of the form:
-
- bincols=([xnam[:tlmin[:tlmax:[binsiz]]]],[ynam[:tlmin[:tlmax[:binsiz]]]])
-
-in bracket syntax, and uses the column names thus specified. The tlmin, tlmax,
-and binsiz specifiers determine the image binning dimensions using:
-
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters are present in the FITS binary
-table header, respectively. If only one parameter is specified, it is
-assumed to be tlmax, and tlmin defaults to 1. If two parameters are
-specified, they are assumed to be tlmin and tlmax.
-
-For example, to bin an HRC event list columns "VPOS" and "UPOS", use:
-
- hrc.nepr[bincols=(VPOS,UPOS)]
-
-or
-
- hrc.nepr[bincols=(VPOS:49152,UPOS:4096)]
-
-Note that you can optionally specify the dimensions of these columns
-to cover cases where neither TLMAX keywords are defined in
-the header. If either dimension is specified, then both must be specified.
-
-
-You can set the FITS_BINCOLS or EVENTS_BINCOLS environment variable as
-an alternative to adding the "bincols=" specifier to each file name
-for FITS binary tables and raw event files, respectively. If no
-binning keywords or environment variables are specified, or if the
-specified columns are not in the binary table, the Chandra parameters
-CPREF (or PREFX) are searched for in the FITS binary table header.
-Failing this, columns named "X" and "Y" are sought. If these are not
-found, the code looks for columns containing the characters "X" and
-"Y". Thus, you can bin on "DETX" and "DETX" columns without
-specifying them, if these are the only column names containing the "X"
-and "Y" characters.
-
-
-Ordinarily, each event or row contributes one count to an image pixel
-during the 2D binning process. Thus, if five events all have the same
-(x,y) position, the image pixel value for that position will have a
-value of five. It is possible to specify a variable contribution
-for each event by using the vcol=[colname] filter spec:
-
- vcol=[colname]
-
-The vcol colname is a column containing a numeric value in each event row
-that will be used as the contribution of the given event to its image
-pixel. For example, consider an event file that has the following content:
-
- x:e:4 y:e:4 v:e
- ------ ------ ----
- 1 1 1.0
- 2 2 2.0
- 3 3 3.0
- 4 4 0.0
- 1 1 1.0
- 2 2 2.0
- 3 3 3.0
- 4 4 4.0
-
-There are two events with x,y value of (1,1) so ordinarily a 2D image will
-have a value of 2 in the (1,1) pixel. If the v column is specified as the
-value column:
-
- foo.fits'[vcol=v]'
-
-then each pixel will contain the additive sum of the associated (x,y)
-column values from the v column. For example, image pixel (1,1) will
-contain 1. + 1. = 2, image pixel (2,2) will contain (2 + 2) = 4, etc.
-
-
-An important variation on the use of a value column to specify the
-contribution an event makes to an image pixel is when the value column
-contains the reciprocal of the event contribution. For this case, the
-column name should be prefixed with a / (divide sign) thus:
-
- foo.fits'[vcol=/v]'
-
-Each image pixel value will then be the sum of the reciprocals of the value
-column. A zero in the value column results in NaN (not a number).
-Thus, in the above example, image pixel (1.1) will contain 1/1 + 1/1 = 2,
-image pixel (2,2) will contain (1/2 + 1/2) = 1, etc. Image pixel (4,4)
-will contain (1/0 + 1/4) = NaN.
-
-
-You can set the FITS_VCOL or EVENTS_VCOL environment variable as
-an alternative to adding the "vcol=" specifier to each file name
-for FITS binary tables and raw event files, respectively.
-
-
-Finally, when binning events, the data type of the resulting 2D image
-must be specified. This can be done with the "bitpix=[n]" keyword in
-the bracket specification. For example:
-
- events.fits[bincols=(VPOS,UPOS),bitpix=-32]
-
-will create a floating point image binned on columns VPOS and UPOS.
-If no bitpix keyword is specified, bitpix=32 is assumed. As with
-bincols values, you also can use the FITS_BITPIX and EVENTS_BITPIX
-environment variables to set this value for FITS binary tables and
-raw event files, respectively.
-
-
-The B<funimage> program also allows you to create a 1D image projection
-along any column of a table by using the B<bincols=[column]>
-filter specification and specifying a single column.
-For example, the following command projects a 1D image along
-the chipx column of a table:
-
- funimage ev.fits'[bincols=chipx]' im.fits
-
-See funimage for more
-information about creating 1D and 2D images.
-
-
-Finally, please note that Funtools supports most FITS standards.
-We will add missing support as required by the community. In general,
-however, we do not support non-standard extensions. For example, we
-sense the presence of the binary table 'variable length array'
-proposed extension and we pass it along when copying and filtering
-files, but we do not process it. We will add support for new standards
-as they become official.
-
-B<Table and Spatial Region Filters>
-
-Note that, in addition extensions and image sections, Funtools bracket
-notation can be used to specify table and spatial region filters. These
-filters are always placed after the image section information. They
-can be specified in the same bracket or in a separate bracket
-immediately following:
-
-
-=over 4
-
-
-
-
-=item *
-
-file[ext|ind|ARRAY()|EVENTS(),section][filters]
-
-
-=item *
-
-file[ext|ind|ARRAY()|EVENTS(),section,filters]
-
-
-=back
-
-
-where:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<file> is the Funtools file name
-
-
-=item *
-
-B<ARRAY()> is an array specification
-
-
-=item *
-
-B<EVENTS()> is an event list specification
-
-
-=item *
-
-B<ext> is the FITS extension name
-
-
-=item *
-
-B<ind> is the FITS extension number
-
-
-=item *
-
-B<section> is the image section to extract
-
-
-=item *
-
-B<filters> are spatial region and table (row) filters to apply
-
-
-=back
-
-
-
-The topics of table and region filtering are covered in detail in:
-
-
-=over 4
-
-
-
-
-=item *
-
-Table Filtering
-
-
-=item *
-
-Spatial Region Filtering
-
-
-=back
-
-
-
-B<Disk Files and Other Supported File Types>
-
-The specified B<file> usually is an ordinary disk file. In
-addition, gzip'ed files are supported in Funtools: gzip'ed input files
-are automatically uncompressed as they are read, and gzip'ed output
-files are compressed as they are written. NB: if a FITS binary table
-is written in gzip format, the number of rows in the table will be set
-to -1. Such a file will work with Funtools programs but will not work
-with other FITS programs such as ds9.
-
-
-The special keywords "stdin" and "stdout" designate Unix standard
-input and standard output, respectively. The string "-" (hyphen) will
-be taken to mean "stdin" if the file is opened for reading and
-"stdout" if the file is opened for writing.
-
-
-A file also can be an INET socket on the same or another machine using
-the syntax:
-
- machine:port
-
-Thus, for example:
-
- karapet:1428
-
-specifies that I/O should be performed to/from port 1428 on the
-machine karapet. If no machine name is specified, the default is to
-use the current machine:
-
- :1428
-
-This means to open port 1428 on the current machine. Socket support
-allows you to generate a distributed pipe:
-
- on karapet: funtask1 in.fits bynars:1428
- on bynars: funtask2 :1428 out.fits
-
-The socket mechanism thus supports simple parallel processing using
-B<process decomposition>. Note that parallel processing using
-B<data decomposition> is supported via the B<section> specifier (see
-below), and the B<row#> specifier, which is part of
-Table Filtering.
-
-
-A file also can be a pointer to shared memory using the syntax:
-
- shm:[id|@key][:size]
-
-A shared memory segment is specified with a B<shm:> prefix,
-followed by either the shared memory id or the shared memory key
-(where the latter is prefixed by the '@' character). The size (in
-bytes) of the shared memory segment can then be appended (preceded by
-the ':' character). If the size specification is absent, the code will
-attempt to determine the length automatically.
-
-If the open mode contains the string "w+", then the memory segment will be
-created if it does not exist. (It also will be released and deleted when the
-file is closed.) In the case where a memory segment is being created, the
-length of the segment is required.
-
-
-A file also can be Unix piped command (i.e. a program to run) using the syntax:
-
- "pipe: command arg1 ... argn"
-
-The output from the command must be a valid FITS file. It is important
-to use quotes to protect spaces so that command arguments are passed
-correctly. A silly example is:
-
- fundisp "pipe: funtable 'foo.fits[cir 512 512 .1]' stdout"
-
-This seemed like a good idea at the time ...
-
-B<Lists of Files>
-
-
-Funtools also will process a list of files as a single file using the
-syntax:
-
- "list: file1 file2 ... filen"
-
-The files in the list are separated by whitespace. Any of the
-above file types can be used. For example, if two files, foo1.fits and
-foo2.fits, are part of the same observation, they can be processed as
-a single file (using their own filters):
-
- fundisp "list: foo1.fits[cir(512,512,10)] foo2.fits[cir(511,511,10)]"
- X Y PHA PI TIME DX DY
- -------- -------- -------- -------- --------------------- -------- --------
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
- 511 511 5 5 79488631.09462625 580 575
- 511 511 10 11 79488780.60006675 580 573
- 511 511 4 4 79494562.35474326 580 575
- 511 511 6 6 79488203.01561825 580 575
- 511 511 6 6 79488017.99730176 580 575
- 511 511 4 4 79494332.45355175 580 575
- 511 511 9 10 79492685.94014275 581 574
- 511 511 5 5 79487708.71298325 580 575
- 511 511 8 9 79493719.00160225 581 573
-
-Again, note that it is important to avoid spaces in the filters
-because the list separator also is whitespace. To protect whitespace
-in a filter, enclose the file specification in quotes:
-
- fundisp "list: 'foo1.fits[cir 512 512 .1]' foo2.fits[cir(511,511,.1)]"
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funfilters.pod b/funtools/doc/pod/funfilters.pod
deleted file mode 100644
index b9b6d83..0000000
--- a/funtools/doc/pod/funfilters.pod
+++ /dev/null
@@ -1,521 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funfilters: Filtering Rows in a Table>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the user interface for
-filtering rows in binary tables.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-Table filtering allows a program to select rows from an table (e.g.,
-X-ray event list) by checking each row against one or more expressions
-involving the columns in the table. When a table is filtered, only
-valid rows satisfying these expressions are passed through for processing.
-
-
-A filter expression is specified using bracket notation appended to
-the filename of the data being processed:
-
- foo.fits[pha==1&&pi==2]
-
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-
- foo.fits[@my.reg]
-
-Filters must be placed after the extension and image section
-information, when such information is present. The correct order is:
-
-
-=over 4
-
-
-
-
-=item *
-
-file[fileinfo,sectioninfo][filters]
-
-
-=item *
-
-file[fileinfo,sectioninfo,filters]
-
-
-=back
-
-
-where:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<file> is the Funtools file name
-
-
-=item *
-
-B<fileinfo> is an ARRAY, EVENT, FITS extension, or FITS index
-
-
-=item *
-
-B<sectioninfo> is the image section to extract
-
-
-=item *
-
-B<filters> are spatial region and table (row) filters to apply
-
-
-=back
-
-
-See Funtools Files for more information
-on file and image section specifications.
-
-B<Filter Expressions>
-
-
-Table filtering can be performed on columns of data in a FITS
-binary table or a raw event file. Table filtering is accomplished by
-means of B<table filter specifications>. An table filter
-specification consists of one or more B<filter expressions> Filter
-specifications also can contain comments and local/global processing
-directives.
-
-
-More specifically, a filter specification consist of one or more lines
-containing:
-
- # comment until end of line
- # include the following file in the table descriptor
- @file
- # each row expression can contain filters separated by operators
- [filter_expression] BOOLOP [filter_expression2], ...
- # each row expression can contain filters separated by the comma operator
- [filter_expression1], [filter_expression2], ...
- # the special row# keyword allows a range of rows to be processed
- row#=m:n
- # or a single row
- row#=m
- # regions are supported -- but are described elsewhere
- [spatial_region_expression]
-
-
-
-A single filter expression consists of an arithmetic, logical, or
-other operations involving one or more column values from a
-table. Columns can be compared to other columns, to header values,
-or to numeric constants. Standard math functions can be applied to
-columns. Separate filter expressions can be combined using boolean operators.
-Standard C semantics can be used when constructing expressions, with
-the usual precedence and associativity rules holding sway:
-
- Operator Associativity
- -------- -------------
- () left to right
- !! (logical not) right to left
- ! (bitwise not) - (unary minus) right to left
- * / left to right
- + - left to right
- < <= > >= left to right
- == != left to right
- & (bitwise and) left to right
- ^ (bitwise exclusive or) left to right
- | (bitwise inclusive or) left to right
- && (logical and) left to right
- || (logical or) left to right
- = right to left
-
-For example, if energy and pha are columns in a table,
-then the following are valid expressions:
-
- pha>1
- energy == pha
- (pha>1) && (energy<=2)
- max(pha,energy)>=2.5
-
-
-
-Comparison values can be integers or floats. Integer comparison values can be
-specified in decimal, octal (using '0' as prefix), hex (using '0x' as prefix)
-or binary (using '0b' as prefix). Thus, the following all specify the same
-comparison test of a status mask:
-
- (status & 15) == 8 # decimal
- (status & 017) == 010 # octal
- (status & 0xf) == 0x8 # hex
- (status & 0b1111) == 0b1000 # binary
-
-
-The special keyword row# allows you to process a range of rows.
-When row# is specified, the filter code skips to the designated
-row and only processes the specified number of rows. The
-"*" character can be utilized as the high limit value to denote
-processing of the remaining rows. Thus:
-
- row#=100:109
-
-processes 10 rows, starting with row 100 (counting from 1),
-while:
-
- row#=100:*
-
-specifies that all but the first 99 rows are to be processed.
-
-
-Spatial region filtering allows a program to select regions of an
-image or rows of a table (e.g., X-ray events) using simple geometric
-shapes and boolean combinations of shapes. For a complete description
-of regions, see Spatial Region Filtering.
-
-B<Separators Also Are Operators>
-
-As mentioned previously, multiple filter expressions can be specified
-in a filter descriptor, separated by commas or new-lines.
-When such a comma or new-line separator is used, the boolean AND operator
-is automatically generated in its place. Thus and expression such as:
-
- pha==1,pi=2:4
-
-is equivalent to:
-
- (pha==1) && (pi>=2&&pi<=4)
-
-
-[Note that the behavior of separators is different for filter expressions
-and spatial region expressions. The former uses AND as the operator, while
-the latter user OR. See
-Combining Region and Table Filters
-for more information about these conventions and how they are treated
-when combined.]
-
-B<Range Lists>
-
-Aside from the standard C syntax, filter expressions can make use of
-IRAF-style B<range lists> which specify a range of values. The
-syntax requires that the column name be followed by an '=' sign, which
-is followed by one or more comma-delimited range expressions of the form:
-
- col = vv # col == vv in range
- col = :vv # col <= vv in range
- col = vv: # col >= vv in range
- col = vv1:vv2 # vv1 <= col <= vv2 in range
-
-The vv's above must be numeric constants; the right hand side of a
-range list cannot contain a column name or header value.
-
-Note that, unlike an ordinary comma separator, the comma separator used
-between two or more range expressions denotes OR. Thus, when two or
-more range expressions are combined with a comma separator, the resulting
-expression is a shortcut for more complicated boolean logic. For example:
-
- col = :3,6:8,10:
-
-is equivalent to:
-
- (col=6 && col =10)
-
-Note also that the single-valued rangelist:
-
- col = val
-
-is equivalent to the C-based filter expression:
-
- col == val
-
-assuming, of course, that val is a numeric constant.
-
-B<Math Operations and Functions>
-
-It is permissible to specify C math functions as part of the filter syntax.
-When the filter parser recognizes a function call, it automatically
-includes the math.h and links in the C math library. Thus, it is
-possible to filter rows by expressions such as these:
-
-
-=over 4
-
-
-
-
-=item *
-
-(pi+pha)>(2+log(pi)-pha)
-
-
-=item *
-
-min(pi,pha)*14>x
-
-
-=item *
-
-max(pi,pha)==(pi+1)
-
-
-=item *
-
-feq(pi,pha)
-
-
-=item *
-
-div(pi,pha)>0
-
-
-=back
-
-
-The function feq(a,b) returns true (1) if the difference between a and b
-(taken as double precision values) is less than approximately 10E-15.
-The function div(a,b) divides a by b, but returns NaN (not a number)
-if b is 0. It is a safe way to avoid floating point errors when
-dividing one column by another.
-
-B<Include Files>
-
-The special B<@filename> directive specifies an include file
-containing filter expressions. This file is processed as part of
-the overall filter descriptor:
-
- foo.fits[pha==1,@foo]
-
-
-B<Header Parameters>
-
-The filter syntax supports comparison between a column value and a
-header parameter value of a FITS binary tables (raw event files have no
-such header). The header parameters can be taken from the binary
-table header or the primary header. For example, assuming there is a
-header value MEAN_PHA in one of these headers, you can select photons
-having exactly this value using:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-pha==MEAN_PHA
-
-
-=back
-
-
-
-
-
-Table filtering is more easily described by means of examples.
-Consider data containing the following table structure:
-
-
-=over 4
-
-
-
-
-=item *
-
-double TIME
-
-
-=item *
-
-int X
-
-
-=item *
-
-int Y
-
-
-=item *
-
-short PI
-
-
-=item *
-
-short PHA
-
-
-=item *
-
-int DX
-
-
-=item *
-
-int DY
-
-
-=back
-
-
-
-
-Tables can be filtered on these columns using IRAF/QPOE range syntax or
-any valid C syntax. The following examples illustrate the possibilities:
-
-
-=over 4
-
-
-
-
-
-
-=item *
-
-pha=10
-
-
-=item *
-
-pha==10
-
-
-select rows whose pha value is exactly 10
-
-
-
-
-=item *
-
-pha=10:50
-
-
-select rows whose pha value is in the range of 10 to 50
-
-
-
-
-=item *
-
-pha=10:50,100
-
-
-select rows whose pha value is in the range of 10 to 50 or is
-equal to 100
-
-
-
-
-=item *
-
-pha>=10 && pha<=50
-
-
-select rows whose pha value is in the range of 10 to 50
-
-
-
-
-=item *
-
-pi=1,2&&pha>3
-
-
-select rows whose pha value is 1 or 2 and whose pi value is 3
-
-
-
-
-=item *
-
-pi=1,2 || pha>3
-
-
-select rows whose pha value is 1 or 2 or whose pi value is 3
-
-
-
-
-=item *
-
-pha==pi+1
-
-
-select rows whose pha value is 1 less than the pi value
-
-
-
-
-=item *
-
-(pha==pi+1) && (time>50000.0)
-
-
-select rows whose pha value is 1 less than the pi value
-and whose time value is greater than 50000
-
-
-
-
-=item *
-
-(pi+pha)>20
-
-
-select rows in which the sum of the pi and pha values is greater
-than 20
-
-
-
-
-=item *
-
-pi%2==1
-
-
-select rows in which the pi value is odd
-
-
-=back
-
-
-
-
-Currently, integer range list limits cannot be specified in binary
-notation (use decimal, hex, or octal instead). Please contact us if
-this is a problem.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funflush.pod b/funtools/doc/pod/funflush.pod
deleted file mode 100644
index b525ad2..0000000
--- a/funtools/doc/pod/funflush.pod
+++ /dev/null
@@ -1,107 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunFlush - flush data to output file>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void FunFlush(Fun fun, char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunFlush> routine will flush data to a FITS output file. In
-particular, it can be called after all rows have been written (using
-the FunTableRowPut() routine)
-in order to add the null padding that is required to complete a FITS
-block. It also should be called after completely writing an image using
-FunImagePut() or after writing
-the final row of an image using
-FunTableRowPut().
-
-
-The B<plist> (i.e., parameter list) argument is a string
-containing one or more comma-delimited B<keyword=value>
-parameters. If the plist string contains the parameter
-"copy=remainder" and the file was opened with a reference file, which,
-in turn, was opened for extension copying (i.e. the input
-FunOpen() mode also was "c" or "C"),
-then FunFlush also will copy the remainder of the FITS extensions from
-the input reference file to the output file. This normally would be
-done only at the end of processing.
-
-
-Note that FunFlush() is called
-with "copy=remainder" in the mode string by FunClose(). This means
-that if you close the output file before the reference input file, it
-is not necessary to call
-FunFlush() explicitly, unless you
-are writing more than one extension. See the
-evmerge example code. However, it is safe to
-call FunFlush() more than once
-without fear of re-writing either the padding or the copied
-extensions.
-
-
-In addition, if FunFlush() is
-called on an output file with the plist set to "copy=reference" and if
-the file was opened with a reference file, the reference extension is
-written to the output file. This mechanism provides a simple way to
-copy input extensions to an output file without processing the former.
-For example, in the code fragment below, an input extension is set to
-be the reference file for a newly opened output extension. If that
-reference extension is not a binary table, it is written to the output
-file:
-
- /* process each input extension in turn */
- for(ext=0; ;ext++){
- /* get new extension name */
- sprintf(tbuf, "%s[%d]", argv[1], ext);
- /* open input extension -- if we cannot open it, we are done */
- if( !(ifun=FunOpen(tbuf, "r", NULL)) )
- break;
- /* make the new extension the reference handle for the output file */
- FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
- /* if its not a binary table, just write it out */
- if( !(s=FunParamGets(ifun, "XTENSION", 0, NULL, &got)) ||
- strcmp(s, "BINTABLE")){
- if( s ) free(s);
- FunFlush(ofun, "copy=reference");
- FunClose(ifun);
- continue;
- }
- else{
- /* process binary table */
- ....
- }
- }
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funhead.pod b/funtools/doc/pod/funhead.pod
deleted file mode 100644
index ee224cc..0000000
--- a/funtools/doc/pod/funhead.pod
+++ /dev/null
@@ -1,218 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funhead - display a header in a Funtools file>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funhead [-a] [-s] [-t] [-L] <iname> [oname ename]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -a # display all extension headers
- -s # display 79 chars instead of 80 before the new-line
- -t # prepend data type char to each line of output
- -L # output in rdb/starbase list format
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funhead> displays the FITS header parameters in the specified
-FITS Extension.
-
-The first argument to the program specifies the Funtools input file
-to display. If "stdin" is specified, data are read from
-the standard input. Funtools Bracket
-Notation is used to specify particular FITS extension to process.
-Normally, the full 80 characters of each header card is output,
-followed by a new-line.
-
-
-If the B<-a> switch is specified, the header from each FITS
-extensions in the file is displayed. Note, however, that the B<-a>
-switch does not work with FITS files input via stdin. We hope to
-remove this restriction in a future release.
-
-
-If the B<-s> switch is specified, only 79 characters are output
-before the new-line. This helps the display on 80 character terminals.
-
-
-If the B<-t> switch is specified, the data type of the parameter
-is output as a one character prefix, followed by 77 characters of the
-param. The parameter data types are defined as: FUN_PAR_UNKNOWN
-('u'), FUN_PAR_COMMENT ('c'), FUN_PAR_LOGICAL ('l'), FUN_PAR_INTEGER
-('i'), FUN_PAR_STRING ('s'), FUN_PAR_REAL ('r'), FUN_PAR_COMPLEX ('x').
-
-
-If the B<-L> (rdb table) switch is used, the output will conform
-to starbase/rdb data base list format.
-
-
-For example to display the EVENTS extension (binary table):
-
- [sh] funhead "foo.fits[EVENTS]"
- XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
- BITPIX = 8 / Binary data
- NAXIS = 2 / Table is a matrix
- NAXIS1 = 20 / Width of table in bytes
- NAXIS2 = 30760 / Number of entries in table
- PCOUNT = 0 / Random parameter count
- GCOUNT = 1 / Group count
- TFIELDS = 7 / Number of fields in each row
- EXTNAME = 'EVENTS ' / Table name
- EXTVER = 1 / Version number of table
- TFORM1 = '1I ' / Data type for field
- TTYPE1 = 'X ' / Label for field
- TUNIT1 = ' ' / Physical units for field
- TFORM2 = '1I ' / Data type for field
- etc. ...
- END
-
-
-
-To display the third header:
-
- [sh] funhead "foo.fits[3]"
- XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
- BITPIX = 8 / Binary data
- NAXIS = 2 / Table is a matrix
- NAXIS1 = 32 / Width of table in bytes
- NAXIS2 = 40 / Number of entries in table
- PCOUNT = 0 / Random parameter count
- GCOUNT = 1 / Group count
- TFIELDS = 7 / Number of fields in each row
- EXTNAME = 'TGR ' / Table name
- EXTVER = 1 / Version number of table
- TFORM1 = '1D ' / Data type for field
- etc. ...
- END
-
-
-
-To display the primary header (i.e., extension 0):
-
- sh> funhead "coma.fits[0]"
- SIMPLE = T /STANDARD FITS FORMAT
- BITPIX = 16 /2-BYTE TWOS-COMPL INTEGER
- NAXIS = 2 /NUMBER OF AXES
- NAXIS1 = 800 /
- NAXIS2 = 800 /
- DATATYPE= 'INTEGER*2' /SHORT INTEGER
- END
-
-
-
-The funhead program also can edit (i.e. add, delete, or modify) or
-display individual headers parameters. Edit mode is signalled by the
-presence of two additional command-line arguments: output file and
-edit command file, in that order. Edit mode acts as a filter: the
-output file will contain the entire input FITS file, including other
-extensions. The edit command file can be "stdin", in which case edit
-command are read from the standard input.
-
-
-The edit command file contains parameter comments (having '#' in the
-first column) and delete and assignment(modify or add) operations. A
-delete operation is specified by preceding the parameter name with a
-minus sign "-". A display operation (very useful in interactive
-sessions, i.e., where the edit commands are taken from stdin) is
-specified by preceding the parameter name with a question mark "?". In
-either case, a parameter value need not be specified. An assignment
-operation is specified in the same two ways that a parameter is
-specified in a text header (but without the comment character that
-precedes header params), i.e.:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-FITS-style comments have an equal sign "=" between the keyword and
-value and an optional slash "/" to signify a comment. The strict FITS
-rules on column positions are not enforced.
-
-
-
-=item *
-
-Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed.
-
-
-=back
-
-
-
-
-For example, the following interactive session checks for the
-existence of parameters, adds new parameters, modifies them, and
-modifies and deletes existing parameters:
-
- sh$ ./funhead snr.ev foo.fits -
- # look for FOO1
- ? FOO1
- WARNING: FOO1 not found
- # add new foo1
- FOO1 = 100
- # add foo2
- FOO2 = 200
- # reset foo1 to a different value
- FOO1 -1
- # delete foo2
- -FOO2
- # change existing value
- EXTVER 2
- ? XS-SORT
- XS-SORT = 'EOF ' / type of event sort
- # delete existing value
- -XS-SORT
- # exit
- ^D
-
-
-
-See Column-based Text Files
-for more information about header parameter format.
-
-
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funhist.pod b/funtools/doc/pod/funhist.pod
deleted file mode 100644
index fc1885d..0000000
--- a/funtools/doc/pod/funhist.pod
+++ /dev/null
@@ -1,252 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funhist - create a 1D histogram of a column (from a FITS binary table or raw event file) or an image>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funhist [-n|-w|-T] <iname> [column] [[lo:hi:]bins]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -n # normalize bin value by the width of each bin
- -w # specify bin width instead of number of bins in arg3
- -T # output in rdb/starbase format (tab separators)
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funhist> creates a one-dimensional histogram from the specified
-columns of a FITS Extension
-binary table of a FITS file (or from a non-FITS raw event file), or
-from a FITS image or array, and writes that histogram as an ASCII
-table. Alternatively, the program can perform a 1D projection of one
-of the image axes.
-
-
-The first argument to the program is required, and specifies the
-Funtools file: FITS table or image, raw event file, or array. If
-"stdin" is specified, data are read from the standard input. Use
-Funtools Bracket Notation to specify FITS
-extensions, and filters.
-
-
-For a table, the second argument also is required. It specifies the
-column to use in generating the histogram. If the data file is of
-type image (or array), the column is optional: if "x" (or "X"), "y"
-(or "Y") is specified, then a projection is performed over the x
-(dim1) or y (dim2) axes, respectively. (That is, this projection will
-give the same results as a histogram performed on a table containing
-the equivalent x,y event rows.) If no column name is specified or
-"xy" (or "XY") is specified for the image, then a histogram is
-performed on the values contained in the image pixels.
-
-
-The argument that follows is optional and specifies the number of bins
-to use in creating the histogram and, if desired, the range of bin
-values. For image and table histograms, the range should specify the
-min and max data values. For image histograms on the x and y axes,
-the range should specify the min and max image bin values. If this
-argument is omitted, the number of output bins for a table is
-calculated either from the TLMIN/TLMAX headers values (if these exist
-in the table FITS header for the specified column) or by going through
-the data to calculate the min and max value. For an image, the number
-of output bins is calculated either from the DATAMIN/DATAMAX header
-values, or by going through the data to calculate min and max value.
-(Note that this latter calculation might fail if the image cannot be
-fit in memory.) If the data are floating point (table or image) and
-the number of bins is not specified, an arbitrary default of 128 is
-used.
-
-
-For binary table processing, the B<-w> (bin width) switch can be used
-to specify the width of each bin rather than the number of bins. Thus:
-
- funhist test.ev pha 1:100:5
-
-means that 5 bins of width 20 are used in the histogram, while:
-
- funhist -w test.ev pha 1:100:5
-
-means that 20 bins of width 5 are used in the histogram.
-
-
-The data are divvied up into the specified number of bins and the
-resulting 1D histogram (or projection) is output in ASCII table
-format. For a table, the output displays the low_edge (inclusive) and
-hi_edge (exclusive) values for the data. For example, a 15-row table
-containing a "pha" column whose values range from -7.5 to 7.5
-can be processed thus:
-
-
- [sh] funhist test.ev pha
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: -7.5 7.5 15
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 22 -7.50000000 -6.50000000
- 2 21 -6.50000000 -5.50000000
- 3 20 -5.50000000 -4.50000000
- 4 19 -4.50000000 -3.50000000
- 5 18 -3.50000000 -2.50000000
- 6 17 -2.50000000 -1.50000000
- 7 16 -1.50000000 -0.50000000
- 8 30 -0.50000000 0.50000000
- 9 16 0.50000000 1.50000000
- 10 17 1.50000000 2.50000000
- 11 18 2.50000000 3.50000000
- 12 19 3.50000000 4.50000000
- 13 20 4.50000000 5.50000000
- 14 21 5.50000000 6.50000000
- 15 22 6.50000000 7.50000000
-
- [sh] funhist test.ev pha 1:6
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 6
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 16 0.50000000 1.50000000
- 2 17 1.50000000 2.50000000
- 3 18 2.50000000 3.50000000
- 4 19 3.50000000 4.50000000
- 5 20 4.50000000 5.50000000
- 6 21 5.50000000 6.50000000
-
- [sh] funhist test.ev pha 1:6:3
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 3
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 33 0.50000000 2.50000000
- 2 37 2.50000000 4.50000000
- 3 41 4.50000000 6.50000000
-
-
-
-For a table histogram, the B<-n>(normalize) switch can be used to
-normalize the bin value by the width of the bin (i.e., hi_edge-lo_edge):
-
- [sh] funhist -n test.ev pha 1:6:3
- # data file: test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 3
- # width normalization (val/(hi_edge-lo_edge)) is applied
-
- bin value lo_edge hi_edge
- ------ --------------------- --------------------- ---------------------
- 1 16.50000000 0.50000000 2.50000000
- 2 6.16666667 2.50000000 4.50000000
- 3 4.10000000 4.50000000 6.50000000
-
-This could used, for example, to produce a light curve with values
-having units of counts/second instead of counts.
-
-
-For an image histogram, the output displays the low and high image
-values (both inclusive) used to generate the histogram. For example,
-in the following example, 184 pixels had a value of 1, 31 had a value
-of 2, while only 2 had a value of 3,4,5,6, or 7:
-
- [sh] funhist test.fits
- # data file: /home/eric/data/test.fits
- # min,max,bins: 1 7 7
-
- bin value lo_val hi_val
- ------ --------------------- --------------------- ---------------------
- 1 184.00000000 1.00000000 1.00000000
- 2 31.00000000 2.00000000 2.00000000
- 3 2.00000000 3.00000000 3.00000000
- 4 2.00000000 4.00000000 4.00000000
- 5 2.00000000 5.00000000 5.00000000
- 6 2.00000000 6.00000000 6.00000000
- 7 2.00000000 7.00000000 7.00000000
-
-
-
-For the axis projection of an image, the output displays the low and
-high image bins (both inclusive) used to generate the projection. For
-example, in the following example, 21 counts had their X bin value of
-2, etc.:
-
- [sh] funhist test.fits x 2:7
- # data file: /home/eric/data/test.fits
- # column: X
- # min,max,bins: 2 7 6
-
- bin value lo_bin hi_bin
- ------ --------------------- --------------------- ---------------------
- 1 21.00000000 2.00000000 2.00000000
- 2 20.00000000 3.00000000 3.00000000
- 3 19.00000000 4.00000000 4.00000000
- 4 18.00000000 5.00000000 5.00000000
- 5 17.00000000 6.00000000 6.00000000
- 6 16.00000000 7.00000000 7.00000000
-
- [sh] funhist test.fits x 2:7:2
- # data file: /home/eric/data/test.fits
- # column: X
- # min,max,bins: 2 7 2
-
- bin value lo_bin hi_bin
- ------ --------------------- --------------------- ---------------------
- 1 60.00000000 2.00000000 4.00000000
- 2 51.00000000 5.00000000 7.00000000
-
-
-
-You can use gnuplot or other plotting programs to graph the
-results, using a script such as:
-
- #!/bin/sh
- sed -e '1,/---- .*/d
- /^$/,$d' | \
- awk '\
- BEGIN{print "set nokey; set title \"funhist\"; set xlabel \"bin\"; set ylabel \"counts\"; plot \"-\" with boxes"} \
- {print $3, $2, $4-$3}' | \
- gnuplot -persist - 1>/dev/null 2>&1
-
-
-Similar plot commands are supplied in the script B<funhist.plot>:
-
- funhist test.ev pha ... | funhist.plot gnuplot
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funidx.pod b/funtools/doc/pod/funidx.pod
deleted file mode 100644
index 37bb712..0000000
--- a/funtools/doc/pod/funidx.pod
+++ /dev/null
@@ -1,224 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funidx: Using Indexes to Filter Rows in a Table>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the user interface for
-filtering rows in binary tables with indexes.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-Funtools Table Filtering allows rows in a
-table to be selected based on the values of one or more columns in the
-row. Because the actual filter code is compiled on the fly, it is very
-efficient. However, for very large files (hundreds of Mb or larger),
-evaluating the filter expression on each row can take a long time. Therefore,
-funtools supports index files for columns, which are used automatically during
-filtering to reduce dramatically the number of row evaluations performed.
-The speed increase for indexed filtering can be an order of magnitude or
-more, depending on the size of the file.
-
-
-The funindex program creates an
-index on one or more columns in a binary table. For example, to create an index
-for the column pi in the file huge.fits, use:
-
- funindex huge.fits pi
-
-This will create an index named huge_pi.idx.
-
-
-When a filter expression is initialized for row evaluation, funtools
-looks for an index file for each column in the filter expression. If
-found, and if the file modification date of the index file is later
-than that of the data file, then the index will be used to reduce the
-number of rows that are evaluated in the filter. When
-Spatial Region Filtering is part of the
-expression, the columns associated with the region are checked for index
-files.
-
-
-If an index file is not available for a given column, then in general,
-all rows must be checked when that column is part of a filter
-expression. This is not true, however, when a non-indexed column is
-part of an AND expression. In this case, only the rows that pass the
-other part of the AND expression need to be checked. Thus, in some cases,
-filtering speed can increase significantly even if all columns are not
-indexed.
-
-
-Also note that certain types of filter expression syntax cannot make
-use of indices. For example, calling functions with column names as
-arguments implies that all rows must be checked against the function
-value. Once again, however, if this function is part of an AND
-expression, then a significant improvement in speed still is possible
-if the other part of the AND expression is indexed.
-
-
-For example, note below the dramatic speedup in searching a 1 Gb
-file using an AND filter, even when one of the columns (pha) has no
-index:
-
-
- time fundisp \
- huge.fits'[idx_activate=0,idx_debug=1,pha=2348&&cir 4000 4000 1]' \
- "x y pha"
- x y pha
- ---------- ----------- ----------
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 42.36u 13.07s 6:42.89 13.7%
-
- time fundisp \
- huge.fits'[idx_activate=1,idx_debug=1,pha=2348&&cir 4000 4000 1]' \
- "x y pha"
- x y pha
- ---------- ----------- ----------
- idxeq: [INDEF]
- idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
- idxand(1): INDEF [IDX_OR_SORT]
- idxall(1): [IDX_OR_SORT]
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 1.55u 0.37s 1:19.80 2.4%
-
-
-When all columns are indexed, the increase in speed can be even more dramatic:
-
- time fundisp \
- huge.fits'[idx_activate=0,idx_debug=1,pi=770&&cir 4000 4000 1]' \
- "x y pi"
- x y pi
- ---------- ----------- ----------
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 42.60u 12.63s 7:28.63 12.3%
-
- time fundisp \
- huge.fits'[idx_activate=1,idx_debug=1,pi=770&&cir 4000 4000 1]' \
- "x y pi"
- x y pi
- ---------- ----------- ----------
- idxeq: pi start=9473025,stop=9492240 => pi[ROW 9473025:9492240]
- idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
- idxor sort/merge: pi[ROW 9473025:9492240] [IDX_OR_SORT]
- idxmerge(5): [IDX_OR_SORT] pi[ROW]
- idxall(1): [IDX_OR_SORT]
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 1.67u 0.30s 0:24.76 7.9%
-
-
-
-The miracle of indexed filtering (and indeed, of any indexing) is the
-speed of the binary search on the index, which is of order log2(n)
-instead of n. (The funtools binary search method is taken from
-http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary, to whom
-grateful acknowledgement is made.) This means that the larger the
-file, the better the performance. Conversely, it also means that for
-small files, using an index (and the overhead involved) can slow
-filtering down somewhat. Our tests indicate that on a file containing
-a few tens of thousands of rows, indexed filtering can be 10 to 20
-percent slower than non-indexed filtering. Of course, your mileage
-will vary with conditions (disk access speed, amount of available
-memory, process load, etc.)
-
-
-Any problem encountered during index processing will result in
-indexing being turned off, and replaced by filtering all rows. You can turn
-filtering off manually by setting the idx_activate variable to 0 (in a filter
-expression) or the FILTER_IDX_ACTIVATE environment variable to 0 (in the global
-environment). Debugging output showing how the indexes are being processed can
-be displayed to stderr by setting the idx_debug variable to 1 (in a filter
-expression) or the FILTER_IDX_DEBUG environment variable to 1 (in the global
-environment).
-
-
-Currently, indexed filtering only works with FITS binary tables and raw
-event files. It does not work with text files. This restriction might be
-removed in a future release.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funimage.pod b/funtools/doc/pod/funimage.pod
deleted file mode 100644
index 7ec3f93..0000000
--- a/funtools/doc/pod/funimage.pod
+++ /dev/null
@@ -1,314 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funimage - create a FITS image from a Funtools data file>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funimage [-a] <iname> <oname> [bitpix=n]
-funimage [-l] <iname> <oname> <xcol:xdims> <ycol:ydims> <vcol> [bitpix=n]
-funimage [-p x|y] <iname> <oname> [bitpix=n]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -a # append to existing output file as an image extension
- -l # input is a list file containing xcol, ycol, value
- -p [x|y] # project along x or y axis to create a 1D image
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funimage> creates a primary FITS image from the specified
-FITS Extension
-and/or
-Image Section
-of a FITS file, or from an
-Image Section
-of a non-FITS array, or from a raw event file.
-
-The first argument to the program specifies the FITS input image,
-array, or raw event file to process. If "stdin" is specified, data are
-read from the standard input. Use Funtools
-Bracket Notation to specify FITS extensions, image sections, and
-filters. The second argument is the output FITS file. If "stdout" is
-specified, the FITS image is written to the standard output. By
-default, the output pixel values are of the same data type as those of the
-input file (or type "int" when binning a table), but this can be
-overridden using an optional third argument of the form:
-
- bitpix=n
-
-where n is 8,16,32,-32,-64, for unsigned char, short, int, float and double,
-respectively.
-
-
-If the input data are of type image, the appropriate section is
-extracted and blocked (based on how the
-Image Section is specified), and
-the result is written to the FITS primary image. When an integer
-image containing the BSCALE and BZERO keywords is converted to float,
-the pixel values are scaled and the scaling keywords are deleted from the
-output header. When converting integer scaled data to integer
-(possibly of a different size), the pixels are not scaled and the
-scaling keywords are retained.
-
-
-If the input data is a binary table or raw event file, these are
-binned into an image, from which a section is extracted and blocked,
-and written to a primary FITS image. In this case, it is necessary to
-specify the two columns that will be used in the 2D binning. This can
-be done on the command line using the B<bincols=(x,y)> keyword:
-
- funcnts "foo.ev[EVENTS,bincols=(detx,dety)]"
-
-The full form of the B<bincols=> specifier is:
-
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-
-Using this syntax, it is possible to bin any two columns of a binary
-table at any bin size. Note that the tlmin, tlmax, and binsiz
-specifiers can be omitted if TLMIN, TLMAX, and TDBIN header parameters
-(respectively) are present in the FITS binary table header for the
-column in question. Note also that if only one parameter is specified,
-it is assumed to be tlmax, and tlmin defaults to 1. If two parameters
-are specified, they are assumed to be tlmin and tlmax.
-See Binning FITS Binary Tables and Non-FITS
-Event Files for more information about binning parameters.
-
-
-By default, a new 2D FITS image file is created and the image is written
-to the primary HDU. If the B<-a> (append) switch is specified,
-the image is appended to an existing FITS file as an IMAGE extension.
-(If the output file does not exist, the switch is effectively ignored
-and the image is written to the primary HDU.) This can be useful in a
-shell programming environment when processing multiple FITS images
-that you want to combine into a single final FITS file.
-
-
-B<funimage> also can take input from a table containing columns of
-x, y, and value (e.g., the output from B<fundisp -l> which
-displays each image x and y and the number of counts at that
-position.) When the B<-l> (list) switch is used, the input file is
-taken to be a FITS or ASCII table containing (at least) three columns
-that specify the x and y image coordinates and the value of that
-image pixel. In this case, B<funimage> requires four extra
-arguments: xcolumn:xdims, ycolumn:ydims, vcolumn and bitpix=n. The x
-and y col:dim information takes the form:
-
- name:dim # values range from 1 to dim
- name:min:max # values range from min to max
- name:min:max:binsiz # dimensions scaled by binsize
-
-In particular, the min value should be used whenever the
-minimum coordinate value is something other than one. For example:
-
- funimage -l foo.lst foo.fits xcol:0:512 ycol:0:512 value bitpix=-32
-
-
-
-The list feature also can be used to read unnamed columns from standard
-input: simply replace the column name with a null string. Note
-that the dimension information is still required:
-
- funimage -l stdin foo.fits "":0:512 "":0:512 "" bitpix=-32
- 240 250 1
- 255 256 2
- ...
- ^D
-
-
-
-The list feature provides a simple way to generate a blank image.
-If you pass a Column-based Text File
-to funimage in which the text header contains the required image
-information, then funimage will correctly make a blank image. For
-example, consider the following text file (called foo.txt):
-
- x:I:1:10 y:I:1:10
- ------ ------
- 0 0
-
-This text file defines two columns, x and y, each of data type 32-bit int and
-image dimension 10. The command:
-
- funimage foo.txt foo.fits bitpix=8
-
-will create an empty FITS image called foo.fits containing a 10x10
-image of unsigned char:
-
- fundisp foo.fits
- 1 2 3 4 5 6 7 8 9 10
- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
- 10: 0 0 0 0 0 0 0 0 0 0
- 9: 0 0 0 0 0 0 0 0 0 0
- 8: 0 0 0 0 0 0 0 0 0 0
- 7: 0 0 0 0 0 0 0 0 0 0
- 6: 0 0 0 0 0 0 0 0 0 0
- 5: 0 0 0 0 0 0 0 0 0 0
- 4: 0 0 0 0 0 0 0 0 0 0
- 3: 0 0 0 0 0 0 0 0 0 0
- 2: 0 0 0 0 0 0 0 0 0 0
- 1: 1 0 0 0 0 0 0 0 0 0
-
-
-
-Note that the text file must contain at least
-one row of data. However, in the present example, event position 0,0 is
-outside the limits of the image and will be ignored. (You can, of course,
-use real x,y values to seed the image with data.)
-
-
-Furthermore, you can use the TEXT filter specification to obviate the need for
-an input text file altogether. The following command will create the same
-10x10 char image without an actual input file:
-
- funimage stdin'[TEXT(x:I:10,y:I:10)]' foo.fits bitpix=8 < /dev/null
-or
- funimage /dev/null'[TEXT(x:I:10,y:I:10)]' foo.fits bitpix=8
-
-
-
-You also can use either of these methods to generate a region mask simply
-by appending a region inside the filter brackets and specfying B<mask=all>
-along with the bitpix. For example, the following command will generate a
-10x10 char mask using 3 regions:
-
- funimage stdin'[TEXT(x:I:10,y:I:10),cir(5,5,4),point(10,1),-cir(5,5,2)]' \
- foo.fits bitpix=8,mask=all < /dev/null
-
-The resulting mask looks like this:
-
- fundisp foo.fits
- 1 2 3 4 5 6 7 8 9 10
- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
- 10: 0 0 0 0 0 0 0 0 0 0
- 9: 0 0 0 0 0 0 0 0 0 0
- 8: 0 0 1 1 1 1 1 0 0 0
- 7: 0 1 1 1 1 1 1 1 0 0
- 6: 0 1 1 0 0 0 1 1 0 0
- 5: 0 1 1 0 0 0 1 1 0 0
- 4: 0 1 1 0 0 0 1 1 0 0
- 3: 0 1 1 1 1 1 1 1 0 0
- 2: 0 0 1 1 1 1 1 0 0 0
- 1: 0 0 0 0 0 0 0 0 0 2
-
-
-
-You can use B<funimage> to create 1D image projections along the x
-or y axis using the B<-p [x|y]> switch. This capability works for
-both images and tables. For example consider a FITS table named ev.fits
-containing the following rows:
-
- X Y
- -------- --------
- 1 1
- 1 2
- 1 3
- 1 4
- 1 5
- 2 2
- 2 3
- 2 4
- 2 5
- 3 3
- 3 4
- 3 5
- 4 4
- 4 5
- 5 5
-
-
-A corresponding 5x5 image, called dim2.fits, would therefore contain:
-
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 5: 1 1 1 1 1
- 4: 1 1 1 1 0
- 3: 1 1 1 0 0
- 2: 1 1 0 0 0
- 1: 1 0 0 0 0
-
-A projection along the y axis can be performed on either the table or
-the image:
-
- funimage -p y ev.fits stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-
- funimage -p y dim2.fits stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-
-
-
-Furthermore, you can create a 1D image projection along any column of
-a table by using the B<bincols=[column]> filter specification and
-specifying a single column. For example, the following command
-projects the same 1D image along the y axis of a table as use of
-the B<-p y> switch:
-
- funimage ev.fits'[bincols=y]' stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-
-
-
-Examples:
-
-Create a FITS image from a FITS binary table:
-
- [sh] funimage test.ev test.fits
-
-
-
-Display the FITS image generated from a blocked section of FITS binary table:
-
- [sh] funimage "test.ev[2:8,3:7,2]" stdout | fundisp stdin
- 1 2 3
- --------- --------- ---------
- 1: 20 28 36
- 2: 28 36 44
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funimageget.pod b/funtools/doc/pod/funimageget.pod
deleted file mode 100644
index a569bba..0000000
--- a/funtools/doc/pod/funimageget.pod
+++ /dev/null
@@ -1,237 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunImageGet - get an image or image section>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void *FunImageGet(Fun fun, void *buf, char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunImageGet()> routine returns an binned image array of the
-specified section of a Funtools data file. If the input data are
-already of type image, the array is generated by extracting the
-specified image section and then binning it according to the specified
-bin factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-B<bincols=> keyword (using appropriate default columns as
-necessary), after which the image section and bin factors are
-applied. In both cases, the data is automatically converted from FITS
-to native format, if necessary.
-
-The first argument is the Funtools handle returned by
-FunOpen(). The second B<buf>
-argument is a pointer to a data buffer to fill. If NULL is specified,
-FunImageGet will allocate a buffer of the appropriate size. Generally
-speaking, you always want Funtools to allocate the buffer because
-the image dimensions will be determined by
-Funtools image sectioning
-on the command line.
-
-The third B<plist> (i.e., parameter list) argument is a string
-containing one or more comma-delimited B<keyword=value>
-parameters. It can be used to specify the return data type using the
-B<bitpix=> keyword. If no such keyword is specified in the plist
-string, the data type of the returned image is the same as the data type
-of the original input file, or is of type int for FITS binary tables.
-
-
-If the B<bitpix=> keyword is supplied in the plist string, the data
-type of the returned image will be one of the supported FITS image
-data types:
-
-
-=over 4
-
-
-
-
-=item *
-
-8 unsigned char
-
-
-=item *
-
-16 short
-
-
-=item *
-
-32 int
-
-
-=item *
-
--32 float
-
-
-=item *
-
--64 double
-
-
-=back
-
-
-For example:
-
- void *buf;
- /* extract data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, NULL)) )
- gerror(stderr, "could not FunImageGet: %s\n", iname);
-
-will allocate buf and retrieve the image in the file data format. In
-this case, you will have to determine the data type (using the
-FUN_SECT_BITPIX value in the
-FunInfoGet()
-routine)
-and then use a switch statement to process each data type:
-
- int bitpix;
- void *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- ...
- buf = FunImageGet(fun, NULL, NULL);
- FunInfoGet(fun, FUN_SECT_BITPIX, &bitpix, 0);
- /* set appropriate data type buffer to point to image buffer */
- switch(bitpix){
- case 8:
- cbuf = (unsigned char *)buf; break;
- case 16:
- sbuf = (short *)buf; break;
- case 32:
- ibuf = (int *)buf; break;
- ...
-
-See the
-imblank example code
-for more details on how to process an image when the data type is not
-specified beforehand.
-
-
-It often is easier to specify the data type directly:
-
- double *buf;
- /* extract data section into a double image buffer */
- if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) )
- gerror(stderr, "could not FunImageGet: %s\n", iname);
-
-will extract the image while converting to type double.
-
-
-On success, a pointer to the image buffer is returned. (This will be
-the same as the second argument, if NULL is not passed to the latter.)
-On error, NULL is returned.
-
-
-In summary, to retrieve image or row data into a binned image, you simply
-call FunOpen() followed by
-FunImageGet(). Generally, you
-then will want to call
-FunInfoGet()
-to retrieve the
-axis dimensions (and data type) of the section you are processing
-(so as to take account of sectioning and blocking of the original data):
-
- double *buf;
- int i, j;
- int dim1, dim2;
- ... other declarations, etc.
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* extract and bin the data section into a double float image buffer */
- if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) )
- gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
-
- /* get dimension information from funtools structure */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-
- /* loop through pixels and reset values below limit to value */
- for(i=0; i<dim1*dim2; i++){
- if( buf[i] <= blimit ) buf[i] = bvalue;
- }
-
-
-
-Another useful plist string value is "mask=all", which returns an
-image populated with regions id values. Image pixels within a region
-will contain the associated region id (region values start at 1), and
-otherwise will contain a 0 value. Thus, the returned image is a
-region mask which can be used to process the image data (which
-presumably is retrieved by a separate call to FunImageGet) pixel by
-pixel.
-
-
-If a FITS binary table or a non-FITS raw event file is being binned
-into an image, it is necessary to specify the two columns that will be
-used in the 2D binning. This usually is done on the command line
-using the B<bincols=(x,y)> keyword:
-
- funcnts "foo.ev[EVENTS,bincols=(detx,dety)]"
-
-
-
-The full form of the B<bincols=> specifier is:
-
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-
-These tlmin, tlmax, and binsiz specifiers can be omitted if TLMIN,
-TLMAX, and TDBIN header parameters (respectively) are present in the
-FITS binary table header for the column in question. Note that if
-only one parameter is specified, it is assumed to be tlmax, and tlmin
-defaults to 1. If two parameters are specified, they are assumed to be
-tlmin and tlmax.
-
-
-If B<bincols> is not specified on the command line, Funtools tries
-to use appropriate defaults: it looks for the environment variable
-FITS_BINCOLS (or FITS_BINKEY). Then it looks for the Chandra
-parameters CPREF (or PREFX) in the FITS binary table header. Failing
-this, it looks for columns named "X" and "Y" and if these are not
-found, it looks for columns containing the characters "X" and "Y".
-
-See Binning FITS Binary Tables and
-Non-FITS Event Files for more information.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funimageput.pod b/funtools/doc/pod/funimageput.pod
deleted file mode 100644
index 60eea7d..0000000
--- a/funtools/doc/pod/funimageput.pod
+++ /dev/null
@@ -1,145 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunImagePut - put an image to a Funtools file>
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix,
- char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-The B<FunImagePut()> routine outputs an image array to a FITS
-file. The image is written either as a primary header/data unit or as
-an image extension, depending on whether other data have already been
-written to the file. That is, if the current file position is at the
-beginning of the file, a primary HDU is written. Otherwise, an
-image extension is written.
-
-
-The first argument is the Funtools handle returned by
-FunOpen(). The second B<buf>
-argument is a pointer to a data buffer to write. The B<dim1>and
-B<dim2> arguments that follow specify the dimensions of the image,
-where dim1 corresponds to naxis1 and dim2 corresponds to naxis2. The
-B<bitpix> argument specifies the data type of the image and can
-have the following FITS-standard values:
-
-
-=over 4
-
-
-
-
-=item *
-
-8 unsigned char
-
-
-=item *
-
-16 short
-
-
-=item *
-
-32 int
-
-
-=item *
-
--32 float
-
-
-=item *
-
--64 double
-
-
-=back
-
-
-
-
-When FunTableRowPut() is first
-called for a given image, Funtools checks to see if the primary header
-has already been written (by having previously written an image or a
-binary table.) If not, this image is written to the primary HDU.
-Otherwise, it is written to an image extension.
-
-Thus, a simple program to generate a FITS image might look like this:
-
- int i;
- int dim1=512, dim2=512;
- double *dbuf;
- Fun fun;
- dbuf = malloc(dim1*dim2*sizeof(double));
- /* open the output FITS image, preparing to copy input params */
- if( !(fun = FunOpen(argv[1], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[1]);
- for(i=0; i<(dim1*dim2); i++){
- ... fill dbuf ...
- }
- /* put the image (header will be generated automatically */
- if( !FunImagePut(fun, buf, dim1, dim2, -64, NULL) )
- gerror(stderr, "could not FunImagePut: %s\n", argv[1]);
- FunClose(fun);
- free(dbuf);
-
-
-
-In addition, if a
-Funtools reference handle
-was specified when this table was opened, the
-parameters from this
-Funtools reference handle
-are merged into the new image
-header. Furthermore, if a reference image was specified during
-FunOpen(), the values of
-B<dim1>, B<dim2>, and B<bitpix> in the calling sequence
-can all be set to 0. In this case, default values are taken from the
-reference image section. This is useful if you are reading an image
-section in its native data format, processing it, and then writing
-that section to a new FITS file. See the
-imblank example code.
-
-
-The data are assumed to be in the native machine format and will
-automatically be swapped to FITS big-endian format if necessary. This
-behavior can be over-ridden with the B<convert=[true|false]>
-keyword in the B<plist> param list string.
-
-
-When you are finished writing the image, you should call
-FunFlush() to write out the FITS
-image padding. However, this is not necessary if you subsequently call
-FunClose() without doing any other I/O to the FITS file.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funimagerowget.pod b/funtools/doc/pod/funimagerowget.pod
deleted file mode 100644
index 91c776a..0000000
--- a/funtools/doc/pod/funimagerowget.pod
+++ /dev/null
@@ -1,137 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunImageRowGet - get row(s) of an image>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void *FunImageRowGet(Fun fun, void *buf, int rstart, int rstop,
- char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunImageRowGet()> routine returns one or more image rows
-from the specified section of a Funtools data file. If the input data
-are of type image, the array is generated by extracting the specified
-image rows and then binning them according to the specified bin
-factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-B<bincols=> keyword (using appropriate default columns as needed),
-after which the image section and bin factors are applied.
-
-
-The first argument is the Funtools handle returned by
-FunOpen(). The second B<buf>
-argument is a pointer to a data buffer to fill. If NULL is specified,
-FunImageGet() will allocate a buffer of the appropriate size.
-
-
-The third and fourth arguments specify the first and last row to
-retrieve. Rows are counted starting from 1, up to the value of
-FUN_YMAX(fun). The final B<plist> (i.e., parameter list) argument
-is a string containing one or more comma-delimited
-B<keyword=value> parameters. It can be used to specify the return
-data type using the B<bitpix=> keyword. If no such keyword is
-specified in the plist string, the data type of the image is the same
-as the data type of the original input file, or is of type int for
-FITS binary tables.
-
-
-If the B<bitpix=>value is supplied in the plist string, the data
-type of the returned image will be one of the supported FITS image
-data types:
-
-
-=over 4
-
-
-
-
-=item *
-
-8 unsigned char
-
-
-=item *
-
-16 short
-
-
-=item *
-
-32 int
-
-
-=item *
-
--32 float
-
-
-=item *
-
--64 double
-
-
-=back
-
-
-
-
-For example:
-
- double *drow;
- Fun fun;
- ... open files ...
- /* get section dimensions */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* allocate one line's worth */
- drow = malloc(dim1*sizeof(double));
- /* retrieve and process each input row (starting at 1) */
- for(i=1; i <= dim2; i++){
- if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", i, iname);
- /* reverse the line */
- for(j=1; j<=dim1; j++){
- ... process drow[j-1] ...
- }
- }
- ...
-
-
-
-On success, a pointer to the image buffer is returned. (This will be
-the same as the second argument, if NULL is not passed to the latter.)
-On error, NULL is returned. Note that the considerations described
-above for specifying binning columns in
-FunImageGet() also apply to
-B<FunImageRowGet()>.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funimagerowput.pod b/funtools/doc/pod/funimagerowput.pod
deleted file mode 100644
index 2ff05cc..0000000
--- a/funtools/doc/pod/funimagerowput.pod
+++ /dev/null
@@ -1,122 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunImageRowPut - put row(s) of an image>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void *FunImageRowPut(Fun fun, void *buf, int rstart, int rstop,
- int dim1, int dim2, int bitpix, char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunImageRowPut()> routine writes one or more image rows to
-the specified FITS image file. The first argument is the Funtools
-handle returned by FunOpen().
-The second B<buf> argument is a pointer to the row data buffer,
-while the third and fourth arguments specify the starting and ending
-rows to write. Valid rows values range from 1 to dim2, i.e., row is
-one-valued.
-
-
-The B<dim1>and B<dim2> arguments that follow specify the
-dimensions, where dim1 corresponds to naxis1 and dim2 corresponds to
-naxis2. The B<bitpix> argument data type of the image and can
-have the following FITS-standard values:
-
-
-=over 4
-
-
-
-
-=item *
-
-8 unsigned char
-
-
-=item *
-
-16 short
-
-
-=item *
-
-32 int
-
-
-=item *
-
--32 float
-
-
-=item *
-
--64 double
-
-
-=back
-
-
-
-For example:
-
- double *drow;
- Fun fun, fun2;
- ... open files ...
- /* get section dimensions */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* allocate one line's worth */
- drow = malloc(dim1*sizeof(double));
- /* retrieve and process each input row (starting at 1) */
- for(i=1; i <= dim2; i++){
- if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", i, iname);
- ... process drow ...
- if( !FunImageRowPut(fun2, drow, i, i, 64, NULL) )
- gerror(stderr, "can't FunImageRowPut: %d %s\n", i, oname);
- }
- ...
-
-
-
-The data are assumed to be in the native machine format and will
-automatically be swapped to big-endian FITS format if necessary. This
-behavior can be over-ridden with the B<convert=[true|false]>
-keyword in the B<plist> param list string.
-
-
-When you are finished writing the image, you should call
-FunFlush() to write out the FITS
-image padding. However, this is not necessary if you subsequently call
-FunClose() without doing any other I/O to the FITS file.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funindex.pod b/funtools/doc/pod/funindex.pod
deleted file mode 100644
index cdc2fc7..0000000
--- a/funtools/doc/pod/funindex.pod
+++ /dev/null
@@ -1,83 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funindex - create an index for a column of a FITS binary table>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funindex <switches> <iname> <key> [oname]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- NB: these options are not compatible with Funtools processing. Please
- use the defaults instead.
- -c # compress output using gzip"
- -a # ASCII output, ignore -c (default: FITS table)"
- -f # FITS table output (default: FITS table)"
- -l # long output, i.e. with key value(s) (default: long)"
- -s # short output, i.e. no key value(s) (default: long)"
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The funindex script creates an index for the specified column (key) by
-running funtable -s (sort) and then saving the column value and the
-record number for each sorted row. This index will be used automatically
- by funtools filtering of that column, provided the index file's modification
-date is later than that of the data file.
-
-
-The first required argument is the name of the FITS binary table
-to index. Please note that text files cannot be indexed at this time.
-The second required argument is the column (key) name to index. While
-multiple keys can be specified in principle, the funtools index processing
-assume a single key and will not recognize files containing multiple keys.
-
-
-By default, the output index file name is [root]_[key].idx, where [root]
-is the root of the input file. Funtools looks for this specific file name
-when deciding whether to use an index for faster filtering. Therefore, the
-optional third argument (output file name) should not be used for funtools
-processing.
-
-
-For example, to create an index on column Y for a given FITS file, use:
-
- funindex foo.fits Y
-
-This will generate an index named foo_y.idx, which will be used by funtools
-for filters involving the Y column.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funindexes.pod b/funtools/doc/pod/funindexes.pod
deleted file mode 100644
index e4cabaa..0000000
--- a/funtools/doc/pod/funindexes.pod
+++ /dev/null
@@ -1,215 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funindexes: Using Indexes to Filtering Rows in a Table>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the user interface for
-filtering rows in binary tables with indexes.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-Funtools Table Filtering allows rows in a
-table to be selected based on the values of one or more columns in the
-row. Because the actual filter code is compiled on the fly, it is very
-efficient. For very large files (hundreds of Mb or larger), however,
-evaluating the filter expression on each row can take a long time. Therefore,
-funtools supports index files for columns, which are used automatically during
-filtering to reduce dramatically the number of row evaluations performed.
-The speed increase for indexed filtering can be an order of magnitude or
-more, depending on the size of the file.
-
-
-The funindex program creates a
-index on column in a binary table. For example, to create an index
-for the column pi in the file huge.fits, use:
-
- funindex huge.fits pi
-
-This will create an index named huge_pi.idx.
-
-
-When a filter expression is initialized for row evaluation, funtools
-looks for an index file for each column in the filter expression. If
-found, and if the file modification date of the index file is later
-than that of the data file, then the index will be used to reduce the
-number of rows that are evaluated in the filter. When <A
-HREF="./regions.html">Spatial Region Filtering is part of the
-expression, the columns associated with the region checked for index
-files.
-
-
-If an index file is not available for a given column, then in general,
-all rows must be checked when that column is part of a filter
-expression. This is not true, however, when a non-indexed column is
-part of an AND expression. In this case, only the rows that pass the
-other part of the AND expression need to be checked. Thus, in some cases,
-filtering speed can increase significantly even if all columns are not
-indexed.
-
-
-Also note that certain types of filter expression syntax cannot make
-use of indices. For example, calling functions with column names as
-arguments implies that all rows must be checked against the function
-value. Once again, however, if this function is part of an AND
-expression, then a significant improvement in speed still is possible
-if the other part of the AND expression is indexed.
-
-
-As an example, note below the dramatic speedup in searching a 1 Gb
-file using an AND filter, even when one of the columns (pha) has no
-index:
-
-
-bynars-16: time fundisp huge.fits'[idx_use=0,idx_debug=1,pha=2348&&cir 4000 4000 1]' "x y pha"
- x y pha
------------ ----------- ----------
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
-42.36u 13.07s 6:42.89 13.7%
-
-bynars-17: time fundisp huge.fits'[idx_use=1,idx_debug=1,pha=2348&&cir 4000 4000 1]' "x y pha"
- x y pha
------------ ----------- ----------
-idxeq: [INDEF]
-idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
-idxand(1): INDEF [IDX_OR_SORT]
-idxall(1): [IDX_OR_SORT]
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
- 3999.48 4000.47 2348
-1.55u 0.37s 1:19.80 2.4%
-
-
-When all columns are indexed, the increase in speed can be even more dramatic:
-
-bynars-20: time fundisp huge.fits'[idx_use=0,idx_debug=1,pi=770&&cir 4000 4000 1]' "x y pi"
- x y pi
------------ ----------- ----------
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
-42.60u 12.63s 7:28.63 12.3%
-
-bynars-21: time fundisp huge.fits'[idx_use=1,idx_debug=1,pi=770&&cir 4000 4000 1]' "x y pi"
- x y pi
------------ ----------- ----------
-idxeq: pi start=9473025,stop=9492240 => pi[ROW 9473025:9492240]
-idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
-idxor sort/merge: pi[ROW 9473025:9492240] [IDX_OR_SORT]
-idxmerge(5): [IDX_OR_SORT] pi[ROW]
-idxall(1): [IDX_OR_SORT]
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
- 3999.48 4000.47 770
-1.67u 0.30s 0:24.76 7.9%
-
-
-
-The miracle of indexed filtering (and indeed, of any indexing) is due
-to the speed of the binary search on the index, which is of order
-log2(n) instead of n. (The funtools binary search method is taken from
-http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary, to whom
-grateful acknowledgement is made.) This means that the larger the
-file, the better the performance. Conversely, it also means that
-for small files, using an index (and the overhead involved) can slow
-filtering down somewhat. Our tests indicate that on a file containing
-a few tens of thousands of rows, indexed filtering can be 10-20
-percent slower. Of course, your mileage will vary with conditions
-(disk access speed, amount of available memory, process load, etc.)
-
-
-Any problem encountered during index processing is supposed to result in
-indexing being turned off, replaced by filtering all rows. You can turn
-filtering off manually by setting the idx_use variable to 0 (in a filter
-expression) or the FILTER_IDX_USE environment variable to 0 (in the global
-environment). Debugging output showing how the indexes are being processed can
-be displayed to stderr by setting the idx_debug variable to 1 (in a filter
-expression) or the FILTER_IDX_DEBUG environment variable to 1 (in the global
-environment).
-
-
-Currently, indexed filtering only works with FITS binary tables and raw
-event files. It does not work with text files. This restriction might be
-removed in a future release.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funinfoget.pod b/funtools/doc/pod/funinfoget.pod
deleted file mode 100644
index 456ac0c..0000000
--- a/funtools/doc/pod/funinfoget.pod
+++ /dev/null
@@ -1,226 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunInfoGet - get information from Funtools struct>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunInfoGet(Fun fun, int type, char *addr, ...)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunInfoGet()> routine returns information culled from the
-Funtools structure. The first argument is the Fun handle from which
-information is to be retrieved. This first required argument is followed
-by a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to retrieve and the
-address where the information is to be stored. The list is terminated by a 0.
-The routine returns the number of get actions performed.
-
-
-The full list of available information is described below. Please note
-that only a few of these will be useful to most application developers.
-For imaging applications, the most important types are:
-
- FUN_SECT_DIM1 int /* dim1 for section */
- FUN_SECT_DIM2 int /* dim2 for section */
- FUN_SECT_BITPIX int /* bitpix for section */
-
-These would be used to determine the dimensions and data type of image
-data retrieved using the
-FunImageGet() routine. For
-example:
-
- /* extract and bin the data section into an image buffer */
- buf = FunImageGet(fun, NULL, NULL);
- /* get required information from funtools structure.
- this should come after the FunImageGet() call, in case the call
- changed sect_bitpix */
- FunInfoGet(fun,
- FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- 0);
- /* loop through pixels and reset values below limit to value */
- for(i=0; i<dim1*dim2; i++){
- switch(bitpix){
- case 8:
- if( cbuf[i] <= blimit ) cbuf[i] = bvalue;
- ...
- }
-
-It is important to bear in mind that the call to
-FunImageGet()
-can change the value of FUN_SECT_BITPIX (e.g. if "bitpix=n" is passed
-in the param list). Therefore, a call to
-FunInfoGet()
-should be made B<after> the call to
-FunImageGet(),
-in order to retrieve the updated bitpix value.
-See the imblank example code for more
-details.
-
-
-It also can be useful to retrieve the World Coordinate System
-information from the Funtools structure. Funtools uses the the WCS
-Library developed by Doug Mink at SAO, which is available
-here.
-(More information about the WCSTools project in general can be found
-here.)
-The FunOpen() routine initializes
-two WCS structures that can be used with this WCS Library.
-Applications can retrieve either of these two WCS structures using
-B<FunInfoGet()>:
-
- FUN_WCS struct WorldCoor * /* wcs structure, for image coordinates*/
- FUN_WCS0 struct WorldCoor * /* wcs structure, for physical coordinates */
-
-The structure retrieved by FUN_WCS is a WCS library handle containing
-parameters suitable for use with image coordinates, regardless of whether the
-data are images or tables. For this structure, the WCS reference point
-(CRPIX) has been converted to image coordinates if the underlying file
-is a table (and therefore in physical coordinates). You therefore must
-ensure that the positions being passed to a routine like pix2wcs are in
-image coordinates. The FUN_WCS0 structure has not had its WCS
-reference point converted to image coordinates. It therefore is useful
-when passing processing physical coordinates from a table.
-
-
-Once a WCS structure has been retrieved, it can be used as the first
-argument to the WCS library routines. (If the structure is NULL, no
-WCS information was contained in the file.) The two important WCS routines
-that Funtools uses are:
-
- #include <wcs.h&gt
- void pix2wcs (wcs,xpix,ypix,xpos,ypos)
- struct WorldCoor *wcs; /* World coordinate system structure */
- double xpix,ypix; /* x and y coordinates in pixels */
- double *xpos,*ypos; /* RA and Dec in degrees (returned) */
-
-
-which converts pixel coordinates to sky coordinates, and:
-
-
- void wcs2pix (wcs, xpos, ypos, xpix, ypix, offscl)
- struct WorldCoor *wcs; /* World coordinate system structure */
- double xpos,ypos; /* World coordinates in degrees */
- double *xpix,*ypix; /* coordinates in pixels */
- int *offscl; /* 0 if within bounds, else off scale */
-
-which converts sky coordinates to pixel coordinates. Again, please note
-that the wcs structure returned by FUN_WCS assumes that image coordinates
-are passed to the pix2wcs routine, while FUN_WCS0 assumes that physical
-coordinates are passed.
-
-
-Note that funtools.h file automatically includes wcs.h. An example
-program that utilizes these WCS structure to call WCS Library routines
-is twcs.c.
-
-
-The following is the complete list of information that can be returned:
-
- name type comment
- --------- -------- ---------------------------------------------
- FUN_FNAME char * /* file name */
- FUN_GIO GIO /* gio handle */
- FUN_HEADER FITSHead /* fitsy header struct */
- FUN_TYPE int /* TY_TABLE,TY_IMAGE,TY_EVENTS,TY_ARRAY */
- FUN_BITPIX int /* bits/pixel in file */
- FUN_MIN1 int /* tlmin of axis1 -- tables */
- FUN_MAX1 int /* tlmax of axis1 -- tables */
- FUN_MIN2 int /* tlmin of axis2 -- tables */
- FUN_MAX2 int /* tlmax of axis2 -- tables */
- FUN_DIM1 int /* dimension of axis1 */
- FUN_DIM2 int /* dimension of axis2 */
- FUN_ENDIAN int /* 0=little, 1=big endian */
- FUN_FILTER char * /* supplied filter */
- FUN_IFUN FITSHead /* pointer to reference header */
- FUN_IFUN0 FITSHead /* same as above, but no reset performed */
- /* image information */
- FUN_DTYPE int /* data type for images */
- FUN_DLEN int /* length of image in bytes */
- FUN_DPAD int /* padding to end of extension */
- FUN_DOBLANK int /* was blank keyword defined? */
- FUN_BLANK int /* value for blank */
- FUN_SCALED int /* was bscale/bzero defined? */
- FUN_BSCALE double /* bscale value */
- FUN_BZERO double /* bzero value */
- /* table information */
- FUN_NROWS int /* number of rows in file (naxis2) */
- FUN_ROWSIZE int /* size of user row struct */
- FUN_BINCOLS char * /* specified binning columns */
- FUN_OVERFLOW int /* overflow detected during binning? */
- /* array information */
- FUN_SKIP int /* bytes to skip in array header */
- /* section information */
- FUN_SECT_X0 int /* low dim1 value of section */
- FUN_SECT_X1 int /* hi dim1 value of section */
- FUN_SECT_Y0 int /* low dim2 value of section */
- FUN_SECT_Y1 int /* hi dim2 value of section */
- FUN_SECT_BLOCK int /* section block factor */
- FUN_SECT_BTYPE int /* 's' (sum), 'a' (average) for binning */
- FUN_SECT_DIM1 int /* dim1 for section */
- FUN_SECT_DIM2 int /* dim2 for section */
- FUN_SECT_BITPIX int /* bitpix for section */
- FUN_SECT_DTYPE int /* data type for section */
- FUN_RAWBUF char * /* pointer to raw row buffer */
- FUN_RAWSIZE int /* byte size of raw row records */
- /* column information */
- FUN_NCOL int /* number of row columns defined */
- FUN_COLS FunCol /* array of row columns */
- /* WCS information */
- FUN_WCS struct WorldCoor * /* wcs structure, converted for images*/
- FUN_WCS0 struct WorldCoor * /* wcs structure, not converted */
-
-
-
-Row applications would not normally need any of this information.
-An example of how these values can be used in more complex programs is
-the evnext example code. In this program, the
-time value for each row is changed to be the value of the succeeding
-row. The program thus reads the time values for a batch of rows,
-changes the time values to be the value for the succeeding row, and
-then merges these changed time values back with the other columns to
-the output file. It then reads the next batch, etc.
-
-
-This does not work for the last row read in each batch, since there
-is no succeeding row until the next batch is read. Therefore, the
-program saves that last row until it has read the next batch, then
-processes the former before starting on the new batch. In order to
-merge the last row successfully, the code uses FUN_RAWBUF to save
-and restore the raw input data associated with each batch of
-rows. Clearly, this requires some information about how funtools
-works internally. We are happy to help you write such programs as the
-need arises.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funinfoput.pod b/funtools/doc/pod/funinfoput.pod
deleted file mode 100644
index 5124dfc..0000000
--- a/funtools/doc/pod/funinfoput.pod
+++ /dev/null
@@ -1,180 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunInfoPut - put information into a Funtools struct>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunInfoPut(Fun fun, int type, char *addr, ...)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunInfoPut()> routine puts information into a Funtools
-structure. The first argument is the Fun handle from which
-information is to be retrieved. After this first required argument
-comes a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to store and the
-address of the new information to store in the struct. The variable
-list is terminated by a 0. The routine returns the number of put
-actions performed.
-
-
-The full list of available information is described above with the
-FunInfoPut() routine. Although
-use of this routine is expected to be uncommon, there is one
-important situation in which it plays an essential part: writing
-multiple extensions to a single output file.
-
-
-For input, multiple extensions are handled by calling
-FunOpen() for each extension to be
-processed. When opening multiple inputs, it sometimes is the case that
-you will want to process them and then write them (including their
-header parameters) to a single output file. To accomplish this, you
-open successive input extensions using
-FunOpen() and then call
-B<FunInfoPut()> to set the
-Funtools reference handle
-of the output file to that of the newly opened input extension:
-
- /* open a new input extension */
- ifun=FunOpen(tbuf, "r", NULL)) )
- /* make the new extension the reference handle for the output file */
- FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
-
-
-Resetting FUN_IFUN has same effect as when a funtools handle is passed
-as the final argument to
-FunOpen(). The state of the output
-file is reset so that a new extension is ready to be written.
-Thus, the next I/O call on the output extension will output the
-header, as expected.
-
-
-For example, in a binary table, after resetting FUN_IFUN you can then
-call FunColumnSelect() to
-select the columns for output. When you then call
-FunImagePut() or <A
-HREF="./library.html#funtablerowput">FunTableRowPut(), a new
-extension will be written that contains the header parameters from the
-reference extension. Remember to call
-FunFlush() to complete output of a
-given extension.
-
-
-A complete example of this capability is given
-in the evcol example code.
-The central algorithm is:
-
-
-=over 4
-
-
-
-
-=item *
-
-open the output file without a reference handle
-
-
-=item *
-
-loop: open each input extension in turn
-
-
-=over 4
-
-
-
-
-=item *
-
-set the reference handle for output to the newly opened input extension
-
-
-=item *
-
-read the input rows or image and perform processing
-
-
-=item *
-
-write new rows or image to the output file
-
-
-=item *
-
-flush the output
-
-
-=item *
-
-close input extension
-
-
-=back
-
-
-
-
-=item *
-
-close output file
-
-
-=back
-
-
-Note that FunFlush() is called
-after processing each input extension in order to ensure that the
-proper padding is written to the output file. A call to
-FunFlush() also ensures that the
-extension header is written to the output file in the case where there
-are no rows to output.
-
-
-If you wish to output a new extension without using a
-Funtools reference handle, you can
-call FunInfoPut() to reset the FUN_OPS value directly. For a binary
-table, you would then call FunColumnSelect() to set up the columns for
-this new extension.
-
- /* reset the operations performed on this handle */
- int ops=0;
- FunInfoPut(ofun, FUN_OPS, &ops, 0);
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
- NULL);
-
-Once the FUN_OPS variable has been reset, the next I/O call on the
-output extension will output the header, as expected.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funjoin.pod b/funtools/doc/pod/funjoin.pod
deleted file mode 100644
index d7830f9..0000000
--- a/funtools/doc/pod/funjoin.pod
+++ /dev/null
@@ -1,233 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funjoin - join two or more FITS binary tables on specified columns>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funjoin [switches] <ifile1> <ifile2> ... <ifilen> <ofile>
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -a cols # columns to activate in all files
- -a1 cols ... an cols # columns to activate in each file
- -b 'c1:bvl,c2:bv2' # blank values for common columns in all files
- -bn 'c1:bv1,c2:bv2' # blank values for columns in specific files
- -j col # column to join in all files
- -j1 col ... jn col # column to join in each file
- -m min # min matches to output a row
- -M max # max matches to output a row
- -s # add 'jfiles' status column
- -S col # add col as status column
- -t tol # tolerance for joining numeric cols [2 files only]
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-B<funjoin> joins rows from two or more (up to 32)
-FITS Binary Table files, based on the values
-of specified join columns in each file. NB: the join columns must have
-an index file associated with it. These files are generated using the
-B<funindex> program.
-
-
-The first argument to the program specifies the first input FITS table
-or raw event file. If "stdin" is specified, data are read from the
-standard input. Subsequent arguments specify additional event files
-and tables to join. The last argument is the output FITS file.
-
-
-NB: Do B<not> use Funtools Bracket
-Notation to specify FITS extensions and row filters when running
-funjoin or you will get wrong results. Rows are accessed and joined
-using the index files directly, and this bypasses all filtering.
-
-
-The join columns are specified using the B<-j col> switch (which
-specifies a column name to use for all files) or with B<-j1 col1>,
-B<-j2 col2>, ... B<-jn coln> switches (which specify a column
-name to use for each file). A join column must be specified for each file.
-If both B<-j col> and B<-jn coln> are specified for a given
-file, then the latter is used. Join columns must either be of type
-string or type numeric; it is illegal to mix numeric and string
-columns in a given join. For example, to join three files using the
-same key column for each file, use:
-
- funjoin -j key in1.fits in2.fits in3.fits out.fits
-
-A different key can be specified for the third file in this way:
-
- funjoin -j key -j3 otherkey in1.fits in2.fits in3.fits out.fits
-
-
-
-The B<-a "cols"> switch (and B<-a1 "col1">,
-B<-a2 "cols2"> counterparts) can be used to specify columns to
-activate (i.e. write to the output file) for each input file. By
-default, all columns are output.
-
-
-If two or more columns from separate files have the same name, the
-second (and subsequent) columns are renamed to have an underscore
-and a numeric value appended.
-
-
-The B<-m min> and B<-M max> switches specify the minimum
-and maximum number of joins required to write out a row. The default
-minimum is 0 joins (i.e. all rows are written out) and the default maximum
-is 63 (the maximum number of possible joins with a limit of 32 input files).
-For example, to write out only those rows in which exactly two files
-have columns that match (i.e. one join):
-
- funjoin -j key -m 1 -M 1 in1.fits in2.fits in3.fits ... out.fits
-
-
-
-A given row can have the requisite number of joins without all of the
-files being joined (e.g. three files are being joined but only two
-have a given join key value). In this case, all of the columns of the
-non-joined file are written out, by default, using blanks (zeros or NULLs).
-The B<-b c1:bv1,c2:bv2> and
-B<-b1 'c1:bv1,c2:bv2' -b2 'c1:bv1,c2:bv2' ...>
-switches can be used to set the blank value for columns common to all
-files and/or columns in a specified file, respectively. Each blank value
-string contains a comma-separated list of column:blank_val specifiers.
-For floating point values (single or double), a case-insensitive string
-value of "nan" means that the IEEE NaN (not-a-number) should be
-used. Thus, for example:
-
- funjoin -b "AKEY:???" -b1 "A:-1" -b3 "G:NaN,E:-1,F:-100" ...
-
-means that a non-joined AKEY column in any file will contain the
-string "???", the non-joined A column of file 1 will contain a value
-of -1, the non-joined G column of file 3 will contain IEEE NaNs, while
-the non-joined E and F columns of the same file will contain values -1
-and -100, respectively. Of course, where common and specific blank values
-are specified for the same column, the specific blank value is used.
-
-
-To distinguish which files are non-blank components of a given row,
-the B<-s> (status) switch can be used to add a bitmask column named
-"JFILES" to the output file. In this column, a bit is set for each
-non-blank file composing the given row, with bit 0 corresponds to the
-first file, bit 1 to the second file, and so on. The file names
-themselves are stored in the FITS header as parameters named JFILE1,
-JFILE2, etc. The B<-S col> switch allows you to change the name
-of the status column from the default "JFILES".
-
-
-A join between rows is the Cartesian product of all rows in one file
-having a given join column value with all rows in a second file having
-the same value for its join column and so on. Thus, if file1 has 2
-rows with join column value 100, file2 has 3 rows with the same value,
-and file3 has 4 rows, then the join results in 2*3*4=24 rows being output.
-
-
-The join algorithm directly processes the index file associated with
-the join column of each file. The smallest value of all the current
-columns is selected as a base, and this value is used to join
-equal-valued columns in the other files. In this way, the index files
-are traversed exactly once.
-
-
-The B<-t tol> switch specifies a tolerance value for numeric
-columns. At present, a tolerance value can join only two files at a
-time. (A completely different algorithm is required to join more than
-two files using a tolerance, somethng we might consider implementing
-in the future.)
-
-
-The following example shows many of the features of funjoin. The input files
-t1.fits, t2.fits, and t3.fits contain the following columns:
-
- [sh] fundisp t1.fits
- AKEY KEY A B
- ----------- ------ ------ ------
- aaa 0 0 1
- bbb 1 3 4
- ccc 2 6 7
- ddd 3 9 10
- eee 4 12 13
- fff 5 15 16
- ggg 6 18 19
- hhh 7 21 22
-
-fundisp t2.fits
- AKEY KEY C D
- ----------- ------ ------ ------
- iii 8 24 25
- ggg 6 18 19
- eee 4 12 13
- ccc 2 6 7
- aaa 0 0 1
-
-fundisp t3.fits
- AKEY KEY E F G
------------- ------ -------- -------- -----------
- ggg 6 18 19 100.10
- jjj 9 27 28 200.20
- aaa 0 0 1 300.30
- ddd 3 9 10 400.40
-
-
-
-Given these input files, the following funjoin command:
-
-
- funjoin -s -a1 "-B" -a2 "-D" -a3 "-E" -b \
- "AKEY:???" -b1 "AKEY:XXX,A:255" -b3 "G:NaN,E:-1,F:-100" \
- -j key t1.fits t2.fits t3.fits foo.fits
-
-will join the files on the KEY column, outputting all columns except B
-(in t1.fits), D (in t2.fits) and E (in t3.fits), and setting blank
-values for AKEY (globally, but overridden for t1.fits) and A (in file
-1) and G, E, and F (in file 3). A JFILES column will be output to
-flag which files were used in each row:
-
-
- AKEY KEY A AKEY_2 KEY_2 C AKEY_3 KEY_3 F G JFILES
- ------------ ------ ------ ------------ ------ ------ ------------ ------ -------- ----------- --------
- aaa 0 0 aaa 0 0 aaa 0 1 300.30 7
- bbb 1 3 ??? 0 0 ??? 0 -100 nan 1
- ccc 2 6 ccc 2 6 ??? 0 -100 nan 3
- ddd 3 9 ??? 0 0 ddd 3 10 400.40 5
- eee 4 12 eee 4 12 ??? 0 -100 nan 3
- fff 5 15 ??? 0 0 ??? 0 -100 nan 1
- ggg 6 18 ggg 6 18 ggg 6 19 100.10 7
- hhh 7 21 ??? 0 0 ??? 0 -100 nan 1
- XXX 0 255 iii 8 24 ??? 0 -100 nan 2
- XXX 0 255 ??? 0 0 jjj 9 28 200.20 4
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funlib.pod b/funtools/doc/pod/funlib.pod
deleted file mode 100644
index 354e217..0000000
--- a/funtools/doc/pod/funlib.pod
+++ /dev/null
@@ -1,542 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunLib: the Funtools Programming Interface>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-A description of the Funtools library.
-
-
-
-=head1 DESCRIPTION
-
-
-
-B<Introduction to the Funtools Programming Interface>
-
-To create a Funtools application, you need to include
-the funtools.h definitions file in your code:
-
- #include <funtools.h>
-
-
-You then call Funtools subroutines and functions to access Funtools data.
-The most important routines are:
-
-
-=over 4
-
-
-
-
-
-
-=item *
-
-FunOpen: open a Funtools file
-
-
-=item *
-
-FunInfoGet: get info about an image or table
-
-
-=item *
-
-FunImageGet: retrieve image data
-
-
-=item *
-
-FunImageRowGet: retrieve image data by row
-
-
-=item *
-
-FunImagePut: output image data
-
-
-=item *
-
-FunImageRowPut: output image data by row
-
-
-=item *
-
-FunColumnSelect: select columns in a table for access
-
-
-=item *
-
-FunTableRowGet: retrieve rows from a table
-
-
-=item *
-
-FunTableRowPut: output rows to a table
-
-
-=item *
-
-FunClose: close a Funtools file
-
-
-=back
-
-
-
-Your program must be linked against the libfuntools.a library,
-along with the math library. The following libraries also might be required
-on your system:
-
-
-=over 4
-
-
-
-
-=item *
-
--lsocket -lnsl for socket support
-
-
-=item *
-
--ldl for dynamic loading
-
-
-=back
-
-
-
-For example, on a Solaris system using gcc, use the following link line:
-
- gcc -o foo foo.c -lfuntools -lsocket -lnsl -ldl -lm
-
-On a Solaris system using Solaris cc, use the following link line:
-
- gcc -o foo foo.c -lfuntools -lsocket -lnsl -lm
-
-On a Linux system using gcc, use the following link line:
-
- gcc -o foo foo.c -lfuntools -ldl -lm
-
-Once configure has built a Makefile on your platform, the required
-"extra" libraries (aside from -lm, which always is required) are
-specified in that file's EXTRA_LIBS variable. For example, under
-Linux you will find:
-
- grep EXTRA_LIBS Makefile
- EXTRA_LIBS = -ldl
- ...
-
-
-
-The Funtools library contains both the zlib library
-(http://www.gzip.org/zlib/) and Doug Mink's WCS library
-(http://tdc-www.harvard.edu/software/wcstools/). It is not necessary
-to put these libraries on a Funtools link line. Include files
-necessary for using these libraries are installed in the Funtools
-include directory.
-
-B<Funtools Programming Tutorial>
-
-The
-FunOpen()
-function is used to open a FITS file, an array, or a raw event file:
-
- /* open the input FITS file for reading */
- ifun = FunOpen(iname, "r", NULL);
- /* open the output FITS file for writing, and connect it to the input file */
- ofun = FunOpen(iname, "w", ifun);
-
-A new output file can inherit header parameters automatically from
-existing input file by passing the input Funtools handle as the last
-argument to the new file's
-FunOpen()
-call as shown above.
-
-
-For image data, you then can call
-FunImageGet()
-to read an image into memory.
-
- float buf=NULL;
- /* extract and bin the data section into an image buffer */
- buf = FunImageGet(fun, NULL, "bitpix=-32");
-
-If the (second) buf argument to this call is NULL, buffer space is allocated
-automatically. The (third) plist argument can be used to specify the
-return data type of the array. If NULL is specified, the data type of
-the input file is used.
-
-
-To process an image buffer, you would generally make a call to
-FunInfoGet() to determine the
-dimensions of the image (which may have been changed from the original
-file dimensions due to Funtools image
-sectioning on the command line). In a FITS image, the index along
-the dim1 axis varies most rapidly, followed by the dim2 axis, etc.
-Thus, to access each pixel in an 2D image, use a double loop such as:
-
- buf = FunImageGet(fun, NULL, "bitpix=-32");
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- for(i=1; i<=dim2; i++){
- for(j=1; j<=dim1; j++){
- ... process buf[((i-1)*dim1)+(j-1)] ...
- }
- }
-
-or:
-
- buf = FunImageGet(fun, NULL, "bitpix=-32");
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- for(i=0; i<(dim1*dim2); i++){
- ... process buf[i] ...
- }
-
-Finally, you can write the resulting image to disk using
-FunImagePut():
-
- FunImagePut(fun2, buf, dim1, dim2, -32, NULL);
-
-Note that Funtools automatically takes care of book-keeping tasks such as
-reading and writing FITS headers (although you can, of course, write
-your own header or add your own parameters to a header).
-
-
-For binary tables and raw event files, a call to
-FunOpen()
-will be followed by a call to the
-FunColumnSelect()
-routine to select columns to be read from the input file and/or
-written to the output file:
-
-
- typedef struct evstruct{
- double time;
- int time2;
- } *Ev, EvRec;
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- "time", "D", "rw", FUN_OFFSET(Ev, time),
- "time2", "J", "w", FUN_OFFSET(Ev, time2),
- NULL);
-
-Columns whose (third) mode argument contains an "r" are "readable",
-i.e., columns will be read from the input file and converted into the
-data type specified in the call's second argument. These columns
-values then are stored in the specified offset of the user record
-structure. Columns whose mode argument contains a "w" are
-"writable", i.e., these values will be written to the output file.
-The
-FunColumnSelect()
-routine also offers the option of automatically merging user
-columns with the original input columns when writing the output
-rows.
-
-
-Once a set of columns has been specified, you can retrieve rows using
-FunTableRowGet(),
-and write the rows using
-FunTableRowPut():
-
- Ev ebuf, ev;
- /* get rows -- let routine allocate the array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- /* time2 is generated here */
- ev->time2 = (int)(ev->time+.5);
- /* change the input time as well */
- ev->time = -(ev->time/10.0);
- }
- /* write out this batch of rows with the new column */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
-The input rows are retrieved into an array of user structs, which
-can be accessed serially as shown above. Once again, Funtools
-automatically takes care of book-keeping tasks such as reading and writing
-FITS headers (although you can, of course, write your own header or
-add your own parameters to a header).
-
-
-When all processing is done, you can call
-FunClose()
-to close the file(s):
-
- FunClose(fun2);
- FunClose(fun);
-
-
-
-These are the basics of processing FITS files (and arrays or raw event
-data) using Funtools. The routines in these examples are described in
-more detail below, along with a few other routines that support
-parameter access, data flushing, etc.
-
-B<Compiling and Linking>
-
-To create a Funtools application, a software developer will include
-the funtools.h definitions file in Funtools code:
-
- #include <funtools.h>
-
-The program is linked against the libfuntools.a library, along with the
-math library (and the dynamic load library, if the latter is available
-on your system):
-
- gcc -o foo foo.c -lfuntools -ldl -lm
-
-
-If gcc is used, Funtools filtering can be performed using dynamically
-loaded shared objects that are built at run-time. Otherwise, filtering
-is performed using a slave process.
-
-Funtools has been built on the following systems:
-
-
-=over 4
-
-
-
-
-=item *
-
-Sun/Solaris 5.X
-
-
-=item *
-
-Linux/RedHat Linux 5.X,6.X,7.X
-
-
-=item *
-
-Dec Alpha/OSF1 V4.X
-
-
-=item *
-
-WindowsNT/Cygwin 1.0
-
-
-=item *
-
-SGI/IRIX64 6.5
-
-
-=back
-
-
-
-B<A Short Digression on Subroutine Order>
-
-There is a natural order for all I/O access libraries. You would not
-think of reading a file without first opening it, or writing a file
-after closing it. A large part of the experiment in funtools is to use
-the idea of "natural order" as a means of making programming
-easier. We do this by maintaining the state of processing for a given
-funtools file, so that we can do things like write headers and flush
-extension padding at the right time, without you having to do it.
-
-
-For example, if you open a new funtools file for writing using
-FunOpen(),
-then generate an array of image data and call
-FunImagePut(),
-funtools knows to write the image header automatically.
-There is no need to think about writing a standard header.
-Of course, you can add parameters to the file first by
-calling one of the
-FunParamPut()
-routines, and these parameters will automatically be added
-to the header when it is written out. There still is no
-need to write the header explicitly.
-
-
-Maintaining state in this way means that there are certain rules of
-order which should be maintained in any funtools program. In particular,
-we strongly recommend the following ordering rules be adhered to:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-When specifying that input extensions be copied to an output file
-via a reference handle, open the output file B<before> reading the
-input file. (Otherwise the initial copy will not occur).
-
-
-
-=item *
-
-Always write parameters to an output file using one of the
-FunParamPut() calls
-B<before> writing any data. (This is a good idea for all FITS
-libraries, to avoid having to recopy data is the FITS header needs
-to be extended by adding a single parameter.)
-
-
-
-=item *
-
-If you retrieve an image, and need to know the data
-type, use the FUN_SECT_BITPIX option of
-FunInfoGet(),
-B<after> calling
-FunImageGet(), since
-it is possible to change the value of BITPIX from the latter.
-
-
-
-=item *
-
-When specifying that input extensions be copied to an output file
-via a reference handle, close the output file B<before> closing
-input file, or else use
-FunFlush()
-explicitly on the output file
-B<before> closing the input file. (Otherwise the final copy will
-not occur).
-
-
-=back
-
-
-
-
-We believe that these are the natural rules that are implied in most
-FITS programming tasks. However, we recognize that making explicit use
-of "natural order" to decide what automatic action to take on behalf
-of the programmer is experimental. Therefore, if you find that your
-needs are not compatible with our preferred order, please let us know
--- it will be most illuminating for us as we evaluate this experiment.
-
-B<Funtools Programming Examples>
-
-The following complete coding examples are provided to illustrate the
-simplicity of Funtools applications. They can be found in the funtest
-subdirectory of the Funtools distribution. In many cases, you should
-be able to modify one of these programs to generate your own Funtools
-program:
-
-
-=over 4
-
-
-
-
-=item *
-
-evread.c: read and write binary tables
-
-
-=item *
-
-evcols.c: add column and rows to binary tables
-
-
-=item *
-
-evmerge.c: merge new columns with existing columns
-
-
-=item *
-
-evnext.c: manipulate raw data pointers
-
-
-=item *
-
-imblank.c: blank out image values below a threshold
-
-
-=item *
-
-asc2fits.c: convert a specific ASCII table to FITS binary table
-
-
-=back
-
-
-
-B<The Funtools Programming Reference Manual>
-
-
-#include <funtools.h>
-
-Fun FunOpen(char *name, char *mode, Fun ref)
-
-void *FunImageGet(Fun fun, void *buf, char *plist)
-
-int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix, char *plist)
-
-void * FunImageRowGet(Fun fun, void *buf, int rstart, int rstop, char *plist)
-
-void * FunImageRowPut(Fun fun, void *buf, int rstart, int rstop, int dim1, int dim2, int bitpix, char *plist)
-
-int FunColumnSelect(Fun fun, int size, char *plist, ...)
-
-void FunColumnActivate(Fun fun, char *s, char *plist)
-
-int FunColumnLookup(Fun fun, char *s, int which, char **name, int *type, int *mode, int *offset, int *n, int *width)
-
-void *FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist, int *nrow)
-
-int FunTableRowPut(Fun fun, void *rows, int nev, int idx, char *plist)
-
-int FunParamGetb(Fun fun, char *name, int n, int defval, int *got)
-
-int FunParamGeti(Fun fun, char *name, int n, int defval, int *got)
-
-double FunParamGetd(Fun fun, char *name, int n, double defval, int *got)
-
-char *FunParamGets(Fun fun, char *name, int n, char *defval, int *got)
-
-int FunParamPutb(Fun fun, char *name, int n, int value, char *comm, int append)
-
-int FunParamPuti(Fun fun, char *name, int n, int value, char *comm, int append)
-
-int FunParamPutd(Fun fun, char *name, int n, double value, int prec, char *comm, int append)
-
-int FunParamPuts(Fun fun, char *name, int n, char *value, char *comm, int append)
-
-int FunInfoGet(Fun fun, int type, ...)
-
-int FunInfoPut(Fun fun, int type, ...)
-
-void FunFlush(Fun fun, char *plist)
-
-void FunClose(Fun fun)
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funmerge.pod b/funtools/doc/pod/funmerge.pod
deleted file mode 100644
index 0cb9216..0000000
--- a/funtools/doc/pod/funmerge.pod
+++ /dev/null
@@ -1,122 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funmerge - merge one or more Funtools table files>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funmerge [-w|-x] -f [colname] <iname1> <iname2> ... <oname>
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -f # output a column specifying file from which this event came
- -w # adjust position values using WCS info
- -x # adjust position values using WCS info and save old values
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funmerge> merges FITS data from one or more
-FITS Binary Table files
-or raw event files.
-
-The first argument to the program specifies the first input FITS table
-or raw event file. If "stdin" is specified, data are read from the
-standard input. Use Funtools Bracket
-Notation to specify FITS extensions and row filters. Subsequent
-arguments specify additional event files and tables to merge. (NB: Stdin
-cannot not be used for any of these additional input file arguments.)
-The last argument is the output FITS file. The columns in each input table
-must be identical.
-
-
-If an input file begins with the '@' character, it is processed as an
-include file, i.e., as a text file containing event file names (as
-well as blank lines and/or comment lines starting with the '#' sign).
-If standard input is specified as an include file ('@stdin'), then
-file names are read from the standard input until EOF (^D). Event
-files and include files can be mixed on a command line.
-
-
-Rows from each table are written sequentially to the output
-file. If the switch B<-f [colname]> is specified on the command
-line, an additional column is added to each row containing the number
-of the file from which that row was taken (starting from one). In
-this case, the corresponding file names are stored in the header
-parameters having the prefix B<FUNFIL>, i.e., FUNFIL01,
-FUNFIL02, etc.
-
-
-Using the B<-w> switch (or B<-x> switch as described
-below), B<funmerge> also can adjust the position column values
-using the WCS information in each file. (By position columns, we mean
-the columns that the table is binned on, i.e., those columns defined
-by the B<bincols=> switch, or (X,Y) by default.) To perform WCS
-alignment, the WCS of the first file is taken as the base WCS. Each
-position in subsequent files is adjusted by first converting it to the
-sky coordinate in its own WCS coordinate system, then by converting
-this sky position to the sky position of the base WCS, and finally
-converting back to a pixel position in the base system. Note that in
-order to perform WCS alignment, the appropriate WCS and TLMIN/TLMAX
-keywords must already exist in each FITS file.
-
-When performing WCS alignment, you can save the original positions in
-the output file by using the B<-x> (for "xtra") switch instead
-of the B<-w> switch (i.e., using this switch also implies using
-B<-w>) The old positions are saved in columns having the same
-name as the original positional columns, with the added prefix "OLD_".
-
-Examples:
-
-
-Merge two tables, and preserve the originating file number for
-each row in the column called "FILE" (along with the corresponding
-file name in the header):
-
- [sh] funmerge -f "FILE" test.ev test2.ev merge.ev
-
-
-
-Merge two tables with WCS alignment, saving the old position values in
-2 additional columns:
-
- [sh] funmerge -x test.ev test2.ev merge.ev
-
-
-
-This program only works on raw event files and binary tables. We have
-not yet implemented image and array merging.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funopen.pod b/funtools/doc/pod/funopen.pod
deleted file mode 100644
index 3d6ab3e..0000000
--- a/funtools/doc/pod/funopen.pod
+++ /dev/null
@@ -1,166 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunOpen - open a Funtools data file>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- Fun FunOpen(char *name, char *mode, Fun ref);
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunOpen()> routine opens a Funtools data file for reading or
-appending, or creates a new FITS file for writing. The B<name>
-argument specifies the name of the Funtools data file to open. You can
-use IRAF-style bracket notation to specify
-Funtools Files, Extensions, and Filters.
-A separate call should be made each time a different FITS extension is
-accessed:
-
- Fun fun;
- char *iname;
- ...
- if( !(fun = FunOpen(iname, "r", NULL)) ){
- fprintf(stderr, "could not FunOpen input file: %s\n", iname);
- exit(1);
- }
-
-
-If B<mode> is "r", the file is opened for reading, and processing
-is set up to begin at the specified extension. For reading,
-B<name> can be B<stdin>, in which case the standard input is read.
-
-
-If B<mode> is "w", the file is created if it does not exist, or
-opened and truncated for writing if it does exist. Processing starts
-at the beginning of the file. The B<name> can be B<stdout>,
-in which case the standard output is readied for processing.
-
-
-If B<mode> is "a", the file is created if it does not exist, or
-opened if it does exist. Processing starts at the end of the file.
-The B<name> can be B<stdout>, in which case the standard
-output is readied for processing.
-
-
-When a Funtools file is opened for writing or appending, a previously
-opened Funtools reference
-handle can be specified as the third argument. This handle
-typically is associated with the input Funtools file that will be used
-to generate the data for the output data. When a reference file is
-specified in this way, the output file will inherit the (extension)
-header parameters from the input file:
-
- Fun fun, fun2;
- ...
- /* open input file */
- if( !(fun = FunOpen(argv[1], "r", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
-Thus, in the above example, the output FITS binary table file will
-inherit all of the parameters associated with the input binary table
-extension.
-
-A file opened for writing with a
-Funtools reference handle also
-inherits the selected columns (i.e. those columns chosen for
-processing using the
-FunColumnSelect() routine)
-from the reference file as its default columns. This makes it easy to
-open an output file in such a way that the columns written to the
-output file are the same as the columns read in the input file. Of
-course, column selection can easily be tailored using the
-FunColumnSelect() routine.
-In particular, it is easy to merge user-defined columns with the input
-columns to generate a new file. See the
-evmerge for a complete example.
-
-
-In addition, when a
-Funtools reference handle
-is supplied in a FunOpen() call,
-it is possible also to specify that all other extensions from the
-reference file (other than the input extension being processed) should
-be copied from the reference file to the output file. This is useful,
-for example, in a case where you are processing a FITS binary table
-or image and you want to copy all of the other extensions to
-the output file as well. Copy of other extensions is controlled by
-adding a "C" or "c" to the mode string of the
-FunOpen() call of the input
-reference file. If "C" is specified, then other extensions are
-B<always> copied (i.e., copy is forced by the application). If
-"c" is used, then other extensions are copied if the user requests
-copying by adding a plus sign "+" to the extension name in the bracket
-specification. For example, the B<funtable> program utilizes
-"c" mode, giving users the option of copying all other extensions:
-
- /* open input file -- allow user copy of other extensions */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
-
-Thus, B<funtable> supports either of these command lines:
-
- # copy only the EVENTS extension
- csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
- # copy ALL extensions
- csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
-
-
-
-Use of a Funtools reference
-handle implies that the input file is opened before the output
-file. However, it is important to note that if copy mode ("c" or "C")
-is specified for the input file, the actual input file open is delayed
-until just after the output file is opened, since the copy of prior
-extensions to the output file takes place while Funtools is seeking to
-the specified input extension. This implies that the output file
-should be opened before any I/O is done on the input file or else the
-copy will fail. Note also that the copy of subsequent extension will
-be handled automatically by
-FunClose()
-if the output file is
-closed before the input file. Alternatively, it can be done explicitly
-by FunFlush(), but again, this
-assumes that the input file still is open.
-
-
-Upon success FunOpen() returns a
-Fun handle that is used in subsequent Funtools calls. On error, NULL
-is returned.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funparamget.pod b/funtools/doc/pod/funparamget.pod
deleted file mode 100644
index 6d06d10..0000000
--- a/funtools/doc/pod/funparamget.pod
+++ /dev/null
@@ -1,153 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunParamGet - get a Funtools param value>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunParamGetb(Fun fun, char *name, int n, int defval, int *got)
-
- int FunParamGeti(Fun fun, char *name, int n, int defval, int *got)
-
- double FunParamGetd(Fun fun, char *name, int n, double defval, int *got)
-
- char *FunParamGets(Fun fun, char *name, int n, char *defval, int *got)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The four routines B<FunParamGetb()>, B<FunParamGeti()>,
-B<FunParamGetd()>, and B<FunParamGets()>, return the value of
-a FITS header parameter as a boolean, int, double, and string,
-respectively. The string returned by B<FunParamGets()> is a malloc'ed
-copy of the header value and should be freed when no longer needed.
-
-
-The first argument is the Fun handle associated with the FITS header
-being accessed. Normally, the header is associated with the FITS
-extension that you opened with B<FunOpen()>. However, you can use
-FunInfoPut() to specify access of the primary header. In particular,
-if you set the FUN_PRIMARYHEADER parameter to 1, then the primary
-header is used for all parameter access until the value is reset to
-0. For example:
-
- int val;
- FunParamGeti(fun, "NAXIS", 1, 0, &got); # current header
- val=1;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch to ...
- FunParamGeti(fun, "NAXIS", 1, 0, &got); # ... primary header
- FunParamGeti(fun, "NAXIS", 2, 0, &got); # ... primary header
- val=0;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch back to ...
- FunParamGeti(fun, "NAXIS", 2, 0, &got); # current header
-
-
-
-Alternatively, you can use the FUN_PRIMARY macro to access parameters
-from the primary header on a per-parameter basis:
-
- FunParamGeti(fun, "NAXIS1", 0, 0, &got); # current header
- FunParamGeti(FUN_PRIMARY(fun), "NAXIS1", 0, 0, &got); # primary header
-
-B<NB: FUN_PRIMARY is deprecated.>
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread-safe. We recommend use of FunInfoPut() to switch between the
-extension header and the primary header.
-
-
-For output data, access to the primary header is only possible until
-the header is written out, which usually takes place when the first
-data are written.
-
-
-The second argument is the name of the parameter to access. The third
-B<n> argument, if non-zero, is an integer that will be added as a
-suffix to the parameter name. This makes it easy to use a simple loop
-to process parameters having the same root name. For example, to
-gather up all values of TLMIN and TLMAX for each column in a binary
-table, you can use:
-
- for(i=0, got=1; got; i++){
- fun->cols[i]->tlmin = (int)FunParamGeti(fun, "TLMIN", i+1, 0.0, &got);
- fun->cols[i]->tlmax = (int)FunParamGeti(fun, "TLMAX", i+1, 0.0, &got);
- }
-
-
-
-The fourth B<defval> argument is the default value to return if
-the parameter does not exist. Note that the data type of this
-parameter is different for each specific FunParamGet() call. The final
-B<got> argument will be 0 if no param was found. Otherwise the
-data type of the parameter is returned as follows: FUN_PAR_UNKNOWN
-('u'), FUN_PAR_COMMENT ('c'), FUN_PAR_LOGICAL ('l'), FUN_PAR_INTEGER
-('i'), FUN_PAR_STRING ('s'), FUN_PAR_REAL ('r'), FUN_PAR_COMPLEX ('x').
-
-
-These routines return the value of the header parameter, or the
-specified default value if the header parameter does not exist. The
-returned value is a malloc'ed string and should be freed when no
-longer needed.
-
-
-By default, B<FunParamGets()> returns the string value of the
-named parameter. However, you can use FunInfoPut() to retrieve the
-raw 80-character FITS card instead. In particular, if you set the
-FUN_RAWPARAM parameter to 1, then card images will be returned by
-FunParamGets() until the value is reset to 0.
-
-
-Alternatively, if the FUN_RAW macro is applied to the name, then the
-80-character raw FITS card is returned instead.
-B<NB: FUN_RAW is deprecated.>
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread-safe. We recommend use of FunInfoPut() to switch between the
-extension header and the primary header.
-
-
-Note that in addition to the behaviors described above, the
-routine B<FunParamGets()> will return the 80 raw characters of the
-B<nth> FITS card (including the comment) if B<name> is specified as
-NULL and B<n> is positive. For example, to loop through all FITS
-header cards in a given extension and print out the raw card, use:
-
- for(i=1; ;i++){
- if( (s = FunParamGets(fun, NULL, i, NULL, &got)) ){
- fprintf(stdout, "%.80s\n", s);
- free(s);
- }
- else{
- break;
- }
- }
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funparamput.pod b/funtools/doc/pod/funparamput.pod
deleted file mode 100644
index 65d1b55..0000000
--- a/funtools/doc/pod/funparamput.pod
+++ /dev/null
@@ -1,147 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunParamPut - put a Funtools param value>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- int FunParamPutb(Fun fun, char *name, int n, int value, char *comm,
- int append)
-
- int FunParamPuti(Fun fun, char *name, int n, int value, char *comm,
- int append)
-
- int FunParamPutd(Fun fun, char *name, int n, double value, int prec,
- char *comm, int append)
-
- int FunParamPuts(Fun fun, char *name, int n, char *value, char *comm,
- int append)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The four routines B<FunParamPutb()>, B<FunParamPuti()>,
-B<FunParamPutd()>, and B<FunParamPuts()>, will set the value
-of a FITS header parameter as a boolean, int, double, and string,
-respectively.
-
-
-The first argument is the Fun handle associated with the FITS header
-being accessed. Normally, the header is associated with the FITS
-extension that you opened with B<FunOpen()>.
-However, you can use FunInfoPut() to specify that use of the primary
-header. In particular, if you set the FUN_PRIMARYHEADER parameter to
-1, then the primary header is used for all parameter access until the
-value is reset to 0. For example:
-
- int val;
- FunParamPuti(fun, "NAXIS1", 0, 10, NULL, 1); # current header
- val=1;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch to ...
- FunParamPuti(fun, "NAXIS1", 0, 10, NULL, 1); # primary header
-
-(You also can use the deprecated FUN_PRIMARY macro, to access
-parameters from the primary header.)
-
-
-The second argument is the B<name> of the parameter. (
-In accordance with FITS standards, the special names B<COMMENT>
-and B<HISTORY>, as well as blank names, are output without the "= "
-value indicator in columns 9 and 10.
-
-
-The third B<n> argument, if non-zero, is an integer that will be
-added as a suffix to the parameter name. This makes it easy to use a
-simple loop to process parameters having the same root name. For
-example, to set the values of TLMIN and TLMAX for each column in a
-binary table, you can use:
-
- for(i=0; i<got; i++){
- FunParamPutd(fun, "TLMIN", i+1, tlmin[i], 7, "min column val", 1);
- FunParamPutd(fun, "TLMAX", i+1, tlmax[i], 7, "max column val", 1);
- }
-
-
-
-The fourth B<defval> argument is the value to set. Note that the
-data type of this argument is different for each specific
-FunParamPut() call. The B<comm> argument is the comment
-string to add to this header parameter. Its value can be NULL. The
-final B<append> argument determines whether the parameter is added
-to the header if it does not exist. If set to a non-zero value, the
-header parameter will be appended to the header if it does not exist.
-If set to 0, the value will only be used to change an existing parameter.
-
-
-Note that the double precision routine FunParamPutd() supports an
-extra B<prec> argument after the B<value> argument, in order
-to specify the precision when converting the double value to ASCII. In
-general a 20.[prec] format is used (since 20 characters are alloted to
-a floating point number in FITS) as follows: if the double value being
-put to the header is less than 0.1 or greater than or equal to
-10**(20-2-[prec]), then %20.[prec]e format is used (i.e., scientific
-notation); otherwise %20.[prec]f format is used (i.e., numeric
-notation).
-
-
-As a rule, parameters should be set before writing the table or image.
-It is, however, possible to update the value of an B<existing>
-parameter after writing an image or table (but not to add a new
-one). Such updating only works if the parameter already exists and if
-the output file is seekable, i.e. if it is a disk file or is stdout
-being redirected to a disk file.
-
-
-It is possible to add a new parameter to a header after the data has
-been written, but only if space has previously been reserved. To reserve
-space, add a blank parameter whose value is the name of the parameter you
-eventually will update. Then, when writing the new parameter, specify a
-value of 2 for the append flag. The parameter writing routine will
-first look to update an existing parameter, as usual. If an existing
-parameter is not found, an appropriately-valued blank parameter will be
-searched for and replaced. For example:
-
- /* add blank card to be used as a place holder for IPAR1 update */
- FunParamPuts(fun, NULL, 0, "IPAR1", "INTEGER Param", 0);
- ...
- /* write header and data */
- FunTableRowPut(fun, events, got, 0, NULL);
- ...
- /* update param in file after writing data -- note append = 2 here */
- FunParamPuti(fun, "IPAR", 1, 400, "INTEGER Param", 2);
-
-
-
-The parameter routines return a 1 if the routine was successful and a 0 on
-failure. In general, the major reason for failure is that you did not
-set the append argument to a non-zero value and the parameter did not
-already exist in the file.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funref.pod b/funtools/doc/pod/funref.pod
deleted file mode 100644
index 13b158f..0000000
--- a/funtools/doc/pod/funref.pod
+++ /dev/null
@@ -1,170 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunRef: the Funtools Reference Handle>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-A description of how to use a Funtools reference handle to connect a
-Funtools input file to an output file.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-The Funtools reference handle connects a Funtools input file to a
-Funtools output file so that parameters (or even whole extensions) can
-be copied from the one to the other. To make the connection, the Funtools
-handle of the input file is passed to the
-final argument of the
-FunOpen() call for the output file:
-
- if( !(ifun = FunOpen(argv[1], "r", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
- if( !(ofun = FunOpen(argv[2], "w", ifun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
-It does not matter what type of input or output file (or extension) is
-opened, or whether they are the same type. When the output image or
-binary table is written using
-FunImagePut()
-or
-FunTableRowPut()
-an appropriate header will be written first, with parameters copied
-from the input extension. Of course, invalid parameters will be
-removed first, e.g., if the input is a binary table and the output is
-an image, then binary table parameters such as TFORM, TUNIT,
-etc. parameters will not be copied to the output.
-
-
-Use of a reference handle also allows default values to be passed
-to
-FunImagePut() in order to
-write out an output image with the same dimensions and data type
-as the input image. To use the defaults from the input, a value
-of 0 is entered for dim1, dim2, and bitpix. For example:
-
- fun = FunOpen(argv[1], "r", NULL);
- fun2 = FunOpen(argv[2], "w", fun);
- buf = FunImageGet(fun, NULL, NULL);
- ... process image data ...
- FunImagePut(fun2, buf, 0, 0, 0, NULL);
-
-Of course, you often want to get information about the data type
-and dimensions of the image for processing. The above code
-is equivalent to the following:
-
- fun = FunOpen(argv[1], "r", NULL);
- fun2 = FunOpen(argv[2], "w", fun);
- buf = FunImageGet(fun, NULL, NULL);
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2,
- FUN_SECT_BITPIX, &bitpix, 0);
- ... process image data ...
- FunImagePut(fun2, buf, dim1, dim2, bitpix, NULL);
-
-
-
-It is possible to change the reference handle for a given output Funtools
-handle using the
-FunInfoPut() routine:
-
- /* make the new extension the reference handle for the output file */
- FunInfoPut(fun2, FUN_IFUN, &fun, 0);
-
-When this is done, Funtools specially resets the output file to start
-a new output extension, which is connected to the new input reference
-handle. You can use this mechanism to process multiple input extensions
-into a single output file, by successively opening the former and
-setting the reference handle for the latter. For example:
-
- /* open a new output FITS file */
- if( !(fun2 = FunOpen(argv[2], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
- /* process each input extension in turn */
- for(ext=0; ;ext++){
- /* get new extension name */
- sprintf(tbuf, "%s[%d]", argv[1], ext);
- /* open it -- if we cannot open it, we are done */
- if( !(fun=FunOpen(tbuf, "r", NULL)) )
- break;
- /* make the new extension the reference handle for the output file */
- FunInfoPut(fun2, FUN_IFUN, &fun, 0);
- ... process ...
- /* flush output extension (write padding, etc.) */
- FunFlush(fun2, NULL);
- /* close the input extension */
- FunClose(fun);
- }
-
-In this example, the output file is opened first. Then each successive
-input extension is opened, and the output reference handle is set to
-the newly opened input handle. After data processing is performed, the
-output extension is flushed and the input extension is closed, in
-preparation for the next input extension.
-
-Finally, a reference handle can be used to copy other extensions from
-the input file to the output file. Copy of other extensions is
-controlled by adding a "C" or "c" to the mode string of the
-FunOpen()
-call B<of the input reference file>. If "C" is specified, then
-other extensions are B<always> copied (i.e., copy is forced by the
-application). If "c" is used, then other extensions are copied if the
-user requests copying by adding a plus sign "+" to the extension name
-in the bracket specification. For example, the B<funtable>
-program utilizes user-specified "c" mode so that the second example
-below will copy all extensions:
-
- # copy only the EVENTS extension
- csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
- # copy ALL extensions
- csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
-
-When extension copy is specified in the input file, the call to
-FunOpen()
-on the input file delays the actual file open until the output file
-also is opened (or until I/O is performed on the input file, which
-ever happens first). Then, when the output file is opened, the input
-file is also opened and input extensions are copied to the output
-file, up to the specific extension being opened. Processing of input
-and output extensions then proceed.
-
-When extension processing is complete, the remaining extensions need to
-be copied from input to output. This can be done explicitly, using the
-FunFlush()
-call with the "copy=remaining" plist:
-
- FunFlush(fun, "copy=remaining");
-
-Alternatively, this will happen automatically, if the output file
-is closed B<before> the input file:
-
- /* we could explicitly flush remaining extensions that need copying */
- /* FunFlush(fun2, "copy=remaining"); */
- /* but if we close output before input, end flush is done automatically */
- FunClose(fun2);
- FunClose(fun);
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funregions.pod b/funtools/doc/pod/funregions.pod
deleted file mode 100644
index 7f975ad..0000000
--- a/funtools/doc/pod/funregions.pod
+++ /dev/null
@@ -1,571 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Regions: Spatial Region Filtering>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the user interface for spatial
-region filtering images and tables.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-Spatial region filtering allows a program to select regions of an
-image or rows of a table (e.g., X-ray events) to process using
-simple geometric shapes and boolean combinations of shapes. When an
-image is filtered, only pixels found within these shapes are
-processed. When a table is filtered, only rows found within these
-shapes are processed.
-
-
-Spatial region filtering for images and tables is accomplished by
-means of B<region specifications>. A region specification
-consists of one or more B<region expressions>, which are geometric
-shapes,combined according to the rules of boolean algebra. Region
-specifications also can contain comments and local/global processing
-directives.
-
-
-Typically, region specifications are specified using bracket notation
-appended to the filename of the data being processed:
-
- foo.fits[circle(512,512,100)]
-
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-
- foo.fits[@my.reg]
-
-
-
-When region filters are passed in bracket notation in this manner, the
-filtering is set up automatically when the file is opened and all
-processing occurs through the filter. Programs also can use the filter
-library API to open filters explicitly.
-
-B<Region Expressions>
-
-More specifically, region specifications consist of one or more lines
-containing:
-
- # comment until end of line
- global keyword=value keyword=value ... # set global value(s)
- # include the following file in the region descriptor
- @file
- # use the FITS image as a mask (cannot be used with other regions)
- @fitsimage
- # each region expression contains shapes separated by operators
- [region_expression1], [region_expression2], ...
- [region_expression], [region_expression], ...
-
-
-
-A single region expression consists of:
-
- # parens and commas are optional, as is the + sign
- [+-]shape(num , num , ...) OP1 shape num num num OP2 shape ...
-
-e.g.:
-
- ([+-]shape(num , num , ...) && shape num num || shape(num, num)
- # a comment can come after a region -- reserved for local properties
- [+-]shape(num , num , ...) # local properties go here, e.g. color=red
-
-
-
-Thus, a region descriptor consists of one or more region
-expressions or B<regions>, separated by comas, new-lines, or
-semi-colons. Each B<region> consists of one or more geometric
-shapes combined using standard boolean operation. Several types
-of shapes are supported, including:
-
-
- shape: arguments:
- ----- ----------------------------------------
- ANNULUS xcenter ycenter inner_radius outer_radius
- BOX xcenter ycenter xwidth yheight (angle)
- CIRCLE xcenter ycenter radius
- ELLIPSE xcenter ycenter xwidth yheight (angle)
- FIELD none
- LINE x1 y1 x2 y2
- PIE xcenter ycenter angle1 angle2
- POINT x1 y1
- POLYGON x1 y1 x2 y2 ... xn yn
-
-
-
-In addition, the following regions accept B<accelerator> syntax:
-
-
- shape arguments
- ----- ------------------------------------------
- ANNULUS xcenter ycenter radius1 radius2 ... radiusn
- ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- PIE xcenter ycenter angle1 angle2 (angle3) (angle4) (angle5) ...
- PIE xcenter ycenter angle1 angle2 (n=[number])
- POINT x1 y1 x2 y2 ... xn yn
-
-Note that the circle accelerators are simply aliases for the annulus
-accelerators. See region geometry
-for more information about accelerators.
-
-
-Finally, the following are combinations of pie with different shapes
-(called "panda" for "Pie AND Annulus") allow for easy specification of
-radial sections:
-
-
- shape: arguments:
- ----- ---------
- PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # box
- EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # ellipse
-
-
-The panda and cpanda specify combinations of annulus and circle with pie,
-respectively and give identical results. The bpanda combines box and pie,
-while epanda combines ellipse and pie.
-See region geometry
-for more information about pandas.
-
-
-The following "shapes" are ignored by funtools (generated by ds9):
-
- shape: arguments:
- ----- ---------
- PROJECTION x1 y1 x2 y2 width # NB: ignored by funtools
- RULER x1 y1 x2 y2 # NB: ignored by funtools
- TEXT x y # NB: ignored by funtools
- GRID # NB: ignored by funtools
- TILE # NB: ignored by funtools
- COMPASS # NB: ignored by funtools
-
-
-
-All arguments to regions are real values; integer values are
-automatically converted to real where necessary. All angles are in
-degrees and run from the positive image x-axis to the positive image
-y-axis. If a rotation angle is part of the associated WCS header, that
-angle is added implicitly as well.
-
-
-Note that 3-letter abbreviations are supported for all shapes, so that
-you can specify "circle" or "cir".
-
-
-B<Columns Used in Region Filtering>
-
-By default, the x,y values in a region expression refer to the two
-"image binning" columns, i.e. the columns that would be used to
-bin the data into an image. For images, these are just the 2 dimensions
-of the image. For tables, these usually default to x and y but
-can be changed as required. For example, in Funtools, new binning
-columns are specified using a bincols=(col1,col2) statement within
-the bracket string on the command line.
-
-Alternate columns for region filtering can be specified by the syntax:
-
- (col1,col2)=region(...)
-
-e.g.:
-
- (X,Y)=annulus(x,y,ri,ro)
- (PHA,PI)=circle(x,y,r)
- (DX,DY)=ellipse(x,y,a,b[,angle])
-
-
-
-B<Region Algebra>
-
-(See also Region Algebra for more complete
-information.)
-
-
-Region shapes can be combined together using Boolean operators:
-
- Symbol Operation Use
- -------- --------- -----------------------------------
- ! not Exclude this shape from this region
- & or && and Include only the overlap of these shapes
- | or || inclusive or Include all of both shapes
- ^ exclusive or Include both shapes except their overlap
-
-Note that the !region syntax must be combined with another region in order
-that we be able to assign a region id properly. That is,
-
- !circle(512,512,10)
-
-is not a legal region because there is no valid region id to work with.
-To get the full field without a circle, combine the above with field(),
-as in:
-
- field() && !circle(512,512,10)
-
-
-B< Region Separators Also Are Operators>
-
-
-As mentioned previously, multiple region expressions can be specified
-in a region descriptor, separated by commas, new-lines, or
-semi-colons. When such a separator is used, the boolean OR operator
-is automatically generated in its place but, unlike explicit use of
-the OR operator, the region ID is incremented (starting from 1).
-
-
-For example, the two shapes specified in this example are given the
-same region value:
-
- foo.fits[circle(512,512,10)||circle(400,400,20)]
-
-On the other hand, the two shapes defined in the following example are
-given different region values:
-
- foo.fits[circle(512,512,10),circle(400,400,20)]
-
-
-
-Of course these two examples will both mask the same table rows or
-pixels. However, in programs that distinguish region id's (such as
-funcnts ), they will act
-differently. The explicit OR operator will result in one region
-expression consisting of two shapes having the same region id and
-funcnts will report a single region. The comma operator will cause
-funcnts to report two region expressions, each with one shape, in
-its output.
-
-
-In general, commas are used to separate region expressions entered
-in bracket notation on the command line:
-
- # regions are added to the filename in bracket notation
- foo.fits[circle(512,512,100),circle(400,400,20)]
-
-New-lines are used to separate region
-expressions in a file:
-
- # regions usually are separated by new-lines in a file
- # use @filename to include this file on the command line
- circle(512,512,100)
- circle(400,400,20)
-
-Semi-colons are provided for backward compatibility with the original
-IRAF/PROS implementation and can be used in either case.
-
-
-If a pixel is covered by two different regions expressions, it is
-given the mask value of the B<first> region that contains that
-pixel. That is, successive regions B<do not> overwrite previous
-regions in the mask, as was the case with the original PROS regions.
-In this way, an individual pixel is covered by one and only one
-region. This means that one must sometimes be careful about the order
-in which regions are defined. If region N is fully contained within
-region M, then N should be defined B<before> M, or else it will be
-"covered up" by the latter.
-
-B<Region Exclusion>
-
-Shapes also can be globally excluded from all the region specifiers in
-a region descriptor by using a minus sign before a region:
-
-
- operator arguments:
- -------- -----------
- - Globally exclude the region expression following '-' sign
- from ALL regions specified in this file
-
-The global exclude region can be used by itself; in such a case, field() is
-implied.
-
-
-A global exclude differs from the local exclude (i.e. a shape prefixed
-by the logical not "!" symbol) in that global excludes are logically
-performed last, so that no region will contain pixels from a globally
-excluded shape. A local exclude is used in a boolean expression with
-an include shape, and only excludes pixels from that include shape.
-Global excludes cannot be used in boolean expressions.
-
-B<Include Files>
-
-
-The B<@filename> directive specifies an include file
-containing region expressions. This file is processed as part of
-the overall region descriptor:
-
- foo.fits[circle(512,512,10),@foo]
-
-A filter include file simply includes text without changing the state
-of the filter. It therefore can be used in expression. That is, if the
-file foo1 contains "pi==1" and foo2 contains "pha==2" then
-the following expressions are equivalent:
-
- "[@foo1&&@foo2]" is equivalent to "[pi==1&&pha==2]"
- "[pha==1||@foo2]" is equivalent to "[pi==1||pha==2]"
- "[@foo1,@foo2]" is equivalent to "[pi==1,pha==2]"
-
-Be careful that you specify evaluation order properly using
-parenthesis, especially if the include file contains multiple
-filter statements. For example, consider a file containing two
-regions such as:
-
- circle 512 512 10
- circle 520 520 10
-
-If you want to include only events (or pixels) that are in these regions
-and have a pi value of 4, then the correct syntax is:
-
- pi==4&&(@foo)
-
-since this is equivalent to:
-
- pi==4 && (circle 512 512 10 || circle 520 520 10)
-
-If you leave out the parenthesis, you are filtering this statement:
-
- pi==4 && circle 512 512 10 || circle 520 520 10)
-
-which is equivalent to:
-
- (pi==4 && circle 512 512 10) || circle 520 520 10)
-
-The latter syntax only applies the pi test to the first region.
-
-
-For image-style filtering, the B<@filename> can specify an 8-bit
-or 16-bit FITS image. In this case, the pixel values in the mask image
-are used as the region mask. The valid pixels in the mask must have
-positive values. Zero values are excluded from the mask and negative
-values are not allowed. Moreover, the region id value is taken as
-the image pixel value and the total number of regions is taken to be
-the highest pixel value. The dimensions of the image mask must be less
-than or equal to the image dimensions of the data. The mask will be
-replicated as needed to match the size of the image. (Thus, best
-results are obtained when the data dimensions are an even multiple of
-the mask dimensions.)
-
-
-An image mask can be used in any image filtering operation, regardless
-of whether the data is of type image or table. For example, the
-funcnts )
-program performs image filtering on images or tables, and so
-FITS image masks are valid input for either type of data in this
-program.. An image mask cannot be used in a program such as
-fundisp )
-when the input data is a table, because fundisp displays
-rows of a table and processes these rows using event-style filtering.
-
-B<Global and Local Properties of Regions>
-
-
-The ds9 image display program describes a host of properties such as
-color, font, fix/free state, etc. Such properties can be specified
-globally (for all regions) or locally (for an individual region).
-The B<global> keyword specifies properties and qualifiers for all
-regions, while local properties are specified in comments on the same
-line as the region:
-
- global color=red
- circle(10,10,2)
- circle(20,20,3) # color=blue
- circle(30,30,4)
-
-The first and third circles will be red, which the second circle will
-be blue. Note that funtools currently ignores region properties, as
-they are used in display only.
-
-B< Coordinate Systems>
-
-For each region, it is important to specify the coordinate system
-used to interpret the region, i.e., to set the context in which position and
-size values are interpreted. For this purpose, the following keywords
-are recognized:
-
-
- name description
- ---- ------------------------------------------
- PHYSICAL pixel coords of original file using LTM/LTV
- IMAGE pixel coords of current file
- FK4, B1950 sky coordinate systems
- FK5, J2000 sky coordinate systems
- GALACTIC sky coordinate systems
- ECLIPTIC sky coordinate systems
- ICRS currently same as J2000
- LINEAR linear wcs as defined in file
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV
-
-
-
-B<Specifying Positions, Sizes, and Angles>
-
-The arguments to region shapes can be floats or integers describing
-positions and sizes. They can be specified as pure numbers or using
-explicit formatting directives:
-
-
- position arguments description
- ------------------ ------------------------------
- [num] context-dependent (see below)
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
- [num]:[num]:[num] hms for 'odd' position arguments
- [num]:[num]:[num] dms for 'even' position arguments
- [num]h[num]m[num]s explicit hms
- [num]d[num]m[num]s explicit dms
-
- size arguments description
- -------------- -----------
- [num] context-dependent (see below)
- [num]" arc seconds
- [num]' arc minutes
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
-
-
-
-When a "pure number" (i.e. one without a format directive such as 'd'
-for 'degrees') is specified, its interpretation depends on the context
-defined by the 'coordsys' keyword. In general, the rule is:
-
-
-All pure numbers have implied units corresponding to the current
-coordinate system.
-
-
-If no such system is explicitly specified, the default system is
-implicitly assumed to be PHYSICAL.
-
-
-In practice this means that for IMAGE and PHYSICAL systems, pure
-numbers are pixels. Otherwise, for all systems other than linear,
-pure numbers are degrees. For LINEAR systems, pure numbers are in the
-units of the linear system. This rule covers both positions and
-sizes.
-
-
-The input values to each shape can be specified in several coordinate
-systems including:
-
-
- name description
- ---- ----------------------------
- IMAGE pixel coords of current file
- LINEAR linear wcs as defined in file
- FK4, B1950 various sky coordinate systems
- FK5, J2000
- GALACTIC
- ECLIPTIC
- ICRS
- PHYSICAL pixel coords of original file using LTM/LTV
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV
-
-
-
-If no coordinate system is specified, PHYSICAL is assumed. PHYSICAL or
-a World Coordinate System such as J2000 is preferred and most general.
-The coordinate system specifier should appear at the beginning of the
-region description, on a separate line (in a file), or followed by a
-new-line or semicolon; e.g.,
-
-
- global coordsys physical
- circle 6500 9320 200
-
-
-The use of celestial input units automatically implies WORLD
-coordinates of the reference image. Thus, if the world coordinate
-system of the reference image is J2000, then
-
-
- circle 10:10:0 20:22:0 3'
-
-
-is equivalent to:
-
-
- circle 10:10:0 20:22:0 3' # j2000
-
-
-
-Note that by using units as described above, you may mix coordinate
-systems within a region specifier; e.g.,
-
-
- circle 6500 9320 3' # physical
-
-
-
-Note that, for regions which accept a rotation angle:
-
-
-ellipse (x, y, r1, r2, angle)
-box(x, y, w, h, angle)
-
-
-the angle is relative to the specified coordinate system. In
-particular, if the region is specified in WCS coordinates, the angle
-is related to the WCS system, not x/y image coordinate axis. For WCS
-systems with no rotation, this obviously is not an issue. However,
-some images do define an implicit rotation (e.g., by using a non-zero
-CROTA value in the WCS parameters) and for these images, the angle
-will be relative to the WCS axes. In such case, a region specification
-such as:
-
-
-fk4;ellipse(22:59:43.985, +58:45:26.92,320", 160", 30)
-
-
-will not, in general, be the same region specified as:
-
-
-physical;ellipse(465, 578, 40, 20, 30)
-
-
-even when positions and sizes match. The angle is relative to WCS axes
-in the first case, and relative to physical x,y axes in the second.
-
-
-
-More detailed descriptions are available for:
-Region Geometry,
-Region Algebra,
-Region Coordinates, and
-Region Boundaries.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funsky.pod b/funtools/doc/pod/funsky.pod
deleted file mode 100644
index 421d5d7..0000000
--- a/funtools/doc/pod/funsky.pod
+++ /dev/null
@@ -1,260 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funsky - convert between image and sky coordinates>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- funsky iname[ext] # RA,Dec (deg) or image pix from stdin
- funsky iname[ext] [lname] # RA, Dec (deg) or image pix from list
- funsky iname[ext] [col1] [col2] # named cols:units from stdin
- funsky iname[ext] [lname] [col1] [col2] # named cols:units from list
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -d # always use integer tlmin conversion (as ds9 does)
- -r # convert x,y to RA,Dec (default: convert RA,Dec to x,y)
- -o # include offset from the nominal target position (in arcsec)
- -v # display input values also (default: display output only)
- -T # output display in rdb format (w/header,tab delimiters)
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-Funsky converts input sky coordinates (RA, Dec) to image coordinates (or vice
-versa) using the WCS information contained in the specified FITS file. Several
-calling sequences are supported in order to make it easy to specify
-coordinate positions in different ways.
-
-
-The first required argument is always the input FITS file (or
-extension) containing the WCS information in an extension header. Note
-that the data from this file is not used. By default, the program
-converts input RA and Dec values to X and Y using this WCS
-information. If the WCS is associated with a FITS image, then the X,Y
-values are image values. If the WCS is associated with a binary table,
-then the X, Y values are physical values. To convert X,Y to RA and
-Dec, use the B<-r> (reverse) switch.
-
-
-If no other command arguments are supplied, then the input positions
-are read from the standard input. Each line is assumed to contain a
-single coordinate position consisting of an RA in degrees (or X in
-pixels) followed by a Dec in degrees (or Y in pixels). The usual
-delimiters are supported (spaces, commas, tabs). For example:
-
- # read from stdin, default column names and units
- [sh] funsky snr.ev
- 22.982695 58.606523 # input RA (hrs), Dec(deg)
- 510.00 510.00
- 22.982127 58.607634 # input
- 512.00 510.50
- 22.981700 58.614301 # input
- 513.50 513.50
- ^D # end of input
-
-
-
-If a second argument is supplied, this argument is assumed to be
-a file containing RA (X) and Dec (Y) positions. The file can either be
-an ASCII table or a FITS binary table. The order of columns is
-unimportant, if the table has a column header. In this case, the
-names of the columns must be one of "RA", "DEC", or "X", "Y" for sky
-to image and image to sky conversions, respectively. If the table has
-no header, then once again, RA (X) is assumed to first, followed
-by DEC (Y).
-For example:
-
- # read from file, default column names and units
- [sh] cat hd.in
- RA DEC
- --------- ---------
- 22.982695 58.606523
- 22.982127 58.607634
- 22.981700 58.614301
-
- [sh] funsky snr.ev hd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
-
-
-If three arguments are supplied, then the input positions again are
-read from the standard input. Each line is assumed to contain a single
-coordinate position consisting of an RA (or X in pixels) followed by a
-Dec (or Y in pixels), with the usual delimiters supported. However,
-the second and third arguments now specify the column names and/or
-sky units using a colon-delimited syntax:
-
- [colname]:[h|d|r]
-
-If the colname is omitted, the names default to "RA", "DEC", "X", "Y",
-"COL1", or "COL2" as above. If the units are omitted, the default is degrees
-for both RA and Dec. When the -r switch is used (convert from image
-to sky) the units are applied to the output instead of the input. The following
-examples will serve to illustrate the options:
-
- # read from stdin, specifying column names (def. units: degrees)
- [sh] cat hd.in
- MYRA MYDEC
- --------- ---------
- 22.982695 58.606523
- 22.982127 58.607634
- 22.981700 58.614301
-
- [sh] funsky snr.ev MYRA MYDEC < hd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read from stdin, specifying column names and units
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev MYRA:d MYDEC:d < dd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read stdin, convert image to sky, specifying output sky units
- [sh] cat im.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] cat im.in | funsky -r snr.ev :d :d
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
-
-
-Finally, four command arguments specify both and input file and column names
-and/or units:
-
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read file, convert image to sky, specifying output sky units
- [sh] cat im.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] funsky -r snr.ev im.in :d :d
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
-
-
-By default, the output of funsky consists only of the converted coordinate
-position(s), one per output line. This makes parsing in shell scripts easy.
-Use the B<-v> (verbose) switch to specify that the input
-coordinates should be pre-pended to each line. For example:
-
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] funsky -v snr.ev dd.in MYRA:d MYDEC:d
- 344.740432 58.606523 510.00 510.00
- 344.731900 58.607634 512.00 510.50
- 344.725500 58.614301 513.50 513.50
-
-
-
-In addition, a full starbase table can be output using the B<-T>
-(table) switch. This switch can be used with or without the -v
-switch. If the -T and -v are both specified, then a descriptive header
-parameters are output before the table (mainly to remind you of the
-sky units):
-
- # output table in non-verbose mode
- [sh] funsky -T snr.ev dd.in MYRA:d MYDEC:d
- X Y
- ------------ ------------
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # output table in verbose mode
- [sh] funsky -T -v snr.ev dd.in MYRA:d MYDEC:d
- # IFILE = /Users/eric/data/snr.ev
- # ICOL1 = MYRA
- # ICOL2 = MYDEC
- # IUNITS1 = d
- # IUNITS2 = d
- # OCOL1 = X
- # OCOL2 = Y
-
- MYRA MYDEC X Y
- ------------ ------------ ------------ ------------
- 344.740432 58.606523 510.00 510.00
- 344.731900 58.607634 512.00 510.50
- 344.725500 58.614301 513.50 513.50
-
-
-
-Finally, the B<-d> (ds9) switch mimicks ds9's use of integer TLMIN
-and TLMAX values for all coordinate transformations. FITS conventions
-seem to call for use of floating point TLMIN and TLMAX when the data are
-floats. This convention is followed by funsky but results in a
-small discrepancy with ds9's converted values for floating point
-data. We will remedy this conflict in the future, maybe.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funtable.pod b/funtools/doc/pod/funtable.pod
deleted file mode 100644
index d4e8475..0000000
--- a/funtools/doc/pod/funtable.pod
+++ /dev/null
@@ -1,296 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funtable - copy selected rows from a Funtools file to a FITS binary table>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funtable [-a] [-i|-z] [-m] [-s cols] <iname> <oname> [columns]
-
-
-
-
-
-=head1 OPTIONS
-
-
-
-
-
- -a # append to existing output file as a table extension
- -i # for image data, only generate X and Y columns
- -m # for tables, write a separate file for each region
- -s "col1 ..." # columns on which to sort
- -z # for image data, output zero-valued pixels
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-B<funtable> selects rows from the specified
-FITS Extension
-(binary table only) of a FITS file, or from a non-FITS raw event
-file, and writes those rows to a FITS binary table file. It also
-will create a FITS binary table from an image or a raw array file.
-
-
-The first argument to the program specifies the FITS file, raw event
-file, or raw array file. If "stdin" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify FITS extensions, and filters. The second
-argument is the output FITS file. If "stdout" is specified, the FITS
-binary table is written to the standard output. By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional third argument in the form:
-
- "column1 column1 ... columnN"
-
-
-
-The B<funtable> program generally is used to select rows from a
-FITS binary table using
-Table Filters
-and/or
-Spatial Region Filters.
-For example, you can copy only selected rows (and output only selected
-columns) by executing in a command such as:
-
- [sh] funtable "test.ev[pha==1&&pi==10]" stdout "x y pi pha" | fundisp stdin
- X Y PHA PI
- ------- ------- ------- ---------
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
-
-
-The special column B<$REGION> can be specified to write the
-region id of each row:
-
- [sh $] funtable "test.ev[time-(int)time>=.99&&annulus(0 0 0 10 n=3)]" stdout 'x y time $REGION' | fundisp stdin
- X Y TIME REGION
- -------- -------- --------------------- ----------
- 5 -6 40.99000000 3
- 4 -5 59.99000000 2
- -1 0 154.99000000 1
- -2 1 168.99000000 1
- -3 2 183.99000000 2
- -4 3 199.99000000 2
- -5 4 216.99000000 2
- -6 5 234.99000000 3
- -7 6 253.99000000 3
-
-
-Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are written.
-
-Columns can be excluded from display using a minus sign before the
-column:
-
- [sh $] funtable "test.ev[time-(int)time>=.99]" stdout "-time" | fundisp stdin
- X Y PHA PI DX DY
- -------- -------- -------- ---------- ----------- -----------
- 5 -6 5 -6 5.50 -6.50
- 4 -5 4 -5 4.50 -5.50
- -1 0 -1 0 -1.50 0.50
- -2 1 -2 1 -2.50 1.50
- -3 2 -3 2 -3.50 2.50
- -4 3 -4 3 -4.50 3.50
- -5 4 -5 4 -5.50 4.50
- -6 5 -6 5 -6.50 5.50
- -7 6 -7 6 -7.50 6.50
-
-All columns except the time column are written.
-
-In general, the rules for activating and de-activating columns are:
-
-
-=over 4
-
-
-
-
-=item *
-
-If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-
-
-=item *
-
-If only include columns are specified, then only the specified columns
-are activated.
-
-
-=item *
-
-If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.
-
-
-=back
-
-
-In addition to specifying columns names explicitly, the special
-symbols I<+> and I<-> can be used to activate and
-de-activate I<all> columns. This is useful if you want to
-activate the $REGION column along with all other columns. According
-to the rules, the syntax "$REGION" only activates the region column
-and de-activates the rest. Use "+ $REGION" to activate all
-columns as well as the region column.
-
-
-Ordinarily, only the selected table is copied to the output file. In
-a FITS binary table, it sometimes is desirable to copy all of the
-other FITS extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. For example, the first command below copies only the EVENT table,
-while the second command copies other extensions as well:
-
- [sh] funtable "/proj/rd/data/snr.ev[EVENTS]" events.ev
- [sh] funtable "/proj/rd/data/snr.ev[EVENTS+]" eventsandmore.ev
-
-
-
-If the input file is an image or a raw array file, then
-B<funtable> will generate a FITS binary table from the pixel
-values in the image. Note that it is not possible to specify the
-columns to output (using command-line argument 3). Instead, there are
-two ways to create such a binary table from an image. By default, a
-3-column table is generated, where the columns are "X", "Y", and
-"VALUE". For each pixel in the image, a single row (event) is
-generated with the "X" and "Y" columns assigned the dim1 and dim2
-values of the image pixel, respectively and the "VALUE" column
-assigned the value of the pixel. With sort of table, running
-B<funhist> on the "VALUE" column will give the same results as
-running B<funhist> on the original image.
-
-
-If the B<-i> ("individual" rows) switch is specified, then only
-the "X" and "Y" columns are generated. In this case, each positive
-pixel value in the image generates n rows (events), where n is equal
-to the integerized value of that pixel (plus 0.5, for floating point
-data). In effect, B<-i> approximately recreates the rows of a
-table that would have been binned into the input image. (Of course,
-this is only approximately correct, since the resulting x,y positions
-are integerized.)
-
-
-If the B<-s [col1 col2 ... coln]> ("sort") switch is specified,
-the output rows of a binary table will be sorted using the
-specified columns as sort keys. The sort keys must be scalar columns
-and also must be part of the output file (i.e. you cannot sort on a
-column but not include it in the output). This facility uses the
-B<_sort> program (included with funtools), which must be accessible
-via your path.
-
-
-For binary tables, the B<-m> ("multiple files") switch will
-generate a separate file for each region in the filter specification
-i.e. each file contains only the rows from that region. Rows
-which pass the filter but are not in any region also are put in a
-separate file.
-
-
-The separate output file names generated by the B<-m> switch are
-produced automatically from the root output file to contain the region id of
-the associated region. (Note that region ids start at 1, so that the
-file name associated with id 0 contains rows that pass the filter but
-are not in any given region.) Output file names are generated as follows:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-A $n specification can be used anywhere in the root file name (suitably
-quoted to protect it from the shell) and will be expanded to be the id
-number of the associated region. For example:
-
- funtable -m input.fits'[cir(512,512,1);cir(520,520,1)...]' 'foo.goo_$n.fits'
-
-will generate files named foo.goo_0.fits (for rows not in any region but
-still passing the filter), foo.goo_1.fits (rows in region id #1, the first
-region), foo.goo_2.fits (rows in region id #2), etc. Note that single quotes
-in the output root are required to protect the '$' from the shell.
-
-
-
-=item *
-
-If $n is not specified, then the region id will be placed before
-the first dot (.) in the filename. Thus:
-
- funtable -m input.fits'[cir(512,512,1);cir(520,520,1)...]' foo.evt.fits
-
-will generate files named foo0.evt.fits (for rows not in any region but
-still passing the filter), foo1.evt.fits (rows in region id #1),
-foo2.evt.fits (rows in region id #2), etc.
-
-
-
-=item *
-
-If no dot is specified in the root output file name, then
-the region id will be appended to the filename. Thus:
-
- funtable -m input.fits'[cir(512,512,1);cir(520,520,1)...]' 'foo_evt'
-
-will generate files named foo_evt0 (for rows not in any region but
-still passing the filter), foo_evt1 (rows in region id #1),
-foo_evt2 (rows in region id #2), etc.
-
-
-=back
-
-
-The multiple file mechanism provide a simple way to generate
-individual source data files with a single pass through the data.
-
-
-By default, a new FITS file is created and the binary table is written
-to the first extension. If the B<-a> (append) switch is specified,
-the table is appended to an existing FITS file as a BINTABLE extension.
-Note that the output FITS file must already exist.
-
-
-If the B<-z> ("zero" pixel values) switch is specified and
-B<-i> is not specified, then pixels having a zero value will
-be output with their "VALUE" column set to zero. Obviously, this
-switch does not make sense when individual events are output.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funtablerowget.pod b/funtools/doc/pod/funtablerowget.pod
deleted file mode 100644
index 86c1e66..0000000
--- a/funtools/doc/pod/funtablerowget.pod
+++ /dev/null
@@ -1,111 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunTableRowGet - get Funtools rows>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
- #include <funtools.h>
-
- void *FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist,
- int *nrow)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-The B<FunTableRowGet()> routine retrieves rows from a Funtools
-binary table or raw event file, and places the values of columns
-selected by FunColumnSelect()
-into an array of user structs. Selected column values are
-automatically converted to the specified user data type (and to native
-data format) as necessary.
-
-
-The first argument is the Fun handle associated with this row data.
-The second B<rows> argument is the array of user structs into
-which the selected columns will be stored. If NULL is passed, the
-routine will automatically allocate space for this array. (This
-includes proper allocation of pointers within each struct, if the "@"
-pointer type is used in the selection of columns. Note that if you
-pass NULL in the second argument, you should free this space using the
-standard free() system call when you are finished with the array of
-rows.) The third B<maxrow> argument specifies the maximum number
-of rows to be returned. Thus, if B<rows> is allocated by the
-user, it should be at least of size maxrow*sizeof(evstruct).
-
-
-The fourth B<plist> argument is a param list string. Currently,
-the keyword/value pair "mask=transparent" is supported in the plist
-argument. If this string is passed in the call's plist argument, then
-all rows are passed back to the user (instead of just rows passing
-the filter). This is only useful when
-FunColumnSelect() also is
-used to specify "$region" as a column to return for each row. In
-such a case, rows found within a region have a returned region value
-greater than 0 (corresponding to the region id of the region in which
-they are located), rows passing the filter but not in a region have
-region value of -1, and rows not passing any filter have region
-value of 0. Thus, using "mask=transparent" and the returned region
-value, a program can process all rows and decide on an action based
-on whether a given row passed the filter or not.
-
-
-The final argument is a pointer to an int variable that will return
-the actual number of rows returned. The routine returns a pointer to
-the array of stored rows, or NULL if there was an error. (This pointer
-will be the same as the second argument, if the latter is non-NULL).
-
- /* get rows -- let routine allocate the row array */
- while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = buf+i;
- /* rearrange some values. etc. */
- ev->energy = (ev->pi+ev->pha)/2.0;
- ev->pha = -ev->pha;
- ev->pi = -ev->pi;
- }
- /* write out this batch of rows */
- FunTableRowPut(fun2, buf, got, 0, NULL);
- /* free row data */
- if( buf ) free(buf);
- }
-
-As shown above, successive calls to
-FunTableRowGet() will return the
-next set of rows from the input file until all rows have been read,
-i.e., the routine behaves like sequential Unix I/O calls such as
-fread(). See evmerge example code for a
-more complete example.
-
-
-Note that FunTableRowGet() also can be called as FunEventsGet(), for
-backward compatibility.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funtablerowput.pod b/funtools/doc/pod/funtablerowput.pod
deleted file mode 100644
index b063e43..0000000
--- a/funtools/doc/pod/funtablerowput.pod
+++ /dev/null
@@ -1,200 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<FunTableRowPut - put Funtools rows>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-int FunTableRowPut(Fun fun, void *rows, int nev, int idx, char *plist)
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-The B<FunTableRowPut()> routine writes rows to a FITS binary
-table, taking its input from an array of user structs that contain
-column values selected by a previous call to
-FunColumnSelect(). Selected
-column values are automatically converted from native data format to
-FITS data format as necessary.
-
-
-The first argument is the Fun handle associated with this row data.
-The second B<rows> argument is the array of user structs to
-output. The third B<nrow> argument specifies the number number of
-rows to write. The routine will write B<nrow> records, starting
-from the location specified by B<rows>.
-
-
-The fourth B<idx> argument is the index of the first raw input
-row to write, in the case where rows from the user buffer are
-being merged with their raw input row counterparts (see below). Note
-that this B<idx> value is has nothing to do with the
-row buffer specified in argument 1. It merely matches the row
-being written with its corresponding (hidden) raw row. Thus, if you
-read a number of rows, process them, and then write them out all at
-once starting from the first user row, the value of B<idx>
-should be 0:
-
- Ev ebuf, ev;
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ...
- }
- /* write out this batch of rows, starting with the first */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
-
-
-On the other hand, if you write out the rows one at a time (possibly
-skipping rows), then, when writing the i'th row from the input
-array of rows, set B<idx> to the value of i:
-
- Ev ebuf, ev;
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ...
- /* write out the current (i.e., i'th) row */
- FunTableRowPut(fun2, (char *)ev, 1, i, NULL);
- }
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
-
-
-The final argument is a param list string that is not currently used.
-The routine returns the number of rows output. This should be equal
-to the value passed in the third nrow</B argument.
-
-
-When FunTableRowPut() is first
-called for a given binary table, Funtools checks to see of the primary
-header has already been written (either by writing a previous row
-table or by writing an image.) If not, a dummy primary header is
-written to the file specifying that an extension should be expected.
-After this, a binary table header is automatically written containing
-information about the columns that will populate this table. In
-addition, if a
-Funtools reference handle
-was specified when this table was opened, the parameters from this
-Funtools reference handle
-are merged into the new binary table header.
-
-
-In a typical Funtools row loop, you read rows using
-FunTableRowGet()() and write
-rows using FunTableRowPut(). The columns written by
-FunTableRowPut()() are those defined as writable by a previous call to
-FunColumnSelect(). If
-that call to FunColumnSelect also specified
-B<merge=[update|replace|append]>, then the entire corresponding
-raw input row record will be merged with the output row according
-to the B<merge> specification (see
-FunColumnSelect() above).
-
-
-A call to write rows can either be done once, after all rows in
-the input batch have been processed, or it can be done (slightly less
-efficiently) one row at a time (or anything in between). We do
-recommend that you write all rows associated with a given batch of
-input rows before reading new rows. This is B<required> if
-you are merging the output rows with the raw input rows (since
-the raw rows are destroyed with each successive call to get new rows).
-
-For example:
-
- Ev buf, ev;
- ...
- /* get rows -- let routine allocate the row array */
- while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* point to the i'th row */
- ev = buf + i;
- .... process
- }
- /* write out this batch of rows */
- FunTableRowPut(fun2, buf, got, 0, NULL);
- /* free row data */
- if( buf ) free(buf);
- }
-
-
-or
-
-
- Ev buf, ev;
- ...
- /* get rows -- let routine allocate the row array */
- while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = buf + i;
- ... process
- /* write out this batch of rows with the new column */
- if( dowrite )
- FunTableRowPut(fun2, buf, 1, i, NULL);
- }
- /* free row data */
- if( buf ) free(buf);
- }
-
-
-
-Note that the difference between these calls is that the first one
-outputs B<got> rows all at once and therefore passes
-B<idx=0> in argument four, so that merging starts at the first raw
-input row. In the second case, a check it made on each row to see
-if it needs to be output. If so, the value of B<idx> is passed as
-the value of the B<i> variable which points to the current row
-being processed in the batch of input rows.
-
-
-As shown above, successive calls to
-FunTableRowPut() will write
-rows sequentially. When you are finished writing all rows in a
-table, you should call
-FunFlush() to write out the FITS
-binary table padding. However, this is not necessary if you
-subsequently call FunClose() without doing any other I/O to the FITS
-file.
-
-
-Note that FunTableRowPut() also can be called as FunEventsPut(), for
-backward compatibility.
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-=cut
diff --git a/funtools/doc/pod/funtbl.pod b/funtools/doc/pod/funtbl.pod
deleted file mode 100644
index 1fb9bb0..0000000
--- a/funtools/doc/pod/funtbl.pod
+++ /dev/null
@@ -1,137 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<funtbl - extract a table from Funtools ASCII output>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-funtable [-c cols] [-h] [-n table] [-p prog] [-s sep] <iname>
-
-
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-[NB: This program has been deprecated in favor of the ASCII text processing
-support in funtools. You can now perform fundisp on funtools ASCII output
-files (specifying the table using bracket notation) to extract tables
-and columns.]
-
-The B<funtbl> script extracts a specified table (without the
-header and comments) from a funtools ASCII output file and writes the
-result to the standard output. The first non-switch argument is the
-ASCII input file name (i.e. the saved output from funcnts, fundisp,
-funhist, etc.). If no filename is specified, stdin is read. The
--n switch specifies which table (starting from 1) to extract. The
-default is to extract the first table. The -c switch is a
-space-delimited list of column numbers to output, e.g. -c "1 3 5"
-will extract the first three odd-numbered columns. The default is to
-extract all columns. The -s switch specifies the separator string to
-put between columns. The default is a single space. The -h switch
-specifies that column names should be added in a header line before
-the data is output. Without the switch, no header is prepended. The
--p program switch allows you to specify an awk-like program to run
-instead of the default (which is host-specific and is determined at
-build time). The -T switch will output the data in rdb format (i.e.,
-with a 2-row header of column names and dashes, and with data columns
-separated by tabs). The -help switch will print out a message
-describing program usage.
-
-
-For example, consider the output from the following funcnts command:
-
- [sh] funcnts -sr snr.ev "ann 512 512 0 9 n=3"
- # source
- # data file: /proj/rd/data/snr.ev
- # arcsec/pixel: 8
- # background
- # constant value: 0.000000
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # summed background-subtracted results
- upto net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
- 2 625.000 25.000 0.000 0.000 6976.00 0.090 0.004
- 3 1442.000 37.974 0.000 0.000 15936.00 0.090 0.002
-
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
- 2 478.000 21.863 0.000 0.000 5376.00 0.089 0.004
- 3 817.000 28.583 0.000 0.000 8960.00 0.091 0.003
-
-
- # the following source and background components were used:
- source_region(s)
- ----------------
- ann 512 512 0 9 n=3
-
- reg counts pixels sumcnts sumpix
- ---- ------------ --------- ------------ ---------
- 1 147.000 25 147.000 25
- 2 478.000 84 625.000 109
- 3 817.000 140 1442.000 249
-
-
-There are four tables in this output. To extract the last one, you
-can execute:
-
- [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -n 4
- 1 147.000 25 147.000 25
- 2 478.000 84 625.000 109
- 3 817.000 140 1442.000 249
-
-Note that the output has been re-formatted so that only a single space
-separates each column, with no extraneous header or comment information.
-
-
-To extract only columns 1,2, and 4 from the last example (but with a header
-prepended and tabs between columns), you can execute:
-
- [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -c "1 2 4" -h -n 4 -s "\t"
- #reg counts sumcnts
- 1 147.000 147.000
- 2 478.000 625.000
- 3 817.000 1442.000
-
-
-Of course, if the output has previously been saved in a file named
-foo.out, the same result can be obtained by executing:
-
- [sh] funtbl -c "1 2 4" -h -n 4 -s "\t" foo.out
- #reg counts sumcnts
- 1 147.000 147.000
- 2 478.000 625.000
- 3 817.000 1442.000
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funtext.pod b/funtools/doc/pod/funtext.pod
deleted file mode 100644
index 9e20d1f..0000000
--- a/funtools/doc/pod/funtext.pod
+++ /dev/null
@@ -1,718 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funtext: Support for Column-based Text Files>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the options for processing column-based
-text files.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-
-Funtools will automatically sense and process "standard"
-column-based text files as if they were FITS binary tables without any
-change in Funtools syntax. In particular, you can filter text files
-using the same syntax as FITS binary tables:
-
- fundisp foo.txt'[cir 512 512 .1]'
- fundisp -T foo.txt > foo.rdb
- funtable foo.txt'[pha=1:10,cir 512 512 10]' foo.fits
-
-
-
-The first example displays a filtered selection of a text file. The
-second example converts a text file to an RDB file. The third example
-converts a filtered selection of a text file to a FITS binary table.
-
-
-Text files can also be used in Funtools image programs. In this case,
-you must provide binning parameters (as with raw event files), using
-the bincols keyword specifier:
-
-
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]
-
-
-For example:
-
- funcnts foo'[bincols=(x:1024,y:1024)]' "ann 512 512 0 10 n=10"
-
-
-B<Standard Text Files>
-
-
-Standard text files have the following characteristics:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-Optional comment lines start with #
-
-
-=item *
-
-Optional blank lines are considered comments
-
-
-=item *
-
-An optional table header consists of the following (in order):
-
-
-=over 4
-
-
-
-
-=item *
-
-a single line of alpha-numeric column names
-
-
-=item *
-
-an optional line of unit strings containing the same number of cols
-
-
-=item *
-
-an optional line of dashes containing the same number of cols
-
-
-=back
-
-
-
-
-=item *
-
-Data lines follow the optional header and (for the present) consist of
- the same number of columns as the header.
-
-
-=item *
-
-Standard delimiters such as space, tab, comma, semi-colon, and bar.
-
-
-=back
-
-
-
-
-Examples:
-
-
- # rdb file
- foo1 foo2 foo3 foos
- ---- ---- ---- ----
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
- # multiple consecutive whitespace and dashes
- foo1 foo2 foo3 foos
- --- ---- ---- ----
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
- # comma delims and blank lines
- foo1,foo2,foo3,foos
-
- 1,2.2,3,xxxx
- 10,20.2,30,yyyy
-
- # bar delims with null values
- foo1|foo2|foo3|foos
- 1||3|xxxx
- 10|20.2||yyyy
-
- # header-less data
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
-
-
-The default set of token delimiters consists of spaces, tabs, commas,
-semi-colons, and vertical bars. Several parsers are used
-simultaneously to analyze a line of text in different ways. One way
-of analyzing a line is to allow a combination of spaces, tabs, and
-commas to be squashed into a single delimiter (no null values between
-consecutive delimiters). Another way is to allow tab, semi-colon, and
-vertical bar delimiters to support null values, i.e. two consecutive
-delimiters implies a null value (e.g. RDB file). A successful parser
-is one which returns a consistent number of columns for all rows, with
-each column having a consistent data type. More than one parser can
-be successful. For now, it is assumed that successful parsers all
-return the same tokens for a given line. (Theoretically, there are
-pathological cases, which will be taken care of as needed). Bad parsers
-are discarded on the fly.
-
-
-If the header does not exist, then names "col1", "col2", etc. are
-assigned to the columns to allow filtering. Furthermore, data types
-for each column are determined by the data types found in the columns
-of the first data line, and can be one of the following: string, int,
-and double. Thus, all of the above examples return the following
-display:
-
- fundisp foo'[foo1>5]'
- FOO1 FOO2 FOO3 FOOS
- ---------- --------------------- ---------- ------------
- 10 20.20000000 30 yyyy
-
-
-B<Comments Convert to Header Params>
-
-
-Comments which precede data rows are converted into header parameters and
-will be written out as such using funimage or funhead. Two styles of comments
-are recognized:
-
-
-1. FITS-style comments have an equal sign "=" between the keyword and
-value and an optional slash "/" to signify a comment. The strict FITS
-rules on column positions are not enforced. In addition, strings only
-need to be quoted if they contain whitespace. For example, the following
-are valid FITS-style comments:
-
-
- # fits0 = 100
- # fits1 = /usr/local/bin
- # fits2 = "/usr/local/bin /opt/local/bin"
- # fits3c = /usr/local/bin /opt/local/bin /usr/bin
- # fits4c = "/usr/local/bin /opt/local/bin" / path dir
-
-
-Note that the fits3c comment is not quoted and therefore its value is the
-single token "/usr/local/bin" and the comment is "opt/local/bin /usr/bin".
-This is different from the quoted comment in fits4c.
-
-
-2. Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed. If a string
-is quoted, then slash "/" after the string will signify a comment.
-For example:
-
-
- # com1 /usr/local/bin
- # com2 "/usr/local/bin /opt/local/bin"
- # com3 /usr/local/bin /opt/local/bin /usr/bin
- # com4c "/usr/local/bin /opt/local/bin" / path dir
-
- # com11: /usr/local/bin
- # com12: "/usr/local/bin /opt/local/bin"
- # com13: /usr/local/bin /opt/local/bin /usr/bin
- # com14c: "/usr/local/bin /opt/local/bin" / path dir
-
-
-
-Note that com3 and com13 are not quoted, so the whole string is part of
-the value, while comz4c and com14c are quoted and have comments following
-the values.
-
-
-Some text files have column name and data type information in the header.
-You can specify the format of column information contained in the
-header using the "hcolfmt=" specification. See below for a detailed
-description.
-
-B<Multiple Tables in a Single File>
-
-
-Multiple tables are supported in a single file. If an RDB-style file
-is sensed, then a ^L (vertical tab) will signify end of
-table. Otherwise, an end of table is sensed when a new header (i.e.,
-all alphanumeric columns) is found. (Note that this heuristic does not
-work for single column tables where the column type is ASCII and the
-table that follows also has only one column.) You also can specify
-characters that signal an end of table condition using the B<eot=>
-keyword. See below for details.
-
-
-You can access the nth table (starting from 1) in a multi-table file
-by enclosing the table number in brackets, as with a FITS extension:
-
-
- fundisp foo'[2]'
-
-The above example will display the second table in the file.
-(Index values start at 1 in oder to maintain logical compatibility
-with FITS files, where extension numbers also start at 1).
-
-
-B<TEXT() Specifier>
-
-
-As with ARRAY() and EVENTS() specifiers for raw image arrays and raw
-event lists respectively, you can use TEXT() on text files to pass
-key=value options to the parsers. An empty set of keywords is
-equivalent to not having TEXT() at all, that is:
-
-
- fundisp foo
- fundisp foo'[TEXT()]'
-
-
-are equivalent. A multi-table index number is placed before the TEXT()
-specifier as the first token, when indexing into a multi-table:
-
- fundisp foo'[2,TEXT(...)]'
-
-
-The filter specification is placed after the TEXT() specifier, separated
-by a comma, or in an entirely separate bracket:
-
-
- fundisp foo'[TEXT(...),circle 512 512 .1]'
- fundisp foo'[2,TEXT(...)][circle 512 512 .1]'
-
-
-B<Text() Keyword Options>
-
-
-The following is a list of keywords that can be used within the TEXT()
-specifier (the first three are the most important):
-
-
-
-=over 4
-
-
-
-
-
-
-=item *
-
-delims="[delims]"
-
-
-Specify token delimiters for this file. Only a single parser having these
-delimiters will be used to process the file.
-
- fundisp foo.fits'[TEXT(delims="!")]'
- fundisp foo.fits'[TEXT(delims="\t%")]'
-
-
-
-
-
-=item *
-
-comchars="[comchars]"
-
-
-Specify comment characters. You must include "\n" to allow blank lines.
-These comment characters will be used for all standard parsers (unless delims
-are also specified).
-
- fundisp foo.fits'[TEXT(comchars="!\n")]'
-
-
-
-
-
-=item *
-
-cols="[name1:type1 ...]"
-
-
-Specify names and data type of columns. This overrides header
-names and/or data types in the first data row or default names and
-data types for header-less tables.
-
- fundisp foo.fits'[TEXT(cols="x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e")]'
-
-
-If the column specifier is the only keyword, then the cols= is not
-required (in analogy with EVENTS()):
-
- fundisp foo.fits'[TEXT(x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e)]'
-
-Of course, an index is allowed in this case:
-
- fundisp foo.fits'[2,TEXT(x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e)]'
-
-
-
-
-
-=item *
-
-eot="[eot delim]"
-
-
-Specify end of table string specifier for multi-table files. RDB
-files support ^L. The end of table specifier is a string and the whole
-string must be found alone on a line to signify EOT. For example:
-
- fundisp foo.fits'[TEXT(eot="END")]'
-
-will end the table when a line contains "END" is found. Multiple lines
-are supported, so that:
-
- fundisp foo.fits'[TEXT(eot="END\nGAME")]'
-
-will end the table when a line contains "END" followed by a line
-containing "GAME".
-
-In the absence of an EOT delimiter, a new table will be sensed when a new
-header (all alphanumeric columns) is found.
-
-
-
-
-=item *
-
-null1="[datatype]"
-
-
-Specify data type of a single null value in row 1.
-Since column data types are determined by the first row, a null value
-in that row will result in an error and a request to specify names and
-data types using cols=. If you only have a one null in row 1, you don't
-need to specify all names and columns. Instead, use null1="type" to
-specify its data type.
-
-
-
-
-=item *
-
-alen=[n]
-
-
-Specify size in bytes for ASCII type columns.
-FITS binary tables only support fixed length ASCII columns, so a
-size value must be specified. The default is 16 bytes.
-
-
-
-
-=item *
-
-nullvalues=["true"|"false"]
-
-
-Specify whether to expect null values.
-Give the parsers a hint as to whether null values should be allowed. The
-default is to try to determine this from the data.
-
-
-
-
-=item *
-
-whitespace=["true"|"false"]
-
-
-Specify whether surrounding white space should be kept as part of
-string tokens. By default surrounding white space is removed from
-tokens.
-
-
-
-
-=item *
-
-header=["true"|"false"]
-
-
-Specify whether to require a header. This is needed by tables
-containing all string columns (and with no row containing dashes), in
-order to be able to tell whether the first row is a header or part of
-the data. The default is false, meaning that the first row will be
-data. If a row dashes are present, the previous row is considered the
-column name row.
-
-
-
-
-=item *
-
-units=["true"|"false"]
-
-
-Specify whether to require a units line.
-Give the parsers a hint as to whether a row specifying units should be
-allowed. The default is to try to determine this from the data.
-
-
-
-
-=item *
-
-i2f=["true"|"false"]
-
-
-Specify whether to allow int to float conversions.
-If a column in row 1 contains an integer value, the data type for that
-column will be set to int. If a subsequent row contains a float in
-that same column, an error will be signaled. This flag specifies that,
-instead of an error, the float should be silently truncated to
-int. Usually, you will want an error to be signaled, so that you can
-specify the data type using cols= (or by changing the value of
-the column in row 1).
-
-
-
-
-=item *
-
-comeot=["true"|"false"|0|1|2]
-
-
-Specify whether comment signifies end of table.
-If comeot is 0 or false, then comments do not signify end of table and
-can be interspersed with data rows. If the value is true or 1 (the
-default for standard parsers), then non-blank lines (e.g. lines
-beginning with '#') signify end of table but blanks are allowed
-between rows. If the value is 2, then all comments, including blank
-lines, signify end of table.
-
-
-
-
-=item *
-
-lazyeot=["true"|"false"]
-
-
-Specify whether "lazy" end of table should be permitted (default is
-true for standard formats, except rdb format where explicit ^L is required
-between tables). A lazy EOT can occur when a new table starts directly
-after an old one, with no special EOT delimiter. A check for this EOT
-condition is begun when a given row contains all string tokens. If, in
-addition, there is a mismatch between the number of tokens in the
-previous row and this row, or a mismatch between the number of string
-tokens in the prev row and this row, a new table is assumed to have
-been started. For example:
-
- ival1 sval3
- ----- -----
- 1 two
- 3 four
-
- jval1 jval2 tval3
- ----- ----- ------
- 10 20 thirty
- 40 50 sixty
-
-Here the line "jval1 ..." contains all string tokens. In addition,
-the number of tokens in this line (3) differs from the number of
-tokens in the previous line (2). Therefore a new table is assumed
-to have started. Similarly:
-
- ival1 ival2 sval3
- ----- ----- -----
- 1 2 three
- 4 5 six
-
- jval1 jval2 tval3
- ----- ----- ------
- 10 20 thirty
- 40 50 sixty
-
-Again, the line "jval1 ..." contains all string tokens. The number of
-string tokens in the previous row (1) differs from the number of
-tokens in the current row(3). We therefore assume a new table as been
-started. This lazy EOT test is not performed if lazyeot is explicitly
-set to false.
-
-
-
-
-=item *
-
-hcolfmt=[header column format]
-
-
-Some text files have column name and data type information in the header.
-For example, VizieR catalogs have headers containing both column names
-and data types:
-
- #Column e_Kmag (F6.3) ?(k_msigcom) K total magnitude uncertainty (4) [ucd=ERROR]
- #Column Rflg (A3) (rd_flg) Source of JHK default mag (6) [ucd=REFER_CODE]
- #Column Xflg (I1) [0,2] (gal_contam) Extended source contamination (10) [ucd=CODE_MISC]
-
-
-while Sextractor files have headers containing column names alone:
-
-
- # 1 X_IMAGE Object position along x [pixel]
- # 2 Y_IMAGE Object position along y [pixel]
- # 3 ALPHA_J2000 Right ascension of barycenter (J2000) [deg]
- # 4 DELTA_J2000 Declination of barycenter (J2000) [deg]
-
-The hcolfmt specification allows you to describe which header lines
-contain column name and data type information. It consists of a string
-defining the format of the column line, using "$col" (or "$name") to
-specify placement of the column name, "$fmt" to specify placement of the
-data format, and "$skip" to specify tokens to ignore. You also can
-specify tokens explicitly (or, for those users familiar with how
-sscanf works, you can specify scanf skip specifiers using "%*").
-For example, the VizieR hcolfmt above might be specified in several ways:
-
- Column $col ($fmt) # explicit specification of "Column" string
- $skip $col ($fmt) # skip one token
- %*s $col ($fmt) # skip one string (using scanf format)
-
-while the Sextractor format might be specified using:
-
- $skip $col # skip one token
- %*d $col # skip one int (using scanf format)
-
-You must ensure that the hcolfmt statement only senses actual column
-definitions, with no false positives or negatives. For example, the
-first Sextractor specification, "$skip $col", will consider any header
-line containing two tokens to be a column name specifier, while the
-second one, "%*d $col", requires an integer to be the first token. In
-general, it is preferable to specify formats as explicitly as
-possible.
-
-
-Note that the VizieR-style header info is sensed automatically by the
-funtools standard VizieR-like parser, using the hcolfmt "Column $col
-($fmt)". There is no need for explicit use of hcolfmt in this case.
-
-
-
-
-=item *
-
-debug=["true"|"false"]
-
-
-Display debugging information during parsing.
-
-
-
-=back
-
-
-
-B<Environment Variables>
-
-
-Environment variables are defined to allow many of these TEXT() values to be
-set without having to include them in TEXT() every time a file is processed:
-
-
- keyword environment variable
- ------- --------------------
- delims TEXT_DELIMS
- comchars TEXT_COMCHARS
- cols TEXT_COLUMNS
- eot TEXT_EOT
- null1 TEXT_NULL1
- alen TEXT_ALEN
- bincols TEXT_BINCOLS
- hcolfmt TEXT_HCOLFMT
-
-
-B<Restrictions and Problems>
-
-
-As with raw event files, the '+' (copy extensions) specifier is not
-supported for programs such as funtable.
-
-
-String to int and int to string data conversions are allowed by the
-text parsers. This is done more by force of circumstance than by
-conviction: these transitions often happens with VizieR catalogs,
-which we want to support fully. One consequence of allowing these
-transitions is that the text parsers can get confused by columns which
-contain a valid integer in the first row and then switch to a
-string. Consider the following table:
-
- xxx yyy zzz
- ---- ---- ----
- 111 aaa bbb
- ccc 222 ddd
-
-The xxx column has an integer value in row one a string in row two,
-while the yyy column has the reverse. The parser will erroneously
-treat the first column as having data type int:
-
- fundisp foo.tab
- XXX YYY ZZZ
- ---------- ------------ ------------
- 111 'aaa' 'bbb'
- 1667457792 '222' 'ddd'
-
-while the second column is processed correctly. This situation can be avoided
-in any number of ways, all of which force the data type of the first column
-to be a string. For example, you can edit the file and explicitly quote the
-first row of the column:
-
- xxx yyy zzz
- ---- ---- ----
- "111" aaa bbb
- ccc 222 ddd
-
- [sh] fundisp foo.tab
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd'
-
-You can edit the file and explicitly set the data type of the first column:
-
- xxx:3A yyy zzz
- ------ ---- ----
- 111 aaa bbb
- ccc 222 ddd
-
- [sh] fundisp foo.tab
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd'
-
-You also can explicitly set the column names and data types of all columns,
-without editing the file:
-
- [sh] fundisp foo.tab'[TEXT(xxx:3A,yyy:3A,zzz:3a)]'
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd'
-
-The issue of data type transitions (which to allow and which to disallow)
-is still under discussion.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/funtools.pod b/funtools/doc/pod/funtools.pod
deleted file mode 100644
index ff43cfb..0000000
--- a/funtools/doc/pod/funtools.pod
+++ /dev/null
@@ -1,542 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funtools: FITS Users Need Tools>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-This document is the Table of Contents for Funtools.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-Funtools, is a "minimal buy-in" FITS library and utility package developed
-at the the High Energy Astrophysics Division of SAO. The Funtools
-library provides simplified access to a wide array of file types:
-standard astronomical FITS images and binary tables, raw arrays and
-binary event lists, and even tables of ASCII column data. A
-sophisticated region filtering library (compatible with ds9) filters
-images and tables using boolean operations between geometric shapes,
-support world coordinates, etc. Funtools also supports advanced
-capabilities such as optimized data searching using index files.
-
-The main goal of the Funtools project has been to develop a minimal buy-in
-FITS library for researchers who are occasional (but serious) coders. In
-this case, "minimal buy-in" means "easy to learn, easy to use, and easy to
-re-learn next month". We have tried to achieve this goal by emphasizing two
-essential capabilities. The first is the ability to develop FITS programs
-without knowing much about FITS, i.e., without having to deal with the
-arcane rules for generating a properly formatted FITS file. The second is
-to support the use of already-familiar C/Unix facilities, especially C
-structs and Unix stdio. Taken together, these two capabilities should allow
-researchers to leverage their existing programming expertise while
-minimizing the need to learn new and complex coding rules.
-
-
-
-
-Choose from the following topics:
-
-
-
-
-=over 4
-
-
-
-
-=item *
-
-Funtools User Programs
-
-
-=over 4
-
-
-
-
-=item *
-
-funcalc: Funtools calculator (for binary tables)
-[funcalc(1)]
-
-
-=item *
-
-funcen: find centroid (for binary tables)
-[funcen(1)]
-
-
-=item *
-
-funcnts: count photons in specified regions
-[funcnts(1)]
-
-
-=item *
-
-funcone: cone search on RA, Dec columns
-[funcone(1)]
-
-
-=item *
-
-fundisp: display data in a Funtools data file
-[fundisp(1)]
-
-
-=item *
-
-funhead: display a header in a Funtools file
-[funhead(1)]
-
-
-=item *
-
-funhist: create a 1D histogram of a column
-[funhist(1)]
-
-
-=item *
-
-funimage: create a FITS image from a Funtools data file
-[funimage(1)]
-
-
-=item *
-
-funindex: create an index on a column in a binary table
-[funindex(1)]
-
-
-=item *
-
-funjoin: join two or more FITS binary tables on specified columns
-[funjoin(1)]
-
-
-=item *
-
-funmerge: merge one or more Funtools table files
-[funmerge(1)]
-
-
-=item *
-
-funsky: convert between image and sky coordinates, using WCS info from a FITS header
-[funsky(1)]
-
-
-=item *
-
-funtable: copy selected rows from a Funtools file to a FITS binary table
-[funtable(1)]
-
-
-=item *
-
-funtbl: extract a table from
-Funtools ASCII output
-[funtbl(1)]
-
-
-=item *
-
-funtools and ds9 image display
-[funds9(n)]
-
-
-=back
-
-
-
-
-
-=item *
-
-Funtools Programming
-
-
-=over 4
-
-
-
-
-=item *
-
-Funtools Programming Summary
-[funlib(3)]
-
-
-=item *
-
-Funtools Programming Tutorial
-[funlib(3)]
-
-
-=item *
-
-A Short Digression on Subroutine Order
-[funlib(3)]
-
-
-=item *
-
-Compiling and Linking
-[funlib(3)]
-
-
-=item *
-
-The Funtools Reference Handle
-[funlib(3)]
-
-
-=item *
-
-The Funtools Programming Reference Manual
-
-
-=over 4
-
-
-
-
-=item *
-
-FunOpen: open a Funtools file
-[funopen(3)]
-
-
-=item *
-
-FunImageGet: retrieve image data
-[funimageget(3)]
-
-
-=item *
-
-FunImagePut: output image data
-[funimageput(3)]
-
-
-=item *
-
-FunImageRowGet: retrieve image data by row
-[funimagerowget(3)]
-
-
-=item *
-
-FunImageRowPut: output image data by row
-[funimagerowput(3)]
-
-
-=item *
-
-FunTableRowGet: retrieve rows from a table
-[funtablerowget(3)]
-
-
-=item *
-
-FunTableRowPut: output rows to a table
-[funtablerowput(3)]
-
-
-=item *
-
-FunColumnSelect: select columns in a table for access
-[funcolumnselect(3)]
-
-
-=item *
-
-FunColumnActivate: activate columns in a table for read/write
-[funcolumnactivate(3)]
-
-
-=item *
-
-FunColumnLookup: lookup info about the columns in a table
-[funcolumnlookup(3)]
-
-
-=item *
-
-FunInfoGet: get info about an image or table
-[funinfoget(3)]
-
-
-=item *
-
-FunInfoPut: put info about an image or table
-[funinfoput(3)]
-
-
-=item *
-
-FunParamGet: get header param
-[funparamget(3)]
-
-
-=item *
-
-FunParamPut: put header param
-[funparamput(3)]
-
-
-=item *
-
-FunFlush: flush I/O in a Funtools file
-[funflush(3)]
-
-
-=item *
-
-FunClose: close a Funtools file
-[funclose(3)]
-
-
-=back
-
-
-
-
-
-=item *
-
-Funtools Programming Examples
-[funlib(3)]
-
-
-=over 4
-
-
-
-
-=item *
-
-evmerge: merge new columns with existing columns
-
-
-=item *
-
-evcols: add column and rows to binary tables
-
-
-=item *
-
-imblank: blank out image values below a threshold
-
-
-=back
-
-
-
-
-=back
-
-
-
-
-
-=item *
-
-Funtools Data Files
-[funfiles(n)]
-
-
-=over 4
-
-
-
-
-=item *
-
-Supported Data Formats
-
-
-=over 4
-
-
-
-
-=item *
-
-FITS File and Extensions
-
-
-=item *
-
-Non-FITS Raw Event Files
-
-
-=item *
-
-Non-FITS Array Files
-
-
-=item *
-
-Column-based Text (ASCII) Files
-
-
-=item *
-
-Database Views of Tables
-
-
-=back
-
-
-
-
-=item *
-
-Image Sections and Blocking
-
-
-=item *
-
-Binning FITS Binary Tables and Non-FITS Event Files
-
-
-=item *
-
-Disk Files and Other Supported File Types
-
-
-=back
-
-
-
-
-
-=item *
-
-Funtools Data Filtering
-
-
-=over 4
-
-
-
-
-=item *
-
-Table Filtering
-[funfilters(n)]
-
-
-=item *
-
-Fast Table Filtering using Indexes
-[funidx(n)]
-
-
-=item *
-
-Spatial Region Filtering
-[funregions(n)]
-
-
-=over 4
-
-
-
-
-=item *
-
-Region Geometry
-[reggeometry(n)]
-
-
-=item *
-
-Region Algebra
-[regalgebra(n)]
-
-
-=item *
-
-Region Coordinates
-[regcoords(n)]
-
-
-=item *
-
-Region Boundaries
-[regbounds(n)]
-
-
-=item *
-
-Differences Between Funtools and IRAF Regions
-[regdiff(n)]
-
-
-=back
-
-
-
-
-=item *
-
-Combining Table and Region Filters
-[funcombine(n)]
-
-
-=back
-
-
-
-
-
-=item *
-
-Miscellaneous
-
-
-=over 4
-
-
-
-
-=item *
-
-Funtools Environment Variables
-[funenv(n)]
-
-
-=item *
-
-Funtools ChangeLog
-
-
-=back
-
-
-
-
-
-=back
-
-
-
-
-
-
-=cut
diff --git a/funtools/doc/pod/funview.pod b/funtools/doc/pod/funview.pod
deleted file mode 100644
index f0c2095..0000000
--- a/funtools/doc/pod/funview.pod
+++ /dev/null
@@ -1,407 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funview: Database View Support for Tables>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the options for utilizing
-database-inspired Views of tables.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-B<Database Views>
-
-In database parlance, a B<View> defines a "virtual table", i.e.,
-a description of row and/or column selection filters (but with no
-permanent storage space allocated). When used in place of a table, a
-View selects the specified rows and/or columns from one or more real
-tables. Views enable you to see complicated data tables in a more
-convenient format. They also can be used as a security mechanism, by
-restricting user access to specific columns and/or rows. [See:
-
-http://www.cs.unibo.it/~ciaccia/COURSES/RESOURCES/SQLTutorial/sqlch5.htm
-
-for a good discussion of SQL Views.]
-
-
-Funtools supports an expanded notion of Views for all tabular data
-(FITS tables, raw binary tables, and ASCII column files). Funtools
-Views allow you to pre-set values for the filter specification, the
-columns to activate, and display format (though the latter is for
-fundisp only). Setting the filter and column activation values
-provides functionality equivalent to that of a classical database
-View, while the ability to set the format is similar to classical
-report writing capabilities.
-
-B<Funtools View Attributes>
-
-A Funtools View is a text file containing one or more of the following
-columns:
-
- column description
- ------ -----------------------------
- view name of view
- file data file name or template
- filter filter specification
- columns columns to activate
- format fundisp format specification
-
-All of the attribute columns are optional, including
-the B<view> name itself. This means that a View can be named or
-unnamed. Unnamed Views can refer to a specific file or a template of
-files (obviously if neither the view or the file column is specified,
-the input View specification will never be used). You can specify any
-combination of filter, column, and format parameters. (It also is
-possible to apply file-specific View to other files; see the discussion
-on B<View Lists> below). Each column has a size limit of 1024 characters.
-
-
-For example, consider the following View file:
-
- view file format columns filter
- ---- ---------------------- ------ ------------ -------
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
- x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
- x1 ${HOME}/data/snr.ev cir 512 512 .1
- x1a ${HOME}/data/snr.ev x y pi pha
- x0 ${HOME}/data/snr.ev
- xf I=%4d
- xc x y pi pha
- xr cir 512 512 .1
- *.ev x y pi pha
- *.fit x y dx dy cir 400 400 3
- *.fits I=%3d x y dx dy cir 400 400 3
-
-This database example is in rdb format, i.e. using tab delimiters and
-permitting null values. Any valid ASCII table format is acceptable,
-but if you use a format that does not permit null values, it will be
-necessary to quote the null strings.
-
-
-The first five entries (x3, x2, x1, x1a, x0) are named entries defining
-default values specifically for the snr.ev data file. Typically, you
-would use these Views by specifying View name, and the corresponding
-file, filter, column, and format values would be used. Note that the x0
-View is essentially an alias for the pathname of this file.
-
-
-The next three entries define defaults that can be applied to any
-file. You typically would use these View names in conjunction with
-a specific file name (see B<View Lists> below) so that the associated
-parameter(s) were applied to that file.
-
-
-The last three entry in the database define unnamed Views that
-pertains to all files ending with the specified templates. In these
-cases, any View that specifies a file name matching the file template
-would be processed with the associated parameter attributes.
-
-B<Invoking a Funtools View (in Place of an Input File)>
-
-To use a Funtools View, you simply pre-pend the "v:" prefix to a View name or
-a file name where an input file name usually is specified. For example:
-
- fundisp v:x3
-
-specifies that the View named x3 (with its file name and associated
-parameters) is processed as the input file to fundisp. Using the
-example database, above, this is equivalent to:
-
- fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-
-That is, the format is used with fundisp's -f (format) switch, while the
-filename and extension are composed of the x3 View's filename and
-region filter.
-
-
-Similarly, executing a command such as:
-
- fundisp v:foo.fit
-
-will match the unnamed View associated with the template "*.fit".
-This is equivalent to executing:
-
- fundisp foo.fit'[cir 400 400 3]' "x y dx dy"
-
-Of course, if you omit the "v:" prefix, then no View processing takes place:
-
- fundisp foo.fit # process foo.fit without any View parameters
- fundisp x3 # error (assuming there is no file named x3)
-
-
-B<Basic View Matching Rules>
-
-
-When a "v:" prefix is recognized, Funtools searches for a View database
-file in the following order:
-
- location description
- ------------ ------------------------------------
- FUN_VIEWFILE environment variable (any file name)
- ./.funtools.vu hidden file, default name
- $HOME/.funtools.vu hidden file, default name
-
-The first View database file located is used to construct a new
-filename, as well as an activation column specification and a format
-specification. The following rules are used:
-
-
-1. An attempt is made to match the input name (i.e., the part of the
-input View after the "v:" prefix) against the B<view> column value
-(if present) of each row in the database. If a match is found, the
-values of all non-blank columns are saved for later use. Also note
-that the first match terminates the search: i.e., the order of the
-database rows matters.
-
-
-2. If no B<view> match is made, an attempt is made to match the input
-name against the B<file> column value (if present). Matching is
-performed on the full pathname of both the input name and the
-database file name, and on the non-directory (root) part of these
-files. This means that the root specification:
-
- fundisp v:snr.ev
-
-will match a row in the database that has a full pathname in the file,
-allowing you to use a B<file>-matched View without having to
-specify the full pathname. In this example, the "v:snr.ev" View
-specification will match the first row (v:x3) in the database:
-
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
-
-even though the row contains a fully qualified pathname as the file
-value. Once again, values of all non-blank columns are saved, and the
-first match terminates the search.
-
-
-3. If neither a B<view> or a B<view> match has been found,
-then a simple template match is attempted against the B<view>
-values. Template matching supports a simplified version of file
-globbing (not a regular expression), with support for a single "*"
-(all characters), "?" (single character), or "[...]" (range) specification.
-
-
-4. If no template match was found on the B<view> column, then a
-simple template match is attempted against the B<file> columns.
-
-
-5. If no match is found, then the filename (minus the "v:" prefix) is
-returned.
-
-B<More on View Matching Rules: Single vs. Multiple Matches >
-
-The matching rules described above stop after the first match,
-regardless of whether that match provides values for all three
-parameters (filter, columns, and format). In cases where a B<view>
-or B<file> match does not provide all three values, it is possible
-that a template match might do so. With regard to the example View
-database above, the x1 View provides only a filter, while omitting
-both the format and columns values. But note that the final rows in
-the database could provide the values via a template match on the
-filename. This sort of multiple matching is especially valuable in
-order to provide "global" values to several Views.
-
-
-Obviously, multiple matching might not be wanted in every
-case. Therefore, we support both multiple matching and single matching
-according to the value of the FUN_VIEWMATCH environment variable. If
-the FUN_VIEWMATCH environment variable exists and if its value begins
-with "s", then a single match is used and missing parameters are not
-filled in with subsequent template matches on the file name. That is,
-matching rules above are followed exactly as explained above. If the
-value of this environment variable begins with "m" (or does not exist),
-then multiple matches are used to try to fill in missing parameters.
-In this case, template matching always takes place and missing values are
-taken from these template matches.
-
-
-Thus, in the example above, the View specification:
-
- fundisp v:x1
-
-will take the file name and filter value from the x1 View:
-
- x1 ${HOME}/data/snr.ev cir 512 512 .1
-
-The column value then will be taken from the "*.ev" file template match
-against the x1 file name:
-
- *.ev x y pi pha
-
-Note once again that order is important: missing values are taken in the
-order in which the template matches are processed.
-
-B<View Lists: Applying a View to Any File>
-
-
-It is possible to apply a named View, or even several Views, to any
-data file by appending a B<viewlist> immediately after the standard "v:"
-prefix. A viewlist takes the form:
-
- :v1,v2,...vn:
-
-where v1, v2, etc. are named Views. The two ":" colon characters surrounding
-the list are required. Thus, the syntax for applying a viewlist to a file is:
-
- v::view1,view2,...viewn:filename
-
-Note that the name after the last ":" is assumed to be a file; it is
-not permissible (or sensible) to use a View name.
-
-
-For example, the View specification:
-
- fundisp v::x2:foo
-
-applies the x2 View to the file foo (even if there is a View named foo)
-and (in using our example database) is equivalent to:
-
- ./fundisp foo'[cir 512 512 .1] "x y pi pha"
-
-The same command can be effected using a list of Views:
-
- fundisp v::x1,x1a:foo
-
-
-
-What happens if a viewlist is used and the file also matches a
-template? Consider, for example, this View specification:
-
- fundisp v::x2:foo.fit
-
-Here, the x2 View will supply filter and column values, while the
-template *.fit can also supply (different) filter and column
-values. In this case, the explicitly specified Views of the viewlist
-trump the matched view values.
-
-
-On the other hand, if a file template match can supply a View value
-that is not supplied by the viewlist, then that value will be taken
-from the file template match. For example:
-
- fundisp v::x2:foo.fits
-
-does not explicitly supply a format value, but the file match on *.fits
-can and does. You can avoid supplying missing values using file template
-matching by replacing the first ":" with a "-" in a viewlist
-specification:
-
- fundisp v:-x2:foo.fits
-
-The use of ":+" to explicitly allow file template matching is also
-supported, but is the same as the default case. Note that the nuances
-of viewlist support are subject to change as our experience and
-understanding grow.
-
-B<Overriding Values Associated with a View>
-
-
-To override values associated with a View, simply supply the override
-values in the correct place on the command line. Thus, given
-the example database described above, the command:
-
- fundisp v:x3
-
-specifies that the View named x3, along with its file name and
-associated parameters, be processed as the input file to fundisp in
-this way:
-
- fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-
-To override one or more of these values, simply specify a new value
-for the format, filter, or columns. For example, if your input View file
-contains a filter, then the View will use that filter as an override
-of the View filter:
-
- fundisp v:x3'[cir 400 400 3]'
-
-will use the columns and format of the x3 View but not the x3 filter. Further
-examples are:
-
- fundisp v:x3 "x y dx dy" # activate a different set of columns
- fundisp -f "I=%3d" v:x3 # use a different format statement
-
-
-
-Note that extension names, extension index values, and other
-non-filter specifications B<do not> override the View
-filter. Thus:
-
- fundisp v:foo.fit[3]
-
-will still use the filter associated with the .fit template (see above), since
-the "3" is an extension index, not a filter.
-
-B<Environment Variables>
-
-The following environment variables are used by Funtools Views:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<FUN_VIEWNAME>
-
-
-The B<FUN_VIEWNAME> environment variable specifies the
-name and location of the View database file. If not present, the
-files ./.funtools.vu and $HOME/.funtools.vu are searched for, in
-that order.
-
-
-
-=item *
-
-B<FUN_VIEWMATCH>
-
-
-The B<FUN_VIEWMATCH> environment variable specifies whether a
-single match or multiple match algorithm is used to locate parameter
-values. If the value of this environment variable begins with "s",
-then a single match is used and missing parameters are not filled in
-with subsequent template matches on the file name. If the value begins
-with "m", then multiple matches are used to try to fill in missing
-parameters. The default is to use multiple matches.
-
-
-=back
-
-
-
-B<Restrictions and Problems>
-
-Support for overriding a filter (while not overriding extension names,
-extension indexes, etc.) requires that we can sense the presence of a
-filter in a bracket specification. It is unclear yet whether our
-algorithm is perfect.
-
-
-Go to Funtools Help Index
-
-Last updated: August 3, 2007
-
-
-
-
-
-=cut
diff --git a/funtools/doc/pod/funvu.pod b/funtools/doc/pod/funvu.pod
deleted file mode 100644
index 528ea50..0000000
--- a/funtools/doc/pod/funvu.pod
+++ /dev/null
@@ -1,404 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<Funvu: database View support for tables>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document contains a summary of the options for utilizing
-database-inspired Views of tables.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-B<Database Views>
-
-In database parlance, a B<View> defines a "virtual table", i.e.,
-a description of row and/or column selection filters (but with no
-permanent storage space allocated). When used in place of a table, a
-View selects the specified rows and/or columns from one or more real
-tables. Views enable users to see complicated data tables in a more
-convenient format. They also can be used as a security mechanism, by
-restricting user access to specific columns and/or rows. [See:
-http://www.cs.unibo.it/~ciaccia/COURSES/RESOURCES/SQLTutorial/sqlch5.htm
-for a good discussion of SQL Views.]
-
-
-Funtools supports an expanded notion of Views for all tabular data
-(FITS tables, raw binary tables, and ASCII column files). Funtools
-Views allow you to pre-set values for the filter specification, the
-columns to activate and display format (though the latter is for
-fundisp only). Setting the filter and column activation values
-provides functionality equivalent to that of a classical database
-View, while the ability to set the format is similar to classical
-report writing capabilities.
-
-B<Funtools View Attributes>
-
-A Funtools View consists of one or more of the following attributes:
-
- column description
- ------ -----------------------------
- view name of view
- file data file name or template
- filter filter specification
- columns columns to activate
- format fundisp format specification
-
-All of the attribute columns are optional, including
-the B<view> name itself. This means that a View can be named or
-unnamed. Unnamed Views can refer to a specific file or a template of
-files (obviously if neither the view or the file column is specified,
-the input View specification will never be used). You can specify any
-combination of filter, column, and format parameters. (It also is
-possible to apply file-specific View to other files; see the discussion
-on B<View Lists> below). Each column has a size limit of 1024 characters.
-
-
-For example, consider the following View database:
-
- view file format columns filter
- ---- ---------------------- ------ ------------ -------
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
- x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
- x1 ${HOME}/data/snr.ev cir 512 512 .1
- x1a ${HOME}/data/snr.ev x y pi pha
- x0 ${HOME}/data/snr.ev
- xf I=%4d
- xc x y pi pha
- xr cir 512 512 .1
- *.ev x y pi pha
- *.fit x y dx dy cir 400 400 3
- *.fits I=%3d x y dx dy cir 400 400 3
-
-This database example is in rdb format, i.e. using tab delimiters and
-permitting null values. Any valid ASCII table format is acceptable,
-but if you use a format that does not permit null values, it will be
-necessary to quote the null strings.
-
-
-The first five entries (x3, x2, x1, x1a, x0) are named entries defining
-default values specifically for the snr.ev data file. Typically, you
-would use these Views by specifying View name, and the corresponding
-file, filter, column, and format values would be used. Note that the x0
-View is essentially an alias for the pathname of this file.
-
-
-The next three entries define defaults that can be applied to any
-file. Here, you typically would use these View names in conjunction with
-a specific file name (see B<View Lists> below) so that the associated
-parameter(s) were applied to that file.
-
-
-The last three entry in the database define unnamed Views that
-pertains to all files ending with the specified templates. In these
-cases, any View that specifies a file name matching the file template
-would be processed with the associated parameter attributes.
-
-B<Invoking a Funtools View (in Place of an Input File)>
-
-To specify a Funtools View, pre-pend the "v:" prefix to a View name or
-a file name where an input file name usually is specified. For example:
-
- fundisp v:x3
-
-specifies that the View named x3, its file name and associated
-parameters, be processed as the input file to fundisp. Using the
-example database, above, this is equivalent to:
-
- fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-
-That is, the format is used with fundisp's -f (format) switch, while the
-filename and extension are composed of the x3 View's filename and
-region filter.
-
-
-Similarly, executing a command such as:
-
- fundisp v:foo.fit
-
-will match the unnamed View associated with the template "*.fit".
-This is equivalent to executing:
-
- fundisp foo.fit'[cir 400 400 3]' "x y dx dy"
-
-Of course, if you omit the "v:" prefix, then no View processing takes place:
-
- fundisp foo.fit # process foo.fit without any View parameters
- fundisp x3 # error (assuming there is no file named x3)
-
-
-B<Basic View Matching Rules>
-
-
-When a "v:" prefix is recognized, Funtools searches for a View database
-file in the following order:
-
- location description
- ------------ ------------------------------------
- FUN_VIEWFILE environment variable (any file name)
- ./.funtools.vu hidden file, default name
- $HOME/.funtools.vu hidden file, default name
-
-The first View database file located is used to construct a new
-filename, as well as an activation column specification and a format
-specification. The following rules are used:
-
-
-1. An attempt is made to match the input name (i.e. the part of the
-input View after the "v:" prefix) against the B<view> column value
-(if present) of each row in the database. If a match is found, the
-values of all non-blank columns are saved for later use. Also note
-that the first match terminates the search: i.e. the order of the
-database rows does matter.
-
-
-2. If no B<view> match is made, an attempt is made to match the input
-name against the B<file> column value (if present). Matching is
-performed on the full pathname of both the input name and the
-database file name, and on the non-directory (root) part of these
-files. This means that the root specification:
-
- fundisp v:snr.ev
-
-will match a row in the database that has a full pathname in the file,
-allowing you to use a B<file>-matched View without having to
-specify the full pathname. In this example, the "v:snr.ev" View
-specification will match the first row (v:x3) in the database:
-
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
-
-even though the row contains a fully qualified pathname as the file
-value. Once again, values of all non-blank columns are saved, and the
-first match terminates the search.
-
-
-3. If neither a B<view> or a B<view> match has been found,
-then a simple template is attempted against the B<view>
-values. The template matching supports a simplified version of file
-globbing (not a regular expression), with support for a single "*"
-(all characters), "?" (single character), or "[...]" (range) specification.
-
-
-4. If no template match was found on the B<view> column, then a
-simple template match is attempted against the B<file> columns.
-
-
-5. If no match is found, then the filename (minus the "v:" prefix) is
-returned.
-
-B<More on View Matching Rules: Single vs. Multiple Matches >
-
-The matching rules described above stop after the first match,
-regardless of whether that match provides values for all three
-parameters (filter, columns, and format). In cases where a B<view>
-or B<file> match does not provide all three values, it is possible
-that a template match might do so. With regard to the example View
-database above, the x1 View provides only a filter, while omitting
-both the format and columns values. But note that the final rows in
-the database could provide the values via a template match on the
-filename. This sort of multiple matching is especially valuable in
-order to provide "global" values to several Views.
-
-
-Obviously, multiple matching might not be wanted in every
-case. Therefore, we support both multiple matching and single matching
-according to the value of the FUN_VIEWMATCH environment variable. If
-the FUN_VIEWMATCH environment variable exists and if its value begins
-with "s", then a single match is used and missing parameters are not
-filled in with subsequent template matches on the file name. That is,
-matching rules above are followed exactly as explained above. If the
-value of this environment variable begins with "m" (or does not exist),
-then multiple matches are used to try to fill in missing parameters.
-In this case, template matching always takes place and missing values are
-taken from these template matches.
-
-
-Thus, in the example above, the View specification:
-
- fundisp v:x1
-
-will take the file name and filter value from the x1 View:
-
- x1 ${HOME}/data/snr.ev cir 512 512 .1
-
-The column value then will be taken from the "*.ev" file template match
-against the x1 file name:
-
- *.ev x y pi pha
-
-Note once again that order is important: missing values are taken in the
-order in which the template matches are processed.
-
-B<View Lists: Applying a View to Any File>
-
-
-It is possible to apply a named View, or even several Views, to any
-data file by appending a B<viewlist> immediately after the standard "v:"
-prefix. A viewlist takes the form:
-
- :v1,v2,...vn:
-
-where v1, v2, etc. are named Views. The two ":" colon characters surrounding
-the list are required. Thus, the syntax for applying a viewlist to a file is:
-
- v::view1,view2,...viewn:filename
-
-Note that the name after the last ":" is assumed to be a file; it is
-not permissible (or sensible) to use a View name.
-
-
-For example, the View specification:
-
- fundisp v::x2:foo
-
-applies the x2 View to the file foo (even if there is a View named foo)
-and (in using our example database) is equivalent to:
-
- ./fundisp foo'[cir 512 512 .1] "x y pi pha"
-
-The same command can be effected using a list of Views:
-
- fundisp v::x1,x1a:foo
-
-
-
-What happens if a viewlist is used and the file also matches a
-template? Consider, for example, this View specification:
-
- fundisp v::x2:foo.fit
-
-Here, the x2 View will supply filter and column values, while the
-template *.fit can also supply (different) filter and column
-values. In this case, the explicitly specified Views of the viewlist
-trump the matched view values.
-
-
-On the other hand, if a file template match can supply a View value
-that is not supplied by the viewlist, then that value will be taken
-from the file template match. For example:
-
- fundisp v::x2:foo.fits
-
-does not explicitly supply a format value, but the file match on *.fits
-can and does. You can avoid supplying missing values using file template
-matching by replacing the first ":" with a "-" in a viewlist
-specification:
-
- fundisp v:-x2:foo.fits
-
-The use of ":+" to explicitly allow file template matching is also
-supported, but is the same as the default case. Note that the nuances
-of viewlist support are subject to change as our experience and
-understanding grows.
-
-B<Overriding Values Associated with a View>
-
-
-To override values associated with a View, simply supply the override
-values in the correct place on the command line. For example, given
-the example database described above, the command:
-
- fundisp v:x3
-
-specifies that the View named x3, along with its file name and
-associated parameters, be processed as the input file to fundisp in
-this way:
-
- fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-
-To override one or more of these values, simply specify a new value
-for the format, filter, or columns. For example, if your input View file
-contains a filter, then the View will use that filter as an override
-of the View filter:
-
- fundisp v:x3'[cir 400 400 3]'
-
-will use the columns and format of the x3 View but not the x3 filter. Further
-examples are:
-
- fundisp v:x3 "x y dx dy" # activate a different set of columns
- fundisp -f "I=%3d" v:x3 # use a different format statement
-
-
-
-Note that extension names, extension index values, and other
-non-filter specifications B<do not> override the View
-filter. Thus:
-
- fundisp v:foo.fit[3]
-
-will still use the filter associated with the .fit template (see above), since
-the "3" is an extension index, not a filter.
-
-B<Environment Variables>
-
-The following environment variables are used by Funtools Views:
-
-
-=over 4
-
-
-
-
-=item *
-
-B<FUN_VIEWNAME>
-
-
-The B<FUN_VIEWNAME> environment variable specifies the
-name and location of the View database file. If not present, the
-files ./.funtools.vu and $HOME/.funtools.vu are searched for, in
-that order.
-
-
-
-=item *
-
-B<FUN_VIEWMATCH>
-
-
-The B<FUN_VIEWMATCH> environment variable specifies whether a
-single match or multiple match algorithm is used to locate parameter
-values. If the value of this environment variable begins with "s",
-then a single match is used and missing parameters are not filled in
-with subsequent template matches on the file name. If the value begins
-with "m", then multiple matches are used to try to fill in missing
-parameters. The default is to use multiple matches.
-
-
-=back
-
-
-
-B<Restrictions and Problems>
-
-Support for overriding a filter (while not overriding extension names,
-extension indexes, etc.) requires that we can sense the presence of a
-filter in a bracket specification. It is unclear yet whether our
-algorithm is perfect.
-
-
-Go to Funtools Help Index
-
-Last updated: January 3, 2006
-
-
-
-
-
-=cut
diff --git a/funtools/doc/pod/regalgebra.pod b/funtools/doc/pod/regalgebra.pod
deleted file mode 100644
index 4c6da88..0000000
--- a/funtools/doc/pod/regalgebra.pod
+++ /dev/null
@@ -1,286 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<RegAlgebra: Boolean Algebra on Spatial Regions>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document describes the boolean arithmetic defined for
-region expressions.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-When defining a region, several shapes can be combined using boolean
-operations. The boolean operators are (in order of precedence):
-
- Symbol Operator Associativity
- ------ -------- -------------
- ! not right to left
- & and left to right
- ^ exclusive or left to right
- | inclusive or left to right
-
-
-For example, to create a mask consisting of a large circle with a
-smaller box removed, one can use the B<and> and B<not>
-operators:
-
- CIRCLE(11,11,15) & !BOX(11,11,3,6)
-
-
-and the resulting mask is:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:1111111111111111111111..................
- 2:1111111111111111111111..................
- 3:11111111111111111111111.................
- 4:111111111111111111111111................
- 5:111111111111111111111111................
- 6:1111111111111111111111111...............
- 7:1111111111111111111111111...............
- 8:1111111111111111111111111...............
- 9:111111111...1111111111111...............
- 10:111111111...1111111111111...............
- 11:111111111...1111111111111...............
- 12:111111111...1111111111111...............
- 13:111111111...1111111111111...............
- 14:111111111...1111111111111...............
- 15:1111111111111111111111111...............
- 16:1111111111111111111111111...............
- 17:111111111111111111111111................
- 18:111111111111111111111111................
- 19:11111111111111111111111.................
- 20:1111111111111111111111..................
- 21:1111111111111111111111..................
- 22:111111111111111111111...................
- 23:..11111111111111111.....................
- 24:...111111111111111......................
- 25:.....11111111111........................
- 26:........................................
- 27:........................................
- 28:........................................
- 29:........................................
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................
-
-A three-quarter circle can be defined as:
-
- CIRCLE(20,20,10) & !PIE(20,20,270,360)
-
-
-and looks as follows:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:........................................
- 2:........................................
- 3:........................................
- 4:........................................
- 5:........................................
- 6:........................................
- 7:........................................
- 8:........................................
- 9:........................................
- 10:........................................
- 11:...............111111111................
- 12:..............11111111111...............
- 13:............111111111111111.............
- 14:............111111111111111.............
- 15:...........11111111111111111............
- 16:..........1111111111111111111...........
- 17:..........1111111111111111111...........
- 18:..........1111111111111111111...........
- 19:..........1111111111111111111...........
- 20:..........1111111111111111111...........
- 21:..........1111111111....................
- 22:..........1111111111....................
- 23:..........1111111111....................
- 24:..........1111111111....................
- 25:...........111111111....................
- 26:............11111111....................
- 27:............11111111....................
- 28:..............111111....................
- 29:...............11111....................
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................
-
-Two non-intersecting ellipses can be made into the same region:
-
- ELL(20,20,10,20,90) | ELL(1,1,20,10,0)
-
-
-and looks as follows:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:11111111111111111111....................
- 2:11111111111111111111....................
- 3:11111111111111111111....................
- 4:11111111111111111111....................
- 5:1111111111111111111.....................
- 6:111111111111111111......................
- 7:1111111111111111........................
- 8:111111111111111.........................
- 9:111111111111............................
- 10:111111111...............................
- 11:...........11111111111111111............
- 12:........111111111111111111111111........
- 13:.....11111111111111111111111111111......
- 14:....11111111111111111111111111111111....
- 15:..11111111111111111111111111111111111...
- 16:.1111111111111111111111111111111111111..
- 17:111111111111111111111111111111111111111.
- 18:111111111111111111111111111111111111111.
- 19:111111111111111111111111111111111111111.
- 20:111111111111111111111111111111111111111.
- 21:111111111111111111111111111111111111111.
- 22:111111111111111111111111111111111111111.
- 23:111111111111111111111111111111111111111.
- 24:.1111111111111111111111111111111111111..
- 25:..11111111111111111111111111111111111...
- 26:...11111111111111111111111111111111.....
- 27:.....11111111111111111111111111111......
- 28:.......111111111111111111111111.........
- 29:...........11111111111111111............
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................
-
-You can use several boolean operations in a single region expression,
-to create arbitrarily complex regions. With the important exception
-below, you can apply the operators in any order, using parentheses if
-necessary to override the natural precedences of the operators.
-
-
-NB: Using a panda shape is always much more efficient than explicitly
-specifying "pie & annulus", due to the ability of panda to place a
-limit on the number of pixels checked in the pie shape. If you are
-going to specify the intersection of pie and annulus, use panda
-instead.
-
-
-As described in "help regreometry", the B<PIE> slice goes to the
-edge of the field. To limit its scope, B<PIE> usually is is
-combined with other shapes, such as circles and annuli, using boolean
-operations. In this context, it is worth noting that that there is a
-difference between B<-PIE> and B<&!PIE>. The former is a
-global exclude of all pixels in the B<PIE> slice, while the latter
-is a local excludes of pixels affecting only the region(s) with which
-the B<PIE> is combined. For example, the following region uses
-B<&!PIE> as a local exclude of a single circle. Two other circles
-are also defined and are unaffected by the local exclude:
-
-
- CIRCLE(1,8,1)
- CIRCLE(8,8,7)&!PIE(8,8,60,120)&!PIE(8,8,240,300)
- CIRCLE(15,8,2)
-
- 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- - - - - - - - - - - - - - - -
- 15: . . . . . . . . . . . . . . .
- 14: . . . . 2 2 2 2 2 2 2 . . . .
- 13: . . . 2 2 2 2 2 2 2 2 2 . . .
- 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 10: . . . . 2 2 2 2 2 2 2 . . . .
- 9: . . . . . . 2 2 2 . . . . 3 3
- 8: 1 . . . . . . . . . . . . 3 3
- 7: . . . . . . 2 2 2 . . . . 3 3
- 6: . . . . 2 2 2 2 2 2 2 . . . .
- 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 3: . . . 2 2 2 2 2 2 2 2 2 . . .
- 2: . . . . 2 2 2 2 2 2 2 . . . .
- 1: . . . . . . . . . . . . . . .
-
-
-Note that the two other regions are not affected by the B<&!PIE>,
-which only affects the circle with which it is combined.
-
-
-On the other hand, a B<-PIE> is an global exclude that does
-affect other regions with which it overlaps:
-
-
- CIRCLE(1,8,1)
- CIRCLE(8,8,7)
- -PIE(8,8,60,120)
- -PIE(8,8,240,300)
- CIRCLE(15,8,2)
-
- 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- - - - - - - - - - - - - - - -
- 15: . . . . . . . . . . . . . . .
- 14: . . . . 2 2 2 2 2 2 2 . . . .
- 13: . . . 2 2 2 2 2 2 2 2 2 . . .
- 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 10: . . . . 2 2 2 2 2 2 2 . . . .
- 9: . . . . . . 2 2 2 . . . . . .
- 8: . . . . . . . . . . . . . . .
- 7: . . . . . . 2 2 2 . . . . . .
- 6: . . . . 2 2 2 2 2 2 2 . . . .
- 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 3: . . . 2 2 2 2 2 2 2 2 2 . . .
- 2: . . . . 2 2 2 2 2 2 2 . . . .
- 1: . . . . . . . . . . . . . . .
-
-
-The two smaller circles are entirely contained within the two exclude
-B<PIE> slices and therefore are excluded from the region.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/regbounds.pod b/funtools/doc/pod/regbounds.pod
deleted file mode 100644
index c63a0bd..0000000
--- a/funtools/doc/pod/regbounds.pod
+++ /dev/null
@@ -1,203 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<RegBounds: Region Boundaries>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-Describes how spatial region boundaries are handled.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-The golden rule for spatial region filtering was first enunciated by
-Leon VanSpeybroeck in 1986:
-
-
-Each photon will be counted once, and no photon will be counted
-more than once.
-
-
-This means that we must be careful about boundary
-conditions. For example, if a circle is contained in an annulus such
-that the inner radius of the annulus is the same as the radius of the
-circle, then photons on that boundary must always be assigned to one
-or the other region. That is, the number of photons in both regions
-must equal the sum of the number of photons in each region taken
-separately.
-
-With this in mind, the rules for determining whether a boundary image
-pixel or table row are assigned to a region are defined below.
-
-B<Image boundaries : radially-symmetric shapes (circle, annuli, ellipse)>
-
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies non-radially-symmetric shapes. When a
-pixel center is exactly on the boundary, the pixel assignment rule is:
-
-
-
-=over 4
-
-
-
-
-=item *
-
-the outer boundary of a symmetric shape does not include such pixels
-
-
-=item *
-
-the inner boundary of a symmetric shape (annulus) includes such pixels
-
-
-=back
-
-
-
-In this way, an annulus with radius from 0 to 1, centered exactly on a
-pixel, includes the pixel on which it is centered, but none of its
-neighbors.
-
-These rules ensure that when defining concentric shapes, no pixels are
-omitted between concentric regions and no pixels are claimed by two
-regions. When applied to small symmetric shapes, the shape is less
-likely to be skewed, as would happen with non-radially-symmetric
-rules. These rules differ from the rules for box-like shapes, which
-are more likely to be positioned adjacent to one another.
-
-B<Image Boundaries: non-radially symmetric shapes (polygons, boxes)>
-
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies radially-symmetric shapes. When a pixel
-center is exactly on the boundary of a non-radially symmetric region,
-the pixel is included in the right or upper region, but not the left
-or lower region. This ensures that geometrically adjoining regions
-touch but don't overlap.
-
-B<Row Boundaries are Analytic>
-
-When filtering table rows, the boundary rules are the same as for
-images, except that the calculation is not done on the center of a
-pixel, (since table rows, especially X-ray events rows, often have
-discrete, floating point positions) but are calculated exactly. That
-is, an row is inside the boundary without regard to its integerized
-pixel value. For rows that are exactly on a region boundary, the
-above rules are applied to ensure that all rows are counted once and
-no row is counted more than once.
-
-
-Because row boundaries are calculated differently from image boundaries,
-certain programs will give different results when filtering the same
-region file. In particular, fundisp/funtable (which utilize analytic
-row filtering) perform differently from funcnts (which performs image
-filtering, even on tables).
-
-B<Image Boundaries vs. Row Boundaries: Practical Considerations>
-
-
-You will sometimes notice a discrepancy between running funcnts on an
-binary table file and running fundisp on the same file with the same filter.
-For example, consider the following:
-
- fundisp test1.fits"[box(4219,3887,6,6,0)]" | wc
- 8893 320148 3752846
-
-Since fundisp has a 2-line header, there are actually 8891 photons
-that pass the filter. But then run funtable and select only the
-rows that pass this filter, placing them in a new file:
-
- ./funtable test1.fits"[box(4219,3887,6,6,0)]" test2.fits
-
-Now run funcnts using the original filter on the derived file:
-
- ./funcnts test2.fits "physical; box(4219,3887,6,6,0)"
-
- [... lot of processed output ...]
-
- # the following source and background components were used:
- source region(s)
- ----------------
- physical; box(4219,3887,6,6,0)
-
- reg counts pixels
- ---- ------------ ---------
- 1 7847.000 36
-
-There are 1044 rows (events) that pass the row filter in fundisp (or
-funtable) but fail to make it through funcnts. Why?
-
-
-The reason can be traced to how analytic row filtering (fundisp, funtable)
-differs from integerized pixel filtering(funcnts, funimage). Consider the
-region:
-
- box(4219,3887,6,6,0)
-
-Analytically (i.e., using row filtering), positions will pass this
-filter successfully if:
-
- 4216 <= x <= 4222
- 3884 <= y <= 3890
-
-For example, photons with position values of x=4216.4 or y=3884.08 will pass.
-
-
-Integerized image filtering is different in that the pixels that will
-pass this filter have centers at:
-
- x = 4217, 4218, 4219, 4220, 4221, 4222
- y = 3885, 3886, 3887, 3888, 3889, 3890
-
-Note that there are 6 pixels in each direction, as specified by the region.
-That means that positions will pass the filter successfully if:
-
- 4217 <= (int)x <= 4222
- 3885 <= (int)y <= 3890
-
-Photons with position values of x=4216.4 or y=3884.08 will NOT pass.
-
-
-Note that the position values are integerized, in effect, binned into
-image values. This means that x=4222.4 will pass this filter, but not
-the analytic filter above. We do this to maintain the design goal that
-either all counts in a pixel are included in an integerized filter, or
-else none are included.
-
-
-[It could be argued that the correct photon limits for floating point
-row data really should be:
-
- 4216.5 <= x <= 4222.5
- 3884.5 <= y <= 3890.5
-
-since each pixel extends for .5 on either side of the center. We chose
-to the maintain integerized algorithm for all image-style filtering so
-that funcnts would give the exact same results regardless of whether
-a table or a derived non-blocked binned image is used.]
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/regcoords.pod b/funtools/doc/pod/regcoords.pod
deleted file mode 100644
index a026a5c..0000000
--- a/funtools/doc/pod/regcoords.pod
+++ /dev/null
@@ -1,247 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<RegCoords: Spatial Region Coordinates>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document describes the specification of coordinate systems, and the
-interpretation of coordinate values, for spatial region filtering.
-
-
-
-=head1 DESCRIPTION
-
-
-
-B<Pixel coordinate systems>
-
-The default coordinate system for regions is PHYSICAL, which means
-that region position and size values are taken from the original
-data. (Note that this is a change from the original IRAF/PROS
-implementation, in which the IMAGE coordinate system was the default.)
-PHYSICAL coordinates always refer to pixel positions on the original
-image (using IRAF LTM and LTV keywords). With PHYSICAL coordinates,
-if a set of coordinates specifies the position of an object in an
-original FITS file, the same coordinates will specify the same object
-in any FITS derived from the original. Physical coordinates are
-invariant with blocking of FITS files or taking sections of images,
-even when a blocked section is written to a new file.
-
-
-Thus, although a value in pixels refers, by default, to the PHYSICAL
-coordinate system, you may specify that position values refer to the
-image coordinate system using the B<global> or B<local>
-properties commands:
-
-
- global coordsys image
- circle 512 512 100
-
-
-The B<global> command changes the coordinate system for all
-regions that follow, while the B<local> command changes the
-coordinate system only for the region immediately following:
-
- local coordsys image
- circle 512 512 100
- circle 1024 1024 200
-
-This changes the coordinate system only for the region that follows.
-In the above example, the second region uses the global coordinate
-system (PHYSICAL by default).
-
-
-B<World Coordinate Systems>
-
-If World Coordinate System information is contained in the data file
-being filtered, it also is possible to define regions using a sky
-coordinate system. Supported systems include:
-
-
- name description
- ---- -----------
- PHYSICAL pixel coords of original file using LTM/LTV
- IMAGE pixel coords of current file
- FK4, B1950 sky coordinate systems
- FK5, J2000 sky coordinate systems
- GALACTIC sky coordinate systems
- ECLIPTIC sky coordinate systems
- ICRS currently same as J2000
- LINEAR linear wcs as defined in file
-
-
-In addition, two mosaic coordinate systems have been defined that
-utilize the (evolving) IRAF mosaic keywords:
-
-
- name description
- ---- -----------
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV
-
-Again, to use one of these coordinate systems, the B<global> or
-B<local> properties commands are used:
-
-
- global coordsys galactic
-
-
-B<WCS Positions and Sizes>
-
-In addition to pixels, positional values in a WCS-enabled region can
-be specified using sexagesimal or degrees format:
-
-
- position arguments description
- ------------------ -----------
- [num] context-dependent (see below)
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
- [num]:[num]:[num] hms for 'odd' position arguments
- [num]:[num]:[num] dms for 'even' position arguments
- [num]h[num]m[num]s explicit hms
- [num]d[num]m[num]s explicit dms
-
-
-If ':' is used as sexagesimal separator, the value is considered to be
-specifying hours/minutes/seconds if it is the first argument of a
-positional pair, and degrees/minutes/seconds for the second argument
-of a pair (except for galactic coordinates, which always use degrees):
-
-
- argument description
- ----------- -----------
- 10:20:30.0 10 hours, 20 minutes, 30 seconds for 1st positional argument
- 10 degrees, 20 minutes, 30 seconds for 2nd positional argument
- 10h20m30.0 10 hours, 20 minutes, 30 seconds
- 10d20m30.0 10 degrees, 20 minutes, 30 seconds
- 10.20d 10.2 degrees
-
-
-Similarly, the units of size values are defined by the formating
-character(s) attached to a number:
-
-
- size arguments description
- -------------- -----------
- [num] context-dependent (see below)
- [num]" arc seconds
- [num]' arc minutes
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
-
-
-For example:
-
- argument description
- ----------- -----------
- 10 ten pixels
- 10' ten minutes of arc
- 10" ten seconds of arc
- 10d ten degrees
- 10p ten pixels
- 0.5r half of a radian
-
-
-
-An example of using sky coordinate systems follows:
-
-
- global coordsys B1950
- -box 175.54d 20.01156d 10' 10'
- local coordsys J2000
- pie 179.57d 22.4d 0 360 n=4 && annulus 179.57d 22.4d 3' 24' n=5
-
-
-At the FK4 1950 coordinates 175.54d RA, 20.01156d DEC exclude a 10
-minute by 10 minute box. Then at the FK5 2000 coordinates 179.57d RA
-22.4d DEC draw a radial profile regions pattern with 4 quadrants and 5
-annuli ranging from 3 minutes to 24 minutes in diameter. In this
-example, the default coordinate system is overridden by the commands
-in the regions spec.
-
-B<NB: The Meaning of Pure Numbers Are Context Sensitive>
-
-
-When a "pure number" (i.e. one without a format directive such as 'd'
-for 'degrees') is specified as a position or size, its interpretation
-depends on the context defined by the 'coordsys' keyword. In general,
-the rule is:
-
-
-All pure numbers have implied units corresponding to the current
-coordinate system.
-
-
-If no coordinate system is explicitly specified, the default system is
-implicitly assumed to be PHYSICAL. In practice this means that for
-IMAGE and PHYSICAL systems, pure numbers are pixels. Otherwise,
-for all systems other than LINEAR, pure numbers are degrees. For
-LINEAR systems, pure numbers are in the units of the linear system.
-This rule covers both positions and sizes.
-
-
-As a corollary, when a sky-formatted number is used with the IMAGE
-or PHYSICAL coordinate system (which includes the default case of no
-coordsys being specified), the formatted number is assumed to be in
-the units of the WCS contained in the current file. If no sky WCS is
-specified, an error results.
-
-
-Examples:
-
-
- circle(512,512,10)
- ellipse 202.44382d 47.181656d 0.01d 0.02d
-
-
-
-In the absence of a specified coordinate system, the circle uses the
-default PHYSICAL units of pixels, while the ellipse explicitly uses degrees,
-presumably to go with the WCS in the current file.
-
-
- global coordsys=fk5
- global color=green font="system 10 normal"
- circle 202.44382 47.181656 0.01
- circle 202.44382 47.181656 10p
- ellipse(512p,512p,10p,15p,20)
-
-
-
-
-Here, the circles use the FK5 units of degrees (except for the
-explicit use of pixels in the second radius), while the ellipse
-explicitly specifies pixels. The ellipse angle is in degrees.
-
-
-Note that Chandra data format appears to use "coordsys=physical"
-implicitly. Therefore, for most Chandra applications, valid regions
-can be generated safely by asking ds9 to save/display regions in
-pixels using the PHYSICAL coordsys.
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/regdiff.pod b/funtools/doc/pod/regdiff.pod
deleted file mode 100644
index e1c38ca..0000000
--- a/funtools/doc/pod/regdiff.pod
+++ /dev/null
@@ -1,99 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<RegDiff:Differences Between Funtools and IRAF Regions>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-Describes the differences between Funtools/ds9 regions and the old IRAF/PROS
-regions.
-
-
-
-=head1 DESCRIPTION
-
-
-
-
-
-We have tried to make Funtools regions compatible with their
-predecessor, IRAF/PROS regions. For simple regions and simple boolean
-algebra between regions, there should be no difference between the two
-implementations. The following is a list of differences and
-incompatibilities between the two:
-
-
-
-=over 4
-
-
-
-
-
-
-=item *
-
-If a pixel is covered by two different regions expressions,
-Funtools assigns the mask value of the B<first> region that
-contains that pixel. That is, successive regions B<do not>
-overwrite previous regions in the mask, as was the case with the
-original PROS regions. This means that one must define overlapping
-regions in the reverse order in which they were defined in PROS. If
-region N is fully contained within region M, then N should be defined
-B<before> M, or else it will be "covered up" by the latter. This
-change is necessitated by the use of optimized filter compilation, i.e.,
-Funtools only tests individual regions until a proper match is made.
-
-
-
-
-=item *
-
-The B<PANDA> region has replaced the old PROS syntax in which
-a B<PIE> accelerator was combined with an B<ANNULUS> accelerator
-using B<AND>. That is,
-
- ANNULUS(20,20,0,15,n=4) & PIE(20,20,0,360,n=3)
-
-has been replaced by:
-
- PANDA(20,20,0,360,3,0,15,4)
-
-The PROS syntax was inconsistent with the meaning of the B<AND> operator.
-
-
-
-
-=item *
-
-The meaning of pure numbers (i.e., without format specifiers) in
-regions has been clarified, as has the syntax for specifying coordinate
-systems. See the general discussion on
-Spatial Region Filtering
-for more information.
-
-
-
-=back
-
-
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/pod/reggeometry.pod b/funtools/doc/pod/reggeometry.pod
deleted file mode 100644
index 0d442d5..0000000
--- a/funtools/doc/pod/reggeometry.pod
+++ /dev/null
@@ -1,1156 +0,0 @@
-=pod
-
-=head1 NAME
-
-
-
-B<RegGeometry: Geometric Shapes in Spatial Region Filtering>
-
-
-
-=head1 SYNOPSIS
-
-
-
-
-
-This document describes the geometry of regions available for spatial
-filtering in IRAF/PROS analysis.
-
-
-
-=head1 DESCRIPTION
-
-
-
-B<Geometric shapes>
-
-Several geometric shapes are used to describe regions. The valid
-shapes are:
-
-
- shape: arguments:
- ----- ----------------------------------------
- ANNULUS xcenter ycenter inner_radius outer_radius
- BOX xcenter ycenter xwidth yheight (angle)
- CIRCLE xcenter ycenter radius
- ELLIPSE xcenter ycenter xwidth yheight (angle)
- FIELD none
- LINE x1 y1 x2 y2
- PIE xcenter ycenter angle1 angle2
- POINT x1 y1
- POLYGON x1 y1 x2 y2 ... xn yn
-
-
-
-All arguments are real values; integer values are automatically
-converted to real where necessary. All angles are in degrees and
-specify angles that run counter-clockwise from the positive y-axis.
-
-
-Shapes can be specified using "command" syntax:
-
- [shape] arg1 arg2 ...
-
-or using "routine" syntax:
-
- [shape](arg1, arg2, ...)
-
-or by any combination of the these. (Of course, the parentheses must
-balance and there cannot be more commas than necessary.) The shape
-keywords are case-insensitive. Furthermore, any shape can be
-specified by a three-character unique abbreviation. For example, one
-can specify three circular regions as:
-
-
- "foo.fits[CIRCLE 512 512 50;CIR(128 128, 10);cir(650,650,20)]"
-
-
-(Quotes generally are required to protect the region descriptor
-from being processed by the Unix shell.)
-
-
-
-
-The B<annulus> shape specifies annuli, centered at xcenter,
-ycenter, with inner and outer radii (r1, r2). For example,
-
- ANNULUS 25 25 5 10
-
-specifies an annulus centered at 25.0 25.0 with an inner radius of 5.0 and
-an outer radius of 10. Assuming (as will be done for all examples in this
-document, unless otherwise noted) this shape is used in a mask of size 40x40,
-it will look like this:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:....................111111111...........
- 33:...................11111111111..........
- 32:.................111111111111111........
- 31:.................111111111111111........
- 30:................11111111111111111.......
- 29:...............1111111.....1111111......
- 28:...............111111.......111111......
- 27:...............11111.........11111......
- 26:...............11111.........11111......
- 25:...............11111.........11111......
- 24:...............11111.........11111......
- 23:...............11111.........11111......
- 22:...............111111.......111111......
- 21:...............1111111.....1111111......
- 20:................11111111111111111.......
- 19:.................111111111111111........
- 18:.................111111111111111........
- 17:...................11111111111..........
- 16:....................111111111...........
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-
-
-
-
-The B<box> shape specifies an orthogonally oriented box,
-centered at xcenter, ycenter, of size xwidth, yheight. It requires four
-arguments and accepts an optional fifth argument to specify a rotation angle.
-When the rotation angle is specified (in degrees), the box is rotated by
-an angle that runs counter-clockwise from the positive y-axis.
-
-
-The B<box> shape specifies a rotated box, centered at
-xcenter, ycenter, of size xwidth, yheight. The box is rotated by an angle
-specified in degrees that runs counter-clockwise from the positive y-axis.
-If the angle argument is omitted, it defaults to 0.
-
-
-
-
-The B<circle> shape specifies a circle, centered at xcenter,
-ycenter, of radius r. It requires three arguments.
-
-
-
-
-The B<ellipse> shape specifies an ellipse, centered at
-xcenter, ycenter, with y-axis width a and the y-axis length b defined such
-that:
-
- x**2/a**2 + y**2/b**2 = 1
-
-Note that a can be less than, equal to, or greater than b. The ellipse
-is rotated the specified number of degrees. The rotation is done according
-to astronomical convention, counter-clockwise from the positive y-axis.
-An ellipse defined by:
-
- ELLIPSE 20 20 5 10 45
-
-will look like this:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:............111111......................
- 26:............11111111....................
- 25:............111111111...................
- 24:............11111111111.................
- 23:............111111111111................
- 22:............111111111111................
- 21:.............111111111111...............
- 20:.............1111111111111..............
- 19:..............111111111111..............
- 18:...............111111111111.............
- 17:...............111111111111.............
- 16:................11111111111.............
- 15:..................111111111.............
- 14:...................11111111.............
- 13:.....................111111.............
- 12:........................................
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-
-
-
-
-
-The B<field> shape specifies the entire field as a
-region. It is not usually specified explicitly, but is used implicitly in the
-case where no regions are specified, that is, in cases where either a null
-string or some abbreviation of the string "none" is input.
-B<Field> takes no arguments.
-
-
-
-
-The B<pie> shape specifies an angular wedge of the entire field,
-centered at xcenter, ycenter. The wedge runs between the two specified angles.
-The angles are given in degrees, running counter-clockwise from the positive
-x-axis. For example,
-
- PIE 20 20 90 180
-
-defines a region from 90 degrees to 180 degrees, i.e., quadrant 2 of the
-Cartesian plane. The display of such a region looks like this:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:11111111111111111111....................
- 39:11111111111111111111....................
- 38:11111111111111111111....................
- 37:11111111111111111111....................
- 36:11111111111111111111....................
- 35:11111111111111111111....................
- 34:11111111111111111111....................
- 33:11111111111111111111....................
- 32:11111111111111111111....................
- 31:11111111111111111111....................
- 30:11111111111111111111....................
- 29:11111111111111111111....................
- 28:11111111111111111111....................
- 27:11111111111111111111....................
- 26:11111111111111111111....................
- 25:11111111111111111111....................
- 24:11111111111111111111....................
- 23:11111111111111111111....................
- 22:11111111111111111111....................
- 21:11111111111111111111....................
- 20:........................................
- 19:........................................
- 18:........................................
- 17:........................................
- 16:........................................
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-The pie slice specified is always a counter-clockwise sweep between
-the angles, starting at the first angle and ending at the second. Thus:
-
- PIE 10 15 30 60
-
-describes a 30 degree sweep from 2 o'clock to 1 o'clock, while:
-
- PIE 10 15 60 30
-
-describes a 330 degree counter-clockwise sweep from 1 o'clock to 2 o'clock
-passing through 12 o'clock (0 degrees). Note in both of these examples that
-the center of the slice can be anywhere on the plane. The second mask looks
-like this:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:111111111111111111111111................
- 39:11111111111111111111111.................
- 38:11111111111111111111111.................
- 37:1111111111111111111111..................
- 36:1111111111111111111111..................
- 35:111111111111111111111...................
- 34:11111111111111111111....................
- 33:11111111111111111111....................
- 32:1111111111111111111....................1
- 31:1111111111111111111..................111
- 30:111111111111111111.................11111
- 29:111111111111111111................111111
- 28:11111111111111111...............11111111
- 27:1111111111111111..............1111111111
- 26:1111111111111111.............11111111111
- 25:111111111111111............1111111111111
- 24:111111111111111..........111111111111111
- 23:11111111111111.........11111111111111111
- 22:11111111111111........111111111111111111
- 21:1111111111111.......11111111111111111111
- 20:111111111111......1111111111111111111111
- 19:111111111111....111111111111111111111111
- 18:11111111111....1111111111111111111111111
- 17:11111111111..111111111111111111111111111
- 16:1111111111.11111111111111111111111111111
- 15:1111111111111111111111111111111111111111
- 14:1111111111111111111111111111111111111111
- 13:1111111111111111111111111111111111111111
- 12:1111111111111111111111111111111111111111
- 11:1111111111111111111111111111111111111111
- 10:1111111111111111111111111111111111111111
- 9:1111111111111111111111111111111111111111
- 8:1111111111111111111111111111111111111111
- 7:1111111111111111111111111111111111111111
- 6:1111111111111111111111111111111111111111
- 5:1111111111111111111111111111111111111111
- 4:1111111111111111111111111111111111111111
- 3:1111111111111111111111111111111111111111
- 2:1111111111111111111111111111111111111111
- 1:1111111111111111111111111111111111111111
-
-The pie slice goes to the edge of the field. To limit its scope, pie
-usually is is combined with other shapes, such as circles and annuli,
-using boolean operations. (See below and in "help regalgebra").
-
-
-Pie Performance Notes:
-
-Pie region processing time is proportional to the size of the image,
-and not the size of the region. This is because the pie shape is the
-only infinite length shape, and we essentially must check all y rows
-for inclusion (unlike other regions, where the y limits can be
-calculated beforehand). Thus, pie can run very slowly on large images.
-In particular, it will run MUCH more slowly than the panda shape in
-image-based region operations (such as funcnts). We recommend use of
-panda over pie where ever possible.
-
-
-If you must use pie, always try to put it last in a boolean &&
-expression. The reason for this is that the filter code is optimized
-to exit as soon as the result is know. Since pie is the slowest
-region, it is better to avoid executing it if another region can decide
-the result. Consider, for example, the difference in time required to
-process a Chandra ACIS file when a pie and circle are combined in
-two different orders:
-
-
- time ./funcnts nacis.fits "circle 4096 4096 100 && pie 4096 4096 10 78"
-2.87u 0.38s 0:35.08 9.2%
-
- time ./funcnts nacis.fits "pie 4096 4096 10 78 && circle 4096 4096 100 "
-89.73u 0.36s 1:03.50 141.8%
-
-
-
-Black-magic performance note:
-
-
-Panda region processing uses a B<quick test> pie region instead of
-the normal pie region when combining its annulus and pie shapes. This
-B<qtpie> shape differs from the normal pie in that it utilizes the
-y limits from the previous region with which it is combined. In a
-panda shape, which is a series of annuli combined with pies, the
-processing time is thus reduced to that of the annuli.
-
-
-You can use the qtpie shape instead of pie in cases where you are
-combining pie with another shape using the && operator. This will
-cause the pie limits to be set using limits from the other shape, and
-will speed up the processing considerably. For example, the above
-execution of funcnts can be improved considerably using this technique:
-
-
- time ./funcnts nacis.fits "circle 4096 4096 100 && qtpie 4096 4096 10 78"
-4.66u 0.33s 0:05.87 85.0%
-
-
-
-We emphasize that this is a quasi-documented feature and might change in
-the future. The qtpie shape is not recognized by ds9 or other programs.
-
-
-
-
-The B<line> shape allows single pixels in a line between (x1,y1) and
-(x2,y2) to be included or excluded. For example:
-
- LINE (5,6, 24,25)
-
-displays as:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:.......................1................
- 24:......................1.................
- 23:.....................1..................
- 22:....................1...................
- 21:...................1....................
- 20:..................1.....................
- 19:.................1......................
- 18:................1.......................
- 17:...............1........................
- 16:..............1.........................
- 15:.............1..........................
- 14:............1...........................
- 13:...........1............................
- 12:..........1.............................
- 11:.........1..............................
- 10:........1...............................
- 9:.......1................................
- 8:......1.................................
- 7:.....1..................................
- 6:....1...................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-
-
-
-
-The B<point> shape allows single pixels to be included or
-excluded. Although the (x,y) values are real numbers, they are truncated
-to integer and the corresponding pixel is included or excluded, as specified.
-
-
-Several points can be put in one region declaration; unlike the
-original IRAF implementation, each now is given a different region mask value.
-This makes it easier, for example, for funcnts to determine the number of
-photons in the individual pixels. For example,
-
- POINT (5,6, 10,11, 20,20, 35,30)
-
-will give the different region mask values to all four points, as shown below:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:..................................4.....
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:........................................
- 24:........................................
- 23:........................................
- 22:........................................
- 21:........................................
- 20:...................3....................
- 19:........................................
- 18:........................................
- 17:........................................
- 16:........................................
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................
- 11:.........2..............................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:....1...................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-
-
-
-
-The B<polygon> shape specifies a polygon with vertices
-(x1, y1) ... (xn, yn). The polygon is closed automatically: one should
-not specify the last vertex to be the same as the first. Any number of
-vertices are allowed. For example, the following polygon defines a
-right triangle as shown below:
-
- POLYGON (10,10, 10,30, 30,30)
-
-
-looks like this:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:..........11111111111111111111..........
- 29:..........1111111111111111111...........
- 28:..........111111111111111111............
- 27:..........11111111111111111.............
- 26:..........1111111111111111..............
- 25:..........111111111111111...............
- 24:..........11111111111111................
- 23:..........1111111111111.................
- 22:..........111111111111..................
- 21:..........11111111111...................
- 20:..........1111111111....................
- 19:..........111111111.....................
- 18:..........11111111......................
- 17:..........1111111.......................
- 16:..........111111........................
- 15:..........11111.........................
- 14:..........1111..........................
- 13:..........111...........................
- 12:..........11............................
- 11:..........1.............................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-Note that polygons can get twisted upon themselves if edge lines
-cross. Thus:
-
- POL (10,10, 20,20, 20,10, 10,20)
-
-will produce an area which is two triangles, like butterfly wings, as shown
-below:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:........................................
- 24:........................................
- 23:........................................
- 22:........................................
- 21:........................................
- 20:........................................
- 19:..........1........1....................
- 18:..........11......11....................
- 17:..........111....111....................
- 16:..........1111..1111....................
- 15:..........1111111111....................
- 14:..........1111..1111....................
- 13:..........111....111....................
- 12:..........11......11....................
- 11:..........1........1....................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-
-
-
-
-The following are combinations of pie with different shapes
-(called "panda" for "Pie AND Annulus") allow for easy specification of
-radial sections:
-
- shape: arguments:
- ----- ---------
- PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # box
- EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # ellipse
-
-
-The B<panda> (B<P>ies B<AND> B<A>nnuli) shape can be
-used to create combinations of pie and annuli markers. It is analogous
-to a Cartesian product on those shapes, i.e., the result is several
-shapes generated by performing a boolean AND between pies and
-annuli. Thus, the panda and cpanda specify combinations of annulus and
-circle with pie, respectively and give identical results. The bpanda
-combines box and pie, while epanda combines ellipse and pie.
-
-
-Consider the example shown below:
-
- PANDA(20,20, 0,360,3, 0,15,4)
-
-Here, 3 pie slices centered at 20, 20 are combined with 4 annuli, also
-centered at 20, 20. The result is a mask with 12 regions (displayed in
-base 16 to save characters):
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:..............44444444444...............
- 33:............444444444444444.............
- 32:...........88444444444444444............
- 31:.........888844443333344444444..........
- 30:........88888833333333333444444.........
- 29:........88888733333333333344444.........
- 28:.......8888877733333333333344444........
- 27:......888887777332222233333344444.......
- 26:......888877777622222222333334444.......
- 25:.....88887777766622222222333334444......
- 24:.....88887777666622222222233334444......
- 23:.....88887777666651111222233334444......
- 22:.....88877776666551111122223333444......
- 21:.....88877776666555111122223333444......
- 20:.....888777766665559999aaaabbbbccc......
- 19:.....888777766665559999aaaabbbbccc......
- 18:.....888777766665599999aaaabbbbccc......
- 17:.....88887777666659999aaaabbbbcccc......
- 16:.....888877776666aaaaaaaaabbbbcccc......
- 15:.....888877777666aaaaaaaabbbbbcccc......
- 14:......8888777776aaaaaaaabbbbbcccc.......
- 13:......888887777bbaaaaabbbbbbccccc.......
- 12:.......88888777bbbbbbbbbbbbccccc........
- 11:........888887bbbbbbbbbbbbccccc.........
- 10:........888888bbbbbbbbbbbcccccc.........
- 9:.........8888ccccbbbbbcccccccc..........
- 8:...........88ccccccccccccccc............
- 7:............ccccccccccccccc.............
- 6:..............ccccccccccc...............
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-
-
-
-
-Several regions with different mask values can be combined in the
-same mask. This supports comparing data from the different regions.
-(For information on how to combine different shapes into a single
-region, see "help regalgebra".) For example, consider the following
-set of regions:
-
- ANNULUS 25 25 5 10
- ELLIPSE 20 20 5 10 315
- BOX 15 15 5 10
-
-The resulting mask will look as follows:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:....................111111111...........
- 33:...................11111111111..........
- 32:.................111111111111111........
- 31:.................111111111111111........
- 30:................11111111111111111.......
- 29:...............1111111.....1111111......
- 28:...............111111.......111111......
- 27:...............11111.222222..11111......
- 26:...............111112222222..11111......
- 25:...............111112222222..11111......
- 24:...............111112222222..11111......
- 23:...............111112222222..11111......
- 22:...............111111222222.111111......
- 21:..............211111112222.1111111......
- 20:............322211111111111111111.......
- 19:............32222111111111111111........
- 18:............22222111111111111111........
- 17:............222222211111111111..........
- 16:............22222222111111111...........
- 15:............222222222...................
- 14:............22222222....................
- 13:............222222......................
- 12:............33333.......................
- 11:............33333.......................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-
-Note that when a pixel is in 2 or more regions, it is arbitrarily
-assigned to a one of the regions in question (often based on how a
-give C compiler optimizes boolean expressions).
-
-
-B<Region accelerators>
-
-
-Two types of \fBaccelerators, to simplify region specification,
-are provided as natural extensions to the ways shapes are described.
-These are: extended lists of parameters, specifying multiple regions,
-valid for annulus, box, circle, ellipse, pie, and points; and
-B<n=>, valid for annulus, box, circle, ellipse, and pie (not
-point). In both cases, one specification is used to define several
-different regions, that is, to define shapes with different mask
-values in the region mask.
-
-
-The following regions accept B<accelerator> syntax:
-
- shape arguments
- ----- ------------------------------------------
- ANNULUS xcenter ycenter radius1 radius2 ... radiusn
- ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- PIE xcenter ycenter angle1 angle2 (angle3) (angle4) (angle5) ...
- PIE xcenter ycenter angle1 angle2 (n=[number])
- POINT x1 y1 x2 y2 ... xn yn
-
-Note that the circle accelerators are simply aliases for the annulus
-accelerators.
-
-
-For example, several annuli at the same center can be specified in one
-region expression by specifying more than two radii. If B<N>
-radii are specified, then B<N>-1 annuli result, with the outer
-radius of each preceding annulus being the inner radius of the
-succeeding annulus. Each annulus is considered a separate region, and
-is given a separate mask value. For example,
-
- ANNULUS 20 20 0 2 5 10 15 20
-
-specifies five different annuli centered at 20 20, and is equivalent to:
-
- ANNULUS 20.0 20.0 0 2
- ANNULUS 20.0 20.0 2 5
- ANNULUS 20.0 20.0 5 10
- ANNULUS 20.0 20.0 10 15
- ANNULUS 20.0 20.0 15 20
-
-The mask is shown below:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:.............5555555555555..............
- 38:...........55555555555555555............
- 37:.........555555555555555555555..........
- 36:........55555555555555555555555.........
- 35:......555555555555555555555555555.......
- 34:.....55555555544444444444555555555......
- 33:....5555555544444444444444455555555.....
- 32:....5555555444444444444444445555555.....
- 31:...555555444444444444444444444555555....
- 30:..55555544444444444444444444444555555...
- 29:..55555544444443333333334444444555555...
- 28:.5555554444444333333333334444444555555..
- 27:.5555544444433333333333333344444455555..
- 26:555555444444333333333333333444444555555.
- 25:555554444443333333333333333344444455555.
- 24:555554444433333332222233333334444455555.
- 23:555554444433333322222223333334444455555.
- 22:555554444433333222222222333334444455555.
- 21:555554444433333222111222333334444455555.
- 20:555554444433333222111222333334444455555.
- 19:555554444433333222111222333334444455555.
- 18:555554444433333222222222333334444455555.
- 17:555554444433333322222223333334444455555.
- 16:555554444433333332222233333334444455555.
- 15:555554444443333333333333333344444455555.
- 14:555555444444333333333333333444444555555.
- 13:.5555544444433333333333333344444455555..
- 12:.5555554444444333333333334444444555555..
- 11:..55555544444443333333334444444555555...
- 10:..55555544444444444444444444444555555...
- 9:...555555444444444444444444444555555....
- 8:....5555555444444444444444445555555.....
- 7:....5555555544444444444444455555555.....
- 6:.....55555555544444444444555555555......
- 5:......555555555555555555555555555.......
- 4:........55555555555555555555555.........
- 3:.........555555555555555555555..........
- 2:...........55555555555555555............
- 1:.............5555555555555..............
-
-
-
-For boxes and ellipses, if an odd number of arguments is specified,
-then the last argument is assumed to be an angle. Otherwise, the
-angle is assumed to be zero. For example:
-
- ellipse 20 20 3 5 6 10 9 15 12 20 45
-
-specifies an 3 ellipses at a 45 degree angle:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........33333333........................
- 35:......333333333333......................
- 34:.....3333333333333333...................
- 33:....333333333333333333..................
- 32:....33333332222233333333................
- 31:...3333332222222222333333...............
- 30:...33333222222222222233333..............
- 29:...333332222222222222223333.............
- 28:...3333222222211112222223333............
- 27:...33332222211111111222223333...........
- 26:...333322222111111111122223333..........
- 25:...3333222211111111111122223333.........
- 24:....3332222111111..1111122223333........
- 23:....333322211111.....11112222333........
- 22:....33332222111.......11112223333.......
- 21:.....33322221111.......11122223333......
- 20:.....33332221111.......11112223333......
- 19:.....33332222111.......11112222333......
- 18:......33332221111.......11122223333.....
- 17:.......33322221111.....111112223333.....
- 16:.......3333222211111..1111112222333.....
- 15:........3333222211111111111122223333....
- 14:.........333322221111111111222223333....
- 13:..........33332222211111111222223333....
- 12:...........3333222222111122222223333....
- 11:............333322222222222222233333....
- 10:.............33333222222222222233333....
- 9:..............3333332222222222333333....
- 8:...............33333333222223333333.....
- 7:.................333333333333333333.....
- 6:..................3333333333333333......
- 5:.....................333333333333.......
- 4:.......................33333333.........
- 3:........................................
- 2:........................................
- 1:........................................
-
-Note in the above example that the lower limit is not part of the
-region for boxes, circles, and ellipses. This makes circles and annuli
-equivalent, i.e.:
-
- circle 20 20 5 10 15 20
- annulus 20 20 5 10 15 20
-
-both give the following region mask:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:.............3333333333333..............
- 38:...........33333333333333333............
- 37:.........333333333333333333333..........
- 36:........33333333333333333333333.........
- 35:......333333333333333333333333333.......
- 34:.....33333333322222222222333333333......
- 33:....3333333322222222222222233333333.....
- 32:....3333333222222222222222223333333.....
- 31:...333333222222222222222222222333333....
- 30:..33333322222222222222222222222333333...
- 29:..33333322222221111111112222222333333...
- 28:.3333332222222111111111112222222333333..
- 27:.3333322222211111111111111122222233333..
- 26:333333222222111111111111111222222333333.
- 25:333332222221111111111111111122222233333.
- 24:33333222221111111.....11111112222233333.
- 23:3333322222111111.......1111112222233333.
- 22:333332222211111.........111112222233333.
- 21:333332222211111.........111112222233333.
- 20:333332222211111.........111112222233333.
- 19:333332222211111.........111112222233333.
- 18:333332222211111.........111112222233333.
- 17:3333322222111111.......1111112222233333.
- 16:33333222221111111.....11111112222233333.
- 15:333332222221111111111111111122222233333.
- 14:333333222222111111111111111222222333333.
- 13:.3333322222211111111111111122222233333..
- 12:.3333332222222111111111112222222333333..
- 11:..33333322222221111111112222222333333...
- 10:..33333322222222222222222222222333333...
- 9:...333333222222222222222222222333333....
- 8:....3333333222222222222222223333333.....
- 7:....3333333322222222222222233333333.....
- 6:.....33333333322222222222333333333......
- 5:......333333333333333333333333333.......
- 4:........33333333333333333333333.........
- 3:.........333333333333333333333..........
- 2:...........33333333333333333............
- 1:.............3333333333333..............
-
-
-
-
-As a final example, specifying several angles in one pie slice
-expression is equivalent to specifying several separate slices with
-the same center. As with the annulus, if B<N> angles are
-specified, then B<N>-1 slices result, with the ending angle of
-each preceding slice being the starting angle of the succeeding slice.
-Each slice is considered a separate region, and is given a separate
-mask value. For example,
-
- PIE 12 12 315 45 115 270
-
-specifies three regions as shown below:
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:2222222222222222222222222222222222222222
- 39:2222222222222222222222222222222222222221
- 38:2222222222222222222222222222222222222211
- 37:2222222222222222222222222222222222222111
- 36:2222222222222222222222222222222222221111
- 35:3222222222222222222222222222222222211111
- 34:3222222222222222222222222222222222111111
- 33:3322222222222222222222222222222221111111
- 32:3322222222222222222222222222222211111111
- 31:3332222222222222222222222222222111111111
- 30:3332222222222222222222222222221111111111
- 29:3333222222222222222222222222211111111111
- 28:3333222222222222222222222222111111111111
- 27:3333322222222222222222222221111111111111
- 26:3333322222222222222222222211111111111111
- 25:3333322222222222222222222111111111111111
- 24:3333332222222222222222221111111111111111
- 23:3333332222222222222222211111111111111111
- 22:3333333222222222222222111111111111111111
- 21:3333333222222222222221111111111111111111
- 20:3333333322222222222211111111111111111111
- 19:3333333322222222222111111111111111111111
- 18:3333333332222222221111111111111111111111
- 17:3333333332222222211111111111111111111111
- 16:3333333333222222111111111111111111111111
- 15:3333333333222221111111111111111111111111
- 14:3333333333322211111111111111111111111111
- 13:3333333333322111111111111111111111111111
- 12:33333333333.1111111111111111111111111111
- 11:3333333333331111111111111111111111111111
- 10:333333333333.111111111111111111111111111
- 9:333333333333..11111111111111111111111111
- 8:333333333333...1111111111111111111111111
- 7:333333333333....111111111111111111111111
- 6:333333333333.....11111111111111111111111
- 5:333333333333......1111111111111111111111
- 4:333333333333.......111111111111111111111
- 3:333333333333........11111111111111111111
- 2:333333333333.........1111111111111111111
- 1:333333333333..........111111111111111111
-
-
-
-The annulus, box, circle, ellipse, and pie shapes also accept an
-B<n=[int]> syntax for specifying multiple regions. The
-B<n=[int]>syntax interprets the previous (shape-dependent)
-arguments as lower and upper limits for the region and creates n
-shapes with evenly spaced boundaries. For example, if B<n=[int]>
-is specified in an annulus, the two immediately preceding radii
-(B<rn> and B<rm>) are divided into B<int> annuli, such
-that the inner radius of the first is B<rn> and the outer radius
-of the last is B<rm>. For example,
-
- ANNULUS 20 20 5 20 n=3
-
-is equivalent to:
-
- ANNULUS 20 20 5 10 15 20
-
-If this syntax is used with an ellipse or box, then the two preceding
-pairs of values are taken to be lower and upper limits for a set of
-ellipses or boxes. A circle uses the two preceding arguments for upper
-and lower radii. For pie, the two preceding angles are divided into n
-wedges such that the starting angle of the first is the lower bound
-and the ending angle of the last is the upper bound. In all cases,
-the B<n=[int]> syntax allows any single alphabetic character
-before the "=", i.e, i=3, z=3, etc. are all equivalent.
-
-
-Also note that for boxes and ellipses, the optional angle argument is
-always specified after the B<n=[int]> syntax. For example:
-
- ellipse 20 20 4 6 16 24 n=3 45
-
-specifies 3 elliptical regions at an angle of 45 degrees:
-
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........33333333........................
- 39:.....33333333333333.....................
- 38:....33333333333333333...................
- 37:...33333333333333333333.................
- 36:..33333333333333333333333...............
- 35:.3333333333222223333333333..............
- 34:3333333322222222222233333333............
- 33:33333332222222222222223333333...........
- 32:333333222222222222222222333333..........
- 31:3333322222222222222222222333333.........
- 30:33333222222222111122222222333333........
- 29:333332222222111111112222222333333.......
- 28:3333222222211111111111222222333333......
- 27:3333222222111111111111112222233333......
- 26:33332222221111111111111112222233333.....
- 25:33332222211111111.111111112222233333....
- 24:333322222111111......111111222223333....
- 23:333322222111111.......111112222233333...
- 22:33333222221111.........11111222223333...
- 21:333332222211111.........11112222233333..
- 20:.33332222211111.........11111222223333..
- 19:.33333222221111.........111112222233333.
- 18:..33332222211111.........11112222233333.
- 17:..333332222211111.......111111222233333.
- 16:...333322222111111......111111222223333.
- 15:...333332222211111111.111111112222233333
- 14:....333332222211111111111111122222233333
- 13:.....33333222221111111111111122222233333
- 12:.....33333322222211111111111222222233333
- 11:......3333332222222111111112222222333333
- 10:.......333333222222221111222222222333333
- 9:........33333322222222222222222222333333
- 8:.........333333222222222222222222333333.
- 7:..........33333332222222222222223333333.
- 6:...........3333333322222222222233333333.
- 5:.............3333333333222223333333333..
- 4:..............33333333333333333333333...
- 3:................33333333333333333333....
- 2:..................33333333333333333.....
- 1:....................33333333333333......
-
-
-
-Both the variable argument syntax and the B<n=[int]> syntax must
-occur alone in a region descriptor (aside from the optional angle for
-boxes and ellipses). They cannot be combined. Thus, it is not valid
-to precede or follow an B<n=[int]> accelerator with more angles or
-radii, as in this example:
-
- # INVALID -- one too many angles before a=5 ...
- # and no angles are allowed after a=5
- PIE 12 12 10 25 50 a=5 85 135
-
-Instead, use three separate specifications, such as:
-
- PIE 12 12 10 25
- PIE 12 12 25 50 a=5
- PIE 12 12 85 135
-
-The original (IRAF) implementation of region filtering permitted this
-looser syntax, but we found it caused more confusion than it was worth
-and therefore removed it.
-
-
-NB: Accelerators may be combined with other shapes in a boolean
-expression in any order. (This is a change starting with funtools
-v1.1.1. Prior to this release, the accelerator shape had to be
-specified last). The actual region mask id values returned depend on the
-order in which the shapes are specified, although the total number of
-pixels or rows that pass the filter will be consistent. For this
-reason, use of accelerators in boolean expressions is discouraged in
-programs such as funcnts, where region mask id values are used
-to count events or image pixels.
-
-
-[All region masks displayed in this document were generated using the
-B<fundisp> routine and the undocumented "mask=all" argument (with
-spaced removed using sed ):
-
- fundisp "funtools/funtest/test40.fits[ANNULUS 25 25 5 10]" mask=all |\
- sed 's/ //g'
-
-Note that you must supply an image of the appropriate size -- in this case,
-a FITS image of dimension 40x40 is used.]
-
-
-
-=head1 SEE ALSO
-
-
-
-See funtools(n) for a list of Funtools help pages
-
-
-
-=cut
diff --git a/funtools/doc/programs.html b/funtools/doc/programs.html
deleted file mode 100644
index 00d4dc7..0000000
--- a/funtools/doc/programs.html
+++ /dev/null
@@ -1,3497 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Funtools Programs</TITLE>
-</HEAD>
-<BODY>
-<H2>Funtools Programs</H2>
-
-<H2>Summary</H2>
-
-<P>
-<PRE>
-
-<A HREF="./programs.html#funcalc">funcalc</A> [-n] [-a argstr] [-e expr] [-f file] [-l link] [-p prog] [-u] &lt;iname&gt; [oname [columns]]
-
-<A HREF="./programs.html#funcen">funcen</A> [-i] [-n iter] [-t tol] [-v lev] &lt;iname&gt; &lt;region&gt;
-
-<A HREF="./programs.html#funcnts">funcnts</A> [switches] &lt;source_file&gt; [source_region] [bkgd_file] [bkgd_region|bkgd_cnts]
-
-<A HREF="./programs.html#funcone">funcone</A> [-n] [-x|-X|-j|-J] [[-l|-L] list] [-r ra_col] [-d dec_col] &lt;iname&gt; &lt;oname&gt; &lt;ra[hdr]&gt; &lt;dec[hdr]&gt; &lt;radius[dr'"]&gt; [columns]
-
-<A HREF="./programs.html#fundisp">fundisp</A> [-f format] [-l] [-n] [-T] &lt;iname&gt; [columns|bitpix=n]
-
-<A HREF="./programs.html#funhead">funhead</A> [-a] [-l] [-s] [-t] [-L] &lt;iname&gt; [oname ename]
-
-<A HREF="./programs.html#funhist">funhist</A> [-n|-w|-T] &lt;iname&gt; [column] [[lo_edge:hi_edge:]bins]
-
-<A HREF="./programs.html#funimage">funimage</A> [-a] [-l] [-p x|y] &lt;iname&gt; &lt;oname&gt; [bitpix=n]
-
-<A HREF="./programs.html#funindex">funindex</A> &lt;iname&gt; &lt;key&gt; [oname]
-
-<A HREF="./programs.html#funjoin">funjoin</A> [switches] &lt;ifile1&gt; &lt;ifile2&gt; ... &lt;ifilen&gt; &lt;ofile&gt;
-
-<A HREF="./programs.html#funmerge">funmerge</A> &lt;iname1&gt; &lt;iname2&gt; ... &lt;oname&gt;
-
-<A HREF="./programs.html#funsky">funsky</A> [switches] &lt;iname1&gt; [&lt;lname2&gt; &lt;col1&gt; &lt;col2&gt;]
-
-<A HREF="./programs.html#funtable">funtable</A> [-a] [-i|-z] [-m] [-s cols] &lt;iname&gt; &lt;oname&gt; [columns]
-
-<A HREF="./programs.html#funtbl">funtbl</A> [-c cols] [-h] [-n table] [-p prog] [-s sep] [-T] &lt;iname&gt;
-</PRE>
-
-<!-- =defdoc funcalc funcalc 1 -->
-
-<!-- =section funcalc NAME -->
-<H2><A NAME="funcalc">funcalc - Funtools calculator (for binary tables)</A></H2>
-<!-- =section funcalc SYNOPSIS -->
-<B>
-<PRE>
-funcalc [-n] [-a argstr] [-e expr] [-f file] [-l link] [-p prog] &lt;iname&gt; [oname [columns]]
-</PRE>
-</B>
-
-<!-- =section funcalc OPTIONS -->
-<P>
-<PRE>
- -a argstr # user arguments to pass to the compiled program
- -e expr # funcalc expression
- -f file # file containing funcalc expression
- -l libs # libs to add to link command
- -n # output generated code instead of compiling and executing
- -p prog # generate named program, no execution
- -u # die if any variable is undeclared (don't auto-declare)
-</PRE>
-
-<!-- =section funcalc DESCRIPTION -->
-<P>
-<B>funcalc</B> is a calculator program that allows arbitrary
-expressions to be constructed, compiled, and executed on columns in a
-Funtools table (FITS binary table or raw event file). It works by
-integrating user-supplied expression(s) into a template C program,
-then compiling and executing the program. <B>funcalc</B> expressions
-are C statements, although some important simplifications (such
-as automatic declaration of variables) are supported.
-
-<P>
-<B>funcalc</B> expressions can be specified in three ways: on the
-command line using the <B>-e [expression]</B> switch, in a file using
-the <B>-f [file]</B> switch, or from stdin (if neither <B>-e</B> nor
-<B>-f</B> is specified). Of course a file containing <B>funcalc</B>
-expressions can be read from stdin.
-
-<P>
-Each invocation of <B>funcalc</B> requires an input Funtools table
-file to be specified as the first command line argument. The output
-Funtools table file is the second optional argument. It is needed only
-if an output FITS file is being created (i.e., in cases where the
-<B>funcalc</B> expression only prints values, no output file is
-needed). If input and output file are both specified, a third optional
-argument can specify the list of columns to activate (using
-<A HREF="./library.html#funcolumnactivate">FunColumnActivate()</A>). Note
-that <B>funcalc</B> determines whether or not to generate code for
-writing an output file based on the presence or absence of an
-output file argument.
-
-<P>
-A <B>funcalc</B> expression executes on each row of a table and
-consists of one or more C statements that operate on the columns of
-that row (possibly using temporary variables). Within an expression,
-reference is made to a column of the <B>current</B> row using the C
-struct syntax <B>cur->[colname]</B>, e.g. cur->x, cur->pha, etc.
-Local scalar variables can be defined using C declarations at very the
-beginning of the expression, or else they can be defined automatically
-by <B>funcalc</B> (to be of type double). Thus, for example, a swap of
-columns x and y in a table can be performed using either of the
-following equivalent <B>funcalc</B> expressions:
-
-<PRE>
- double temp;
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;
-</PRE>
-
-or:
-
-<PRE>
- temp = cur->x;
- cur->x = cur->y;
- cur->y = temp;
-</PRE>
-
-When this expression is executed using a command such as:
-<PRE>
- funcalc -f swap.expr itest.ev otest.ev
-</PRE>
-the resulting file will have values of the x and y columns swapped.
-
-<P>
-By default, the data type of the variable for a column is the same as
-the data type of the column as stored in the file. This can be changed
-by appending ":[dtype]" to the first reference to that column. In the
-example above, to force x and y to be output as doubles, specify the
-type 'D' explicitly:
-<PRE>
- temp = cur->x:D;
- cur->x = cur->y:D;
- cur->y = temp;
-</PRE>
-
-Data type specifiers follow standard FITS table syntax for defining
-columns using TFORM:
-<UL>
-<LI>A: ASCII characters
-<LI>B: unsigned 8-bit char
-<LI>I: signed 16-bit int
-<LI>U: unsigned 16-bit int (not standard FITS)
-<LI>J: signed 32-bit int
-<LI>V: unsigned 32-bit int (not standard FITS)
-<LI>E: 32-bit float
-<LI>D: 64-bit float
-<LI>X: bits (treated as an array of chars)
-</UL>
-Note that only the first reference to a column should contain the
-explicit data type specifier.
-
-<P>
-Of course, it is important to handle the data type of the columns
-correctly. One of the most frequent cause of error in <B>funcalc</B>
-programming is the implicit use of the wrong data type for a column in
-expression. For example, the calculation:
-<PRE>
- dx = (cur->x - cur->y)/(cur->x + cur->y);
-</PRE>
-usually needs to be performed using floating point arithmetic. In
-cases where the x and y columns are integers, this can be done by
-reading the columns as doubles using an explicit type specification:
-<PRE>
- dx = (cur->x:D - cur->y:D)/(cur->x + cur->y);
-</PRE>
-
-Alternatively, it can be done using C type-casting in the expression:
-<PRE>
- dx = ((double)cur->x - (double)cur->y)/((double)cur->x + (double)cur->y);
-</PRE>
-
-<P>
-In addition to accessing columns in the current row, reference also
-can be made to the <B>previous</B> row using <B>prev->[colname]</B>,
-and to the <B>next</B> row using <B>next->[colname]</B>. Note that if
-<B>prev->[colname]</B> is specified in the <B>funcalc</B>
-expression, the very first row is not processed. If
-<B>next->[colname]</B> is specified in the <B>funcalc</B>
-expression, the very last row is not processed. In this way,
-<B>prev</B> and <B>next</B> are guaranteed always to point to valid
-rows. For example, to print out the values of the current x column
-and the previous y column, use the C fprintf function in a
-<B>funcalc</B> expression:
-<PRE>
- fprintf(stdout, "%d %d\n", cur->x, prev->y);
-</PRE>
-
-<P>
-New columns can be specified using the same <B>cur->[colname]</B>
-syntax by appending the column type (and optional tlmin/tlmax/binsiz
-specifiers), separated by colons. For example, cur->avg:D will define
-a new column of type double. Type specifiers are the same those
-used above to specify new data types for existing columns.
-
-<P>
-For example, to create and output a new column that is the average value of the
-x and y columns, a new "avg" column can be defined:
-<PRE>
- cur->avg:D = (cur->x + cur->y)/2.0
-</PRE>
-Note that the final ';' is not required for single-line expressions.
-
-<P>
-As with FITS TFORM data type specification, the column data type
-specifier can be preceded by a numeric count to define an array, e.g.,
-"10I" means a vector of 10 short ints, "2E" means two single precision
-floats, etc. A new column only needs to be defined once in a
-<B>funcalc</B> expression, after which it can be used without
-re-specifying the type. This includes reference to elements of a
-column array:
-
-<PRE>
- cur->avg[0]:2D = (cur->x + cur->y)/2.0;
- cur->avg[1] = (cur->x - cur->y)/2.0;
-</PRE>
-
-<P>
-The 'X' (bits) data type is treated as a char array of dimension
-(numeric_count/8), i.e., 16X is processed as a 2-byte char array. Each
-8-bit array element is accessed separately:
-<PRE>
- cur->stat[0]:16X = 1;
- cur->stat[1] = 2;
-</PRE>
-Here, a 16-bit column is created with the MSB is set to 1 and the LSB set to 2.
-
-<P>
-By default, all processed rows are written to the specified output
-file. If you want to skip writing certain rows, simply execute the C
-"continue" statement at the end of the <B>funcalc</B> expression,
-since the writing of the row is performed immediately after the
-expression is executed. For example, to skip writing rows whose
-average is the same as the current x value:
-
-<PRE>
- cur->avg[0]:2D = (cur->x + cur->y)/2.0;
- cur->avg[1] = (cur->x - cur->y)/2.0;
- if( cur->avg[0] == cur->x )
- continue;
-</PRE>
-
-<P>
-If no output file argument is specified on the <B>funcalc</B> command
-line, no output file is opened and no rows are written. This is useful
-in expressions that simply print output results instead of generating
-a new file:
-<PRE>
- fpv = (cur->av3:D-cur->av1:D)/(cur->av1+cur->av2:D+cur->av3);
- fbv = cur->av2/(cur->av1+cur->av2+cur->av3);
- fpu = ((double)cur->au3-cur->au1)/((double)cur->au1+cur->au2+cur->au3);
- fbu = cur->au2/(double)(cur->au1+cur->au2+cur->au3);
- fprintf(stdout, "%f\t%f\t%f\t%f\n", fpv, fbv, fpu, fbu);
-</PRE>
-In the above example, we use both explicit type specification
-(for "av" columns) and type casting (for "au" columns) to ensure that
-all operations are performed in double precision.
-
-<P>
-When an output file is specified, the selected input table is
-processed and output rows are copied to the output file. Note that
-the output file can be specified as "stdout" in order to write the
-output rows to the standard output. If the output file argument is
-passed, an optional third argument also can be passed to specify which
-columns to process.
-
-<p>
-In a FITS binary table, it sometimes is desirable to copy all of the
-other FITS extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. See <B>funtable</B> for a related example.
-
-<P>
-<B>funcalc</B> works by integrating the user-specified expression
-into a template C program called <A HREF="./tabcalc.c">tabcalc.c</A>.
-The completed program then is compiled and executed. Variable
-declarations that begin the <B>funcalc</B> expression are placed in
-the local declaration section of the template main program. All other
-lines are placed in the template main program's inner processing
-loop. Other details of program generation are handled
-automatically. For example, column specifiers are analyzed to build a
-C struct for processing rows, which is passed to
-<A HREF="./library.html#funcolumnselect">FunColumnSelect()</A> and used
-in <A HREF="./library.html#funtablerowget">FunTableRowGet()</A>. If
-an unknown variable is used in the expression, resulting in a
-compilation error, the program build is retried after defining the
-unknown variable to be of type double.
-
-<P>
-Normally, <B>funcalc</B> expression code is added to
-<B>funcalc</B> row processing loop. It is possible to add code
-to other parts of the program by placing this code inside
-special directives of the form:
-<PRE>
- [directive name]
- ... code goes here ...
- end
-</PRE>
-
-The directives are:
-<UL>
-<LI><B>global</B> add code and declarations in global space, before the main routine.
-
-<LI><B>local</B> add declarations (and code) just after the local declarations in
-main
-
-<LI><B>before</B> add code just before entering the main row processing loop
-
-<LI><B>after</B> add code just after exiting the main row processing loop
-</UL>
-
-Thus, the following <B>funcalc</B> expression will declare global
-variables and make subroutine calls just before and just after the
-main processing loop:
-<PRE>
- global
- double v1, v2;
- double init(void);
- double finish(double v);
- end
- before
- v1 = init();
- end
- ... process rows, with calculations using v1 ...
- after
- v2 = finish(v1);
- if( v2 < 0.0 ){
- fprintf(stderr, "processing failed %g -> %g\n", v1, v2);
- exit(1);
- }
- end
-</PRE>
-Routines such as init() and finish() above are passed to the generated
-program for linking using the <B>-l [link directives ...]</B>
-switch. The string specified by this switch will be added to the link
-line used to build the program (before the funtools library). For
-example, assuming that init() and finish() are in the library
-libmysubs.a in the /opt/special/lib directory, use:
-<PRE>
- funcalc -l "-L/opt/special/lib -lmysubs" ...
-</PRE>
-
-<p>
-User arguments can be passed to a compiled funcalc program using a string
-argument to the "-a" switch. The string should contain all of the
-user arguments. For example, to pass the integers 1 and 2, use:
-<PRE>
- funcalc -a "1 2" ...
-</PRE>
-The arguments are stored in an internal array and are accessed as
-strings via the ARGV(n) macro. For example, consider the following
-expression:
-<PRE>
- local
- int pmin, pmax;
- end
-
- before
- pmin=atoi(ARGV(0));
- pmax=atoi(ARGV(1));
- end
-
- if( (cur->pha >= pmin) && (cur->pha <= pmax) )
- fprintf(stderr, "%d %d %d\n", cur->x, cur->y, cur->pha);
-</PRE>
-This expression will print out x, y, and pha values for all rows in which
-the pha value is between the two user-input values:
-<PRE>
- funcalc -a '1 12' -f foo snr.ev'[cir 512 512 .1]'
- 512 512 6
- 512 512 8
- 512 512 5
- 512 512 5
- 512 512 8
-
- funcalc -a '5 6' -f foo snr.ev'[cir 512 512 .1]'
- 512 512 6
- 512 512 5
- 512 512 5
-</PRE>
-
-<P>
-Note that it is the user's responsibility to ensure that the correct
-number of arguments are passed. The ARGV(n) macro returns a NULL if a
-requested argument is outside the limits of the actual number of args,
-usually resulting in a SEGV if processed blindly. To check the
-argument count, use the ARGC macro:
-<PRE>
- local
- long int seed=1;
- double limit=0.8;
- end
-
- before
- if( ARGC >= 1 ) seed = atol(ARGV(0));
- if( ARGC >= 2 ) limit = atof(ARGV(1));
- srand48(seed);
- end
-
- if ( drand48() > limit ) continue;
-</PRE>
-
-<P>
-The macro WRITE_ROW expands to the FunTableRowPut() call that writes
-the current row. It can be used to write the row more than once. In
-addition, the macro NROW expands to the row number currently being
-processed. Use of these two macros is shown in the following example:
-<PRE>
- if( cur->pha:I == cur->pi:I ) continue;
- a = cur->pha;
- cur->pha = cur->pi;
- cur->pi = a;
- cur->AVG:E = (cur->pha+cur->pi)/2.0;
- cur->NR:I = NROW;
- if( NROW < 10 ) WRITE_ROW;
-</PRE>
-
-<p>
-If the <B>-p [prog]</B> switch is specified, the expression is not
-executed. Rather, the generated executable is saved with the specified
-program name for later use.
-
-<P>
-If the <B>-n</B> switch is specified, the expression is not
-executed. Rather, the generated code is written to stdout. This is
-especially useful if you want to generate a skeleton file and add your
-own code, or if you need to check compilation errors. Note that the
-comment at the start of the output gives the compiler command needed
-to build the program on that platform. (The command can change from
-platform to platform because of the use of different libraries,
-compiler switches, etc.)
-
-<P>
-As mentioned previously, <B>funcalc</B> will declare a scalar
-variable automatically (as a double) if that variable has been used
-but not declared. This facility is implemented using a sed script
-named <A HREF="./funcalc.sed">funcalc.sed</A>, which processes the
-compiler output to sense an undeclared variable error. This script
-has been seeded with the appropriate error information for gcc, and for
-cc on Solaris, DecAlpha, and SGI platforms. If you find that automatic
-declaration of scalars is not working on your platform, check this sed
-script; it might be necessary to add to or edit some of the error
-messages it senses.
-
-<P>
-In order to keep the lexical analysis of <B>funcalc</B> expressions
-(reasonably) simple, we chose to accept some limitations on how
-accurately C comments, spaces, and new-lines are placed in the
-generated program. In particular, comments associated with local
-variables declared at the beginning of an expression (i.e., not in a
-<B>local...end</B> block) will usually end up in the inner loop, not
-with the local declarations:
-<PRE>
- /* this comment will end up in the wrong place (i.e, inner loop) */
- double a; /* also in wrong place */
- /* this will be in the the right place (inner loop) */
- if( cur->x:D == cur->y:D ) continue; /* also in right place */
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- cur->avg:E = (cur->x+cur->y)/2.0;
-</PRE>
-Similarly, spaces and new-lines sometimes are omitted or added in a
-seemingly arbitrary manner. Of course, none of these stylistic
-blemishes affect the correctness of the generated code.
-
-<P>
-Because <B>funcalc</B> must analyze the user expression using the data
-file(s) passed on the command line, the input file(s) must be opened
-and read twice: once during program generation and once during
-execution. As a result, it is not possible to use stdin for the
-input file: <B>funcalc</B> cannot be used as a filter. We will
-consider removing this restriction at a later time.
-
-<P>
-Along with C comments, <B>funcalc</B> expressions can have one-line
-internal comments that are not passed on to the generated C
-program. These internal comment start with the <B>#</B> character and
-continue up to the new-line:
-<PRE>
- double a; # this is not passed to the generated C file
- # nor is this
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- /* this comment is passed to the C file */
- cur->avg:E = (cur->x+cur->y)/2.0;
-</PRE>
-
-<P>
-As previously mentioned, input columns normally are identified by
-their being used within the inner event loop. There are rare cases
-where you might want to read a column and process it outside the main
-loop. For example, qsort might use a column in its sort comparison
-routine that is not processed inside the inner loop (and therefore not
-implicitly specified as a column to be read). To ensure that such a
-column is read by the event loop, use the <b>explicit</b> keyword.
-The arguments to this keyword specify columns that should be read into
-the input record structure even though they are not mentioned in the
-inner loop. For example:
- <PRE>
- explicit pi pha
-</PRE>
-will ensure that the pi and pha columns are read for each row,
-even if they are not processed in the inner event loop. The <b>explicit</b>
-statement can be placed anywhere.
-
-<P>
-Finally, note that <B>funcalc</B> currently works on expressions
-involving FITS binary tables and raw event files. We will consider
-adding support for image expressions at a later point, if there is
-demand for such support from the community.
-
-<!-- =defdoc funcen funcen 1 -->
-
-<!-- =section funcen NAME -->
-<H2><A NAME="funcen">funcen - find centroid (for binary tables)</A></H2>
-<!-- =section funcen SYNOPSIS -->
-<B>
-<PRE>
-funcen [-i] [-n iter] [-t tol] [-v lev] &lt;iname&gt; &lt;region&gt;
-</PRE>
-</B>
-
-<!-- =section funcen OPTIONS -->
-<P>
-<PRE>
- -i # use image filtering (default: event filtering)
- -n iter # max number of iterations (default: 0)
- -t tol # pixel tolerance distance (default: 1.0)
- -v [0,1,2,3] # output verbosity level (default: 0)
-</PRE>
-
-<!-- =section funcen DESCRIPTION -->
-<P>
-<B>funcen</B> iteratively calculates the centroid position within one
-or more regions of a Funtools table (FITS binary table or raw event
-file). Starting with an input table, an initial region specification,
-and an iteration count, the program calculates the average x and y
-position within the region and then uses this new position as the
-region center for the next iteration. Iteration terminates when the
-maximum number of iterations is reached or when the input tolerance
-distance is met for that region. A count of events in the final region
-is then output, along with the pixel position value (and, where
-available, WCS position).
-
-<P>
-The first argument to the program specifies the Funtools table file to
-process. Since the file must be read repeatedly, a value of "stdin"
-is not permitted when the number of iterations is non-zero. Use
-<A HREF="./files.html">Funtools Bracket Notation</A> to specify FITS
-extensions and filters.
-
-<P>
-The second required argument is the initial region descriptor. Multiple
-regions are permitted. However, compound regions (accelerators,
-variable argument regions and regions connected via boolean algebra)
-are not permitted. Points and polygons also are illegal. These
-restrictions might be lifted in a future version, if warranted.
-
-<p>
-The <B>-n</B> (iteration number) switch specifies the maximum number of
-iterations to perform. The default is 0, which means that the program will
-simply count and display the number of events in the initial region(s).
-Note that when iterations is 0, the data can be input via stdin.
-
-<p>
-The <B>-t</B> (tolerance) switch specifies a floating point tolerance
-value. If the distance between the current centroid position value and
-the last position values is less than this value, iteration terminates.
-The default value is 1 pixel.
-
-<p>
-The <B>-v</B> (verbosity) switch specifies the verbosity level of the
-output. The default is 0, which results in a single line of output for
-each input region consisting of the following values:
-<pre>
- counts x y [ra dec coordsys]
-</pre>
-The last 3 WCS values are output if WCS information is available in the
-data file header. Thus, for example:
-<pre>
- [sh] funcen -n 0 snr.ev "cir 505 508 5"
- 915 505.00 508.00 345.284038 58.870920 j2000
-
- [sh] funcen -n 3 snr.ev "cir 505 508 5"
- 1120 504.43 509.65 345.286480 58.874587 j2000
-</pre>
-The first example simply counts the number of events in the initial region.
-The second example iterates the centroid calculation three times to determine
-a final "best" position.
-
-<p>
-Higher levels of verbosity obviously imply more verbose output. At
-level 1, the output essentially contains the same information as level
-0, but with keyword formatting:
-
- [sh] funcen -v 1 -n 3 snr.ev "cir 505 508 5"
- event_file: snr.ev
- initial_region: cir 505 508 5
- tolerance: 1.0000
- iterations: 1
-
- events: 1120
- x,y(physical): 504.43 509.65
- ra,dec(j2000): 345.286480 58.874587
- final_region1: cir 504.43 509.65 5
-</pre>
-Level 2 outputs results from intermediate calculations as well.
-
-<p>
-Ordinarily, region filtering is performed using analytic (event)
-filtering, i.e. that same style of filtering as is performed by
-<b>fundisp</b> and <b>funtable</b>. Use the <b>-i</b> switch to specify image
-filtering, i.e. the same style filtering as is performed by <b>funcnts</b>.
-Thus, you can perform a quick calculation of counts in regions, using
-either the analytic or image filtering method, by specifying the
- <b>-n 0</b> and optional <b>-i</b> switches. These two method often
-give different results because of how boundary events are processed:
-<pre>
- [sh] funcen snr.ev "cir 505 508 5"
- 915 505.00 508.00 345.284038 58.870920 j2000
-
- [sh] funcen -i snr.ev "cir 505 508 5"
- 798 505.00 508.00 345.284038 58.870920 j2000
-</pre>
-See <A HREF="./regbounds.html">Region Boundaries</A> for more information
-about how boundaries are calculated using these two methods.
-
-<!-- =defdoc funcnts funcnts 1 -->
-
-<!-- =section funcnts NAME -->
-<H2><A NAME="funcnts">funcnts - count photons in specified regions, with bkgd subtraction</A></H2>
-
-<!-- =section funcnts SYNOPSIS -->
-<B>
-<PRE>
-funcnts [switches] &lt;source_file&gt; [source_region] [bkgd_file] [bkgd_region|bkgd_value]
-</PRE>
-</B>
-
-<!-- =section funcnts OPTIONS -->
-<P>
-<PRE>
- -e "source_exposure[;bkgd_exposure]"
- # source (bkgd) FITS exposure image using matching files
- -w "source_exposure[;bkgd_exposure]"
- # source (bkgd) FITS exposure image using WCS transform
- -t "source_timecorr[;bkgd_timecorr]"
- # source (bkgd) time correction value or header parameter name
- -g # output using nice g format
- -G # output using %.14g format (maximum precision)
- -i "[column;]int1;int2..." # column-based intervals
- -m # match individual source and bkgd regions
- -p # output in pixels, even if wcs is present
- -r # output inner/outer radii (and angles) for annuli (and pandas)
- -s # output summed values
- -v "scol[;bcol]" # src and bkgd value columns for tables
- -T # output in starbase/rdb format
- -z # output regions with zero area
-</B>
-</PRE>
-
-<!-- =section funcnts DESCRIPTION -->
-<P>
-<B>funcnts</B> counts photons in the specified source regions and
-reports the results for each region. Regions are specified using the
-<A HREF="./regions.html">Spatial Region Filtering</A> mechanism.
-Photons are also counted in the specified bkgd regions applied to the
-same data file or a different data file. (Alternatively, a constant
-background value in counts/pixel**2 can be specified.) The bkgd regions
-are either paired one-to-one with source regions or pooled and
-normalized by area, and then subtracted from the source counts in each
-region. Displayed results include the bkgd-subtracted counts in each
-region, as well as the error on the counts, the area in
-each region, and the surface brightness (cnts/area**2) calculated for
-each region.
-
-<P>
-The first argument to the program specifies the FITS input image, array, or
-raw event file to process. If "stdin" is specified, data are read from
-the standard input. Use <A HREF="./files.html">Funtools Bracket
-Notation</A> to specify FITS extensions, image sections, and filters.
-
-<P>
-The optional second argument is the source region descriptor. If no
-region is specified, the entire field is used.
-
-<P>
-The background arguments can take one of two forms, depending on
-whether a separate background file is specified. If the source
-file is to be used for background as well, the third argument can be
-either the background region, or a constant value denoting background
-cnts/pixel. Alternatively, the third argument can be a background
-data file, in which case the fourth argument is the background region.
-If no third argument is specified, a constant value of 0 is used
-(i.e., no background).
-
-<P>
-In summary, the following command arguments are valid:
-<PRE>
- [sh] funcnts sfile # counts in source file
- [sh] funcnts sfile sregion # counts in source region
- [sh] funcnts sfile sregion bregion # bkgd reg. is from source file
- [sh] funcnts sfile sregion bvalue # bkgd reg. is constant
- [sh] funcnts sfile sregion bfile bregion # bkgd reg. is from separate file
-</PRE>
-
-<P>
-NB: unlike other Funtools programs, source and background regions are
-specified as separate arguments on the command line, rather than being
-placed inside brackets as part of the source and background filenames.
-This is because regions in funcnts are not simply used as data
-filters, but also are used to calculate areas, exposure, etc. If you
-put the source region inside the brackets (i.e. use it simply as a
-filter) rather than specifying it as argument two, the program still
-will only count photons that pass the region filter. However, the area
-calculation will be performed on the whole field, since field() is the
-default source region. This rarely is the desired behavior. On the
-other hand, with FITS binary tables, it often is useful to put a column
-filter in the filename brackets, so that only events matching the
-column filter are counted inside the region.
-
-<P>
-For example, to extract the counts within a radius of 22 pixels from the
-center of the FITS binary table snr.ev and subtract the background determined
-from the same image within an annulus of radii 50-100 pixels:
-<PRE>
- [sh] funcnts snr.ev "circle(502,512,22)" "annulus(502,512,50,100)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- circle(502,512,22)
-
- reg counts pixels
- ---- ------------ ---------
- 1 4382.000 1513
-
- background region(s)
- --------------------
- annulus(502,512,50,100)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-</PRE>
-The area units for the output columns labeled "area", "surf_bri"
-(surface brightness) and "surf_err" will be given either in
-arc-seconds (if appropriate WCS information is in the data file
-header(s)) or in pixels. If the data file has WCS info, but you do not
-want arc-second units, use the <B>-p</B> switch to force output in
-pixels. Also, regions having zero area are not normally included in
-the primary (background-subtracted) table, but are included in the
-secondary source and bkgd tables. If you want these regions to be
-included in the primary table, use the <B>-z</B> switch.
-
-<P>
-Note that a simple sed command will extract the background-subtracted results
-for further analysis:
-<PRE>
- [sh] cat funcnts.sed
- 1,/---- .*/d
- /^$/,$d
-
- [sh] sed -f funcnts.sed funcnts.out
- 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-</PRE>
-
-<P>
-If separate source and background files are specified, <B>funcnts</B> will
-attempt to normalize the the background area so that the background
-pixel size is the same as the source pixel size. This normalization
-can only take place if the appropriate WCS information is contained in
-both files (e.g. degrees/pixel values in CDELT). If either
-file does not contain the requisite size information, the normalization
-is not performed. In this case, it is the user's responsibility to
-ensure that the pixel sizes are the same for the two files.
-
-<P>
-Normally, if more than one background region is specified, <B>funcnts</B>
-will combine them all into a single region and use this background
-region to produce the background-subtracted results for each source
-region. The <B>-m</B> (match multiple backgrounds) switch tells
-<B>funcnts</B> to make a one to one correspondence between background and
-source regions, instead of using a single combined background region.
-For example, the default case is to combine 2 background
-regions into a single region and then apply that region to each of the
-source regions:
-
-<PRE>
- [sh] funcnts snr.ev "annulus(502,512,0,22,n=2)" "annulus(502,512,50,100,n=2)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002
- 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,22,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region(s)
- --------------------
- annulus(502,512,50,100,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-</PRE>
-Note that the basic region filter rule "each photon is counted once
-and no photon is counted more than once" still applies when using The
-<B>-m</B> to match background regions. That is, if two background
-regions overlap, the overlapping pixels will be counted in only one of
-them. In a worst-case scenario, if two background regions are the same
-region, the first will get all the counts and area and the second
-will get none.
-
-<P>
-Using the <B>-m</B> switch causes <B>funcnts</B> to use each of the two
-background regions independently with each of the two source regions:
-
-<PRE>
- [sh] funcnts -m snr.ev "annulus(502,512,0,22,n=2)" "ann(502,512,50,100,n=2)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 3087.015 56.954 150.985 2.395 23872.00 0.129 0.002
- 2 755.959 34.295 388.041 5.672 72959.99 0.010 0.000
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,22,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region(s)
- --------------------
- ann(502,512,50,100,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3975.000 9820
- 2 4681.000 13752
-</PRE>
-
-<P>
-Note that most floating point quantities are displayed using "f"
-format. You can change this to "g" format using the <B>-g</B>
-switch. This can be useful when the counts in each pixel is very
-small or very large. If you want maximum precision and don't care
-about the columns lining up nicely, use <B>-G</B>, which outputs
-all floating values as %.14g.
-
-<P>
-When counting photons using the annulus and panda (pie and annuli)
-shapes, it often is useful to have access to the radii (and panda
-angles) for each separate region. The <B>-r</B> switch will add radii
-and angle columns to the output table:
-
-<PRE>
- [sh] funcnts -r snr.ev "annulus(502,512,0,22,n=2)" "ann(502,512,50,100,n=2)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
- # radii: arcsecs
- # angles: degrees
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err radius1 radius2 angle1 angle2
- ---- ------------ --------- ------------ --------- --------- --------- --------- --------- --------- --------- ---------
- 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002 0.00 88.00 NA NA
- 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000 88.00 176.00 NA NA
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,22,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- 1 3238.000 373
- 2 1144.000 1140
-
- background region(s)
- --------------------
- ann(502,512,50,100,n=2)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-</PRE>
-
-<P>
-Radii are given in units of pixels or arc-seconds (depending on the
-presence of WCS info), while the angle values (when present) are in
-degrees. These columns can be used to plot radial profiles. For
-example, the script <B>funcnts.plot</B> in the funtools
-distribution) will plot a radial profile using gnuplot (version 3.7 or
-above). A simplified version of this script is shown below:
-
-<PRE>
- #!/bin/sh
-
- if [ x"$1" = xgnuplot ]; then
- if [ x`which gnuplot 2>/dev/null` = x ]; then
- echo "ERROR: gnuplot not available"
- exit 1
- fi
- awk '
- BEGIN{HEADER=1; DATA=0; FILES=""; XLABEL="unknown"; YLABEL="unknown"}
- HEADER==1{
- if( $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( FILES != "" ) FILES = FILES ","
- FILES = FILES $4
- }
- else if( $1 == "#" && $2 == "radii:" ){
- XLABEL = $3
- }
- else if( $1 == "#" && $2 == "surf_bri:" ){
- YLABEL = $3
- }
- else if( $1 == "----" ){
- printf "set nokey; set title \"funcnts(%s)\"\n", FILES
- printf "set xlabel \" radius(%s)\"\n", XLABEL
- printf "set ylabel \"surf_bri(%s)\"\n", YLABEL
- print "plot \"-\" using 3:4:6:7:8 with boxerrorbars"
- HEADER = 0
- DATA = 1
- next
- }
- }
- DATA==1{
- if( NF == 12 ){
- print $9, $10, ($9+$10)/2, $7, $8, $7-$8, $7+$8, $10-$9
- }
- else{
- exit
- }
- }
- ' | gnuplot -persist - 1>/dev/null 2>&1
-
- elif [ x"$1" = xds9 ]; then
- awk '
- BEGIN{HEADER=1; DATA=0; XLABEL="unknown"; YLABEL="unknown"}
- HEADER==1{
- if( $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( FILES != "" ) FILES = FILES ","
- FILES = FILES $4
- }
- else if( $1 == "#" && $2 == "radii:" ){
- XLABEL = $3
- }
- else if( $1 == "#" && $2 == "surf_bri:" ){
- YLABEL = $3
- }
- else if( $1 == "----" ){
- printf "funcnts(%s) radius(%s) surf_bri(%s) 3\n", FILES, XLABEL, YLABEL
- HEADER = 0
- DATA = 1
- next
- }
- }
- DATA==1{
- if( NF == 12 ){
- print $9, $7, $8
- }
- else{
- exit
- }
- }
- '
- else
- echo "funcnts -r ... | funcnts.plot [ds9|gnuplot]"
- exit 1
- fi
-</PRE>
-
-Thus, to run <B>funcnts</B> and plot the results using gnuplot (version 3.7
-or above), use:
-<PRE>
- funcnts -r snr.ev "annulus(502,512,0,50,n=5)" ... | funcnts.plot gnuplot
-</PRE>
-
-<P>
-The <B>-s</B> (sum) switch causes <B>funcnts</B> to produce an
-additional table of summed (integrated) background subtracted values,
-along with the default table of individual values:
-
-<PRE>
- [sh] funcnts -s snr.ev "annulus(502,512,0,50,n=5)" "annulus(502,512,50,100)"
- # source
- # data file: snr.ev
- # degrees/pix: 0.00222222
- # background
- # data file: snr.ev
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # summed background-subtracted results
- upto net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
- 2 3776.817 65.254 457.183 4.914 79679.98 0.047 0.001
- 3 4025.492 71.972 1031.508 11.087 179775.96 0.022 0.000
- 4 4185.149 80.109 1840.851 19.786 320831.94 0.013 0.000
- 5 4415.540 90.790 2873.460 30.885 500799.90 0.009 0.000
-
-
- # background-subtracted results
- reg counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
- 2 895.818 35.423 345.182 3.710 60159.99 0.015 0.001
- 3 248.675 29.345 574.325 6.173 100095.98 0.002 0.000
- 4 159.657 32.321 809.343 8.699 141055.97 0.001 0.000
- 5 230.390 37.231 1032.610 11.099 179967.96 0.001 0.000
-
-
- # the following source and background components were used:
- source region(s)
- ----------------
- annulus(502,512,0,50,n=5)
-
- reg counts pixels sumcnts sumpix
- ---- ------------ --------- ------------ ---------
- 1 2993.000 305 2993.000 305
- 2 1241.000 940 4234.000 1245
- 3 823.000 1564 5057.000 2809
- 4 969.000 2204 6026.000 5013
- 5 1263.000 2812 7289.000 7825
-
- background region(s)
- --------------------
- annulus(502,512,50,100)
-
- reg counts pixels
- ---- ------------ ---------
- all 8656.000 23572
-</PRE>
-
-<P>
-The <B>-t</B> and <B>-e</B> switches can be used to apply timing and
-exposure corrections, respectively, to the data. Please note that
-these corrections are meant to be used qualitatively, since
-application of more accurate correction factors is a complex and
-mission-dependent effort. The algorithm for applying these simple
-corrections is as follows:
-<PRE>
- C = Raw Counts in Source Region
- Ac= Area of Source Region
- Tc= Exposure time for Source Data
- Ec= Average exposure in Source Region, from exposure map
-
- B= Raw Counts in Background Region
- Ab= Area of Background Region
- Tb= (Exposure) time for Background Data
- Eb= Average exposure in Background Region, from exposure map
-</PRE>
-Then, Net Counts in Source region is
-<PRE>
- Net= C - B * (Ac*Tc*Ec)/(Ab*Tb*Eb)
-</PRE>
-with the standard propagation of errors for the Error on Net.
-The net rate would then be
-<PRE>
- Net Rate = Net/(Ac*Tc*Ec)
-</PRE>
-The average exposure in each region is calculated by summing up the
-pixel values in the exposure map for the given region and then
-dividing by the number of pixels in that region. Exposure maps often
-are generated at a block factor > 1 (e.g., block 4 means that each
-exposure pixel contains 4x4 pixels at full resolution) and
-<B>funcnts</B> will deal with the blocking automatically. Using the
-<B>-e</B> switch, you can supply both source and background exposure
-files (separated by ";"), if you have separate source and background
-data files. If you do not supply a background exposure file to go with
-a separate background data file, <B>funcnts</B> assumes that exposure
-already has been applied to the background data file. In addition, it
-assumes that the error on the pixels in the background data file is
-zero.
-
-<P>
-NB: The <B>-e</B> switch assumes that the exposure map overlays the
-image file <B>exactly</B>, except for the block factor. Each pixel in
-the image is scaled by the block factor to access the corresponding
-pixel in the exposure map. If your exposure map does not line up
-exactly with the image, <B>do not use</B> the <B>-e</B> exposure
-correction. In this case, it still is possible to perform exposure
-correction <B>if</B> both the image and the exposure map have valid
-WCS information: use the <B>-w</B> switch so that the transformation
-from image pixel to exposure pixel uses the WCS information. That is,
-each pixel in the image region will be transformed first from image
-coordinates to sky coordinates, then from sky coordinates to exposure
-coordinates. Please note that using <B>-w</B> can increase the time
-required to process the exposure correction considerably.
-
-<P>
-A time correction can be applied to both source and
-background data using the <B>-t</B> switch. The value for the correction can
-either be a numeric constant or the name of a header parameter in
-the source (or background) file:
-<PRE>
- [sh] funcnts -t 23.4 ... # number for source
- [sh] funcnts -t "LIVETIME;23.4" ... # param for source, numeric for bkgd
-</PRE>
-When a time correction is specified, it is applied to the net counts
-as well (see algorithm above), so that the units of surface brightness
-become cnts/area**2/sec.
-
-<P>
-The <B>-i</B> (interval) switch is used to run <b>funcnts</b> on multiple
-column-based intervals with only a single pass through the data. It is
-equivalent to running <b>funcnts</b> several times with a different column
-filter added to the source and background data each time. For each
-interval, the full <b>funcnts</b> output is generated, with a linefeed
-character (^L) inserted between each run. In addition, the output for
-each interval will contain the interval specification in its header.
-Intervals are very useful for generating X-ray hardness ratios
-efficiently. Of course, they are only supported when the input data
-are contained in a table.
-
-<P>
-Two formats are supported for interval specification. The most general
-format is semi-colon-delimited list of filters to be used as intervals:
-<PRE>
- funcnts -i "pha=1:5;pha=6:10;pha=11:15" snr.ev "circle(502,512,22)" ...
-</PRE>
-Conceptually, this will be equivalent to running <b>funcnts</b> three times:
-<PRE>
- funcnts snr.ev'[pha=1:5]' "circle(502,512,22)"
- funcnts snr.ev'[pha=6:10]' "circle(502,512,22)"
- funcnts snr.ev'[pha=11:15]' "circle(502,512,22)"
-</PRE>
-However, using the <B>-i</B> switch will require only one pass through
-the data.
-
-<P>
-Note that complex filters can be used to specify intervals:
-<PRE>
- funcnts -i "pha=1:5&&pi=4;pha=6:10&&pi=5;pha=11:15&&pi=6" snr.ev ...
-</PRE>
-The program simply runs the data through each filter in turn and generates
-three <b>funcnts</b> outputs, separated by the line-feed character.
-
-<P>
-In fact, although the intent is to support intervals for hardness ratios,
-the specified filters do not have to be intervals at all. Nor does one
-"interval" filter have to be related to another. For example:
-<PRE>
- funcnts -i "pha=1:5;pi=6:10;energy=11:15" snr.ev "circle(502,512,22)" ...
-</PRE>
-is equivalent to running <b>funcnts</b> three times with unrelated filter
-specifications.
-
-<P>
-A second interval format is supported for the simple case in which a
-single column is used to specify multiple homogeneous intervals for
-that column. In this format, a column name is specified first,
-followed by intervals:
-<PRE>
- funcnts -i "pha;1:5;6:10;11:15" snr.ev "circle(502,512,22)" ...
-</PRE>
-This is equivalent to the first example, but requires less typing. The
-<b>funcnts</b> program will simply prepend "pha=" before each of the specified
-intervals. (Note that this format does not contain the "=" character in
-the column argument.)
-
-<P>
-Ordinarily, when <b>funcnts</b> is run on a FITS binary table (or a
-raw event table), one integral count is accumulated for each row
-(event) contained within a given region. The <B>-v "scol[;bcol]"</B>
-(value column) switch will accumulate counts using the value from the
-specified column for the given event. If only a single column is
-specified, it is used for both the source and background regions. Two
-separate columns, separated by a semi-colon, can be specified for source
-and background. The special token '$none' can be used to specify that
-a value column is to be used for one but not the other. For example,
-'pha;$none' will use the pha column for the source but use integral
-counts for the background, while '$none;pha' will do the converse.
-If the value column is of type logical, then the value used will be 1
-for T and 0 for F. Value columns are used, for example, to integrate
-probabilities instead of integral counts.
-
-<P>
-If the <B>-T</B> (rdb table) switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces and line-feed will be inserted between
-tables.
-
-<P>
-Finally, note that <B>funcnts</B> is an image program, even though it
-can be run directly on FITS binary tables. This means that image
-filtering is applied to the rows in order to ensure that the same
-results are obtained regardless of whether a table or the equivalent
-binned image is used. Because of this, however, the number of counts
-found using <B>funcnts</B> can differ from the number of events found
-using row-filter programs such as <B>fundisp</B> or <B>funtable</B>
-For more information about these difference, see the discussion of
-<A HREF="./regbounds.html">Region Boundaries</A>.
-
-<!-- =defdoc funcone funcone 1 -->
-
-<!-- =section funcone NAME -->
-<H2><A NAME="funcone">funcone - cone search of a binary table containing RA, Dec columns</A></H2>
-
-<!-- =section funcone SYNOPSIS -->
-<B>
-<PRE>
-funcone &lt;switches&gt; &lt;iname&gt; &lt;oname&gt; &lt;ra[hdr]&gt; &lt;dec[hdr]&gt; &lt;radius[dr'"]&gt; [columns]
-</PRE>
-</B>
-
-<!-- =section funcone OPTIONS -->
-<P>
-<PRE>
- -d deccol:[hdr] # Dec column name, units (def: DEC:d)
- -j # join columns from list file
- -J # join columns from list file, output all rows
- -l listfile # read centers and radii from a list
- -L listfile # read centers and radii from a list, output list rows
- -n # don't use cone limits as a filter
- -r racol:[hdr] # RA column name, units (def: RA:h)
- -x # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols
- -X # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols, output all rows
-</PRE>
-
-<!-- =section funcone DESCRIPTION -->
-<P>
-Funcone performs a cone search on the RA and Dec columns of a FITS
-binary table. The distance from the center RA, Dec position to the RA,
-Dec in each row in the table is calculated. Rows whose distance is
-less than the specified radius are output.
-
-<P>
-The first argument to the program specifies the FITS file, raw event
-file, or raw array file. If "stdin" is specified, data are read from
-the standard input. Use <A HREF="./files.html">Funtools Bracket
-Notation</A> to specify FITS extensions, and filters. The second
-argument is the output FITS file. If "stdout" is specified, the FITS
-binary table is written to the standard output.
-
-<P>
-The third and fourth required arguments are the RA and Dec center
-position. By default, RA is specified in hours while Dec is specified
-in degrees. You can change the units of either of these by appending
-the character "d" (degrees), "h" (hours) or "r" (radians). Sexagesimal
-notation is supported, with colons or spaces separating hms and dms.
-(When using spaces, please ensure that the entire string is quoted.)
-
-<P>
-The fifth required argument is the radius of the cone search. By default,
-the radius value is given in degrees. The units can be changed by appending
-the character "d" (degrees), "r" (radians), "'" (arc minutes) or
-'"' (arc seconds).
-
-<P>
-By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional sixth argument in the form:
-<PRE>
- "column1 column1 ... columnN"
-</PRE>
-A seventh argument allows you to output selected columns from the list
-file when <B>-j</B> switch is used. Note that the RA and Dec columns
-used in the cone calculation must not be de-selected.
-
-<P>
-Also by default, the RA and Dec column names are named "RA" and "Dec",
-and are given in units of hours and degrees respectively. You can
-change both the name and the units using the -r [RA] and/or -d [Dec]
-switches. Once again, one of "h", "d", or "r" is appended to the
-column name to specify units but in this case, there must be a colon ":"
-between the name and the unit specification.
-
-<P>
-If the <B>-l [listfile]</B> switch is used, then one or more of the
-center RA, center Dec, and radius can be taken from a list file (which
-can be a FITS table or an ASCII column text file). In this case, the
-third (center RA), fourth (center Dec), and fifth (radius) command
-line arguments can either be a column name in the list file (if that
-parameter varies) or else a numeric value (if that parameter is
-static). When a column name is specified for the RA, Dec, or radius,
-you can append a colon followed by "h", "d", or "r" to specify units
-(also ' and " for radius). The cone search algorithm is run once for
-each row in the list, taking RA, Dec, and radius values from the
-specified columns or from static numeric values specified on the
-command line.
-
-<P>
-When using a list, all valid rows from each iteration are written to a
-single output file. Use the <B>-x</B> switch to help delineate which
-line of the list file was used to produce the given output row(s).
-This switch causes the values for the center RA, Dec, radius, and row
-number to be appended to the output file, in columns called RA_CEN,
-DEC_CEN, RAD_CEN and CONE_KEY, respectively. Alternatively, the
-<B>-j</B> (join) switch will append all columns from the list row to
-the output row (essentially a join of the list row and input row),
-along with the CONE_KEY row number. These two switches are mutually
-exclusive.
-
-<P>
-The <b>-X</b> and <b>-J</b> switches write out the same data as their
-lower case counterparts for each row satisfying a cone search. In
-addition, these switches also write out rows from the event file that
-do not satisfy any cone search. In such cases, that CONE_KEY column
-will be given a value of -1 and the center and list position information
-will be set to zero for the given row. Thus, all rows of the input
-event file are guaranteed to be output, with rows satisfying at least
-one cone search having additional search information.
-
-<p>
-The <b>-L</b> switch acts similarly to the <b>-l</b> switch in that it
-takes centers from a list file. However, it also implicitly sets the
--j switch, so that output rows are the join of the input event row and
-the center position row. In addition, this switch also writes out all
-center position rows for which no event satisfies the cone search
-criteria of that row. The CONE_KEY column will be given a value of -2
-for center rows that were not close to any data row and the event
-columns will be zeroed out for such rows. In this way, all centers
-rows are guaranteed to be output at least once.
-
-<p>
-If any of "all row" switches (<b>-X</b>, <b>-J</b>, or <b>-L</b>) are
-specified, then a new column named JSTAT is added to the output table.
-The positive values in this column indicate the center position row number
-(starting from 1) in the list file that this data row successful matched
-in a cone search. A value of -1 means that the data row did not match
-any center position. A value of -2 means that the center position was
-not matched by any data row.
-
-<P>
-Given a center position and radius, the cone search algorithm
-calculates limit parameters for a box enclosing the specified cone,
-and only tests rows whose positions values lie within those limits.
-For small files, the overhead associated with this cone limit
-filtering can cause the program to run more slowly than if all events
-were tested. You can turn off cone limit filtering using the <B>-n</B>
-switch to see if this speeds up the processing (especially useful when
-processing a large list of positions).
-
-<P>
-For example, the default cone search uses columns "RA" and "Dec" in hours
-and degrees (respectively) and RA position in hours, Dec and radius in degrees:
-<PRE>
- funone in.fits out.fits 23.45 34.56 0.01
-</PRE>
-To specify the RA position in degrees:
-<PRE>
- funcone in.fits out.fits 23.45d 34.56 0.01
-</PRE>
-To get RA and Dec from a list but use a static value for radius (and
-also write identifying info for each row in the list):
-<PRE>
- funcone -x -l list.txt in.fits out.fits MYRA MYDec 0.01
-</PRE>
-User specified columns in degrees, RA position in hours (sexagesimal
-notation), Dec position in degrees (sexagesimal notation) and radius
-in arc minutes:
-<PRE>
- funcone -r myRa:d -d myDec in.fits out.fits 12:30:15.5 30:12 15'
-</PRE>
-
-<!-- =defdoc fundisp fundisp 1 -->
-
-<!-- =section fundisp NAME -->
-<H2><A NAME="fundisp">fundisp - display data in a Funtools data file</A></H2>
-
-<!-- =section fundisp SYNOPSIS -->
-<B>
-<PRE>
-fundisp [-f format] [-l] [-n] [-T] &lt;iname&gt; [columns|bitpix=n]
-</PRE>
-</B>
-
-<!-- =section fundisp OPTIONS -->
-<P>
-<PRE>
- -f # format string for display
- -l # display image as a list containing the columns X, Y, VAL
- -n # don't output header
- -F [c] # use specified character as column separator (def: space)
- -T # output in rdb/starbase format (tab separators)
-</PRE>
-
-<!-- =section fundisp DESCRIPTION -->
-<P>
-<B>fundisp</B> displays the data in the specified
-<A HREF="./files.html">FITS Extension</A>
-and/or
-<A HREF="./files.html#sections">Image Section</A>
-of a FITS file, or in a
-<A HREF="./files.html#sections">Section</A>
-of a non-FITS array or raw event file.
-<P>
-The first argument to the program specifies the FITS input image, array, or
-raw event file to display. If "stdin" is specified, data are read from
-the standard input. Use <A HREF="./files.html">Funtools Bracket
-Notation</A> to specify FITS extensions, image sections, and filters.
-
-<P>
-If the data being displayed are columns (either in a FITS binary table
-or a raw event file), the individual rows are listed. Filters can be
-added using bracket notation. Thus:
-<PRE>
- [sh] fundisp "test.ev[time-(int)time>.15]"
- X Y PHA PI TIME DX DY
- ------- ------- ------- --------- ---------------- ---------- ----------
- 10 8 10 8 17.1600 8.50 10.50
- 9 9 9 9 17.1600 9.50 9.50
- 10 9 10 9 18.1600 9.50 10.50
- 10 9 10 9 18.1700 9.50 10.50
- 8 10 8 10 17.1600 10.50 8.50
- 9 10 9 10 18.1600 10.50 9.50
- 9 10 9 10 18.1700 10.50 9.50
- 10 10 10 10 19.1600 10.50 10.50
- 10 10 10 10 19.1700 10.50 10.50
- 10 10 10 10 19.1800 10.50 10.50
-</PRE>
-[NB: The FITS binary table test file test.ev, as well as the FITS
-image test.fits, are contained in the funtools funtest directory.]
-
-<P>
-When a table is being displayed using <B>fundisp</B>, a second optional
-argument can be used to specify the columns to display. For example:
-<PRE>
- [sh] fundisp "test.ev[time-(int)time>=.99]" "x y time"
- X Y TIME
- -------- -------- ---------------------
- 5 -6 40.99000000
- 4 -5 59.99000000
- -1 0 154.99000000
- -2 1 168.99000000
- -3 2 183.99000000
- -4 3 199.99000000
- -5 4 216.99000000
- -6 5 234.99000000
- -7 6 253.99000000
-</PRE>
-
-<P>
-The special column <B>$REGION</B> can be specified to display the
-region id of each row:
-<PRE>
- [sh $] fundisp "test.ev[time-(int)time>=.99&&annulus(0 0 0 10 n=3)]" 'x y time $REGION'
- X Y TIME REGION
- -------- -------- --------------------- ----------
- 5 -6 40.99000000 3
- 4 -5 59.99000000 2
- -1 0 154.99000000 1
- -2 1 168.99000000 1
- -3 2 183.99000000 2
- -4 3 199.99000000 2
- -5 4 216.99000000 2
- -6 5 234.99000000 3
- -7 6 253.99000000 3
-</PRE>
-<P>
-Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are displayed.
-<P>
-Columns can be excluded from display using a minus sign before the
-column:
-<PRE>
- [sh $] fundisp "test.ev[time-(int)time>=.99]" "-time"
- X Y PHA PI DX DY
- -------- -------- -------- ---------- ----------- -----------
- 5 -6 5 -6 5.50 -6.50
- 4 -5 4 -5 4.50 -5.50
- -1 0 -1 0 -1.50 0.50
- -2 1 -2 1 -2.50 1.50
- -3 2 -3 2 -3.50 2.50
- -4 3 -4 3 -4.50 3.50
- -5 4 -5 4 -5.50 4.50
- -6 5 -6 5 -6.50 5.50
- -7 6 -7 6 -7.50 6.50
-</PRE>
-All columns except the time column are displayed.
-<P>
-The special column <B>$N</B> can be specified to display the
-ordinal value of each row. Thus, continuing the previous example:
-<PRE>
- fundisp "test.ev[time-(int)time>=.99]" '-time $n'
- X Y PHA PI DX DY N
- ------- -------- -------- ---------- ----------- ----------- ----------
- 5 -6 5 -6 5.50 -6.50 337
- 4 -5 4 -5 4.50 -5.50 356
- -1 0 -1 0 -1.50 0.50 451
- -2 1 -2 1 -2.50 1.50 465
- -3 2 -3 2 -3.50 2.50 480
- -4 3 -4 3 -4.50 3.50 496
- -5 4 -5 4 -5.50 4.50 513
- -6 5 -6 5 -6.50 5.50 531
- -7 6 -7 6 -7.50 6.50 550
-</PRE>
-Note that the column specification is enclosed in single quotes to protect
-'$n' from begin expanded by the shell.
-
-<P>
-In general, the rules for activating and de-activating columns are:
-<UL>
-<LI> If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-<LI> If only include columns are specified, then only the specified columns
-are activated.
-<LI> If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.
-</UL>
-In addition to specifying columns names explicitly, the special
-symbols <B>+</B> and <B>-</B> can be used to activate and
-de-activate <B>all</B> columns. This is useful if you want to
-activate the $REGION column along with all other columns. According
-to the rules, the syntax "$REGION" only activates the region column
-and de-activates the rest. Use "+ $REGION" to activate all
-columns as well as the region column.
-
-<P>
-If the data being displayed are image data (either in a FITS primary
-image, a FITS image extension, or an array file), an mxn pixel display
-is produced, where m and n are the dimensions of the image. By
-default, pixel values are displayed using the same data type as in the
-file. However, for integer data where the BSCALE and BZERO header parameters
-are present, the data is displayed as floats. In either case, the
-display data type can be overridden using an optional second argument
-of the form:
-<PRE>
- bitpix=n
-</PRE>
-where n is 8,16,32,-32,-64, for unsigned char, short, int, float and double,
-respectively.
-
-<P>
-Of course, running <B>fundisp</B> on anything but the smallest image
-usually results in a display whose size makes it unreadable.
-Therefore, one can uses bracket notation (see below)
-to apply section and/or blocking to the image before generating a
-display. For example:
-<PRE>
- [sh] fundisp "test.fits[2:6,2:7]" bitpix=-32
- 2 3 4 5 6
- ---------- ---------- ---------- ---------- ----------
- 2: 3.00 4.00 5.00 6.00 7.00
- 3: 4.00 5.00 6.00 7.00 8.00
- 4: 5.00 6.00 7.00 8.00 9.00
- 5: 6.00 7.00 8.00 9.00 10.00
- 6: 7.00 8.00 9.00 10.00 11.00
- 7: 8.00 9.00 10.00 11.00 12.00
-</PRE>
-
-<P>
-Note that is is possible to display a FITS binary table as an image
-simply by passing the table through <B>funimage</B> first:
-<PRE>
- [sh] ./funimage test.ev stdout | fundisp "stdin[2:6,2:7]" bitpix=8
- 2 3 4 5 6
- ------- ------- ------- ------- -------
- 2: 3 4 5 6 7
- 3: 4 5 6 7 8
- 4: 5 6 7 8 9
- 5: 6 7 8 9 10
- 6: 7 8 9 10 11
- 7: 8 9 10 11 12
-</PRE>
-
-If the <B>-l</B> (list) switch is used, then an image is displayed as a
-list containing the columns: X, Y, VAL. For example:
-<PRE>
- fundisp -l "test1.fits[2:6,2:7]" bitpix=-32
- X Y VAL
- ---------- ---------- -----------
- 2 2 6.00
- 3 2 1.00
- 4 2 1.00
- 5 2 1.00
- 6 2 1.00
- 2 3 1.00
- 3 3 5.00
- 4 3 1.00
- 5 3 1.00
- 6 3 1.00
- 2 4 1.00
- 3 4 1.00
- 4 4 4.00
- 5 4 1.00
- 6 4 1.00
- 2 5 1.00
- 3 5 1.00
- 4 5 1.00
- 5 5 3.00
- 6 5 1.00
- 2 6 1.00
- 3 6 1.00
- 4 6 1.00
- 5 6 1.00
- 6 6 2.00
- 2 7 1.00
- 3 7 1.00
- 4 7 1.00
- 5 7 1.00
- 6 7 1.00
-</PRE>
-
-<p>
-If the <B>-n</B> (nohead) switch is used, then no header is output for
-tables. This is useful, for example, when fundisp output is being
-directed into gnuplot.
-
-<P>
-The <B>fundisp</B> program uses a default set of display formats:
-<PRE>
- datatype TFORM format
- -------- ----- --------
- double D "%21.8f"
- float E "%11.2f"
- int J "%10d"
- short I "%8d"
- byte B "%6d"
- string A "%12.12s"
- bits X "%8x"
- logical L "%1x"
-</PRE>
-Thus, the default display of 1 double and 2 shorts gives:
-<PRE>
- [sh] fundisp snr.ev "time x y"
-
- TIME X Y
- --------------------- -------- --------
- 79494546.56818075 546 201
- 79488769.94469175 548 201
- ...
-</PRE>
-You can change the display format for individual columns or for all
-columns of a given data types by means of the -f switch. The format
-string that accompanies -f is a space-delimited list of keyword=format
-values. The keyword values can either be column names (in which case
-the associated format pertains only to that column) or FITS table
-TFORM specifiers (in which case the format pertains to all columns
-having that data type). For example, you can change the double and
-short formats for all columns like this:
-<PRE>
- [sh] fundisp -f "D=%22.11f I=%3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- ---
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...
-</PRE>
-
-<p>
-Alternatively, you can change the format of the time and x columns like this:
-<pre>
- [sh] fundisp -f "time=%22.11f x=%3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- --------
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...
-</pre>
-Note that there is a potential conflict if a column has the same name
-as one of the TFORM specifiers. In the examples above, the the "X"
-column in the table has the same name as the X (bit) datatype. To
-resolve this conflict, the format string is processed such that
-TFORM datatype specifiers are checked for first, using a
-case-sensitive comparison. If the specified format value is not an
-upper case TFORM value, then a case-insensitive check is made on the
-column name. This means that, in the examples above, "X=%3d" will refer
-to the X (bit) datatype, while "x=%3d" will refer to the X column:
-<pre>
- [sh] fundisp -f "X=%3d" snr.ev "x y"
-
- X Y
- -------- --------
- 546 201
- 548 201
- ...
-
- [sh] fundisp -f "x=%3d" snr.ev "x y"
-
- X Y
- --- --------
- 546 201
- 548 201
- ...
-</pre>
-As a rule, therefore, it is best always to specify the column name in
-lower case and TFORM data types in upper case.
-
-<p>
-The <B>-f [format]</B> will change the format for a single execution
-of fundisp. You also can use the <B>FUN_FORMAT</B> envronment variable
-to change the format for all invocations of fundisp. The format of this
-environment variable's value is identical to that used with
-the <B>-f</B> switch. This global value can be overridden in
-individual cases by use of the <B>-f [format]</B> switch.
-
-<P>
-Caveats: Please also note that it is the user's responsibility to
-match the format specifier to the column data type correctly. Also
-note that, in order to maintain visual alignment between names and
-columns, the column name will be truncated (on the left) if the
-format width is less than the length of the name. However, truncation
-is not performed if the output is in RDB format (using the -T switch).
-
-<p>
-[An older-style format string is supported but deprecated. It
-consists of space-delimited C format statements for all data types,
-specified in the following order:
-<PRE>
- double float int short byte string bit.
-</PRE>
-This order of the list is based on the assumption that people generally
-will want to change the float formats.
-<P>
-If "-" is entered instead of a format statement for a given data type, the
-default format is used. Also, the format string can be terminated without
-specifying all formats, and defaults will be used for the rest of the
-list. Note that you must supply a minimum field width, i.e., "%6d" and
-"%-6d" are legal, "%d" is not legal.
-
-By using -f [format], you can change the double and short formats like this:
-<PRE>
- [sh] fundisp -f "22.11f - - 3d" snr.ev "time x y"
-
- TIME X Y
- ---------------------- --- ---
- 79494546.56818075478 546 201
- 79488769.94469174743 548 201
- ...
-</PRE>
-NB: This format is deprecated and will be removed in a future release.]
-
-<P>
-The <B>-F[c]</B> switch can be used to specify a (single-character)
-column separator (where the default is a space). Note that column
-formatting will almost certainly also add spaces to pad individual
-columns to the required width. These can be removed with a program
-such as sed, at the cost of generating unaligned columns. For example:
-<PRE>
-fundisp -F',' snr.ev'[cir 512 512 .1]'
- X, Y, PHA, PI, TIME, DX, DY
---------,--------,--------,--------,---------------------,--------,--------
- 512, 512, 6, 7, 79493997.45854475, 578, 574
- 512, 512, 8, 9, 79494575.58943175, 579, 573
- 512, 512, 5, 6, 79493631.03866175, 578, 575
- 512, 512, 5, 5, 79493290.86521725, 578, 575
- 512, 512, 8, 9, 79493432.00990875, 579, 573
-
-fundisp -F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,PHA,PI,TIME,DX,DY
---------,--------,--------,--------,---------------------,--------,--------
- 512,512,6,7,79493997.45854475,578,574
- 512,512,8,9,79494575.58943175,579,573
- 512,512,5,6,79493631.03866175,578,575
- 512,512,5,5,79493290.86521725,578,575
- 512,512,8,9,79493432.00990875,579,573
-
-fundisp -f "x=%3d y=%3d pi=%1d pha=%1d time=%20.11f dx=%3d dy=%3d" -F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,A,I,TIME,DX,DY
----,---,-,-,--------------------,---,---
-512,512,6,7,79493997.45854474604,578,574
-512,512,8,9,79494575.58943174779,579,573
-512,512,5,6,79493631.03866174817,578,575
-512,512,5,5,79493290.86521725357,578,575
-512,512,8,9,79493432.00990875065,579,573
-
-</PRE>
-
-<P>
-If the <B>-T</B> (rdb table) switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces. This format is not available when
-displaying image pixels (except in conjunction with the <B>-l</B>
-switch).
-
-<P>
-Finally, note that <B>fundisp</B> can be used to create column filters from
-the auxiliary tables in a FITS file. For example, the following shell code
-will generate a good-time interval (GTI) filter for X-ray data files that
-contain a standard GTI extension:
-<PRE>
- #!/bin/sh
- sed '1,/---- .*/d
- /^$/,$d' | awk 'tot>0{printf "||"};{printf "time="$1":"$2; tot++}'
-</PRE>
-If this script is placed in a file called "mkgti", it can be used in a
-command such as:
-<PRE>
- fundisp foo.fits"[GTI]" | mkgti > gti.filter
-</PRE>
-The resulting filter file can then be used in various funtools programs:
-<PRE>
- funcnts foo.fits"[@gti.filter]" ...
-</PRE>
-to process only the events in the good-time intervals.
-
-<!-- =defdoc funhead funhead 1 -->
-
-<!-- =section funhead NAME -->
-<H2><A NAME="funhead">funhead - display a header in a Funtools file</A></H2>
-
-<!-- =section funhead SYNOPSIS -->
-<B>
-<PRE>
-funhead [-a] [-s] [-t] [-L] &lt;iname&gt; [oname ename]
-</PRE>
-</B>
-
-<!-- =section funhead OPTIONS -->
-<P>
-<PRE>
- -a # display all extension headers
- -s # display 79 chars instead of 80 before the new-line
- -t # prepend data type char to each line of output
- -L # output in rdb/starbase list format
-</PRE>
-
-<!-- =section funhead DESCRIPTION -->
-<P>
-<B>funhead</B> displays the FITS header parameters in the specified
-<A HREF="./files.html">FITS Extension</A>.
-<P>
-The first argument to the program specifies the Funtools input file
-to display. If "stdin" is specified, data are read from
-the standard input. <A HREF="./files.html">Funtools Bracket
-Notation</A> is used to specify particular FITS extension to process.
-Normally, the full 80 characters of each header card is output,
-followed by a new-line.
-
-<P>
-If the <B>-a</B> switch is specified, the header from each FITS
-extensions in the file is displayed. Note, however, that the <B>-a</B>
-switch does not work with FITS files input via stdin. We hope to
-remove this restriction in a future release.
-
-<P>
-If the <B>-s</B> switch is specified, only 79 characters are output
-before the new-line. This helps the display on 80 character terminals.
-
-<P>
-If the <B>-t</B> switch is specified, the data type of the parameter
-is output as a one character prefix, followed by 77 characters of the
-param. The parameter data types are defined as: FUN_PAR_UNKNOWN
-('u'), FUN_PAR_COMMENT ('c'), FUN_PAR_LOGICAL ('l'), FUN_PAR_INTEGER
-('i'), FUN_PAR_STRING ('s'), FUN_PAR_REAL ('r'), FUN_PAR_COMPLEX ('x').
-
-<P>
-If the <B>-L</B> (rdb table) switch is used, the output will conform
-to starbase/rdb data base list format.
-
-<P>
-For example to display the EVENTS extension (binary table):
-<PRE>
- [sh] funhead "foo.fits[EVENTS]"
- XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
- BITPIX = 8 / Binary data
- NAXIS = 2 / Table is a matrix
- NAXIS1 = 20 / Width of table in bytes
- NAXIS2 = 30760 / Number of entries in table
- PCOUNT = 0 / Random parameter count
- GCOUNT = 1 / Group count
- TFIELDS = 7 / Number of fields in each row
- EXTNAME = 'EVENTS ' / Table name
- EXTVER = 1 / Version number of table
- TFORM1 = '1I ' / Data type for field
- TTYPE1 = 'X ' / Label for field
- TUNIT1 = ' ' / Physical units for field
- TFORM2 = '1I ' / Data type for field
- etc. ...
- END
-</PRE>
-
-<P>
-To display the third header:
-<PRE>
- [sh] funhead "foo.fits[3]"
- XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
- BITPIX = 8 / Binary data
- NAXIS = 2 / Table is a matrix
- NAXIS1 = 32 / Width of table in bytes
- NAXIS2 = 40 / Number of entries in table
- PCOUNT = 0 / Random parameter count
- GCOUNT = 1 / Group count
- TFIELDS = 7 / Number of fields in each row
- EXTNAME = 'TGR ' / Table name
- EXTVER = 1 / Version number of table
- TFORM1 = '1D ' / Data type for field
- etc. ...
- END
-</PRE>
-
-<P>
-To display the primary header (i.e., extension 0):
-<PRE>
- sh> funhead "coma.fits[0]"
- SIMPLE = T /STANDARD FITS FORMAT
- BITPIX = 16 /2-BYTE TWOS-COMPL INTEGER
- NAXIS = 2 /NUMBER OF AXES
- NAXIS1 = 800 /
- NAXIS2 = 800 /
- DATATYPE= 'INTEGER*2' /SHORT INTEGER
- END
-</PRE>
-
-<P>
-The funhead program also can edit (i.e. add, delete, or modify) or
-display individual headers parameters. Edit mode is signalled by the
-presence of two additional command-line arguments: output file and
-edit command file, in that order. Edit mode acts as a filter: the
-output file will contain the entire input FITS file, including other
-extensions. The edit command file can be "stdin", in which case edit
-command are read from the standard input.
-
-<P>
-The edit command file contains parameter comments (having '#' in the
-first column) and delete and assignment(modify or add) operations. A
-delete operation is specified by preceding the parameter name with a
-minus sign "-". A display operation (very useful in interactive
-sessions, i.e., where the edit commands are taken from stdin) is
-specified by preceding the parameter name with a question mark "?". In
-either case, a parameter value need not be specified. An assignment
-operation is specified in the same two ways that a parameter is
-specified in a text header (but without the comment character that
-precedes header params), i.e.:
-
-<UL>
-<LI> FITS-style comments have an equal sign "=" between the keyword and
-value and an optional slash "/" to signify a comment. The strict FITS
-rules on column positions are not enforced.
-
-<LI> Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed.
-</UL>
-
-<P>
-For example, the following interactive session checks for the
-existence of parameters, adds new parameters, modifies them, and
-modifies and deletes existing parameters:
-<PRE>
- sh$ ./funhead snr.ev foo.fits -
- # look for FOO1
- ? FOO1
- WARNING: FOO1 not found
- # add new foo1
- FOO1 = 100
- # add foo2
- FOO2 = 200
- # reset foo1 to a different value
- FOO1 -1
- # delete foo2
- -FOO2
- # change existing value
- EXTVER 2
- ? XS-SORT
- XS-SORT = 'EOF ' / type of event sort
- # delete existing value
- -XS-SORT
- # exit
- ^D
-</PRE>
-
-<P>
-See <A HREF="./text.html">Column-based Text Files</A>
-for more information about header parameter format.
-
-<P>
-
-<P>
-<!-- =defdoc funhist funhist 1 -->
-
-<!-- =section funhist NAME -->
-<H2><A NAME="funhist">funhist - create a 1D histogram of a column (from a FITS binary table or raw event file) or an image</A></H2>
-
-<!-- =section funhist SYNOPSIS -->
-<B>
-<PRE>
-funhist [-n|-w|-T] &lt;iname&gt; [column] [[lo:hi:]bins]
-</PRE>
-</B>
-
-<!-- =section funhist OPTIONS -->
-<P>
-<PRE>
- -n # normalize bin value by the width of each bin
- -w # specify bin width instead of number of bins in arg3
- -T # output in rdb/starbase format (tab separators)
-</PRE>
-
-<!-- =section funhist DESCRIPTION -->
-<P>
-<B>funhist</B> creates a one-dimensional histogram from the specified
-columns of a <A HREF="./files.html">FITS Extension</A>
-binary table of a FITS file (or from a non-FITS raw event file), or
-from a FITS image or array, and writes that histogram as an ASCII
-table. Alternatively, the program can perform a 1D projection of one
-of the image axes.
-
-<P>
-The first argument to the program is required, and specifies the
-Funtools file: FITS table or image, raw event file, or array. If
-"stdin" is specified, data are read from the standard input. Use
-<A HREF="./files.html">Funtools Bracket Notation</A> to specify FITS
-extensions, and filters.
-
-<P>
-For a table, the second argument also is required. It specifies the
-column to use in generating the histogram. If the data file is of
-type image (or array), the column is optional: if "x" (or "X"), "y"
-(or "Y") is specified, then a projection is performed over the x
-(dim1) or y (dim2) axes, respectively. (That is, this projection will
-give the same results as a histogram performed on a table containing
-the equivalent x,y event rows.) If no column name is specified or
-"xy" (or "XY") is specified for the image, then a histogram is
-performed on the values contained in the image pixels.
-
-<P>
-The argument that follows is optional and specifies the number of bins
-to use in creating the histogram and, if desired, the range of bin
-values. For image and table histograms, the range should specify the
-min and max data values. For image histograms on the x and y axes,
-the range should specify the min and max image bin values. If this
-argument is omitted, the number of output bins for a table is
-calculated either from the TLMIN/TLMAX headers values (if these exist
-in the table FITS header for the specified column) or by going through
-the data to calculate the min and max value. For an image, the number
-of output bins is calculated either from the DATAMIN/DATAMAX header
-values, or by going through the data to calculate min and max value.
-(Note that this latter calculation might fail if the image cannot be
-fit in memory.) If the data are floating point (table or image) and
-the number of bins is not specified, an arbitrary default of 128 is
-used.
-
-<P>
-For binary table processing, the <B>-w</B> (bin width) switch can be used
-to specify the width of each bin rather than the number of bins. Thus:
-<PRE>
- funhist test.ev pha 1:100:5
-</PRE>
-means that 5 bins of width 20 are used in the histogram, while:
-<PRE>
- funhist -w test.ev pha 1:100:5
-</PRE>
-means that 20 bins of width 5 are used in the histogram.
-
-<P>
-The data are divvied up into the specified number of bins and the
-resulting 1D histogram (or projection) is output in ASCII table
-format. For a table, the output displays the low_edge (inclusive) and
-hi_edge (exclusive) values for the data. For example, a 15-row table
-containing a "pha" column whose values range from -7.5 to 7.5
-can be processed thus:
-
-<PRE>
- [sh] funhist test.ev pha
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: -7.5 7.5 15
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 22 -7.50000000 -6.50000000
- 2 21 -6.50000000 -5.50000000
- 3 20 -5.50000000 -4.50000000
- 4 19 -4.50000000 -3.50000000
- 5 18 -3.50000000 -2.50000000
- 6 17 -2.50000000 -1.50000000
- 7 16 -1.50000000 -0.50000000
- 8 30 -0.50000000 0.50000000
- 9 16 0.50000000 1.50000000
- 10 17 1.50000000 2.50000000
- 11 18 2.50000000 3.50000000
- 12 19 3.50000000 4.50000000
- 13 20 4.50000000 5.50000000
- 14 21 5.50000000 6.50000000
- 15 22 6.50000000 7.50000000
-
- [sh] funhist test.ev pha 1:6
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 6
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 16 0.50000000 1.50000000
- 2 17 1.50000000 2.50000000
- 3 18 2.50000000 3.50000000
- 4 19 3.50000000 4.50000000
- 5 20 4.50000000 5.50000000
- 6 21 5.50000000 6.50000000
-
- [sh] funhist test.ev pha 1:6:3
- # data file: /home/eric/data/test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 3
-
- bin value lo_edge hi_edge
- ------ --------- --------------------- ---------------------
- 1 33 0.50000000 2.50000000
- 2 37 2.50000000 4.50000000
- 3 41 4.50000000 6.50000000
-</PRE>
-
-<P>
-For a table histogram, the <B>-n</B>(normalize) switch can be used to
-normalize the bin value by the width of the bin (i.e., hi_edge-lo_edge):
-<PRE>
- [sh] funhist -n test.ev pha 1:6:3
- # data file: test.ev
- # column: pha
- # min,max,bins: 0.5 6.5 3
- # width normalization (val/(hi_edge-lo_edge)) is applied
-
- bin value lo_edge hi_edge
- ------ --------------------- --------------------- ---------------------
- 1 16.50000000 0.50000000 2.50000000
- 2 6.16666667 2.50000000 4.50000000
- 3 4.10000000 4.50000000 6.50000000
-</PRE>
-This could used, for example, to produce a light curve with values
-having units of counts/second instead of counts.
-
-<P>
-For an image histogram, the output displays the low and high image
-values (both inclusive) used to generate the histogram. For example,
-in the following example, 184 pixels had a value of 1, 31 had a value
-of 2, while only 2 had a value of 3,4,5,6, or 7:
-<PRE>
- [sh] funhist test.fits
- # data file: /home/eric/data/test.fits
- # min,max,bins: 1 7 7
-
- bin value lo_val hi_val
- ------ --------------------- --------------------- ---------------------
- 1 184.00000000 1.00000000 1.00000000
- 2 31.00000000 2.00000000 2.00000000
- 3 2.00000000 3.00000000 3.00000000
- 4 2.00000000 4.00000000 4.00000000
- 5 2.00000000 5.00000000 5.00000000
- 6 2.00000000 6.00000000 6.00000000
- 7 2.00000000 7.00000000 7.00000000
-</PRE>
-
-<P>
-For the axis projection of an image, the output displays the low and
-high image bins (both inclusive) used to generate the projection. For
-example, in the following example, 21 counts had their X bin value of
-2, etc.:
-<PRE>
- [sh] funhist test.fits x 2:7
- # data file: /home/eric/data/test.fits
- # column: X
- # min,max,bins: 2 7 6
-
- bin value lo_bin hi_bin
- ------ --------------------- --------------------- ---------------------
- 1 21.00000000 2.00000000 2.00000000
- 2 20.00000000 3.00000000 3.00000000
- 3 19.00000000 4.00000000 4.00000000
- 4 18.00000000 5.00000000 5.00000000
- 5 17.00000000 6.00000000 6.00000000
- 6 16.00000000 7.00000000 7.00000000
-
- [sh] funhist test.fits x 2:7:2
- # data file: /home/eric/data/test.fits
- # column: X
- # min,max,bins: 2 7 2
-
- bin value lo_bin hi_bin
- ------ --------------------- --------------------- ---------------------
- 1 60.00000000 2.00000000 4.00000000
- 2 51.00000000 5.00000000 7.00000000
-</PRE>
-
-<P>
-You can use gnuplot or other plotting programs to graph the
-results, using a script such as:
-<PRE>
- #!/bin/sh
- sed -e '1,/---- .*/d
- /^$/,$d' | \
- awk '\
- BEGIN{print "set nokey; set title \"funhist\"; set xlabel \"bin\"; set ylabel \"counts\"; plot \"-\" with boxes"} \
- {print $3, $2, $4-$3}' | \
- gnuplot -persist - 1>/dev/null 2>&1
-</PRE>
-
-Similar plot commands are supplied in the script <B>funhist.plot</B>:
-<PRE>
- funhist test.ev pha ... | funhist.plot gnuplot
-</PRE>
-
-<!-- =defdoc funimage funimage 1 -->
-
-<!-- =section funimage NAME -->
-<H2><A NAME="funimage">funimage - create a FITS image from a Funtools data file</A></H2>
-
-<!-- =section funimage SYNOPSIS -->
-<B>
-<PRE>
-funimage [-a] &lt;iname&gt; &lt;oname&gt; [bitpix=n]
-funimage [-l] &lt;iname&gt; &lt;oname&gt; &lt;xcol:xdims&gt; &lt;ycol:ydims&gt; &lt;vcol&gt; [bitpix=n]
-funimage [-p x|y] &lt;iname&gt; &lt;oname&gt; [bitpix=n]
-</PRE>
-</B>
-
-<!-- =section funimage OPTIONS -->
-<P>
-<PRE>
- -a # append to existing output file as an image extension
- -l # input is a list file containing xcol, ycol, value
- -p [x|y] # project along x or y axis to create a 1D image
-</PRE>
-
-<!-- =section funimage DESCRIPTION -->
-<P>
-<B>funimage</B> creates a primary FITS image from the specified
-<A HREF="./files.html">FITS Extension</A>
-and/or
-<A HREF="./files.html#sections">Image Section</A>
-of a FITS file, or from an
-<A HREF="./files.html#sections">Image Section</A>
-of a non-FITS array, or from a raw event file.
-<P>
-The first argument to the program specifies the FITS input image,
-array, or raw event file to process. If "stdin" is specified, data are
-read from the standard input. Use <A HREF="./files.html">Funtools
-Bracket Notation</A> to specify FITS extensions, image sections, and
-filters. The second argument is the output FITS file. If "stdout" is
-specified, the FITS image is written to the standard output. By
-default, the output pixel values are of the same data type as those of the
-input file (or type "int" when binning a table), but this can be
-overridden using an optional third argument of the form:
-<PRE>
- bitpix=n
-</PRE>
-where n is 8,16,32,-32,-64, for unsigned char, short, int, float and double,
-respectively.
-
-<P>
-If the input data are of type image, the appropriate section is
-extracted and blocked (based on how the
-<A HREF="./files.html#sections">Image Section</A> is specified), and
-the result is written to the FITS primary image. When an integer
-image containing the BSCALE and BZERO keywords is converted to float,
-the pixel values are scaled and the scaling keywords are deleted from the
-output header. When converting integer scaled data to integer
-(possibly of a different size), the pixels are not scaled and the
-scaling keywords are retained.
-
-<P>
-If the input data is a binary table or raw event file, these are
-binned into an image, from which a section is extracted and blocked,
-and written to a primary FITS image. In this case, it is necessary to
-specify the two columns that will be used in the 2D binning. This can
-be done on the command line using the <B>bincols=(x,y)</B> keyword:
-<PRE>
- funcnts "foo.ev[EVENTS,bincols=(detx,dety)]"
-</PRE>
-The full form of the <B>bincols=</B> specifier is:
-<PRE>
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-</PRE>
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-<PRE>
- dim = (tlmax - tlmin)/binsiz (floating point data)
- dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-</PRE>
-Using this syntax, it is possible to bin any two columns of a binary
-table at any bin size. Note that the tlmin, tlmax, and binsiz
-specifiers can be omitted if TLMIN, TLMAX, and TDBIN header parameters
-(respectively) are present in the FITS binary table header for the
-column in question. Note also that if only one parameter is specified,
-it is assumed to be tlmax, and tlmin defaults to 1. If two parameters
-are specified, they are assumed to be tlmin and tlmax.
-See <A HREF="./files.html#binning">Binning FITS Binary Tables and Non-FITS
-Event Files</A> for more information about binning parameters.
-
-<p>
-By default, a new 2D FITS image file is created and the image is written
-to the primary HDU. If the <B>-a</B> (append) switch is specified,
-the image is appended to an existing FITS file as an IMAGE extension.
-(If the output file does not exist, the switch is effectively ignored
-and the image is written to the primary HDU.) This can be useful in a
-shell programming environment when processing multiple FITS images
-that you want to combine into a single final FITS file.
-
-<P>
-<B>funimage</B> also can take input from a table containing columns of
-x, y, and value (e.g., the output from <B>fundisp -l</B> which
-displays each image x and y and the number of counts at that
-position.) When the <B>-l</B> (list) switch is used, the input file is
-taken to be a FITS or ASCII table containing (at least) three columns
-that specify the x and y image coordinates and the value of that
-image pixel. In this case, <B>funimage</B> requires four extra
-arguments: xcolumn:xdims, ycolumn:ydims, vcolumn and bitpix=n. The x
-and y col:dim information takes the form:
-<PRE>
- name:dim # values range from 1 to dim
- name:min:max # values range from min to max
- name:min:max:binsiz # dimensions scaled by binsize
-</PRE>
-In particular, the min value should be used whenever the
-minimum coordinate value is something other than one. For example:
-<PRE>
- funimage -l foo.lst foo.fits xcol:0:512 ycol:0:512 value bitpix=-32
-</PRE>
-
-<P>
-The list feature also can be used to read unnamed columns from standard
-input: simply replace the column name with a null string. Note
-that the dimension information is still required:
-<PRE>
- funimage -l stdin foo.fits "":0:512 "":0:512 "" bitpix=-32
- 240 250 1
- 255 256 2
- ...
- ^D
-</PRE>
-
-<P>
-The list feature provides a simple way to generate a blank image.
-If you pass a <A HREF="./text.html">Column-based Text File</A>
-to funimage in which the text header contains the required image
-information, then funimage will correctly make a blank image. For
-example, consider the following text file (called foo.txt):
-<PRE>
- x:I:1:10 y:I:1:10
- ------ ------
- 0 0
-</PRE>
-This text file defines two columns, x and y, each of data type 32-bit int and
-image dimension 10. The command:
-<PRE>
- funimage foo.txt foo.fits bitpix=8
-</PRE>
-will create an empty FITS image called foo.fits containing a 10x10
-image of unsigned char:
-<PRE>
- fundisp foo.fits
- 1 2 3 4 5 6 7 8 9 10
- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
- 10: 0 0 0 0 0 0 0 0 0 0
- 9: 0 0 0 0 0 0 0 0 0 0
- 8: 0 0 0 0 0 0 0 0 0 0
- 7: 0 0 0 0 0 0 0 0 0 0
- 6: 0 0 0 0 0 0 0 0 0 0
- 5: 0 0 0 0 0 0 0 0 0 0
- 4: 0 0 0 0 0 0 0 0 0 0
- 3: 0 0 0 0 0 0 0 0 0 0
- 2: 0 0 0 0 0 0 0 0 0 0
- 1: 1 0 0 0 0 0 0 0 0 0
-
-</PRE>
-
-Note that the text file must contain at least
-one row of data. However, in the present example, event position 0,0 is
-outside the limits of the image and will be ignored. (You can, of course,
-use real x,y values to seed the image with data.)
-
-<P>
-Furthermore, you can use the TEXT filter specification to obviate the need for
-an input text file altogether. The following command will create the same
-10x10 char image without an actual input file:
-<PRE>
- funimage stdin'[TEXT(x:I:10,y:I:10)]' foo.fits bitpix=8 < /dev/null
-or
- funimage /dev/null'[TEXT(x:I:10,y:I:10)]' foo.fits bitpix=8
-</PRE>
-
-<P>
-You also can use either of these methods to generate a region mask simply
-by appending a region inside the filter brackets and specfying <B>mask=all</B>
-along with the bitpix. For example, the following command will generate a
-10x10 char mask using 3 regions:
-<PRE>
- funimage stdin'[TEXT(x:I:10,y:I:10),cir(5,5,4),point(10,1),-cir(5,5,2)]' \
- foo.fits bitpix=8,mask=all < /dev/null
-</PRE>
-The resulting mask looks like this:
-<PRE>
- fundisp foo.fits
- 1 2 3 4 5 6 7 8 9 10
- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
- 10: 0 0 0 0 0 0 0 0 0 0
- 9: 0 0 0 0 0 0 0 0 0 0
- 8: 0 0 1 1 1 1 1 0 0 0
- 7: 0 1 1 1 1 1 1 1 0 0
- 6: 0 1 1 0 0 0 1 1 0 0
- 5: 0 1 1 0 0 0 1 1 0 0
- 4: 0 1 1 0 0 0 1 1 0 0
- 3: 0 1 1 1 1 1 1 1 0 0
- 2: 0 0 1 1 1 1 1 0 0 0
- 1: 0 0 0 0 0 0 0 0 0 2
-</PRE>
-
-<P>
-You can use <B>funimage</B> to create 1D image projections along the x
-or y axis using the <b>-p [x|y]</b> switch. This capability works for
-both images and tables. For example consider a FITS table named ev.fits
-containing the following rows:
-<PRE>
- X Y
- -------- --------
- 1 1
- 1 2
- 1 3
- 1 4
- 1 5
- 2 2
- 2 3
- 2 4
- 2 5
- 3 3
- 3 4
- 3 5
- 4 4
- 4 5
- 5 5
-
-</PRE>
-A corresponding 5x5 image, called dim2.fits, would therefore contain:
-<PRE>
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 5: 1 1 1 1 1
- 4: 1 1 1 1 0
- 3: 1 1 1 0 0
- 2: 1 1 0 0 0
- 1: 1 0 0 0 0
-</PRE>
-A projection along the y axis can be performed on either the table or
-the image:
-<PRE>
- funimage -p y ev.fits stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-
- funimage -p y dim2.fits stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-</PRE>
-
-<P>
-Furthermore, you can create a 1D image projection along any column of
-a table by using the <b>bincols=[column]</b> filter specification and
-specifying a single column. For example, the following command
-projects the same 1D image along the y axis of a table as use of
-the <b>-p y</b> switch:
-<PRE>
- funimage ev.fits'[bincols=y]' stdout | fundisp stdin
- 1 2 3 4 5
- ---------- ---------- ---------- ---------- ----------
- 1: 1 2 3 4 5
-</PRE>
-
-<P>
-Examples:
-<P>
-Create a FITS image from a FITS binary table:
-<PRE>
- [sh] funimage test.ev test.fits
-</PRE>
-
-<P>
-Display the FITS image generated from a blocked section of FITS binary table:
-<PRE>
- [sh] funimage "test.ev[2:8,3:7,2]" stdout | fundisp stdin
- 1 2 3
- --------- --------- ---------
- 1: 20 28 36
- 2: 28 36 44
-</PRE>
-
-<!-- =defdoc funindex funindex 1 -->
-
-<!-- =section funindex NAME -->
-<H2><A NAME="funindex">funindex - create an index for a column of a FITS binary table</A></H2>
-
-<!-- =section funindex SYNOPSIS -->
-<B>
-<PRE>
-funindex &lt;switches&gt; &lt;iname&gt; &lt;key&gt; [oname]
-</PRE>
-</B>
-
-<!-- =section funindex OPTIONS -->
-<P>
-<PRE>
- NB: these options are not compatible with Funtools processing. Please
- use the defaults instead.
- -c # compress output using gzip"
- -a # ASCII output, ignore -c (default: FITS table)"
- -f # FITS table output (default: FITS table)"
- -l # long output, i.e. with key value(s) (default: long)"
- -s # short output, i.e. no key value(s) (default: long)"
-</PRE>
-
-<!-- =section funindex DESCRIPTION -->
-<P>
-The funindex script creates an index for the specified column (key) by
-running funtable -s (sort) and then saving the column value and the
-record number for each sorted row. This index will be used automatically
- by funtools filtering of that column, provided the index file's modification
-date is later than that of the data file.
-
-<p>
-The first required argument is the name of the FITS binary table
-to index. Please note that text files cannot be indexed at this time.
-The second required argument is the column (key) name to index. While
-multiple keys can be specified in principle, the funtools index processing
-assume a single key and will not recognize files containing multiple keys.
-
-<P>
-By default, the output index file name is [root]_[key].idx, where [root]
-is the root of the input file. Funtools looks for this specific file name
-when deciding whether to use an index for faster filtering. Therefore, the
-optional third argument (output file name) should not be used for funtools
-processing.
-
-<P>
-For example, to create an index on column Y for a given FITS file, use:
-<PRE>
- funindex foo.fits Y
-</PRE>
-This will generate an index named foo_y.idx, which will be used by funtools
-for filters involving the Y column.
-
-<!-- =defdoc funjoin funjoin 1 -->
-
-<!-- =section funjoin NAME -->
-<H2><A NAME="funjoin">funjoin - join two or more FITS binary tables on specified columns</A></H2>
-
-<!-- =section funjoin SYNOPSIS -->
-<B>
-<PRE>
-funjoin [switches] &lt;ifile1&gt; &lt;ifile2&gt; ... &lt;ifilen&gt; &lt;ofile&gt;
-</PRE>
-</B>
-
-<!-- =section funjoin OPTIONS -->
-<P>
-<PRE>
- -a cols # columns to activate in all files
- -a1 cols ... an cols # columns to activate in each file
- -b 'c1:bvl,c2:bv2' # blank values for common columns in all files
- -bn 'c1:bv1,c2:bv2' # blank values for columns in specific files
- -j col # column to join in all files
- -j1 col ... jn col # column to join in each file
- -m min # min matches to output a row
- -M max # max matches to output a row
- -s # add 'jfiles' status column
- -S col # add col as status column
- -t tol # tolerance for joining numeric cols [2 files only]
-</PRE>
-
-<!-- =section funjoin DESCRIPTION -->
-<B>funjoin</B> joins rows from two or more (up to 32)
-<A HREF="./files.html">FITS Binary Table files</A>, based on the values
-of specified join columns in each file. NB: the join columns must have
-an index file associated with it. These files are generated using the
-<B>funindex</B> program.
-
-<P>
-The first argument to the program specifies the first input FITS table
-or raw event file. If "stdin" is specified, data are read from the
-standard input. Subsequent arguments specify additional event files
-and tables to join. The last argument is the output FITS file.
-
-<P>
-NB: Do <B>not</B> use <A HREF="./files.html">Funtools Bracket
-Notation</A> to specify FITS extensions and row filters when running
-funjoin or you will get wrong results. Rows are accessed and joined
-using the index files directly, and this bypasses all filtering.
-
-<P>
-The join columns are specified using the <B>-j col</B> switch (which
-specifies a column name to use for all files) or with <B>-j1 col1</B>,
-<B>-j2 col2</B>, ... <B>-jn coln</B> switches (which specify a column
-name to use for each file). A join column must be specified for each file.
-If both <B>-j col</B> and <B>-jn coln</B> are specified for a given
-file, then the latter is used. Join columns must either be of type
-string or type numeric; it is illegal to mix numeric and string
-columns in a given join. For example, to join three files using the
-same key column for each file, use:
-<PRE>
- funjoin -j key in1.fits in2.fits in3.fits out.fits
-</PRE>
-A different key can be specified for the third file in this way:
-<PRE>
- funjoin -j key -j3 otherkey in1.fits in2.fits in3.fits out.fits
-</PRE>
-
-<P>
-The <B>-a "cols"</B> switch (and <B>-a1 "col1"</B>,
-<B>-a2 "cols2"</B> counterparts) can be used to specify columns to
-activate (i.e. write to the output file) for each input file. By
-default, all columns are output.
-
-<P>
-If two or more columns from separate files have the same name, the
-second (and subsequent) columns are renamed to have an underscore
-and a numeric value appended.
-
-<P>
-The <B>-m min</B> and <B>-M max</B> switches specify the minimum
-and maximum number of joins required to write out a row. The default
-minimum is 0 joins (i.e. all rows are written out) and the default maximum
-is 63 (the maximum number of possible joins with a limit of 32 input files).
-For example, to write out only those rows in which exactly two files
-have columns that match (i.e. one join):
-<PRE>
- funjoin -j key -m 1 -M 1 in1.fits in2.fits in3.fits ... out.fits
-</PRE>
-
-<P>
-A given row can have the requisite number of joins without all of the
-files being joined (e.g. three files are being joined but only two
-have a given join key value). In this case, all of the columns of the
-non-joined file are written out, by default, using blanks (zeros or NULLs).
-The <B>-b c1:bv1,c2:bv2</B> and
-<B>-b1 'c1:bv1,c2:bv2' -b2 'c1:bv1,c2:bv2' ...</B>
-switches can be used to set the blank value for columns common to all
-files and/or columns in a specified file, respectively. Each blank value
-string contains a comma-separated list of column:blank_val specifiers.
-For floating point values (single or double), a case-insensitive string
-value of "nan" means that the IEEE NaN (not-a-number) should be
-used. Thus, for example:
-<PRE>
- funjoin -b "AKEY:???" -b1 "A:-1" -b3 "G:NaN,E:-1,F:-100" ...
-</PRE>
-means that a non-joined AKEY column in any file will contain the
-string "???", the non-joined A column of file 1 will contain a value
-of -1, the non-joined G column of file 3 will contain IEEE NaNs, while
-the non-joined E and F columns of the same file will contain values -1
-and -100, respectively. Of course, where common and specific blank values
-are specified for the same column, the specific blank value is used.
-
-<P>
-To distinguish which files are non-blank components of a given row,
-the <B>-s</B> (status) switch can be used to add a bitmask column named
-"JFILES" to the output file. In this column, a bit is set for each
-non-blank file composing the given row, with bit 0 corresponds to the
-first file, bit 1 to the second file, and so on. The file names
-themselves are stored in the FITS header as parameters named JFILE1,
-JFILE2, etc. The <B>-S col</B> switch allows you to change the name
-of the status column from the default "JFILES".
-
-<P>
-A join between rows is the Cartesian product of all rows in one file
-having a given join column value with all rows in a second file having
-the same value for its join column and so on. Thus, if file1 has 2
-rows with join column value 100, file2 has 3 rows with the same value,
-and file3 has 4 rows, then the join results in 2*3*4=24 rows being output.
-
-<P>
-The join algorithm directly processes the index file associated with
-the join column of each file. The smallest value of all the current
-columns is selected as a base, and this value is used to join
-equal-valued columns in the other files. In this way, the index files
-are traversed exactly once.
-
-<P>
-The <B>-t tol</B> switch specifies a tolerance value for numeric
-columns. At present, a tolerance value can join only two files at a
-time. (A completely different algorithm is required to join more than
-two files using a tolerance, somethng we might consider implementing
-in the future.)
-
-<P>
-The following example shows many of the features of funjoin. The input files
-t1.fits, t2.fits, and t3.fits contain the following columns:
-<PRE>
- [sh] fundisp t1.fits
- AKEY KEY A B
- ----------- ------ ------ ------
- aaa 0 0 1
- bbb 1 3 4
- ccc 2 6 7
- ddd 3 9 10
- eee 4 12 13
- fff 5 15 16
- ggg 6 18 19
- hhh 7 21 22
-
-fundisp t2.fits
- AKEY KEY C D
- ----------- ------ ------ ------
- iii 8 24 25
- ggg 6 18 19
- eee 4 12 13
- ccc 2 6 7
- aaa 0 0 1
-
-fundisp t3.fits
- AKEY KEY E F G
------------- ------ -------- -------- -----------
- ggg 6 18 19 100.10
- jjj 9 27 28 200.20
- aaa 0 0 1 300.30
- ddd 3 9 10 400.40
-</PRE>
-
-<P>
-Given these input files, the following funjoin command:
-<PRE>
-
- funjoin -s -a1 "-B" -a2 "-D" -a3 "-E" -b \
- "AKEY:???" -b1 "AKEY:XXX,A:255" -b3 "G:NaN,E:-1,F:-100" \
- -j key t1.fits t2.fits t3.fits foo.fits
-</PRE>
-will join the files on the KEY column, outputting all columns except B
-(in t1.fits), D (in t2.fits) and E (in t3.fits), and setting blank
-values for AKEY (globally, but overridden for t1.fits) and A (in file
-1) and G, E, and F (in file 3). A JFILES column will be output to
-flag which files were used in each row:
-<PRE>
-
- AKEY KEY A AKEY_2 KEY_2 C AKEY_3 KEY_3 F G JFILES
- ------------ ------ ------ ------------ ------ ------ ------------ ------ -------- ----------- --------
- aaa 0 0 aaa 0 0 aaa 0 1 300.30 7
- bbb 1 3 ??? 0 0 ??? 0 -100 nan 1
- ccc 2 6 ccc 2 6 ??? 0 -100 nan 3
- ddd 3 9 ??? 0 0 ddd 3 10 400.40 5
- eee 4 12 eee 4 12 ??? 0 -100 nan 3
- fff 5 15 ??? 0 0 ??? 0 -100 nan 1
- ggg 6 18 ggg 6 18 ggg 6 19 100.10 7
- hhh 7 21 ??? 0 0 ??? 0 -100 nan 1
- XXX 0 255 iii 8 24 ??? 0 -100 nan 2
- XXX 0 255 ??? 0 0 jjj 9 28 200.20 4
-
-</PRE>
-<!-- =defdoc funmerge funmerge 1 -->
-
-<!-- =section funmerge NAME -->
-<H2><A NAME="funmerge">funmerge - merge one or more Funtools table files</A></H2>
-
-<!-- =section funmerge SYNOPSIS -->
-<B>
-<PRE>
-funmerge [-w|-x] -f [colname] &lt;iname1&gt; &lt;iname2&gt; ... &lt;oname&gt;
-</PRE>
-</B>
-
-<!-- =section funmerge OPTIONS -->
-<P>
-<PRE>
- -f # output a column specifying file from which this event came
- -w # adjust position values using WCS info
- -x # adjust position values using WCS info and save old values
-</PRE>
-
-<!-- =section funmerge DESCRIPTION -->
-<P>
-<B>funmerge</B> merges FITS data from one or more
-<A HREF="./files.html">FITS Binary Table files</A>
-or raw event files.
-<P>
-The first argument to the program specifies the first input FITS table
-or raw event file. If "stdin" is specified, data are read from the
-standard input. Use <A HREF="./files.html">Funtools Bracket
-Notation</A> to specify FITS extensions and row filters. Subsequent
-arguments specify additional event files and tables to merge. (NB: Stdin
-cannot not be used for any of these additional input file arguments.)
-The last argument is the output FITS file. The columns in each input table
-must be identical.
-
-<P>
-If an input file begins with the '@' character, it is processed as an
-include file, i.e., as a text file containing event file names (as
-well as blank lines and/or comment lines starting with the '#' sign).
-If standard input is specified as an include file ('@stdin'), then
-file names are read from the standard input until EOF (^D). Event
-files and include files can be mixed on a command line.
-
-<P>
-Rows from each table are written sequentially to the output
-file. If the switch <B>-f [colname]</B> is specified on the command
-line, an additional column is added to each row containing the number
-of the file from which that row was taken (starting from one). In
-this case, the corresponding file names are stored in the header
-parameters having the prefix <B>FUNFIL</B>, i.e., FUNFIL01,
-FUNFIL02, etc.
-
-<P>
-Using the <B>-w</B> switch (or <B>-x</B> switch as described
-below), <B>funmerge</B> also can adjust the position column values
-using the WCS information in each file. (By position columns, we mean
-the columns that the table is binned on, i.e., those columns defined
-by the <B>bincols=</B> switch, or (X,Y) by default.) To perform WCS
-alignment, the WCS of the first file is taken as the base WCS. Each
-position in subsequent files is adjusted by first converting it to the
-sky coordinate in its own WCS coordinate system, then by converting
-this sky position to the sky position of the base WCS, and finally
-converting back to a pixel position in the base system. Note that in
-order to perform WCS alignment, the appropriate WCS and TLMIN/TLMAX
-keywords must already exist in each FITS file.
-<P>
-When performing WCS alignment, you can save the original positions in
-the output file by using the <B>-x</B> (for "xtra") switch instead
-of the <B>-w</B> switch (i.e., using this switch also implies using
-<B>-w</B>) The old positions are saved in columns having the same
-name as the original positional columns, with the added prefix "OLD_".
-<P>
-Examples:
-
-<P>
-Merge two tables, and preserve the originating file number for
-each row in the column called "FILE" (along with the corresponding
-file name in the header):
-<PRE>
- [sh] funmerge -f "FILE" test.ev test2.ev merge.ev
-</PRE>
-
-<P>
-Merge two tables with WCS alignment, saving the old position values in
-2 additional columns:
-<PRE>
- [sh] funmerge -x test.ev test2.ev merge.ev
-</PRE>
-
-<P>
-This program only works on raw event files and binary tables. We have
-not yet implemented image and array merging.
-
-<!-- =defdoc funsky funsky 1 -->
-
-<!-- =section funsky NAME -->
-<H2><A NAME="funsky">funsky - convert between image and sky coordinates</A></H2>
-
-<!-- =section funsky SYNOPSIS -->
-<B>
-<PRE>
- funsky iname[ext] # RA,Dec (deg) or image pix from stdin
- funsky iname[ext] [lname] # RA, Dec (deg) or image pix from list
- funsky iname[ext] [col1] [col2] # named cols:units from stdin
- funsky iname[ext] [lname] [col1] [col2] # named cols:units from list
-</PRE>
-</B>
-
-<!-- =section funsky OPTIONS -->
-<P>
-<PRE>
- -d # always use integer tlmin conversion (as ds9 does)
- -r # convert x,y to RA,Dec (default: convert RA,Dec to x,y)
- -o # include offset from the nominal target position (in arcsec)
- -v # display input values also (default: display output only)
- -T # output display in rdb format (w/header,tab delimiters)
-</PRE>
-
-<!-- =section funsky DESCRIPTION -->
-<P>
-Funsky converts input sky coordinates (RA, Dec) to image coordinates (or vice
-versa) using the WCS information contained in the specified FITS file. Several
-calling sequences are supported in order to make it easy to specify
-coordinate positions in different ways.
-
-<P>
-The first required argument is always the input FITS file (or
-extension) containing the WCS information in an extension header. Note
-that the data from this file is not used. By default, the program
-converts input RA and Dec values to X and Y using this WCS
-information. If the WCS is associated with a FITS image, then the X,Y
-values are image values. If the WCS is associated with a binary table,
-then the X, Y values are physical values. To convert X,Y to RA and
-Dec, use the <B>-r</B> (reverse) switch.
-
-<P>
-If no other command arguments are supplied, then the input positions
-are read from the standard input. Each line is assumed to contain a
-single coordinate position consisting of an RA in degrees (or X in
-pixels) followed by a Dec in degrees (or Y in pixels). The usual
-delimiters are supported (spaces, commas, tabs). For example:
-<PRE>
- # read from stdin, default column names and units
- [sh] funsky snr.ev
- 22.982695 58.606523 # input RA (hrs), Dec(deg)
- 510.00 510.00
- 22.982127 58.607634 # input
- 512.00 510.50
- 22.981700 58.614301 # input
- 513.50 513.50
- ^D # end of input
-</PRE>
-
-<p>
-If a second argument is supplied, this argument is assumed to be
-a file containing RA (X) and Dec (Y) positions. The file can either be
-an ASCII table or a FITS binary table. The order of columns is
-unimportant, if the table has a column header. In this case, the
-names of the columns must be one of "RA", "DEC", or "X", "Y" for sky
-to image and image to sky conversions, respectively. If the table has
-no header, then once again, RA (X) is assumed to first, followed
-by DEC (Y).
-For example:
-<PRE>
- # read from file, default column names and units
- [sh] cat hd.in
- RA DEC
- --------- ---------
- 22.982695 58.606523
- 22.982127 58.607634
- 22.981700 58.614301
-
- [sh] funsky snr.ev hd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-</PRE>
-
-<P>
-If three arguments are supplied, then the input positions again are
-read from the standard input. Each line is assumed to contain a single
-coordinate position consisting of an RA (or X in pixels) followed by a
-Dec (or Y in pixels), with the usual delimiters supported. However,
-the second and third arguments now specify the column names and/or
-sky units using a colon-delimited syntax:
-<PRE>
- [colname]:[h|d|r]
-</PRE>
-If the colname is omitted, the names default to "RA", "DEC", "X", "Y",
-"COL1", or "COL2" as above. If the units are omitted, the default is degrees
-for both RA and Dec. When the -r switch is used (convert from image
-to sky) the units are applied to the output instead of the input. The following
-examples will serve to illustrate the options:
-<PRE>
- # read from stdin, specifying column names (def. units: degrees)
- [sh] cat hd.in
- MYRA MYDEC
- --------- ---------
- 22.982695 58.606523
- 22.982127 58.607634
- 22.981700 58.614301
-
- [sh] funsky snr.ev MYRA MYDEC < hd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read from stdin, specifying column names and units
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev MYRA:d MYDEC:d < dd.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read stdin, convert image to sky, specifying output sky units
- [sh] cat im.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] cat im.in | funsky -r snr.ev :d :d
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-</PRE>
-
-<P>
-Finally, four command arguments specify both and input file and column names
-and/or units:
-<PRE>
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # read file, convert image to sky, specifying output sky units
- [sh] cat im.in
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] funsky -r snr.ev im.in :d :d
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-</PRE>
-
-<P>
-By default, the output of funsky consists only of the converted coordinate
-position(s), one per output line. This makes parsing in shell scripts easy.
-Use the <B>-v</B> (verbose) switch to specify that the input
-coordinates should be pre-pended to each line. For example:
-<PRE>
- [sh] cat dd.in
- MYRA MYDEC
- --------- ---------
- 344.740432 58.606523
- 344.731900 58.607634
- 344.725500 58.614301
-
- [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- [sh] funsky -v snr.ev dd.in MYRA:d MYDEC:d
- 344.740432 58.606523 510.00 510.00
- 344.731900 58.607634 512.00 510.50
- 344.725500 58.614301 513.50 513.50
-</PRE>
-
-<P>
-In addition, a full starbase table can be output using the <B>-T</B>
-(table) switch. This switch can be used with or without the -v
-switch. If the -T and -v are both specified, then a descriptive header
-parameters are output before the table (mainly to remind you of the
-sky units):
-<PRE>
- # output table in non-verbose mode
- [sh] funsky -T snr.ev dd.in MYRA:d MYDEC:d
- X Y
- ------------ ------------
- 510.00 510.00
- 512.00 510.50
- 513.50 513.50
-
- # output table in verbose mode
- [sh] funsky -T -v snr.ev dd.in MYRA:d MYDEC:d
- # IFILE = /Users/eric/data/snr.ev
- # ICOL1 = MYRA
- # ICOL2 = MYDEC
- # IUNITS1 = d
- # IUNITS2 = d
- # OCOL1 = X
- # OCOL2 = Y
-
- MYRA MYDEC X Y
- ------------ ------------ ------------ ------------
- 344.740432 58.606523 510.00 510.00
- 344.731900 58.607634 512.00 510.50
- 344.725500 58.614301 513.50 513.50
-</PRE>
-
-<P>
-Finally, the <B>-d</B> (ds9) switch mimicks ds9's use of integer TLMIN
-and TLMAX values for all coordinate transformations. FITS conventions
-seem to call for use of floating point TLMIN and TLMAX when the data are
-floats. This convention is followed by funsky but results in a
-small discrepancy with ds9's converted values for floating point
-data. We will remedy this conflict in the future, maybe.
-
-<!-- =defdoc funtable funtable 1 -->
-
-<!-- =section funtable NAME -->
-<H2><A NAME="funtable">funtable - copy selected rows from a Funtools file to a FITS binary table</A></H2>
-
-<!-- =section funtable SYNOPSIS -->
-<B>
-<PRE>
-funtable [-a] [-i|-z] [-m] [-s cols] &lt;iname&gt; &lt;oname&gt; [columns]
-</PRE>
-</B>
-
-<!-- =section funtable OPTIONS -->
-<P>
-<PRE>
- -a # append to existing output file as a table extension
- -i # for image data, only generate X and Y columns
- -m # for tables, write a separate file for each region
- -s "col1 ..." # columns on which to sort
- -z # for image data, output zero-valued pixels
-</PRE>
-
-<!-- =section funtable DESCRIPTION -->
-<P>
-<B>funtable</B> selects rows from the specified
-<A HREF="./files.html">FITS Extension</A>
-(binary table only) of a FITS file, or from a non-FITS raw event
-file, and writes those rows to a FITS binary table file. It also
-will create a FITS binary table from an image or a raw array file.
-
-<P>
-The first argument to the program specifies the FITS file, raw event
-file, or raw array file. If "stdin" is specified, data are read from
-the standard input. Use <A HREF="./files.html">Funtools Bracket
-Notation</A> to specify FITS extensions, and filters. The second
-argument is the output FITS file. If "stdout" is specified, the FITS
-binary table is written to the standard output. By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional third argument in the form:
-<PRE>
- "column1 column1 ... columnN"
-</PRE>
-
-<P>
-The <B>funtable</B> program generally is used to select rows from a
-FITS binary table using
-<A HREF="./filters.html">Table Filters</A>
-and/or
-<A HREF="./regions.html">Spatial Region Filters</A>.
-For example, you can copy only selected rows (and output only selected
-columns) by executing in a command such as:
-<PRE>
- [sh] funtable "test.ev[pha==1&&pi==10]" stdout "x y pi pha" | fundisp stdin
- X Y PHA PI
- ------- ------- ------- ---------
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
- 1 10 1 10
-</PRE>
-<P>
-The special column <B>$REGION</B> can be specified to write the
-region id of each row:
-<PRE>
- [sh $] funtable "test.ev[time-(int)time>=.99&&annulus(0 0 0 10 n=3)]" stdout 'x y time $REGION' | fundisp stdin
- X Y TIME REGION
- -------- -------- --------------------- ----------
- 5 -6 40.99000000 3
- 4 -5 59.99000000 2
- -1 0 154.99000000 1
- -2 1 168.99000000 1
- -3 2 183.99000000 2
- -4 3 199.99000000 2
- -5 4 216.99000000 2
- -6 5 234.99000000 3
- -7 6 253.99000000 3
-</PRE>
-<P>
-Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are written.
-<P>
-Columns can be excluded from display using a minus sign before the
-column:
-<PRE>
- [sh $] funtable "test.ev[time-(int)time>=.99]" stdout "-time" | fundisp stdin
- X Y PHA PI DX DY
- -------- -------- -------- ---------- ----------- -----------
- 5 -6 5 -6 5.50 -6.50
- 4 -5 4 -5 4.50 -5.50
- -1 0 -1 0 -1.50 0.50
- -2 1 -2 1 -2.50 1.50
- -3 2 -3 2 -3.50 2.50
- -4 3 -4 3 -4.50 3.50
- -5 4 -5 4 -5.50 4.50
- -6 5 -6 5 -6.50 5.50
- -7 6 -7 6 -7.50 6.50
-</PRE>
-All columns except the time column are written.
-<P>
-In general, the rules for activating and de-activating columns are:
-<UL>
-<LI> If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-<LI> If only include columns are specified, then only the specified columns
-are activated.
-<LI> If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.
-</UL>
-In addition to specifying columns names explicitly, the special
-symbols <EM>+</EM> and <EM>-</EM> can be used to activate and
-de-activate <EM>all</EM> columns. This is useful if you want to
-activate the $REGION column along with all other columns. According
-to the rules, the syntax "$REGION" only activates the region column
-and de-activates the rest. Use "+ $REGION" to activate all
-columns as well as the region column.
-
-<P>
-Ordinarily, only the selected table is copied to the output file. In
-a FITS binary table, it sometimes is desirable to copy all of the
-other FITS extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. For example, the first command below copies only the EVENT table,
-while the second command copies other extensions as well:
-<PRE>
- [sh] funtable "/proj/rd/data/snr.ev[EVENTS]" events.ev
- [sh] funtable "/proj/rd/data/snr.ev[EVENTS+]" eventsandmore.ev
-</PRE>
-
-<P>
-If the input file is an image or a raw array file, then
-<B>funtable</B> will generate a FITS binary table from the pixel
-values in the image. Note that it is not possible to specify the
-columns to output (using command-line argument 3). Instead, there are
-two ways to create such a binary table from an image. By default, a
-3-column table is generated, where the columns are "X", "Y", and
-"VALUE". For each pixel in the image, a single row (event) is
-generated with the "X" and "Y" columns assigned the dim1 and dim2
-values of the image pixel, respectively and the "VALUE" column
-assigned the value of the pixel. With sort of table, running
-<B>funhist</B> on the "VALUE" column will give the same results as
-running <B>funhist</B> on the original image.
-
-<P>
-If the <B>-i</B> ("individual" rows) switch is specified, then only
-the "X" and "Y" columns are generated. In this case, each positive
-pixel value in the image generates n rows (events), where n is equal
-to the integerized value of that pixel (plus 0.5, for floating point
-data). In effect, <B>-i</B> approximately recreates the rows of a
-table that would have been binned into the input image. (Of course,
-this is only approximately correct, since the resulting x,y positions
-are integerized.)
-
-<P>
-If the <B>-s [col1 col2 ... coln]</B> ("sort") switch is specified,
-the output rows of a binary table will be sorted using the
-specified columns as sort keys. The sort keys must be scalar columns
-and also must be part of the output file (i.e. you cannot sort on a
-column but not include it in the output). This facility uses the
-<B>_sort</B> program (included with funtools), which must be accessible
-via your path.
-
-<p>
-For binary tables, the <B>-m</B> ("multiple files") switch will
-generate a separate file for each region in the filter specification
-i.e. each file contains only the rows from that region. Rows
-which pass the filter but are not in any region also are put in a
-separate file.
-
-<P>
-The separate output file names generated by the <B>-m</B> switch are
-produced automatically from the root output file to contain the region id of
-the associated region. (Note that region ids start at 1, so that the
-file name associated with id 0 contains rows that pass the filter but
-are not in any given region.) Output file names are generated as follows:
-
-<UL>
-<LI> A $n specification can be used anywhere in the root file name (suitably
-quoted to protect it from the shell) and will be expanded to be the id
-number of the associated region. For example:
-<PRE>
- funtable -m input.fits'[cir(512,512,1);cir(520,520,1)...]' 'foo.goo_$n.fits'
-</PRE>
-will generate files named foo.goo_0.fits (for rows not in any region but
-still passing the filter), foo.goo_1.fits (rows in region id #1, the first
-region), foo.goo_2.fits (rows in region id #2), etc. Note that single quotes
-in the output root are required to protect the '$' from the shell.
-
-<LI> If $n is not specified, then the region id will be placed before
-the first dot (.) in the filename. Thus:
-<PRE>
- funtable -m input.fits'[cir(512,512,1);cir(520,520,1)...]' foo.evt.fits
-</PRE>
-will generate files named foo0.evt.fits (for rows not in any region but
-still passing the filter), foo1.evt.fits (rows in region id #1),
-foo2.evt.fits (rows in region id #2), etc.
-
-<LI> If no dot is specified in the root output file name, then
-the region id will be appended to the filename. Thus:
-<PRE>
- funtable -m input.fits'[cir(512,512,1);cir(520,520,1)...]' 'foo_evt'
-</PRE>
-will generate files named foo_evt0 (for rows not in any region but
-still passing the filter), foo_evt1 (rows in region id #1),
-foo_evt2 (rows in region id #2), etc.
-</UL>
-The multiple file mechanism provide a simple way to generate
-individual source data files with a single pass through the data.
-
-<p>
-By default, a new FITS file is created and the binary table is written
-to the first extension. If the <B>-a</B> (append) switch is specified,
-the table is appended to an existing FITS file as a BINTABLE extension.
-Note that the output FITS file must already exist.
-
-<P>
-If the <B>-z</B> ("zero" pixel values) switch is specified and
-<B>-i</B> is not specified, then pixels having a zero value will
-be output with their "VALUE" column set to zero. Obviously, this
-switch does not make sense when individual events are output.
-
-<!-- =defdoc funtbl funtbl 1 -->
-
-<!-- =section funtbl NAME -->
-<H2><A NAME="funtbl">funtbl - extract a table from Funtools ASCII output</A></H2>
-
-<!-- =section funtbl SYNOPSIS -->
-<B>
-<PRE>
-funtable [-c cols] [-h] [-n table] [-p prog] [-s sep] &lt;iname&gt;
-</PRE>
-</B>
-
-<!-- =section funtbl DESCRIPTION -->
-<P>
-[NB: This program has been deprecated in favor of the ASCII text processing
-support in funtools. You can now perform fundisp on funtools ASCII output
-files (specifying the table using bracket notation) to extract tables
-and columns.]
-
-The <B>funtbl</B> script extracts a specified table (without the
-header and comments) from a funtools ASCII output file and writes the
-result to the standard output. The first non-switch argument is the
-ASCII input file name (i.e. the saved output from funcnts, fundisp,
-funhist, etc.). If no filename is specified, stdin is read. The
--n switch specifies which table (starting from 1) to extract. The
-default is to extract the first table. The -c switch is a
-space-delimited list of column numbers to output, e.g. -c "1 3 5"
-will extract the first three odd-numbered columns. The default is to
-extract all columns. The -s switch specifies the separator string to
-put between columns. The default is a single space. The -h switch
-specifies that column names should be added in a header line before
-the data is output. Without the switch, no header is prepended. The
--p program switch allows you to specify an awk-like program to run
-instead of the default (which is host-specific and is determined at
-build time). The -T switch will output the data in rdb format (i.e.,
-with a 2-row header of column names and dashes, and with data columns
-separated by tabs). The -help switch will print out a message
-describing program usage.
-
-<P>
-For example, consider the output from the following funcnts command:
-<PRE>
- [sh] funcnts -sr snr.ev "ann 512 512 0 9 n=3"
- # source
- # data file: /proj/rd/data/snr.ev
- # arcsec/pixel: 8
- # background
- # constant value: 0.000000
- # column units
- # area: arcsec**2
- # surf_bri: cnts/arcsec**2
- # surf_err: cnts/arcsec**2
-
- # summed background-subtracted results
- upto net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
- 2 625.000 25.000 0.000 0.000 6976.00 0.090 0.004
- 3 1442.000 37.974 0.000 0.000 15936.00 0.090 0.002
-
-
- # background-subtracted results
- reg net_counts error background berror area surf_bri surf_err
- ---- ------------ --------- ------------ --------- --------- --------- ---------
- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
- 2 478.000 21.863 0.000 0.000 5376.00 0.089 0.004
- 3 817.000 28.583 0.000 0.000 8960.00 0.091 0.003
-
-
- # the following source and background components were used:
- source_region(s)
- ----------------
- ann 512 512 0 9 n=3
-
- reg counts pixels sumcnts sumpix
- ---- ------------ --------- ------------ ---------
- 1 147.000 25 147.000 25
- 2 478.000 84 625.000 109
- 3 817.000 140 1442.000 249
-</PRE>
-<P>
-There are four tables in this output. To extract the last one, you
-can execute:
-<PRE>
- [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -n 4
- 1 147.000 25 147.000 25
- 2 478.000 84 625.000 109
- 3 817.000 140 1442.000 249
-</PRE>
-Note that the output has been re-formatted so that only a single space
-separates each column, with no extraneous header or comment information.
-
-<P>
-To extract only columns 1,2, and 4 from the last example (but with a header
-prepended and tabs between columns), you can execute:
-<PRE>
- [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -c "1 2 4" -h -n 4 -s "\t"
- #reg counts sumcnts
- 1 147.000 147.000
- 2 478.000 625.000
- 3 817.000 1442.000
-</PRE>
-<P>
-Of course, if the output has previously been saved in a file named
-foo.out, the same result can be obtained by executing:
-<PRE>
- [sh] funtbl -c "1 2 4" -h -n 4 -s "\t" foo.out
- #reg counts sumcnts
- 1 147.000 147.000
- 2 478.000 625.000
- 3 817.000 1442.000
-</PRE>
-
-<!-- =section funcalc SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funcen SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funcnts SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funcone SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section fundisp SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funhead SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funhist SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funimage SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funindex SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funjoin SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funmerge SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funsky SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funtable SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =section funtbl SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: April 1, 2007</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/regalgebra.html b/funtools/doc/regalgebra.html
deleted file mode 100644
index c31dbf7..0000000
--- a/funtools/doc/regalgebra.html
+++ /dev/null
@@ -1,278 +0,0 @@
-<!-- =defdoc regalgebra regalgebra n -->
-<HTML>
-<HEAD>
-<TITLE>Region Algebra</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section regalgebra NAME -->
-<H2><A NAME="regalgebra">RegAlgebra: Boolean Algebra on Spatial Regions</A></H2>
-
-<!-- =section regalgebra SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document describes the boolean arithmetic defined for
-region expressions.
-
-<!-- =section regalgebra DESCRIPTION -->
-<H2>Description</H2>
-<P>
-When defining a region, several shapes can be combined using boolean
-operations. The boolean operators are (in order of precedence):
-<PRE>
- Symbol Operator Associativity
- ------ -------- -------------
- ! not right to left
- & and left to right
- ^ exclusive or left to right
- | inclusive or left to right
-
-</PRE>
-For example, to create a mask consisting of a large circle with a
-smaller box removed, one can use the <B>and</B> and <B>not</B>
-operators:
-<PRE>
- CIRCLE(11,11,15) & !BOX(11,11,3,6)
-</PRE>
-
-and the resulting mask is:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:1111111111111111111111..................
- 2:1111111111111111111111..................
- 3:11111111111111111111111.................
- 4:111111111111111111111111................
- 5:111111111111111111111111................
- 6:1111111111111111111111111...............
- 7:1111111111111111111111111...............
- 8:1111111111111111111111111...............
- 9:111111111...1111111111111...............
- 10:111111111...1111111111111...............
- 11:111111111...1111111111111...............
- 12:111111111...1111111111111...............
- 13:111111111...1111111111111...............
- 14:111111111...1111111111111...............
- 15:1111111111111111111111111...............
- 16:1111111111111111111111111...............
- 17:111111111111111111111111................
- 18:111111111111111111111111................
- 19:11111111111111111111111.................
- 20:1111111111111111111111..................
- 21:1111111111111111111111..................
- 22:111111111111111111111...................
- 23:..11111111111111111.....................
- 24:...111111111111111......................
- 25:.....11111111111........................
- 26:........................................
- 27:........................................
- 28:........................................
- 29:........................................
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................
-</PRE>
-A three-quarter circle can be defined as:
-<PRE>
- CIRCLE(20,20,10) & !PIE(20,20,270,360)
-</PRE>
-
-and looks as follows:
-<PRE>
-
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:........................................
- 2:........................................
- 3:........................................
- 4:........................................
- 5:........................................
- 6:........................................
- 7:........................................
- 8:........................................
- 9:........................................
- 10:........................................
- 11:...............111111111................
- 12:..............11111111111...............
- 13:............111111111111111.............
- 14:............111111111111111.............
- 15:...........11111111111111111............
- 16:..........1111111111111111111...........
- 17:..........1111111111111111111...........
- 18:..........1111111111111111111...........
- 19:..........1111111111111111111...........
- 20:..........1111111111111111111...........
- 21:..........1111111111....................
- 22:..........1111111111....................
- 23:..........1111111111....................
- 24:..........1111111111....................
- 25:...........111111111....................
- 26:............11111111....................
- 27:............11111111....................
- 28:..............111111....................
- 29:...............11111....................
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................
-</PRE>
-Two non-intersecting ellipses can be made into the same region:
-<PRE>
- ELL(20,20,10,20,90) | ELL(1,1,20,10,0)
-</PRE>
-
-and looks as follows:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 1:11111111111111111111....................
- 2:11111111111111111111....................
- 3:11111111111111111111....................
- 4:11111111111111111111....................
- 5:1111111111111111111.....................
- 6:111111111111111111......................
- 7:1111111111111111........................
- 8:111111111111111.........................
- 9:111111111111............................
- 10:111111111...............................
- 11:...........11111111111111111............
- 12:........111111111111111111111111........
- 13:.....11111111111111111111111111111......
- 14:....11111111111111111111111111111111....
- 15:..11111111111111111111111111111111111...
- 16:.1111111111111111111111111111111111111..
- 17:111111111111111111111111111111111111111.
- 18:111111111111111111111111111111111111111.
- 19:111111111111111111111111111111111111111.
- 20:111111111111111111111111111111111111111.
- 21:111111111111111111111111111111111111111.
- 22:111111111111111111111111111111111111111.
- 23:111111111111111111111111111111111111111.
- 24:.1111111111111111111111111111111111111..
- 25:..11111111111111111111111111111111111...
- 26:...11111111111111111111111111111111.....
- 27:.....11111111111111111111111111111......
- 28:.......111111111111111111111111.........
- 29:...........11111111111111111............
- 30:........................................
- 31:........................................
- 32:........................................
- 33:........................................
- 34:........................................
- 35:........................................
- 36:........................................
- 37:........................................
- 38:........................................
- 39:........................................
- 40:........................................
-</PRE>
-You can use several boolean operations in a single region expression,
-to create arbitrarily complex regions. With the important exception
-below, you can apply the operators in any order, using parentheses if
-necessary to override the natural precedences of the operators.
-
-<P>
-NB: Using a panda shape is always much more efficient than explicitly
-specifying "pie & annulus", due to the ability of panda to place a
-limit on the number of pixels checked in the pie shape. If you are
-going to specify the intersection of pie and annulus, use panda
-instead.
-
-<P>
-As described in "help regreometry", the <B>PIE</B> slice goes to the
-edge of the field. To limit its scope, <B>PIE</B> usually is is
-combined with other shapes, such as circles and annuli, using boolean
-operations. In this context, it is worth noting that that there is a
-difference between <B>-PIE</B> and <B>&!PIE</B>. The former is a
-global exclude of all pixels in the <B>PIE</B> slice, while the latter
-is a local excludes of pixels affecting only the region(s) with which
-the <B>PIE</B> is combined. For example, the following region uses
-<B>&!PIE</B> as a local exclude of a single circle. Two other circles
-are also defined and are unaffected by the local exclude:
-<PRE>
-
- CIRCLE(1,8,1)
- CIRCLE(8,8,7)&!PIE(8,8,60,120)&!PIE(8,8,240,300)
- CIRCLE(15,8,2)
-
- 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- - - - - - - - - - - - - - - -
- 15: . . . . . . . . . . . . . . .
- 14: . . . . 2 2 2 2 2 2 2 . . . .
- 13: . . . 2 2 2 2 2 2 2 2 2 . . .
- 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 10: . . . . 2 2 2 2 2 2 2 . . . .
- 9: . . . . . . 2 2 2 . . . . 3 3
- 8: 1 . . . . . . . . . . . . 3 3
- 7: . . . . . . 2 2 2 . . . . 3 3
- 6: . . . . 2 2 2 2 2 2 2 . . . .
- 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 3: . . . 2 2 2 2 2 2 2 2 2 . . .
- 2: . . . . 2 2 2 2 2 2 2 . . . .
- 1: . . . . . . . . . . . . . . .
-
-</PRE>
-Note that the two other regions are not affected by the <B>&!PIE</B>,
-which only affects the circle with which it is combined.
-
-<P>
-On the other hand, a <B>-PIE</B> is an global exclude that does
-affect other regions with which it overlaps:
-<PRE>
-
- CIRCLE(1,8,1)
- CIRCLE(8,8,7)
- -PIE(8,8,60,120)
- -PIE(8,8,240,300)
- CIRCLE(15,8,2)
-
- 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- - - - - - - - - - - - - - - -
- 15: . . . . . . . . . . . . . . .
- 14: . . . . 2 2 2 2 2 2 2 . . . .
- 13: . . . 2 2 2 2 2 2 2 2 2 . . .
- 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 10: . . . . 2 2 2 2 2 2 2 . . . .
- 9: . . . . . . 2 2 2 . . . . . .
- 8: . . . . . . . . . . . . . . .
- 7: . . . . . . 2 2 2 . . . . . .
- 6: . . . . 2 2 2 2 2 2 2 . . . .
- 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
- 3: . . . 2 2 2 2 2 2 2 2 2 . . .
- 2: . . . . 2 2 2 2 2 2 2 . . . .
- 1: . . . . . . . . . . . . . . .
-
-</PRE>
-The two smaller circles are entirely contained within the two exclude
-<B>PIE</B> slices and therefore are excluded from the region.
-
-<!-- =section regalgebra SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 17, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/regbounds.html b/funtools/doc/regbounds.html
deleted file mode 100644
index 4fef30f..0000000
--- a/funtools/doc/regbounds.html
+++ /dev/null
@@ -1,179 +0,0 @@
-<!-- =defdoc regbounds regbounds n -->
-<HTML>
-<HEAD>
-<TITLE>Spatial Region Boundaries</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section regbounds NAME -->
-<H2><A NAME="regbounds">RegBounds: Region Boundaries</A></H2>
-
-<!-- =section regbounds SYNOPSIS -->
-<H2>Summary</H2>
-Describes how spatial region boundaries are handled.
-
-<!-- =section regbounds DESCRIPTION -->
-<H2>Description</H2>
-<P>
-The golden rule for spatial region filtering was first enunciated by
-Leon VanSpeybroeck in 1986:
-
-<P>
-<B>Each photon will be counted once, and no photon will be counted
-more than once</B>.
-
-<P>
-This means that we must be careful about boundary
-conditions. For example, if a circle is contained in an annulus such
-that the inner radius of the annulus is the same as the radius of the
-circle, then photons on that boundary must always be assigned to one
-or the other region. That is, the number of photons in both regions
-must equal the sum of the number of photons in each region taken
-separately.
-
-With this in mind, the rules for determining whether a boundary image
-pixel or table row are assigned to a region are defined below.
-
-<H2>Image boundaries : radially-symmetric shapes (circle, annuli, ellipse)</H2>
-
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies non-radially-symmetric shapes. When a
-pixel center is exactly on the boundary, the pixel assignment rule is:
-
-<UL>
-<LI> the outer boundary of a symmetric shape does not include such pixels
-<LI> the inner boundary of a symmetric shape (annulus) includes such pixels
-</UL>
-
-In this way, an annulus with radius from 0 to 1, centered exactly on a
-pixel, includes the pixel on which it is centered, but none of its
-neighbors.
-
-These rules ensure that when defining concentric shapes, no pixels are
-omitted between concentric regions and no pixels are claimed by two
-regions. When applied to small symmetric shapes, the shape is less
-likely to be skewed, as would happen with non-radially-symmetric
-rules. These rules differ from the rules for box-like shapes, which
-are more likely to be positioned adjacent to one another.
-
-<H2>Image Boundaries: non-radially symmetric shapes (polygons, boxes)</H2>
-
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies radially-symmetric shapes. When a pixel
-center is exactly on the boundary of a non-radially symmetric region,
-the pixel is included in the right or upper region, but not the left
-or lower region. This ensures that geometrically adjoining regions
-touch but don't overlap.
-
-<H2>Row Boundaries are Analytic</H2>
-
-When filtering table rows, the boundary rules are the same as for
-images, except that the calculation is not done on the center of a
-pixel, (since table rows, especially X-ray events rows, often have
-discrete, floating point positions) but are calculated exactly. That
-is, an row is inside the boundary without regard to its integerized
-pixel value. For rows that are exactly on a region boundary, the
-above rules are applied to ensure that all rows are counted once and
-no row is counted more than once.
-
-<P>
-Because row boundaries are calculated differently from image boundaries,
-certain programs will give different results when filtering the same
-region file. In particular, fundisp/funtable (which utilize analytic
-row filtering) perform differently from funcnts (which performs image
-filtering, even on tables).
-
-<H2>Image Boundaries vs. Row Boundaries: Practical Considerations</H2>
-
-<P>
-You will sometimes notice a discrepancy between running funcnts on an
-binary table file and running fundisp on the same file with the same filter.
-For example, consider the following:
-<PRE>
- fundisp test1.fits"[box(4219,3887,6,6,0)]" | wc
- 8893 320148 3752846
-</PRE>
-Since fundisp has a 2-line header, there are actually 8891 photons
-that pass the filter. But then run funtable and select only the
-rows that pass this filter, placing them in a new file:
-<PRE>
- ./funtable test1.fits"[box(4219,3887,6,6,0)]" test2.fits
-</PRE>
-Now run funcnts using the original filter on the derived file:
-<PRE>
- ./funcnts test2.fits "physical; box(4219,3887,6,6,0)"
-
- [... lot of processed output ...]
-
- # the following source and background components were used:
- source region(s)
- ----------------
- physical; box(4219,3887,6,6,0)
-
- reg counts pixels
- ---- ------------ ---------
- 1 7847.000 36
-</PRE>
-There are 1044 rows (events) that pass the row filter in fundisp (or
-funtable) but fail to make it through funcnts. Why?
-
-<P>
-The reason can be traced to how analytic row filtering (fundisp, funtable)
-differs from integerized pixel filtering(funcnts, funimage). Consider the
-region:
-<PRE>
- box(4219,3887,6,6,0)
-</PRE>
-Analytically (i.e., using row filtering), positions will pass this
-filter successfully if:
-<PRE>
- 4216 <= x <= 4222
- 3884 <= y <= 3890
-</PRE>
-For example, photons with position values of x=4216.4 or y=3884.08 will pass.
-
-<P>
-Integerized image filtering is different in that the pixels that will
-pass this filter have centers at:
-<PRE>
- x = 4217, 4218, 4219, 4220, 4221, 4222
- y = 3885, 3886, 3887, 3888, 3889, 3890
-</PRE>
-Note that there are 6 pixels in each direction, as specified by the region.
-That means that positions will pass the filter successfully if:
-<PRE>
- 4217 <= (int)x <= 4222
- 3885 <= (int)y <= 3890
-</PRE>
-Photons with position values of x=4216.4 or y=3884.08 will NOT pass.
-
-<P>
-Note that the position values are integerized, in effect, binned into
-image values. This means that x=4222.4 will pass this filter, but not
-the analytic filter above. We do this to maintain the design goal that
-either all counts in a pixel are included in an integerized filter, or
-else none are included.
-
-<P>
-[It could be argued that the correct photon limits for floating point
-row data really should be:
-<PRE>
- 4216.5 <= x <= 4222.5
- 3884.5 <= y <= 3890.5
-</PRE>
-since each pixel extends for .5 on either side of the center. We chose
-to the maintain integerized algorithm for all image-style filtering so
-that funcnts would give the exact same results regardless of whether
-a table or a derived non-blocked binned image is used.]
-
-<!-- =section regbounds SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 16, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/regcoords.html b/funtools/doc/regcoords.html
deleted file mode 100644
index ff656c2..0000000
--- a/funtools/doc/regcoords.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!-- =defdoc regcoords regcoords n -->
-<HTML>
-<HEAD>
-<TITLE>Spatial Region Coordinates</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section regcoords NAME -->
-<H2><A NAME="regcoords">RegCoords: Spatial Region Coordinates</A></H2>
-
-<!-- =section regcoords SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document describes the specification of coordinate systems, and the
-interpretation of coordinate values, for spatial region filtering.
-
-<!-- =section regcoords DESCRIPTION -->
-<H2>Pixel coordinate systems</H2>
-<P>
-The default coordinate system for regions is PHYSICAL, which means
-that region position and size values are taken from the original
-data. (Note that this is a change from the original IRAF/PROS
-implementation, in which the IMAGE coordinate system was the default.)
-PHYSICAL coordinates always refer to pixel positions on the original
-image (using IRAF LTM and LTV keywords). With PHYSICAL coordinates,
-if a set of coordinates specifies the position of an object in an
-original FITS file, the same coordinates will specify the same object
-in any FITS derived from the original. Physical coordinates are
-invariant with blocking of FITS files or taking sections of images,
-even when a blocked section is written to a new file.
-
-<P>
-Thus, although a value in pixels refers, by default, to the PHYSICAL
-coordinate system, you may specify that position values refer to the
-image coordinate system using the <B>global</B> or <B>local</B>
-properties commands:
-
-<PRE>
- global coordsys image
- circle 512 512 100
-</PRE>
-
-The <B>global</B> command changes the coordinate system for all
-regions that follow, while the <B>local</B> command changes the
-coordinate system only for the region immediately following:
-<PRE>
- local coordsys image
- circle 512 512 100
- circle 1024 1024 200
-</PRE>
-This changes the coordinate system only for the region that follows.
-In the above example, the second region uses the global coordinate
-system (PHYSICAL by default).
-
-<P>
-<H2>World Coordinate Systems</H2>
-
-If World Coordinate System information is contained in the data file
-being filtered, it also is possible to define regions using a sky
-coordinate system. Supported systems include:
-
-<PRE>
- name description
- ---- -----------
- PHYSICAL pixel coords of original file using LTM/LTV
- IMAGE pixel coords of current file
- FK4, B1950 sky coordinate systems
- FK5, J2000 sky coordinate systems
- GALACTIC sky coordinate systems
- ECLIPTIC sky coordinate systems
- ICRS currently same as J2000
- LINEAR linear wcs as defined in file
-</PRE>
-
-In addition, two mosaic coordinate systems have been defined that
-utilize the (evolving) IRAF mosaic keywords:
-
-<PRE>
- name description
- ---- -----------
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV
-</PRE>
-Again, to use one of these coordinate systems, the <B>global</B> or
-<B>local</B> properties commands are used:
-
-<PRE>
- global coordsys galactic
-</PRE>
-
-<H2>WCS Positions and Sizes</H2>
-
-In addition to pixels, positional values in a WCS-enabled region can
-be specified using sexagesimal or degrees format:
-
-<PRE>
- position arguments description
- ------------------ -----------
- [num] context-dependent (see below)
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
- [num]:[num]:[num] hms for 'odd' position arguments
- [num]:[num]:[num] dms for 'even' position arguments
- [num]h[num]m[num]s explicit hms
- [num]d[num]m[num]s explicit dms
-</PRE>
-
-If ':' is used as sexagesimal separator, the value is considered to be
-specifying hours/minutes/seconds if it is the first argument of a
-positional pair, and degrees/minutes/seconds for the second argument
-of a pair (except for galactic coordinates, which always use degrees):
-
-<PRE>
- argument description
- ----------- -----------
- 10:20:30.0 10 hours, 20 minutes, 30 seconds for 1st positional argument
- 10 degrees, 20 minutes, 30 seconds for 2nd positional argument
- 10h20m30.0 10 hours, 20 minutes, 30 seconds
- 10d20m30.0 10 degrees, 20 minutes, 30 seconds
- 10.20d 10.2 degrees
-</PRE>
-
-Similarly, the units of size values are defined by the formating
-character(s) attached to a number:
-
-<PRE>
- size arguments description
- -------------- -----------
- [num] context-dependent (see below)
- [num]" arc seconds
- [num]' arc minutes
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
-</PRE>
-
-For example:
-<PRE>
- argument description
- ----------- -----------
- 10 ten pixels
- 10' ten minutes of arc
- 10" ten seconds of arc
- 10d ten degrees
- 10p ten pixels
- 0.5r half of a radian
-</PRE>
-
-<P>
-An example of using sky coordinate systems follows:
-
-<PRE>
- global coordsys B1950
- -box 175.54d 20.01156d 10' 10'
- local coordsys J2000
- pie 179.57d 22.4d 0 360 n=4 && annulus 179.57d 22.4d 3' 24' n=5
-</PRE>
-
-At the FK4 1950 coordinates 175.54d RA, 20.01156d DEC exclude a 10
-minute by 10 minute box. Then at the FK5 2000 coordinates 179.57d RA
-22.4d DEC draw a radial profile regions pattern with 4 quadrants and 5
-annuli ranging from 3 minutes to 24 minutes in diameter. In this
-example, the default coordinate system is overridden by the commands
-in the regions spec.
-
-<H2>NB: The Meaning of Pure Numbers Are Context Sensitive</H2>
-
-<P>
-When a "pure number" (i.e. one without a format directive such as 'd'
-for 'degrees') is specified as a position or size, its interpretation
-depends on the context defined by the 'coordsys' keyword. In general,
-the rule is:
-
-<P>
-<B>All pure numbers have implied units corresponding to the current
-coordinate system.</B>
-
-<P>
-If no coordinate system is explicitly specified, the default system is
-implicitly assumed to be PHYSICAL. In practice this means that for
-IMAGE and PHYSICAL systems, pure numbers are pixels. Otherwise,
-for all systems other than LINEAR, pure numbers are degrees. For
-LINEAR systems, pure numbers are in the units of the linear system.
-This rule covers both positions and sizes.
-
-<P>
-As a corollary, when a sky-formatted number is used with the IMAGE
-or PHYSICAL coordinate system (which includes the default case of no
-coordsys being specified), the formatted number is assumed to be in
-the units of the WCS contained in the current file. If no sky WCS is
-specified, an error results.
-
-<P>
-Examples:
-
-<PRE>
- circle(512,512,10)
- ellipse 202.44382d 47.181656d 0.01d 0.02d
-</PRE>
-
-<P>
-In the absence of a specified coordinate system, the circle uses the
-default PHYSICAL units of pixels, while the ellipse explicitly uses degrees,
-presumably to go with the WCS in the current file.
-
-<PRE>
- global coordsys=fk5
- global color=green font="system 10 normal"
- circle 202.44382 47.181656 0.01
- circle 202.44382 47.181656 10p
- ellipse(512p,512p,10p,15p,20)
-</PRE>
-
-
-<P>
-Here, the circles use the FK5 units of degrees (except for the
-explicit use of pixels in the second radius), while the ellipse
-explicitly specifies pixels. The ellipse angle is in degrees.
-
-<P>
-Note that Chandra data format appears to use "coordsys=physical"
-implicitly. Therefore, for most Chandra applications, valid regions
-can be generated safely by asking ds9 to save/display regions in
-pixels using the PHYSICAL coordsys.
-
-<!-- =section regcoords SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 17, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/regdiff.html b/funtools/doc/regdiff.html
deleted file mode 100644
index 29c9658..0000000
--- a/funtools/doc/regdiff.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!-- =defdoc regdiff regdiff n -->
-<HTML>
-<HEAD>
-<TITLE>Differences Between Funtools and IRAF Regions</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section regdiff NAME -->
-<H2><A NAME="regdiff">RegDiff:Differences Between Funtools and IRAF Regions</A></H2>
-
-<!-- =section regdiff SYNOPSIS -->
-<H2>Summary</H2>
-Describes the differences between Funtools/ds9 regions and the old IRAF/PROS
-regions.
-
-<!-- =section regdiff DESCRIPTION -->
-<H2>Description</H2>
-<P>
-We have tried to make Funtools regions compatible with their
-predecessor, IRAF/PROS regions. For simple regions and simple boolean
-algebra between regions, there should be no difference between the two
-implementations. The following is a list of differences and
-incompatibilities between the two:
-
-<UL>
-
-<P>
-<LI>If a pixel is covered by two different regions expressions,
-Funtools assigns the mask value of the <B>first</B> region that
-contains that pixel. That is, successive regions <B>do not</b>
-overwrite previous regions in the mask, as was the case with the
-original PROS regions. This means that one must define overlapping
-regions in the reverse order in which they were defined in PROS. If
-region N is fully contained within region M, then N should be defined
-<B>before</B> M, or else it will be "covered up" by the latter. This
-change is necessitated by the use of optimized filter compilation, i.e.,
-Funtools only tests individual regions until a proper match is made.
-
-<P>
-<LI> The <B>PANDA</B> region has replaced the old PROS syntax in which
-a <B>PIE</B> accelerator was combined with an <B>ANNULUS</B> accelerator
-using <B>AND</B>. That is,
-<PRE>
- ANNULUS(20,20,0,15,n=4) & PIE(20,20,0,360,n=3)
-</PRE>
-has been replaced by:
-<PRE>
- PANDA(20,20,0,360,3,0,15,4)
-</PRE>
-The PROS syntax was inconsistent with the meaning of the <B>AND</B> operator.
-
-<P>
-<LI> The meaning of pure numbers (i.e., without format specifiers) in
-regions has been clarified, as has the syntax for specifying coordinate
-systems. See the general discussion on
-<A HREF="./regions.html">Spatial Region Filtering</A>
-for more information.
-
-</UL>
-
-<!-- =section regdiff SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 16, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/reggeometry.html b/funtools/doc/reggeometry.html
deleted file mode 100644
index faca53f..0000000
--- a/funtools/doc/reggeometry.html
+++ /dev/null
@@ -1,1148 +0,0 @@
-<!-- =defdoc reggeometry reggeometry n -->
-<HTML>
-<HEAD>
-<TITLE>Region Geometry</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section reggeometry NAME -->
-<H2><A NAME="reggeometry">RegGeometry: Geometric Shapes in Spatial Region Filtering</A></H2>
-
-<!-- =section reggeometry SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document describes the geometry of regions available for spatial
-filtering in IRAF/PROS analysis.
-
-<!-- =section reggeometry DESCRIPTION -->
-<H2>Geometric shapes</H2>
-<P>
-Several geometric shapes are used to describe regions. The valid
-shapes are:
-
-<PRE>
- shape: arguments:
- ----- ----------------------------------------
- ANNULUS xcenter ycenter inner_radius outer_radius
- BOX xcenter ycenter xwidth yheight (angle)
- CIRCLE xcenter ycenter radius
- ELLIPSE xcenter ycenter xwidth yheight (angle)
- FIELD none
- LINE x1 y1 x2 y2
- PIE xcenter ycenter angle1 angle2
- POINT x1 y1
- POLYGON x1 y1 x2 y2 ... xn yn
-</PRE>
-
-
-All arguments are real values; integer values are automatically
-converted to real where necessary. All angles are in degrees and
-specify angles that run counter-clockwise from the positive y-axis.
-
-<P>
-Shapes can be specified using "command" syntax:
-<PRE>
- [shape] arg1 arg2 ...
-</PRE>
-or using "routine" syntax:
-<PRE>
- [shape](arg1, arg2, ...)
-</PRE>
-or by any combination of the these. (Of course, the parentheses must
-balance and there cannot be more commas than necessary.) The shape
-keywords are case-insensitive. Furthermore, any shape can be
-specified by a three-character unique abbreviation. For example, one
-can specify three circular regions as:
-
-<PRE>
- "foo.fits[CIRCLE 512 512 50;CIR(128 128, 10);cir(650,650,20)]"
-</PRE>
-
-(Quotes generally are required to protect the region descriptor
-from being processed by the Unix shell.)
-
-<HR>
-
-<P>
-The <B>annulus</B> shape specifies annuli, centered at xcenter,
-ycenter, with inner and outer radii (r1, r2). For example,
-<PRE>
- ANNULUS 25 25 5 10
-</PRE>
-specifies an annulus centered at 25.0 25.0 with an inner radius of 5.0 and
-an outer radius of 10. Assuming (as will be done for all examples in this
-document, unless otherwise noted) this shape is used in a mask of size 40x40,
-it will look like this:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:....................111111111...........
- 33:...................11111111111..........
- 32:.................111111111111111........
- 31:.................111111111111111........
- 30:................11111111111111111.......
- 29:...............1111111.....1111111......
- 28:...............111111.......111111......
- 27:...............11111.........11111......
- 26:...............11111.........11111......
- 25:...............11111.........11111......
- 24:...............11111.........11111......
- 23:...............11111.........11111......
- 22:...............111111.......111111......
- 21:...............1111111.....1111111......
- 20:................11111111111111111.......
- 19:.................111111111111111........
- 18:.................111111111111111........
- 17:...................11111111111..........
- 16:....................111111111...........
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-
-<HR>
-
-<P>
-The <B>box</B> shape specifies an orthogonally oriented box,
-centered at xcenter, ycenter, of size xwidth, yheight. It requires four
-arguments and accepts an optional fifth argument to specify a rotation angle.
-When the rotation angle is specified (in degrees), the box is rotated by
-an angle that runs counter-clockwise from the positive y-axis.
-
-<P>
-The <B>box</B> shape specifies a rotated box, centered at
-xcenter, ycenter, of size xwidth, yheight. The box is rotated by an angle
-specified in degrees that runs counter-clockwise from the positive y-axis.
-If the angle argument is omitted, it defaults to 0.
-
-<HR>
-
-<P>
-The <B>circle</B> shape specifies a circle, centered at xcenter,
-ycenter, of radius r. It requires three arguments.
-
-<HR>
-
-<P>
-The <B>ellipse</B> shape specifies an ellipse, centered at
-xcenter, ycenter, with y-axis width a and the y-axis length b defined such
-that:
-<PRE>
- x**2/a**2 + y**2/b**2 = 1
-</PRE>
-Note that a can be less than, equal to, or greater than b. The ellipse
-is rotated the specified number of degrees. The rotation is done according
-to astronomical convention, counter-clockwise from the positive y-axis.
-An ellipse defined by:
-<PRE>
- ELLIPSE 20 20 5 10 45
-</PRE>
-will look like this:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:............111111......................
- 26:............11111111....................
- 25:............111111111...................
- 24:............11111111111.................
- 23:............111111111111................
- 22:............111111111111................
- 21:.............111111111111...............
- 20:.............1111111111111..............
- 19:..............111111111111..............
- 18:...............111111111111.............
- 17:...............111111111111.............
- 16:................11111111111.............
- 15:..................111111111.............
- 14:...................11111111.............
- 13:.....................111111.............
- 12:........................................
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-
-
-<HR>
-
-<P>
-The <B>field</B> shape specifies the entire field as a
-region. It is not usually specified explicitly, but is used implicitly in the
-case where no regions are specified, that is, in cases where either a null
-string or some abbreviation of the string "none" is input.
-<B>Field</B> takes no arguments.
-
-<HR>
-
-<P>
-The <B>pie</B> shape specifies an angular wedge of the entire field,
-centered at xcenter, ycenter. The wedge runs between the two specified angles.
-The angles are given in degrees, running counter-clockwise from the positive
-x-axis. For example,
-<PRE>
- PIE 20 20 90 180
-</PRE>
-defines a region from 90 degrees to 180 degrees, i.e., quadrant 2 of the
-Cartesian plane. The display of such a region looks like this:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:11111111111111111111....................
- 39:11111111111111111111....................
- 38:11111111111111111111....................
- 37:11111111111111111111....................
- 36:11111111111111111111....................
- 35:11111111111111111111....................
- 34:11111111111111111111....................
- 33:11111111111111111111....................
- 32:11111111111111111111....................
- 31:11111111111111111111....................
- 30:11111111111111111111....................
- 29:11111111111111111111....................
- 28:11111111111111111111....................
- 27:11111111111111111111....................
- 26:11111111111111111111....................
- 25:11111111111111111111....................
- 24:11111111111111111111....................
- 23:11111111111111111111....................
- 22:11111111111111111111....................
- 21:11111111111111111111....................
- 20:........................................
- 19:........................................
- 18:........................................
- 17:........................................
- 16:........................................
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................
- 11:........................................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-The pie slice specified is always a counter-clockwise sweep between
-the angles, starting at the first angle and ending at the second. Thus:
-<PRE>
- PIE 10 15 30 60
-</PRE>
-describes a 30 degree sweep from 2 o'clock to 1 o'clock, while:
-<PRE>
- PIE 10 15 60 30
-</PRE>
-describes a 330 degree counter-clockwise sweep from 1 o'clock to 2 o'clock
-passing through 12 o'clock (0 degrees). Note in both of these examples that
-the center of the slice can be anywhere on the plane. The second mask looks
-like this:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:111111111111111111111111................
- 39:11111111111111111111111.................
- 38:11111111111111111111111.................
- 37:1111111111111111111111..................
- 36:1111111111111111111111..................
- 35:111111111111111111111...................
- 34:11111111111111111111....................
- 33:11111111111111111111....................
- 32:1111111111111111111....................1
- 31:1111111111111111111..................111
- 30:111111111111111111.................11111
- 29:111111111111111111................111111
- 28:11111111111111111...............11111111
- 27:1111111111111111..............1111111111
- 26:1111111111111111.............11111111111
- 25:111111111111111............1111111111111
- 24:111111111111111..........111111111111111
- 23:11111111111111.........11111111111111111
- 22:11111111111111........111111111111111111
- 21:1111111111111.......11111111111111111111
- 20:111111111111......1111111111111111111111
- 19:111111111111....111111111111111111111111
- 18:11111111111....1111111111111111111111111
- 17:11111111111..111111111111111111111111111
- 16:1111111111.11111111111111111111111111111
- 15:1111111111111111111111111111111111111111
- 14:1111111111111111111111111111111111111111
- 13:1111111111111111111111111111111111111111
- 12:1111111111111111111111111111111111111111
- 11:1111111111111111111111111111111111111111
- 10:1111111111111111111111111111111111111111
- 9:1111111111111111111111111111111111111111
- 8:1111111111111111111111111111111111111111
- 7:1111111111111111111111111111111111111111
- 6:1111111111111111111111111111111111111111
- 5:1111111111111111111111111111111111111111
- 4:1111111111111111111111111111111111111111
- 3:1111111111111111111111111111111111111111
- 2:1111111111111111111111111111111111111111
- 1:1111111111111111111111111111111111111111
-</PRE>
-The pie slice goes to the edge of the field. To limit its scope, pie
-usually is is combined with other shapes, such as circles and annuli,
-using boolean operations. (See below and in "help regalgebra").
-
-<P>
-Pie Performance Notes:
-<P>
-Pie region processing time is proportional to the size of the image,
-and not the size of the region. This is because the pie shape is the
-only infinite length shape, and we essentially must check all y rows
-for inclusion (unlike other regions, where the y limits can be
-calculated beforehand). Thus, pie can run very slowly on large images.
-In particular, it will run MUCH more slowly than the panda shape in
-image-based region operations (such as funcnts). We recommend use of
-panda over pie where ever possible.
-
-<P>
-If you must use pie, always try to put it last in a boolean &&
-expression. The reason for this is that the filter code is optimized
-to exit as soon as the result is know. Since pie is the slowest
-region, it is better to avoid executing it if another region can decide
-the result. Consider, for example, the difference in time required to
-process a Chandra ACIS file when a pie and circle are combined in
-two different orders:
-
-<PRE>
- time ./funcnts nacis.fits "circle 4096 4096 100 && pie 4096 4096 10 78"
-2.87u 0.38s 0:35.08 9.2%
-
- time ./funcnts nacis.fits "pie 4096 4096 10 78 && circle 4096 4096 100 "
-89.73u 0.36s 1:03.50 141.8%
-</PRE>
-
-<P>
-Black-magic performance note:
-
-<P>
-Panda region processing uses a <B>quick test</B> pie region instead of
-the normal pie region when combining its annulus and pie shapes. This
-<B>qtpie</B> shape differs from the normal pie in that it utilizes the
-y limits from the previous region with which it is combined. In a
-panda shape, which is a series of annuli combined with pies, the
-processing time is thus reduced to that of the annuli.
-
-<P>
-You can use the qtpie shape instead of pie in cases where you are
-combining pie with another shape using the && operator. This will
-cause the pie limits to be set using limits from the other shape, and
-will speed up the processing considerably. For example, the above
-execution of funcnts can be improved considerably using this technique:
-
-<PRE>
- time ./funcnts nacis.fits "circle 4096 4096 100 && qtpie 4096 4096 10 78"
-4.66u 0.33s 0:05.87 85.0%
-</PRE>
-
-<P>
-We emphasize that this is a quasi-documented feature and might change in
-the future. The qtpie shape is not recognized by ds9 or other programs.
-
-<HR>
-
-<P>
-The <B>line</B> shape allows single pixels in a line between (x1,y1) and
-(x2,y2) to be included or excluded. For example:
-<PRE>
- LINE (5,6, 24,25)
-<PRE>
-displays as:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:.......................1................
- 24:......................1.................
- 23:.....................1..................
- 22:....................1...................
- 21:...................1....................
- 20:..................1.....................
- 19:.................1......................
- 18:................1.......................
- 17:...............1........................
- 16:..............1.........................
- 15:.............1..........................
- 14:............1...........................
- 13:...........1............................
- 12:..........1.............................
- 11:.........1..............................
- 10:........1...............................
- 9:.......1................................
- 8:......1.................................
- 7:.....1..................................
- 6:....1...................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-
-<HR>
-
-<P>
-The <B>point</B> shape allows single pixels to be included or
-excluded. Although the (x,y) values are real numbers, they are truncated
-to integer and the corresponding pixel is included or excluded, as specified.
-
-<P>
-Several points can be put in one region declaration; unlike the
-original IRAF implementation, each now is given a different region mask value.
-This makes it easier, for example, for funcnts to determine the number of
-photons in the individual pixels. For example,
-<PRE>
- POINT (5,6, 10,11, 20,20, 35,30)
-</PRE>
-will give the different region mask values to all four points, as shown below:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:..................................4.....
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:........................................
- 24:........................................
- 23:........................................
- 22:........................................
- 21:........................................
- 20:...................3....................
- 19:........................................
- 18:........................................
- 17:........................................
- 16:........................................
- 15:........................................
- 14:........................................
- 13:........................................
- 12:........................................
- 11:.........2..............................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:....1...................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-
-<HR>
-
-<P>
-The <B>polygon</B> shape specifies a polygon with vertices
-(x1, y1) ... (xn, yn). The polygon is closed automatically: one should
-not specify the last vertex to be the same as the first. Any number of
-vertices are allowed. For example, the following polygon defines a
-right triangle as shown below:
-<PRE>
- POLYGON (10,10, 10,30, 30,30)
-</PRE>
-
-looks like this:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:..........11111111111111111111..........
- 29:..........1111111111111111111...........
- 28:..........111111111111111111............
- 27:..........11111111111111111.............
- 26:..........1111111111111111..............
- 25:..........111111111111111...............
- 24:..........11111111111111................
- 23:..........1111111111111.................
- 22:..........111111111111..................
- 21:..........11111111111...................
- 20:..........1111111111....................
- 19:..........111111111.....................
- 18:..........11111111......................
- 17:..........1111111.......................
- 16:..........111111........................
- 15:..........11111.........................
- 14:..........1111..........................
- 13:..........111...........................
- 12:..........11............................
- 11:..........1.............................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-Note that polygons can get twisted upon themselves if edge lines
-cross. Thus:
-<PRE>
- POL (10,10, 20,20, 20,10, 10,20)
-</PRE>
-will produce an area which is two triangles, like butterfly wings, as shown
-below:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:........................................
- 33:........................................
- 32:........................................
- 31:........................................
- 30:........................................
- 29:........................................
- 28:........................................
- 27:........................................
- 26:........................................
- 25:........................................
- 24:........................................
- 23:........................................
- 22:........................................
- 21:........................................
- 20:........................................
- 19:..........1........1....................
- 18:..........11......11....................
- 17:..........111....111....................
- 16:..........1111..1111....................
- 15:..........1111111111....................
- 14:..........1111..1111....................
- 13:..........111....111....................
- 12:..........11......11....................
- 11:..........1........1....................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-
-<HR>
-
-<P>
-The following are combinations of pie with different shapes
-(called "panda" for "Pie AND Annulus") allow for easy specification of
-radial sections:
-<PRE>
- shape: arguments:
- ----- ---------
- PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # box
- EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # ellipse
-</PRE>
-
-The <B>panda</B> (<B>P</B>ies <B>AND</B> <B>A</B>nnuli) shape can be
-used to create combinations of pie and annuli markers. It is analogous
-to a Cartesian product on those shapes, i.e., the result is several
-shapes generated by performing a boolean AND between pies and
-annuli. Thus, the panda and cpanda specify combinations of annulus and
-circle with pie, respectively and give identical results. The bpanda
-combines box and pie, while epanda combines ellipse and pie.
-
-<P>
-Consider the example shown below:
-<PRE>
- PANDA(20,20, 0,360,3, 0,15,4)
-</PRE>
-Here, 3 pie slices centered at 20, 20 are combined with 4 annuli, also
-centered at 20, 20. The result is a mask with 12 regions (displayed in
-base 16 to save characters):
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:..............44444444444...............
- 33:............444444444444444.............
- 32:...........88444444444444444............
- 31:.........888844443333344444444..........
- 30:........88888833333333333444444.........
- 29:........88888733333333333344444.........
- 28:.......8888877733333333333344444........
- 27:......888887777332222233333344444.......
- 26:......888877777622222222333334444.......
- 25:.....88887777766622222222333334444......
- 24:.....88887777666622222222233334444......
- 23:.....88887777666651111222233334444......
- 22:.....88877776666551111122223333444......
- 21:.....88877776666555111122223333444......
- 20:.....888777766665559999aaaabbbbccc......
- 19:.....888777766665559999aaaabbbbccc......
- 18:.....888777766665599999aaaabbbbccc......
- 17:.....88887777666659999aaaabbbbcccc......
- 16:.....888877776666aaaaaaaaabbbbcccc......
- 15:.....888877777666aaaaaaaabbbbbcccc......
- 14:......8888777776aaaaaaaabbbbbcccc.......
- 13:......888887777bbaaaaabbbbbbccccc.......
- 12:.......88888777bbbbbbbbbbbbccccc........
- 11:........888887bbbbbbbbbbbbccccc.........
- 10:........888888bbbbbbbbbbbcccccc.........
- 9:.........8888ccccbbbbbcccccccc..........
- 8:...........88ccccccccccccccc............
- 7:............ccccccccccccccc.............
- 6:..............ccccccccccc...............
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-
-<HR>
-
-<P>
-Several regions with different mask values can be combined in the
-same mask. This supports comparing data from the different regions.
-(For information on how to combine different shapes into a single
-region, see "help regalgebra".) For example, consider the following
-set of regions:
-<PRE>
- ANNULUS 25 25 5 10
- ELLIPSE 20 20 5 10 315
- BOX 15 15 5 10
-</PRE>
-The resulting mask will look as follows:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........................................
- 35:........................................
- 34:....................111111111...........
- 33:...................11111111111..........
- 32:.................111111111111111........
- 31:.................111111111111111........
- 30:................11111111111111111.......
- 29:...............1111111.....1111111......
- 28:...............111111.......111111......
- 27:...............11111.222222..11111......
- 26:...............111112222222..11111......
- 25:...............111112222222..11111......
- 24:...............111112222222..11111......
- 23:...............111112222222..11111......
- 22:...............111111222222.111111......
- 21:..............211111112222.1111111......
- 20:............322211111111111111111.......
- 19:............32222111111111111111........
- 18:............22222111111111111111........
- 17:............222222211111111111..........
- 16:............22222222111111111...........
- 15:............222222222...................
- 14:............22222222....................
- 13:............222222......................
- 12:............33333.......................
- 11:............33333.......................
- 10:........................................
- 9:........................................
- 8:........................................
- 7:........................................
- 6:........................................
- 5:........................................
- 4:........................................
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-Note that when a pixel is in 2 or more regions, it is arbitrarily
-assigned to a one of the regions in question (often based on how a
-give C compiler optimizes boolean expressions).
-
-<P>
-<H2>Region accelerators</H2>
-
-<P>
-Two types of \fBaccelerators</B>, to simplify region specification,
-are provided as natural extensions to the ways shapes are described.
-These are: extended lists of parameters, specifying multiple regions,
-valid for annulus, box, circle, ellipse, pie, and points; and
-<B>n=<int></B>, valid for annulus, box, circle, ellipse, and pie (not
-point). In both cases, one specification is used to define several
-different regions, that is, to define shapes with different mask
-values in the region mask.
-
-<P>
-The following regions accept <B>accelerator</B> syntax:
-<PRE>
- shape arguments
- ----- ------------------------------------------
- ANNULUS xcenter ycenter radius1 radius2 ... radiusn
- ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- PIE xcenter ycenter angle1 angle2 (angle3) (angle4) (angle5) ...
- PIE xcenter ycenter angle1 angle2 (n=[number])
- POINT x1 y1 x2 y2 ... xn yn
-</PRE>
-Note that the circle accelerators are simply aliases for the annulus
-accelerators.
-
-<P>
-For example, several annuli at the same center can be specified in one
-region expression by specifying more than two radii. If <B>N</B>
-radii are specified, then <B>N</B>-1 annuli result, with the outer
-radius of each preceding annulus being the inner radius of the
-succeeding annulus. Each annulus is considered a separate region, and
-is given a separate mask value. For example,
-<PRE>
- ANNULUS 20 20 0 2 5 10 15 20
-</PRE>
-specifies five different annuli centered at 20 20, and is equivalent to:
-<PRE>
- ANNULUS 20.0 20.0 0 2
- ANNULUS 20.0 20.0 2 5
- ANNULUS 20.0 20.0 5 10
- ANNULUS 20.0 20.0 10 15
- ANNULUS 20.0 20.0 15 20
-</PRE>
-The mask is shown below:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:.............5555555555555..............
- 38:...........55555555555555555............
- 37:.........555555555555555555555..........
- 36:........55555555555555555555555.........
- 35:......555555555555555555555555555.......
- 34:.....55555555544444444444555555555......
- 33:....5555555544444444444444455555555.....
- 32:....5555555444444444444444445555555.....
- 31:...555555444444444444444444444555555....
- 30:..55555544444444444444444444444555555...
- 29:..55555544444443333333334444444555555...
- 28:.5555554444444333333333334444444555555..
- 27:.5555544444433333333333333344444455555..
- 26:555555444444333333333333333444444555555.
- 25:555554444443333333333333333344444455555.
- 24:555554444433333332222233333334444455555.
- 23:555554444433333322222223333334444455555.
- 22:555554444433333222222222333334444455555.
- 21:555554444433333222111222333334444455555.
- 20:555554444433333222111222333334444455555.
- 19:555554444433333222111222333334444455555.
- 18:555554444433333222222222333334444455555.
- 17:555554444433333322222223333334444455555.
- 16:555554444433333332222233333334444455555.
- 15:555554444443333333333333333344444455555.
- 14:555555444444333333333333333444444555555.
- 13:.5555544444433333333333333344444455555..
- 12:.5555554444444333333333334444444555555..
- 11:..55555544444443333333334444444555555...
- 10:..55555544444444444444444444444555555...
- 9:...555555444444444444444444444555555....
- 8:....5555555444444444444444445555555.....
- 7:....5555555544444444444444455555555.....
- 6:.....55555555544444444444555555555......
- 5:......555555555555555555555555555.......
- 4:........55555555555555555555555.........
- 3:.........555555555555555555555..........
- 2:...........55555555555555555............
- 1:.............5555555555555..............
-</PRE>
-
-<P>
-For boxes and ellipses, if an odd number of arguments is specified,
-then the last argument is assumed to be an angle. Otherwise, the
-angle is assumed to be zero. For example:
-<PRE>
- ellipse 20 20 3 5 6 10 9 15 12 20 45
-</PRE>
-specifies an 3 ellipses at a 45 degree angle:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:........................................
- 38:........................................
- 37:........................................
- 36:........33333333........................
- 35:......333333333333......................
- 34:.....3333333333333333...................
- 33:....333333333333333333..................
- 32:....33333332222233333333................
- 31:...3333332222222222333333...............
- 30:...33333222222222222233333..............
- 29:...333332222222222222223333.............
- 28:...3333222222211112222223333............
- 27:...33332222211111111222223333...........
- 26:...333322222111111111122223333..........
- 25:...3333222211111111111122223333.........
- 24:....3332222111111..1111122223333........
- 23:....333322211111.....11112222333........
- 22:....33332222111.......11112223333.......
- 21:.....33322221111.......11122223333......
- 20:.....33332221111.......11112223333......
- 19:.....33332222111.......11112222333......
- 18:......33332221111.......11122223333.....
- 17:.......33322221111.....111112223333.....
- 16:.......3333222211111..1111112222333.....
- 15:........3333222211111111111122223333....
- 14:.........333322221111111111222223333....
- 13:..........33332222211111111222223333....
- 12:...........3333222222111122222223333....
- 11:............333322222222222222233333....
- 10:.............33333222222222222233333....
- 9:..............3333332222222222333333....
- 8:...............33333333222223333333.....
- 7:.................333333333333333333.....
- 6:..................3333333333333333......
- 5:.....................333333333333.......
- 4:.......................33333333.........
- 3:........................................
- 2:........................................
- 1:........................................
-</PRE>
-Note in the above example that the lower limit is not part of the
-region for boxes, circles, and ellipses. This makes circles and annuli
-equivalent, i.e.:
-<PRE>
- circle 20 20 5 10 15 20
- annulus 20 20 5 10 15 20
-</PRE>
-both give the following region mask:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........................................
- 39:.............3333333333333..............
- 38:...........33333333333333333............
- 37:.........333333333333333333333..........
- 36:........33333333333333333333333.........
- 35:......333333333333333333333333333.......
- 34:.....33333333322222222222333333333......
- 33:....3333333322222222222222233333333.....
- 32:....3333333222222222222222223333333.....
- 31:...333333222222222222222222222333333....
- 30:..33333322222222222222222222222333333...
- 29:..33333322222221111111112222222333333...
- 28:.3333332222222111111111112222222333333..
- 27:.3333322222211111111111111122222233333..
- 26:333333222222111111111111111222222333333.
- 25:333332222221111111111111111122222233333.
- 24:33333222221111111.....11111112222233333.
- 23:3333322222111111.......1111112222233333.
- 22:333332222211111.........111112222233333.
- 21:333332222211111.........111112222233333.
- 20:333332222211111.........111112222233333.
- 19:333332222211111.........111112222233333.
- 18:333332222211111.........111112222233333.
- 17:3333322222111111.......1111112222233333.
- 16:33333222221111111.....11111112222233333.
- 15:333332222221111111111111111122222233333.
- 14:333333222222111111111111111222222333333.
- 13:.3333322222211111111111111122222233333..
- 12:.3333332222222111111111112222222333333..
- 11:..33333322222221111111112222222333333...
- 10:..33333322222222222222222222222333333...
- 9:...333333222222222222222222222333333....
- 8:....3333333222222222222222223333333.....
- 7:....3333333322222222222222233333333.....
- 6:.....33333333322222222222333333333......
- 5:......333333333333333333333333333.......
- 4:........33333333333333333333333.........
- 3:.........333333333333333333333..........
- 2:...........33333333333333333............
- 1:.............3333333333333..............
-
-</PRE>
-
-<P>
-As a final example, specifying several angles in one pie slice
-expression is equivalent to specifying several separate slices with
-the same center. As with the annulus, if <B>N</B> angles are
-specified, then <B>N</B>-1 slices result, with the ending angle of
-each preceding slice being the starting angle of the succeeding slice.
-Each slice is considered a separate region, and is given a separate
-mask value. For example,
-<PRE>
- PIE 12 12 315 45 115 270
-</PRE>
-specifies three regions as shown below:
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:2222222222222222222222222222222222222222
- 39:2222222222222222222222222222222222222221
- 38:2222222222222222222222222222222222222211
- 37:2222222222222222222222222222222222222111
- 36:2222222222222222222222222222222222221111
- 35:3222222222222222222222222222222222211111
- 34:3222222222222222222222222222222222111111
- 33:3322222222222222222222222222222221111111
- 32:3322222222222222222222222222222211111111
- 31:3332222222222222222222222222222111111111
- 30:3332222222222222222222222222221111111111
- 29:3333222222222222222222222222211111111111
- 28:3333222222222222222222222222111111111111
- 27:3333322222222222222222222221111111111111
- 26:3333322222222222222222222211111111111111
- 25:3333322222222222222222222111111111111111
- 24:3333332222222222222222221111111111111111
- 23:3333332222222222222222211111111111111111
- 22:3333333222222222222222111111111111111111
- 21:3333333222222222222221111111111111111111
- 20:3333333322222222222211111111111111111111
- 19:3333333322222222222111111111111111111111
- 18:3333333332222222221111111111111111111111
- 17:3333333332222222211111111111111111111111
- 16:3333333333222222111111111111111111111111
- 15:3333333333222221111111111111111111111111
- 14:3333333333322211111111111111111111111111
- 13:3333333333322111111111111111111111111111
- 12:33333333333.1111111111111111111111111111
- 11:3333333333331111111111111111111111111111
- 10:333333333333.111111111111111111111111111
- 9:333333333333..11111111111111111111111111
- 8:333333333333...1111111111111111111111111
- 7:333333333333....111111111111111111111111
- 6:333333333333.....11111111111111111111111
- 5:333333333333......1111111111111111111111
- 4:333333333333.......111111111111111111111
- 3:333333333333........11111111111111111111
- 2:333333333333.........1111111111111111111
- 1:333333333333..........111111111111111111
-</PRE>
-
-<P>
-The annulus, box, circle, ellipse, and pie shapes also accept an
-<B>n=[int]</B> syntax for specifying multiple regions. The
-<B>n=[int]</b>syntax interprets the previous (shape-dependent)
-arguments as lower and upper limits for the region and creates n
-shapes with evenly spaced boundaries. For example, if <B>n=[int]</B>
-is specified in an annulus, the two immediately preceding radii
-(<B>rn</B> and <B>rm</B>) are divided into <B>int</B> annuli, such
-that the inner radius of the first is <B>rn</B> and the outer radius
-of the last is <B>rm</B>. For example,
-<PRE>
- ANNULUS 20 20 5 20 n=3
-</PRE>
-is equivalent to:
-<PRE>
- ANNULUS 20 20 5 10 15 20
-</PRE>
-If this syntax is used with an ellipse or box, then the two preceding
-pairs of values are taken to be lower and upper limits for a set of
-ellipses or boxes. A circle uses the two preceding arguments for upper
-and lower radii. For pie, the two preceding angles are divided into n
-wedges such that the starting angle of the first is the lower bound
-and the ending angle of the last is the upper bound. In all cases,
-the <B>n=[int]</B> syntax allows any single alphabetic character
-before the "=", i.e, i=3, z=3, etc. are all equivalent.
-
-<P>
-Also note that for boxes and ellipses, the optional angle argument is
-always specified after the <B>n=[int]</B> syntax. For example:
-<PRE>
- ellipse 20 20 4 6 16 24 n=3 45
-<PRE>
-specifies 3 elliptical regions at an angle of 45 degrees:
-
-<PRE>
- 1234567890123456789012345678901234567890
- ----------------------------------------
- 40:........33333333........................
- 39:.....33333333333333.....................
- 38:....33333333333333333...................
- 37:...33333333333333333333.................
- 36:..33333333333333333333333...............
- 35:.3333333333222223333333333..............
- 34:3333333322222222222233333333............
- 33:33333332222222222222223333333...........
- 32:333333222222222222222222333333..........
- 31:3333322222222222222222222333333.........
- 30:33333222222222111122222222333333........
- 29:333332222222111111112222222333333.......
- 28:3333222222211111111111222222333333......
- 27:3333222222111111111111112222233333......
- 26:33332222221111111111111112222233333.....
- 25:33332222211111111.111111112222233333....
- 24:333322222111111......111111222223333....
- 23:333322222111111.......111112222233333...
- 22:33333222221111.........11111222223333...
- 21:333332222211111.........11112222233333..
- 20:.33332222211111.........11111222223333..
- 19:.33333222221111.........111112222233333.
- 18:..33332222211111.........11112222233333.
- 17:..333332222211111.......111111222233333.
- 16:...333322222111111......111111222223333.
- 15:...333332222211111111.111111112222233333
- 14:....333332222211111111111111122222233333
- 13:.....33333222221111111111111122222233333
- 12:.....33333322222211111111111222222233333
- 11:......3333332222222111111112222222333333
- 10:.......333333222222221111222222222333333
- 9:........33333322222222222222222222333333
- 8:.........333333222222222222222222333333.
- 7:..........33333332222222222222223333333.
- 6:...........3333333322222222222233333333.
- 5:.............3333333333222223333333333..
- 4:..............33333333333333333333333...
- 3:................33333333333333333333....
- 2:..................33333333333333333.....
- 1:....................33333333333333......
-</PRE>
-
-<P>
-Both the variable argument syntax and the <B>n=[int]</B> syntax must
-occur alone in a region descriptor (aside from the optional angle for
-boxes and ellipses). They cannot be combined. Thus, it is not valid
-to precede or follow an <B>n=[int]</B> accelerator with more angles or
-radii, as in this example:
-<PRE>
- # INVALID -- one too many angles before a=5 ...
- # and no angles are allowed after a=5
- PIE 12 12 10 25 50 a=5 85 135
-</PRE>
-Instead, use three separate specifications, such as:
-<PRE>
- PIE 12 12 10 25
- PIE 12 12 25 50 a=5
- PIE 12 12 85 135
-</PRE>
-The original (IRAF) implementation of region filtering permitted this
-looser syntax, but we found it caused more confusion than it was worth
-and therefore removed it.
-
-<P>
-NB: Accelerators may be combined with other shapes in a boolean
-expression in any order. (This is a change starting with funtools
-v1.1.1. Prior to this release, the accelerator shape had to be
-specified last). The actual region mask id values returned depend on the
-order in which the shapes are specified, although the total number of
-pixels or rows that pass the filter will be consistent. For this
-reason, use of accelerators in boolean expressions is discouraged in
-programs such as funcnts, where region mask id values are used
-to count events or image pixels.
-
-<P>
-[All region masks displayed in this document were generated using the
-<B>fundisp</B> routine and the undocumented "mask=all" argument (with
-spaced removed using sed ):
-<PRE>
- fundisp "funtools/funtest/test40.fits[ANNULUS 25 25 5 10]" mask=all |\
- sed 's/ //g'
-</PRE>
-Note that you must supply an image of the appropriate size -- in this case,
-a FITS image of dimension 40x40 is used.]
-
-<!-- =section reggeometry SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: March 12, 2007</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/regions.html b/funtools/doc/regions.html
deleted file mode 100644
index 33a8cde..0000000
--- a/funtools/doc/regions.html
+++ /dev/null
@@ -1,563 +0,0 @@
-<!-- =defdoc funregions funregions n -->
-<HTML>
-<HEAD>
-<TITLE>Spatial Region Filtering</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funregions NAME -->
-<H2><A NAME="regions">Regions: Spatial Region Filtering</A></H2>
-
-<!-- =section funregions SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document contains a summary of the user interface for spatial
-region filtering images and tables.
-
-<!-- =section funregions DESCRIPTION -->
-<H2>Description</H2>
-<P>
-Spatial region filtering allows a program to select regions of an
-image or rows of a table (e.g., X-ray events) to process using
-simple geometric shapes and boolean combinations of shapes. When an
-image is filtered, only pixels found within these shapes are
-processed. When a table is filtered, only rows found within these
-shapes are processed.
-
-<P>
-Spatial region filtering for images and tables is accomplished by
-means of <B>region specifications</B>. A region specification
-consists of one or more <B>region expressions</B>, which are geometric
-shapes,combined according to the rules of boolean algebra. Region
-specifications also can contain comments and local/global processing
-directives.
-
-<P>
-Typically, region specifications are specified using bracket notation
-appended to the filename of the data being processed:
-<PRE>
- foo.fits[circle(512,512,100)]
-</PRE>
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-<PRE>
- foo.fits[@my.reg]
-</PRE>
-
-<P>
-When region filters are passed in bracket notation in this manner, the
-filtering is set up automatically when the file is opened and all
-processing occurs through the filter. Programs also can use the filter
-library API to open filters explicitly.
-
-<H2>Region Expressions</H2>
-
-More specifically, region specifications consist of one or more lines
-containing:
-<PRE>
- # comment until end of line
- global keyword=value keyword=value ... # set global value(s)
- # include the following file in the region descriptor
- @file
- # use the FITS image as a mask (cannot be used with other regions)
- @fitsimage
- # each region expression contains shapes separated by operators
- [region_expression1], [region_expression2], ...
- [region_expression], [region_expression], ...
-</PRE>
-
-<P>
-A single region expression consists of:
-<PRE>
- # parens and commas are optional, as is the + sign
- [+-]shape(num , num , ...) OP1 shape num num num OP2 shape ...
-
-e.g.:
-
- ([+-]shape(num , num , ...) && shape num num || shape(num, num)
- # a comment can come after a region -- reserved for local properties
- [+-]shape(num , num , ...) # local properties go here, e.g. color=red
-</PRE>
-
-<P>
-Thus, a region descriptor consists of one or more <B>region
-expressions</B> or <B>regions</B>, separated by comas, new-lines, or
-semi-colons. Each <B>region</B> consists of one or more <B>geometric
-shapes</B> combined using standard boolean operation. Several types
-of shapes are supported, including:
-
-<PRE>
- shape: arguments:
- ----- ----------------------------------------
- ANNULUS xcenter ycenter inner_radius outer_radius
- BOX xcenter ycenter xwidth yheight (angle)
- CIRCLE xcenter ycenter radius
- ELLIPSE xcenter ycenter xwidth yheight (angle)
- FIELD none
- LINE x1 y1 x2 y2
- PIE xcenter ycenter angle1 angle2
- POINT x1 y1
- POLYGON x1 y1 x2 y2 ... xn yn
-</PRE>
-
-<P>
-In addition, the following regions accept <B>accelerator</B> syntax:
-
-<PRE>
- shape arguments
- ----- ------------------------------------------
- ANNULUS xcenter ycenter radius1 radius2 ... radiusn
- ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
- BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
- CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
- ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
- ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
- PIE xcenter ycenter angle1 angle2 (angle3) (angle4) (angle5) ...
- PIE xcenter ycenter angle1 angle2 (n=[number])
- POINT x1 y1 x2 y2 ... xn yn
-</PRE>
-Note that the circle accelerators are simply aliases for the annulus
-accelerators. See <A HREF="./reggeometry.html">region geometry</A>
-for more information about accelerators.
-
-<P>
-Finally, the following are combinations of pie with different shapes
-(called "panda" for "Pie AND Annulus") allow for easy specification of
-radial sections:
-
-<PRE>
- shape: arguments:
- ----- ---------
- PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
- BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # box
- EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # ellipse
-</PRE>
-
-The panda and cpanda specify combinations of annulus and circle with pie,
-respectively and give identical results. The bpanda combines box and pie,
-while epanda combines ellipse and pie.
-See <A HREF="./reggeometry.html">region geometry</A>
-for more information about pandas.
-
-<P>
-The following "shapes" are ignored by funtools (generated by ds9):
-<PRE>
- shape: arguments:
- ----- ---------
- PROJECTION x1 y1 x2 y2 width # NB: ignored by funtools
- RULER x1 y1 x2 y2 # NB: ignored by funtools
- TEXT x y # NB: ignored by funtools
- GRID # NB: ignored by funtools
- TILE # NB: ignored by funtools
- COMPASS # NB: ignored by funtools
-</PRE>
-
-<P>
-All arguments to regions are real values; integer values are
-automatically converted to real where necessary. All angles are in
-degrees and run from the positive image x-axis to the positive image
-y-axis. If a rotation angle is part of the associated WCS header, that
-angle is added implicitly as well.
-
-<P>
-Note that 3-letter abbreviations are supported for all shapes, so that
-you can specify "circle" or "cir".
-
-<P>
-<H2>Columns Used in Region Filtering</H2>
-<P>
-By default, the x,y values in a region expression refer to the two
-"image binning" columns, i.e. the columns that would be used to
-bin the data into an image. For images, these are just the 2 dimensions
-of the image. For tables, these usually default to x and y but
-can be changed as required. For example, in Funtools, new binning
-columns are specified using a bincols=(col1,col2) statement within
-the bracket string on the command line.
-<P>
-Alternate columns for region filtering can be specified by the syntax:
-<PRE>
- (col1,col2)=region(...)
-</PRE>
-e.g.:
-<PRE>
- (X,Y)=annulus(x,y,ri,ro)
- (PHA,PI)=circle(x,y,r)
- (DX,DY)=ellipse(x,y,a,b[,angle])
-</PRE>
-
-<P>
-<H2>Region Algebra</H2>
-
-(See also <A HREF="./regalgebra.html">Region Algebra</A> for more complete
-information.)
-
-<P>
-Region shapes can be combined together using Boolean operators:
-<PRE>
- Symbol Operation Use
- -------- --------- -----------------------------------
- ! not Exclude this shape from this region
- & or && and Include only the overlap of these shapes
- | or || inclusive or Include all of both shapes
- ^ exclusive or Include both shapes except their overlap
-</PRE>
-Note that the !region syntax must be combined with another region in order
-that we be able to assign a region id properly. That is,
-<PRE>
- !circle(512,512,10)
-</PRE>
-is not a legal region because there is no valid region id to work with.
-To get the full field without a circle, combine the above with field(),
-as in:
-<PRE>
- field() && !circle(512,512,10)
-</PRE>
-
-<H2> Region Separators Also Are Operators</H2>
-
-<P>
-As mentioned previously, multiple region expressions can be specified
-in a region descriptor, separated by commas, new-lines, or
-semi-colons. When such a separator is used, the boolean OR operator
-is automatically generated in its place but, unlike explicit use of
-the OR operator, the region ID is incremented (starting from 1).
-
-<P>
-For example, the two shapes specified in this example are given the
-same region value:
-<PRE>
- foo.fits[circle(512,512,10)||circle(400,400,20)]
-</PRE>
-On the other hand, the two shapes defined in the following example are
-given different region values:
-<PRE>
- foo.fits[circle(512,512,10),circle(400,400,20)]
-</PRE>
-
-<P>
-Of course these two examples will both mask the same table rows or
-pixels. However, in programs that distinguish region id's (such as
-<A HREF="programs.html#funcnts">funcnts</A> ), they will act
-differently. The explicit OR operator will result in one region
-expression consisting of two shapes having the same region id and
-funcnts will report a single region. The comma operator will cause
-funcnts to report two region expressions, each with one shape, in
-its output.
-
-<P>
-In general, commas are used to separate region expressions entered
-in bracket notation on the command line:
-<PRE>
- # regions are added to the filename in bracket notation
- foo.fits[circle(512,512,100),circle(400,400,20)]
-</PRE>
-New-lines are used to separate region
-expressions in a file:
-<PRE>
- # regions usually are separated by new-lines in a file
- # use @filename to include this file on the command line
- circle(512,512,100)
- circle(400,400,20)
-</PRE>
-Semi-colons are provided for backward compatibility with the original
-IRAF/PROS implementation and can be used in either case.
-
-<P>
-If a pixel is covered by two different regions expressions, it is
-given the mask value of the <B>first</B> region that contains that
-pixel. That is, successive regions <B>do not</b> overwrite previous
-regions in the mask, as was the case with the original PROS regions.
-In this way, an individual pixel is covered by one and only one
-region. This means that one must sometimes be careful about the order
-in which regions are defined. If region N is fully contained within
-region M, then N should be defined <B>before</B> M, or else it will be
-"covered up" by the latter.
-
-<H2>Region Exclusion</H2>
-<P>
-Shapes also can be globally excluded from all the region specifiers in
-a region descriptor by using a minus sign before a region:
-
-<PRE>
- operator arguments:
- -------- -----------
- - Globally exclude the region expression following '-' sign
- from ALL regions specified in this file
-</PRE>
-The global exclude region can be used by itself; in such a case, field() is
-implied.
-
-<P>
-A global exclude differs from the local exclude (i.e. a shape prefixed
-by the logical not "!" symbol) in that global excludes are logically
-performed last, so that no region will contain pixels from a globally
-excluded shape. A local exclude is used in a boolean expression with
-an include shape, and only excludes pixels from that include shape.
-Global excludes cannot be used in boolean expressions.
-
-<H2>Include Files</H2>
-
-<P>
-The <B>@filename</B> directive specifies an include file
-containing region expressions. This file is processed as part of
-the overall region descriptor:
-<PRE>
- foo.fits[circle(512,512,10),@foo]
-</PRE>
-A filter include file simply includes text without changing the state
-of the filter. It therefore can be used in expression. That is, if the
-file foo1 contains "pi==1" and foo2 contains "pha==2" then
-the following expressions are equivalent:
-<pre>
- "[@foo1&&@foo2]" is equivalent to "[pi==1&&pha==2]"
- "[pha==1||@foo2]" is equivalent to "[pi==1||pha==2]"
- "[@foo1,@foo2]" is equivalent to "[pi==1,pha==2]"
-</pre>
-Be careful that you specify evaluation order properly using
-parenthesis, especially if the include file contains multiple
-filter statements. For example, consider a file containing two
-regions such as:
-<pre>
- circle 512 512 10
- circle 520 520 10
-</pre>
-If you want to include only events (or pixels) that are in these regions
-and have a pi value of 4, then the correct syntax is:
-<pre>
- pi==4&&(@foo)
-</pre>
-since this is equivalent to:
-<pre>
- pi==4 && (circle 512 512 10 || circle 520 520 10)
-</pre>
-If you leave out the parenthesis, you are filtering this statement:
-<pre>
- pi==4 && circle 512 512 10 || circle 520 520 10)
-</pre>
-which is equivalent to:
-<pre>
- (pi==4 && circle 512 512 10) || circle 520 520 10)
-</pre>
-The latter syntax only applies the pi test to the first region.
-
-<P>
-For image-style filtering, the <B>@filename</B> can specify an 8-bit
-or 16-bit FITS image. In this case, the pixel values in the mask image
-are used as the region mask. The valid pixels in the mask must have
-positive values. Zero values are excluded from the mask and negative
-values are not allowed. Moreover, the region id value is taken as
-the image pixel value and the total number of regions is taken to be
-the highest pixel value. The dimensions of the image mask must be less
-than or equal to the image dimensions of the data. The mask will be
-replicated as needed to match the size of the image. (Thus, best
-results are obtained when the data dimensions are an even multiple of
-the mask dimensions.)
-
-<P>
-An image mask can be used in any image filtering operation, regardless
-of whether the data is of type image or table. For example, the
-<A HREF="programs.html#funcnts">funcnts</A> )
-program performs image filtering on images or tables, and so
-FITS image masks are valid input for either type of data in this
-program.. An image mask cannot be used in a program such as
-<A HREF="programs.html#fundisp">fundisp</A> )
-when the input data is a table, because fundisp displays
-rows of a table and processes these rows using event-style filtering.
-
-<H2>Global and Local Properties of Regions</H2>
-
-<P>
-The ds9 image display program describes a host of properties such as
-color, font, fix/free state, etc. Such properties can be specified
-globally (for all regions) or locally (for an individual region).
-The <B>global</B> keyword specifies properties and qualifiers for all
-regions, while local properties are specified in comments on the same
-line as the region:
-<PRE>
- global color=red
- circle(10,10,2)
- circle(20,20,3) # color=blue
- circle(30,30,4)
-</PRE>
-The first and third circles will be red, which the second circle will
-be blue. Note that funtools currently ignores region properties, as
-they are used in display only.
-
-<H2> Coordinate Systems</H2>
-
-For each region, it is important to specify the coordinate system
-used to interpret the region, i.e., to set the context in which position and
-size values are interpreted. For this purpose, the following keywords
-are recognized:
-
-<PRE>
- name description
- ---- ------------------------------------------
- PHYSICAL pixel coords of original file using LTM/LTV
- IMAGE pixel coords of current file
- FK4, B1950 sky coordinate systems
- FK5, J2000 sky coordinate systems
- GALACTIC sky coordinate systems
- ECLIPTIC sky coordinate systems
- ICRS currently same as J2000
- LINEAR linear wcs as defined in file
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV
-</PRE>
-
-<P>
-<H2>Specifying Positions, Sizes, and Angles</H2>
-
-The arguments to region shapes can be floats or integers describing
-positions and sizes. They can be specified as pure numbers or using
-explicit formatting directives:
-
-<PRE>
- position arguments description
- ------------------ ------------------------------
- [num] context-dependent (see below)
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
- [num]:[num]:[num] hms for 'odd' position arguments
- [num]:[num]:[num] dms for 'even' position arguments
- [num]h[num]m[num]s explicit hms
- [num]d[num]m[num]s explicit dms
-
- size arguments description
- -------------- -----------
- [num] context-dependent (see below)
- [num]" arc seconds
- [num]' arc minutes
- [num]d degrees
- [num]r radians
- [num]p physical pixels
- [num]i image pixels
-</PRE>
-
-<!- this helps emacs close the open quote " >
-When a "pure number" (i.e. one without a format directive such as 'd'
-for 'degrees') is specified, its interpretation depends on the context
-defined by the 'coordsys' keyword. In general, the rule is:
-
-<P>
-<B>All pure numbers have implied units corresponding to the current
-coordinate system.</B>
-
-<P>
-If no such system is explicitly specified, the default system is
-implicitly assumed to be PHYSICAL.
-
-<P>
-In practice this means that for IMAGE and PHYSICAL systems, pure
-numbers are pixels. Otherwise, for all systems other than linear,
-pure numbers are degrees. For LINEAR systems, pure numbers are in the
-units of the linear system. This rule covers both positions and
-sizes.
-
-<P>
-The input values to each shape can be specified in several coordinate
-systems including:
-
-<PRE>
- name description
- ---- ----------------------------
- IMAGE pixel coords of current file
- LINEAR linear wcs as defined in file
- FK4, B1950 various sky coordinate systems
- FK5, J2000
- GALACTIC
- ECLIPTIC
- ICRS
- PHYSICAL pixel coords of original file using LTM/LTV
- AMPLIFIER mosaic coords of original file using ATM/ATV
- DETECTOR mosaic coords of original file using DTM/DTV
-</PRE>
-
-<P>
-If no coordinate system is specified, PHYSICAL is assumed. PHYSICAL or
-a World Coordinate System such as J2000 is preferred and most general.
-The coordinate system specifier should appear at the beginning of the
-region description, on a separate line (in a file), or followed by a
-new-line or semicolon; e.g.,
-
-<PRE>
- global coordsys physical
- circle 6500 9320 200
-</PRE>
-
-The use of celestial input units automatically implies WORLD
-coordinates of the reference image. Thus, if the world coordinate
-system of the reference image is J2000, then
-
-<PRE>
- circle 10:10:0 20:22:0 3'
-</PRE>
-
-is equivalent to:
-
-<PRE>
- circle 10:10:0 20:22:0 3' # j2000
-</PRE>
-
-</PRE>
-Note that by using units as described above, you may mix coordinate
-systems within a region specifier; e.g.,
-
-<PRE>
- circle 6500 9320 3' # physical
-</PRE>
-
-<P>
-Note that, for regions which accept a rotation angle:
-
-<PRE>
-ellipse (x, y, r1, r2, angle)
-box(x, y, w, h, angle)
-</PRE>
-
-the angle is relative to the specified coordinate system. In
-particular, if the region is specified in WCS coordinates, the angle
-is related to the WCS system, not x/y image coordinate axis. For WCS
-systems with no rotation, this obviously is not an issue. However,
-some images do define an implicit rotation (e.g., by using a non-zero
-CROTA value in the WCS parameters) and for these images, the angle
-will be relative to the WCS axes. In such case, a region specification
-such as:
-
-<PRE>
-fk4;ellipse(22:59:43.985, +58:45:26.92,320", 160", 30)
-</PRE>
-
-will not, in general, be the same region specified as:
-
-<PRE>
-physical;ellipse(465, 578, 40, 20, 30)
-</PRE>
-
-even when positions and sizes match. The angle is relative to WCS axes
-in the first case, and relative to physical x,y axes in the second.
-
-
-<P>
-More detailed descriptions are available for:
-<A HREF="./reggeometry.html">Region Geometry</A>,
-<A HREF="./regalgebra.html">Region Algebra</A>,
-<A HREF="./regcoords.html">Region Coordinates</A>, and
-<A HREF="./regbounds.html">Region Boundaries</A>.
-
-<!-- =section funregions SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: November 17, 2005</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/sman/fun4.index b/funtools/doc/sman/fun4.index
deleted file mode 100644
index ce00526..0000000
--- a/funtools/doc/sman/fun4.index
+++ /dev/null
Binary files differ
diff --git a/funtools/doc/sman/fun4.index.prop b/funtools/doc/sman/fun4.index.prop
deleted file mode 100644
index 9b01bbd..0000000
--- a/funtools/doc/sman/fun4.index.prop
+++ /dev/null
Binary files differ
diff --git a/funtools/doc/sman/fun4.index.version b/funtools/doc/sman/fun4.index.version
deleted file mode 100644
index accb620..0000000
--- a/funtools/doc/sman/fun4.index.version
+++ /dev/null
@@ -1,2 +0,0 @@
-SMAN_DATA_VERSION 1.2
-VERSION 1.01
diff --git a/funtools/doc/sman/fun8.index b/funtools/doc/sman/fun8.index
deleted file mode 100644
index 44fd94a..0000000
--- a/funtools/doc/sman/fun8.index
+++ /dev/null
Binary files differ
diff --git a/funtools/doc/sman/fun8.index.prop b/funtools/doc/sman/fun8.index.prop
deleted file mode 100644
index 5fd8f14..0000000
--- a/funtools/doc/sman/fun8.index.prop
+++ /dev/null
Binary files differ
diff --git a/funtools/doc/sman/fun8.index.version b/funtools/doc/sman/fun8.index.version
deleted file mode 100644
index accb620..0000000
--- a/funtools/doc/sman/fun8.index.version
+++ /dev/null
@@ -1,2 +0,0 @@
-SMAN_DATA_VERSION 1.2
-VERSION 1.01
diff --git a/funtools/doc/sman_conf.tmpl b/funtools/doc/sman_conf.tmpl
deleted file mode 100644
index abac8e4..0000000
--- a/funtools/doc/sman_conf.tmpl
+++ /dev/null
@@ -1,96 +0,0 @@
-# $Id: sman-defaults.conf,v 1.33 2006/05/02 02:09:18 joshr Exp $
-# by Josh Rabinowitz, 2005-2006. <joshr>
-# this is the default sman configuration file.
-# if you need to make changes, copy this file to
-# /usr/local/etc/sman.conf and make changes to that file.
-# NOTE: if you do use a custom sman.conf you may need to manually
-# NOTE: merge changes from this file to your configuration file
-# NOTE: after upgrading sman versions
-
-# See 'perldoc sman.conf' for more documentation
-
-# sman-defaults.conf
-# holds the defaults for sman.
-# the directive names are case-insensitive
-
-SWISHECMD @SW@ -v 0
-
-# MANCMD specifies how to manually convert the manpages to
-# ASCII. For 'manual' parsing.
-# %F is the quoted full [F]ilename of the manpage (ie, '/usr/share/man/man1/ls.1.gz)
-# %S is the quoted [S]ection of the manpage (ie, '1')
-# %C is the quoted (apparent) [C]ommand of the manpage (ie, 'ls')
-
-# NOTE: lack of a MANCMD (or a value of AUTOCONFIG) causes sman-update
-# to autoconfigure the value of MANCMD. It will most likely choose
-# one of the below:
-
-# this works for most linuxes we've tested. ie 'man /man/man1/ls.1'
-# MANCMD man -c %F
-# this works for freebsd 4.4 and Mac OS X. ie 'man 1 ls'
-#MANCMD man -c %S %C
-# -c means reparse man page sources (for line re-wrapping)
-
-# works for Solaris and OS X
-MANCMD man -s %S %C
-
-# the COL program is used to strip out backspaces and
-# such from the MAN output.
-
-COLCMD col -b
-
-# all vars starting with ENV_ get set in the
-# environment, sans the ENV_ prefix.
-
-# Try to make MAN wrap lines at 256 chars (not 80!)
-ENV_MANWIDTH 256
-
-# where to put sman's temp files.
-# (Use SWISHE_TMPDIR to set affect SWISH-E at index time)
-
-TMPDIR /tmp
-
-# meta and property aliases. If your XML has different tags.
-# refentrytitle, manvolnum and refpurpose are the names from rman
-# each ALIASES line turns into 2 lines for SWISH-E like this:
-#MetaNameAlias swishtitle refentrytitle
-#PropertyNameAlias swishtitle refentrytitle
-
-TITLEALIASES RefEntryTitle
-SECALIASES ManVolNum
-DESCALIASES RefPurpose
-#MANPAGEALIASES swishdefault
-
-# All parameters beginning with SWISHE_ have the SWISHE_ prefix stripped
-# and are written into a tmp config file for SWISH-E at index time.
-
-# SWISHE_IndexFile is also used by sman as which index to search.
-
-# SWISHE_IndexFile specifies which index to create and search
-# NOTE: if the containing dir (ie, /var/lib/sman) is owned by an unprivileged
-# user, then sman-update can be run as that user.
-
-SWISHE_IndexFile /var/lib/sman/sman.index
-
-# these have 'SWISHE_' stripped off and are used
-# when indexing the man pages.
-
-SWISHE_IndexComments no
- # don't index text in comments
-
-# These are important! You probably don't want to mess with these.
-SWISHE_IndexPointer "format=%V;"
- # for future use. %V becomes $Sman::SMAN_DATA_VERSION
-#SWISHE_FuzzyIndexingMode Stem
- # above was deprecated in 2.4.3, does not work in 2.4.4
-SWISHE_FuzzyIndexingMode Stemming_en2
-SWISHE_MetaNames desc sec swishtitle manpage digest
-SWISHE_PropertyNames desc sec manpage digest
-
-# SWISHE_IgnoreWords File: ./stopwords/english.txt
-# allow _ and : but not /
-# .'s in middle of word are word chars, for files like 'named.conf'.
-SWISHE_WordCharacters 0123456789abcdefghijklmnopqrstuvwxyz_:.
-SWISHE_BeginCharacters 0123456789abcdefghijklmnopqrstuvwxyz_:
-SWISHE_EndCharacters 0123456789abcdefghijklmnopqrstuvwxyz_:
-SWISHE_IgnoreTotalWordCountWhenRanking 0
diff --git a/funtools/doc/szlong.c b/funtools/doc/szlong.c
deleted file mode 100644
index b0e84bc..0000000
--- a/funtools/doc/szlong.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- fprintf(stdout, "%d\n", (int)sizeof(long));
- return 0;
-}
-
diff --git a/funtools/doc/tabcalc.c b/funtools/doc/tabcalc.c
deleted file mode 100644
index 5f1cb30..0000000
--- a/funtools/doc/tabcalc.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *
- * This program was generated automatically by the funcalc program,
- * by running the tabcalc.c template through the funcalc.l lexical analyzer.
- * On this system, it was (or can be) built a command such as:
- *
- * $COMMAND
- *
- */
-#include <funtools.h>
-
-extern char *optarg;
-extern int optind;
-
-/* define the types of event records we have to handle */
-#define REC_CUR 1
-#define REC_PREV 2
-#define REC_NEXT 4
-
-/* default number of rows to read at a time */
-#define MAXROW 8192
-int maxrow=MAXROW;
-
-typedef struct rowstruct{
-$MEMBERS
-} *Row, RowRec;
-
-/* global definitions and init calls go here */
-$GLOBAL
-
-/* main program */
-int main (int argc, char **argv)
-{
- int c, i, got, total, rectype, start, stop, skip, args;
- int del=0;
- char *s;
- Fun fun, ofun;
- Row rowbuf, rowptr;
- Row cur, prev, next;
- $AUTO
-
- /* local definitions, followed by init calls go here */
- $LOCAL
-
- /* exit on gio errors */
- setgerror(1);
-
- /* avoid shared library problems by using "process" type for filtering */
- putenv("FILTER_PTYPE=process");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "d")) != -1){
- switch(c){
- case 'd':
- del = 1;
- break;
- }
- }
- /* check for required arguments */
- args = argc - optind;
- /* make sure we have minimal arguments */
- if( args < $ARGS ){
- if( $ARGS == 1 )
- fprintf(stderr,
- "usage: [expr] | funcalc [-e expr] [-f file] iname\n");
- else
- fprintf(stderr,
- "usage: [expr] | funcalc [-e expr] [-f file] iname oname [cols]\n");
- goto error;
- }
-
- /* set rectype: determine whether we need prev,next records */
- rectype=$RECTYPE;
-
- /* get maxrow,if user-specified */
- if( (s=(char *)getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
- /* make sure max row is large enough to handle prev, next */
- if( rectype & (REC_PREV|REC_NEXT) ) maxrow = MAX(3,maxrow);
-
- /* open input file */
- if( !(fun = FunOpen(argv[optind+0], "rc", NULL)) ){
- gerror(stderr, "could not FunOpen input file: %s\n", argv[optind+0]);
- goto error;
- }
-
- /* open the output FITS image, inheriting params from input */
- if( $ARGS > 1 ){
- if( !(ofun = FunOpen(argv[optind+1], "w", fun)) ){
- gerror(stderr, "could not FunOpen output file: %s\n", argv[optind+1]);
- goto error;
- }
- }
-
- /* select columns */
- FunColumnSelect(fun, sizeof(RowRec), "merge=replace",
- $SELECT
- NULL);
-
- /* activate specified columns -- these will be written to the output file */
- if( args >= 3 )
- FunColumnActivate(fun, argv[optind+2], NULL);
-
- /* allocate space for rowbuf -- we will manage this buffer ourselves */
- rowbuf = (Row)calloc(maxrow, sizeof(RowRec));
-
- /* no record read yet */
- total = 0;
-
- /* any user-defined calls before we enter the row loop go here */
- $BEFORE
-
- /* main loop -- get rows and process */
- while( 1 ){
- /* need prev record */
- if( rectype & REC_PREV ){
- /* no records yet: read new batch of records into start of rowbuf */
- if( total == 0 ){
- rowptr = rowbuf;
- }
- /* we have read records: move last record from last batch into first
- new record and read new records after that */
- else{
- /* if we are accessing next, we did not actually process final record,
- therefore we do it now */
- if( rectype & REC_NEXT ){
- memcpy(rowbuf, rowbuf+(got-2), sizeof(RowRec)*2);
- rowptr = rowbuf+2;
- }
- /* not accessing next, so we just move last record processed */
- else{
- memcpy(rowbuf, rowbuf+(got-1), sizeof(RowRec));
- rowptr = rowbuf+1;
- }
- }
- /* start at 2nd record so as to have a valid prev */
- start = 1;
- }
- /* processing that does not require prev */
- else{
- rowptr = rowbuf;
- start = 0;
- }
-
- /* adjust maxrow to account for handling of prev record */
- skip = (rowptr - rowbuf)/sizeof(RowRec);
-
- /* read new rows */
- if( !FunTableRowGet(fun, rowptr, maxrow-skip, NULL, &got) )
- break;
-
- /* if we need access to next record, don't process the last one we read */
- if( rectype & REC_NEXT ){
- stop = got - 1;
- }
- /* processing that does not require acces to next, process as cur */
- else{
- stop = got;
- }
-
- /* process all rows */
- for(i=start; i<stop; i++){
- /* set up pointer to current row */
- cur = rowbuf+i;
- /* set up pointer to prev and next as needed */
- if( rectype & REC_PREV ) prev = rowbuf+(i-1);
- if( rectype & REC_NEXT ) next = rowbuf+(i+1);
- /* execute the expression */
- $EXPR
- /* write out this row with the new column */
- if( $ARGS > 1 )
- FunTableRowPut(ofun, (char *)cur, 1, i, NULL);
- }
- total += got;
- }
-
- /* any user-defined calls after we finish the row loop go here */
- $AFTER
-
- /* free row data */
- if( rowbuf ) free(rowbuf);
-
- /* clean up -- close output before input to perform flush automatically */
- if( $ARGS > 1 )
- FunClose(ofun);
- FunClose(fun);
-
- /* delete program if necessary */
- if( del ) unlink(argv[0]);
- return(0);
-
-error:
- /* delete program if necessary */
- if( del ) unlink(argv[0]);
- return(1);
-}
diff --git a/funtools/doc/text.html b/funtools/doc/text.html
deleted file mode 100644
index f4fdac8..0000000
--- a/funtools/doc/text.html
+++ /dev/null
@@ -1,564 +0,0 @@
-<!-- =defdoc funtext funtext n -->
-<HTML>
-<HEAD>
-<TITLE>Column-based Text Files</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funtext NAME -->
-<H2><A NAME="funtext">Funtext: Support for Column-based Text Files</A></H2>
-
-<!-- =section funtext SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document contains a summary of the options for processing column-based
-text files.
-
-<!-- =section funtext DESCRIPTION -->
-<H2>Description</H2>
-
-<P>
-Funtools will automatically sense and process "standard"
-column-based text files as if they were FITS binary tables without any
-change in Funtools syntax. In particular, you can filter text files
-using the same syntax as FITS binary tables:
-<pre>
- fundisp foo.txt'[cir 512 512 .1]'
- fundisp -T foo.txt > foo.rdb
- funtable foo.txt'[pha=1:10,cir 512 512 10]' foo.fits
-</pre>
-
-<P>
-The first example displays a filtered selection of a text file. The
-second example converts a text file to an RDB file. The third example
-converts a filtered selection of a text file to a FITS binary table.
-
-<P>
-Text files can also be used in Funtools image programs. In this case,
-you must provide binning parameters (as with raw event files), using
-the bincols keyword specifier:
-
-<pre>
- bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]
-</pre>
-
-For example:
-<pre>
- funcnts foo'[bincols=(x:1024,y:1024)]' "ann 512 512 0 10 n=10"
-</pre>
-
-<H2>Standard Text Files</H2>
-
-<P>
-Standard text files have the following characteristics:
-
-<ul>
-<li> Optional comment lines start with #
-<li> Optional blank lines are considered comments
-<li> An optional table header consists of the following (in order):
-<ul>
- <li> a single line of alpha-numeric column names
- <li> an optional line of unit strings containing the same number of cols
- <li> an optional line of dashes containing the same number of cols
-</ul>
-<li> Data lines follow the optional header and (for the present) consist of
- the same number of columns as the header.
-<li> Standard delimiters such as space, tab, comma, semi-colon, and bar.
-</ul>
-
-<P>
-Examples:
-
-<pre>
- # rdb file
- foo1 foo2 foo3 foos
- ---- ---- ---- ----
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
- # multiple consecutive whitespace and dashes
- foo1 foo2 foo3 foos
- --- ---- ---- ----
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-
- # comma delims and blank lines
- foo1,foo2,foo3,foos
-
- 1,2.2,3,xxxx
- 10,20.2,30,yyyy
-
- # bar delims with null values
- foo1|foo2|foo3|foos
- 1||3|xxxx
- 10|20.2||yyyy
-
- # header-less data
- 1 2.2 3 xxxx
- 10 20.2 30 yyyy
-</pre>
-
-<P>
-The default set of token delimiters consists of spaces, tabs, commas,
-semi-colons, and vertical bars. Several parsers are used
-simultaneously to analyze a line of text in different ways. One way
-of analyzing a line is to allow a combination of spaces, tabs, and
-commas to be squashed into a single delimiter (no null values between
-consecutive delimiters). Another way is to allow tab, semi-colon, and
-vertical bar delimiters to support null values, i.e. two consecutive
-delimiters implies a null value (e.g. RDB file). A successful parser
-is one which returns a consistent number of columns for all rows, with
-each column having a consistent data type. More than one parser can
-be successful. For now, it is assumed that successful parsers all
-return the same tokens for a given line. (Theoretically, there are
-pathological cases, which will be taken care of as needed). Bad parsers
-are discarded on the fly.
-
-<P>
-If the header does not exist, then names "col1", "col2", etc. are
-assigned to the columns to allow filtering. Furthermore, data types
-for each column are determined by the data types found in the columns
-of the first data line, and can be one of the following: string, int,
-and double. Thus, all of the above examples return the following
-display:
-<pre>
- fundisp foo'[foo1>5]'
- FOO1 FOO2 FOO3 FOOS
- ---------- --------------------- ---------- ------------
- 10 20.20000000 30 yyyy
-</pre>
-
-<H2>Comments Convert to Header Params</H2>
-
-<P>
-Comments which precede data rows are converted into header parameters and
-will be written out as such using funimage or funhead. Two styles of comments
-are recognized:
-
-<P>
-1. FITS-style comments have an equal sign "=" between the keyword and
-value and an optional slash "/" to signify a comment. The strict FITS
-rules on column positions are not enforced. In addition, strings only
-need to be quoted if they contain whitespace. For example, the following
-are valid FITS-style comments:
-
-<pre>
- # fits0 = 100
- # fits1 = /usr/local/bin
- # fits2 = "/usr/local/bin /opt/local/bin"
- # fits3c = /usr/local/bin /opt/local/bin /usr/bin
- # fits4c = "/usr/local/bin /opt/local/bin" / path dir
-</pre>
-
-Note that the fits3c comment is not quoted and therefore its value is the
-single token "/usr/local/bin" and the comment is "opt/local/bin /usr/bin".
-This is different from the quoted comment in fits4c.
-
-<P>
-2. Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed. If a string
-is quoted, then slash "/" after the string will signify a comment.
-For example:
-
-<pre>
- # com1 /usr/local/bin
- # com2 "/usr/local/bin /opt/local/bin"
- # com3 /usr/local/bin /opt/local/bin /usr/bin
- # com4c "/usr/local/bin /opt/local/bin" / path dir
-
- # com11: /usr/local/bin
- # com12: "/usr/local/bin /opt/local/bin"
- # com13: /usr/local/bin /opt/local/bin /usr/bin
- # com14c: "/usr/local/bin /opt/local/bin" / path dir
-</pre>
-
-<P>
-Note that com3 and com13 are not quoted, so the whole string is part of
-the value, while comz4c and com14c are quoted and have comments following
-the values.
-
-<P>
-Some text files have column name and data type information in the header.
-You can specify the format of column information contained in the
-header using the "hcolfmt=" specification. See below for a detailed
-description.
-
-<H2>Multiple Tables in a Single File</H2>
-
-<P>
-Multiple tables are supported in a single file. If an RDB-style file
-is sensed, then a ^L (vertical tab) will signify end of
-table. Otherwise, an end of table is sensed when a new header (i.e.,
-all alphanumeric columns) is found. (Note that this heuristic does not
-work for single column tables where the column type is ASCII and the
-table that follows also has only one column.) You also can specify
-characters that signal an end of table condition using the <b>eot=</b>
-keyword. See below for details.
-
-<P>
-You can access the nth table (starting from 1) in a multi-table file
-by enclosing the table number in brackets, as with a FITS extension:
-
-<pre>
- fundisp foo'[2]'
-</pre>
-The above example will display the second table in the file.
-(Index values start at 1 in oder to maintain logical compatibility
-with FITS files, where extension numbers also start at 1).
-
-
-<H2>TEXT() Specifier</H2>
-
-<P>
-As with ARRAY() and EVENTS() specifiers for raw image arrays and raw
-event lists respectively, you can use TEXT() on text files to pass
-key=value options to the parsers. An empty set of keywords is
-equivalent to not having TEXT() at all, that is:
-
-<pre>
- fundisp foo
- fundisp foo'[TEXT()]'
-</pre>
-
-are equivalent. A multi-table index number is placed before the TEXT()
-specifier as the first token, when indexing into a multi-table:
-
- fundisp foo'[2,TEXT(...)]'
-
-<P>
-The filter specification is placed after the TEXT() specifier, separated
-by a comma, or in an entirely separate bracket:
-
-<pre>
- fundisp foo'[TEXT(...),circle 512 512 .1]'
- fundisp foo'[2,TEXT(...)][circle 512 512 .1]'
-</pre>
-
-<H2>Text() Keyword Options</H2>
-
-<P>
-The following is a list of keywords that can be used within the TEXT()
-specifier (the first three are the most important):
-
-<DL>
-
-<P>
-<DT> delims="[delims]"
-<DD>Specify token delimiters for this file. Only a single parser having these
-delimiters will be used to process the file.
-<pre>
- fundisp foo.fits'[TEXT(delims="!")]'
- fundisp foo.fits'[TEXT(delims="\t%")]'
-</pre>
-
-<P>
-<DT> comchars="[comchars]"
-<DD> Specify comment characters. You must include "\n" to allow blank lines.
-These comment characters will be used for all standard parsers (unless delims
-are also specified).
-<pre>
- fundisp foo.fits'[TEXT(comchars="!\n")]'
-</pre>
-
-<P>
-<DT> cols="[name1:type1 ...]"
-<DD> Specify names and data type of columns. This overrides header
-names and/or data types in the first data row or default names and
-data types for header-less tables.
-<pre>
- fundisp foo.fits'[TEXT(cols="x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e")]'
-</pre>
-<P>
-If the column specifier is the only keyword, then the cols= is not
-required (in analogy with EVENTS()):
-<pre>
- fundisp foo.fits'[TEXT(x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e)]'
-</pre>
-Of course, an index is allowed in this case:
-<pre>
- fundisp foo.fits'[2,TEXT(x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e)]'
-</pre>
-
-<P>
-<DT> eot="[eot delim]"
-<DD> Specify end of table string specifier for multi-table files. RDB
-files support ^L. The end of table specifier is a string and the whole
-string must be found alone on a line to signify EOT. For example:
-<pre>
- fundisp foo.fits'[TEXT(eot="END")]'
-</pre>
-will end the table when a line contains "END" is found. Multiple lines
-are supported, so that:
-<pre>
- fundisp foo.fits'[TEXT(eot="END\nGAME")]'
-</pre>
-will end the table when a line contains "END" followed by a line
-containing "GAME".
-<P>
-In the absence of an EOT delimiter, a new table will be sensed when a new
-header (all alphanumeric columns) is found.
-
-<P>
-<DT> null1="[datatype]"
-<DD> Specify data type of a single null value in row 1.
-Since column data types are determined by the first row, a null value
-in that row will result in an error and a request to specify names and
-data types using cols=. If you only have a one null in row 1, you don't
-need to specify all names and columns. Instead, use null1="type" to
-specify its data type.
-
-<P>
-<DT> alen=[n]
-<DD>Specify size in bytes for ASCII type columns.
-FITS binary tables only support fixed length ASCII columns, so a
-size value must be specified. The default is 16 bytes.
-
-<P>
-<DT> nullvalues=["true"|"false"]
-<DD>Specify whether to expect null values.
-Give the parsers a hint as to whether null values should be allowed. The
-default is to try to determine this from the data.
-
-<P>
-<DT> whitespace=["true"|"false"]
-<DD> Specify whether surrounding white space should be kept as part of
-string tokens. By default surrounding white space is removed from
-tokens.
-
-<P>
-<DT> header=["true"|"false"]
-<DD>Specify whether to require a header. This is needed by tables
-containing all string columns (and with no row containing dashes), in
-order to be able to tell whether the first row is a header or part of
-the data. The default is false, meaning that the first row will be
-data. If a row dashes are present, the previous row is considered the
-column name row.
-
-<P>
-<DT> units=["true"|"false"]
-<DD>Specify whether to require a units line.
-Give the parsers a hint as to whether a row specifying units should be
-allowed. The default is to try to determine this from the data.
-
-<P>
-<DT> i2f=["true"|"false"]
-<DD>Specify whether to allow int to float conversions.
-If a column in row 1 contains an integer value, the data type for that
-column will be set to int. If a subsequent row contains a float in
-that same column, an error will be signaled. This flag specifies that,
-instead of an error, the float should be silently truncated to
-int. Usually, you will want an error to be signaled, so that you can
-specify the data type using cols= (or by changing the value of
-the column in row 1).
-
-<P>
-<DT> comeot=["true"|"false"|0|1|2]
-<DD>Specify whether comment signifies end of table.
-If comeot is 0 or false, then comments do not signify end of table and
-can be interspersed with data rows. If the value is true or 1 (the
-default for standard parsers), then non-blank lines (e.g. lines
-beginning with '#') signify end of table but blanks are allowed
-between rows. If the value is 2, then all comments, including blank
-lines, signify end of table.
-
-<P>
-<DT> lazyeot=["true"|"false"]
-<DD>Specify whether "lazy" end of table should be permitted (default is
-true for standard formats, except rdb format where explicit ^L is required
-between tables). A lazy EOT can occur when a new table starts directly
-after an old one, with no special EOT delimiter. A check for this EOT
-condition is begun when a given row contains all string tokens. If, in
-addition, there is a mismatch between the number of tokens in the
-previous row and this row, or a mismatch between the number of string
-tokens in the prev row and this row, a new table is assumed to have
-been started. For example:
-<PRE>
- ival1 sval3
- ----- -----
- 1 two
- 3 four
-
- jval1 jval2 tval3
- ----- ----- ------
- 10 20 thirty
- 40 50 sixty
-</PRE>
-Here the line "jval1 ..." contains all string tokens. In addition,
-the number of tokens in this line (3) differs from the number of
-tokens in the previous line (2). Therefore a new table is assumed
-to have started. Similarly:
-<PRE>
- ival1 ival2 sval3
- ----- ----- -----
- 1 2 three
- 4 5 six
-
- jval1 jval2 tval3
- ----- ----- ------
- 10 20 thirty
- 40 50 sixty
-</PRE>
-Again, the line "jval1 ..." contains all string tokens. The number of
-string tokens in the previous row (1) differs from the number of
-tokens in the current row(3). We therefore assume a new table as been
-started. This lazy EOT test is not performed if lazyeot is explicitly
-set to false.
-
-<P>
-<DT> hcolfmt=[header column format]
-<DD> Some text files have column name and data type information in the header.
-For example, VizieR catalogs have headers containing both column names
-and data types:
-<PRE>
- #Column e_Kmag (F6.3) ?(k_msigcom) K total magnitude uncertainty (4) [ucd=ERROR]
- #Column Rflg (A3) (rd_flg) Source of JHK default mag (6) [ucd=REFER_CODE]
- #Column Xflg (I1) [0,2] (gal_contam) Extended source contamination (10) [ucd=CODE_MISC]
-</PRE>
-
-while Sextractor files have headers containing column names alone:
-
-<PRE>
- # 1 X_IMAGE Object position along x [pixel]
- # 2 Y_IMAGE Object position along y [pixel]
- # 3 ALPHA_J2000 Right ascension of barycenter (J2000) [deg]
- # 4 DELTA_J2000 Declination of barycenter (J2000) [deg]
-</PRE>
-The hcolfmt specification allows you to describe which header lines
-contain column name and data type information. It consists of a string
-defining the format of the column line, using "$col" (or "$name") to
-specify placement of the column name, "$fmt" to specify placement of the
-data format, and "$skip" to specify tokens to ignore. You also can
-specify tokens explicitly (or, for those users familiar with how
-sscanf works, you can specify scanf skip specifiers using "%*").
-For example, the VizieR hcolfmt above might be specified in several ways:
-<PRE>
- Column $col ($fmt) # explicit specification of "Column" string
- $skip $col ($fmt) # skip one token
- %*s $col ($fmt) # skip one string (using scanf format)
-</PRE>
-while the Sextractor format might be specified using:
-<PRE>
- $skip $col # skip one token
- %*d $col # skip one int (using scanf format)
-</PRE>
-You must ensure that the hcolfmt statement only senses actual column
-definitions, with no false positives or negatives. For example, the
-first Sextractor specification, "$skip $col", will consider any header
-line containing two tokens to be a column name specifier, while the
-second one, "%*d $col", requires an integer to be the first token. In
-general, it is preferable to specify formats as explicitly as
-possible.
-
-<P>
-Note that the VizieR-style header info is sensed automatically by the
-funtools standard VizieR-like parser, using the hcolfmt "Column $col
-($fmt)". There is no need for explicit use of hcolfmt in this case.
-
-<P>
-<DT> debug=["true"|"false"]
-<DD>Display debugging information during parsing.
-
-</DL>
-
-<H2>Environment Variables</H2>
-
-<P>
-Environment variables are defined to allow many of these TEXT() values to be
-set without having to include them in TEXT() every time a file is processed:
-
-<pre>
- keyword environment variable
- ------- --------------------
- delims TEXT_DELIMS
- comchars TEXT_COMCHARS
- cols TEXT_COLUMNS
- eot TEXT_EOT
- null1 TEXT_NULL1
- alen TEXT_ALEN
- bincols TEXT_BINCOLS
- hcolfmt TEXT_HCOLFMT
-</pre>
-
-<H2>Restrictions and Problems</H2>
-
-<P>
-As with raw event files, the '+' (copy extensions) specifier is not
-supported for programs such as funtable.
-
-<P>
-String to int and int to string data conversions are allowed by the
-text parsers. This is done more by force of circumstance than by
-conviction: these transitions often happens with VizieR catalogs,
-which we want to support fully. One consequence of allowing these
-transitions is that the text parsers can get confused by columns which
-contain a valid integer in the first row and then switch to a
-string. Consider the following table:
-<PRE>
- xxx yyy zzz
- ---- ---- ----
- 111 aaa bbb
- ccc 222 ddd
-</PRE>
-The xxx column has an integer value in row one a string in row two,
-while the yyy column has the reverse. The parser will erroneously
-treat the first column as having data type int:
-<PRE>
- fundisp foo.tab
- XXX YYY ZZZ
- ---------- ------------ ------------
- 111 'aaa' 'bbb'
- 1667457792 '222' 'ddd'
-</PRE>
-while the second column is processed correctly. This situation can be avoided
-in any number of ways, all of which force the data type of the first column
-to be a string. For example, you can edit the file and explicitly quote the
-first row of the column:
-<PRE>
- xxx yyy zzz
- ---- ---- ----
- "111" aaa bbb
- ccc 222 ddd
-
- [sh] fundisp foo.tab
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd'
-</PRE>
-You can edit the file and explicitly set the data type of the first column:
-<PRE>
- xxx:3A yyy zzz
- ------ ---- ----
- 111 aaa bbb
- ccc 222 ddd
-
- [sh] fundisp foo.tab
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd'
-</PRE>
-You also can explicitly set the column names and data types of all columns,
-without editing the file:
-<PRE>
- [sh] fundisp foo.tab'[TEXT(xxx:3A,yyy:3A,zzz:3a)]'
- XXX YYY ZZZ
- ------------ ------------ ------------
- '111' 'aaa' 'bbb'
- 'ccc' '222' 'ddd'
-</PRE>
-The issue of data type transitions (which to allow and which to disallow)
-is still under discussion.
-
-<!-- =section funtext SEE ALSO -->
-<!-- =text See funtools(n) for a list of Funtools help pages -->
-<!-- =stop -->
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: August 3, 2007</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/doc/twcs.c b/funtools/doc/twcs.c
deleted file mode 100644
index 2da9319..0000000
--- a/funtools/doc/twcs.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * twcs.c -- example using WCS Library
- *
- */
-
-#include <funtools.h>
-
-int main(int argc, char **argv)
-{
- int i;
- Fun fun;
- struct WorldCoor *wcs; /* WCS info */
- double x,y,ra,dec,xr,yr;
-
- if(argc == 1){
- fprintf(stderr, "usage: twcs iname\n");
- exit(1);
- }
-
- /* open Funtools file */
- /* Funopen makes initial WCS library call: wcs = wcsinit(header_string) */
- if( !(fun = FunOpen(argv[1], "r ", NULL)) ){
- fprintf(stderr, "ERROR can't open file: %s\n", argv[1]);
- exit(1);
- }
-
- /* get wcs structure */
- FunInfoGet(fun,FUN_WCS,&wcs,0);
- if( !wcs || !iswcs(wcs) ){
- fprintf(stderr,"No WCS data");
- return(1);
- }
-
- /* read input, convert pixels to wcs and back */
- while(1){
- fprintf(stdout,"\nInput x y: ");
- if(scanf("%lf %lf", &x, &y) != EOF){
- if(x <= -999)
- break;
- /* convert image pixels to sky coords */
- pix2wcs(wcs, x, y, &ra, &dec);
- fprintf(stdout,"Convert from pixels to ra,dec using pix2wcs()\n");
- fprintf(stdout, "x=%.10g y=%.10g -> ra=%.10g dec=%.10g\n",
- x, y, ra, dec);
- /* convert sky coords to image pixels */
- fprintf(stdout,"Convert from ra,dec -> pixels using wcs2pix()\n");
- wcs2pix(wcs, ra, dec, &xr, &yr, &i);
- fprintf(stdout, "ra=%.10g dec=%.10g -> x=%.10g y=%.10g offscale=%d\n",
- ra, dec, xr, yr, i);
- }
- else
- break;
- }
-
- /* clean up */
- /* FunClose makes final WCS library call: wcsfree(wcs) */
- FunClose(fun);
- return(0);
-}
-
diff --git a/funtools/doc/view.html b/funtools/doc/view.html
deleted file mode 100644
index 6f1faa8..0000000
--- a/funtools/doc/view.html
+++ /dev/null
@@ -1,376 +0,0 @@
-<!-- =defdoc funview funview n -->
-<HTML>
-<HEAD>
-<TITLE>Database View Support for Tables</TITLE>
-</HEAD>
-<BODY>
-
-<!-- =section funview NAME -->
-<H2><A NAME="funview">Funview: Database View Support for Tables</A></H2>
-
-<!-- =section funview SYNOPSIS -->
-<H2>Summary</H2>
-<P>
-This document contains a summary of the options for utilizing
-database-inspired Views of tables.
-
-<!-- =section funview DESCRIPTION -->
-<H2>Description</H2>
-
-<H2>Database Views</H2>
-<P>
-In database parlance, a <B>View</B> defines a "virtual table", i.e.,
-a description of row and/or column selection filters (but with no
-permanent storage space allocated). When used in place of a table, a
-View selects the specified rows and/or columns from one or more real
-tables. Views enable you to see complicated data tables in a more
-convenient format. They also can be used as a security mechanism, by
-restricting user access to specific columns and/or rows. [See:
-<pre>
-http://www.cs.unibo.it/~ciaccia/COURSES/RESOURCES/SQLTutorial/sqlch5.htm
-</pre>
-for a good discussion of SQL Views.]
-
-<P>
-Funtools supports an expanded notion of Views for all tabular data
-(FITS tables, raw binary tables, and ASCII column files). Funtools
-Views allow you to pre-set values for the filter specification, the
-columns to activate, and display format (though the latter is for
-fundisp only). Setting the filter and column activation values
-provides functionality equivalent to that of a classical database
-View, while the ability to set the format is similar to classical
-report writing capabilities.
-
-<H2>Funtools View Attributes</H2>
-<P>
-A Funtools View is a text file containing one or more of the following
-columns:
-<PRE>
- column description
- ------ -----------------------------
- view name of view
- file data file name or template
- filter filter specification
- columns columns to activate
- format fundisp format specification
-</PRE>
-All of the attribute columns are optional, including
-the <B>view</B> name itself. This means that a View can be named or
-unnamed. Unnamed Views can refer to a specific file or a template of
-files (obviously if neither the view or the file column is specified,
-the input View specification will never be used). You can specify any
-combination of filter, column, and format parameters. (It also is
-possible to apply file-specific View to other files; see the discussion
-on <B>View Lists</B> below). Each column has a size limit of 1024 characters.
-
-<P>
-For example, consider the following View file:
-<PRE>
- view file format columns filter
- ---- ---------------------- ------ ------------ -------
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
- x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
- x1 ${HOME}/data/snr.ev cir 512 512 .1
- x1a ${HOME}/data/snr.ev x y pi pha
- x0 ${HOME}/data/snr.ev
- xf I=%4d
- xc x y pi pha
- xr cir 512 512 .1
- *.ev x y pi pha
- *.fit x y dx dy cir 400 400 3
- *.fits I=%3d x y dx dy cir 400 400 3
-</PRE>
-This database example is in rdb format, i.e. using tab delimiters and
-permitting null values. Any valid ASCII table format is acceptable,
-but if you use a format that does not permit null values, it will be
-necessary to quote the null strings.
-
-<P>
-The first five entries (x3, x2, x1, x1a, x0) are named entries defining
-default values specifically for the snr.ev data file. Typically, you
-would use these Views by specifying View name, and the corresponding
-file, filter, column, and format values would be used. Note that the x0
-View is essentially an alias for the pathname of this file.
-
-<P>
-The next three entries define defaults that can be applied to any
-file. You typically would use these View names in conjunction with
-a specific file name (see <B>View Lists</B> below) so that the associated
-parameter(s) were applied to that file.
-
-<P>
-The last three entry in the database define unnamed Views that
-pertains to all files ending with the specified templates. In these
-cases, any View that specifies a file name matching the file template
-would be processed with the associated parameter attributes.
-
-<H2>Invoking a Funtools View (in Place of an Input File)</H2>
-<P>
-To use a Funtools View, you simply pre-pend the "v:" prefix to a View name or
-a file name where an input file name usually is specified. For example:
-<PRE>
- fundisp v:x3
-</PRE>
-specifies that the View named x3 (with its file name and associated
-parameters) is processed as the input file to fundisp. Using the
-example database, above, this is equivalent to:
-<PRE>
- fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-</PRE>
-That is, the format is used with fundisp's -f (format) switch, while the
-filename and extension are composed of the x3 View's filename and
-region filter.
-
-<P>
-Similarly, executing a command such as:
-<PRE>
- fundisp v:foo.fit
-</PRE>
-will match the unnamed View associated with the template "*.fit".
-This is equivalent to executing:
-<PRE>
- fundisp foo.fit'[cir 400 400 3]' "x y dx dy"
-</PRE>
-Of course, if you omit the "v:" prefix, then no View processing takes place:
-<PRE>
- fundisp foo.fit # process foo.fit without any View parameters
- fundisp x3 # error (assuming there is no file named x3)
-</PRE>
-
-<H2>Basic View Matching Rules</H2>
-
-<P>
-When a "v:" prefix is recognized, Funtools searches for a View database
-file in the following order:
-<PRE>
- location description
- ------------ ------------------------------------
- FUN_VIEWFILE environment variable (any file name)
- ./.funtools.vu hidden file, default name
- $HOME/.funtools.vu hidden file, default name
-</PRE>
-The first View database file located is used to construct a new
-filename, as well as an activation column specification and a format
-specification. The following rules are used:
-
-<P>
-1. An attempt is made to match the input name (i.e., the part of the
-input View after the "v:" prefix) against the <B>view</B> column value
-(if present) of each row in the database. If a match is found, the
-values of all non-blank columns are saved for later use. Also note
-that the first match terminates the search: i.e., <B>the order of the
-database rows matters</B>.
-
-<P>
-2. If no <B>view</B> match is made, an attempt is made to match the input
-name against the <B>file</B> column value (if present). Matching is
-performed on the full pathname of both the input name and the
-database file name, and on the non-directory (root) part of these
-files. This means that the root specification:
-<PRE>
- fundisp v:snr.ev
-</PRE>
-will match a row in the database that has a full pathname in the file,
-allowing you to use a <B>file</B>-matched View without having to
-specify the full pathname. In this example, the "v:snr.ev" View
-specification will match the first row (v:x3) in the database:
-<PRE>
- x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
-</PRE>
-even though the row contains a fully qualified pathname as the file
-value. Once again, values of all non-blank columns are saved, and the
-first match terminates the search.
-
-<P>
-3. If neither a <B>view</B> or a <B>view</B> match has been found,
-then a simple template match is attempted against the <B>view</B>
-values. Template matching supports a simplified version of file
-globbing (not a regular expression), with support for a single "*"
-(all characters), "?" (single character), or "[...]" (range) specification.
-
-<P>
-4. If no template match was found on the <B>view</B> column, then a
-simple template match is attempted against the <B>file</B> columns.
-
-<P>
-5. If no match is found, then the filename (minus the "v:" prefix) is
-returned.
-
-<H2>More on View Matching Rules: Single vs. Multiple Matches </H2>
-
-The matching rules described above stop after the first match,
-regardless of whether that match provides values for all three
-parameters (filter, columns, and format). In cases where a <B>view</B>
-or <B>file</B> match does not provide all three values, it is possible
-that a template match might do so. With regard to the example View
-database above, the x1 View provides only a filter, while omitting
-both the format and columns values. But note that the final rows in
-the database could provide the values via a template match on the
-filename. This sort of multiple matching is especially valuable in
-order to provide "global" values to several Views.
-
-<P>
-Obviously, multiple matching might not be wanted in every
-case. Therefore, we support both multiple matching and single matching
-according to the value of the FUN_VIEWMATCH environment variable. If
-the FUN_VIEWMATCH environment variable exists and if its value begins
-with "s", then a single match is used and missing parameters are not
-filled in with subsequent template matches on the file name. That is,
-matching rules above are followed exactly as explained above. If the
-value of this environment variable begins with "m" (or does not exist),
-then multiple matches are used to try to fill in missing parameters.
-In this case, template matching always takes place and missing values are
-taken from these template matches.
-
-<P>
-Thus, in the example above, the View specification:
-<PRE>
- fundisp v:x1
-</PRE>
-will take the file name and filter value from the x1 View:
-<PRE>
- x1 ${HOME}/data/snr.ev cir 512 512 .1
-</PRE>
-The column value then will be taken from the "*.ev" file template match
-against the x1 file name:
-<PRE>
- *.ev x y pi pha
-</PRE>
-Note once again that order is important: missing values are taken in the
-order in which the template matches are processed.
-
-<H2>View Lists: Applying a View to Any File</H2>
-
-<P>
-It is possible to apply a named View, or even several Views, to any
-data file by appending a <B>viewlist</B> immediately after the standard "v:"
-prefix. A viewlist takes the form:
-<PRE>
- :v1,v2,...vn:
-</PRE>
-where v1, v2, etc. are named Views. The two ":" colon characters surrounding
-the list are required. Thus, the syntax for applying a viewlist to a file is:
-<PRE>
- v::view1,view2,...viewn:filename
-</PRE>
-Note that the name after the last ":" is assumed to be a file; it is
-not permissible (or sensible) to use a View name.
-
-<P>
-For example, the View specification:
-<PRE>
- fundisp v::x2:foo
-</PRE>
-applies the x2 View to the file foo (even if there is a View named foo)
-and (in using our example database) is equivalent to:
-<PRE>
- ./fundisp foo'[cir 512 512 .1] "x y pi pha"
-</PRE>
-The same command can be effected using a list of Views:
-<PRE>
- fundisp v::x1,x1a:foo
-</PRE>
-
-<P>
-What happens if a viewlist is used and the file also matches a
-template? Consider, for example, this View specification:
-<PRE>
- fundisp v::x2:foo.fit
-</PRE>
-Here, the x2 View will supply filter and column values, while the
-template *.fit can also supply (different) filter and column
-values. In this case, the explicitly specified Views of the viewlist
-trump the matched view values.
-
-<P>
-On the other hand, if a file template match can supply a View value
-that is not supplied by the viewlist, then that value will be taken
-from the file template match. For example:
-<PRE>
- fundisp v::x2:foo.fits
-</PRE>
-does not explicitly supply a format value, but the file match on *.fits
-can and does. You can avoid supplying missing values using file template
-matching by replacing the first ":" with a "-" in a viewlist
-specification:
-<PRE>
- fundisp v:-x2:foo.fits
-</PRE>
-The use of ":+" to explicitly allow file template matching is also
-supported, but is the same as the default case. Note that the nuances
-of viewlist support are subject to change as our experience and
-understanding grow.
-
-<H2>Overriding Values Associated with a View</H2>
-
-<P>
-To override values associated with a View, simply supply the override
-values in the correct place on the command line. Thus, given
-the example database described above, the command:
-<PRE>
- fundisp v:x3
-</PRE>
-specifies that the View named x3, along with its file name and
-associated parameters, be processed as the input file to fundisp in
-this way:
-<PRE>
- fundisp -f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-</PRE>
-To override one or more of these values, simply specify a new value
-for the format, filter, or columns. For example, if your input View file
-contains a filter, then the View will use that filter as an override
-of the View filter:
-<PRE>
- fundisp v:x3'[cir 400 400 3]'
-</PRE>
-will use the columns and format of the x3 View but not the x3 filter. Further
-examples are:
-<PRE>
- fundisp v:x3 "x y dx dy" # activate a different set of columns
- fundisp -f "I=%3d" v:x3 # use a different format statement
-</PRE>
-
-<P>
-Note that extension names, extension index values, and other
-non-filter specifications <B>do not</B> override the View
-filter. Thus:
-<PRE>
- fundisp v:foo.fit[3]
-</PRE>
-will still use the filter associated with the .fit template (see above), since
-the "3" is an extension index, not a filter.
-
-<H2>Environment Variables</H2>
-
-The following environment variables are used by Funtools Views:
-<DL>
-<DT><B>FUN_VIEWNAME</B>
-<DD> The <B>FUN_VIEWNAME</B> environment variable specifies the
-name and location of the View database file. If not present, the
-files ./.funtools.vu and $HOME/.funtools.vu are searched for, in
-that order.
-
-<DT><B>FUN_VIEWMATCH</B>
-<DD> The <B>FUN_VIEWMATCH</B> environment variable specifies whether a
-single match or multiple match algorithm is used to locate parameter
-values. If the value of this environment variable begins with "s",
-then a single match is used and missing parameters are not filled in
-with subsequent template matches on the file name. If the value begins
-with "m", then multiple matches are used to try to fill in missing
-parameters. The default is to use multiple matches.
-</DL>
-
-<H2>Restrictions and Problems</H2>
-
-Support for overriding a filter (while not overriding extension names,
-extension indexes, etc.) requires that we can sense the presence of a
-filter in a bracket specification. It is unclear yet whether our
-algorithm is perfect.
-
-<P>
-<A HREF="./help.html">Go to Funtools Help Index</A>
-
-<H5>Last updated: August 3, 2007</H5>
-
-</BODY>
-</HTML>
diff --git a/funtools/faq/Makefile.in b/funtools/faq/Makefile.in
deleted file mode 100644
index 09900f5..0000000
--- a/funtools/faq/Makefile.in
+++ /dev/null
@@ -1,135 +0,0 @@
-#
-# This is a Makefile for the Funtools testing. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# extra includes for compiling
-INCLUDES = -I. -I$(prefix)/include
-
-# extra libs
-EXTRA_LIBS = @EXTRA_LIBS@
-
-# the full set of libraries for linking
-LIBS = -L.. -lfuntools $(EXTRA_LIBS) -lm
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = @srcdir@/install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-
-# web site for installation
-WEBDIR = /proj/rd/www/funtools
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-DEPEND_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-PROGS = tev tim
-
-all: $(PROGS)
-
-tev: tev.o
- $(CC) $(LDFLAGS) tev.o -o tev $(LIBS)
-
-tim: tim.o
- $(CC) $(LDFLAGS) tim.o -o tim $(LIBS)
-
-Makefile: Makefile.in
- $(SHELL) config.status
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak \
- config.info config.log \
- *fun*.out doc/*~
- $(RM) -r autom4te.cache
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log
-
-install:
- @echo "Nothing to install in faq"
-
-www:
- -@( if [ -d ${WEBDIR} ]; then \
- echo "installing in Web site: ${WEBDIR}"; \
- mkdir -p ${WEBDIR}/faq; \
- cp -p *.html ${WEBDIR}/faq/.; \
- else \
- echo "Web site not available for install"; \
- fi;)
-
-pclean:
- $(RM) $(PROGS)
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-evread.o: evread.c
- $(CC) -c $(CC_SWITCHES) evread.c
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/faq/faq.html b/funtools/faq/faq.html
deleted file mode 100644
index d89d723..0000000
--- a/funtools/faq/faq.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<html><head><title>Funtools FAQ</title></head>
-
-<p>
-Welcome to the Funtools FAQ
-<p>
-The primary home page for this FAQ is
-<a href="http://hea-www.harvard.edu/saord/funtools/faq/faq.html">http://hea-www.harvard.edu/saord/funtools/faq/faq.html</a>.
-
-<ol>
-
-<li>Retrieving and Installing Funtools
-<ol>
-<li><a href="faq1.html#faq1">Where can I get funtools?</a>
-<li><a href="faq1.html#faq2">How do I build funtools?</a>
-<li><a href="faq1.html#faq3">What secondary build options might be useful?</a>
-</ol>
-
-<li>Programming with Funtools
-<ol>
-<li><a href="faq2.html#faq1">What are the compile/link commands for various platforms?</a>
-<li><a href="faq2.html#faq2">What is the simplest possible program?</a>
-<li>Working with Binary Tables (Event Files)
-<ol>
-<li><a href="faq2.html#faq1.1">How do I read and display events?</a>
-<li><a href="faq2.html#faq1.2">How do I change the values of a single column for all events?</a>
-<li><a href="faq2.html#faq1.3">How do I process events based on the region each is in?</a>
-<li><a href="faq2.html#faq1.4">How do I make a FITS event file from a non-FITS source (and add my own params)?</a>
-</ol>
-<li>Working with Images
-<ol>
-<li><a href="faq2.html#faq2.1">How do I process an image in double float format?</a>
-<li><a href="faq2.html#faq2.1">How do I process an image in its native format?</a>
-</ol>
-</ol>
-
-<li>Funtools Analysis Programs
-<ol>
-<li><a href="faq3.html#faq1">What programs are available and what do they do?</a>
-</ol>
-
-<li>Using Filters and Regions
-<ol>
-<li><a href="faq4.html#faq1">Please show how to use column and regions filters</a>
-</ol>
-
-</ol>
-
-
-
diff --git a/funtools/faq/faq1.html b/funtools/faq/faq1.html
deleted file mode 100644
index d4f1fd8..0000000
--- a/funtools/faq/faq1.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<html><head><title>Funtools FAQ: Installing</title></head>
-
-<ol>
-
-<li> <a name="faq1"><b>Where can I get funtools?</b><p>
-Funtools is available at:
-<a href="http://hea-www.harvard.edu/saord/funtools">http://hea-www.harvard.edu/saord/funtools</a>.
-
-<li> <a name="faq2"><b>How do I build funtools?</b><p>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-./configure --prefix="install_root" # site-specific configuration
-make # build the software
-make install # install it
-make clean # clean up unneeded temp files
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name=faq3"><b>What secondary build options might be useful?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-# specify root dir to install funtools executables, libraries, man pages, etc.
-# default is to install in /usr/local
-configure --prefix="install_root"
-
-# create funtools as a shared library
-configure --enable-shared=yes
-
-# create funtools as a shared library and use it to link funtools itself
-configure --enable-shared=link
-
-# gcc: enable support for files larger than 2 Gb
-configure CFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
-</PRE>
-</CODE></BLOCKQUOTE>
-
-</ol>
diff --git a/funtools/faq/faq2.html b/funtools/faq/faq2.html
deleted file mode 100644
index f5b424b..0000000
--- a/funtools/faq/faq2.html
+++ /dev/null
@@ -1,381 +0,0 @@
-<html><head><title>Funtools FAQ: Programming</title></head>
-
-<ol>
-<li><a name="faq1"><b>What are the compile/link commands for various platforms?</b></a>
-<P>
-Assuming, for example, that funtools is installed in /soft/saord and that
-gcc is the compiler being used:
-<ol>
-<li> Linux:
-<BLOCKQUOTE><CODE>
-<PRE>
-gcc -g -I/soft/saord/include -c -o foo.o foo.c
-gcc -g foo.o -o foo -L/soft/saord/lib -lfuntools -ldl -lm
-</PRE>
-</CODE></BLOCKQUOTE>
-<li> Apple OS X:
-<BLOCKQUOTE><CODE>
-<PRE>
-gcc -g -no-cpp-precomp -fno-common -I/soft/saord/include -c -o foo.o foo.c
-gcc -g foo.o -o foo -L/soft/saord/lib -lfuntools -lm
-</PRE>
-</CODE></BLOCKQUOTE>
-<li> Sun Solaris:
-<BLOCKQUOTE><CODE>
-<PRE>
-gcc -g -no-cpp-precomp -fno-common -I/soft/saord/include -c -o foo.o foo.c
-gcc -g foo.o -o foo -L/soft/saord/lib -lfuntools -lsocket -lnsl -ldl -lm
-</PRE>
-</CODE></BLOCKQUOTE>
-
-</ol>
-
-<li><a name="faq2"><b>What is the simplest possible program?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-#include &lt;stdlib.h&gt;
-#include &lt;funtools.h&gt;
-
-int main(int argc, char **argv)
-{
- Fun fun;
-
- /* sanity check */
- if( argc &lt; 2 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- /* close file */
- FunClose(fun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name="faq1.1"><b>How do I read and display events?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>#
-#include &lt;stdlib.h&gt;
-#include &lt;funtools.h&gt;
-
-typedef struct evstruct{
- double x, y;
- int pi, pha;
-} *Ev, EvRec;
-
-int main(int argc, char **argv)
-{
- int i, got;
- int maxrow=1024;
- Ev ev, ebuf=NULL;
- Fun fun;
-
- /* sanity check */
- if( argc &lt; 2 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- /* select columns to read (and data types to convert to) */
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "x", "D", "r", FUN_OFFSET(Ev, x),
- "y", "D", "r", FUN_OFFSET(Ev, y),
- "pha", "J", "r", FUN_OFFSET(Ev, pha),
- "pi", "J", "r", FUN_OFFSET(Ev, pi),
- NULL);
- /* read and process events */
- while( (ebuf=(void *)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) && got ){
- for(i=0; i&lt;got; i++){
- ev = (Ev)ebuf+i;
- fprintf(stdout, "%.1f %.1f %d %d\n", ev->x, ev->y, ev->pha, ev->pi);
- }
- if( ebuf) free(ebuf);
- }
- /* close file */
- FunClose(fun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name="faq1.2"><b>How do I change the value of a single column in all events?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-#include &lt;stdlib.h&gt;
-#include &lt;funtools.h&gt;
-
-typedef struct evstruct{
- int pi;
-} *Ev, EvRec;
-
-int main(int argc, char **argv)
-{
- int i, got;
- int maxrow=1024;
- Ev ev, ebuf=NULL;
- Fun fun, ofun;
-
- /* sanity check */
- if( argc &lt; 3 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open input funtools file: %s\n", argv[1]);
- return 1;
- }
- /* open output file and inherit header params, columns, etc. from input */
- if( !(ofun=FunOpen(argv[2], "w", fun)) ){
- fprintf(stderr, "ERROR: can't open output funtools file: %s\n", argv[2]);
- return 1;
- }
- /* select columns to read (and data types to convert to) */
- /* use "merge=update" to change value while keeping original data type */
- /* use "merge=replace" to change boh the value and data type */
- got = FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "pi", "J", "rw", FUN_OFFSET(Ev, pi),
- NULL);
- /* read and process events */
- while( (ebuf=(void *)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) && got ){
- for(i=0; i&lt;got; i++){
- ev = (Ev)ebuf+i;
- ev->pi = ev->pi + 1;
- }
- /* write rows to output file */
- if( FunTableRowPut(ofun, ebuf, got, 0, NULL) != got ){
- fprintf(stderr, "ERROR: writing to funtools file: %s\n", argv[2]);
- return 1;
- }
- if( ebuf) free(ebuf);
- }
- /* close files */
- FunClose(ofun);
- FunClose(fun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name="faq1.3"><b>How do I process events based on the region each is in?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-#include &lt;stdlib.h&gt;
-#include &lt;funtools.h&gt;
-
-typedef struct evstruct{
- int x, y;
- int pi, pha;
- int region;
-} *Ev, EvRec;
-
-int main(int argc, char **argv)
-{
- int i, got;
- int maxrow=1024;
- Ev ev, ebuf=NULL;
- Fun fun;
-
- /* sanity check */
- if( argc &lt; 2 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- /* select columns to read (and data types to convert to) */
- /* specifying $REGION will retrieve the one-indexed region number */
- /* events passing the filter but not in a region will have value -1 */
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "x", "J", "r", FUN_OFFSET(Ev, x),
- "y", "J", "r", FUN_OFFSET(Ev, y),
- "pha", "J", "r", FUN_OFFSET(Ev, pha),
- "pi", "J", "r", FUN_OFFSET(Ev, pi),
- "$REGION", "J", "r", FUN_OFFSET(Ev, region),
- NULL);
- /* read and process events */
- while( (ebuf=(void *)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) && got ){
- for(i=0; i&lt;got; i++){
- ev = (Ev)ebuf+i;
- fprintf(stdout, "%4d %4d %3d %3d %4d\n",
- ev->x, ev->y, ev->pha, ev->pi, ev->region);
- }
- if( ebuf) free(ebuf);
- }
- /* close file */
- FunClose(fun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name="faq1.4"><b>How do I make a FITS event file from a non-FITS source (and add my own params)?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-#include &lt;stdlib.h&gt;
-#include &lt;funtools.h&gt;
-
-typedef struct evstruct{
- int x, y;
- int pha;
- float pi;
-} *Ev, EvRec;
-
-int main(int argc, char **argv)
-{
- int i, nev;
- int pmod=16, put=1;
- double pinc=0.1234;
- char xbuf[32], ybuf[32];
- Ev ev;
- Fun ofun;
-
- /* sanity check */
- if( argc &lt; 3 ) return 1;
- /* open new file for writing */
- if( !(ofun=FunOpen(argv[1], "w", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- if( (nev = atoi(argv[2])) <=0 ) return 1;
- ev = (Ev)calloc(1, sizeof(EvRec));
- /* The pair of numeric values specify the data value range, used to bin
- x, y into an image. They are permitted but not needed for pi and pha */
- sprintf(xbuf, "J:1:%d", nev);
- sprintf(ybuf, "J:1:%d", nev);
- /* select columns to write */
- FunColumnSelect(ofun, sizeof(EvRec), NULL,
- "x", xbuf, "w", FUN_OFFSET(Ev, x),
- "y", ybuf, "w", FUN_OFFSET(Ev, y),
- "pha", "J:1:16", "w", FUN_OFFSET(Ev, pha),
- "pi", "E", "w", FUN_OFFSET(Ev, pi),
- NULL);
- /* write params to header; generally added before first event is written */
- FunParamPuti(ofun, "PMOD", 0, pmod, "modulus for pha generation", 1);
- FunParamPutd(ofun, "PINC", 0, pinc, 7, "increment for pi generation", 1);
- /* make up events */
- for(i=1; i<=nev; i++){
- ev->x = i; ev->y = nev-i+1; ev->pha = i % pmod; ev->pi = ev->pha + pinc;
- /* write rows to output file -- this can be done in batches, of course */
- if( FunTableRowPut(ofun, ev, put, 0, NULL) != put ){
- fprintf(stderr, "ERROR: writing to funtools file: %s\n", argv[1]);
- return 1;
- }
- }
- if( ev) free(ev);
- /* close file */
- FunClose(ofun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name="faq2.1"><b>How do I process an image in double float format?</b></a>
-<P>
-<BLOCKQUOTE><CODE>
-<PRE>
-#include &lt;stdlib.h&gt;
-#include &lt;funtools.h&gt;
-
-int main(int argc, char **argv)
-{
- int i, j, dim1, dim2;
- double *buf;
- Fun fun;
-
- /* sanity check */
- if( argc &lt; 2 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- /* extract (and bin, if necessary) data into a double prec. image buffer */
- if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) ){
- fprintf(stderr, "ERROR: can't get image: %s\n", argv[1]);
- return 1;
- }
- /* get image dimensions after FunImageGet, in case an image section
- was specified on the command line, which changes image dimensions */
- FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* loop through image */
- for(i=0; i&lt;dim2; i++){
- for(j=0; j&lt;dim1; j++){
- fprintf(stdout, "%.1f ", buf[i*dim1+j]);
- }
- fprintf(stdout, "\n");
- }
- /* close file */
- FunClose(fun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li><a name="faq2.1"><b>How do I process an image in its native format?</b></a>
-<BLOCKQUOTE><CODE>
-<PRE>
-#include &lt;funtools.h&gt;
-
-int main(int argc, char **argv)
-{
- int i, j, bitpix, dim1, dim2;
- double *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- float *fbuf;
- double *dbuf;
- Fun fun;
-
- /* sanity check */
- if( argc &lt; 2 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- /* extract (and bin, if necessary) data into a buffer whose
- data type is not specified and therefore is that of the file */
- if( !(buf = FunImageGet(fun, NULL, NULL)) ){
- fprintf(stderr, "ERROR: can't get image: %s\n", argv[1]);
- return 1;
- }
- /* get image dimensions after FunImageGet, in case an image section
- was specified on the command line, which changes image dimensions */
- FunInfoGet(fun, FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* set appropriate data type buffer to point to image buffer */
- switch(bitpix){
- case 8: cbuf = (unsigned char *)buf; break;
- case 16: sbuf = (short *)buf; break;
- case 32: ibuf = (int *)buf; break;
- case -32: fbuf = (float *)buf; break;
- case -64: dbuf = (double *)buf; break;
- }
- /* loop through image */
- for(i=0; i&lt;dim2; i++){
- for(j=0; j&lt;dim1; j++){
- switch(bitpix){
- case 8: fprintf(stdout, "%4d ", cbuf[i*dim1+j]); break;
- case 16: fprintf(stdout, "%6d ", sbuf[i*dim1+j]); break;
- case 32: fprintf(stdout, "%9d ", ibuf[i*dim1+j]); break;
- case -32: fprintf(stdout, "%.2f ", fbuf[i*dim1+j]); break;
- case -64: fprintf(stdout, "%.6f ", dbuf[i*dim1+j]); break;
- }
- }
- fprintf(stdout, "\n");
- }
- /* close file */
- FunClose(fun);
- return 0;
-}
-</PRE>
-</CODE></BLOCKQUOTE>
-
-</ol>
diff --git a/funtools/faq/faq3.html b/funtools/faq/faq3.html
deleted file mode 100644
index e55a4d0..0000000
--- a/funtools/faq/faq3.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<html><head><title>Funtools FAQ: Programs</title></head>
-
-<ol>
-<li><a name=faq1"><b>What programs are available and what do they do?</b></a>
-<P>
-<ol>
-<LI>funcalc: funtools calculator (for binary tables)
-<LI>funcen: find centroid (for binary tables)
-<LI>funcnts: count photons in specified regions with background subtraction
-<LI>funcone: cone search on RA, Dec columns
-<LI>fundisp: display data in a funtools data file
-<LI>funhead: display a header in a funtools file
-<LI>funhist: create a 1D histogram of a column
-<LI>funimage: create a FITS image from a funtools data file
-<LI>funindex: create a index on a column in a binary table
-<LI>funjoin: join two or more FITS binary tables on specified columns
-<LI>funmerge: merge one or more funtools table files
-<LI>funsky: convert between image and sky coodinates, using WCS info from a FITS header
-<LI>funtable: copy selected rows from a funtools file to a FITS binary table
-<LI>funtbl: extract a table (obsolete)
-</ol>
-
-</ol>
diff --git a/funtools/faq/faq4.html b/funtools/faq/faq4.html
deleted file mode 100644
index 7e384a7..0000000
--- a/funtools/faq/faq4.html
+++ /dev/null
@@ -1,211 +0,0 @@
-<html><head><title>Funtools FAQ: Filtering</title></head>
-<p>
-NB: column filters work on tables only. Regions work on tables and images.
-
-<p>
-<ol>
-<li><a name="faq1"><b>Please show how to use column and regions filters</b></a>
-
-<p>
-<ol>
-<li> Filter events through a circular region using physical pixels
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,.5)]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region, for a single value of pha
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle 512 512 .5 && pha==5]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region, including a range of pha values
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,.5)&&pha=5:6]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 6 7 79493997.45854475 578 574
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region, excluding a range of pha values
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,.5)&&\!pha=5:6]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 8 9 79494575.58943175 579 573
- 512 512 8 9 79493432.00990875 579 573
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through two circular regions
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,.5); circle 500 500 .1]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 500 500 5 5 79493733.05197725 600 577
- 500 500 9 9 79488217.13936825 600 576
- 500 500 2 2 79487590.99904275 599 581
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region, selecting a single time value
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,.5)&&time==79493631.03866175]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 5 6 79493631.03866175 578 575
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region, selecting a single time value
-(but using feq to avoid possible precision problems)
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,.5)&&feq(time,79493631.03866175)]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 5 6 79493631.03866175 578 575
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region, while excluding an inner circle
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,1);-cir 512 512 .5]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 511 9 9 79492909.11908525 580 572
- 512 511 6 7 79492607.35239075 580 573
- 512 511 6 7 79493574.08603576 580 573
- 512 511 7 8 79488537.75487424 579 572
- 511 512 5 5 79488781.64644176 579 576
- 511 512 5 6 79492586.05470325 579 576
- 511 512 10 10 79494397.55842775 580 574
- 511 512 1 2 79493697.87522624 577 582
- 511 512 6 7 79493997.75123225 579 575
- 511 512 10 11 79487417.67703976 579 574
- 513 512 6 6 79493306.47509325 578 573
- 513 512 8 8 79487909.39373726 578 572
- 512 513 4 4 79487403.52010125 576 577
- 512 513 8 9 79492536.31151475 577 574
- 512 513 10 10 79492589.71195325 578 574
- 512 513 5 5 79488335.19512025 576 575
- 512 513 8 8 79493661.25728776 578 574
- 512 513 8 9 79487914.98186225 577 574
- 512 513 5 5 79487392.91247626 577 576
- 512 513 4 4 79492808.24789475 577 576
- 512 513 7 8 79493236.90765475 577 574
- 512 513 6 7 79493667.65710025 578 574
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region for a range of pha, while excluding an inner circle
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,1)&&pha=6:7;-cir 512 512 .5]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 511 6 7 79492607.35239075 580 573
- 512 511 6 7 79493574.08603576 580 573
- 512 511 7 8 79488537.75487424 579 572
- 511 512 6 7 79493997.75123225 579 575
- 513 512 6 6 79493306.47509325 578 573
- 512 513 7 8 79493236.90765475 577 574
- 512 513 6 7 79493667.65710025 578 574
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region for ranges of pha and pi, while excluding an inner circle
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[circle(512,512,1)&&pha=5:7 && pi=6:8;-cir 512 512 .5]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 511 6 7 79492607.35239075 580 573
- 512 511 6 7 79493574.08603576 580 573
- 512 511 7 8 79488537.75487424 579 572
- 511 512 5 6 79492586.05470325 579 576
- 511 512 6 7 79493997.75123225 579 575
- 513 512 6 6 79493306.47509325 578 573
- 512 513 7 8 79493236.90765475 577 574
- 512 513 6 7 79493667.65710025 578 574
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region in fk5 coords (degrees)
-<BLOCKQUOTE><CODE>
-<PRE>
-fundisp foo.fits'[fk5;circle(345.25391,58.879774,3.9999997")]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-</PRE>
-</CODE></BLOCKQUOTE>
-
-<li> Filter events through a circular region retrieved from ds9
-<BLOCKQUOTE><CODE>
-<PRE>
-cat foo.reg
-# Region file format: DS9 version 4.0
-# Filename: foo.fits'[EVENTS]'
-global color=green font="helvetica 10 normal" select=1 highlite=1 edit=1 move=1 delete=1 include=1 fixed=0 source
-fk5
-circle(345.25391,58.879774,3.9999997")
-
-fundisp foo.fits'[@foo.reg]'
-
- X Y PHA PI TIME DX DY
----- ---- --- --- --------------------- ---- ----
- 512 512 6 7 79493997.45854475 578 574
- 512 512 8 9 79494575.58943175 579 573
- 512 512 5 6 79493631.03866175 578 575
- 512 512 5 5 79493290.86521725 578 575
- 512 512 8 9 79493432.00990875 579 573
-
-</PRE>
-</CODE></BLOCKQUOTE>
-
-</ol>
-
-</ol>
diff --git a/funtools/faq/tdisp b/funtools/faq/tdisp
deleted file mode 100755
index e2ee633..0000000
--- a/funtools/faq/tdisp
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-if [ ! -r foo.fits ]; then
- ln -s $HOME/data/snr.ev foo.fits
-fi
-
-FUN_FORMAT='x=%4d y=%4d pha=%3d pi=%3d dx=%4d dy=%4d'
-export FUN_FORMAT
-
-echo fundisp foo.fits"'[$1]'" | tee foo.log
-echo " " | tee -a foo.log
-../fundisp foo.fits"[$1]" | tee -a foo.log
-
-
-
diff --git a/funtools/faq/tev.c b/funtools/faq/tev.c
deleted file mode 100644
index 9f9cf59..0000000
--- a/funtools/faq/tev.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <stdlib.h>
-#include <funtools.h>
-
-typedef struct evstruct{
- int x, y;
- int pha;
- float pi;
- int region;
-} *Ev, EvRec;
-
-int main(int argc, char **argv)
-{
- int i, nev;
- int pmod=16, put=1;
- double pinc=0.1234;
- char xbuf[32], ybuf[32];
- Ev ev;
- Fun ofun;
-
- /* sanity check */
- if( argc < 3 ) return 1;
- /* open new file for writing */
- if( !(ofun=FunOpen(argv[1], "w", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- if( (nev = atoi(argv[2])) <=0 ) return 1;
- ev = (Ev)calloc(1, sizeof(EvRec));
- /* The pair of numeric values specify the data value range, used to bin
- x, y into an image. They are permitted but not needed for pi and pha */
- sprintf(xbuf, "J:1:%d", nev);
- sprintf(ybuf, "J:1:%d", nev);
- /* select columns to write */
- FunColumnSelect(ofun, sizeof(EvRec), NULL,
- "x", xbuf, "w", FUN_OFFSET(Ev, x),
- "y", ybuf, "w", FUN_OFFSET(Ev, y),
- "pha", "J:1:16", "w", FUN_OFFSET(Ev, pha),
- "pi", "E", "w", FUN_OFFSET(Ev, pi),
- NULL);
- /* write params to header; generally added before first event is written */
- FunParamPuti(ofun, "PMOD", 0, pmod, "modulus for pha generation", 1);
- FunParamPutd(ofun, "PINC", 0, pinc, 7, "increment for pi generation", 1);
- /* make up events */
- for(i=1; i<=nev; i++){
- ev->x = i; ev->y = nev-i+1; ev->pha = i % pmod; ev->pi = ev->pha + pinc;
- /* write rows to output file -- this can be done in batches, of course */
- if( FunTableRowPut(ofun, ev, put, 0, NULL) != put ){
- fprintf(stderr, "ERROR: writing to funtools file: %s\n", argv[1]);
- return 1;
- }
- }
- if( ev) free(ev);
- /* close file */
- FunClose(ofun);
- return 0;
-}
diff --git a/funtools/faq/tfaq.c b/funtools/faq/tfaq.c
deleted file mode 100644
index 8913f44..0000000
--- a/funtools/faq/tfaq.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <funtools.h>
-
-typedef struct evstruct{
- int pi;
-} *Ev, EvRec;
-
-int main(int argc, char **argv)
-{
- int i, got;
- int maxrow=1024;
- Ev ev, ebuf=NULL;
- Fun fun, ofun;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open input funtools file: %s\n", argv[1]);
- return 1;
- }
- if( !(ofun=FunOpen(argv[2], "w", fun)) ){
- fprintf(stderr, "ERROR: can't open output funtools file: %s\n", argv[2]);
- return 1;
- }
- /* select columns to read (and data types to convert to) */
- got = FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "pi", "J", "rw", FUN_OFFSET(Ev, pi),
- NULL);
- /* read and process events */
- while(ebuf=(void *)FunTableRowGet(fun, NULL, maxrow, NULL, &got) ){
- for(i=0; i<got; i++){
- ev = (Ev)ebuf+i;
- ev->pi = ev->pi + 1;
- }
- if( FunTableRowPut(ofun, ebuf, got, 0, NULL) != got ){
- fprintf(stderr, "ERROR: writing to funtools file: %s\n", argv[2]);
- return 1;
- }
- if( ebuf) free(ebuf);
- }
- /* close files */
- FunClose(ofun);
- FunClose(fun);
-}
diff --git a/funtools/faq/tim.c b/funtools/faq/tim.c
deleted file mode 100644
index 5b0aa98..0000000
--- a/funtools/faq/tim.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <funtools.h>
-
-int main(int argc, char **argv)
-{
- int i, j, bitpix, dim1, dim2;
- double *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- float *fbuf;
- double *dbuf;
- Fun fun;
-
- /* sanity check */
- if( argc < 2 ) return 1;
- /* open file for reading */
- if( !(fun=FunOpen(argv[1], "r", NULL)) ){
- fprintf(stderr, "ERROR: can't open funtools file: %s\n", argv[1]);
- return 1;
- }
- /* extract (and bin, if necessary) data into a double prec. image buffer */
- /* data type is not specified and therefore is that of the file */
- if( !(buf = FunImageGet(fun, NULL, NULL)) ){
- fprintf(stderr, "ERROR: can't get image: %s\n", argv[1]);
- return 1;
- }
- /* get image dimensions after FunImageGet, in case an image section
- was specified on the command line, which changes image dimensions */
- FunInfoGet(fun, FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- /* set appropriate data type buffer to point to image buffer */
- switch(bitpix){
- case 8: cbuf = (unsigned char *)buf; break;
- case 16: sbuf = (short *)buf; break;
- case 32: ibuf = (int *)buf; break;
- case -32: fbuf = (float *)buf; break;
- case -64: dbuf = (double *)buf; break;
- }
- /* loop through image */
- for(i=0; i<dim2; i++){
- for(j=0; j<dim1; j++){
- switch(bitpix){
- case 8: fprintf(stdout, "%4d ", cbuf[i*dim1+j]); break;
- case 16: fprintf(stdout, "%6d ", sbuf[i*dim1+j]); break;
- case 32: fprintf(stdout, "%9d ", ibuf[i*dim1+j]); break;
- case -32: fprintf(stdout, "%.2f ", fbuf[i*dim1+j]); break;
- case -64: fprintf(stdout, "%.6f ", dbuf[i*dim1+j]); break;
- }
- }
- fprintf(stdout, "\n");
- }
- /* close file */
- FunClose(fun);
- return 0;
-}
diff --git a/funtools/filter/Imakefile b/funtools/filter/Imakefile
deleted file mode 100644
index a1aa8c7..0000000
--- a/funtools/filter/Imakefile
+++ /dev/null
@@ -1,18 +0,0 @@
-XCOMM #########################################################################
-XCOMM
-XCOMM Fake Imakefile for xpa for use in saord
-XCOMM Its only necessary to have the Makefiles target
-XCOMM
-XCOMM #########################################################################
-
-Makefiles::
- @(x=""; \
- for i in $(CC); do \
- if [ "$$i" = "gcc" ] ; then \
- echo "X uses gcc ... and so shall we"; \
- x="--enable-gcc"; \
- fi; \
- done; \
- rm -f config.cache; \
- ./configure --enable-saord --prefix=$(TOP) --exec-prefix=$(TOP) --with-alt-libdir=$(TOP)/lib $$x)
-
diff --git a/funtools/filter/Makefile.in b/funtools/filter/Makefile.in
deleted file mode 100644
index 6b625f1..0000000
--- a/funtools/filter/Makefile.in
+++ /dev/null
@@ -1,282 +0,0 @@
-#
-# This file is a Makefile for Filter. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-# Current FILT version; used in various names.
-PACKAGE = @PACKAGE_NAME@
-VERSION = @PACKAGE_VERSION@
-
-DISTNAME = filter-${VERSION}
-DISTDIR = ../export/${DISTNAME}
-FTPDIR = ../ftp
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# Directory in which to install the .a, .so, and .o files:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the programs:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the include files:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
-
-# util files are in the util directory at same level
-UTIL_INC = -I../util
-#UTIL_LIBS = -L../util -lutil
-
-# fitsy files are in the fitsy directory at same level
-FITSY_INC = -I../fitsy
-#FITSY_LIBS = -L../fitsy
-
-# wcs files are in the wcs subdirectory
-WCS_INC = -I../wcs
-#WCS_LIBS = -L../wcs -lwcs
-
-# extra includes for compiling
-INCLUDES = $(UTIL_INC) $(FITSY_INC) $(WCS_INC)
-
-# extra libs
-EXTRA_LIBS = -L.. -lfuntools @EXTRA_LIBS@
-
-# the full set of libraries for linking
-LIBS = $(WCS_LIBS) $(FITSY_LIBS) $(EXTRA_LIBS) -lm
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# whether to set the FPU in double round mode
-FPU_DOUBLE = @USE_FPU_DOUBLE@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# special definitions for filtering
-OBJPATH = \"$(LIB_INSTALL_DIR):.\"
-FILTER_CC = @FILTER_CC@
-FILTER_CFLAGS = @FILTER_CFLAGS@
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = ./install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = -I. ${CFLAGS} ${CPPFLAGS} -DFILT_VERSION="\"$(VERSION)\"" @USE_DL@ \
- ${INCLUDES} ${AC_FLAGS}
-
-DEPEND_SWITCHES = -I. ${CFLAGS} -I. ${INCLUDES} ${AC_FLAGS}
-
-SRCS = evregions.c filter.c filtprog.c filtprog_c.c \
- imregions.c symbols.c lex.filt.c column.c dl.c tl.c \
- lex.idx.c idx.tab.c idxacts.c
-
-OBJS = evregions.o filter.o filtprog.o filtprog_c.o \
- imregions.o symbols.o lex.filt.o column.o dl.o tl.o \
- lex.idx.o idx.tab.o idxacts.o
-
-# these are all the modules going into the "normal" filt library
-LIBOBJS = ${OBJS}
-
-# the default library for this package
-DEFLIB = @DEFLIB@
-# the actual library we are building (if this is a subpackage)
-LIB = @LIB@
-
-TESTPROGS = tfilt
-
-all: $(LIB) $(PROGS)
-
-testall: $(TESTPROGS)
-
-All: all testall
-
-install: install-binaries
-
-$(LIB): $(LIBOBJS)
- ar cruv $(LIB) $(LIBOBJS)
- $(RANLIB) $(LIB)
-
-tfilt: $(LIB) tfilt.o
- $(CC) $(LDFLAGS) tfilt.o -o tfilt $(LIB) ${LIBS}
-
-# Note: before running ranlib below, must cd to target directory because
-# some ranlibs write to current directory, and this might not always be
-# possible (e.g. if installing as root).
-
-install-binaries: $(LIB) $(PROGS)
- @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @if [ "$(LIB)" = "$(DEFLIB)" ] ; then \
- XLIB=`basename $(LIB)`; \
- echo "Installing $$XLIB"; \
- $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \
- (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \
- chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \
- fi;
-# @for i in imregions.o evregions.o ; \
-# do \
-# if [ -f $$i ] ; then \
-# echo "Installing $$i" ; \
-# $(INSTALL_DATA) $$i $(LIB_INSTALL_DIR)/$$i ; \
-# fi; \
-# done;
- @for i in filter.h column.h dl.h tl.h idx.h; \
- do \
- if [ -f $$i ] ; then \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/$$i ; \
- fi; \
- done;
-
-Makefile: Makefile.in
- $(SHELL) config.status
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak \
- config.info config.log \
- doc/*~
- $(RM) -r autom4te.cache
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-.c.o:
- $(CC) -c $(CC_SWITCHES) $<
-
-filtprog_c.o: filtprog_c.c regions_h.h xalloc_c.h swap_c.h \
- events_c.h image_c.h evregions_c.h imregions_c.h filter.h
- $(CC) -c $(CC_SWITCHES) -DOBJPATH="$(OBJPATH)" \
- -DFILTER_CC="$(FILTER_CC)" -DFILTER_CFLAGS="$(FILTER_CFLAGS)" \
- filtprog_c.c
-
-# header and source include files for program generation
-regions_h.h: regions.h inc.sed
- $(RM) regions_h.h
- ./inc.sed REGIONS_H < regions.h > regions_h.h
-
-xalloc_c.h: ../util/xalloc.c inc.sed
- $(RM) xalloc_c.h
- ./inc.sed XALLOC_C < ../util/xalloc.c > xalloc_c.h
-
-swap_c.h: swap.c inc.sed
- $(RM) swap_c.h
- ./inc.sed SWAP_C < swap.c > swap_c.h
-
-events_c.h: evfilter.c inc.sed
- $(RM) events_c.h
- ./inc.sed EVENTS_C < evfilter.c > events_c.h
-
-image_c.h: imfilter.c inc.sed
- $(RM) image_c.h
- ./inc.sed IMAGE_C < imfilter.c > image_c.h
-
-evregions.c: evregions_c.tmpl Makefile
- $(RM) evregions.c
- sed 's/_FPUDBL_/$(FPU_DOUBLE)/' < evregions_c.tmpl > evregions.c
-
-imregions.c: imregions_c.tmpl Makefile
- $(RM) imregions.c
- sed 's/_FPUDBL_/$(FPU_DOUBLE)/' < imregions_c.tmpl > imregions.c
-
-evregions_c.h: evregions.c inc.sed
- $(RM) evregions_c.h
- ./inc.sed EVREGIONS_C < evregions.c > evregions_c.h
-
-imregions_c.h: imregions.c inc.sed
- $(RM) imregions_c.h
- ./inc.sed IMREGIONS_C < imregions.c > imregions_c.h
-
-headers: regions_h.h xalloc_c.h swap_c.h \
- events_c.h image_c.h evregions_c.h imregions_c.h
-
-# remake the parser
-LEX = flex -i
-parser: filt.l
- @($(LEX) -Pfilt filt.l; \
- sed "s/yytext_ptr/filttext_ptr/g" < lex.filt.c > nlex.filt.c; \
- mv nlex.filt.c lex.filt.c)
-
-iparser: idx.l
- @($(LEX) -Pidx idx.l; \
- sed "s/yytext_ptr/idxtext_ptr/g" < lex.idx.c > nlex.idx.c; \
- mv nlex.idx.c lex.idx.c)
-
-YACC = bison -d -v
-igrammar: idx.y
- $(YACC) -p idx idx.y
-
-pure: tfilt.pure
-
-tfilt.pure: $(FILDLIB) tfilt.o
- purify $(CC) $(LDFLAGS) tfilt.o -o tfilt.pure \
- $(LIB) $(LIBS)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/filter/ZHTODO b/funtools/filter/ZHTODO
deleted file mode 100644
index 6dce830..0000000
--- a/funtools/filter/ZHTODO
+++ /dev/null
@@ -1,4 +0,0 @@
-1. segments should be full statements
-2. reverse order of segments
-3. excludes are not moved to the end
-4. allow specification of region id
diff --git a/funtools/filter/ac_c_long_long.m4 b/funtools/filter/ac_c_long_long.m4
deleted file mode 100644
index fb6df1e..0000000
--- a/funtools/filter/ac_c_long_long.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-##### http://autoconf-archive.cryp.to/ac_c_long_long.html
-#
-# SYNOPSIS
-#
-# AC_C_LONG_LONG
-#
-# DESCRIPTION
-#
-# Provides a test for the existance of the long long int type and
-# defines HAVE_LONG_LONG if it is found.
-#
-# LAST MODIFICATION
-#
-# 2006-10-30
-#
-# COPYLEFT
-#
-# Copyright (c) 2006 Caolan McNamara <caolan@skynet.ie>
-#
-# Copying and distribution of this file, with or without
-# modification, are permitted in any medium without royalty provided
-# the copyright notice and this notice are preserved.
-
-AC_DEFUN([AC_C_LONG_LONG],
-[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
-[if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- AC_TRY_COMPILE(,[long long int i;],
- ac_cv_c_long_long=yes,
- ac_cv_c_long_long=no)
- fi])
- if test $ac_cv_c_long_long = yes; then
- AC_DEFINE(HAVE_LONG_LONG, 1, [compiler understands long long])
- fi
-])
diff --git a/funtools/filter/aclocal.m4 b/funtools/filter/aclocal.m4
deleted file mode 100644
index 65f68be..0000000
--- a/funtools/filter/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-builtin(include,ac_c_long_long.m4)
diff --git a/funtools/filter/addld b/funtools/filter/addld
deleted file mode 100644
index 5591871..0000000
--- a/funtools/filter/addld
+++ /dev/null
@@ -1 +0,0 @@
-setenv LD_LIBRARY_PATH "..:${LD_LIBRARY_PATH}"
diff --git a/funtools/filter/column.c b/funtools/filter/column.c
deleted file mode 100644
index a1ad027..0000000
--- a/funtools/filter/column.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-#include <column.h>
-
-#ifdef ANSI_FUNC
-void
-ColumnLoad(char *ibuf, int size, int n, int convert, void *obuf)
-#else
-void ColumnLoad(ibuf, size, n, convert, obuf)
- char *ibuf;
- int size;
- int n;
- int convert;
- void *obuf;
-#endif
-{
- register char *iptr;
- register char *optr;
- int i, j;
-
- if( convert ){
- optr = (char *)obuf;
- iptr = (char *)ibuf;
- for(i=0; i<n; i++){
- for(j=size-1; j>=0; j--){
- *optr++ = *(iptr+j);
- }
- iptr += size;
- }
- }
- else{
- memcpy(obuf, ibuf, n*size);
- }
-}
-
diff --git a/funtools/filter/column.h b/funtools/filter/column.h
deleted file mode 100644
index ffe9b0f..0000000
--- a/funtools/filter/column.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * column.h -- declarations for column processing
- *
- */
-
-#ifndef __column_h
-#define __column_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include "prsetup.h"
-_PRbeg
-
-void ColumnLoad _PRx((char *ibuf, int size, int n, int convert, void *obuf));
-
-_PRend
-
-#endif
diff --git a/funtools/filter/compat/install-sh b/funtools/filter/compat/install-sh
deleted file mode 100755
index ab74c88..0000000
--- a/funtools/filter/compat/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/funtools/filter/conf.h.in b/funtools/filter/conf.h.in
deleted file mode 100644
index 12c728f..0000000
--- a/funtools/filter/conf.h.in
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Define as 1 if this compiler supports long long. */
-#undef HAVE_LONG_LONG
-
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
-
-/* Define if you have inline */
-#undef inline
diff --git a/funtools/filter/config.guess b/funtools/filter/config.guess
deleted file mode 100644
index 44290b8..0000000
--- a/funtools/filter/config.guess
+++ /dev/null
@@ -1,1435 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-23'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches to <config-patches@gnu.org>.
-
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
- echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine=${arch}${endian}-unknown
- ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
- earm*)
- expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
- ;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
- x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
-esac
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/filter/config.sub b/funtools/filter/config.sub
deleted file mode 100644
index bc855a2..0000000
--- a/funtools/filter/config.sub
+++ /dev/null
@@ -1,1807 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-22'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- moxiebox)
- basic_machine=moxie-unknown
- os=-moxiebox
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
- ;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/filter/configure-failsafe b/funtools/filter/configure-failsafe
deleted file mode 100755
index 2017281..0000000
--- a/funtools/filter/configure-failsafe
+++ /dev/null
@@ -1,6399 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for filter 1.1.
-#
-# Report bugs to <saord@cfa.harvard.edu>.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME='filter'
-PACKAGE_TARNAME='filter'
-PACKAGE_VERSION='1.1'
-PACKAGE_STRING='filter 1.1'
-PACKAGE_BUGREPORT='saord@cfa.harvard.edu'
-
-ac_unique_file="./filter.h"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP FILTER_CC FILTER_CFLAGS LIB DEFLIB DOSHARED LLIB USE_FPU_DOUBLE USE_DL EXTRA_LIBS EXTRA_OBJS LIBOBJS LTLIBOBJS'
-ac_subst_files=''
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-ac_prev=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures filter 1.1 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
- cat <<_ACEOF
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of filter 1.1:";;
- esac
- cat <<\_ACEOF
-
-Optional Features:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-shared build shared libraries
- --enable-dl allow use of dynamic loading if available
- --enable-fpu_double set FPU in double round mode
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-filter-cc=CC compiler
- --with-filter-cflags=CFLAGS compiler flags
- --with-altlib=LIB library name
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <saord@cfa.harvard.edu>.
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
- else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
- done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
- cat <<\_ACEOF
-filter configure 1.1
-generated by GNU Autoconf 2.59
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by filter $as_me 1.1, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-{
- (set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
- *)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-}
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- sed "/^$/d" confdefs.h | sort
- echo
- fi
- test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
- ' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
- esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ac_config_headers="$ac_config_headers conf.h"
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f $ac_dir/shtool; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
- { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
- ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
- { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
- ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-
-#
-# checks that we use in most projects
-#
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CC" && break
-done
-
- CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-
-echo "$as_me:$LINENO: checking for long long int" >&5
-echo $ECHO_N "checking for long long int... $ECHO_C" >&6
-if test "${ac_cv_c_long_long+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-long long int i;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_long_long=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_long_long=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5
-echo "${ECHO_T}$ac_cv_c_long_long" >&6
- if test $ac_cv_c_long_long = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
- fi
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- RANLIB=$ac_ct_RANLIB
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in malloc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in getopt.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in values.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/un.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/mman.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/ipc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
-
-for ac_header in sys/shm.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
- ;;
-esac
-
-echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
-if test "${ac_cv_type_socklen_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/socket.h>
-
-int
-main ()
-{
-if ((socklen_t *) 0)
- return 0;
-if (sizeof (socklen_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_socklen_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_socklen_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
-if test $ac_cv_type_socklen_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SOCKLEN_T 1
-_ACEOF
-
-
-fi
-
-
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- }
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_const=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_const=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-
-fi
-
-
-
-
-
-for ac_func in strchr memcpy snprintf
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
-if test "${ac_cv_func_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define connect to an innocuous variant, in case <limits.h> declares connect.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define connect innocuous_connect
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef connect
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != connect;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
-
-if test $ac_cv_func_connect = no; then
- echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-int
-main ()
-{
-connect ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_socket_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_socket_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-if test $ac_cv_lib_socket_connect = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lsocket"
-fi
-
-fi
-echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-if test "${ac_cv_func_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define gethostbyname innocuous_gethostbyname
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef gethostbyname
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != gethostbyname;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
-
-if test $ac_cv_func_gethostbyname = no; then
- echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-int
-main ()
-{
-gethostbyname ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_nsl_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lnsl"
-fi
-
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_inline=$ac_kw; break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-
-
-case $ac_cv_c_inline in
- inline | yes) ;;
- *)
- case $ac_cv_c_inline in
- no) ac_val=;;
- *) ac_val=$ac_cv_c_inline;;
- esac
- cat >>confdefs.h <<_ACEOF
-#ifndef __cplusplus
-#define inline $ac_val
-#endif
-_ACEOF
- ;;
-esac
-
-
-echo "$as_me:$LINENO: checking for filter cc" >&5
-echo $ECHO_N "checking for filter cc... $ECHO_C" >&6
-
-# Check whether --with-filter-cc or --without-filter-cc was given.
-if test "${with_filter_cc+set}" = set; then
- withval="$with_filter_cc"
- FILTER_CC=\\\"$withval\\\"
-else
- FILTER_CC=NULL
-fi;
-echo "$as_me:$LINENO: result: $FILTER_CC" >&5
-echo "${ECHO_T}$FILTER_CC" >&6
-
-
-echo "$as_me:$LINENO: checking for filter cflags" >&5
-echo $ECHO_N "checking for filter cflags... $ECHO_C" >&6
-
-# Check whether --with-filter-cflags or --without-filter-cflags was given.
-if test "${with_filter_cflags+set}" = set; then
- withval="$with_filter_cflags"
- FILTER_CFLAGS=\\\"$withval\\\"
-else
- FILTER_CFLAGS=NULL
-fi;
-echo "$as_me:$LINENO: result: $FILTER_CFLAGS" >&5
-echo "${ECHO_T}$FILTER_CFLAGS" >&6
-
-
-DEFLIB="libfilter.a"
-echo "$as_me:$LINENO: checking for alternate target library" >&5
-echo $ECHO_N "checking for alternate target library... $ECHO_C" >&6
-
-# Check whether --with-altlib or --without-altlib was given.
-if test "${with_altlib+set}" = set; then
- withval="$with_altlib"
- alt_lib=yes LIB=$withval
-else
- alt_lib=no LIB=$DEFLIB
-fi;
-echo "$as_me:$LINENO: result: $alt_lib ($LIB)" >&5
-echo "${ECHO_T}$alt_lib ($LIB)" >&6
-
-
-
-echo "$as_me:$LINENO: checking for shared library build" >&5
-echo $ECHO_N "checking for shared library build... $ECHO_C" >&6
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
-
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-
-# Check whether --enable-dl or --disable-dl was given.
-if test "${enable_dl+set}" = set; then
- enableval="$enable_dl"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-echo "$as_me:$LINENO: checking for dynamic loading (with gcc) " >&5
-echo $ECHO_N "checking for dynamic loading (with gcc) ... $ECHO_C" >&6
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- echo "$as_me:$LINENO: checking for dlopen in -lc" >&5
-echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6
-if test $ac_cv_lib_c_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-echo "$as_me:$LINENO: result: $using_dl ($CC)" >&5
-echo "${ECHO_T}$using_dl ($CC)" >&6
-fi
-
-# Check whether --enable-fpu_double or --disable-fpu_double was given.
-if test "${enable_fpu_double+set}" = set; then
- enableval="$enable_fpu_double"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-echo "$as_me:$LINENO: checking for setting fpu in double rounding mode (with gcc) " >&5
-echo $ECHO_N "checking for setting fpu in double rounding mode (with gcc) ... $ECHO_C" >&6
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_fpu_double="yes"
- USE_FPU_DOUBLE="1"
-else
- using_fpu_double="no"
- USE_FPU_DOUBLE="0"
-fi
-echo "$as_me:$LINENO: result: $using_fpu_double" >&5
-echo "${ECHO_T}$using_fpu_double" >&6
-else
- USE_FPU_DOUBLE="0"
-fi
-
-
-echo "$as_me:$LINENO: checking $host_os configuration" >&5
-echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CYGWIN
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging Cygwin" >&5
-echo "${ECHO_T}flagging Cygwin" >&6
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MINGW32
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging MinGW" >&5
-echo "${ECHO_T}flagging MinGW" >&6
- ;;
- *osf*|*Osf*)
- echo "$as_me:$LINENO: checking for snprintf in -ldb" >&5
-echo $ECHO_N "checking for snprintf in -ldb... $ECHO_C" >&6
-if test "${ac_cv_lib_db_snprintf+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldb $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char snprintf ();
-int
-main ()
-{
-snprintf ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_db_snprintf=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_db_snprintf=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_db_snprintf" >&5
-echo "${ECHO_T}$ac_cv_lib_db_snprintf" >&6
-if test $ac_cv_lib_db_snprintf = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -ldb"
-fi
-
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fno-common, -fPIC to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common, -fPIC to CFLAGS" >&6
- else
- echo "$as_me:$LINENO: result: adding -fno-common to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common to CFLAGS" >&6
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fPIC to gcc" >&5
-echo "${ECHO_T}adding -fPIC to gcc" >&6
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- ;;
-esac
-
-
-
-
-
-
- ac_config_files="$ac_config_files Makefile"
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by filter $as_me 1.1, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-filter config.status 1.1
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-
-
-
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@FILTER_CC@,$FILTER_CC,;t t
-s,@FILTER_CFLAGS@,$FILTER_CFLAGS,;t t
-s,@LIB@,$LIB,;t t
-s,@DEFLIB@,$DEFLIB,;t t
-s,@DOSHARED@,$DOSHARED,;t t
-s,@LLIB@,$LLIB,;t t
-s,@USE_FPU_DOUBLE@,$USE_FPU_DOUBLE,;t t
-s,@USE_DL@,$USE_DL,;t t
-s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t
-s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- # Do quote $f, to prevent DOS paths from being IFS'd.
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
- rm -f conftest.defines
- mv conftest.tail conftest.defines
-done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
-
-cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
- if test x"$ac_file" != x-; then
- if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
- { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
- else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- rm -f $ac_file
- mv $tmp/config.h $ac_file
- fi
- else
- cat $tmp/config.h
- rm -f $tmp/config.h
- fi
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-
diff --git a/funtools/filter/configure.ac b/funtools/filter/configure.ac
deleted file mode 100644
index ae2a3db..0000000
--- a/funtools/filter/configure.ac
+++ /dev/null
@@ -1,202 +0,0 @@
-# This file is an input file used by the GNU "autoconf" program to
-# generate the file "configure", which is run during XPA installation
-# to configure the system for the local environment.
-AC_INIT(filter, 1.1, saord@cfa.harvard.edu, filter)
-
-AC_CONFIG_HEADERS([conf.h])
-AC_CONFIG_SRCDIR(./filter.h)
-AC_CANONICAL_HOST
-
-#
-# checks that we use in most projects
-#
-AC_PROG_CC
-
-AC_EXEEXT
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-AC_C_LONG_LONG
-
-AC_PROG_RANLIB
-
-AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(getopt.h)
-AC_CHECK_HEADERS(values.h)
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_HEADERS(sys/un.h)
-AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_HEADERS(sys/ipc.h)
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
- AC_CHECK_HEADERS(sys/shm.h)
- ;;
-esac
-
-AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])
-
-AC_C_CONST
-
-AC_CHECK_FUNCS(strchr memcpy snprintf)
-
-AC_CHECK_FUNC(connect)
-if test $ac_cv_func_connect = no; then
- AC_CHECK_LIB(socket, connect, EXTRA_LIBS="$EXTRA_LIBS -lsocket")
-fi
-AC_CHECK_FUNC(gethostbyname)
-if test $ac_cv_func_gethostbyname = no; then
- AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-AC_C_INLINE
-
-AC_MSG_CHECKING(for filter cc)
-AC_ARG_WITH(filter-cc, [ --with-filter-cc=CC compiler],
- FILTER_CC=\\\"$withval\\\", FILTER_CC=NULL)
-AC_MSG_RESULT($FILTER_CC)
-AC_SUBST(FILTER_CC)
-
-AC_MSG_CHECKING(for filter cflags)
-AC_ARG_WITH(filter-cflags, [ --with-filter-cflags=CFLAGS compiler flags],
- FILTER_CFLAGS=\\\"$withval\\\", FILTER_CFLAGS=NULL)
-AC_MSG_RESULT($FILTER_CFLAGS)
-AC_SUBST(FILTER_CFLAGS)
-
-DEFLIB="libfilter.a"
-AC_MSG_CHECKING(for alternate target library)
-AC_ARG_WITH(altlib, [ --with-altlib=LIB library name],
- alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB)
-AC_MSG_RESULT($alt_lib ($LIB))
-AC_SUBST(LIB)
-AC_SUBST(DEFLIB)
-
-AC_MSG_CHECKING(for shared library build)
-AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
- AC_SUBST(DOSHARED)
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-AC_SUBST(LLIB)
-AC_MSG_RESULT($fun_ok)
-
-AC_ARG_ENABLE(dl, [ --enable-dl allow use of dynamic loading if available],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-AC_MSG_CHECKING([for dynamic loading (with gcc) ])
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-AC_MSG_RESULT([$using_dl ($CC)])
-fi
-
-AC_ARG_ENABLE(fpu_double, [ --enable-fpu_double set FPU in double round mode],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-AC_MSG_CHECKING([for setting fpu in double rounding mode (with gcc) ])
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_fpu_double="yes"
- USE_FPU_DOUBLE="1"
-else
- using_fpu_double="no"
- USE_FPU_DOUBLE="0"
-fi
-AC_MSG_RESULT([$using_fpu_double])
-else
- USE_FPU_DOUBLE="0"
-fi
-AC_SUBST(USE_FPU_DOUBLE)
-
-AC_MSG_CHECKING([$host_os configuration])
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
- AC_DEFINE([HAVE_CYGWIN])
- AC_MSG_RESULT(flagging Cygwin)
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
- AC_DEFINE([HAVE_MINGW32])
- AC_MSG_RESULT(flagging MinGW)
- ;;
- *osf*|*Osf*)
- AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT([adding -fno-common, -fPIC to CFLAGS])
- else
- AC_MSG_RESULT([adding -fno-common to CFLAGS])
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT(adding -fPIC to gcc)
- else
- AC_MSG_RESULT(none)
- fi
- else
- AC_MSG_RESULT(none)
- fi
- ;;
-esac
-
-AC_SUBST(USE_DL)
-
-AC_SUBST(EXTRA_LIBS)
-AC_SUBST(EXTRA_OBJS)
-
-AC_CONFIG_FILES(Makefile)
-
-AC_OUTPUT
diff --git a/funtools/filter/dl.c b/funtools/filter/dl.c
deleted file mode 100644
index 8e914f2..0000000
--- a/funtools/filter/dl.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifdef USE_DL
-
-#include <stdio.h>
-#include <dl.h>
-#include <gio.h>
-#include <prsetup.h>
-
-int have_dl = 1;
-
-#ifdef ANSI_FUNC
-void *
-DLOpen(char *name)
-#else
-void *DLOpen(name)
- char *name;
-#endif
-{
- void *d;
- if( !(d=dlopen(name, RTLD_LAZY)) )
- gerror(stderr, "%s\n", dlerror());
- return d;
-}
-
-#ifdef ANSI_FUNC
-void *
-DLSym(void *dl, char *name)
-#else
-void *DLSym(dl, name)
- void *dl;
- char *name;
-#endif
-{
- void *d;
- if( !(d=dlsym(dl, name)) )
- gerror(stderr, "%s\n", dlerror());
- return d;
-}
-
-#ifdef ANSI_FUNC
-int
-DLClose(void *dl)
-#else
-int DLClose(dl)
- void *dl;
-#endif
-{
- if( dl )
- return dlclose(dl);
- else
- return -1;
-}
-
-#else
-
-int have_dl = 0;
-
-#endif
diff --git a/funtools/filter/dl.h b/funtools/filter/dl.h
deleted file mode 100644
index e3f1b09..0000000
--- a/funtools/filter/dl.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __dl_h
-#define __dl_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include "prsetup.h"
-
-_PRbeg
-
-void *DLOpen _PRx((char *name));
-void *DLSym _PRx((void *dl, char *name));
-int DLClose _PRx((void *dl));
-
-
-_PRend
-
-#endif
diff --git a/funtools/filter/events_c.h b/funtools/filter/events_c.h
deleted file mode 100644
index 74f180e..0000000
--- a/funtools/filter/events_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *EVENTS_C="\n\n#ifdef TEST\n#include <math.h>\n#define EVFILTRTN _FilterEvents\n#define NSHAPE 1\n#define NREGION 1\n#define _X_ X\n#define _Y_ Y\n#define FILTER ((circle(g,1,1,1,_X_,_Y_,1,2,3)))\n#define EVSIZE 4\n#define X *((short *)(eptr+0))\n#define Y *((short *)(eptr+2))\n#include \"regions.h\"\n#endif\n\nstatic char __abuf[EVSIZE+1];\nstatic char *acopy(void *s, int n)\n{\n memset(__abuf, 0, n+1);\n memmove(__abuf, s, n);\n return __abuf;\n}\n\nvoid *EVFILTRTN(void *tg, char *ebuf, int ne, int esize, int *rbuf)\n{\n int i, j;\n int *rptr;\n char *eptr;\n Scan scan, tscan;\n GFilt g = (GFilt)tg;\n\n \n \n eptr = ebuf;\n\n if( !g ){\n g = (GFilt)calloc(1, sizeof(GFiltRec));\n#if NSHAPE\n \n g->nshapes = NSHAPE;\n g->maxshapes = (NSHAPE*(XSNO+1))+1;\n g->shapes = (Shape)calloc(g->maxshapes, sizeof(ShapeRec));\n#endif\n#ifdef EVSECT\n \n g->evsect = EVSECT;\n sscanf(g->evsect, \"%d %d %d %d %d\",\n &g->xmin, &g->xmax, &g->ymin, &g->ymax, &g->block);\n \n g->x0 = 1;\n g->y0 = 1;\n g->x1 = (g->xmax-g->xmin)/g->block+1;\n g->y1 = (g->ymax-g->ymin)/g->block+1;\n \n g->ybuf = (int *)calloc(g->y1+1, sizeof(int));\n g->x0s = (int *)calloc(g->y1+1, sizeof(int));\n g->x1s = (int *)calloc(g->y1+1, sizeof(int));\n \n for(i=0; i<=g->y1; i++) g->x0s[i] = g->x0;\n for(i=0; i<=g->y1; i++) g->x1s[i] = g->x1;\n \n if( NMASK ){\n g->nmask = NMASK; \n g->maskdim = MASKDIM;\n g->masks = _masks;\n }\n \n#if DO_FILTER_SWAP\n memset(_swf, 0, EVSIZE);\n#endif\n if( eptr ) FINIT;\n \n g->tlminx = TLMINX;\n g->tlminy = TLMINY;\n g->usebinsiz = USEBINSIZ;\n if( BINSIZX > 0.0 )\n g->binsizx = BINSIZX;\n else\n g->binsizx = 1.0;\n if( BINSIZY > 0.0 )\n g->binsizy = BINSIZY;\n else\n g->binsizy = 1.0;\n g->tloff = TLOFF;\n#endif\n }\n\n \n if( !ebuf && !rbuf && (ne<0) ){\n#if NSHAPE\n \n for(i=0; i<g->maxshapes; i++){\n if( g->shapes[i].scanlist ){\n for(j=0; j<g->y1; j++){\n if( g->shapes[i].scanlist[j] ){\n for(scan=g->shapes[i].scanlist[j]; scan; ){\n tscan = scan->next;\n if( scan ) free(scan);\n scan = tscan;\n }\n }\n }\n if( g->shapes[i].scanlist ) free(g->shapes[i].scanlist);\n }\n if( g->shapes[i].pts ) free(g->shapes[i].pts);\n if( g->shapes[i].xv ) free(g->shapes[i].xv);\n }\n if( g->masks ) free(g->masks);\n if( g->shapes ) free(g->shapes);\n if( g->ybuf ) free(g->ybuf);\n if( g->x0s ) free(g->x0s);\n if( g->x1s ) free(g->x1s);\n if( g ) free(g);\n#endif\n return NULL;\n }\n else{\n \n for(rptr=rbuf, eptr=ebuf; ne--; rptr++, eptr += esize){\n g->rid = 0;\n#if DO_FILTER_SWAP\n memset(_swf, 0, EVSIZE);\n#endif\n *rptr = ((FILTER) ? (g->rid ? g->rid : -1) : 0);\n }\n return (void *)g;\n }\n}\n\nint main(int argc, char **argv)\n{\n int i;\n#if HAVE_MINGW32==0\n int pipes[4];\n#endif\n int get, got;\n#if DO_FILTER_SWAP\n int sgot;\n#endif\n int n;\n int *rbuf;\n char *ebuf, *etop;\n char *s=NULL, *t=NULL, *u=NULL;\n void *g=NULL;\n#if USE_WIN32\n HANDLE hStdin, hStdout; \n DWORD dwRead, dwWritten; \n#endif\n\n \n#if HAVE_MINGW32==0\n if( (s=getenv(\"LAUNCH_PIPES\")) ){\n t = (char *)strdup(s);\n for(i=0, u=(char *)strtok(t, \",\"); i<4 && u; \n i++, u=(char *)strtok(NULL,\",\")){\n pipes[i] = atoi(u);\n }\n if( t ) free(t);\n if( i < 4 ) return(1);\n close(pipes[0]);\n close(pipes[3]);\n dup2(pipes[2], 0); close(pipes[2]);\n dup2(pipes[1], 1); close(pipes[1]);\n }\n#endif\n\n#if USE_WIN32\n hStdout = GetStdHandle(STD_OUTPUT_HANDLE); \n hStdin = GetStdHandle(STD_INPUT_HANDLE); \n if( (hStdout == INVALID_HANDLE_VALUE) || (hStdin == INVALID_HANDLE_VALUE) ){\n unlink(argv[0]);\n return 0;\n }\n#endif\n\n \n#if USE_WIN32\n while((ReadFile(hStdin, &get, sizeof(int), &dwRead, NULL) >0) && \n (dwRead == sizeof(int)) ){\n#else\n while( read(0, &get, sizeof(int)) == sizeof(int) ){\n#endif\n#if DO_FILTER_SWAP\n switch(sizeof(int)){\n case 2:\n _sw2((char *)&get,2,NULL,0);\n break;\n case 4:\n _sw4((char *)&get,4,NULL,0);\n break;\n case 8:\n _sw8((char *)&get,8,NULL,0);\n break;\n }\n#endif\n ebuf = (char *)calloc(get, sizeof(char));\n#if USE_WIN32\n for(n=0, etop=ebuf; get>0; etop += got, get -= dwRead){\n if((ReadFile(hStdin, etop, get, &dwRead, NULL)==FALSE) || (dwRead==0))\n break;\n n += dwRead;\n }\n#else\n for(n=0, etop=ebuf; get>0; etop += got, get -= got){\n if( (got=read(0, etop, get)) <=0 ) \n break;\n n += got;\n }\n#endif\n n /= EVSIZE;\n \n rbuf = (int *)calloc(n, sizeof(int));\n \n g = EVFILTRTN(g, ebuf, n, EVSIZE, rbuf);\n \n got = n*sizeof(int);\n#if DO_FILTER_SWAP\n sgot = got;\n switch(sizeof(int)){\n case 2:\n _sw2((char *)&sgot,2,NULL,0);\n break;\n case 4:\n _sw4((char *)&sgot,4,NULL,0);\n break;\n case 8:\n _sw8((char *)&sgot,8,NULL,0);\n break;\n }\n#if USE_WIN32\n WriteFile(hStdout, &sgot, sizeof(int), &dwWritten, NULL); \n#else\n write(1, &sgot, sizeof(int));\n#endif\n#else\n#if USE_WIN32\n WriteFile(hStdout, &got, sizeof(int), &dwWritten, NULL); \n#else\n write(1, &got, sizeof(int));\n#endif\n#endif\n#if DO_FILTER_SWAP\n switch(sizeof(int)){\n case 2:\n _sw2((char *)rbuf,got,NULL,0);\n break;\n case 4:\n _sw4((char *)rbuf,got,NULL,0);\n break;\n case 8:\n _sw8((char *)rbuf,got,NULL,0);\n break;\n }\n#endif\n#if USE_WIN32\n WriteFile(hStdout, rbuf, got, &dwWritten, NULL); \n#else\n write(1, rbuf, got);\n#endif\n if( ebuf) free(ebuf);\n if( rbuf ) free(rbuf);\n }\n EVFILTRTN(g, NULL, -1, 0, NULL);\n unlink(argv[0]);\n return 0;\n}\n";
diff --git a/funtools/filter/events_py.h b/funtools/filter/events_py.h
deleted file mode 100644
index fdf775b..0000000
--- a/funtools/filter/events_py.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *EVENTS_PY="\n# load the funtools routines\n_libname = './libfuntools.so.1.0'\nlibfuntools=cdll.LoadLibrary(_libname)\nlibc=cdll.LoadLibrary(None)\n\n# region definitions\nimannulusi=libfuntools.imannulusi\nimboxi=libfuntools.imboxi\nimcirclei=libfuntools.imcirclei\nimellipsei=libfuntools.imellipsei\nimfieldi=libfuntools.imfieldi\nimlinei=libfuntools.imlinei\nimpiei=libfuntools.impiei\nimqtpiei=libfuntools.imqtpiei\nimpointi=libfuntools.impointi\nimpandai=libfuntools.impandai\nimnannulusi=libfuntools.imnannulusi\nimnboxi=libfuntools.imnboxi\nimnellipsei=libfuntools.imnellipsei\nimnpiei=libfuntools.imnpiei\nimpolygoni=libfuntools.impolygoni\nimvannulusi=libfuntools.imvannulusi\nimvboxi=libfuntools.imvboxi\nimvellipsei=libfuntools.imvellipsei\nimvpiei=libfuntools.imvpiei\nimvpointi=libfuntools.imvpointi\nimannulus=libfuntools.imannulus\nimbox=libfuntools.imbox\nimcircle=libfuntools.imcircle\nimellipse=libfuntools.imellipse\nimfield=libfuntools.imfield\nimline=libfuntools.imline\nimpie=libfuntools.impie\nimqtpie=libfuntools.imqtpie\nimpoint=libfuntools.impoint\nimpanda=libfuntools.impanda\nimnannulus=libfuntools.imnannulus\nimnbox=libfuntools.imnbox\nimnellipse=libfuntools.imnellipse\nimnpie=libfuntools.imnpie\nimpolygon=libfuntools.impolygon\nimvannulus=libfuntools.imvannulus\nimvbox=libfuntools.imvbox\nimvellipse=libfuntools.imvellipse\nimvpie=libfuntools.imvpie\nimvpoint=libfuntools.imvpoint\n\nevannulus=libfuntools.evannulus\nevbox=libfuntools.evbox\nevcircle=libfuntools.evcircle\nevellipse=libfuntools.evellipse\nevfield=libfuntools.evfield\nevline=libfuntools.evline\nevpie=libfuntools.evpie\nevqtpie=libfuntools.evqtpie\nevpoint=libfuntools.evpoint\nevnannulus=libfuntools.evnannulus\nevnbox=libfuntools.evnbox\nevnellipse=libfuntools.evnellipse\nevnpie=libfuntools.evnpie\nevpanda=libfuntools.evpanda\nevpolygon=libfuntools.evpolygon\nevvannulus=libfuntools.evvannulus\nevvbox=libfuntools.evvbox\nevvellipse=libfuntools.evvellipse\nevvpie=libfuntools.evvpie\nevvpoint=libfuntools.evvpoint\n\nevvcircle=libfuntools.evvannulus\nevncircle=libfuntools.evnannulus\nevcpanda=libfuntools.evpanda\n\nimvcirclei=libfuntools.imvannulusi\nimncirclei=libfuntools.imnannulusi\nimvcircle=libfuntools.imvannulus\nimncircle=libfuntools.imnannulus\nimcpandai=libfuntools.impandai\nimcpanda=libfuntools.impanda\n\n# from regions.h -- no idea what it is ...\nxsno=3\n\n# ... but its important!\nmaxshapes=(nshape*(xsno+1))+1\n\n# ctypes struct definitions (taken from filter.h)\nclass filtmask(Structure):\n _fields_ = [('region', c_int), ('y', c_int), ('xstart', c_int), ('xstop', c_int)]\n\nclass scanrec(Structure):\n pass\n\n# this is how you add a forward pointer\nscanrec._fields_ = [ ('next', POINTER(scanrec)), ('x', c_int) ]\n\nclass shaperec(Structure):\n _fields_ = [ ('init', c_int), ('ystart', c_double), ('ystop', c_double), ('scanlist', c_void_p), ('nv', c_int), ('xv', c_void_p), ('r1sq', c_double), ('r2sq', c_double), ('angl', c_double), ('sinangl', c_double), ('cosangl', c_double), ('cossq', c_double), ('sinsq', c_double), ('xradsq', c_double), ('yradsq', c_double), ('a', c_double), ('npt', c_int), ('pts', c_void_p), ('xonly', c_int), ('x1', c_double), ('x2', c_double), ('y1', c_double), ('invslope', c_double)]\n\nclass gfiltrec(Structure):\n _fields_ = [('nshapes', c_int), ('maxshapes', c_int), ('shapes', POINTER(shaperec * maxshapes)), ('rid', c_int), ('usebinsiz', c_int), ('evsect', c_char_p), ('tlminx', c_double), ('tlminy', c_double), ('binsizx', c_double), ('binsizy', c_double), ('tloff', c_double), ('xmin', c_int), ('xmax', c_int), ('ymin', c_int), ('ymax', c_int), ('block', c_int), ('x0', c_int), ('x1', c_int), ('y0', c_int), ('y1', c_int), ('ybuf', POINTER(c_int)), ('x0s', POINTER(c_int)), ('x1s', POINTER(c_int)), ('nmask', c_int), ('maskdim', c_int), ('masks', POINTER(filtmask))]\n\n# taken from the code in evfilter.c that initializes the g struct\n# allocate shape record\nshapearr = (shaperec * maxshapes)()\n# allocate g record\ngrec = gfiltrec()\n# fill in g record\ngrec.nshapes = nshape\ngrec.maxshapes = maxshapes\ngrec.shapes = pointer(shapearr)\n# pointer to g record\ng=pointer(grec)\n\n# # processing loop\n# while True:\n# rvals = ''\n# buf = sys.stdin.read(4)\n# if not buf: break\n# vals = struct.unpack('=i', buf)\n# nev = vals[0]/evsize\n# for i in range(nev):\n# evbuf = sys.stdin.read(evsize)\n# rvals += struct.pack('=i', xfilter(evdef, evbuf))\n# sys.stdout.write(struct.pack('=i', nev*4))\n# sys.stdout.write(rvals)\n# sys.stdout.flush()\n\n# processing loop\nobytes = 0\nwhile True:\n # get byte count\n nval = c_int(0)\n if libc.read(0, byref(nval), 4) != 4: break\n bytes = nval.value\n nev = bytes / evsize\n\n # create a new data buffer, if necessary\n if obytes != bytes:\n evbuf = create_string_buffer(bytes)\n pevbuf = addressof(evbuf)\n rvals = (c_int * nev)()\n obytes = bytes\n\n # read data\n if libc.read(0, evbuf, bytes) != bytes: break\n\n # process data\n ioff = 0\n for i in range(nev):\n rvals[i] = xfilter(evdef, evbuf[ioff:ioff+evsize])\n ioff += evsize\n\n # write result byte count and result data\n nval = c_int(nev*4)\n libc.write(1, byref(nval), 4)\n libc.write(1, rvals, nval)\n";
diff --git a/funtools/filter/evfilter.c b/funtools/filter/evfilter.c
deleted file mode 100644
index 58add93..0000000
--- a/funtools/filter/evfilter.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* gcc -g -o foo event.body.c -lm */
-#ifdef TEST
-#include <math.h>
-#define EVFILTRTN _FilterEvents
-#define NSHAPE 1
-#define NREGION 1
-#define _X_ X
-#define _Y_ Y
-#define FILTER ((circle(g,1,1,1,_X_,_Y_,1,2,3)))
-#define EVSIZE 4
-#define X *((short *)(eptr+0))
-#define Y *((short *)(eptr+2))
-#include "regions.h"
-#endif
-
-static char __abuf[EVSIZE+1];
-static char *acopy(void *s, int n)
-{
- memset(__abuf, 0, n+1);
- memmove(__abuf, s, n);
- return __abuf;
-}
-
-void *EVFILTRTN(void *tg, char *ebuf, int ne, int esize, int *rbuf)
-{
- int i, j;
- int *rptr;
- char *eptr;
- Scan scan, tscan;
- GFilt g = (GFilt)tg;
-
- /* set eptr to ebuf -- this must be done before FINIT, because the latter */
- /*passes X and Y to shape init routines, and these defines use eptr */
- eptr = ebuf;
-
- if( !g ){
- g = (GFilt)calloc(1, sizeof(GFiltRec));
-#if NSHAPE
- /* allocate space for the globals */
- g->nshapes = NSHAPE;
- g->maxshapes = (NSHAPE*(XSNO+1))+1;
- g->shapes = (Shape)calloc(g->maxshapes, sizeof(ShapeRec));
-#endif
-#ifdef EVSECT
- /* if evsect is defined, we are filtering an image section */
- g->evsect = EVSECT;
- sscanf(g->evsect, "%d %d %d %d %d",
- &g->xmin, &g->xmax, &g->ymin, &g->ymax, &g->block);
- /* get x and y limits on subsection */
- g->x0 = 1;
- g->y0 = 1;
- g->x1 = (g->xmax-g->xmin)/g->block+1;
- g->y1 = (g->ymax-g->ymin)/g->block+1;
- /* allocate a buffer for valid y row flags */
- g->ybuf = (int *)calloc(g->y1+1, sizeof(int));
- g->x0s = (int *)calloc(g->y1+1, sizeof(int));
- g->x1s = (int *)calloc(g->y1+1, sizeof(int));
- /* seed impossible values for x limits */
- for(i=0; i<=g->y1; i++) g->x0s[i] = g->x0;
- for(i=0; i<=g->y1; i++) g->x1s[i] = g->x1;
- /* save image mask values */
- if( NMASK ){
- g->nmask = NMASK;
- g->maskdim = MASKDIM;
- g->masks = _masks;
- }
- /* initialize shapes -- but check to make sure eptr is OK */
-#if DO_FILTER_SWAP
- memset(_swf, 0, EVSIZE);
-#endif
- if( eptr ) FINIT;
- /* these also must be defined if EVSECT is being used */
- g->tlminx = TLMINX;
- g->tlminy = TLMINY;
- g->usebinsiz = USEBINSIZ;
- if( BINSIZX > 0.0 )
- g->binsizx = BINSIZX;
- else
- g->binsizx = 1.0;
- if( BINSIZY > 0.0 )
- g->binsizy = BINSIZY;
- else
- g->binsizy = 1.0;
- g->tloff = TLOFF;
-#endif
- }
-
- /* if we have negative events, we free the structs */
- if( !ebuf && !rbuf && (ne<0) ){
-#if NSHAPE
- /* free polygon records */
- for(i=0; i<g->maxshapes; i++){
- if( g->shapes[i].scanlist ){
- for(j=0; j<g->y1; j++){
- if( g->shapes[i].scanlist[j] ){
- for(scan=g->shapes[i].scanlist[j]; scan; ){
- tscan = scan->next;
- if( scan ) free(scan);
- scan = tscan;
- }
- }
- }
- if( g->shapes[i].scanlist ) free(g->shapes[i].scanlist);
- }
- if( g->shapes[i].pts ) free(g->shapes[i].pts);
- if( g->shapes[i].xv ) free(g->shapes[i].xv);
- }
- if( g->masks ) free(g->masks);
- if( g->shapes ) free(g->shapes);
- if( g->ybuf ) free(g->ybuf);
- if( g->x0s ) free(g->x0s);
- if( g->x1s ) free(g->x1s);
- if( g ) free(g);
-#endif
- return NULL;
- }
- else{
- /* do the filtering on each event */
- for(rptr=rbuf, eptr=ebuf; ne--; rptr++, eptr += esize){
- g->rid = 0;
-#if DO_FILTER_SWAP
- memset(_swf, 0, EVSIZE);
-#endif
- *rptr = ((FILTER) ? (g->rid ? g->rid : -1) : 0);
- }
- return (void *)g;
- }
-}
-
-int main(int argc, char **argv)
-{
- int i;
-#if HAVE_MINGW32==0
- int pipes[4];
-#endif
- int get, got;
-#if DO_FILTER_SWAP
- int sgot;
-#endif
- int n;
- int *rbuf;
- char *ebuf, *etop;
- char *s=NULL, *t=NULL, *u=NULL;
- void *g=NULL;
-#if USE_WIN32
- HANDLE hStdin, hStdout;
- DWORD dwRead, dwWritten;
-#endif
-
- /* Launch() sometimes rearranges passed pipes to be stdin/stdout */
-#if HAVE_MINGW32==0
- if( (s=getenv("LAUNCH_PIPES")) ){
- t = (char *)strdup(s);
- for(i=0, u=(char *)strtok(t, ","); i<4 && u;
- i++, u=(char *)strtok(NULL,",")){
- pipes[i] = atoi(u);
- }
- if( t ) free(t);
- if( i < 4 ) return(1);
- close(pipes[0]);
- close(pipes[3]);
- dup2(pipes[2], 0); close(pipes[2]);
- dup2(pipes[1], 1); close(pipes[1]);
- }
-#endif
-
-#if USE_WIN32
- hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- hStdin = GetStdHandle(STD_INPUT_HANDLE);
- if( (hStdout == INVALID_HANDLE_VALUE) || (hStdin == INVALID_HANDLE_VALUE) ){
- unlink(argv[0]);
- return 0;
- }
-#endif
-
- /* read and filter events */
-#if USE_WIN32
- while((ReadFile(hStdin, &get, sizeof(int), &dwRead, NULL) >0) &&
- (dwRead == sizeof(int)) ){
-#else
- while( read(0, &get, sizeof(int)) == sizeof(int) ){
-#endif
-#if DO_FILTER_SWAP
- switch(sizeof(int)){
- case 2:
- _sw2((char *)&get,2,NULL,0);
- break;
- case 4:
- _sw4((char *)&get,4,NULL,0);
- break;
- case 8:
- _sw8((char *)&get,8,NULL,0);
- break;
- }
-#endif
- ebuf = (char *)calloc(get, sizeof(char));
-#if USE_WIN32
- for(n=0, etop=ebuf; get>0; etop += got, get -= dwRead){
- if((ReadFile(hStdin, etop, get, &dwRead, NULL)==FALSE) || (dwRead==0))
- break;
- n += dwRead;
- }
-#else
- for(n=0, etop=ebuf; get>0; etop += got, get -= got){
- if( (got=read(0, etop, get)) <=0 )
- break;
- n += got;
- }
-#endif
- n /= EVSIZE;
- /* allocate return value buffer */
- rbuf = (int *)calloc(n, sizeof(int));
- /* filter events, with results going into rbuf */
- g = EVFILTRTN(g, ebuf, n, EVSIZE, rbuf);
- /* write results */
- got = n*sizeof(int);
-#if DO_FILTER_SWAP
- sgot = got;
- switch(sizeof(int)){
- case 2:
- _sw2((char *)&sgot,2,NULL,0);
- break;
- case 4:
- _sw4((char *)&sgot,4,NULL,0);
- break;
- case 8:
- _sw8((char *)&sgot,8,NULL,0);
- break;
- }
-#if USE_WIN32
- WriteFile(hStdout, &sgot, sizeof(int), &dwWritten, NULL);
-#else
- write(1, &sgot, sizeof(int));
-#endif
-#else
-#if USE_WIN32
- WriteFile(hStdout, &got, sizeof(int), &dwWritten, NULL);
-#else
- write(1, &got, sizeof(int));
-#endif
-#endif
-#if DO_FILTER_SWAP
- switch(sizeof(int)){
- case 2:
- _sw2((char *)rbuf,got,NULL,0);
- break;
- case 4:
- _sw4((char *)rbuf,got,NULL,0);
- break;
- case 8:
- _sw8((char *)rbuf,got,NULL,0);
- break;
- }
-#endif
-#if USE_WIN32
- WriteFile(hStdout, rbuf, got, &dwWritten, NULL);
-#else
- write(1, rbuf, got);
-#endif
- if( ebuf) free(ebuf);
- if( rbuf ) free(rbuf);
- }
- EVFILTRTN(g, NULL, -1, 0, NULL);
- unlink(argv[0]);
- return 0;
-}
diff --git a/funtools/filter/evfilter.py b/funtools/filter/evfilter.py
deleted file mode 100644
index 70e617c..0000000
--- a/funtools/filter/evfilter.py
+++ /dev/null
@@ -1,156 +0,0 @@
-# load the funtools routines
-_libname = './libfuntools.so.1.0'
-libfuntools=cdll.LoadLibrary(_libname)
-libc=cdll.LoadLibrary(None)
-
-# region definitions
-imannulusi=libfuntools.imannulusi
-imboxi=libfuntools.imboxi
-imcirclei=libfuntools.imcirclei
-imellipsei=libfuntools.imellipsei
-imfieldi=libfuntools.imfieldi
-imlinei=libfuntools.imlinei
-impiei=libfuntools.impiei
-imqtpiei=libfuntools.imqtpiei
-impointi=libfuntools.impointi
-impandai=libfuntools.impandai
-imnannulusi=libfuntools.imnannulusi
-imnboxi=libfuntools.imnboxi
-imnellipsei=libfuntools.imnellipsei
-imnpiei=libfuntools.imnpiei
-impolygoni=libfuntools.impolygoni
-imvannulusi=libfuntools.imvannulusi
-imvboxi=libfuntools.imvboxi
-imvellipsei=libfuntools.imvellipsei
-imvpiei=libfuntools.imvpiei
-imvpointi=libfuntools.imvpointi
-imannulus=libfuntools.imannulus
-imbox=libfuntools.imbox
-imcircle=libfuntools.imcircle
-imellipse=libfuntools.imellipse
-imfield=libfuntools.imfield
-imline=libfuntools.imline
-impie=libfuntools.impie
-imqtpie=libfuntools.imqtpie
-impoint=libfuntools.impoint
-impanda=libfuntools.impanda
-imnannulus=libfuntools.imnannulus
-imnbox=libfuntools.imnbox
-imnellipse=libfuntools.imnellipse
-imnpie=libfuntools.imnpie
-impolygon=libfuntools.impolygon
-imvannulus=libfuntools.imvannulus
-imvbox=libfuntools.imvbox
-imvellipse=libfuntools.imvellipse
-imvpie=libfuntools.imvpie
-imvpoint=libfuntools.imvpoint
-
-evannulus=libfuntools.evannulus
-evbox=libfuntools.evbox
-evcircle=libfuntools.evcircle
-evellipse=libfuntools.evellipse
-evfield=libfuntools.evfield
-evline=libfuntools.evline
-evpie=libfuntools.evpie
-evqtpie=libfuntools.evqtpie
-evpoint=libfuntools.evpoint
-evnannulus=libfuntools.evnannulus
-evnbox=libfuntools.evnbox
-evnellipse=libfuntools.evnellipse
-evnpie=libfuntools.evnpie
-evpanda=libfuntools.evpanda
-evpolygon=libfuntools.evpolygon
-evvannulus=libfuntools.evvannulus
-evvbox=libfuntools.evvbox
-evvellipse=libfuntools.evvellipse
-evvpie=libfuntools.evvpie
-evvpoint=libfuntools.evvpoint
-
-evvcircle=libfuntools.evvannulus
-evncircle=libfuntools.evnannulus
-evcpanda=libfuntools.evpanda
-
-imvcirclei=libfuntools.imvannulusi
-imncirclei=libfuntools.imnannulusi
-imvcircle=libfuntools.imvannulus
-imncircle=libfuntools.imnannulus
-imcpandai=libfuntools.impandai
-imcpanda=libfuntools.impanda
-
-# from regions.h -- no idea what it is ...
-xsno=3
-
-# ... but its important!
-maxshapes=(nshape*(xsno+1))+1
-
-# ctypes struct definitions (taken from filter.h)
-class filtmask(Structure):
- _fields_ = [('region', c_int), ('y', c_int), ('xstart', c_int), ('xstop', c_int)]
-
-class scanrec(Structure):
- pass
-
-# this is how you add a forward pointer
-scanrec._fields_ = [ ('next', POINTER(scanrec)), ('x', c_int) ]
-
-class shaperec(Structure):
- _fields_ = [ ('init', c_int), ('ystart', c_double), ('ystop', c_double), ('scanlist', c_void_p), ('nv', c_int), ('xv', c_void_p), ('r1sq', c_double), ('r2sq', c_double), ('angl', c_double), ('sinangl', c_double), ('cosangl', c_double), ('cossq', c_double), ('sinsq', c_double), ('xradsq', c_double), ('yradsq', c_double), ('a', c_double), ('npt', c_int), ('pts', c_void_p), ('xonly', c_int), ('x1', c_double), ('x2', c_double), ('y1', c_double), ('invslope', c_double)]
-
-class gfiltrec(Structure):
- _fields_ = [('nshapes', c_int), ('maxshapes', c_int), ('shapes', POINTER(shaperec * maxshapes)), ('rid', c_int), ('usebinsiz', c_int), ('evsect', c_char_p), ('tlminx', c_double), ('tlminy', c_double), ('binsizx', c_double), ('binsizy', c_double), ('tloff', c_double), ('xmin', c_int), ('xmax', c_int), ('ymin', c_int), ('ymax', c_int), ('block', c_int), ('x0', c_int), ('x1', c_int), ('y0', c_int), ('y1', c_int), ('ybuf', POINTER(c_int)), ('x0s', POINTER(c_int)), ('x1s', POINTER(c_int)), ('nmask', c_int), ('maskdim', c_int), ('masks', POINTER(filtmask))]
-
-# taken from the code in evfilter.c that initializes the g struct
-# allocate shape record
-shapearr = (shaperec * maxshapes)()
-# allocate g record
-grec = gfiltrec()
-# fill in g record
-grec.nshapes = nshape
-grec.maxshapes = maxshapes
-grec.shapes = pointer(shapearr)
-# pointer to g record
-g=pointer(grec)
-
-# # processing loop
-# while True:
-# rvals = ''
-# buf = sys.stdin.read(4)
-# if not buf: break
-# vals = struct.unpack('=i', buf)
-# nev = vals[0]/evsize
-# for i in range(nev):
-# evbuf = sys.stdin.read(evsize)
-# rvals += struct.pack('=i', xfilter(evdef, evbuf))
-# sys.stdout.write(struct.pack('=i', nev*4))
-# sys.stdout.write(rvals)
-# sys.stdout.flush()
-
-# processing loop
-obytes = 0
-while True:
- # get byte count
- nval = c_int(0)
- if libc.read(0, byref(nval), 4) != 4: break
- bytes = nval.value
- nev = bytes / evsize
-
- # create a new data buffer, if necessary
- if obytes != bytes:
- evbuf = create_string_buffer(bytes)
- pevbuf = addressof(evbuf)
- rvals = (c_int * nev)()
- obytes = bytes
-
- # read data
- if libc.read(0, evbuf, bytes) != bytes: break
-
- # process data
- ioff = 0
- for i in range(nev):
- rvals[i] = xfilter(evdef, evbuf[ioff:ioff+evsize])
- ioff += evsize
-
- # write result byte count and result data
- nval = c_int(nev*4)
- libc.write(1, byref(nval), 4)
- libc.write(1, rvals, nval)
diff --git a/funtools/filter/evregions.c b/funtools/filter/evregions.c
deleted file mode 100644
index 2b28152..0000000
--- a/funtools/filter/evregions.c
+++ /dev/null
@@ -1,1532 +0,0 @@
-/*
- NB: MAKE SURE YOU EDIT THE TEMPLATE FILE!!!!
-*/
-
-#ifndef FILTER_PTYPE
-#include <regions.h>
-#endif
-
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-/* panda and pie incorrectly used astronomical angles. fixed 4/2004 */
-#define USE_ASTRO_ANGLE 0
-
-/* we might want to avoid (x86) extended precision problems */
-#define USE_FPU_DOUBLE 0
-#if USE_FPU_DOUBLE
-#include <fpu_control.h>
-static fpu_control_t _cw;
-#define FPU_DOUBLE {fpu_control_t _cw2; _FPU_GETCW(_cw); _cw2 = _cw & ~_FPU_EXTENDED; _cw2 |= _FPU_DOUBLE; _FPU_SETCW(_cw2);}
-#define FPU_RESTORE {_FPU_SETCW(_cw);}
-#else
-#define FPU_DOUBLE
-#define FPU_RESTORE
-#endif
-
-/* alternate method of avoiding (x86) extended precision problems */
-#define USE_FLOAT_COMPARE 0
-
-/* add this to FilterOpen to cause this module to be loaded for dynamic linking */
-static int evregno=0;
-void initevregions(void)
-{
- evregno++;
- return;
-}
-
-static int polypt(double x, double y, double* poly, int count,
- double UNUSED(xstart), double ystart, int flag)
-{
- /* x-- x value of point being tested */
- /* y-- y value of point being tested */
- /* poly-- bounding polygon, array of length (count*2) */
- /* count-- number of edges of bounding polygon */
-
- /* This algorithm is from "An Introduction to Ray Tracing", Academic Press, */
- /* 1989, edited by Andrew Glassner, pg 53 */
- /* a point lies in a polygon if a line is extended from the point to infinite */
- /* in any direction and the number of intersections with the polygon is odd. */
- /* This is valid for both concave and convex polygons. */
- /* Points on a vertex are considered inside. */
- /* Points on a edge are considered inside. */
-
- /* number of crossings */
- int crossings = 0;
-
- /* init sign for first vertice */
- int sign = ((poly[1] - y)>=0) ? 1 : -1;
-
- /* for all edges */
- int i;
-
- /* if flag is set, we check x, y against first point */
- if( flag && (x == poly[0]) && (y == poly[1]) ) return 1;
-
- for(i=0; i<count; i++) {
- int j = (i!=(count-1)) ? i+1 : 0;
-
- /* Vertex 1 */
- double x1 = poly[i*2] - x;
- double y1 = poly[i*2+1] - y;
-
- /* Vertex 2 */
- double x2 = poly[j*2] - x;
- double y2 = poly[j*2+1] - y;
-
- /* sign holder for p2 */
- int nextSign = (y2>=0) ? 1 : -1;
-
- /* horiz line */
- if( (y1==0) && (y2==0) ){
- if( ((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0)) ){
- /* we always return true for ystart horiz lines */
- if( y == ystart )
- return 1;
- else
- return fmod((double)crossings+1,2.0) ? 1 : 0;
- }
- }
- /* vertical line */
- else if( (x1==0) && (x2==0) ){
- if( ((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0)) ){
- return fmod((double)crossings+1,2.0) ? 1 : 0;
- }
- }
- /* point on line */
- else if( feq((y1*(x2-x1)),(x1*(y2-y1))) ){
- if( (((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0))) &&
- (((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0))) ){
- return fmod((double)crossings+1,2.0) ? 1 : 0;
- }
- }
-#if 0
- /* horiz line */
- if( (y1==0) && (y2==0) ){
- if( ((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0)) ){
- if( y == ystart ){
- return 1;
- }
- }
- }
- /* vertical line */
- else if( (x1==0) && (x2==0) ){
- if( ((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0)) ){
- if( x == xstart ){
- return 1;
- }
- }
- }
- /* point on line */
- else if( feq((y1*(x2-x1)),(x1*(y2-y1))) ){
- if( (((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0))) &&
- (((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0))) ){
- return 0;
- }
- }
-#endif
- if (sign != nextSign) {
- if (x1>0 && x2>0)
- crossings++;
- else if (x1>0 || x2>0) {
- if (x1-(y1*(x2-x1)/(y2-y1)) > 0)
- crossings++;
- }
- sign = nextSign;
- }
- }
-
- return crossings%2 ? 1 : 0; /* if odd, point is inside */
-}
-
-static void quadeq(double a, double b, double c,
- double *x1, double *x2, int *nr, int *nc)
-{
- double dis, q;
- if( feq(a,0.0) ){
- *nc = 0;
- if( feq(b,0.0) ){
- *nr = 0; *x1 = 0.0;
- }
- else{
- *nr = 1; *x1 = -c / b;
- }
- *x2 = *x1;
- }
- else{
- dis = b*b - 4.0 * a * c;
- if( dis > 0.0 ){
- *nr = 2; *nc = 0;
- dis = sqrt(dis);
- if( b < 0.0 ) dis = -dis;
- q = -0.5 * (b + dis);
- *x1 = q/a; *x2 = c/q;
- if(*x1 > *x2){
- q = *x1; *x1 = *x2; *x2 = q;
- }
- }
- else if( feq(dis,0.0) ){
- *nr = 1; *nc = 0; *x1 = - 0.5 * b / a; *x2 = *x1;
- }
- else{
- *nr = 0; *nc = 2; *x1 = - 0.5 * b / a; *x2 = 0.5 * sqrt(-dis) / a;
- }
- }
-}
-
-static int corner_vertex(int index, int width, int height,
- double *x, double *y)
-{
- switch (index) {
- case 1:
- *x = 0.0;
- *y = height + 1;
- break;
- case 2:
- *x = 0.0;
- *y = 0.0;
- break;
- case 3:
- *x = width + 1;
- *y = 0.0;
- break;
- case 4:
- *x = width + 1;
- *y = height + 1;
- default:
- break;
- }
- index = index + 1;
- if(index > 4) index = 1;
- return(index);
-}
-
-static int pie_intercept(double width, double height, double xcen, double ycen,
- double angle, double *xcept, double *ycept)
-{
- double angl, slope; /* l: angle and slope of ray */
- angl = angle;
- /* put angles in normal range */
- while (angl < 0.0)
- angl = angl + 360.0;
- while (angl >= 360.0)
- angl = angl - 360.0;
- /* check for a horizontal angle */
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 180.0) < SMALL_NUMBER) {
-#endif
- *xcept = 0.0;
- *ycept = ycen;
- return(2);
- }
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 0.0) < SMALL_NUMBER) {
-#endif
- *xcept = width + 1;
- *ycept = ycen;
- return(4);
- }
- /* convert to a Cartesian angle */
-#if USE_ASTRO_ANGLE
- angl = angl + 90.0;
-#endif
- if(angl >= 360.0)
- angl = angl - 360.0;
- if(angl < 180.0) {
- *ycept = height + 1;
- /* rule out vertical line */
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(1);
- }
- } else {
- *ycept = 0.0;
- /* rule out vertical line */
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(3);
- }
- }
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- /* calculate slope */
- slope = tan(angl);
- /* calculate intercept with designated y edge */
- *xcept = xcen + ((*ycept - ycen) / slope);
- if(*xcept < 0) {
- *ycept = (ycen - (xcen * slope));
- *xcept = 0.0;
- return(2);
- } else if(*xcept > (width + 1)) {
- *ycept = (ycen + ((width + 1 - xcen) * slope));
- *xcept = width + 1;
- return(4);
- } else {
- if(*ycept < height)
- return(3);
- else
- return(1);
- }
-}
-
-/* ***************************** shapes ********************************** */
-
-int evannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double ri, double ro)
-{
- /* use circle if possible */
- if( ri == 0 ){
- return(evcircle(g, rno, sno, flag, type, x, y, xcen, ycen, ro));
- }
-
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- g->shapes[sno].ystart = ycen - ro;
- g->shapes[sno].ystop = ycen + ro;
- g->shapes[sno].r1sq = ri * ri;
- g->shapes[sno].r2sq = ro * ro;
- }
-
- if((((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))<=g->shapes[sno].r2sq) &&
- (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))>g->shapes[sno].r1sq)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-int evbox(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double xcen, double ycen, double xwidth, double yheight,
- double angle)
-{
- int i;
- double angl; /* l: Cartesian angle in radians */
- double half_width, half_height;/* l: radii (1/2 width and height) */
- double cosangl, sinangl; /* l: sine, cosine of the Cartesian angle */
- double hw_cos, hw_sin; /* l: products of half_width with sin, cos */
- double hh_cos, hh_sin; /* l: products of half_height with sin, cos */
- double xstart=0.0;
-
- if( (xwidth == 0) && (yheight==0) ){
- return(!flag);
- }
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save angle for use in multi or slices */
- angl = angle + 90.0;
-#else
- angl = angle;
-#endif
- while (angl >= 360.0) angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin (angl);
- cosangl = cos (angl);
-#if USE_ASTRO_ANGLE
- /* since we rotate by 90.0 degrees to get from astro angle to cartesian, */
- /* we also need to switch the width and height. we do this secretly so */
- /* that the display will turn out right, by doing it in the half terms */
- half_width = yheight / 2.0;
- half_height = xwidth / 2.0;
-#else
- half_width = xwidth / 2.0;
- half_height = yheight / 2.0;
-#endif
- hw_cos = half_width * cosangl;
- hw_sin = half_width * sinangl;
- hh_cos = half_height * cosangl;
- hh_sin = half_height * sinangl;
- g->shapes[sno].pts = (double *)calloc(8, sizeof(double));
-#if USE_ASTRO_ANGLE
- g->shapes[sno].pts[0] = xcen - hw_cos - hh_sin;
- g->shapes[sno].pts[1] = ycen - hw_sin + hh_cos;
- g->shapes[sno].pts[2] = xcen + hw_cos - hh_sin;
- g->shapes[sno].pts[3] = ycen + hw_sin + hh_cos;
- g->shapes[sno].pts[4] = xcen + hw_cos + hh_sin;
- g->shapes[sno].pts[5] = ycen + hw_sin - hh_cos;
- g->shapes[sno].pts[6] = xcen - hw_cos + hh_sin;
- g->shapes[sno].pts[7] = ycen - hw_sin - hh_cos;
-#else
- g->shapes[sno].pts[0] = xcen - hw_cos + hh_sin;
- g->shapes[sno].pts[1] = ycen - hh_cos - hw_sin;
- g->shapes[sno].pts[2] = xcen - hw_cos - hh_sin;
- g->shapes[sno].pts[3] = ycen + hh_cos - hw_sin;
- g->shapes[sno].pts[4] = xcen + hw_cos - hh_sin;
- g->shapes[sno].pts[5] = ycen + hh_cos + hw_sin;
- g->shapes[sno].pts[6] = xcen + hw_cos + hh_sin;
- g->shapes[sno].pts[7] = ycen - hh_cos + hw_sin;
-#endif
- g->shapes[sno].npt = 8;
- /* now find the y limits */
- if( g->shapes[sno].npt ){
- xstart = g->shapes[sno].pts[0];
- g->shapes[sno].ystart = g->shapes[sno].pts[1];
- g->shapes[sno].ystop = g->shapes[sno].ystart;
- for(i=1; i<g->shapes[sno].npt; i+=2){
- if(g->shapes[sno].pts[i-1] < xstart)
- xstart = g->shapes[sno].pts[i-1];
- if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)
- g->shapes[sno].ystop = g->shapes[sno].pts[i];
- if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)
- g->shapes[sno].ystart = g->shapes[sno].pts[i];
- }
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,
- xstart, g->shapes[sno].ystart, 0)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evcircle(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double xcen, double ycen, double radius)
-{
- if( radius == 0 ){
- return(!flag);
- }
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- g->shapes[sno].ystart = ycen - radius;
- g->shapes[sno].ystop = ycen + radius;
- g->shapes[sno].r1sq = radius * radius;
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))<=g->shapes[sno].r1sq)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad, double angle)
-{
- double yhi, yoff;
- double b, c;
- double b_partial, c_partial;
- double xboff, xfoff;
- int nr, nc;
-
- /* use circle if possible */
- if( xrad == yrad ){
- return(evcircle(g, rno, sno, flag, type, x, y, xcen, ycen, xrad));
- }
-
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- /* set worst case limits (xrad axis parallel to vertical axis) */
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save "angle" for use by other routines */
- g->shapes[sno].angl = angle + 90.0;
-#else
- g->shapes[sno].angl = angle;
-#endif
- while( g->shapes[sno].angl >= 360.0 )
- g->shapes[sno].angl = g->shapes[sno].angl - 360.0;
- /* convert to radians */
- g->shapes[sno].angl = (g->shapes[sno].angl / 180.0) * M_PI;
- g->shapes[sno].sinangl = sin(g->shapes[sno].angl);
- g->shapes[sno].cosangl = cos(g->shapes[sno].angl);
- /* calculate approximate y limits */
- /* choose lesser of containing rotbox and circle */
-#if USE_ASTRO_ANGLE
- yhi = fabs(g->shapes[sno].sinangl * yrad) +
- fabs(g->shapes[sno].cosangl * xrad);
-#else
- yhi = fabs(g->shapes[sno].sinangl * xrad) +
- fabs(g->shapes[sno].cosangl * yrad);
-#endif
- yhi = min(yhi, max(yrad, xrad));
- g->shapes[sno].ystart = ycen - yhi;
- g->shapes[sno].ystop = ycen + yhi;
- /* prepare partials for quadratic equation solutions to coordinates */
- g->shapes[sno].cossq = g->shapes[sno].cosangl * g->shapes[sno].cosangl;
- g->shapes[sno].sinsq = g->shapes[sno].sinangl * g->shapes[sno].sinangl;
-#if USE_ASTRO_ANGLE
- /* because we rotate by 90.0 degrees to get from astro angle to */
- /* cartesian, we also need to switch the x and y axes. we do this */
- /* secretly so that the display will turn out right, by doing it in */
- /* the sq terms */
- g->shapes[sno].xradsq = yrad * yrad;
- g->shapes[sno].yradsq = xrad * xrad;
-#else
- g->shapes[sno].xradsq = xrad * xrad;
- g->shapes[sno].yradsq = yrad * yrad;
-#endif
- /* fill in as much of a,b,c as we can */
- g->shapes[sno].a = (g->shapes[sno].cossq / g->shapes[sno].xradsq) +
- (g->shapes[sno].sinsq / g->shapes[sno].yradsq);
- }
- if( ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) ){
- b_partial = (2.0 * g->shapes[sno].sinangl) *
- ((g->shapes[sno].cosangl / g->shapes[sno].xradsq) -
- (g->shapes[sno].cosangl / g->shapes[sno].yradsq));
- c_partial = (g->shapes[sno].sinsq / g->shapes[sno].xradsq) +
- (g->shapes[sno].cossq / g->shapes[sno].yradsq);
- yoff = y - ycen;
- b = b_partial * yoff;
- c = (c_partial * yoff * yoff) - 1.0;
- /* solve quadratic */
- quadeq (g->shapes[sno].a, b, c, &xboff, &xfoff, &nr, &nc);
- /* if real roots */
- if( nr != 0 ) {
- FPU_DOUBLE
-#if USE_FLOAT_COMPARE
- if( (((float)x>=(float)(xcen+xboff)) &&
- ((float)x<=(float)(xcen+xfoff))) == flag ){
-#else
- if( ((x>=(xcen+xboff)) && (x<=(xcen+xfoff))) == flag ){
-#endif
- if( rno && flag ) g->rid = rno;
- FPU_RESTORE
- return 1;
- }
- else{
- FPU_RESTORE
- return 0;
- }
- }
- else
- return !flag;
- }
- return !flag;
-}
-
-int evfield(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),
- double UNUSED(x), double UNUSED(y))
-{
- if( flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evline(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double x1, double y1, double x2, double y2)
-{
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- g->shapes[sno].ystart = min(y1,y2);
- g->shapes[sno].ystop = max(y1,y2);
- g->shapes[sno].x1 = x1;
- g->shapes[sno].x2 = x2;
- g->shapes[sno].y1 = y1;
- if( feq(y1,y2) ){
- g->shapes[sno].xonly = 1;
- g->shapes[sno].invslope = 0;
- }
- else{
- g->shapes[sno].xonly = 0;
- g->shapes[sno].invslope = (x1 - x2) / (y1 - y2);
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- ((!g->shapes[sno].xonly &&
- feq((((y-g->shapes[sno].y1)*g->shapes[sno].invslope)+g->shapes[sno].x1),x)) ||
- (g->shapes[sno].xonly &&
- ((x>=g->shapes[sno].x1)&&(x<=g->shapes[sno].x2))))) == flag){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- int i;
- int width, height; /* l: image mask width and height */
- double sweep; /* l: sweep between cut angles */
- int intrcpt1, intrcpt2; /* l: side intercepted by each cut */
- double x2, y2; /* l: coordinates of second intercept */
- double xstart=0.0;
-
- /* use field if possible */
- if( (angle1==0) && (angle2==360) ){
- return(evfield(g, rno, sno, flag, type, x, y));
- }
-
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- /* we have to fake width and height, since we do not know them! */
- width = LARGE_NUMBER;
- height = LARGE_NUMBER;
- /* start listing vertices of polygon */
- g->shapes[sno].pts = (double *)calloc(14, sizeof(double));
- g->shapes[sno].pts[0] = xcen;
- g->shapes[sno].pts[1] = ycen;
- sweep = angle2 - angle1;
- /* if sweep is too small to be noticed, don't bother */
- if(fabs(sweep) < SMALL_NUMBER)
- return !flag;
- if (sweep < 0.0) sweep = sweep + 360.0;
- intrcpt1 = pie_intercept((double)width, (double)height, xcen, ycen, angle1,
- &(g->shapes[sno].pts[2]),
- &(g->shapes[sno].pts[3]));
- intrcpt2 = pie_intercept((double)width, (double)height, xcen, ycen, angle2,
- &x2, &y2);
- g->shapes[sno].npt = 4;
- /* if angles intercept same side and slice is between them, no corners */
- /* else, mark corners until reaching side with second angle intercept */
- if((intrcpt1 != intrcpt2) || (sweep > 180.0)){
- do{
- intrcpt1 = corner_vertex(intrcpt1, width, height,
- &(g->shapes[sno].pts[g->shapes[sno].npt]),
- &(g->shapes[sno].pts[g->shapes[sno].npt+1]));
- g->shapes[sno].npt = g->shapes[sno].npt + 2;
- }while(intrcpt1 != intrcpt2);
- }
- g->shapes[sno].pts[g->shapes[sno].npt] = x2;
- g->shapes[sno].pts[g->shapes[sno].npt+1] = y2;
- g->shapes[sno].npt = g->shapes[sno].npt + 2;
- /* now find the y limits */
- if( g->shapes[sno].npt ){
- xstart = g->shapes[sno].pts[0];
- g->shapes[sno].ystart = g->shapes[sno].pts[1];
- g->shapes[sno].ystop = g->shapes[sno].ystart;
- for(i=1; i<g->shapes[sno].npt; i+=2){
- if(g->shapes[sno].pts[i-1] < xstart)
- xstart = g->shapes[sno].pts[i-1];
- if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)
- g->shapes[sno].ystop = g->shapes[sno].pts[i];
- if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)
- g->shapes[sno].ystart = g->shapes[sno].pts[i];
- }
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,
- xstart, g->shapes[sno].ystart, 1)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-int evqtpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- return evpie(g, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);
-}
-
-int evpoint(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),
- double x, double y,
- double xcen, double ycen)
-{
- if( ((x==xcen) && (y==ycen)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-#ifdef __STDC__
-int
-evpolygon(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y, ...)
-{
- int i, maxpts;
- double xstart=0.0;
- va_list args;
- va_start(args, y);
-#else
-int evpolygon(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xstart=0.0;
- int i, maxpts;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- /* allocate space for x,y arguments */
- maxpts = MASKINC;
- g->shapes[sno].pts = (double *)calloc(maxpts, sizeof(double));
- /* gather up arguments */
- g->shapes[sno].npt = 0;
- while( 1 ){
- if( g->shapes[sno].npt >= maxpts ){
- maxpts += MASKINC;
- g->shapes[sno].pts = (double *)realloc(g->shapes[sno].pts,
- maxpts*sizeof(double));
- }
- g->shapes[sno].pts[g->shapes[sno].npt] = va_arg(args, double);
- /* two negatives in a row means we are at end of args */
- if( feq(g->shapes[sno].pts[g->shapes[sno].npt],PSTOP) &&
- feq(g->shapes[sno].pts[g->shapes[sno].npt-1],PSTOP) ){
- g->shapes[sno].npt--;
- break;
- }
- g->shapes[sno].npt++;
- }
- va_end(args);
- /* realloc to actual size */
- g->shapes[sno].pts = (double *)realloc(g->shapes[sno].pts,
- g->shapes[sno].npt*sizeof(double));
- /* now find the y limits */
- if( g->shapes[sno].npt ){
- xstart = g->shapes[sno].pts[0];
- g->shapes[sno].ystart = g->shapes[sno].pts[1];
- g->shapes[sno].ystop = g->shapes[sno].ystart;
- for(i=1; i<g->shapes[sno].npt; i+=2){
- if(g->shapes[sno].pts[i-1] < xstart)
- xstart = g->shapes[sno].pts[i-1];
- if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)
- g->shapes[sno].ystop = g->shapes[sno].pts[i];
- if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)
- g->shapes[sno].ystart = g->shapes[sno].pts[i];
- }
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,
- xstart, g->shapes[sno].ystart, 0)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-/* accelerator regions -- lower and upper limits are given for n regions */
-
-int evnannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- dinc = (hi - lo)/(double)n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evannulus(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evnbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evbox(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( evbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evnellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evellipse(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( evellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evnpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- while( lo > hi ) lo -= 360.0;
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* check limits */
- if( !evpie(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evpie(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evpie(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, rinc;
-
- /* get limits */
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- rinc = (radhi - radlo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi) ||
- !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=1; a<=ahi; a++){
- for(r=1; r<=rhi; r++){
- if( evannulus(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, radlo+((r-1)*rinc), radlo+(r*rinc)) &&
- evpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+((a-1)*ainc), anglo+(a*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, radlo, radhi) )
- return(1);
- else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int evbpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( evbox(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the box .. must also be in the pie */
- else if( !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( evbox(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- evqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !evbox(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int evepanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( evellipse(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the ellipse .. must also be in the pie */
- else if( !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( evellipse(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- evqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !evellipse(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-/* varargs regions -- a series of lower and upper limits is specified */
-
-#ifdef __STDC__
-int
-evvannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvannulus(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(evannulus(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evannulus(g, rno+i, sno+i, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-evvbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvbox(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(evbox(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( evbox(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- else if( evbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-
-#ifdef __STDC__
-int
-evvellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvellipse(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(evellipse(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1],
- ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( evellipse(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( evellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-evvpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvpie(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(evpie(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evpie(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evpie(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !evpie(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(1);
- }
-}
-
-#ifdef __STDC__
-int
-evvpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, y);
-#else
-int evvpoint(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* look through all of them to find the right one */
- for(i=0, j=0; i<n; i+=2, j++){
- if( evpoint(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
-}
-
-
diff --git a/funtools/filter/evregions_c.h b/funtools/filter/evregions_c.h
deleted file mode 100644
index 1ecd201..0000000
--- a/funtools/filter/evregions_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *EVREGIONS_C="\n/*\n NB: MAKE SURE YOU EDIT THE TEMPLATE FILE!!!!\n*/\n\n#ifndef FILTER_PTYPE\n#include <regions.h>\n#endif\n\n\n#ifndef UNUSED\n#ifdef __GNUC__\n# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))\n#else\n# define UNUSED(x) UNUSED_ ## x\n#endif\n#endif\n\n\n#define USE_ASTRO_ANGLE 0\n\n\n#define USE_FPU_DOUBLE 0\n#if USE_FPU_DOUBLE\n#include <fpu_control.h>\nstatic fpu_control_t _cw;\n#define FPU_DOUBLE {fpu_control_t _cw2; _FPU_GETCW(_cw); _cw2 = _cw & ~_FPU_EXTENDED; _cw2 |= _FPU_DOUBLE; _FPU_SETCW(_cw2);}\n#define FPU_RESTORE {_FPU_SETCW(_cw);}\n#else\n#define FPU_DOUBLE\n#define FPU_RESTORE\n#endif\n\n\n#define USE_FLOAT_COMPARE 0\n\n\nstatic int evregno=0;\nvoid initevregions(void)\n{\n evregno++;\n return;\n}\n\nstatic int polypt(double x, double y, double* poly, int count,\n double UNUSED(xstart), double ystart, int flag)\n{\n \n \n \n \n\n \n \n \n \n \n \n \n\n \n int crossings = 0;\n\n \n int sign = ((poly[1] - y)>=0) ? 1 : -1;\n\n \n int i;\n\n \n if( flag && (x == poly[0]) && (y == poly[1]) ) return 1;\n\n for(i=0; i<count; i++) {\n int j = (i!=(count-1)) ? i+1 : 0;\n\n \n double x1 = poly[i*2] - x;\n double y1 = poly[i*2+1] - y;\n\n \n double x2 = poly[j*2] - x;\n double y2 = poly[j*2+1] - y;\n\n \n int nextSign = (y2>=0) ? 1 : -1;\n\n \n if( (y1==0) && (y2==0) ){\n if( ((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0)) ){\n \n if( y == ystart )\n return 1;\n else\n return fmod((double)crossings+1,2.0) ? 1 : 0;\n }\n }\n \n else if( (x1==0) && (x2==0) ){\n if( ((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0)) ){\n return fmod((double)crossings+1,2.0) ? 1 : 0;\n }\n }\n \n else if( feq((y1*(x2-x1)),(x1*(y2-y1))) ){\n if( (((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0))) &&\n (((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0))) ){\n return fmod((double)crossings+1,2.0) ? 1 : 0;\n }\n }\n#if 0\n \n if( (y1==0) && (y2==0) ){\n if( ((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0)) ){\n if( y == ystart ){\n return 1;\n }\n }\n }\n \n else if( (x1==0) && (x2==0) ){\n if( ((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0)) ){\n if( x == xstart ){\n return 1;\n }\n }\n }\n \n else if( feq((y1*(x2-x1)),(x1*(y2-y1))) ){\n if( (((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0))) &&\n (((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0))) ){\n return 0;\n }\n }\n#endif\n if (sign != nextSign) {\n if (x1>0 && x2>0)\n crossings++;\n else if (x1>0 || x2>0) {\n if (x1-(y1*(x2-x1)/(y2-y1)) > 0)\n crossings++;\n }\n sign = nextSign;\n }\n }\n\n return crossings%2 ? 1 : 0; \n}\n\nstatic void quadeq(double a, double b, double c,\n double *x1, double *x2, int *nr, int *nc)\n{\n double dis, q;\n if( feq(a,0.0) ){\n *nc = 0;\n if( feq(b,0.0) ){\n *nr = 0; *x1 = 0.0;\n }\n else{\n *nr = 1; *x1 = -c / b;\n }\n *x2 = *x1;\n }\n else{\n dis = b*b - 4.0 * a * c;\n if( dis > 0.0 ){\n *nr = 2; *nc = 0;\n dis = sqrt(dis);\n if( b < 0.0 ) dis = -dis;\n q = -0.5 * (b + dis);\n *x1 = q/a; *x2 = c/q;\n if(*x1 > *x2){\n q = *x1; *x1 = *x2; *x2 = q;\n }\n } \n else if( feq(dis,0.0) ){\n *nr = 1; *nc = 0; *x1 = - 0.5 * b / a; *x2 = *x1;\n }\n else{\n *nr = 0; *nc = 2; *x1 = - 0.5 * b / a; *x2 = 0.5 * sqrt(-dis) / a;\n }\n }\n}\n\nstatic int corner_vertex(int index, int width, int height,\n double *x, double *y)\n{\n switch (index) {\n case 1:\n *x = 0.0;\n *y = height + 1;\n break;\n case 2:\n *x = 0.0;\n *y = 0.0;\n break;\n case 3:\n *x = width + 1;\n *y = 0.0;\n break;\n case 4:\n *x = width + 1;\n *y = height + 1;\n default:\n break;\n }\n index = index + 1;\n if(index > 4) index = 1;\n return(index);\n}\n\nstatic int pie_intercept(double width, double height, double xcen, double ycen,\n double angle, double *xcept, double *ycept)\n{\n double angl, slope; \n angl = angle;\n \n while (angl < 0.0)\n angl = angl + 360.0;\n while (angl >= 360.0)\n angl = angl - 360.0;\n \n#if USE_ASTRO_ANGLE\n if(fabs(angl - 90.0) < SMALL_NUMBER) {\n#else\n if(fabs(angl - 180.0) < SMALL_NUMBER) {\n#endif\n *xcept = 0.0;\n *ycept = ycen;\n return(2);\n }\n#if USE_ASTRO_ANGLE\n if(fabs(angl - 270.0) < SMALL_NUMBER) {\n#else\n if(fabs(angl - 0.0) < SMALL_NUMBER) {\n#endif\n *xcept = width + 1;\n *ycept = ycen;\n return(4);\n }\n \n#if USE_ASTRO_ANGLE\n angl = angl + 90.0;\n#endif\n if(angl >= 360.0)\n angl = angl - 360.0;\n if(angl < 180.0) {\n *ycept = height + 1;\n \n if(fabs(angl - 90.0) < SMALL_NUMBER) {\n *xcept = xcen;\n return(1);\n }\n } else {\n *ycept = 0.0;\n \n if(fabs(angl - 270.0) < SMALL_NUMBER) {\n *xcept = xcen;\n return(3);\n }\n }\n \n angl = (angl / 180.0) * M_PI;\n \n slope = tan(angl);\n \n *xcept = xcen + ((*ycept - ycen) / slope);\n if(*xcept < 0) {\n *ycept = (ycen - (xcen * slope));\n *xcept = 0.0;\n return(2);\n } else if(*xcept > (width + 1)) {\n *ycept = (ycen + ((width + 1 - xcen) * slope));\n *xcept = width + 1;\n return(4);\n } else {\n if(*ycept < height)\n return(3);\n else\n return(1);\n }\n}\n\n\n\nint evannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double ri, double ro)\n{\n \n if( ri == 0 ){\n return(evcircle(g, rno, sno, flag, type, x, y, xcen, ycen, ro));\n }\n\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n g->shapes[sno].ystart = ycen - ro;\n g->shapes[sno].ystop = ycen + ro;\n g->shapes[sno].r1sq = ri * ri;\n g->shapes[sno].r2sq = ro * ro;\n }\n\n if((((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))<=g->shapes[sno].r2sq) &&\n (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))>g->shapes[sno].r1sq)) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else{\n return 0;\n }\n}\n\nint evbox(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y,\n double xcen, double ycen, double xwidth, double yheight,\n double angle)\n{\n int i;\n double angl; \n double half_width, half_height;\n double cosangl, sinangl; \n double hw_cos, hw_sin; \n double hh_cos, hh_sin; \n double xstart=0.0;\n\n if( (xwidth == 0) && (yheight==0) ){\n return(!flag);\n }\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n#if USE_ASTRO_ANGLE\n \n angl = angle + 90.0;\n#else\n angl = angle;\n#endif\n while (angl >= 360.0) angl = angl - 360.0;\n \n angl = (angl / 180.0) * M_PI;\n sinangl = sin (angl);\n cosangl = cos (angl);\n#if USE_ASTRO_ANGLE\n \n \n \n half_width = yheight / 2.0;\n half_height = xwidth / 2.0;\n#else\n half_width = xwidth / 2.0;\n half_height = yheight / 2.0;\n#endif\n hw_cos = half_width * cosangl;\n hw_sin = half_width * sinangl;\n hh_cos = half_height * cosangl;\n hh_sin = half_height * sinangl;\n g->shapes[sno].pts = (double *)calloc(8, sizeof(double));\n#if USE_ASTRO_ANGLE\n g->shapes[sno].pts[0] = xcen - hw_cos - hh_sin;\n g->shapes[sno].pts[1] = ycen - hw_sin + hh_cos;\n g->shapes[sno].pts[2] = xcen + hw_cos - hh_sin;\n g->shapes[sno].pts[3] = ycen + hw_sin + hh_cos;\n g->shapes[sno].pts[4] = xcen + hw_cos + hh_sin;\n g->shapes[sno].pts[5] = ycen + hw_sin - hh_cos;\n g->shapes[sno].pts[6] = xcen - hw_cos + hh_sin;\n g->shapes[sno].pts[7] = ycen - hw_sin - hh_cos;\n#else\n g->shapes[sno].pts[0] = xcen - hw_cos + hh_sin;\n g->shapes[sno].pts[1] = ycen - hh_cos - hw_sin;\n g->shapes[sno].pts[2] = xcen - hw_cos - hh_sin;\n g->shapes[sno].pts[3] = ycen + hh_cos - hw_sin;\n g->shapes[sno].pts[4] = xcen + hw_cos - hh_sin;\n g->shapes[sno].pts[5] = ycen + hh_cos + hw_sin;\n g->shapes[sno].pts[6] = xcen + hw_cos + hh_sin;\n g->shapes[sno].pts[7] = ycen - hh_cos + hw_sin;\n#endif\n g->shapes[sno].npt = 8;\n \n if( g->shapes[sno].npt ){\n xstart = g->shapes[sno].pts[0];\n g->shapes[sno].ystart = g->shapes[sno].pts[1];\n g->shapes[sno].ystop = g->shapes[sno].ystart;\n for(i=1; i<g->shapes[sno].npt; i+=2){\n if(g->shapes[sno].pts[i-1] < xstart)\n xstart = g->shapes[sno].pts[i-1];\n if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)\n g->shapes[sno].ystop = g->shapes[sno].pts[i];\n if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)\n g->shapes[sno].ystart = g->shapes[sno].pts[i];\n }\n }\n }\n if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,\n xstart, g->shapes[sno].ystart, 0)) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\nint evcircle(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y,\n double xcen, double ycen, double radius)\n{\n if( radius == 0 ){\n return(!flag);\n }\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n g->shapes[sno].ystart = ycen - radius;\n g->shapes[sno].ystop = ycen + radius;\n g->shapes[sno].r1sq = radius * radius;\n }\n if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))<=g->shapes[sno].r1sq)) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\nint evellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xrad, double yrad, double angle)\n{\n double yhi, yoff;\n double b, c;\n double b_partial, c_partial;\n double xboff, xfoff;\n int nr, nc;\n\n \n if( xrad == yrad ){\n return(evcircle(g, rno, sno, flag, type, x, y, xcen, ycen, xrad));\n }\n\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n \n#if USE_ASTRO_ANGLE\n \n g->shapes[sno].angl = angle + 90.0;\n#else\n g->shapes[sno].angl = angle;\n#endif\n while( g->shapes[sno].angl >= 360.0 )\n g->shapes[sno].angl = g->shapes[sno].angl - 360.0;\n \n g->shapes[sno].angl = (g->shapes[sno].angl / 180.0) * M_PI;\n g->shapes[sno].sinangl = sin(g->shapes[sno].angl);\n g->shapes[sno].cosangl = cos(g->shapes[sno].angl);\n \n \n#if USE_ASTRO_ANGLE\n yhi = fabs(g->shapes[sno].sinangl * yrad) + \n fabs(g->shapes[sno].cosangl * xrad);\n#else\n yhi = fabs(g->shapes[sno].sinangl * xrad) + \n fabs(g->shapes[sno].cosangl * yrad);\n#endif\n yhi = min(yhi, max(yrad, xrad));\n g->shapes[sno].ystart = ycen - yhi;\n g->shapes[sno].ystop = ycen + yhi;\n \n g->shapes[sno].cossq = g->shapes[sno].cosangl * g->shapes[sno].cosangl;\n g->shapes[sno].sinsq = g->shapes[sno].sinangl * g->shapes[sno].sinangl;\n#if USE_ASTRO_ANGLE\n \n \n \n \n g->shapes[sno].xradsq = yrad * yrad;\n g->shapes[sno].yradsq = xrad * xrad;\n#else\n g->shapes[sno].xradsq = xrad * xrad;\n g->shapes[sno].yradsq = yrad * yrad;\n#endif\n \n g->shapes[sno].a = (g->shapes[sno].cossq / g->shapes[sno].xradsq) + \n (g->shapes[sno].sinsq / g->shapes[sno].yradsq);\n }\n if( ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) ){\n b_partial = (2.0 * g->shapes[sno].sinangl) * \n ((g->shapes[sno].cosangl / g->shapes[sno].xradsq) - \n (g->shapes[sno].cosangl / g->shapes[sno].yradsq));\n c_partial = (g->shapes[sno].sinsq / g->shapes[sno].xradsq) + \n (g->shapes[sno].cossq / g->shapes[sno].yradsq);\n yoff = y - ycen;\n b = b_partial * yoff;\n c = (c_partial * yoff * yoff) - 1.0;\n \n quadeq (g->shapes[sno].a, b, c, &xboff, &xfoff, &nr, &nc);\n \n if( nr != 0 ) {\n FPU_DOUBLE\n#if USE_FLOAT_COMPARE\n if( (((float)x>=(float)(xcen+xboff)) && \n ((float)x<=(float)(xcen+xfoff))) == flag ){\n#else\n if( ((x>=(xcen+xboff)) && (x<=(xcen+xfoff))) == flag ){\n#endif\n if( rno && flag ) g->rid = rno;\n FPU_RESTORE\n return 1;\n }\n else{\n FPU_RESTORE\n return 0;\n }\n }\n else\n return !flag;\n }\n return !flag;\n}\n\nint evfield(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),\n double UNUSED(x), double UNUSED(y))\n{\n if( flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\nint evline(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y,\n double x1, double y1, double x2, double y2)\n{\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n g->shapes[sno].ystart = min(y1,y2);\n g->shapes[sno].ystop = max(y1,y2);\n g->shapes[sno].x1 = x1;\n g->shapes[sno].x2 = x2;\n g->shapes[sno].y1 = y1;\n if( feq(y1,y2) ){\n g->shapes[sno].xonly = 1;\n g->shapes[sno].invslope = 0;\n }\n else{\n g->shapes[sno].xonly = 0;\n g->shapes[sno].invslope = (x1 - x2) / (y1 - y2);\n }\n }\n if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n ((!g->shapes[sno].xonly &&\n feq((((y-g->shapes[sno].y1)*g->shapes[sno].invslope)+g->shapes[sno].x1),x)) ||\n (g->shapes[sno].xonly &&\n ((x>=g->shapes[sno].x1)&&(x<=g->shapes[sno].x2))))) == flag){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\nint evpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2)\n{\n int i;\n int width, height; \n double sweep; \n int intrcpt1, intrcpt2; \n double x2, y2; \n double xstart=0.0;\n\n \n if( (angle1==0) && (angle2==360) ){\n return(evfield(g, rno, sno, flag, type, x, y));\n }\n\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n \n width = LARGE_NUMBER;\n height = LARGE_NUMBER;\n \n g->shapes[sno].pts = (double *)calloc(14, sizeof(double));\n g->shapes[sno].pts[0] = xcen;\n g->shapes[sno].pts[1] = ycen;\n sweep = angle2 - angle1;\n \n if(fabs(sweep) < SMALL_NUMBER)\n return !flag;\n if (sweep < 0.0) sweep = sweep + 360.0;\n intrcpt1 = pie_intercept((double)width, (double)height, xcen, ycen, angle1,\n &(g->shapes[sno].pts[2]),\n &(g->shapes[sno].pts[3]));\n intrcpt2 = pie_intercept((double)width, (double)height, xcen, ycen, angle2,\n &x2, &y2);\n g->shapes[sno].npt = 4;\n \n \n if((intrcpt1 != intrcpt2) || (sweep > 180.0)){\n do{\n intrcpt1 = corner_vertex(intrcpt1, width, height, \n &(g->shapes[sno].pts[g->shapes[sno].npt]),\n &(g->shapes[sno].pts[g->shapes[sno].npt+1]));\n g->shapes[sno].npt = g->shapes[sno].npt + 2;\n }while(intrcpt1 != intrcpt2);\n }\n g->shapes[sno].pts[g->shapes[sno].npt] = x2;\n g->shapes[sno].pts[g->shapes[sno].npt+1] = y2;\n g->shapes[sno].npt = g->shapes[sno].npt + 2;\n \n if( g->shapes[sno].npt ){\n xstart = g->shapes[sno].pts[0];\n g->shapes[sno].ystart = g->shapes[sno].pts[1];\n g->shapes[sno].ystop = g->shapes[sno].ystart;\n for(i=1; i<g->shapes[sno].npt; i+=2){\n if(g->shapes[sno].pts[i-1] < xstart)\n xstart = g->shapes[sno].pts[i-1];\n if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)\n g->shapes[sno].ystop = g->shapes[sno].pts[i];\n if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)\n g->shapes[sno].ystart = g->shapes[sno].pts[i];\n }\n }\n }\n if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,\n xstart, g->shapes[sno].ystart, 1)) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else{\n return 0;\n }\n}\n\nint evqtpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2)\n{\n return evpie(g, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);\n}\n\nint evpoint(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),\n double x, double y,\n double xcen, double ycen)\n{\n if( ((x==xcen) && (y==ycen)) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\n#ifdef __STDC__\nint\nevpolygon(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y, ...)\n{\n int i, maxpts;\n double xstart=0.0;\n va_list args;\n va_start(args, y);\n#else\nint evpolygon(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xstart=0.0;\n int i, maxpts;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n#endif\n if( !g->shapes[sno].init ){\n g->shapes[sno].init = 1;\n \n maxpts = MASKINC;\n g->shapes[sno].pts = (double *)calloc(maxpts, sizeof(double));\n \n g->shapes[sno].npt = 0;\n while( 1 ){\n if( g->shapes[sno].npt >= maxpts ){\n maxpts += MASKINC;\n g->shapes[sno].pts = (double *)realloc(g->shapes[sno].pts,\n maxpts*sizeof(double));\n }\n g->shapes[sno].pts[g->shapes[sno].npt] = va_arg(args, double);\n \n if( feq(g->shapes[sno].pts[g->shapes[sno].npt],PSTOP) &&\n feq(g->shapes[sno].pts[g->shapes[sno].npt-1],PSTOP) ){\n g->shapes[sno].npt--;\n break;\n }\n g->shapes[sno].npt++;\n }\n va_end(args);\n \n g->shapes[sno].pts = (double *)realloc(g->shapes[sno].pts,\n g->shapes[sno].npt*sizeof(double));\n \n if( g->shapes[sno].npt ){\n xstart = g->shapes[sno].pts[0];\n g->shapes[sno].ystart = g->shapes[sno].pts[1];\n g->shapes[sno].ystop = g->shapes[sno].ystart;\n for(i=1; i<g->shapes[sno].npt; i+=2){\n if(g->shapes[sno].pts[i-1] < xstart)\n xstart = g->shapes[sno].pts[i-1];\n if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)\n g->shapes[sno].ystop = g->shapes[sno].pts[i];\n if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)\n g->shapes[sno].ystart = g->shapes[sno].pts[i];\n }\n }\n }\n if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,\n xstart, g->shapes[sno].ystart, 0)) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\n\n\nint evnannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lo, double hi, int n)\n{\n int i;\n int xsno;\n double dinc;\n\n \n dinc = (hi - lo)/(double)n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( evannulus(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){\n return(1);\n }\n }\n return(0);\n }\n else{\n \n if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){\n return(1);\n }\n return(0);\n }\n}\n\nint evnbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double ang)\n{\n int i;\n int xsno;\n double dincx;\n double dincy;\n\n \n dincx = (hix - lox)/n;\n dincy = (hiy - loy)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(0);\n }\n \n if( evbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( evbox(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(1);\n }\n \n if( evbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(1);\n }\n return(0);\n }\n}\n\nint evnellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double ang)\n{\n int i;\n int xsno;\n double dincx;\n double dincy;\n\n \n dincx = (hix - lox)/n;\n dincy = (hiy - loy)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(0);\n }\n \n if( evellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( evellipse(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(1);\n }\n \n if( evellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(1);\n }\n return(0);\n }\n}\n\nint evnpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lo, double hi, int n)\n{\n int i;\n int xsno;\n double dinc;\n\n \n while( lo > hi ) lo -= 360.0;\n dinc = (hi - lo)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evpie(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( evpie(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){\n return(1);\n }\n }\n return(0);\n }\n else{\n \n if( !evpie(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){\n return(1);\n }\n return(0);\n }\n}\n\nint evpanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double radlo, double radhi, double radn)\n{\n \n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, rinc;\n\n \n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n rinc = (radhi - radlo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi) ||\n !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi) ){\n return(0);\n }\n \n for(a=1; a<=ahi; a++){\n for(r=1; r<=rhi; r++){\n if( evannulus(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, radlo+((r-1)*rinc), radlo+(r*rinc)) &&\n evpie(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+((a-1)*ainc), anglo+(a*ainc)) ){\n return(1);\n }\n n++;\n }\n }\n return(0);\n }\n else{\n \n if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, radlo, radhi) )\n return(1);\n else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){\n return(1);\n }\n else{\n return(0);\n }\n }\n}\n\nint evbpanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double xlo, double ylo, double xhi, double yhi, double radn,\n double ang)\n{\n \n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, xinc, yinc;\n\n \n anglo += ang;\n anghi += ang;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n xinc = (xhi - xlo)/radn;\n yinc = (yhi - ylo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,\n ang) ){\n return(0);\n }\n \n else if( evbox(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,\n ang) ){\n return(0);\n }\n \n else if( !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){\n return(0);\n }\n \n for(a=0; a<ahi; a++){\n for(r=1; r<=rhi; r++){\n if( evbox(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&\n evqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){\n return(1);\n }\n n++;\n }\n }\n return(0);\n }\n else{\n \n if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )\n return(1);\n \n else if( !evbox(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,\n ang) )\n return(1);\n \n else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){\n return(1);\n }\n else{\n return(0);\n }\n }\n}\n\nint evepanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double xlo, double ylo, double xhi, double yhi, double radn,\n double ang)\n{\n \n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, xinc, yinc;\n\n \n anglo += ang;\n anghi += ang;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n xinc = (xhi - xlo)/radn;\n yinc = (yhi - ylo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,\n ang) ){\n return(0);\n }\n \n else if( evellipse(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,\n ang) ){\n return(0);\n }\n \n else if( !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){\n return(0);\n }\n \n for(a=0; a<ahi; a++){\n for(r=1; r<=rhi; r++){\n if( evellipse(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&\n evqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){\n return(1);\n }\n n++;\n }\n }\n return(0);\n }\n else{\n \n if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )\n return(1);\n \n else if( !evellipse(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,\n ang) )\n return(1);\n \n else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){\n return(1);\n }\n else{\n return(0);\n }\n }\n}\n\n\n\n#ifdef __STDC__\nint\nevvannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint evvannulus(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double *xv;\n int i, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n if( n == 2 ){\n return(evannulus(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]));\n }\n if( flag ){\n \n if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( evannulus(g, rno+i, sno+i, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1]) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(1);\n }\n return(0);\n }\n}\n\n#ifdef __STDC__\nint\nevvbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double ang;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint evvbox(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n ang = xv[--n];\n \n if( n == 2 ){\n return(evbox(g, rno, sno, flag, type, x, y,\n xcen, ycen, xv[0], xv[1], ang));\n }\n if( flag ){\n \n if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],\n ang) ){\n return(0);\n }\n \n if( evbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){\n return(0);\n }\n \n for(i=2, j=0; i<n; i+=2, j++){\n if( evbox(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1], ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang) ){\n return(1);\n }\n \n else if( evbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){\n return(1);\n }\n return(0);\n }\n}\n\n\n#ifdef __STDC__\nint\nevvellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double ang;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint evvellipse(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n ang = xv[--n];\n \n if( n == 2 ){\n return(evellipse(g, rno, sno, flag, type, x, y,\n xcen, ycen, xv[0], xv[1], ang));\n }\n if( flag ){\n \n if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],\n ang) ){\n return(0);\n }\n \n if( evellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1],\n ang) ){\n return(0);\n }\n \n for(i=2, j=0; i<n; i+=2, j++){\n if( evellipse(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1], ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1],\n ang) ){\n return(1);\n }\n \n if( evellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){\n return(1);\n }\n return(0);\n }\n}\n\n#ifdef __STDC__\nint\nevvpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint evvpie(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double *xv;\n int i, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n if( n == 2 ){\n return(evpie(g, rno, sno, flag, type, x, y,\n xcen, ycen, xv[0], xv[1]));\n }\n if( flag ){\n \n if( !evpie(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( evpie(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !evpie(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(1);\n }\n return(1);\n }\n}\n\n#ifdef __STDC__\nint\nevvpoint(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, y);\n#else\nint evvpoint(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n for(i=0, j=0; i<n; i+=2, j++){\n if( evpoint(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]) ){\n return(1);\n }\n }\n return(0);\n}\n\n\n";
diff --git a/funtools/filter/evregions_c.tmpl b/funtools/filter/evregions_c.tmpl
deleted file mode 100644
index 9fe330e..0000000
--- a/funtools/filter/evregions_c.tmpl
+++ /dev/null
@@ -1,1532 +0,0 @@
-/*
- NB: MAKE SURE YOU EDIT THE TEMPLATE FILE!!!!
-*/
-
-#ifndef FILTER_PTYPE
-#include <regions.h>
-#endif
-
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-/* panda and pie incorrectly used astronomical angles. fixed 4/2004 */
-#define USE_ASTRO_ANGLE 0
-
-/* we might want to avoid (x86) extended precision problems */
-#define USE_FPU_DOUBLE _FPUDBL_
-#if USE_FPU_DOUBLE
-#include <fpu_control.h>
-static fpu_control_t _cw;
-#define FPU_DOUBLE {fpu_control_t _cw2; _FPU_GETCW(_cw); _cw2 = _cw & ~_FPU_EXTENDED; _cw2 |= _FPU_DOUBLE; _FPU_SETCW(_cw2);}
-#define FPU_RESTORE {_FPU_SETCW(_cw);}
-#else
-#define FPU_DOUBLE
-#define FPU_RESTORE
-#endif
-
-/* alternate method of avoiding (x86) extended precision problems */
-#define USE_FLOAT_COMPARE 0
-
-/* add this to FilterOpen to cause this module to be loaded for dynamic linking */
-static int evregno=0;
-void initevregions(void)
-{
- evregno++;
- return;
-}
-
-static int polypt(double x, double y, double* poly, int count,
- double UNUSED(xstart), double ystart, int flag)
-{
- /* x-- x value of point being tested */
- /* y-- y value of point being tested */
- /* poly-- bounding polygon, array of length (count*2) */
- /* count-- number of edges of bounding polygon */
-
- /* This algorithm is from "An Introduction to Ray Tracing", Academic Press, */
- /* 1989, edited by Andrew Glassner, pg 53 */
- /* a point lies in a polygon if a line is extended from the point to infinite */
- /* in any direction and the number of intersections with the polygon is odd. */
- /* This is valid for both concave and convex polygons. */
- /* Points on a vertex are considered inside. */
- /* Points on a edge are considered inside. */
-
- /* number of crossings */
- int crossings = 0;
-
- /* init sign for first vertice */
- int sign = ((poly[1] - y)>=0) ? 1 : -1;
-
- /* for all edges */
- int i;
-
- /* if flag is set, we check x, y against first point */
- if( flag && (x == poly[0]) && (y == poly[1]) ) return 1;
-
- for(i=0; i<count; i++) {
- int j = (i!=(count-1)) ? i+1 : 0;
-
- /* Vertex 1 */
- double x1 = poly[i*2] - x;
- double y1 = poly[i*2+1] - y;
-
- /* Vertex 2 */
- double x2 = poly[j*2] - x;
- double y2 = poly[j*2+1] - y;
-
- /* sign holder for p2 */
- int nextSign = (y2>=0) ? 1 : -1;
-
- /* horiz line */
- if( (y1==0) && (y2==0) ){
- if( ((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0)) ){
- /* we always return true for ystart horiz lines */
- if( y == ystart )
- return 1;
- else
- return fmod((double)crossings+1,2.0) ? 1 : 0;
- }
- }
- /* vertical line */
- else if( (x1==0) && (x2==0) ){
- if( ((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0)) ){
- return fmod((double)crossings+1,2.0) ? 1 : 0;
- }
- }
- /* point on line */
- else if( feq((y1*(x2-x1)),(x1*(y2-y1))) ){
- if( (((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0))) &&
- (((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0))) ){
- return fmod((double)crossings+1,2.0) ? 1 : 0;
- }
- }
-#if 0
- /* horiz line */
- if( (y1==0) && (y2==0) ){
- if( ((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0)) ){
- if( y == ystart ){
- return 1;
- }
- }
- }
- /* vertical line */
- else if( (x1==0) && (x2==0) ){
- if( ((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0)) ){
- if( x == xstart ){
- return 1;
- }
- }
- }
- /* point on line */
- else if( feq((y1*(x2-x1)),(x1*(y2-y1))) ){
- if( (((x2>=0) && (x1<=0)) || ((x1>=0) && (x2<=0))) &&
- (((y2>=0) && (y1<=0)) || ((y1>=0) && (y2<=0))) ){
- return 0;
- }
- }
-#endif
- if (sign != nextSign) {
- if (x1>0 && x2>0)
- crossings++;
- else if (x1>0 || x2>0) {
- if (x1-(y1*(x2-x1)/(y2-y1)) > 0)
- crossings++;
- }
- sign = nextSign;
- }
- }
-
- return crossings%2 ? 1 : 0; /* if odd, point is inside */
-}
-
-static void quadeq(double a, double b, double c,
- double *x1, double *x2, int *nr, int *nc)
-{
- double dis, q;
- if( feq(a,0.0) ){
- *nc = 0;
- if( feq(b,0.0) ){
- *nr = 0; *x1 = 0.0;
- }
- else{
- *nr = 1; *x1 = -c / b;
- }
- *x2 = *x1;
- }
- else{
- dis = b*b - 4.0 * a * c;
- if( dis > 0.0 ){
- *nr = 2; *nc = 0;
- dis = sqrt(dis);
- if( b < 0.0 ) dis = -dis;
- q = -0.5 * (b + dis);
- *x1 = q/a; *x2 = c/q;
- if(*x1 > *x2){
- q = *x1; *x1 = *x2; *x2 = q;
- }
- }
- else if( feq(dis,0.0) ){
- *nr = 1; *nc = 0; *x1 = - 0.5 * b / a; *x2 = *x1;
- }
- else{
- *nr = 0; *nc = 2; *x1 = - 0.5 * b / a; *x2 = 0.5 * sqrt(-dis) / a;
- }
- }
-}
-
-static int corner_vertex(int index, int width, int height,
- double *x, double *y)
-{
- switch (index) {
- case 1:
- *x = 0.0;
- *y = height + 1;
- break;
- case 2:
- *x = 0.0;
- *y = 0.0;
- break;
- case 3:
- *x = width + 1;
- *y = 0.0;
- break;
- case 4:
- *x = width + 1;
- *y = height + 1;
- default:
- break;
- }
- index = index + 1;
- if(index > 4) index = 1;
- return(index);
-}
-
-static int pie_intercept(double width, double height, double xcen, double ycen,
- double angle, double *xcept, double *ycept)
-{
- double angl, slope; /* l: angle and slope of ray */
- angl = angle;
- /* put angles in normal range */
- while (angl < 0.0)
- angl = angl + 360.0;
- while (angl >= 360.0)
- angl = angl - 360.0;
- /* check for a horizontal angle */
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 180.0) < SMALL_NUMBER) {
-#endif
- *xcept = 0.0;
- *ycept = ycen;
- return(2);
- }
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 0.0) < SMALL_NUMBER) {
-#endif
- *xcept = width + 1;
- *ycept = ycen;
- return(4);
- }
- /* convert to a Cartesian angle */
-#if USE_ASTRO_ANGLE
- angl = angl + 90.0;
-#endif
- if(angl >= 360.0)
- angl = angl - 360.0;
- if(angl < 180.0) {
- *ycept = height + 1;
- /* rule out vertical line */
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(1);
- }
- } else {
- *ycept = 0.0;
- /* rule out vertical line */
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(3);
- }
- }
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- /* calculate slope */
- slope = tan(angl);
- /* calculate intercept with designated y edge */
- *xcept = xcen + ((*ycept - ycen) / slope);
- if(*xcept < 0) {
- *ycept = (ycen - (xcen * slope));
- *xcept = 0.0;
- return(2);
- } else if(*xcept > (width + 1)) {
- *ycept = (ycen + ((width + 1 - xcen) * slope));
- *xcept = width + 1;
- return(4);
- } else {
- if(*ycept < height)
- return(3);
- else
- return(1);
- }
-}
-
-/* ***************************** shapes ********************************** */
-
-int evannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double ri, double ro)
-{
- /* use circle if possible */
- if( ri == 0 ){
- return(evcircle(g, rno, sno, flag, type, x, y, xcen, ycen, ro));
- }
-
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- g->shapes[sno].ystart = ycen - ro;
- g->shapes[sno].ystop = ycen + ro;
- g->shapes[sno].r1sq = ri * ri;
- g->shapes[sno].r2sq = ro * ro;
- }
-
- if((((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))<=g->shapes[sno].r2sq) &&
- (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))>g->shapes[sno].r1sq)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-int evbox(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double xcen, double ycen, double xwidth, double yheight,
- double angle)
-{
- int i;
- double angl; /* l: Cartesian angle in radians */
- double half_width, half_height;/* l: radii (1/2 width and height) */
- double cosangl, sinangl; /* l: sine, cosine of the Cartesian angle */
- double hw_cos, hw_sin; /* l: products of half_width with sin, cos */
- double hh_cos, hh_sin; /* l: products of half_height with sin, cos */
- double xstart=0.0;
-
- if( (xwidth == 0) && (yheight==0) ){
- return(!flag);
- }
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save angle for use in multi or slices */
- angl = angle + 90.0;
-#else
- angl = angle;
-#endif
- while (angl >= 360.0) angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin (angl);
- cosangl = cos (angl);
-#if USE_ASTRO_ANGLE
- /* since we rotate by 90.0 degrees to get from astro angle to cartesian, */
- /* we also need to switch the width and height. we do this secretly so */
- /* that the display will turn out right, by doing it in the half terms */
- half_width = yheight / 2.0;
- half_height = xwidth / 2.0;
-#else
- half_width = xwidth / 2.0;
- half_height = yheight / 2.0;
-#endif
- hw_cos = half_width * cosangl;
- hw_sin = half_width * sinangl;
- hh_cos = half_height * cosangl;
- hh_sin = half_height * sinangl;
- g->shapes[sno].pts = (double *)calloc(8, sizeof(double));
-#if USE_ASTRO_ANGLE
- g->shapes[sno].pts[0] = xcen - hw_cos - hh_sin;
- g->shapes[sno].pts[1] = ycen - hw_sin + hh_cos;
- g->shapes[sno].pts[2] = xcen + hw_cos - hh_sin;
- g->shapes[sno].pts[3] = ycen + hw_sin + hh_cos;
- g->shapes[sno].pts[4] = xcen + hw_cos + hh_sin;
- g->shapes[sno].pts[5] = ycen + hw_sin - hh_cos;
- g->shapes[sno].pts[6] = xcen - hw_cos + hh_sin;
- g->shapes[sno].pts[7] = ycen - hw_sin - hh_cos;
-#else
- g->shapes[sno].pts[0] = xcen - hw_cos + hh_sin;
- g->shapes[sno].pts[1] = ycen - hh_cos - hw_sin;
- g->shapes[sno].pts[2] = xcen - hw_cos - hh_sin;
- g->shapes[sno].pts[3] = ycen + hh_cos - hw_sin;
- g->shapes[sno].pts[4] = xcen + hw_cos - hh_sin;
- g->shapes[sno].pts[5] = ycen + hh_cos + hw_sin;
- g->shapes[sno].pts[6] = xcen + hw_cos + hh_sin;
- g->shapes[sno].pts[7] = ycen - hh_cos + hw_sin;
-#endif
- g->shapes[sno].npt = 8;
- /* now find the y limits */
- if( g->shapes[sno].npt ){
- xstart = g->shapes[sno].pts[0];
- g->shapes[sno].ystart = g->shapes[sno].pts[1];
- g->shapes[sno].ystop = g->shapes[sno].ystart;
- for(i=1; i<g->shapes[sno].npt; i+=2){
- if(g->shapes[sno].pts[i-1] < xstart)
- xstart = g->shapes[sno].pts[i-1];
- if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)
- g->shapes[sno].ystop = g->shapes[sno].pts[i];
- if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)
- g->shapes[sno].ystart = g->shapes[sno].pts[i];
- }
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,
- xstart, g->shapes[sno].ystart, 0)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evcircle(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double xcen, double ycen, double radius)
-{
- if( radius == 0 ){
- return(!flag);
- }
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- g->shapes[sno].ystart = ycen - radius;
- g->shapes[sno].ystop = ycen + radius;
- g->shapes[sno].r1sq = radius * radius;
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- (((xcen-x)*(xcen-x))+((ycen-y)*(ycen-y))<=g->shapes[sno].r1sq)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad, double angle)
-{
- double yhi, yoff;
- double b, c;
- double b_partial, c_partial;
- double xboff, xfoff;
- int nr, nc;
-
- /* use circle if possible */
- if( xrad == yrad ){
- return(evcircle(g, rno, sno, flag, type, x, y, xcen, ycen, xrad));
- }
-
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- /* set worst case limits (xrad axis parallel to vertical axis) */
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save "angle" for use by other routines */
- g->shapes[sno].angl = angle + 90.0;
-#else
- g->shapes[sno].angl = angle;
-#endif
- while( g->shapes[sno].angl >= 360.0 )
- g->shapes[sno].angl = g->shapes[sno].angl - 360.0;
- /* convert to radians */
- g->shapes[sno].angl = (g->shapes[sno].angl / 180.0) * M_PI;
- g->shapes[sno].sinangl = sin(g->shapes[sno].angl);
- g->shapes[sno].cosangl = cos(g->shapes[sno].angl);
- /* calculate approximate y limits */
- /* choose lesser of containing rotbox and circle */
-#if USE_ASTRO_ANGLE
- yhi = fabs(g->shapes[sno].sinangl * yrad) +
- fabs(g->shapes[sno].cosangl * xrad);
-#else
- yhi = fabs(g->shapes[sno].sinangl * xrad) +
- fabs(g->shapes[sno].cosangl * yrad);
-#endif
- yhi = min(yhi, max(yrad, xrad));
- g->shapes[sno].ystart = ycen - yhi;
- g->shapes[sno].ystop = ycen + yhi;
- /* prepare partials for quadratic equation solutions to coordinates */
- g->shapes[sno].cossq = g->shapes[sno].cosangl * g->shapes[sno].cosangl;
- g->shapes[sno].sinsq = g->shapes[sno].sinangl * g->shapes[sno].sinangl;
-#if USE_ASTRO_ANGLE
- /* because we rotate by 90.0 degrees to get from astro angle to */
- /* cartesian, we also need to switch the x and y axes. we do this */
- /* secretly so that the display will turn out right, by doing it in */
- /* the sq terms */
- g->shapes[sno].xradsq = yrad * yrad;
- g->shapes[sno].yradsq = xrad * xrad;
-#else
- g->shapes[sno].xradsq = xrad * xrad;
- g->shapes[sno].yradsq = yrad * yrad;
-#endif
- /* fill in as much of a,b,c as we can */
- g->shapes[sno].a = (g->shapes[sno].cossq / g->shapes[sno].xradsq) +
- (g->shapes[sno].sinsq / g->shapes[sno].yradsq);
- }
- if( ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) ){
- b_partial = (2.0 * g->shapes[sno].sinangl) *
- ((g->shapes[sno].cosangl / g->shapes[sno].xradsq) -
- (g->shapes[sno].cosangl / g->shapes[sno].yradsq));
- c_partial = (g->shapes[sno].sinsq / g->shapes[sno].xradsq) +
- (g->shapes[sno].cossq / g->shapes[sno].yradsq);
- yoff = y - ycen;
- b = b_partial * yoff;
- c = (c_partial * yoff * yoff) - 1.0;
- /* solve quadratic */
- quadeq (g->shapes[sno].a, b, c, &xboff, &xfoff, &nr, &nc);
- /* if real roots */
- if( nr != 0 ) {
- FPU_DOUBLE
-#if USE_FLOAT_COMPARE
- if( (((float)x>=(float)(xcen+xboff)) &&
- ((float)x<=(float)(xcen+xfoff))) == flag ){
-#else
- if( ((x>=(xcen+xboff)) && (x<=(xcen+xfoff))) == flag ){
-#endif
- if( rno && flag ) g->rid = rno;
- FPU_RESTORE
- return 1;
- }
- else{
- FPU_RESTORE
- return 0;
- }
- }
- else
- return !flag;
- }
- return !flag;
-}
-
-int evfield(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),
- double UNUSED(x), double UNUSED(y))
-{
- if( flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evline(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double x1, double y1, double x2, double y2)
-{
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- g->shapes[sno].ystart = min(y1,y2);
- g->shapes[sno].ystop = max(y1,y2);
- g->shapes[sno].x1 = x1;
- g->shapes[sno].x2 = x2;
- g->shapes[sno].y1 = y1;
- if( feq(y1,y2) ){
- g->shapes[sno].xonly = 1;
- g->shapes[sno].invslope = 0;
- }
- else{
- g->shapes[sno].xonly = 0;
- g->shapes[sno].invslope = (x1 - x2) / (y1 - y2);
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- ((!g->shapes[sno].xonly &&
- feq((((y-g->shapes[sno].y1)*g->shapes[sno].invslope)+g->shapes[sno].x1),x)) ||
- (g->shapes[sno].xonly &&
- ((x>=g->shapes[sno].x1)&&(x<=g->shapes[sno].x2))))) == flag){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-int evpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- int i;
- int width, height; /* l: image mask width and height */
- double sweep; /* l: sweep between cut angles */
- int intrcpt1, intrcpt2; /* l: side intercepted by each cut */
- double x2, y2; /* l: coordinates of second intercept */
- double xstart=0.0;
-
- /* use field if possible */
- if( (angle1==0) && (angle2==360) ){
- return(evfield(g, rno, sno, flag, type, x, y));
- }
-
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- /* we have to fake width and height, since we do not know them! */
- width = LARGE_NUMBER;
- height = LARGE_NUMBER;
- /* start listing vertices of polygon */
- g->shapes[sno].pts = (double *)calloc(14, sizeof(double));
- g->shapes[sno].pts[0] = xcen;
- g->shapes[sno].pts[1] = ycen;
- sweep = angle2 - angle1;
- /* if sweep is too small to be noticed, don't bother */
- if(fabs(sweep) < SMALL_NUMBER)
- return !flag;
- if (sweep < 0.0) sweep = sweep + 360.0;
- intrcpt1 = pie_intercept((double)width, (double)height, xcen, ycen, angle1,
- &(g->shapes[sno].pts[2]),
- &(g->shapes[sno].pts[3]));
- intrcpt2 = pie_intercept((double)width, (double)height, xcen, ycen, angle2,
- &x2, &y2);
- g->shapes[sno].npt = 4;
- /* if angles intercept same side and slice is between them, no corners */
- /* else, mark corners until reaching side with second angle intercept */
- if((intrcpt1 != intrcpt2) || (sweep > 180.0)){
- do{
- intrcpt1 = corner_vertex(intrcpt1, width, height,
- &(g->shapes[sno].pts[g->shapes[sno].npt]),
- &(g->shapes[sno].pts[g->shapes[sno].npt+1]));
- g->shapes[sno].npt = g->shapes[sno].npt + 2;
- }while(intrcpt1 != intrcpt2);
- }
- g->shapes[sno].pts[g->shapes[sno].npt] = x2;
- g->shapes[sno].pts[g->shapes[sno].npt+1] = y2;
- g->shapes[sno].npt = g->shapes[sno].npt + 2;
- /* now find the y limits */
- if( g->shapes[sno].npt ){
- xstart = g->shapes[sno].pts[0];
- g->shapes[sno].ystart = g->shapes[sno].pts[1];
- g->shapes[sno].ystop = g->shapes[sno].ystart;
- for(i=1; i<g->shapes[sno].npt; i+=2){
- if(g->shapes[sno].pts[i-1] < xstart)
- xstart = g->shapes[sno].pts[i-1];
- if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)
- g->shapes[sno].ystop = g->shapes[sno].pts[i];
- if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)
- g->shapes[sno].ystart = g->shapes[sno].pts[i];
- }
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,
- xstart, g->shapes[sno].ystart, 1)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-int evqtpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- return evpie(g, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);
-}
-
-int evpoint(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),
- double x, double y,
- double xcen, double ycen)
-{
- if( ((x==xcen) && (y==ycen)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-#ifdef __STDC__
-int
-evpolygon(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y, ...)
-{
- int i, maxpts;
- double xstart=0.0;
- va_list args;
- va_start(args, y);
-#else
-int evpolygon(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xstart=0.0;
- int i, maxpts;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- if( !g->shapes[sno].init ){
- g->shapes[sno].init = 1;
- /* allocate space for x,y arguments */
- maxpts = MASKINC;
- g->shapes[sno].pts = (double *)calloc(maxpts, sizeof(double));
- /* gather up arguments */
- g->shapes[sno].npt = 0;
- while( 1 ){
- if( g->shapes[sno].npt >= maxpts ){
- maxpts += MASKINC;
- g->shapes[sno].pts = (double *)realloc(g->shapes[sno].pts,
- maxpts*sizeof(double));
- }
- g->shapes[sno].pts[g->shapes[sno].npt] = va_arg(args, double);
- /* two negatives in a row means we are at end of args */
- if( feq(g->shapes[sno].pts[g->shapes[sno].npt],PSTOP) &&
- feq(g->shapes[sno].pts[g->shapes[sno].npt-1],PSTOP) ){
- g->shapes[sno].npt--;
- break;
- }
- g->shapes[sno].npt++;
- }
- va_end(args);
- /* realloc to actual size */
- g->shapes[sno].pts = (double *)realloc(g->shapes[sno].pts,
- g->shapes[sno].npt*sizeof(double));
- /* now find the y limits */
- if( g->shapes[sno].npt ){
- xstart = g->shapes[sno].pts[0];
- g->shapes[sno].ystart = g->shapes[sno].pts[1];
- g->shapes[sno].ystop = g->shapes[sno].ystart;
- for(i=1; i<g->shapes[sno].npt; i+=2){
- if(g->shapes[sno].pts[i-1] < xstart)
- xstart = g->shapes[sno].pts[i-1];
- if(g->shapes[sno].pts[i] > g->shapes[sno].ystop)
- g->shapes[sno].ystop = g->shapes[sno].pts[i];
- if(g->shapes[sno].pts[i] < g->shapes[sno].ystart)
- g->shapes[sno].ystart = g->shapes[sno].pts[i];
- }
- }
- }
- if( (((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- polypt(x, y, g->shapes[sno].pts, g->shapes[sno].npt/2,
- xstart, g->shapes[sno].ystart, 0)) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-/* accelerator regions -- lower and upper limits are given for n regions */
-
-int evnannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- dinc = (hi - lo)/(double)n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evannulus(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evnbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evbox(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( evbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evnellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evellipse(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( evellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evnpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- while( lo > hi ) lo -= 360.0;
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* check limits */
- if( !evpie(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evpie(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evpie(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int evpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, rinc;
-
- /* get limits */
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- rinc = (radhi - radlo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi) ||
- !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=1; a<=ahi; a++){
- for(r=1; r<=rhi; r++){
- if( evannulus(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, radlo+((r-1)*rinc), radlo+(r*rinc)) &&
- evpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+((a-1)*ainc), anglo+(a*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, radlo, radhi) )
- return(1);
- else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int evbpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( evbox(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the box .. must also be in the pie */
- else if( !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( evbox(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- evqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !evbox(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int evepanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( evellipse(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the ellipse .. must also be in the pie */
- else if( !evpie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( evellipse(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- evqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !evellipse(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !evpie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-/* varargs regions -- a series of lower and upper limits is specified */
-
-#ifdef __STDC__
-int
-evvannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvannulus(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(evannulus(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evannulus(g, rno+i, sno+i, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-evvbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvbox(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(evbox(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( evbox(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !evbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- else if( evbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-
-#ifdef __STDC__
-int
-evvellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvellipse(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(evellipse(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( evellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1],
- ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( evellipse(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !evellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( evellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-evvpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int evvpie(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(evpie(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !evpie(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( evpie(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !evpie(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(1);
- }
-}
-
-#ifdef __STDC__
-int
-evvpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, y);
-#else
-int evvpoint(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* look through all of them to find the right one */
- for(i=0, j=0; i<n; i+=2, j++){
- if( evpoint(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
-}
-
-
diff --git a/funtools/filter/filt.l b/funtools/filter/filt.l
deleted file mode 100644
index 576c478..0000000
--- a/funtools/filter/filt.l
+++ /dev/null
@@ -1,3228 +0,0 @@
-option caseless
-%array
-
-%{
-
-#include <stdio.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <ctype.h>
-#include <string.h>
-#include <math.h>
-#include <filter.h>
-
-#define MAX_INCLUDE_DEPTH 100
-#define SEGINC 1024
-#define MASKINC 1024
-
-#define LARGE_NUMBER 65536
-
-/* must match regions.h */
-#define PSTOP -142857.142857
-
-/* stolen from fitsy/xos.h */
-#define X__PI 3.14159265358979323846
-#define X_2PI ( 2 * X__PI )
-#define X_R2D (X_2PI / 360.0)
-#define X_R2H (X_2PI / 24.0)
-#define X_H2D (360.0 / 24.0)
-
-#define r2h(r) ( (r) / X_R2H )
-#define h2r(d) ( (d) * X_R2H )
-#define r2d(r) ( (r) / X_R2D )
-#define d2r(d) ( (d) * X_R2D )
-#define h2d(r) ( (r) * X_H2D )
-#define d2h(d) ( (d) / X_H2D )
-
-/* region types */
-#define TY_ANNULUS 1
-#define TY_BOX 2
-#define TY_CIRCLE 3
-#define TY_ELLIPSE 4
-#define TY_FIELD 5
-#define TY_LINE 6
-#define TY_PANDA 7
-#define TY_BPANDA 8
-#define TY_CPANDA 9
-#define TY_EPANDA 10
-#define TY_PIE 11
-#define TY_QTPIE 11
-#define TY_POINT 12
-#define TY_POLYGON 13
-#define TY_IMAGEMASK 14
-
-/* oft-used checks on argument and coord types */
-#define XARG ((narg % 2) == 1)
-#define YARG ((narg % 2) == 0)
-#define POSARG ((regid == TY_POLYGON) || (regid == TY_LINE) || (narg<=2))
-#define ANGARG (((regid == TY_PANDA) && (narg==3)) || \
- ((regid == TY_PANDA) && (narg==4)) || \
- ((regid == TY_BPANDA) && (narg==3)) || \
- ((regid == TY_BPANDA) && (narg==4)) || \
- ((regid == TY_CPANDA) && (narg==3)) || \
- ((regid == TY_CPANDA) && (narg==4)) || \
- ((regid == TY_EPANDA) && (narg==3)) || \
- ((regid == TY_EPANDA) && (narg==4)) || \
- ((regid == TY_PIE) && (narg>=3)) )
-
-#define NUMARG (((regid == TY_PANDA) && (narg==5)) || \
- ((regid == TY_PANDA) && (narg==8)) || \
- ((regid == TY_BPANDA) && (narg==5)) || \
- ((regid == TY_BPANDA) && (narg==10)) || \
- ((regid == TY_CPANDA) && (narg==5)) || \
- ((regid == TY_CPANDA) && (narg==8)) || \
- ((regid == TY_EPANDA) && (narg==5)) || \
- ((regid == TY_EPANDA) && (narg==10)) )
-
-#define SAVEANG ((regid == TY_BOX) || (regid == TY_ELLIPSE))
-
-#define USEPHYS (filt->fhd->table && \
- (filt->type == TYPE_EVENTS) && !filt->evsect)
-
-#define USEWCS (gcoordsys && \
- strcmp(gcoordsys, "image") && strcmp(gcoordsys, "physical"))
-
-#define IMFLIP (USEWCS && wcs->imflip)
-
-#define WCSSIZE (iswcs(wcs) && (cdelt1!=0) && (cdelt2!=0))
-
-/* format statements */
-#define DFMT1 ",%f"
-#define DFMT2 ",%f,%f"
-#define DFMT4 ",%f,%f,%f,%f"
-#define SFMT1 ",%s"
-#define IFMT1 ",%d"
-
-/* flex is not thread-safe, so we did not put any effort into avoiding
- globals, i.e. by putting read-write variables below into a struct */
-
-static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
-static int include_stack_ptr = 0;
-static int parse_error = 0;
-
-static int colargs;
-static int filtlen;
-static int radanglen;
-static int initbindefs;
-static int regtype;
-static int regid;
-static int laststart;
-static int maxfiltseg;
-static int setargs;
-static int inexpr;
-static int macropass;
-static int narg;
-static int nparen;
-static int nsparen;
-static int nrparen;
-static int nfiltseg;
-static int nrange;
-static int nroutine;
-static int nshape;
-static int nregion;
-static int nmask;
-static int got;
-static int offscl;
-static int xtype, ytype;
-static int tltyp[2];
-
-static double lastd1;
-static double lastd2;
-static double xpos, ypos;
-static double xpix, ypix;
-static double cdelt1, cdelt2, crot;
-static double dval, dval2;
-static double tlmin[2];
-static double tlmax[2];
-static double binsiz[2];
-
-static char lastarg[SZ_LINE];
-static char regname[SZ_LINE];
-static char colnames[2][SZ_LINE];
-static char wcsnames[2][SZ_LINE];
-static char macrobuf[SZ_LINE];
-static char rangename[SZ_LINE];
-static char sbuf[SZ_LINE];
-static char saveang[SZ_LINE];
-
-static char *fcoordsys=NULL;
-static char *gcoordsys=NULL;
-static char *filter=NULL;
-static char *radang=NULL;
-
-static struct WorldCoor *wcs=NULL;
-static FiltSeg *filtseg=NULL;
-static Filter filt=NULL;
-
-/* these are read-only */
-static char *rnames[] = {"annulus", "box", "circle", "ellipse",
- "line", "panda", "pie", "qtpie", "point",
- "polygon", "field", "bpanda", "cpanda", "epanda",
- "imagemask", NULL};
-static int rargs[] = {4, 5, 3, 5,
- 4, 8, 4, 4, 2,
- 6, 0, 11, 8, 11,
- 0, 0};
-static int vargs[] = {'y', 'o', 'y', 'o',
- 'n', 'n', 'y', 'n', 'e',
- 'e', 'n', 'n', 'n', 'n',
- 'n', '\0'};
-
-static int _FiltLexTypeCmp(const void *s1, const void *s2);
-static int _FiltLexTypeMatch(int ftype, int ttype);
-static int _FiltLexAccel _PRx((int n));
-static int _FiltLexRegionPanda _PRx((void));
-static int _FiltLexLcx _PRx((void));
-static int _FiltLexArgCheck _PRx((char *name, int args));
-static int _FiltLexNeedOp _PRx((int i, char *s));
-static void _FiltLexOp _PRx((char *s));
-static void _FiltLexTypeSet _PRx((int type));
-static void _FiltLexNew _PRx((void));
-static void _FiltLexParen _PRx((char *s));
-static void _FiltLexCat _PRx((char *s));
-static void _FiltLexRegionStart _PRx((int docols));
-static void _FiltLexRegionVal _PRx((char *s));
-static void _FiltLexRegionEnd _PRx((void));
-static void _FiltLexRangeAdd _PRx((char *xname, char *str, int type, int n, int maxlen));
-static void _FiltLexArgSave _PRx((double dval));
-static void _FiltLexSetWcs _PRx((char *s));
-static void _FiltLexWcsCols _PRx((FITSHead header, char *name1, char *name2));
-static void _FiltLexNum _PRx((int lcx));
-static void _FiltLexEnd _PRx((void));
-static void _FiltLexMake _PRx((void));
-static char *_FiltLexGetWcs _PRx((void));
-static int _FiltIncMask(FilterMask masks, int maxmask, int nmask);
-static int _FiltFitsMask(char *filename, FilterMask *rmasks, FITSHead *rhead, int *nreg);
-static void bin2num(char *d, char *s, int maxlen);
-
-int _filterror _PRx((char *msg));
-%}
-
-DIG [0-9]
-DIG2 [0-9a-fA-F]
-BINARY 0[bB][01]+
-INT1 [-+]?{DIG}+L?
-INT2 [-+]?0[xX]{DIG2}+L?
-INT ({INT1}|{INT2})
-FLOAT1 [-+]?{DIG}+\.?([eE][-+]?{DIG}+)?
-FLOAT2 [-+]?{DIG}*\.{DIG}+([eE][-+]?{DIG}+)?
-FLOAT ({FLOAT1}|{FLOAT2})
-NUM ({INT}|{FLOAT}|{BINARY})
-HMS {INT}{SP}[:hH]{SP}{INT}{SP}[:mM]{SP}{NUM}{SP}[s]?
-DMS {INT}{SP}[:dD]{SP}{INT}{SP}[:mM]{SP}{NUM}{SP}[s]?
-WCS {HMS}|{DMS}
-DEG {NUM}d
-RAD {NUM}r
-IPIX {NUM}i
-PPIX {NUM}p
-ASEC {NUM}\"
-AMIN {NUM}'
-COORSYS (j2000|fk5|icrs|b1950|fk4|galactic|ecliptic|linear|image|physical|amplifier|detector)
-NAME [A-Za-z_][0-9A-Za-z~_]*(\[[^\[]*\])?
-FILE @[0-9A-Za-z~_/\-\.]*(\[.*\])?
-REGION [\!+-]?(ann|annulus|box|cir|circle|ell|ellipse|lin|line|pan|panda|pie|poi|qtpie|qtp|point|pol|polygon|fie|field|bpanda|bpa|cpanda|cpa|epanda|epa)
-REGVAL {SP}\{{INT}\}
-LOP (&&|\|\||[&\|])
-OP (&&|\|\||==|!=|<=|>=|<<|>>|[&\|~=<>+\-*/%^])
-STR (\"[^\"]*\"|'[^']*')
-SP [ \t]*
-EOL ([;\n]|\\n)
-SEP (,|{EOL})
-COM #
-US (unsigned{SP})?
-II (int{SP})?
-DTYPE (\({US}char\)|\({US}short{II}\)|\({US}int\)|\({US}long{II}\)|\(float\)|\(double\))
-
-%s RLIST
-%s RTINE
-%s REG
-%x AREG
-%x INCLUDE
-%x COMM
-
-%%
-
-{DTYPE} { _FiltLexCat(yytext); }
-
-{COORSYS}[\n;,]* { _FiltLexSetWcs(yytext); }
-
-global { BEGIN COMM; }
-tile { BEGIN COMM; }
-compass { BEGIN COMM; }
-{COM} {
- /* comment acts like EOL */
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- else if( YY_START == RLIST ){
- _FiltLexParen(")");
- _FiltLexNew();
- }
- else{
- _FiltLexNew();
- }
- BEGIN COMM;
-}
-<COMM>\n { BEGIN INITIAL; }
-<COMM>\\n { BEGIN INITIAL; }
-<COMM>. { /* ignore comments up to eol */ ; }
-
-[+-]?text([ \t]+|{SP}\({SP})[^;\n]*{EOL} { ; /* ignore */ }
-[+-]?vector([ \t]+|{SP}\({SP})[^;\n]*{EOL} { ; /* ignore */ }
-[+-]?ruler([ \t]+|{SP}\({SP})[^;\n]*{EOL} { ; /* ignore */ }
-[+-]?projection([ \t]+|{SP}\({SP})[^;\n]*{EOL} { ; /* ignore */ }
-
-\(/{NAME},{NAME}\){SP}={SP}{REGION} {
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- /* Found an asc-style region */
- colargs = 0;
- laststart = YY_START;
- BEGIN AREG;
-}
-<AREG>{NAME} {
- if( colargs > 2 )
- _filterror("illegal Chandra region (too many column args)");
- if( !FilterSymbolEnter(filt, yytext, &got) ){
- switch(got){
- case -1:
- _filterror("missing column or header parameter");
- break;
- case -2:
- _filterror("column is not an array");
- break;
- case -3:
- _filterror("internal error while processing column");
- break;
- }
- }
- strcpy(colnames[colargs],yytext);
- colargs++;
-}
-<AREG>, { ; }
-<AREG>\( { ; }
-<AREG>\) { ; }
-<AREG>= {
- /* end of asc part of region */
- if( colargs != 2 )
- _filterror("illegal Chandra region (wrong number of cols)");
- BEGIN INITIAL;
-}
-
-[+-]?field([ \t]+|{SP}\({SP})? |
-{REGION}([ \t]+|{SP}\({SP})/{NUM} {
- /* finish off previous */
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- /* Found a region */
- BEGIN REG;
- if( filt->type == TYPE_EVENTS ){
- /* if asc-style, re-do wcs for specified columns */
- if( colargs == 2 ){
- _FiltLexRegionStart(2);
- _FiltLexWcsCols(filt->fhd, colnames[0], colnames[1]);
- }
- /* set up default columns */
- else{
- _FiltLexRegionStart(1);
- }
- }
- /* its an image */
- else{
- _FiltLexRegionStart(0);
- }
-}
-{REGION}([ \t]+|{SP}\({SP})/{NAME} {
- /* can't happen */
- _filterror("invalid characters following the region name");
-}
-<REG>{NUM} {
- narg++;
- /* process this pure number in the current coord system */
- _FiltLexNum(_FiltLexLcx());
-}
-<REG>{IPIX} {
- narg++;
- /* remove trailing unit character */
- yytext[strlen(yytext)-1] = '\0';
- /* process this as a pure number in image coord sys */
- _FiltLexNum(LCX_IMAGE);
-}
-<REG>{PPIX} {
- narg++;
- /* remove trailing unit character */
- yytext[strlen(yytext)-1] = '\0';
- /* process this as a pure number in physical coord sys */
- _FiltLexNum(LCX_PHYS);
-}
-<REG>{WCS} {
- char *coordsys;
- if( nowcs(wcs) )
- _filterror("no WCS information in file");
- narg++;
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = SAOstrtod(yytext,NULL);
- xtype = SAOdtype;
- if( (xtype !=0) && (xtype != '.') && (xtype != 'd') ){
- coordsys = _FiltLexGetWcs();
- /* arg1 coords are hms, but ecliptic, galactic are deg */
- if( !coordsys ||
- (strncasecmp(coordsys, "ecl", 3) &&
- strncasecmp(coordsys, "gal", 3)) ){
- xpos = h2d(xpos);
- }
- }
- }
- else{
- ypos = SAOstrtod(yytext,NULL);
- ytype = SAOdtype;
- /* convert wcs to image pixels */
- wcsc2pix(wcs, xpos,ypos, _FiltLexGetWcs(), &xpix,&ypix,
- &offscl);
- /* convert to physical for single event filtering */
- if( USEPHYS ){
- xpix = tli2p(xpix, tlmin[0], binsiz[0], tltyp[0]);
- ypix = tli2p(ypix, tlmin[1], binsiz[1], tltyp[1]);
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
-}
-<REG>{DEG} {
- narg++;
- /* handle position arguments */
- if( POSARG ){
- if( nowcs(wcs) )
- _filterror("no WCS information in file");
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = strtod(yytext,NULL);
- }
- else{
- ypos = strtod(yytext,NULL);
- /* convert wcs to image pixels */
- wcsc2pix(wcs, xpos, ypos, _FiltLexGetWcs(),
- &xpix, &ypix, &offscl);
- /* convert to physical for single event filtering */
- if( USEPHYS ){
- xpix = tli2p(xpix, tlmin[0], binsiz[0], tltyp[0]);
- ypix = tli2p(ypix, tlmin[1], binsiz[1], tltyp[1]);
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
- }
- /* angle arguments are just passed along, with updated crot */
- else if( ANGARG ){
- dval = strtod(yytext,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(yytext,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* handle size arguments */
- else{
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- if( SAVEANG ){
- dval = strtod(yytext,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = ABS(strtod(yytext,NULL)/cdelt1);
- else
- dval = ABS(strtod(yytext,NULL)/cdelt2);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
-}
-<REG>{RAD} {
- narg++;
- /* handle position arguments */
- if( POSARG ){
- if( nowcs(wcs) )
- _filterror("no WCS information in file");
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = r2d(strtod(yytext,NULL));
- }
- else{
- ypos = r2d(strtod(yytext,NULL));
- /* convert wcs to image pixels */
- wcsc2pix(wcs, xpos, ypos, _FiltLexGetWcs(),
- &xpix, &ypix, &offscl);
- /* convert to physical for single event filtering */
- if( USEPHYS ){
- xpix = tli2p(xpix, tlmin[0], binsiz[0], tltyp[0]);
- ypix = tli2p(ypix, tlmin[1], binsiz[1], tltyp[1]);
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
- }
- /* angle arguments are just passed along, with updated crot */
- else if( ANGARG ){
- dval = r2d(strtod(yytext,NULL));
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(yytext,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* handle size arguments */
- else{
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- if( SAVEANG ){
- dval = r2d(strtod(yytext,NULL));
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = r2d(ABS(strtod(yytext,NULL)/cdelt1));
- else
- dval = r2d(ABS(strtod(yytext,NULL)/cdelt2));
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
-}
-<REG>{AMIN} {
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- narg++;
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = ABS(strtod(yytext,NULL)/(cdelt1*60.0));
- else
- dval = ABS(strtod(yytext,NULL)/(cdelt2*60.0));
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
-}
-<REG>{ASEC} {
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- narg++;
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = ABS(strtod(yytext,NULL)/(cdelt1*3600.0));
- else
- dval = ABS(strtod(yytext,NULL)/(cdelt2*3600.0));
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
-}
-<REG>[a-z]{SP}={SP}{NUM}{SP} {
- int n;
- n = strtol(strchr(yytext, '=')+1, NULL, 10);
- if( n <=0 ){
- _filterror("invalid region accelerator");
- }
- else{
- if( !_FiltLexAccel(n) ){
- _filterror("invalid region accelerator");
- }
- }
-}
-<REG>{NUM}/{OP} {
- if( _FiltLexArgCheck(regname, narg) == 0 ){
- /* new expression without an expression separator ... sigh */
- _FiltLexRegionEnd();
- _FiltLexNew();
- BEGIN INITIAL;
- yyless(0);
- } else {
- narg++;
- /* process this pure number in the current coord system */
- _FiltLexNum(_FiltLexLcx());
- }
-}
-<REG>({NAME}{OP}|{FILE}) {
- /* new expression without an expression separator ... sigh */
- _FiltLexRegionEnd();
- _FiltLexNew();
- BEGIN INITIAL;
- yyless(0);
-}
-<REG>, {
- /* explicit rule avoids the _FiltLexNew of general rule */
- ;
-}
-<REG>{REGVAL} {
- _FiltLexRegionVal(yytext);
- if( !nsparen ){
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- }
-}
-<REG>\( {
- nsparen++;
-}
-<REG>\){REGVAL} {
- _FiltLexRegionVal(yytext+1);
- if( nsparen ){
- nsparen--;
- if( !nsparen ){
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- }
- } else {
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- /* REJECT; */
- /* explicit execution of general rule instead of REJECT */
- nparen--;
- _FiltLexNew();
- _FiltLexCat(")");
- _FiltLexNew();
- }
-}
-<REG>\) {
- if( nsparen ){
- nsparen--;
- if( !nsparen ){
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- }
- } else {
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- /* REJECT; */
- /* explicit execution of general rule instead of REJECT */
- nparen--;
- _FiltLexNew();
- _FiltLexCat(")");
- _FiltLexNew();
- }
-}
-<REG>{OP} {
- _FiltLexRegionEnd();
- _FiltLexOp(yytext);
- BEGIN INITIAL;
-}
-<REG>{EOL} {
- _FiltLexRegionEnd();
- _FiltLexNew();
- BEGIN INITIAL;
-}
-
-{NAME}{SP}/={SP}\(?({NAME}|:{NAME}) {
- _filterror("you must use == to compare two columns,");
-}
-
-{NAME}{SP}/={SP}\(?({NUM}|:{NUM}) {
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- }
- _FiltLexParen("(");
- BEGIN RLIST;
- narg = 0;
- _FiltLexTypeSet(TOK_RLIST);
- nrange = 0;
- if( !FilterSymbolEnter(filt, yytext, &got) ){
- switch(got){
- case -1:
- _filterror("missing column or header parameter");
- break;
- case -2:
- _filterror("column is not an array");
- break;
- case -3:
- _filterror("internal error while processing column");
- break;
- }
- }
- strncpy(rangename, yytext, SZ_LINE-1);
-}
-<RLIST>{NUM}{SP}:{SP}{NUM} {
- _FiltLexRangeAdd(rangename, yytext, 3, nrange++, SZ_LINE);
-}
-<RLIST>:{SP}{NUM} {
- _FiltLexRangeAdd(rangename, yytext, 1, nrange++, SZ_LINE);
-}
-<RLIST>{NUM}{SP}: {
- _FiltLexRangeAdd(rangename, yytext, 4, nrange++, SZ_LINE);
-}
-<RLIST>{NUM} {
- _FiltLexRangeAdd(rangename, yytext, 2, nrange++, SZ_LINE);
-}
-<RLIST>= { ; }
-<RLIST>, { ; }
-<RLIST>{SEP}{SP}/{NUM}\)*{LOP} { ; }
-<RLIST>{SEP}{SP}/\(*({NAME}|{NUM}{SP}{OP}|{FILE}|{REGION}) {
- _FiltLexParen(")");
- _FiltLexNew();
- BEGIN INITIAL;
-}
-<RLIST>\) {
- _FiltLexParen(")");
- _FiltLexNew();
- _FiltLexParen(")");
- _FiltLexNew();
- BEGIN INITIAL;
-}
-<RLIST>{OP} {
- _FiltLexParen(")");
- _FiltLexOp(yytext);
- BEGIN INITIAL;
-}
-<RLIST>{EOL} {
- _FiltLexParen(")");
- _FiltLexNew();
- BEGIN INITIAL;
-}
-
-{NAME}{SP}/\( {
- /* Found a routine */
- laststart = YY_START;
- BEGIN RTINE;
- narg = 0;
- nrparen = 0;
- _FiltLexTypeSet(TOK_RTINE);
- _FiltLexCat(FilterLexRoutine1(filt, yytext));
- nroutine++;
-}
-<RTINE>, {
- /* explicit rule avoids the _FiltLexNew of general rule */
- _FiltLexCat(",");
-}
-<RTINE>\( {
- nrparen++;
- _FiltLexCat("(");
-}
-<RTINE>\) {
- nrparen--;
- if( nrparen ){
- _FiltLexCat(")");
- }
- else{
- /* end of routine */
- BEGIN laststart;
- _FiltLexCat(FilterLexRoutine2(filt, ")"));
- }
-}
-
-{FILE} {
- /* Found an include file */
- char *s, *t;
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- /* handle FITS mask file specially */
- filt->nmask = _FiltFitsMask(yytext+1,
- &(filt->masks),
- &(filt->maskhd),
- &(filt->nmaskreg));
- /* filt->nmask == -1 => its not a FITS file */
- if( filt->nmask != -1 ){
- switch(filt->nmask){
- case -2:
- _filterror("FITS image mask must be image data -");
- break;
- case -3:
- _filterror("Invalid dimensions for FITS image mask -");
- break;
- case -4:
- _filterror("FITS image mask cannot contain negative values -");
- break;
- default:
- if( (filt->type != TYPE_IMAGE) && !filt->evsect ){
- _filterror("FITS image mask is valid for image filtering only -");
- }
- else{
- if( nmask )
- _filterror("only one FITS image mask allowed at a time -");
- else
- nmask++;
- }
- break;
- }
- }
- else{
- if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) {
- _filterror("include files are nested too deeply");
- }
- if( (s = (char *)FileContents(yytext+1, 0, NULL)) == NULL ){
- _filterror("can't access include file");
- }
- /* ignore empty include file */
- else if( *s == '\0' ){
- ;
- }
- else {
- t = FilterClip(s);
- xfree(s);
- if( t && *t ){
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
- _FiltLexNew();
- _FiltLexParen("(");
- FiltScanString(t);
- xfree(t);
- }
- }
- }
-}
-
-{NAME} {
- if( !FilterSymbolEnter(filt, yytext, &got) ){
- switch(got){
- case -1:
- _filterror("missing column or header parameter");
- break;
- case -2:
- _filterror("column is not an array");
- break;
- case -3:
- _filterror("internal error while processing column");
- break;
- }
- }
- else{
- narg++;
- /* add if initial condition (not region, routine, etc.) */
- if( YY_START == INITIAL ) _FiltLexTypeSet(TOK_NAME);
- _FiltLexCat(FilterLexName(filt,yytext));
- }
-}
-
-{SP} { ; /* ignore white space */ }
-
-{STR} { narg++; _FiltLexCat(yytext); }
-
-{NUM} {
- char tbuf[SZ_LINE];
- bin2num(tbuf, yytext, SZ_LINE-1);
- narg++;
- _FiltLexCat(tbuf);
- }
-
-{OP} {
- _FiltLexOp(yytext);
- if( YY_START != RTINE ) BEGIN INITIAL;
-}
-
-\( {
- nparen++;
- _FiltLexNew();
- _FiltLexCat(yytext);
- _FiltLexNew();
-}
-\) {
- nparen--;
- _FiltLexNew();
- _FiltLexCat(yytext);
- _FiltLexNew();
-}
-{SEP} {
- _FiltLexNew();
- BEGIN INITIAL;
-}
-
-. { _FiltLexCat(yytext); }
-
-<<EOF>> {
- if ( --include_stack_ptr < 0 ){
- _FiltLexMake();
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yyterminate();
- } else {
- _FiltLexParen(")");
- _FiltLexNew();
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yy_switch_to_buffer(include_stack[include_stack_ptr] );
- }
-}
-
-%%
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-
-#ifdef YY_USE_PROTOS
-static void floatprefix(void)
-#else
-static void floatprefix()
-#endif
-{
- if( filt->method == METHOD_C )
- _FiltLexCat("(double)");
-}
-
-#ifdef YY_USE_PROTOS
-static void floatsuffix(void)
-#else
-static void floatsuffix()
-#endif
-{
- return;
-}
-
-#ifdef YY_USE_PROTOS
-static void
-bin2num(char *d, char *s, int maxlen)
-#else
-static void
-bin2num(d, s, maxlen)
- char *d;
- char *s;
- int maxlen;
-#endif
-{
- unsigned long bits;
- char *p=NULL;
-
- if( strlen(s) < 2 ){
- if( d != s ) strncpy(d, s, maxlen-1);
- }
- else{
- if( (*s=='0') && (*(s+1)=='b') ){
- bits = strtoul(s+2, &p, 2);
- if( *p != '\0' ) _filterror("invalid binary value");
- snprintf(d, maxlen, "%lx", bits);
- if( (strlen(d) <2) || (*d!='0') || ((*(d+1)!='x')&&((*(d+1)!='X'))) ){
- snprintf(d, maxlen, "0x%lx", bits);
- }
- }
- else{
- if( d != s ) strncpy(d, s, maxlen-1);
- }
- }
-}
-
-/*
- *
- * _FiltLexNew -- finish last start and set up new filter segment
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexNew(void)
-#else
-static void _FiltLexNew()
-#endif
-{
- int i;
- int last;
-
- if( nfiltseg >= maxfiltseg ){
- last = maxfiltseg;
- if( maxfiltseg == 0 ){
- maxfiltseg = SEGINC;
- filtseg = (FiltSeg *)xmalloc(maxfiltseg * sizeof(FiltSeg));
- }
- else{
- maxfiltseg += SEGINC;
- filtseg = (FiltSeg *)xrealloc(filtseg, maxfiltseg * sizeof(FiltSeg));
- }
- /* clear the unused records */
- for(i=last; i<maxfiltseg; i++){
- filtseg[i] = NULL;
- }
- }
- if( !nfiltseg || (filtseg[nfiltseg-1] && filtseg[nfiltseg-1]->s) ){
- filtseg[nfiltseg] = (FiltSeg)xcalloc(1, sizeof(FiltSegRec));
- nfiltseg++;
- }
- filtseg[nfiltseg-1]->n = nfiltseg-1;
- filtseg[nfiltseg-1]->nregion = 0;
-}
-
-/*
- *
- * _FiltLexParen -- add a paren to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexParen(char *str)
-#else
-static void _FiltLexParen(str)
- char *str;
-#endif
-{
- /* _FiltLexNew(); */
- _FiltLexCat(str);
- /* _FiltLexNew(); */
-}
-
-/*
- *
- * __FiltLexCat -- add a string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-__FiltLexCat(char *str, char **ostr, int *olen)
-#else
-static void __FiltLexCat(str, ostr, olen)
- char *str;
- char **ostr;
- int *olen;
-#endif
-{
- int blen;
- int slen;
-
- if( (str == NULL) || (*str == '\0') )
- return;
- else
- slen = strlen(str) + 1;
-
- if( (*ostr == NULL) || (**ostr == '\0') )
- blen = 0;
- else
- blen = strlen(*ostr);
-
- while( (blen + slen) >= *olen ){
- *olen += SEGINC;
- }
- if( blen == 0 )
- *ostr = (char *)xcalloc(*olen, sizeof(char));
- else
- *ostr = (char *)xrealloc(*ostr, *olen);
- strcat(*ostr, str);
-}
-
-/*
- *
- * _FiltLexCat -- add a string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexCat(char *str)
-#else
-static void _FiltLexCat(str)
- char *str;
-#endif
-{
- char *s;
- if( !str || !*str )
- return;
- if( nfiltseg ==0 )
- _FiltLexNew();
- s = xmalloc(strlen(str)+1);
- nowhite(str, s);
- __FiltLexCat(s, &(filtseg[nfiltseg-1]->s), &(filtseg[nfiltseg-1]->len));
- if( s ) xfree(s);
-}
-
-/*
- *
- * _FiltLexArgSave -- save a radius or angle value to the temp string:
- * this is a special hack for funcnts
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexArgSave(double dval)
-#else
-static void _FiltLexArgSave(dval)
- double dval;
-#endif
-{
- char tbuf[SZ_LINE];
-
- if( narg < 3 )
- return;
- snprintf(tbuf, SZ_LINE, DFMT1, dval);
- if( narg == 3 ){
- *lastarg = '\0';
- lastd1 = 0.0;
- lastd2 = 0.0;
- if( filtseg[nfiltseg-1]->radang ){
- xfree(filtseg[nfiltseg-1]->radang);
- filtseg[nfiltseg-1]->radang = NULL;
- filtseg[nfiltseg-1]->ralen = 0;
- }
- }
- switch(regid){
- case TY_ANNULUS:
- case TY_CIRCLE:
- if( *lastarg ){
- __FiltLexCat(lastarg, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- if( narg > 3 ){
- __FiltLexCat(",NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- strcpy(lastarg, tbuf);
- }
- lastd1 = lastd2;
- lastd2 = dval;
- break;
-
- case TY_BOX:
- case TY_ELLIPSE:
- if( (narg%2) == 1 ){
- if( *lastarg ){
- __FiltLexCat(lastarg, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- if( narg > 3 ){
- __FiltLexCat(",NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- strcpy(lastarg, tbuf);
- }
- lastd1 = lastd2;
- lastd2 = dval;
- }
- break;
-
- case TY_PIE:
- if( narg == 3 ){
- __FiltLexCat("NA,NA", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- else if( *lastarg ){
- __FiltLexCat("NA,NA,", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat(lastarg, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- if( narg > 3 ){
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- strcpy(lastarg, tbuf);
- }
- lastd1 = lastd2;
- lastd2 = dval;
- break;
-
- case TY_POINT:
- /* we have to process this here if its is a varargs */
- /* so, for the 3rd arg, we add a line for initial x, y pair */
- if( narg == 3 ){
- __FiltLexCat("NA,NA,NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- /* and for every even arg, add a line for the preceeding x,y pair */
- else if( (narg % 2) == 0 ){
- __FiltLexCat("NA,NA,NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- break;
- default:
- return;
- }
-}
-
-/*
- *
- * _FiltLexAccel -- appply acceleration to a segment
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexAccel(int n)
-#else
-static int _FiltLexAccel(n)
- int n;
-#endif
-{
- int i;
- char tbuf[SZ_LINE];
- char *s;
- double dinc;
-
- /* check region type */
- switch(regid){
- case TY_ANNULUS:
- break;
- case TY_BOX:
- narg -= 2;
- break;
- case TY_CIRCLE:
- narg -= 1;
- break;
- case TY_ELLIPSE:
- narg -= 2;
- break;
- case TY_PIE:
- break;
- default:
- _filterror("annulus, box, circle, ellipse, pie accelerators only - ");
- break;
- }
- /* add the argument */
- snprintf(tbuf, SZ_LINE, IFMT1, n);
- _FiltLexCat(tbuf);
- /* change the name of the routine we will call */
- if( filtseg[nfiltseg-1]->s0 ){
- if( (s = xstrdup(&filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0])) ){
- filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0] = '\0';
- _FiltLexCat("n");
- _FiltLexCat(s);
- snprintf(tbuf, SZ_LINE, "%d ", n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- setargs = 1;
- free (s);
- }
- if( filtseg[nfiltseg-1]->radang ){
- xfree(filtseg[nfiltseg-1]->radang);
- filtseg[nfiltseg-1]->radang = NULL;
- filtseg[nfiltseg-1]->ralen = 0;
- }
- switch(regid){
- case TY_ANNULUS:
- case TY_BOX:
- case TY_CIRCLE:
- case TY_ELLIPSE:
- dinc = (lastd2 - lastd1)/n;
- for(i=1; i<=n; i++){
- snprintf(tbuf, SZ_LINE, DFMT2, lastd1+((i-1)*dinc), lastd1+(i*dinc));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat(",NA,NA", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- break;
- case TY_PIE:
- dinc = (lastd2 - lastd1)/n;
- for(i=1; i<=n; i++){
- snprintf(tbuf, SZ_LINE, DFMT2, lastd1+((i-1)*dinc), lastd1+(i*dinc));
- __FiltLexCat("NA,NA", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- break;
- default:
- _filterror("annulus, box, circle, ellipse, pie accelerators only - ");
- break;
- }
- _FiltLexTypeSet(TOK_ACCEL);
- }
- else{
- _filterror("misplaced accelerator");
- }
- return(n);
-}
-
-/*
- *
- * _FiltLexTypeSet -- add type info to the filter segment record
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexTypeSet(int type)
-#else
-static void _FiltLexTypeSet(type)
- int type;
-#endif
-{
- if( nfiltseg ==0 )
- _FiltLexNew();
- filtseg[nfiltseg-1]->type |= type;
-}
-
-/*
- *
- * _FiltLexOp -- add an operator to the filter segment record
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexOp(char *op)
-#else
-static void _FiltLexOp(op)
- char *op;
-#endif
-{
- _FiltLexCat(op);
- filtseg[nfiltseg-1]->ops += 1;
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRegionStart(int docols)
-#else
-static void _FiltLexRegionStart(docols)
- int docols;
-#endif
-{
- char *s, *t;
- char tbuf[SZ_LINE];
-
- /* sanity check -- 1D images do not support regions */
- if( (filt->type == TYPE_IMAGE) && (ft_naxes(filt->fhd)==1) ){
- _filterror("2D region filters invalid for 1D images");
- }
- narg = 0;
- setargs=0;
- s = xmalloc(strlen(yytext)+1);
- nowhite(yytext, s);
- if( *s == '+' ){
- regtype = TOK_IREG;
- strcpy(regname, s+1);
- }
- else if( *s == '-' ){
- regtype = TOK_EREG;
- strcpy(regname, s+1);
- }
- else if( *s == '!' ){
- regtype = TOK_NREG;
- strcpy(regname, s+1);
- }
- else{
- regtype = TOK_IREG;
- strcpy(regname, s);
- }
- _FiltLexTypeSet(regtype);
- if( !(t=strchr(regname, '(')) ){
- nsparen=0;
- }
- /* remove the paren from the regname string -- we will explicitly add it */
- else{
- *t = '\0';
- nsparen=1;
- }
- /* convert to lower case, remove white space */
- culc(regname);
- nowhite(regname, s);
- strcpy(regname, s);
- /* convert abbrev to region */
- if( !strncmp(regname, "ann", 3) ){
- strcpy(regname, "annulus");
- regid = TY_ANNULUS;
- }
- else if( !strncmp(regname, "box", 3) ){
- strcpy(regname, "box");
- regid = TY_BOX;
- }
- else if( !strncmp(regname, "cir", 3) ){
- strcpy(regname, "circle");
- regid = TY_CIRCLE;
- }
- else if( !strncmp(regname, "ell", 3) ){
- strcpy(regname, "ellipse");
- regid = TY_ELLIPSE;
- }
- else if( !strncmp(regname, "fie", 3) ){
- strcpy(regname, "field");
- regid = TY_FIELD;
- }
- else if( !strncmp(regname, "lin", 3) ){
- strcpy(regname, "line");
- regid = TY_LINE;
- }
- else if( !strncmp(regname, "pan", 3) ){
- strcpy(regname, "panda");
- regid = TY_PANDA;
- }
- else if( !strncmp(regname, "bpa", 3) ){
- strcpy(regname, "bpanda");
- regid = TY_BPANDA;
- }
- else if( !strncmp(regname, "cpa", 3) ){
- strcpy(regname, "cpanda");
- regid = TY_CPANDA;
- }
- else if( !strncmp(regname, "epa", 3) ){
- strcpy(regname, "epanda");
- regid = TY_EPANDA;
- }
- else if( !strncmp(regname, "pie", 3) ){
- strcpy(regname, "pie");
- regid = TY_PIE;
- }
- else if( !strncmp(regname, "qtp", 3) ){
- strcpy(regname, "qtpie");
- regid = TY_PIE;
- }
- else if( !strncmp(regname, "poi", 3) ){
- strcpy(regname, "point");
- regid = TY_POINT;
- }
- else if( !strncmp(regname, "pol", 3) ){
- strcpy(regname, "polygon");
- regid = TY_POLYGON;
- }
- else if( !strcmp(regname, "imagemask") ){
- regid = TY_IMAGEMASK;
- }
- /* append filter-type prefix */
- switch( filt->type ){
- case TYPE_EVENTS:
- /* normally, we filter rows analytically using evregions.o */
- if( !filt->evsect )
- _FiltLexCat("ev");
- /* if evsect=xxx is specified, we filter by image pixels */
- else
- _FiltLexCat("im");
- break;
- case TYPE_IMAGE:
- /* image are filtered by image pixels */
- _FiltLexCat("im");
- break;
- }
- /* no region value to start */
- filtseg[nfiltseg-1]->regval = 0;
- /* save size of current string so we can get back to the region string */
- filtseg[nfiltseg-1]->s0 = strlen(filtseg[nfiltseg-1]->s);
- /* append region */
- _FiltLexCat(FilterLexRegion1(filt,regname));
- /* append standard args */
- _FiltLexCat("(g,$RS,");
- /* add include/exclude and whether we mark y lines for this region
- (we don't mark y on excludes as an optimization) */
- switch(regtype){
- case TOK_IREG:
- snprintf(tbuf, SZ_LINE, "1,%d", TOK_IREG);
- _FiltLexCat(tbuf);
- break;
- case TOK_NREG:
- snprintf(tbuf, SZ_LINE, "0,%d", TOK_NREG);
- _FiltLexCat(tbuf);
- break;
- case TOK_EREG:
- snprintf(tbuf, SZ_LINE, "0,%d", TOK_EREG);
- _FiltLexCat(tbuf);
- break;
- }
- switch(docols){
- case 0:
- /* initialize default columns for tables -- but don't enter symbols yet */
- FilterSymbolDefaults(filt, 0);
- /* initialize wcs for default image case */
- _FiltLexWcsCols(filt->fhd, filt->xbin, filt->ybin);
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat("x");
- floatsuffix();
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat("y");
- floatsuffix();
- break;
- case 1:
- if( !initbindefs ){
- /* initialize default columns for tables and enter symbols */
- FilterSymbolDefaults(filt, 1);
- /* initialize wcs for default table case */
- _FiltLexWcsCols(filt->fhd, filt->xbin, filt->ybin);
- initbindefs++;
- }
- if( !filt->xbin || !filt->ybin ){
- _filterror("two binning columns are required for regions");
- }
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(filt->xbin);
- floatsuffix();
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(filt->ybin);
- floatsuffix();
- break;
- case 2:
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(colnames[0]);
- floatsuffix();
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(colnames[1]);
- floatsuffix();
- break;
- }
- if( s ) xfree(s);
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRegionVal(char *s)
-#else
-static void
-_FiltLexRegionVal(s)
- char *s;
-#endif
-{
- char *t=NULL;
- if( (t=strchr(s, '{')) ){
- t++;
- }
- else{
- t = s;
- }
- filtseg[nfiltseg-1]->regval = atoi(t);
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRegionEnd(void)
-#else
-static void
-_FiltLexRegionEnd()
-#endif
-{
- int n;
- char *s;
- char ebuf[SZ_LINE];
- char tbuf[SZ_LINE];
-
- /* add final arguments as required */
- switch( regid ){
- case TY_BOX:
- if( (narg%2) == 0 ){
- _FiltLexCat(",0.0"); narg++;
- }
- else{
- /* if we saved an angle arg, we need to replace the last position arg */
- if( *saveang ){
- if( (s=strrchr(filtseg[nfiltseg-1]->s, ',')) ){
- *s = '\0';
- _FiltLexCat(saveang);
- }
- }
- }
- break;
- case TY_ELLIPSE:
- if( (narg%2) == 0 ){
- _FiltLexCat(",0.0"); narg++;
- }
- else{
- /* if we saved an angle arg, we need to replace the last position arg */
- if( *saveang ){
- if( (s=strrchr(filtseg[nfiltseg-1]->s, ',')) ){
- *s = '\0';
- _FiltLexCat(saveang);
- }
- }
- }
- break;
- case TY_BPANDA:
- case TY_EPANDA:
- if( (narg%2) == 0 ){
- _FiltLexCat(",0.0"); narg++;
- }
- /* drop through here to process panda */
- case TY_PANDA:
- case TY_CPANDA:
- _FiltLexRegionPanda();
- setargs = 1;
- break;
- default:
- break;
- }
-
- /* argument check */
- if( (n=_FiltLexArgCheck(regname, narg)) > 0 ){
- /* don't bother printing where we are in region */
- *yytext = '\0';
- switch( vargs[n-1] ){
- case 'n':
- snprintf(ebuf, SZ_LINE, "'%s' requires %d args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- case 'e':
- snprintf(ebuf, SZ_LINE,
- "'%s' requires at least %d (even) args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- case 'o':
- snprintf(ebuf, SZ_LINE,
- "'%s' requires at least %d (odd) args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- case 'y':
- default:
- snprintf(ebuf, SZ_LINE, "'%s' requires %d args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- }
- _filterror(ebuf);
- }
-
- /* process varargs */
- if( (n < 0) || (regid == TY_POLYGON) ){
- if( filtseg[nfiltseg-1]->type & TOK_ACCEL ){
- _filterror("n= and variable arglist cannot be combined -");
- }
- /* if its a varargs, we need to end with PSTOP values */
- snprintf(sbuf, SZ_LINE, DFMT2, PSTOP, PSTOP);
- _FiltLexCat(sbuf);
- /* change the name of the routine we will call */
- if( regid != TY_POLYGON ){
- if( filtseg[nfiltseg-1]->s0 ){
- if((s = xstrdup(&filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0]))){
- filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0] = '\0';
- _FiltLexCat("v");
- _FiltLexCat(s);
- switch(regid){
- case TY_ANNULUS:
- n = narg - 3;
- break;
- case TY_BOX:
- n = (narg - 5)/2;
- break;
- case TY_CIRCLE:
- n = narg - 3;
- break;
- case TY_ELLIPSE:
- n = (narg - 5)/2;
- break;
- case TY_PIE:
- n = narg - 3;
- break;
- case TY_POINT:
- n = narg/2;
- break;
- default:
- _filterror("varargs: annulus, box, circle, ellipse, pie, point;");
- break;
- }
- snprintf(tbuf, SZ_LINE, "%d ", n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- setargs = 1;
- free (s);
- }
- _FiltLexTypeSet(TOK_VARARGS);
- }
- else{
- _filterror("invalid varargs");
- }
- }
- }
-
-
- /* set number of regions and shapes, if not already done */
- if( !setargs ){
- snprintf(tbuf, SZ_LINE, "%d ", 1);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- }
-
- /* finish off region string */
- _FiltLexCat(FilterLexRegion2(filt,")"));
-
- /* no column arguments */
- colargs = 0;
- /* arguments are not set */
- setargs = 0;
- /* save angle not set */
- *saveang = 0;
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexRegionPanda(void)
-#else
-static int
-_FiltLexRegionPanda()
-#endif
-{
- int i;
- int n=0;
- int got=0;
- int a, r;
- int ahi=0, rhi=0;
- int hi=0;
- double d[11];
- double ainc=0.0, rinc=0.0;
- char tbuf[SZ_LINE];
- char *s=NULL;
- char *t, *u;
-
- switch(regid){
- case TY_PANDA:
- case TY_CPANDA:
- hi = 7;
- break;
- case TY_BPANDA:
- case TY_EPANDA:
- hi = 10;
- break;
- default:
- _filterror("unknown panda type -- contact saord@cfa.harvard.edu");
- break;
- }
- s = xstrdup(filtseg[nfiltseg-1]->s);
- for(i=hi; i>=0; i--){
- /* look for last comma */
- t = strrchr(s, ',');
- if( !t ) goto done;
- /* null it out from base string */
- *t = '\0';
- /* point past comma and get double value */
- t++;
- d[i] = strtod(t, &u);
- if( t == u ) goto done;
- }
-
- switch(regid){
- case TY_PANDA:
- case TY_CPANDA:
- ainc = (d[3] - d[2])/d[4];
- ahi = (int)d[4];
- rinc = (d[6] - d[5])/d[7];
- rhi = (int)d[7];
- break;
- case TY_BPANDA:
- case TY_EPANDA:
- ainc = (d[3] - d[2])/d[4];
- ahi = (int)d[4];
- rinc = (d[7] - d[5])/d[9];
- rhi = (int)d[9];
- break;
- default:
- _filterror("unknown panda type -- contact saord@cfa.harvard.edu");
- break;
- }
- /* process limits arguments */
- for(a=1; a<=ahi; a++){
- for(r=1; r<=rhi; r++){
- snprintf(tbuf, SZ_LINE, DFMT4,
- d[5]+((r-1)*rinc), d[5]+(r*rinc),
- d[2]+((a-1)*ainc), d[2]+(a*ainc));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- n++;
- }
- }
-
- /* adjust region and shape count */
- snprintf(tbuf, SZ_LINE, "%d ", n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- snprintf(tbuf, SZ_LINE, "%d ", 2*n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- _FiltLexTypeSet(TOK_ACCEL);
- /* success */
- got = 1;
-
-done:
- if( s ) xfree(s);
- return got;
-}
-
-/*
- *
- * _FiltLexRangeAdd -- add a rangelist string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRangeAdd(char *xname, char *str, int type, int n, int maxlen)
-#else
-static void _FiltLexRangeAdd(xname, str, type, n, maxlen)
- char *xname;
- char *str;
- int type;
- int n;
- int maxlen;
-#endif
-{
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char *s;
- char *t;
- char *t2;
- char *name;
-
- /* get "in-expression" name for current technique */
- name = FilterLexName(filt, xname);
-
- /* initialize pointers */
- s = str;
- t = tbuf;
-
- /* clear working buffer */
- memset(t, 0, SZ_LINE);
-
- /* if this is not the beginning, we first need to OR with prev */
- if( n != 0 ) strncat(t, "||", maxlen-1);
-
- /* put in parens for safety */
- strncat(t, "(", maxlen-1);
-
- /* add the name */
- strncat(t, name, maxlen-1);
-
- /* add the rangelist */
- switch(type){
- case 1:
- strncat(t, "<=", maxlen-1);
- /* skip past : */
- s++;
- /* append value */
- t2 = tbuf2;
- while( *s ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- case 2:
- strncat(t, "==", maxlen-1);
- /* append upper value */
- t2 = tbuf2;
- while( *s ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- case 3:
- strncat(t, ">=", maxlen-1);
- /* append lower value */
- t2 = tbuf2;
- while( *s && (*s != ':') ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- /* skip past : */
- s++;
- strncat(t, "&&", maxlen-1);
- strncat(t, name, maxlen-1);
- strncat(t, "<=", maxlen-1);
- /* append upper value */
- t2 = tbuf2;
- while( *s ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- case 4:
- strncat(t, ">=", maxlen-1);
- /* append lower value */
- t2 = tbuf2;
- while( *s && (*s != ':') ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- }
- strncat(t, ")", maxlen-1);
- _FiltLexCat(tbuf);
-}
-
-/*
- *
- * _FiltLexTypeCmp -- compare routine for qsort
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexTypeCmp(const void *s1, const void *s2)
-#else
-static int _FiltLexTypeCmp(s1, s2)
- const void *s1;
- const void *s2;
-#endif
-{
- FiltSeg *f1 = (FiltSeg *)s1;
- FiltSeg *f2 = (FiltSeg *)s2;
-
- /* check for broken qsort */
- if( !*f1 || !*f2 ){
- _filterror("qsort is broken -- contact saord@cfa.harvard.edu");
- /* will not happen */
- return 0;
- }
-
- /* make sure null string is at the end */
- if( !(*f1)->s && !(*f2)->s ) return 0;
- else if( !(*f1)->s ) return 1;
- else if( !(*f2)->s ) return -1;
-
- /* paint: reverse order and make excludes local */
- if( filt->paint ){
- /* if both are regions, reverse order */
- if( ((*f1)->type & TOK_REG) && ((*f2)->type & TOK_REG) ){
- if( (*f1)->n < (*f2)->n ) return 1;
- else if( (*f1)->n > (*f2)->n ) return -1;
- else return 0;
- }
- /* keep same order */
- else{
- if( (*f1)->n < (*f2)->n ) return -1;
- else if( (*f1)->n > (*f2)->n ) return 1;
- else return 0;
- }
- }
- else{
- /* if both or neither are eregions, keep them in the same order */
- if( ((*f1)->type & TOK_EREG) == ((*f2)->type & TOK_EREG) ){
- if( (*f1)->n < (*f2)->n ) return -1;
- else if( (*f1)->n > (*f2)->n ) return 1;
- else return 0;
- }
- /* exactly one is an eregion -- and we want eregions last */
- else{
- if( (*f1)->type & TOK_EREG ) return 1;
- else if( (*f2)->type & TOK_EREG ) return -1;
- /* should not happen */
- else return 0;
- }
- }
-}
-
-/*
- *
- * _FiltLexTypeMatch -- see if the type of filtering we are doing
- * matches the type of token we have
- *
- */
-#ifdef YY_USE_PROTOS
-int
-_FiltLexTypeMatch(int ftype, int ttype)
-#else
-int _FiltLexTypeMatch(ftype, ttype)
- int ftype;
- int ttype;
-#endif
-{
- switch(ftype){
- case TYPE_IMAGE:
- /* we don't allow range list and col names in image filters */
- if( (ttype & TOK_RLIST) || (ttype & TOK_NAME) )
- return 0;
- /* everything else is fine */
- else
- return 1;
- case TYPE_EVENTS:
- return 1;
- default:
- return 1;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexArgCheck(char *name, int args)
-#else
-static int _FiltLexArgCheck(name, args)
- char *name;
- int args;
-#endif
-{
- int i;
-
- for(i=0; rnames[i]; i++){
- if( !strcmp(name, rnames[i]) ){
- if( args == rargs[i] ){
- return(0);
- }
- else{
- /* less than required min */
- if( args < rargs[i] )
- return(i+1);
- /* more than min args -- could be varargs */
- else{
- /* check args allowed in varargs */
- switch(vargs[i]){
- case 'e':
- if( (args%2) == 0 )
- return(-1);
- else
- return(i+1);
- case 'o':
- if( (args%2) == 1 )
- return(-1);
- else
- return(i+1);
- case 'y':
- return(-1);
- default:
- return(i+1);
- }
- }
- }
- }
- }
- return(0);
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexSetWcs(char *s)
-#else
-static void _FiltLexSetWcs(s)
- char *s;
-#endif
-{
- char name[SZ_LINE];
- int ip=0;
-
- newdtable(",=;");
- /* get name of global coordsys */
- if( word(s, name, &ip) ){
- if( gcoordsys ) xfree(gcoordsys);
- gcoordsys = xstrdup(name);
- culc(gcoordsys);
- }
- /* restore old delim table */
- freedtable();
-}
-
-#ifdef YY_USE_PROTOS
-static char *
-_FiltLexCB(char *name, void *client_data)
-#else
-static char *_FiltLexCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- FiltSeg f=(FiltSeg)client_data;
- int ip=0;
- int nr=0;
- int ns=0;
- char *s;
- char tbuf[SZ_LINE];
-
- if( !strcmp(name, "RS") ){
- /* exclude regions get no region value first time around */
- if( (macropass==0) && (f->type & TOK_EREG) ){
- return NULL;
- }
- /* get next region value and remove from string */
- if( word(f->regions, tbuf, &ip) ){
- nr = atoi(tbuf);
- s = xstrdup(&(f->regions[ip]));
- xfree(f->regions);
- f->regions = s;
- }
- else{
- _filterror("internal error: no region string specified");
- return(NULL);
- }
- if( !inexpr || (f->type & (TOK_ACCEL|TOK_VARARGS)) ){
- if( f->regval ){
- snprintf(macrobuf, SZ_LINE, "%d,", f->regval);
- }
- else{
- snprintf(macrobuf, SZ_LINE, "%d,", nregion+1);
- }
- nregion += nr;
- f->nregion += nr;
- inexpr = 1;
- }
- else{
- if( f->regval ){
- snprintf(macrobuf, SZ_LINE, "%d,", f->regval);
- }
- else{
- snprintf(macrobuf, SZ_LINE, "%d,", nregion);
- }
- }
-
- /* get next shape value and remove from string */
- ip = 0;
- if( word(f->shapes, tbuf, &ip) ){
- ns = atoi(tbuf);
- s = xstrdup(&(f->shapes[ip]));
- xfree(f->shapes);
- f->shapes = s;
- }
- else{
- _filterror("internal error: no shape string specified");
- return(NULL);
- }
- /* concat shape value */
- nshape++;
- snprintf(tbuf, SZ_LINE, "%d", nshape);
- strcat(macrobuf, tbuf);
- /* set new shape value */
- nshape += (ns-1);
-
- /* return macro value */
- return(macrobuf);
- }
- else{
- return NULL;
- }
-}
-
-/*
- *
- * _FiltLexNeedOp -- determine if we add a connecting operator for this segment
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexNeedOp(int i, char *s)
-#else
-static int _FiltLexNeedOp(i, s)
- int i;
- char *s;
-#endif
-{
- int c;
- /* check for operator in current string */
- if( s && *s ){
- c = *s;
- switch(c){
- case '&':
- case '|':
- case '=':
- case '!':
- case '<':
- case '>':
- return 0;
- default:
- break;
- }
- }
- /* not in this string check for operator in previous */
- for(i=i-1; i>=0; i--){
- if( !filtseg[i] || !filtseg[i]->s ) continue;
- if( strcmp(filtseg[i]->s, "(") && strcmp(filtseg[i]->s, ")") )
- break;
- }
- if( i >= 0 ){
- c = filtseg[i]->s[strlen(filtseg[i]->s)-1];
- switch(c){
- case '&':
- case '|':
- case '=':
- case '!':
- case '<':
- case '>':
- return 0;
- default:
- return 1;
- }
- }
- else{
- return 0;
- }
-}
-
-/*
- *
- * _FiltLexMake -- generate filter from filter segments
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexMake(void)
-#else
-static void _FiltLexMake()
-#endif
-{
- int i, j, k, l;
- int x, xtot;
- int type=0;
- int ltype=0;
- int opar=0;
- char *s;
-
- /* debugging */
- if( filt->debug ){
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i]->s )
- fprintf(stderr, "unsorted #%d %s\n", filtseg[i]->n, filtseg[i]->s);
- else
- fprintf(stderr, "unsorted #%d %d is empty\n", i, filtseg[i]->n);
- }
- }
- /* look for bad region expressions and determine how many regions we have */
- for(i=0, j=0, k=0, l=0; i<nfiltseg; i++){
- if( !filtseg[i] || !filtseg[i]->s ) continue;
- type = filtseg[i]->type;
- /* make sure we want the type being offered */
- if( !_FiltLexTypeMatch(filt->type, type) ){
- _filterror("column filters not permitted in an image filter expression");
- }
- /* look for bad combinations */
- if( (type & TOK_NREG) && !(type & TOK_IREG) )
- _filterror("!region must be combined with another region (e.g., field()&&!region)");
- if( (type & TOK_EREG) && (type & TOK_IREG) )
- _filterror("-region must not be combined with another region (use !region instead)");
- if( (type & TOK_EREG) && (type & TOK_NAME) )
- _filterror("-region must not be combined with filters (use !region instead)");
- if( (type & TOK_EREG) && (type & TOK_RLIST) )
- _filterror("-region must not be combined with range lists (use !region instead)");
- if( (type & TOK_EREG) && (type & TOK_RTINE) )
- _filterror("-region must not be combined with routines (use !region instead)");
- /* count region types */
- if( filtseg[i]->type & TOK_IREG ) j++;
- if( filtseg[i]->type & TOK_NREG ) k++;
- if( filtseg[i]->type & TOK_EREG ) l++;
- }
- /* check for fits image mask and process specially */
- if( filt->masks ){
- /* can't have fits mask and ascii regions */
- if( j || k || l ){
- _filterror("FITS image masks cannot be combined with ASCII regions");
- }
- /* image filtering of events uses a imagemask special routine */
- if( (filt->type == TYPE_EVENTS) && filt->evsect ){
- strcpy(yytext, "imagemask");
- _FiltLexRegionStart(1);
- _FiltLexRegionEnd();
- }
- else{
- __FiltLexCat("imagemask", &filter, &filtlen);
- nregion = filt->nmaskreg;
- return;
- }
- }
- /* if we have only exclude regions, add field */
- if( !j && !k && l ){
- strcpy(yytext, "field");
- if( filt->type == TYPE_EVENTS )
- _FiltLexRegionStart(1);
- else
- _FiltLexRegionStart(0);
- _FiltLexRegionEnd();
- }
-
- /* reset region and shape counts */
- nregion=0;
- nshape=0;
-
- /* expand macro before reordering, to maintain region numbers in sequence */
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i] && filtseg[i]->s ){
- if( _FiltLexNeedOp(i, NULL) ) inexpr=0;
- macropass=0;
- s = ExpandMacro(filtseg[i]->s, NULL, NULL, 0, _FiltLexCB, filtseg[i]);
- xfree(filtseg[i]->s);
- filtseg[i]->s = s;
- }
- }
-
- /* we want descending order so that eregions are last in the expression */
- qsort(filtseg, nfiltseg, sizeof(FiltSeg), _FiltLexTypeCmp);
-
- if( filt->debug ){
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i]->s )
- fprintf(stderr, "sorted #%d %s\n", filtseg[i]->n, filtseg[i]->s);
- else
- fprintf(stderr, "sorted #%d %d is empty\n", i, filtseg[i]->n);
- }
- }
-
- /* add open paren and mark that we did it */
- __FiltLexCat("(", &filter, &filtlen);
- opar = 1;
-
- /* run through segments, inserting proper boolean connectors */
- ltype = 0;
- for(i=0; i<nfiltseg; ){
- if( filtseg[i] && filtseg[i]->s ){
- /* no type probably means its a paren, so just add it and jump out */
- if( !filtseg[i]->type ){
- __FiltLexCat(filtseg[i]->s, &filter, &filtlen);
- /* remove empty parens, if we just make them */
- x = strlen(filter);
- if( (filter[x-2] == '(') && (filter[x-1] == ')') )
- filter[x-2] = '\0';
- i++;
- continue;
- }
- type = filtseg[i]->type;
- if( _FiltLexNeedOp(i, NULL) ) inexpr=0;
- macropass=1;
- s = ExpandMacro(filtseg[i]->s, NULL, NULL, 0, _FiltLexCB, filtseg[i]);
- if( _FiltLexNeedOp(i, s) ){
- /* remove trailing open parens from prev. segment (add back later) */
- for(xtot=0, x=strlen(filter)-1; x>=0; x--){
- if( filter[x] != '(' ) break;
- filter[x] = '\0';
- xtot++;
- }
- if( (ltype & TOK_IREG) && (type & TOK_IREG) ){
- __FiltLexCat("||", &filter, &filtlen);
- }
- else if( (ltype & TOK_IREG) && (type & TOK_EREG) ){
- if( opar > 0 ){
- __FiltLexCat(")", &filter, &filtlen);
- opar--;
- }
- if( filt->paint ){
- if( opar > 0 ){
- __FiltLexCat(")", &filter, &filtlen);
- opar --;
- }
- __FiltLexCat("||", &filter, &filtlen);
- }
- else{
- __FiltLexCat("&&", &filter, &filtlen);
- }
- __FiltLexCat("(", &filter, &filtlen);
- opar++;
- }
- else if( (ltype & TOK_EREG) && (type & TOK_EREG) ){
- __FiltLexCat("&&", &filter, &filtlen);
- }
- else if( (ltype & TOK_EREG) && (type & TOK_IREG) ){
- if( filt->paint && (opar > 0) ){
- __FiltLexCat(")", &filter, &filtlen);
- opar --;
- }
- __FiltLexCat("&&", &filter, &filtlen);
- __FiltLexCat("(", &filter, &filtlen);
- opar ++;
- if( filt->paint ){
- __FiltLexCat("(", &filter, &filtlen);
- opar++;
- }
- }
- /* otherwise implied operator is AND */
- else{
- __FiltLexCat("&&", &filter, &filtlen);
- }
- /* add back parens */
- for(x=0; x<xtot; x++){
- __FiltLexCat("(", &filter, &filtlen);
- }
- }
- else{
- if( filt->paint && (i==0) ){
- __FiltLexCat("((", &filter, &filtlen);
- opar +=2;
- }
- }
- __FiltLexCat(s, &filter, &filtlen);
- if( s ) xfree(s);
- if( filtseg[i]->radang ){
- if( *filtseg[i]->radang == ',' )
- __FiltLexCat(filtseg[i]->radang+1, &radang, &radanglen);
- else
- __FiltLexCat(filtseg[i]->radang, &radang, &radanglen);
- }
- else{
- __FiltLexCat("NA,NA,NA,NA\n", &radang, &radanglen);
- }
- i++;
- for(; (i<nfiltseg) && (filtseg[i]->type==type); ){
- if( _FiltLexNeedOp(i, NULL) ) inexpr=0;
- s = ExpandMacro(filtseg[i]->s, NULL, NULL, 0, _FiltLexCB, filtseg[i]);
- if( _FiltLexNeedOp(i, s) ){
- for(xtot=0, x=strlen(filter)-1; x>=0; x--){
- if( filter[x] != '(' ) break;
- filter[x] = '\0';
- xtot++;
- }
- /* if lhs and rhs are regions, implied operator is OR */
- if( type & TOK_IREG )
- __FiltLexCat("||", &filter, &filtlen);
- /* otherwise implied operator is AND */
- else
- __FiltLexCat("&&", &filter, &filtlen);
- for(x=0; x<xtot; x++){
- __FiltLexCat("(", &filter, &filtlen);
- }
- }
- __FiltLexCat(s, &filter, &filtlen);
- if( s ) xfree(s);
- if( filtseg[i]->radang ){
- if( *filtseg[i]->radang == ',' )
- __FiltLexCat(filtseg[i]->radang+1, &radang, &radanglen);
- else
- __FiltLexCat(filtseg[i]->radang, &radang, &radanglen);
- }
- else{
- __FiltLexCat("NA,NA,NA,NA\n", &radang, &radanglen);
- }
- i++;
- }
- }
- /* ignore invalid arguments */
- else{
- i++;
- }
- /* save last type */
- ltype = type;
- }
-
- /* if last segment was an exclude and we are in paint mode, ignore it */
- if( filt->paint && (ltype & TOK_EREG) ){
- __FiltLexCat("&&0", &filter, &filtlen);
- }
-
- /* close off open parens (lots could be needed in paint mode) */
- while( opar-- ){
- __FiltLexCat(")", &filter, &filtlen);
- }
-
- /* check for even number of parens */
- l = strlen(filter);
- for(i=0, j=0; i<l; i++){
- if( filter[i] == '(' ) j++;
- if( filter[i] == ')' ) j--;
- }
- if( j != 0 ){
- if( filt->debug ) fprintf(stderr, "paren error %d: %s\n", j, filter);
- _filterror("unbalanced parentheses");
- }
- if( filt->debug ) fprintf(stderr, "filter: %s\n", filter);
-}
-
-/*
- *
- * _FiltLexEnd -- cleanup from parsing regions
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexEnd(void)
-#else
-static void _FiltLexEnd()
-#endif
-{
- int i;
-
- /* reset state variables */
- colargs = 0;
- initbindefs = 0;
- include_stack_ptr = 0;
- nroutine = 0;
- nshape = 0;
- nmask = 0;
- nparen = 0;
- parse_error = 0;
- filtlen = 0;
- radanglen = 0;
- regid = 0;
- regtype = 0;
- inexpr = 0;
- *regname = '\0';
- *saveang = 0;
- *(wcsnames[0]) = '\0';
- *(wcsnames[1]) = '\0';
- binsiz[0] = 1;
- binsiz[1] = 1;
- /* free up previous filter */
- if( filter ){
- xfree(filter);
- filter = NULL;
- }
- /* free up previous radang string */
- if( radang ){
- xfree(radang);
- radang = NULL;
- }
- /* free up wcs */
- if( wcs ){
- wcsfree (wcs);
- wcs = NULL;
- }
- /* no segments */
- if( filtseg ){
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i] ){
- if( filtseg[i]->s ) xfree(filtseg[i]->s);
- if( filtseg[i]->regions ) xfree(filtseg[i]->regions);
- if( filtseg[i]->shapes ) xfree(filtseg[i]->shapes);
- if( filtseg[i]->radang ) xfree(filtseg[i]->radang);
- xfree(filtseg[i]);
- }
- }
- xfree(filtseg);
- filtseg = NULL;
- }
- maxfiltseg = 0;
- nfiltseg = 0;
- if( gcoordsys ){
- xfree(gcoordsys);
- gcoordsys = NULL;
- }
- if( fcoordsys ){
- xfree(fcoordsys);
- fcoordsys = NULL;
- }
- cdelt1 = 0.0;
- cdelt2 = 0.0;
- crot = 0.0;
-}
-
-/*
- *
- * _FiltLexGetWcs -- determine the WCS coord system to use for wcsc translation
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_FiltLexGetWcs(void)
-#else
-static char *_FiltLexGetWcs()
-#endif
-{
- if( gcoordsys &&
- strcmp(gcoordsys, "image") && strcmp(gcoordsys, "physical") )
- return gcoordsys;
- if( fcoordsys &&
- strcmp(fcoordsys, "image") && strcmp(fcoordsys, "physical") )
- return fcoordsys;
- return NULL;
-}
-
-/*
- *
- * _FiltLexWcsCols -- reset WCS for these columns
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexWcsCols(FITSHead iheader, char *name0, char *name1)
-#else
-static void _FiltLexWcsCols(iheader, name0, name1)
- FITSHead iheader;
- char *name0;
- char *name1;
-#endif
-{
- int i, which, ival;
- int simple=1;
- double dval, dval2;
- char *s;
- FITSHead oheader;
- FITSCard card;
-
- /* make sure we have something to process */
- if( !iheader )
- return;
-
- if( filt->fhd->image ){
- /* free up old wcs */
- if( wcs ) wcsfree (wcs);
- /* init new wcs */
- hlength(ft_cards(filt->fhd),0);
- wcs = wcsinit(ft_cards(filt->fhd));
- tltyp[0] = 0;
- tltyp[1] = 0;
- }
- /* for tables, we can init wcs only the specified columns */
- else if( name0 && *name0 && name1 && *name1 ){
- /* see if these are the same as the last set of columns */
- if( (*(wcsnames[0]) && !strcasecmp(name0,wcsnames[0])) &&
- (*(wcsnames[1]) && !strcasecmp(name1,wcsnames[1])) && wcs ){
- return;
- }
-
- /* gather up important tl info about the binning columns */
- for(i=1; i<=iheader->table->tfields; i++){
- /* determine which bincol we are processing */
- if( !strcasecmp(iheader->table->col[i-1].name, name0) )
- which = 0;
- else if( !strcasecmp(iheader->table->col[i-1].name, name1) )
- which = 1;
- else
- continue;
- /* set tlinfo values for this column */
- tlmin[which] = ft_headgetr(iheader, "TLMIN", i, 1.0, &card);
- tlmax[which] = ft_headgetr(iheader, "TLMAX", i, 1.0, &card);
- binsiz[which] = ft_headgetr(iheader, "TDBIN", i, 1.0, &card);
- tltyp[which] = iheader->table->col[i-1].type;
- }
-
- /* free up old wcs */
- if( wcs ) wcsfree (wcs);
- /* make a copy of the header */
- oheader = ft_headcopy(iheader);
-
- /* make sure this is a primary FITS file */
- ft_cardfmt((FITSCard)oheader->cards,
- "SIMPLE", 0, FT_LOGICAL, &simple, 0, "Standard FITS");
- /* set dimension info, used by wcs code */
- ft_headseti(oheader, "NAXIS", 0, 2, "number of axes", 1);
- /* set dimension info */
- for(i=0; i<=1; i++){
- ival = (int)tldim(tlmin[i], tlmax[i], binsiz[i], tltyp[i]);
- ft_headseti(oheader, "NAXIS", i+1, ival, "axis dimension", 1);
- }
- /* set bitpix */
- ft_headseti(oheader, "BITPIX", 0, 32, "bits/pixel", 1);
- /* synchronize the header and the cards after any changes */
- ft_syncdata(oheader);
-
- /* transform WCS cards for the specified columns, if we have such */
- for(i=1; i<=iheader->table->tfields; i++){
- /* determine which bincol we are processing */
- if( !strcasecmp(iheader->table->col[i-1].name, name0) )
- which = 0;
- else if( !strcasecmp(iheader->table->col[i-1].name, name1) )
- which = 1;
- else
- continue;
- /* convert event wcs header info image wcs info */
- if( (s=ft_headgets(iheader, "TCTYP", i, NULL, &card)) && card ){
- ft_headapps(oheader, "CTYPE", which+1, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCRVL", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CRVAL", which+1, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCDLT", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CDELT", which+1, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCROT", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CROTA", which+1, s, NULL);
- xfree(s);
- }
- /* this value gets converted from physical to image */
- if( (dval=ft_headgetr(iheader, "TCRPX", i, 0.0, &card)) && card ){
- dval2 = tlp2i(dval, tlmin[which], binsiz[which], tltyp[which]);
- ft_headsetr(oheader, "CRPIX", which+1, dval2, 7, NULL, 1);
- }
- }
-
- /* init new wcs */
- hlength(ft_cards(oheader),0);
- wcs = wcsinit(ft_cards(oheader));
- ft_headfree(oheader, 1);
- /* save names for next time */
- strcpy(wcsnames[0], name0);
- strcpy(wcsnames[1], name1);
- }
-
- /* set some extra wcs parameters */
- if( wcs && iswcs(wcs) ){
- if( fcoordsys ) xfree(fcoordsys);
- fcoordsys = xstrdup(wcs->radecin);
- culc(fcoordsys);
- if( !wcs->coorflip ){
- cdelt1 = wcs->cdelt[0];
- cdelt2 = wcs->cdelt[1];
- }
- else{
- cdelt1 = wcs->cdelt[1];
- cdelt2 = wcs->cdelt[0];
- }
- if ( wcs->imflip ) {
- crot = -wcs->rot;
- } else {
- crot = wcs->rot;
- }
- }
- else{
- cdelt1 = 0.0;
- cdelt2 = 0.0;
- crot = 0.0;
- }
- /* set global coord system first time through */
- if( !gcoordsys ){
- if( (gcoordsys=xstrdup(getenv("COORDSYS"))) == NULL )
- gcoordsys = xstrdup(DEFAULT_COORDSYS);
- }
-}
-
-/*
- *
- * _FiltLexLcx -- determine if we have a linear-type WCS
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexLcx(void)
-#else
-static int _FiltLexLcx()
-#endif
-{
- char *coordsys;
- coordsys = gcoordsys;
- if( !coordsys || !*coordsys )
- return 0;
- if( !strcasecmp(coordsys, "image") ) return LCX_IMAGE;
- if( !strcasecmp(coordsys, "physical") ) return LCX_PHYS;
- if( !strcasecmp(coordsys, "amplifier") ) return LCX_AMP;
- if( !strcasecmp(coordsys, "detector") ) return LCX_DET;
- return 0;
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexNum(int lcx)
-#else
-static void _FiltLexNum(lcx)
- int lcx;
-#endif
-{
- char tbuf[SZ_LINE];
-
- /* process binary number, if necessary */
- bin2num(tbuf, yytext, SZ_LINE);
-
- /* for linear coordinate systems (physical, amps, etc.),
- we have to convert to image coords or physical coords,
- depending on the type of data and type of filtering */
- if( lcx ){
- /* data is in a table: we can use image or physical coords */
- if( filt->fhd->table ){
- /* if we want to use physical coordinates ... */
- if( USEPHYS ){
- /* convert image positions to physical coords */
- if( lcx == LCX_IMAGE ){
- if( POSARG ){
- dval = tli2p(strtod(tbuf,NULL),
- tlmin[(narg+1)%2], binsiz[(narg+1)%2], tltyp[(narg+1)%2]);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* angle arguments are just passed along */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* size arguments have to be converted using the binsize */
- else{
- if( SAVEANG ){
- dval = strtod(tbuf,NULL);
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- dval = strtod(tbuf,NULL) * binsiz[(narg+1)%2];
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- /* already in physical -- just pass along args */
- else{
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- /* we are using image coords (image-style filtering) */
- else{
- /* convert non-image positions to image coords */
- if( lcx != LCX_IMAGE ){
- if( POSARG ){
- dval = tlp2i(strtod(tbuf,NULL),
- tlmin[(narg+1)%2], binsiz[(narg+1)%2], tltyp[(narg+1)%2]);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* angle arguments are just passed along */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* size arguments have to be converted using the binsize */
- else{
- if( SAVEANG ){
- dval = strtod(tbuf,NULL);
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- dval = strtod(tbuf,NULL) / binsiz[(narg+1)%2];
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- /* already in image -- just pass along args */
- else{
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- }
- /* data is in an image: we use image coords */
- else{
- /* convert positional arguments to image */
- if( POSARG ){
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = SAOstrtod(tbuf,NULL);
- }
- else{
- ypos = SAOstrtod(tbuf,NULL);
- switch(lcx){
- case LCX_IMAGE:
- xpix = xpos;
- ypix = ypos;
- break;
- case LCX_PHYS:
- ft_phy2img(filt->fhd, xpos, ypos, &xpix, &ypix);
- break;
- case LCX_AMP:
- ft_amp2phy(filt->fhd, xpos, ypos, &dval, &dval2);
- ft_phy2img(filt->fhd, dval, dval2, &xpix, &ypix);
- break;
- case LCX_DET:
- ft_det2phy(filt->fhd, xpos, ypos, &dval, &dval2);
- ft_phy2img(filt->fhd, dval, dval2, &xpix, &ypix);
- break;
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
- }
- /* angle arguments are just passed along, with updated crot */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* convert size args, which may or may not be in pairs */
- else{
- if( SAVEANG ){
- dval = strtod(tbuf,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- /* arg 1 is associated with ra, arg2 with dec */
- if( XARG ){
- xpos = ABS(strtod(tbuf,NULL));
- ypos = 0.0;
- switch(lcx){
- case LCX_IMAGE:
- xpix = xpos;
- break;
- case LCX_PHYS:
- ft_phy2img_size(filt->fhd, xpos, ypos, &xpix, &ypix);
- break;
- case LCX_AMP:
- ft_amp2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- case LCX_DET:
- ft_det2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- }
- snprintf(sbuf, SZ_LINE, DFMT1, xpix);
- _FiltLexArgSave(xpix);
- }
- else{
- xpos = 0.0;
- ypos = ABS(strtod(tbuf,NULL));
- switch(lcx){
- case LCX_IMAGE:
- ypix = ypos;
- break;
- case LCX_PHYS:
- ft_phy2img_size(filt->fhd, xpos, ypos, &xpix, &ypix);
- break;
- case LCX_AMP:
- ft_amp2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- case LCX_DET:
- ft_det2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- }
- snprintf(sbuf, SZ_LINE, DFMT1, ypix);
- _FiltLexArgSave(ypix);
- }
- _FiltLexCat(sbuf);
- }
- }
- }
- /* not lcx -- angle arguments are just passed along with updated crot */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* not lcx -- everything else is assumed to be in units of "degrees"
- in the default system. add 'd' and put back for reparsing */
- else{
- int i;
- char *yycopy = xstrdup(tbuf);
- unput('d');
- for(i=yyleng-1; i>=0; --i)
- unput(yycopy[i]);
- xfree(yycopy);
- narg--;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltIncMask(FilterMask masks, int maxmask, int nmask)
-#else
-static int _FiltIncMask(masks, maxmask, nmask)
- FilterMask masks;
- int maxmask;
- int nmask;
-#endif
-{
- int omax;
- nmask++;
- if( nmask >= maxmask ){
- omax = maxmask;
- maxmask += MASKINC;
- masks = (FilterMask)xrealloc(masks, maxmask*sizeof(FilterMaskRec));
- memset(masks+omax, 0, (maxmask-omax)*sizeof(FilterMaskRec));
- }
- return nmask;
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltFitsMask(char *filename, FilterMask *rmasks, FITSHead *rhead, int *nreg)
-#else
-static int _FiltFitsMask(filename, rmasks, rhead, nreg)
- char *filename;
- FilterMask *rmasks;
- FITSHead *rhead;
- int *nreg;
-#endif
-{
- short *dptr;
- short *data=NULL;
- int x, y;
- int maxreg=-1;
- int maxmask; /* max masks allocated thus far */
- int nmask=0; /* number of mask segments */
- FilterMask masks=NULL; /* array valid region masks for one row */
- FITSHead head=NULL;
-
- /* read fits image */
- if( !ft_simpleimageread(filename, &head, (void *)&data, NULL, 16) ){
- return(-1);
- }
- if( !head->image ){
- if( data ) xfree(data);
- if( head ) ft_headfree(head, 1);
- return(-2);
- }
- if( !ft_naxes(head) || !ft_naxis(head, 1) || !ft_naxis(head, 2) ){
- if( data ) xfree(data);
- if( head ) ft_headfree(head, 1);
- return(-3);
- }
-
- /* allocate an array of masks, which will be returned to caller */
- maxmask = MASKINC;
- masks = (FilterMask)xcalloc(maxmask, sizeof(FilterMaskRec));
- /* seed the first region mask value */
- masks[nmask].region = 0;
- /* loop through y rows */
- for(y=1; y<=ft_naxis(head, 2); y++){
- dptr = data + ((y-1) * ft_naxis(head, 1));
- /* to start this line, we make a seed mask with no region */
- if( masks[nmask].region ){
- nmask = _FiltIncMask(masks, maxmask, nmask);
- masks[nmask].region = 0;
- }
- /* process each pixel in the row */
- for(x=1; x<=ft_naxis(head, 1); x++, dptr++){
- /* we do not allow negative values */
- if( *dptr < 0 ){
- if( data ) xfree(data);
- if( head ) ft_headfree(head, 1);
- if( masks ) xfree(masks);
- return(-4);
- }
- /* set max region as needed */
- if( *dptr > maxreg )
- maxreg = *dptr;
- /* look for a change in the mask */
- if( *dptr != masks[nmask].region ){
- /* if previous was non-zero region, finish it and bump to next */
- if( masks[nmask].region ){
- masks[nmask].xstop = x - 1;
- nmask = _FiltIncMask(masks, maxmask, nmask);
- }
- masks[nmask].y = y;
- masks[nmask].region = *dptr;
- masks[nmask].xstart = x;
- }
- }
- /* finish last non-zero segment, inc number of mask segs */
- if( masks[nmask].region ){
- masks[nmask].xstop = x;
- nmask = _FiltIncMask(masks, maxmask, nmask);
- }
- }
-
- /* free up data space */
- if( data ) xfree(data);
- /* allocate just enough mask space */
- masks = (FilterMask)xrealloc(masks, nmask*sizeof(FilterMaskRec));
- if( rmasks )
- *rmasks = masks;
- else
- xfree(masks);
- if( rhead )
- *rhead = head;
- else
- ft_headfree(head, 1);
- if( nreg )
- *nreg = maxreg;
-
- return(nmask);
-}
-
-/*
- *
- * Semi-public Routines
- *
- *
- */
-
-/*
- *
- * _FilterString -- return output filter from lexer
- *
- */
-#ifdef YY_USE_PROTOS
-char *
-_FilterString(void)
-#else
-char *_FilterString()
-#endif
-{
- if( filtlen <= 0 )
- _FiltLexMake();
- return(filter);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterRoutineCount(void)
-#else
-int FilterRoutineCount()
-#endif
-{
- return(nroutine);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterShapeCount(void)
-#else
-int FilterShapeCount()
-#endif
-{
- return(nshape);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterRegionCount(int type)
-#else
-int FilterRegionCount(type)
- int type;
-#endif
-{
- int i, j;
-
- /* handle fits image masks specially */
- if( nmask ){
- if( type & TOK_IREG )
- return(nregion);
- else
- return(0);
- }
-
- /* normal regions */
- for(i=0, j=0; i<nfiltseg; i++){
- if( filtseg[i]->type & type ){
- j += filtseg[i]->nregion;
- }
- }
- return(j);
-}
-
-#ifdef YY_USE_PROTOS
-char *
-FilterRadAng(void)
-#else
-char *FilterRadAng()
-#endif
-{
- return(radang);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterParseError(void)
-#else
-int FilterParseError()
-#endif
-{
- return(parse_error);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterTlInfo(double *tlmins, double *binsizs, int *tltyps)
-#else
-int FilterTlInfo(tlmins, binsizs, tltyps)
- double *tlmins;
- double *binsizs;
- int *tltyps;
-#endif
-{
- tlmins[0] = tlmin[0];
- tlmins[1] = tlmin[1];
- binsizs[0] = binsiz[0];
- binsizs[1] = binsiz[1];
- tltyps[0] = tltyp[0];
- tltyps[1] = tltyp[1];
- return 1;
-}
-
-#ifdef YY_USE_PROTOS
-void
-FiltInitParser(void)
-#else
-void FiltInitParser()
-#endif
-{
- static int parser = 0;
- /* make sure we free'd up all space from last time */
- _FiltLexEnd();
- /* set up some convenience variables */
- filt = FilterDefault();
-/*
- if( parser )
- yyrestart(NULL);
-*/
- BEGIN INITIAL;
- parser++;
- laststart=INITIAL;
-}
-
-#ifdef YY_USE_PROTOS
-void
-FiltScanString(char *s)
-#else
-void FiltScanString(s)
- char *s;
-#endif
-{
- int i;
- char *t;
- /* make sure there is an explicit delim at end so we are done before
- lex finds EOF -- otherwise panda shapes don't get processed */
- i = strlen(s);
- t = xmalloc(i+2);
- strcpy(t, s);
- if( (t[i-1] != ';') && (t[i-1] != '\n') )
- strcat(t, "\n");
- yy_scan_string(t);
- if( t ) xfree(t);
-}
-
-/* yyerror -- renamed to _filterror because flex -P does not change this */
-#ifdef YY_USE_PROTOS
-int
-_filterror(char *msg)
-#else
-int _filterror(msg)
- char *msg;
-#endif
-{
- if( *yytext )
- gerror(stderr, "%s while parsing filter at: %s\n",
- msg ? msg : "filterr", yytext);
- else
- gerror(stderr, "%s\n", msg ? msg : "filterr");
- YY_FLUSH_BUFFER;
- parse_error = 1;
- yyterminate();
-}
-
-#ifdef YY_USE_PROTOS
-int yywrap(void)
-#else
-int yywrap()
-#endif
-{
- return 1;
-}
diff --git a/funtools/filter/filter.c b/funtools/filter/filter.c
deleted file mode 100644
index 78d5383..0000000
--- a/funtools/filter/filter.c
+++ /dev/null
@@ -1,1041 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * filter.c -- hi-level management of filters
- *
- */
-
-#include <filter.h>
-
-#if HAVE_CYGWIN||HAVE_MINGW32
-#include <windows.h>
-#endif
-
-extern int idx_debug;
-
-/*
- *
- * private routines
- *
- */
-
-/* this is needed by lex */
-static Filter default_filter = NULL;
-
-/* null filters return this special record */
-static FilterRec null_filter;
-
-#ifdef ANSI_FUNC
-static void
-FiltInitRegions(void)
-#else
-static void FiltInitRegions()
-#endif
-{
- initevregions();
- initimregions();
-}
-
-/*
- *
- * _FilterImageCmp -- compare routine for qsort
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FilterImageCmp(const void *s1, const void *s2)
-#else
-static int _FilterImageCmp(s1, s2)
- const void *s1;
- const void *s2;
-#endif
-{
- FilterMask f1 = (FilterMask)s1;
- FilterMask f2 = (FilterMask)s2;
-
- if( f1->y < f2->y ){
- return -1;
- }
- else if( f1->y > f2->y ){
- return 1;
- }
- else{
- if( f1->xstart < f2->xstart ){
- return -1;
- }
- else{
- return 1;
- }
- }
-}
-
-/*
- *
- * semi-public routines, used by other modules
- *
- */
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *
- * FilterClip -- save the filter without the enclosing brackets
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterClip(char *filter)
-#else
-char *FilterClip(filter)
- char *filter;
-#endif
-{
- char *tbuf;
- char *tptr;
- char *ofilter;
- int len;
- int i;
-
- /* check for the obvious */
- if( !filter || (*filter == '\0') )
- return(NULL);
-
- /* save filter, but without the enclosing brackets */
- tbuf = xstrdup(filter);
- nowhite(tbuf, tbuf);
- tptr = tbuf;
- if( *tbuf == '[' ){
- tptr++;
- len = strlen(tptr);
- for(i=len-1; i>=0; i-- ){
- if( tptr[i] == ']' ){
- tptr[i] = '\0';
- break;
- }
- }
- }
- if( tptr && (*tptr != '\0') ){
- /* we extend the buffer because flex has problems in filt_init_buffer
- if its smaller than sizeof(FILE *) */
- ofilter = xcalloc(strlen(tptr)+SZ_LINE, sizeof(char));
- nowhite(tptr, ofilter);
- }
- else{
- ofilter = NULL;
- }
- xfree(tbuf);
- return(ofilter);
-}
-
-/*
- *
- * FilterDefault -- get the default filter handle for the parser
- *
- */
-#ifdef ANSI_FUNC
-Filter
-FilterDefault(void)
-#else
-Filter FilterDefault()
-#endif
-{
- return(default_filter);
-}
-
-/*
- *
- * FilterNull -- get the null filter pointer
- *
- */
-#ifdef ANSI_FUNC
-Filter
-FilterNull(void)
-#else
-Filter FilterNull()
-#endif
-{
- return(&null_filter);
-}
-
-/*
- *
- * FilterNum -- get a unique number associated with an open filter
- *
- */
-static int filter_num=0;
-#ifdef ANSI_FUNC
-int
-FilterNum(void)
-#else
-int FilterNum()
-#endif
-{
- filter_num++;
- return(filter_num);
-}
-
-/*
- *
- * FilterPath -- get the path through which we look for things
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterPath(void)
-#else
-char *FilterPath()
-#endif
-{
- static char *filter_path=NULL;
- if( filter_path == NULL ){
- filter_path = (char *)getenv("PATH");
- }
- return(filter_path);
-}
-
-/*
- *
- * FilterOpen -- open a filter and initialize the symbol table
- *
- */
-#ifdef ANSI_FUNC
-Filter
-FilterOpen(FITSHead header, char *string, char *mode)
-#else
-Filter FilterOpen(header, string, mode)
- FITSHead header; /* fitsy header struct */
- char *string; /* filter string */
- char *mode; /* "C", "f77", "awk", etc. */
-#endif
-{
- int lexonly=0;
- int got=0;
- char *s, *t;
- char tbuf[SZ_LINE];
- Filter filter;
- char *filtstr;
-
- /* return if we have no filter */
- if( (string == NULL) || (*string == '\0') ||
- !strcmp(string, "[]") || !strcmp(string, "\n") )
- return(NOFILTER);
-
- /* more checks for an essentially blank string */
- for(got=0, s=string; *s; s++){
- if( (*s != ' ') && (*s != '\t') && (*s != '\n') && (*s != ';') ){
- got++;
- break;
- }
- }
- if( !got )
- return(NOFILTER);
-
- /* allocate a new filter record */
- if( (filter = (Filter)xcalloc(1, sizeof(FilterRec))) == NULL )
- return(NULL);
-
- /* this is the default filter handle for the parser */
- default_filter = filter;
-
- /* clean up filter */
- s = FilterClip(string);
- /* if its not a file, use string directly */
- if( *s != '@' ){
- t = xstrdup(s);
- }
- /* if it a FITS file, use string directly */
- else if( IsFits(&(s[1])) ){
- t = xstrdup(s);
- }
- /* replace ASCII file with contents, if possible */
- else if( !(t = FileContents(&(s[1]), 0, NULL)) ){
- t = xstrdup(s);
- }
- /* set the input filter string for the parser */
- filter->string = FilterClip(t);
- if( s ) xfree(s);
- if( t ) xfree(t);
- /* return if we have no filter */
- if( !filter->string || (*filter->string == '\0') ){
- return(NOFILTER);
- }
-
- /* save mode */
- filter->mode=xstrdup(mode);
-
- /* assume we will use an index */
-#if HAVE_MINGW32==0
- filter->doidx = 1;
-#else
- filter->doidx = 0;
-#endif
-
- /* process the mode string */
- if( (s = xstrdup(filter->mode)) ){
- /* set global convert flag */
- if( keyword(s, "convert", tbuf, SZ_LINE) )
- filter->convert = istrue(tbuf);
- /* set the event section */
- if( keyword(s, "evsect", tbuf, SZ_LINE) )
- filter->evsect = xstrdup(tbuf);
- if( keyword(s, "lexonly", tbuf, SZ_LINE) )
- lexonly = 1;
-#if HAVE_MINGW32==0
- if( keyword(s, "idx", tbuf, SZ_LINE) ){
- if( istrue(tbuf) )
- filter->doidx = 1;
- else if( isfalse(tbuf) )
- filter->doidx = -1;
- }
-#endif
- }
- if( s ) xfree(s);
-
- /* determine which method of filter processing we will use:
- currently we support only the C method */
- filter->method = DEFAULT_FILTER_METHOD;
- *tbuf = '\0';
- if( (s=(char *)getenv("FILTER_METHOD")) ){
- strcpy(tbuf, s);
- }
- if( !*tbuf && (s=xstrdup(filter->mode)) ){
- keyword(s, "method", tbuf, SZ_LINE);
- if( s ) xfree(s);
- }
- if( *tbuf ){
- if( !strcasecmp(tbuf, "c") )
- filter->method = METHOD_C;
- }
-
- /* determine which type of filtering we do: event or image */
- filter->type = DEFAULT_FILTER_TYPE;
- *tbuf = '\0';
- if( (s=(char *)getenv("FILTER_TYPE")) ){
- strcpy(tbuf, s);
- }
- if( !*tbuf && (s=xstrdup(filter->mode)) ){
- keyword(s, "type", tbuf, SZ_LINE);
- if( s ) xfree(s);
- }
- if( *tbuf ){
- if( !strncasecmp(tbuf, "ev", 2) )
- filter->type = TYPE_EVENTS;
- else if( !strncasecmp(tbuf, "im", 2) )
- filter->type = TYPE_IMAGE;
- }
-
- /* determine which type of process execution we do */
- switch(filter->method){
- case METHOD_C:
- filter->ptype = DEFAULT_FILTER_PTYPE;
- *tbuf = '\0';
- if( (s=(char *)getenv("FILTER_PTYPE")) ){
- strcpy(tbuf, s);
- }
- if( !*tbuf && (s=xstrdup(filter->mode)) ){
- keyword(s, "ptype", tbuf, SZ_LINE);
- if( s ) xfree(s);
- }
- if( *tbuf ){
- if( *tbuf == 'p' )
- filter->ptype = PTYPE_PROCESS;
- else if( *tbuf == 'c' )
- filter->ptype = PTYPE_CONTAINED;
-#ifdef USE_DL
- else if( *tbuf == 'd' )
- filter->ptype = PTYPE_DYNAMIC;
-#endif
- }
- break;
- default:
- filter->ptype = PTYPE_PROCESS;
- break;
- }
-
- /* determine region paint mode */
- *tbuf = '\0';
- if( (s=(char *)getenv("FILTER_PAINT")) ){
- strcpy(tbuf, s);
- }
- if( !*tbuf && (s=xstrdup(filter->mode)) ){
- keyword(s, "paint", tbuf, SZ_LINE);
- if( s ) xfree(s);
- }
- if( !*tbuf )
- strcpy(tbuf, DEFAULT_PAINT_MODE);
- if( *tbuf ){
- if( istrue(tbuf) )
- filter->paint = 1;
- else
- filter->paint = 0;
- }
-
- /* debugging mode */
- *tbuf = '\0';
- if( (s=(char *)getenv("FILTER_DEBUG")) ){
- strcpy(tbuf, s);
- }
- if( !*tbuf && (s=xstrdup(filter->mode)) ){
- keyword(s, "debug", tbuf, SZ_LINE);
- if( s ) xfree(s);
- }
- if( *tbuf ){
- if( isdigit((int)*tbuf) )
- filter->debug = atoi(tbuf);
- else if( istrue(tbuf) )
- filter->debug = 1;
- else if( isfalse(tbuf) )
- filter->debug = 0;
- }
-
- /* save the fits header */
- filter->fhd = header;
-
- /* init the symbol table */
- if( !FilterSymbolInit(filter) )
- goto error;
-
- /* init parser variables */
- FiltInitParser();
-
- /* init regions */
- FiltInitRegions();
-
- /* set up to parse the input filter */
- FiltScanString(filter->string);
-
- /* parse filter */
- filtlex();
-
- /* check for errors while parsing the string */
- if( FilterParseError() )
- goto error;
-
- /* make sure we have something to filter */
- if( !(filtstr = (char *)_FilterString()) || !strcmp(filtstr, "()") ){
- FilterClose(filter);
- return(NOFILTER);
- }
-
- /* imagemask processing of images does not use the compiled process */
- if( filter->nmask && filter->masks && (filter->type == TYPE_IMAGE) )
- goto done;
-
- /* for event filtering, we can use indexes */
-#if HAVE_MINGW32==0
- if( filter->type == TYPE_EVENTS ){
- /* run index grammar and see if we can get help from indexes */
- if( filter->doidx == 1 ){
- if( !idxinitparser(filtstr) ){
- filter->doidx = -1;
- }
- else{
- idxparse();
- idxfreeglobals();
- if( !filter->idx || (filter->idx->type == IDX_INDEF) ){
- if( filter->idx ){
- idxendparser();
- filter->idx = NULL;
- }
- filter->doidx = -1;
- }
- }
- }
- /* if we are using an index and we are only processing indexed columns,
- we don't need to use compiled filter */
- if( FILTER_INDEX_ONLY(filter) ){
- if( idx_debug ) fprintf(stderr, "idx: skipping compiled filter\n");
- goto done;
- }
- }
-#endif
-
- /* lexonly means we only wanted to run the lexer */
- if( lexonly )
- goto done;
-
- /* open the program file that we will compile from the filter */
- if( !FilterProgOpen(filter) )
- goto error;
-
- /* prepend the to C program as needed */
- if( !FilterProgPrepend(filter) )
- goto error;
-
- /* write the symbols to the appropriate program */
- if( !FilterProgWrite(filter) )
- goto error;
-
- /* append the program body to C program */
- if( !FilterProgAppend(filter) )
- goto error;
-
- /* that is all we need to output */
- if( !FilterProgClose(filter) )
- goto error;
-
- /* compile the filter program */
- if( !FilterProgCompile(filter) )
- goto error;
-
- if( filter->debug >= 2 ) goto done;
-
- switch(filter->method){
- case METHOD_C:
- switch(filter->ptype){
- case PTYPE_PROCESS:
- case PTYPE_CONTAINED:
- switch(filter->pipeos){
- case PIPE_WIN32:
-#if HAVE_CYGWIN||HAVE_MINGW32
- if( !WinProcessOpen(filter->prog,
- &(filter->ihandle), &(filter->ohandle), &(filter->process)) )
- goto error;
-#else
- gerror(stderr, "internal error: no WinProcess without Windows");
- goto error;
-#endif
- break;
- default:
- if( !ProcessOpen(filter->prog,
- &(filter->ichan), &(filter->ochan), &(filter->pid)) )
- goto error;
- break;
- }
- break;
-#ifdef USE_DL
- case PTYPE_DYNAMIC:
- if( !(filter->dl=DLOpen(filter->prog)) )
- goto error;
- break;
-#endif
- default:
- goto error;
- }
- break;
- default:
- goto error;
- }
-
- /* return the good news */
-done:
- return(filter);
-
-error:
- FilterClose(filter);
- return(NULL);
-
-}
-
-/*
- *
- * FilterEvents -- filter events by sending them to a co-process,
- * which returns a char array of good event flags
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterEvents(Filter filter, char *ebuf, int esize, int n, int *vbuf)
-#else
-int FilterEvents(filter, ebuf, esize, n, vbuf)
- Filter filter;
- char *ebuf;
- int esize;
- int n;
- int *vbuf;
-#endif
-{
- int i;
- int flag;
- int get=0, got=0;
- int bytes;
- char *eptr;
- char *etop;
- char *obuf;
- char *optr;
-#ifdef USE_DL
- FilterTableCall evrtn;
-#endif
- FilterSymbols sp;
-
- /* make sure we have a valid filter and a valid table */
- if( !filter || (filter == NOFILTER) || !filter->fhd || !filter->fhd->table )
- return(0);
-
- /* handle fits image mask specially */
- if( filter->nmask && filter->masks && !filter->evsect ){
- gerror(stderr, "event filtering cannot use image masks\n");
- return(0);
- }
-
- /* if the index is enough, just return */
- if( FILTER_INDEX_ONLY(filter) )
- return 0;
-
- /* we only send the necessary parts of each event record */
- if( (obuf = (char *)xcalloc(n*filter->evsize, sizeof(char))) == NULL )
- return(0);
- optr = obuf;
-
- /* extract (and convert) the necessary columns of the event */
- for(eptr=ebuf, etop=ebuf+(n*esize); eptr<etop; eptr += esize){
- /* loop through the symbol table and process columns */
- for(i=0; i<filter->nsyms; i++){
- sp = &(filter->symtab[i]);
- /* skip accidentally empty ones */
- if( (sp->name == NULL) || (*sp->name == '\0') )
- continue;
- /* process this type of symbol */
- switch(sp->type){
- case SYM_COL:
- if( filter->fhd->table->col[sp->idx].type == 'X' ){
- ColumnLoad(eptr+filter->fhd->table->col[sp->idx].offset,
- filter->fhd->table->col[sp->idx].size,
- (filter->fhd->table->col[sp->idx].n+7)/8,
- filter->convert, optr+sp->offset);
- }
- else{
- ColumnLoad(eptr+filter->fhd->table->col[sp->idx].offset,
- filter->fhd->table->col[sp->idx].size,
- filter->fhd->table->col[sp->idx].n,
- filter->convert, optr+sp->offset);
- }
- break;
- default:
- break;
- }
- }
- /* bump to next output record */
- optr += filter->evsize;
- }
-
- switch(filter->ptype){
- case PTYPE_PROCESS:
- case PTYPE_CONTAINED:
- switch(filter->pipeos){
- case PIPE_WIN32:
-#if HAVE_CYGWIN||HAVE_MINGW32
- /* write events to the filter process */
- bytes = n*filter->evsize;
- if((got=WinProcessWrite(filter->ohandle, obuf, bytes)) != bytes){
- gerror(stderr,
- "event filter failed: wanted to write %d bytes but wrote %d\n",
- bytes, got);
- flag = -1;
- }
- /* read back result flags */
- get = n * sizeof(unsigned int);
- WinProcessRead(filter->ihandle, vbuf, get, &got);
-#else
- gerror(stderr, "internal error: no WinProcess without Windows");
- flag = -1;
-#endif
- break;
- default:
- /* write events to the filter process */
- bytes = n*filter->evsize;
- if((got=ProcessWrite(filter->ochan, obuf, bytes)) != bytes){
- gerror(stderr,
- "event filter failed: wanted to write %d bytes but wrote %d\n",
- bytes, got);
- flag = -1;
- }
- /* read back result flags */
- get = n * sizeof(unsigned int);
- ProcessRead(filter->ichan, vbuf, get, &got);
- break;
- }
- /* we need one int back for each event we wrote */
- if( get == got ){
- flag = 1;
- }
- else{
- gerror(stderr,
- "event filter failed: wanted to read %d bytes but got %d\n",
- get, got);
- flag = -1;
- }
- break;
-#ifdef USE_DL
- case PTYPE_DYNAMIC:
- if( (evrtn=(FilterTableCall)DLSym(filter->dl, filter->pname)) ){
- filter->g = (*evrtn)(filter->g, obuf, n, filter->evsize, vbuf);
- flag = 1;
- }
- else{
- flag = -1;
- }
- break;
-#endif
- default:
- flag = -1;
- break;
- }
-
- /* free up malloc'ed space */
- if( obuf ) xfree(obuf);
- /* return the news */
- return flag;
-}
-
-/*
- *
- * FilterImage -- filter image by sending sections to a co-process,
- * which returns segments of valid image data
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterImage(Filter filter, int x0, int x1, int y0, int y1, int block,
- FilterMask *masks, int *nreg)
-#else
-int FilterImage(filter, x0, x1, y0, y1, block, masks, nreg)
- Filter filter;
- int x0, x1, y0, y1, block;
- FilterMask *masks;
- int *nreg;
-#endif
-{
- int i, j;
- int got;
- int fsize;
- int mblock;
- char tbuf[SZ_LINE];
- FilterMask xmasks;
-#ifdef USE_DL
- FilterImageCall imrtn;
-#endif
-
- /* make sure we have a valid filter */
- if( !filter || (filter == NOFILTER) )
- return(0);
-
- /* handle fits image mask specially */
- if( filter->nmask && filter->masks ){
- mblock = (int)(((double)((x1 - x0 + 1)/block)/(double)ft_naxis(filter->maskhd, 1)) + 0.5);
- if( mblock < 1 ){
- gerror(stderr, "image mask cannot be larger than blocked image section");
- return(0);
- }
- /* copy mask records into return buffer */
- fsize = filter->nmask * sizeof(FilterMaskRec) * mblock;
- xmasks = xmalloc(fsize);
- /* copy all masks and translate x,y positions as needed */
- for(got=0, i=0; i<filter->nmask; i++){
- xmasks[got].region = filter->masks[i].region;
- xmasks[got].y = (filter->masks[i].y - 1.0) * mblock + 1.0;
- xmasks[got].xstart = (filter->masks[i].xstart - 1.0) * mblock + 1.0;
- xmasks[got].xstop = (filter->masks[i].xstop - 1.0) * mblock + 1.0;
- /* replicate the segment up to the block factor */
- for(j=1; j<mblock; j++){
- xmasks[got+j].region = xmasks[got].region;
- xmasks[got+j].y = xmasks[got].y+j;
- xmasks[got+j].xstart = xmasks[got].xstart;
- xmasks[got+j].xstop = xmasks[got].xstop;
- }
- got += mblock;
- }
- /* sort by y and x */
- qsort(xmasks, got, sizeof(FilterMaskRec), _FilterImageCmp);
- /* mask records */
- if( masks ) *masks = xmasks;
- /* number of regions */
- if( nreg ) *nreg = filter->nmaskreg;
- return(got);
- }
-
- /* if the index is enough, just return */
- if( FILTER_INDEX_ONLY(filter) )
- return(0);
-
- switch(filter->ptype){
- case PTYPE_PROCESS:
- case PTYPE_CONTAINED:
- switch(filter->pipeos){
- case PIPE_WIN32:
-#if HAVE_CYGWIN||HAVE_MINGW32
- /* write command to process */
- snprintf(tbuf, SZ_LINE-1, "%d %d %d %d %d\n", x0, x1, y0, y1, block);
- WinProcessWrite(filter->ohandle, tbuf, (int)strlen(tbuf));
- /* read back mask records */
- *masks = WinProcessRead(filter->ihandle, NULL, -1, &got);
- got /= sizeof(FilterMaskRec);
-#else
- gerror(stderr, "internal error: no WinProcess without Windows");
- return(-1);
-#endif
- break;
- default:
- /* write command to process */
- snprintf(tbuf, SZ_LINE-1, "%d %d %d %d %d\n", x0, x1, y0, y1, block);
- ProcessWrite(filter->ochan, tbuf, (int)strlen(tbuf));
- /* read back mask records */
- *masks = ProcessRead(filter->ichan, NULL, -1, &got);
- got /= sizeof(FilterMaskRec);
- break;
- }
- break;
-#ifdef USE_DL
- case PTYPE_DYNAMIC:
- if( (imrtn=(FilterImageCall)DLSym(filter->dl, filter->pname)) ){
- *masks = (*imrtn)(x0, x1, y0, y1, block, &got);
- }
- else
- return(-1);
- break;
-#endif
- default:
- return(-1);
- }
-
- /* how many separate regions? */
- if( nreg ) *nreg = FilterRegionCount(TOK_IREG);
-
- /* return the news */
- return(got);
-}
-
-/*
- *
- * FilterClose -- close a filter and free up memory
- *
- */
-#ifdef ANSI_FUNC
-int FilterClose(Filter filter)
-#else
-int FilterClose(filter)
- Filter filter;
-#endif
-{
- int status=0;
- int i, j;
- Scan scan, tscan;
-
- if( !filter || (filter == NOFILTER) )
- return(0);
-
- /* this is the default filter handle */
- default_filter = filter;
-
- switch(filter->ptype){
- case PTYPE_PROCESS:
- case PTYPE_CONTAINED:
- /* close the filter process */
- switch(filter->pipeos){
- case PIPE_WIN32:
-#if HAVE_CYGWIN||HAVE_MINGW32
- if( filter->process ) WinProcessClose(filter->process, &status);
-#else
- gerror(stderr, "internal error: no WinProcess without Windows");
-#endif
- break;
- default:
- if( filter->pid > 0 ) ProcessClose(filter->pid, &status);
- break;
- }
- /* delete program */
- if( filter->prog ) unlink(filter->prog);
- break;
-#ifdef USE_DL
- case PTYPE_DYNAMIC:
- if( filter->dl )
- DLClose(filter->dl);
- break;
-#endif
- default:
- break;
- }
-
- /* call any method-specific cleanup routines */
- FilterProgClose(filter);
- FilterProgEnd(filter);
-
- /* free alloc'ed memory */
- FilterSymbolFree(filter);
- if( filter->pname ) xfree(filter->pname);
- if( filter->mode ) xfree(filter->mode);
- if( filter->masks ) xfree(filter->masks);
- if( filter->cc ) xfree(filter->cc);
- if( filter->cflags ) xfree(filter->cflags);
- if( filter->objs ) xfree(filter->objs);
- if( filter->extra ) xfree(filter->extra);
- if( filter->shflags ) xfree(filter->shflags);
- if( filter->code ) xfree(filter->code);
- if( filter->prog ) xfree(filter->prog);
- if( filter->string ) xfree(filter->string);
- if( filter->xbin ) xfree(filter->xbin);
- if( filter->ybin ) xfree(filter->ybin);
- if( filter->symtab ) xfree(filter->symtab);
- if( filter->evsect ) xfree(filter->evsect);
- if( filter->maskhd ) ft_headfree(filter->maskhd, 1);
- /* free region information */
- if( filter->g ){
- for(i=0; i<filter->g->maxshapes; i++){
- if( filter->g->shapes[i].scanlist ){
- for(j=0; j<=filter->g->y1; j++){
- if( filter->g->shapes[i].scanlist[j] ){
- for(scan=filter->g->shapes[i].scanlist[j]; scan; ){
- tscan = scan->next;
- xfree(scan);
- scan = tscan;
- }
- }
- }
- xfree(filter->g->shapes[i].scanlist);
- }
- if( filter->g->shapes[i].pts ) xfree(filter->g->shapes[i].pts);
- if( filter->g->shapes[i].xv ) xfree(filter->g->shapes[i].xv);
- }
- if( filter->g->shapes ) xfree(filter->g->shapes);
- if( filter->g->ybuf ) xfree(filter->g->ybuf);
- if( filter->g->x0s ) xfree(filter->g->x0s);
- if( filter->g->x1s ) xfree(filter->g->x1s);
- if( filter->g->masks ) xfree(filter->g->masks);
- if( filter->g ) xfree(filter->g);
- }
- /* free index information */
-#if HAVE_MINGW32==0
- idxendparser();
-#endif
- /* free main struct */
- xfree(filter);
- /* return the status from closing the sub-process */
- return(status);
-}
-
-
-/*
- *
- * FilterConcats -- concat n filters, removing enclosing brackets as necessary
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterConcats(char **filters, int n)
-#else
-char *FilterConcats(filters, n)
- char **filters;
- int n;
-#endif
-{
- char *ofilter;
- char *optr;
- char *clip;
- int i;
- int len;
-
- /* need at least 1 string */
- if( n == 0 )
- return(NULL);
-
- /* get max length of output filter */
- for(len=0, i=0; i<n; i++){
- if( filters[i] && (*filters[i] != '\0') ){
- len += strlen(filters[i]);
- }
- }
-
- /* need something to return */
- if( len == 0 )
- return(NULL);
-
- /* allocate space for the output filter */
- ofilter = (char *)xcalloc(len+1, sizeof(char));
- optr = ofilter;
-
- /* take each input filter */
- for(i=0; i<n; i++){
- if( filters[i] && (*filters[i] != '\0') ){
- /* clip off the brackets */
- clip = FilterClip(filters[i]);
- /* copy the clipped filter to the output */
- if( clip && (*clip != '\0') ){
- strcpy(optr, clip);
- xfree(clip);
- while( *optr )
- optr++;
- }
- }
- }
-
- /* this is the concat'ed filter */
- return(ofilter);
-}
-
-/*
- *
- * FilterConcat -- concat 2 filters, with an optional operation in between
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterConcat(char *f1, char *f2, char *op)
-#else
-char *FilterConcat(f1, f2, op)
- char *f1;
- char *f2;
- char *op;
-#endif
-{
- char *nf1, *nf2, *nop;
- char *result;
- char *filters[4];
- int n=0;
-
- /* clip the filters and look for null extensions */
- nf1 = FilterClip(f1);
- nf2 = FilterClip(f2);
- nop = FilterClip(op);
-
- if( nf1 && (*nf1 != '\0') ){
- filters[n++] = nf1;
- }
- if( nop && (*nop != '\0') &&
- nf1 && (*nf1 != '\0') &&
- nf2 && (*nf2 != '\0') ){
- filters[n++] = nop;
- }
- if( nf2 && (*nf2 != '\0') ){
- filters[n++] = nf2;
- }
-
- /* get the concated filters */
- result = FilterConcats(filters, n);
-
- /* free up space */
- if( nf1 )
- xfree(nf1);
- if( nf2 )
- xfree(nf2);
- if( nop )
- xfree(nop);
-
- /* return result */
- return(result);
-}
-
-/*
- *
- * FilterString -- return the filter string used for this filter
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterString(Filter filter)
-#else
-char *FilterString(filter)
- Filter filter;
-#endif
-{
- if( !filter || (filter == NOFILTER) )
- return NULL;
- else
- return filter->string;
-}
diff --git a/funtools/filter/filter.h b/funtools/filter/filter.h
deleted file mode 100644
index 7a49bdc..0000000
--- a/funtools/filter/filter.h
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * filter.h - include file for "compile on the fly" filters
- *
- */
-
-#ifndef __filter_h
-#define __filter_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-/* avoid use of system -- its not secure */
-/* but funtools cannot use launch for the MinGW platform because the stdfiles
- support is missing in the launch_spawnvp() implementation of launch */
-#ifndef USE_LAUNCH
-#define USE_LAUNCH 1
-#endif
-#if HAVE_MINGW32
-#undef USE_LAUNCH
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include <sys/types.h>
-#include "prsetup.h"
-#include "gio.h"
-#include "file.h"
-#include "find.h"
-#include "macro.h"
-#include "word.h"
-#include "xalloc.h"
-#include "strtod.h"
-#define USE_XFILEIO 1
-#include "fitsy.h"
-#undef USE_XFILEIO
-#include "idx.h"
-#include "wcs.h"
-#include "column.h"
-#include "tl.h"
-#include "dl.h"
-#include "mkrtemp.h"
-#include "zprocess.h"
-#include "winprocess.h"
-#include "parse.h"
-#ifdef USE_LAUNCH
-#include "xlaunch.h"
-#endif
-
-#ifndef OBJPATH
-#define OBJPATH "."
-#endif
-
-#ifndef FILTER_CC
-#define FILTER_CC NULL
-#endif
-
-#ifndef FILTER_CFLAGS
-#define FILTER_CFLAGS NULL
-#endif
-
-/* define methods of program generation */
-#define METHOD_C 1
-
-/* define types of filtering */
-#define TYPE_EVENTS 1
-#define TYPE_IMAGE 2
-
-/* define types of filtering process -- separate process, self-contained
- separate process, or dynamic load (if defined) */
-#define PTYPE_PROCESS 1
-#define PTYPE_CONTAINED 2
-#define PTYPE_DYNAMIC 3
-
-/* define how we connect the processes -- unix or windows pipes */
-#define PIPE_UNIX 0
-#define PIPE_WIN32 1
-
-
-/* defaults which can be overridden by environment variables */
-#define DEFAULT_FILTER_METHOD METHOD_C
-#define DEFAULT_FILTER_TYPE TYPE_EVENTS
-#ifdef USE_DL
-#define DEFAULT_FILTER_PTYPE PTYPE_DYNAMIC
-#else
-#define DEFAULT_FILTER_PTYPE PTYPE_PROCESS
-#endif
-#define DEFAULT_PAINT_MODE "false"
-#define DEFAULT_FILTER_TMPDIR "/tmp"
-
-/* define type of important tokens */
-#define TOK_EREG 1
-#define TOK_NREG 2
-#define TOK_IREG 4
-#define TOK_RLIST 8
-#define TOK_RTINE 16
-#define TOK_NAME 32
-#define TOK_ACCEL 64
-#define TOK_VARARGS 128
-
-#define TOK_REG (TOK_EREG|TOK_NREG|TOK_IREG)
-
-/* default cordinate system for regions */
-#define DEFAULT_COORDSYS "physical"
-
-/* if we have gcc, we can use dynamic loading instead of a separate process */
-#define GCC_SHARED_FLAGS "-g -fPIC -shared"
-
-/* places to look for the compiler other than user's path */
-#define CC_PATH "/opt/SUNWspro/bin:/bin:/usr/bin:/usr/local/bin/:/opt/local/bin:"
-
-/* define non-WCS coordinate systems we handle specially */
-#define LCX_IMAGE 1
-#define LCX_PHYS 2
-#define LCX_AMP 3
-#define LCX_DET 4
-
-/* define symbol types in symbol table */
-#define SYM_COL 1
-#define SYM_PAR 2
-
-/* whether we use only the index and not the compiled filter */
-#define FILTER_INDEX_ONLY(f) \
- ((f->doidx==1)&&(f->idx)&&(f->idx->dofilt==0)&&(f->idx->rtype!=IDX_INDEF))
-
-typedef struct filtmask {
- int region;
- int y;
- int xstart, xstop;
-} *FilterMask, FilterMaskRec;
-
-typedef struct scanrec{
- struct scanrec *next;
- int x;
-} *Scan, ScanRec;
-
-/* structs for use with region routines */
-typedef struct shaperec {
- int init;
- double ystart, ystop;
- Scan *scanlist;
- /* varargs */
- int nv;
- double *xv;
- /* circle, annulus */
- double r1sq, r2sq;
- /* ellipse */
- double angl, sinangl, cosangl;
- double cossq, sinsq;
- double xradsq, yradsq;
- double a;
- /* polygon-style shapes */
- int npt;
- double *pts;
- /* line */
- int xonly;
- double x1, x2, y1;
- double invslope;
-} *Shape, ShapeRec;
-
-typedef struct gfiltrec {
- int nshapes; /* number of shapes */
- int maxshapes; /* number of shape records we allocate */
- Shape shapes; /* array holding range limits for one shape */
- int rid; /* first valid region for current pixel */
- int usebinsiz; /* whether bindizx,binsizy are used */
- char *evsect; /* value of event section */
- double tlminx, tlminy; /* tlmin for event section */
- double binsizx, binsizy; /* bin sizes for event section */
- double tloff; /* offset for quick p2i conversion */
- int xmin, xmax, ymin, ymax; /* section limits in original image coords */
- int block; /* block factor */
- int x0, x1, y0, y1; /* section limits in section coords */
- int *ybuf; /* valid y row flags */
- int *x0s; /* valid x start values */
- int *x1s; /* valid x stop values */
- int nmask; /* number of image mask record */
- int maskdim; /* size of mask image */
- FilterMask masks; /* mask records */
-} *GFilt, GFiltRec;
-
-typedef struct filtseg {
- int n;
- int type;
- int ops;
- int len;
- int flag;
- int nregion;
- char *s;
- int s0;
- char *regions;
- int nr;
- char *shapes;
- int ns;
- int regval;
- char *radang;
- int ralen;
-} *FiltSeg, FiltSegRec;
-
-/* structs for use with symbol table routines */
-typedef struct filtsymtab {
- int type;
- char *name;
- char *value;
- int idx;
- int offset;
- FITSCard card;
-} *FilterSymbols, FilterSymRec;
-
-typedef struct filtrec {
- /* general information */
- char *mode;
- char *evsect;
- int method;
- int type;
- int paint;
- int debug;
- /* the input filter string */
- char *string;
- int size;
- /* fits info */
- FITSHead fhd;
- int convert;
- char *xbin;
- char *ybin;
- /* compiled program info */
- char *code;
- char *prog;
- FILE *fp;
- /* symbol table info */
- int maxsyms;
- int nsyms;
- int evsize;
- FilterSymbols symtab;
- /* method info */
- char *cc;
- char *cflags;
- char *objs;
- char *extra;
- char *shflags;
- /* process info */
- char *pname;
- int ptype;
- /* which type of pipe? */
- int pipeos;
- /* used by unix pipe */
- int pid;
- int ichan;
- int ochan;
- /* used by Windows pipe */
- void *process;
- void *ihandle;
- void *ohandle;
- /* used for dynamic linking */
- void *dl;
- GFilt g;
- /* loadable drivers for each technique */
- /* NB: can't use typdef because we refer to this struct */
- int (*filt_start) _PRx((struct filtrec *filter));
- int (*filt_open) _PRx((struct filtrec *filter));
- int (*filt_prepend) _PRx((struct filtrec *filter));
- int (*filt_write) _PRx((struct filtrec *filter));
- int (*filt_append) _PRx((struct filtrec *filter));
- int (*filt_close) _PRx((struct filtrec *filter));
- int (*filt_compile) _PRx((struct filtrec *filter));
- int (*filt_end) _PRx((struct filtrec *filter));
- char *(*filt_name) _PRx((struct filtrec *filter, char *name));
- char *(*filt_routine1) _PRx((struct filtrec *filter, char *name));
- char *(*filt_routine2) _PRx((struct filtrec *filter, char *name));
- char *(*filt_region1) _PRx((struct filtrec *filter, char *name));
- char *(*filt_region2) _PRx((struct filtrec *filter, char *name));
- /* fits image mask info */
- int nmask;
- int nmaskreg;
- FilterMask masks;
- FITSHead maskhd;
- /* indexing information */
- int doidx;
- idxvalrec *valhead;
- idxrowrec *rowhead;
- idxrowrec *idx;
-} *Filter, FilterRec;
-
-typedef void *(*FilterTableCall)(
-#ifdef ANSI_FUNC
- void *tg, char *ebuf, int ne, int esize, int *rbuf
-#endif
-);
-
-typedef FilterMask (*FilterImageCall)(
-#ifdef ANSI_FUNC
- int txmin, int txmax, int tymin, int tymax, int tblock, int *got
-#endif
-);
-
-/* this makes it look like a simple flag */
-#define NOFILTER FilterNull()
-
-_PRbeg
-
-/* filter.c */
-int FilterNum _PRx((void));
-char *FilterClip _PRx((char *filter));
-Filter FilterDefault _PRx((void));
-Filter FilterNull _PRx((void));
-char *FilterPath _PRx((void));
-Filter FilterOpen _PRx((FITSHead header, char *filter, char *mode));
-int FilterEvents _PRx((Filter filter,
- char *ebuf, int esize, int n, int *vbuf));
-int FilterImage _PRx((Filter filter,
- int x0, int x1, int y0, int y1, int block,
- FilterMask *masks, int *nreg));
-int FilterClose _PRx((Filter filter));
-char *FilterConcats _PRx((char **filters, int n));
-char *FilterConcat _PRx((char *f1, char *f2, char *op));
-char *FilterString _PRx((Filter filter));
-
-/* symbols.c */
-int FilterSymbolInit _PRx((Filter filter));
-char *FilterSymbolEnter _PRx((Filter filter, char *s, int *got));
-FilterSymbols FilterSymbolLookup _PRx((Filter filter, char *s));
-int FilterSymbolDefaults _PRx((Filter filter, int enter));
-void FilterSymbolFree _PRx((Filter filter));
-
-/* filt.l */
-char *_FilterString _PRx((void));
-void FiltInitParser _PRx((void));
-void FiltScanString _PRx((char *s));
-int FilterRoutineCount _PRx((void));
-int FilterShapeCount _PRx((void));
-int FilterRegionCount _PRx((int type));
-int FilterParseError _PRx((void));
-int FilterTlInfo _PRx((double *tlmins, double *binsizs, int *tltyps));
-char *FilterRadAng _PRx((void));
-
-int filterror _PRx((char *msg));
-int filtlex _PRx((void));
-int filtwrap _PRx((void));
-int filtparse _PRx((void));
-
-/* filtprog.c */
-int FilterProgStart _PRx((Filter filter));
-int FilterProgOpen _PRx((Filter filter));
-int FilterProgPrepend _PRx((Filter filter));
-int FilterProgWrite _PRx((Filter filter));
-int FilterProgAppend _PRx((Filter filter));
-int FilterProgClose _PRx((Filter filter));
-int FilterProgCompile _PRx((Filter filter));
-int FilterProgEnd _PRx((Filter filter));
-char *FilterLexName _PRx((Filter filter, char *name));
-char *FilterLexRoutine1 _PRx((Filter filter, char *name));
-char *FilterLexRoutine2 _PRx((Filter filter, char *name));
-char *FilterLexRegion1 _PRx((Filter filter, char *name));
-char *FilterLexRegion2 _PRx((Filter filter, char *name));
-
-/* filtprog_c.c */
-int FilterProgLoad_C _PRx((Filter filter));
-
-/* evregions.c */
-void initevregions _PRx((void));
-/* imregions.c */
-void initimregions _PRx((void));
-
-_PRend
-
-/* for compatibility with funtools */
-#define FilterTable FilterEvents
-
-#endif /* __filter.h */
diff --git a/funtools/filter/filter_pyh.py b/funtools/filter/filter_pyh.py
deleted file mode 100644
index fb98196..0000000
--- a/funtools/filter/filter_pyh.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# from regions.h -- no idea what it is ...
-xsno=3
-
-# ... but its important!
-maxshapes=(nshape*(xsno+1))+1
-
-# ctypes struct definitions (taken from filter.h)
-class filtmask(Structure):
- _fields_ = [('region', c_int), ('y', c_int), ('xstart', c_int), ('xstop', c_int)]
-
-class scanrec(Structure):
- pass
-
-# this is how you add a forward pointer
-scanrec._fields_ = [ ('next', POINTER(scanrec)), ('x', c_int) ]
-
-class shaperec(Structure):
- _fields_ = [ ('init', c_int), ('ystart', c_double), ('ystop', c_double), ('scanlist', c_void_p), ('nv', c_int), ('xv', c_void_p), ('r1sq', c_double), ('r2sq', c_double), ('angl', c_double), ('sinangl', c_double), ('cosangl', c_double), ('cossq', c_double), ('sinsq', c_double), ('xradsq', c_double), ('yradsq', c_double), ('a', c_double), ('npt', c_int), ('pts', c_void_p), ('xonly', c_int), ('x1', c_double), ('x2', c_double), ('y1', c_double), ('invslope', c_double)]
-
-class gfiltrec(Structure):
- _fields_ = [('nshapes', c_int), ('maxshapes', c_int), ('shapes', POINTER(shaperec * maxshapes)), ('rid', c_int), ('usebinsiz', c_int), ('evsect', c_char_p), ('tlminx', c_double), ('tlminy', c_double), ('binsizx', c_double), ('binsizy', c_double), ('tloff', c_double), ('xmin', c_int), ('xmax', c_int), ('ymin', c_int), ('ymax', c_int), ('block', c_int), ('x0', c_int), ('x1', c_int), ('y0', c_int), ('y1', c_int), ('ybuf', POINTER(c_int)), ('x0s', POINTER(c_int)), ('x1s', POINTER(c_int)), ('nmask', c_int), ('maskdim', c_int), ('masks', POINTER(filtmask))]
-
diff --git a/funtools/filter/filtprog.c b/funtools/filter/filtprog.c
deleted file mode 100644
index 81720f8..0000000
--- a/funtools/filter/filtprog.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * filtprog.c -- hi level support for filters using different techniques
- *
- */
-
-#include <filter.h>
-
-/*
- *
- * FilterProgStart -- start the filtering process
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgStart (Filter filter)
-#else
-int FilterProgStart(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* call the technique-specific routine */
- if( filter->filt_start )
- return((filter->filt_start)(filter));
- else{
- return(0);
- }
-}
-
-/*
- *
- * FilterProgOpen -- return filter program as a file for writing
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgOpen (Filter filter)
-#else
-int FilterProgOpen(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* check the mode for known techniques and load drivers */
- switch( filter->method ){
- case METHOD_C:
- FilterProgLoad_C(filter);
- break;
- default:
- gerror(stderr, "unknown filter technique: %d\n", filter->method);
- return(0);
- }
-
- /* call the technique-specific routine */
- if( filter->filt_open ){
- return((filter->filt_open)(filter));
- }
- else{
- return(1);
- }
-}
-
-/*
- *
- * FilterProgPrepend -- prepend to the filter
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgPrepend (Filter filter)
-#else
-int FilterProgPrepend(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* call the technique-specific routine */
- if( filter->filt_prepend )
- return((filter->filt_prepend)(filter));
- else
- return(1);
-}
-
-/*
- *
- * FilterProgWrite -- write the symbols
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgWrite (Filter filter)
-#else
-int FilterProgWrite(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* call the technique-specific routine */
- if( filter->filt_write )
- return((filter->filt_write)(filter));
- else
- return(1);
-}
-
-/*
- *
- * FilterProgAppend -- append the filter program body
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgAppend (Filter filter)
-#else
-int FilterProgAppend(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* call the technique-specific routine */
- if( filter->filt_append )
- return((filter->filt_append)(filter));
- else
- return(1);
-}
-
-/*
- *
- * FilterProgClose -- close the filter program file
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgClose (Filter filter)
-#else
-int FilterProgClose(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* debugging only */
- if( filter->debug >= 2 )
- return(1);
-
- /* call the technique-specific routine */
- if( filter->filt_close )
- return((filter->filt_close)(filter));
- else
- return(1);
-}
-
-/*
- *
- * FilterProgCompile -- compile the filter program
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgCompile (Filter filter)
-#else
-int FilterProgCompile(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* debugging only */
- if( filter->debug >= 2 )
- return(1);
-
- /* call the technique-specific routine */
- if( filter->filt_compile )
- return((filter->filt_compile)(filter));
- else
- return(1);
-}
-
-/*
- *
- * FilterProgEnd -- end the filtering process
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgEnd (Filter filter)
-#else
-int FilterProgEnd(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* call the technique-specific routine */
- if( filter->filt_end )
- return((filter->filt_end)(filter));
- else{
- return(0);
- }
-}
-
-/*
- *
- * FilterLexName -- return the "in-expression" name
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterLexName (Filter filter, char *name)
-#else
-char *FilterLexName(filter, name)
- Filter filter;
- char *name;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(name);
-
- /* call the technique-specific routine */
- if( filter->filt_name )
- return((filter->filt_name)(filter, name));
- else
- return(name);
-}
-
-/*
- *
- * FilterLexRoutine1 -- return the beginning of the routine string
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterLexRoutine1 (Filter filter, char *name)
-#else
-char *FilterLexRoutine1(filter, name)
- Filter filter;
- char *name;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(NULL);
-
- /* call the technique-specific routine */
- if( filter->filt_routine1 )
- return((filter->filt_routine1)(filter, name));
- else
- return(name);
-}
-
-/*
- *
- * FilterLexRoutine2 -- return the beginning of the routine string
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterLexRoutine2 (Filter filter, char *name)
-#else
-char *FilterLexRoutine2(filter, name)
- Filter filter;
- char *name;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(NULL);
-
- /* call the technique-specific routine */
- if( filter->filt_routine2 )
- return((filter->filt_routine2)(filter, name));
- else
- return(name);
-}
-
-/*
- *
- * FilterLexRegion1 -- return the beginning of the region string
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterLexRegion1 (Filter filter, char *name)
-#else
-char *FilterLexRegion1(filter, name)
- Filter filter;
- char *name;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(NULL);
-
- /* call the technique-specific region */
- if( filter->filt_region1 )
- return((filter->filt_region1)(filter, name));
- else
- return(name);
-}
-
-/*
- *
- * FilterLexRegion2 -- return the end of the region string
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterLexRegion2 (Filter filter, char *name)
-#else
-char *FilterLexRegion2(filter, name)
- Filter filter;
- char *name;
-#endif
-{
- /* make sure we have something to play with */
- if( filter == NULL)
- return(NULL);
-
- /* call the technique-specific region */
- if( filter->filt_region2 )
- return((filter->filt_region2)(filter, name));
- else
- return(name);
-}
-
diff --git a/funtools/filter/filtprog_c.c b/funtools/filter/filtprog_c.c
deleted file mode 100644
index dbebd60..0000000
--- a/funtools/filter/filtprog_c.c
+++ /dev/null
@@ -1,1033 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * filtprog_c.c -- support for filters using the C compiler
- *
- */
-
-#include <filter.h>
-#include <swap.h>
-#include <regions_h.h>
-#include <events_c.h>
-#include <image_c.h>
-#include <evregions_c.h>
-#include <imregions_c.h>
-#include <xalloc_c.h>
-#include <swap_c.h>
-
-/*
- *
- * Private Routines
- *
- */
-
-#ifdef ANSI_FUNC
-static char *
-GetType(int t)
-#else
-static char *GetType(t)
- int t;
-#endif
-{
- switch(t){
- case 'A':
- return("char");
- case 'B':
- return("unsigned char");
- case 'I':
- return("short");
- case 'U':
- return("unsigned short");
- case 'J':
- return("int");
- case 'V':
- return("unsigned int");
- case 'K':
- return("long long");
- case 'E':
- return("float");
- case 'D':
- return("double");
- case 'X':
- return("char");
- case 'L':
- return("char");
- default:
- return("char");
- }
-}
-
-#ifdef ANSI_FUNC
-static double
-GetTloff(int t)
-#else
-static double GetTloff(t)
- int t;
-#endif
-{
- switch(t){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'V':
- case 'K':
- case 'X':
- return 1.0;
- case 'E':
- case 'D':
- return 0.5;
- default:
- return 1.0;
- }
-}
-
-#ifdef ANSI_FUNC
-static char *
-_FilterInitString(char *filtstr)
-#else
-static char *_FilterInitString(filtstr)
- char *filtstr;
-#endif
-{
- char *ibuf, *iptr, *fptr;
- char *s, *t;
- int paren=0;
-
- ibuf = xcalloc(strlen(filtstr)*10, sizeof(char));
- /* make sure we have at least one shape */
- if( !FilterShapeCount() )
- return ibuf;
- iptr = ibuf;
- fptr = filtstr;
- while( *fptr ){
- /* look for beginning of region routine */
- if( !(s=strstr(fptr, "im")) && !(s=strstr(fptr, "ev")) )
- break;
- t = s+2;
- if( !*t )
- break;
- /* which is followed by a region and open paren */
- if( strncmp(t, "annulus(", 8) &&
- strncmp(t, "box(", 4) &&
- strncmp(t, "circle(", 7) &&
- strncmp(t, "ellipse(", 8) &&
- strncmp(t, "line(", 5) &&
- strncmp(t, "panda(", 6) &&
- strncmp(t, "bpanda(", 7) &&
- strncmp(t, "cpanda(", 7) &&
- strncmp(t, "epanda(", 7) &&
- strncmp(t, "pie(", 4) &&
- strncmp(t, "qtpie(", 6) &&
- strncmp(t, "point(", 6) &&
- strncmp(t, "nannulus(", 9) &&
- strncmp(t, "nbox(", 5) &&
- strncmp(t, "ncircle(", 8) &&
- strncmp(t, "nellipse(", 9) &&
- strncmp(t, "npie(", 5) &&
- strncmp(t, "vannulus(", 9) &&
- strncmp(t, "vbox(", 5) &&
- strncmp(t, "vcircle(", 8) &&
- strncmp(t, "vellipse(", 9) &&
- strncmp(t, "vpie(", 5) &&
- strncmp(t, "vpoint(", 7) &&
- strncmp(t, "polygon(", 8) &&
- strncmp(t, "field(", 6) &&
- strncmp(t, "imagemask(", 10) ){
- fptr = t;
- continue;
- }
- /* copy region name up to open paren */
- for(fptr=s; *fptr && *fptr!='('; fptr++){
- *iptr++ = *fptr;
- }
- /* append init suffix */
- *iptr++ = 'i';
- /* copy the paren */
- if( *fptr == '(' ){
- *iptr++ = *fptr++;
- paren++;
- }
- /* copy til end of region, i.e., when paren goes to 0 */
- while( *fptr && paren ){
- if( *fptr == '(' )
- paren++;
- if( *fptr == ')' )
- paren--;
- *iptr++ = *fptr++;
- }
- /* copy ';' */
- *iptr++ = ';';
- }
- return(ibuf);
-}
-
-/*
- *
- * FilterProgOpen_C -- return filter program as a file for writing
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgOpen_C (Filter filter)
-#else
-static int FilterProgOpen_C(filter)
- Filter filter;
-#endif
-{
- int fd;
- char *ccstr=NULL;
- char prefix[SZ_LINE];
- char tbuf[SZ_LINE];
- char *tmpdir=NULL;
-#if HAVE_CYGWIN
- char *s;
-#endif
-
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- /* see if the user specified a compiler explicitly */
- if( !(ccstr = getenv("FILTER_CC")) &&
- !(ccstr = getenv("CC")) &&
- !(ccstr = FILTER_CC) ){
- ccstr = "gcc";
- }
- /* make sure we have a compiler */
- if( !(filter->cc = Access(ccstr, "x")) &&
- !(filter->cc = Find(ccstr, "x", NULL, FilterPath())) &&
- !(filter->cc = Find("gcc", "x", NULL, FilterPath())) &&
- !(filter->cc = Find("cc", "x", NULL, FilterPath())) &&
- !(filter->cc = Find("cc", "x", NULL, ".")) &&
- !(filter->cc = Find("cc", "x", NULL, CC_PATH)) ){
- gerror(stderr, "no compiler found for filter compilation\n");
- return(0);
- }
-
- /* determine whether communication is via Unix pipes or Win32 pipes */
- filter->pipeos = PIPE_UNIX;
-#if HAVE_MINGW32
- filter->pipeos = PIPE_WIN32;
-#endif
-#if HAVE_CYGWIN
- if( (s=strrchr(filter->cc, '/')) ){
- s++;
- }
- else if( (s=strrchr(filter->cc, '\\')) ){
- s++;
- } else {
- s = filter->cc;
- }
- if( !strcasecmp(s, "tcc") || !strcasecmp(s, "tcc.exe") ||
- !strcasecmp(s, "pcc") || !strcasecmp(s, "pcc.exe") ){
- filter->pipeos = PIPE_WIN32;
- }
-#endif
-
- /* final check on ptype: if we wanted dynamic but had no gcc, use process */
- if( (filter->ptype == PTYPE_DYNAMIC) && !strstr(filter->cc, "gcc") )
- filter->ptype = PTYPE_PROCESS;
- /* get default file names */
- snprintf(tbuf, SZ_LINE, "$FILTER_OBJDIR:$FILTER_LIBDIR:%s:$HOME/.funtools:$SAORD_ROOT/lib:/usr/lib:/usr/local/lib:/opt/local/lib", OBJPATH);
- switch( filter->type ){
- case TYPE_EVENTS:
- /* normally, we filter events analytically */
- if( !filter->evsect )
- /* filter->objs = Find("evregions.o", "r", NULL, tbuf); */
- filter->objs = Find("libfuntools.a", "r", NULL, tbuf);
- /* if evsect=xxx is specified, we filter by image pixels */
- else
- /* filter->objs = Find("imregions.o", "r", NULL, tbuf); */
- filter->objs = Find("libfuntools.a", "r", NULL, tbuf);
- break;
- case TYPE_IMAGE:
- /* image are filtered by image pixels */
- /* filter->objs = Find("imregions.o", "r", NULL, tbuf); */
- filter->objs = Find("libfuntools.a", "r", NULL, tbuf);
- break;
- }
- /* if we wanted to a process, but have no objects, use self-contained */
- if( (filter->ptype == PTYPE_PROCESS) && !filter->objs )
- filter->ptype = PTYPE_CONTAINED;
- /* allow extra stuff on the command line */
- if( !(filter->cflags = xstrdup(getenv("FILTER_CFLAGS"))) &&
- !(filter->cflags = xstrdup(FILTER_CFLAGS)) )
- filter->cflags = xstrdup(" ");
- if( !(filter->extra = xstrdup(getenv("FILTER_EXTRA"))) )
- filter->extra = xstrdup(" ");
- /* set shared switches for gcc */
- if( strstr(filter->cc, "gcc") )
- filter->shflags = xstrdup(GCC_SHARED_FLAGS);
-
- /* get prefix for filter source and program */
- if( !(tmpdir = (char *)getenv("FILTER_TMPDIR")) &&
- !(tmpdir = (char *)getenv("TMPDIR")) &&
- !(tmpdir = (char *)getenv("TMP")) )
- tmpdir = DEFAULT_FILTER_TMPDIR;
- if( !*tmpdir )
- tmpdir = ".";
-#if HAVE_MINGW32
- snprintf(prefix, SZ_LINE, "%s\\f", tmpdir);
-#else
- snprintf(prefix, SZ_LINE, "%s/f", tmpdir);
-#endif
-
- /* make up the routine name when we dynamically load */
- snprintf(tbuf, SZ_LINE, "Filter%d%d", (int)getpid(), FilterNum());
- filter->pname = xstrdup(tbuf);
-
- /* make up name of C source file we will generate */
- if( filter->debug >= 2 ){
- filter->fp = stdout;
- return(1);
- }
- else{
- if( (fd=mkrtemp(prefix, ".c", tbuf, SZ_LINE, 1)) < 0 ){
- gerror(stderr, "could not generate C filter source name: %s\n",
- prefix);
- return(0);
- }
- filter->code = xstrdup(tbuf);
- if( !(filter->fp = fdopen(fd, "w+b")) ){
- gerror(stderr, "could not open C filter source file: %s\n",
- tbuf);
- return(0);
- }
- }
-
- /* make up the name of the program we will compile into.
- we make this different from the .c file name to make interception
- by an intruder harder */
- if( mkrtemp(prefix, NULL, tbuf, SZ_LINE, 0) < 0 ){
- gerror(stderr, "could not generate C filter program name: %s\n",
- prefix);
- return(0);
- }
-#if HAVE_MINGW32
- strcat(tbuf, ".exe");
-#endif
- filter->prog = xstrdup(tbuf);
- return(1);
-}
-
-/*
- *
- * FilterProgPrepend_C -- prepend the filter code
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgPrepend_C (Filter filter)
-#else
-static int FilterProgPrepend_C(filter)
- Filter filter;
-#endif
-{
- char *s=NULL;
- char *contents=NULL;
- FILE *fd;
-
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- /* make sure we are not in debug mode */
- if( filter->debug >= 2 )
- return(1);
-
- /* init temps */
- fd = filter->fp;
-
- /* initialize with process type */
- switch(filter->ptype){
- case PTYPE_CONTAINED:
- fprintf(fd, "#define FILTER_PTYPE c\n");
- break;
- case PTYPE_DYNAMIC:
- fprintf(fd, "#define FILTER_PTYPE d\n");
- break;
- case PTYPE_PROCESS:
- fprintf(fd, "#define FILTER_PTYPE p\n");
- break;
- }
-
- /* we want the byte order up at the top */
- if( is_bigendian() ){
- fprintf(fd, "#define MYBYTE_ORDER 4321\n");
- }
- else{
- fprintf(fd, "#define MYBYTE_ORDER 1234\n");
- }
-
- /* for some compilers (e.g. pcc), we need to minimize use of #include */
- if( (s=strrchr(filter->cc, '/')) ){
- s++;
- } else {
- s = filter->cc;
- }
- if( !strcasecmp(s, "pcc") || !strcasecmp(s, "pcc.exe") ){
- fprintf(fd, "#define MINIMIZE_INCLUDES 1\n");
- }
-
- /* do we need windows pipes? */
- if( filter->pipeos == PIPE_WIN32 ){
- fprintf(fd, "#define USE_WIN32 1\n");
- fprintf(fd, "#include <windows.h>\n");
- }
-
-
- /* prepend the filter header */
- contents = REGIONS_H;
- if( (contents != NULL) && (*contents != '\0') ){
- fprintf(fd, "%s\n", contents);
- }
-
- /* these are implemented as aliases */
- fprintf(fd, "#define evvcircle evvannulus\n");
- fprintf(fd, "#define evncircle evnannulus\n");
- fprintf(fd, "#define imvcirclei imvannulusi\n");
- fprintf(fd, "#define imncirclei imnannulusi\n");
- fprintf(fd, "#define imvcircle imvannulus\n");
- fprintf(fd, "#define imncircle imnannulus\n");
- fprintf(fd, "#define evcpanda evpanda\n");
- fprintf(fd, "#define imcpandai impandai\n");
- fprintf(fd, "#define imcpanda impanda\n");
- fprintf(fd, "\n");
-
- /* add some math support */
- if( is_bigendian() ){
- fprintf(fd, "static unsigned char _nan[8]={0x7F,0xF0,1,1,1,1,1,1};\n");
- }
- else{
- fprintf(fd, "static unsigned char _nan[8]={1,1,1,1,1,1,0xF0,0x7F};\n");
- }
- fprintf(fd, "#define NaN *((double *)_nan)\n");
- fprintf(fd, "#define div(a,b) (feq(b,0)?(NaN):(a/b))\n");
- fprintf(fd, "\n");
- return(1);
-}
-
-/*
- *
- * FilterProgWrite_C -- write the symbols for filtering
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgWrite_C(Filter filter)
-#else
-static int FilterProgWrite_C(filter)
- Filter filter;
-#endif
-{
- int i;
- int offset;
- int pad;
- int dsize;
- int evsize;
- int tltyps[2];
- double tlmins[2];
- double binsizs[2];
- char vbuf[1024];
- char *s, *t;
- char *v;
- char *ibuf;
- char *filtstr;
- char *contents=NULL;
- char tbuf[SZ_LINE];
- FILE *fd;
- FilterSymbols sp;
- FITSHead fhd;
-
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- /* make sure we are init'ed */
- if( filter->fhd == NULL ){
- gerror(stderr, "symbol table not initialized\n");
- return(0);
- }
-
- /* make sure we are init'ed */
- if( filter->fp == NULL ){
- gerror(stderr, "no output file for parser\n");
- return(0);
- }
-
- /* get the filter string */
- if( !(filtstr = (char *)_FilterString()) || !strcmp(filtstr, "()") ){
- return(0);
- }
-
- /* init temps */
- fhd = filter->fhd;
- fd= filter->fp;
- offset = 0;
- evsize = 0;
-
- /* ptype-specific processing */
- switch(filter->ptype){
- case PTYPE_CONTAINED:
- /* Write code to output file -- must be done BEFORE we write the
- region symbols, to avoid unintentional redefinitions */
- if( filter->debug < 2 ){
- /* we need the xalloc routines */
- contents = XALLOC_C;
- if( (contents != NULL) && (*contents != '\0') ){
- fprintf(fd, "%s\n", contents);
- }
- /* region routines if not linking against previously compiled code */
- switch( filter->type ){
- case TYPE_EVENTS:
- /* normally, we filter events analytically using evregions.o */
- if( !filter->evsect )
- contents = EVREGIONS_C;
- /* if evsect=xxx is specified, we filter by image pixels */
- else
- contents = IMREGIONS_C;
- break;
- case TYPE_IMAGE:
- /* image are filtered by image pixels */
- contents = IMREGIONS_C;
- break;
- default:
- break;
- }
- if( (contents != NULL) && (*contents != '\0') ){
- /* use fprintf so that we handle \n correctly in TEMPLATE */
- fprintf(fd, "%s\n", contents);
- }
- else{
- gerror(stderr, "could not write filter subroutines\n");
- return(0);
- }
- }
- break;
- }
-
- /* always need the swap routines (they're part of the filter) */
- contents = SWAP_C;
- if( (contents != NULL) && (*contents != '\0') ){
- fprintf(fd, "%s\n", contents);
- }
-
- /* output counts of shapes */
- fprintf(fd, "#define NSHAPE %d\n",
- FilterShapeCount());
- fprintf(fd, "#define NREGION %d\n",
- FilterRegionCount(TOK_IREG|TOK_EREG|TOK_NREG));
- /* output the filter itself */
- fprintf(fd, "#define FILTER %s\n", filtstr);
- if( filter->debug < 2 ){
- /* string version of the filter -- used to check for FIELD optimization */
- fprintf(fd, "#define FILTSTR \"%s\"\n", filtstr);
- /* output the initialization string */
- ibuf = _FilterInitString(filtstr);
- fprintf(fd, "#define FINIT %s\n", (ibuf && *ibuf)?ibuf:"");
- if( ibuf ) xfree(ibuf);
- }
-
- /* for type image, we generate an initialization string */
- switch(filter->type){
- case TYPE_IMAGE:
- fprintf(fd, "#define IMFILTRTN %s\n", filter->pname);
- break;
- case TYPE_EVENTS:
- fprintf(fd, "#define EVFILTRTN %s\n", filter->pname);
- /* output the event section and tlmin values, if necessary */
- if( filter->evsect && FilterTlInfo(tlmins,binsizs,tltyps) ){
- if( *filter->evsect == '"' )
- fprintf(fd, "#define EVSECT %s\n", filter->evsect);
- else
- fprintf(fd, "#define EVSECT \"%s\"\n", filter->evsect);
- fprintf(fd, "#define TLMINX %f\n", tlmins[0]);
- fprintf(fd, "#define TLMINY %f\n", tlmins[1]);
- for(i=0; i<2; i++)
- if( binsizs[i] <= 0.0 ) binsizs[i] = 1.0;
- if( (binsizs[0] == 1.0) && (binsizs[1] == 1.0) )
- fprintf(fd, "#define USEBINSIZ 0\n");
- else
- fprintf(fd, "#define USEBINSIZ 1\n");
- fprintf(fd, "#define BINSIZX %f\n", binsizs[0]);
- fprintf(fd, "#define BINSIZY %f\n", binsizs[1]);
- fprintf(fd, "#define TLOFF %f\n", GetTloff(tltyps[0]));
- fprintf(fd, "#define TLOFF %f\n", GetTloff(tltyps[1]));
- }
- /* loop through the symbol table and process #defines */
- for(i=0; i<filter->nsyms; i++){
- sp = &(filter->symtab[i]);
- /* skip accidentally empty ones */
- if( (sp->name == NULL) || (*sp->name == '\0') )
- continue;
- /* process this type of symbol */
- switch(sp->type){
- case SYM_COL:
- /* make sure we are aligned */
- if( fhd->table->col[sp->idx].type == 'X' ){
- switch(fhd->table->col[sp->idx].n){
- case 8:
- dsize = 1;
- break;
- case 16:
- dsize = 2;
- break;
- case 32:
- dsize = 4;
- break;
- default:
- dsize = ft_sizeof(filter->fhd->table->col[sp->idx].type);
- }
- }
- else{
- dsize = ft_sizeof(filter->fhd->table->col[sp->idx].type);
- }
- pad = dsize - (offset % dsize);
- if( pad == dsize ) pad = 0;
- offset += pad;
- evsize += pad;
- sp->offset = offset;
- if( fhd->table->col[sp->idx].scaled ){
- snprintf(tbuf, SZ_LINE, "(%f+%f*(",
- fhd->table->col[sp->idx].zero,
- fhd->table->col[sp->idx].scale);
- s = tbuf;
- t = "))";
- }
- else{
- s = "";
- t = "";
- }
- if( fhd->table->col[sp->idx].n == 1 ){
- fprintf(fd, "#define %s %s*((%s *)(SW%d(eptr+%d,%d,_swf,%d)))%s\n",
- sp->name,
- s,
- GetType((int)fhd->table->col[sp->idx].type),
- dsize,
- offset,
- dsize,
- offset,
- t);
- }
- else{
- if( fhd->table->col[sp->idx].type == 'X' ){
- switch(fhd->table->col[sp->idx].n){
- case 8:
- fprintf(fd, "#define %s %s*((%s *)(eptr+%d))%s\n",
- sp->name, s, "unsigned char", offset, t);
- break;
- case 16:
- fprintf(fd, "#define %s %s*((%s *)(SW2(eptr+%d,%d,_swf,%d)))%s\n",
- sp->name, s, "unsigned short", offset, 2, offset, t);
- break;
- case 32:
- fprintf(fd, "#define %s %s*((%s *)(SW4(eptr+%d,%d,_swf,%d)))%s\n",
- sp->name, s, "unsigned int", offset, 4, offset, t);
- break;
- default:
- fprintf(fd, "#define %s %s((%s *)(SW%d(eptr+%d,%d,_swf,%d)))%s\n",
- sp->name,
- s,
- GetType((int)fhd->table->col[sp->idx].type),
- dsize,
- offset,
- dsize,
- offset,
- t);
- }
- }
- else if( fhd->table->col[sp->idx].type == 'A' ){
- fprintf(fd, "#define %s acopy(eptr+%d,%d)\n",
- sp->name,
- offset,
- fhd->table->col[sp->idx].n);
- }
- else{
- fprintf(fd, "#define %s %s((%s *)(SW%d(eptr+%d,%d,_swf,%d)))%s\n",
- sp->name,
- s,
- GetType((int)fhd->table->col[sp->idx].type),
- dsize,
- offset,
- dsize,
- offset,
- t);
- }
- }
- /* lower and upper case are both acceptable */
- strcpy(vbuf, sp->name);
- cluc(vbuf);
- if( strcmp(vbuf, sp->name) ){
- fprintf(fd, "#define %s %s\n", vbuf, sp->name);
- }
- culc(vbuf);
- if( strcmp(vbuf, sp->name) ){
- fprintf(fd, "#define %s %s\n", vbuf, sp->name);
- }
- /* bump pointers */
- if( fhd->table->col[sp->idx].type == 'X' ){
- offset +=
- ((fhd->table->col[sp->idx].size*fhd->table->col[sp->idx].n)+7)/8;
- evsize +=
- ((fhd->table->col[sp->idx].size*fhd->table->col[sp->idx].n)+7)/8;
- }
- else{
- offset += fhd->table->col[sp->idx].size*fhd->table->col[sp->idx].n;
- evsize += fhd->table->col[sp->idx].size*fhd->table->col[sp->idx].n;
- }
- break;
- case SYM_PAR:
- /* we have to distinguish between numbers and strings here */
- /* strip off enclosing white space */
- (void)nowhite(sp->value, vbuf);
- /* check for all white space */
- if( *vbuf == '\0' ){
- fprintf(fd, "#define %s \"\"\n", sp->name);
- }
- else{
- /* see if its a pure number */
- (void)strtod(vbuf, &v);
- if( (v == NULL) || (*v == '\0') )
- fprintf(fd, "#define %s %s\n", sp->name, vbuf);
- else
- fprintf(fd, "#define %s \"%s\"\n", sp->name, vbuf);
- }
- break;
- }
- }
- /* make sure each record is aligned */
- pad = 8 - (evsize % 8);
- if( pad == 8 ) pad = 0;
- evsize += pad;
- /* make sure we have at least one byte to send to co-process */
- if( evsize <=0 ) evsize = 1;
- /* output the size of the filter record */
- fprintf(fd, "#define EVSIZE %d\n", evsize);
- fprintf(fd, "static char _swf[%d];\n", evsize);
- /* save for later use */
- filter->evsize = evsize;
- break;
- default:
- break;
- }
-
- /* write out the mask structure */
- if( filter->nmask && filter->masks &&
- (filter->type == TYPE_EVENTS) && filter->evsect ){
- fprintf(fd, "#define NMASK %d\n", filter->nmask);
- fprintf(fd, "#define MASKDIM %d;\n", ft_naxis(filter->maskhd, 1));
- fprintf(fd, "static FilterMaskRec _masks[]={\n");
- /* copy all masks and translate x,y positions as needed */
- for(i=0; i<filter->nmask; i++){
- fprintf(fd, "{%d,%d,%d,%d}",
- filter->masks[i].region,
- filter->masks[i].y,
- filter->masks[i].xstart,
- filter->masks[i].xstop);
- if( i != (filter->nmask -1) )
- fprintf(fd, ",");
- fprintf(fd, "\n");
- }
- fprintf(fd, "};\n");
- }
- else{
- fprintf(fd, "#define NMASK 0\n");
- fprintf(fd, "#define MASKDIM 0;\n");
- fprintf(fd, "static FilterMask _masks=NULL;\n");
- }
-
- /* write it now */
- fflush(fd);
- return(1);
-}
-
-/*
- *
- * FilterProgAppend_C -- append the filter program body
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgAppend_C (Filter filter)
-#else
-static int FilterProgAppend_C(filter)
- Filter filter;
-#endif
-{
- char *contents=NULL;
-
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- /* make sure we are not in debug mode */
- if( filter->debug >= 2 )
- return(1);
-
- /* get body of filter program */
- switch( filter->type ){
- case TYPE_EVENTS:
- contents = EVENTS_C;
- break;
- case TYPE_IMAGE:
- contents = IMAGE_C;
- break;
- }
- if( (contents != NULL) && (*contents != '\0') ){
- /* use fprintf so that we handle \n correctly in TEMPLATE */
- fprintf(filter->fp, "%s\n", contents);
- return(1);
- }
- else{
- gerror(stderr, "could not write body of filter program\n");
- return(0);
- }
-}
-
-/*
- *
- * FilterProgClose_C -- close the filter program file
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgClose_C (Filter filter)
-#else
-static int FilterProgClose_C(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- /* close file if we are not in debug mode */
- if( (filter->debug < 2) && filter->fp ){
- fclose(filter->fp);
- filter->fp = NULL;
- }
- return(1);
-}
-
-/*
- *
- * FilterProgCompile_C -- compile the filter program
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgCompile_C (Filter filter)
-#else
-static int FilterProgCompile_C(filter)
- Filter filter;
-#endif
-{
- char *s;
- char *math;
- char tbuf[SZ_LINE];
- char pmode[SZ_LINE];
- char log[SZ_LINE];
- char *devnull;
-#ifdef USE_LAUNCH
- char *stdfiles[3];
-#else
- char tbuf2[SZ_LINE];
-#endif
- int len;
- int got;
- int keep=0;
-
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- /* make sure we are not in debug mode */
- if( !filter->cc || (filter->debug >= 2) )
- return(1);
-
- /* flag whether to keep compiler files around */
- if( !(s=getenv("FILTER_KEEP")) || !istrue(s) )
- keep = 0;
- else
- keep = 1;
-
- /* add math library, if necessary */
- switch(filter->pipeos){
- case PIPE_WIN32:
- math = "";
- break;
- default:
- math = "-lm";
- break;
- }
-
- /* set up /dev/null */
-#if HAVE_MINGW32
- devnull = "nul";
-#else
- devnull = "/dev/null";
-#endif
-
- /* get log file name */
- snprintf(log, SZ_LINE, "%s.log", filter->prog);
-
- /* delete old version */
- unlink(filter->prog);
-
- switch(filter->ptype){
- case PTYPE_PROCESS:
- /* make up the compile command */
- snprintf(tbuf, SZ_LINE, "%s %s -o %s %s %s %s %s",
- filter->cc, filter->cflags, filter->prog, filter->code,
- filter->objs ? filter->objs : " ",
- filter->extra, math);
-#ifndef USE_LAUNCH
- snprintf(tbuf2, SZ_LINE, " 1>%s 2>%s", devnull, log);
- strcat(tbuf, tbuf2);
-#endif
- strcpy(pmode, "x");
- break;
- case PTYPE_CONTAINED:
- /* make up the compile command */
- snprintf(tbuf, SZ_LINE, "%s %s -o %s %s %s %s",
- filter->cc, filter->cflags, filter->prog, filter->code,
- filter->extra, math);
-#ifndef USE_LAUNCH
- snprintf(tbuf2, SZ_LINE, " 1>%s 2>%s", devnull, log);
- strcat(tbuf, tbuf2);
-#endif
- strcpy(pmode, "x");
- break;
-#ifdef USE_DL
- case PTYPE_DYNAMIC:
- snprintf(tbuf, SZ_LINE, "%s %s %s %s -o %s %s %s",
- filter->cc, filter->cflags, filter->shflags,
- filter->objs ? filter->objs : " ",
- filter->prog, filter->code, filter->extra);
-#ifndef USE_LAUNCH
- snprintf(tbuf2, SZ_LINE, " 1>%s 2>%s", devnull, log);
- strcat(tbuf, tbuf2);
-#endif
- strcpy(pmode, "r");
- break;
-#endif
- default:
- return(0);
- }
-
- /* issue the shell command to compile the program */
-#ifdef USE_LAUNCH
- stdfiles[0] = NULL;
- stdfiles[1] = devnull;
- stdfiles[2] = log;
- got = Launch(tbuf, 1, stdfiles, NULL);
-#else
- got = system(tbuf);
-#endif
-
- /* delete the filter program body in any case */
- if( !keep )
- unlink(filter->code);
-
- /* Sun cc can leave an extraneous .o around, which we don't want */
- strcpy(tbuf, filter->code);
- /* change .c to .o */
- tbuf[strlen(tbuf)-1] = 'o';
- unlink(tbuf);
- /* ... actually its usually left in the current directory */
- if( (s = strrchr(tbuf, '/')) )
- unlink(s+1);
-
- /* now we can see if we succeeded in issuing the command */
- if( got < 0 ){
- gerror(stderr, "could not run filter compilation\n");
- return(0);
- }
-
- /* if we have an executable program, we succeeded */
- if( (s=Find(filter->prog, pmode, NULL, NULL)) != NULL ){
- unlink(log);
- if( s ) xfree(s);
- }
- else{
- s = FileContents(log, 0, &len);
- if( s && *s && len ){
- fprintf(stderr, "Compilation error message:\n%s\n", s);
- }
- if( !keep ){
- unlink(log);
- }
- if( s ) xfree(s);
- gerror(stderr, "filter compilation failed\n");
- return(0);
- }
-
- /* good news */
- return(1);
-}
-
-
-/*
- *
- * FilterProgEnd_C -- end the filtering process
- *
- */
-#ifdef ANSI_FUNC
-static int
-FilterProgEnd_C (Filter filter)
-#else
-int FilterProgEnd_C(filter)
- Filter filter;
-#endif
-{
- char *s;
- int status=0;
-
- /* make sure we have something to play with */
- if( filter == NULL)
- return(0);
-
- /* delete the filter program */
- unlink(filter->prog);
- /* delete the filter program body, if necessary */
- if( !(s=getenv("FILTER_KEEP")) || !istrue(s) )
- unlink(filter->code);
- return(status);
-}
-
-/*
- *
- * Public Routines
- *
- */
-
-/*
- *
- * FilterProgLoad_C -- load the routines needed to support C filtering
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterProgLoad_C (Filter filter)
-#else
-int FilterProgLoad_C(filter)
- Filter filter;
-#endif
-{
- /* make sure we have something to work with */
- if( !filter )
- return(0);
-
- filter->filt_open = FilterProgOpen_C;
- filter->filt_prepend = FilterProgPrepend_C;
- filter->filt_write = FilterProgWrite_C;
- filter->filt_append = FilterProgAppend_C;
- filter->filt_close = FilterProgClose_C;
- filter->filt_compile = FilterProgCompile_C;
- filter->filt_end = FilterProgEnd_C;
- return(1);
-}
diff --git a/funtools/filter/idx.h b/funtools/filter/idx.h
deleted file mode 100644
index 0eaf982..0000000
--- a/funtools/filter/idx.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * idx.h - include file for indexed filters
- *
- */
-#ifndef __idx_h
-#define __idx_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-#include "prsetup.h"
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include "fitsy.h"
-#include "gio.h"
-#include "xalloc.h"
-#include "strtod.h"
-
-/* binary search edge */
-#define IDX_EDGE_LEFT 1
-#define IDX_EDGE_RIGHT 2
-#define IDX_EDGE_BOTH (IDX_EDGE_LEFT|IDX_EDGE_RIGHT)
-
-/* type of row record */
-#define IDX_ALLROWS 0
-#define IDX_INDEF 1
-#define IDX_ROW_LIST 2
-#define IDX_SORT 3
-#define IDX_OR_SORT 4
-#define IDX_AND_SORT 5
-
-/* methods of accessing data record */
-#define IDX_IO_MMAP 1
-#define IDX_IO_LSEEK 2
-
-#ifdef HAVE_SYS_MMAN_H
-#define IDX_IO_DEFAULT IDX_IO_MMAP
-#else
-#define IDX_IO_DEFAULT IDX_IO_LSEEK
-#endif
-
-/* increment for storing rowlists */
-#define IDX_ROW_INC 32
-
-/* sort program */
-#define IDX_SORTPROG "_funsort"
-
-/* idxinfo which values */
-#define IDX_COLNAME 1
-#define IDX_FILENAME 2
-#define IDX_FILEROOT1 3
-#define IDX_FILEROOT2 4
-#define IDX_PATHNAME 5
-#define IDX_SORTNAME 6
-
-/* rows can be in memory range lists or file-based row numbers */
-typedef struct _idxrowrec{
- struct _idxrowrec *next;
- char *s;
- int type;
- int rtype;
- int dofilt;
- int dosort;
- int rtot;
- int maxrow;
- int nrow;
- int *startrow;
- int *stoprow;
- FILE *ifile;
- int ichan;
- int ochan;
- int pid;
- struct _idxvalrec *v;
- char *fdata;
- int flen;
-} idxrowrec;
-
-/* values can be int, float, col, region, func */
-typedef struct _idxvalrec{
- struct _idxvalrec *next;
- char *s;
- int type;
- int ntype;
- longlong ival;
- double dval;
- char *iname;
- GIO igio;
- FITSHead ifits;
- int itype;
- int ioffset;
- int in;
- int vtype;
- int voffset;
- int vn;
- int nrow;
- char *idata;
- int ilen;
- struct _idxvalrec *rv[2];
- double rlo[2], rhi[2];
-} idxvalrec;
-
-_PRbeg
-
-idxrowrec *idxall _PRx((idxrowrec *row));
-idxrowrec *idxor _PRx((idxrowrec *row1, idxrowrec *row2));
-idxrowrec *idxand _PRx((idxrowrec *row1, idxrowrec *row2));
-idxrowrec *idxnot _PRx((idxrowrec *row));
-
-idxrowrec *idxrowreg _PRx((idxvalrec *val));
-idxrowrec *idxrowfun _PRx((idxvalrec *val));
-idxrowrec *idxroweq _PRx((idxvalrec *val1, idxvalrec *val2));
-idxrowrec *idxrowne _PRx((idxvalrec *val1, idxvalrec *val2));
-idxrowrec *idxrowlt _PRx((idxvalrec *val1, idxvalrec *val2));
-idxrowrec *idxrowle _PRx((idxvalrec *val1, idxvalrec *val2));
-idxrowrec *idxrowgt _PRx((idxvalrec *val1, idxvalrec *val2));
-idxrowrec *idxrowge _PRx((idxvalrec *val1, idxvalrec *val2));
-idxrowrec *idxrownot _PRx((idxvalrec *val));
-
-idxvalrec *idxvaladd _PRx((idxvalrec *val1, idxvalrec *val2));
-
-idxvalrec *idxvalsub _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvalmul _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvaldiv _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvalmod _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvaland _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvalor _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvalxor _PRx((idxvalrec *val1, idxvalrec *val2));
-idxvalrec *idxvalnot _PRx((idxvalrec *val));
-idxvalrec *idxvalcom _PRx((idxvalrec *val));
-idxvalrec *idxvalmin _PRx((idxvalrec *val));
-
-char *idxinfo _PRx((int which));
-int idxdebug _PRx((int debug));
-idxvalrec *idxvalnew _PRx((char *s));
-int idxvalfree _PRx((idxvalrec *v));
-idxrowrec *idxrownew _PRx((void));
-int idxrowfree _PRx((idxrowrec *r));
-int idxinitfilenames _PRx((char *s, int *flag));
-char *idxindexfilename _PRx((char *s, int *size));
-idxvalrec *idxlookupfilename _PRx((char *iname));
-void idxfreefilenames _PRx((void));
-void idxfreeglobals _PRx((void));
-int idxinitparser _PRx((char *s));
-void idxendparser _PRx((void));
-void *idxread _PRx((idxrowrec *row, GIO gio, FITSHead fits,
- void *buf, size_t size, size_t get, size_t *got,
- int *dofilt));
-void idxstring _PRx((char *s));
-int idxerror _PRx((char *mmsg));
-int idxlex _PRx((void));
-int idxparse _PRx((void));
-
-_PRend
-
-#endif /* __idx.h */
diff --git a/funtools/filter/idx.l b/funtools/filter/idx.l
deleted file mode 100644
index a542505..0000000
--- a/funtools/filter/idx.l
+++ /dev/null
@@ -1,559 +0,0 @@
-%option caseless
-%array
-
-%{
-#include <math.h>
-#include <filter.h>
-#include <idx.h>
-#include <idx.tab.h>
-
-extern int idx_debug;
-
-static int _valint(char *s, idxvalrec **v);
-static int _valfloat(char *s, idxvalrec **v);
-static int _valname(char *s, idxvalrec **v);
-static int _valreg(char *s, idxvalrec **v);
-static int _valfunc(char *s, idxvalrec **v);
-%}
-
-SP [ \t]
-DIG [0-9]
-DIG2 [0-9a-fA-F]
-/* note that negative numbers are not defined here, but in the grammar */
-INT1 {DIG}+L?
-INT2 0[xX]{DIG2}+L?
-INT ({INT1}|{INT2})
-FLOAT1 {DIG}+\.?([eE][-+]?{DIG}+)?
-FLOAT2 {DIG}*\.{DIG}+([eE][-+]?{DIG}+)?
-XFLOAT -142857.142857
-FLOAT ({FLOAT1}|{FLOAT2}|{XFLOAT})
-NUM ({INT}|{FLOAT})
-NAME [A-Za-z_][0-9A-Za-z~_]*(\[[^\[]*\])?
-
-/* must match regions in filt.l */
-REGION (ev|im)[vn]?(annulus|box|circle|ellipse|line|panda|pie|qtpie|point|polygon|field|bpanda|cpanda|epanda)
-%%
-
-{INT} {return _valint(yytext, &(idxlval.val));}
-
-{FLOAT} {return _valfloat(yytext, &(idxlval.val));}
-
-
-evfield"(g",{INT},{INT},{INT},{INT},"(double)"{NAME},"(double)"{NAME}")" {
- return _valreg(yytext, &(idxlval.val));
-}
-
-{REGION}"(g",{INT},{INT},{INT},{INT},"(double)"{NAME},"(double)"{NAME}(,[+-]?{FLOAT})*,[+-]?{FLOAT}")" {
- return _valreg(yytext, &(idxlval.val));
-}
-
-{NAME}"("[^()]*("("[^()]*")")*")" {
- /* support functions with one level of nested parens */
- return _valfunc(yytext, &(idxlval.val));
-}
-
-{NAME} {return _valname(yytext, &(idxlval.val));}
-
-"||" {return OR;}
-"&&" {return AND;}
-"==" {return EQ;}
-"!=" {return NE;}
-"<=" {return LE;}
-">=" {return GE;}
-
-{SP} {;}
-
-<<EOF>> {
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yyterminate();
- }
-
-. {return yytext[0];}
-
-%%
-
-#ifdef YY_USE_PROTOS
-static int _valint(char *s, idxvalrec **v)
-#else
-static int _valint(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- char *t;
- *v = idxvalnew(s);
- (*v)->ival = strtoll(s, &t, 0);
- if( *t )
- idxerror("bad integer value");
- (*v)->type = NUM;
- (*v)->ntype = PARSE_INTEGER;
- (*v)->dval = (double)(*v)->ival;
- return NUM;
-}
-
-#ifdef YY_USE_PROTOS
-static int _valfloat(char *s, idxvalrec **v)
-#else
-static int _valfloat(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- char *t;
- *v = idxvalnew(s);
- (*v)->dval = strtod(s, &t);
- if( *t )
- idxerror("bad float value");
- (*v)->type = NUM;
- (*v)->ntype = PARSE_FLOAT;
- return NUM;
-}
-
-#ifdef YY_USE_PROTOS
-static int _valname(char *s, idxvalrec **v)
-#else
-static int _valname(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- int i;
- int got;
- int oflag;
- int isize=0;
- char *iname;
- char *colname;
- char tail[SZ_LINE];
- FilterSymbols sp=NULL;
- idxvalrec *vv;
-
- *v = idxvalnew(s);
- /* lookup the string */
- if( !(sp=FilterSymbolLookup(FilterDefault(), s)) ){
- idxerror("column name not found in data file");
- (*v)->type = INDEF;
- return INDEF;
- }
- colname = idxinfo(IDX_COLNAME);
- /* see what sort of symbol it is */
- switch(sp->type){
- case SYM_COL:
- if( !(iname=idxindexfilename(s, &isize)) ){
- (*v)->type = INDEF;
- return INDEF;
- }
- /* if we already have opened this index, just use the existing handle */
- if( (vv=idxlookupfilename(iname)) ){
- (*v)->igio = vv->igio;
- (*v)->ifits = vv->ifits;
- }
- /* open index for first time and mark iname */
- else{
- oflag = setgerror(0);
- (*v)->igio = ft_fitsheadopen(iname, &((*v)->ifits), tail, SZ_LINE, "r");
- setgerror(oflag);
- if( !((*v)->igio) ){
- idxerror("existing index file can't be opened");
- (*v)->type = INDEF;
- return INDEF;
- }
- else{
- (*v)->iname = xstrdup(iname);
- }
- }
- xfree(iname);
- if( (*v)->ifits ){
- for(got=0, i=0; i<(*v)->ifits->table->tfields; i++){
- if( !strcasecmp(s, (*v)->ifits->table->col[i].name) ){
- (*v)->vtype = (*v)->ifits->table->col[i].type;
- (*v)->voffset = (*v)->ifits->table->col[i].offset;
- (*v)->vn = (*v)->ifits->table->col[i].n;
- got++;
- }
- if( !strcasecmp(colname, (*v)->ifits->table->col[i].name) ){
- (*v)->itype = (*v)->ifits->table->col[i].type;
- (*v)->ioffset = (*v)->ifits->table->col[i].offset;
- (*v)->in = (*v)->ifits->table->col[i].n;
- got++;
- }
- }
- if( got == 2 ){
-#ifdef HAVE_SYS_MMAN_H
- if( !(*v)->igio->gz ){
- if(!((*v)->idata = mmap(NULL, isize, PROT_READ, MAP_PRIVATE,
- fileno((*v)->igio->fp), 0)) ){
- idxerror("index file can't be mmap'ed");
- (*v)->type = INDEF;
- return INDEF;
- }
- (*v)->ilen = isize;
- }
-#endif
- (*v)->nrow = ft_naxis((*v)->ifits,2);
- (*v)->type = COL;
- return COL;
- }
- else{
- idxerror("column name and/or index not found in index file");
- }
- }
- else{
- (*v)->type = INDEF;
- return INDEF;
- }
- case SYM_PAR:
- (*v)->ntype=ParseDataType(sp->value, &(*v)->dval, &(*v)->ival);
- (*v)->type = NUM;
- switch((*v)->ntype){
- case PARSE_INTEGER:
- case PARSE_HEXINT:
- (*v)->dval = (double)(*v)->ival;
- return NUM;
- case PARSE_FLOAT:
- return NUM;
- default:
- idxerror("invalid parameter type in index");
- return 0;
- }
- default:
- idxerror("unknown symbol type in index");
- return 0;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int _valreglims(idxvalrec *v, char *s)
-#else
-static int _valreglims(v, s)
- idxvalrec *v;
- char *s;
-#endif
-{
- int i;
- int ip=0;
- int nd=0, maxd=0;
- double xcen, ycen;
- double dval;
- double *dvals;
- double pts[8];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- double angle;
- double xwidth, yheight;
- double angl; /* l: Cartesian angle in radians */
- double half_width, half_height;/* l: radii (1/2 width and height) */
- double cosangl, sinangl; /* l: sine, cosine of the Cartesian angle */
- double hw_cos, hw_sin; /* l: products of half_width with sin, cos */
- double hh_cos, hh_sin; /* l: products of half_height with sin, cos */
-
- if( !strcmp(v->s, "circle") || !strcmp(v->s, "ncircle") ||
- !strcmp(v->s, "annulus") || !strcmp(v->s, "nannulus") ){
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- dval = -1;
- if( *v->s == 'n' ){
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ) return 0;
- dval = MAX(atof(tbuf),dval);
- }
- else{
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") ){
- dval = MAX(atof(tbuf),dval);
- }
- }
- v->rlo[0] = xcen - dval - 1;
- v->rhi[0] = xcen + dval + 1;
- v->rlo[1] = ycen - dval - 1;
- v->rhi[1] = ycen + dval + 1;
- return 1;
- }
- else if( !strcmp(v->s, "box") || !strcmp(v->s, "nbox") ||
- !strcmp(v->s, "ellipse") || !strcmp(v->s, "nellipse") ){
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- maxd = SZ_LINE;
- if( !(dvals=(double *)malloc(maxd*sizeof(double))) ) return 0;
- if( *v->s == 'n' ){
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ) return 0;
- if( !word(s, tbuf, &ip) || !word(s, tbuf2, &ip) ) return 0;
- dvals[nd++] = atof(tbuf);
- dvals[nd++] = atof(tbuf2);
- if( word(s, tbuf, &ip) && word(s, tbuf, &ip) )
- dvals[nd++] = atof(tbuf);
- }
- else{
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") ){
- dvals[nd++] = atof(tbuf);
- if( nd == maxd ){
- maxd += SZ_LINE;
- if( !(dvals=(double *)realloc(dvals, maxd*sizeof(double))) ) return 0;
- }
- }
- }
-ellcom:
- if( nd == 2 ){
- angle = 0.0;
- xwidth = dvals[0];
- yheight = dvals[1];
- }
- else{
- angle = dvals[nd-1];
- xwidth = dvals[nd-3];
- yheight = dvals[nd-2];
- }
- if( dvals ) xfree(dvals);
-
- /* Why is this done in evfilter.c??? Doesn't seem necessary */
- /* angl = angle + 90.0; */
- angl = angle;
- while (angl >= 360.0) angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin (angl);
- cosangl = cos (angl);
- /* Why is this done in evfilter.c??? Doesn't seem necessary */
- /* since we rotate by 90.0 degrees to get from astro angle to cartesian, */
- /* we also need to switch the width and height. we do this secretly so */
- /* that the display will turn out right, by doing it in the half terms */
- if( !strcmp(v->s, "box") ){
- /*
- half_width = yheight / 2.0;
- half_height = xwidth / 2.0;
- */
- half_width = xwidth / 2.0;
- half_height = yheight / 2.0;
- }
- else{
- /*
- half_width = yheight;
- half_height = xwidth;
- */
- half_width = xwidth;
- half_height = yheight;
- }
- hw_cos = half_width * cosangl;
- hw_sin = half_width * sinangl;
- hh_cos = half_height * cosangl;
- hh_sin = half_height * sinangl;
-
- pts[0] = xcen - hw_cos - hh_sin;
- pts[1] = ycen - hw_sin + hh_cos;
- pts[2] = xcen + hw_cos - hh_sin;
- pts[3] = ycen + hw_sin + hh_cos;
- pts[4] = xcen + hw_cos + hh_sin;
- pts[5] = ycen + hw_sin - hh_cos;
- pts[6] = xcen - hw_cos + hh_sin;
- pts[7] = ycen - hw_sin - hh_cos;
-
- v->rlo[0] = pts[0];
- v->rhi[0] = pts[0];
- v->rlo[1] = pts[1];
- v->rhi[1] = pts[1];
- for(i=2; i<8; i+=2){
- v->rlo[0] = MIN(pts[i],v->rlo[0]);
- v->rhi[0] = MAX(pts[i],v->rhi[0]);
- v->rlo[1] = MIN(pts[i+1],v->rlo[1]);
- v->rhi[1] = MAX(pts[i+1],v->rhi[1]);
- }
- return 1;
- }
- else if( !strcmp(v->s, "line") ){
- for(i=0; i<4; i++){
- if( word(s, tbuf, &ip) ){
- pts[i] = atof(tbuf);
- }
- }
- v->rlo[0] = MIN(pts[0],pts[2]);
- v->rhi[0] = MAX(pts[0],pts[2]);
- v->rlo[1] = MIN(pts[1],pts[3]);
- v->rhi[1] = MAX(pts[1],pts[3]);
- return 1;
- }
- else if( !strcmp(v->s, "point") || !strcmp(v->s, "polygon") ){
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- v->rlo[0] = xcen-1;
- v->rhi[0] = xcen+1;
- v->rlo[1] = ycen-1;
- v->rhi[1] = ycen+1;
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") &&
- word(s, tbuf2, &ip) ){
- dval = atof(tbuf);
- v->rlo[0] = MIN(dval-1,v->rlo[0]);
- v->rhi[0] = MAX(dval+1,v->rhi[0]);
- dval = atof(tbuf2);
- v->rlo[1] = MIN(dval-1,v->rlo[1]);
- v->rhi[1] = MAX(dval+1,v->rhi[1]);
- }
- return 1;
- }
- else if( !strcmp(v->s, "pie") || !strcmp(v->s, "qtpie") ){
- return 0;
- }
- else if( !strcmp(v->s, "panda") || !strcmp(v->s, "cpanda") ){
- maxd = SZ_LINE;
- if( !(dvals=(double *)malloc(maxd*sizeof(double))) ) return 0;
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") ){
- dvals[nd++] = atof(tbuf);
- if( nd == maxd ){
- maxd += SZ_LINE;
- if( !(dvals=(double *)realloc(dvals, maxd*sizeof(double))) ) return 0;
- }
- }
- v->rlo[0] = dvals[0] - dvals[6] - 1;
- v->rhi[0] = dvals[0] + dvals[6] + 1;
- v->rlo[1] = dvals[1] - dvals[6] - 1;
- v->rhi[1] = dvals[1] + dvals[6] + 1;
- if( dvals ) xfree(dvals);
- return 1;
- }
- else if( !strcmp(v->s, "bpanda") || !strcmp(v->s, "epanda") ){
- maxd = 3;
- if( !(dvals=(double *)malloc(maxd*sizeof(double))) ) return 0;
- /* grab: xcen ycen */
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- /* skip: ang1 ang2 nang xwlo yhlo */
- for(i=0; i<5; i++){
- if( !word(s, tbuf, &ip) ) return 0;
- }
- /* grab: xwhi yhhi */
- for(i=0; i<2; i++){
- if( !word(s, tbuf, &ip) ) return 0;
- dvals[nd++] = atof(tbuf);
- }
- /* skip: nrad */
- if( !word(s, tbuf, &ip) ) return 0;
- /* grab: ang */
- if( !word(s, tbuf, &ip) ) return 0;
- dvals[nd++] = atof(tbuf);
- /* we can now handle this with box/ellipse code */
- goto ellcom;
- }
- else if( !strcmp(v->s, "field") ){
- return 0;
- }
- else{
- return 0;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int _valreg(char *s, idxvalrec **v)
-#else
-static int _valreg(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- int ip=0;
- char *t;
- char tbuf[SZ_LINE];
- *v = idxvalnew(NULL);
- newdtable("(),");
- while( *s == '(' ) s++;
- if( !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- if( strstr(tbuf, "field") ){
- (*v)->type = INDEF;
- return REG;
- }
- t = tbuf+2;
- if( *t == 'v' ) t++;
- (*v)->s = xstrdup(t);
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ||
- !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- /* include/exclude */
- if( !atoi(tbuf) ){
- (*v)->type = INDEF;
- return REG;
- }
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- culc(tbuf);
- _valname(tbuf, &(*v)->rv[0]);
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- culc(tbuf);
- _valname(tbuf, &(*v)->rv[1]);
- if( !_valreglims(*v, &s[ip]) ){
- (*v)->type = INDEF;
- return REG;
- }
- freedtable();
- (*v)->type = REG;
- return REG;
-}
-
-#ifdef YY_USE_PROTOS
-static int _valfunc(char *s, idxvalrec **v)
-#else
-static int _valfunc(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- *v = idxvalnew(s);
- (*v)->type = FUNC;
- return FUNC;
-}
-
-
-#ifdef YY_USE_PROTOS
-void
-idxstring(char *s)
-#else
-void idxstring(s)
- char *s;
-#endif
-{
- idx_scan_string(s);
-}
-
-#ifdef YY_USE_PROTOS
-int
-idxerror(char *msg)
-#else
-int idxerror(msg)
- char *msg;
-#endif
-{
- Filter filter;
-
- YY_FLUSH_BUFFER;
- /* turn indexing off */
- if( (filter=FilterDefault()) ){
- filter->doidx = -1;
- }
- /* output message, if necessary */
- if( idx_debug ){
- fprintf(stderr, "ERROR: %s", msg);
- if( !strcmp(msg, "syntax error") ){
- fprintf(stderr, " (terminating index processing)");
- }
- fprintf(stderr, "\n");
- }
- yyterminate();
-}
-
-#ifdef YY_USE_PROTOS
-int yywrap(void)
-#else
-int yywrap()
-#endif
-{
- return 1;
-}
-
diff --git a/funtools/filter/idx.output b/funtools/filter/idx.output
deleted file mode 100644
index 0a2de2d..0000000
--- a/funtools/filter/idx.output
+++ /dev/null
@@ -1,1007 +0,0 @@
-State 3 conflicts: 1 reduce/reduce
-
-
-Grammar
-
- 0 $accept: idx $end
-
- 1 idx: expr
-
- 2 expr: rowlist
- 3 | expr OR expr
- 4 | expr AND expr
- 5 | '(' expr ')'
-
- 6 rowlist: REG
- 7 | FUNC
- 8 | value EQ value
- 9 | value NE value
- 10 | value '<' value
- 11 | value LE value
- 12 | value '>' value
- 13 | value GE value
-
- 14 value: NUM
- 15 | COL
- 16 | INDEF
- 17 | FUNC
- 18 | value '+' value
- 19 | value '-' value
- 20 | value '*' value
- 21 | value '/' value
- 22 | value '%' value
- 23 | value '&' value
- 24 | value '|' value
- 25 | value '^' value
- 26 | '!' value
- 27 | '~' value
- 28 | '-' value
- 29 | '(' value ')'
-
-
-Terminals, with rules where they appear
-
-$end (0) 0
-'!' (33) 26
-'%' (37) 22
-'&' (38) 23
-'(' (40) 5 29
-')' (41) 5 29
-'*' (42) 20
-'+' (43) 18
-'-' (45) 19 28
-'/' (47) 21
-'<' (60) 10
-'>' (62) 12
-'^' (94) 25
-'|' (124) 24
-'~' (126) 27
-error (256)
-NUM (258) 14
-COL (259) 15
-FUNC (260) 7 17
-REG (261) 6
-INDEF (262) 16
-OR (263) 3
-AND (264) 4
-NE (265) 9
-EQ (266) 8
-GE (267) 13
-LE (268) 11
-UMINUS (269)
-
-
-Nonterminals, with rules where they appear
-
-$accept (29)
- on left: 0
-idx (30)
- on left: 1, on right: 0
-expr (31)
- on left: 2 3 4 5, on right: 1 3 4 5
-rowlist (32)
- on left: 6 7 8 9 10 11 12 13, on right: 2
-value (33)
- on left: 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29,
- on right: 8 9 10 11 12 13 18 19 20 21 22 23 24 25 26 27 28 29
-
-
-state 0
-
- 0 $accept: . idx $end
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 3
- REG shift, and go to state 4
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 9
-
- idx go to state 10
- expr go to state 11
- rowlist go to state 12
- value go to state 13
-
-
-state 1
-
- 14 value: NUM .
-
- $default reduce using rule 14 (value)
-
-
-state 2
-
- 15 value: COL .
-
- $default reduce using rule 15 (value)
-
-
-state 3
-
- 7 rowlist: FUNC .
- 17 value: FUNC .
-
- $end reduce using rule 7 (rowlist)
- OR reduce using rule 7 (rowlist)
- AND reduce using rule 7 (rowlist)
- ')' reduce using rule 7 (rowlist)
- ')' [reduce using rule 17 (value)]
- $default reduce using rule 17 (value)
-
-
-state 4
-
- 6 rowlist: REG .
-
- $default reduce using rule 6 (rowlist)
-
-
-state 5
-
- 16 value: INDEF .
-
- $default reduce using rule 16 (value)
-
-
-state 6
-
- 28 value: '-' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 16
-
-
-state 7
-
- 26 value: '!' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 17
-
-
-state 8
-
- 27 value: '~' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 18
-
-
-state 9
-
- 5 expr: '(' . expr ')'
- 29 value: '(' . value ')'
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 3
- REG shift, and go to state 4
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 9
-
- expr go to state 19
- rowlist go to state 12
- value go to state 20
-
-
-state 10
-
- 0 $accept: idx . $end
-
- $end shift, and go to state 21
-
-
-state 11
-
- 1 idx: expr .
- 3 expr: expr . OR expr
- 4 | expr . AND expr
-
- OR shift, and go to state 22
- AND shift, and go to state 23
-
- $default reduce using rule 1 (idx)
-
-
-state 12
-
- 2 expr: rowlist .
-
- $default reduce using rule 2 (expr)
-
-
-state 13
-
- 8 rowlist: value . EQ value
- 9 | value . NE value
- 10 | value . '<' value
- 11 | value . LE value
- 12 | value . '>' value
- 13 | value . GE value
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- NE shift, and go to state 27
- EQ shift, and go to state 28
- '<' shift, and go to state 29
- '>' shift, and go to state 30
- GE shift, and go to state 31
- LE shift, and go to state 32
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
-
-state 14
-
- 17 value: FUNC .
-
- $default reduce using rule 17 (value)
-
-
-state 15
-
- 29 value: '(' . value ')'
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 38
-
-
-state 16
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
- 28 | '-' value .
-
- $default reduce using rule 28 (value)
-
-
-state 17
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
- 26 | '!' value .
-
- $default reduce using rule 26 (value)
-
-
-state 18
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
- 27 | '~' value .
-
- $default reduce using rule 27 (value)
-
-
-state 19
-
- 3 expr: expr . OR expr
- 4 | expr . AND expr
- 5 | '(' expr . ')'
-
- OR shift, and go to state 22
- AND shift, and go to state 23
- ')' shift, and go to state 39
-
-
-state 20
-
- 8 rowlist: value . EQ value
- 9 | value . NE value
- 10 | value . '<' value
- 11 | value . LE value
- 12 | value . '>' value
- 13 | value . GE value
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
- 29 | '(' value . ')'
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- NE shift, and go to state 27
- EQ shift, and go to state 28
- '<' shift, and go to state 29
- '>' shift, and go to state 30
- GE shift, and go to state 31
- LE shift, and go to state 32
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
- ')' shift, and go to state 40
-
-
-state 21
-
- 0 $accept: idx $end .
-
- $default accept
-
-
-state 22
-
- 3 expr: expr OR . expr
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 3
- REG shift, and go to state 4
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 9
-
- expr go to state 41
- rowlist go to state 12
- value go to state 13
-
-
-state 23
-
- 4 expr: expr AND . expr
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 3
- REG shift, and go to state 4
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 9
-
- expr go to state 42
- rowlist go to state 12
- value go to state 13
-
-
-state 24
-
- 24 value: value '|' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 43
-
-
-state 25
-
- 25 value: value '^' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 44
-
-
-state 26
-
- 23 value: value '&' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 45
-
-
-state 27
-
- 9 rowlist: value NE . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 46
-
-
-state 28
-
- 8 rowlist: value EQ . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 47
-
-
-state 29
-
- 10 rowlist: value '<' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 48
-
-
-state 30
-
- 12 rowlist: value '>' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 49
-
-
-state 31
-
- 13 rowlist: value GE . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 50
-
-
-state 32
-
- 11 rowlist: value LE . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 51
-
-
-state 33
-
- 18 value: value '+' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 52
-
-
-state 34
-
- 19 value: value '-' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 53
-
-
-state 35
-
- 20 value: value '*' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 54
-
-
-state 36
-
- 21 value: value '/' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 55
-
-
-state 37
-
- 22 value: value '%' . value
-
- NUM shift, and go to state 1
- COL shift, and go to state 2
- FUNC shift, and go to state 14
- INDEF shift, and go to state 5
- '-' shift, and go to state 6
- '!' shift, and go to state 7
- '~' shift, and go to state 8
- '(' shift, and go to state 15
-
- value go to state 56
-
-
-state 38
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
- 29 | '(' value . ')'
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
- ')' shift, and go to state 40
-
-
-state 39
-
- 5 expr: '(' expr ')' .
-
- $default reduce using rule 5 (expr)
-
-
-state 40
-
- 29 value: '(' value ')' .
-
- $default reduce using rule 29 (value)
-
-
-state 41
-
- 3 expr: expr . OR expr
- 3 | expr OR expr .
- 4 | expr . AND expr
-
- AND shift, and go to state 23
-
- $default reduce using rule 3 (expr)
-
-
-state 42
-
- 3 expr: expr . OR expr
- 4 | expr . AND expr
- 4 | expr AND expr .
-
- $default reduce using rule 4 (expr)
-
-
-state 43
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 24 | value '|' value .
- 25 | value . '^' value
-
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 24 (value)
-
-
-state 44
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
- 25 | value '^' value .
-
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 25 (value)
-
-
-state 45
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 23 | value '&' value .
- 24 | value . '|' value
- 25 | value . '^' value
-
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 23 (value)
-
-
-state 46
-
- 9 rowlist: value NE value .
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 9 (rowlist)
-
-
-state 47
-
- 8 rowlist: value EQ value .
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 8 (rowlist)
-
-
-state 48
-
- 10 rowlist: value '<' value .
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 10 (rowlist)
-
-
-state 49
-
- 12 rowlist: value '>' value .
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 12 (rowlist)
-
-
-state 50
-
- 13 rowlist: value GE value .
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 13 (rowlist)
-
-
-state 51
-
- 11 rowlist: value LE value .
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '|' shift, and go to state 24
- '^' shift, and go to state 25
- '&' shift, and go to state 26
- '+' shift, and go to state 33
- '-' shift, and go to state 34
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 11 (rowlist)
-
-
-state 52
-
- 18 value: value . '+' value
- 18 | value '+' value .
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 18 (value)
-
-
-state 53
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 19 | value '-' value .
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- '*' shift, and go to state 35
- '/' shift, and go to state 36
- '%' shift, and go to state 37
-
- $default reduce using rule 19 (value)
-
-
-state 54
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 20 | value '*' value .
- 21 | value . '/' value
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- $default reduce using rule 20 (value)
-
-
-state 55
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 21 | value '/' value .
- 22 | value . '%' value
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- $default reduce using rule 21 (value)
-
-
-state 56
-
- 18 value: value . '+' value
- 19 | value . '-' value
- 20 | value . '*' value
- 21 | value . '/' value
- 22 | value . '%' value
- 22 | value '%' value .
- 23 | value . '&' value
- 24 | value . '|' value
- 25 | value . '^' value
-
- $default reduce using rule 22 (value)
diff --git a/funtools/filter/idx.tab.c b/funtools/filter/idx.tab.c
deleted file mode 100644
index d38c8af..0000000
--- a/funtools/filter/idx.tab.c
+++ /dev/null
@@ -1,2177 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.0. */
-
-/* Skeleton parser for GLR parsing with Bison,
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* This is the parser code for GLR (Generalized LR) parser. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <setjmp.h>
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "glr.c"
-
-/* Pure parsers. */
-#define YYPURE 0
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-/* Substitute the variable and function names. */
-#define yyparse idxparse
-#define yylex idxlex
-#define yyerror idxerror
-#define yylval idxlval
-#define yychar idxchar
-#define yydebug idxdebug
-#define yynerrs idxnerrs
-#define yylloc idxlloc
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NUM = 258,
- COL = 259,
- FUNC = 260,
- REG = 261,
- INDEF = 262,
- OR = 263,
- AND = 264,
- NE = 265,
- EQ = 266,
- GE = 267,
- LE = 268,
- UMINUS = 269
- };
-#endif
-#define NUM 258
-#define COL 259
-#define FUNC 260
-#define REG 261
-#define INDEF 262
-#define OR 263
-#define AND 264
-#define NE 265
-#define EQ 266
-#define GE 267
-#define LE 268
-#define UMINUS 269
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 1 "idx.y"
-
-#include <idx.h>
-#include <idx.tab.h>
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 6 "idx.y"
-typedef union YYSTYPE {
- idxrowrec *row;
- idxvalrec *val;
-} YYSTYPE;
-/* Line 186 of glr.c. */
-#line 115 "idx.tab.c"
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
-typedef struct YYLTYPE
-{
-
- char yydummy;
-
-} YYLTYPE;
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-/* Default (constant) value used for initialization for null
- right-hand sides. Unlike the standard yacc.c template,
- here we set the default value of $$ to a zeroed-out value.
- Since the default value is undefined, this behavior is
- technically correct. */
-static YYSTYPE yyval_default;
-
-/* Copy the second part of user declarations. */
-
-
-/* Line 217 of glr.c. */
-#line 142 "idx.tab.c"
-
-#ifndef YYFREE
-# define YYFREE free
-#endif
-#ifndef YYMALLOC
-# define YYMALLOC malloc
-#endif
-#ifndef YYREALLOC
-# define YYREALLOC realloc
-#endif
-
-#ifdef __cplusplus
- typedef bool yybool;
-#else
- typedef unsigned char yybool;
-#endif
-#define yytrue 1
-#define yyfalse 0
-
-/*-----------------.
-| GCC extensions. |
-`-----------------*/
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if !defined (__GNUC__) || __GNUC__ < 2 || \
-(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YYASSERT
-# define YYASSERT(condition) ((void) ((condition) || (abort (), 0)))
-#endif
-
-#ifndef ATTRIBUTE_UNUSED
-# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 21
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 143
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 29
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 5
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 30
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 57
-/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
-#define YYMAXRHS 3
-/* YYMAXLEFT -- Maximum number of symbols to the left of a handle
- accessed by $0, $-1, etc., in any rule. */
-#define YYMAXLEFT 0
-
-/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 269
-
-#define YYTRANSLATE(YYX) \
- ((YYX <= 0) ? YYEOF : \
- (unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const unsigned char yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 24, 2, 2, 2, 23, 12, 2,
- 27, 28, 21, 19, 2, 20, 2, 22, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 15, 2, 16, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 11, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 10, 2, 25, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 13, 14, 17, 18, 26
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const unsigned char yyprhs[] =
-{
- 0, 0, 3, 5, 7, 11, 15, 19, 21, 23,
- 27, 31, 35, 39, 43, 47, 49, 51, 53, 55,
- 59, 63, 67, 71, 75, 79, 83, 87, 90, 93,
- 96
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const signed char yyrhs[] =
-{
- 30, 0, -1, 31, -1, 32, -1, 31, 8, 31,
- -1, 31, 9, 31, -1, 27, 31, 28, -1, 6,
- -1, 5, -1, 33, 14, 33, -1, 33, 13, 33,
- -1, 33, 15, 33, -1, 33, 18, 33, -1, 33,
- 16, 33, -1, 33, 17, 33, -1, 3, -1, 4,
- -1, 7, -1, 5, -1, 33, 19, 33, -1, 33,
- 20, 33, -1, 33, 21, 33, -1, 33, 22, 33,
- -1, 33, 23, 33, -1, 33, 12, 33, -1, 33,
- 10, 33, -1, 33, 11, 33, -1, 24, 33, -1,
- 25, 33, -1, 20, 33, -1, 27, 33, 28, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned char yyrline[] =
-{
- 0, 39, 39, 42, 43, 44, 45, 49, 50, 51,
- 52, 53, 54, 55, 56, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74
-};
-#endif
-
-#if (YYDEBUG) || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "NUM", "COL", "FUNC", "REG", "INDEF",
- "OR", "AND", "'|'", "'^'", "'&'", "NE", "EQ", "'<'", "'>'", "GE", "LE",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'~'", "UMINUS", "'('", "')'",
- "$accept", "idx", "expr", "rowlist", "value", 0
-};
-#endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const unsigned char yyr1[] =
-{
- 0, 29, 30, 31, 31, 31, 31, 32, 32, 32,
- 32, 32, 32, 32, 32, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const unsigned char yyr2[] =
-{
- 0, 2, 1, 1, 3, 3, 3, 1, 1, 3,
- 3, 3, 3, 3, 3, 1, 1, 1, 1, 3,
- 3, 3, 3, 3, 3, 3, 3, 2, 2, 2,
- 3
-};
-
-/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
-static const unsigned char yydprec[] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0
-};
-
-/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */
-static const unsigned char yymerger[] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0
-};
-
-/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
- doesn't specify something else to do. Zero means the default is an
- error. */
-static const unsigned char yydefact[] =
-{
- 0, 15, 16, 18, 7, 17, 0, 0, 0, 0,
- 0, 2, 3, 0, 18, 0, 29, 27, 28, 0,
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
- 30, 4, 5, 25, 26, 24, 10, 9, 11, 13,
- 14, 12, 19, 20, 21, 22, 23
-};
-
-/* YYPDEFGOTO[NTERM-NUM]. */
-static const signed char yydefgoto[] =
-{
- -1, 10, 11, 12, 13
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -17
-static const signed char yypact[] =
-{
- 30, -17, -17, 4, -17, -17, 36, 36, 36, 30,
- 8, 2, -17, 89, -17, 36, -17, -17, -17, 37,
- 56, -17, 30, 30, 36, 36, 36, 36, 36, 36,
- 36, 36, 36, 36, 36, 36, 36, 36, 70, -17,
- -17, 5, -17, 108, 120, 114, 103, 103, 103, 103,
- 103, 103, -16, -16, -17, -17, -17
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const signed char yypgoto[] =
-{
- -17, -17, 29, -17, -6
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -9
-static const signed char yytable[] =
-{
- 16, 17, 18, 20, -8, 35, 36, 37, 21, 38,
- 22, 23, -8, -8, 23, 0, 0, 0, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, -8, 1, 2, 3, 4, 5, 19, 1,
- 2, 14, 0, 5, 0, 22, 23, 0, 0, 0,
- 6, 41, 42, 0, 7, 8, 6, 9, 0, 0,
- 7, 8, 0, 15, 0, 39, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 24, 25, 26, 0, 40, 0, 0, 0, 0, 33,
- 34, 35, 36, 37, 0, 0, 0, 0, 40, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 24, 25, 26, 0, 0, 0, 25,
- 26, 0, 33, 34, 35, 36, 37, 33, 34, 35,
- 36, 37, 26, 33, 34, 35, 36, 37, 0, 33,
- 34, 35, 36, 37
-};
-
-/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
- list of conflicting reductions corresponding to action entry for
- state STATE-NUM in yytable. 0 means no conflicts. The list in
- yyconfl is terminated by a rule number of 0. */
-static const unsigned char yyconflp[] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
-};
-
-/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
- 0, pointed into by YYCONFLP. */
-static const short int yyconfl[] =
-{
- 0, 18, 0
-};
-
-static const signed char yycheck[] =
-{
- 6, 7, 8, 9, 0, 21, 22, 23, 0, 15,
- 8, 9, 8, 9, 9, -1, -1, -1, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 28, 3, 4, 5, 6, 7, 9, 3,
- 4, 5, -1, 7, -1, 8, 9, -1, -1, -1,
- 20, 22, 23, -1, 24, 25, 20, 27, -1, -1,
- 24, 25, -1, 27, -1, 28, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 10, 11, 12, -1, 28, -1, -1, -1, -1, 19,
- 20, 21, 22, 23, -1, -1, -1, -1, 28, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 10, 11, 12, -1, -1, -1, 11,
- 12, -1, 19, 20, 21, 22, 23, 19, 20, 21,
- 22, 23, 12, 19, 20, 21, 22, 23, -1, 19,
- 20, 21, 22, 23
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const unsigned char yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 20, 24, 25, 27,
- 30, 31, 32, 33, 5, 27, 33, 33, 33, 31,
- 33, 0, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 33, 28,
- 28, 31, 31, 33, 33, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33
-};
-
-
-/* Prevent warning if -Wmissing-prototypes. */
-int yyparse (void);
-
-/* Error token number */
-#define YYTERROR 1
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0)
-#endif
-
-
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-#define YYLEX yylex ()
-
-YYSTYPE yylval;
-
-YYLTYPE yylloc;
-
-int yynerrs;
-int yychar;
-
-static const int YYEOF = 0;
-static const int YYEMPTY = -2;
-
-typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
-
-#define YYCHK(YYE) \
- do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
- while (0)
-
-#if YYDEBUG
-
-#if ! defined (YYFPRINTF)
-# define YYFPRINTF fprintf
-#endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
-
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- switch (yytype)
- {
- default:
- break;
- }
- YYFPRINTF (yyoutput, ")");
-}
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-
-#else /* !YYDEBUG */
-
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-
-#endif /* !YYDEBUG */
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-/* Minimum number of free items on the stack allowed after an
- allocation. This is to allow allocation and initialization
- to be completed by functions that call expandGLRStack before the
- stack is expanded, thus insuring that all necessary pointers get
- properly redirected to new data. */
-#define YYHEADROOM 2
-
-#if (! defined (YYSTACKEXPANDABLE) \
- && (! defined (__cplusplus) \
- || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
-#define YYSTACKEXPANDABLE 1
-#else
-#define YYSTACKEXPANDABLE 0
-#endif
-
-/** State numbers, as in LALR(1) machine */
-typedef int yyStateNum;
-
-/** Rule numbers, as in LALR(1) machine */
-typedef int yyRuleNum;
-
-/** Grammar symbol */
-typedef short int yySymbol;
-
-/** Item references, as in LALR(1) machine */
-typedef short int yyItemNum;
-
-typedef struct yyGLRState yyGLRState;
-typedef struct yySemanticOption yySemanticOption;
-typedef union yyGLRStackItem yyGLRStackItem;
-typedef struct yyGLRStack yyGLRStack;
-typedef struct yyGLRStateSet yyGLRStateSet;
-
-struct yyGLRState {
- yybool yyisState;
- yybool yyresolved;
- yyStateNum yylrState;
- yyGLRState* yypred;
- size_t yyposn;
- union {
- yySemanticOption* yyfirstVal;
- YYSTYPE yysval;
- } yysemantics;
- YYLTYPE yyloc;
-};
-
-struct yyGLRStateSet {
- yyGLRState** yystates;
- size_t yysize, yycapacity;
-};
-
-struct yySemanticOption {
- yybool yyisState;
- yyRuleNum yyrule;
- yyGLRState* yystate;
- yySemanticOption* yynext;
-};
-
-union yyGLRStackItem {
- yyGLRState yystate;
- yySemanticOption yyoption;
-};
-
-struct yyGLRStack {
- int yyerrflag;
- int yyerrState;
-
-
- yySymbol* yytokenp;
- jmp_buf yyexception_buffer;
- yyGLRStackItem* yyitems;
- yyGLRStackItem* yynextFree;
- int yyspaceLeft;
- yyGLRState* yysplitPoint;
- yyGLRState* yylastDeleted;
- yyGLRStateSet yytops;
-};
-
-static void yyinitGLRStack (yyGLRStack* yystack, size_t yysize);
-static void yyexpandGLRStack (yyGLRStack* yystack);
-static void yyfreeGLRStack (yyGLRStack* yystack);
-
-static void
-yyFail (yyGLRStack* yystack, const char* yyformat, ...)
-{
- yystack->yyerrflag = 1;
- if (yyformat != NULL)
- {
- char yymsg[256];
- va_list yyap;
- va_start (yyap, yyformat);
- vsprintf (yymsg, yyformat, yyap);
- yyerror (yymsg);
- }
- longjmp (yystack->yyexception_buffer, 1);
-}
-
-#if YYDEBUG || YYERROR_VERBOSE
-/** A printable representation of TOKEN. Valid until next call to
- * tokenName. */
-static inline const char*
-yytokenName (yySymbol yytoken)
-{
- if (yytoken == YYEMPTY)
- return "";
-
- return yytname[yytoken];
-}
-#endif
-
-/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
- * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
- * containing the pointer to the next state in the chain. Assumes
- * YYLOW1 < YYLOW0. */
-static void yyfillin (yyGLRStackItem *, int, int) ATTRIBUTE_UNUSED;
-static void
-yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
-{
- yyGLRState* s;
- int i;
- s = yyvsp[yylow0].yystate.yypred;
- for (i = yylow0-1; i >= yylow1; i -= 1)
- {
- YYASSERT (s->yyresolved);
- yyvsp[i].yystate.yyresolved = yytrue;
- yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
- yyvsp[i].yystate.yyloc = s->yyloc;
- s = yyvsp[i].yystate.yypred = s->yypred;
- }
-}
-
-/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
- YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
- For convenience, always return YYLOW1. */
-static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
- ATTRIBUTE_UNUSED;
-static inline int
-yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
-{
- if (!yynormal && yylow1 < *yylow)
- {
- yyfillin (yyvsp, *yylow, yylow1);
- *yylow = yylow1;
- }
- return yylow1;
-}
-
-/** Perform user action for rule number YYN, with RHS length YYRHSLEN,
- * and top stack item YYVSP. YYLVALP points to place to put semantic
- * value ($$), and yylocp points to place for location information
- * (@$). Returns yyok for normal return, yyaccept for YYACCEPT,
- * yyerr for YYERROR, yyabort for YYABORT. */
-static YYRESULTTAG
-yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
- YYSTYPE* yyvalp,
- YYLTYPE* yylocp ATTRIBUTE_UNUSED,
- yyGLRStack* yystack
- )
-{
- yybool yynormal ATTRIBUTE_UNUSED = (yystack->yysplitPoint == NULL);
- int yylow;
-
-# undef yyerrok
-# define yyerrok (yystack->yyerrState = 0)
-# undef YYACCEPT
-# define YYACCEPT return yyaccept
-# undef YYABORT
-# define YYABORT return yyabort
-# undef YYERROR
-# define YYERROR return yyerrok, yyerr
-# undef YYRECOVERING
-# define YYRECOVERING (yystack->yyerrState != 0)
-# undef yyclearin
-# define yyclearin (yychar = *(yystack->yytokenp) = YYEMPTY)
-# undef YYFILL
-# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal)
-# undef YYBACKUP
-# define YYBACKUP(Token, Value) \
- return yyerror ("syntax error: cannot back up"), \
- yyerrok, yyerr
-
- yylow = 1;
- if (yyrhslen == 0)
- *yyvalp = yyval_default;
- else
- *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;
- YYLLOC_DEFAULT (*yylocp, yyvsp - yyrhslen, yyrhslen);
-
- switch (yyn)
- {
- case 2:
-#line 39 "idx.y"
- { idxall((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.row)); ;}
- break;
-
- case 4:
-#line 43 "idx.y"
- { ((*yyvalp).row) = idxor((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.row),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.row)); ;}
- break;
-
- case 5:
-#line 44 "idx.y"
- { ((*yyvalp).row) = idxand((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.row),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.row)); ;}
- break;
-
- case 6:
-#line 45 "idx.y"
- { ((*yyvalp).row) = (((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.row); ;}
- break;
-
- case 7:
-#line 49 "idx.y"
- { ((*yyvalp).row) = idxrowreg((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 8:
-#line 50 "idx.y"
- { ((*yyvalp).row) = idxrowfun((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 9:
-#line 51 "idx.y"
- { ((*yyvalp).row) = idxroweq((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 10:
-#line 52 "idx.y"
- { ((*yyvalp).row) = idxrowne((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 11:
-#line 53 "idx.y"
- { ((*yyvalp).row) = idxrowlt((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 12:
-#line 54 "idx.y"
- { ((*yyvalp).row) = idxrowle((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 13:
-#line 55 "idx.y"
- { ((*yyvalp).row) = idxrowgt((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 14:
-#line 56 "idx.y"
- { ((*yyvalp).row) = idxrowge((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 19:
-#line 63 "idx.y"
- { ((*yyvalp).val) = idxvaladd((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 20:
-#line 64 "idx.y"
- { ((*yyvalp).val) = idxvalsub((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 21:
-#line 65 "idx.y"
- { ((*yyvalp).val) = idxvalmul((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 22:
-#line 66 "idx.y"
- { ((*yyvalp).val) = idxvaldiv((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 23:
-#line 67 "idx.y"
- { ((*yyvalp).val) = idxvalmod((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 24:
-#line 68 "idx.y"
- { ((*yyvalp).val) = idxvaland((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 25:
-#line 69 "idx.y"
- { ((*yyvalp).val) = idxvalor((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 26:
-#line 70 "idx.y"
- { ((*yyvalp).val) = idxvalxor((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.val),(((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 27:
-#line 71 "idx.y"
- { ((*yyvalp).val) = idxvalnot((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 28:
-#line 72 "idx.y"
- { ((*yyvalp).val) = idxvalcom((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 29:
-#line 73 "idx.y"
- { ((*yyvalp).val) = idxvalmin((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.val)); ;}
- break;
-
- case 30:
-#line 74 "idx.y"
- { ((*yyvalp).val) = (((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.val); ;}
- break;
-
-
- }
-
- return yyok;
-# undef yyerrok
-# undef YYABORT
-# undef YYACCEPT
-# undef YYERROR
-# undef YYBACKUP
-# undef yyclearin
-# undef YYRECOVERING
-/* Line 750 of glr.c. */
-#line 890 "idx.tab.c"
-}
-
-
-static void
-yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
-{
- /* `Use' the arguments. */
- (void) yy0;
- (void) yy1;
-
- switch (yyn)
- {
-
- }
-}
-
- /* Bison grammar-table manipulation. */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-/** Number of symbols composing the right hand side of rule #RULE. */
-static inline int
-yyrhsLength (yyRuleNum yyrule)
-{
- return yyr2[yyrule];
-}
-
-/** Left-hand-side symbol for rule #RULE. */
-static inline yySymbol
-yylhsNonterm (yyRuleNum yyrule)
-{
- return yyr1[yyrule];
-}
-
-#define yyis_pact_ninf(yystate) \
- ((yystate) == YYPACT_NINF)
-
-/** True iff LR state STATE has only a default reduction (regardless
- * of token). */
-static inline yybool
-yyisDefaultedState (yyStateNum yystate)
-{
- return yyis_pact_ninf (yypact[yystate]);
-}
-
-/** The default reduction for STATE, assuming it has one. */
-static inline yyRuleNum
-yydefaultAction (yyStateNum yystate)
-{
- return yydefact[yystate];
-}
-
-#define yyis_table_ninf(yytable_value) \
- 0
-
-/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
- * Result R means
- * R < 0: Reduce on rule -R.
- * R = 0: Error.
- * R > 0: Shift to state R.
- * Set *CONFLICTS to a pointer into yyconfl to 0-terminated list of
- * conflicting reductions.
- */
-static inline void
-yygetLRActions (yyStateNum yystate, int yytoken,
- int* yyaction, const short int** yyconflicts)
-{
- int yyindex = yypact[yystate] + yytoken;
- if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
- {
- *yyaction = -yydefact[yystate];
- *yyconflicts = yyconfl;
- }
- else if (! yyis_table_ninf (yytable[yyindex]))
- {
- *yyaction = yytable[yyindex];
- *yyconflicts = yyconfl + yyconflp[yyindex];
- }
- else
- {
- *yyaction = 0;
- *yyconflicts = yyconfl + yyconflp[yyindex];
- }
-}
-
-static inline yyStateNum
-yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
-{
- int yyr;
- yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
- if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
- return yytable[yyr];
- else
- return yydefgoto[yylhs - YYNTOKENS];
-}
-
-static inline yybool
-yyisShiftAction (int yyaction)
-{
- return 0 < yyaction;
-}
-
-static inline yybool
-yyisErrorAction (int yyaction)
-{
- return yyaction == 0;
-}
-
- /* GLRStates */
-
-static void
-yyaddDeferredAction (yyGLRStack* yystack, yyGLRState* yystate,
- yyGLRState* rhs, yyRuleNum yyrule)
-{
- yySemanticOption* yynewItem;
- yynewItem = &yystack->yynextFree->yyoption;
- yystack->yyspaceLeft -= 1;
- yystack->yynextFree += 1;
- yynewItem->yyisState = yyfalse;
- yynewItem->yystate = rhs;
- yynewItem->yyrule = yyrule;
- yynewItem->yynext = yystate->yysemantics.yyfirstVal;
- yystate->yysemantics.yyfirstVal = yynewItem;
- if (yystack->yyspaceLeft < YYHEADROOM)
- yyexpandGLRStack (yystack);
-}
-
- /* GLRStacks */
-
-/** Initialize SET to a singleton set containing an empty stack. */
-static void
-yyinitStateSet (yyGLRStateSet* yyset)
-{
- yyset->yysize = 1;
- yyset->yycapacity = 16;
- yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
- yyset->yystates[0] = NULL;
-}
-
-static void yyfreeStateSet (yyGLRStateSet* yyset)
-{
- YYFREE (yyset->yystates);
-}
-
-/** Initialize STACK to a single empty stack, with total maximum
- * capacity for all stacks of SIZE. */
-static void
-yyinitGLRStack (yyGLRStack* yystack, size_t yysize)
-{
- yystack->yyerrflag = 0;
- yystack->yyerrState = 0;
- yynerrs = 0;
- yystack->yyspaceLeft = yysize;
- yystack->yynextFree = yystack->yyitems =
- (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystack->yynextFree[0]);
- yystack->yysplitPoint = NULL;
- yystack->yylastDeleted = NULL;
- yyinitStateSet (&yystack->yytops);
-}
-
-#define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \
- &((YYTOITEMS) - ((YYFROMITEMS) - (yyGLRStackItem*) (YYX)))->YYTYPE
-
-/** If STACK is expandable, extend it. WARNING: Pointers into the
- stack from outside should be considered invalid after this call.
- We always expand when there are 1 or fewer items left AFTER an
- allocation, so that we can avoid having external pointers exist
- across an allocation. */
-static void
-yyexpandGLRStack (yyGLRStack* yystack)
-{
-#if YYSTACKEXPANDABLE
- yyGLRStack yynewStack;
- yyGLRStackItem* yyp0, *yyp1;
- size_t yysize, yynewSize;
- size_t yyn;
- yysize = yystack->yynextFree - yystack->yyitems;
- if (YYMAXDEPTH <= yysize)
- yyFail (yystack, "parser stack overflow");
- yynewSize = 2*yysize;
- if (YYMAXDEPTH < yynewSize)
- yynewSize = YYMAXDEPTH;
- yyinitGLRStack (&yynewStack, yynewSize);
- for (yyp0 = yystack->yyitems, yyp1 = yynewStack.yyitems, yyn = yysize;
- 0 < yyn;
- yyn -= 1, yyp0 += 1, yyp1 += 1)
- {
- *yyp1 = *yyp0;
- if (*(yybool *) yyp0)
- {
- yyGLRState* yys0 = &yyp0->yystate;
- yyGLRState* yys1 = &yyp1->yystate;
- if (yys0->yypred != NULL)
- yys1->yypred =
- YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
- if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != NULL)
- yys1->yysemantics.yyfirstVal =
- YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
- }
- else
- {
- yySemanticOption* yyv0 = &yyp0->yyoption;
- yySemanticOption* yyv1 = &yyp1->yyoption;
- if (yyv0->yystate != NULL)
- yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
- if (yyv0->yynext != NULL)
- yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
- }
- }
- if (yystack->yysplitPoint != NULL)
- yystack->yysplitPoint = YYRELOC (yystack->yyitems, yynewStack.yyitems,
- yystack->yysplitPoint, yystate);
-
- for (yyn = 0; yyn < yystack->yytops.yysize; yyn += 1)
- if (yystack->yytops.yystates[yyn] != NULL)
- yystack->yytops.yystates[yyn] =
- YYRELOC (yystack->yyitems, yynewStack.yyitems,
- yystack->yytops.yystates[yyn], yystate);
- YYFREE (yystack->yyitems);
- yystack->yyitems = yynewStack.yyitems;
- yystack->yynextFree = yynewStack.yynextFree + yysize;
- yystack->yyspaceLeft = yynewStack.yyspaceLeft - yysize;
-
-#else
-
- yyFail (yystack, "parser stack overflow");
-#endif
-}
-
-static void
-yyfreeGLRStack (yyGLRStack* yystack)
-{
- YYFREE (yystack->yyitems);
- yyfreeStateSet (&yystack->yytops);
-}
-
-/** Assuming that S is a GLRState somewhere on STACK, update the
- * splitpoint of STACK, if needed, so that it is at least as deep as
- * S. */
-static inline void
-yyupdateSplit (yyGLRStack* yystack, yyGLRState* yys)
-{
- if (yystack->yysplitPoint != NULL && yystack->yysplitPoint > yys)
- yystack->yysplitPoint = yys;
-}
-
-/** Invalidate stack #K in STACK. */
-static inline void
-yymarkStackDeleted (yyGLRStack* yystack, int yyk)
-{
- if (yystack->yytops.yystates[yyk] != NULL)
- yystack->yylastDeleted = yystack->yytops.yystates[yyk];
- yystack->yytops.yystates[yyk] = NULL;
-}
-
-/** Undelete the last stack that was marked as deleted. Can only be
- done once after a deletion, and only when all other stacks have
- been deleted. */
-static void
-yyundeleteLastStack (yyGLRStack* yystack)
-{
- if (yystack->yylastDeleted == NULL || yystack->yytops.yysize != 0)
- return;
- yystack->yytops.yystates[0] = yystack->yylastDeleted;
- yystack->yytops.yysize = 1;
- YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
- yystack->yylastDeleted = NULL;
-}
-
-static inline void
-yyremoveDeletes (yyGLRStack* yystack)
-{
- size_t yyi, yyj;
- yyi = yyj = 0;
- while (yyj < yystack->yytops.yysize)
- {
- if (yystack->yytops.yystates[yyi] == NULL)
- {
- if (yyi == yyj)
- {
- YYDPRINTF ((stderr, "Removing dead stacks.\n"));
- }
- yystack->yytops.yysize -= 1;
- }
- else
- {
- yystack->yytops.yystates[yyj] = yystack->yytops.yystates[yyi];
- if (yyj != yyi)
- {
- YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
- (unsigned long int) yyi, (unsigned long int) yyj));
- }
- yyj += 1;
- }
- yyi += 1;
- }
-}
-
-/** Shift to a new state on stack #K of STACK, corresponding to LR state
- * LRSTATE, at input position POSN, with (resolved) semantic value SVAL. */
-static inline void
-yyglrShift (yyGLRStack* yystack, int yyk, yyStateNum yylrState, size_t yyposn,
- YYSTYPE yysval, YYLTYPE* yylocp)
-{
- yyGLRStackItem* yynewItem;
-
- yynewItem = yystack->yynextFree;
- yystack->yynextFree += 1;
- yystack->yyspaceLeft -= 1;
- yynewItem->yystate.yyisState = yytrue;
- yynewItem->yystate.yylrState = yylrState;
- yynewItem->yystate.yyposn = yyposn;
- yynewItem->yystate.yyresolved = yytrue;
- yynewItem->yystate.yypred = yystack->yytops.yystates[yyk];
- yystack->yytops.yystates[yyk] = &yynewItem->yystate;
- yynewItem->yystate.yysemantics.yysval = yysval;
- yynewItem->yystate.yyloc = *yylocp;
- if (yystack->yyspaceLeft < YYHEADROOM)
- yyexpandGLRStack (yystack);
-}
-
-/** Shift stack #K of YYSTACK, to a new state corresponding to LR
- * state YYLRSTATE, at input position YYPOSN, with the (unresolved)
- * semantic value of YYRHS under the action for YYRULE. */
-static inline void
-yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState,
- size_t yyposn, yyGLRState* rhs, yyRuleNum yyrule)
-{
- yyGLRStackItem* yynewItem;
-
- yynewItem = yystack->yynextFree;
- yynewItem->yystate.yyisState = yytrue;
- yynewItem->yystate.yylrState = yylrState;
- yynewItem->yystate.yyposn = yyposn;
- yynewItem->yystate.yyresolved = yyfalse;
- yynewItem->yystate.yypred = yystack->yytops.yystates[yyk];
- yynewItem->yystate.yysemantics.yyfirstVal = NULL;
- yystack->yytops.yystates[yyk] = &yynewItem->yystate;
- yystack->yynextFree += 1;
- yystack->yyspaceLeft -= 1;
- yyaddDeferredAction (yystack, &yynewItem->yystate, rhs, yyrule);
-}
-
-/** Pop the symbols consumed by reduction #RULE from the top of stack
- * #K of STACK, and perform the appropriate semantic action on their
- * semantic values. Assumes that all ambiguities in semantic values
- * have been previously resolved. Set *VALP to the resulting value,
- * and *LOCP to the computed location (if any). Return value is as
- * for userAction. */
-static inline YYRESULTTAG
-yydoAction (yyGLRStack* yystack, int yyk, yyRuleNum yyrule,
- YYSTYPE* yyvalp, YYLTYPE* yylocp)
-{
- int yynrhs = yyrhsLength (yyrule);
-
- if (yystack->yysplitPoint == NULL)
- {
- /* Standard special case: single stack. */
- yyGLRStackItem* rhs = (yyGLRStackItem*) yystack->yytops.yystates[yyk];
- YYASSERT (yyk == 0);
- yystack->yynextFree -= yynrhs;
- yystack->yyspaceLeft += yynrhs;
- yystack->yytops.yystates[0] = & yystack->yynextFree[-1].yystate;
- return yyuserAction (yyrule, yynrhs, rhs,
- yyvalp, yylocp, yystack);
- }
- else
- {
- int yyi;
- yyGLRState* yys;
- yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
- yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
- = yystack->yytops.yystates[yyk];
- for (yyi = 0; yyi < yynrhs; yyi += 1)
- {
- yys = yys->yypred;
- YYASSERT (yys);
- }
- yyupdateSplit (yystack, yys);
- yystack->yytops.yystates[yyk] = yys;
- return yyuserAction (yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
- yyvalp, yylocp, yystack);
- }
-}
-
-#if !YYDEBUG
-# define YY_REDUCE_PRINT(K, Rule)
-#else
-# define YY_REDUCE_PRINT(K, Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (K, Rule); \
-} while (0)
-
-/*----------------------------------------------------------.
-| Report that the RULE is going to be reduced on stack #K. |
-`----------------------------------------------------------*/
-
-static inline void
-yy_reduce_print (size_t yyk, yyRuleNum yyrule)
-{
- int yyi;
- YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu), ",
- (unsigned long int) yyk, yyrule - 1,
- (unsigned long int) yyrline[yyrule]);
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
- YYFPRINTF (stderr, "%s ", yytokenName (yyrhs[yyi]));
- YYFPRINTF (stderr, "-> %s\n", yytokenName (yyr1[yyrule]));
-}
-#endif
-
-/** Pop items off stack #K of STACK according to grammar rule RULE,
- * and push back on the resulting nonterminal symbol. Perform the
- * semantic action associated with RULE and store its value with the
- * newly pushed state, if FORCEEVAL or if STACK is currently
- * unambiguous. Otherwise, store the deferred semantic action with
- * the new state. If the new state would have an identical input
- * position, LR state, and predecessor to an existing state on the stack,
- * it is identified with that existing state, eliminating stack #K from
- * the STACK. In this case, the (necessarily deferred) semantic value is
- * added to the options for the existing state's semantic value.
- */
-static inline YYRESULTTAG
-yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
- yybool yyforceEval)
-{
- size_t yyposn = yystack->yytops.yystates[yyk]->yyposn;
-
- if (yyforceEval || yystack->yysplitPoint == NULL)
- {
- YYSTYPE yysval;
- YYLTYPE yyloc;
-
- YY_REDUCE_PRINT (yyk, yyrule);
- YYCHK (yydoAction (yystack, yyk, yyrule, &yysval, &yyloc));
- yyglrShift (yystack, yyk,
- yyLRgotoState (yystack->yytops.yystates[yyk]->yylrState,
- yylhsNonterm (yyrule)),
- yyposn, yysval, &yyloc);
- }
- else
- {
- size_t yyi;
- int yyn;
- yyGLRState* yys, *yys0 = yystack->yytops.yystates[yyk];
- yyStateNum yynewLRState;
-
- for (yys = yystack->yytops.yystates[yyk], yyn = yyrhsLength (yyrule);
- 0 < yyn; yyn -= 1)
- {
- yys = yys->yypred;
- YYASSERT (yys);
- }
- yyupdateSplit (yystack, yys);
- yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
- YYDPRINTF ((stderr,
- "Reduced stack %lu by rule #%d; action deferred. Now in state %d.\n",
- (unsigned long int) yyk, yyrule - 1, yynewLRState));
- for (yyi = 0; yyi < yystack->yytops.yysize; yyi += 1)
- if (yyi != yyk && yystack->yytops.yystates[yyi] != NULL)
- {
- yyGLRState* yyp, *yysplit = yystack->yysplitPoint;
- yyp = yystack->yytops.yystates[yyi];
- while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn)
- {
- if (yyp->yylrState == yynewLRState && yyp->yypred == yys)
- {
- yyaddDeferredAction (yystack, yyp, yys0, yyrule);
- yymarkStackDeleted (yystack, yyk);
- YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
- (unsigned long int) yyk,
- (unsigned long int) yyi));
- return yyok;
- }
- yyp = yyp->yypred;
- }
- }
- yystack->yytops.yystates[yyk] = yys;
- yyglrShiftDefer (yystack, yyk, yynewLRState, yyposn, yys0, yyrule);
- }
- return yyok;
-}
-
-static int
-yysplitStack (yyGLRStack* yystack, int yyk)
-{
- if (yystack->yysplitPoint == NULL)
- {
- YYASSERT (yyk == 0);
- yystack->yysplitPoint = yystack->yytops.yystates[yyk];
- }
- if (yystack->yytops.yysize >= yystack->yytops.yycapacity)
- {
- yystack->yytops.yycapacity *= 2;
- yystack->yytops.yystates =
- (yyGLRState**) YYREALLOC (yystack->yytops.yystates,
- (yystack->yytops.yycapacity
- * sizeof yystack->yytops.yystates[0]));
- }
- yystack->yytops.yystates[yystack->yytops.yysize]
- = yystack->yytops.yystates[yyk];
- yystack->yytops.yysize += 1;
- return yystack->yytops.yysize-1;
-}
-
-/** True iff Y0 and Y1 represent identical options at the top level.
- * That is, they represent the same rule applied to RHS symbols
- * that produce the same terminal symbols. */
-static yybool
-yyidenticalOptions (yySemanticOption* yyy0, yySemanticOption* yyy1)
-{
- if (yyy0->yyrule == yyy1->yyrule)
- {
- yyGLRState *yys0, *yys1;
- int yyn;
- for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
- yyn = yyrhsLength (yyy0->yyrule);
- yyn > 0;
- yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
- if (yys0->yyposn != yys1->yyposn)
- return yyfalse;
- return yytrue;
- }
- else
- return yyfalse;
-}
-
-/** Assuming identicalOptions (Y0,Y1), (destructively) merge the
- * alternative semantic values for the RHS-symbols of Y1 into the
- * corresponding semantic value sets of the symbols of Y0. */
-static void
-yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
-{
- yyGLRState *yys0, *yys1;
- int yyn;
- for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
- yyn = yyrhsLength (yyy0->yyrule);
- yyn > 0;
- yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
- if (yys0 == yys1)
- break;
- else if (! yys0->yyresolved && ! yys1->yyresolved)
- {
- yySemanticOption* yyz;
- for (yyz = yys0->yysemantics.yyfirstVal; yyz->yynext != NULL;
- yyz = yyz->yynext)
- continue;
- yyz->yynext = yys1->yysemantics.yyfirstVal;
- }
-}
-
-/** Y0 and Y1 represent two possible actions to take in a given
- * parsing state; return 0 if no combination is possible,
- * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */
-static int
-yypreference (yySemanticOption* y0, yySemanticOption* y1)
-{
- yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule;
- int p0 = yydprec[r0], p1 = yydprec[r1];
-
- if (p0 == p1)
- {
- if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1])
- return 0;
- else
- return 1;
- }
- if (p0 == 0 || p1 == 0)
- return 0;
- if (p0 < p1)
- return 3;
- if (p1 < p0)
- return 2;
- return 0;
-}
-
-static YYRESULTTAG yyresolveValue (yySemanticOption* yyoptionList,
- yyGLRStack* yystack, YYSTYPE* yyvalp,
- YYLTYPE* yylocp);
-
-static YYRESULTTAG
-yyresolveStates (yyGLRState* yys, int yyn, yyGLRStack* yystack)
-{
- YYRESULTTAG yyflag;
- if (0 < yyn)
- {
- YYASSERT (yys->yypred);
- yyflag = yyresolveStates (yys->yypred, yyn-1, yystack);
- if (yyflag != yyok)
- return yyflag;
- if (! yys->yyresolved)
- {
- yyflag = yyresolveValue (yys->yysemantics.yyfirstVal, yystack,
- &yys->yysemantics.yysval, &yys->yyloc
- );
- if (yyflag != yyok)
- return yyflag;
- yys->yyresolved = yytrue;
- }
- }
- return yyok;
-}
-
-static YYRESULTTAG
-yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystack,
- YYSTYPE* yyvalp, YYLTYPE* yylocp)
-{
- yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
- int yynrhs;
-
- yynrhs = yyrhsLength (yyopt->yyrule);
- YYCHK (yyresolveStates (yyopt->yystate, yynrhs, yystack));
- yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;
- return yyuserAction (yyopt->yyrule, yynrhs,
- yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
- yyvalp, yylocp, yystack);
-}
-
-#if YYDEBUG
-static void
-yyreportTree (yySemanticOption* yyx, int yyindent)
-{
- int yynrhs = yyrhsLength (yyx->yyrule);
- int yyi;
- yyGLRState* yys;
- yyGLRState* yystates[YYMAXRHS];
- yyGLRState yyleftmost_state;
-
- for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
- yystates[yyi] = yys;
- if (yys == NULL)
- {
- yyleftmost_state.yyposn = 0;
- yystates[0] = &yyleftmost_state;
- }
- else
- yystates[0] = yys;
-
- if (yyx->yystate->yyposn < yys->yyposn + 1)
- YYFPRINTF (stderr, "%*s%s -> <Rule %d, empty>\n",
- yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
- yyx->yyrule);
- else
- YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
- yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
- yyx->yyrule, (unsigned long int) (yys->yyposn + 1),
- (unsigned long int) yyx->yystate->yyposn);
- for (yyi = 1; yyi <= yynrhs; yyi += 1)
- {
- if (yystates[yyi]->yyresolved)
- {
- if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
- YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
- yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]));
- else
- YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
- yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]),
- (unsigned long int) (yystates[yyi - 1]->yyposn + 1),
- (unsigned long int) yystates[yyi]->yyposn);
- }
- else
- yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
- }
-}
-#endif
-
-static void
-yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
- yyGLRStack* yystack)
-{
- /* `Unused' warnings. */
- (void) yyx0;
- (void) yyx1;
-
-#if YYDEBUG
- YYFPRINTF (stderr, "Ambiguity detected.\n");
- YYFPRINTF (stderr, "Option 1,\n");
- yyreportTree (yyx0, 2);
- YYFPRINTF (stderr, "\nOption 2,\n");
- yyreportTree (yyx1, 2);
- YYFPRINTF (stderr, "\n");
-#endif
- yyFail (yystack, "ambiguity detected");
-}
-
-
-/** Resolve the ambiguity represented by OPTIONLIST, perform the indicated
- * actions, and return the result. */
-static YYRESULTTAG
-yyresolveValue (yySemanticOption* yyoptionList, yyGLRStack* yystack,
- YYSTYPE* yyvalp, YYLTYPE* yylocp)
-{
- yySemanticOption* yybest;
- yySemanticOption* yyp;
- int yymerge;
-
- yybest = yyoptionList;
- yymerge = 0;
- for (yyp = yyoptionList->yynext; yyp != NULL; yyp = yyp->yynext)
- {
- if (yyidenticalOptions (yybest, yyp))
- yymergeOptionSets (yybest, yyp);
- else
- switch (yypreference (yybest, yyp))
- {
- case 0:
- yyreportAmbiguity (yybest, yyp, yystack);
- break;
- case 1:
- yymerge = 1;
- break;
- case 2:
- break;
- case 3:
- yybest = yyp;
- yymerge = 0;
- break;
- }
- }
-
- if (yymerge)
- {
- int yyprec = yydprec[yybest->yyrule];
- YYCHK (yyresolveAction (yybest, yystack, yyvalp, yylocp));
- for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext)
- {
- if (yyprec == yydprec[yyp->yyrule])
- {
- YYSTYPE yyval1;
- YYLTYPE yydummy;
- YYCHK (yyresolveAction (yyp, yystack, &yyval1, &yydummy));
- yyuserMerge (yymerger[yyp->yyrule], yyvalp, &yyval1);
- }
- }
- return yyok;
- }
- else
- return yyresolveAction (yybest, yystack, yyvalp, yylocp);
-}
-
-static YYRESULTTAG
-yyresolveStack (yyGLRStack* yystack)
-{
- if (yystack->yysplitPoint != NULL)
- {
- yyGLRState* yys;
- int yyn;
-
- for (yyn = 0, yys = yystack->yytops.yystates[0];
- yys != yystack->yysplitPoint;
- yys = yys->yypred, yyn += 1)
- continue;
- YYCHK (yyresolveStates (yystack->yytops.yystates[0], yyn, yystack
- ));
- }
- return yyok;
-}
-
-static void
-yycompressStack (yyGLRStack* yystack)
-{
- yyGLRState* yyp, *yyq, *yyr;
-
- if (yystack->yytops.yysize != 1 || yystack->yysplitPoint == NULL)
- return;
-
- for (yyp = yystack->yytops.yystates[0], yyq = yyp->yypred, yyr = NULL;
- yyp != yystack->yysplitPoint;
- yyr = yyp, yyp = yyq, yyq = yyp->yypred)
- yyp->yypred = yyr;
-
- yystack->yyspaceLeft += yystack->yynextFree - yystack->yyitems;
- yystack->yynextFree = ((yyGLRStackItem*) yystack->yysplitPoint) + 1;
- yystack->yyspaceLeft -= yystack->yynextFree - yystack->yyitems;
- yystack->yysplitPoint = NULL;
- yystack->yylastDeleted = NULL;
-
- while (yyr != NULL)
- {
- yystack->yynextFree->yystate = *yyr;
- yyr = yyr->yypred;
- yystack->yynextFree->yystate.yypred = & yystack->yynextFree[-1].yystate;
- yystack->yytops.yystates[0] = &yystack->yynextFree->yystate;
- yystack->yynextFree += 1;
- yystack->yyspaceLeft -= 1;
- }
-}
-
-static YYRESULTTAG
-yyprocessOneStack (yyGLRStack* yystack, int yyk,
- size_t yyposn, YYSTYPE* yylvalp, YYLTYPE* yyllocp
- )
-{
- int yyaction;
- const short int* yyconflicts;
- yyRuleNum yyrule;
- yySymbol* const yytokenp = yystack->yytokenp;
-
- while (yystack->yytops.yystates[yyk] != NULL)
- {
- yyStateNum yystate = yystack->yytops.yystates[yyk]->yylrState;
- YYDPRINTF ((stderr, "Stack %d Entering state %d\n", yyk, yystate));
-
- YYASSERT (yystate != YYFINAL);
-
- if (yyisDefaultedState (yystate))
- {
- yyrule = yydefaultAction (yystate);
- if (yyrule == 0)
- {
- YYDPRINTF ((stderr, "Stack %d dies.\n", yyk));
- yymarkStackDeleted (yystack, yyk);
- return yyok;
- }
- YYCHK (yyglrReduce (yystack, yyk, yyrule, yyfalse));
- }
- else
- {
- if (*yytokenp == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- *yytokenp = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", *yytokenp, yylvalp, yyllocp);
- }
- yygetLRActions (yystate, *yytokenp, &yyaction, &yyconflicts);
-
- while (*yyconflicts != 0)
- {
- int yynewStack = yysplitStack (yystack, yyk);
- YYDPRINTF ((stderr, "Splitting off stack %d from %d.\n",
- yynewStack, yyk));
- YYCHK (yyglrReduce (yystack, yynewStack,
- *yyconflicts, yyfalse));
- YYCHK (yyprocessOneStack (yystack, yynewStack, yyposn,
- yylvalp, yyllocp));
- yyconflicts += 1;
- }
-
- if (yyisShiftAction (yyaction))
- {
- YYDPRINTF ((stderr, "On stack %d, ", yyk));
- YY_SYMBOL_PRINT ("shifting", *yytokenp, yylvalp, yyllocp);
- yyglrShift (yystack, yyk, yyaction, yyposn+1,
- *yylvalp, yyllocp);
- YYDPRINTF ((stderr, ", now in state #%d\n",
- yystack->yytops.yystates[yyk]->yylrState));
- break;
- }
- else if (yyisErrorAction (yyaction))
- {
- YYDPRINTF ((stderr, "Stack %d dies.\n", yyk));
- yymarkStackDeleted (yystack, yyk);
- break;
- }
- else
- YYCHK (yyglrReduce (yystack, yyk, -yyaction, yyfalse));
- }
- }
- return yyok;
-}
-
-static void
-yyreportSyntaxError (yyGLRStack* yystack,
- YYSTYPE* yylvalp, YYLTYPE* yyllocp)
-{
- /* `Unused' warnings. */
- (void) yylvalp;
- (void) yyllocp;
-
- if (yystack->yyerrState == 0)
- {
-#if YYERROR_VERBOSE
- yySymbol* const yytokenp = yystack->yytokenp;
- int yyn;
- yyn = yypact[yystack->yytops.yystates[0]->yylrState];
- if (YYPACT_NINF < yyn && yyn < YYLAST)
- {
- size_t yysize = 0;
- const char* yyprefix;
- char* yymsg;
- int yyx;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 0;
-
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yysize += strlen (yyprefix) + strlen (yytokenName (yyx));
- yycount += 1;
- if (yycount == 5)
- {
- yysize = 0;
- break;
- }
- yyprefix = " or ";
- }
- yysize += (sizeof ("syntax error, unexpected ")
- + strlen (yytokenName (*yytokenp)));
- yymsg = (char*) YYMALLOC (yysize);
- if (yymsg != 0)
- {
- char* yyp = yymsg;
- sprintf (yyp, "syntax error%s%s",
- (*yytokenp == YYEMPTY ? "" : ", unexpected "),
- yytokenName (*yytokenp));
- yyp += strlen (yyp);
- if (yycount < 5)
- {
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx));
- yyp += strlen (yyp);
- yyprefix = " or ";
- }
- }
- yyerror (yymsg);
- YYFREE (yymsg);
- }
- else
- yyerror ("syntax error; also virtual memory exhausted");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
- yynerrs += 1;
- }
-}
-
-/* Recover from a syntax error on YYSTACK, assuming that YYTOKENP,
- YYLVALP, and YYLLOCP point to the syntactic category, semantic
- value, and location of the look-ahead. */
-static void
-yyrecoverSyntaxError (yyGLRStack* yystack,
- YYSTYPE* yylvalp,
- YYLTYPE* yyllocp ATTRIBUTE_UNUSED
- )
-{
- yySymbol* const yytokenp = yystack->yytokenp;
- size_t yyk;
- int yyj;
-
- if (yystack->yyerrState == 3)
- /* We just shifted the error token and (perhaps) took some
- reductions. Skip tokens until we can proceed. */
- while (yytrue)
- {
- if (*yytokenp == YYEOF)
- {
- /* Now pop stack until empty and fail. */
- while (yystack->yytops.yystates[0] != NULL)
- {
- yyGLRState *yys = yystack->yytops.yystates[0];
-
- yydestruct ("Error: popping",
- yystos[yys->yylrState],
- &yys->yysemantics.yysval);
- yystack->yytops.yystates[0] = yys->yypred;
- yystack->yynextFree -= 1;
- yystack->yyspaceLeft += 1;
- }
- yyFail (yystack, NULL);
- }
- if (*yytokenp != YYEMPTY)
- {
- yydestruct ("Error: discarding",
- *yytokenp, yylvalp);
- }
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- *yytokenp = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", *yytokenp, yylvalp, yyllocp);
- yyj = yypact[yystack->yytops.yystates[0]->yylrState];
- if (yyis_pact_ninf (yyj))
- return;
- yyj += *yytokenp;
- if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != *yytokenp)
- {
- if (yydefact[yystack->yytops.yystates[0]->yylrState] != 0)
- return;
- }
- else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj]))
- return;
- }
-
- /* Reduce to one stack. */
- for (yyk = 0; yyk < yystack->yytops.yysize; yyk += 1)
- if (yystack->yytops.yystates[yyk] != NULL)
- break;
- if (yyk >= yystack->yytops.yysize)
- yyFail (yystack, NULL);
- for (yyk += 1; yyk < yystack->yytops.yysize; yyk += 1)
- yymarkStackDeleted (yystack, yyk);
- yyremoveDeletes (yystack);
- yycompressStack (yystack);
-
- /* Now pop stack until we find a state that shifts the error token. */
- yystack->yyerrState = 3;
- while (yystack->yytops.yystates[0] != NULL)
- {
- yyGLRState *yys = yystack->yytops.yystates[0];
- yyj = yypact[yys->yylrState];
- if (! yyis_pact_ninf (yyj))
- {
- yyj += YYTERROR;
- if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
- && yyisShiftAction (yytable[yyj]))
- {
- /* Shift the error token having adjusted its location. */
- YYLTYPE yyerrloc;
- YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
- yylvalp, &yyerrloc);
- yyglrShift (yystack, 0, yytable[yyj],
- yys->yyposn, *yylvalp, &yyerrloc);
- yys = yystack->yytops.yystates[0];
- break;
- }
- }
-
- yydestruct ("Error: popping",
- yystos[yys->yylrState],
- &yys->yysemantics.yysval);
- yystack->yytops.yystates[0] = yys->yypred;
- yystack->yynextFree -= 1;
- yystack->yyspaceLeft += 1;
- }
- if (yystack->yytops.yystates[0] == NULL)
- yyFail (yystack, NULL);
-}
-
-#define YYCHK1(YYE) \
- do { \
- switch (YYE) { \
- default: \
- break; \
- case yyabort: \
- yystack.yyerrflag = 1; \
- goto yyDone; \
- case yyaccept: \
- yystack.yyerrflag = 0; \
- goto yyDone; \
- case yyerr: \
- goto yyuser_error; \
- } \
- } while (0)
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-int
-yyparse (void)
-{
- yySymbol yytoken;
- yyGLRStack yystack;
- size_t yyposn;
-
-
- YYSTYPE* const yylvalp = &yylval;
- YYLTYPE* const yyllocp = &yylloc;
-
- yyinitGLRStack (&yystack, YYINITDEPTH);
- yystack.yytokenp = &yytoken;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- if (setjmp (yystack.yyexception_buffer) != 0)
- goto yyDone;
-
- yylval = yyval_default;
-
-
- yyglrShift (&yystack, 0, 0, 0, yylval, &yylloc);
- yytoken = YYEMPTY;
- yyposn = 0;
-
- while (yytrue)
- {
- /* For efficiency, we have two loops, the first of which is
- specialized to deterministic operation (single stack, no
- potential ambiguity). */
- /* Standard mode */
- while (yytrue)
- {
- yyRuleNum yyrule;
- int yyaction;
- const short int* yyconflicts;
-
- yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
- if (yystate == YYFINAL)
- goto yyDone;
- if (yyisDefaultedState (yystate))
- {
- yyrule = yydefaultAction (yystate);
- if (yyrule == 0)
- {
-
- yyreportSyntaxError (&yystack, yylvalp, yyllocp);
- goto yyuser_error;
- }
- YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue));
- }
- else
- {
- if (yytoken == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, yylvalp, yyllocp);
- }
- yygetLRActions (yystate, yytoken, &yyaction, &yyconflicts);
- if (*yyconflicts != 0)
- break;
- if (yyisShiftAction (yyaction))
- {
- YY_SYMBOL_PRINT ("Shifting", yytoken, yylvalp, yyllocp);
- if (yytoken != YYEOF)
- yytoken = YYEMPTY;
- yyposn += 1;
- yyglrShift (&yystack, 0, yyaction, yyposn,
- yylval, yyllocp);
- if (0 < yystack.yyerrState)
- yystack.yyerrState -= 1;
- }
- else if (yyisErrorAction (yyaction))
- {
-
- yyreportSyntaxError (&yystack, yylvalp, yyllocp);
- goto yyuser_error;
- }
- else
- YYCHK1 (yyglrReduce (&yystack, 0, -yyaction, yytrue));
- }
- }
-
- while (yytrue)
- {
- int yys;
- int yyn = yystack.yytops.yysize;
- for (yys = 0; yys < yyn; yys += 1)
- YYCHK1 (yyprocessOneStack (&yystack, yys, yyposn,
- yylvalp, yyllocp));
- yytoken = YYEMPTY;
- yyposn += 1;
- yyremoveDeletes (&yystack);
- if (yystack.yytops.yysize == 0)
- {
- yyundeleteLastStack (&yystack);
- if (yystack.yytops.yysize == 0)
- yyFail (&yystack, "syntax error");
- YYCHK1 (yyresolveStack (&yystack));
- YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
-
- yyreportSyntaxError (&yystack, yylvalp, yyllocp);
- goto yyuser_error;
- }
- else if (yystack.yytops.yysize == 1)
- {
- YYCHK1 (yyresolveStack (&yystack));
- YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
- yycompressStack (&yystack);
- break;
- }
- }
- continue;
- yyuser_error:
- yyrecoverSyntaxError (&yystack, yylvalp, yyllocp);
- yyposn = yystack.yytops.yystates[0]->yyposn;
- }
- yyDone:
- /* On YYABORT, free the lookahead. */
- if (yystack.yyerrflag == 1 && yytoken != YYEMPTY)
- yydestruct ("Error: discarding lookahead",
- yytoken, yylvalp);
-
- yyfreeGLRStack (&yystack);
- return yystack.yyerrflag;
-}
-
-/* DEBUGGING ONLY */
-#ifdef YYDEBUG
-static void yypstack (yyGLRStack* yystack, int yyk) ATTRIBUTE_UNUSED;
-static void yypdumpstack (yyGLRStack* yystack) ATTRIBUTE_UNUSED;
-
-static void
-yy_yypstack (yyGLRState* yys)
-{
- if (yys->yypred)
- {
- yy_yypstack (yys->yypred);
- fprintf (stderr, " -> ");
- }
- fprintf (stderr, "%d@%lu", yys->yylrState, (unsigned long int) yys->yyposn);
-}
-
-static void
-yypstates (yyGLRState* yyst)
-{
- if (yyst == NULL)
- fprintf (stderr, "<null>");
- else
- yy_yypstack (yyst);
- fprintf (stderr, "\n");
-}
-
-static void
-yypstack (yyGLRStack* yystack, int yyk)
-{
- yypstates (yystack->yytops.yystates[yyk]);
-}
-
-#define YYINDEX(YYX) \
- ((YYX) == NULL ? -1 : (yyGLRStackItem*) (YYX) - yystack->yyitems)
-
-
-static void
-yypdumpstack (yyGLRStack* yystack)
-{
- yyGLRStackItem* yyp;
- size_t yyi;
- for (yyp = yystack->yyitems; yyp < yystack->yynextFree; yyp += 1)
- {
- fprintf (stderr, "%3lu. ", (unsigned long int) (yyp - yystack->yyitems));
- if (*(yybool *) yyp)
- {
- fprintf (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
- yyp->yystate.yyresolved, yyp->yystate.yylrState,
- (unsigned long int) yyp->yystate.yyposn,
- (long int) YYINDEX (yyp->yystate.yypred));
- if (! yyp->yystate.yyresolved)
- fprintf (stderr, ", firstVal: %ld",
- (long int) YYINDEX (yyp->yystate.yysemantics.yyfirstVal));
- }
- else
- {
- fprintf (stderr, "Option. rule: %d, state: %ld, next: %ld",
- yyp->yyoption.yyrule,
- (long int) YYINDEX (yyp->yyoption.yystate),
- (long int) YYINDEX (yyp->yyoption.yynext));
- }
- fprintf (stderr, "\n");
- }
- fprintf (stderr, "Tops:");
- for (yyi = 0; yyi < yystack->yytops.yysize; yyi += 1)
- fprintf (stderr, "%lu: %ld; ", (unsigned long int) yyi,
- (long int) YYINDEX (yystack->yytops.yystates[yyi]));
- fprintf (stderr, "\n");
-}
-#endif
-
-
-#line 77 "idx.y"
-
-
diff --git a/funtools/filter/idx.tab.h b/funtools/filter/idx.tab.h
deleted file mode 100644
index 00ac7cd..0000000
--- a/funtools/filter/idx.tab.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.0. */
-
-/* Skeleton parser for GLR parsing with Bison,
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- NUM = 258,
- COL = 259,
- FUNC = 260,
- REG = 261,
- INDEF = 262,
- OR = 263,
- AND = 264,
- NE = 265,
- EQ = 266,
- GE = 267,
- LE = 268,
- UMINUS = 269
- };
-#endif
-#define NUM 258
-#define COL 259
-#define FUNC 260
-#define REG 261
-#define INDEF 262
-#define OR 263
-#define AND 264
-#define NE 265
-#define EQ 266
-#define GE 267
-#define LE 268
-#define UMINUS 269
-
-
-
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 6 "idx.y"
-typedef union YYSTYPE {
- idxrowrec *row;
- idxvalrec *val;
-} YYSTYPE;
-/* Line 2089 of glr.c. */
-#line 65 "idx.tab.h"
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-extern YYSTYPE idxlval;
-
-#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
-typedef struct YYLTYPE
-{
-
- char yydummy;
-
-} YYLTYPE;
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-
diff --git a/funtools/filter/idx.y b/funtools/filter/idx.y
deleted file mode 100644
index 1846fec..0000000
--- a/funtools/filter/idx.y
+++ /dev/null
@@ -1,77 +0,0 @@
-%{
-#include <idx.h>
-#include <idx.tab.h>
-%}
-
-%union{
- idxrowrec *row;
- idxvalrec *val;
-}
-
-%token <val> NUM
-%token <val> COL
-%token <val> FUNC
-%token <val> REG
-%token <val> INDEF
-
-%left OR
-%left AND
-%left '|'
-%left '^'
-%left '&'
-%nonassoc EQ NE
-%nonassoc '<' LE '>' GE
-%left '+' '-'
-%left '*' '/' '%'
-%right '!' '~' UMINUS
-
-%type <row> idx
-%type <row> expr
-%type <row> rowlist
-%type <val> value
-
-%glr-parser
-%expect-rr 1
-
-%%
-
-/* combines lists of row numbers */
-idx: expr { idxall($1); }
-;
-
-expr: rowlist
-| expr OR expr { $$ = idxor($1,$3); }
-| expr AND expr { $$ = idxand($1,$3); }
-| '(' expr ')' { $$ = $2; }
-;
-
-/* generates lists of row numbers */
-rowlist:REG { $$ = idxrowreg($1); }
-| FUNC { $$ = idxrowfun($1); }
-| value EQ value { $$ = idxroweq($1,$3); }
-| value NE value { $$ = idxrowne($1,$3); }
-| value '<' value { $$ = idxrowlt($1,$3); }
-| value LE value { $$ = idxrowle($1,$3); }
-| value '>' value { $$ = idxrowgt($1,$3); }
-| value GE value { $$ = idxrowge($1,$3); }
-;
-
-value: NUM
-| COL
-| INDEF
-| FUNC
-| value '+' value { $$ = idxvaladd($1,$3); }
-| value '-' value { $$ = idxvalsub($1,$3); }
-| value '*' value { $$ = idxvalmul($1,$3); }
-| value '/' value { $$ = idxvaldiv($1,$3); }
-| value '%' value { $$ = idxvalmod($1,$3); }
-| value '&' value { $$ = idxvaland($1,$3); }
-| value '|' value { $$ = idxvalor($1,$3); }
-| value '^' value { $$ = idxvalxor($1,$3); }
-| '!' value { $$ = idxvalnot($2); }
-| '~' value { $$ = idxvalcom($2); }
-| '-' value %prec UMINUS { $$ = idxvalmin($2); }
-| '(' value ')' { $$ = $2; }
-;
-
-%%
diff --git a/funtools/filter/idxacts.c b/funtools/filter/idxacts.c
deleted file mode 100644
index 4989267..0000000
--- a/funtools/filter/idxacts.c
+++ /dev/null
@@ -1,2368 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * idxacts.c -- action routines for idx
- *
- */
-
-#include <filter.h>
-#include <idx.h>
-#include <idx.tab.h>
-
-#if HAVE_LONG_LONG
-#define LFMT "%lld"
-#else
-#define LFMT "%ld"
-#endif
-
-#define IDX_DEBUG 1
-#if IDX_DEBUG
-#define IPRINTF(x) if( idx_debug ) fprintf x
-#else
-#define IPRINTF(x)
-#endif
-
-/* used by idx.l, so it must be global */
-int idx_debug=0;
-
-/*
- *
- * private routines
- *
- */
-
-#define MAXD 3
-static char dbuf[MAXD][SZ_LINE];
-static int nd=0;
-
-static char _swapped[8];
-static int idx_io=IDX_IO_DEFAULT;
-
-static char *idxcolname=NULL;
-static char *idxfilename=NULL;
-static char *idxfileroot1=NULL;
-static char *idxfileroot2=NULL;
-static char *idxpath=NULL;
-static char *idxsort=NULL;
-
-static char fmt[SZ_LINE];
-
-#ifdef ANSI_FUNC
-static void *
-_swap(void *ibuf, int isize)
-#else
-static void *_swap(ibuf, isize)
- void *ibuf;
- int isize;
-#endif
-{
- return ft_dataswap(_swapped, ibuf, isize, isize*8);
-}
-
-#if IDX_DEBUG
-#ifdef ANSI_FUNC
-static char *
-rowdisp(idxrowrec *row)
-#else
-static char *rowdisp(row)
- idxrowrec *row;
-#endif
-{
- int i;
- char tbuf[SZ_LINE];
-
- if( nd >= MAXD ) nd = 0;
- *dbuf[nd] = '\0';
- switch(row->rtype){
- case IDX_ROW_LIST:
- if( row->s ){
- snprintf(dbuf[nd], SZ_LINE-1, "%s[ROW", row->s);
- }
- else{
- snprintf(dbuf[nd], SZ_LINE-1, "[ROW");
- }
- for(i=0; i<row->nrow; i++){
- strncat(dbuf[nd], " ", SZ_LINE-1);
- snprintf(tbuf, SZ_LINE-1, "%d:%d", row->startrow[i], row->stoprow[i]);
- strncat(dbuf[nd], tbuf, SZ_LINE-1);
- }
- strncat(dbuf[nd], "]", SZ_LINE-1);
- break;
- case IDX_SORT:
- snprintf(dbuf[nd], SZ_LINE-1, "[IDX_SORT]");
- break;
- case IDX_OR_SORT:
- snprintf(dbuf[nd], SZ_LINE-1, "[IDX_OR_SORT]");
- break;
- case IDX_AND_SORT:
- snprintf(dbuf[nd], SZ_LINE-1, "[IDX_AND_SORT]");
- break;
- case IDX_INDEF:
- snprintf(dbuf[nd], SZ_LINE-1, "[INDEF]");
- break;
- }
- if( !*dbuf[nd] ){
- snprintf(dbuf[nd], SZ_LINE-1, "type=%d?", row->rtype);
- }
- return dbuf[nd++];
-}
-#endif
-
-#ifdef ANSI_FUNC
-static int
-_idxvalfree(idxvalrec *v)
-#else
-static int _idxvalfree(v)
- idxvalrec *v;
-#endif
-{
- if( !v ) return 0;
- if( v->s ) xfree(v->s);
-#ifdef HAVE_SYS_MMAN_H
- if( v->idata ) munmap(v->idata, v->ilen);
-#endif
- /* these are linked (i.e. if iname does not exist, its a copy of another */
- if( v->iname && v->igio && v->ifits ){
- gclose(v->igio);
- xfree(v->iname);
- ft_headfree(v->ifits, 1);
- }
- xfree(v);
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static int
-_idxrowfree(idxrowrec *r)
-#else
-static int _idxrowfree(r)
- idxrowrec *r;
-#endif
-{
- int tries=0;
- int exit_status;
-
- if( !r ) return 0;
- if( r->s ) xfree(r->s);
- if( r->startrow ) xfree(r->startrow);
- if( r->stoprow ) xfree(r->stoprow);
- if( r->ifile )
- fclose(r->ifile);
- else if( r->ichan )
- close(r->ichan);
- if( r->ochan )
- close(r->ochan);
-#if HAVE_MINGW32==0
- if( r->pid ){
- while( (waitpid(r->pid, &exit_status, WNOHANG)==0) && (tries<10) ){
- gsleep(10);
- tries++;
- }
- r->pid = 0;
- }
-#endif
- if( r->fdata ){
-#ifdef HAVE_SYS_MMAN_H
- munmap(r->fdata, r->flen);
-#endif
- }
- xfree(r);
- return 1;
-}
-
-
-#ifdef ANSI_FUNC
-static int
-_idxstartsort(int type, int *ichan, int *ochan, int *pid)
-#else
-static int _idxstartsort(type, ichan, ochan, pid)
- int type;
- int *ichan;
- int *ochan;
- int *pid;
-#endif
-{
- char *s;
- char cmd[SZ_LINE];
-
- if( !idxsort ){
- if( idxpath ) return 0;
- if( (s=(char *)getenv("PATH")) ){
- idxpath = xstrdup(s);
- }
- if( !(idxsort=Find(IDX_SORTPROG, "x", NULL, idxpath)) &&
- !(idxsort=Find(IDX_SORTPROG, "x", NULL, ".")) ){
- idxerror("index sort program cannot be found");
- return 0;
- }
- }
- /* construct command line for sort program */
- switch(type){
- case IDX_SORT:
- snprintf(cmd, SZ_LINE-1, "%s -B4 +i0", idxsort);
- break;
- case IDX_OR_SORT:
- snprintf(cmd, SZ_LINE-1, "%s -B4 +i0 -u", idxsort);
- break;
- case IDX_AND_SORT:
- snprintf(cmd, SZ_LINE-1, "%s -B4 +i0 -D", idxsort);
- break;
- default:
- snprintf(cmd, SZ_LINE-1, "%s -B4 +i0", idxsort);
- break;
- }
- /* start the sort program */
- if( !ProcessOpen(cmd, ichan, ochan, pid) ){
- idxerror("index sort process cannot be started");
- return 0;
- }
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static int
-_idxwritesort(idxrowrec *x, idxrowrec *row)
-#else
-static int _idxwritesort(x, row)
- idxrowrec *x;
- idxrowrec *row;
-#endif
-{
- int i, j, k=0;
- int rowsize;
- int ioffset;
- int itype;
- int isize;
- int obuf[SZ_LINE];
- long ipos;
- char nbuf[8];
- idxvalrec *v=NULL;
-
- v = row->v;
- rowsize = ft_naxis(v->ifits, 1);
- ioffset = v->ioffset;
- itype = v->itype;
- isize = ft_sizeof(v->itype);
- for(i=0; i<row->nrow; i++){
- for(j=row->startrow[i]; j<=row->stoprow[i]; j++){
- ipos = v->ifits->data + ((j-1)*rowsize) + ioffset;
- switch( idx_io ){
- case IDX_IO_MMAP:
- if( v->idata ){
-#ifdef HAVE_SYS_MMAN_H
- memcpy(nbuf, &v->idata[ipos], isize);
-#else
- idxerror("mmap not supported on this system");
-#endif
- break;
- }
- case IDX_IO_LSEEK:
- if( gseek(v->igio, (off_t)ipos, 0) < 0 ){
- idxerror("can't lseek into index file");
- return 0;
- }
- if( !gread(v->igio, nbuf, isize, 1) ){
- idxerror("can't read index file");
- return 0;
- }
- break;
- }
- switch(itype){
- case 'B':
- obuf[k++] = (int)*(unsigned char *)(nbuf);
- break;
- case 'I':
- obuf[k++] = (int)*(short *)_swap(nbuf,2);
- break;
- case 'U':
- obuf[k++] = (int)*(unsigned short *)_swap(nbuf,2);
- break;
- case 'J':
- obuf[k++] = (int)*(int *)_swap(nbuf,4);
- break;
- case 'V':
- obuf[k++] = (int)*(unsigned int *)_swap(nbuf,4);
- break;
- case 'K':
- idxerror("64-bit integer not supported for index");
- break;
- default:
- idxerror("illegal index data type");
- }
- if( k == SZ_LINE ){
- if( write(x->ochan, obuf, k*sizeof(int)) != (int)(k*sizeof(int)) ){
- idxerror("can't write index value to sort");
- return 0;
- }
- k = 0;
- }
- }
- }
- if( k ){
- if( write(x->ochan, obuf, k*sizeof(int)) != (int)(k*sizeof(int)) ){
- idxerror("can't write index value to sort");
- return 0;
- }
- }
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static int
-_idxcompare(char *buf, int type, int offset, int n,
- double d, longlong l, int t)
-#else
-static int _idxcompare(buf, type, offset, n, d, l, t)
- char *buf;
- int type;
- int offset;
- int n;
- double d;
- longlong l;
- int t;
-#endif
-{
- unsigned short sval;
- unsigned int xval;
- int xn;
- double dval=0.0;
- longlong lval=0;
- int isint=0;
-
- switch(type){
- case 'X':
- isint = 1;
- if( n == 16 ){
- xn = 1;
- n = 1;
- }
- else if( n == 32 ){
- xn = 2;
- n = 1;
- }
- else if( n == 64 ){
- xn = 3;
- n = 1;
- }
- else{
- xn = 0;
- n = (n+7)/8;
- }
- switch(xn){
- case 1:
- memcpy(&sval, _swap(buf+offset,2), sizeof(unsigned short));
- dval = (double)sval;
- lval = (longlong)sval;
- break;
- case 2:
- memcpy(&xval, _swap(buf+offset,4), sizeof(unsigned int));
- dval = (double)xval;
- lval = (longlong)xval;
- break;
- case 3:
- memcpy(&lval, _swap(buf+offset,8), sizeof(unsigned int));
- dval = (double)lval;
- break;
- case 0:
- default:
- xval = (unsigned int)*(unsigned char *)(buf+offset);
- dval = (double)xval;
- lval = (longlong)xval;
- break;
- }
- case 'B':
- isint = 1;
- dval = (double)*(unsigned char *)(buf+offset);
- lval = (longlong)*(unsigned char *)(buf+offset);
- break;
- case 'I':
- isint = 1;
- dval = (double)*(short *)_swap(buf+offset,2);
- lval = (longlong)*(short *)_swap(buf+offset,2);
- break;
- case 'U':
- isint = 1;
- dval = (double)*(unsigned short *)_swap(buf+offset,2);
- lval = (longlong)*(unsigned short *)_swap(buf+offset,2);
- break;
- case 'J':
- isint = 1;
- dval = (double)*(int *)_swap(buf+offset,4);
- lval = (longlong)*(int *)_swap(buf+offset,4);
- break;
- case 'V':
- isint = 1;
- dval = (double)*(unsigned int *)_swap(buf+offset,4);
- lval = (longlong)*(unsigned int *)_swap(buf+offset,4);
- break;
- case 'K':
- isint = 1;
- dval = (double)*(longlong *)_swap(buf+offset,8);
- lval = (longlong)*(longlong *)_swap(buf+offset,8);
- break;
- case 'E':
- isint = 0;
- dval = (double)*(float *)_swap(buf+offset,4);
- lval = (longlong)*(float *)_swap(buf+offset,4);
- break;
- case 'D':
- isint = 0;
- dval = *(double *)_swap(buf+offset,8);
- lval = *(longlong *)_swap(buf+offset,8);
- break;
- case 'L':
- isint = 1;
- dval = (double)*(unsigned char *)(buf+offset);
- lval = (longlong)*(unsigned char *)(buf+offset);
- break;
- case 'A':
- default:
- gerror(stderr, "illegal numeric value for compare: %d\n", type);
- break;
- }
- if( t == PARSE_INTEGER ){
- if( isint ){
- if( lval < l )
- return -1;
- else if( lval > l )
- return 1;
- else
- return 0;
- }
- else{
- if( dval < l )
- return -1;
- else if( dval > l )
- return 1;
- else
- return 0;
- }
- }
- else{
- if( isint ){
- if( lval < d )
- return -1;
- else if( lval > d )
- return 1;
- else
- return 0;
- }
- else{
- if( dval < d )
- return -1;
- else if( dval > d )
- return 1;
- else
- return 0;
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static int
-_idxbsearch(GIO gio, FITSHead fits, int type, int offset, int n,
- int exact, int edge, double d, longlong l, int t)
-#else
-static int _idxbsearch(gio, fits, type, offset, n, exact, edge, d, l, t)
- GIO gio;
- FITSHead fits;
- int type;
- int offset;
- int n;
- int exact;
- int edge;
- double d;
- longlong l;
- int t;
-#endif
-{
- int high, low, try;
- int cmp;
- int rowsize;
- size_t got;
- long ipos;
- char *buf=NULL;
-
- /* sanity check */
- if( !gio || !fits ) return -1;
-
- /* set limits */
- low = 0;
- high = ft_naxis(fits, 2)+1;
- rowsize = ft_naxis(fits, 1);
- /* search */
- while( (high - low) > 1){
- try = (high + low) / 2;
- /* grab desired row in index */
- ipos = fits->data + ((try-1)*rowsize);
- if( gseek(gio, (off_t)ipos, 0) < 0 ) return -1;
- buf = _gread(gio, NULL, sizeof(char), rowsize, &got);
- if( !buf || (got != (size_t)rowsize) ) return -1;
- /* compare row to key value */
- cmp = _idxcompare(buf, type, offset, n, d, l, t);
- if( buf ) xfree(buf);
- switch(cmp){
- /* thisval < val */
- case -1:
- low = try;
- break;
- /* thisval == val */
- case 0:
- /* to find first record, set hi */
- if( edge == -1 )
- high = try;
- /* for last record, set lo */
- else
- low = try;
- break;
- /* thisval > val */
- case 1:
- high = try;
- break;
- }
- }
- /* check for out of bounds and get candidate row */
- if( edge == 1 ){
- if( low == 0 ) {
- if( exact )
- return -1;
- else
- return 0;
- }
- try = low;
- }
- else{
- if( high == (ft_naxis(fits, 2)+1) ){
- if( exact )
- return -1;
- else
- return ft_naxis(fits, 2)+1;;
- }
- try = high;
- }
- /* grab desired row in index */
- ipos = fits->data + ((try-1)*rowsize);
- if( gseek(gio, (off_t)ipos, 0) < 0 ) return -1;
- buf = _gread(gio, NULL, sizeof(char), rowsize, &got);
- if( !buf || (got != (size_t)rowsize) ) return -1;
- /* compare row to key value */
- cmp = _idxcompare(buf, type, offset, n, d, l, t);
- if( buf ) xfree(buf);
- /* if row == key value, we got a match */
- if( !cmp || !exact ){
- if( edge == 1 )
- return low;
- else
- return high;
- }
- else
- return -1;
-}
-
-#ifdef ANSI_FUNC
-static int
-_idxrowcommon(idxvalrec *val1, idxvalrec *val2, int exact, int which,
- idxrowrec **x, int *start, int *stop, int *nrow)
-#else
-static int _idxrowcommon(val1, val2, exact, which, x, start, stop, nrow)
- idxvalrec *val1, *val2;
- int exact;
- int which;
- idxrowrec **x;
- int *start, *stop;
- int *nrow
-#endif
-{
- idxvalrec *v1=NULL, *v2=NULL;
-
- *start = -1;
- *stop = -1;
- *nrow = -1;
- *x = idxrownew();
- if( (val1->type == COL) && (val2->type == NUM) ){
- v1 = val1;
- v2 = val2;
- }
- if( v1 && v2 ){
- (*x)->type = COL;
- (*x)->rtype = IDX_ROW_LIST;
- (*x)->dofilt = 0;
- (*x)->s = xstrdup(v1->s);
- (*x)->v = v1;
- *nrow = v1->nrow;
- if( which & IDX_EDGE_LEFT )
- *start = _idxbsearch(v1->igio, v1->ifits, v1->vtype, v1->voffset, v1->vn,
- exact, -1, v2->dval, v2->ival, v2->ntype);
- if( which & IDX_EDGE_RIGHT )
- *stop = _idxbsearch(v1->igio, v1->ifits, v1->vtype, v1->voffset, v1->vn,
- exact, 1, v2->dval, v2->ival, v2->ntype);
- return 1;
- }
- else{
- (*x)->type = IDX_INDEF;
- (*x)->rtype = IDX_INDEF;
- (*x)->dofilt = 1;
- return 0;
- }
-}
-
-#ifdef ANSI_FUNC
-static int
-_idxrowaddrow(idxrowrec *r, int start, int stop)
-#else
- static int _idxrowaddrow(r, start, stop)
- idxrowrec *r;
- int start;
- int stop;
-#endif
-{
- if( !r ) return 0;
- if( r->nrow >= r->maxrow ){
- r->maxrow += IDX_ROW_INC;
- r->startrow = xrealloc(r->startrow, r->maxrow*sizeof(int));
- r->stoprow = xrealloc(r->stoprow, r->maxrow*sizeof(int));
- }
- r->startrow[r->nrow] = start;
- r->stoprow[r->nrow] = stop;
- r->nrow++;
- return r->nrow;
-}
-
-#ifdef ANSI_FUNC
-static void
-idxrowmark(idxrowrec *row1, idxrowrec *row2, char **mbuf, int *nm)
-#else
-static void idxrowmark(row1, row2, mbuf, nm)
- idxrowrec *row1, *row2;
- char **mbuf;
- int *nm;
-#endif
-{
- int i, j;
-
- *nm=0;
- for(i=0; i<row1->nrow; i++){
- *nm = MAX(*nm, row1->stoprow[i]);
- }
- for(i=0; i<row2->nrow; i++){
- *nm = MAX(*nm, row2->stoprow[i]);
- }
- *nm += 1;
- if( !(*mbuf = xcalloc(*nm, sizeof(char))) ){
- idxerror("can't allocate memory for index");
- }
- for(i=0; i<row1->nrow; i++){
- for(j=row1->startrow[i]; j<=row1->stoprow[i]; j++){
- (*mbuf)[j-1] |= 1;
- }
- }
- for(i=0; i<row2->nrow; i++){
- for(j=row2->startrow[i]; j<=row2->stoprow[i]; j++){
- (*mbuf)[j-1] |= 2;
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static idxrowrec *
-_idxrowmerge(idxrowrec *x, idxrowrec *row1, idxrowrec *row2, int type)
-#else
-static idxrowrec *_idxrowmerge(x, row1, row2, type)
- idxrowrec *x;
- idxrowrec *row1;
- idxrowrec *row2
- int type;
-#endif
-{
- int last=-1;
- int in1=-1, in2=-1, on=0;
- int igot1=-1, igot2=-1;
- int fd[2];
- int ibuf1[SZ_LINE];
- int ibuf2[SZ_LINE];
- int obuf[SZ_LINE];
- FILE *ifd1, *ifd2, *ofd;
-
-#if HAVE_MINGW32==0
- /* we fork a process that will read the output from 2 instances of sort and
- either OR and AND the results. Doing this avoids having the main process
- read the output of the sorts and write to a new merge process */
- if( pipe(fd) < 0 ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- if( (x->pid = fork()) < 0 ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- } else if( x->pid != 0 ){ /* parent */
- IPRINTF((stderr, "idxmerge(%d): %s %s\n",
- type, rowdisp(row1), rowdisp(row2)));
- close(fd[1]);
- x->ichan = fd[0];
- close(row1->ichan); row1->ichan=0;
- close(row2->ichan); row2->ichan=0;
- return x;
- }
- else{ /* child */
- close(fd[0]);
- if( !(ifd1 = fdopen(row1->ichan, "r")) ||
- !(ifd2 = fdopen(row2->ichan, "r")) ||
- !(ofd = fdopen(fd[1], "w")) ){
- _exit(1);
- }
- while( 1 ){
- if( in1 == igot1 ){
- igot1 = fread(ibuf1, sizeof(int), SZ_LINE, ifd1);
- if( igot1 != 0 ){
- in1 = 0;
- }
- }
- if( in2 == igot2 ){
- igot2 = fread(ibuf2, sizeof(int), SZ_LINE, ifd2);
- if( igot2 != 0 ){
- in2 = 0;
- }
- }
- if( igot1 && igot2 ){
- if( ibuf1[in1] < ibuf2[in2] ){
- switch(type){
- case IDX_SORT:
- obuf[on++] = ibuf1[in1];
- break;
- case IDX_AND_SORT:
- if( ibuf1[in1] == last )
- obuf[on++] = ibuf1[in1];
- break;
- case IDX_OR_SORT:
- if( ibuf1[in1] != last )
- obuf[on++] = ibuf1[in1];
- break;
- }
- last = ibuf1[in1++];
- }
- else{
- switch(type){
- case IDX_SORT:
- obuf[on++] = ibuf2[in2];
- break;
- case IDX_AND_SORT:
- if( ibuf2[in2] == last )
- obuf[on++] = ibuf2[in2];
- break;
- case IDX_OR_SORT:
- if( ibuf2[in2] != last )
- obuf[on++] = ibuf2[in2];
- break;
- }
- last = ibuf2[in2++];
- }
- }
- else if( igot1 ){
- switch(type){
- case IDX_SORT:
- obuf[on++] = ibuf2[in2];
- break;
- case IDX_AND_SORT:
- if( ibuf1[in1] == last )
- obuf[on++] = ibuf1[in1];
- break;
- case IDX_OR_SORT:
- if( ibuf1[in1] != last )
- obuf[on++] = ibuf1[in1];
- break;
- }
- last = ibuf1[in1++];
- }
- else if( igot2 ){
- switch(type){
- case IDX_SORT:
- obuf[on++] = ibuf2[in2];
- break;
- case IDX_AND_SORT:
- if( ibuf2[in2] == last )
- obuf[on++] = ibuf2[in2];
- break;
- case IDX_OR_SORT:
- if( ibuf2[in2] != last )
- obuf[on++] = ibuf2[in2];
- break;
- }
- last = ibuf2[in2++];
- }
- else{
- break;
- }
- if( on == SZ_LINE ){
- fwrite(obuf, sizeof(int), on, ofd);
- fflush(ofd);
- on = 0;
- }
- }
- fwrite(obuf, sizeof(int), on, ofd);
- fflush(ofd);
- _exit(0);
- }
-#else
- idxerror("can't use index optimization with MinGW");
-#endif
- /* shouldn't get here */
- return NULL;
-}
-
-/*
- *
- * public routines
- *
- */
-
-#ifdef ANSI_FUNC
-idxrowrec *idxall(idxrowrec *row)
-#else
-idxrowrec *idxall(row)
- idxrowrec *row;
-#endif
-{
- Filter filt;
- idxrowrec *x;
-
- /* sanity check */
- if( !(filt = FilterDefault()) )
- idxerror("filter symbol table not initialized");
- /* most range list columns need to be sorted; col==val already is sorted */
- if( (row->type == COL) && (row->rtype == IDX_ROW_LIST) && row->dosort ){
- x = idxrownew();
- if( _idxstartsort(0, &(x->ichan), &(x->ochan), &(x->pid)) &&
- _idxwritesort(x, row) ){
- x->type = row->type;
- /* doesn't matter which sort we use here */
- x->rtype = IDX_SORT;
- x->dofilt = row->dofilt;
- /* close input to start sort */
- close(x->ochan);
- x->ochan = 0;
- }
- else{
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- }
- }
- /* everything else is fine as is */
- else{
- x = row;
- }
- IPRINTF((stderr, "idxall(%d): %s\n", x->dofilt, rowdisp(x)));
- filt->idx = x;
- return x;
-}
-
-#ifdef ANSI_FUNC
-void *
-idxread(idxrowrec *row, GIO gio, FITSHead fits,
- void *buf, size_t size, size_t get, size_t *got, int *dofilt)
-#else
- void *idxread(row, gio, fits, buf, size, get, got, dofilt)
- idxrowrec *row;
- GIO gio;
- FITSHead fits;
- void *buf;
- size_t size;
- size_t get;
- size_t *got;
- int *dofilt;
-#endif
-{
- int j, k=0;
- int left;
- int nrow;
- int rowsize;
- int ioffset;
- int itype;
- int isize;
- int start, stop;
- int *ibuf=NULL;
- size_t i;
- char nbuf[8];
- long ipos;
- struct stat fbuf;
-
- /* initialize */
- *got = 0;
- *dofilt = row->dofilt;
-
- /* handle particular io method */
- switch( idx_io ){
- case IDX_IO_MMAP:
-#ifdef HAVE_SYS_MMAN_H
- if( !row->fdata ){
- if( fstat(fileno(gio->fp), &fbuf) < 0 ){
- *got = 0;
- idxerror("can't fstat data file");
- goto done;
- }
- row->flen = fbuf.st_size;
- if( (row->fdata = mmap(NULL, row->flen, PROT_READ, MAP_PRIVATE,
- fileno(gio->fp), 0)) == MAP_FAILED ){
- *got = 0;
- idxerror("can't mmap data file");
- perror("mmap");
- goto done;
- }
- }
-#else
- idxerror("mmap not supported on this system");
-#endif
- break;
- case IDX_IO_LSEEK:
- break;
- }
-
- /* get rows */
- switch(row->rtype){
- case IDX_ROW_LIST:
- if( !(ibuf = xcalloc(get, sizeof(int))) ){
- *got = 0;
- idxerror("can't allocate index record buffer");
- goto done;
- }
- rowsize = ft_naxis(row->v->ifits, 1);
- ioffset = row->v->ioffset;
- itype = row->v->itype;
- isize = ft_sizeof(row->v->itype);
- for(left=get, i=0; (left>0) && (i<(size_t)row->nrow); i++){
- if( (row->startrow[i]<0) && (row->stoprow[i]<0) ) continue;
- nrow = row->stoprow[i] - row->startrow[i] + 1;
- if( left > nrow ){
- start = row->startrow[i];
- stop = row->stoprow[i];
- row->startrow[i] = -1;
- row->stoprow[i] = -1;
- *got += nrow;
- left -= nrow;
- }
- else if( nrow == left ){
- start = row->startrow[i];
- stop = row->stoprow[i];
- row->startrow[i] = -1;
- row->stoprow[i] = -1;
- *got += nrow;
- left = 0;
- }
- else{
- start = row->startrow[i];
- stop = start + left - 1;
- row->startrow[i] += left;
- *got += left;
- left = 0;
- }
- for(j=start; j<=stop; j++){
- ipos = row->v->ifits->data + ((j-1)*rowsize) + ioffset;
- switch( idx_io ){
- case IDX_IO_MMAP:
- if( row->v->idata ){
-#ifdef HAVE_SYS_MMAN_H
- memcpy(nbuf, &(row->v->idata[ipos]), isize);
-#else
- idxerror("mmap not supported on this system");
-#endif
- break;
- }
- case IDX_IO_LSEEK:
- if( gseek(row->v->igio, (off_t)ipos, 0) < 0 ){
- *got = 0;
- idxerror("can't seek into index file");
- goto done;
- }
- if( !gread(row->v->igio, nbuf, isize, 1) ){
- *got = 0;
- idxerror("can't read index file");
- goto done;
- }
- break;
- }
- switch(itype){
- case 'B':
- ibuf[k++] = (int)*(unsigned char *)(nbuf);
- break;
- case 'I':
- ibuf[k++] = (int)*(short *)_swap(nbuf,2);
- break;
- case 'U':
- ibuf[k++] = (int)*(unsigned short *)_swap(nbuf,2);
- break;
- case 'J':
- ibuf[k++] = (int)*(int *)_swap(nbuf,4);
- break;
- case 'V':
- ibuf[k++] = (int)*(unsigned int *)_swap(nbuf,4);
- break;
- case 'K':
- idxerror("64-bit integer not supported for index");
- break;
- default:
- *got = 0;
- idxerror("illegal index data type");
- goto done;
- }
- }
- }
- /* now grab the row associated with each row value */
- for(i=0; i<*got; i++){
- /* grab desired row in index */
- ipos = fits->data + ((ibuf[i]-1)*size);
- switch( idx_io ){
- case IDX_IO_MMAP:
-#ifdef HAVE_SYS_MMAN_H
- memcpy((char *)buf+(i*size), &(row->fdata[ipos]), size);
-#else
- idxerror("mmap not supported on this system");
-#endif
- break;
- case IDX_IO_LSEEK:
- if( gseek(gio, (off_t)ipos, 0) < 0 ){
- return 0;
- }
- if( !gread(gio, (char *)buf+(i*size), size, 1) ){
- *got = i;
- }
- break;
- }
- }
- break;
- case IDX_SORT:
- case IDX_OR_SORT:
- case IDX_AND_SORT:
- if( !row->ifile && !(row->ifile = fdopen(row->ichan, "r")) ){
- *got = 0;
- idxerror("can't fdup input index records");
- goto done;
- }
- if( !(ibuf = xcalloc(get, sizeof(int))) ){
- *got = 0;
- idxerror("can't allocate index record buffer");
- goto done;
- }
- /* read the row values */
- *got=fread(ibuf, sizeof(int), get, row->ifile);
- /* now grab the row associated with each row value */
- for(i=0; i<*got; i++){
- /* grab desired row in index */
- ipos = fits->data + ((ibuf[i]-1)*size);
- switch( idx_io ){
- case IDX_IO_MMAP:
-#ifdef HAVE_SYS_MMAN_H
- memcpy((char *)buf+(i*size), &(row->fdata[ipos]), size);
-#else
- idxerror("mmap not supported on this system");
-#endif
- break;
- case IDX_IO_LSEEK:
- if( gseek(gio, (off_t)ipos, 0) < 0 ){
- return 0;
- }
- if( !gread(gio, (char *)buf+(i*size), size, 1) ){
- *got = i;
- }
- break;
- }
- }
- break;
- case IDX_INDEF:
- default:
- *dofilt = 1;
- _gread(gio, (void *)buf, size, get, got);
- break;
- }
-
-done:
- if( ibuf ) xfree(ibuf);
- return (void *)buf;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxor(idxrowrec *row1, idxrowrec *row2)
-#else
-idxrowrec *idxor(row1, row2)
- idxrowrec *row1, *row2;
-#endif
-{
- int i;
- int nm=0;
- int start=0, stop=0;
- char *mbuf=NULL;
- idxrowrec *x=NULL;
- idxrowrec *r1, *r2;;
-
- x = idxrownew();
- if( (row1->type == IDX_INDEF) || (row2->type == IDX_INDEF) ){
- /* if we have an indef we will have to go through all of the rows. */
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- IPRINTF((stderr, "idxor(%d): INDEF %s\n", x->dofilt, rowdisp(x)));
- return x;
- }
- if( (row1->type == COL) && (row2->type == COL) &&
- (row1->rtype == IDX_ROW_LIST) && (row2->rtype == IDX_ROW_LIST) &&
- row1->s && row2->s && !strcmp(row1->s, row2->s) ){
- IPRINTF((stderr, "idxor: %s %s", rowdisp(row1), rowdisp(row2)));
- x->type = COL;
- x->rtype = IDX_ROW_LIST;
- x->dofilt = 0;
- x->s = xstrdup(row1->s);
- x->v = row1->v;
- /* a bit quicker when we have a simple OR */
- if( (row1->nrow == 1) && (row2->nrow == 1) ){
- if( (row1->stoprow[0] < row2->startrow[0]) ||
- (row2->stoprow[0] < row1->startrow[0]) ){
- _idxrowaddrow(x, row1->startrow[0], row1->stoprow[0]);
- _idxrowaddrow(x, row2->startrow[0], row2->stoprow[0]);
- }
- else{
- start = MIN(row1->startrow[0], row2->startrow[0]);
- stop = MAX(row1->stoprow[0], row2->stoprow[0]);
- _idxrowaddrow(x, start, stop);
- }
- IPRINTF((stderr, " =>(q) %s\n", rowdisp(x)));
- return x;
- }
- idxrowmark(row1, row2, &mbuf, &nm);
- for(i=0; i<nm; i++){
- if( mbuf[i] ){
- if( !start )
- start = i+1;
- }
- else{
- if( start ){
- stop = i;
- _idxrowaddrow(x, start, stop);
- start = 0;
- stop = 0;
- }
- }
- }
- if( start ){
- stop = nm;
- _idxrowaddrow(x, start, stop);
- start = 0;
- stop = 0;
- }
- if( mbuf ) xfree(mbuf);
- IPRINTF((stderr, " => %s\n", rowdisp(x)));
- return x;
- }
- else{
- if( (row1->type == REG) || (row2->type == REG) ){
- x->type = REG;
- x->dofilt = 1;
- }
- else{
- x->type = COL;
- x->dofilt = 0;
- }
- x->rtype = IDX_OR_SORT;
- /* two row lists: we sort both at once */
- if( (row1->rtype == IDX_ROW_LIST) && (row2->rtype == IDX_ROW_LIST) ){
- IPRINTF((stderr, "idxor sort: %s %s\n", rowdisp(row1), rowdisp(row2)));
- /* open sort program and return only unique records */
- if( !_idxstartsort(IDX_OR_SORT, &(x->ichan), &(x->ochan), &(x->pid)) ||
- !_idxwritesort(x, row1) || !_idxwritesort(x, row2) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- /* close input to start sort */
- close(x->ochan);
- x->ochan = 0;
- /* return here */
- return x;
- }
- /* at least one sorted process: we set up a merge (and maybe a sort) */
- else if( row1->rtype == IDX_ROW_LIST ){
- IPRINTF((stderr, "idxor sort/merge: %s %s\n",
- rowdisp(row1), rowdisp(row2)));
- r1 = row2;
- r2 = idxrownew();
- r2->type = row1->type;
- r2->rtype = row1->rtype;
- r2->s = xstrdup(row1->s);
- r2->dofilt = row1->dofilt;
- /* open sort program to return all records */
- if( !_idxstartsort(0, &(r2->ichan), &(r2->ochan), &(r2->pid)) ||
- !_idxwritesort(r2, row1) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- /* close input to start sort */
- close(r2->ochan);
- r2->ochan = 0;
- /* common merge code */
- return _idxrowmerge(x, r1, r2, IDX_OR_SORT);
- }
- /* at least one sorted process: we set up a merge (and maybe a sort) */
- else if( row2->rtype == IDX_ROW_LIST ){
- r1 = row1;
- IPRINTF((stderr, "idxor sort/merge: %s %s\n",
- rowdisp(row1), rowdisp(row2)));
- r2 = idxrownew();
- r2->type = row2->type;
- r2->rtype = row2->rtype;
- r2->s = xstrdup(row2->s);
- r2->dofilt = row2->dofilt;
- /* open sort program to return all records */
- if( !_idxstartsort(0, &(r2->ichan), &(r2->ochan), &(r2->pid)) ||
- !_idxwritesort(r2, row2) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- /* close input to start sort */
- close(r2->ochan);
- r2->ochan = 0;
- /* common merge code */
- return _idxrowmerge(x, r1, r2, IDX_OR_SORT);
- }
- else{
- return _idxrowmerge(x, row1, row2, IDX_OR_SORT);
- }
- }
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxand(idxrowrec *row1, idxrowrec *row2)
-#else
-idxrowrec *idxand(row1, row2)
- idxrowrec *row1, *row2;
-#endif
-{
- int i;
- int nm=0;
- int start=0, stop=0;
- char *mbuf=NULL;
- idxrowrec *x=NULL;
- idxrowrec *r1, *r2;
-
- if( (row1->type == IDX_INDEF) || (row2->type == IDX_INDEF) ){
- /* if we have an indef we return the other row and turn dofilter on.
- this works with AND but not with OR */
- if( (row1->type != IDX_INDEF) ){
- x = row1;
- x->dofilt = 1;
- }
- else if( (row2->type != IDX_INDEF) ){
- x = row2;
- x->dofilt = 1;
- }
- /* can't happen */
- else{
- x = idxrownew();
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- }
- IPRINTF((stderr, "idxand(%d): INDEF %s\n", x->dofilt, rowdisp(x)));
- return x;
- }
- x = idxrownew();
- if( (row1->type == COL) && (row2->type == COL) &&
- (row1->rtype == IDX_ROW_LIST) && (row2->rtype == IDX_ROW_LIST) &&
- row1->s && row2->s && !strcmp(row1->s, row2->s) ){
- IPRINTF((stderr, "idxand: %s %s", rowdisp(row1), rowdisp(row2)));
- x->type = COL;
- x->rtype = IDX_ROW_LIST;
- x->dofilt = 0;
- x->s = xstrdup(row1->s);
- x->v = row1->v;
- /* a bit quicker when we have a simple AND */
- if( (row1->nrow == 1) && (row2->nrow == 1) ){
- start = MAX(row1->startrow[0], row2->startrow[0]);
- stop = MIN(row1->stoprow[0], row2->stoprow[0]);
- if( start <= stop ){
- _idxrowaddrow(x, start, stop);
- }
- IPRINTF((stderr, " =>(q) %s\n", rowdisp(x)));
- return x;
- }
- idxrowmark(row1, row2, &mbuf, &nm);
- for(i=0; i<nm; i++){
- if( mbuf[i] == 3 ){
- if( !start )
- start = i+1;
- }
- else{
- if( start ){
- stop = i;
- _idxrowaddrow(x, start, stop);
- start = 0;
- stop = 0;
- }
- }
- }
- if( start ){
- stop = nm;
- _idxrowaddrow(x, start, stop);
- start = 0;
- stop = 0;
- }
- if( mbuf ) xfree(mbuf);
- IPRINTF((stderr, " => %s\n", rowdisp(x)));
- return x;
- }
- else{
- if( (row1->type == REG) || (row2->type == REG) ){
- x->type = REG;
- x->dofilt = 1;
- }
- else{
- x->type = COL;
- x->dofilt = 0;
- }
- x->rtype = IDX_OR_SORT;
- /* two row lists: we sort both at once */
- if( (row1->rtype == IDX_ROW_LIST) && (row2->rtype == IDX_ROW_LIST) ){
- IPRINTF((stderr, "idxand sort: %s %s\n", rowdisp(row1), rowdisp(row2)));
- /* open sort program and return only dup records */
- if( !_idxstartsort(IDX_AND_SORT, &(x->ichan), &(x->ochan), &(x->pid)) ||
- !_idxwritesort(x, row1) || !_idxwritesort(x, row2) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- /* close input to start sort */
- close(x->ochan);
- x->ochan = 0;
- /* return here */
- return x;
- }
- /* at least one sorted process: we set up a merge (and maybe a sort) */
- else if( row1->rtype == IDX_ROW_LIST ){
- IPRINTF((stderr, "idxor sort/merge: %s %s\n",
- rowdisp(row1), rowdisp(row2)));
- r1 = row2;
- r2 = idxrownew();
- r2->type = row1->type;
- r2->rtype = row1->rtype;
- r2->s = xstrdup(row1->s);
- r2->dofilt = row1->dofilt;
- /* open sort program to return all records */
- if( !_idxstartsort(0, &(r2->ichan), &(r2->ochan), &(r2->pid)) ||
- !_idxwritesort(r2, row1) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- /* close input to start sort */
- close(r2->ochan);
- r2->ochan = 0;
- /* common merge code */
- return _idxrowmerge(x, r1, r2, IDX_AND_SORT);
- }
- /* at least one sorted process: we set up a merge (and maybe a sort) */
- else if( row2->rtype == IDX_ROW_LIST ){
- r1 = row1;
- IPRINTF((stderr, "idxor sort/merge: %s %s\n",
- rowdisp(row1), rowdisp(row2)));
- r2 = idxrownew();
- r2->type = row2->type;
- r2->rtype = row2->rtype;
- r2->s = xstrdup(row2->s);
- r2->dofilt = row2->dofilt;
- /* open sort program to return all records */
- if( !_idxstartsort(0, &(r2->ichan), &(r2->ochan), &(r2->pid)) ||
- !_idxwritesort(r2, row2) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- /* close input to start sort */
- close(r2->ochan);
- r2->ochan = 0;
- /* common merge code */
- return _idxrowmerge(x, r1, r2, IDX_AND_SORT);
- }
- else{
- return _idxrowmerge(x, row1, row2, IDX_AND_SORT);
- }
- }
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowreg(idxvalrec *val)
-#else
-idxrowrec *idxrowreg(idxvalrec *val)
- idxvalrec *val;
-#endif
-{
- int i=0, j=0;
- idxrowrec *x=NULL;
- idxrowrec *r[2];
- int start[2], stop[2];
-
- x = idxrownew();
- if( (val->type == INDEF) ||
- ((val->rv[0]->type == INDEF) && (val->rv[1]->type == INDEF)) ){
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
- }
- for(i=0; i<2; i++){
- r[i] = idxrownew();
- /* handle case where one of the regions has no index */
- if( val->rv[i]->type == INDEF ){
- r[i]->type = IDX_INDEF;
- r[i]->rtype = IDX_INDEF;
- r[i]->dofilt = 1;
- continue;
- }
- /* j will be the index of the valid val record we use in the output row */
- j = i;
- r[i]->type = REG;
- r[i]->rtype = IDX_ROW_LIST;
- r[i]->s = xstrdup(val->rv[i]->s);
- r[i]->v = val->rv[i];
- start[i] = _idxbsearch(val->rv[i]->igio,
- val->rv[i]->ifits, val->rv[i]->vtype,
- val->rv[i]->voffset, val->rv[i]->vn,
- 0, -1, val->rlo[i], (longlong)0, PARSE_FLOAT);
- stop[i] = _idxbsearch(val->rv[i]->igio,
- val->rv[i]->ifits, val->rv[i]->vtype,
- val->rv[i]->voffset, val->rv[i]->vn,
- 0, 1, val->rhi[i], (longlong)0, PARSE_FLOAT);
- if( (start[i] > 0) && (stop[i] > 0) ){
- _idxrowaddrow(r[i], start[i], stop[i]);
- }
- }
- x = idxand(r[0], r[1]);
- x->type = REG;
- x->dofilt = 1;
- x->v = val->rv[j];
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowfun(idxvalrec *UNUSED(val))
-#else
-idxrowrec *idxrowfun(idxvalrec *val)
- idxvalrec *val;
-#endif
-{
- idxrowrec *x=NULL;
-
- x = idxrownew();
- x->type = IDX_INDEF;
- x->rtype = IDX_INDEF;
- x->dofilt = 1;
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxroweq(idxvalrec *val1, idxvalrec *val2)
-#else
-idxrowrec *idxroweq(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- int start, stop;
- int nrow;
- idxrowrec *x=NULL;
-
- if( (val1->type == NUM) && (val2->type == COL) ){
- return idxroweq(val2, val1);
- }
- IPRINTF((stderr, "idxeq: "));
- if( _idxrowcommon(val1, val2, 1, IDX_EDGE_BOTH, &x, &start, &stop, &nrow) ){
- IPRINTF((stderr, "%s start=%d,stop=%d", x->s, start, stop));
- if( (start > 0) && (stop > 0) ){
- _idxrowaddrow(x, start, stop);
- }
- IPRINTF((stderr, " => "));
- }
- IPRINTF((stderr, "%s\n", rowdisp(x)));
- /* this is the only operator resulting in a sorted range list */
- x->dosort = 0;
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowne(idxvalrec *val1, idxvalrec *val2)
-#else
-idxrowrec *idxrowne(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- int start, stop;
- int nrow;
- int i=0;
- idxrowrec *x=NULL;
-
- if( (val1->type == NUM) && (val2->type == COL) ){
- return idxrowne(val2, val1);
- }
- IPRINTF((stderr, "idxne: "));
- if( _idxrowcommon(val1, val2, 0, IDX_EDGE_BOTH, &x, &start, &stop, &nrow) ){
- IPRINTF((stderr, "%s start=%d,stop=%d", x->s, start, stop));
- if( start > 1 ){
- _idxrowaddrow(x, 1, start-1);
- i++;
- }
- if( stop && (stop < nrow) ){
- _idxrowaddrow(x, stop+1, nrow);
- IPRINTF((stderr, " start=%d,stop=%d", x->startrow[i], x->stoprow[i]));
- }
- IPRINTF((stderr, " => "));
- }
- IPRINTF((stderr, "%s\n", rowdisp(x)));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowlt(idxvalrec *val1, idxvalrec *val2)
-#else
-idxrowrec *idxrowlt(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- int start, stop;
- int nrow;
- int i=0;
- idxrowrec *x=NULL;
-
- if( (val1->type == NUM) && (val2->type == COL) ){
- return idxrowgt(val2, val1);
- }
- IPRINTF((stderr, "idxlt: "));
- if( _idxrowcommon(val1, val2, 0, IDX_EDGE_LEFT, &x, &start, &stop, &nrow) ){
- IPRINTF((stderr, "%s start=%d,stop=%d", x->s, start, stop));
- if( start > 1 ){
- _idxrowaddrow(x, 1, start-1);
- i++;
- }
- IPRINTF((stderr, " => "));
- }
- IPRINTF((stderr, "%s\n", rowdisp(x)));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowle(idxvalrec *val1, idxvalrec *val2)
-#else
-idxrowrec *idxrowle(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- int start, stop;
- int nrow;
- idxrowrec *x=NULL;
-
- if( (val1->type == NUM) && (val2->type == COL) ){
- return idxrowge(val2, val1);
- }
- IPRINTF((stderr, "idxle: "));
- if( _idxrowcommon(val1, val2, 0, IDX_EDGE_RIGHT, &x, &start, &stop, &nrow) ){
- IPRINTF((stderr, "%s start=%d,stop=%d", x->s, start, stop));
- if( stop > 0 ){
- _idxrowaddrow(x, 1, stop);
- }
- IPRINTF((stderr, " => "));
- }
- IPRINTF((stderr, "%s\n", rowdisp(x)));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowgt(idxvalrec *val1, idxvalrec *val2)
-#else
-idxrowrec *idxrowgt(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- int start, stop;
- int nrow;
- int i=0;
- idxrowrec *x=NULL;
-
- if( (val1->type == NUM) && (val2->type == COL) ){
- return idxrowlt(val2, val1);
- }
- IPRINTF((stderr, "idxgt: "));
- if( _idxrowcommon(val1, val2, 0, IDX_EDGE_RIGHT, &x, &start, &stop, &nrow) ){
- IPRINTF((stderr, "%s start=%d,stop=%d ", x->s, start, stop));
- if( (stop >= 0) && (stop < nrow) ){
- _idxrowaddrow(x, stop+1, nrow);
- i++;
- }
- IPRINTF((stderr, " => "));
- }
- IPRINTF((stderr, "%s\n", rowdisp(x)));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrowge(idxvalrec *val1, idxvalrec *val2)
-#else
-idxrowrec *idxrowge(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- int start, stop;
- int nrow;
- int i=0;
- idxrowrec *x=NULL;
-
- if( (val1->type == NUM) && (val2->type == COL) ){
- return idxrowle(val2, val1);
- }
- IPRINTF((stderr, "idxge: "));
- if( _idxrowcommon(val1, val2, 0, IDX_EDGE_LEFT, &x, &start, &stop, &nrow) ){
- IPRINTF((stderr, "%s start=%d,stop=%d ", x->s, start, stop));
- if( (start > 0) && (start <= nrow) ){
- _idxrowaddrow(x, start, nrow);
- i++;
- }
- IPRINTF((stderr, " => "));
- }
- IPRINTF((stderr, "%s\n", rowdisp(x)));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvaladd(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvaladd(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) ){
- x->ntype = PARSE_FLOAT;
- x->dval = val1->dval + val2->dval;
- IPRINTF((stderr, "valadd: %f + %f => %f\n",
- val1->dval, val2->dval, x->dval));
- }
- else{
- x->ntype = PARSE_INTEGER;
- x->ival = val1->ival + val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valadd: %s + %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalsub(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvalsub(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) ){
- x->ntype = PARSE_FLOAT;
- x->dval = val1->dval - val2->dval;
- IPRINTF((stderr, "valsub: %f - %f => %f\n",
- val1->dval, val2->dval, x->dval));
- }
- else{
- x->ntype = PARSE_INTEGER;
- x->ival = val1->ival - val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valsub: %s - %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalmul(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvalmul(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) ){
- x->ntype = PARSE_FLOAT;
- x->dval = val1->dval * val2->dval;
- IPRINTF((stderr, "valmul: %f * %f => %f\n",
- val1->dval, val2->dval, x->dval));
- }
- else{
- x->ntype = PARSE_INTEGER;
- x->ival = val1->ival * val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valmul: %s * %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvaldiv(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvaldiv(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- if( val2->dval == 0.0 )
- idxerror("can't divide by zero");
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) ){
- x->dval = val1->dval / val2->dval;
- x->ntype = PARSE_FLOAT;
- }
- else{
- x->ival = val1->ival / val2->ival;
- x->ntype = PARSE_INTEGER;
- }
- IPRINTF((stderr, "valdiv: %f / %f => %f\n",
- val1->dval, val2->dval, x->dval));
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalmod(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvalmod(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) ){
- idxerror("can't use mod operator with floating point value");
- }
- else{
- x->ntype = PARSE_INTEGER;
- x->ival = val1->ival % val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valmod: %s mod %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvaland(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvaland(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- x->ntype = PARSE_INTEGER;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) )
- x->ival = (longlong)val1->dval & (longlong)val2->dval;
- else
- x->ival = val1->ival & val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valand: %s & %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalor(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvalor(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- x->ntype = PARSE_INTEGER;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) )
- x->ival = (longlong)val1->dval | (longlong)val2->dval;
- else
- x->ival = val1->ival | val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valor: %s | %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalxor(idxvalrec *val1, idxvalrec *val2)
-#else
-idxvalrec *idxvalxor(val1, val2)
- idxvalrec *val1, *val2;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- if( (val1->type == NUM) && (val2->type == NUM) ){
- x->type = NUM;
- x->ntype = PARSE_INTEGER;
- if( (val1->ntype == PARSE_FLOAT) || (val2->ntype == PARSE_FLOAT) )
- x->ival = (longlong)val1->dval ^ (longlong)val2->dval;
- else
- x->ival = val1->ival ^ val2->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valxor: %s ^ %s => %s\n", LFMT, LFMT, LFMT);
- IPRINTF((stderr, fmt, val1->ival, val2->ival, x->ival));
- }
- else{
- x->type = INDEF;
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalnot(idxvalrec *val)
-#else
-idxvalrec *idxvalnot(val)
- idxvalrec *val;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- x->type = NUM;
- x->ntype = PARSE_INTEGER;
- if( val->ntype == PARSE_FLOAT )
- x->ival = !val->dval;
- else
- x->ival = !val->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valnot: %s => %s\n", LFMT, LFMT);
- IPRINTF((stderr, fmt, val->ival, x->ival));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalcom(idxvalrec *val)
-#else
-idxvalrec *idxvalcom(val)
- idxvalrec *val;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- x->type = NUM;
- x->ntype = PARSE_INTEGER;
- if( val->ntype == PARSE_FLOAT )
- x->ival = ~(longlong)val->dval;
- else
- x->ival = ~val->ival;
- x->dval = x->ival;
- snprintf(fmt, SZ_LINE, "valcom: %s => %s\n", LFMT, LFMT);
- IPRINTF((stderr, fmt, val->ival, x->ival));
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalmin(idxvalrec *val)
-#else
-idxvalrec *idxvalmin(val)
- idxvalrec *val;
-#endif
-{
- idxvalrec *x=NULL;
-
- x = idxvalnew(NULL);
- x->type = NUM;
- x->ntype = val->ntype;
- x->dval = -val->dval;
- x->ival = -val->ival;
- if( val->ntype == PARSE_FLOAT ){
- IPRINTF((stderr, "valmin: %f => %f\n", val->dval, x->dval));
- }
- else{
- snprintf(fmt, SZ_LINE, "valmin: %s => %s\n", LFMT, LFMT);
- IPRINTF((stderr, fmt, val->ival, x->ival));
- }
- return x;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *idxvalnew(char *s)
-#else
-idxvalrec *idxvalnew(s)
- char *s;
-#endif
-{
- idxvalrec *v=NULL;
- Filter filt;
-
- if( !(filt = FilterDefault()) )
- idxerror("filter symbol table not initialized");
- if( !(v=xcalloc(1, sizeof(struct _idxvalrec))) )
- idxerror("can't allocate idxvalrec");
- if( s ) v->s = xstrdup(s);
- v->next = filt->valhead;
- filt->valhead = v;
- return v;
-}
-
-
-#ifdef ANSI_FUNC
-int idxvalfree(idxvalrec *v)
-#else
-int idxvalfree(v)
- idxvalrec *v;
-#endif
-{
- idxvalrec *t;
- int n=0;
- Filter filt;
-
- if( !(filt = FilterDefault()) )
- idxerror("filter symbol table not initialized");
- if( v ){
- if( filt->valhead == v ){
- filt->valhead = v->next;
- }
- else{
- for(t=filt->valhead; t; t=t->next){
- if( t->next == v ){
- t->next = v->next;
- break;
- }
- }
- }
- _idxvalfree(v);
- n = 1;
- }
- else{
- for(v=filt->valhead; v; n++){
- t = v->next;
- _idxvalfree(v);
- v = t;
- }
- filt->valhead = NULL;
- }
- return n;
-}
-
-#ifdef ANSI_FUNC
-idxvalrec *
-idxlookupfilename(char *iname)
-#else
-idxvalrec *idxlookupfilename(iname)
- char *iname
-#endif
-{
- idxvalrec *t;
- Filter filt;
-
- if( !(filt = FilterDefault()) )
- return NULL;
- for(t=filt->valhead; t; t=t->next){
- if( t->iname && !strcmp(t->iname, iname) ){
- return t;
- }
- }
- return NULL;
-}
-
-#ifdef ANSI_FUNC
-idxrowrec *idxrownew(void)
-#else
-idxrowrec *idxrownew()
-#endif
-{
- idxrowrec *r=NULL;
- Filter filt;
-
- if( !(filt = FilterDefault()) )
- idxerror("filter symbol table not initialized");
- if( !(r=xcalloc(1, sizeof(struct _idxrowrec))) )
- idxerror("can't allocate idxrowrec");
- r->maxrow = IDX_ROW_INC;
- r->startrow = xcalloc(r->maxrow, sizeof(int));
- r->stoprow = xcalloc(r->maxrow, sizeof(int));
- r->nrow = 0;
- r->dosort = 1;
- r->next = filt->rowhead;
- filt->rowhead = r;
- return r;
-}
-
-#ifdef ANSI_FUNC
-int idxrowfree(idxrowrec *r)
-#else
-int idxrowfree(r)
- idxrowrec *r;
-#endif
-{
- idxrowrec *t;
- int n=0;
- Filter filt;
-
- if( !(filt = FilterDefault()) )
- idxerror("filter symbol table not initialized");
- if( r ){
- if( filt->rowhead == r ){
- filt->rowhead = r->next;
- }
- else{
- for(t=filt->rowhead; t; t=t->next){
- if( t->next == r ){
- t->next = r->next;
- break;
- }
- }
- }
- _idxrowfree(r);
- n = 1;
- }
- else{
- for(r=filt->rowhead; r; n++){
- t = r->next;
- _idxrowfree(r);
- r = t;
- }
- filt->rowhead = NULL;
- }
- return n;
-}
-
-#ifdef ANSI_FUNC
-int
-idxinitfilenames(char *t, int *flag)
-#else
-int idxinitfilenames(t, flag)
- char *t;
- int *flag;
-#endif
-{
- char *u=NULL;
- int havegz=0;
-
- /* initialize */
- if( flag ) *flag = 0;
- /* free current values */
- idxfreefilenames();
-
- /* sanity check */
- if( !t || !*t) return 0;
-
- if( (u=strchr(t, ':')) ){
- if( !strncasecmp(t, "pipe:", 5) || !strncasecmp(t, "mmap:", 5) ||
- !strncasecmp(t, "shm:", 4) || !strncasecmp(t, "mem:", 4) ||
- !strncasecmp(t, "buf:", 4) || !strncasecmp(t, "file:", 5) ||
- !strncasecmp(t, "gzip:", 5) || !strncasecmp(t, "unfile:", 7) ){
- t = u+1;
- }
- }
- idxfilename = xstrdup(t);
- if( (idxfileroot2=xstrdup(t)) ){
- if( (t=strrchr(idxfileroot2, '.')) ){
- if( !strcmp(t, ".gz") ){
- havegz=1;
- *t = '\0';
- if( (t=strrchr(idxfileroot2, '.')) ){
- *t = '\0';
- }
- }
- else{
- *t = '\0';
- }
- }
- if( (t=strrchr(idxfileroot2, '/')) ){
- idxfileroot1 = xstrdup(t+1);
- }
- else{
- idxfileroot1 = xstrdup(idxfileroot2);
- }
- }
- if( flag ) *flag = havegz;
- return 1;
-}
-
-#ifdef ANSI_FUNC
-void
-idxfreefilenames(void)
-#else
-void idxfreefilenames()
-#endif
-{
- if( idxfilename ){
- xfree(idxfilename);
- idxfilename=NULL;
- }
- if( idxfileroot1 ){
- xfree(idxfileroot1);
- idxfileroot1=NULL;
- }
- if( idxfileroot2 ){
- xfree(idxfileroot2);
- idxfileroot2=NULL;
- }
-}
-
-#ifdef ANSI_FUNC
-void
-idxfreeglobals(void)
-#else
-void idxfreeglobals()
-#endif
-{
- if( idxcolname ){
- xfree(idxcolname);
- idxcolname=NULL;
- }
- if( idxpath ){
- xfree(idxpath);
- idxpath=NULL;
- }
- if( idxsort ){
- xfree(idxsort);
- idxsort=NULL;
- }
- idxfreefilenames();
-}
-
-#ifdef ANSI_FUNC
-char *
-idxindexfilename(char *col, int *size)
-#else
-char *idxindexfilename(col, size)
- char *col;
- int *size;
-#endif
-{
- int i;
- char *iname=NULL;
- char *fname=NULL;
- char *idxname=NULL;
- char *suffix="";
- char colbuf[SZ_LINE];
- char tbuf[SZ_LINE];
- char tbuf1[SZ_LINE];
- char tbuf2[SZ_LINE];
- struct stat ibuf;
- struct stat fbuf;
-
- /* sanity checks */
- if( !col ) return NULL;
- if( !idxinfo(IDX_FILENAME) ) return NULL;
- if( !idxinfo(IDX_FILEROOT1) || !idxinfo(IDX_FILEROOT2) ) return NULL;
-
- /* we try using the column name as is, in lower case, and in upper case */
- /* we also try with and without a .gz extension */
- strncpy(colbuf, col, SZ_LINE-1);
- for(i=0; i<6; i++){
- switch(i){
- case 0:
- break;
- case 1:
- culc(colbuf);
- break;
- case 2:
- cluc(colbuf);
- break;
- case 3:
- suffix=".gz";
- break;
- case 4:
- culc(colbuf);
- suffix=".gz";
- break;
- case 5:
- cluc(colbuf);
- suffix=".gz";
- break;
- }
- snprintf(tbuf1, SZ_LINE-1, "%s_%s.idx%s", idxinfo(IDX_FILEROOT1),
- colbuf, suffix);
- snprintf(tbuf2, SZ_LINE-1, "%s_%s.idx%s", idxinfo(IDX_FILEROOT2),
- colbuf, suffix);
- if( (iname=Find(tbuf1, "r", NULL, "." )) ||
- (iname=Find(tbuf1, "r", NULL, FilterPath())) ||
- (iname=Find(tbuf2, "r", NULL, "." )) ||
- (iname=Find(tbuf2, "r", NULL, FilterPath())) ){
- if( (fname=Find(idxinfo(IDX_FILENAME), "r", NULL, "." )) ||
- (fname=Find(idxinfo(IDX_FILENAME), "r", NULL, FilterPath())) ){
- if( (stat(fname, &fbuf) <0) || (stat(iname, &ibuf) <0) ){
- goto done;
- }
- else if( fbuf.st_mtime > ibuf.st_mtime ){
- goto done;
- }
- }
- snprintf(tbuf, SZ_LINE-1, "%s[1]", iname);
- idxname = xstrdup(tbuf);
- break;
- }
- }
-
-done:
- if( iname ) xfree(iname);
- if( fname ) xfree(fname);
- if( size ) *size = ibuf.st_size;
- return idxname;
-}
-
-#ifdef ANSI_FUNC
-int
-idxinitparser(char *s)
-#else
-int idxinitparser(s)
- char *s;
-#endif
-{
- char *t;
- int havegz=0;
- Filter filt;
-
- /* sanity checks */
- if( !(filt = FilterDefault()) ) return 0;
- if( !filt->fhd->filename ) return 0;
-
- /* initialize index file name info */
- idxinitfilenames(filt->fhd->filename, &havegz);
-
- /* process index environent */
- if( (t=getenv("FILTER_IDX_COLNAME")) ){
- idxcolname = xstrdup(t);
- }
- else{
- idxcolname = xstrdup("n");
- }
- if( (t=getenv("FILTER_IDX_IO")) ){
- if( !strncasecmp(t, "mmap", 4) ){
-#ifdef HAVE_SYS_MMAN_H
- idx_io = IDX_IO_MMAP;
-#else
- idx_io = IDX_IO_LSEEK;
-#endif
- }
- else if( !strncasecmp(t, "lseek", 5) ){
- idx_io = IDX_IO_LSEEK;
- }
- else{
- idx_io = IDX_IO_DEFAULT;
- }
- }
- /* oops ... if we have a gz file, we can't use mmap */
- if( havegz ){
- idx_io = IDX_IO_LSEEK;
- }
- if( s ) idxstring(s);
- return 1;
-}
-
-#ifdef ANSI_FUNC
-void
-idxendparser(void)
-#else
-void idxendparser()
-#endif
-{
- idxvalfree(NULL);
- idxrowfree(NULL);
- idxfreeglobals();
-}
-
-#ifdef ANSI_FUNC
-char *
-idxinfo(int which)
-#else
-char *idxinfo(which)
- int which;
-#endif
-{
- switch(which){
- case IDX_COLNAME:
- return idxcolname;
- case IDX_FILENAME:
- return idxfilename;
- case IDX_FILEROOT1:
- return idxfileroot1;
- case IDX_FILEROOT2:
- return idxfileroot2;
- case IDX_PATHNAME:
- return idxpath;
- case IDX_SORTNAME:
- return idxsort;
- default:
- return NULL;
- }
-}
-
-#ifdef ANSI_FUNC
-int
-idxdebug(int debug)
-#else
-int idxdebug(debug)
- int debug;
-#endif
-{
- int odebug;
-
- odebug = idx_debug;
- idx_debug = debug;
- return odebug;
-}
diff --git a/funtools/filter/image_c.h b/funtools/filter/image_c.h
deleted file mode 100644
index 4db125b..0000000
--- a/funtools/filter/image_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *IMAGE_C="\n\n#ifdef TEST\n#include <stdio.h>\n#include <math.h>\n#define IMFILTRTN _FilterImage\n#define NMASK 0\n#define MASKDIM 0\n#define _masks NULL\n#define NSHAPE 2\n#define NREGION 2\n#define FILTER ((imcircle(g,1,1,1,4,(double)x,(double)y,8.0,8.0,5.0)))&&(imcircle(g,2,2,0,1,(double)x,(double)y,8.0,8.0,3.0))\n#define FILTSTR \"((imcircle(g,1,1,1,4,(double)x,(double)y,8.0,8.0,5.0)))&&(imcircle(g,2,2,0,1,(double)x,(double)y,8.0,8.0,3.0))\"\n#define FINIT imcirclei(g,1,1,1,4,(double)x,(double)y,8.0,8.0,5.0);imcirclei(g,2,2,0,1,(double)x,(double)y,8.0,8.0,3.0);\n#include \"regions.h\"\n#endif\n\n\nFilterMask masks=NULL; \nint maxmask; \nint nmask; \nint nreg; \nint rid; \nint x, y; \nint rlen; \nint *rbuf; \nint *rptr; \n\nvoid incnmask(void)\n{\n int omax;\n nmask++;\n if( nmask >= maxmask ){\n omax = maxmask;\n maxmask += MASKINC;\n masks = (FilterMask)realloc(masks, maxmask*sizeof(FilterMaskRec));\n memset(masks+omax, 0, (maxmask-omax)*sizeof(FilterMaskRec));\n }\n}\n\nFilterMask\nIMFILTRTN(int txmin, int txmax, int tymin, int tymax, int tblock, int *got)\n{\n int i, j;\n int fieldonly;\n GFilt g;\n Scan scan, tscan;\n\n \n if( NSHAPE <=0 ){\n *got = 0;\n return NULL;\n }\n \n g = (GFilt)calloc(1, sizeof(GFiltRec));\n \n fieldonly = (NSHAPE==1) && strstr(FILTSTR, \"field\");\n \n g->nshapes = NSHAPE;\n g->maxshapes = (NSHAPE*(XSNO+1))+1;\n g->shapes = (Shape)calloc(g->maxshapes, sizeof(ShapeRec));\n \n g->block= max(1,tblock);\n g->xmin = max(1,txmin); \n g->xmax = txmax;\n g->ymin = max(1,tymin);\n g->ymax = tymax;\n \n g->x0 = 1;\n g->y0 = 1;\n g->x1 = (g->xmax-g->xmin)/g->block+1;\n g->y1 = (g->ymax-g->ymin)/g->block+1;\n \n rlen = g->x1 - g->x0 + 1;\n rbuf = (int *)calloc(rlen+1, sizeof(int));\n \n maxmask = MASKINC;\n masks = (FilterMask)calloc(maxmask, sizeof(FilterMaskRec));\n \n nmask = 0;\n masks[nmask].region = 0;\n \n nreg = 0;\n \n g->ybuf = (int *)calloc(g->y1+1, sizeof(int));\n g->x0s = (int *)calloc(g->y1+1, sizeof(int));\n g->x1s = (int *)calloc(g->y1+1, sizeof(int));\n \n for(i=0; i<=g->y1; i++) g->x0s[i] = g->x1;\n for(i=0; i<=g->y1; i++) g->x1s[i] = g->x0;\n \n if( NMASK ){\n g->nmask = NMASK; \n g->maskdim = MASKDIM;\n g->masks = _masks;\n }\n \n FINIT;\n \n for(y=g->y0; y<=g->y1; y++){\n if( fieldonly ){\n \n masks[nmask].region = 1;\n masks[nmask].y = y - g->y0 + 1;\n masks[nmask].xstart = 1;\n masks[nmask].xstop = (g->x1 - g->x0 + 1);\n incnmask();\n continue;\n }\n if( g->ybuf[y] ){\n \n if( masks[nmask].region ){\n \n incnmask();\n masks[nmask].region = 0;\n }\n \n for(x=g->x0s[y], rptr=&rbuf[1+(g->x0s[y]-g->x0)]; x<=g->x1s[y];\n x++, rptr++){\n \n g->rid = 0;\n if( FILTER ){\n \n if( *rptr == 0 ){\n nreg++;\n *rptr = g->rid ? g->rid : -1;\n }\n \n else if( (*rptr == -1) && (g->rid >0) ){\n *rptr = g->rid;\n }\n }\n }\n }\n \n if( nreg ){\n for(i=1; i<=rlen; i++){\n if( rbuf[i] != masks[nmask].region ){\n \n if( masks[nmask].region ){\n masks[nmask].xstop = i - 1;\n \n incnmask();\n }\n masks[nmask].y = y - g->y0 + 1;\n masks[nmask].region = rbuf[i];\n masks[nmask].xstart = i;\n }\n }\n \n if( masks[nmask].region ){\n masks[nmask].xstop = (g->x1 - g->x0 + 1);\n \n incnmask();\n }\n \n (void)memset(rbuf, 0, (rlen+1)*sizeof(int));\n rptr = rbuf;\n nreg = 0;\n }\n }\n \n if( rbuf) free(rbuf);\n \n if( g ){\n for(i=0; i<g->maxshapes; i++){\n if( g->shapes[i].scanlist ){\n for(j=0; j<=g->y1; j++){\n if( g->shapes[i].scanlist[j] ){\n for(scan=g->shapes[i].scanlist[j]; scan; ){\n tscan = scan->next;\n free(scan);\n scan = tscan;\n }\n }\n }\n free(g->shapes[i].scanlist);\n }\n if( g->shapes[i].pts ) free(g->shapes[i].pts);\n if( g->shapes[i].xv ) free(g->shapes[i].xv);\n }\n if( g->masks ) free(g->masks);\n if( g->shapes ) free(g->shapes);\n if( g->ybuf ) free(g->ybuf);\n if( g->x0s ) free(g->x0s);\n if( g->x1s ) free(g->x1s);\n if( g ) free(g);\n }\n \n *got = nmask;\n return masks;\n}\n\nint main(int argc, char **argv)\n{\n int i;\n int get, got;\n#if DO_FILTER_SWAP\n int sgot;\n#endif\n#if HAVE_MINGW32==0\n int pipes[4];\n#endif\n int txmin, txmax, tymin, tymax, tblock;\n char tbuf[SZ_LINE];\n char *s=NULL, *t=NULL, *u=NULL;\n#if USE_WIN32\n HANDLE hStdin, hStdout; \n DWORD dwRead, dwWritten; \n#endif\n\n \n#if HAVE_MINGW32==0\n if( (s=getenv(\"LAUNCH_PIPES\")) ){\n t = (char *)strdup(s);\n for(i=0, u=(char *)strtok(t, \",\"); i<4 && u; \n i++, u=(char *)strtok(NULL,\",\")){\n pipes[i] = atoi(u);\n }\n if( t ) free(t);\n if( i < 4 ) return(1);\n close(pipes[0]);\n close(pipes[3]);\n dup2(pipes[2], 0); close(pipes[2]);\n dup2(pipes[1], 1); close(pipes[1]);\n }\n#endif\n\n#if USE_WIN32\n hStdout = GetStdHandle(STD_OUTPUT_HANDLE); \n hStdin = GetStdHandle(STD_INPUT_HANDLE); \n if( (hStdout == INVALID_HANDLE_VALUE) || (hStdin == INVALID_HANDLE_VALUE) ){\n unlink(argv[0]);\n return 0;\n }\n#endif\n\n \n#ifdef TEST\n while( fgets(tbuf, SZ_LINE, stdin) ){\n#else\n#if USE_WIN32\n while((ReadFile(hStdin, &get, sizeof(int), &dwRead, NULL) != FALSE) && \n (dwRead == sizeof(int)) ){\n#else\n while( read(0, &get, sizeof(int)) == sizeof(int) ){\n#endif\n#if DO_FILTER_SWAP\n switch(sizeof(int)){\n case 2:\n _sw2((char *)&get,2,NULL,0);\n break;\n case 4:\n _sw4((char *)&get,4,NULL,0);\n break;\n case 8:\n _sw8((char *)&get,8,NULL,0);\n break;\n }\n#endif\n#if USE_WIN32\n if((ReadFile(hStdin, tbuf, get, &dwRead, NULL)==FALSE) || (dwRead != get))\n break;\n#else\n if(read(0, tbuf, get) != get) \n break;\n#endif\n#endif \n if(sscanf(tbuf, \"%d %d %d %d %d\",\n &txmin, &txmax, &tymin, &tymax, &tblock)!=5){\n break;\n }\n masks = IMFILTRTN(txmin, txmax, tymin, tymax, tblock, &got);\n#ifdef TEST\n \n fprintf(stdout, \"nmask=%d\\n\", nmask);\n for(i=0; i<nmask; i++){\n fprintf(stdout, \"region: %d\tx: (%d,%d)\ty: %d\\n\",\n masks[i].region, masks[i].xstart, masks[i].xstop, masks[i].y);\n }\n fflush(stdout);\n#else\n \n got = got * sizeof(FilterMaskRec);\n#if DO_FILTER_SWAP\n sgot = got;\n switch(sizeof(int)){\n case 2:\n _sw2((char *)&sgot,2,NULL,0);\n break;\n case 4:\n _sw4((char *)&sgot,4,NULL,0);\n break;\n case 8:\n _sw8((char *)&sgot,8,NULL,0);\n break;\n }\n#if USE_WIN32\n WriteFile(hStdout, &sgot, sizeof(int), &dwWritten, NULL); \n#else\n write(1, &sgot, sizeof(int));\n#endif\n#else\n#if USE_WIN32\n WriteFile(hStdout, &got, sizeof(int), &dwWritten, NULL); \n#else\n write(1, &got, sizeof(int));\n#endif\n#endif\n#if DO_FILTER_SWAP\n switch(sizeof(int)){\n case 2:\n _sw2((char *)masks,got,NULL,0);\n break;\n case 4:\n _sw4((char *)masks,got,NULL,0);\n break;\n case 8:\n _sw8((char *)masks,got,NULL,0);\n break;\n }\n#endif\n#if USE_WIN32\n WriteFile(hStdout, masks, got, &dwWritten, NULL); \n#else\n write(1, masks, got);\n#endif\n#endif\n \n if( masks ) free(masks);\n }\n#ifndef TEST\n unlink(argv[0]);\n#endif\n return 0;\n}\n";
diff --git a/funtools/filter/imfilter.c b/funtools/filter/imfilter.c
deleted file mode 100644
index d2495da..0000000
--- a/funtools/filter/imfilter.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* for TEST: gcc -DTEST -g -o foo imfilter.c imregions.o -lm */
-#ifdef TEST
-#include <stdio.h>
-#include <math.h>
-#define IMFILTRTN _FilterImage
-#define NMASK 0
-#define MASKDIM 0
-#define _masks NULL
-#define NSHAPE 2
-#define NREGION 2
-#define FILTER ((imcircle(g,1,1,1,4,(double)x,(double)y,8.0,8.0,5.0)))&&(imcircle(g,2,2,0,1,(double)x,(double)y,8.0,8.0,3.0))
-#define FILTSTR "((imcircle(g,1,1,1,4,(double)x,(double)y,8.0,8.0,5.0)))&&(imcircle(g,2,2,0,1,(double)x,(double)y,8.0,8.0,3.0))"
-#define FINIT imcirclei(g,1,1,1,4,(double)x,(double)y,8.0,8.0,5.0);imcirclei(g,2,2,0,1,(double)x,(double)y,8.0,8.0,3.0);
-#include "regions.h"
-#endif
-
-/* these are global for use with special region routines */
-FilterMask masks=NULL; /* array valid region masks for one row */
-int maxmask; /* max masks allocated thus far */
-int nmask; /* number of mask segments */
-int nreg; /* number of regions in this set of rows */
-int rid; /* first valid region for current pixel */
-int x, y; /* current row and column */
-int rlen; /* length of temp region buf */
-int *rbuf; /* temp region flags */
-int *rptr; /* pointer into region buffer */
-
-void incnmask(void)
-{
- int omax;
- nmask++;
- if( nmask >= maxmask ){
- omax = maxmask;
- maxmask += MASKINC;
- masks = (FilterMask)realloc(masks, maxmask*sizeof(FilterMaskRec));
- memset(masks+omax, 0, (maxmask-omax)*sizeof(FilterMaskRec));
- }
-}
-
-FilterMask
-IMFILTRTN(int txmin, int txmax, int tymin, int tymax, int tblock, int *got)
-{
- int i, j;
- int fieldonly;
- GFilt g;
- Scan scan, tscan;
-
- /* make sure we have something to process */
- if( NSHAPE <=0 ){
- *got = 0;
- return NULL;
- }
- /* allocate space for the globals */
- g = (GFilt)calloc(1, sizeof(GFiltRec));
- /* see if we have only the field shape */
- fieldonly = (NSHAPE==1) && strstr(FILTSTR, "field");
- /* allocate region records */
- g->nshapes = NSHAPE;
- g->maxshapes = (NSHAPE*(XSNO+1))+1;
- g->shapes = (Shape)calloc(g->maxshapes, sizeof(ShapeRec));
- /* make sure we start at 1 */
- g->block= max(1,tblock);
- g->xmin = max(1,txmin);
- g->xmax = txmax;
- g->ymin = max(1,tymin);
- g->ymax = tymax;
- /* get x and y limits on subsection */
- g->x0 = 1;
- g->y0 = 1;
- g->x1 = (g->xmax-g->xmin)/g->block+1;
- g->y1 = (g->ymax-g->ymin)/g->block+1;
- /* allocate a temp region buffer */
- rlen = g->x1 - g->x0 + 1;
- rbuf = (int *)calloc(rlen+1, sizeof(int));
- /* allocate an array of masks, which will be written to caller */
- maxmask = MASKINC;
- masks = (FilterMask)calloc(maxmask, sizeof(FilterMaskRec));
- /* seed the first region mask value */
- nmask = 0;
- masks[nmask].region = 0;
- /* keep track of how many hits we had for this set of rows */
- nreg = 0;
- /* allocate a buffer for valid y row flags */
- g->ybuf = (int *)calloc(g->y1+1, sizeof(int));
- g->x0s = (int *)calloc(g->y1+1, sizeof(int));
- g->x1s = (int *)calloc(g->y1+1, sizeof(int));
- /* seed impossible values for x limits */
- for(i=0; i<=g->y1; i++) g->x0s[i] = g->x1;
- for(i=0; i<=g->y1; i++) g->x1s[i] = g->x0;
- /* save image mask values */
- if( NMASK ){
- g->nmask = NMASK;
- g->maskdim = MASKDIM;
- g->masks = _masks;
- }
- /* initialize ybuf */
- FINIT;
- /* process all valid rows */
- for(y=g->y0; y<=g->y1; y++){
- if( fieldonly ){
- /* inc the mask count, (extend mask array, if necessary) */
- masks[nmask].region = 1;
- masks[nmask].y = y - g->y0 + 1;
- masks[nmask].xstart = 1;
- masks[nmask].xstop = (g->x1 - g->x0 + 1);
- incnmask();
- continue;
- }
- if( g->ybuf[y] ){
- /* to start this line, we make a seed mask with no region */
- if( masks[nmask].region ){
- /* inc the mask count, (extend mask array, if necessary) */
- incnmask();
- masks[nmask].region = 0;
- }
- /* process each pixel in this row where there is a region */
- for(x=g->x0s[y], rptr=&rbuf[1+(g->x0s[y]-g->x0)]; x<=g->x1s[y];
- x++, rptr++){
- /* get filter result, which is the region id or 0 */
- g->rid = 0;
- if( FILTER ){
- /* never change a region id to a -1 */
- if( *rptr == 0 ){
- nreg++;
- *rptr = g->rid ? g->rid : -1;
- }
- /* but always overwrite a -1 */
- else if( (*rptr == -1) && (g->rid >0) ){
- *rptr = g->rid;
- }
- }
- }
- }
- /* if we have processed a row, make up the segments */
- if( nreg ){
- for(i=1; i<=rlen; i++){
- if( rbuf[i] != masks[nmask].region ){
- /* if previous was non-zero region, finish it and bump to next */
- if( masks[nmask].region ){
- masks[nmask].xstop = i - 1;
- /* inc the mask count, (extend mask array, if necessary) */
- incnmask();
- }
- masks[nmask].y = y - g->y0 + 1;
- masks[nmask].region = rbuf[i];
- masks[nmask].xstart = i;
- }
- }
- /* finish last non-zero segment, inc number of mask segs */
- if( masks[nmask].region ){
- masks[nmask].xstop = (g->x1 - g->x0 + 1);
- /* inc the mask count, (extend mask array, if necessary) */
- incnmask();
- }
- /* reset counters for next set of rows */
- (void)memset(rbuf, 0, (rlen+1)*sizeof(int));
- rptr = rbuf;
- nreg = 0;
- }
- }
- /* free buffers */
- if( rbuf) free(rbuf);
- /* free region information */
- if( g ){
- for(i=0; i<g->maxshapes; i++){
- if( g->shapes[i].scanlist ){
- for(j=0; j<=g->y1; j++){
- if( g->shapes[i].scanlist[j] ){
- for(scan=g->shapes[i].scanlist[j]; scan; ){
- tscan = scan->next;
- free(scan);
- scan = tscan;
- }
- }
- }
- free(g->shapes[i].scanlist);
- }
- if( g->shapes[i].pts ) free(g->shapes[i].pts);
- if( g->shapes[i].xv ) free(g->shapes[i].xv);
- }
- if( g->masks ) free(g->masks);
- if( g->shapes ) free(g->shapes);
- if( g->ybuf ) free(g->ybuf);
- if( g->x0s ) free(g->x0s);
- if( g->x1s ) free(g->x1s);
- if( g ) free(g);
- }
- /* return mask info */
- *got = nmask;
- return masks;
-}
-
-int main(int argc, char **argv)
-{
- int i;
- int get, got;
-#if DO_FILTER_SWAP
- int sgot;
-#endif
-#if HAVE_MINGW32==0
- int pipes[4];
-#endif
- int txmin, txmax, tymin, tymax, tblock;
- char tbuf[SZ_LINE];
- char *s=NULL, *t=NULL, *u=NULL;
-#if USE_WIN32
- HANDLE hStdin, hStdout;
- DWORD dwRead, dwWritten;
-#endif
-
- /* Launch() sometimes rearranges passed pipes to be stdin/stdout */
-#if HAVE_MINGW32==0
- if( (s=getenv("LAUNCH_PIPES")) ){
- t = (char *)strdup(s);
- for(i=0, u=(char *)strtok(t, ","); i<4 && u;
- i++, u=(char *)strtok(NULL,",")){
- pipes[i] = atoi(u);
- }
- if( t ) free(t);
- if( i < 4 ) return(1);
- close(pipes[0]);
- close(pipes[3]);
- dup2(pipes[2], 0); close(pipes[2]);
- dup2(pipes[1], 1); close(pipes[1]);
- }
-#endif
-
-#if USE_WIN32
- hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- hStdin = GetStdHandle(STD_INPUT_HANDLE);
- if( (hStdout == INVALID_HANDLE_VALUE) || (hStdin == INVALID_HANDLE_VALUE) ){
- unlink(argv[0]);
- return 0;
- }
-#endif
-
- /* process requests for region information for sections of the image */
-#ifdef TEST
- while( fgets(tbuf, SZ_LINE, stdin) ){
-#else
-#if USE_WIN32
- while((ReadFile(hStdin, &get, sizeof(int), &dwRead, NULL) != FALSE) &&
- (dwRead == sizeof(int)) ){
-#else
- while( read(0, &get, sizeof(int)) == sizeof(int) ){
-#endif
-#if DO_FILTER_SWAP
- switch(sizeof(int)){
- case 2:
- _sw2((char *)&get,2,NULL,0);
- break;
- case 4:
- _sw4((char *)&get,4,NULL,0);
- break;
- case 8:
- _sw8((char *)&get,8,NULL,0);
- break;
- }
-#endif
-#if USE_WIN32
- if((ReadFile(hStdin, tbuf, get, &dwRead, NULL)==FALSE) || (dwRead != get))
- break;
-#else
- if(read(0, tbuf, get) != get)
- break;
-#endif
-#endif /* #ifdef TEST */
- if(sscanf(tbuf, "%d %d %d %d %d",
- &txmin, &txmax, &tymin, &tymax, &tblock)!=5){
- break;
- }
- masks = IMFILTRTN(txmin, txmax, tymin, tymax, tblock, &got);
-#ifdef TEST
- /* display segments for debugging */
- fprintf(stdout, "nmask=%d\n", nmask);
- for(i=0; i<nmask; i++){
- fprintf(stdout, "region: %d\tx: (%d,%d)\ty: %d\n",
- masks[i].region, masks[i].xstart, masks[i].xstop, masks[i].y);
- }
- fflush(stdout);
-#else
- /* calculate size of data we will write */
- got = got * sizeof(FilterMaskRec);
-#if DO_FILTER_SWAP
- sgot = got;
- switch(sizeof(int)){
- case 2:
- _sw2((char *)&sgot,2,NULL,0);
- break;
- case 4:
- _sw4((char *)&sgot,4,NULL,0);
- break;
- case 8:
- _sw8((char *)&sgot,8,NULL,0);
- break;
- }
-#if USE_WIN32
- WriteFile(hStdout, &sgot, sizeof(int), &dwWritten, NULL);
-#else
- write(1, &sgot, sizeof(int));
-#endif
-#else
-#if USE_WIN32
- WriteFile(hStdout, &got, sizeof(int), &dwWritten, NULL);
-#else
- write(1, &got, sizeof(int));
-#endif
-#endif
-#if DO_FILTER_SWAP
- switch(sizeof(int)){
- case 2:
- _sw2((char *)masks,got,NULL,0);
- break;
- case 4:
- _sw4((char *)masks,got,NULL,0);
- break;
- case 8:
- _sw8((char *)masks,got,NULL,0);
- break;
- }
-#endif
-#if USE_WIN32
- WriteFile(hStdout, masks, got, &dwWritten, NULL);
-#else
- write(1, masks, got);
-#endif
-#endif
- /* free mask records */
- if( masks ) free(masks);
- }
-#ifndef TEST
- unlink(argv[0]);
-#endif
- return 0;
-}
diff --git a/funtools/filter/imregions.c b/funtools/filter/imregions.c
deleted file mode 100644
index 6067d53..0000000
--- a/funtools/filter/imregions.c
+++ /dev/null
@@ -1,2585 +0,0 @@
-/*
- NB: MAKE SURE YOU EDIT THE TEMPLATE FILE!!!!
-*/
-
-#ifndef FILTER_PTYPE
-#include <regions.h>
-#endif
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-/* panda and pie incorrectly used astronomical angles. fixed 4/2004 */
-#define USE_ASTRO_ANGLE 0
-
-/* we might want to avoid (x86) extended precision problems */
-#define USE_FPU_DOUBLE 0
-#if USE_FPU_DOUBLE
-#include <fpu_control.h>
-static fpu_control_t _cw;
-#define FPU_DOUBLE {fpu_control_t _cw2; _FPU_GETCW(_cw); _cw2 = _cw & ~_FPU_EXTENDED; _cw2 |= _FPU_DOUBLE; _FPU_SETCW(_cw2);}
-#define FPU_RESTORE {_FPU_SETCW(_cw);}
-#else
-#define FPU_DOUBLE
-#define FPU_RESTORE
-#endif
-
-/* add to FilterOpen to cause this module to be loaded for dynamic linking */
-static int imregno=0;
-void initimregions(void)
-{
- imregno++;
- return;
-}
-
-static void markx(GFilt g, int UNUSED(sno), int flag, int type, int x, int y)
-{
- /* don't mark exclude regions */
- if( type == TOK_EREG )
- return;
- /* for include, we might extend the x limits */
- if( flag ){
- if( x <= g->x0s[y] )
- g->x0s[y] = max(x,g->x0);
- if( x >= g->x1s[y] )
- g->x1s[y] = min(x,g->x1);
- }
- /* for exclude, we have to look at the full line */
- else{
- g->x0s[y] = g->x0;
- g->x1s[y] = g->x1;
- }
-}
-
-static void marky(GFilt g, int sno, int flag, int type)
-{
- int i;
- /* don't mark exclude regions */
- if( type == TOK_EREG )
- return;
- /* mark include shape */
- if( flag ){
- for(i=max(g->y0,g->shapes[sno].ystart);
- i<=min(g->y1,g->shapes[sno].ystop);
- i++)
- g->ybuf[i] = 1;
- }
- /* mark exclude shape */
- else{
- for(i=g->y0; i<=g->shapes[sno].ystart-1; i++)
- g->ybuf[i] = 1;
- for(i=g->shapes[sno].ystop+1; i<=g->y1; i++)
- g->ybuf[i] = 1;
- }
-}
-
-static int
-imagemaskcmp(const void *s1, const void *s2)
-{
- FilterMask f1 = (FilterMask)s1;
- FilterMask f2 = (FilterMask)s2;
-
- if( f1->y < f2->y ){
- return -1;
- }
- else if( f1->y > f2->y ){
- return 1;
- }
- else{
- if( f1->xstart < f2->xstart ){
- return -1;
- }
- else{
- return 1;
- }
- }
-}
-
-/* ***************************** shape support ***************************** */
-
-static void quadeq(double a, double b, double c,
- double *x1, double *x2, int *nr, int *nc)
-{
- double dis, q;
- if( feq(a,0.0) ){
- *nc = 0;
- if( feq(b,0.0) ){
- *nr = 0; *x1 = 0.0;
- }
- else{
- *nr = 1; *x1 = -c / b;
- }
- *x2 = *x1;
- }
- else{
- dis = b*b - 4.0 * a * c;
- if( dis > 0.0 ){
- *nr = 2; *nc = 0;
- dis = sqrt(dis);
- if( b < 0.0 ) dis = -dis;
- q = -0.5 * (b + dis);
- *x1 = q/a; *x2 = c/q;
- if(*x1 > *x2){
- q = *x1; *x1 = *x2; *x2 = q;
- }
- }
- else if( feq(dis,0.0) ){
- *nr = 1; *nc = 0; *x1 = - 0.5 * b / a; *x2 = *x1;
- }
- else{
- *nr = 0; *nc = 2; *x1 = - 0.5 * b / a; *x2 = 0.5 * sqrt(-dis) / a;
- }
- }
-}
-
-static void rgs_mark(GFilt g, Scan *scanlist,
- int sno, int flag, int type, int xval, int yval )
-{
- Scan scanmark, mark;
- /* since yval is used as an index, make sure its within limits */
- if(yval < g->y0) yval = g->y0;
- if(yval > g->y1) yval = g->y1;
- mark = (Scan)calloc(1, sizeof(ScanRec));
- mark->x = xval;
- /* sanity check */
- if( !scanlist ) return;
- /* starts are installed at back of list for given x */
- if( !scanlist[yval] || ((scanlist[yval])->x > xval) ){
- mark->next = scanlist[yval];
- scanlist[yval] = mark;
- } else {
- scanmark = scanlist[yval];
- while( scanmark->next && ((scanmark->next)->x < xval) )
- scanmark = scanmark->next;
- mark->next = scanmark->next;
- scanmark->next = mark;
- }
- markx(g, sno, flag, type, xval, yval);
-}
-
-static void rgs_segment(GFilt g, Scan *scanlist, int width, int height,
- int sno, int flag, int type,
- double x1, double y1, double x2, double y2)
-{
- int ystart, ystop, yval, xval;
- double invslope, xoffset;
-
- ystart = PIXINCL(y1);
- if( ystart < 1 ) ystart = 1;
- /* note: PIXINCL(stop) is 1st pixel not counted */
- ystop = PIXINCL(y2) - 1;
- if( ystop > height ) ystop = height;
- /* ignore segment if there is no positive slope in integer coords */
- if( (ystart > ystop) || (ystop < 1) )
- return;
- /* use inverse slope (run/rise) to get x given y with a multiply */
- invslope = (x1 - x2) / (y1 - y2);
- xoffset = x1 + ((ystart - y1) * invslope);
- for(yval=ystart; yval<=ystop; yval++){
- xval = PIXINCL(xoffset);
- /* clip line to edges of image area (actually bend line) */
- if(xval < 1) xval = 1;
- if(xval > width) xval = width + 1;
- rgs_mark(g, scanlist, sno, flag, type, xval, yval);
- xoffset = xoffset + invslope;
- }
-}
-
-static void _polygoni(GFilt g, int qt, int UNUSED(rno), int sno, int flag,
- int type, double *vx, double *vy, int count)
-{
- int i, j;
- double xlo, xhi;
- double ylo, yhi;
-
-#ifdef ALREADY_DONE
- /* divide by block factor to get real endpoints */
- for(i=0; i<count; i++){
- vx[i] = (vx[i] - g->xmin)/g->block + 1.0;
- vy[i] = (vy[i] - g->ymin)/g->block + 1.0;
- }
-#endif
- /* find the limits */
- xlo = vx[0];
- xhi = xlo;
- ylo = vy[0];
- yhi = ylo;
- for(i=0; i<count; i++){
- if(vx[i] > xhi) xhi = vx[i];
- if(vx[i] < xlo) xlo = vx[i];
- if(vy[i] > yhi) yhi = vy[i];
- if(vy[i] < ylo) ylo = vy[i];
- }
- if( qt && (sno > 1) ){
- g->shapes[sno].ystart = g->shapes[sno-1].ystart;
- g->shapes[sno].ystop = g->shapes[sno-1].ystop;
- }
- else{
- g->shapes[sno].ystart = max(g->y0,PIXINCL(ylo));
- g->shapes[sno].ystop = min(g->y1,PIXINCL(yhi) - 1);
- }
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- marky(g, sno, flag, type);
-
- /* mark all horizontal segment crossings */
- /* start with segment between last and first point */
- j = count-1;
- for(i=0; i<count; i++){
- /* make segments always run from lower y to higher y */
- if(vy[i] > vy[j]){
- rgs_segment(g, g->shapes[sno].scanlist, g->x1, g->y1,
- sno, flag, type, vx[j], vy[j], vx[i], vy[i]);
- }
- else{
- rgs_segment(g, g->shapes[sno].scanlist, g->x1, g->y1,
- sno, flag, type, vx[i], vy[i], vx[j], vy[j]);
- }
- j = i;
- }
-}
-
-static int corner_vertex(int index, int width, int height,
- double *x, double *y)
-{
- switch (index) {
- case 1:
- *x = 0.0;
- *y = height + 1;
- break;
- case 2:
- *x = 0.0;
- *y = 0.0;
- break;
- case 3:
- *x = width + 1;
- *y = 0.0;
- break;
- case 4:
- *x = width + 1;
- *y = height + 1;
- default:
- break;
- }
- index = index + 1;
- if(index > 4) index = 1;
- return(index);
-}
-
-static int pie_intercept(int width, int height, double xcen, double ycen,
- double angle, double *xcept, double *ycept)
-{
- double angl, slope; /* l: angle and slope of ray */
- angl = angle;
- /* put angles in normal range */
- while (angl < 0.0)
- angl = angl + 360.0;
- while (angl >= 360.0)
- angl = angl - 360.0;
- /* check for a horizontal angle */
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 180.0) < SMALL_NUMBER) {
-#endif
- *xcept = 0.0;
- *ycept = ycen;
- return(2);
- }
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 0.0) < SMALL_NUMBER) {
-#endif
- *xcept = width + 1;
- *ycept = ycen;
- return(4);
- }
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle */
- angl = angl + 90.0;
-#endif
- if(angl >= 360.0)
- angl = angl - 360.0;
- if(angl < 180.0) {
- *ycept = height + 1;
- /* rule out vertical line */
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(1);
- }
- } else {
- *ycept = 0.0;
- /* rule out vertical line */
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(3);
- }
- }
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- /* calculate slope */
- slope = tan(angl);
- /* calculate intercept with designated y edge */
- *xcept = xcen + ((*ycept - ycen) / slope);
- if(*xcept < 0) {
- *ycept = (ycen - (xcen * slope));
- *xcept = 0.0;
- return(2);
- } else if(*xcept > (width + 1)) {
- *ycept = (ycen + ((width + 1 - xcen) * slope));
- *xcept = width + 1;
- return(4);
- } else {
- if(*ycept < height)
- return(3);
- else
- return(1);
- }
-}
-
-void _impiei(GFilt g, int qt, int rno, int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen, double angle1, double angle2)
-{
- int width, height; /* l: image mask width and height */
- double sweep; /* l: sweep between cut angles */
- double vx[7], vy[7]; /* l: arrays of vertices for polygon */
- int count; /* l: number of polygon vertices */
- int intrcpt1, intrcpt2; /* l: side intercepted by each cut */
- double x2, y2; /* l: coordinates of second intercept */
-
- /* NB: do not use x and y variables, they have bogus values */
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- /* temps */
- width = g->x1;
- height = g->y1;
- /* start listing vertices of polygon */
- vx[0] = xcen;
- vy[0] = ycen;
- sweep = angle2 - angle1;
- /* if sweep is too small to be noticed, don't bother */
- if(fabs(sweep) < SMALL_NUMBER)
- return;
- if (sweep < 0.0) sweep = sweep + 360.0;
- intrcpt1 = pie_intercept(width, height, xcen, ycen, angle1,
- &(vx[1]), &(vy[1]));
- intrcpt2 = pie_intercept(width, height, xcen, ycen, angle2,
- &x2, &y2);
- count = 2;
- /* if angles intercept same side and slice is between them, no corners */
- /* else, mark corners until reaching side with second angle intercept */
- if((intrcpt1 != intrcpt2) || (sweep > 180.0)){
- do{
- intrcpt1 = corner_vertex(intrcpt1, width, height,
- &(vx[count]), &(vy[count]));
- count = count + 1;
- }while(intrcpt1 != intrcpt2);
- }
- vx[count] = x2;
- vy[count] = y2;
- count++;
- _polygoni(g, qt, rno, sno, flag, type, vx, vy, count);
-}
-
-/* ***************************** shapes ********************************** */
-
-void imannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius)
-{
- int yy;
- double dval;
- double xoff, yoff;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- if( iradius == 0 ){
- imcirclei(g, rno, sno, flag, type, x, y, xcen, ycen, oradius);
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- iradius /= (double)g->block;
- oradius /= (double)g->block;
- /* set y limits */
- if( PIXSTART(ycen - oradius) < PIXSTOP(ycen + oradius) ){
- g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - oradius));
- g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + oradius));
- }
- else{
- g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + oradius));
- g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - oradius));
- }
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- yoff = PIXCEN(yy) - ycen;
- if( (dval=(oradius * oradius) - (yoff * yoff)) > 0.0 ){
- xoff = sqrt(dval);
- if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);
- }
- if( (dval=(iradius * iradius) - (yoff * yoff)) > 0.0 ){
- xoff = sqrt(dval);
- if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);
- }
- }
- }
- }
-}
-
-int imannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius)
-{
- Scan scan;
-
- if( iradius == 0 ){
- return(imcircle(g, rno, sno, flag, type, x, y, xcen, ycen, oradius));
- }
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- ((y >= g->shapes[sno].ystart) && (y <= g->shapes[sno].ystop)) &&
- (scan->next->next ?
- (((x >= scan->x) && (x <= scan->next->next->next->x)) &&
- !((x >= scan->next->x) && (x <= scan->next->next->x))) :
- ((x >= scan->x) && (x <= scan->next->x))))
- ==flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-void imboxi(GFilt g, int rno, int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen, double xwidth, double yheight,
- double angle)
-{
- double angl; /* l: Cartesian angle in radians */
- double half_width, half_height;/* l: radii (1/2 width and height) */
- double cosangl, sinangl; /* l: sine, cosine of the Cartesian angle */
- double hw_cos, hw_sin; /* l: products of half_width with sin, cos */
- double hh_cos, hh_sin; /* l: products of half_height with sin, cos */
- double cornerx[4], cornery[4]; /* l: arrays of x and y coords of 4 corners */
-
- /* NB: do not use x and y variables, they have bogus values */
- if( (xwidth == 0) && (yheight==0) ){
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- xwidth /= (double)g->block;
- yheight /= (double)g->block;
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save angle for use in multi or slices */
- angl = angle + 90.0;
-#else
- angl = angle;
-#endif
- while (angl >= 360.0) angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin (angl);
- cosangl = cos (angl);
-#if USE_ASTRO_ANGLE
- /* since we rotate by 90.0 degrees to get from astro angle to cartesian, */
- /* we also need to switch the width and height. we do this secretly so */
- /* that the display will turn out right, by doing it in the half terms */
- half_width = yheight / 2.0;
- half_height = xwidth / 2.0;
-#else
- half_width = xwidth / 2.0;
- half_height = yheight / 2.0;
-#endif
- hw_cos = half_width * cosangl;
- hw_sin = half_width * sinangl;
- hh_cos = half_height * cosangl;
- hh_sin = half_height * sinangl;
-#if USE_ASTRO_ANGLE
- cornerx[0] = xcen - hw_cos - hh_sin;
- cornery[0] = ycen - hw_sin + hh_cos;
- cornerx[1] = xcen + hw_cos - hh_sin;
- cornery[1] = ycen + hw_sin + hh_cos;
- cornerx[2] = xcen + hw_cos + hh_sin;
- cornery[2] = ycen + hw_sin - hh_cos;
- cornerx[3] = xcen - hw_cos + hh_sin;
- cornery[3] = ycen - hw_sin - hh_cos;
-#else
- cornerx[0] = xcen - hw_cos + hh_sin;
- cornery[0] = ycen - hh_cos - hw_sin;
- cornerx[1] = xcen - hw_cos - hh_sin;
- cornery[1] = ycen + hh_cos - hw_sin;
- cornerx[2] = xcen + hw_cos - hh_sin;
- cornery[2] = ycen + hh_cos + hw_sin;
- cornerx[3] = xcen + hw_cos + hh_sin;
- cornery[3] = ycen - hh_cos + hw_sin;
-#endif
- _polygoni(g, 0, rno, sno, flag, type, cornerx, cornery, 4);
-}
-
-int imbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen),
- double xwidth, double yheight,
- double UNUSED(angle))
-{
- if( (xwidth == 0) && (yheight==0) ){
- return(!flag);
- }
- return impolygon(g, rno, sno, flag, type, x, y);
-}
-
-void imcirclei(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen, double radius)
-{
- int yy;
- double dval;
- double xoff, yoff;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
- if( radius == 0 ){
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- radius /= (double)g->block;
- /* set y limits */
- if( PIXSTART(ycen - radius) < PIXSTOP(ycen + radius) ){
- g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - radius));
- g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + radius));
- }
- else{
- g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + radius));
- g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - radius));
- }
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- yoff = PIXCEN(yy) - ycen;
- if( (dval=(radius * radius) - (yoff * yoff))>=0.0 ){
- xoff = sqrt(dval);
- if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);
- }
- }
- }
-}
-
-int imcircle(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen), double radius)
-{
- Scan scan;
-
- if( radius == 0 ){
- return(!flag);
- }
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- ((x >= scan->x) && (x <= (scan->next)->x))) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-void imellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double angle)
-{
- int yy;
- int nr, nc;
- double yhi;
- double yoff;
- double xboff, xfoff;
- double angl;
- double sinangl, cosangl;
- double cossq, sinsq, xradsq, yradsq;
- double a, b_partial, c_partial;
- double b, c;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- if( xrad == yrad ){
- imcirclei(g, rno, sno, flag, type, x, y, xcen, ycen, xrad);
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- xrad /= (double)g->block;
- yrad /= (double)g->block;
- /* set worst case limits (xrad axis parallel to vertical axis) */
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save "angle" for use by other routines */
- angl = angle + 90.0;
-#else
- angl = angle;
-#endif
- while( angl >= 360.0 )
- angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin(angl);
- cosangl = cos(angl);
- /* calculate approximate y limits */
- /* choose lesser of containing rotbox and circle */
- FPU_DOUBLE
-#if USE_ASTRO_ANGLE
- yhi = fabs(sinangl * yrad) + fabs(cosangl * xrad);
-#else
- yhi = fabs(sinangl * xrad) + fabs(cosangl * yrad);
-#endif
- yhi = min(yhi, max(yrad, xrad));
- /* set y limits */
- if( PIXSTART(ycen - yhi) < PIXSTOP(ycen + yhi) ){
- g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - yhi));
- g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + yhi));
- }
- else{
- g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + yhi));
- g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - yhi));
- }
- FPU_RESTORE
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* prepare partials for quadratic equation solutions to coordinates */
- cossq = cosangl * cosangl;
- sinsq = sinangl * sinangl;
-#if USE_ASTRO_ANGLE
- /* because we rotate by 90.0 degrees to get from astro angle to */
- /* cartesian, we also need to switch the x and y axes. we do this */
- /* secretly so that the display will turn out right, by doing it in */
- /* the sq terms */
- xradsq = yrad * yrad;
- yradsq = xrad * xrad;
-#else
- xradsq = xrad * xrad;
- yradsq = yrad * yrad;
-#endif
- /* fill in as much of a,b,c as we can */
- a = (cossq / xradsq) + (sinsq / yradsq);
- b_partial = (2.0 * sinangl) * ((cosangl / xradsq) - (cosangl / yradsq));
- c_partial = (sinsq / xradsq) + (cossq / yradsq);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- yoff = yy - ycen;
- b = b_partial * yoff;
- c = (c_partial * yoff * yoff) - 1.0;
- /* solve quadratic */
- quadeq (a, b, c, &xboff, &xfoff, &nr, &nc);
- /* if real roots */
- if( nr != 0 ) {
- /* translate x coordinates */
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen + xboff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xfoff), yy);
- }
- }
-}
-
-int imellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double UNUSED(angle))
-{
- Scan scan;
-
- if( xrad == yrad ){
- return(imcircle(g, rno, sno, flag, type, x, y, xcen, ycen, xrad));
- }
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- FPU_DOUBLE
- if( (scan &&
- ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- ((x >= scan->x) && (x <= (scan->next)->x))) == flag ){
- if( rno && flag ) g->rid = rno;
- FPU_RESTORE
- return 1;
- }
- else{
- FPU_RESTORE
- return 0;
- }
-}
-
-void imfieldi(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y))
-{
- int yy;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
- g->shapes[sno].ystart = g->y0;
- g->shapes[sno].ystop = g->y1;
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- rgs_mark(g, scanlist, sno, flag, type, g->x0, yy);
- rgs_mark(g, scanlist, sno, flag, type, g->x1, yy);
- }
-}
-
-int imfield(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),
- double UNUSED(x), double UNUSED(y))
-{
- if( flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-void imlinei(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double x1, double y1, double x2, double y2)
-{
- double vx[2];
- double vy[2];
- int xval, yval;
- double invslope, xoffset;
-
- /* NB: do not use x and y variables, they have bogus values */
- /* divide by block factor to get "real" parameters */
- x1 = (x1 - g->xmin)/g->block + 1.0;
- y1 = (y1 - g->ymin)/g->block + 1.0;
- x2 = (x2 - g->xmin)/g->block + 1.0;
- y2 = (y2 - g->ymin)/g->block + 1.0;
- /* order by increasing y */
- if( y1 < y2 ){
- vx[0] = x1;
- vy[0] = y1;
- vx[1] = x2;
- vy[1] = y2;
- }
- else{
- vx[0] = x2;
- vy[0] = y2;
- vx[1] = x1;
- vy[1] = y1;
- }
- /* set y limits */
- g->shapes[sno].ystart = PIXNUM(vy[0]);
- g->shapes[sno].ystop = PIXNUM(vy[1]);
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- marky(g, sno, flag, type);
- if( feq(vy[0],vy[1]) ){
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,
- (int)min(vx[0],vx[1]), (int)vy[0]);
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,
- (int)max(vx[0],vx[1]), (int)vy[0]);
- }
- else{
- /* mark all horizontal segment crossings */
- invslope = (vx[0] - vx[1]) / (vy[0] - vy[1]);
- xoffset = vx[0];
- for(yval=vy[0]; yval<=vy[1]; yval++){
- xval = xoffset;
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type, xval, yval);
- xoffset = xoffset + invslope;
- }
- }
-}
-
-int imline(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double UNUSED(x1), double UNUSED(y1),
- double UNUSED(x2), double UNUSED(y2))
-{
- Scan scan;
-
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- ((x==(int)scan->x) ||
- (scan->next&&((x>=(int)scan->x)&&(x<=(int)scan->next->x)))))==flag ) {
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-void impiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- _impiei(g, 0, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);
-}
-
-int impie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen),
- double UNUSED(angle1), double UNUSED(angle2))
-{
- return impolygon(g, rno, sno, flag, type, x, y);
-}
-
-void imqtpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- _impiei(g, 1, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);
-}
-
-int imqtpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen),
- double UNUSED(angle1), double UNUSED(angle2))
-{
- return impolygon(g, rno, sno, flag, type, x, y);
-}
-
-void impointi(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen)
-{
- /* NB: do not use x and y variables, they have bogus values */
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- /* set y limits */
- g->shapes[sno].ystart = PIXNUM(ycen);
- g->shapes[sno].ystop = PIXNUM(ycen);
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- marky(g, sno, flag, type);
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,
- PIXNUM(xcen), PIXNUM(ycen));
-}
-
-int impoint(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen))
-{
- Scan scan;
-
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- (y == (int)g->shapes[sno].ystart) &&
- (x == (int)scan->x))==flag ) {
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-#ifdef __STDC__
-void
-impolygoni(GFilt g, int rno, int sno, int flag, int type,
- double UNUSED(x), double y, ...)
-{
- double *vx=NULL, *vy=NULL;
- int count, maxcount;
- va_list args;
- va_start(args, y);
-#else
-void impolygoni(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *vx=NULL, *vy=NULL;
- int count, maxcount;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- /* NB: do not use x and y variables, they have bogus values */
- /* allocate space for x,y arguments */
- maxcount = MASKINC;
- vx = (double *)calloc(maxcount, sizeof(double));
- vy = (double *)calloc(maxcount, sizeof(double));
- /* look for x,y arguments */
- count = 0;
- while( 1 ){
- if( (count + 1) >= maxcount ){
- maxcount += MASKINC;
- vx = (double *)realloc(vx, maxcount*sizeof(double));
- vy = (double *)realloc(vy, maxcount*sizeof(double));
- }
- vx[count] = va_arg(args, double);
- vy[count] = va_arg(args, double);
- if( feq(vx[count],PSTOP) && feq(vy[count],PSTOP) )
- break;
- vx[count] = (vx[count] - g->xmin)/g->block + 1.0;
- vy[count] = (vy[count] - g->ymin)/g->block + 1.0;
- count ++;
- }
- va_end(args);
- /* realloc to actual size */
- vx = (double *)realloc(vx, count*sizeof(double));
- vy = (double *)realloc(vy, count*sizeof(double));
- /* call the common routine */
- _polygoni(g, 0, rno, sno, flag, type, vx, vy, count);
- if( vx ) free(vx);
- if( vy ) free(vy);
-}
-
-#ifdef __STDC__
-int
-impolygon(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y, ...)
-{
- int crossings;
- Scan scan;
- va_list args;
- va_start(args, y);
-#else
-int impolygon(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- int crossings;
- Scan scan;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- va_end(args);
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- /* no initialization of x for this row, just jump right in */
- if( (y>=g->shapes[sno].ystart)&&(y<=g->shapes[sno].ystop) ){
- crossings = 0;
- for(scan=g->shapes[sno].scanlist[(int)y]; scan; scan=scan->next){
- if( x >= scan->x )
- crossings++;
- else
- break;
- }
- if( (crossings%2) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
- }
- else{
- return !flag;
- }
-}
-
-void imnannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi);
- for(i=0; i<n; i++){
- imannulusi(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc));
- }
-}
-
-void imnboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang);
- imboxi(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang);
- for(i=0; i<n; i++){
- imboxi(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang);
- }
-}
-
-void imnellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang);
- imellipsei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang);
- for(i=0; i<n; i++){
- imellipsei(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang);
- }
-}
-
-void imnpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- while( lo > hi ) lo -= 360.0;
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- impiei(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi);
- for(i=0; i<n; i++){
- impiei(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc));
- }
-}
-
-void impandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn)
-{
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, rinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- rinc = (radhi - radlo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init pies and annuli */
- imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi);
- imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);
- for(a=0; a<ahi; a++){
- for(r=0; r<rhi; r++){
- imannulusi(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, radlo+(r*rinc), radlo+((r+1)*rinc));
- imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));
- n++;
- }
- }
-}
-
-void imbpandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init pies and ellipses */
- imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi, ang);
- imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);
- imboxi(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo, ang);
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- imboxi(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang);
- imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));
- n++;
- }
- }
-}
-
-void imepandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init pies and ellipses */
- imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi, ang);
- imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);
- imellipsei(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo, ang);
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- imellipsei(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang);
- imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));
- n++;
- }
- }
-}
-
-/* accelerator regions -- lower and upper limits are given for n regions */
-
-int imnannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- dinc = (hi - lo)/(double)n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imannulus(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int imnbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imbox(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( imbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int imnellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imellipse(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( imellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int imnpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- while( lo > hi ) lo -= 360.0;
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* check limits */
- if( !impie(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( impie(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !impie(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int impanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, rinc;
-
- /* get limits */
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- rinc = (radhi - radlo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi) ||
- !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=1; a<=ahi; a++){
- for(r=1; r<=rhi; r++){
- if( imannulus(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, radlo+((r-1)*rinc), radlo+(r*rinc)) &&
- impie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+((a-1)*ainc), anglo+(a*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, radlo, radhi) )
- return(1);
- else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int imbpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( imbox(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the box .. must also be in the pie */
- else if( !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( imbox(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- imqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !imbox(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int imepanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( imellipse(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the ellipse .. must also be in the pie */
- else if( !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( imellipse(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- imqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !imellipse(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-#ifdef __STDC__
-void
-imvannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvannulusi(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- imannulusi(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]);
- return;
- }
- imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]);
- for(i=0; i<(n-1); i++){
- imannulusi(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]);
- }
-}
-
-#ifdef __STDC__
-void
-imvboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvboxi(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- imboxi(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- return;
- }
- imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang);
- imboxi(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- for(i=2, j=0; i<n; i+=2, j++){
- imboxi(g, rno+j, sno+j, flag, type, x, y, xcen, ycen, xv[i], xv[i+1], ang);
- }
-}
-
-#ifdef __STDC__
-void
-imvellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvellipsei(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- imellipsei(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- return;
- }
- imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang);
- imellipsei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- for(i=2, j=0; i<n; i+=2, j++){
- imellipsei(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang);
- }
-}
-
-#ifdef __STDC__
-void
-imvpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvpiei(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- impiei(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]);
- return;
- }
- impiei(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]);
- for(i=0; i<(n-1); i++){
- impiei(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]);
- }
-}
-
-#ifdef __STDC__
-void
-imvpointi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, y);
-#else
-int imvpointi(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- for(i=0, j=0; i<n; i+=2, j++){
- impointi(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]);
- }
-}
-
-/* varargs regions -- a series of lower and upper limits is specified */
-
-#ifdef __STDC__
-int
-imvannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvannulus(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(imannulus(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imannulus(g, rno+i, sno+i, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-imvbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvbox(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(imbox(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( imbox(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- else if( imbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-imvellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvellipse(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(imellipse(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1],
- ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( imellipse(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( imellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-imvpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvpie(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(impie(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !impie(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( impie(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !impie(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(1);
- }
-}
-
-#ifdef __STDC__
-int
-imvpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, y);
-#else
-int imvpoint(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* look through all of them to find the right one */
- for(i=0, j=0; i<n; i+=2, j++){
- if( impoint(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
-}
-
-void imimagemaski(GFilt g, int UNUSED(rno), int UNUSED(sno),
- int UNUSED(flag), int UNUSED(type),
- double UNUSED(x), double UNUSED(y))
-{
- int i, j;
- int got;
- int fsize;
- int mblock;
- FilterMask xmasks;
-
- /* NB: do not use x and y variables, they have bogus values */
- /* scale mask x, y values to match the incoming image section */
- mblock = (int)(((double)((g->xmax - g->xmin + 1)/g->block)/(double)g->maskdim) + 0.5);
- if( mblock < 1 ){
- g->masks = NULL;
- g->nmask = 0;
- }
- /* copy all masks and translate x,y positions as needed */
- fsize = g->nmask * sizeof(FilterMaskRec) * mblock;
- xmasks = (FilterMask)calloc(1, fsize);
- for(got=0, i=0; i<g->nmask; i++){
- xmasks[got].region = g->masks[i].region;
- xmasks[got].y = (g->masks[i].y - 1.0) * mblock + 1.0;
- xmasks[got].xstart = (g->masks[i].xstart - 1.0) * mblock + 1.0;
- xmasks[got].xstop = (g->masks[i].xstop - 1.0) * mblock + 1.0;
- /* replicate the segment up to the block factor */
- for(j=1; j<mblock; j++){
- xmasks[got+j].region = xmasks[got].region;
- xmasks[got+j].y = xmasks[got].y+j;
- xmasks[got+j].xstart = xmasks[got].xstart;
- xmasks[got+j].xstop = xmasks[got].xstop;
- }
- got += mblock;
- }
- /* sort by y and x */
- qsort(xmasks, got, sizeof(FilterMaskRec), imagemaskcmp);
- /* we don't free previous masks, just overwrite, because they were not
- allocated in the first place */
- /* if( g->masks ) free(g->masks); */
- /* set up new mask records */
- g->masks = xmasks;
- g->nmask = got;
-
- /* now mark each y line that has a y mask value */
- for(i=0; i<got; i++){
- if( !g->ybuf[g->masks[i].y] )
- g->ybuf[g->masks[i].y] = i+1;
- }
-}
-
-int imimagemask(GFilt g, int UNUSED(rno), int UNUSED(sno),
- int UNUSED(flag), int UNUSED(type),
- double x, double y)
-{
- int i;
- int ix, iy;
-
- if( g->nmask == 0 )
- return(0);
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- ix = (int)x;
- iy = (int)y;
- /* look for mask segment containing ix, iy */
- i = g->ybuf[iy];
- /* ybuf contains offset+1 of first mask record containing iy */
- if( i != 0 ){
- i--;
- for(; i<g->nmask; i++){
- if( g->masks[i].y > iy ){
- return(0);
- }
- if( (ix >= g->masks[i].xstart) && (ix <= g->masks[i].xstop) ){
- g->rid = g->masks[i].region;
- return(1);
- }
- }
- }
- return(0);
-}
-
diff --git a/funtools/filter/imregions_c.h b/funtools/filter/imregions_c.h
deleted file mode 100644
index bb6cdc0..0000000
--- a/funtools/filter/imregions_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *IMREGIONS_C="\n/*\n NB: MAKE SURE YOU EDIT THE TEMPLATE FILE!!!!\n*/\n\n#ifndef FILTER_PTYPE\n#include <regions.h>\n#endif\n\n#ifndef UNUSED\n#ifdef __GNUC__\n# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))\n#else\n# define UNUSED(x) UNUSED_ ## x\n#endif\n#endif\n\n\n#define USE_ASTRO_ANGLE 0\n\n\n#define USE_FPU_DOUBLE 0\n#if USE_FPU_DOUBLE\n#include <fpu_control.h>\nstatic fpu_control_t _cw;\n#define FPU_DOUBLE {fpu_control_t _cw2; _FPU_GETCW(_cw); _cw2 = _cw & ~_FPU_EXTENDED; _cw2 |= _FPU_DOUBLE; _FPU_SETCW(_cw2);}\n#define FPU_RESTORE {_FPU_SETCW(_cw);}\n#else\n#define FPU_DOUBLE\n#define FPU_RESTORE\n#endif\n\n\nstatic int imregno=0;\nvoid initimregions(void)\n{\n imregno++;\n return;\n}\n\nstatic void markx(GFilt g, int UNUSED(sno), int flag, int type, int x, int y)\n{\n \n if( type == TOK_EREG )\n return;\n \n if( flag ){\n if( x <= g->x0s[y] )\n g->x0s[y] = max(x,g->x0);\n if( x >= g->x1s[y] )\n g->x1s[y] = min(x,g->x1);\n }\n \n else{\n g->x0s[y] = g->x0;\n g->x1s[y] = g->x1;\n }\n}\n\nstatic void marky(GFilt g, int sno, int flag, int type)\n{\n int i;\n \n if( type == TOK_EREG )\n return;\n \n if( flag ){\n for(i=max(g->y0,g->shapes[sno].ystart);\n i<=min(g->y1,g->shapes[sno].ystop);\n i++)\n g->ybuf[i] = 1;\n }\n \n else{\n for(i=g->y0; i<=g->shapes[sno].ystart-1; i++)\n g->ybuf[i] = 1;\n for(i=g->shapes[sno].ystop+1; i<=g->y1; i++)\n g->ybuf[i] = 1;\n }\n}\n\nstatic int\nimagemaskcmp(const void *s1, const void *s2)\n{\n FilterMask f1 = (FilterMask)s1;\n FilterMask f2 = (FilterMask)s2;\n \n if( f1->y < f2->y ){\n return -1;\n }\n else if( f1->y > f2->y ){\n return 1;\n }\n else{\n if( f1->xstart < f2->xstart ){\n return -1;\n }\n else{\n return 1;\n }\n }\n}\n\n\n\nstatic void quadeq(double a, double b, double c,\n double *x1, double *x2, int *nr, int *nc)\n{\n double dis, q;\n if( feq(a,0.0) ){\n *nc = 0;\n if( feq(b,0.0) ){\n *nr = 0; *x1 = 0.0;\n }\n else{\n *nr = 1; *x1 = -c / b;\n }\n *x2 = *x1;\n }\n else{\n dis = b*b - 4.0 * a * c;\n if( dis > 0.0 ){\n *nr = 2; *nc = 0;\n dis = sqrt(dis);\n if( b < 0.0 ) dis = -dis;\n q = -0.5 * (b + dis);\n *x1 = q/a; *x2 = c/q;\n if(*x1 > *x2){\n q = *x1; *x1 = *x2; *x2 = q;\n }\n } \n else if( feq(dis,0.0) ){\n *nr = 1; *nc = 0; *x1 = - 0.5 * b / a; *x2 = *x1;\n }\n else{\n *nr = 0; *nc = 2; *x1 = - 0.5 * b / a; *x2 = 0.5 * sqrt(-dis) / a;\n }\n }\n}\n\nstatic void rgs_mark(GFilt g, Scan *scanlist,\n int sno, int flag, int type, int xval, int yval )\n{\n Scan scanmark, mark;\n \n if(yval < g->y0) yval = g->y0;\n if(yval > g->y1) yval = g->y1;\n mark = (Scan)calloc(1, sizeof(ScanRec));\n mark->x = xval;\n \n if( !scanlist ) return;\n \n if( !scanlist[yval] || ((scanlist[yval])->x > xval) ){\n mark->next = scanlist[yval];\n scanlist[yval] = mark;\n } else {\n scanmark = scanlist[yval];\n while( scanmark->next && ((scanmark->next)->x < xval) )\n scanmark = scanmark->next;\n mark->next = scanmark->next;\n scanmark->next = mark;\n }\n markx(g, sno, flag, type, xval, yval);\n}\n\nstatic void rgs_segment(GFilt g, Scan *scanlist, int width, int height,\n int sno, int flag, int type,\n double x1, double y1, double x2, double y2)\n{\n int ystart, ystop, yval, xval;\n double invslope, xoffset;\n\n ystart = PIXINCL(y1);\n if( ystart < 1 ) ystart = 1;\n \n ystop = PIXINCL(y2) - 1;\n if( ystop > height ) ystop = height;\n \n if( (ystart > ystop) || (ystop < 1) )\n return;\n \n invslope = (x1 - x2) / (y1 - y2);\n xoffset = x1 + ((ystart - y1) * invslope);\n for(yval=ystart; yval<=ystop; yval++){\n xval = PIXINCL(xoffset);\n \n if(xval < 1) xval = 1;\n if(xval > width) xval = width + 1;\n rgs_mark(g, scanlist, sno, flag, type, xval, yval);\n xoffset = xoffset + invslope;\n }\n}\n\nstatic void _polygoni(GFilt g, int qt, int UNUSED(rno), int sno, int flag,\n int type, double *vx, double *vy, int count)\n{\n int i, j;\n double xlo, xhi;\n double ylo, yhi;\n\n#ifdef ALREADY_DONE\n \n for(i=0; i<count; i++){\n vx[i] = (vx[i] - g->xmin)/g->block + 1.0;\n vy[i] = (vy[i] - g->ymin)/g->block + 1.0;\n }\n#endif\n \n xlo = vx[0];\n xhi = xlo;\n ylo = vy[0];\n yhi = ylo;\n for(i=0; i<count; i++){\n if(vx[i] > xhi) xhi = vx[i];\n if(vx[i] < xlo) xlo = vx[i];\n if(vy[i] > yhi) yhi = vy[i];\n if(vy[i] < ylo) ylo = vy[i];\n }\n if( qt && (sno > 1) ){\n g->shapes[sno].ystart = g->shapes[sno-1].ystart;\n g->shapes[sno].ystop = g->shapes[sno-1].ystop;\n }\n else{\n g->shapes[sno].ystart = max(g->y0,PIXINCL(ylo));\n g->shapes[sno].ystop = min(g->y1,PIXINCL(yhi) - 1);\n }\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n marky(g, sno, flag, type);\n\n \n \n j = count-1;\n for(i=0; i<count; i++){\n \n if(vy[i] > vy[j]){\n rgs_segment(g, g->shapes[sno].scanlist, g->x1, g->y1,\n sno, flag, type, vx[j], vy[j], vx[i], vy[i]);\n }\n else{\n rgs_segment(g, g->shapes[sno].scanlist, g->x1, g->y1,\n sno, flag, type, vx[i], vy[i], vx[j], vy[j]);\n }\n j = i;\n }\n}\n\nstatic int corner_vertex(int index, int width, int height,\n double *x, double *y)\n{\n switch (index) {\n case 1:\n *x = 0.0;\n *y = height + 1;\n break;\n case 2:\n *x = 0.0;\n *y = 0.0;\n break;\n case 3:\n *x = width + 1;\n *y = 0.0;\n break;\n case 4:\n *x = width + 1;\n *y = height + 1;\n default:\n break;\n }\n index = index + 1;\n if(index > 4) index = 1;\n return(index);\n}\n\nstatic int pie_intercept(int width, int height, double xcen, double ycen,\n double angle, double *xcept, double *ycept)\n{\n double angl, slope; \n angl = angle;\n \n while (angl < 0.0)\n angl = angl + 360.0;\n while (angl >= 360.0)\n angl = angl - 360.0;\n \n#if USE_ASTRO_ANGLE\n if(fabs(angl - 90.0) < SMALL_NUMBER) {\n#else\n if(fabs(angl - 180.0) < SMALL_NUMBER) {\n#endif\n *xcept = 0.0;\n *ycept = ycen;\n return(2);\n }\n#if USE_ASTRO_ANGLE\n if(fabs(angl - 270.0) < SMALL_NUMBER) {\n#else\n if(fabs(angl - 0.0) < SMALL_NUMBER) {\n#endif\n *xcept = width + 1;\n *ycept = ycen;\n return(4);\n }\n#if USE_ASTRO_ANGLE\n \n angl = angl + 90.0;\n#endif\n if(angl >= 360.0)\n angl = angl - 360.0;\n if(angl < 180.0) {\n *ycept = height + 1;\n \n if(fabs(angl - 90.0) < SMALL_NUMBER) {\n *xcept = xcen;\n return(1);\n }\n } else {\n *ycept = 0.0;\n \n if(fabs(angl - 270.0) < SMALL_NUMBER) {\n *xcept = xcen;\n return(3);\n }\n }\n \n angl = (angl / 180.0) * M_PI;\n \n slope = tan(angl);\n \n *xcept = xcen + ((*ycept - ycen) / slope);\n if(*xcept < 0) {\n *ycept = (ycen - (xcen * slope));\n *xcept = 0.0;\n return(2);\n } else if(*xcept > (width + 1)) {\n *ycept = (ycen + ((width + 1 - xcen) * slope));\n *xcept = width + 1;\n return(4);\n } else {\n if(*ycept < height)\n return(3);\n else\n return(1);\n }\n}\n\nvoid _impiei(GFilt g, int qt, int rno, int sno, int flag, int type,\n double UNUSED(x), double UNUSED(y),\n double xcen, double ycen, double angle1, double angle2)\n{\n int width, height; \n double sweep; \n double vx[7], vy[7]; \n int count; \n int intrcpt1, intrcpt2; \n double x2, y2; \n\n \n \n xcen = (xcen - g->xmin)/g->block + 1.0;\n ycen = (ycen - g->ymin)/g->block + 1.0;\n \n width = g->x1;\n height = g->y1;\n \n vx[0] = xcen;\n vy[0] = ycen;\n sweep = angle2 - angle1;\n \n if(fabs(sweep) < SMALL_NUMBER)\n return;\n if (sweep < 0.0) sweep = sweep + 360.0;\n intrcpt1 = pie_intercept(width, height, xcen, ycen, angle1,\n &(vx[1]), &(vy[1]));\n intrcpt2 = pie_intercept(width, height, xcen, ycen, angle2,\n &x2, &y2);\n count = 2;\n \n \n if((intrcpt1 != intrcpt2) || (sweep > 180.0)){\n do{\n intrcpt1 = corner_vertex(intrcpt1, width, height, \n &(vx[count]), &(vy[count]));\n count = count + 1;\n }while(intrcpt1 != intrcpt2);\n }\n vx[count] = x2;\n vy[count] = y2;\n count++;\n _polygoni(g, qt, rno, sno, flag, type, vx, vy, count);\n}\n\n\n\nvoid imannulusi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double iradius, double oradius)\n{\n int yy;\n double dval;\n double xoff, yoff;\n Scan *scanlist;\n\n \n\n if( iradius == 0 ){\n imcirclei(g, rno, sno, flag, type, x, y, xcen, ycen, oradius);\n return;\n }\n \n xcen = (xcen - g->xmin)/g->block + 1.0;\n ycen = (ycen - g->ymin)/g->block + 1.0;\n iradius /= (double)g->block;\n oradius /= (double)g->block;\n \n if( PIXSTART(ycen - oradius) < PIXSTOP(ycen + oradius) ){\n g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - oradius));\n g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + oradius));\n }\n else{\n g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + oradius));\n g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - oradius));\n }\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n scanlist = g->shapes[sno].scanlist;\n marky(g, sno, flag, type);\n \n for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){\n yoff = PIXCEN(yy) - ycen;\n if( (dval=(oradius * oradius) - (yoff * yoff)) > 0.0 ){\n xoff = sqrt(dval);\n if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){\n rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);\n rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);\n }\n if( (dval=(iradius * iradius) - (yoff * yoff)) > 0.0 ){\n xoff = sqrt(dval);\n if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){\n rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);\n rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);\n }\n }\n }\n }\n}\n\nint imannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double iradius, double oradius)\n{\n Scan scan;\n\n if( iradius == 0 ){\n return(imcircle(g, rno, sno, flag, type, x, y, xcen, ycen, oradius));\n }\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n if( flag ){\n if(y < g->shapes[sno].ystart ) return 0;\n if(y > g->shapes[sno].ystop ) return 0;\n }\n scan = g->shapes[sno].scanlist[(int)y];\n if( (scan && \n ((y >= g->shapes[sno].ystart) && (y <= g->shapes[sno].ystop)) &&\n (scan->next->next ?\n (((x >= scan->x) && (x <= scan->next->next->next->x)) &&\n !((x >= scan->next->x) && (x <= scan->next->next->x))) :\n ((x >= scan->x) && (x <= scan->next->x))))\n ==flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\nvoid imboxi(GFilt g, int rno, int sno, int flag, int type,\n double UNUSED(x), double UNUSED(y),\n double xcen, double ycen, double xwidth, double yheight,\n double angle)\n{\n double angl; \n double half_width, half_height;\n double cosangl, sinangl; \n double hw_cos, hw_sin; \n double hh_cos, hh_sin; \n double cornerx[4], cornery[4]; \n\n \n if( (xwidth == 0) && (yheight==0) ){\n return;\n }\n \n xcen = (xcen - g->xmin)/g->block + 1.0;\n ycen = (ycen - g->ymin)/g->block + 1.0;\n xwidth /= (double)g->block;\n yheight /= (double)g->block;\n#if USE_ASTRO_ANGLE\n \n angl = angle + 90.0;\n#else\n angl = angle;\n#endif\n while (angl >= 360.0) angl = angl - 360.0;\n \n angl = (angl / 180.0) * M_PI;\n sinangl = sin (angl);\n cosangl = cos (angl);\n#if USE_ASTRO_ANGLE\n \n \n \n half_width = yheight / 2.0;\n half_height = xwidth / 2.0;\n#else\n half_width = xwidth / 2.0;\n half_height = yheight / 2.0;\n#endif\n hw_cos = half_width * cosangl;\n hw_sin = half_width * sinangl;\n hh_cos = half_height * cosangl;\n hh_sin = half_height * sinangl;\n#if USE_ASTRO_ANGLE\n cornerx[0] = xcen - hw_cos - hh_sin;\n cornery[0] = ycen - hw_sin + hh_cos;\n cornerx[1] = xcen + hw_cos - hh_sin;\n cornery[1] = ycen + hw_sin + hh_cos;\n cornerx[2] = xcen + hw_cos + hh_sin;\n cornery[2] = ycen + hw_sin - hh_cos;\n cornerx[3] = xcen - hw_cos + hh_sin;\n cornery[3] = ycen - hw_sin - hh_cos;\n#else\n cornerx[0] = xcen - hw_cos + hh_sin;\n cornery[0] = ycen - hh_cos - hw_sin;\n cornerx[1] = xcen - hw_cos - hh_sin;\n cornery[1] = ycen + hh_cos - hw_sin;\n cornerx[2] = xcen + hw_cos - hh_sin;\n cornery[2] = ycen + hh_cos + hw_sin;\n cornerx[3] = xcen + hw_cos + hh_sin;\n cornery[3] = ycen - hh_cos + hw_sin;\n#endif\n _polygoni(g, 0, rno, sno, flag, type, cornerx, cornery, 4);\n}\n\nint imbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double UNUSED(xcen), double UNUSED(ycen),\n double xwidth, double yheight,\n double UNUSED(angle))\n{\n if( (xwidth == 0) && (yheight==0) ){\n return(!flag);\n }\n return impolygon(g, rno, sno, flag, type, x, y);\n}\n\nvoid imcirclei(GFilt g, int UNUSED(rno), int sno, int flag, int type,\n double UNUSED(x), double UNUSED(y),\n double xcen, double ycen, double radius)\n{\n int yy;\n double dval;\n double xoff, yoff;\n Scan *scanlist;\n\n \n if( radius == 0 ){\n return;\n }\n \n xcen = (xcen - g->xmin)/g->block + 1.0;\n ycen = (ycen - g->ymin)/g->block + 1.0;\n radius /= (double)g->block;\n \n if( PIXSTART(ycen - radius) < PIXSTOP(ycen + radius) ){\n g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - radius));\n g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + radius));\n }\n else{\n g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + radius));\n g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - radius));\n }\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n scanlist = g->shapes[sno].scanlist;\n marky(g, sno, flag, type);\n \n for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){\n yoff = PIXCEN(yy) - ycen;\n if( (dval=(radius * radius) - (yoff * yoff))>=0.0 ){\n xoff = sqrt(dval);\n if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){\n rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);\n rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);\n }\n }\n }\n}\n\nint imcircle(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y,\n double UNUSED(xcen), double UNUSED(ycen), double radius)\n{\n Scan scan;\n\n if( radius == 0 ){\n return(!flag);\n }\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n if( flag ){\n if(y < g->shapes[sno].ystart ) return 0;\n if(y > g->shapes[sno].ystop ) return 0;\n }\n scan = g->shapes[sno].scanlist[(int)y];\n if( (scan && \n ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n ((x >= scan->x) && (x <= (scan->next)->x))) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else{\n return 0;\n }\n}\n\nvoid imellipsei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xrad, double yrad,\n double angle)\n{\n int yy;\n int nr, nc;\n double yhi;\n double yoff;\n double xboff, xfoff;\n double angl;\n double sinangl, cosangl;\n double cossq, sinsq, xradsq, yradsq;\n double a, b_partial, c_partial;\n double b, c;\n Scan *scanlist;\n\n \n\n if( xrad == yrad ){\n imcirclei(g, rno, sno, flag, type, x, y, xcen, ycen, xrad);\n return;\n }\n \n xcen = (xcen - g->xmin)/g->block + 1.0;\n ycen = (ycen - g->ymin)/g->block + 1.0;\n xrad /= (double)g->block;\n yrad /= (double)g->block;\n \n#if USE_ASTRO_ANGLE\n \n angl = angle + 90.0;\n#else\n angl = angle;\n#endif\n while( angl >= 360.0 )\n angl = angl - 360.0;\n \n angl = (angl / 180.0) * M_PI;\n sinangl = sin(angl);\n cosangl = cos(angl);\n \n \n FPU_DOUBLE\n#if USE_ASTRO_ANGLE\n yhi = fabs(sinangl * yrad) + fabs(cosangl * xrad);\n#else\n yhi = fabs(sinangl * xrad) + fabs(cosangl * yrad);\n#endif\n yhi = min(yhi, max(yrad, xrad));\n \n if( PIXSTART(ycen - yhi) < PIXSTOP(ycen + yhi) ){\n g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - yhi));\n g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + yhi));\n }\n else{\n g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + yhi));\n g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - yhi));\n }\n FPU_RESTORE\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n scanlist = g->shapes[sno].scanlist;\n marky(g, sno, flag, type);\n \n cossq = cosangl * cosangl;\n sinsq = sinangl * sinangl;\n#if USE_ASTRO_ANGLE\n \n \n \n \n xradsq = yrad * yrad;\n yradsq = xrad * xrad;\n#else\n xradsq = xrad * xrad;\n yradsq = yrad * yrad;\n#endif\n \n a = (cossq / xradsq) + (sinsq / yradsq);\n b_partial = (2.0 * sinangl) * ((cosangl / xradsq) - (cosangl / yradsq));\n c_partial = (sinsq / xradsq) + (cossq / yradsq);\n \n for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){\n yoff = yy - ycen;\n b = b_partial * yoff;\n c = (c_partial * yoff * yoff) - 1.0;\n \n quadeq (a, b, c, &xboff, &xfoff, &nr, &nc);\n \n if( nr != 0 ) {\n \n rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen + xboff), yy);\n rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xfoff), yy);\n }\n }\n}\n\nint imellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xrad, double yrad,\n double UNUSED(angle))\n{\n Scan scan;\n\n if( xrad == yrad ){\n return(imcircle(g, rno, sno, flag, type, x, y, xcen, ycen, xrad));\n }\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n if( flag ){\n if(y < g->shapes[sno].ystart ) return 0;\n if(y > g->shapes[sno].ystop ) return 0;\n }\n scan = g->shapes[sno].scanlist[(int)y];\n FPU_DOUBLE\n if( (scan && \n ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&\n ((x >= scan->x) && (x <= (scan->next)->x))) == flag ){\n if( rno && flag ) g->rid = rno;\n FPU_RESTORE\n return 1;\n }\n else{\n FPU_RESTORE\n return 0;\n }\n}\n\nvoid imfieldi(GFilt g, int UNUSED(rno), int sno, int flag, int type,\n double UNUSED(x), double UNUSED(y))\n{\n int yy;\n Scan *scanlist;\n\n \n g->shapes[sno].ystart = g->y0;\n g->shapes[sno].ystop = g->y1;\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n scanlist = g->shapes[sno].scanlist;\n marky(g, sno, flag, type);\n \n for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){\n rgs_mark(g, scanlist, sno, flag, type, g->x0, yy);\n rgs_mark(g, scanlist, sno, flag, type, g->x1, yy);\n }\n}\n\nint imfield(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),\n double UNUSED(x), double UNUSED(y))\n{\n if( flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else{\n return 0;\n }\n}\n\nvoid imlinei(GFilt g, int UNUSED(rno), int sno, int flag, int type,\n double UNUSED(x), double UNUSED(y),\n double x1, double y1, double x2, double y2)\n{\n double vx[2];\n double vy[2];\n int xval, yval;\n double invslope, xoffset;\n\n \n \n x1 = (x1 - g->xmin)/g->block + 1.0;\n y1 = (y1 - g->ymin)/g->block + 1.0;\n x2 = (x2 - g->xmin)/g->block + 1.0;\n y2 = (y2 - g->ymin)/g->block + 1.0;\n \n if( y1 < y2 ){\n vx[0] = x1;\n vy[0] = y1;\n vx[1] = x2;\n vy[1] = y2;\n }\n else{\n vx[0] = x2;\n vy[0] = y2;\n vx[1] = x1;\n vy[1] = y1;\n }\n \n g->shapes[sno].ystart = PIXNUM(vy[0]);\n g->shapes[sno].ystop = PIXNUM(vy[1]);\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n marky(g, sno, flag, type);\n if( feq(vy[0],vy[1]) ){\n rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,\n (int)min(vx[0],vx[1]), (int)vy[0]);\n rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,\n (int)max(vx[0],vx[1]), (int)vy[0]);\n }\n else{\n \n invslope = (vx[0] - vx[1]) / (vy[0] - vy[1]);\n xoffset = vx[0];\n for(yval=vy[0]; yval<=vy[1]; yval++){\n xval = xoffset;\n rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type, xval, yval);\n xoffset = xoffset + invslope;\n }\n }\n}\n\nint imline(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y,\n double UNUSED(x1), double UNUSED(y1),\n double UNUSED(x2), double UNUSED(y2))\n{\n Scan scan;\n\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n if( flag ){\n if(y < g->shapes[sno].ystart ) return 0;\n if(y > g->shapes[sno].ystop ) return 0;\n }\n scan = g->shapes[sno].scanlist[(int)y];\n if( (scan &&\n ((x==(int)scan->x) ||\n (scan->next&&((x>=(int)scan->x)&&(x<=(int)scan->next->x)))))==flag ) {\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\nvoid impiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2)\n{\n _impiei(g, 0, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);\n}\n\nint impie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double UNUSED(xcen), double UNUSED(ycen),\n double UNUSED(angle1), double UNUSED(angle2))\n{\n return impolygon(g, rno, sno, flag, type, x, y);\n}\n\nvoid imqtpiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2)\n{\n _impiei(g, 1, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);\n}\n\nint imqtpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double UNUSED(xcen), double UNUSED(ycen),\n double UNUSED(angle1), double UNUSED(angle2))\n{\n return impolygon(g, rno, sno, flag, type, x, y);\n}\n\nvoid impointi(GFilt g, int UNUSED(rno), int sno, int flag, int type,\n double UNUSED(x), double UNUSED(y),\n double xcen, double ycen)\n{\n \n \n xcen = (xcen - g->xmin)/g->block + 1.0;\n ycen = (ycen - g->ymin)/g->block + 1.0;\n \n g->shapes[sno].ystart = PIXNUM(ycen);\n g->shapes[sno].ystop = PIXNUM(ycen);\n g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));\n marky(g, sno, flag, type);\n rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,\n PIXNUM(xcen), PIXNUM(ycen));\n}\n\nint impoint(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y,\n double UNUSED(xcen), double UNUSED(ycen))\n{\n Scan scan;\n\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n if( flag ){\n if(y < g->shapes[sno].ystart ) return 0;\n if(y > g->shapes[sno].ystop ) return 0;\n }\n scan = g->shapes[sno].scanlist[(int)y];\n if( (scan &&\n (y == (int)g->shapes[sno].ystart) && \n (x == (int)scan->x))==flag ) {\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else\n return 0;\n}\n\n#ifdef __STDC__\nvoid\nimpolygoni(GFilt g, int rno, int sno, int flag, int type,\n double UNUSED(x), double y, ...)\n{\n double *vx=NULL, *vy=NULL;\n int count, maxcount;\n va_list args;\n va_start(args, y);\n#else\nvoid impolygoni(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double *vx=NULL, *vy=NULL;\n int count, maxcount;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n#endif\n \n \n maxcount = MASKINC;\n vx = (double *)calloc(maxcount, sizeof(double));\n vy = (double *)calloc(maxcount, sizeof(double));\n \n count = 0;\n while( 1 ){\n if( (count + 1) >= maxcount ){\n maxcount += MASKINC;\n vx = (double *)realloc(vx, maxcount*sizeof(double));\n vy = (double *)realloc(vy, maxcount*sizeof(double));\n }\n vx[count] = va_arg(args, double);\n vy[count] = va_arg(args, double);\n if( feq(vx[count],PSTOP) && feq(vy[count],PSTOP) )\n break;\n vx[count] = (vx[count] - g->xmin)/g->block + 1.0;\n vy[count] = (vy[count] - g->ymin)/g->block + 1.0;\n count ++;\n }\n va_end(args);\n \n vx = (double *)realloc(vx, count*sizeof(double));\n vy = (double *)realloc(vy, count*sizeof(double));\n \n _polygoni(g, 0, rno, sno, flag, type, vx, vy, count);\n if( vx ) free(vx);\n if( vy ) free(vy);\n}\n\n#ifdef __STDC__\nint\nimpolygon(GFilt g, int rno, int sno, int flag, int UNUSED(type),\n double x, double y, ...)\n{\n int crossings;\n Scan scan;\n va_list args;\n va_start(args, y);\n#else\nint impolygon(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n int crossings;\n Scan scan;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n#endif\n va_end(args);\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n if( flag ){\n if(y < g->shapes[sno].ystart ) return 0;\n if(y > g->shapes[sno].ystop ) return 0;\n }\n \n if( (y>=g->shapes[sno].ystart)&&(y<=g->shapes[sno].ystop) ){\n crossings = 0;\n for(scan=g->shapes[sno].scanlist[(int)y]; scan; scan=scan->next){\n if( x >= scan->x )\n crossings++;\n else\n break;\n }\n if( (crossings%2) == flag ){\n if( rno && flag ) g->rid = rno;\n return 1;\n }\n else{\n return 0;\n }\n }\n else{\n return !flag;\n }\n}\n\nvoid imnannulusi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n)\n{\n int i;\n int xsno;\n double dinc;\n\n \n\n \n dinc = (hi - lo)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi);\n for(i=0; i<n; i++){\n imannulusi(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc));\n }\n}\n\nvoid imnboxi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double ang)\n{\n int i;\n int xsno;\n double dincx;\n double dincy;\n\n \n\n \n dincx = (hix - lox)/n;\n dincy = (hiy - loy)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang);\n imboxi(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang);\n for(i=0; i<n; i++){\n imboxi(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang);\n }\n}\n\nvoid imnellipsei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double ang)\n{\n int i;\n int xsno;\n double dincx;\n double dincy;\n\n \n\n \n dincx = (hix - lox)/n;\n dincy = (hiy - loy)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang);\n imellipsei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang);\n for(i=0; i<n; i++){\n imellipsei(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang);\n }\n}\n\nvoid imnpiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n)\n{\n int i;\n int xsno;\n double dinc;\n\n \n\n \n while( lo > hi ) lo -= 360.0;\n dinc = (hi - lo)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n impiei(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi);\n for(i=0; i<n; i++){\n impiei(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc));\n }\n}\n\nvoid impandai(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double radlo, double radhi, double radn)\n{\n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, rinc;\n\n \n\n \n while( anglo > anghi ) anglo -= 360.0;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n rinc = (radhi - radlo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi);\n imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);\n for(a=0; a<ahi; a++){\n for(r=0; r<rhi; r++){\n imannulusi(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, radlo+(r*rinc), radlo+((r+1)*rinc));\n imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));\n n++;\n }\n }\n}\n\nvoid imbpandai(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double xlo, double ylo, double xhi, double yhi, double radn,\n double ang)\n{\n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, xinc, yinc;\n\n \n\n \n anglo += ang;\n anghi += ang;\n while( anglo > anghi ) anglo -= 360.0;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n xinc = (xhi - xlo)/radn;\n yinc = (yhi - ylo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi, ang);\n imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);\n imboxi(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo, ang);\n for(a=0; a<ahi; a++){\n for(r=1; r<=rhi; r++){\n imboxi(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang);\n imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));\n n++;\n }\n }\n}\n\nvoid imepandai(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double xlo, double ylo, double xhi, double yhi, double radn,\n double ang)\n{\n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, xinc, yinc;\n\n \n\n \n anglo += ang;\n anghi += ang;\n while( anglo > anghi ) anglo -= 360.0;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n xinc = (xhi - xlo)/radn;\n yinc = (yhi - ylo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n \n imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi, ang);\n imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);\n imellipsei(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo, ang);\n for(a=0; a<ahi; a++){\n for(r=1; r<=rhi; r++){\n imellipsei(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang);\n imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));\n n++;\n }\n }\n}\n\n\n\nint imnannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lo, double hi, int n)\n{\n int i;\n int xsno;\n double dinc;\n\n \n dinc = (hi - lo)/(double)n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( imannulus(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){\n return(1);\n }\n }\n return(0);\n }\n else{\n \n if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){\n return(1);\n }\n return(0);\n }\n}\n\nint imnbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double ang)\n{\n int i;\n int xsno;\n double dincx;\n double dincy;\n\n \n dincx = (hix - lox)/n;\n dincy = (hiy - loy)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(0);\n }\n \n if( imbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( imbox(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(1);\n }\n \n if( imbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(1);\n }\n return(0);\n }\n}\n\nint imnellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double ang)\n{\n int i;\n int xsno;\n double dincx;\n double dincy;\n\n \n dincx = (hix - lox)/n;\n dincy = (hiy - loy)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(0);\n }\n \n if( imellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( imellipse(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){\n return(1);\n }\n \n if( imellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){\n return(1);\n }\n return(0);\n }\n}\n\nint imnpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen,\n double lo, double hi, int n)\n{\n int i;\n int xsno;\n double dinc;\n\n \n while( lo > hi ) lo -= 360.0;\n dinc = (hi - lo)/n;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !impie(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( impie(g, rno+i, sno+i, flag, type, x, y,\n xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){\n return(1);\n }\n }\n return(0);\n }\n else{\n \n if( !impie(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){\n return(1);\n }\n return(0);\n }\n}\n\nint impanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double radlo, double radhi, double radn)\n{\n \n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, rinc;\n\n \n while( anglo > anghi ) anglo -= 360.0;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n rinc = (radhi - radlo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi) ||\n !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi) ){\n return(0);\n }\n \n for(a=1; a<=ahi; a++){\n for(r=1; r<=rhi; r++){\n if( imannulus(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, radlo+((r-1)*rinc), radlo+(r*rinc)) &&\n impie(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+((a-1)*ainc), anglo+(a*ainc)) ){\n return(1);\n }\n n++;\n }\n }\n return(0);\n }\n else{\n \n if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, radlo, radhi) )\n return(1);\n else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){\n return(1);\n }\n else{\n return(0);\n }\n }\n}\n\nint imbpanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double xlo, double ylo, double xhi, double yhi, double radn,\n double ang)\n{\n \n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, xinc, yinc;\n\n \n anglo += ang;\n anghi += ang;\n while( anglo > anghi ) anglo -= 360.0;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n xinc = (xhi - xlo)/radn;\n yinc = (yhi - ylo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,\n ang) ){\n return(0);\n }\n \n else if( imbox(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,\n ang) ){\n return(0);\n }\n \n else if( !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){\n return(0);\n }\n \n for(a=0; a<ahi; a++){\n for(r=1; r<=rhi; r++){\n if( imbox(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&\n imqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){\n return(1);\n }\n n++;\n }\n }\n return(0);\n }\n else{\n \n if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )\n return(1);\n \n else if( !imbox(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,\n ang) )\n return(1);\n \n else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){\n return(1);\n }\n else{\n return(0);\n }\n }\n}\n\nint imepanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double xlo, double ylo, double xhi, double yhi, double radn,\n double ang)\n{\n \n int a, r;\n int ahi, rhi;\n int xsno;\n int n=0;\n double ainc, xinc, yinc;\n\n \n anglo += ang;\n anghi += ang;\n while( anglo > anghi ) anglo -= 360.0;\n ainc = (anghi - anglo)/angn;\n ahi = (int)angn;\n xinc = (xhi - xlo)/radn;\n yinc = (yhi - ylo)/radn;\n rhi = (int)radn;\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( flag ){\n \n if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,\n ang) ){\n return(0);\n }\n \n else if( imellipse(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,\n ang) ){\n return(0);\n }\n \n else if( !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){\n return(0);\n }\n \n for(a=0; a<ahi; a++){\n for(r=1; r<=rhi; r++){\n if( imellipse(g, rno+n, sno+(2*n), flag, type, x, y,\n xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&\n imqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,\n xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){\n return(1);\n }\n n++;\n }\n }\n return(0);\n }\n else{\n \n if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )\n return(1);\n \n else if( !imellipse(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,\n ang) )\n return(1);\n \n else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){\n return(1);\n }\n else{\n return(0);\n }\n }\n}\n\n#ifdef __STDC__\nvoid\nimvannulusi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvannulusi(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n if( n == 2 ){\n imannulusi(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]);\n return;\n }\n imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]);\n for(i=0; i<(n-1); i++){\n imannulusi(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]);\n }\n}\n\n#ifdef __STDC__\nvoid\nimvboxi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double ang;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvboxi(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n ang = xv[--n];\n \n if( n == 2 ){\n imboxi(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);\n return;\n }\n imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang);\n imboxi(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);\n for(i=2, j=0; i<n; i+=2, j++){\n imboxi(g, rno+j, sno+j, flag, type, x, y, xcen, ycen, xv[i], xv[i+1], ang);\n }\n}\n\n#ifdef __STDC__\nvoid\nimvellipsei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double ang;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvellipsei(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n ang = xv[--n];\n \n if( n == 2 ){\n imellipsei(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);\n return;\n }\n imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang);\n imellipsei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);\n for(i=2, j=0; i<n; i+=2, j++){\n imellipsei(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1], ang);\n }\n}\n\n#ifdef __STDC__\nvoid\nimvpiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvpiei(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n if( n == 2 ){\n impiei(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]);\n return;\n }\n impiei(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]);\n for(i=0; i<(n-1); i++){\n impiei(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]);\n }\n}\n\n#ifdef __STDC__\nvoid\nimvpointi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, y);\n#else\nint imvpointi(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n for(i=0, j=0; i<n; i+=2, j++){\n impointi(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]);\n }\n}\n\n\n\n#ifdef __STDC__\nint\nimvannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvannulus(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double *xv;\n int i, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n if( n == 2 ){\n return(imannulus(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]));\n }\n if( flag ){\n \n if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( imannulus(g, rno+i, sno+i, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1]) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(1);\n }\n return(0);\n }\n}\n\n#ifdef __STDC__\nint\nimvbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double ang;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvbox(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n ang = xv[--n];\n \n if( n == 2 ){\n return(imbox(g, rno, sno, flag, type, x, y,\n xcen, ycen, xv[0], xv[1], ang));\n }\n if( flag ){\n \n if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],\n ang) ){\n return(0);\n }\n \n if( imbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){\n return(0);\n }\n \n for(i=2, j=0; i<n; i+=2, j++){\n if( imbox(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1], ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang) ){\n return(1);\n }\n \n else if( imbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){\n return(1);\n }\n return(0);\n }\n}\n\n#ifdef __STDC__\nint\nimvellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double ang;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvellipse(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double ang;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n ang = xv[--n];\n \n if( n == 2 ){\n return(imellipse(g, rno, sno, flag, type, x, y,\n xcen, ycen, xv[0], xv[1], ang));\n }\n if( flag ){\n \n if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],\n ang) ){\n return(0);\n }\n \n if( imellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1],\n ang) ){\n return(0);\n }\n \n for(i=2, j=0; i<n; i+=2, j++){\n if( imellipse(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,\n xv[i], xv[i+1], ang) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1],\n ang) ){\n return(1);\n }\n \n if( imellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){\n return(1);\n }\n return(0);\n }\n}\n\n#ifdef __STDC__\nint\nimvpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...)\n{\n int i, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, ycen);\n#else\nint imvpie(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double xcen, ycen;\n double *xv;\n int i, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n xcen = va_arg(args, double);\n ycen = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n if( n == 2 ){\n return(impie(g, rno, sno, flag, type, x, y,\n xcen, ycen, xv[0], xv[1]));\n }\n if( flag ){\n \n if( !impie(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(0);\n }\n \n for(i=0; i<n; i++){\n if( impie(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]) ){\n return(1);\n }\n }\n return(0);\n }\n \n else{\n \n if( !impie(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){\n return(1);\n }\n return(1);\n }\n}\n\n#ifdef __STDC__\nint\nimvpoint(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...)\n{\n int i, j, n;\n int maxpts;\n int xsno;\n double *xv;\n va_list args;\n va_start(args, y);\n#else\nint imvpoint(va_alist) va_dcl\n{\n GFilt g;\n int rno, sno, flag, type;\n double x, y;\n double *xv;\n int i, j, n;\n int maxpts;\n int xsno;\n va_list args;\n va_start(args);\n g = va_arg(args, GFilt);\n rno = va_arg(args, int);\n sno = va_arg(args, int);\n flag = va_arg(args, int);\n type = va_arg(args, int);\n x = va_arg(args, double);\n y = va_arg(args, double);\n#endif\n xsno = (g->nshapes+1)+((sno-1)*XSNO);\n if( !g->shapes[xsno].xv ){\n maxpts = MASKINC;\n g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));\n g->shapes[xsno].nv = 0;\n while( 1 ){\n if( g->shapes[xsno].nv >= maxpts ){\n maxpts += MASKINC;\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n maxpts*sizeof(double));\n }\n g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);\n if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&\n feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){\n g->shapes[xsno].nv--;\n break;\n }\n g->shapes[xsno].nv++;\n }\n va_end(args);\n g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,\n g->shapes[xsno].nv*sizeof(double));\n }\n n = g->shapes[xsno].nv;\n xv = g->shapes[xsno].xv;\n \n for(i=0, j=0; i<n; i+=2, j++){\n if( impoint(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]) ){\n return(1);\n }\n }\n return(0);\n}\n\nvoid imimagemaski(GFilt g, int UNUSED(rno), int UNUSED(sno),\n int UNUSED(flag), int UNUSED(type),\n double UNUSED(x), double UNUSED(y))\n{\n int i, j;\n int got;\n int fsize;\n int mblock;\n FilterMask xmasks;\n\n \n \n mblock = (int)(((double)((g->xmax - g->xmin + 1)/g->block)/(double)g->maskdim) + 0.5);\n if( mblock < 1 ){\n g->masks = NULL;\n g->nmask = 0;\n }\n \n fsize = g->nmask * sizeof(FilterMaskRec) * mblock;\n xmasks = (FilterMask)calloc(1, fsize);\n for(got=0, i=0; i<g->nmask; i++){\n xmasks[got].region = g->masks[i].region;\n xmasks[got].y = (g->masks[i].y - 1.0) * mblock + 1.0;\n xmasks[got].xstart = (g->masks[i].xstart - 1.0) * mblock + 1.0;\n xmasks[got].xstop = (g->masks[i].xstop - 1.0) * mblock + 1.0;\n \n for(j=1; j<mblock; j++){\n xmasks[got+j].region = xmasks[got].region;\n xmasks[got+j].y = xmasks[got].y+j;\n xmasks[got+j].xstart = xmasks[got].xstart;\n xmasks[got+j].xstop = xmasks[got].xstop;\n }\n got += mblock;\n }\n \n qsort(xmasks, got, sizeof(FilterMaskRec), imagemaskcmp);\n /* we don't free previous masks, just overwrite, because they were not\n allocated in the first place */\n \n \n g->masks = xmasks;\n g->nmask = got;\n\n \n for(i=0; i<got; i++){\n if( !g->ybuf[g->masks[i].y] )\n g->ybuf[g->masks[i].y] = i+1;\n }\n}\n\nint imimagemask(GFilt g, int UNUSED(rno), int UNUSED(sno),\n int UNUSED(flag), int UNUSED(type),\n double x, double y)\n{\n int i;\n int ix, iy;\n\n if( g->nmask == 0 )\n return(0);\n if( g->evsect ){\n if( g->usebinsiz ){\n x = (int)((x - g->tlminx)/g->binsizx + 1.0);\n y = (int)((y - g->tlminy)/g->binsizy + 1.0);\n }\n else{\n x = (int)((x - g->tlminx) + 1.0);\n y = (int)((y - g->tlminy) + 1.0);\n }\n x = (int)((x - g->xmin)/g->block + 1.0);\n y = (int)((y - g->ymin)/g->block + 1.0);\n if(y < g->y0) return 0;\n if(y > g->y1) return 0;\n if(x < g->x0) return 0;\n if(x > g->x1) return 0;\n }\n ix = (int)x;\n iy = (int)y;\n \n i = g->ybuf[iy];\n \n if( i != 0 ){\n i--;\n for(; i<g->nmask; i++){\n if( g->masks[i].y > iy ){\n return(0);\n }\n if( (ix >= g->masks[i].xstart) && (ix <= g->masks[i].xstop) ){\n g->rid = g->masks[i].region;\n return(1);\n }\n }\n }\n return(0);\n}\n\n";
diff --git a/funtools/filter/imregions_c.tmpl b/funtools/filter/imregions_c.tmpl
deleted file mode 100644
index 639fefc..0000000
--- a/funtools/filter/imregions_c.tmpl
+++ /dev/null
@@ -1,2585 +0,0 @@
-/*
- NB: MAKE SURE YOU EDIT THE TEMPLATE FILE!!!!
-*/
-
-#ifndef FILTER_PTYPE
-#include <regions.h>
-#endif
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-/* panda and pie incorrectly used astronomical angles. fixed 4/2004 */
-#define USE_ASTRO_ANGLE 0
-
-/* we might want to avoid (x86) extended precision problems */
-#define USE_FPU_DOUBLE _FPUDBL_
-#if USE_FPU_DOUBLE
-#include <fpu_control.h>
-static fpu_control_t _cw;
-#define FPU_DOUBLE {fpu_control_t _cw2; _FPU_GETCW(_cw); _cw2 = _cw & ~_FPU_EXTENDED; _cw2 |= _FPU_DOUBLE; _FPU_SETCW(_cw2);}
-#define FPU_RESTORE {_FPU_SETCW(_cw);}
-#else
-#define FPU_DOUBLE
-#define FPU_RESTORE
-#endif
-
-/* add to FilterOpen to cause this module to be loaded for dynamic linking */
-static int imregno=0;
-void initimregions(void)
-{
- imregno++;
- return;
-}
-
-static void markx(GFilt g, int UNUSED(sno), int flag, int type, int x, int y)
-{
- /* don't mark exclude regions */
- if( type == TOK_EREG )
- return;
- /* for include, we might extend the x limits */
- if( flag ){
- if( x <= g->x0s[y] )
- g->x0s[y] = max(x,g->x0);
- if( x >= g->x1s[y] )
- g->x1s[y] = min(x,g->x1);
- }
- /* for exclude, we have to look at the full line */
- else{
- g->x0s[y] = g->x0;
- g->x1s[y] = g->x1;
- }
-}
-
-static void marky(GFilt g, int sno, int flag, int type)
-{
- int i;
- /* don't mark exclude regions */
- if( type == TOK_EREG )
- return;
- /* mark include shape */
- if( flag ){
- for(i=max(g->y0,g->shapes[sno].ystart);
- i<=min(g->y1,g->shapes[sno].ystop);
- i++)
- g->ybuf[i] = 1;
- }
- /* mark exclude shape */
- else{
- for(i=g->y0; i<=g->shapes[sno].ystart-1; i++)
- g->ybuf[i] = 1;
- for(i=g->shapes[sno].ystop+1; i<=g->y1; i++)
- g->ybuf[i] = 1;
- }
-}
-
-static int
-imagemaskcmp(const void *s1, const void *s2)
-{
- FilterMask f1 = (FilterMask)s1;
- FilterMask f2 = (FilterMask)s2;
-
- if( f1->y < f2->y ){
- return -1;
- }
- else if( f1->y > f2->y ){
- return 1;
- }
- else{
- if( f1->xstart < f2->xstart ){
- return -1;
- }
- else{
- return 1;
- }
- }
-}
-
-/* ***************************** shape support ***************************** */
-
-static void quadeq(double a, double b, double c,
- double *x1, double *x2, int *nr, int *nc)
-{
- double dis, q;
- if( feq(a,0.0) ){
- *nc = 0;
- if( feq(b,0.0) ){
- *nr = 0; *x1 = 0.0;
- }
- else{
- *nr = 1; *x1 = -c / b;
- }
- *x2 = *x1;
- }
- else{
- dis = b*b - 4.0 * a * c;
- if( dis > 0.0 ){
- *nr = 2; *nc = 0;
- dis = sqrt(dis);
- if( b < 0.0 ) dis = -dis;
- q = -0.5 * (b + dis);
- *x1 = q/a; *x2 = c/q;
- if(*x1 > *x2){
- q = *x1; *x1 = *x2; *x2 = q;
- }
- }
- else if( feq(dis,0.0) ){
- *nr = 1; *nc = 0; *x1 = - 0.5 * b / a; *x2 = *x1;
- }
- else{
- *nr = 0; *nc = 2; *x1 = - 0.5 * b / a; *x2 = 0.5 * sqrt(-dis) / a;
- }
- }
-}
-
-static void rgs_mark(GFilt g, Scan *scanlist,
- int sno, int flag, int type, int xval, int yval )
-{
- Scan scanmark, mark;
- /* since yval is used as an index, make sure its within limits */
- if(yval < g->y0) yval = g->y0;
- if(yval > g->y1) yval = g->y1;
- mark = (Scan)calloc(1, sizeof(ScanRec));
- mark->x = xval;
- /* sanity check */
- if( !scanlist ) return;
- /* starts are installed at back of list for given x */
- if( !scanlist[yval] || ((scanlist[yval])->x > xval) ){
- mark->next = scanlist[yval];
- scanlist[yval] = mark;
- } else {
- scanmark = scanlist[yval];
- while( scanmark->next && ((scanmark->next)->x < xval) )
- scanmark = scanmark->next;
- mark->next = scanmark->next;
- scanmark->next = mark;
- }
- markx(g, sno, flag, type, xval, yval);
-}
-
-static void rgs_segment(GFilt g, Scan *scanlist, int width, int height,
- int sno, int flag, int type,
- double x1, double y1, double x2, double y2)
-{
- int ystart, ystop, yval, xval;
- double invslope, xoffset;
-
- ystart = PIXINCL(y1);
- if( ystart < 1 ) ystart = 1;
- /* note: PIXINCL(stop) is 1st pixel not counted */
- ystop = PIXINCL(y2) - 1;
- if( ystop > height ) ystop = height;
- /* ignore segment if there is no positive slope in integer coords */
- if( (ystart > ystop) || (ystop < 1) )
- return;
- /* use inverse slope (run/rise) to get x given y with a multiply */
- invslope = (x1 - x2) / (y1 - y2);
- xoffset = x1 + ((ystart - y1) * invslope);
- for(yval=ystart; yval<=ystop; yval++){
- xval = PIXINCL(xoffset);
- /* clip line to edges of image area (actually bend line) */
- if(xval < 1) xval = 1;
- if(xval > width) xval = width + 1;
- rgs_mark(g, scanlist, sno, flag, type, xval, yval);
- xoffset = xoffset + invslope;
- }
-}
-
-static void _polygoni(GFilt g, int qt, int UNUSED(rno), int sno, int flag,
- int type, double *vx, double *vy, int count)
-{
- int i, j;
- double xlo, xhi;
- double ylo, yhi;
-
-#ifdef ALREADY_DONE
- /* divide by block factor to get real endpoints */
- for(i=0; i<count; i++){
- vx[i] = (vx[i] - g->xmin)/g->block + 1.0;
- vy[i] = (vy[i] - g->ymin)/g->block + 1.0;
- }
-#endif
- /* find the limits */
- xlo = vx[0];
- xhi = xlo;
- ylo = vy[0];
- yhi = ylo;
- for(i=0; i<count; i++){
- if(vx[i] > xhi) xhi = vx[i];
- if(vx[i] < xlo) xlo = vx[i];
- if(vy[i] > yhi) yhi = vy[i];
- if(vy[i] < ylo) ylo = vy[i];
- }
- if( qt && (sno > 1) ){
- g->shapes[sno].ystart = g->shapes[sno-1].ystart;
- g->shapes[sno].ystop = g->shapes[sno-1].ystop;
- }
- else{
- g->shapes[sno].ystart = max(g->y0,PIXINCL(ylo));
- g->shapes[sno].ystop = min(g->y1,PIXINCL(yhi) - 1);
- }
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- marky(g, sno, flag, type);
-
- /* mark all horizontal segment crossings */
- /* start with segment between last and first point */
- j = count-1;
- for(i=0; i<count; i++){
- /* make segments always run from lower y to higher y */
- if(vy[i] > vy[j]){
- rgs_segment(g, g->shapes[sno].scanlist, g->x1, g->y1,
- sno, flag, type, vx[j], vy[j], vx[i], vy[i]);
- }
- else{
- rgs_segment(g, g->shapes[sno].scanlist, g->x1, g->y1,
- sno, flag, type, vx[i], vy[i], vx[j], vy[j]);
- }
- j = i;
- }
-}
-
-static int corner_vertex(int index, int width, int height,
- double *x, double *y)
-{
- switch (index) {
- case 1:
- *x = 0.0;
- *y = height + 1;
- break;
- case 2:
- *x = 0.0;
- *y = 0.0;
- break;
- case 3:
- *x = width + 1;
- *y = 0.0;
- break;
- case 4:
- *x = width + 1;
- *y = height + 1;
- default:
- break;
- }
- index = index + 1;
- if(index > 4) index = 1;
- return(index);
-}
-
-static int pie_intercept(int width, int height, double xcen, double ycen,
- double angle, double *xcept, double *ycept)
-{
- double angl, slope; /* l: angle and slope of ray */
- angl = angle;
- /* put angles in normal range */
- while (angl < 0.0)
- angl = angl + 360.0;
- while (angl >= 360.0)
- angl = angl - 360.0;
- /* check for a horizontal angle */
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 180.0) < SMALL_NUMBER) {
-#endif
- *xcept = 0.0;
- *ycept = ycen;
- return(2);
- }
-#if USE_ASTRO_ANGLE
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
-#else
- if(fabs(angl - 0.0) < SMALL_NUMBER) {
-#endif
- *xcept = width + 1;
- *ycept = ycen;
- return(4);
- }
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle */
- angl = angl + 90.0;
-#endif
- if(angl >= 360.0)
- angl = angl - 360.0;
- if(angl < 180.0) {
- *ycept = height + 1;
- /* rule out vertical line */
- if(fabs(angl - 90.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(1);
- }
- } else {
- *ycept = 0.0;
- /* rule out vertical line */
- if(fabs(angl - 270.0) < SMALL_NUMBER) {
- *xcept = xcen;
- return(3);
- }
- }
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- /* calculate slope */
- slope = tan(angl);
- /* calculate intercept with designated y edge */
- *xcept = xcen + ((*ycept - ycen) / slope);
- if(*xcept < 0) {
- *ycept = (ycen - (xcen * slope));
- *xcept = 0.0;
- return(2);
- } else if(*xcept > (width + 1)) {
- *ycept = (ycen + ((width + 1 - xcen) * slope));
- *xcept = width + 1;
- return(4);
- } else {
- if(*ycept < height)
- return(3);
- else
- return(1);
- }
-}
-
-void _impiei(GFilt g, int qt, int rno, int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen, double angle1, double angle2)
-{
- int width, height; /* l: image mask width and height */
- double sweep; /* l: sweep between cut angles */
- double vx[7], vy[7]; /* l: arrays of vertices for polygon */
- int count; /* l: number of polygon vertices */
- int intrcpt1, intrcpt2; /* l: side intercepted by each cut */
- double x2, y2; /* l: coordinates of second intercept */
-
- /* NB: do not use x and y variables, they have bogus values */
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- /* temps */
- width = g->x1;
- height = g->y1;
- /* start listing vertices of polygon */
- vx[0] = xcen;
- vy[0] = ycen;
- sweep = angle2 - angle1;
- /* if sweep is too small to be noticed, don't bother */
- if(fabs(sweep) < SMALL_NUMBER)
- return;
- if (sweep < 0.0) sweep = sweep + 360.0;
- intrcpt1 = pie_intercept(width, height, xcen, ycen, angle1,
- &(vx[1]), &(vy[1]));
- intrcpt2 = pie_intercept(width, height, xcen, ycen, angle2,
- &x2, &y2);
- count = 2;
- /* if angles intercept same side and slice is between them, no corners */
- /* else, mark corners until reaching side with second angle intercept */
- if((intrcpt1 != intrcpt2) || (sweep > 180.0)){
- do{
- intrcpt1 = corner_vertex(intrcpt1, width, height,
- &(vx[count]), &(vy[count]));
- count = count + 1;
- }while(intrcpt1 != intrcpt2);
- }
- vx[count] = x2;
- vy[count] = y2;
- count++;
- _polygoni(g, qt, rno, sno, flag, type, vx, vy, count);
-}
-
-/* ***************************** shapes ********************************** */
-
-void imannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius)
-{
- int yy;
- double dval;
- double xoff, yoff;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- if( iradius == 0 ){
- imcirclei(g, rno, sno, flag, type, x, y, xcen, ycen, oradius);
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- iradius /= (double)g->block;
- oradius /= (double)g->block;
- /* set y limits */
- if( PIXSTART(ycen - oradius) < PIXSTOP(ycen + oradius) ){
- g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - oradius));
- g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + oradius));
- }
- else{
- g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + oradius));
- g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - oradius));
- }
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- yoff = PIXCEN(yy) - ycen;
- if( (dval=(oradius * oradius) - (yoff * yoff)) > 0.0 ){
- xoff = sqrt(dval);
- if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);
- }
- if( (dval=(iradius * iradius) - (yoff * yoff)) > 0.0 ){
- xoff = sqrt(dval);
- if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);
- }
- }
- }
- }
-}
-
-int imannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius)
-{
- Scan scan;
-
- if( iradius == 0 ){
- return(imcircle(g, rno, sno, flag, type, x, y, xcen, ycen, oradius));
- }
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- ((y >= g->shapes[sno].ystart) && (y <= g->shapes[sno].ystop)) &&
- (scan->next->next ?
- (((x >= scan->x) && (x <= scan->next->next->next->x)) &&
- !((x >= scan->next->x) && (x <= scan->next->next->x))) :
- ((x >= scan->x) && (x <= scan->next->x))))
- ==flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-void imboxi(GFilt g, int rno, int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen, double xwidth, double yheight,
- double angle)
-{
- double angl; /* l: Cartesian angle in radians */
- double half_width, half_height;/* l: radii (1/2 width and height) */
- double cosangl, sinangl; /* l: sine, cosine of the Cartesian angle */
- double hw_cos, hw_sin; /* l: products of half_width with sin, cos */
- double hh_cos, hh_sin; /* l: products of half_height with sin, cos */
- double cornerx[4], cornery[4]; /* l: arrays of x and y coords of 4 corners */
-
- /* NB: do not use x and y variables, they have bogus values */
- if( (xwidth == 0) && (yheight==0) ){
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- xwidth /= (double)g->block;
- yheight /= (double)g->block;
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save angle for use in multi or slices */
- angl = angle + 90.0;
-#else
- angl = angle;
-#endif
- while (angl >= 360.0) angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin (angl);
- cosangl = cos (angl);
-#if USE_ASTRO_ANGLE
- /* since we rotate by 90.0 degrees to get from astro angle to cartesian, */
- /* we also need to switch the width and height. we do this secretly so */
- /* that the display will turn out right, by doing it in the half terms */
- half_width = yheight / 2.0;
- half_height = xwidth / 2.0;
-#else
- half_width = xwidth / 2.0;
- half_height = yheight / 2.0;
-#endif
- hw_cos = half_width * cosangl;
- hw_sin = half_width * sinangl;
- hh_cos = half_height * cosangl;
- hh_sin = half_height * sinangl;
-#if USE_ASTRO_ANGLE
- cornerx[0] = xcen - hw_cos - hh_sin;
- cornery[0] = ycen - hw_sin + hh_cos;
- cornerx[1] = xcen + hw_cos - hh_sin;
- cornery[1] = ycen + hw_sin + hh_cos;
- cornerx[2] = xcen + hw_cos + hh_sin;
- cornery[2] = ycen + hw_sin - hh_cos;
- cornerx[3] = xcen - hw_cos + hh_sin;
- cornery[3] = ycen - hw_sin - hh_cos;
-#else
- cornerx[0] = xcen - hw_cos + hh_sin;
- cornery[0] = ycen - hh_cos - hw_sin;
- cornerx[1] = xcen - hw_cos - hh_sin;
- cornery[1] = ycen + hh_cos - hw_sin;
- cornerx[2] = xcen + hw_cos - hh_sin;
- cornery[2] = ycen + hh_cos + hw_sin;
- cornerx[3] = xcen + hw_cos + hh_sin;
- cornery[3] = ycen - hh_cos + hw_sin;
-#endif
- _polygoni(g, 0, rno, sno, flag, type, cornerx, cornery, 4);
-}
-
-int imbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen),
- double xwidth, double yheight,
- double UNUSED(angle))
-{
- if( (xwidth == 0) && (yheight==0) ){
- return(!flag);
- }
- return impolygon(g, rno, sno, flag, type, x, y);
-}
-
-void imcirclei(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen, double radius)
-{
- int yy;
- double dval;
- double xoff, yoff;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
- if( radius == 0 ){
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- radius /= (double)g->block;
- /* set y limits */
- if( PIXSTART(ycen - radius) < PIXSTOP(ycen + radius) ){
- g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - radius));
- g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + radius));
- }
- else{
- g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + radius));
- g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - radius));
- }
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- yoff = PIXCEN(yy) - ycen;
- if( (dval=(radius * radius) - (yoff * yoff))>=0.0 ){
- xoff = sqrt(dval);
- if( PIXSTART(xcen - xoff) <= PIXSTOP(xcen + xoff) ){
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen - xoff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xoff), yy);
- }
- }
- }
-}
-
-int imcircle(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen), double radius)
-{
- Scan scan;
-
- if( radius == 0 ){
- return(!flag);
- }
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- ((x >= scan->x) && (x <= (scan->next)->x))) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-void imellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double angle)
-{
- int yy;
- int nr, nc;
- double yhi;
- double yoff;
- double xboff, xfoff;
- double angl;
- double sinangl, cosangl;
- double cossq, sinsq, xradsq, yradsq;
- double a, b_partial, c_partial;
- double b, c;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- if( xrad == yrad ){
- imcirclei(g, rno, sno, flag, type, x, y, xcen, ycen, xrad);
- return;
- }
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- xrad /= (double)g->block;
- yrad /= (double)g->block;
- /* set worst case limits (xrad axis parallel to vertical axis) */
-#if USE_ASTRO_ANGLE
- /* convert to a Cartesian angle; save "angle" for use by other routines */
- angl = angle + 90.0;
-#else
- angl = angle;
-#endif
- while( angl >= 360.0 )
- angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin(angl);
- cosangl = cos(angl);
- /* calculate approximate y limits */
- /* choose lesser of containing rotbox and circle */
- FPU_DOUBLE
-#if USE_ASTRO_ANGLE
- yhi = fabs(sinangl * yrad) + fabs(cosangl * xrad);
-#else
- yhi = fabs(sinangl * xrad) + fabs(cosangl * yrad);
-#endif
- yhi = min(yhi, max(yrad, xrad));
- /* set y limits */
- if( PIXSTART(ycen - yhi) < PIXSTOP(ycen + yhi) ){
- g->shapes[sno].ystart = max(g->y0,PIXSTART(ycen - yhi));
- g->shapes[sno].ystop = min(g->y1,PIXSTOP(ycen + yhi));
- }
- else{
- g->shapes[sno].ystart = min(g->y1,PIXSTOP(ycen + yhi));
- g->shapes[sno].ystop = max(g->y0,PIXSTART(ycen - yhi));
- }
- FPU_RESTORE
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* prepare partials for quadratic equation solutions to coordinates */
- cossq = cosangl * cosangl;
- sinsq = sinangl * sinangl;
-#if USE_ASTRO_ANGLE
- /* because we rotate by 90.0 degrees to get from astro angle to */
- /* cartesian, we also need to switch the x and y axes. we do this */
- /* secretly so that the display will turn out right, by doing it in */
- /* the sq terms */
- xradsq = yrad * yrad;
- yradsq = xrad * xrad;
-#else
- xradsq = xrad * xrad;
- yradsq = yrad * yrad;
-#endif
- /* fill in as much of a,b,c as we can */
- a = (cossq / xradsq) + (sinsq / yradsq);
- b_partial = (2.0 * sinangl) * ((cosangl / xradsq) - (cosangl / yradsq));
- c_partial = (sinsq / xradsq) + (cossq / yradsq);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- yoff = yy - ycen;
- b = b_partial * yoff;
- c = (c_partial * yoff * yoff) - 1.0;
- /* solve quadratic */
- quadeq (a, b, c, &xboff, &xfoff, &nr, &nc);
- /* if real roots */
- if( nr != 0 ) {
- /* translate x coordinates */
- rgs_mark(g, scanlist, sno, flag, type, PIXSTART(xcen + xboff), yy);
- rgs_mark(g, scanlist, sno, flag, type, PIXSTOP(xcen + xfoff), yy);
- }
- }
-}
-
-int imellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double UNUSED(angle))
-{
- Scan scan;
-
- if( xrad == yrad ){
- return(imcircle(g, rno, sno, flag, type, x, y, xcen, ycen, xrad));
- }
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- FPU_DOUBLE
- if( (scan &&
- ((y>=g->shapes[sno].ystart) && (y<=g->shapes[sno].ystop)) &&
- ((x >= scan->x) && (x <= (scan->next)->x))) == flag ){
- if( rno && flag ) g->rid = rno;
- FPU_RESTORE
- return 1;
- }
- else{
- FPU_RESTORE
- return 0;
- }
-}
-
-void imfieldi(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y))
-{
- int yy;
- Scan *scanlist;
-
- /* NB: do not use x and y variables, they have bogus values */
- g->shapes[sno].ystart = g->y0;
- g->shapes[sno].ystop = g->y1;
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- scanlist = g->shapes[sno].scanlist;
- marky(g, sno, flag, type);
- /* calculate start/stop values for each y line */
- for(yy=g->shapes[sno].ystart; yy<=g->shapes[sno].ystop; yy++){
- rgs_mark(g, scanlist, sno, flag, type, g->x0, yy);
- rgs_mark(g, scanlist, sno, flag, type, g->x1, yy);
- }
-}
-
-int imfield(GFilt g, int rno, int UNUSED(sno), int flag, int UNUSED(type),
- double UNUSED(x), double UNUSED(y))
-{
- if( flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-void imlinei(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double x1, double y1, double x2, double y2)
-{
- double vx[2];
- double vy[2];
- int xval, yval;
- double invslope, xoffset;
-
- /* NB: do not use x and y variables, they have bogus values */
- /* divide by block factor to get "real" parameters */
- x1 = (x1 - g->xmin)/g->block + 1.0;
- y1 = (y1 - g->ymin)/g->block + 1.0;
- x2 = (x2 - g->xmin)/g->block + 1.0;
- y2 = (y2 - g->ymin)/g->block + 1.0;
- /* order by increasing y */
- if( y1 < y2 ){
- vx[0] = x1;
- vy[0] = y1;
- vx[1] = x2;
- vy[1] = y2;
- }
- else{
- vx[0] = x2;
- vy[0] = y2;
- vx[1] = x1;
- vy[1] = y1;
- }
- /* set y limits */
- g->shapes[sno].ystart = PIXNUM(vy[0]);
- g->shapes[sno].ystop = PIXNUM(vy[1]);
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- marky(g, sno, flag, type);
- if( feq(vy[0],vy[1]) ){
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,
- (int)min(vx[0],vx[1]), (int)vy[0]);
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,
- (int)max(vx[0],vx[1]), (int)vy[0]);
- }
- else{
- /* mark all horizontal segment crossings */
- invslope = (vx[0] - vx[1]) / (vy[0] - vy[1]);
- xoffset = vx[0];
- for(yval=vy[0]; yval<=vy[1]; yval++){
- xval = xoffset;
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type, xval, yval);
- xoffset = xoffset + invslope;
- }
- }
-}
-
-int imline(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double UNUSED(x1), double UNUSED(y1),
- double UNUSED(x2), double UNUSED(y2))
-{
- Scan scan;
-
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- ((x==(int)scan->x) ||
- (scan->next&&((x>=(int)scan->x)&&(x<=(int)scan->next->x)))))==flag ) {
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-void impiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- _impiei(g, 0, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);
-}
-
-int impie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen),
- double UNUSED(angle1), double UNUSED(angle2))
-{
- return impolygon(g, rno, sno, flag, type, x, y);
-}
-
-void imqtpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2)
-{
- _impiei(g, 1, rno, sno, flag, type, x, y, xcen, ycen, angle1, angle2);
-}
-
-int imqtpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen),
- double UNUSED(angle1), double UNUSED(angle2))
-{
- return impolygon(g, rno, sno, flag, type, x, y);
-}
-
-void impointi(GFilt g, int UNUSED(rno), int sno, int flag, int type,
- double UNUSED(x), double UNUSED(y),
- double xcen, double ycen)
-{
- /* NB: do not use x and y variables, they have bogus values */
- /* divide by block factor to get "real" parameters */
- xcen = (xcen - g->xmin)/g->block + 1.0;
- ycen = (ycen - g->ymin)/g->block + 1.0;
- /* set y limits */
- g->shapes[sno].ystart = PIXNUM(ycen);
- g->shapes[sno].ystop = PIXNUM(ycen);
- g->shapes[sno].scanlist = (Scan *)calloc(g->y1+1, sizeof(Scan));
- marky(g, sno, flag, type);
- rgs_mark(g, g->shapes[sno].scanlist, sno, flag, type,
- PIXNUM(xcen), PIXNUM(ycen));
-}
-
-int impoint(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y,
- double UNUSED(xcen), double UNUSED(ycen))
-{
- Scan scan;
-
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- scan = g->shapes[sno].scanlist[(int)y];
- if( (scan &&
- (y == (int)g->shapes[sno].ystart) &&
- (x == (int)scan->x))==flag ) {
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else
- return 0;
-}
-
-#ifdef __STDC__
-void
-impolygoni(GFilt g, int rno, int sno, int flag, int type,
- double UNUSED(x), double y, ...)
-{
- double *vx=NULL, *vy=NULL;
- int count, maxcount;
- va_list args;
- va_start(args, y);
-#else
-void impolygoni(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *vx=NULL, *vy=NULL;
- int count, maxcount;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- /* NB: do not use x and y variables, they have bogus values */
- /* allocate space for x,y arguments */
- maxcount = MASKINC;
- vx = (double *)calloc(maxcount, sizeof(double));
- vy = (double *)calloc(maxcount, sizeof(double));
- /* look for x,y arguments */
- count = 0;
- while( 1 ){
- if( (count + 1) >= maxcount ){
- maxcount += MASKINC;
- vx = (double *)realloc(vx, maxcount*sizeof(double));
- vy = (double *)realloc(vy, maxcount*sizeof(double));
- }
- vx[count] = va_arg(args, double);
- vy[count] = va_arg(args, double);
- if( feq(vx[count],PSTOP) && feq(vy[count],PSTOP) )
- break;
- vx[count] = (vx[count] - g->xmin)/g->block + 1.0;
- vy[count] = (vy[count] - g->ymin)/g->block + 1.0;
- count ++;
- }
- va_end(args);
- /* realloc to actual size */
- vx = (double *)realloc(vx, count*sizeof(double));
- vy = (double *)realloc(vy, count*sizeof(double));
- /* call the common routine */
- _polygoni(g, 0, rno, sno, flag, type, vx, vy, count);
- if( vx ) free(vx);
- if( vy ) free(vy);
-}
-
-#ifdef __STDC__
-int
-impolygon(GFilt g, int rno, int sno, int flag, int UNUSED(type),
- double x, double y, ...)
-{
- int crossings;
- Scan scan;
- va_list args;
- va_start(args, y);
-#else
-int impolygon(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- int crossings;
- Scan scan;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- va_end(args);
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- if( flag ){
- if(y < g->shapes[sno].ystart ) return 0;
- if(y > g->shapes[sno].ystop ) return 0;
- }
- /* no initialization of x for this row, just jump right in */
- if( (y>=g->shapes[sno].ystart)&&(y<=g->shapes[sno].ystop) ){
- crossings = 0;
- for(scan=g->shapes[sno].scanlist[(int)y]; scan; scan=scan->next){
- if( x >= scan->x )
- crossings++;
- else
- break;
- }
- if( (crossings%2) == flag ){
- if( rno && flag ) g->rid = rno;
- return 1;
- }
- else{
- return 0;
- }
- }
- else{
- return !flag;
- }
-}
-
-void imnannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi);
- for(i=0; i<n; i++){
- imannulusi(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc));
- }
-}
-
-void imnboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang);
- imboxi(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang);
- for(i=0; i<n; i++){
- imboxi(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang);
- }
-}
-
-void imnellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang);
- imellipsei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang);
- for(i=0; i<n; i++){
- imellipsei(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang);
- }
-}
-
-void imnpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- while( lo > hi ) lo -= 360.0;
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init all shapes */
- impiei(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi);
- for(i=0; i<n; i++){
- impiei(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc));
- }
-}
-
-void impandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn)
-{
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, rinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- rinc = (radhi - radlo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init pies and annuli */
- imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi);
- imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);
- for(a=0; a<ahi; a++){
- for(r=0; r<rhi; r++){
- imannulusi(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, radlo+(r*rinc), radlo+((r+1)*rinc));
- imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));
- n++;
- }
- }
-}
-
-void imbpandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init pies and ellipses */
- imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi, ang);
- imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);
- imboxi(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo, ang);
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- imboxi(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang);
- imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));
- n++;
- }
- }
-}
-
-void imepandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* NB: do not use x and y variables, they have bogus values */
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- /* init pies and ellipses */
- imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi, ang);
- imqtpiei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi);
- imellipsei(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo, ang);
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- imellipsei(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang);
- imqtpiei(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc));
- n++;
- }
- }
-}
-
-/* accelerator regions -- lower and upper limits are given for n regions */
-
-int imnannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- dinc = (hi - lo)/(double)n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imannulus(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int imnbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imbox(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( imbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int imnellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double ang)
-{
- int i;
- int xsno;
- double dincx;
- double dincy;
-
- /* get limits */
- dincx = (hix - lox)/n;
- dincy = (hiy - loy)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imellipse(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lox+((i+1)*dincx), loy+((i+1)*dincy), ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, hix, hiy, ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( imellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, lox, loy, ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-int imnpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen,
- double lo, double hi, int n)
-{
- int i;
- int xsno;
- double dinc;
-
- /* get limits */
- while( lo > hi ) lo -= 360.0;
- dinc = (hi - lo)/n;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* check limits */
- if( !impie(g, 0, xsno, flag, type, x, y, xcen, ycen, lo, hi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( impie(g, rno+i, sno+i, flag, type, x, y,
- xcen, ycen, lo+(i*dinc), lo+((i+1)*dinc)) ){
- return(1);
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !impie(g, 0, xsno, 1, type, x, y, xcen, ycen, lo, hi) ){
- return(1);
- }
- return(0);
- }
-}
-
-int impanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, rinc;
-
- /* get limits */
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- rinc = (radhi - radlo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, radlo, radhi) ||
- !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=1; a<=ahi; a++){
- for(r=1; r<=rhi; r++){
- if( imannulus(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, radlo+((r-1)*rinc), radlo+(r*rinc)) &&
- impie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+((a-1)*ainc), anglo+(a*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, radlo, radhi) )
- return(1);
- else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int imbpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( imbox(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the box .. must also be in the pie */
- else if( !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( imbox(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- imqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !imbox(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-int imepanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double xlo, double ylo, double xhi, double yhi, double radn,
- double ang)
-{
-
- int a, r;
- int ahi, rhi;
- int xsno;
- int n=0;
- double ainc, xinc, yinc;
-
- /* get limits */
- anglo += ang;
- anghi += ang;
- while( anglo > anghi ) anglo -= 360.0;
- ainc = (anghi - anglo)/angn;
- ahi = (int)angn;
- xinc = (xhi - xlo)/radn;
- yinc = (yhi - ylo)/radn;
- rhi = (int)radn;
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xhi, yhi,
- ang) ){
- return(0);
- }
- /* but if its in the inner region we lose */
- else if( imellipse(g, 0, xsno+2, flag, type, x, y, xcen, ycen, xlo, ylo,
- ang) ){
- return(0);
- }
- /* its in the ellipse .. must also be in the pie */
- else if( !impie(g, 0, xsno+1, flag, type, x, y, xcen, ycen, anglo, anghi)){
- return(0);
- }
- /* look through all of them to find the right one */
- for(a=0; a<ahi; a++){
- for(r=1; r<=rhi; r++){
- if( imellipse(g, rno+n, sno+(2*n), flag, type, x, y,
- xcen, ycen, xlo+(r*xinc), ylo+(r*yinc), ang) &&
- imqtpie(g, rno+n, sno+(2*n+1), flag, type, x, y,
- xcen, ycen, anglo+(a*ainc), anglo+((a+1)*ainc)) ){
- return(1);
- }
- n++;
- }
- }
- return(0);
- }
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xhi, yhi, ang) )
- return(1);
- /* if its in the inner region we win */
- else if( !imellipse(g, 0, xsno+2, 1, type, x, y, xcen, ycen, xlo, ylo,
- ang) )
- return(1);
- /* if its not in the pie, we win */
- else if( !impie(g, 0, xsno+1, 1, type, x, y, xcen, ycen, anglo, anghi) ){
- return(1);
- }
- else{
- return(0);
- }
- }
-}
-
-#ifdef __STDC__
-void
-imvannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvannulusi(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- imannulusi(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]);
- return;
- }
- imannulusi(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]);
- for(i=0; i<(n-1); i++){
- imannulusi(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]);
- }
-}
-
-#ifdef __STDC__
-void
-imvboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvboxi(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- imboxi(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- return;
- }
- imboxi(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang);
- imboxi(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- for(i=2, j=0; i<n; i+=2, j++){
- imboxi(g, rno+j, sno+j, flag, type, x, y, xcen, ycen, xv[i], xv[i+1], ang);
- }
-}
-
-#ifdef __STDC__
-void
-imvellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvellipsei(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- imellipsei(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- return;
- }
- imellipsei(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang);
- imellipsei(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang);
- for(i=2, j=0; i<n; i+=2, j++){
- imellipsei(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang);
- }
-}
-
-#ifdef __STDC__
-void
-imvpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvpiei(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- impiei(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]);
- return;
- }
- impiei(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]);
- for(i=0; i<(n-1); i++){
- impiei(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]);
- }
-}
-
-#ifdef __STDC__
-void
-imvpointi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, y);
-#else
-int imvpointi(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- for(i=0, j=0; i<n; i+=2, j++){
- impointi(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]);
- }
-}
-
-/* varargs regions -- a series of lower and upper limits is specified */
-
-#ifdef __STDC__
-int
-imvannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvannulus(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(imannulus(g, rno, sno, flag, type, x, y, xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imannulus(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( imannulus(g, rno+i, sno+i, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imannulus(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-imvbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvbox(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(imbox(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imbox(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imbox(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( imbox(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we win ... */
- if( !imbox(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1], ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- else if( imbox(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-imvellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double ang;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvellipse(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double ang;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- ang = xv[--n];
- /* this should be impossible ... */
- if( n == 2 ){
- return(imellipse(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1], ang));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(0);
- }
- /* if its in the inner region we lose */
- if( imellipse(g, 0, xsno+1, flag, type, x, y, xcen, ycen, xv[0], xv[1],
- ang) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=2, j=0; i<n; i+=2, j++){
- if( imellipse(g, rno+j, sno+j, flag, type, x, y, xcen, ycen,
- xv[i], xv[i+1], ang) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !imellipse(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[n-2], xv[n-1],
- ang) ){
- return(1);
- }
- /* if its in the inner region we win */
- if( imellipse(g, 0, xsno+1, 1, type, x, y, xcen, ycen, xv[0], xv[1], ang) ){
- return(1);
- }
- return(0);
- }
-}
-
-#ifdef __STDC__
-int
-imvpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...)
-{
- int i, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, ycen);
-#else
-int imvpie(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double xcen, ycen;
- double *xv;
- int i, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
- xcen = va_arg(args, double);
- ycen = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* this should be impossible ... */
- if( n == 2 ){
- return(impie(g, rno, sno, flag, type, x, y,
- xcen, ycen, xv[0], xv[1]));
- }
- if( flag ){
- /* if its not somewhere inside the entire region we lose ... */
- if( !impie(g, 0, xsno, flag, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(0);
- }
- /* look through all of them to find the right one */
- for(i=0; i<n; i++){
- if( impie(g, rno+i, sno+i, flag, type, x, y, xcen, ycen, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
- }
- /* for excludes, we have to check that we are not in any of them */
- else{
- /* if its not somewhere inside the entire region we lose ... */
- if( !impie(g, 0, xsno, 1, type, x, y, xcen, ycen, xv[0], xv[n-1]) ){
- return(1);
- }
- return(1);
- }
-}
-
-#ifdef __STDC__
-int
-imvpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...)
-{
- int i, j, n;
- int maxpts;
- int xsno;
- double *xv;
- va_list args;
- va_start(args, y);
-#else
-int imvpoint(va_alist) va_dcl
-{
- GFilt g;
- int rno, sno, flag, type;
- double x, y;
- double *xv;
- int i, j, n;
- int maxpts;
- int xsno;
- va_list args;
- va_start(args);
- g = va_arg(args, GFilt);
- rno = va_arg(args, int);
- sno = va_arg(args, int);
- flag = va_arg(args, int);
- type = va_arg(args, int);
- x = va_arg(args, double);
- y = va_arg(args, double);
-#endif
- xsno = (g->nshapes+1)+((sno-1)*XSNO);
- if( !g->shapes[xsno].xv ){
- maxpts = MASKINC;
- g->shapes[xsno].xv = (double *)calloc(maxpts, sizeof(double));
- g->shapes[xsno].nv = 0;
- while( 1 ){
- if( g->shapes[xsno].nv >= maxpts ){
- maxpts += MASKINC;
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- maxpts*sizeof(double));
- }
- g->shapes[xsno].xv[g->shapes[xsno].nv] = va_arg(args, double);
- if( feq(g->shapes[xsno].xv[g->shapes[xsno].nv],PSTOP) &&
- feq(g->shapes[xsno].xv[g->shapes[xsno].nv-1],PSTOP) ){
- g->shapes[xsno].nv--;
- break;
- }
- g->shapes[xsno].nv++;
- }
- va_end(args);
- g->shapes[xsno].xv = (double *)realloc(g->shapes[xsno].xv,
- g->shapes[xsno].nv*sizeof(double));
- }
- n = g->shapes[xsno].nv;
- xv = g->shapes[xsno].xv;
- /* look through all of them to find the right one */
- for(i=0, j=0; i<n; i+=2, j++){
- if( impoint(g, rno+j, sno+j, flag, type, x, y, xv[i], xv[i+1]) ){
- return(1);
- }
- }
- return(0);
-}
-
-void imimagemaski(GFilt g, int UNUSED(rno), int UNUSED(sno),
- int UNUSED(flag), int UNUSED(type),
- double UNUSED(x), double UNUSED(y))
-{
- int i, j;
- int got;
- int fsize;
- int mblock;
- FilterMask xmasks;
-
- /* NB: do not use x and y variables, they have bogus values */
- /* scale mask x, y values to match the incoming image section */
- mblock = (int)(((double)((g->xmax - g->xmin + 1)/g->block)/(double)g->maskdim) + 0.5);
- if( mblock < 1 ){
- g->masks = NULL;
- g->nmask = 0;
- }
- /* copy all masks and translate x,y positions as needed */
- fsize = g->nmask * sizeof(FilterMaskRec) * mblock;
- xmasks = (FilterMask)calloc(1, fsize);
- for(got=0, i=0; i<g->nmask; i++){
- xmasks[got].region = g->masks[i].region;
- xmasks[got].y = (g->masks[i].y - 1.0) * mblock + 1.0;
- xmasks[got].xstart = (g->masks[i].xstart - 1.0) * mblock + 1.0;
- xmasks[got].xstop = (g->masks[i].xstop - 1.0) * mblock + 1.0;
- /* replicate the segment up to the block factor */
- for(j=1; j<mblock; j++){
- xmasks[got+j].region = xmasks[got].region;
- xmasks[got+j].y = xmasks[got].y+j;
- xmasks[got+j].xstart = xmasks[got].xstart;
- xmasks[got+j].xstop = xmasks[got].xstop;
- }
- got += mblock;
- }
- /* sort by y and x */
- qsort(xmasks, got, sizeof(FilterMaskRec), imagemaskcmp);
- /* we don't free previous masks, just overwrite, because they were not
- allocated in the first place */
- /* if( g->masks ) free(g->masks); */
- /* set up new mask records */
- g->masks = xmasks;
- g->nmask = got;
-
- /* now mark each y line that has a y mask value */
- for(i=0; i<got; i++){
- if( !g->ybuf[g->masks[i].y] )
- g->ybuf[g->masks[i].y] = i+1;
- }
-}
-
-int imimagemask(GFilt g, int UNUSED(rno), int UNUSED(sno),
- int UNUSED(flag), int UNUSED(type),
- double x, double y)
-{
- int i;
- int ix, iy;
-
- if( g->nmask == 0 )
- return(0);
- if( g->evsect ){
- if( g->usebinsiz ){
- x = (int)((x - g->tlminx)/g->binsizx + 1.0);
- y = (int)((y - g->tlminy)/g->binsizy + 1.0);
- }
- else{
- x = (int)((x - g->tlminx) + 1.0);
- y = (int)((y - g->tlminy) + 1.0);
- }
- x = (int)((x - g->xmin)/g->block + 1.0);
- y = (int)((y - g->ymin)/g->block + 1.0);
- if(y < g->y0) return 0;
- if(y > g->y1) return 0;
- if(x < g->x0) return 0;
- if(x > g->x1) return 0;
- }
- ix = (int)x;
- iy = (int)y;
- /* look for mask segment containing ix, iy */
- i = g->ybuf[iy];
- /* ybuf contains offset+1 of first mask record containing iy */
- if( i != 0 ){
- i--;
- for(; i<g->nmask; i++){
- if( g->masks[i].y > iy ){
- return(0);
- }
- if( (ix >= g->masks[i].xstart) && (ix <= g->masks[i].xstop) ){
- g->rid = g->masks[i].region;
- return(1);
- }
- }
- }
- return(0);
-}
-
diff --git a/funtools/filter/inc.sed b/funtools/filter/inc.sed
deleted file mode 100755
index 5318ca2..0000000
--- a/funtools/filter/inc.sed
+++ /dev/null
@@ -1,13 +0,0 @@
-:
-NAME="$1"
-sed '
-1i\
-static char *XXXX="\\n
-
-s#/\*.*\*/##g
-s/"/\\"/g
-s/\\n/\\\\n/g
-s/$/\\n/
-$a\
-\"
-' | sed "s/XXXX/$NAME/" | awk '{printf("%s", $0)};END{printf(";\n")}'
diff --git a/funtools/filter/install-sh b/funtools/filter/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/filter/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/filter/lex.filt.c b/funtools/filter/lex.filt.c
deleted file mode 100644
index 95c561a..0000000
--- a/funtools/filter/lex.filt.c
+++ /dev/null
@@ -1,8941 +0,0 @@
-#define yy_create_buffer filt_create_buffer
-#define yy_delete_buffer filt_delete_buffer
-#define yy_scan_buffer filt_scan_buffer
-#define yy_scan_string filt_scan_string
-#define yy_scan_bytes filt_scan_bytes
-#define yy_flex_debug filt_flex_debug
-#define yy_init_buffer filt_init_buffer
-#define yy_flush_buffer filt_flush_buffer
-#define yy_load_buffer_state filt_load_buffer_state
-#define yy_switch_to_buffer filt_switch_to_buffer
-#define yyin filtin
-#define yyleng filtleng
-#define yylex filtlex
-#define yyout filtout
-#define yyrestart filtrestart
-#define yytext filttext
-#define yywrap filtwrap
-
-/* A lexical scanner generated by flex*/
-
-/* Scanner skeleton version:
- * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-#include <stdio.h>
-#include <unistd.h>
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, filttext_ptr )
-
-/* Some routines like yy_flex_realloc() are emitted as static but are
- not called by all lexers. This generates warnings in some compilers,
- notably GCC. Arrange to suppress these. */
-#ifdef __GNUC__
-#define YY_MAY_BE_UNUSED __attribute__((unused))
-#else
-#define YY_MAY_BE_UNUSED
-#endif
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-static YY_BUFFER_STATE yy_current_buffer = 0;
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart YY_PROTO(( FILE *input_file ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-
-#define YY_USES_REJECT
-typedef unsigned char YY_CHAR;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-typedef int yy_state_type;
-extern char yytext[];
-
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- filttext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- if ( yyleng >= YYLMAX ) \
- YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
- yy_flex_strncpy( yytext, filttext_ptr, yyleng + 1 ); \
- yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 68
-#define YY_END_OF_BUFFER 69
-static yyconst short int yy_acclist[1847] =
- { 0,
- 60, 60, 60, 60, 60, 60, 60, 60, 69, 67,
- 68, 60, 67, 68, 66, 68, 67, 68, 67, 68,
- 6, 67, 68, 63, 67, 68, 63, 67, 68, 67,
- 68, 64, 67, 68, 65, 67, 68, 63, 67, 68,
- 66, 67, 68, 67, 68, 62, 67, 68, 62, 67,
- 68, 63, 67, 68, 63, 67, 68, 63, 67, 68,
- 58, 67, 68, 67, 68, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
-
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 59, 67, 68,16425,16426,
- 59, 67, 68,16425,16426, 63, 67, 68, 53, 66,
- 68,16433,16434, 67, 68, 52, 63, 67, 68, 52,
- 63, 67, 68, 51, 65, 67, 68, 52, 63, 67,
- 68, 48, 66, 67, 68,16433,16434, 67, 68, 46,
- 62, 67, 68, 46, 62, 67, 68, 67, 68, 53,
- 66, 67, 68,16433,16434, 52, 63, 67, 68, 47,
-
- 52, 63, 67, 68, 52, 63, 67, 68, 67, 68,
- 52, 63, 67, 68, 56, 64, 67, 68, 57, 65,
- 67, 68, 55, 66, 67, 68, 60, 67, 68, 40,
- 66, 68, 67, 68, 39, 63, 67, 68, 39, 63,
- 67, 68, 36, 64, 67, 68, 38, 65, 67, 68,
- 39, 63, 67, 68, 34, 66, 67, 68, 67, 68,
- 23, 62, 67, 68,16416, 23, 62, 67, 68,16416,
- 40, 66, 67, 68, 39, 63, 67, 68, 39, 63,
- 67, 68, 39, 63, 67, 68, 33, 58, 67, 68,
- 67, 68, 59, 67, 68,16425,16426, 59, 67, 68,
-
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 59, 67, 68,
- 16425,16426, 59, 67, 68,16425,16426, 67, 68, 39,
- 63, 67, 68, 68, 17, 68, 18, 68, 16, 68,
- 19, 68, 15, 68, 9, 68, 7, 68, 9, 68,
-
- 60, 63, 61, 62, 62, 62, 62, 62, 58, 66,
- 16425,16426, 54, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
-
- 59,16425,16426, 59,16425,16426,16433,16434, 8242, 8242,
- 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 52, 63,
- 46, 62, 46, 62, 46, 62, 46, 62, 45, 46,
- 62, 44, 44, 53, 66,16433,16434, 60, 39, 63,
- 23, 62,16416, 23, 62,16416, 23, 62,16416, 30,
- 8224, 8224, 29, 23, 62,16416, 8224, 8224, 8224, 27,
- 24, 23, 62,16416, 25, 28, 8224, 33, 58, 40,
- 66, 33, 33, 59,16425,16426, 33, 33, 33, 33,
- 33, 59,16425,16426,16425,16426, 33, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
-
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 15, 8, 62,
- 62, 62, 58, 8234, 8234, 8233, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
-
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 2, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 8242, 8241, 8242, 8242, 8242, 8242, 8241, 8242, 8242, 8242,
- 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242,
-
- 8242, 8242, 8242, 43, 43, 46, 62, 46, 62, 46,
- 62, 44, 44, 44, 44, 27, 23, 62,16416, 23,
- 62,16416, 23, 62,16416, 33, 58, 59,16425,16426,
- 31, 8234, 31, 8234, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 2, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
-
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 35, 15, 62, 62, 8234,
- 8234, 8234, 8234, 8234, 8234, 8233, 8233,16425,16426, 54,
- 59,16425,16426,16405,16406,16425,16426, 54,16405,16406,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 2, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
-
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 4, 59,16425,16426, 59,16425,16426,
- 8242, 8242, 8241, 8242, 8241, 8241, 8242, 8242, 8242, 8242,
- 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242,
- 8242, 46, 62, 43, 43, 43, 43, 46, 62, 44,
- 44, 44, 37, 23, 62,16416, 23, 27, 62,16416,
- 23, 62,16416,16425,16426, 33, 33, 54, 33, 33,
- 33, 33, 31, 8234, 31, 8234, 31, 31, 8234, 31,
- 8234, 59,16425,16426, 59,16425,16426, 59,16425,16426,
-
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 4, 59,16425,16426,
- 59,16425,16426,16405,16406,16405,16406, 1, 8234, 8234,
- 8234, 8234, 8234, 8234, 8234, 8233, 8233, 8234, 8234, 8233,
- 59,16425,16426, 8213, 8213, 8214,16405,16406, 59,16425,
-
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 20, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 16425,16426, 54, 59,16425,16426, 8242, 8242, 8242, 8242,
- 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8241,
- 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242, 8242,
- 8242, 43, 43, 43, 44, 44, 26, 26, 26, 26,
- 26, 26, 8224, 23, 62,16416, 23, 62,16416, 8234,
-
- 8234, 8233, 31, 8234, 31, 8234, 31, 8234, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 20, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 20, 8234, 8234, 8234,
- 8234, 8234, 8233, 8234, 8234, 8234, 8234, 8234, 8234, 8233,
- 8233, 59,16425,16426, 8213, 8213, 8213, 8213, 8214, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
-
- 16426, 59,16425,16426, 20,16405,16406,16425,16426, 20,
- 54,16405,16406, 59,16425,16426, 3, 59,16425,16426,
- 59,16425,16426, 59,16425,16426, 59,16425,16426,16425,
- 16426, 54,16425,16426, 10, 54, 59,16425,16426, 8242,
- 8242, 8242, 8242, 8242, 8242, 8242, 43, 43, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 23, 62,16416, 8234, 8234,
- 8234, 8234, 8234, 8234, 8233, 8233, 31, 8234, 31, 8234,
- 59,16425,16426, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
-
- 16426, 3, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 20,16405,16406,
- 20,16405,16406, 8234, 8234, 8234, 8234, 8234, 8234, 8234,
- 8234, 8234, 8233, 59,16425,16426, 8213, 8213, 8213, 8214,
- 5, 59,16425,16426, 59,16425,16426, 59,16425,16426,
- 20,16405,16406, 59,16425,16426, 59,16425,16426, 59,
- 16425,16426,16425,16426, 12, 54, 8234, 8234, 8233, 10,
- 16425,16426, 54, 8242, 8242, 8242, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 8234, 8234, 8234,
- 8234, 8234, 8234, 8234, 8233, 59,16425,16426, 5, 59,
-
- 16425,16426, 59,16425,16426, 59,16425,16426, 59,16425,
- 16426, 59,16425,16426, 59,16425,16426, 8234, 8234, 8234,
- 8234, 8234, 59,16425,16426, 8213, 8213, 59,16425,16426,
- 8234, 8234, 8233, 12, 8234, 8234, 8234, 8234, 8234, 8234,
- 8233, 8233,16425,16426, 11, 54, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 8234, 8234, 8234, 8234, 8234,
- 59,16425,16426, 59,16425,16426, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 8234,
- 8234, 59,16425,16426, 8234, 8234, 8234, 8234, 8234, 8234,
- 8233, 8233, 8234, 8234, 8234, 8234, 8234, 8234, 8234, 8233,
-
- 10, 8233, 8234, 8234, 8233, 11, 26, 8234, 8234, 59,
- 16425,16426, 59,16425,16426, 8234, 8234, 8234, 8234, 8234,
- 8234, 8234, 8233, 12, 8233, 8234, 8234, 8234, 8234, 8234,
- 10, 8233, 10, 8234, 8234, 8234, 8234, 8234, 8234, 8233,
- 8233, 26, 59,16425,16426, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- 14,16425,16426, 54, 8234, 8234, 8234, 8234, 8234, 12,
- 8233, 12, 8234, 8234, 10, 8234, 8234, 8234, 8234, 8234,
- 8234, 8234, 8233, 11, 8233,16425,16426, 13, 54, 8234,
-
- 8234, 12, 8234, 8234, 8234, 8234, 8234, 11, 8233, 11,
- 8234, 8234, 8233, 13, 8234, 8234, 11, 8234, 8234, 8234,
- 8234, 8234, 8234, 8233, 8233, 8234, 8234, 8234, 8234, 8234,
- 8234, 8234, 8233, 13, 8233, 8234, 8234, 8234, 8234, 8234,
- 13, 8233, 13, 8234, 8234, 13
- } ;
-
-static yyconst short int yy_accept[1689] =
- { 0,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,
- 9, 9, 9, 9, 9, 10, 12, 15, 17, 19,
- 21, 24, 27, 30, 32, 35, 38, 41, 44, 46,
- 49, 52, 55, 58, 61, 64, 66, 71, 76, 81,
- 86, 91, 96, 101, 106, 111, 116, 121, 126, 131,
- 136, 141, 146, 149, 154, 156, 160, 164, 168, 172,
- 178, 180, 184, 188, 190, 196, 200, 205, 209, 211,
- 215, 219, 223, 227, 230, 233, 235, 239, 243, 247,
- 251, 255, 259, 261, 266, 271, 275, 279, 283, 287,
- 291, 293, 298, 303, 308, 313, 318, 323, 328, 333,
-
- 338, 343, 348, 353, 358, 363, 368, 373, 378, 380,
- 384, 385, 387, 389, 391, 393, 395, 397, 399, 401,
- 402, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 404, 404, 404, 404, 404, 404, 404, 404, 404,
- 404, 404, 405, 406, 406, 406, 406, 406, 406, 407,
- 408, 408, 408, 409, 409, 410, 410, 411, 413, 414,
- 417, 417, 417, 420, 423, 426, 429, 432, 435, 438,
- 441, 444, 447, 450, 453, 456, 459, 462, 465, 468,
- 471, 474, 477, 480, 483, 486, 489, 492, 495, 498,
- 501, 504, 507, 509, 509, 509, 509, 509, 509, 509,
-
- 510, 511, 512, 513, 514, 515, 516, 517, 518, 519,
- 521, 521, 523, 525, 527, 527, 529, 530, 530, 530,
- 532, 532, 532, 532, 532, 533, 534, 538, 539, 539,
- 541, 541, 541, 541, 544, 547, 550, 550, 550, 551,
- 552, 553, 554, 557, 557, 558, 559, 560, 560, 561,
- 561, 561, 562, 565, 566, 567, 567, 568, 570, 570,
- 572, 572, 573, 574, 577, 578, 579, 580, 580, 581,
- 585, 587, 588, 591, 594, 597, 600, 603, 606, 609,
- 612, 615, 618, 621, 624, 627, 630, 633, 636, 639,
- 642, 645, 648, 651, 654, 657, 660, 663, 666, 669,
-
- 672, 675, 678, 678, 678, 678, 679, 679, 680, 680,
- 680, 680, 680, 680, 680, 680, 680, 680, 680, 680,
- 680, 680, 680, 680, 680, 680, 680, 680, 680, 680,
- 680, 680, 680, 680, 680, 680, 680, 680, 681, 681,
- 682, 683, 683, 684, 684, 684, 684, 684, 685, 686,
- 686, 687, 687, 690, 693, 696, 699, 702, 705, 708,
- 711, 714, 717, 720, 723, 726, 729, 733, 736, 739,
- 742, 745, 748, 751, 754, 757, 760, 763, 766, 769,
- 772, 775, 778, 781, 781, 781, 781, 781, 781, 781,
- 781, 781, 781, 781, 781, 781, 781, 781, 781, 781,
-
- 782, 784, 784, 784, 785, 786, 787, 787, 787, 787,
- 787, 789, 790, 790, 791, 791, 792, 793, 794, 795,
- 796, 797, 798, 799, 800, 801, 802, 803, 804, 804,
- 804, 804, 804, 805, 806, 808, 808, 810, 812, 813,
- 814, 815, 815, 815, 816, 816, 816, 816, 816, 817,
- 817, 817, 817, 817, 817, 817, 820, 820, 820, 820,
- 820, 820, 823, 823, 823, 823, 823, 826, 826, 828,
- 828, 831, 831, 831, 831, 831, 833, 835, 838, 841,
- 844, 847, 850, 853, 856, 859, 862, 865, 868, 871,
- 874, 878, 881, 884, 887, 890, 893, 896, 899, 902,
-
- 905, 908, 911, 914, 917, 920, 923, 926, 926, 926,
- 927, 927, 928, 928, 928, 928, 928, 928, 928, 928,
- 928, 928, 928, 928, 928, 928, 928, 928, 928, 928,
- 928, 928, 928, 928, 928, 928, 928, 928, 928, 928,
- 928, 928, 929, 930, 931, 932, 933, 933, 933, 934,
- 934, 934, 934, 935, 936, 937, 938, 938, 940, 941,
- 941, 944, 948, 951, 954, 957, 960, 963, 966, 969,
- 972, 975, 978, 981, 984, 985, 988, 991, 994, 997,
- 1000, 1003, 1006, 1009, 1012, 1015, 1018, 1021, 1024, 1028,
- 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
-
- 1031, 1031, 1031, 1031, 1031, 1031, 1032, 1032, 1032, 1032,
- 1032, 1032, 1033, 1033, 1035, 1036, 1037, 1037, 1037, 1037,
- 1037, 1037, 1038, 1038, 1039, 1040, 1041, 1042, 1043, 1044,
- 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1052, 1054,
- 1055, 1056, 1057, 1057, 1057, 1058, 1058, 1060, 1060, 1061,
- 1061, 1062, 1063, 1063, 1063, 1064, 1064, 1067, 1067, 1067,
- 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067,
- 1071, 1074, 1076, 1076, 1077, 1078, 1079, 1080, 1081, 1082,
- 1083, 1085, 1087, 1088, 1090, 1090, 1090, 1092, 1092, 1095,
- 1098, 1101, 1104, 1107, 1110, 1113, 1116, 1119, 1122, 1125,
-
- 1128, 1131, 1134, 1137, 1140, 1143, 1146, 1149, 1152, 1155,
- 1158, 1161, 1164, 1167, 1171, 1174, 1174, 1176, 1178, 1178,
- 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1178,
- 1178, 1178, 1178, 1178, 1178, 1178, 1178, 1179, 1179, 1179,
- 1179, 1179, 1179, 1179, 1179, 1179, 1179, 1180, 1180, 1181,
- 1182, 1183, 1184, 1185, 1185, 1185, 1186, 1186, 1187, 1187,
- 1187, 1188, 1188, 1188, 1188, 1188, 1189, 1190, 1190, 1191,
- 1194, 1194, 1194, 1195, 1196, 1197, 1199, 1202, 1205, 1208,
- 1211, 1214, 1217, 1220, 1223, 1226, 1230, 1233, 1236, 1239,
- 1242, 1245, 1248, 1251, 1253, 1254, 1257, 1258, 1259, 1260,
-
- 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270,
- 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1271, 1271, 1272,
- 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282,
- 1282, 1283, 1283, 1284, 1285, 1285, 1286, 1287, 1287, 1287,
- 1287, 1287, 1288, 1289, 1289, 1289, 1289, 1289, 1290, 1291,
- 1291, 1291, 1291, 1291, 1292, 1293, 1293, 1293, 1294, 1297,
- 1300, 1300, 1300, 1300, 1300, 1300, 1301, 1302, 1302, 1303,
- 1303, 1305, 1305, 1307, 1309, 1312, 1315, 1318, 1321, 1324,
- 1327, 1330, 1333, 1336, 1339, 1343, 1346, 1349, 1352, 1355,
- 1358, 1361, 1364, 1367, 1367, 1367, 1367, 1367, 1367, 1367,
-
- 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367,
- 1367, 1367, 1368, 1368, 1368, 1368, 1368, 1368, 1368, 1369,
- 1370, 1370, 1371, 1371, 1372, 1373, 1373, 1374, 1375, 1376,
- 1377, 1377, 1377, 1378, 1378, 1378, 1378, 1379, 1380, 1381,
- 1382, 1385, 1386, 1387, 1388, 1388, 1388, 1389, 1389, 1390,
- 1390, 1393, 1396, 1399, 1402, 1405, 1410, 1414, 1417, 1421,
- 1424, 1427, 1430, 1432, 1433, 1433, 1435, 1436, 1437, 1437,
- 1437, 1437, 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1440,
- 1440, 1440, 1440, 1440, 1440, 1440, 1440, 1441, 1442, 1443,
- 1444, 1445, 1446, 1447, 1447, 1448, 1449, 1449, 1450, 1451,
-
- 1452, 1453, 1453, 1453, 1454, 1455, 1455, 1455, 1456, 1457,
- 1458, 1459, 1459, 1459, 1460, 1460, 1460, 1461, 1462, 1463,
- 1464, 1464, 1464, 1465, 1466, 1466, 1466, 1466, 1466, 1469,
- 1470, 1471, 1472, 1472, 1472, 1473, 1473, 1473, 1473, 1474,
- 1475, 1476, 1477, 1477, 1479, 1481, 1484, 1487, 1490, 1493,
- 1496, 1499, 1502, 1506, 1509, 1512, 1515, 1518, 1518, 1518,
- 1518, 1518, 1518, 1518, 1518, 1518, 1518, 1518, 1518, 1518,
- 1518, 1518, 1518, 1518, 1518, 1518, 1518, 1518, 1521, 1524,
- 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1525, 1526, 1526,
- 1527, 1527, 1528, 1529, 1530, 1531, 1532, 1532, 1532, 1533,
-
- 1533, 1534, 1537, 1537, 1538, 1538, 1539, 1540, 1540, 1541,
- 1545, 1548, 1551, 1554, 1557, 1560, 1563, 1563, 1565, 1566,
- 1567, 1567, 1567, 1567, 1567, 1567, 1567, 1567, 1568, 1569,
- 1569, 1570, 1571, 1573, 1574, 1574, 1574, 1574, 1574, 1574,
- 1574, 1574, 1575, 1576, 1577, 1577, 1578, 1578, 1579, 1580,
- 1580, 1581, 1581, 1582, 1583, 1583, 1584, 1584, 1585, 1586,
- 1586, 1586, 1587, 1588, 1588, 1589, 1589, 1590, 1591, 1592,
- 1593, 1594, 1594, 1594, 1595, 1595, 1596, 1599, 1603, 1606,
- 1609, 1612, 1615, 1618, 1618, 1618, 1618, 1618, 1618, 1618,
- 1618, 1618, 1618, 1618, 1618, 1618, 1618, 1618, 1618, 1618,
-
- 1618, 1618, 1618, 1618, 1618, 1618, 1618, 1618, 1618, 1618,
- 1619, 1620, 1620, 1621, 1621, 1622, 1623, 1626, 1626, 1627,
- 1628, 1631, 1631, 1631, 1631, 1631, 1632, 1633, 1633, 1634,
- 1635, 1636, 1637, 1638, 1638, 1638, 1639, 1639, 1639, 1639,
- 1640, 1641, 1642, 1643, 1643, 1643, 1645, 1646, 1647, 1647,
- 1647, 1647, 1647, 1647, 1647, 1647, 1648, 1649, 1649, 1650,
- 1651, 1651, 1652, 1653, 1654, 1655, 1656, 1656, 1656, 1657,
- 1658, 1658, 1659, 1659, 1660, 1661, 1664, 1667, 1668, 1669,
- 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679,
- 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
-
- 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
- 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1681, 1682,
- 1685, 1686, 1687, 1688, 1688, 1688, 1689, 1689, 1689, 1689,
- 1690, 1691, 1692, 1693, 1693, 1693, 1694, 1694, 1695, 1696,
- 1697, 1698, 1699, 1699, 1699, 1700, 1700, 1701, 1701, 1701,
- 1702, 1702, 1703, 1703, 1703, 1703, 1703, 1704, 1705, 1705,
- 1706, 1707, 1708, 1708, 1709, 1710, 1713, 1713, 1713, 1713,
- 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713,
- 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713,
- 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713,
-
- 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713,
- 1713, 1716, 1716, 1717, 1717, 1718, 1719, 1720, 1721, 1722,
- 1722, 1722, 1723, 1723, 1724, 1724, 1724, 1725, 1725, 1726,
- 1726, 1727, 1728, 1728, 1729, 1729, 1730, 1731, 1731, 1732,
- 1732, 1733, 1734, 1735, 1736, 1737, 1737, 1737, 1738, 1738,
- 1738, 1738, 1739, 1740, 1741, 1742, 1742, 1743, 1746, 1746,
- 1746, 1746, 1746, 1746, 1746, 1746, 1747, 1748, 1749, 1750,
- 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760,
- 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770,
- 1771, 1772, 1772, 1772, 1772, 1772, 1772, 1774, 1775, 1775,
-
- 1776, 1777, 1777, 1778, 1778, 1779, 1780, 1780, 1781, 1781,
- 1782, 1783, 1783, 1784, 1785, 1786, 1786, 1787, 1787, 1788,
- 1789, 1790, 1791, 1792, 1792, 1792, 1793, 1793, 1794, 1794,
- 1794, 1795, 1795, 1796, 1796, 1796, 1796, 1796, 1796, 1796,
- 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796,
- 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796,
- 1796, 1796, 1796, 1796, 1796, 1796, 1798, 1799, 1800, 1800,
- 1800, 1800, 1800, 1801, 1802, 1803, 1803, 1804, 1805, 1805,
- 1806, 1806, 1807, 1808, 1808, 1809, 1809, 1810, 1811, 1811,
- 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811,
-
- 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811, 1811,
- 1811, 1811, 1811, 1812, 1813, 1813, 1814, 1815, 1815, 1816,
- 1817, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
- 1818, 1819, 1820, 1821, 1821, 1821, 1822, 1822, 1822, 1822,
- 1823, 1824, 1825, 1826, 1826, 1826, 1826, 1826, 1827, 1827,
- 1828, 1829, 1830, 1831, 1832, 1832, 1832, 1833, 1833, 1834,
- 1834, 1834, 1835, 1835, 1836, 1836, 1836, 1836, 1837, 1838,
- 1838, 1839, 1839, 1840, 1841, 1841, 1842, 1842, 1843, 1844,
- 1844, 1844, 1844, 1845, 1846, 1847, 1847, 1847
- } ;
-
-static yyconst int yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 5, 6, 1, 7, 8, 9, 10,
- 11, 7, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 20, 20, 20, 23, 24, 25, 26,
- 27, 28, 1, 29, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 56,
- 30, 31, 32, 7, 33, 1, 34, 35, 36, 37,
-
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 56, 59, 60, 61, 62, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst int yy_meta[63] =
- { 0,
- 1, 2, 3, 4, 1, 1, 4, 4, 1, 5,
- 6, 7, 8, 9, 10, 11, 12, 12, 12, 12,
- 12, 12, 12, 13, 1, 4, 14, 4, 1, 15,
- 1, 1, 16, 17, 17, 17, 17, 18, 17, 16,
- 16, 16, 16, 16, 19, 20, 16, 16, 16, 16,
- 16, 21, 16, 16, 16, 16, 22, 16, 1, 4,
- 23, 24
- } ;
-
-static yyconst short int yy_base[1846] =
- { 0,
- 0, 0, 60, 0, 79, 83, 122, 0, 184, 0,
- 237, 0, 66, 67, 7752,14226, 7745,14226, 68, 7741,
- 14226,14226, 7737, 7735, 215,14226, 281,14226, 288, 322,
- 64, 39, 7716, 73, 7712, 7693, 319, 323, 345, 354,
- 378, 385, 356, 380, 399, 409, 421, 430, 431, 440,
- 463, 472, 7552, 509, 541,14226, 7603,14226, 577, 0,
- 584, 606, 278, 662, 0, 82, 7579, 83, 7558, 7544,
- 595,14226,14226, 253,14226, 621,14226, 7593, 0, 259,
- 594,14226, 669, 691, 316,14226, 88, 7567, 231, 7559,
- 7540, 752, 813, 406, 449, 276, 430, 441, 331, 216,
-
- 391, 461, 371, 742, 315, 345, 536, 468, 780, 7526,
- 14226,14226,14226,14226,14226, 7543,14226,14226, 7523, 7564,
- 14226, 7518, 217, 63, 204, 7520, 7514, 470, 7501, 7547,
- 14226, 7532, 341, 479, 487, 605, 456, 606, 632, 691,
- 752, 7504, 0, 7496, 627, 7474, 7489, 7488, 788, 813,
- 310, 835,14226, 0, 7495, 7491,14226, 583,14226, 714,
- 874, 7473, 836, 720, 860, 872, 898, 903, 904, 908,
- 909, 910, 914, 941, 725, 943, 947, 956, 970, 979,
- 985, 980, 989, 1001, 1012, 1016, 1022, 1027, 1038, 1045,
- 1054, 1061, 0, 1051, 1101, 1110, 1087, 1159, 317, 7465,
-
- 7464, 359, 492, 355, 539, 226, 414, 873, 390,14226,
- 1117, 7450, 411, 699, 618, 826, 1220, 516, 1188, 641,
- 0, 0, 1208, 1227, 1236, 611, 0, 457, 1265,14226,
- 579, 1277, 1243, 7439, 637, 1297, 1036, 7446,14226,14226,
- 7455,14226, 7423, 1139, 510, 7433, 543, 555, 1140, 1333,
- 1181,14226, 1358,14226,14226, 0, 7399, 7428, 7425,14226,
- 7419,14226, 7435, 1419, 626, 1480, 718, 7409, 7377, 1506,
- 899, 1567, 7387, 7381, 7395, 7355, 7374, 7354, 7345, 7355,
- 7331, 7334, 7331, 7341, 7331, 736, 7323, 7314, 7310, 7320,
- 7318, 7286, 7284, 7260, 7275, 74, 7263, 7261, 7243, 7226,
-
- 7229, 7229, 1309, 704, 1358, 7234, 7230,14226, 7145, 7131,
- 7153, 7135, 7151, 7107, 7117, 7112, 7094, 7093, 7096, 689,
- 7084, 0, 609, 7098, 831, 783, 774, 948, 1004, 975,
- 933, 7075, 7060, 7062, 7042, 7038, 1394, 768, 1370, 1419,
- 7018, 7026, 7023, 7025, 1162, 1433, 1440, 1576, 810, 1622,
- 7014, 7009, 1186, 1466, 1513, 1515, 1331, 1517, 1519, 1395,
- 1529, 1590, 1605, 1621, 1599, 1628, 1548, 1647, 1652, 1550,
- 1658, 1659, 1665, 1670, 1681, 1691, 1692, 1702, 1704, 1713,
- 1714, 1725, 1726, 6990, 770, 829, 694, 6978, 6975, 1032,
- 6954, 1765, 1452, 1814, 912, 1875, 1936, 1997, 6971,14226,
-
- 6987, 985, 6954, 842, 6962, 852, 905, 1466, 1022, 0,
- 6928, 6957, 6954, 6819, 6814, 937, 267, 747, 308, 761,
- 417, 847, 786, 978, 1032, 918, 1120, 930, 1752, 2058,
- 1774, 1843, 2067, 941, 1319, 1887, 1949, 1145, 1265, 1904,
- 1959, 1075, 1971,14226, 0, 1997, 1467, 2010,14226, 2022,
- 1610, 1745, 2029, 2123, 6788, 2177, 1836, 2044, 2238, 6782,
- 2074, 2096, 1855, 2109, 2294, 6781, 2350, 6802, 6800, 6799,
- 2411, 2472, 2495, 2133, 2116, 2518, 1060, 2574, 2635, 1552,
- 6762, 1137, 666, 1758, 1145, 2000, 1707, 999, 1170, 613,
- 2162, 2156, 1845, 2147, 2157, 2161, 1040, 1089, 2190, 1221,
-
- 1215, 2210, 1161, 2196, 2215, 2211, 2220, 6754, 0,14226,
- 6782, 6781, 2221, 1210, 1561, 1392, 1603, 1422, 1796, 1608,
- 1807, 1528, 1809, 1668, 1654, 1203, 6779, 1336, 1707, 1277,
- 1899, 1814, 1838, 1898, 1700, 1871, 6764, 6768, 6749, 6747,
- 2259, 2268,14226, 2209, 2281, 2303, 1094, 2315,14226, 0,
- 2327, 2385, 2683, 1235, 6769, 6767, 6750, 2414, 6742, 2740,
- 2418, 2801, 2827, 2420, 2432, 2442, 2453, 2451, 2520, 2498,
- 2519, 2521, 2542, 2581, 1962, 2585, 2583, 2595, 2597, 2596,
- 2630, 2642, 2646, 2648, 2644, 2681, 2683, 2705, 2804, 2825,
- 6725, 6713, 6726, 6704, 6720, 6708, 6716, 6516, 6505, 6489,
-
- 6480, 1356, 6465, 2872, 2933, 6504, 6470, 1448, 2839, 2994,
- 0, 6446, 2901,14226, 6495, 6438, 2556, 2846, 2884, 3055,
- 6463, 6443, 6438, 6437, 818, 6438, 1479, 1242, 1523, 1341,
- 1718, 990, 1366, 1511, 1828, 667, 1574, 2945, 2955, 2679,
- 2965, 2994, 1488, 3016,14226, 0, 1340, 3028, 1648, 3084,
- 3091, 6391, 6367, 0,14226, 3101, 3121, 1800, 3182, 1915,
- 0, 2172, 3204, 2205, 0, 2246, 3226, 2307, 0, 3248,
- 3309, 2906, 1678, 6395, 1244, 6393, 1904, 3371, 1749, 1639,
- 3432, 3157, 6414, 3169, 1867, 3284, 6411, 0, 3488, 3549,
- 1901, 1768, 6366, 1538, 1958, 1398, 1295, 1324, 1963, 2061,
-
- 1976, 1900, 1614, 1990, 2430, 1992, 1778, 2054, 1874, 2063,
- 2065, 1574, 2261, 6349, 2008, 1053, 3610, 2160, 6346, 6352,
- 6266, 6273, 6260, 6270, 6263, 6265, 6245, 6257, 6258, 925,
- 1930, 6256, 3637, 2222, 2352, 2513,14226, 2387, 3155, 2796,
- 6248, 6246, 6232, 2236, 6234, 3345, 2051, 3133, 3192, 6235,
- 3216, 3309, 3418, 2103, 3445,14226, 0, 6232, 6224, 6223,
- 6220, 3699, 2295, 3461, 3321, 3747, 1500, 3804, 3866, 3058,
- 3488, 3502, 3914, 1949, 6213, 2373, 3537, 2997, 3542, 3544,
- 3556, 3568, 3583, 3928, 3761, 3587, 3937, 3938, 3943, 3952,
- 3959, 3974, 3770, 3771, 2665, 3975, 6186,14226, 6184, 6194,
-
- 6174, 6177, 6170, 6166, 6166, 6165, 6152, 6139, 6154, 3514,
- 4025, 3582, 3994, 4086, 4001, 4141,14226, 2669, 1709, 2074,
- 1809, 2146, 2130, 2172, 2206, 2143, 1014, 1128, 2428, 4042,
- 2105, 4027, 4049, 6141, 4056, 4115,14226, 2013, 4200, 4150,
- 4122, 4222, 4278, 2924, 4329, 4159, 4166, 4351, 4407, 3041,
- 4458, 4175, 4186, 4480, 4536, 3234, 4587, 4208, 4627, 6128,
- 4689, 0, 2466, 4231, 4285, 4737, 2210, 4794, 4856, 4264,
- 2486, 4292, 4316, 2388, 4917, 4978, 1376, 2256, 535, 2154,
- 2254, 2307, 2276, 2360, 2823, 2326, 2055, 2342, 1754, 1636,
- 1834, 2828, 2400, 6122, 6116, 6126, 6120, 6122, 6102, 6117,
-
- 6102, 2354, 5039, 5989, 2261, 5089, 2590, 2547, 2679, 2901,
- 2979, 2552, 5984, 2710, 3941, 3972, 5968, 4337, 4358,14226,
- 4393, 2418, 4414, 4421, 5964, 5975, 5973, 5137, 4488, 4544,
- 2705, 5183, 5970, 5199, 4598, 4744, 5224, 2374, 5281, 5343,
- 3998, 3277, 4445, 4522, 2439, 4573,14226, 0, 5966, 5939,
- 4028, 4444, 4520, 4570, 4089, 5404, 5430, 4924, 4245, 4459,
- 4928, 4930, 4263, 4126, 2628, 4392,14226, 4231, 5457, 2994,
- 4233, 4391, 5910, 5917, 5907, 5914, 5901, 5911, 5902, 5899,
- 5879, 5882, 5882, 4766, 5518, 5579, 1437, 2472, 2695, 2525,
- 2447, 2531, 2497, 4950, 4978,14226, 5854, 5640, 487, 2540,
-
- 2873, 2713, 4995, 2627,14226, 0, 2934, 5696, 3093, 2664,
- 3094, 2721, 5007, 2876, 0, 3196, 5752, 3257, 2894, 3318,
- 2787, 5038, 2937,14226, 0, 3467, 4490, 5808, 5830, 5878,
- 5047, 5145, 2853, 5924, 5882, 5940, 5532, 5167, 5965, 2775,
- 6022, 6084, 5190, 5253, 5911, 6145, 6206, 5842, 2760, 2459,
- 2189, 2939, 5839, 2537, 2953, 3000, 3571, 5830, 5842, 5831,
- 6267, 4914, 5830, 3031, 3085, 2945, 5831, 5828, 3507, 5813,
- 3292, 3485, 6317, 3221, 4522, 4071, 4352, 6378, 6400, 5802,
- 4657, 4488, 5405, 4546, 3155, 5206, 5231,14226, 6412, 3426,
- 5539, 5579, 6428, 6459, 5595, 5602, 3428, 6505, 5813, 6521,
-
- 6560, 5230, 5631, 3081, 5647, 5654, 5798, 5809, 5808, 5151,
- 5677, 5407, 0, 5693, 5679, 5700, 3537, 5563,14226, 4654,
- 6622, 5167, 5008, 6684, 3159, 6744, 6773, 6802, 3125, 6859,
- 6921, 3557, 5730, 5408, 5779, 5790, 5783, 5784, 5756, 5771,
- 5751, 3187, 3199, 2608, 5764, 3939, 5794, 5866, 4275, 5907,
- 4985, 5830, 5947, 4340, 5994, 5029, 5842, 6146, 4404, 6982,
- 6159, 7004, 3243, 7050, 3454, 5885, 5972, 7066, 7097, 6171,
- 6206, 3456, 7143, 5766, 7159, 7198, 7259, 7320, 5744, 5756,
- 5727, 5715, 5683, 5665, 5644, 5665, 5645, 5659, 5646, 5656,
- 5645, 5635, 5609, 5609, 2425, 5597, 4004, 7381, 4485, 7430,
-
- 3605, 5736, 5766, 5594, 5410, 5601, 5733, 5606, 6228, 6255,
- 5603, 7469, 3758, 6272, 6420, 5584, 5729, 6364, 6386,14226,
- 5678, 0, 3582, 7499, 7528, 7557, 3440, 7614, 7676, 4086,
- 5575, 7736, 7772, 5017, 7808, 4207, 7837, 7874, 7903, 7920,
- 7963, 8020, 0, 5545, 4649, 6482,14226, 5719, 8082, 5906,
- 5909, 5540, 5551, 5538, 6436, 6766, 3782, 6512, 6991, 3940,
- 6528, 7013, 3944, 5549, 6160, 6213, 0, 7058, 7074, 5510,
- 8133, 3769, 7104, 7126, 5486, 5477, 5408, 5401,14226, 5407,
- 5393, 5381, 5238, 5231, 5221, 5192, 5159, 5133, 5025, 5020,
- 0, 4257, 1868, 3745, 4355, 4593, 3249, 3313, 5596, 2877,
-
- 0, 4766, 2379, 4313, 4537, 4626, 3757, 3918, 5652, 2991,
- 2870, 4963, 6799, 4988, 6746, 6239, 7151, 7259, 4949, 5971,
- 4943, 8163, 8199, 6236, 8235, 5051, 8264, 8301, 8330, 8347,
- 8390, 8447, 0, 6283, 8507, 6469, 8536, 8565, 4894, 8582,
- 8637, 8673, 6825, 8709, 6232, 8724, 0, 6458, 6748, 4792,
- 7269, 6823, 0, 3624, 8761, 8790, 8819, 3952, 8876, 8938,
- 6468, 7014, 7285, 7320, 4749, 4672, 4625, 4596, 4581, 4566,
- 4535, 4533, 4448, 4357, 4311, 4284, 4254, 2562, 2972, 2910,
- 3410, 3130, 872, 3201, 2603, 3023, 3495, 3026, 4287, 3946,
- 4049, 3231, 3320, 3555, 3467, 2682, 3511, 3135, 4063, 4083,
-
- 3961, 4595, 3949, 3483, 5527, 7126, 5789, 7342, 7282, 4079,
- 5735, 8998, 7342, 9027, 9056, 4052, 9073, 9128, 9164, 7346,
- 9200, 6778, 9215, 0, 7015, 7326, 4051, 7367, 7371, 9252,
- 9281, 6805, 9310, 7404, 9339, 9368, 3989, 7408, 3931, 7420,
- 7424, 7468, 3768, 9397, 9433, 7479, 9469, 7026, 9498, 9535,
- 9564, 9581, 9624, 9681, 0, 7481, 7107, 4145, 3675, 3633,
- 3570, 3414, 3349, 3315, 3264, 4003, 3245, 4293, 3583, 4351,
- 4124, 4352, 3316, 4054, 3746, 4551, 2785, 4415, 4121, 3198,
- 4745, 4118, 4888, 4416, 4890, 4168, 4290, 4179, 4914, 4721,
- 4452, 3152, 3037, 3013, 2977, 4189, 7530, 7363, 9741, 9770,
-
- 7107, 9799, 7566, 9828, 9857, 2882, 7504, 2865, 7738, 7512,
- 7568, 9886, 9915, 7265, 7578, 9944, 7747, 9973,10002, 2838,
- 10019,10074,10110, 7781,10146, 7267,10161, 0, 7777, 7811,
- 2808, 7820, 7877, 2718, 2643, 2623, 4484, 4289, 4489, 4418,
- 4741, 4491, 4541, 4236, 4335, 4582, 4645, 4891, 4649, 4896,
- 4952, 4742, 5012, 5139, 4257, 4570, 5031, 5048, 2498, 2290,
- 2185, 2113, 7942, 7422, 7375, 7944,14226, 7565,10200, 7757,
- 7746,10260,10289, 7445, 7885,10318,10347, 7582,10376, 7945,
- 10405,10434, 2038, 7963, 1990, 8143, 7984, 7987, 4492, 4419,
- 5141, 5140, 3084, 5159, 2548, 4739, 5229, 5226, 5233, 4368,
-
- 5245, 4456, 1935, 1767, 1685, 1552, 8167, 7813, 0, 5436,
- 10463,10492,10521, 4988,10578,10640, 7748,10700,10729, 7793,
- 8175, 4910, 5489, 5040, 5491, 5536, 5535, 1466, 1225, 1285,
- 1273,10758,10794, 8208,10830, 7887,10859,10896,10925,10942,
- 10985,11042, 0, 8210, 1154, 4980,11102, 8245,11131,11160,
- 1024,11177,11232,11268, 8247,11304, 7926,11319, 0, 8243,
- 8304, 962, 8312, 8368, 789, 586,11356,11385, 7928,11414,
- 8355,11443,11472, 404, 8371, 390, 8391, 8411, 8414, 3527,
- 295,11501,11530, 7971, 8510, 5522,14226,11561,11585,11609,
- 11618,11632,11655,11671,11694,11707,11724, 5734,11748,11771,
-
- 11793,11809,11822,11845, 5776,11862,11873,11884, 5789,11888,
- 11912,11935,11959,11972,11984,12008,12017,12032,12056,12069,
- 12088,12106,12117,12141,12164, 5857,12180,12204,12217,12241,
- 12264,12274, 6183,12285,12307,12318,12329,12341,12365,12388,
- 12409, 6484,12433,12452,12476,12493,12508, 6493,12519,12532,
- 12556,12580,12603,12626, 6503,12648,12672,12685,12700, 6740,
- 12711, 6840, 6973, 7036, 7172,12730, 7297,12753,12766,12784,
- 12808,12827,12840,12850, 7308,12861,12885,12909,12933,12956,
- 12969,12993,13006,13019,13027,13049,13068,13087,13107,13130,
- 13148,13172,13189,13213,13226,13245,13269,13292,13307, 7369,
-
- 13318,13342,13365,13387,13400,13423, 7392,13443, 7460,13463,
- 7491,13484,13507,13531,13555,13574,13597,13619,13643,13667,
- 13690,13703,13722,13746,13759,13782,13802,13822,13843,13866,
- 13890,13914,13937,13961, 7546,13985,14009,14033,14057,14081,
- 14105,14129,14153,14177,14201
- } ;
-
-static yyconst short int yy_def[1846] =
- { 0,
- 1687, 1, 1, 3, 1, 1, 1687, 7, 1687, 9,
- 9, 11, 1688, 1688, 1687, 1687, 1687, 1687, 1687, 1689,
- 1687, 1687, 1687, 1690, 1691, 1687, 1687, 1687, 1687, 1687,
- 30, 1687, 1687, 1687, 1692, 1687, 1693, 1693, 1693, 1693,
- 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693,
- 1693, 1693, 1687, 1687, 1687, 1687, 1687, 1687, 27, 54,
- 1687, 1687, 62, 1687, 54, 1687, 1687, 1687, 1687, 1687,
- 1691, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 71, 1687,
- 27, 1687, 1687, 1687, 84, 1687, 1687, 1687, 1687, 1694,
- 1687, 1695, 1695, 93, 93, 93, 93, 93, 93, 93,
-
- 93, 93, 93, 93, 93, 93, 93, 93, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1696, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1689,
- 1687, 1690, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
- 1687, 30, 31, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1698, 1692, 1699, 1687, 1687, 1687, 1693,
- 1700, 1701, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693,
- 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693,
- 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693, 1693,
- 1693, 1693, 54, 1687, 54, 1687, 1687, 1687, 198, 1702,
-
- 1703, 1703, 1703, 1703, 1703, 1703, 1703, 1703, 1703, 1687,
- 1687, 62, 62, 1704, 1687, 1704, 1687, 1687, 1687, 1687,
- 1705, 64, 1687, 1687, 1687, 225, 54, 1687, 1687, 1687,
- 1687, 1687, 1687, 84, 84, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 236, 1706, 1687, 1687, 1687, 1687, 1707, 1687,
- 1708, 1687, 1687, 1687, 1687, 1709, 1687, 1710, 1711, 1687,
- 1687, 1687, 1687, 1712, 1687, 1700, 1687, 1713, 1687, 1712,
- 1687, 266, 270, 270, 270, 270, 270, 270, 270, 270,
- 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
- 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
-
- 270, 270, 1687, 1714, 1687, 1715, 1716, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1717, 1718, 1719, 1718, 1718, 1718, 1718, 1718, 1718,
- 1718, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1720, 1721, 1721, 266, 266, 1687, 1687, 1687, 348, 1722,
- 1723, 1724, 1724, 1725, 1725, 1725, 1725, 1725, 1725, 1725,
- 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725,
- 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725,
- 1725, 1725, 1725, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 394, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 397, 1687, 1687, 1687, 1687, 1687, 398, 1726,
- 1687, 1727, 1728, 1729, 1730, 1729, 1729, 1729, 1729, 1729,
- 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1687, 1687,
- 1687, 1687, 1687, 433, 1687, 1687, 1687, 1731, 1732, 1687,
- 1687, 1687, 1687, 1687, 1733, 1687, 1734, 1687, 1687, 1687,
- 1735, 1736, 1687, 1687, 454, 1687, 1735, 1687, 1687, 459,
- 1687, 456, 1737, 1687, 1687, 465, 1687, 1738, 1738, 1739,
- 1739, 1740, 1740, 1687, 1687, 1687, 476, 1741, 1741, 479,
- 479, 479, 479, 479, 479, 479, 479, 479, 479, 479,
- 479, 479, 479, 479, 479, 479, 479, 479, 479, 479,
-
- 479, 479, 479, 479, 479, 479, 479, 1687, 1742, 1687,
- 1743, 1743, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1744, 1745, 1745, 1746, 1746,
- 1746, 1746, 1746, 1746, 1746, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1747, 1687, 1687, 1687, 1687, 1687, 1748,
- 1687, 1687, 1687, 553, 1749, 1750, 1751, 1752, 1752, 1687,
- 1753, 1754, 1754, 1753, 1753, 1753, 1753, 1753, 1753, 1753,
- 1753, 1753, 1753, 1753, 1687, 1753, 1753, 1753, 1753, 1753,
- 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 605, 1687, 1687, 1687,
- 1755, 1687, 1687, 1687, 1687, 1687, 610, 1687, 617, 1687,
- 1756, 1756, 1757, 1757, 1758, 1758, 1758, 1758, 1758, 1758,
- 1758, 1758, 1758, 1758, 1758, 1758, 1758, 1687, 1687, 1759,
- 1687, 1687, 1687, 1687, 1687, 1760, 1687, 1687, 1687, 1687,
- 1687, 1761, 1687, 1762, 1687, 1687, 1687, 1687, 1687, 1687,
- 1763, 1687, 1687, 1687, 1764, 1687, 1687, 1687, 1765, 1687,
- 1687, 1766, 1766, 1766, 1766, 1766, 1766, 1687, 1766, 1766,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1767, 1768, 1768,
- 690, 690, 690, 690, 690, 690, 690, 690, 690, 690,
-
- 690, 690, 690, 690, 690, 690, 690, 690, 690, 690,
- 690, 690, 690, 690, 690, 1769, 1754, 717, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1770, 1771, 1687, 1772, 1772, 1772, 1687, 1772, 1772, 1772,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1773,
- 1774, 1687, 1687, 1687, 1687, 1687, 1775, 1776, 1777, 1778,
- 1778, 1687, 762, 1779, 1779, 1779, 766, 1687, 1687, 1780,
- 1687, 1687, 1687, 773, 1781, 717, 1780, 1780, 1780, 1780,
- 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780,
- 1780, 1780, 1780, 1782, 1782, 1780, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 811, 1687, 1687, 811, 1687, 811, 1783, 1783,
- 1783, 1783, 1783, 1783, 1783, 1783, 1783, 1783, 1783, 1687,
- 1687, 1687, 1687, 1784, 1687, 1687, 1687, 1785, 1687, 1687,
- 1687, 1687, 1687, 1786, 1687, 1687, 1687, 1687, 1687, 1787,
- 1687, 1687, 1687, 1687, 1687, 1788, 1687, 1687, 1687, 859,
- 1687, 861, 861, 1789, 1789, 1789, 866, 1687, 1687, 1687,
- 1687, 1687, 1687, 1790, 1791, 1791, 876, 876, 876, 876,
- 876, 876, 876, 876, 876, 876, 876, 876, 876, 876,
- 876, 876, 876, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1792, 1792, 1687, 1793, 1793, 1793, 1793,
- 1793, 1687, 1687, 1687, 1794, 1794, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1795, 1796, 1796, 1797, 1797, 1797,
- 1797, 1797, 1797, 1797, 1797, 1797, 1797, 937, 1687, 1687,
- 1798, 1799, 1687, 1687, 1687, 1687, 1687, 1800, 1801, 1802,
- 1798, 1798, 1798, 1798, 1798, 1803, 1803, 1798, 1798, 1798,
- 1798, 1798, 1804, 1804, 1794, 1794, 1687, 1794, 1687, 1794,
- 1794, 1798, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1805, 1805, 1805, 1805,
- 1805, 1805, 1805, 1687, 1687, 1687, 1687, 1687, 1806, 1687,
-
- 1806, 1687, 1687, 1687, 1687, 1807, 1687, 1687, 1808, 1687,
- 1808, 1687, 1687, 1687, 1809, 1687, 1687, 1810, 1687, 1810,
- 1687, 1687, 1687, 1687, 1811, 1687, 1687, 1687, 1687, 1812,
- 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1039,
- 1687, 1687, 1687, 1687, 1687, 1813, 1813, 1047, 1047, 1047,
- 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1814, 1815, 1687, 1816, 1816, 1816, 1816, 1817, 1817, 1687,
- 1818, 1818, 1819, 1819, 1687, 1687, 1687, 1687, 1820, 1820,
- 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820,
-
- 1687, 1821, 1687, 1687, 1687, 1687, 1822, 1823, 1823, 1821,
- 1821, 1821, 1079, 1821, 1821, 1821, 1818, 1818, 1687, 1818,
- 1687, 1818, 1818, 1687, 1124, 1819, 1819, 1819, 1128, 1687,
- 1687, 1819, 1824, 1824, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1825, 1825, 1825, 1687, 1687, 1687, 1687, 1826, 1687,
- 1687, 1687, 1687, 1827, 1687, 1687, 1687, 1687, 1828, 1687,
- 1687, 1687, 1162, 1829, 1829, 1829, 1829, 1829, 1829, 1829,
- 1829, 1829, 1829, 1829, 1829, 1687, 1830, 1830, 1178, 1178,
- 1178, 1178, 1178, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1831, 1831, 1832, 1832,
-
- 1833, 1833, 1833, 1687, 1818, 1818, 1824, 1824, 1820, 1820,
- 1820, 1820, 1820, 1820, 1820, 1100, 1821, 1687, 1687, 1687,
- 1821, 1121, 1121, 1818, 1818, 1818, 1226, 1687, 1687, 1818,
- 1128, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1128,
- 1128, 1687, 1131, 1834, 1824, 1824, 1687, 1824, 1687, 1824,
- 1824, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1162, 1687, 1687, 1835, 1829, 1829, 1829,
- 1829, 1829, 1829, 1829, 1175, 1178, 1178, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1198, 1198, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831,
-
- 1200, 1200, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832,
- 1687, 1833, 1833, 1687, 1824, 1824, 1820, 1820, 1820, 1821,
- 1226, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1226,
- 1226, 1687, 1229, 1836, 1819, 1819, 1819, 1819, 1237, 1128,
- 1819, 1819, 1819, 1819, 1819, 1237, 1242, 1837, 1834, 1838,
- 1834, 1834, 1249, 1249, 1824, 1824, 1824, 1357, 1687, 1687,
- 1824, 1835, 1829, 1829, 1829, 1178, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1831, 1831, 1831,
- 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831,
- 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832,
-
- 1832, 1832, 1832, 1687, 1687, 1833, 1833, 1833, 1833, 1687,
- 1821, 1818, 1818, 1818, 1818, 1327, 1226, 1818, 1818, 1818,
- 1818, 1818, 1327, 1332, 1839, 1836, 1838, 1836, 1836, 1819,
- 1819, 1819, 1819, 1819, 1819, 1819, 1346, 1837, 1840, 1837,
- 1837, 1834, 1357, 1824, 1824, 1824, 1824, 1824, 1824, 1824,
- 1824, 1357, 1357, 1687, 1360, 1841, 1687, 1178, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1831, 1831, 1831, 1831, 1831,
- 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1832, 1832,
- 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832,
- 1832, 1687, 1687, 1687, 1687, 1687, 1842, 1842, 1818, 1818,
-
- 1818, 1818, 1818, 1818, 1818, 1423, 1839, 1840, 1839, 1839,
- 1836, 1819, 1819, 1819, 1837, 1824, 1824, 1824, 1824, 1449,
- 1357, 1824, 1824, 1824, 1824, 1824, 1449, 1454, 1843, 1841,
- 1838, 1841, 1841, 1687, 1687, 1687, 1831, 1831, 1831, 1831,
- 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1832, 1832, 1832,
- 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1687, 1687,
- 1687, 1687, 1842, 1842, 1842, 1842, 1687, 1842, 1687, 1842,
- 1842, 1818, 1818, 1818, 1839, 1824, 1824, 1824, 1824, 1824,
- 1824, 1824, 1527, 1843, 1840, 1843, 1843, 1841, 1831, 1831,
- 1831, 1831, 1831, 1831, 1831, 1832, 1832, 1832, 1832, 1832,
-
- 1832, 1832, 1687, 1687, 1687, 1687, 1842, 1842, 1569, 1569,
- 1842, 1842, 1842, 1613, 1687, 1687, 1842, 1824, 1824, 1824,
- 1843, 1831, 1831, 1831, 1832, 1832, 1832, 1687, 1687, 1687,
- 1613, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1613,
- 1613, 1687, 1616, 1844, 1687, 1687, 1842, 1842, 1842, 1842,
- 1637, 1613, 1842, 1842, 1842, 1842, 1842, 1637, 1642, 1845,
- 1844, 1838, 1844, 1844, 1687, 1687, 1842, 1842, 1842, 1842,
- 1842, 1842, 1842, 1658, 1845, 1840, 1845, 1845, 1844, 1687,
- 1687, 1842, 1842, 1842, 1845, 1687, 0, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687
- } ;
-
-static yyconst short int yy_nxt[14289] =
- { 0,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 27, 29, 22, 30, 31, 31, 31,
- 31, 31, 31, 16, 28, 32, 33, 34, 35, 16,
- 36, 16, 37, 38, 39, 40, 41, 42, 43, 44,
- 37, 45, 46, 37, 47, 37, 37, 37, 48, 49,
- 50, 37, 51, 37, 52, 37, 37, 37, 16, 53,
- 16, 22, 54, 55, 121, 121, 56, 57, 118, 118,
- 58, 59, 60, 59, 61, 56, 62, 63, 63, 63,
- 63, 63, 63, 64, 65, 66, 67, 68, 71, 72,
- 69, 73, 71, 72, 121, 73, 119, 119, 1687, 121,
-
- 121, 122, 123, 124, 312, 125, 126, 210, 210, 210,
- 210, 313, 127, 230, 230, 500, 128, 129, 501, 70,
- 1687, 56, 16, 74, 75, 76, 20, 21, 77, 78,
- 24, 79, 80, 81, 82, 81, 83, 77, 84, 85,
- 85, 85, 85, 85, 85, 16, 86, 87, 88, 89,
- 90, 16, 91, 16, 92, 93, 94, 95, 96, 97,
- 98, 99, 100, 101, 102, 100, 103, 100, 100, 100,
- 104, 105, 106, 100, 107, 100, 108, 100, 100, 100,
- 109, 110, 16, 77, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 112, 113, 111, 114, 111, 111, 111,
-
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 115, 111, 111, 111, 111, 111, 116, 116, 116, 116,
- 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
- 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
- 116, 116, 111, 111, 111, 111, 111, 111, 314, 111,
- 134, 135, 315, 136, 228, 415, 137, 230, 230, 138,
- 231, 264, 264, 111, 310, 311, 139, 423, 140, 111,
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 141, 415, 142, 143, 143,
-
- 143, 143, 143, 143, 149, 149, 149, 149, 149, 149,
- 149, 229, 1687, 281, 122, 123, 124, 232, 125, 144,
- 158, 264, 264, 626, 158, 127, 338, 338, 159, 145,
- 129, 146, 159, 147, 1687, 148, 150, 415, 143, 143,
- 143, 143, 143, 143, 143, 161, 158, 1686, 162, 161,
- 1687, 1687, 162, 322, 159, 158, 151, 158, 628, 152,
- 264, 264, 165, 159, 287, 159, 153, 298, 163, 164,
- 324, 161, 1687, 1687, 162, 288, 264, 264, 154, 158,
- 161, 158, 161, 162, 415, 162, 158, 159, 415, 159,
- 264, 264, 166, 167, 159, 168, 419, 175, 299, 176,
-
- 158, 169, 170, 420, 161, 416, 161, 162, 159, 162,
- 158, 161, 292, 177, 162, 171, 264, 264, 159, 415,
- 172, 927, 158, 275, 178, 161, 289, 181, 162, 173,
- 159, 158, 158, 174, 179, 161, 290, 264, 162, 159,
- 159, 158, 428, 415, 180, 1687, 415, 161, 1684, 159,
- 162, 264, 264, 276, 277, 424, 161, 161, 228, 162,
- 162, 630, 182, 183, 158, 282, 161, 1687, 322, 162,
- 184, 185, 159, 158, 283, 264, 264, 186, 284, 291,
- 187, 159, 285, 188, 286, 324, 264, 264, 1000, 161,
- 278, 322, 162, 189, 264, 264, 279, 280, 161, 322,
-
- 190, 162, 328, 318, 191, 302, 264, 264, 324, 192,
- 193, 319, 194, 264, 264, 229, 324, 320, 195, 325,
- 196, 415, 196, 197, 1145, 198, 199, 199, 199, 199,
- 199, 199, 435, 435, 326, 240, 240, 200, 1005, 417,
- 418, 201, 202, 203, 204, 201, 205, 206, 201, 201,
- 201, 201, 201, 207, 201, 201, 201, 208, 209, 201,
- 201, 201, 201, 201, 201, 201, 201, 210, 415, 240,
- 240, 456, 456, 300, 122, 123, 124, 301, 125, 126,
- 231, 264, 264, 421, 158, 127, 1048, 422, 264, 128,
- 129, 211, 159, 212, 213, 213, 213, 213, 213, 213,
-
- 214, 214, 214, 214, 214, 214, 214, 215, 233, 161,
- 234, 235, 235, 235, 235, 235, 235, 322, 322, 215,
- 216, 322, 213, 213, 213, 213, 213, 213, 213, 217,
- 134, 135, 1681, 136, 324, 324, 137, 232, 324, 138,
- 218, 217, 215, 219, 322, 1687, 139, 230, 140, 327,
- 220, 262, 262, 329, 122, 123, 124, 700, 125, 126,
- 318, 324, 221, 222, 217, 127, 264, 1687, 319, 128,
- 129, 1687, 330, 223, 320, 223, 224, 333, 225, 226,
- 226, 226, 226, 226, 226, 236, 236, 236, 236, 236,
- 236, 236, 237, 1687, 238, 239, 415, 240, 241, 242,
-
- 215, 693, 240, 322, 240, 243, 240, 235, 235, 235,
- 235, 235, 235, 235, 244, 158, 245, 246, 247, 264,
- 324, 158, 217, 159, 828, 248, 158, 249, 250, 159,
- 523, 251, 252, 524, 159, 253, 429, 331, 596, 254,
- 161, 255, 597, 162, 262, 262, 161, 256, 508, 162,
- 257, 161, 240, 158, 162, 261, 491, 491, 262, 263,
- 509, 159, 366, 262, 510, 262, 355, 262, 149, 149,
- 149, 149, 149, 149, 149, 293, 415, 265, 266, 267,
- 627, 268, 294, 295, 338, 338, 322, 264, 264, 296,
- 415, 303, 297, 303, 629, 322, 304, 305, 305, 305,
-
- 305, 305, 305, 324, 149, 149, 149, 149, 149, 149,
- 149, 269, 324, 270, 271, 415, 261, 592, 593, 262,
- 263, 531, 159, 632, 262, 337, 262, 215, 262, 149,
- 149, 149, 149, 149, 149, 149, 530, 158, 265, 272,
- 267, 1680, 268, 322, 1687, 159, 339, 415, 339, 217,
- 152, 340, 340, 340, 340, 340, 340, 340, 273, 274,
- 324, 158, 161, 219, 529, 162, 1687, 400, 400, 159,
- 594, 819, 269, 158, 270, 344, 415, 595, 400, 400,
- 631, 159, 356, 345, 354, 346, 161, 346, 347, 162,
- 348, 349, 349, 349, 349, 349, 349, 350, 161, 158,
-
- 271, 162, 415, 905, 158, 158, 425, 159, 159, 158,
- 158, 158, 159, 159, 426, 158, 1471, 159, 159, 159,
- 427, 617, 617, 159, 161, 472, 902, 162, 357, 161,
- 161, 358, 162, 162, 161, 161, 161, 162, 162, 162,
- 161, 361, 158, 162, 158, 322, 1687, 415, 158, 360,
- 159, 903, 159, 359, 363, 626, 159, 158, 364, 415,
- 322, 362, 324, 367, 367, 159, 415, 161, 1687, 161,
- 162, 158, 162, 161, 365, 1687, 162, 324, 637, 159,
- 158, 158, 161, 625, 535, 162, 158, 322, 159, 159,
- 158, 368, 615, 761, 159, 402, 161, 1687, 159, 162,
-
- 532, 372, 158, 369, 324, 161, 161, 415, 162, 162,
- 159, 161, 371, 158, 162, 161, 322, 158, 162, 415,
- 370, 159, 534, 158, 633, 159, 373, 161, 158, 401,
- 162, 159, 402, 324, 825, 374, 159, 237, 161, 158,
- 698, 162, 161, 415, 616, 162, 158, 159, 161, 357,
- 533, 162, 264, 161, 159, 158, 162, 376, 375, 244,
- 377, 415, 158, 159, 161, 600, 626, 162, 1669, 378,
- 159, 161, 451, 601, 162, 379, 251, 705, 634, 602,
- 161, 411, 380, 162, 384, 385, 386, 161, 387, 388,
- 162, 649, 649, 264, 1687, 389, 383, 894, 382, 390,
-
- 391, 381, 1687, 397, 397, 397, 397, 397, 397, 397,
- 747, 747, 392, 510, 392, 393, 1687, 394, 395, 395,
- 395, 395, 395, 395, 197, 706, 396, 199, 199, 199,
- 199, 199, 199, 214, 214, 214, 214, 214, 214, 214,
- 452, 457, 264, 384, 385, 386, 215, 387, 388, 415,
- 453, 458, 453, 458, 389, 454, 459, 415, 390, 391,
- 398, 635, 399, 1687, 636, 400, 401, 993, 217, 402,
- 400, 1687, 400, 403, 400, 199, 199, 199, 199, 199,
- 199, 199, 463, 692, 404, 405, 406, 558, 1687, 647,
- 264, 695, 464, 407, 464, 559, 408, 465, 264, 436,
-
- 1665, 436, 711, 409, 437, 437, 437, 437, 437, 437,
- 437, 717, 560, 730, 264, 410, 699, 353, 411, 718,
- 400, 430, 224, 264, 439, 226, 226, 226, 226, 226,
- 226, 431, 732, 431, 432, 737, 433, 434, 434, 434,
- 434, 434, 434, 440, 440, 440, 440, 440, 440, 440,
- 441, 674, 226, 226, 226, 226, 226, 226, 226, 236,
- 236, 236, 236, 236, 236, 236, 1645, 708, 264, 1687,
- 442, 415, 709, 443, 264, 471, 303, 821, 303, 441,
- 444, 304, 305, 305, 305, 305, 305, 305, 446, 322,
- 446, 1687, 445, 447, 448, 448, 448, 448, 448, 448,
-
- 238, 239, 443, 240, 241, 242, 324, 1565, 240, 444,
- 240, 735, 240, 236, 236, 236, 236, 236, 236, 236,
- 215, 445, 245, 246, 247, 304, 305, 305, 305, 305,
- 305, 305, 562, 449, 450, 435, 435, 1646, 252, 264,
- 563, 215, 217, 882, 461, 254, 461, 255, 733, 462,
- 462, 462, 462, 462, 462, 462, 257, 161, 240, 237,
- 162, 238, 239, 217, 240, 241, 242, 528, 264, 240,
- 415, 240, 883, 240, 305, 305, 305, 305, 305, 305,
- 305, 244, 823, 245, 246, 247, 340, 340, 340, 340,
- 340, 340, 340, 717, 249, 415, 158, 807, 251, 252,
-
- 808, 718, 508, 626, 159, 541, 254, 541, 255, 481,
- 542, 542, 542, 542, 542, 542, 542, 257, 510, 240,
- 158, 161, 261, 717, 162, 262, 263, 721, 159, 264,
- 262, 718, 262, 881, 262, 340, 340, 340, 340, 340,
- 340, 340, 264, 568, 265, 266, 267, 347, 268, 544,
- 349, 349, 349, 349, 349, 349, 545, 545, 545, 545,
- 545, 545, 545, 723, 811, 811, 415, 158, 605, 605,
- 605, 605, 605, 605, 605, 159, 737, 618, 269, 618,
- 270, 344, 619, 619, 619, 619, 619, 619, 619, 345,
- 1142, 346, 161, 346, 347, 162, 348, 349, 349, 349,
-
- 349, 349, 349, 350, 831, 831, 262, 158, 415, 261,
- 561, 653, 262, 263, 562, 159, 158, 262, 562, 262,
- 562, 262, 563, 654, 159, 820, 563, 655, 563, 717,
- 562, 265, 266, 267, 352, 268, 565, 718, 563, 161,
- 415, 161, 162, 161, 162, 161, 162, 826, 162, 158,
- 575, 158, 415, 158, 567, 161, 352, 159, 162, 159,
- 575, 159, 717, 566, 726, 269, 564, 270, 473, 822,
- 718, 879, 575, 691, 161, 569, 161, 162, 474, 162,
- 474, 475, 264, 476, 477, 477, 477, 477, 477, 477,
- 546, 158, 349, 349, 349, 349, 349, 349, 349, 159,
-
- 562, 367, 1630, 415, 717, 264, 158, 720, 563, 717,
- 547, 457, 718, 548, 159, 829, 161, 718, 264, 162,
- 549, 458, 562, 458, 892, 161, 459, 570, 162, 562,
- 563, 161, 550, 551, 162, 551, 552, 563, 553, 554,
- 554, 554, 554, 554, 554, 573, 571, 161, 158, 722,
- 162, 491, 725, 158, 161, 717, 159, 162, 264, 158,
- 158, 159, 572, 718, 649, 649, 562, 159, 159, 717,
- 471, 562, 574, 161, 563, 579, 162, 718, 161, 563,
- 576, 162, 158, 1055, 161, 161, 577, 162, 162, 264,
- 159, 161, 562, 562, 162, 729, 161, 578, 674, 162,
-
- 563, 563, 580, 158, 674, 562, 581, 161, 158, 471,
- 162, 159, 322, 563, 158, 158, 159, 161, 161, 322,
- 162, 162, 159, 159, 1629, 728, 158, 158, 161, 324,
- 161, 162, 582, 162, 159, 159, 324, 583, 415, 161,
- 161, 740, 162, 162, 585, 586, 452, 415, 697, 584,
- 587, 161, 161, 987, 162, 162, 453, 734, 453, 158,
- 264, 454, 589, 638, 824, 638, 588, 159, 639, 639,
- 639, 639, 639, 639, 639, 674, 674, 737, 590, 393,
- 471, 604, 395, 395, 395, 395, 395, 395, 432, 1054,
- 640, 434, 434, 434, 434, 434, 434, 717, 384, 385,
-
- 386, 658, 387, 388, 877, 718, 694, 264, 717, 389,
- 717, 264, 264, 390, 391, 398, 718, 399, 718, 889,
- 400, 606, 264, 659, 737, 400, 322, 400, 607, 400,
- 395, 395, 395, 395, 395, 395, 395, 457, 415, 404,
- 405, 406, 724, 324, 514, 659, 158, 458, 608, 458,
- 322, 609, 459, 989, 159, 727, 463, 415, 610, 641,
- 641, 641, 641, 641, 641, 641, 464, 324, 464, 1056,
- 611, 465, 717, 612, 827, 400, 398, 738, 399, 702,
- 718, 400, 401, 871, 871, 402, 400, 264, 400, 403,
- 400, 199, 199, 199, 199, 199, 199, 199, 264, 905,
-
- 404, 405, 406, 437, 437, 437, 437, 437, 437, 437,
- 322, 322, 408, 890, 1378, 741, 658, 491, 264, 409,
- 440, 440, 440, 440, 440, 440, 440, 324, 324, 674,
- 674, 410, 736, 887, 411, 471, 400, 398, 659, 399,
- 730, 648, 400, 401, 264, 264, 402, 400, 739, 400,
- 215, 400, 397, 397, 397, 397, 397, 397, 397, 732,
- 659, 404, 405, 406, 575, 437, 437, 437, 437, 437,
- 437, 437, 217, 613, 575, 440, 440, 440, 440, 440,
- 440, 440, 650, 1687, 650, 1628, 575, 651, 651, 651,
- 651, 651, 651, 651, 880, 411, 443, 400, 398, 884,
-
- 399, 158, 264, 400, 606, 1687, 491, 264, 400, 159,
- 400, 886, 400, 447, 448, 448, 448, 448, 448, 448,
- 264, 927, 404, 405, 406, 481, 448, 448, 448, 448,
- 448, 448, 448, 656, 264, 656, 264, 696, 657, 657,
- 657, 657, 657, 657, 657, 454, 455, 455, 455, 455,
- 455, 455, 264, 264, 653, 893, 612, 997, 400, 430,
- 459, 460, 460, 460, 460, 460, 460, 747, 747, 431,
- 655, 431, 432, 655, 433, 434, 434, 434, 434, 434,
- 434, 642, 1620, 434, 434, 434, 434, 434, 434, 434,
- 462, 462, 462, 462, 462, 462, 462, 885, 264, 1053,
-
- 891, 643, 481, 415, 644, 264, 481, 264, 264, 264,
- 988, 645, 462, 462, 462, 462, 462, 462, 462, 922,
- 922, 831, 831, 646, 658, 465, 466, 466, 466, 466,
- 466, 466, 682, 682, 682, 682, 682, 682, 682, 455,
- 455, 455, 455, 455, 455, 455, 659, 475, 158, 681,
- 477, 477, 477, 477, 477, 477, 159, 158, 158, 415,
- 1606, 776, 158, 158, 575, 159, 159, 660, 659, 1687,
- 159, 159, 415, 662, 575, 415, 626, 704, 991, 661,
- 238, 239, 990, 240, 241, 242, 575, 481, 240, 701,
- 240, 158, 240, 456, 456, 663, 703, 158, 491, 159,
-
- 264, 415, 245, 246, 247, 159, 662, 264, 992, 264,
- 264, 158, 158, 449, 264, 264, 158, 663, 252, 159,
- 159, 158, 717, 546, 159, 254, 481, 255, 663, 159,
- 718, 1605, 737, 712, 322, 415, 257, 915, 240, 662,
- 264, 707, 626, 264, 470, 916, 548, 666, 714, 264,
- 663, 324, 710, 549, 460, 460, 460, 460, 460, 460,
- 460, 663, 794, 264, 264, 550, 470, 713, 264, 667,
- 795, 1071, 715, 264, 719, 542, 542, 542, 542, 542,
- 542, 542, 664, 663, 542, 542, 542, 542, 542, 542,
- 542, 667, 905, 481, 665, 666, 352, 545, 545, 545,
-
- 545, 545, 545, 545, 352, 264, 1049, 264, 666, 264,
- 466, 466, 466, 466, 466, 466, 466, 667, 746, 545,
- 545, 545, 545, 545, 545, 545, 748, 1051, 748, 264,
- 667, 749, 749, 749, 749, 749, 749, 749, 668, 667,
- 548, 552, 1604, 751, 554, 554, 554, 554, 554, 554,
- 669, 237, 667, 238, 239, 902, 240, 241, 242, 1050,
- 264, 240, 1687, 240, 322, 240, 467, 467, 467, 467,
- 467, 467, 467, 244, 776, 245, 246, 247, 1052, 264,
- 903, 324, 1687, 467, 467, 467, 670, 467, 467, 683,
- 251, 252, 491, 481, 671, 264, 907, 737, 254, 322,
-
- 255, 752, 752, 752, 752, 752, 752, 752, 352, 257,
- 528, 240, 672, 264, 673, 558, 324, 674, 675, 158,
- 676, 158, 674, 559, 674, 1391, 674, 159, 909, 159,
- 352, 562, 1045, 158, 922, 922, 677, 678, 679, 563,
- 560, 159, 471, 158, 161, 353, 161, 162, 367, 162,
- 1057, 159, 158, 264, 158, 1104, 1104, 415, 161, 770,
- 159, 162, 159, 888, 777, 626, 1288, 470, 161, 1289,
- 680, 162, 674, 473, 264, 470, 415, 161, 778, 161,
- 162, 345, 162, 474, 780, 474, 475, 683, 476, 477,
- 477, 477, 477, 477, 477, 350, 473, 779, 1143, 158,
-
- 1180, 415, 871, 871, 345, 626, 474, 159, 474, 475,
- 264, 476, 477, 477, 477, 477, 477, 477, 350, 683,
- 158, 158, 158, 1687, 161, 322, 415, 162, 159, 159,
- 159, 1603, 684, 782, 477, 477, 477, 477, 477, 477,
- 477, 1000, 324, 158, 1144, 161, 161, 161, 162, 162,
- 162, 159, 685, 1078, 415, 686, 781, 737, 626, 322,
- 415, 1079, 687, 401, 626, 908, 402, 783, 161, 784,
- 1182, 162, 617, 617, 688, 158, 324, 261, 785, 905,
- 262, 263, 158, 159, 158, 262, 158, 262, 264, 262,
- 159, 1005, 159, 905, 159, 1624, 158, 562, 158, 265,
-
- 266, 267, 322, 268, 159, 563, 159, 161, 1466, 161,
- 162, 161, 162, 367, 162, 411, 788, 786, 689, 324,
- 787, 161, 161, 161, 162, 162, 162, 1074, 1000, 789,
- 967, 158, 367, 269, 905, 270, 562, 415, 261, 159,
- 1473, 262, 263, 158, 563, 158, 262, 158, 262, 158,
- 262, 159, 967, 159, 626, 159, 161, 159, 970, 162,
- 265, 266, 267, 357, 268, 1010, 971, 967, 161, 1279,
- 161, 162, 161, 162, 161, 162, 401, 162, 1005, 402,
- 1279, 792, 158, 790, 158, 1687, 1687, 791, 690, 967,
- 159, 322, 159, 642, 269, 970, 270, 753, 357, 554,
-
- 554, 554, 554, 554, 554, 554, 794, 161, 324, 161,
- 162, 1081, 162, 528, 795, 1005, 644, 754, 357, 1082,
- 755, 1090, 1090, 645, 415, 1075, 1484, 756, 411, 1146,
- 1146, 161, 626, 793, 162, 646, 353, 1151, 1151, 757,
- 352, 762, 352, 352, 352, 352, 352, 352, 352, 763,
- 352, 764, 352, 764, 765, 352, 766, 767, 767, 767,
- 767, 767, 767, 768, 352, 352, 352, 352, 352, 1279,
- 352, 353, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 352, 352,
-
- 352, 352, 562, 1156, 1156, 158, 1687, 1179, 322, 470,
- 563, 264, 771, 159, 771, 772, 905, 773, 774, 774,
- 774, 774, 774, 774, 956, 324, 158, 161, 776, 963,
- 161, 470, 957, 162, 159, 911, 1687, 964, 771, 761,
- 771, 772, 1546, 773, 774, 774, 774, 774, 774, 774,
- 812, 161, 812, 1687, 162, 813, 813, 813, 813, 813,
- 813, 813, 619, 619, 619, 619, 619, 619, 619, 1165,
- 1165, 1311, 796, 398, 1000, 399, 264, 1010, 400, 606,
- 737, 264, 1578, 400, 471, 400, 607, 400, 395, 395,
- 395, 395, 395, 395, 395, 1019, 927, 404, 405, 406,
-
- 619, 619, 619, 619, 619, 619, 619, 672, 905, 609,
- 1003, 737, 815, 322, 815, 676, 610, 816, 816, 816,
- 816, 816, 816, 816, 1005, 658, 1574, 1005, 611, 1390,
- 324, 612, 861, 400, 398, 658, 399, 471, 1019, 400,
- 606, 905, 1076, 1468, 400, 1024, 400, 659, 400, 605,
- 605, 605, 605, 605, 605, 605, 215, 659, 404, 405,
- 406, 639, 639, 639, 639, 639, 639, 639, 1007, 659,
- 810, 639, 639, 639, 639, 639, 639, 639, 217, 659,
- 1181, 641, 641, 641, 641, 641, 641, 641, 1024, 1189,
- 264, 322, 612, 1190, 400, 398, 967, 399, 158, 481,
-
- 400, 606, 830, 905, 264, 400, 159, 400, 324, 400,
- 641, 641, 641, 641, 641, 641, 641, 1562, 967, 404,
- 405, 406, 528, 161, 970, 1077, 162, 832, 1467, 832,
- 357, 644, 833, 833, 833, 833, 833, 833, 833, 835,
- 1132, 835, 662, 1403, 836, 836, 836, 836, 836, 836,
- 836, 264, 1183, 612, 905, 400, 398, 905, 399, 158,
- 1561, 400, 401, 1467, 663, 402, 400, 159, 400, 1474,
- 400, 620, 620, 620, 620, 620, 620, 620, 1185, 1186,
- 404, 405, 406, 1560, 161, 1016, 663, 162, 620, 620,
- 620, 620, 620, 620, 1010, 1010, 941, 1104, 1104, 818,
-
- 651, 651, 651, 651, 651, 651, 651, 651, 651, 651,
- 651, 651, 651, 651, 411, 905, 400, 657, 657, 657,
- 657, 657, 657, 657, 238, 239, 1187, 240, 241, 242,
- 1150, 1013, 240, 1188, 240, 1623, 240, 657, 657, 657,
- 657, 657, 657, 657, 1005, 1005, 245, 246, 247, 749,
- 749, 749, 749, 749, 749, 749, 1207, 449, 683, 965,
- 965, 905, 252, 1470, 1208, 1687, 528, 322, 965, 254,
- 683, 255, 1486, 682, 682, 682, 682, 682, 682, 682,
- 257, 965, 240, 839, 324, 682, 682, 682, 682, 682,
- 682, 682, 1559, 840, 870, 840, 841, 662, 842, 843,
-
- 843, 843, 843, 843, 843, 845, 686, 910, 749, 749,
- 749, 749, 749, 749, 749, 846, 415, 846, 847, 663,
- 848, 849, 849, 849, 849, 849, 849, 851, 415, 528,
- 753, 737, 905, 322, 1472, 666, 626, 852, 626, 852,
- 853, 663, 854, 855, 855, 855, 855, 855, 855, 857,
- 324, 238, 239, 755, 240, 241, 242, 667, 1019, 858,
- 756, 858, 528, 240, 859, 860, 860, 860, 860, 860,
- 860, 244, 757, 245, 246, 247, 905, 1687, 1026, 667,
- 905, 467, 467, 467, 670, 467, 467, 1480, 251, 252,
- 1385, 944, 671, 1197, 1155, 872, 254, 872, 255, 1687,
-
- 873, 873, 873, 873, 873, 873, 873, 257, 1024, 240,
- 237, 1536, 238, 239, 946, 240, 241, 242, 1198, 1019,
- 240, 947, 240, 905, 240, 752, 752, 752, 752, 752,
- 752, 752, 244, 948, 245, 246, 247, 929, 929, 929,
- 929, 929, 929, 929, 905, 249, 921, 905, 1279, 251,
- 252, 528, 353, 1481, 1386, 1022, 918, 254, 918, 255,
- 1543, 919, 919, 919, 919, 919, 919, 919, 257, 1024,
- 240, 470, 862, 470, 470, 470, 470, 470, 470, 470,
- 863, 470, 864, 470, 864, 865, 470, 866, 867, 867,
- 867, 867, 867, 867, 868, 470, 470, 674, 470, 470,
-
- 1535, 470, 471, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 470,
- 470, 470, 470, 683, 752, 752, 752, 752, 752, 752,
- 752, 905, 1090, 1090, 1213, 1213, 684, 1279, 477, 477,
- 477, 477, 477, 477, 477, 755, 923, 353, 923, 353,
- 1469, 924, 924, 924, 924, 924, 924, 924, 666, 686,
- 1165, 1165, 1272, 1272, 1117, 765, 687, 928, 767, 767,
- 767, 767, 767, 767, 1404, 471, 1199, 471, 688, 158,
- 667, 261, 353, 737, 262, 263, 1117, 159, 528, 262,
-
- 1483, 262, 772, 262, 942, 774, 774, 774, 774, 774,
- 774, 1200, 667, 265, 266, 267, 528, 268, 943, 943,
- 943, 943, 943, 943, 943, 984, 905, 984, 1311, 875,
- 985, 985, 985, 985, 985, 985, 985, 737, 158, 1119,
- 1193, 1475, 528, 158, 1485, 158, 159, 269, 1194, 270,
- 158, 159, 261, 159, 1195, 262, 263, 158, 159, 967,
- 262, 1119, 262, 161, 262, 159, 162, 1122, 161, 158,
- 161, 162, 1133, 162, 265, 266, 267, 159, 268, 357,
- 1134, 967, 161, 1117, 158, 162, 528, 970, 956, 357,
- 951, 1117, 159, 876, 161, 952, 957, 162, 813, 813,
-
- 813, 813, 813, 813, 813, 1482, 1311, 1279, 269, 161,
- 270, 717, 162, 161, 905, 737, 162, 322, 1539, 718,
- 953, 771, 264, 771, 772, 1245, 773, 774, 774, 774,
- 774, 774, 774, 1245, 324, 954, 1687, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 1279, 527, 528, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 906, 906, 906, 906, 527, 527, 527, 527, 352,
-
- 762, 352, 352, 352, 352, 352, 352, 352, 763, 352,
- 764, 352, 764, 765, 352, 766, 767, 767, 767, 767,
- 767, 767, 768, 352, 352, 352, 352, 352, 1534, 352,
- 353, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 352, 352, 352,
- 352, 930, 158, 767, 767, 767, 767, 767, 767, 767,
- 159, 963, 966, 967, 1213, 1213, 905, 905, 353, 964,
- 968, 931, 1544, 1000, 932, 1272, 1272, 161, 528, 353,
- 162, 933, 1379, 1380, 357, 967, 161, 969, 1398, 162,
-
- 471, 970, 1245, 934, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 935, 352, 935, 936, 352,
- 937, 938, 938, 938, 938, 938, 938, 352, 352, 352,
- 352, 352, 352, 1005, 352, 353, 939, 939, 939, 939,
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 940, 940, 940, 940, 940, 940, 940, 352,
- 352, 352, 352, 352, 352, 557, 352, 353, 940, 940,
-
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 352, 352, 352, 940, 944, 158,
- 774, 774, 774, 774, 774, 774, 774, 159, 158, 158,
- 1000, 1010, 1083, 967, 158, 1019, 159, 159, 945, 528,
- 1084, 946, 159, 158, 161, 1146, 1146, 162, 947, 1399,
- 158, 159, 927, 161, 161, 967, 162, 162, 159, 161,
- 948, 970, 162, 971, 967, 158, 158, 905, 161, 955,
- 528, 162, 959, 159, 159, 161, 1245, 960, 162, 958,
- 1005, 1005, 528, 367, 1478, 1024, 967, 1491, 1480, 158,
-
- 161, 161, 970, 162, 162, 1197, 961, 159, 1245, 962,
- 813, 813, 813, 813, 813, 813, 813, 816, 816, 816,
- 816, 816, 816, 816, 161, 972, 398, 162, 399, 158,
- 1198, 400, 606, 1514, 905, 905, 400, 159, 400, 1102,
- 400, 811, 811, 833, 833, 833, 833, 833, 833, 833,
- 404, 405, 406, 994, 161, 994, 1537, 162, 995, 995,
- 995, 995, 995, 995, 995, 833, 833, 833, 833, 833,
- 833, 833, 836, 836, 836, 836, 836, 836, 836, 357,
- 528, 1687, 761, 322, 612, 905, 400, 398, 1119, 399,
- 158, 1467, 400, 606, 528, 1479, 1501, 400, 159, 400,
-
- 324, 400, 814, 814, 814, 814, 814, 814, 814, 1487,
- 1119, 404, 405, 406, 528, 161, 1122, 1202, 162, 814,
- 814, 814, 814, 814, 814, 1496, 357, 1123, 1119, 1488,
- 986, 836, 836, 836, 836, 836, 836, 836, 999, 999,
- 999, 999, 999, 999, 999, 612, 1497, 400, 401, 528,
- 1119, 402, 528, 1550, 1498, 905, 1122, 816, 816, 816,
- 816, 816, 816, 816, 841, 1541, 998, 843, 843, 843,
- 843, 843, 843, 847, 1548, 1008, 849, 849, 849, 849,
- 849, 849, 1009, 1009, 1009, 1009, 1009, 1009, 1009, 853,
- 1563, 1017, 855, 855, 855, 855, 855, 855, 1564, 528,
-
- 411, 839, 1018, 1018, 1018, 1018, 1018, 1018, 1018, 967,
- 528, 840, 1554, 840, 841, 1555, 842, 843, 843, 843,
- 843, 843, 843, 1000, 459, 460, 460, 460, 460, 460,
- 460, 967, 971, 967, 971, 967, 1001, 970, 843, 843,
- 843, 843, 843, 843, 843, 865, 158, 1030, 867, 867,
- 867, 867, 867, 867, 159, 967, 1002, 967, 904, 1003,
- 904, 970, 471, 970, 1118, 1119, 1004, 905, 904, 1467,
- 904, 161, 1120, 1005, 162, 1043, 1000, 1043, 1006, 1000,
- 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1119, 528, 1121,
- 1480, 1279, 1001, 1122, 843, 843, 843, 843, 843, 843,
-
- 843, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 873, 873,
- 873, 873, 873, 873, 873, 1003, 471, 683, 905, 1257,
- 905, 528, 1004, 1465, 905, 1590, 1005, 1480, 1476, 1005,
- 845, 1477, 873, 873, 873, 873, 873, 873, 873, 1538,
- 846, 1010, 846, 847, 528, 848, 849, 849, 849, 849,
- 849, 849, 1010, 919, 919, 919, 919, 919, 919, 919,
- 1392, 1393, 1687, 1279, 322, 1011, 905, 849, 849, 849,
- 849, 849, 849, 849, 919, 919, 919, 919, 919, 919,
- 919, 324, 905, 905, 1260, 1012, 905, 1467, 1013, 1203,
- 1279, 1005, 1133, 966, 967, 1014, 1381, 1540, 1542, 528,
-
- 1134, 968, 1005, 1382, 1086, 1019, 1086, 1015, 1010, 1087,
- 1087, 1087, 1087, 1087, 1087, 1087, 967, 161, 969, 1626,
- 162, 1011, 970, 849, 849, 849, 849, 849, 849, 849,
- 924, 924, 924, 924, 924, 924, 924, 924, 924, 924,
- 924, 924, 924, 924, 1013, 158, 905, 528, 1263, 905,
- 905, 1014, 1467, 159, 1592, 1024, 1547, 1552, 1005, 851,
- 158, 943, 943, 943, 943, 943, 943, 943, 159, 852,
- 161, 852, 853, 162, 854, 855, 855, 855, 855, 855,
- 855, 1019, 1103, 528, 1279, 161, 1199, 528, 162, 1123,
- 1119, 1027, 1115, 1558, 1020, 1110, 855, 855, 855, 855,
-
- 855, 855, 855, 1627, 929, 929, 929, 929, 929, 929,
- 929, 1200, 1119, 1028, 1021, 905, 528, 1022, 1122, 353,
- 905, 158, 905, 905, 1023, 1089, 451, 1594, 1589, 159,
- 251, 1024, 1687, 1591, 322, 663, 1025, 1019, 943, 943,
- 943, 943, 943, 943, 943, 1622, 161, 971, 967, 162,
- 1020, 324, 855, 855, 855, 855, 855, 855, 855, 946,
- 929, 929, 929, 929, 929, 929, 929, 1111, 528, 1464,
- 967, 158, 905, 1022, 1201, 353, 970, 1467, 1394, 159,
- 1023, 932, 905, 1463, 1105, 1395, 1105, 1024, 857, 1106,
- 1106, 1106, 1106, 1106, 1106, 1106, 161, 1545, 458, 162,
-
- 458, 528, 1462, 459, 460, 460, 460, 460, 460, 460,
- 244, 1112, 936, 905, 1094, 938, 938, 938, 938, 938,
- 938, 1595, 1480, 451, 905, 1461, 528, 251, 1027, 353,
- 238, 239, 1460, 240, 241, 242, 1489, 1383, 240, 1490,
- 240, 1384, 240, 860, 860, 860, 860, 860, 860, 860,
- 1028, 1247, 245, 246, 247, 1123, 1119, 528, 1205, 1119,
- 467, 467, 467, 670, 467, 467, 1206, 251, 252, 1459,
- 1396, 1029, 663, 1247, 1397, 254, 905, 255, 1119, 1250,
- 528, 1119, 1467, 665, 1122, 1597, 257, 1122, 240, 470,
- 862, 470, 470, 470, 470, 470, 470, 470, 863, 470,
-
- 864, 470, 864, 865, 470, 866, 867, 867, 867, 867,
- 867, 867, 868, 470, 470, 470, 470, 470, 1458, 470,
- 471, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 470, 470, 470,
- 470, 1032, 528, 867, 867, 867, 867, 867, 867, 867,
- 1095, 1095, 1095, 1095, 1095, 1095, 1095, 527, 471, 527,
- 528, 1033, 905, 528, 1034, 353, 528, 527, 1557, 527,
- 471, 1035, 985, 985, 985, 985, 985, 985, 985, 1593,
- 1600, 1549, 1625, 1036, 470, 470, 470, 470, 470, 470,
-
- 470, 470, 470, 470, 470, 1037, 470, 1037, 1038, 470,
- 1039, 1040, 1040, 1040, 1040, 1040, 1040, 470, 470, 470,
- 470, 470, 470, 761, 470, 471, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 470,
- 470, 470, 470, 470, 470, 557, 470, 471, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
-
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 470, 470, 470, 1042, 158, 528,
- 261, 528, 528, 262, 263, 158, 159, 528, 262, 158,
- 262, 158, 262, 159, 1551, 1596, 1553, 159, 1432, 159,
- 1598, 905, 265, 266, 267, 528, 268, 1063, 1064, 1065,
- 161, 1066, 1067, 162, 161, 1046, 161, 162, 1068, 162,
- 1556, 1467, 1069, 1070, 1404, 1114, 995, 995, 995, 995,
- 995, 995, 995, 737, 357, 322, 269, 1117, 270, 158,
- 353, 261, 1116, 528, 262, 263, 1010, 159, 1599, 262,
- 737, 262, 324, 262, 995, 995, 995, 995, 995, 995,
-
- 995, 1151, 1151, 265, 266, 267, 1147, 268, 1147, 1123,
- 1119, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1152, 967,
- 1152, 1666, 1565, 1153, 1153, 1153, 1153, 1153, 1153, 1153,
- 1019, 1047, 1119, 1336, 1336, 1410, 1005, 269, 1122, 270,
- 1061, 967, 1062, 528, 1565, 1156, 1156, 970, 1601, 1157,
- 1062, 1157, 1062, 1119, 1158, 1158, 1158, 1158, 1158, 1158,
- 1158, 1377, 528, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
- 1602, 905, 1063, 1064, 1065, 1119, 1066, 1067, 471, 528,
- 1024, 1122, 1376, 1068, 1164, 1480, 1467, 1069, 1070, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 1072,
-
- 527, 527, 527, 527, 527, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 527, 527, 527, 527, 527, 527, 732, 527,
- 528, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 527, 527, 527,
- 1073, 930, 158, 767, 767, 767, 767, 767, 767, 767,
- 159, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 353, 1119,
- 528, 905, 905, 1467, 932, 1480, 471, 161, 1467, 1375,
- 162, 933, 1034, 1170, 1170, 1170, 1170, 1170, 1170, 1170,
- 905, 1119, 1467, 934, 1091, 1374, 1091, 1122, 471, 1092,
-
- 1092, 1092, 1092, 1092, 1092, 1092, 1044, 1044, 1044, 1044,
- 1044, 1044, 1044, 1230, 353, 1093, 1093, 1093, 1093, 1093,
- 1093, 1093, 1087, 1087, 1087, 1087, 1087, 1087, 1087, 1279,
- 353, 158, 1093, 1093, 1093, 1093, 1093, 1093, 1096, 159,
- 938, 938, 938, 938, 938, 938, 938, 1087, 1087, 1087,
- 1087, 1087, 1087, 1087, 683, 353, 161, 528, 1097, 162,
- 528, 1098, 1480, 1480, 528, 1373, 1480, 1217, 1099, 1044,
- 1044, 1044, 1044, 1044, 1044, 1044, 528, 1372, 1480, 1371,
- 1100, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 1101, 1101, 1101,
-
- 1101, 1101, 1101, 1101, 352, 352, 352, 352, 352, 352,
- 759, 352, 353, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 352,
- 352, 352, 1101, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 352, 352, 940,
- 940, 940, 940, 940, 940, 940, 352, 352, 352, 352,
- 352, 352, 557, 352, 353, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
-
- 940, 352, 352, 352, 940, 956, 1083, 967, 158, 1251,
- 1247, 1205, 1119, 957, 1084, 771, 159, 771, 772, 1206,
- 773, 774, 774, 774, 774, 774, 774, 1370, 1369, 967,
- 161, 1113, 1247, 161, 1119, 970, 162, 1565, 1250, 1687,
- 1122, 771, 367, 771, 772, 1565, 773, 774, 774, 774,
- 774, 774, 774, 1368, 1367, 1366, 1687, 965, 1124, 967,
- 965, 965, 965, 965, 965, 965, 1125, 965, 1126, 965,
- 1126, 1127, 965, 1128, 1129, 1129, 1129, 1129, 1129, 1129,
- 1130, 967, 965, 965, 965, 965, 965, 970, 965, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
-
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 965, 965, 965, 965, 398,
- 905, 399, 528, 1404, 400, 606, 1467, 491, 1405, 400,
- 1365, 400, 737, 400, 985, 985, 985, 985, 985, 985,
- 985, 471, 1480, 404, 405, 406, 1038, 1350, 1169, 1040,
- 1040, 1040, 1040, 1040, 1040, 1092, 1092, 1092, 1092, 1092,
- 1092, 1092, 1492, 471, 1118, 1119, 528, 528, 1493, 1350,
- 353, 1494, 1120, 1480, 965, 1351, 1352, 612, 1495, 400,
- 398, 1480, 399, 1687, 798, 400, 606, 1119, 798, 1121,
- 400, 798, 400, 1122, 400, 1092, 1092, 1092, 1092, 1092,
-
- 1092, 1092, 1123, 1119, 404, 405, 406, 1251, 1247, 965,
- 353, 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1095,
- 1095, 1095, 1095, 1095, 1095, 1119, 353, 905, 1319, 1387,
- 1247, 1122, 1212, 353, 353, 1314, 1250, 1388, 612, 1098,
- 400, 1000, 1218, 1389, 1218, 1290, 1279, 1219, 1219, 1219,
- 1219, 1219, 1219, 1219, 1001, 1287, 843, 843, 843, 843,
- 843, 843, 843, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
- 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1003, 158, 158,
- 158, 1286, 1285, 528, 1004, 1400, 159, 159, 159, 1284,
- 1283, 1005, 1282, 1401, 158, 1281, 1006, 1010, 1280, 1402,
-
- 1279, 158, 159, 161, 161, 161, 162, 162, 162, 159,
- 1011, 1278, 849, 849, 849, 849, 849, 849, 849, 161,
- 1251, 1247, 162, 367, 1277, 1320, 161, 367, 367, 162,
- 158, 1246, 1247, 1013, 1315, 1247, 1497, 1687, 159, 1248,
- 1014, 1221, 1316, 1247, 1498, 341, 1687, 1005, 322, 1250,
- 341, 341, 1015, 1019, 1247, 161, 1249, 1247, 162, 491,
- 1250, 161, 491, 1250, 162, 324, 1020, 1687, 855, 855,
- 855, 855, 855, 855, 855, 1255, 1687, 1255, 322, 367,
- 1256, 1256, 1256, 1256, 1256, 1256, 1256, 438, 1312, 1022,
- 1687, 491, 438, 438, 491, 324, 1023, 471, 1254, 1687,
-
- 467, 322, 1313, 1024, 798, 467, 467, 1253, 1025, 1160,
- 1148, 1148, 1148, 1148, 1148, 1148, 1148, 798, 324, 1161,
- 798, 1161, 847, 798, 1162, 1163, 1163, 1163, 1163, 1163,
- 1163, 1027, 1252, 238, 239, 328, 240, 241, 242, 1109,
- 1109, 240, 1220, 240, 353, 240, 1153, 1153, 1153, 1153,
- 1153, 1153, 1153, 1028, 1204, 245, 246, 247, 1158, 1158,
- 1158, 1158, 1158, 1158, 1158, 1196, 249, 1000, 620, 1192,
- 251, 252, 1191, 620, 620, 663, 1184, 514, 254, 514,
- 255, 514, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 257,
- 264, 240, 1032, 1178, 867, 867, 867, 867, 867, 867,
-
- 867, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1247, 471,
- 1251, 1247, 683, 471, 655, 1034, 471, 1005, 1258, 798,
- 1258, 1141, 1035, 1259, 1259, 1259, 1259, 1259, 1259, 1259,
- 1247, 798, 798, 1247, 1036, 1166, 1250, 1166, 798, 1250,
- 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1140, 1010, 1139,
- 1138, 1137, 1361, 1136, 1135, 471, 1168, 1168, 1168, 1168,
- 1168, 1168, 1168, 1153, 1153, 1153, 1153, 1153, 1153, 1153,
- 1109, 471, 158, 1168, 1168, 1168, 1168, 1168, 1168, 1171,
- 159, 1040, 1040, 1040, 1040, 1040, 1040, 1040, 1167, 1167,
- 1167, 1167, 1167, 1167, 1167, 950, 471, 161, 1005, 1172,
-
- 162, 353, 1173, 471, 927, 1261, 927, 1261, 1088, 1174,
- 1262, 1262, 1262, 1262, 1262, 1262, 1262, 1411, 1085, 1080,
- 905, 1175, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 470, 470, 470, 470, 470,
- 470, 759, 470, 471, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 470, 470, 470, 1176, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 470,
-
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 470, 470, 470,
- 470, 470, 470, 557, 470, 471, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 470, 470, 470, 1042, 158, 1019, 261, 1060,
- 514, 262, 263, 1059, 159, 514, 262, 514, 262, 514,
- 262, 1265, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1058,
- 265, 266, 267, 847, 268, 1264, 1163, 1163, 1163, 1163,
- 1163, 1163, 510, 659, 1687, 996, 1177, 1170, 1170, 1170,
- 1170, 1170, 1170, 1170, 652, 983, 982, 1024, 981, 652,
-
- 652, 980, 471, 798, 269, 659, 270, 158, 1271, 261,
- 979, 1005, 262, 263, 1265, 159, 978, 262, 977, 262,
- 976, 262, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 975,
- 974, 265, 266, 267, 967, 268, 659, 471, 1119, 973,
- 1251, 1247, 950, 1173, 1210, 1210, 1210, 1210, 1210, 1210,
- 1210, 761, 1413, 1413, 761, 927, 967, 481, 659, 353,
- 1119, 759, 970, 1247, 1005, 269, 1122, 270, 1061, 1250,
- 1062, 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1062, 920,
- 1062, 917, 914, 913, 912, 1427, 353, 905, 1215, 1215,
- 1215, 1215, 1215, 1215, 1215, 514, 901, 514, 514, 514,
-
- 1063, 1064, 1065, 353, 1066, 1067, 900, 1427, 899, 898,
- 897, 1068, 1117, 1428, 1429, 1069, 1070, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 1072, 527, 527,
- 527, 527, 527, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 527, 527, 527, 527, 527, 527, 732, 527, 528, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 527, 527, 527, 1073, 1078,
- 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1079, 896, 771,
- 895, 771, 772, 264, 773, 774, 774, 774, 774, 774,
-
- 774, 1113, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1687,
- 878, 771, 683, 771, 772, 683, 773, 774, 774, 774,
- 774, 774, 774, 1209, 471, 1209, 471, 655, 1210, 1210,
- 1210, 1210, 1210, 1210, 1210, 837, 1215, 1215, 1215, 1215,
- 1215, 1215, 1215, 353, 1093, 1093, 1093, 1093, 1093, 1093,
- 1093, 353, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 353,
- 1439, 1093, 1093, 1093, 1093, 1093, 1093, 415, 624, 624,
- 1247, 967, 1211, 1096, 622, 938, 938, 938, 938, 938,
- 938, 938, 1439, 1246, 1247, 1336, 1336, 965, 1440, 1441,
- 353, 1248, 1247, 967, 622, 716, 1098, 817, 1250, 970,
-
- 716, 716, 817, 1099, 750, 400, 1247, 609, 1249, 750,
- 750, 400, 1250, 809, 814, 1100, 1214, 798, 1214, 814,
- 814, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1259, 1259,
- 1259, 1259, 1259, 1259, 1259, 806, 353, 1216, 1216, 1216,
- 1216, 1216, 1216, 1216, 1262, 1262, 1262, 1262, 1262, 1262,
- 1262, 805, 353, 804, 1216, 1216, 1216, 1216, 1216, 1216,
- 352, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 352, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 352, 352, 352, 352, 352, 352, 759,
- 352, 353, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
-
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 352, 352,
- 352, 1101, 1117, 1222, 1119, 1117, 1117, 1117, 1117, 1117,
- 1117, 1223, 1117, 1224, 1117, 1224, 1225, 1117, 1226, 1227,
- 1227, 1227, 1227, 1227, 1227, 1228, 1119, 1117, 1117, 1117,
- 1117, 1117, 1122, 1117, 1229, 1229, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
- 1117, 1117, 1117, 1117, 965, 1124, 967, 965, 965, 965,
- 965, 965, 965, 1125, 965, 1126, 965, 1126, 1127, 965,
-
- 1128, 1129, 1129, 1129, 1129, 1129, 1129, 1130, 967, 965,
- 965, 965, 965, 965, 970, 965, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 965, 965, 965, 965, 967, 1315, 1247, 803,
- 1350, 834, 802, 801, 800, 1316, 834, 834, 1127, 799,
- 1231, 1129, 1129, 1129, 1129, 1129, 1129, 1000, 967, 798,
- 1247, 797, 1350, 353, 970, 967, 1250, 965, 1351, 1352,
- 1119, 761, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1232,
- 1232, 1232, 1232, 1232, 1232, 1232, 557, 967, 759, 745,
-
- 1405, 744, 1119, 970, 967, 743, 742, 967, 1122, 1687,
- 528, 322, 512, 512, 510, 264, 1233, 1005, 1129, 1129,
- 1129, 1129, 1129, 1129, 1129, 1350, 967, 967, 324, 967,
- 471, 469, 970, 469, 1406, 970, 1234, 1687, 1687, 1235,
- 1407, 1434, 1434, 1408, 1687, 624, 1236, 1350, 415, 967,
- 1409, 838, 965, 1351, 1352, 970, 838, 838, 1237, 965,
- 965, 967, 965, 965, 965, 965, 965, 965, 965, 965,
- 1238, 965, 1238, 1239, 965, 1240, 1241, 1241, 1241, 1241,
- 1241, 1241, 965, 967, 965, 965, 965, 965, 965, 970,
- 965, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
-
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 965, 965, 965,
- 965, 965, 965, 967, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 965, 1243, 1243, 1243,
- 1243, 1243, 1243, 1243, 965, 967, 965, 965, 965, 965,
- 1244, 970, 965, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243,
- 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 1243, 965,
- 965, 965, 1243, 1160, 844, 622, 413, 614, 400, 844,
- 844, 408, 1010, 1161, 614, 1161, 847, 400, 1162, 1163,
-
- 1163, 1163, 1163, 1163, 1163, 1265, 603, 1259, 1259, 1259,
- 1259, 1259, 1259, 1259, 1019, 1265, 599, 1508, 1011, 598,
- 1163, 1163, 1163, 1163, 1163, 1163, 1163, 659, 1247, 1262,
- 1262, 1262, 1262, 1262, 1262, 1262, 591, 659, 1012, 1508,
- 353, 1013, 1005, 557, 1117, 1509, 1510, 850, 1266, 659,
- 1247, 1687, 850, 850, 343, 1005, 1250, 343, 1457, 659,
- 1267, 1268, 543, 1268, 1024, 1005, 1269, 1269, 1269, 1269,
- 1269, 1269, 1269, 540, 1269, 1269, 1269, 1269, 1269, 1269,
- 1269, 471, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 471,
- 1269, 1269, 1269, 1269, 1269, 1269, 1269, 471, 539, 1168,
-
- 1168, 1168, 1168, 1168, 1168, 471, 538, 537, 1265, 1119,
- 1270, 1171, 536, 1040, 1040, 1040, 1040, 1040, 1040, 1040,
- 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1687, 471, 528,
- 659, 1119, 525, 514, 1173, 471, 1687, 1122, 322, 522,
- 521, 1174, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 520,
- 519, 518, 659, 1175, 1273, 324, 1273, 471, 1005, 1274,
- 1274, 1274, 1274, 1274, 1274, 1274, 325, 1318, 1318, 1318,
- 1318, 1318, 1318, 1318, 471, 1275, 1275, 1275, 1275, 1275,
- 1275, 1275, 353, 856, 517, 516, 515, 514, 856, 856,
- 471, 513, 1275, 1275, 1275, 1275, 1275, 1275, 470, 470,
-
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 470, 470, 470, 470, 470, 470, 759, 470, 471,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 470, 470, 470, 1176,
- 158, 512, 261, 307, 507, 262, 263, 967, 159, 1247,
- 262, 1350, 262, 506, 262, 1318, 1318, 1318, 1318, 1318,
- 1318, 1318, 505, 1687, 265, 266, 267, 504, 268, 967,
- 353, 1247, 1687, 1350, 322, 970, 1276, 1250, 965, 1351,
-
- 1352, 1364, 1364, 1364, 1364, 1364, 1364, 1364, 874, 503,
- 502, 324, 481, 874, 874, 1442, 471, 499, 269, 925,
- 270, 158, 330, 261, 925, 925, 262, 263, 1427, 159,
- 498, 262, 497, 262, 496, 262, 1364, 1364, 1364, 1364,
- 1364, 1364, 1364, 1687, 1119, 265, 266, 267, 1119, 268,
- 1427, 471, 1687, 495, 322, 1117, 1428, 1429, 1413, 1413,
- 494, 493, 1503, 1503, 1571, 1567, 1119, 492, 490, 1427,
- 1119, 324, 1122, 1427, 489, 488, 1122, 1567, 487, 269,
- 1107, 270, 1291, 486, 1292, 1107, 1107, 1567, 485, 329,
- 484, 1427, 1292, 1570, 1292, 1427, 1117, 1428, 1429, 1567,
-
- 1117, 1428, 1429, 1149, 483, 1570, 967, 482, 1149, 1149,
- 1439, 481, 905, 1511, 1293, 1294, 1295, 480, 1296, 1297,
- 1434, 1434, 1439, 1571, 1567, 1298, 1439, 479, 967, 1299,
- 1300, 1301, 1439, 1302, 970, 478, 262, 965, 1440, 1441,
- 471, 1302, 262, 1302, 1439, 262, 1567, 1119, 1439, 965,
- 1440, 1441, 1570, 965, 1440, 1441, 469, 259, 240, 240,
- 250, 528, 240, 1303, 1304, 1305, 1515, 1306, 1307, 1119,
- 1350, 1154, 240, 1687, 1308, 1122, 1154, 1154, 1309, 1310,
- 1317, 1247, 1317, 1531, 1687, 1318, 1318, 1318, 1318, 1318,
- 1318, 1318, 1350, 415, 413, 1517, 1517, 965, 1351, 1352,
-
- 353, 1119, 1159, 1247, 353, 1531, 1508, 1159, 1159, 1250,
- 1245, 1532, 1533, 1225, 1508, 1321, 1227, 1227, 1227, 1227,
- 1227, 1227, 343, 1119, 156, 336, 335, 334, 1508, 1122,
- 1119, 1566, 1567, 1117, 1509, 1510, 1508, 332, 1687, 1568,
- 131, 1117, 1509, 1510, 1322, 1322, 1322, 1322, 1322, 1322,
- 1322, 131, 1119, 321, 1567, 317, 1569, 1362, 1122, 1119,
- 1570, 316, 1362, 1362, 309, 120, 1571, 1567, 1119, 308,
- 1427, 1323, 307, 1227, 1227, 1227, 1227, 1227, 1227, 1227,
- 1439, 1119, 1503, 1503, 1247, 230, 260, 1122, 259, 1567,
- 1119, 1324, 1427, 230, 1325, 1570, 1122, 1117, 1428, 1429,
-
- 230, 1326, 1439, 210, 227, 210, 1247, 965, 1440, 1441,
- 210, 121, 1250, 1327, 1117, 1117, 1119, 1117, 1117, 1117,
- 1117, 1117, 1117, 1117, 1117, 1328, 1117, 1328, 1329, 1117,
- 1330, 1331, 1331, 1331, 1331, 1331, 1331, 1117, 1119, 1117,
- 1117, 1117, 1117, 1117, 1122, 1117, 1332, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- 1332, 1332, 1117, 1117, 1117, 1117, 1117, 1117, 1119, 1117,
- 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
- 1117, 1117, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1117,
-
- 1119, 1117, 1117, 1117, 1117, 1334, 1122, 1117, 1333, 1333,
- 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333,
- 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333,
- 1333, 1333, 1333, 1333, 1117, 1117, 1117, 1333, 967, 157,
- 1508, 156, 121, 131, 121, 131, 120, 1571, 1567, 1247,
- 1567, 1687, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1567,
- 967, 1687, 1508, 1517, 1517, 1687, 970, 1117, 1509, 1510,
- 1567, 1247, 1567, 1335, 967, 1687, 1570, 1250, 1570, 1585,
- 1687, 1567, 1687, 1247, 1575, 1687, 1687, 1570, 1232, 1232,
- 1232, 1232, 1232, 1232, 1232, 1247, 967, 1580, 1580, 1687,
-
- 1687, 1585, 970, 1617, 1687, 1247, 1245, 1586, 1587, 1235,
- 967, 1250, 1687, 1531, 1571, 1567, 1687, 1247, 1687, 1337,
- 1687, 1337, 1531, 1250, 1338, 1338, 1338, 1338, 1338, 1338,
- 1338, 1687, 967, 1687, 1687, 1531, 1687, 1567, 970, 967,
- 1245, 1532, 1533, 1570, 1531, 1687, 1687, 1687, 1687, 1245,
- 1532, 1533, 1687, 1339, 1339, 1339, 1339, 1339, 1339, 1339,
- 1687, 967, 1687, 1687, 1687, 1687, 1588, 970, 1687, 1687,
- 1339, 1339, 1339, 1339, 1339, 1339, 967, 1687, 1687, 1531,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1508, 1239, 1567,
- 1340, 1241, 1241, 1241, 1241, 1241, 1241, 1687, 967, 1687,
-
- 1687, 1531, 1687, 1687, 970, 967, 1245, 1532, 1533, 1508,
- 1687, 1567, 1687, 1687, 1117, 1509, 1510, 1570, 1687, 1341,
- 1341, 1341, 1341, 1341, 1341, 1341, 1687, 967, 1567, 1687,
- 1567, 1687, 1687, 970, 1342, 1687, 1241, 1241, 1241, 1241,
- 1241, 1241, 1241, 1607, 1567, 1566, 1567, 1247, 1687, 1687,
- 1567, 1608, 1567, 1568, 1343, 1687, 1570, 1344, 1570, 1687,
- 1687, 1580, 1580, 1687, 1345, 1585, 1567, 1687, 1567, 1247,
- 1569, 1687, 1570, 1567, 1570, 1250, 1346, 1342, 1687, 1241,
- 1241, 1241, 1241, 1241, 1241, 1241, 1585, 1585, 1687, 1531,
- 1687, 1687, 1245, 1586, 1587, 1567, 1687, 965, 1687, 1687,
-
- 1344, 1570, 1687, 1687, 1687, 1687, 1687, 1345, 1585, 1687,
- 1687, 1531, 1687, 1245, 1586, 1587, 1245, 1532, 1533, 965,
- 965, 965, 967, 965, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 1347, 1347, 1347, 1347,
- 1347, 1347, 1347, 965, 967, 965, 965, 965, 965, 1348,
- 970, 965, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
- 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347,
- 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 965, 965,
- 965, 1347, 1245, 1353, 1247, 1245, 1245, 1245, 1245, 1245,
- 1245, 1354, 1245, 1355, 1245, 1355, 1356, 1245, 1357, 1358,
-
- 1358, 1358, 1358, 1358, 1358, 1359, 1247, 1245, 1245, 1245,
- 1245, 1245, 1250, 1245, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1245, 1245, 1245, 1245, 1363, 1585, 1363, 1687, 1687, 1364,
- 1364, 1364, 1364, 1364, 1364, 1364, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 471, 1119, 1687, 1585, 1607, 1567,
- 1687, 1687, 1245, 1586, 1587, 1687, 1608, 1585, 1687, 1322,
- 1322, 1322, 1322, 1322, 1322, 1322, 1687, 1119, 1687, 1621,
- 1687, 1567, 1687, 1122, 1687, 1687, 1687, 1570, 1687, 1585,
-
- 1412, 1119, 1687, 1687, 1245, 1586, 1587, 1687, 1687, 1687,
- 1567, 1687, 1662, 1687, 1687, 1322, 1322, 1322, 1322, 1322,
- 1322, 1322, 1687, 1119, 1648, 1648, 1687, 1687, 1687, 1122,
- 1687, 1687, 1567, 1687, 1662, 1687, 1325, 1119, 1570, 1565,
- 1663, 1664, 1687, 1687, 1687, 1676, 1414, 1567, 1414, 1567,
- 1687, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1687, 1119,
- 1687, 1648, 1648, 1671, 1671, 1122, 1119, 1676, 1687, 1567,
- 1687, 1567, 1565, 1677, 1678, 1570, 1687, 1570, 1687, 1687,
- 1416, 1416, 1416, 1416, 1416, 1416, 1416, 1687, 1119, 1687,
- 1687, 1687, 1687, 1687, 1122, 1687, 1687, 1416, 1416, 1416,
-
- 1416, 1416, 1416, 1119, 1687, 1687, 1662, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1662, 1329, 1687, 1417, 1331, 1331,
- 1331, 1331, 1331, 1331, 1687, 1119, 1687, 1687, 1662, 1687,
- 1687, 1122, 1119, 1565, 1663, 1664, 1662, 1687, 1687, 1687,
- 1687, 1565, 1663, 1664, 1687, 1687, 1418, 1418, 1418, 1418,
- 1418, 1418, 1418, 1687, 1119, 1687, 1687, 1567, 1679, 1687,
- 1122, 1419, 1687, 1331, 1331, 1331, 1331, 1331, 1331, 1331,
- 1662, 1671, 1671, 1676, 1687, 1687, 1687, 1687, 1687, 1567,
- 1687, 1420, 1687, 1687, 1421, 1570, 1687, 1687, 1687, 1687,
- 1687, 1422, 1662, 1676, 1687, 1676, 1687, 1565, 1663, 1664,
-
- 1565, 1677, 1678, 1423, 1419, 1687, 1331, 1331, 1331, 1331,
- 1331, 1331, 1331, 1676, 1687, 1676, 1662, 1687, 1687, 1687,
- 1565, 1677, 1678, 1687, 1117, 1687, 1687, 1421, 1687, 1687,
- 1687, 1687, 1687, 1687, 1422, 1676, 1687, 1685, 1662, 1687,
- 1565, 1677, 1678, 1565, 1663, 1664, 1117, 1117, 1117, 1119,
- 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
- 1117, 1117, 1117, 1424, 1424, 1424, 1424, 1424, 1424, 1424,
- 1117, 1119, 1117, 1117, 1117, 1117, 1425, 1122, 1117, 1424,
- 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424,
- 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424, 1424,
-
- 1424, 1424, 1424, 1424, 1424, 1117, 1117, 1117, 1424, 967,
- 1687, 1687, 1676, 1687, 1687, 1687, 1687, 1687, 1430, 1687,
- 1430, 1687, 1687, 1431, 1431, 1431, 1431, 1431, 1431, 1431,
- 1687, 967, 1687, 1687, 1676, 1687, 1687, 970, 967, 1565,
- 1677, 1678, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1687,
- 967, 1687, 1687, 1687, 1687, 1687, 970, 967, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1687, 967,
- 1687, 1687, 1687, 1687, 1687, 970, 1342, 1687, 1241, 1241,
-
- 1241, 1241, 1241, 1241, 1241, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 965, 1687, 1687, 1344,
- 1687, 1687, 1687, 1687, 1687, 1687, 1345, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1346, 967,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1341, 1341, 1341, 1341, 1341, 1341, 1341,
- 1687, 967, 1687, 1687, 1687, 1687, 1687, 970, 1687, 1687,
- 1687, 1687, 1687, 1687, 1433, 967, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1341,
- 1341, 1341, 1341, 1341, 1341, 1341, 1687, 967, 1687, 1687,
-
- 1687, 1687, 1687, 970, 1687, 1687, 1687, 1687, 1687, 1687,
- 1344, 967, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1435, 1687, 1435, 1687, 1687, 1436, 1436, 1436, 1436, 1436,
- 1436, 1436, 1687, 967, 1687, 1687, 1687, 1687, 1687, 970,
- 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1437, 1437, 1437,
- 1437, 1437, 1437, 1247, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1356, 1687, 1443, 1358, 1358,
- 1358, 1358, 1358, 1358, 1687, 1247, 1687, 1687, 1687, 1687,
- 1687, 1250, 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1444, 1444, 1444, 1444,
- 1444, 1444, 1444, 1687, 1247, 1687, 1687, 1687, 1687, 1687,
- 1250, 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1445, 1687, 1358, 1358, 1358, 1358, 1358,
- 1358, 1358, 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250,
- 1687, 1687, 1687, 1446, 1687, 1687, 1447, 1687, 1687, 1687,
- 1687, 1687, 1687, 1448, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1449, 1245, 1245, 1247, 1245,
- 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1450, 1245, 1450,
- 1451, 1245, 1452, 1453, 1453, 1453, 1453, 1453, 1453, 1245,
-
- 1247, 1245, 1245, 1245, 1245, 1245, 1250, 1245, 1454, 1454,
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1454, 1245, 1245, 1245, 1245, 1245, 1245,
- 1247, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245,
- 1245, 1245, 1245, 1245, 1455, 1455, 1455, 1455, 1455, 1455,
- 1455, 1245, 1247, 1245, 1245, 1245, 1245, 1456, 1250, 1245,
- 1455, 1455, 1455, 1455, 1455, 1455, 1455, 1455, 1455, 1455,
- 1455, 1455, 1455, 1455, 1455, 1455, 1455, 1455, 1455, 1455,
- 1455, 1455, 1455, 1455, 1455, 1455, 1245, 1245, 1245, 1455,
-
- 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1499,
- 1687, 1499, 1687, 1687, 1500, 1500, 1500, 1500, 1500, 1500,
- 1500, 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122, 1119,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1415, 1415, 1415, 1415, 1415, 1415, 1415,
- 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122, 1119, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 1687,
- 1119, 1687, 1687, 1687, 1687, 1687, 1122, 1419, 1687, 1331,
- 1331, 1331, 1331, 1331, 1331, 1331, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1117, 1687, 1687,
- 1421, 1687, 1687, 1687, 1687, 1687, 1687, 1422, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1423,
- 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1418, 1418, 1418, 1418, 1418, 1418,
- 1418, 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122, 1687,
- 1687, 1687, 1687, 1687, 1687, 1502, 1119, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1418, 1418, 1418, 1418, 1418, 1418, 1418, 1687, 1119, 1687,
- 1687, 1687, 1687, 1687, 1122, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1421, 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1504, 1687, 1504, 1687, 1687, 1505, 1505, 1505, 1505,
- 1505, 1505, 1505, 1687, 1119, 1687, 1687, 1687, 1687, 1687,
- 1122, 1506, 1506, 1506, 1506, 1506, 1506, 1506, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1506, 1506,
- 1506, 1506, 1506, 1506, 967, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1431, 1431,
- 1431, 1431, 1431, 1431, 1431, 1687, 967, 1687, 1687, 1687,
- 1687, 1687, 970, 967, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1431, 1431, 1431,
-
- 1431, 1431, 1431, 1431, 1687, 967, 1687, 1687, 1687, 1687,
- 1687, 970, 967, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1512, 1687, 1512, 1687, 1687, 1513, 1513, 1513, 1513,
- 1513, 1513, 1513, 1687, 967, 1687, 1687, 1687, 1687, 1687,
- 970, 967, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1436, 1436, 1436, 1436, 1436,
- 1436, 1436, 1687, 967, 1687, 1687, 1687, 1687, 1687, 970,
- 967, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1436, 1436, 1436, 1436, 1436, 1436,
- 1436, 1687, 967, 1687, 1687, 1687, 1687, 1687, 970, 1247,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1444, 1444, 1444, 1444, 1444, 1444, 1444,
- 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250, 1687, 1687,
- 1687, 1687, 1687, 1687, 1516, 1247, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1444,
- 1444, 1444, 1444, 1444, 1444, 1444, 1687, 1247, 1687, 1687,
- 1687, 1687, 1687, 1250, 1687, 1687, 1687, 1687, 1687, 1687,
- 1447, 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1518, 1687, 1518, 1687, 1687, 1519, 1519, 1519, 1519, 1519,
- 1519, 1519, 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250,
-
- 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1520, 1520, 1520, 1520, 1520, 1520,
- 1520, 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250, 1687,
- 1687, 1520, 1520, 1520, 1520, 1520, 1520, 1247, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1451,
- 1687, 1521, 1453, 1453, 1453, 1453, 1453, 1453, 1687, 1247,
- 1687, 1687, 1687, 1687, 1687, 1250, 1247, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1687, 1247, 1687,
- 1687, 1687, 1687, 1687, 1250, 1523, 1687, 1453, 1453, 1453,
-
- 1453, 1453, 1453, 1453, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1524, 1687, 1687, 1525, 1687,
- 1687, 1687, 1687, 1687, 1687, 1526, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1527, 1523, 1687,
- 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1245, 1687,
- 1687, 1525, 1687, 1687, 1687, 1687, 1687, 1687, 1526, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1245, 1245, 1245, 1247, 1245, 1245, 1245, 1245, 1245, 1245,
- 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1528, 1528, 1528,
-
- 1528, 1528, 1528, 1528, 1245, 1247, 1245, 1245, 1245, 1245,
- 1529, 1250, 1245, 1528, 1528, 1528, 1528, 1528, 1528, 1528,
- 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528,
- 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1245,
- 1245, 1245, 1528, 1119, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1500, 1500, 1500,
- 1500, 1500, 1500, 1500, 1687, 1119, 1687, 1687, 1687, 1687,
- 1687, 1122, 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1500, 1500, 1500, 1500,
- 1500, 1500, 1500, 1687, 1119, 1687, 1687, 1687, 1687, 1687,
-
- 1122, 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1572, 1687, 1572, 1687, 1687, 1573, 1573, 1573, 1573, 1573,
- 1573, 1573, 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122,
- 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1505, 1505, 1505, 1505, 1505, 1505,
- 1505, 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122, 1119,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1505, 1505, 1505, 1505, 1505, 1505, 1505,
- 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122, 967, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1513, 1513, 1513, 1513, 1513, 1513, 1513, 1687,
- 967, 1687, 1687, 1687, 1687, 1687, 970, 967, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1513, 1513, 1513, 1513, 1513, 1513, 1513, 1687, 967,
- 1687, 1687, 1687, 1687, 1687, 970, 1247, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1576, 1687, 1576, 1687, 1687,
- 1577, 1577, 1577, 1577, 1577, 1577, 1577, 1687, 1247, 1687,
- 1687, 1687, 1687, 1687, 1250, 1247, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1519,
- 1519, 1519, 1519, 1519, 1519, 1519, 1687, 1247, 1687, 1687,
-
- 1687, 1687, 1687, 1250, 1247, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1519, 1519,
- 1519, 1519, 1519, 1519, 1519, 1687, 1247, 1687, 1687, 1687,
- 1687, 1687, 1250, 1523, 1687, 1453, 1453, 1453, 1453, 1453,
- 1453, 1453, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1245, 1687, 1687, 1525, 1687, 1687, 1687,
- 1687, 1687, 1687, 1526, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1527, 1247, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1687, 1247, 1687,
-
- 1687, 1687, 1687, 1687, 1250, 1687, 1687, 1687, 1687, 1687,
- 1687, 1579, 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1522, 1522, 1522, 1522,
- 1522, 1522, 1522, 1687, 1247, 1687, 1687, 1687, 1687, 1687,
- 1250, 1687, 1687, 1687, 1687, 1687, 1687, 1525, 1247, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1581, 1687, 1581,
- 1687, 1687, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1687,
- 1247, 1687, 1687, 1687, 1687, 1687, 1250, 1583, 1583, 1583,
- 1583, 1583, 1583, 1583, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1583, 1583, 1583, 1583, 1583, 1583,
-
- 1565, 1609, 1567, 1565, 1565, 1565, 1565, 1565, 1565, 1610,
- 1565, 1611, 1565, 1611, 1612, 1565, 1613, 1614, 1614, 1614,
- 1614, 1614, 1614, 1615, 1567, 1565, 1565, 1565, 1565, 1565,
- 1570, 1565, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1565, 1565,
- 1565, 1565, 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1573, 1573, 1573, 1573,
- 1573, 1573, 1573, 1687, 1119, 1687, 1687, 1687, 1687, 1687,
- 1122, 1119, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1573, 1573, 1573, 1573, 1573,
- 1573, 1573, 1687, 1119, 1687, 1687, 1687, 1687, 1687, 1122,
- 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1577, 1577, 1577, 1577, 1577, 1577,
- 1577, 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250, 1247,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1577, 1577, 1577, 1577, 1577, 1577, 1577,
- 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250, 1247, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1618, 1687, 1618,
- 1687, 1687, 1619, 1619, 1619, 1619, 1619, 1619, 1619, 1687,
-
- 1247, 1687, 1687, 1687, 1687, 1687, 1250, 1247, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1687, 1247,
- 1687, 1687, 1687, 1687, 1687, 1250, 1247, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1582, 1582, 1582, 1582, 1582, 1582, 1582, 1687, 1247, 1687,
- 1687, 1687, 1687, 1687, 1250, 1567, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1612, 1687, 1631,
- 1614, 1614, 1614, 1614, 1614, 1614, 1687, 1567, 1687, 1687,
- 1687, 1687, 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1632, 1632,
- 1632, 1632, 1632, 1632, 1632, 1687, 1567, 1687, 1687, 1687,
- 1687, 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1633, 1687, 1614, 1614, 1614,
- 1614, 1614, 1614, 1614, 1687, 1567, 1687, 1687, 1687, 1687,
- 1687, 1570, 1687, 1687, 1687, 1634, 1687, 1687, 1635, 1687,
- 1687, 1687, 1687, 1687, 1687, 1636, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1637, 1565, 1565,
- 1567, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1638,
- 1565, 1638, 1639, 1565, 1640, 1641, 1641, 1641, 1641, 1641,
-
- 1641, 1565, 1567, 1565, 1565, 1565, 1565, 1565, 1570, 1565,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1565, 1565, 1565, 1565,
- 1565, 1565, 1567, 1565, 1565, 1565, 1565, 1565, 1565, 1565,
- 1565, 1565, 1565, 1565, 1565, 1565, 1643, 1643, 1643, 1643,
- 1643, 1643, 1643, 1565, 1567, 1565, 1565, 1565, 1565, 1644,
- 1570, 1565, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643,
- 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1565, 1565,
-
- 1565, 1643, 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1619, 1619, 1619, 1619,
- 1619, 1619, 1619, 1687, 1247, 1687, 1687, 1687, 1687, 1687,
- 1250, 1247, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1619, 1619, 1619, 1619, 1619,
- 1619, 1619, 1687, 1247, 1687, 1687, 1687, 1687, 1687, 1250,
- 1567, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1632, 1632, 1632, 1632, 1632, 1632,
- 1632, 1687, 1567, 1687, 1687, 1687, 1687, 1687, 1570, 1687,
- 1687, 1687, 1687, 1687, 1687, 1647, 1567, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1687, 1567, 1687,
- 1687, 1687, 1687, 1687, 1570, 1687, 1687, 1687, 1687, 1687,
- 1687, 1635, 1567, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1649, 1687, 1649, 1687, 1687, 1650, 1650, 1650, 1650,
- 1650, 1650, 1650, 1687, 1567, 1687, 1687, 1687, 1687, 1687,
- 1570, 1567, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1651, 1651, 1651, 1651, 1651,
- 1651, 1651, 1687, 1567, 1687, 1687, 1687, 1687, 1687, 1570,
- 1687, 1687, 1651, 1651, 1651, 1651, 1651, 1651, 1567, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1639, 1687, 1652, 1641, 1641, 1641, 1641, 1641, 1641, 1687,
- 1567, 1687, 1687, 1687, 1687, 1687, 1570, 1567, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1653, 1653, 1653, 1653, 1653, 1653, 1653, 1687, 1567,
- 1687, 1687, 1687, 1687, 1687, 1570, 1654, 1687, 1641, 1641,
- 1641, 1641, 1641, 1641, 1641, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1655, 1687, 1687, 1656,
- 1687, 1687, 1687, 1687, 1687, 1687, 1657, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1658, 1654,
-
- 1687, 1641, 1641, 1641, 1641, 1641, 1641, 1641, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1565,
- 1687, 1687, 1656, 1687, 1687, 1687, 1687, 1687, 1687, 1657,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1565, 1565, 1565, 1567, 1565, 1565, 1565, 1565, 1565,
- 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1659, 1659,
- 1659, 1659, 1659, 1659, 1659, 1565, 1567, 1565, 1565, 1565,
- 1565, 1660, 1570, 1565, 1659, 1659, 1659, 1659, 1659, 1659,
- 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659,
- 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659, 1659,
-
- 1565, 1565, 1565, 1659, 1567, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1667, 1687, 1667, 1687, 1687, 1668, 1668,
- 1668, 1668, 1668, 1668, 1668, 1687, 1567, 1687, 1687, 1687,
- 1687, 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1650, 1650, 1650,
- 1650, 1650, 1650, 1650, 1687, 1567, 1687, 1687, 1687, 1687,
- 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1650, 1650, 1650, 1650,
- 1650, 1650, 1650, 1687, 1567, 1687, 1687, 1687, 1687, 1687,
- 1570, 1654, 1687, 1641, 1641, 1641, 1641, 1641, 1641, 1641,
-
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1565, 1687, 1687, 1656, 1687, 1687, 1687, 1687, 1687,
- 1687, 1657, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1658, 1567, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1653, 1653,
- 1653, 1653, 1653, 1653, 1653, 1687, 1567, 1687, 1687, 1687,
- 1687, 1687, 1570, 1687, 1687, 1687, 1687, 1687, 1687, 1670,
- 1567, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1653, 1653, 1653, 1653, 1653, 1653,
- 1653, 1687, 1567, 1687, 1687, 1687, 1687, 1687, 1570, 1687,
-
- 1687, 1687, 1687, 1687, 1687, 1656, 1567, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1672, 1687, 1672, 1687, 1687,
- 1673, 1673, 1673, 1673, 1673, 1673, 1673, 1687, 1567, 1687,
- 1687, 1687, 1687, 1687, 1570, 1674, 1674, 1674, 1674, 1674,
- 1674, 1674, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1674, 1674, 1674, 1674, 1674, 1674, 1567, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1668, 1668, 1668, 1668, 1668, 1668, 1668, 1687,
- 1567, 1687, 1687, 1687, 1687, 1687, 1570, 1567, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 1668, 1668, 1668, 1668, 1668, 1668, 1668, 1687, 1567,
- 1687, 1687, 1687, 1687, 1687, 1570, 1567, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1682, 1687, 1682, 1687, 1687,
- 1683, 1683, 1683, 1683, 1683, 1683, 1683, 1687, 1567, 1687,
- 1687, 1687, 1687, 1687, 1570, 1567, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1673,
- 1673, 1673, 1673, 1673, 1673, 1673, 1687, 1567, 1687, 1687,
- 1687, 1687, 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1673, 1673,
- 1673, 1673, 1673, 1673, 1673, 1687, 1567, 1687, 1687, 1687,
-
- 1687, 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1683, 1683, 1683,
- 1683, 1683, 1683, 1683, 1687, 1567, 1687, 1687, 1687, 1687,
- 1687, 1570, 1567, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1683, 1683, 1683, 1683,
- 1683, 1683, 1683, 1687, 1567, 1687, 1687, 1687, 1687, 1687,
- 1570, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
-
- 130, 130, 130, 130, 130, 130, 130, 130, 130, 132,
- 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 133, 133, 133, 133, 133, 133, 133,
- 155, 155, 155, 155, 1687, 1687, 155, 155, 155, 155,
- 155, 155, 155, 155, 1687, 155, 160, 1687, 1687, 160,
- 1687, 1687, 1687, 1687, 1687, 1687, 160, 1687, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 1687, 160, 258,
- 258, 258, 258, 1687, 1687, 258, 258, 258, 258, 258,
- 258, 258, 258, 1687, 258, 264, 1687, 264, 264, 1687,
-
- 264, 1687, 264, 1687, 264, 264, 1687, 264, 264, 264,
- 264, 264, 264, 264, 264, 264, 1687, 264, 306, 1687,
- 1687, 306, 306, 306, 306, 306, 306, 306, 306, 1687,
- 306, 323, 1687, 1687, 1687, 323, 1687, 1687, 323, 323,
- 323, 323, 323, 323, 323, 323, 1687, 323, 342, 342,
- 1687, 342, 342, 342, 342, 342, 342, 342, 342, 342,
- 342, 342, 342, 342, 342, 342, 342, 342, 342, 342,
- 342, 342, 351, 1687, 1687, 351, 1687, 351, 1687, 351,
- 351, 1687, 351, 351, 1687, 1687, 351, 351, 351, 351,
- 351, 351, 351, 352, 352, 352, 352, 352, 352, 352,
-
- 352, 352, 352, 352, 352, 352, 352, 1687, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 412, 412, 412,
- 412, 1687, 1687, 412, 412, 412, 412, 412, 412, 412,
- 412, 1687, 412, 414, 1687, 1687, 414, 414, 414, 414,
- 414, 414, 414, 414, 1687, 414, 214, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 214, 214, 1687, 1687,
- 1687, 1687, 214, 455, 1687, 1687, 1687, 1687, 455, 1687,
- 455, 1687, 1687, 455, 460, 1687, 1687, 1687, 1687, 460,
- 1687, 460, 1687, 1687, 460, 466, 1687, 1687, 1687, 1687,
- 466, 1687, 466, 1687, 1687, 466, 258, 258, 258, 258,
-
- 1687, 1687, 258, 258, 258, 258, 258, 258, 258, 258,
- 1687, 258, 468, 468, 1687, 468, 468, 468, 468, 468,
- 468, 468, 468, 468, 468, 468, 468, 468, 468, 468,
- 468, 468, 468, 468, 468, 468, 264, 1687, 264, 264,
- 1687, 264, 1687, 264, 1687, 264, 264, 1687, 264, 264,
- 264, 264, 264, 264, 264, 264, 264, 1687, 264, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 1687, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 305, 1687, 1687, 1687, 1687, 1687, 1687,
- 305, 1687, 1687, 305, 305, 306, 1687, 1687, 306, 306,
-
- 306, 306, 306, 306, 306, 306, 1687, 306, 511, 511,
- 511, 511, 511, 511, 511, 511, 511, 511, 511, 511,
- 511, 511, 1687, 511, 511, 511, 511, 511, 511, 511,
- 511, 511, 526, 526, 526, 526, 526, 526, 526, 323,
- 1687, 1687, 1687, 323, 1687, 1687, 323, 323, 323, 323,
- 323, 323, 323, 323, 1687, 323, 527, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
- 1687, 527, 527, 527, 527, 527, 527, 527, 527, 527,
- 341, 1687, 1687, 1687, 1687, 341, 341, 341, 342, 342,
- 1687, 342, 342, 342, 342, 342, 342, 342, 342, 342,
-
- 342, 342, 342, 342, 342, 342, 342, 342, 342, 342,
- 342, 342, 555, 1687, 555, 555, 1687, 555, 1687, 1687,
- 1687, 555, 555, 555, 555, 555, 555, 555, 556, 1687,
- 1687, 556, 556, 556, 556, 556, 556, 556, 556, 1687,
- 556, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 1687, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 160, 1687, 1687, 160, 1687,
- 1687, 1687, 1687, 1687, 1687, 160, 1687, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 1687, 160, 412, 412,
- 412, 412, 1687, 1687, 412, 412, 412, 412, 412, 412,
-
- 412, 412, 1687, 412, 621, 621, 1687, 621, 621, 621,
- 621, 621, 621, 621, 621, 621, 621, 621, 621, 621,
- 621, 621, 621, 621, 621, 621, 621, 621, 414, 1687,
- 1687, 414, 414, 414, 414, 414, 414, 414, 414, 1687,
- 414, 623, 623, 623, 623, 623, 623, 623, 623, 623,
- 623, 623, 623, 623, 623, 1687, 623, 623, 623, 623,
- 623, 623, 623, 623, 623, 438, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 438, 438, 1687, 1687, 1687,
- 438, 438, 438, 226, 1687, 226, 1687, 1687, 1687, 1687,
- 1687, 226, 226, 1687, 1687, 226, 448, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 448, 1687, 1687, 448, 448, 460, 1687,
- 1687, 1687, 1687, 460, 1687, 460, 1687, 1687, 460, 455,
- 1687, 1687, 1687, 1687, 455, 1687, 455, 1687, 1687, 455,
- 466, 1687, 1687, 1687, 1687, 466, 1687, 466, 1687, 1687,
- 466, 468, 468, 1687, 468, 468, 468, 468, 468, 468,
- 468, 468, 468, 468, 468, 468, 468, 468, 468, 468,
- 468, 468, 468, 468, 468, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 1687,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 351,
- 1687, 1687, 351, 1687, 351, 1687, 351, 351, 1687, 351,
-
- 351, 1687, 1687, 351, 351, 351, 351, 351, 351, 351,
- 264, 1687, 264, 264, 1687, 264, 1687, 264, 1687, 264,
- 264, 1687, 264, 264, 264, 264, 264, 264, 264, 264,
- 264, 1687, 264, 511, 511, 511, 511, 511, 511, 511,
- 511, 511, 511, 511, 511, 511, 511, 1687, 511, 511,
- 511, 511, 511, 511, 511, 511, 511, 731, 1687, 1687,
- 1687, 1687, 1687, 731, 1687, 1687, 731, 731, 731, 731,
- 731, 731, 731, 731, 1687, 731, 527, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
- 1687, 527, 527, 527, 527, 527, 527, 527, 527, 527,
-
- 323, 1687, 1687, 1687, 323, 1687, 1687, 323, 323, 323,
- 323, 323, 323, 323, 323, 1687, 323, 349, 1687, 349,
- 1687, 1687, 1687, 1687, 1687, 349, 349, 1687, 1687, 349,
- 758, 1687, 1687, 758, 758, 758, 758, 758, 758, 758,
- 758, 1687, 758, 556, 1687, 1687, 556, 556, 556, 556,
- 556, 556, 556, 556, 1687, 556, 760, 760, 760, 760,
- 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
- 1687, 760, 760, 760, 760, 760, 760, 760, 760, 760,
- 352, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 1687, 352, 352, 352, 352, 352,
-
- 352, 352, 352, 352, 160, 1687, 1687, 160, 1687, 1687,
- 1687, 1687, 1687, 1687, 160, 1687, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 1687, 160, 775, 1687, 1687,
- 775, 1687, 775, 1687, 775, 775, 1687, 775, 1687, 775,
- 1687, 775, 775, 775, 775, 775, 775, 775, 621, 621,
- 1687, 621, 621, 621, 621, 621, 621, 621, 621, 621,
- 621, 621, 621, 621, 621, 621, 621, 621, 621, 621,
- 621, 621, 623, 623, 623, 623, 623, 623, 623, 623,
- 623, 623, 623, 623, 623, 623, 1687, 623, 623, 623,
- 623, 623, 623, 623, 623, 623, 414, 1687, 1687, 414,
-
- 414, 414, 414, 414, 414, 414, 414, 1687, 414, 434,
- 1687, 434, 1687, 1687, 1687, 1687, 1687, 434, 434, 1687,
- 1687, 434, 652, 1687, 1687, 1687, 1687, 652, 652, 652,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 1687, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 264, 1687, 264, 264, 1687, 264,
- 1687, 264, 1687, 264, 264, 1687, 264, 264, 264, 264,
- 264, 264, 264, 264, 264, 1687, 264, 716, 1687, 1687,
- 1687, 1687, 716, 716, 716, 1687, 1687, 1687, 716, 731,
- 1687, 1687, 1687, 1687, 1687, 731, 1687, 1687, 731, 731,
-
- 731, 731, 731, 731, 731, 731, 1687, 731, 904, 904,
- 904, 904, 904, 904, 904, 904, 904, 904, 904, 904,
- 904, 904, 1687, 904, 904, 904, 904, 904, 904, 904,
- 904, 904, 323, 1687, 323, 1687, 1687, 1687, 323, 1687,
- 1687, 323, 323, 323, 323, 323, 323, 323, 323, 1687,
- 323, 750, 1687, 1687, 1687, 1687, 750, 750, 750, 554,
- 1687, 554, 1687, 1687, 1687, 1687, 1687, 554, 554, 1687,
- 1687, 554, 758, 1687, 1687, 758, 758, 758, 758, 758,
- 758, 758, 758, 1687, 758, 926, 926, 926, 926, 926,
- 926, 926, 926, 926, 926, 926, 926, 926, 926, 1687,
-
- 926, 926, 926, 926, 926, 926, 926, 926, 926, 760,
- 760, 760, 760, 760, 760, 760, 760, 760, 760, 760,
- 760, 760, 760, 1687, 760, 760, 760, 760, 760, 760,
- 760, 760, 760, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 1687, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 160, 1687, 1687,
- 160, 1687, 1687, 1687, 1687, 1687, 1687, 160, 1687, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 1687, 160,
- 949, 1687, 1687, 949, 949, 949, 949, 949, 949, 949,
- 949, 1687, 949, 965, 965, 965, 965, 965, 965, 965,
-
- 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 965, 414, 1687, 1687,
- 414, 414, 414, 414, 414, 414, 414, 414, 1687, 414,
- 834, 1687, 1687, 1687, 1687, 834, 834, 834, 838, 1687,
- 1687, 1687, 1687, 838, 838, 838, 1687, 1687, 1687, 838,
- 844, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 844, 844, 1687, 1687, 1687, 844, 844, 844, 844, 850,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 850,
- 850, 1687, 1687, 1687, 850, 850, 850, 850, 856, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 856, 856,
-
- 1687, 1687, 1687, 856, 856, 856, 856, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 1687, 470, 470, 470, 470, 470, 470, 470, 470,
- 470, 874, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 874, 1687, 1687, 1687, 1687, 874, 874, 874, 264,
- 1687, 264, 264, 1687, 264, 1687, 264, 1687, 264, 264,
- 1687, 264, 264, 264, 264, 264, 264, 264, 264, 264,
- 1687, 264, 904, 904, 904, 904, 904, 904, 904, 904,
- 904, 904, 904, 904, 904, 904, 1687, 904, 904, 904,
- 904, 904, 904, 904, 904, 904, 323, 1687, 1687, 1687,
-
- 323, 1687, 1687, 323, 323, 323, 323, 323, 323, 323,
- 323, 1687, 323, 965, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 965, 925, 1687, 1687,
- 1687, 1687, 925, 925, 925, 926, 926, 926, 926, 926,
- 926, 926, 926, 926, 926, 926, 926, 926, 926, 1687,
- 926, 926, 926, 926, 926, 926, 926, 926, 926, 352,
- 352, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 1687, 352, 352, 352, 352, 352, 352,
- 352, 352, 352, 160, 1687, 1687, 160, 1687, 1687, 1687,
-
- 1687, 1687, 1687, 160, 1687, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 1687, 160, 774, 1687, 774, 1687,
- 1687, 1687, 1687, 1687, 774, 774, 1687, 1687, 774, 949,
- 1687, 1687, 949, 949, 949, 949, 949, 949, 949, 949,
- 1687, 949, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108,
- 1108, 1108, 1108, 1108, 1108, 1108, 1687, 1108, 1108, 1108,
- 1108, 1108, 1108, 1108, 1108, 1108, 775, 1687, 1687, 775,
- 1687, 775, 1687, 775, 775, 1687, 775, 1687, 775, 1687,
- 775, 775, 775, 775, 775, 775, 775, 1117, 1117, 1117,
- 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
-
- 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
- 1117, 414, 1687, 1687, 414, 414, 414, 414, 414, 414,
- 414, 414, 1687, 414, 999, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 999, 1687, 1687, 1687, 1687, 1687,
- 999, 1687, 1687, 999, 1009, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1009, 1687, 1687, 1687, 1687, 1687,
- 1009, 1687, 1687, 1009, 1018, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1018, 1687, 1687, 1687, 1687, 1687,
- 1018, 1687, 1687, 1018, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 470, 1687, 470,
-
- 470, 470, 470, 470, 470, 470, 470, 470, 264, 1687,
- 264, 264, 1687, 264, 1687, 264, 1687, 264, 264, 1687,
- 264, 264, 264, 264, 264, 264, 264, 264, 264, 1687,
- 264, 904, 904, 904, 904, 904, 904, 904, 904, 904,
- 904, 904, 904, 904, 904, 1687, 904, 904, 904, 904,
- 904, 904, 904, 904, 904, 527, 527, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 1687,
- 527, 527, 527, 527, 527, 527, 527, 527, 527, 323,
- 1687, 323, 1687, 1687, 1687, 323, 1687, 1687, 323, 323,
- 323, 323, 323, 323, 323, 323, 1687, 323, 775, 1687,
-
- 1687, 775, 1687, 775, 1687, 775, 775, 1687, 775, 1687,
- 1687, 1687, 775, 775, 775, 775, 775, 775, 775, 1117,
- 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
- 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
- 1117, 1117, 1117, 965, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 965, 965, 965, 965,
- 965, 965, 965, 965, 965, 965, 965, 352, 352, 352,
- 352, 352, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 1687, 352, 352, 352, 352, 352, 352, 352, 352,
- 352, 160, 1687, 1687, 160, 1687, 1687, 1687, 1687, 1687,
-
- 1687, 160, 1687, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 1687, 160, 1107, 1687, 1687, 1687, 1687, 1107,
- 1107, 1107, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108,
- 1108, 1108, 1108, 1108, 1108, 1108, 1687, 1108, 1108, 1108,
- 1108, 1108, 1108, 1108, 1108, 1108, 1245, 1245, 1245, 1245,
- 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245,
- 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245, 1245,
- 414, 1687, 1687, 414, 414, 414, 414, 414, 414, 414,
- 414, 1687, 414, 1149, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1149, 1687, 1687, 1687, 1687, 1149, 1149,
-
- 1149, 1687, 1149, 1154, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1154, 1687, 1687, 1687, 1687, 1154, 1154,
- 1154, 1687, 1154, 1159, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1159, 1687, 1687, 1687, 1687, 1159, 1159,
- 1159, 1687, 1159, 470, 470, 470, 470, 470, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 1687, 470, 470,
- 470, 470, 470, 470, 470, 470, 470, 264, 1687, 264,
- 264, 1687, 264, 1687, 264, 1687, 264, 264, 1687, 264,
- 264, 264, 264, 264, 264, 264, 264, 264, 1687, 264,
- 904, 904, 904, 904, 904, 904, 904, 904, 904, 904,
-
- 904, 904, 904, 904, 1687, 904, 904, 904, 904, 904,
- 904, 904, 904, 904, 527, 527, 527, 527, 527, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 1687, 527,
- 527, 527, 527, 527, 527, 527, 527, 527, 323, 1687,
- 1687, 1687, 323, 1687, 323, 1687, 1687, 1687, 323, 1687,
- 1687, 323, 323, 323, 323, 323, 323, 323, 323, 1687,
- 323, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349,
- 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349,
- 1349, 1349, 1349, 1349, 1349, 1426, 1426, 1426, 1426, 1426,
- 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426,
-
- 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1426, 1438,
- 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438,
- 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438,
- 1438, 1438, 1438, 760, 760, 760, 760, 760, 760, 760,
- 760, 760, 760, 760, 760, 760, 760, 1687, 760, 760,
- 760, 760, 760, 760, 760, 760, 760, 1507, 1507, 1507,
- 1507, 1507, 1507, 1507, 1507, 1507, 1507, 1507, 1507, 1507,
- 1507, 1507, 1507, 1507, 1507, 1507, 1507, 1507, 1507, 1507,
- 1507, 926, 926, 926, 926, 926, 926, 926, 926, 926,
- 926, 926, 926, 926, 926, 1687, 926, 926, 926, 926,
-
- 926, 926, 926, 926, 926, 1530, 1530, 1530, 1530, 1530,
- 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530,
- 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1565,
- 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565,
- 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565,
- 1565, 1565, 1565, 1584, 1584, 1584, 1584, 1584, 1584, 1584,
- 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1584,
- 1584, 1584, 1584, 1584, 1584, 1584, 1584, 1661, 1661, 1661,
- 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661,
- 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661, 1661,
-
- 1661, 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675,
- 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675, 1675,
- 1675, 1675, 1675, 1675, 1675, 15, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687
- } ;
-
-static yyconst short int yy_chk[14289] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 3, 3, 32, 32, 3, 3, 13, 14,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 5, 5,
- 3, 5, 6, 6, 19, 6, 13, 14, 31, 34,
-
- 34, 19, 19, 19, 124, 19, 19, 66, 66, 68,
- 68, 124, 19, 87, 87, 296, 19, 19, 296, 3,
- 31, 3, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
-
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 11, 11, 125, 11,
- 25, 25, 125, 25, 74, 206, 25, 89, 89, 25,
- 80, 100, 100, 11, 123, 123, 25, 206, 25, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 27, 417, 27, 27, 27,
-
- 27, 27, 27, 27, 29, 29, 29, 29, 29, 29,
- 29, 74, 63, 96, 27, 27, 27, 80, 27, 27,
- 37, 96, 96, 417, 38, 27, 151, 151, 37, 27,
- 27, 27, 38, 27, 63, 27, 30, 419, 30, 30,
- 30, 30, 30, 30, 30, 37, 39, 1681, 37, 38,
- 85, 199, 38, 133, 39, 40, 30, 43, 419, 30,
- 105, 105, 39, 40, 99, 43, 30, 105, 38, 38,
- 133, 39, 85, 199, 39, 99, 99, 99, 30, 41,
- 40, 44, 43, 40, 204, 43, 42, 41, 202, 44,
- 106, 106, 39, 39, 42, 40, 204, 43, 106, 43,
-
- 45, 40, 40, 204, 41, 202, 44, 41, 45, 44,
- 46, 42, 103, 44, 42, 41, 103, 103, 46, 209,
- 42, 1676, 47, 94, 44, 45, 101, 46, 45, 42,
- 47, 48, 49, 42, 45, 46, 101, 101, 46, 48,
- 49, 50, 209, 207, 45, 213, 421, 47, 1674, 50,
- 47, 94, 94, 94, 94, 207, 48, 49, 228, 48,
- 49, 421, 47, 48, 51, 97, 50, 213, 137, 50,
- 48, 48, 51, 52, 97, 97, 97, 48, 97, 102,
- 48, 52, 98, 49, 98, 137, 98, 98, 999, 51,
- 95, 134, 51, 50, 95, 95, 95, 95, 52, 135,
-
- 51, 52, 137, 128, 51, 108, 102, 102, 134, 52,
- 54, 128, 54, 108, 108, 228, 135, 128, 54, 134,
- 54, 203, 54, 54, 999, 54, 54, 54, 54, 54,
- 54, 54, 218, 218, 135, 245, 245, 54, 999, 203,
- 203, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 55, 205, 247,
- 247, 248, 248, 107, 55, 55, 55, 107, 55, 55,
- 231, 107, 107, 205, 158, 55, 879, 205, 879, 55,
- 55, 59, 158, 59, 59, 59, 59, 59, 59, 59,
-
- 61, 61, 61, 61, 61, 61, 61, 62, 81, 158,
- 81, 81, 81, 81, 81, 81, 81, 136, 138, 215,
- 62, 323, 62, 62, 62, 62, 62, 62, 62, 62,
- 71, 71, 1666, 71, 136, 138, 71, 231, 323, 71,
- 62, 215, 220, 62, 139, 226, 71, 76, 71, 136,
- 62, 265, 265, 138, 76, 76, 76, 490, 76, 76,
- 145, 139, 62, 64, 220, 76, 490, 226, 145, 76,
- 76, 235, 139, 64, 145, 64, 64, 145, 64, 64,
- 64, 64, 64, 64, 64, 83, 83, 83, 83, 83,
- 83, 83, 84, 235, 84, 84, 636, 84, 84, 84,
-
- 214, 483, 84, 140, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 160, 84, 84, 84, 483,
- 140, 164, 214, 160, 636, 84, 175, 84, 84, 164,
- 320, 84, 84, 320, 175, 84, 214, 140, 387, 84,
- 160, 84, 387, 160, 267, 267, 164, 84, 304, 164,
- 84, 175, 84, 92, 175, 92, 286, 286, 92, 92,
- 304, 92, 175, 92, 304, 92, 164, 92, 141, 141,
- 141, 141, 141, 141, 141, 104, 418, 92, 92, 92,
- 418, 92, 104, 104, 338, 338, 327, 104, 104, 104,
- 420, 109, 104, 109, 420, 326, 109, 109, 109, 109,
-
- 109, 109, 109, 327, 149, 149, 149, 149, 149, 149,
- 149, 92, 326, 92, 93, 423, 93, 385, 385, 93,
- 93, 327, 93, 423, 93, 149, 93, 216, 93, 150,
- 150, 150, 150, 150, 150, 150, 326, 163, 93, 93,
- 93, 1665, 93, 325, 349, 163, 152, 625, 152, 216,
- 150, 152, 152, 152, 152, 152, 152, 152, 93, 93,
- 325, 165, 163, 216, 325, 163, 349, 404, 404, 165,
- 386, 625, 93, 166, 93, 161, 422, 386, 406, 406,
- 422, 166, 165, 161, 163, 161, 165, 161, 161, 165,
- 161, 161, 161, 161, 161, 161, 161, 161, 166, 167,
-
- 271, 166, 208, 1383, 168, 169, 208, 167, 271, 170,
- 171, 172, 168, 169, 208, 173, 1383, 170, 171, 172,
- 208, 407, 407, 173, 167, 271, 730, 167, 166, 168,
- 169, 167, 168, 169, 170, 171, 172, 170, 171, 172,
- 173, 170, 174, 173, 176, 331, 395, 426, 177, 169,
- 174, 730, 176, 168, 172, 426, 177, 178, 173, 428,
- 328, 171, 331, 176, 176, 178, 416, 174, 395, 176,
- 174, 179, 176, 177, 174, 434, 177, 328, 428, 179,
- 180, 182, 178, 416, 331, 178, 181, 330, 180, 182,
- 183, 177, 402, 1662, 181, 402, 179, 434, 183, 179,
-
- 328, 181, 184, 178, 330, 180, 182, 424, 180, 182,
- 184, 181, 180, 185, 181, 183, 329, 186, 183, 632,
- 179, 185, 330, 187, 424, 186, 182, 184, 188, 409,
- 184, 187, 409, 329, 632, 183, 188, 237, 185, 189,
- 488, 185, 186, 827, 402, 186, 190, 189, 187, 185,
- 329, 187, 488, 188, 190, 191, 188, 186, 184, 237,
- 186, 425, 192, 191, 189, 390, 827, 189, 1651, 187,
- 192, 190, 237, 390, 190, 188, 237, 497, 425, 390,
- 191, 409, 189, 191, 194, 194, 194, 192, 194, 194,
- 192, 442, 442, 497, 477, 194, 192, 716, 191, 194,
-
- 194, 190, 195, 197, 197, 197, 197, 197, 197, 197,
- 547, 547, 195, 716, 195, 195, 477, 195, 195, 195,
- 195, 195, 195, 195, 196, 498, 196, 196, 196, 196,
- 196, 196, 196, 211, 211, 211, 211, 211, 211, 211,
- 244, 249, 498, 196, 196, 196, 438, 196, 196, 427,
- 244, 249, 244, 249, 196, 244, 249, 828, 196, 196,
- 198, 427, 198, 345, 427, 198, 198, 828, 438, 198,
- 198, 345, 198, 198, 198, 198, 198, 198, 198, 198,
- 198, 198, 251, 482, 198, 198, 198, 353, 345, 438,
- 482, 485, 251, 198, 251, 353, 198, 251, 485, 219,
-
- 1645, 219, 503, 198, 219, 219, 219, 219, 219, 219,
- 219, 514, 353, 526, 503, 198, 489, 353, 198, 514,
- 198, 217, 223, 489, 223, 223, 223, 223, 223, 223,
- 223, 217, 526, 217, 217, 1629, 217, 217, 217, 217,
- 217, 217, 217, 224, 224, 224, 224, 224, 224, 224,
- 225, 675, 225, 225, 225, 225, 225, 225, 225, 233,
- 233, 233, 233, 233, 233, 233, 1629, 500, 501, 554,
- 225, 628, 501, 225, 500, 675, 229, 628, 229, 439,
- 225, 229, 229, 229, 229, 229, 229, 229, 232, 530,
- 232, 554, 225, 232, 232, 232, 232, 232, 232, 232,
-
- 236, 236, 439, 236, 236, 236, 530, 1631, 236, 439,
- 236, 530, 236, 236, 236, 236, 236, 236, 236, 236,
- 435, 439, 236, 236, 236, 303, 303, 303, 303, 303,
- 303, 303, 357, 236, 236, 435, 435, 1630, 236, 697,
- 357, 647, 435, 697, 250, 236, 250, 236, 528, 250,
- 250, 250, 250, 250, 250, 250, 236, 357, 236, 253,
- 357, 253, 253, 647, 253, 253, 253, 528, 698, 253,
- 630, 253, 698, 253, 305, 305, 305, 305, 305, 305,
- 305, 253, 630, 253, 253, 253, 339, 339, 339, 339,
- 339, 339, 339, 516, 253, 633, 360, 602, 253, 253,
-
- 602, 516, 305, 633, 360, 337, 253, 337, 253, 877,
- 337, 337, 337, 337, 337, 337, 337, 253, 305, 253,
- 264, 360, 264, 518, 360, 264, 264, 516, 264, 877,
- 264, 518, 264, 696, 264, 340, 340, 340, 340, 340,
- 340, 340, 696, 360, 264, 264, 264, 346, 264, 346,
- 346, 346, 346, 346, 346, 346, 347, 347, 347, 347,
- 347, 347, 347, 518, 608, 608, 987, 354, 393, 393,
- 393, 393, 393, 393, 393, 354, 1628, 408, 264, 408,
- 264, 266, 408, 408, 408, 408, 408, 408, 408, 266,
- 987, 266, 354, 266, 266, 354, 266, 266, 266, 266,
-
- 266, 266, 266, 266, 643, 643, 266, 270, 627, 270,
- 354, 447, 270, 270, 355, 270, 356, 270, 358, 270,
- 359, 270, 355, 447, 356, 627, 358, 447, 359, 522,
- 361, 270, 270, 270, 767, 270, 356, 522, 361, 355,
- 634, 356, 355, 358, 356, 359, 358, 634, 359, 367,
- 367, 370, 629, 480, 359, 361, 767, 367, 361, 370,
- 367, 480, 515, 358, 522, 270, 355, 270, 272, 629,
- 515, 694, 367, 480, 367, 361, 370, 367, 272, 370,
- 272, 272, 694, 272, 272, 272, 272, 272, 272, 272,
- 348, 362, 348, 348, 348, 348, 348, 348, 348, 362,
-
- 365, 370, 1606, 637, 517, 480, 363, 515, 365, 520,
- 348, 451, 517, 348, 363, 637, 362, 520, 712, 362,
- 348, 451, 364, 451, 712, 365, 451, 362, 365, 366,
- 364, 363, 348, 350, 363, 350, 350, 366, 350, 350,
- 350, 350, 350, 350, 350, 365, 363, 364, 368, 517,
- 364, 703, 520, 369, 366, 525, 368, 366, 703, 371,
- 372, 369, 364, 525, 649, 649, 373, 371, 372, 524,
- 680, 374, 366, 368, 373, 372, 368, 524, 369, 374,
- 368, 369, 375, 890, 371, 372, 369, 371, 372, 890,
- 375, 373, 376, 377, 373, 525, 374, 371, 680, 374,
-
- 376, 377, 373, 378, 673, 379, 374, 375, 487, 673,
- 375, 378, 535, 379, 380, 381, 487, 376, 377, 529,
- 376, 377, 380, 381, 1605, 524, 382, 383, 378, 535,
- 379, 378, 375, 379, 382, 383, 529, 376, 819, 380,
- 381, 535, 380, 381, 378, 379, 452, 631, 487, 377,
- 380, 382, 383, 819, 382, 383, 452, 529, 452, 484,
- 487, 452, 382, 429, 631, 429, 381, 484, 429, 429,
- 429, 429, 429, 429, 429, 679, 679, 1604, 383, 392,
- 679, 392, 392, 392, 392, 392, 392, 392, 431, 889,
- 431, 431, 431, 431, 431, 431, 431, 519, 392, 392,
-
- 392, 658, 392, 392, 692, 519, 484, 889, 521, 392,
- 523, 484, 692, 392, 392, 394, 521, 394, 523, 707,
- 394, 394, 707, 658, 532, 394, 532, 394, 394, 394,
- 394, 394, 394, 394, 394, 394, 394, 457, 821, 394,
- 394, 394, 519, 532, 521, 658, 493, 457, 394, 457,
- 533, 394, 457, 821, 493, 523, 463, 635, 394, 432,
- 432, 432, 432, 432, 432, 432, 463, 533, 463, 891,
- 394, 463, 536, 394, 635, 394, 396, 533, 396, 493,
- 536, 396, 396, 685, 685, 396, 396, 891, 396, 396,
- 396, 396, 396, 396, 396, 396, 396, 396, 493, 1293,
-
- 396, 396, 396, 436, 436, 436, 436, 436, 436, 436,
- 534, 531, 396, 709, 1293, 536, 660, 691, 709, 396,
- 440, 440, 440, 440, 440, 440, 440, 534, 531, 677,
- 677, 396, 531, 702, 396, 677, 396, 397, 660, 397,
- 731, 440, 397, 397, 702, 691, 397, 397, 534, 397,
- 437, 397, 397, 397, 397, 397, 397, 397, 397, 731,
- 660, 397, 397, 397, 575, 437, 437, 437, 437, 437,
- 437, 437, 437, 397, 575, 441, 441, 441, 441, 441,
- 441, 441, 443, 774, 443, 1603, 575, 443, 443, 443,
- 443, 443, 443, 443, 695, 397, 441, 397, 398, 699,
-
- 398, 486, 695, 398, 398, 774, 704, 699, 398, 486,
- 398, 701, 398, 446, 446, 446, 446, 446, 446, 446,
- 701, 1585, 398, 398, 398, 706, 448, 448, 448, 448,
- 448, 448, 448, 450, 704, 450, 706, 486, 450, 450,
- 450, 450, 450, 450, 450, 453, 453, 453, 453, 453,
- 453, 453, 715, 486, 448, 715, 398, 838, 398, 430,
- 458, 458, 458, 458, 458, 458, 458, 747, 747, 430,
- 448, 430, 430, 838, 430, 430, 430, 430, 430, 430,
- 430, 433, 1583, 433, 433, 433, 433, 433, 433, 433,
- 461, 461, 461, 461, 461, 461, 461, 700, 708, 887,
-
- 710, 433, 711, 820, 433, 700, 708, 710, 887, 711,
- 820, 433, 462, 462, 462, 462, 462, 462, 462, 754,
- 754, 831, 831, 433, 454, 464, 464, 464, 464, 464,
- 464, 464, 475, 475, 475, 475, 475, 475, 475, 454,
- 454, 454, 454, 454, 454, 454, 454, 474, 494, 474,
- 474, 474, 474, 474, 474, 474, 494, 492, 495, 823,
- 1562, 718, 496, 491, 491, 492, 495, 454, 454, 718,
- 496, 491, 826, 662, 491, 822, 826, 496, 823, 454,
- 456, 456, 822, 456, 456, 456, 491, 880, 456, 492,
- 456, 499, 456, 456, 456, 662, 495, 504, 494, 499,
-
- 494, 824, 456, 456, 456, 504, 664, 880, 824, 492,
- 495, 502, 506, 456, 496, 491, 505, 662, 456, 502,
- 506, 507, 513, 544, 505, 456, 1051, 456, 664, 507,
- 513, 1561, 734, 504, 734, 825, 456, 744, 456, 459,
- 1051, 499, 825, 499, 867, 744, 544, 666, 506, 504,
- 664, 734, 502, 544, 459, 459, 459, 459, 459, 459,
- 459, 459, 713, 502, 506, 544, 867, 505, 505, 666,
- 713, 905, 507, 507, 513, 541, 541, 541, 541, 541,
- 541, 541, 459, 459, 542, 542, 542, 542, 542, 542,
- 542, 666, 905, 878, 459, 465, 763, 545, 545, 545,
-
- 545, 545, 545, 545, 763, 713, 881, 881, 668, 878,
- 465, 465, 465, 465, 465, 465, 465, 465, 545, 546,
- 546, 546, 546, 546, 546, 546, 548, 883, 548, 883,
- 668, 548, 548, 548, 548, 548, 548, 548, 465, 465,
- 546, 551, 1560, 551, 551, 551, 551, 551, 551, 551,
- 465, 467, 668, 467, 467, 902, 467, 467, 467, 882,
- 882, 467, 735, 467, 735, 467, 467, 467, 467, 467,
- 467, 467, 467, 467, 776, 467, 467, 467, 886, 886,
- 902, 735, 776, 467, 467, 467, 467, 467, 467, 874,
- 467, 467, 888, 884, 467, 888, 735, 738, 467, 738,
-
- 467, 552, 552, 552, 552, 552, 552, 552, 938, 467,
- 1303, 467, 471, 884, 471, 558, 738, 471, 471, 561,
- 471, 564, 471, 558, 471, 1303, 471, 561, 738, 564,
- 938, 705, 874, 565, 922, 922, 471, 471, 471, 705,
- 558, 565, 471, 566, 561, 558, 564, 561, 565, 564,
- 893, 566, 568, 893, 567, 945, 945, 829, 565, 561,
- 568, 565, 567, 705, 564, 829, 1195, 863, 566, 1195,
- 471, 566, 471, 472, 705, 863, 991, 568, 566, 567,
- 568, 472, 567, 472, 568, 472, 472, 871, 472, 472,
- 472, 472, 472, 472, 472, 472, 473, 567, 991, 570,
-
- 1050, 988, 871, 871, 473, 988, 473, 570, 473, 473,
- 1050, 473, 473, 473, 473, 473, 473, 473, 473, 476,
- 571, 569, 572, 736, 570, 736, 993, 570, 571, 569,
- 572, 1559, 476, 570, 476, 476, 476, 476, 476, 476,
- 476, 1000, 736, 573, 993, 571, 569, 572, 571, 569,
- 572, 573, 476, 912, 990, 476, 569, 908, 990, 908,
- 992, 912, 476, 617, 992, 736, 617, 571, 573, 572,
- 1054, 573, 617, 617, 476, 478, 908, 478, 573, 1595,
- 478, 478, 574, 478, 577, 478, 576, 478, 1054, 478,
- 574, 1000, 577, 1378, 576, 1595, 578, 580, 579, 478,
-
- 478, 478, 907, 478, 578, 580, 579, 574, 1378, 577,
- 574, 576, 577, 579, 576, 617, 577, 574, 478, 907,
- 576, 578, 580, 579, 578, 580, 579, 907, 1004, 580,
- 965, 581, 578, 478, 1385, 478, 479, 1144, 479, 581,
- 1385, 479, 479, 582, 479, 585, 479, 583, 479, 584,
- 479, 582, 965, 585, 1144, 583, 581, 584, 965, 581,
- 479, 479, 479, 581, 479, 1010, 795, 795, 582, 1536,
- 585, 582, 583, 585, 584, 583, 818, 584, 1004, 818,
- 1535, 585, 586, 582, 587, 818, 818, 584, 479, 795,
- 586, 909, 587, 640, 479, 795, 479, 553, 583, 553,
-
- 553, 553, 553, 553, 553, 553, 588, 586, 909, 587,
- 586, 914, 587, 1396, 588, 1010, 640, 553, 586, 914,
- 553, 931, 931, 640, 989, 909, 1396, 553, 818, 1002,
- 1002, 588, 989, 587, 588, 640, 931, 1012, 1012, 553,
- 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
- 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
- 560, 560, 560, 560, 560, 560, 560, 560, 560, 1534,
- 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
- 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
- 560, 560, 560, 560, 560, 560, 560, 560, 560, 560,
-
- 560, 560, 562, 1021, 1021, 589, 740, 1049, 740, 1040,
- 562, 1049, 562, 589, 562, 562, 1477, 562, 562, 562,
- 562, 562, 562, 562, 885, 740, 590, 562, 563, 892,
- 589, 1040, 885, 589, 590, 740, 563, 892, 563, 1531,
- 563, 563, 1477, 563, 563, 563, 563, 563, 563, 563,
- 609, 590, 609, 563, 590, 609, 609, 609, 609, 609,
- 609, 609, 618, 618, 618, 618, 618, 618, 618, 1033,
- 1033, 1311, 590, 604, 1001, 604, 885, 1014, 604, 604,
- 1311, 892, 1520, 604, 1033, 604, 604, 604, 604, 604,
- 604, 604, 604, 604, 604, 1019, 1508, 604, 604, 604,
-
- 619, 619, 619, 619, 619, 619, 619, 672, 1300, 604,
- 1001, 910, 613, 910, 613, 672, 604, 613, 613, 613,
- 613, 613, 613, 613, 1001, 844, 1506, 1014, 604, 1300,
- 910, 604, 672, 604, 605, 1007, 605, 672, 1023, 605,
- 605, 1380, 910, 1380, 605, 1019, 605, 844, 605, 605,
- 605, 605, 605, 605, 605, 605, 639, 1007, 605, 605,
- 605, 638, 638, 638, 638, 638, 638, 638, 844, 844,
- 605, 639, 639, 639, 639, 639, 639, 639, 639, 1007,
- 1052, 641, 641, 641, 641, 641, 641, 641, 1023, 1066,
- 1052, 911, 605, 1066, 605, 610, 970, 610, 778, 1055,
-
- 610, 610, 641, 1379, 1055, 610, 778, 610, 911, 610,
- 642, 642, 642, 642, 642, 642, 642, 1495, 970, 610,
- 610, 610, 1310, 778, 970, 911, 778, 644, 1379, 644,
- 778, 642, 644, 644, 644, 644, 644, 644, 644, 648,
- 970, 648, 850, 1310, 648, 648, 648, 648, 648, 648,
- 648, 1056, 1056, 610, 1386, 610, 620, 1388, 620, 770,
- 1494, 620, 620, 1388, 850, 620, 620, 770, 620, 1386,
- 620, 620, 620, 620, 620, 620, 620, 620, 1064, 1064,
- 620, 620, 620, 1493, 770, 850, 850, 770, 620, 620,
- 620, 620, 620, 620, 1009, 1011, 770, 1104, 1104, 620,
-
- 650, 650, 650, 650, 650, 650, 650, 651, 651, 651,
- 651, 651, 651, 651, 620, 1593, 620, 656, 656, 656,
- 656, 656, 656, 656, 657, 657, 1065, 657, 657, 657,
- 1009, 1011, 657, 1065, 657, 1593, 657, 657, 657, 657,
- 657, 657, 657, 657, 1009, 1011, 657, 657, 657, 748,
- 748, 748, 748, 748, 748, 748, 1085, 657, 682, 1129,
- 1125, 1382, 657, 1382, 1085, 739, 1398, 739, 1125, 657,
- 684, 657, 1398, 682, 682, 682, 682, 682, 682, 682,
- 657, 1129, 657, 659, 739, 684, 684, 684, 684, 684,
- 684, 684, 1492, 659, 682, 659, 659, 1016, 659, 659,
-
- 659, 659, 659, 659, 659, 663, 684, 739, 749, 749,
- 749, 749, 749, 749, 749, 663, 1142, 663, 663, 1016,
- 663, 663, 663, 663, 663, 663, 663, 667, 1143, 1480,
- 751, 1074, 1384, 1074, 1384, 856, 1143, 667, 1142, 667,
- 667, 1016, 667, 667, 667, 667, 667, 667, 667, 670,
- 1074, 670, 670, 751, 670, 670, 670, 856, 1018, 670,
- 751, 670, 1392, 670, 670, 670, 670, 670, 670, 670,
- 670, 670, 751, 670, 670, 670, 1467, 1163, 856, 856,
- 1297, 670, 670, 670, 670, 670, 670, 1392, 670, 670,
- 1297, 942, 670, 1071, 1018, 686, 670, 686, 670, 1163,
-
- 686, 686, 686, 686, 686, 686, 686, 670, 1018, 670,
- 671, 1465, 671, 671, 942, 671, 671, 671, 1071, 1020,
- 671, 942, 671, 1071, 671, 752, 752, 752, 752, 752,
- 752, 752, 671, 942, 671, 671, 671, 765, 765, 765,
- 765, 765, 765, 765, 1298, 671, 752, 1473, 1464, 671,
- 671, 1393, 765, 1393, 1298, 1020, 746, 671, 746, 671,
- 1473, 746, 746, 746, 746, 746, 746, 746, 671, 1020,
- 671, 678, 678, 678, 678, 678, 678, 678, 678, 678,
- 678, 678, 678, 678, 678, 678, 678, 678, 678, 678,
- 678, 678, 678, 678, 678, 678, 678, 678, 678, 678,
-
- 1463, 678, 678, 678, 678, 678, 678, 678, 678, 678,
- 678, 678, 678, 678, 678, 678, 678, 678, 678, 678,
- 678, 678, 678, 678, 678, 678, 678, 678, 678, 678,
- 678, 678, 678, 681, 753, 753, 753, 753, 753, 753,
- 753, 1381, 1090, 1090, 1097, 1097, 681, 1462, 681, 681,
- 681, 681, 681, 681, 681, 753, 755, 1090, 755, 1097,
- 1381, 755, 755, 755, 755, 755, 755, 755, 1026, 681,
- 1165, 1165, 1172, 1172, 1227, 764, 681, 764, 764, 764,
- 764, 764, 764, 764, 1404, 1165, 1072, 1172, 681, 689,
- 1026, 689, 764, 1404, 689, 689, 1227, 689, 1395, 689,
-
- 1395, 689, 771, 689, 771, 771, 771, 771, 771, 771,
- 771, 1072, 1026, 689, 689, 689, 1072, 689, 772, 772,
- 772, 772, 772, 772, 772, 810, 1387, 810, 1680, 689,
- 810, 810, 810, 810, 810, 810, 810, 1680, 777, 1117,
- 1069, 1387, 1397, 779, 1397, 780, 777, 689, 1069, 689,
- 690, 779, 690, 780, 1069, 690, 690, 781, 690, 1132,
- 690, 1117, 690, 777, 690, 781, 777, 1117, 779, 782,
- 780, 779, 1057, 780, 690, 690, 690, 782, 690, 779,
- 1057, 1132, 781, 1223, 783, 781, 1394, 1132, 786, 781,
- 777, 1223, 783, 690, 782, 780, 786, 782, 812, 812,
-
- 812, 812, 812, 812, 812, 1394, 1201, 1461, 690, 783,
- 690, 717, 783, 786, 1469, 1201, 786, 1201, 1469, 717,
- 782, 717, 1057, 717, 717, 1354, 717, 717, 717, 717,
- 717, 717, 717, 1354, 1201, 783, 717, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 733, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 733, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 1460, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 733, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 733, 733, 733, 733,
- 733, 733, 733, 733, 733, 733, 733, 733, 733, 762,
-
- 762, 762, 762, 762, 762, 762, 762, 762, 762, 762,
- 762, 762, 762, 762, 762, 762, 762, 762, 762, 762,
- 762, 762, 762, 762, 762, 762, 762, 762, 1459, 762,
- 762, 762, 762, 762, 762, 762, 762, 762, 762, 762,
- 762, 762, 762, 762, 762, 762, 762, 762, 762, 762,
- 762, 762, 762, 762, 762, 762, 762, 762, 762, 762,
- 762, 766, 785, 766, 766, 766, 766, 766, 766, 766,
- 785, 793, 794, 794, 1213, 1213, 1294, 1475, 766, 793,
- 794, 766, 1475, 1257, 766, 1272, 1272, 785, 1307, 1213,
- 785, 766, 1294, 1294, 785, 794, 793, 794, 1307, 793,
-
- 1272, 794, 1443, 766, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 1257, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
- 768, 768, 768, 768, 768, 768, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
-
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 769, 769,
- 769, 769, 769, 769, 769, 769, 769, 769, 773, 784,
- 773, 773, 773, 773, 773, 773, 773, 784, 787, 788,
- 1146, 1260, 915, 915, 789, 1263, 787, 788, 773, 1308,
- 915, 773, 789, 790, 784, 1146, 1146, 784, 773, 1308,
- 791, 790, 1439, 787, 788, 915, 787, 788, 791, 789,
- 773, 915, 789, 916, 916, 792, 796, 1390, 790, 784,
- 1403, 790, 788, 792, 796, 791, 1358, 790, 791, 787,
- 1146, 1260, 1401, 789, 1390, 1263, 916, 1403, 1401, 941,
-
- 792, 796, 916, 792, 796, 1197, 791, 941, 1358, 792,
- 813, 813, 813, 813, 813, 813, 813, 815, 815, 815,
- 815, 815, 815, 815, 941, 796, 811, 941, 811, 951,
- 1197, 811, 811, 1437, 1466, 1197, 811, 951, 811, 941,
- 811, 811, 811, 832, 832, 832, 832, 832, 832, 832,
- 811, 811, 811, 830, 951, 830, 1466, 951, 830, 830,
- 830, 830, 830, 830, 830, 833, 833, 833, 833, 833,
- 833, 833, 835, 835, 835, 835, 835, 835, 835, 951,
- 1391, 1076, 1427, 1076, 811, 1474, 811, 814, 1230, 814,
- 955, 1474, 814, 814, 1399, 1391, 1416, 814, 955, 814,
-
- 1076, 814, 814, 814, 814, 814, 814, 814, 814, 1399,
- 1230, 814, 814, 814, 1400, 955, 1230, 1076, 955, 814,
- 814, 814, 814, 814, 814, 1410, 955, 964, 964, 1400,
- 814, 836, 836, 836, 836, 836, 836, 836, 841, 841,
- 841, 841, 841, 841, 841, 814, 1458, 814, 816, 1482,
- 964, 816, 1479, 1482, 1458, 1471, 964, 816, 816, 816,
- 816, 816, 816, 816, 840, 1471, 840, 840, 840, 840,
- 840, 840, 840, 846, 1479, 846, 846, 846, 846, 846,
- 846, 846, 847, 847, 847, 847, 847, 847, 847, 852,
- 1496, 852, 852, 852, 852, 852, 852, 852, 1496, 1486,
-
- 816, 839, 853, 853, 853, 853, 853, 853, 853, 1236,
- 1488, 839, 1486, 839, 839, 1488, 839, 839, 839, 839,
- 839, 839, 839, 842, 858, 858, 858, 858, 858, 858,
- 858, 1236, 968, 968, 971, 971, 842, 1236, 842, 842,
- 842, 842, 842, 842, 842, 864, 959, 864, 864, 864,
- 864, 864, 864, 864, 959, 968, 842, 971, 1292, 842,
- 1292, 968, 864, 971, 963, 963, 842, 1544, 1292, 1544,
- 1292, 959, 963, 842, 959, 870, 1149, 870, 842, 843,
- 870, 870, 870, 870, 870, 870, 870, 963, 1555, 963,
- 1555, 1377, 843, 963, 843, 843, 843, 843, 843, 843,
-
- 843, 865, 865, 865, 865, 865, 865, 865, 872, 872,
- 872, 872, 872, 872, 872, 843, 865, 873, 1389, 1149,
- 1538, 1487, 843, 1376, 1468, 1538, 1149, 1487, 1389, 843,
- 845, 1389, 873, 873, 873, 873, 873, 873, 873, 1468,
- 845, 1154, 845, 845, 1304, 845, 845, 845, 845, 845,
- 845, 845, 848, 918, 918, 918, 918, 918, 918, 918,
- 1304, 1304, 1077, 1375, 1077, 848, 1545, 848, 848, 848,
- 848, 848, 848, 848, 919, 919, 919, 919, 919, 919,
- 919, 1077, 1470, 1472, 1154, 848, 1295, 1545, 848, 1077,
- 1374, 1154, 972, 966, 966, 848, 1295, 1470, 1472, 1600,
-
- 972, 966, 848, 1295, 921, 1159, 921, 848, 849, 921,
- 921, 921, 921, 921, 921, 921, 966, 972, 966, 1600,
- 972, 849, 966, 849, 849, 849, 849, 849, 849, 849,
- 923, 923, 923, 923, 923, 923, 923, 924, 924, 924,
- 924, 924, 924, 924, 849, 952, 1478, 1484, 1159, 1540,
- 1590, 849, 1590, 952, 1540, 1159, 1478, 1484, 849, 851,
- 960, 943, 943, 943, 943, 943, 943, 943, 960, 851,
- 952, 851, 851, 952, 851, 851, 851, 851, 851, 851,
- 851, 854, 943, 1491, 1373, 960, 1199, 1602, 960, 1082,
- 1082, 1027, 960, 1491, 854, 952, 854, 854, 854, 854,
-
- 854, 854, 854, 1602, 929, 929, 929, 929, 929, 929,
- 929, 1199, 1082, 1027, 854, 1537, 1199, 854, 1082, 929,
- 1539, 953, 1542, 1589, 854, 929, 1027, 1542, 1537, 953,
- 1027, 854, 1075, 1539, 1075, 1027, 854, 855, 944, 944,
- 944, 944, 944, 944, 944, 1589, 953, 1084, 1084, 953,
- 855, 1075, 855, 855, 855, 855, 855, 855, 855, 944,
- 930, 930, 930, 930, 930, 930, 930, 953, 1305, 1372,
- 1084, 954, 1543, 855, 1075, 930, 1084, 1543, 1305, 954,
- 855, 930, 1476, 1371, 946, 1305, 946, 855, 857, 946,
- 946, 946, 946, 946, 946, 946, 954, 1476, 857, 954,
-
- 857, 1556, 1370, 857, 857, 857, 857, 857, 857, 857,
- 857, 954, 935, 1546, 935, 935, 935, 935, 935, 935,
- 935, 1546, 1556, 857, 1296, 1369, 1402, 857, 859, 935,
- 859, 859, 1368, 859, 859, 859, 1402, 1296, 859, 1402,
- 859, 1296, 859, 859, 859, 859, 859, 859, 859, 859,
- 859, 1245, 859, 859, 859, 1120, 1120, 1306, 1081, 1081,
- 859, 859, 859, 859, 859, 859, 1081, 859, 859, 1367,
- 1306, 859, 859, 1245, 1306, 859, 1547, 859, 1120, 1245,
- 1549, 1081, 1547, 859, 1120, 1549, 859, 1081, 859, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
-
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 1366, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 861, 861, 861, 861, 861, 861, 861, 861, 861,
- 861, 866, 1490, 866, 866, 866, 866, 866, 866, 866,
- 936, 936, 936, 936, 936, 936, 936, 1302, 866, 1302,
- 1596, 866, 1541, 1552, 866, 936, 1481, 1302, 1490, 1302,
- 1365, 866, 984, 984, 984, 984, 984, 984, 984, 1541,
- 1552, 1481, 1596, 866, 868, 868, 868, 868, 868, 868,
-
- 868, 868, 868, 868, 868, 868, 868, 868, 868, 868,
- 868, 868, 868, 868, 868, 868, 868, 868, 868, 868,
- 868, 868, 868, 1350, 868, 868, 868, 868, 868, 868,
- 868, 868, 868, 868, 868, 868, 868, 868, 868, 868,
- 868, 868, 868, 868, 868, 868, 868, 868, 868, 868,
- 868, 868, 868, 868, 868, 868, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
-
- 869, 869, 869, 869, 869, 869, 869, 869, 869, 869,
- 869, 869, 869, 869, 869, 869, 869, 869, 875, 1483,
- 875, 1485, 1548, 875, 875, 958, 875, 1550, 875, 961,
- 875, 962, 875, 958, 1483, 1548, 1485, 961, 1339, 962,
- 1550, 1622, 875, 875, 875, 1489, 875, 1062, 1062, 1062,
- 958, 1062, 1062, 958, 961, 875, 962, 961, 1062, 962,
- 1489, 1622, 1062, 1062, 1312, 958, 994, 994, 994, 994,
- 994, 994, 994, 1312, 961, 1312, 875, 1321, 875, 876,
- 1319, 876, 962, 1551, 876, 876, 1151, 876, 1551, 876,
- 1646, 876, 1312, 876, 995, 995, 995, 995, 995, 995,
-
- 995, 1151, 1151, 876, 876, 876, 1003, 876, 1003, 1123,
- 1123, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1013, 1234,
- 1013, 1646, 1614, 1013, 1013, 1013, 1013, 1013, 1013, 1013,
- 1156, 876, 1123, 1234, 1234, 1314, 1151, 876, 1123, 876,
- 903, 1234, 903, 1553, 1614, 1156, 1156, 1234, 1553, 1022,
- 903, 1022, 903, 1326, 1022, 1022, 1022, 1022, 1022, 1022,
- 1022, 1290, 1557, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
- 1557, 1624, 903, 903, 903, 1326, 903, 903, 1031, 1558,
- 1156, 1326, 1289, 903, 1031, 1558, 1624, 903, 903, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
-
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 906, 906, 906, 906, 906, 906, 906, 906, 906,
- 906, 928, 1110, 928, 928, 928, 928, 928, 928, 928,
- 1110, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 928, 1122,
- 1554, 1592, 1591, 1592, 928, 1554, 1032, 1110, 1591, 1288,
- 1110, 928, 1032, 1038, 1038, 1038, 1038, 1038, 1038, 1038,
- 1594, 1122, 1594, 928, 932, 1287, 932, 1122, 1038, 932,
-
- 932, 932, 932, 932, 932, 932, 1043, 1043, 1043, 1043,
- 1043, 1043, 1043, 1122, 932, 934, 934, 934, 934, 934,
- 934, 934, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1286,
- 934, 1102, 934, 934, 934, 934, 934, 934, 937, 1102,
- 937, 937, 937, 937, 937, 937, 937, 1087, 1087, 1087,
- 1087, 1087, 1087, 1087, 1044, 937, 1102, 1598, 937, 1102,
- 1597, 937, 1597, 1598, 1599, 1285, 1599, 1102, 937, 1044,
- 1044, 1044, 1044, 1044, 1044, 1044, 1601, 1284, 1601, 1283,
- 937, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
-
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 939, 939, 939, 939, 939, 939, 939, 939,
- 939, 939, 939, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
- 940, 940, 940, 940, 940, 940, 940, 940, 940, 940,
-
- 940, 940, 940, 940, 940, 956, 1083, 1083, 1112, 1134,
- 1134, 1205, 1205, 956, 1083, 956, 1112, 956, 956, 1205,
- 956, 956, 956, 956, 956, 956, 956, 1282, 1281, 1083,
- 956, 957, 1134, 1112, 1205, 1083, 1112, 1610, 1134, 957,
- 1205, 957, 1112, 957, 957, 1610, 957, 957, 957, 957,
- 957, 957, 957, 1280, 1278, 1277, 957, 969, 969, 969,
- 969, 969, 969, 969, 969, 969, 969, 969, 969, 969,
- 969, 969, 969, 969, 969, 969, 969, 969, 969, 969,
- 969, 969, 969, 969, 969, 969, 969, 969, 969, 969,
- 969, 969, 969, 969, 969, 969, 969, 969, 969, 969,
-
- 969, 969, 969, 969, 969, 969, 969, 969, 969, 969,
- 969, 969, 969, 969, 969, 969, 969, 969, 969, 985,
- 1623, 985, 1625, 1686, 985, 985, 1623, 1276, 1405, 985,
- 1275, 985, 1686, 985, 985, 985, 985, 985, 985, 985,
- 985, 1270, 1625, 985, 985, 985, 1037, 1244, 1037, 1037,
- 1037, 1037, 1037, 1037, 1037, 1091, 1091, 1091, 1091, 1091,
- 1091, 1091, 1405, 1037, 1118, 1118, 1627, 1626, 1405, 1244,
- 1091, 1405, 1118, 1626, 1244, 1244, 1244, 985, 1405, 985,
- 986, 1627, 986, 1264, 1254, 986, 986, 1118, 1253, 1118,
- 986, 1252, 986, 1118, 986, 1092, 1092, 1092, 1092, 1092,
-
- 1092, 1092, 1206, 1206, 986, 986, 986, 1208, 1208, 1231,
- 1092, 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1096, 1096,
- 1096, 1096, 1096, 1096, 1096, 1206, 1095, 1299, 1216, 1299,
- 1208, 1206, 1095, 1096, 1211, 1204, 1208, 1299, 986, 1096,
- 986, 998, 1103, 1299, 1103, 1196, 1194, 1103, 1103, 1103,
- 1103, 1103, 1103, 1103, 998, 1193, 998, 998, 998, 998,
- 998, 998, 998, 1105, 1105, 1105, 1105, 1105, 1105, 1105,
- 1106, 1106, 1106, 1106, 1106, 1106, 1106, 998, 1111, 1221,
- 1115, 1192, 1191, 1309, 998, 1309, 1111, 1221, 1115, 1190,
- 1189, 998, 1188, 1309, 1114, 1187, 998, 1008, 1186, 1309,
-
- 1185, 1116, 1114, 1111, 1221, 1115, 1111, 1221, 1115, 1116,
- 1008, 1184, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1114,
- 1248, 1248, 1114, 1115, 1183, 1221, 1116, 1111, 1114, 1116,
- 1217, 1133, 1133, 1008, 1207, 1207, 1411, 1202, 1217, 1133,
- 1008, 1116, 1207, 1248, 1411, 1698, 1202, 1008, 1202, 1248,
- 1698, 1698, 1008, 1017, 1133, 1217, 1133, 1207, 1217, 1182,
- 1133, 1411, 1181, 1207, 1411, 1202, 1017, 1203, 1017, 1017,
- 1017, 1017, 1017, 1017, 1017, 1145, 1203, 1145, 1203, 1217,
- 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1705, 1202, 1017,
- 1407, 1180, 1705, 1705, 1179, 1203, 1017, 1174, 1141, 1407,
-
- 1709, 1407, 1203, 1017, 1140, 1709, 1709, 1139, 1017, 1028,
- 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1138, 1407, 1028,
- 1137, 1028, 1028, 1136, 1028, 1028, 1028, 1028, 1028, 1028,
- 1028, 1029, 1135, 1029, 1029, 1407, 1029, 1029, 1029, 1109,
- 1108, 1029, 1107, 1029, 1099, 1029, 1152, 1152, 1152, 1152,
- 1152, 1152, 1152, 1029, 1080, 1029, 1029, 1029, 1157, 1157,
- 1157, 1157, 1157, 1157, 1157, 1070, 1029, 1148, 1726, 1068,
- 1029, 1029, 1067, 1726, 1726, 1029, 1063, 1060, 1029, 1059,
- 1029, 1058, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1029,
- 1053, 1029, 1030, 1048, 1030, 1030, 1030, 1030, 1030, 1030,
-
- 1030, 1166, 1166, 1166, 1166, 1166, 1166, 1166, 1250, 1030,
- 1251, 1251, 1045, 1035, 997, 1030, 1166, 1148, 1150, 983,
- 1150, 982, 1030, 1150, 1150, 1150, 1150, 1150, 1150, 1150,
- 1250, 981, 980, 1251, 1030, 1034, 1250, 1034, 979, 1251,
- 1034, 1034, 1034, 1034, 1034, 1034, 1034, 978, 1153, 977,
- 976, 975, 1250, 974, 973, 1034, 1036, 1036, 1036, 1036,
- 1036, 1036, 1036, 1153, 1153, 1153, 1153, 1153, 1153, 1153,
- 950, 1036, 1320, 1036, 1036, 1036, 1036, 1036, 1036, 1039,
- 1320, 1039, 1039, 1039, 1039, 1039, 1039, 1039, 1167, 1167,
- 1167, 1167, 1167, 1167, 1167, 949, 1039, 1320, 1153, 1039,
-
- 1320, 933, 1039, 1167, 927, 1155, 926, 1155, 925, 1039,
- 1155, 1155, 1155, 1155, 1155, 1155, 1155, 1320, 917, 913,
- 904, 1039, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041,
- 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
-
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042,
- 1042, 1042, 1042, 1042, 1042, 1042, 1046, 1158, 1046, 901,
- 900, 1046, 1046, 899, 1046, 898, 1046, 897, 1046, 896,
- 1046, 1265, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 895,
- 1046, 1046, 1046, 1161, 1046, 1161, 1161, 1161, 1161, 1161,
- 1161, 1161, 894, 1265, 860, 834, 1046, 1170, 1170, 1170,
- 1170, 1170, 1170, 1170, 1733, 809, 808, 1158, 807, 1733,
-
- 1733, 806, 1170, 805, 1046, 1265, 1046, 1047, 1170, 1047,
- 804, 1265, 1047, 1047, 1266, 1047, 803, 1047, 802, 1047,
- 801, 1047, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 800,
- 799, 1047, 1047, 1047, 1345, 1047, 1266, 1171, 1324, 797,
- 1316, 1316, 775, 1171, 1209, 1209, 1209, 1209, 1209, 1209,
- 1209, 761, 1324, 1324, 760, 759, 1345, 1047, 1266, 1209,
- 1324, 758, 1345, 1316, 1266, 1047, 1324, 1047, 1061, 1316,
- 1061, 1210, 1210, 1210, 1210, 1210, 1210, 1210, 1061, 750,
- 1061, 745, 743, 742, 741, 1334, 1210, 732, 1214, 1214,
- 1214, 1214, 1214, 1214, 1214, 729, 728, 727, 726, 725,
-
- 1061, 1061, 1061, 1214, 1061, 1061, 724, 1334, 723, 722,
- 721, 1061, 1334, 1334, 1334, 1061, 1061, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073,
- 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1078,
- 1218, 1218, 1218, 1218, 1218, 1218, 1218, 1078, 720, 1078,
- 719, 1078, 1078, 714, 1078, 1078, 1078, 1078, 1078, 1078,
-
- 1078, 1079, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1079,
- 693, 1079, 687, 1079, 1079, 683, 1079, 1079, 1079, 1079,
- 1079, 1079, 1079, 1089, 676, 1089, 674, 653, 1089, 1089,
- 1089, 1089, 1089, 1089, 1089, 652, 1215, 1215, 1215, 1215,
- 1215, 1215, 1215, 1089, 1093, 1093, 1093, 1093, 1093, 1093,
- 1093, 1215, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1093,
- 1348, 1093, 1093, 1093, 1093, 1093, 1093, 626, 624, 623,
- 1361, 1336, 1093, 1094, 622, 1094, 1094, 1094, 1094, 1094,
- 1094, 1094, 1348, 1246, 1246, 1336, 1336, 1348, 1348, 1348,
- 1094, 1246, 1361, 1336, 621, 1742, 1094, 616, 1361, 1336,
-
- 1742, 1742, 615, 1094, 1748, 612, 1246, 607, 1246, 1748,
- 1748, 606, 1246, 603, 1755, 1094, 1098, 601, 1098, 1755,
- 1755, 1098, 1098, 1098, 1098, 1098, 1098, 1098, 1258, 1258,
- 1258, 1258, 1258, 1258, 1258, 600, 1098, 1100, 1100, 1100,
- 1100, 1100, 1100, 1100, 1261, 1261, 1261, 1261, 1261, 1261,
- 1261, 599, 1100, 598, 1100, 1100, 1100, 1100, 1100, 1100,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
-
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101,
- 1101, 1101, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
- 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
- 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
- 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
- 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
- 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121,
- 1121, 1121, 1121, 1121, 1124, 1124, 1124, 1124, 1124, 1124,
- 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
-
- 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
- 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
- 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
- 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124,
- 1124, 1124, 1124, 1124, 1124, 1124, 1126, 1315, 1315, 597,
- 1349, 1760, 596, 595, 594, 1315, 1760, 1760, 1126, 593,
- 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1256, 1126, 592,
- 1315, 591, 1349, 559, 1126, 1127, 1315, 1349, 1349, 1349,
- 1422, 557, 1256, 1256, 1256, 1256, 1256, 1256, 1256, 1127,
- 1127, 1127, 1127, 1127, 1127, 1127, 556, 1127, 555, 540,
-
- 1313, 539, 1422, 1127, 1128, 538, 537, 1432, 1422, 1313,
- 527, 1313, 512, 511, 508, 481, 1128, 1256, 1128, 1128,
- 1128, 1128, 1128, 1128, 1128, 1352, 1128, 1343, 1313, 1432,
- 470, 469, 1128, 468, 1313, 1432, 1128, 466, 460, 1128,
- 1313, 1343, 1343, 1313, 455, 415, 1128, 1352, 414, 1343,
- 1313, 1762, 1352, 1352, 1352, 1343, 1762, 1762, 1128, 1130,
- 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
- 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
- 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
- 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
-
- 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
- 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
- 1130, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
- 1131, 1131, 1131, 1160, 1763, 413, 412, 411, 405, 1763,
- 1763, 403, 1259, 1160, 401, 1160, 1160, 399, 1160, 1160,
-
- 1160, 1160, 1160, 1160, 1160, 1162, 391, 1259, 1259, 1259,
- 1259, 1259, 1259, 1259, 1262, 1362, 389, 1425, 1162, 388,
- 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1162, 1448, 1262,
- 1262, 1262, 1262, 1262, 1262, 1262, 384, 1362, 1162, 1425,
- 352, 1162, 1259, 351, 1425, 1425, 1425, 1764, 1162, 1162,
- 1448, 344, 1764, 1764, 343, 1162, 1448, 342, 1362, 1362,
- 1162, 1164, 341, 1164, 1262, 1362, 1164, 1164, 1164, 1164,
- 1164, 1164, 1164, 336, 1268, 1268, 1268, 1268, 1268, 1268,
- 1268, 1164, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1268,
- 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1168, 335, 1168,
-
- 1168, 1168, 1168, 1168, 1168, 1269, 334, 333, 1457, 1501,
- 1168, 1169, 332, 1169, 1169, 1169, 1169, 1169, 1169, 1169,
- 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1406, 1169, 324,
- 1457, 1501, 321, 319, 1169, 1273, 1406, 1501, 1406, 318,
- 317, 1169, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 316,
- 315, 314, 1457, 1169, 1173, 1406, 1173, 1274, 1457, 1173,
- 1173, 1173, 1173, 1173, 1173, 1173, 1406, 1317, 1317, 1317,
- 1317, 1317, 1317, 1317, 1173, 1175, 1175, 1175, 1175, 1175,
- 1175, 1175, 1317, 1765, 313, 312, 311, 310, 1765, 1765,
- 1175, 309, 1175, 1175, 1175, 1175, 1175, 1175, 1176, 1176,
-
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176,
- 1177, 307, 1177, 306, 302, 1177, 1177, 1514, 1177, 1526,
- 1177, 1351, 1177, 301, 1177, 1318, 1318, 1318, 1318, 1318,
- 1318, 1318, 300, 1409, 1177, 1177, 1177, 299, 1177, 1514,
- 1318, 1526, 1409, 1351, 1409, 1514, 1177, 1526, 1351, 1351,
-
- 1351, 1363, 1363, 1363, 1363, 1363, 1363, 1363, 1767, 298,
- 297, 1409, 295, 1767, 1767, 1351, 1363, 294, 1177, 1775,
- 1177, 1178, 1409, 1178, 1775, 1775, 1178, 1178, 1426, 1178,
- 293, 1178, 292, 1178, 291, 1178, 1364, 1364, 1364, 1364,
- 1364, 1364, 1364, 1408, 1413, 1178, 1178, 1178, 1420, 1178,
- 1426, 1364, 1408, 290, 1408, 1426, 1426, 1426, 1413, 1413,
- 289, 288, 1420, 1420, 1498, 1498, 1413, 287, 285, 1428,
- 1420, 1408, 1413, 1429, 284, 283, 1420, 1565, 282, 1178,
- 1800, 1178, 1198, 281, 1198, 1800, 1800, 1498, 280, 1408,
- 279, 1428, 1198, 1498, 1198, 1429, 1428, 1428, 1428, 1565,
-
- 1429, 1429, 1429, 1807, 278, 1565, 1434, 277, 1807, 1807,
- 1438, 276, 1198, 1428, 1198, 1198, 1198, 275, 1198, 1198,
- 1434, 1434, 1440, 1564, 1564, 1198, 1441, 274, 1434, 1198,
- 1198, 1200, 1438, 1200, 1434, 273, 269, 1438, 1438, 1438,
- 268, 1200, 263, 1200, 1440, 261, 1564, 1574, 1441, 1440,
- 1440, 1440, 1564, 1441, 1441, 1441, 259, 258, 257, 246,
- 243, 1200, 241, 1200, 1200, 1200, 1440, 1200, 1200, 1574,
- 1442, 1809, 238, 234, 1200, 1574, 1809, 1809, 1200, 1200,
- 1212, 1446, 1212, 1456, 212, 1212, 1212, 1212, 1212, 1212,
- 1212, 1212, 1442, 201, 200, 1446, 1446, 1442, 1442, 1442,
-
- 1212, 1224, 1811, 1446, 162, 1456, 1507, 1811, 1811, 1446,
- 1456, 1456, 1456, 1224, 1510, 1224, 1224, 1224, 1224, 1224,
- 1224, 1224, 156, 1224, 155, 148, 147, 146, 1507, 1224,
- 1225, 1497, 1497, 1507, 1507, 1507, 1510, 144, 142, 1497,
- 132, 1510, 1510, 1510, 1225, 1225, 1225, 1225, 1225, 1225,
- 1225, 130, 1225, 129, 1497, 127, 1497, 1835, 1225, 1226,
- 1497, 126, 1835, 1835, 122, 120, 1568, 1568, 1503, 119,
- 1511, 1226, 116, 1226, 1226, 1226, 1226, 1226, 1226, 1226,
- 1515, 1226, 1503, 1503, 1578, 110, 91, 1226, 90, 1568,
- 1503, 1226, 1511, 88, 1226, 1568, 1503, 1511, 1511, 1511,
-
- 78, 1226, 1515, 70, 69, 67, 1578, 1515, 1515, 1515,
- 57, 53, 1578, 1226, 1228, 1228, 1228, 1228, 1228, 1228,
- 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228,
- 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228,
- 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228,
- 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228,
- 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228,
- 1228, 1228, 1228, 1228, 1228, 1228, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
-
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
- 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1232, 36,
- 1509, 35, 33, 24, 23, 20, 17, 1571, 1571, 1517,
- 1617, 15, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1570,
- 1232, 0, 1509, 1517, 1517, 0, 1232, 1509, 1509, 1509,
- 1571, 1517, 1617, 1232, 1233, 0, 1571, 1517, 1617, 1529,
- 0, 1570, 0, 1524, 1509, 0, 0, 1570, 1233, 1233,
- 1233, 1233, 1233, 1233, 1233, 1620, 1233, 1524, 1524, 0,
-
- 0, 1529, 1233, 1570, 0, 1524, 1529, 1529, 1529, 1233,
- 1235, 1524, 0, 1530, 1608, 1608, 0, 1620, 0, 1235,
- 0, 1235, 1532, 1620, 1235, 1235, 1235, 1235, 1235, 1235,
- 1235, 0, 1235, 0, 0, 1530, 0, 1608, 1235, 1237,
- 1530, 1530, 1530, 1608, 1532, 0, 0, 0, 0, 1532,
- 1532, 1532, 0, 1237, 1237, 1237, 1237, 1237, 1237, 1237,
- 0, 1237, 0, 0, 0, 0, 1532, 1237, 0, 0,
- 1237, 1237, 1237, 1237, 1237, 1237, 1238, 0, 0, 1533,
- 0, 0, 0, 0, 0, 0, 0, 1575, 1238, 1636,
- 1238, 1238, 1238, 1238, 1238, 1238, 1238, 0, 1238, 0,
-
- 0, 1533, 0, 0, 1238, 1239, 1533, 1533, 1533, 1575,
- 0, 1636, 0, 0, 1575, 1575, 1575, 1636, 0, 1239,
- 1239, 1239, 1239, 1239, 1239, 1239, 0, 1239, 1657, 0,
- 1669, 0, 0, 1239, 1240, 0, 1240, 1240, 1240, 1240,
- 1240, 1240, 1240, 1563, 1563, 1566, 1566, 1580, 0, 0,
- 1657, 1563, 1669, 1566, 1240, 0, 1657, 1240, 1669, 0,
- 0, 1580, 1580, 0, 1240, 1584, 1563, 0, 1566, 1580,
- 1566, 0, 1563, 1684, 1566, 1580, 1240, 1241, 0, 1241,
- 1241, 1241, 1241, 1241, 1241, 1241, 1587, 1584, 0, 1588,
- 0, 0, 1584, 1584, 1584, 1684, 0, 1241, 0, 0,
-
- 1241, 1684, 0, 0, 0, 0, 0, 1241, 1587, 0,
- 0, 1588, 0, 1587, 1587, 1587, 1588, 1588, 1588, 1241,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
- 1242, 1242, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
- 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
-
- 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
- 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
- 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
- 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249,
- 1249, 1249, 1249, 1249, 1271, 1586, 1271, 0, 0, 1271,
- 1271, 1271, 1271, 1271, 1271, 1271, 0, 0, 0, 0,
- 0, 0, 0, 0, 1271, 1322, 0, 1586, 1607, 1607,
- 0, 0, 1586, 1586, 1586, 0, 1607, 1621, 0, 1322,
- 1322, 1322, 1322, 1322, 1322, 1322, 0, 1322, 0, 1586,
- 0, 1607, 0, 1322, 0, 0, 0, 1607, 0, 1621,
-
- 1322, 1323, 0, 0, 1621, 1621, 1621, 0, 0, 0,
- 1634, 0, 1644, 0, 0, 1323, 1323, 1323, 1323, 1323,
- 1323, 1323, 0, 1323, 1634, 1634, 0, 0, 0, 1323,
- 0, 0, 1634, 0, 1644, 0, 1323, 1325, 1634, 1644,
- 1644, 1644, 0, 0, 0, 1660, 1325, 1648, 1325, 1655,
- 0, 1325, 1325, 1325, 1325, 1325, 1325, 1325, 0, 1325,
- 0, 1648, 1648, 1655, 1655, 1325, 1327, 1660, 0, 1648,
- 0, 1655, 1660, 1660, 1660, 1648, 0, 1655, 0, 0,
- 1327, 1327, 1327, 1327, 1327, 1327, 1327, 0, 1327, 0,
- 0, 0, 0, 0, 1327, 0, 0, 1327, 1327, 1327,
-
- 1327, 1327, 1327, 1328, 0, 0, 1661, 0, 0, 0,
- 0, 0, 0, 0, 1663, 1328, 0, 1328, 1328, 1328,
- 1328, 1328, 1328, 1328, 0, 1328, 0, 0, 1661, 0,
- 0, 1328, 1329, 1661, 1661, 1661, 1663, 0, 0, 0,
- 0, 1663, 1663, 1663, 0, 0, 1329, 1329, 1329, 1329,
- 1329, 1329, 1329, 0, 1329, 0, 0, 1671, 1663, 0,
- 1329, 1330, 0, 1330, 1330, 1330, 1330, 1330, 1330, 1330,
- 1664, 1671, 1671, 1675, 0, 0, 0, 0, 0, 1671,
- 0, 1330, 0, 0, 1330, 1671, 0, 0, 0, 0,
- 0, 1330, 1664, 1677, 0, 1675, 0, 1664, 1664, 1664,
-
- 1675, 1675, 1675, 1330, 1331, 0, 1331, 1331, 1331, 1331,
- 1331, 1331, 1331, 1678, 0, 1677, 1679, 0, 0, 0,
- 1677, 1677, 1677, 0, 1331, 0, 0, 1331, 0, 0,
- 0, 0, 0, 0, 1331, 1678, 0, 1677, 1679, 0,
- 1678, 1678, 1678, 1679, 1679, 1679, 1331, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
-
- 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1335,
- 0, 0, 1685, 0, 0, 0, 0, 0, 1335, 0,
- 1335, 0, 0, 1335, 1335, 1335, 1335, 1335, 1335, 1335,
- 0, 1335, 0, 0, 1685, 0, 0, 1335, 1337, 1685,
- 1685, 1685, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 0,
- 1337, 0, 0, 0, 0, 0, 1337, 1338, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 0, 1338,
- 0, 0, 0, 0, 0, 1338, 1340, 0, 1340, 1340,
-
- 1340, 1340, 1340, 1340, 1340, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1340, 0, 0, 1340,
- 0, 0, 0, 0, 0, 0, 1340, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1340, 1341,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1341, 1341, 1341, 1341, 1341, 1341, 1341,
- 0, 1341, 0, 0, 0, 0, 0, 1341, 0, 0,
- 0, 0, 0, 0, 1341, 1342, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1342,
- 1342, 1342, 1342, 1342, 1342, 1342, 0, 1342, 0, 0,
-
- 0, 0, 0, 1342, 0, 0, 0, 0, 0, 0,
- 1342, 1344, 0, 0, 0, 0, 0, 0, 0, 0,
- 1344, 0, 1344, 0, 0, 1344, 1344, 1344, 1344, 1344,
- 1344, 1344, 0, 1344, 0, 0, 0, 0, 0, 1344,
- 1346, 1346, 1346, 1346, 1346, 1346, 1346, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1346, 1346, 1346,
- 1346, 1346, 1346, 1355, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1355, 0, 1355, 1355, 1355,
- 1355, 1355, 1355, 1355, 0, 1355, 0, 0, 0, 0,
- 0, 1355, 1356, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 1356, 1356, 1356, 1356,
- 1356, 1356, 1356, 0, 1356, 0, 0, 0, 0, 0,
- 1356, 1357, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1357, 0, 1357, 1357, 1357, 1357, 1357,
- 1357, 1357, 0, 1357, 0, 0, 0, 0, 0, 1357,
- 0, 0, 0, 1357, 0, 0, 1357, 0, 0, 0,
- 0, 0, 0, 1357, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1357, 1359, 1359, 1359, 1359,
- 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359,
- 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359,
-
- 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359,
- 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359,
- 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359,
- 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
- 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360,
-
- 1412, 0, 0, 0, 0, 0, 0, 0, 0, 1412,
- 0, 1412, 0, 0, 1412, 1412, 1412, 1412, 1412, 1412,
- 1412, 0, 1412, 0, 0, 0, 0, 0, 1412, 1414,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1414, 1414, 1414, 1414, 1414, 1414, 1414,
- 0, 1414, 0, 0, 0, 0, 0, 1414, 1415, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1415, 1415, 1415, 1415, 1415, 1415, 1415, 0,
- 1415, 0, 0, 0, 0, 0, 1415, 1417, 0, 1417,
- 1417, 1417, 1417, 1417, 1417, 1417, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 1417, 0, 0,
- 1417, 0, 0, 0, 0, 0, 0, 1417, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1417,
- 1418, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1418, 1418, 1418, 1418, 1418, 1418,
- 1418, 0, 1418, 0, 0, 0, 0, 0, 1418, 0,
- 0, 0, 0, 0, 0, 1418, 1419, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1419, 1419, 1419, 1419, 1419, 1419, 1419, 0, 1419, 0,
- 0, 0, 0, 0, 1419, 0, 0, 0, 0, 0,
-
- 0, 1419, 1421, 0, 0, 0, 0, 0, 0, 0,
- 0, 1421, 0, 1421, 0, 0, 1421, 1421, 1421, 1421,
- 1421, 1421, 1421, 0, 1421, 0, 0, 0, 0, 0,
- 1421, 1423, 1423, 1423, 1423, 1423, 1423, 1423, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1423, 1423,
- 1423, 1423, 1423, 1423, 1430, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1430, 1430,
- 1430, 1430, 1430, 1430, 1430, 0, 1430, 0, 0, 0,
- 0, 0, 1430, 1431, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1431, 1431, 1431,
-
- 1431, 1431, 1431, 1431, 0, 1431, 0, 0, 0, 0,
- 0, 1431, 1433, 0, 0, 0, 0, 0, 0, 0,
- 0, 1433, 0, 1433, 0, 0, 1433, 1433, 1433, 1433,
- 1433, 1433, 1433, 0, 1433, 0, 0, 0, 0, 0,
- 1433, 1435, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1435, 1435, 1435, 1435, 1435,
- 1435, 1435, 0, 1435, 0, 0, 0, 0, 0, 1435,
- 1436, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1436, 1436, 1436, 1436, 1436, 1436,
- 1436, 0, 1436, 0, 0, 0, 0, 0, 1436, 1444,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1444, 1444, 1444, 1444, 1444, 1444, 1444,
- 0, 1444, 0, 0, 0, 0, 0, 1444, 0, 0,
- 0, 0, 0, 0, 1444, 1445, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1445,
- 1445, 1445, 1445, 1445, 1445, 1445, 0, 1445, 0, 0,
- 0, 0, 0, 1445, 0, 0, 0, 0, 0, 0,
- 1445, 1447, 0, 0, 0, 0, 0, 0, 0, 0,
- 1447, 0, 1447, 0, 0, 1447, 1447, 1447, 1447, 1447,
- 1447, 1447, 0, 1447, 0, 0, 0, 0, 0, 1447,
-
- 1449, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1449, 1449, 1449, 1449, 1449, 1449,
- 1449, 0, 1449, 0, 0, 0, 0, 0, 1449, 0,
- 0, 1449, 1449, 1449, 1449, 1449, 1449, 1450, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1450,
- 0, 1450, 1450, 1450, 1450, 1450, 1450, 1450, 0, 1450,
- 0, 0, 0, 0, 0, 1450, 1451, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1451, 1451, 1451, 1451, 1451, 1451, 1451, 0, 1451, 0,
- 0, 0, 0, 0, 1451, 1452, 0, 1452, 1452, 1452,
-
- 1452, 1452, 1452, 1452, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1452, 0, 0, 1452, 0,
- 0, 0, 0, 0, 0, 1452, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1452, 1453, 0,
- 1453, 1453, 1453, 1453, 1453, 1453, 1453, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1453, 0,
- 0, 1453, 0, 0, 0, 0, 0, 0, 1453, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1453, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
-
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454,
- 1454, 1454, 1454, 1499, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1499, 1499, 1499,
- 1499, 1499, 1499, 1499, 0, 1499, 0, 0, 0, 0,
- 0, 1499, 1500, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1500, 1500, 1500, 1500,
- 1500, 1500, 1500, 0, 1500, 0, 0, 0, 0, 0,
-
- 1500, 1502, 0, 0, 0, 0, 0, 0, 0, 0,
- 1502, 0, 1502, 0, 0, 1502, 1502, 1502, 1502, 1502,
- 1502, 1502, 0, 1502, 0, 0, 0, 0, 0, 1502,
- 1504, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1504, 1504, 1504, 1504, 1504, 1504,
- 1504, 0, 1504, 0, 0, 0, 0, 0, 1504, 1505,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1505, 1505, 1505, 1505, 1505, 1505, 1505,
- 0, 1505, 0, 0, 0, 0, 0, 1505, 1512, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 1512, 1512, 1512, 1512, 1512, 1512, 1512, 0,
- 1512, 0, 0, 0, 0, 0, 1512, 1513, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1513, 1513, 1513, 1513, 1513, 1513, 1513, 0, 1513,
- 0, 0, 0, 0, 0, 1513, 1516, 0, 0, 0,
- 0, 0, 0, 0, 0, 1516, 0, 1516, 0, 0,
- 1516, 1516, 1516, 1516, 1516, 1516, 1516, 0, 1516, 0,
- 0, 0, 0, 0, 1516, 1518, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1518,
- 1518, 1518, 1518, 1518, 1518, 1518, 0, 1518, 0, 0,
-
- 0, 0, 0, 1518, 1519, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1519, 1519,
- 1519, 1519, 1519, 1519, 1519, 0, 1519, 0, 0, 0,
- 0, 0, 1519, 1521, 0, 1521, 1521, 1521, 1521, 1521,
- 1521, 1521, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1521, 0, 0, 1521, 0, 0, 0,
- 0, 0, 0, 1521, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1521, 1522, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1522, 1522, 1522, 1522, 1522, 1522, 1522, 0, 1522, 0,
-
- 0, 0, 0, 0, 1522, 0, 0, 0, 0, 0,
- 0, 1522, 1523, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1523, 1523, 1523, 1523,
- 1523, 1523, 1523, 0, 1523, 0, 0, 0, 0, 0,
- 1523, 0, 0, 0, 0, 0, 0, 1523, 1525, 0,
- 0, 0, 0, 0, 0, 0, 0, 1525, 0, 1525,
- 0, 0, 1525, 1525, 1525, 1525, 1525, 1525, 1525, 0,
- 1525, 0, 0, 0, 0, 0, 1525, 1527, 1527, 1527,
- 1527, 1527, 1527, 1527, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1527, 1527, 1527, 1527, 1527, 1527,
-
- 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569,
- 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569,
- 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569,
- 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569,
- 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569,
- 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569, 1569,
- 1569, 1569, 1572, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1572, 1572, 1572, 1572,
- 1572, 1572, 1572, 0, 1572, 0, 0, 0, 0, 0,
- 1572, 1573, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 1573, 1573, 1573, 1573, 1573,
- 1573, 1573, 0, 1573, 0, 0, 0, 0, 0, 1573,
- 1576, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1576, 1576, 1576, 1576, 1576, 1576,
- 1576, 0, 1576, 0, 0, 0, 0, 0, 1576, 1577,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1577, 1577, 1577, 1577, 1577, 1577, 1577,
- 0, 1577, 0, 0, 0, 0, 0, 1577, 1579, 0,
- 0, 0, 0, 0, 0, 0, 0, 1579, 0, 1579,
- 0, 0, 1579, 1579, 1579, 1579, 1579, 1579, 1579, 0,
-
- 1579, 0, 0, 0, 0, 0, 1579, 1581, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1581, 1581, 1581, 1581, 1581, 1581, 1581, 0, 1581,
- 0, 0, 0, 0, 0, 1581, 1582, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1582, 1582, 1582, 1582, 1582, 1582, 1582, 0, 1582, 0,
- 0, 0, 0, 0, 1582, 1611, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1611, 0, 1611,
- 1611, 1611, 1611, 1611, 1611, 1611, 0, 1611, 0, 0,
- 0, 0, 0, 1611, 1612, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 1612, 1612,
- 1612, 1612, 1612, 1612, 1612, 0, 1612, 0, 0, 0,
- 0, 0, 1612, 1613, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1613, 0, 1613, 1613, 1613,
- 1613, 1613, 1613, 1613, 0, 1613, 0, 0, 0, 0,
- 0, 1613, 0, 0, 0, 1613, 0, 0, 1613, 0,
- 0, 0, 0, 0, 0, 1613, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1613, 1615, 1615,
- 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615,
- 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615,
-
- 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615,
- 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615,
- 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615,
- 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615, 1615,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
- 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616,
-
- 1616, 1616, 1618, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1618, 1618, 1618, 1618,
- 1618, 1618, 1618, 0, 1618, 0, 0, 0, 0, 0,
- 1618, 1619, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1619, 1619, 1619, 1619, 1619,
- 1619, 1619, 0, 1619, 0, 0, 0, 0, 0, 1619,
- 1632, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1632, 1632, 1632, 1632, 1632, 1632,
- 1632, 0, 1632, 0, 0, 0, 0, 0, 1632, 0,
- 0, 0, 0, 0, 0, 1632, 1633, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1633, 1633, 1633, 1633, 1633, 1633, 1633, 0, 1633, 0,
- 0, 0, 0, 0, 1633, 0, 0, 0, 0, 0,
- 0, 1633, 1635, 0, 0, 0, 0, 0, 0, 0,
- 0, 1635, 0, 1635, 0, 0, 1635, 1635, 1635, 1635,
- 1635, 1635, 1635, 0, 1635, 0, 0, 0, 0, 0,
- 1635, 1637, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1637, 1637, 1637, 1637, 1637,
- 1637, 1637, 0, 1637, 0, 0, 0, 0, 0, 1637,
- 0, 0, 1637, 1637, 1637, 1637, 1637, 1637, 1638, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1638, 0, 1638, 1638, 1638, 1638, 1638, 1638, 1638, 0,
- 1638, 0, 0, 0, 0, 0, 1638, 1639, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1639, 1639, 1639, 1639, 1639, 1639, 1639, 0, 1639,
- 0, 0, 0, 0, 0, 1639, 1640, 0, 1640, 1640,
- 1640, 1640, 1640, 1640, 1640, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1640, 0, 0, 1640,
- 0, 0, 0, 0, 0, 0, 1640, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1640, 1641,
-
- 0, 1641, 1641, 1641, 1641, 1641, 1641, 1641, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1641,
- 0, 0, 1641, 0, 0, 0, 0, 0, 0, 1641,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1641, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
- 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642, 1642,
-
- 1642, 1642, 1642, 1642, 1647, 0, 0, 0, 0, 0,
- 0, 0, 0, 1647, 0, 1647, 0, 0, 1647, 1647,
- 1647, 1647, 1647, 1647, 1647, 0, 1647, 0, 0, 0,
- 0, 0, 1647, 1649, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1649, 1649, 1649,
- 1649, 1649, 1649, 1649, 0, 1649, 0, 0, 0, 0,
- 0, 1649, 1650, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1650, 1650, 1650, 1650,
- 1650, 1650, 1650, 0, 1650, 0, 0, 0, 0, 0,
- 1650, 1652, 0, 1652, 1652, 1652, 1652, 1652, 1652, 1652,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1652, 0, 0, 1652, 0, 0, 0, 0, 0,
- 0, 1652, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1652, 1653, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1653, 1653,
- 1653, 1653, 1653, 1653, 1653, 0, 1653, 0, 0, 0,
- 0, 0, 1653, 0, 0, 0, 0, 0, 0, 1653,
- 1654, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1654, 1654, 1654, 1654, 1654, 1654,
- 1654, 0, 1654, 0, 0, 0, 0, 0, 1654, 0,
-
- 0, 0, 0, 0, 0, 1654, 1656, 0, 0, 0,
- 0, 0, 0, 0, 0, 1656, 0, 1656, 0, 0,
- 1656, 1656, 1656, 1656, 1656, 1656, 1656, 0, 1656, 0,
- 0, 0, 0, 0, 1656, 1658, 1658, 1658, 1658, 1658,
- 1658, 1658, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1658, 1658, 1658, 1658, 1658, 1658, 1667, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 0,
- 1667, 0, 0, 0, 0, 0, 1667, 1668, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 1668, 1668, 1668, 1668, 1668, 1668, 1668, 0, 1668,
- 0, 0, 0, 0, 0, 1668, 1670, 0, 0, 0,
- 0, 0, 0, 0, 0, 1670, 0, 1670, 0, 0,
- 1670, 1670, 1670, 1670, 1670, 1670, 1670, 0, 1670, 0,
- 0, 0, 0, 0, 1670, 1672, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1672,
- 1672, 1672, 1672, 1672, 1672, 1672, 0, 1672, 0, 0,
- 0, 0, 0, 1672, 1673, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1673, 1673,
- 1673, 1673, 1673, 1673, 1673, 0, 1673, 0, 0, 0,
-
- 0, 0, 1673, 1682, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1682, 1682, 1682,
- 1682, 1682, 1682, 1682, 0, 1682, 0, 0, 0, 0,
- 0, 1682, 1683, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1683, 1683, 1683, 1683,
- 1683, 1683, 1683, 0, 1683, 0, 0, 0, 0, 0,
- 1683, 1688, 1688, 1688, 1688, 1688, 1688, 1688, 1688, 1688,
- 1688, 1688, 1688, 1688, 1688, 1688, 1688, 1688, 1688, 1688,
- 1688, 1688, 1688, 1688, 1688, 1689, 1689, 1689, 1689, 1689,
- 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689,
-
- 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1690,
- 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690,
- 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690,
- 1690, 1690, 1690, 1691, 1691, 1691, 1691, 1691, 1691, 1691,
- 1692, 1692, 1692, 1692, 0, 0, 1692, 1692, 1692, 1692,
- 1692, 1692, 1692, 1692, 0, 1692, 1693, 0, 0, 1693,
- 0, 0, 0, 0, 0, 0, 1693, 0, 1693, 1693,
- 1693, 1693, 1693, 1693, 1693, 1693, 1693, 0, 1693, 1694,
- 1694, 1694, 1694, 0, 0, 1694, 1694, 1694, 1694, 1694,
- 1694, 1694, 1694, 0, 1694, 1695, 0, 1695, 1695, 0,
-
- 1695, 0, 1695, 0, 1695, 1695, 0, 1695, 1695, 1695,
- 1695, 1695, 1695, 1695, 1695, 1695, 0, 1695, 1696, 0,
- 0, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 0,
- 1696, 1697, 0, 0, 0, 1697, 0, 0, 1697, 1697,
- 1697, 1697, 1697, 1697, 1697, 1697, 0, 1697, 1699, 1699,
- 0, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
- 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
- 1699, 1699, 1700, 0, 0, 1700, 0, 1700, 0, 1700,
- 1700, 0, 1700, 1700, 0, 0, 1700, 1700, 1700, 1700,
- 1700, 1700, 1700, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-
- 1701, 1701, 1701, 1701, 1701, 1701, 1701, 0, 1701, 1701,
- 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1702, 1702, 1702,
- 1702, 0, 0, 1702, 1702, 1702, 1702, 1702, 1702, 1702,
- 1702, 0, 1702, 1703, 0, 0, 1703, 1703, 1703, 1703,
- 1703, 1703, 1703, 1703, 0, 1703, 1704, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1704, 1704, 0, 0,
- 0, 0, 1704, 1706, 0, 0, 0, 0, 1706, 0,
- 1706, 0, 0, 1706, 1707, 0, 0, 0, 0, 1707,
- 0, 1707, 0, 0, 1707, 1708, 0, 0, 0, 0,
- 1708, 0, 1708, 0, 0, 1708, 1710, 1710, 1710, 1710,
-
- 0, 0, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710,
- 0, 1710, 1711, 1711, 0, 1711, 1711, 1711, 1711, 1711,
- 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711,
- 1711, 1711, 1711, 1711, 1711, 1711, 1712, 0, 1712, 1712,
- 0, 1712, 0, 1712, 0, 1712, 1712, 0, 1712, 1712,
- 1712, 1712, 1712, 1712, 1712, 1712, 1712, 0, 1712, 1713,
- 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713,
- 1713, 1713, 1713, 0, 1713, 1713, 1713, 1713, 1713, 1713,
- 1713, 1713, 1713, 1714, 0, 0, 0, 0, 0, 0,
- 1714, 0, 0, 1714, 1714, 1715, 0, 0, 1715, 1715,
-
- 1715, 1715, 1715, 1715, 1715, 1715, 0, 1715, 1716, 1716,
- 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- 1716, 1716, 0, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- 1716, 1716, 1717, 1717, 1717, 1717, 1717, 1717, 1717, 1718,
- 0, 0, 0, 1718, 0, 0, 1718, 1718, 1718, 1718,
- 1718, 1718, 1718, 1718, 0, 1718, 1719, 1719, 1719, 1719,
- 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
- 0, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
- 1720, 0, 0, 0, 0, 1720, 1720, 1720, 1721, 1721,
- 0, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721,
-
- 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721,
- 1721, 1721, 1722, 0, 1722, 1722, 0, 1722, 0, 0,
- 0, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1723, 0,
- 0, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 0,
- 1723, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724,
- 1724, 1724, 1724, 1724, 1724, 0, 1724, 1724, 1724, 1724,
- 1724, 1724, 1724, 1724, 1724, 1725, 0, 0, 1725, 0,
- 0, 0, 0, 0, 0, 1725, 0, 1725, 1725, 1725,
- 1725, 1725, 1725, 1725, 1725, 1725, 0, 1725, 1727, 1727,
- 1727, 1727, 0, 0, 1727, 1727, 1727, 1727, 1727, 1727,
-
- 1727, 1727, 0, 1727, 1728, 1728, 0, 1728, 1728, 1728,
- 1728, 1728, 1728, 1728, 1728, 1728, 1728, 1728, 1728, 1728,
- 1728, 1728, 1728, 1728, 1728, 1728, 1728, 1728, 1729, 0,
- 0, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 0,
- 1729, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730,
- 1730, 1730, 1730, 1730, 1730, 0, 1730, 1730, 1730, 1730,
- 1730, 1730, 1730, 1730, 1730, 1731, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1731, 1731, 0, 0, 0,
- 1731, 1731, 1731, 1732, 0, 1732, 0, 0, 0, 0,
- 0, 1732, 1732, 0, 0, 1732, 1734, 0, 0, 0,
-
- 0, 0, 0, 1734, 0, 0, 1734, 1734, 1735, 0,
- 0, 0, 0, 1735, 0, 1735, 0, 0, 1735, 1736,
- 0, 0, 0, 0, 1736, 0, 1736, 0, 0, 1736,
- 1737, 0, 0, 0, 0, 1737, 0, 1737, 0, 0,
- 1737, 1738, 1738, 0, 1738, 1738, 1738, 1738, 1738, 1738,
- 1738, 1738, 1738, 1738, 1738, 1738, 1738, 1738, 1738, 1738,
- 1738, 1738, 1738, 1738, 1738, 1739, 1739, 1739, 1739, 1739,
- 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 0,
- 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1740,
- 0, 0, 1740, 0, 1740, 0, 1740, 1740, 0, 1740,
-
- 1740, 0, 0, 1740, 1740, 1740, 1740, 1740, 1740, 1740,
- 1741, 0, 1741, 1741, 0, 1741, 0, 1741, 0, 1741,
- 1741, 0, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741,
- 1741, 0, 1741, 1743, 1743, 1743, 1743, 1743, 1743, 1743,
- 1743, 1743, 1743, 1743, 1743, 1743, 1743, 0, 1743, 1743,
- 1743, 1743, 1743, 1743, 1743, 1743, 1743, 1744, 0, 0,
- 0, 0, 0, 1744, 0, 0, 1744, 1744, 1744, 1744,
- 1744, 1744, 1744, 1744, 0, 1744, 1745, 1745, 1745, 1745,
- 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745,
- 0, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745,
-
- 1746, 0, 0, 0, 1746, 0, 0, 1746, 1746, 1746,
- 1746, 1746, 1746, 1746, 1746, 0, 1746, 1747, 0, 1747,
- 0, 0, 0, 0, 0, 1747, 1747, 0, 0, 1747,
- 1749, 0, 0, 1749, 1749, 1749, 1749, 1749, 1749, 1749,
- 1749, 0, 1749, 1750, 0, 0, 1750, 1750, 1750, 1750,
- 1750, 1750, 1750, 1750, 0, 1750, 1751, 1751, 1751, 1751,
- 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751,
- 0, 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751, 1751,
- 1752, 1752, 1752, 1752, 1752, 1752, 1752, 1752, 1752, 1752,
- 1752, 1752, 1752, 1752, 0, 1752, 1752, 1752, 1752, 1752,
-
- 1752, 1752, 1752, 1752, 1753, 0, 0, 1753, 0, 0,
- 0, 0, 0, 0, 1753, 0, 1753, 1753, 1753, 1753,
- 1753, 1753, 1753, 1753, 1753, 0, 1753, 1754, 0, 0,
- 1754, 0, 1754, 0, 1754, 1754, 0, 1754, 0, 1754,
- 0, 1754, 1754, 1754, 1754, 1754, 1754, 1754, 1756, 1756,
- 0, 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756,
- 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756, 1756,
- 1756, 1756, 1757, 1757, 1757, 1757, 1757, 1757, 1757, 1757,
- 1757, 1757, 1757, 1757, 1757, 1757, 0, 1757, 1757, 1757,
- 1757, 1757, 1757, 1757, 1757, 1757, 1758, 0, 0, 1758,
-
- 1758, 1758, 1758, 1758, 1758, 1758, 1758, 0, 1758, 1759,
- 0, 1759, 0, 0, 0, 0, 0, 1759, 1759, 0,
- 0, 1759, 1761, 0, 0, 0, 0, 1761, 1761, 1761,
- 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
- 1766, 1766, 1766, 1766, 0, 1766, 1766, 1766, 1766, 1766,
- 1766, 1766, 1766, 1766, 1768, 0, 1768, 1768, 0, 1768,
- 0, 1768, 0, 1768, 1768, 0, 1768, 1768, 1768, 1768,
- 1768, 1768, 1768, 1768, 1768, 0, 1768, 1769, 0, 0,
- 0, 0, 1769, 1769, 1769, 0, 0, 0, 1769, 1770,
- 0, 0, 0, 0, 0, 1770, 0, 0, 1770, 1770,
-
- 1770, 1770, 1770, 1770, 1770, 1770, 0, 1770, 1771, 1771,
- 1771, 1771, 1771, 1771, 1771, 1771, 1771, 1771, 1771, 1771,
- 1771, 1771, 0, 1771, 1771, 1771, 1771, 1771, 1771, 1771,
- 1771, 1771, 1772, 0, 1772, 0, 0, 0, 1772, 0,
- 0, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 0,
- 1772, 1773, 0, 0, 0, 0, 1773, 1773, 1773, 1774,
- 0, 1774, 0, 0, 0, 0, 0, 1774, 1774, 0,
- 0, 1774, 1776, 0, 0, 1776, 1776, 1776, 1776, 1776,
- 1776, 1776, 1776, 0, 1776, 1777, 1777, 1777, 1777, 1777,
- 1777, 1777, 1777, 1777, 1777, 1777, 1777, 1777, 1777, 0,
-
- 1777, 1777, 1777, 1777, 1777, 1777, 1777, 1777, 1777, 1778,
- 1778, 1778, 1778, 1778, 1778, 1778, 1778, 1778, 1778, 1778,
- 1778, 1778, 1778, 0, 1778, 1778, 1778, 1778, 1778, 1778,
- 1778, 1778, 1778, 1779, 1779, 1779, 1779, 1779, 1779, 1779,
- 1779, 1779, 1779, 1779, 1779, 1779, 1779, 0, 1779, 1779,
- 1779, 1779, 1779, 1779, 1779, 1779, 1779, 1780, 0, 0,
- 1780, 0, 0, 0, 0, 0, 0, 1780, 0, 1780,
- 1780, 1780, 1780, 1780, 1780, 1780, 1780, 1780, 0, 1780,
- 1781, 0, 0, 1781, 1781, 1781, 1781, 1781, 1781, 1781,
- 1781, 0, 1781, 1782, 1782, 1782, 1782, 1782, 1782, 1782,
-
- 1782, 1782, 1782, 1782, 1782, 1782, 1782, 1782, 1782, 1782,
- 1782, 1782, 1782, 1782, 1782, 1782, 1782, 1783, 0, 0,
- 1783, 1783, 1783, 1783, 1783, 1783, 1783, 1783, 0, 1783,
- 1784, 0, 0, 0, 0, 1784, 1784, 1784, 1785, 0,
- 0, 0, 0, 1785, 1785, 1785, 0, 0, 0, 1785,
- 1786, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1786, 1786, 0, 0, 0, 1786, 1786, 1786, 1786, 1787,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1787,
- 1787, 0, 0, 0, 1787, 1787, 1787, 1787, 1788, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1788, 1788,
-
- 0, 0, 0, 1788, 1788, 1788, 1788, 1789, 1789, 1789,
- 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789,
- 1789, 0, 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789,
- 1789, 1790, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1790, 0, 0, 0, 0, 1790, 1790, 1790, 1791,
- 0, 1791, 1791, 0, 1791, 0, 1791, 0, 1791, 1791,
- 0, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791, 1791,
- 0, 1791, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792,
- 1792, 1792, 1792, 1792, 1792, 1792, 0, 1792, 1792, 1792,
- 1792, 1792, 1792, 1792, 1792, 1792, 1793, 0, 0, 0,
-
- 1793, 0, 0, 1793, 1793, 1793, 1793, 1793, 1793, 1793,
- 1793, 0, 1793, 1794, 1794, 1794, 1794, 1794, 1794, 1794,
- 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794,
- 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1795, 0, 0,
- 0, 0, 1795, 1795, 1795, 1796, 1796, 1796, 1796, 1796,
- 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 0,
- 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1796, 1797,
- 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797,
- 1797, 1797, 1797, 0, 1797, 1797, 1797, 1797, 1797, 1797,
- 1797, 1797, 1797, 1798, 0, 0, 1798, 0, 0, 0,
-
- 0, 0, 0, 1798, 0, 1798, 1798, 1798, 1798, 1798,
- 1798, 1798, 1798, 1798, 0, 1798, 1799, 0, 1799, 0,
- 0, 0, 0, 0, 1799, 1799, 0, 0, 1799, 1801,
- 0, 0, 1801, 1801, 1801, 1801, 1801, 1801, 1801, 1801,
- 0, 1801, 1802, 1802, 1802, 1802, 1802, 1802, 1802, 1802,
- 1802, 1802, 1802, 1802, 1802, 1802, 0, 1802, 1802, 1802,
- 1802, 1802, 1802, 1802, 1802, 1802, 1803, 0, 0, 1803,
- 0, 1803, 0, 1803, 1803, 0, 1803, 0, 1803, 0,
- 1803, 1803, 1803, 1803, 1803, 1803, 1803, 1804, 1804, 1804,
- 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804,
-
- 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804, 1804,
- 1804, 1805, 0, 0, 1805, 1805, 1805, 1805, 1805, 1805,
- 1805, 1805, 0, 1805, 1806, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1806, 0, 0, 0, 0, 0,
- 1806, 0, 0, 1806, 1808, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1808, 0, 0, 0, 0, 0,
- 1808, 0, 0, 1808, 1810, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1810, 0, 0, 0, 0, 0,
- 1810, 0, 0, 1810, 1812, 1812, 1812, 1812, 1812, 1812,
- 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1812, 0, 1812,
-
- 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1812, 1813, 0,
- 1813, 1813, 0, 1813, 0, 1813, 0, 1813, 1813, 0,
- 1813, 1813, 1813, 1813, 1813, 1813, 1813, 1813, 1813, 0,
- 1813, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814, 1814,
- 1814, 1814, 1814, 1814, 1814, 0, 1814, 1814, 1814, 1814,
- 1814, 1814, 1814, 1814, 1814, 1815, 1815, 1815, 1815, 1815,
- 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 0,
- 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1815, 1816,
- 0, 1816, 0, 0, 0, 1816, 0, 0, 1816, 1816,
- 1816, 1816, 1816, 1816, 1816, 1816, 0, 1816, 1817, 0,
-
- 0, 1817, 0, 1817, 0, 1817, 1817, 0, 1817, 0,
- 0, 0, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1818,
- 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
- 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
- 1818, 1818, 1818, 1819, 1819, 1819, 1819, 1819, 1819, 1819,
- 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1819,
- 1819, 1819, 1819, 1819, 1819, 1819, 1819, 1820, 1820, 1820,
- 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820,
- 1820, 0, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820,
- 1820, 1821, 0, 0, 1821, 0, 0, 0, 0, 0,
-
- 0, 1821, 0, 1821, 1821, 1821, 1821, 1821, 1821, 1821,
- 1821, 1821, 0, 1821, 1822, 0, 0, 0, 0, 1822,
- 1822, 1822, 1823, 1823, 1823, 1823, 1823, 1823, 1823, 1823,
- 1823, 1823, 1823, 1823, 1823, 1823, 0, 1823, 1823, 1823,
- 1823, 1823, 1823, 1823, 1823, 1823, 1824, 1824, 1824, 1824,
- 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824,
- 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824,
- 1825, 0, 0, 1825, 1825, 1825, 1825, 1825, 1825, 1825,
- 1825, 0, 1825, 1826, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1826, 0, 0, 0, 0, 1826, 1826,
-
- 1826, 0, 1826, 1827, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1827, 0, 0, 0, 0, 1827, 1827,
- 1827, 0, 1827, 1828, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1828, 0, 0, 0, 0, 1828, 1828,
- 1828, 0, 1828, 1829, 1829, 1829, 1829, 1829, 1829, 1829,
- 1829, 1829, 1829, 1829, 1829, 1829, 1829, 0, 1829, 1829,
- 1829, 1829, 1829, 1829, 1829, 1829, 1829, 1830, 0, 1830,
- 1830, 0, 1830, 0, 1830, 0, 1830, 1830, 0, 1830,
- 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 0, 1830,
- 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831, 1831,
-
- 1831, 1831, 1831, 1831, 0, 1831, 1831, 1831, 1831, 1831,
- 1831, 1831, 1831, 1831, 1832, 1832, 1832, 1832, 1832, 1832,
- 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 0, 1832,
- 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1832, 1833, 0,
- 0, 0, 1833, 0, 1833, 0, 0, 0, 1833, 0,
- 0, 1833, 1833, 1833, 1833, 1833, 1833, 1833, 1833, 0,
- 1833, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834,
- 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834, 1834,
- 1834, 1834, 1834, 1834, 1834, 1836, 1836, 1836, 1836, 1836,
- 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836,
-
- 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1836, 1837,
- 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
- 1837, 1837, 1837, 1838, 1838, 1838, 1838, 1838, 1838, 1838,
- 1838, 1838, 1838, 1838, 1838, 1838, 1838, 0, 1838, 1838,
- 1838, 1838, 1838, 1838, 1838, 1838, 1838, 1839, 1839, 1839,
- 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839,
- 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839,
- 1839, 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1840,
- 1840, 1840, 1840, 1840, 1840, 0, 1840, 1840, 1840, 1840,
-
- 1840, 1840, 1840, 1840, 1840, 1841, 1841, 1841, 1841, 1841,
- 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841,
- 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1841, 1842,
- 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842,
- 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842, 1842,
- 1842, 1842, 1842, 1843, 1843, 1843, 1843, 1843, 1843, 1843,
- 1843, 1843, 1843, 1843, 1843, 1843, 1843, 1843, 1843, 1843,
- 1843, 1843, 1843, 1843, 1843, 1843, 1843, 1844, 1844, 1844,
- 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844,
- 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844, 1844,
-
- 1844, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845,
- 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845, 1845,
- 1845, 1845, 1845, 1845, 1845, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687,
- 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687
- } ;
-
-static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
-static char *yy_full_match;
-static int yy_lp;
-static int yy_looking_for_trail_begin = 0;
-static int yy_full_lp;
-static int *yy_full_state;
-#define YY_TRAILING_MASK 0x2000
-#define YY_TRAILING_HEAD_MASK 0x4000
-#define REJECT \
-{ \
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
-yy_cp = yy_full_match; /* restore poss. backed-over text */ \
-yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \
-yy_state_ptr = yy_full_state; /* restore orig. state */ \
-yy_current_state = *yy_state_ptr; /* restore curr. state */ \
-++yy_lp; \
-goto find_rule; \
-}
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#ifndef YYLMAX
-#define YYLMAX 8192
-#endif
-
-char yytext[YYLMAX];
-char *filttext_ptr;
-#line 1 "filt.l"
-#define INITIAL 0
-#line 5 "filt.l"
-
-#include <stdio.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <ctype.h>
-#include <string.h>
-#include <math.h>
-#include <filter.h>
-
-#define MAX_INCLUDE_DEPTH 100
-#define SEGINC 1024
-#define MASKINC 1024
-
-#define LARGE_NUMBER 65536
-
-/* must match regions.h */
-#define PSTOP -142857.142857
-
-/* stolen from fitsy/xos.h */
-#define X__PI 3.14159265358979323846
-#define X_2PI ( 2 * X__PI )
-#define X_R2D (X_2PI / 360.0)
-#define X_R2H (X_2PI / 24.0)
-#define X_H2D (360.0 / 24.0)
-
-#define r2h(r) ( (r) / X_R2H )
-#define h2r(d) ( (d) * X_R2H )
-#define r2d(r) ( (r) / X_R2D )
-#define d2r(d) ( (d) * X_R2D )
-#define h2d(r) ( (r) * X_H2D )
-#define d2h(d) ( (d) / X_H2D )
-
-/* region types */
-#define TY_ANNULUS 1
-#define TY_BOX 2
-#define TY_CIRCLE 3
-#define TY_ELLIPSE 4
-#define TY_FIELD 5
-#define TY_LINE 6
-#define TY_PANDA 7
-#define TY_BPANDA 8
-#define TY_CPANDA 9
-#define TY_EPANDA 10
-#define TY_PIE 11
-#define TY_QTPIE 11
-#define TY_POINT 12
-#define TY_POLYGON 13
-#define TY_IMAGEMASK 14
-
-/* oft-used checks on argument and coord types */
-#define XARG ((narg % 2) == 1)
-#define YARG ((narg % 2) == 0)
-#define POSARG ((regid == TY_POLYGON) || (regid == TY_LINE) || (narg<=2))
-#define ANGARG (((regid == TY_PANDA) && (narg==3)) || \
- ((regid == TY_PANDA) && (narg==4)) || \
- ((regid == TY_BPANDA) && (narg==3)) || \
- ((regid == TY_BPANDA) && (narg==4)) || \
- ((regid == TY_CPANDA) && (narg==3)) || \
- ((regid == TY_CPANDA) && (narg==4)) || \
- ((regid == TY_EPANDA) && (narg==3)) || \
- ((regid == TY_EPANDA) && (narg==4)) || \
- ((regid == TY_PIE) && (narg>=3)) )
-
-#define NUMARG (((regid == TY_PANDA) && (narg==5)) || \
- ((regid == TY_PANDA) && (narg==8)) || \
- ((regid == TY_BPANDA) && (narg==5)) || \
- ((regid == TY_BPANDA) && (narg==10)) || \
- ((regid == TY_CPANDA) && (narg==5)) || \
- ((regid == TY_CPANDA) && (narg==8)) || \
- ((regid == TY_EPANDA) && (narg==5)) || \
- ((regid == TY_EPANDA) && (narg==10)) )
-
-#define SAVEANG ((regid == TY_BOX) || (regid == TY_ELLIPSE))
-
-#define USEPHYS (filt->fhd->table && \
- (filt->type == TYPE_EVENTS) && !filt->evsect)
-
-#define USEWCS (gcoordsys && \
- strcmp(gcoordsys, "image") && strcmp(gcoordsys, "physical"))
-
-#define IMFLIP (USEWCS && wcs->imflip)
-
-#define WCSSIZE (iswcs(wcs) && (cdelt1!=0) && (cdelt2!=0))
-
-/* format statements */
-#define DFMT1 ",%f"
-#define DFMT2 ",%f,%f"
-#define DFMT4 ",%f,%f,%f,%f"
-#define SFMT1 ",%s"
-#define IFMT1 ",%d"
-
-/* flex is not thread-safe, so we did not put any effort into avoiding
- globals, i.e. by putting read-write variables below into a struct */
-
-static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
-static int include_stack_ptr = 0;
-static int parse_error = 0;
-
-static int colargs;
-static int filtlen;
-static int radanglen;
-static int initbindefs;
-static int regtype;
-static int regid;
-static int laststart;
-static int maxfiltseg;
-static int setargs;
-static int inexpr;
-static int macropass;
-static int narg;
-static int nparen;
-static int nsparen;
-static int nrparen;
-static int nfiltseg;
-static int nrange;
-static int nroutine;
-static int nshape;
-static int nregion;
-static int nmask;
-static int got;
-static int offscl;
-static int xtype, ytype;
-static int tltyp[2];
-
-static double lastd1;
-static double lastd2;
-static double xpos, ypos;
-static double xpix, ypix;
-static double cdelt1, cdelt2, crot;
-static double dval, dval2;
-static double tlmin[2];
-static double tlmax[2];
-static double binsiz[2];
-
-static char lastarg[SZ_LINE];
-static char regname[SZ_LINE];
-static char colnames[2][SZ_LINE];
-static char wcsnames[2][SZ_LINE];
-static char macrobuf[SZ_LINE];
-static char rangename[SZ_LINE];
-static char sbuf[SZ_LINE];
-static char saveang[SZ_LINE];
-
-static char *fcoordsys=NULL;
-static char *gcoordsys=NULL;
-static char *filter=NULL;
-static char *radang=NULL;
-
-static struct WorldCoor *wcs=NULL;
-static FiltSeg *filtseg=NULL;
-static Filter filt=NULL;
-
-/* these are read-only */
-static char *rnames[] = {"annulus", "box", "circle", "ellipse",
- "line", "panda", "pie", "qtpie", "point",
- "polygon", "field", "bpanda", "cpanda", "epanda",
- "imagemask", NULL};
-static int rargs[] = {4, 5, 3, 5,
- 4, 8, 4, 4, 2,
- 6, 0, 11, 8, 11,
- 0, 0};
-static int vargs[] = {'y', 'o', 'y', 'o',
- 'n', 'n', 'y', 'n', 'e',
- 'e', 'n', 'n', 'n', 'n',
- 'n', '\0'};
-
-static int _FiltLexTypeCmp(const void *s1, const void *s2);
-static int _FiltLexTypeMatch(int ftype, int ttype);
-static int _FiltLexAccel _PRx((int n));
-static int _FiltLexRegionPanda _PRx((void));
-static int _FiltLexLcx _PRx((void));
-static int _FiltLexArgCheck _PRx((char *name, int args));
-static int _FiltLexNeedOp _PRx((int i, char *s));
-static void _FiltLexOp _PRx((char *s));
-static void _FiltLexTypeSet _PRx((int type));
-static void _FiltLexNew _PRx((void));
-static void _FiltLexParen _PRx((char *s));
-static void _FiltLexCat _PRx((char *s));
-static void _FiltLexRegionStart _PRx((int docols));
-static void _FiltLexRegionVal _PRx((char *s));
-static void _FiltLexRegionEnd _PRx((void));
-static void _FiltLexRangeAdd _PRx((char *xname, char *str, int type, int n, int maxlen));
-static void _FiltLexArgSave _PRx((double dval));
-static void _FiltLexSetWcs _PRx((char *s));
-static void _FiltLexWcsCols _PRx((FITSHead header, char *name1, char *name2));
-static void _FiltLexNum _PRx((int lcx));
-static void _FiltLexEnd _PRx((void));
-static void _FiltLexMake _PRx((void));
-static char *_FiltLexGetWcs _PRx((void));
-static int _FiltIncMask(FilterMask masks, int maxmask, int nmask);
-static int _FiltFitsMask(char *filename, FilterMask *rmasks, FITSHead *rhead, int *nreg);
-static void bin2num(char *d, char *s, int maxlen);
-
-int _filterror _PRx((char *msg));
-#define RLIST 1
-
-#define RTINE 2
-
-#define REG 3
-
-#define AREG 4
-
-#define INCLUDE 5
-
-#define COMM 6
-
-#line 4563 "lex.filt.c"
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-#endif
-
-#ifndef filttext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-#endif
-
-#if YY_STACK_USED
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp = NULL, *yy_bp = NULL;
- register int yy_act;
-
-#line 247 "filt.l"
-
-
-#line 4717 "lex.filt.c"
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yy_start;
- yy_state_ptr = yy_state_buf;
- *yy_state_ptr++ = yy_current_state;
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 1688 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- *yy_state_ptr++ = yy_current_state;
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 14226 );
-
-yy_find_action:
- yy_current_state = *--yy_state_ptr;
- yy_lp = yy_accept[yy_current_state];
-find_rule: /* we branch to this label when backing up */
- for ( ; ; ) /* until we find what rule we matched */
- {
- if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
- {
- yy_act = yy_acclist[yy_lp];
- if ( yy_act & YY_TRAILING_HEAD_MASK ||
- yy_looking_for_trail_begin )
- {
- if ( yy_act == yy_looking_for_trail_begin )
- {
- yy_looking_for_trail_begin = 0;
- yy_act &= ~YY_TRAILING_HEAD_MASK;
- break;
- }
- }
- else if ( yy_act & YY_TRAILING_MASK )
- {
- yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
- yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
- }
- else
- {
- yy_full_match = yy_cp;
- yy_full_state = yy_state_ptr;
- yy_full_lp = yy_lp;
- break;
- }
- ++yy_lp;
- goto find_rule;
- }
- --yy_cp;
- yy_current_state = *--yy_state_ptr;
- yy_lp = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
-case 1:
-YY_RULE_SETUP
-#line 249 "filt.l"
-{ _FiltLexCat(yytext); }
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 251 "filt.l"
-{ _FiltLexSetWcs(yytext); }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 253 "filt.l"
-{ BEGIN COMM; }
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 254 "filt.l"
-{ BEGIN COMM; }
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 255 "filt.l"
-{ BEGIN COMM; }
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 256 "filt.l"
-{
- /* comment acts like EOL */
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- else if( YY_START == RLIST ){
- _FiltLexParen(")");
- _FiltLexNew();
- }
- else{
- _FiltLexNew();
- }
- BEGIN COMM;
-}
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 271 "filt.l"
-{ BEGIN INITIAL; }
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 272 "filt.l"
-{ BEGIN INITIAL; }
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 273 "filt.l"
-{ /* ignore comments up to eol */ ; }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 275 "filt.l"
-{ ; /* ignore */ }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 276 "filt.l"
-{ ; /* ignore */ }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 277 "filt.l"
-{ ; /* ignore */ }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 278 "filt.l"
-{ ; /* ignore */ }
- YY_BREAK
-case 14:
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
-yy_c_buf_p = yy_cp = yy_bp + 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-#line 280 "filt.l"
-{
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- /* Found an asc-style region */
- colargs = 0;
- laststart = YY_START;
- BEGIN AREG;
-}
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 290 "filt.l"
-{
- if( colargs > 2 )
- _filterror("illegal Chandra region (too many column args)");
- if( !FilterSymbolEnter(filt, yytext, &got) ){
- switch(got){
- case -1:
- _filterror("missing column or header parameter");
- break;
- case -2:
- _filterror("column is not an array");
- break;
- case -3:
- _filterror("internal error while processing column");
- break;
- }
- }
- strcpy(colnames[colargs],yytext);
- colargs++;
-}
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 309 "filt.l"
-{ ; }
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 310 "filt.l"
-{ ; }
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 311 "filt.l"
-{ ; }
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 312 "filt.l"
-{
- /* end of asc part of region */
- if( colargs != 2 )
- _filterror("illegal Chandra region (wrong number of cols)");
- BEGIN INITIAL;
-}
- YY_BREAK
-case 20:
-#line 320 "filt.l"
-case 21:
-YY_RULE_SETUP
-#line 320 "filt.l"
-{
- /* finish off previous */
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- /* Found a region */
- BEGIN REG;
- if( filt->type == TYPE_EVENTS ){
- /* if asc-style, re-do wcs for specified columns */
- if( colargs == 2 ){
- _FiltLexRegionStart(2);
- _FiltLexWcsCols(filt->fhd, colnames[0], colnames[1]);
- }
- /* set up default columns */
- else{
- _FiltLexRegionStart(1);
- }
- }
- /* its an image */
- else{
- _FiltLexRegionStart(0);
- }
-}
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 344 "filt.l"
-{
- /* can't happen */
- _filterror("invalid characters following the region name");
-}
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 348 "filt.l"
-{
- narg++;
- /* process this pure number in the current coord system */
- _FiltLexNum(_FiltLexLcx());
-}
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 353 "filt.l"
-{
- narg++;
- /* remove trailing unit character */
- yytext[strlen(yytext)-1] = '\0';
- /* process this as a pure number in image coord sys */
- _FiltLexNum(LCX_IMAGE);
-}
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 360 "filt.l"
-{
- narg++;
- /* remove trailing unit character */
- yytext[strlen(yytext)-1] = '\0';
- /* process this as a pure number in physical coord sys */
- _FiltLexNum(LCX_PHYS);
-}
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 367 "filt.l"
-{
- char *coordsys;
- if( nowcs(wcs) )
- _filterror("no WCS information in file");
- narg++;
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = SAOstrtod(yytext,NULL);
- xtype = SAOdtype;
- if( (xtype !=0) && (xtype != '.') && (xtype != 'd') ){
- coordsys = _FiltLexGetWcs();
- /* arg1 coords are hms, but ecliptic, galactic are deg */
- if( !coordsys ||
- (strncasecmp(coordsys, "ecl", 3) &&
- strncasecmp(coordsys, "gal", 3)) ){
- xpos = h2d(xpos);
- }
- }
- }
- else{
- ypos = SAOstrtod(yytext,NULL);
- ytype = SAOdtype;
- /* convert wcs to image pixels */
- wcsc2pix(wcs, xpos,ypos, _FiltLexGetWcs(), &xpix,&ypix,
- &offscl);
- /* convert to physical for single event filtering */
- if( USEPHYS ){
- xpix = tli2p(xpix, tlmin[0], binsiz[0], tltyp[0]);
- ypix = tli2p(ypix, tlmin[1], binsiz[1], tltyp[1]);
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
-}
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 401 "filt.l"
-{
- narg++;
- /* handle position arguments */
- if( POSARG ){
- if( nowcs(wcs) )
- _filterror("no WCS information in file");
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = strtod(yytext,NULL);
- }
- else{
- ypos = strtod(yytext,NULL);
- /* convert wcs to image pixels */
- wcsc2pix(wcs, xpos, ypos, _FiltLexGetWcs(),
- &xpix, &ypix, &offscl);
- /* convert to physical for single event filtering */
- if( USEPHYS ){
- xpix = tli2p(xpix, tlmin[0], binsiz[0], tltyp[0]);
- ypix = tli2p(ypix, tlmin[1], binsiz[1], tltyp[1]);
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
- }
- /* angle arguments are just passed along, with updated crot */
- else if( ANGARG ){
- dval = strtod(yytext,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(yytext,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* handle size arguments */
- else{
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- if( SAVEANG ){
- dval = strtod(yytext,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = ABS(strtod(yytext,NULL)/cdelt1);
- else
- dval = ABS(strtod(yytext,NULL)/cdelt2);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
-}
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 459 "filt.l"
-{
- narg++;
- /* handle position arguments */
- if( POSARG ){
- if( nowcs(wcs) )
- _filterror("no WCS information in file");
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = r2d(strtod(yytext,NULL));
- }
- else{
- ypos = r2d(strtod(yytext,NULL));
- /* convert wcs to image pixels */
- wcsc2pix(wcs, xpos, ypos, _FiltLexGetWcs(),
- &xpix, &ypix, &offscl);
- /* convert to physical for single event filtering */
- if( USEPHYS ){
- xpix = tli2p(xpix, tlmin[0], binsiz[0], tltyp[0]);
- ypix = tli2p(ypix, tlmin[1], binsiz[1], tltyp[1]);
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
- }
- /* angle arguments are just passed along, with updated crot */
- else if( ANGARG ){
- dval = r2d(strtod(yytext,NULL));
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(yytext,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* handle size arguments */
- else{
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- if( SAVEANG ){
- dval = r2d(strtod(yytext,NULL));
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = r2d(ABS(strtod(yytext,NULL)/cdelt1));
- else
- dval = r2d(ABS(strtod(yytext,NULL)/cdelt2));
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
-}
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 517 "filt.l"
-{
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- narg++;
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = ABS(strtod(yytext,NULL)/(cdelt1*60.0));
- else
- dval = ABS(strtod(yytext,NULL)/(cdelt2*60.0));
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
-}
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 530 "filt.l"
-{
- if( !WCSSIZE )
- _filterror("no WCS (or CDELT) information in file");
- narg++;
- /* arg 1 is ra, arg2 is dec */
- if( XARG )
- dval = ABS(strtod(yytext,NULL)/(cdelt1*3600.0));
- else
- dval = ABS(strtod(yytext,NULL)/(cdelt2*3600.0));
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
-}
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 543 "filt.l"
-{
- int n;
- n = strtol(strchr(yytext, '=')+1, NULL, 10);
- if( n <=0 ){
- _filterror("invalid region accelerator");
- }
- else{
- if( !_FiltLexAccel(n) ){
- _filterror("invalid region accelerator");
- }
- }
-}
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 555 "filt.l"
-{
- if( _FiltLexArgCheck(regname, narg) == 0 ){
- /* new expression without an expression separator ... sigh */
- _FiltLexRegionEnd();
- _FiltLexNew();
- BEGIN INITIAL;
- yyless(0);
- } else {
- narg++;
- /* process this pure number in the current coord system */
- _FiltLexNum(_FiltLexLcx());
- }
-}
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 568 "filt.l"
-{
- /* new expression without an expression separator ... sigh */
- _FiltLexRegionEnd();
- _FiltLexNew();
- BEGIN INITIAL;
- yyless(0);
-}
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 575 "filt.l"
-{
- /* explicit rule avoids the _FiltLexNew of general rule */
- ;
-}
- YY_BREAK
-case 35:
-YY_RULE_SETUP
-#line 579 "filt.l"
-{
- _FiltLexRegionVal(yytext);
- if( !nsparen ){
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- }
-}
- YY_BREAK
-case 36:
-YY_RULE_SETUP
-#line 586 "filt.l"
-{
- nsparen++;
-}
- YY_BREAK
-case 37:
-YY_RULE_SETUP
-#line 589 "filt.l"
-{
- _FiltLexRegionVal(yytext+1);
- if( nsparen ){
- nsparen--;
- if( !nsparen ){
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- }
- } else {
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- /* REJECT; */
- /* explicit execution of general rule instead of REJECT */
- nparen--;
- _FiltLexNew();
- _FiltLexCat(")");
- _FiltLexNew();
- }
-}
- YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 608 "filt.l"
-{
- if( nsparen ){
- nsparen--;
- if( !nsparen ){
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- }
- } else {
- _FiltLexRegionEnd();
- BEGIN INITIAL;
- /* REJECT; */
- /* explicit execution of general rule instead of REJECT */
- nparen--;
- _FiltLexNew();
- _FiltLexCat(")");
- _FiltLexNew();
- }
-}
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 626 "filt.l"
-{
- _FiltLexRegionEnd();
- _FiltLexOp(yytext);
- BEGIN INITIAL;
-}
- YY_BREAK
-case 40:
-YY_RULE_SETUP
-#line 631 "filt.l"
-{
- _FiltLexRegionEnd();
- _FiltLexNew();
- BEGIN INITIAL;
-}
- YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 637 "filt.l"
-{
- _filterror("you must use == to compare two columns,");
-}
- YY_BREAK
-case 42:
-YY_RULE_SETUP
-#line 641 "filt.l"
-{
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- }
- _FiltLexParen("(");
- BEGIN RLIST;
- narg = 0;
- _FiltLexTypeSet(TOK_RLIST);
- nrange = 0;
- if( !FilterSymbolEnter(filt, yytext, &got) ){
- switch(got){
- case -1:
- _filterror("missing column or header parameter");
- break;
- case -2:
- _filterror("column is not an array");
- break;
- case -3:
- _filterror("internal error while processing column");
- break;
- }
- }
- strncpy(rangename, yytext, SZ_LINE-1);
-}
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 665 "filt.l"
-{
- _FiltLexRangeAdd(rangename, yytext, 3, nrange++, SZ_LINE);
-}
- YY_BREAK
-case 44:
-YY_RULE_SETUP
-#line 668 "filt.l"
-{
- _FiltLexRangeAdd(rangename, yytext, 1, nrange++, SZ_LINE);
-}
- YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 671 "filt.l"
-{
- _FiltLexRangeAdd(rangename, yytext, 4, nrange++, SZ_LINE);
-}
- YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 674 "filt.l"
-{
- _FiltLexRangeAdd(rangename, yytext, 2, nrange++, SZ_LINE);
-}
- YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 677 "filt.l"
-{ ; }
- YY_BREAK
-case 48:
-YY_RULE_SETUP
-#line 678 "filt.l"
-{ ; }
- YY_BREAK
-case 49:
-YY_RULE_SETUP
-#line 679 "filt.l"
-{ ; }
- YY_BREAK
-case 50:
-YY_RULE_SETUP
-#line 680 "filt.l"
-{
- _FiltLexParen(")");
- _FiltLexNew();
- BEGIN INITIAL;
-}
- YY_BREAK
-case 51:
-YY_RULE_SETUP
-#line 685 "filt.l"
-{
- _FiltLexParen(")");
- _FiltLexNew();
- _FiltLexParen(")");
- _FiltLexNew();
- BEGIN INITIAL;
-}
- YY_BREAK
-case 52:
-YY_RULE_SETUP
-#line 692 "filt.l"
-{
- _FiltLexParen(")");
- _FiltLexOp(yytext);
- BEGIN INITIAL;
-}
- YY_BREAK
-case 53:
-YY_RULE_SETUP
-#line 697 "filt.l"
-{
- _FiltLexParen(")");
- _FiltLexNew();
- BEGIN INITIAL;
-}
- YY_BREAK
-case 54:
-*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
-yy_c_buf_p = yy_cp -= 1;
-YY_DO_BEFORE_ACTION; /* set up yytext again */
-YY_RULE_SETUP
-#line 703 "filt.l"
-{
- /* Found a routine */
- laststart = YY_START;
- BEGIN RTINE;
- narg = 0;
- nrparen = 0;
- _FiltLexTypeSet(TOK_RTINE);
- _FiltLexCat(FilterLexRoutine1(filt, yytext));
- nroutine++;
-}
- YY_BREAK
-case 55:
-YY_RULE_SETUP
-#line 713 "filt.l"
-{
- /* explicit rule avoids the _FiltLexNew of general rule */
- _FiltLexCat(",");
-}
- YY_BREAK
-case 56:
-YY_RULE_SETUP
-#line 717 "filt.l"
-{
- nrparen++;
- _FiltLexCat("(");
-}
- YY_BREAK
-case 57:
-YY_RULE_SETUP
-#line 721 "filt.l"
-{
- nrparen--;
- if( nrparen ){
- _FiltLexCat(")");
- }
- else{
- /* end of routine */
- BEGIN laststart;
- _FiltLexCat(FilterLexRoutine2(filt, ")"));
- }
-}
- YY_BREAK
-case 58:
-YY_RULE_SETUP
-#line 733 "filt.l"
-{
- /* Found an include file */
- char *s, *t;
- if( YY_START == REG ){
- _FiltLexRegionEnd();
- _FiltLexNew();
- }
- /* handle FITS mask file specially */
- filt->nmask = _FiltFitsMask(yytext+1,
- &(filt->masks),
- &(filt->maskhd),
- &(filt->nmaskreg));
- /* filt->nmask == -1 => its not a FITS file */
- if( filt->nmask != -1 ){
- switch(filt->nmask){
- case -2:
- _filterror("FITS image mask must be image data -");
- break;
- case -3:
- _filterror("Invalid dimensions for FITS image mask -");
- break;
- case -4:
- _filterror("FITS image mask cannot contain negative values -");
- break;
- default:
- if( (filt->type != TYPE_IMAGE) && !filt->evsect ){
- _filterror("FITS image mask is valid for image filtering only -");
- }
- else{
- if( nmask )
- _filterror("only one FITS image mask allowed at a time -");
- else
- nmask++;
- }
- break;
- }
- }
- else{
- if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) {
- _filterror("include files are nested too deeply");
- }
- if( (s = (char *)FileContents(yytext+1, 0, NULL)) == NULL ){
- _filterror("can't access include file");
- }
- /* ignore empty include file */
- else if( *s == '\0' ){
- ;
- }
- else {
- t = FilterClip(s);
- xfree(s);
- if( t && *t ){
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
- _FiltLexNew();
- _FiltLexParen("(");
- FiltScanString(t);
- xfree(t);
- }
- }
- }
-}
- YY_BREAK
-case 59:
-YY_RULE_SETUP
-#line 795 "filt.l"
-{
- if( !FilterSymbolEnter(filt, yytext, &got) ){
- switch(got){
- case -1:
- _filterror("missing column or header parameter");
- break;
- case -2:
- _filterror("column is not an array");
- break;
- case -3:
- _filterror("internal error while processing column");
- break;
- }
- }
- else{
- narg++;
- /* add if initial condition (not region, routine, etc.) */
- if( YY_START == INITIAL ) _FiltLexTypeSet(TOK_NAME);
- _FiltLexCat(FilterLexName(filt,yytext));
- }
-}
- YY_BREAK
-case 60:
-YY_RULE_SETUP
-#line 817 "filt.l"
-{ ; /* ignore white space */ }
- YY_BREAK
-case 61:
-YY_RULE_SETUP
-#line 819 "filt.l"
-{ narg++; _FiltLexCat(yytext); }
- YY_BREAK
-case 62:
-YY_RULE_SETUP
-#line 821 "filt.l"
-{
- char tbuf[SZ_LINE];
- bin2num(tbuf, yytext, SZ_LINE-1);
- narg++;
- _FiltLexCat(tbuf);
- }
- YY_BREAK
-case 63:
-YY_RULE_SETUP
-#line 828 "filt.l"
-{
- _FiltLexOp(yytext);
- if( YY_START != RTINE ) BEGIN INITIAL;
-}
- YY_BREAK
-case 64:
-YY_RULE_SETUP
-#line 833 "filt.l"
-{
- nparen++;
- _FiltLexNew();
- _FiltLexCat(yytext);
- _FiltLexNew();
-}
- YY_BREAK
-case 65:
-YY_RULE_SETUP
-#line 839 "filt.l"
-{
- nparen--;
- _FiltLexNew();
- _FiltLexCat(yytext);
- _FiltLexNew();
-}
- YY_BREAK
-case 66:
-YY_RULE_SETUP
-#line 845 "filt.l"
-{
- _FiltLexNew();
- BEGIN INITIAL;
-}
- YY_BREAK
-case 67:
-YY_RULE_SETUP
-#line 850 "filt.l"
-{ _FiltLexCat(yytext); }
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(RLIST):
-case YY_STATE_EOF(RTINE):
-case YY_STATE_EOF(REG):
-case YY_STATE_EOF(AREG):
-case YY_STATE_EOF(INCLUDE):
-case YY_STATE_EOF(COMM):
-#line 852 "filt.l"
-{
- if ( --include_stack_ptr < 0 ){
- _FiltLexMake();
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yyterminate();
- } else {
- _FiltLexParen(")");
- _FiltLexNew();
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yy_switch_to_buffer(include_stack[include_stack_ptr] );
- }
-}
- YY_BREAK
-case 68:
-YY_RULE_SETUP
-#line 865 "filt.l"
-ECHO;
- YY_BREAK
-#line 5704 "lex.filt.c"
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - filttext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = filttext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = filttext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = filttext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- filttext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = filttext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = filttext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-static int yy_get_next_buffer()
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = filttext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - filttext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - filttext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
-
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- filttext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = yy_start;
- yy_state_ptr = yy_state_buf;
- *yy_state_ptr++ = yy_current_state;
-
- for ( yy_cp = filttext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 1688 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- *yy_state_ptr++ = yy_current_state;
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
- {
- register int yy_is_jam;
-
- register YY_CHAR yy_c = 1;
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 1688 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 1687);
- if ( ! yy_is_jam )
- *yy_state_ptr++ = yy_current_state;
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-
- filttext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-#endif /* ifndef YY_NO_UNPUT */
-
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - filttext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = filttext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-
- return c;
- }
-#endif /* YY_NO_INPUT */
-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- filttext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
-
-
- {
- yy_flush_buffer( b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
-#else
-void yy_flush_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
- }
-
-
-#ifndef YY_NO_SCAN_BUFFER
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
-char *base;
-yy_size_t size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
-yyconst char *yy_str;
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len );
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
-yyconst char *bytes;
-int len;
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef filttext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
-#line 865 "filt.l"
-
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-
-#ifdef YY_USE_PROTOS
-static void floatprefix(void)
-#else
-static void floatprefix()
-#endif
-{
- if( filt->method == METHOD_C )
- _FiltLexCat("(double)");
-}
-
-#ifdef YY_USE_PROTOS
-static void floatsuffix(void)
-#else
-static void floatsuffix()
-#endif
-{
- return;
-}
-
-#ifdef YY_USE_PROTOS
-static void
-bin2num(char *d, char *s, int maxlen)
-#else
-static void
-bin2num(d, s, maxlen)
- char *d;
- char *s;
- int maxlen;
-#endif
-{
- unsigned long bits;
- char *p=NULL;
-
- if( strlen(s) < 2 ){
- if( d != s ) strncpy(d, s, maxlen-1);
- }
- else{
- if( (*s=='0') && (*(s+1)=='b') ){
- bits = strtoul(s+2, &p, 2);
- if( *p != '\0' ) _filterror("invalid binary value");
- snprintf(d, maxlen, "%lx", bits);
- if( (strlen(d) <2) || (*d!='0') || ((*(d+1)!='x')&&((*(d+1)!='X'))) ){
- snprintf(d, maxlen, "0x%lx", bits);
- }
- }
- else{
- if( d != s ) strncpy(d, s, maxlen-1);
- }
- }
-}
-
-/*
- *
- * _FiltLexNew -- finish last start and set up new filter segment
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexNew(void)
-#else
-static void _FiltLexNew()
-#endif
-{
- int i;
- int last;
-
- if( nfiltseg >= maxfiltseg ){
- last = maxfiltseg;
- if( maxfiltseg == 0 ){
- maxfiltseg = SEGINC;
- filtseg = (FiltSeg *)xmalloc(maxfiltseg * sizeof(FiltSeg));
- }
- else{
- maxfiltseg += SEGINC;
- filtseg = (FiltSeg *)xrealloc(filtseg, maxfiltseg * sizeof(FiltSeg));
- }
- /* clear the unused records */
- for(i=last; i<maxfiltseg; i++){
- filtseg[i] = NULL;
- }
- }
- if( !nfiltseg || (filtseg[nfiltseg-1] && filtseg[nfiltseg-1]->s) ){
- filtseg[nfiltseg] = (FiltSeg)xcalloc(1, sizeof(FiltSegRec));
- nfiltseg++;
- }
- filtseg[nfiltseg-1]->n = nfiltseg-1;
- filtseg[nfiltseg-1]->nregion = 0;
-}
-
-/*
- *
- * _FiltLexParen -- add a paren to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexParen(char *str)
-#else
-static void _FiltLexParen(str)
- char *str;
-#endif
-{
- /* _FiltLexNew(); */
- _FiltLexCat(str);
- /* _FiltLexNew(); */
-}
-
-/*
- *
- * __FiltLexCat -- add a string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-__FiltLexCat(char *str, char **ostr, int *olen)
-#else
-static void __FiltLexCat(str, ostr, olen)
- char *str;
- char **ostr;
- int *olen;
-#endif
-{
- int blen;
- int slen;
-
- if( (str == NULL) || (*str == '\0') )
- return;
- else
- slen = strlen(str) + 1;
-
- if( (*ostr == NULL) || (**ostr == '\0') )
- blen = 0;
- else
- blen = strlen(*ostr);
-
- while( (blen + slen) >= *olen ){
- *olen += SEGINC;
- }
- if( blen == 0 )
- *ostr = (char *)xcalloc(*olen, sizeof(char));
- else
- *ostr = (char *)xrealloc(*ostr, *olen);
- strcat(*ostr, str);
-}
-
-/*
- *
- * _FiltLexCat -- add a string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexCat(char *str)
-#else
-static void _FiltLexCat(str)
- char *str;
-#endif
-{
- char *s;
- if( !str || !*str )
- return;
- if( nfiltseg ==0 )
- _FiltLexNew();
- s = xmalloc(strlen(str)+1);
- nowhite(str, s);
- __FiltLexCat(s, &(filtseg[nfiltseg-1]->s), &(filtseg[nfiltseg-1]->len));
- if( s ) xfree(s);
-}
-
-/*
- *
- * _FiltLexArgSave -- save a radius or angle value to the temp string:
- * this is a special hack for funcnts
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexArgSave(double dval)
-#else
-static void _FiltLexArgSave(dval)
- double dval;
-#endif
-{
- char tbuf[SZ_LINE];
-
- if( narg < 3 )
- return;
- snprintf(tbuf, SZ_LINE, DFMT1, dval);
- if( narg == 3 ){
- *lastarg = '\0';
- lastd1 = 0.0;
- lastd2 = 0.0;
- if( filtseg[nfiltseg-1]->radang ){
- xfree(filtseg[nfiltseg-1]->radang);
- filtseg[nfiltseg-1]->radang = NULL;
- filtseg[nfiltseg-1]->ralen = 0;
- }
- }
- switch(regid){
- case TY_ANNULUS:
- case TY_CIRCLE:
- if( *lastarg ){
- __FiltLexCat(lastarg, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- if( narg > 3 ){
- __FiltLexCat(",NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- strcpy(lastarg, tbuf);
- }
- lastd1 = lastd2;
- lastd2 = dval;
- break;
-
- case TY_BOX:
- case TY_ELLIPSE:
- if( (narg%2) == 1 ){
- if( *lastarg ){
- __FiltLexCat(lastarg, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- if( narg > 3 ){
- __FiltLexCat(",NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- strcpy(lastarg, tbuf);
- }
- lastd1 = lastd2;
- lastd2 = dval;
- }
- break;
-
- case TY_PIE:
- if( narg == 3 ){
- __FiltLexCat("NA,NA", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- else if( *lastarg ){
- __FiltLexCat("NA,NA,", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat(lastarg, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- if( narg > 3 ){
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- strcpy(lastarg, tbuf);
- }
- lastd1 = lastd2;
- lastd2 = dval;
- break;
-
- case TY_POINT:
- /* we have to process this here if its is a varargs */
- /* so, for the 3rd arg, we add a line for initial x, y pair */
- if( narg == 3 ){
- __FiltLexCat("NA,NA,NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- /* and for every even arg, add a line for the preceeding x,y pair */
- else if( (narg % 2) == 0 ){
- __FiltLexCat("NA,NA,NA,NA\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- break;
- default:
- return;
- }
-}
-
-/*
- *
- * _FiltLexAccel -- appply acceleration to a segment
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexAccel(int n)
-#else
-static int _FiltLexAccel(n)
- int n;
-#endif
-{
- int i;
- char tbuf[SZ_LINE];
- char *s;
- double dinc;
-
- /* check region type */
- switch(regid){
- case TY_ANNULUS:
- break;
- case TY_BOX:
- narg -= 2;
- break;
- case TY_CIRCLE:
- narg -= 1;
- break;
- case TY_ELLIPSE:
- narg -= 2;
- break;
- case TY_PIE:
- break;
- default:
- _filterror("annulus, box, circle, ellipse, pie accelerators only - ");
- break;
- }
- /* add the argument */
- snprintf(tbuf, SZ_LINE, IFMT1, n);
- _FiltLexCat(tbuf);
- /* change the name of the routine we will call */
- if( filtseg[nfiltseg-1]->s0 ){
- if( (s = xstrdup(&filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0])) ){
- filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0] = '\0';
- _FiltLexCat("n");
- _FiltLexCat(s);
- snprintf(tbuf, SZ_LINE, "%d ", n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- setargs = 1;
- free (s);
- }
- if( filtseg[nfiltseg-1]->radang ){
- xfree(filtseg[nfiltseg-1]->radang);
- filtseg[nfiltseg-1]->radang = NULL;
- filtseg[nfiltseg-1]->ralen = 0;
- }
- switch(regid){
- case TY_ANNULUS:
- case TY_BOX:
- case TY_CIRCLE:
- case TY_ELLIPSE:
- dinc = (lastd2 - lastd1)/n;
- for(i=1; i<=n; i++){
- snprintf(tbuf, SZ_LINE, DFMT2, lastd1+((i-1)*dinc), lastd1+(i*dinc));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat(",NA,NA", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- break;
- case TY_PIE:
- dinc = (lastd2 - lastd1)/n;
- for(i=1; i<=n; i++){
- snprintf(tbuf, SZ_LINE, DFMT2, lastd1+((i-1)*dinc), lastd1+(i*dinc));
- __FiltLexCat("NA,NA", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- }
- break;
- default:
- _filterror("annulus, box, circle, ellipse, pie accelerators only - ");
- break;
- }
- _FiltLexTypeSet(TOK_ACCEL);
- }
- else{
- _filterror("misplaced accelerator");
- }
- return(n);
-}
-
-/*
- *
- * _FiltLexTypeSet -- add type info to the filter segment record
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexTypeSet(int type)
-#else
-static void _FiltLexTypeSet(type)
- int type;
-#endif
-{
- if( nfiltseg ==0 )
- _FiltLexNew();
- filtseg[nfiltseg-1]->type |= type;
-}
-
-/*
- *
- * _FiltLexOp -- add an operator to the filter segment record
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexOp(char *op)
-#else
-static void _FiltLexOp(op)
- char *op;
-#endif
-{
- _FiltLexCat(op);
- filtseg[nfiltseg-1]->ops += 1;
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRegionStart(int docols)
-#else
-static void _FiltLexRegionStart(docols)
- int docols;
-#endif
-{
- char *s, *t;
- char tbuf[SZ_LINE];
-
- /* sanity check -- 1D images do not support regions */
- if( (filt->type == TYPE_IMAGE) && (ft_naxes(filt->fhd)==1) ){
- _filterror("2D region filters invalid for 1D images");
- }
- narg = 0;
- setargs=0;
- s = xmalloc(strlen(yytext)+1);
- nowhite(yytext, s);
- if( *s == '+' ){
- regtype = TOK_IREG;
- strcpy(regname, s+1);
- }
- else if( *s == '-' ){
- regtype = TOK_EREG;
- strcpy(regname, s+1);
- }
- else if( *s == '!' ){
- regtype = TOK_NREG;
- strcpy(regname, s+1);
- }
- else{
- regtype = TOK_IREG;
- strcpy(regname, s);
- }
- _FiltLexTypeSet(regtype);
- if( !(t=strchr(regname, '(')) ){
- nsparen=0;
- }
- /* remove the paren from the regname string -- we will explicitly add it */
- else{
- *t = '\0';
- nsparen=1;
- }
- /* convert to lower case, remove white space */
- culc(regname);
- nowhite(regname, s);
- strcpy(regname, s);
- /* convert abbrev to region */
- if( !strncmp(regname, "ann", 3) ){
- strcpy(regname, "annulus");
- regid = TY_ANNULUS;
- }
- else if( !strncmp(regname, "box", 3) ){
- strcpy(regname, "box");
- regid = TY_BOX;
- }
- else if( !strncmp(regname, "cir", 3) ){
- strcpy(regname, "circle");
- regid = TY_CIRCLE;
- }
- else if( !strncmp(regname, "ell", 3) ){
- strcpy(regname, "ellipse");
- regid = TY_ELLIPSE;
- }
- else if( !strncmp(regname, "fie", 3) ){
- strcpy(regname, "field");
- regid = TY_FIELD;
- }
- else if( !strncmp(regname, "lin", 3) ){
- strcpy(regname, "line");
- regid = TY_LINE;
- }
- else if( !strncmp(regname, "pan", 3) ){
- strcpy(regname, "panda");
- regid = TY_PANDA;
- }
- else if( !strncmp(regname, "bpa", 3) ){
- strcpy(regname, "bpanda");
- regid = TY_BPANDA;
- }
- else if( !strncmp(regname, "cpa", 3) ){
- strcpy(regname, "cpanda");
- regid = TY_CPANDA;
- }
- else if( !strncmp(regname, "epa", 3) ){
- strcpy(regname, "epanda");
- regid = TY_EPANDA;
- }
- else if( !strncmp(regname, "pie", 3) ){
- strcpy(regname, "pie");
- regid = TY_PIE;
- }
- else if( !strncmp(regname, "qtp", 3) ){
- strcpy(regname, "qtpie");
- regid = TY_PIE;
- }
- else if( !strncmp(regname, "poi", 3) ){
- strcpy(regname, "point");
- regid = TY_POINT;
- }
- else if( !strncmp(regname, "pol", 3) ){
- strcpy(regname, "polygon");
- regid = TY_POLYGON;
- }
- else if( !strcmp(regname, "imagemask") ){
- regid = TY_IMAGEMASK;
- }
- /* append filter-type prefix */
- switch( filt->type ){
- case TYPE_EVENTS:
- /* normally, we filter rows analytically using evregions.o */
- if( !filt->evsect )
- _FiltLexCat("ev");
- /* if evsect=xxx is specified, we filter by image pixels */
- else
- _FiltLexCat("im");
- break;
- case TYPE_IMAGE:
- /* image are filtered by image pixels */
- _FiltLexCat("im");
- break;
- }
- /* no region value to start */
- filtseg[nfiltseg-1]->regval = 0;
- /* save size of current string so we can get back to the region string */
- filtseg[nfiltseg-1]->s0 = strlen(filtseg[nfiltseg-1]->s);
- /* append region */
- _FiltLexCat(FilterLexRegion1(filt,regname));
- /* append standard args */
- _FiltLexCat("(g,$RS,");
- /* add include/exclude and whether we mark y lines for this region
- (we don't mark y on excludes as an optimization) */
- switch(regtype){
- case TOK_IREG:
- snprintf(tbuf, SZ_LINE, "1,%d", TOK_IREG);
- _FiltLexCat(tbuf);
- break;
- case TOK_NREG:
- snprintf(tbuf, SZ_LINE, "0,%d", TOK_NREG);
- _FiltLexCat(tbuf);
- break;
- case TOK_EREG:
- snprintf(tbuf, SZ_LINE, "0,%d", TOK_EREG);
- _FiltLexCat(tbuf);
- break;
- }
- switch(docols){
- case 0:
- /* initialize default columns for tables -- but don't enter symbols yet */
- FilterSymbolDefaults(filt, 0);
- /* initialize wcs for default image case */
- _FiltLexWcsCols(filt->fhd, filt->xbin, filt->ybin);
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat("x");
- floatsuffix();
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat("y");
- floatsuffix();
- break;
- case 1:
- if( !initbindefs ){
- /* initialize default columns for tables and enter symbols */
- FilterSymbolDefaults(filt, 1);
- /* initialize wcs for default table case */
- _FiltLexWcsCols(filt->fhd, filt->xbin, filt->ybin);
- initbindefs++;
- }
- if( !filt->xbin || !filt->ybin ){
- _filterror("two binning columns are required for regions");
- }
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(filt->xbin);
- floatsuffix();
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(filt->ybin);
- floatsuffix();
- break;
- case 2:
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(colnames[0]);
- floatsuffix();
- _FiltLexCat(",");
- floatprefix();
- _FiltLexCat(colnames[1]);
- floatsuffix();
- break;
- }
- if( s ) xfree(s);
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRegionVal(char *s)
-#else
-static void
-_FiltLexRegionVal(s)
- char *s;
-#endif
-{
- char *t=NULL;
- if( (t=strchr(s, '{')) ){
- t++;
- }
- else{
- t = s;
- }
- filtseg[nfiltseg-1]->regval = atoi(t);
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRegionEnd(void)
-#else
-static void
-_FiltLexRegionEnd()
-#endif
-{
- int n;
- char *s;
- char ebuf[SZ_LINE];
- char tbuf[SZ_LINE];
-
- /* add final arguments as required */
- switch( regid ){
- case TY_BOX:
- if( (narg%2) == 0 ){
- _FiltLexCat(",0.0"); narg++;
- }
- else{
- /* if we saved an angle arg, we need to replace the last position arg */
- if( *saveang ){
- if( (s=strrchr(filtseg[nfiltseg-1]->s, ',')) ){
- *s = '\0';
- _FiltLexCat(saveang);
- }
- }
- }
- break;
- case TY_ELLIPSE:
- if( (narg%2) == 0 ){
- _FiltLexCat(",0.0"); narg++;
- }
- else{
- /* if we saved an angle arg, we need to replace the last position arg */
- if( *saveang ){
- if( (s=strrchr(filtseg[nfiltseg-1]->s, ',')) ){
- *s = '\0';
- _FiltLexCat(saveang);
- }
- }
- }
- break;
- case TY_BPANDA:
- case TY_EPANDA:
- if( (narg%2) == 0 ){
- _FiltLexCat(",0.0"); narg++;
- }
- /* drop through here to process panda */
- case TY_PANDA:
- case TY_CPANDA:
- _FiltLexRegionPanda();
- setargs = 1;
- break;
- default:
- break;
- }
-
- /* argument check */
- if( (n=_FiltLexArgCheck(regname, narg)) > 0 ){
- /* don't bother printing where we are in region */
- *yytext = '\0';
- switch( vargs[n-1] ){
- case 'n':
- snprintf(ebuf, SZ_LINE, "'%s' requires %d args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- case 'e':
- snprintf(ebuf, SZ_LINE,
- "'%s' requires at least %d (even) args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- case 'o':
- snprintf(ebuf, SZ_LINE,
- "'%s' requires at least %d (odd) args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- case 'y':
- default:
- snprintf(ebuf, SZ_LINE, "'%s' requires %d args (%d found)",
- rnames[n-1], rargs[n-1], narg);
- break;
- }
- _filterror(ebuf);
- }
-
- /* process varargs */
- if( (n < 0) || (regid == TY_POLYGON) ){
- if( filtseg[nfiltseg-1]->type & TOK_ACCEL ){
- _filterror("n= and variable arglist cannot be combined -");
- }
- /* if its a varargs, we need to end with PSTOP values */
- snprintf(sbuf, SZ_LINE, DFMT2, PSTOP, PSTOP);
- _FiltLexCat(sbuf);
- /* change the name of the routine we will call */
- if( regid != TY_POLYGON ){
- if( filtseg[nfiltseg-1]->s0 ){
- if((s = xstrdup(&filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0]))){
- filtseg[nfiltseg-1]->s[filtseg[nfiltseg-1]->s0] = '\0';
- _FiltLexCat("v");
- _FiltLexCat(s);
- switch(regid){
- case TY_ANNULUS:
- n = narg - 3;
- break;
- case TY_BOX:
- n = (narg - 5)/2;
- break;
- case TY_CIRCLE:
- n = narg - 3;
- break;
- case TY_ELLIPSE:
- n = (narg - 5)/2;
- break;
- case TY_PIE:
- n = narg - 3;
- break;
- case TY_POINT:
- n = narg/2;
- break;
- default:
- _filterror("varargs: annulus, box, circle, ellipse, pie, point;");
- break;
- }
- snprintf(tbuf, SZ_LINE, "%d ", n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- setargs = 1;
- free (s);
- }
- _FiltLexTypeSet(TOK_VARARGS);
- }
- else{
- _filterror("invalid varargs");
- }
- }
- }
-
-
- /* set number of regions and shapes, if not already done */
- if( !setargs ){
- snprintf(tbuf, SZ_LINE, "%d ", 1);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- }
-
- /* finish off region string */
- _FiltLexCat(FilterLexRegion2(filt,")"));
-
- /* no column arguments */
- colargs = 0;
- /* arguments are not set */
- setargs = 0;
- /* save angle not set */
- *saveang = 0;
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexRegionPanda(void)
-#else
-static int
-_FiltLexRegionPanda()
-#endif
-{
- int i;
- int n=0;
- int got=0;
- int a, r;
- int ahi=0, rhi=0;
- int hi=0;
- double d[11];
- double ainc=0.0, rinc=0.0;
- char tbuf[SZ_LINE];
- char *s=NULL;
- char *t, *u;
-
- switch(regid){
- case TY_PANDA:
- case TY_CPANDA:
- hi = 7;
- break;
- case TY_BPANDA:
- case TY_EPANDA:
- hi = 10;
- break;
- default:
- _filterror("unknown panda type -- contact saord@cfa.harvard.edu");
- break;
- }
- s = xstrdup(filtseg[nfiltseg-1]->s);
- for(i=hi; i>=0; i--){
- /* look for last comma */
- t = strrchr(s, ',');
- if( !t ) goto done;
- /* null it out from base string */
- *t = '\0';
- /* point past comma and get double value */
- t++;
- d[i] = strtod(t, &u);
- if( t == u ) goto done;
- }
-
- switch(regid){
- case TY_PANDA:
- case TY_CPANDA:
- ainc = (d[3] - d[2])/d[4];
- ahi = (int)d[4];
- rinc = (d[6] - d[5])/d[7];
- rhi = (int)d[7];
- break;
- case TY_BPANDA:
- case TY_EPANDA:
- ainc = (d[3] - d[2])/d[4];
- ahi = (int)d[4];
- rinc = (d[7] - d[5])/d[9];
- rhi = (int)d[9];
- break;
- default:
- _filterror("unknown panda type -- contact saord@cfa.harvard.edu");
- break;
- }
- /* process limits arguments */
- for(a=1; a<=ahi; a++){
- for(r=1; r<=rhi; r++){
- snprintf(tbuf, SZ_LINE, DFMT4,
- d[5]+((r-1)*rinc), d[5]+(r*rinc),
- d[2]+((a-1)*ainc), d[2]+(a*ainc));
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- __FiltLexCat("\n", &(filtseg[nfiltseg-1]->radang),
- &(filtseg[nfiltseg-1]->ralen));
- n++;
- }
- }
-
- /* adjust region and shape count */
- snprintf(tbuf, SZ_LINE, "%d ", n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->regions),
- &(filtseg[nfiltseg-1]->nr));
- snprintf(tbuf, SZ_LINE, "%d ", 2*n);
- __FiltLexCat(tbuf, &(filtseg[nfiltseg-1]->shapes),
- &(filtseg[nfiltseg-1]->ns));
- _FiltLexTypeSet(TOK_ACCEL);
- /* success */
- got = 1;
-
-done:
- if( s ) xfree(s);
- return got;
-}
-
-/*
- *
- * _FiltLexRangeAdd -- add a rangelist string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexRangeAdd(char *xname, char *str, int type, int n, int maxlen)
-#else
-static void _FiltLexRangeAdd(xname, str, type, n, maxlen)
- char *xname;
- char *str;
- int type;
- int n;
- int maxlen;
-#endif
-{
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char *s;
- char *t;
- char *t2;
- char *name;
-
- /* get "in-expression" name for current technique */
- name = FilterLexName(filt, xname);
-
- /* initialize pointers */
- s = str;
- t = tbuf;
-
- /* clear working buffer */
- memset(t, 0, SZ_LINE);
-
- /* if this is not the beginning, we first need to OR with prev */
- if( n != 0 ) strncat(t, "||", maxlen-1);
-
- /* put in parens for safety */
- strncat(t, "(", maxlen-1);
-
- /* add the name */
- strncat(t, name, maxlen-1);
-
- /* add the rangelist */
- switch(type){
- case 1:
- strncat(t, "<=", maxlen-1);
- /* skip past : */
- s++;
- /* append value */
- t2 = tbuf2;
- while( *s ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- case 2:
- strncat(t, "==", maxlen-1);
- /* append upper value */
- t2 = tbuf2;
- while( *s ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- case 3:
- strncat(t, ">=", maxlen-1);
- /* append lower value */
- t2 = tbuf2;
- while( *s && (*s != ':') ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- /* skip past : */
- s++;
- strncat(t, "&&", maxlen-1);
- strncat(t, name, maxlen-1);
- strncat(t, "<=", maxlen-1);
- /* append upper value */
- t2 = tbuf2;
- while( *s ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- case 4:
- strncat(t, ">=", maxlen-1);
- /* append lower value */
- t2 = tbuf2;
- while( *s && (*s != ':') ){
- *t2++ = *s++;
- }
- *t2 = '\0';
- bin2num(tbuf2, tbuf2, maxlen-1);
- strncat(t, tbuf2, maxlen-1);
- break;
- }
- strncat(t, ")", maxlen-1);
- _FiltLexCat(tbuf);
-}
-
-/*
- *
- * _FiltLexTypeCmp -- compare routine for qsort
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexTypeCmp(const void *s1, const void *s2)
-#else
-static int _FiltLexTypeCmp(s1, s2)
- const void *s1;
- const void *s2;
-#endif
-{
- FiltSeg *f1 = (FiltSeg *)s1;
- FiltSeg *f2 = (FiltSeg *)s2;
-
- /* check for broken qsort */
- if( !*f1 || !*f2 ){
- _filterror("qsort is broken -- contact saord@cfa.harvard.edu");
- /* will not happen */
- return 0;
- }
-
- /* make sure null string is at the end */
- if( !(*f1)->s && !(*f2)->s ) return 0;
- else if( !(*f1)->s ) return 1;
- else if( !(*f2)->s ) return -1;
-
- /* paint: reverse order and make excludes local */
- if( filt->paint ){
- /* if both are regions, reverse order */
- if( ((*f1)->type & TOK_REG) && ((*f2)->type & TOK_REG) ){
- if( (*f1)->n < (*f2)->n ) return 1;
- else if( (*f1)->n > (*f2)->n ) return -1;
- else return 0;
- }
- /* keep same order */
- else{
- if( (*f1)->n < (*f2)->n ) return -1;
- else if( (*f1)->n > (*f2)->n ) return 1;
- else return 0;
- }
- }
- else{
- /* if both or neither are eregions, keep them in the same order */
- if( ((*f1)->type & TOK_EREG) == ((*f2)->type & TOK_EREG) ){
- if( (*f1)->n < (*f2)->n ) return -1;
- else if( (*f1)->n > (*f2)->n ) return 1;
- else return 0;
- }
- /* exactly one is an eregion -- and we want eregions last */
- else{
- if( (*f1)->type & TOK_EREG ) return 1;
- else if( (*f2)->type & TOK_EREG ) return -1;
- /* should not happen */
- else return 0;
- }
- }
-}
-
-/*
- *
- * _FiltLexTypeMatch -- see if the type of filtering we are doing
- * matches the type of token we have
- *
- */
-#ifdef YY_USE_PROTOS
-int
-_FiltLexTypeMatch(int ftype, int ttype)
-#else
-int _FiltLexTypeMatch(ftype, ttype)
- int ftype;
- int ttype;
-#endif
-{
- switch(ftype){
- case TYPE_IMAGE:
- /* we don't allow range list and col names in image filters */
- if( (ttype & TOK_RLIST) || (ttype & TOK_NAME) )
- return 0;
- /* everything else is fine */
- else
- return 1;
- case TYPE_EVENTS:
- return 1;
- default:
- return 1;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexArgCheck(char *name, int args)
-#else
-static int _FiltLexArgCheck(name, args)
- char *name;
- int args;
-#endif
-{
- int i;
-
- for(i=0; rnames[i]; i++){
- if( !strcmp(name, rnames[i]) ){
- if( args == rargs[i] ){
- return(0);
- }
- else{
- /* less than required min */
- if( args < rargs[i] )
- return(i+1);
- /* more than min args -- could be varargs */
- else{
- /* check args allowed in varargs */
- switch(vargs[i]){
- case 'e':
- if( (args%2) == 0 )
- return(-1);
- else
- return(i+1);
- case 'o':
- if( (args%2) == 1 )
- return(-1);
- else
- return(i+1);
- case 'y':
- return(-1);
- default:
- return(i+1);
- }
- }
- }
- }
- }
- return(0);
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexSetWcs(char *s)
-#else
-static void _FiltLexSetWcs(s)
- char *s;
-#endif
-{
- char name[SZ_LINE];
- int ip=0;
-
- newdtable(",=;");
- /* get name of global coordsys */
- if( word(s, name, &ip) ){
- if( gcoordsys ) xfree(gcoordsys);
- gcoordsys = xstrdup(name);
- culc(gcoordsys);
- }
- /* restore old delim table */
- freedtable();
-}
-
-#ifdef YY_USE_PROTOS
-static char *
-_FiltLexCB(char *name, void *client_data)
-#else
-static char *_FiltLexCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- FiltSeg f=(FiltSeg)client_data;
- int ip=0;
- int nr=0;
- int ns=0;
- char *s;
- char tbuf[SZ_LINE];
-
- if( !strcmp(name, "RS") ){
- /* exclude regions get no region value first time around */
- if( (macropass==0) && (f->type & TOK_EREG) ){
- return NULL;
- }
- /* get next region value and remove from string */
- if( word(f->regions, tbuf, &ip) ){
- nr = atoi(tbuf);
- s = xstrdup(&(f->regions[ip]));
- xfree(f->regions);
- f->regions = s;
- }
- else{
- _filterror("internal error: no region string specified");
- return(NULL);
- }
- if( !inexpr || (f->type & (TOK_ACCEL|TOK_VARARGS)) ){
- if( f->regval ){
- snprintf(macrobuf, SZ_LINE, "%d,", f->regval);
- }
- else{
- snprintf(macrobuf, SZ_LINE, "%d,", nregion+1);
- }
- nregion += nr;
- f->nregion += nr;
- inexpr = 1;
- }
- else{
- if( f->regval ){
- snprintf(macrobuf, SZ_LINE, "%d,", f->regval);
- }
- else{
- snprintf(macrobuf, SZ_LINE, "%d,", nregion);
- }
- }
-
- /* get next shape value and remove from string */
- ip = 0;
- if( word(f->shapes, tbuf, &ip) ){
- ns = atoi(tbuf);
- s = xstrdup(&(f->shapes[ip]));
- xfree(f->shapes);
- f->shapes = s;
- }
- else{
- _filterror("internal error: no shape string specified");
- return(NULL);
- }
- /* concat shape value */
- nshape++;
- snprintf(tbuf, SZ_LINE, "%d", nshape);
- strcat(macrobuf, tbuf);
- /* set new shape value */
- nshape += (ns-1);
-
- /* return macro value */
- return(macrobuf);
- }
- else{
- return NULL;
- }
-}
-
-/*
- *
- * _FiltLexNeedOp -- determine if we add a connecting operator for this segment
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexNeedOp(int i, char *s)
-#else
-static int _FiltLexNeedOp(i, s)
- int i;
- char *s;
-#endif
-{
- int c;
- /* check for operator in current string */
- if( s && *s ){
- c = *s;
- switch(c){
- case '&':
- case '|':
- case '=':
- case '!':
- case '<':
- case '>':
- return 0;
- default:
- break;
- }
- }
- /* not in this string check for operator in previous */
- for(i=i-1; i>=0; i--){
- if( !filtseg[i] || !filtseg[i]->s ) continue;
- if( strcmp(filtseg[i]->s, "(") && strcmp(filtseg[i]->s, ")") )
- break;
- }
- if( i >= 0 ){
- c = filtseg[i]->s[strlen(filtseg[i]->s)-1];
- switch(c){
- case '&':
- case '|':
- case '=':
- case '!':
- case '<':
- case '>':
- return 0;
- default:
- return 1;
- }
- }
- else{
- return 0;
- }
-}
-
-/*
- *
- * _FiltLexMake -- generate filter from filter segments
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexMake(void)
-#else
-static void _FiltLexMake()
-#endif
-{
- int i, j, k, l;
- int x, xtot;
- int type=0;
- int ltype=0;
- int opar=0;
- char *s;
-
- /* debugging */
- if( filt->debug ){
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i]->s )
- fprintf(stderr, "unsorted #%d %s\n", filtseg[i]->n, filtseg[i]->s);
- else
- fprintf(stderr, "unsorted #%d %d is empty\n", i, filtseg[i]->n);
- }
- }
- /* look for bad region expressions and determine how many regions we have */
- for(i=0, j=0, k=0, l=0; i<nfiltseg; i++){
- if( !filtseg[i] || !filtseg[i]->s ) continue;
- type = filtseg[i]->type;
- /* make sure we want the type being offered */
- if( !_FiltLexTypeMatch(filt->type, type) ){
- _filterror("column filters not permitted in an image filter expression");
- }
- /* look for bad combinations */
- if( (type & TOK_NREG) && !(type & TOK_IREG) )
- _filterror("!region must be combined with another region (e.g., field()&&!region)");
- if( (type & TOK_EREG) && (type & TOK_IREG) )
- _filterror("-region must not be combined with another region (use !region instead)");
- if( (type & TOK_EREG) && (type & TOK_NAME) )
- _filterror("-region must not be combined with filters (use !region instead)");
- if( (type & TOK_EREG) && (type & TOK_RLIST) )
- _filterror("-region must not be combined with range lists (use !region instead)");
- if( (type & TOK_EREG) && (type & TOK_RTINE) )
- _filterror("-region must not be combined with routines (use !region instead)");
- /* count region types */
- if( filtseg[i]->type & TOK_IREG ) j++;
- if( filtseg[i]->type & TOK_NREG ) k++;
- if( filtseg[i]->type & TOK_EREG ) l++;
- }
- /* check for fits image mask and process specially */
- if( filt->masks ){
- /* can't have fits mask and ascii regions */
- if( j || k || l ){
- _filterror("FITS image masks cannot be combined with ASCII regions");
- }
- /* image filtering of events uses a imagemask special routine */
- if( (filt->type == TYPE_EVENTS) && filt->evsect ){
- strcpy(yytext, "imagemask");
- _FiltLexRegionStart(1);
- _FiltLexRegionEnd();
- }
- else{
- __FiltLexCat("imagemask", &filter, &filtlen);
- nregion = filt->nmaskreg;
- return;
- }
- }
- /* if we have only exclude regions, add field */
- if( !j && !k && l ){
- strcpy(yytext, "field");
- if( filt->type == TYPE_EVENTS )
- _FiltLexRegionStart(1);
- else
- _FiltLexRegionStart(0);
- _FiltLexRegionEnd();
- }
-
- /* reset region and shape counts */
- nregion=0;
- nshape=0;
-
- /* expand macro before reordering, to maintain region numbers in sequence */
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i] && filtseg[i]->s ){
- if( _FiltLexNeedOp(i, NULL) ) inexpr=0;
- macropass=0;
- s = ExpandMacro(filtseg[i]->s, NULL, NULL, 0, _FiltLexCB, filtseg[i]);
- xfree(filtseg[i]->s);
- filtseg[i]->s = s;
- }
- }
-
- /* we want descending order so that eregions are last in the expression */
- qsort(filtseg, nfiltseg, sizeof(FiltSeg), _FiltLexTypeCmp);
-
- if( filt->debug ){
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i]->s )
- fprintf(stderr, "sorted #%d %s\n", filtseg[i]->n, filtseg[i]->s);
- else
- fprintf(stderr, "sorted #%d %d is empty\n", i, filtseg[i]->n);
- }
- }
-
- /* add open paren and mark that we did it */
- __FiltLexCat("(", &filter, &filtlen);
- opar = 1;
-
- /* run through segments, inserting proper boolean connectors */
- ltype = 0;
- for(i=0; i<nfiltseg; ){
- if( filtseg[i] && filtseg[i]->s ){
- /* no type probably means its a paren, so just add it and jump out */
- if( !filtseg[i]->type ){
- __FiltLexCat(filtseg[i]->s, &filter, &filtlen);
- /* remove empty parens, if we just make them */
- x = strlen(filter);
- if( (filter[x-2] == '(') && (filter[x-1] == ')') )
- filter[x-2] = '\0';
- i++;
- continue;
- }
- type = filtseg[i]->type;
- if( _FiltLexNeedOp(i, NULL) ) inexpr=0;
- macropass=1;
- s = ExpandMacro(filtseg[i]->s, NULL, NULL, 0, _FiltLexCB, filtseg[i]);
- if( _FiltLexNeedOp(i, s) ){
- /* remove trailing open parens from prev. segment (add back later) */
- for(xtot=0, x=strlen(filter)-1; x>=0; x--){
- if( filter[x] != '(' ) break;
- filter[x] = '\0';
- xtot++;
- }
- if( (ltype & TOK_IREG) && (type & TOK_IREG) ){
- __FiltLexCat("||", &filter, &filtlen);
- }
- else if( (ltype & TOK_IREG) && (type & TOK_EREG) ){
- if( opar > 0 ){
- __FiltLexCat(")", &filter, &filtlen);
- opar--;
- }
- if( filt->paint ){
- if( opar > 0 ){
- __FiltLexCat(")", &filter, &filtlen);
- opar --;
- }
- __FiltLexCat("||", &filter, &filtlen);
- }
- else{
- __FiltLexCat("&&", &filter, &filtlen);
- }
- __FiltLexCat("(", &filter, &filtlen);
- opar++;
- }
- else if( (ltype & TOK_EREG) && (type & TOK_EREG) ){
- __FiltLexCat("&&", &filter, &filtlen);
- }
- else if( (ltype & TOK_EREG) && (type & TOK_IREG) ){
- if( filt->paint && (opar > 0) ){
- __FiltLexCat(")", &filter, &filtlen);
- opar --;
- }
- __FiltLexCat("&&", &filter, &filtlen);
- __FiltLexCat("(", &filter, &filtlen);
- opar ++;
- if( filt->paint ){
- __FiltLexCat("(", &filter, &filtlen);
- opar++;
- }
- }
- /* otherwise implied operator is AND */
- else{
- __FiltLexCat("&&", &filter, &filtlen);
- }
- /* add back parens */
- for(x=0; x<xtot; x++){
- __FiltLexCat("(", &filter, &filtlen);
- }
- }
- else{
- if( filt->paint && (i==0) ){
- __FiltLexCat("((", &filter, &filtlen);
- opar +=2;
- }
- }
- __FiltLexCat(s, &filter, &filtlen);
- if( s ) xfree(s);
- if( filtseg[i]->radang ){
- if( *filtseg[i]->radang == ',' )
- __FiltLexCat(filtseg[i]->radang+1, &radang, &radanglen);
- else
- __FiltLexCat(filtseg[i]->radang, &radang, &radanglen);
- }
- else{
- __FiltLexCat("NA,NA,NA,NA\n", &radang, &radanglen);
- }
- i++;
- for(; (i<nfiltseg) && (filtseg[i]->type==type); ){
- if( _FiltLexNeedOp(i, NULL) ) inexpr=0;
- s = ExpandMacro(filtseg[i]->s, NULL, NULL, 0, _FiltLexCB, filtseg[i]);
- if( _FiltLexNeedOp(i, s) ){
- for(xtot=0, x=strlen(filter)-1; x>=0; x--){
- if( filter[x] != '(' ) break;
- filter[x] = '\0';
- xtot++;
- }
- /* if lhs and rhs are regions, implied operator is OR */
- if( type & TOK_IREG )
- __FiltLexCat("||", &filter, &filtlen);
- /* otherwise implied operator is AND */
- else
- __FiltLexCat("&&", &filter, &filtlen);
- for(x=0; x<xtot; x++){
- __FiltLexCat("(", &filter, &filtlen);
- }
- }
- __FiltLexCat(s, &filter, &filtlen);
- if( s ) xfree(s);
- if( filtseg[i]->radang ){
- if( *filtseg[i]->radang == ',' )
- __FiltLexCat(filtseg[i]->radang+1, &radang, &radanglen);
- else
- __FiltLexCat(filtseg[i]->radang, &radang, &radanglen);
- }
- else{
- __FiltLexCat("NA,NA,NA,NA\n", &radang, &radanglen);
- }
- i++;
- }
- }
- /* ignore invalid arguments */
- else{
- i++;
- }
- /* save last type */
- ltype = type;
- }
-
- /* if last segment was an exclude and we are in paint mode, ignore it */
- if( filt->paint && (ltype & TOK_EREG) ){
- __FiltLexCat("&&0", &filter, &filtlen);
- }
-
- /* close off open parens (lots could be needed in paint mode) */
- while( opar-- ){
- __FiltLexCat(")", &filter, &filtlen);
- }
-
- /* check for even number of parens */
- l = strlen(filter);
- for(i=0, j=0; i<l; i++){
- if( filter[i] == '(' ) j++;
- if( filter[i] == ')' ) j--;
- }
- if( j != 0 ){
- if( filt->debug ) fprintf(stderr, "paren error %d: %s\n", j, filter);
- _filterror("unbalanced parentheses");
- }
- if( filt->debug ) fprintf(stderr, "filter: %s\n", filter);
-}
-
-/*
- *
- * _FiltLexEnd -- cleanup from parsing regions
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexEnd(void)
-#else
-static void _FiltLexEnd()
-#endif
-{
- int i;
-
- /* reset state variables */
- colargs = 0;
- initbindefs = 0;
- include_stack_ptr = 0;
- nroutine = 0;
- nshape = 0;
- nmask = 0;
- nparen = 0;
- parse_error = 0;
- filtlen = 0;
- radanglen = 0;
- regid = 0;
- regtype = 0;
- inexpr = 0;
- *regname = '\0';
- *saveang = 0;
- *(wcsnames[0]) = '\0';
- *(wcsnames[1]) = '\0';
- binsiz[0] = 1;
- binsiz[1] = 1;
- /* free up previous filter */
- if( filter ){
- xfree(filter);
- filter = NULL;
- }
- /* free up previous radang string */
- if( radang ){
- xfree(radang);
- radang = NULL;
- }
- /* free up wcs */
- if( wcs ){
- wcsfree (wcs);
- wcs = NULL;
- }
- /* no segments */
- if( filtseg ){
- for(i=0; i<nfiltseg; i++){
- if( filtseg[i] ){
- if( filtseg[i]->s ) xfree(filtseg[i]->s);
- if( filtseg[i]->regions ) xfree(filtseg[i]->regions);
- if( filtseg[i]->shapes ) xfree(filtseg[i]->shapes);
- if( filtseg[i]->radang ) xfree(filtseg[i]->radang);
- xfree(filtseg[i]);
- }
- }
- xfree(filtseg);
- filtseg = NULL;
- }
- maxfiltseg = 0;
- nfiltseg = 0;
- if( gcoordsys ){
- xfree(gcoordsys);
- gcoordsys = NULL;
- }
- if( fcoordsys ){
- xfree(fcoordsys);
- fcoordsys = NULL;
- }
- cdelt1 = 0.0;
- cdelt2 = 0.0;
- crot = 0.0;
-}
-
-/*
- *
- * _FiltLexGetWcs -- determine the WCS coord system to use for wcsc translation
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_FiltLexGetWcs(void)
-#else
-static char *_FiltLexGetWcs()
-#endif
-{
- if( gcoordsys &&
- strcmp(gcoordsys, "image") && strcmp(gcoordsys, "physical") )
- return gcoordsys;
- if( fcoordsys &&
- strcmp(fcoordsys, "image") && strcmp(fcoordsys, "physical") )
- return fcoordsys;
- return NULL;
-}
-
-/*
- *
- * _FiltLexWcsCols -- reset WCS for these columns
- *
- */
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexWcsCols(FITSHead iheader, char *name0, char *name1)
-#else
-static void _FiltLexWcsCols(iheader, name0, name1)
- FITSHead iheader;
- char *name0;
- char *name1;
-#endif
-{
- int i, which, ival;
- int simple=1;
- double dval, dval2;
- char *s;
- FITSHead oheader;
- FITSCard card;
-
- /* make sure we have something to process */
- if( !iheader )
- return;
-
- if( filt->fhd->image ){
- /* free up old wcs */
- if( wcs ) wcsfree (wcs);
- /* init new wcs */
- hlength(ft_cards(filt->fhd),0);
- wcs = wcsinit(ft_cards(filt->fhd));
- tltyp[0] = 0;
- tltyp[1] = 0;
- }
- /* for tables, we can init wcs only the specified columns */
- else if( name0 && *name0 && name1 && *name1 ){
- /* see if these are the same as the last set of columns */
- if( (*(wcsnames[0]) && !strcasecmp(name0,wcsnames[0])) &&
- (*(wcsnames[1]) && !strcasecmp(name1,wcsnames[1])) && wcs ){
- return;
- }
-
- /* gather up important tl info about the binning columns */
- for(i=1; i<=iheader->table->tfields; i++){
- /* determine which bincol we are processing */
- if( !strcasecmp(iheader->table->col[i-1].name, name0) )
- which = 0;
- else if( !strcasecmp(iheader->table->col[i-1].name, name1) )
- which = 1;
- else
- continue;
- /* set tlinfo values for this column */
- tlmin[which] = ft_headgetr(iheader, "TLMIN", i, 1.0, &card);
- tlmax[which] = ft_headgetr(iheader, "TLMAX", i, 1.0, &card);
- binsiz[which] = ft_headgetr(iheader, "TDBIN", i, 1.0, &card);
- tltyp[which] = iheader->table->col[i-1].type;
- }
-
- /* free up old wcs */
- if( wcs ) wcsfree (wcs);
- /* make a copy of the header */
- oheader = ft_headcopy(iheader);
-
- /* make sure this is a primary FITS file */
- ft_cardfmt((FITSCard)oheader->cards,
- "SIMPLE", 0, FT_LOGICAL, &simple, 0, "Standard FITS");
- /* set dimension info, used by wcs code */
- ft_headseti(oheader, "NAXIS", 0, 2, "number of axes", 1);
- /* set dimension info */
- for(i=0; i<=1; i++){
- ival = (int)tldim(tlmin[i], tlmax[i], binsiz[i], tltyp[i]);
- ft_headseti(oheader, "NAXIS", i+1, ival, "axis dimension", 1);
- }
- /* set bitpix */
- ft_headseti(oheader, "BITPIX", 0, 32, "bits/pixel", 1);
- /* synchronize the header and the cards after any changes */
- ft_syncdata(oheader);
-
- /* transform WCS cards for the specified columns, if we have such */
- for(i=1; i<=iheader->table->tfields; i++){
- /* determine which bincol we are processing */
- if( !strcasecmp(iheader->table->col[i-1].name, name0) )
- which = 0;
- else if( !strcasecmp(iheader->table->col[i-1].name, name1) )
- which = 1;
- else
- continue;
- /* convert event wcs header info image wcs info */
- if( (s=ft_headgets(iheader, "TCTYP", i, NULL, &card)) && card ){
- ft_headapps(oheader, "CTYPE", which+1, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCRVL", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CRVAL", which+1, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCDLT", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CDELT", which+1, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCROT", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CROTA", which+1, s, NULL);
- xfree(s);
- }
- /* this value gets converted from physical to image */
- if( (dval=ft_headgetr(iheader, "TCRPX", i, 0.0, &card)) && card ){
- dval2 = tlp2i(dval, tlmin[which], binsiz[which], tltyp[which]);
- ft_headsetr(oheader, "CRPIX", which+1, dval2, 7, NULL, 1);
- }
- }
-
- /* init new wcs */
- hlength(ft_cards(oheader),0);
- wcs = wcsinit(ft_cards(oheader));
- ft_headfree(oheader, 1);
- /* save names for next time */
- strcpy(wcsnames[0], name0);
- strcpy(wcsnames[1], name1);
- }
-
- /* set some extra wcs parameters */
- if( wcs && iswcs(wcs) ){
- if( fcoordsys ) xfree(fcoordsys);
- fcoordsys = xstrdup(wcs->radecin);
- culc(fcoordsys);
- if( !wcs->coorflip ){
- cdelt1 = wcs->cdelt[0];
- cdelt2 = wcs->cdelt[1];
- }
- else{
- cdelt1 = wcs->cdelt[1];
- cdelt2 = wcs->cdelt[0];
- }
- if ( wcs->imflip ) {
- crot = -wcs->rot;
- } else {
- crot = wcs->rot;
- }
- }
- else{
- cdelt1 = 0.0;
- cdelt2 = 0.0;
- crot = 0.0;
- }
- /* set global coord system first time through */
- if( !gcoordsys ){
- if( (gcoordsys=xstrdup(getenv("COORDSYS"))) == NULL )
- gcoordsys = xstrdup(DEFAULT_COORDSYS);
- }
-}
-
-/*
- *
- * _FiltLexLcx -- determine if we have a linear-type WCS
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_FiltLexLcx(void)
-#else
-static int _FiltLexLcx()
-#endif
-{
- char *coordsys;
- coordsys = gcoordsys;
- if( !coordsys || !*coordsys )
- return 0;
- if( !strcasecmp(coordsys, "image") ) return LCX_IMAGE;
- if( !strcasecmp(coordsys, "physical") ) return LCX_PHYS;
- if( !strcasecmp(coordsys, "amplifier") ) return LCX_AMP;
- if( !strcasecmp(coordsys, "detector") ) return LCX_DET;
- return 0;
-}
-
-#ifdef YY_USE_PROTOS
-static void
-_FiltLexNum(int lcx)
-#else
-static void _FiltLexNum(lcx)
- int lcx;
-#endif
-{
- char tbuf[SZ_LINE];
-
- /* process binary number, if necessary */
- bin2num(tbuf, yytext, SZ_LINE);
-
- /* for linear coordinate systems (physical, amps, etc.),
- we have to convert to image coords or physical coords,
- depending on the type of data and type of filtering */
- if( lcx ){
- /* data is in a table: we can use image or physical coords */
- if( filt->fhd->table ){
- /* if we want to use physical coordinates ... */
- if( USEPHYS ){
- /* convert image positions to physical coords */
- if( lcx == LCX_IMAGE ){
- if( POSARG ){
- dval = tli2p(strtod(tbuf,NULL),
- tlmin[(narg+1)%2], binsiz[(narg+1)%2], tltyp[(narg+1)%2]);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* angle arguments are just passed along */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* size arguments have to be converted using the binsize */
- else{
- if( SAVEANG ){
- dval = strtod(tbuf,NULL);
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- dval = strtod(tbuf,NULL) * binsiz[(narg+1)%2];
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- /* already in physical -- just pass along args */
- else{
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- /* we are using image coords (image-style filtering) */
- else{
- /* convert non-image positions to image coords */
- if( lcx != LCX_IMAGE ){
- if( POSARG ){
- dval = tlp2i(strtod(tbuf,NULL),
- tlmin[(narg+1)%2], binsiz[(narg+1)%2], tltyp[(narg+1)%2]);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* angle arguments are just passed along */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* size arguments have to be converted using the binsize */
- else{
- if( SAVEANG ){
- dval = strtod(tbuf,NULL);
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- dval = strtod(tbuf,NULL) / binsiz[(narg+1)%2];
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- /* already in image -- just pass along args */
- else{
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- _FiltLexArgSave(dval);
- }
- }
- }
- /* data is in an image: we use image coords */
- else{
- /* convert positional arguments to image */
- if( POSARG ){
- /* save x value for processing with y next time */
- if( XARG ){
- xpos = SAOstrtod(tbuf,NULL);
- }
- else{
- ypos = SAOstrtod(tbuf,NULL);
- switch(lcx){
- case LCX_IMAGE:
- xpix = xpos;
- ypix = ypos;
- break;
- case LCX_PHYS:
- ft_phy2img(filt->fhd, xpos, ypos, &xpix, &ypix);
- break;
- case LCX_AMP:
- ft_amp2phy(filt->fhd, xpos, ypos, &dval, &dval2);
- ft_phy2img(filt->fhd, dval, dval2, &xpix, &ypix);
- break;
- case LCX_DET:
- ft_det2phy(filt->fhd, xpos, ypos, &dval, &dval2);
- ft_phy2img(filt->fhd, dval, dval2, &xpix, &ypix);
- break;
- }
- snprintf(sbuf, SZ_LINE, DFMT2, xpix, ypix);
- _FiltLexCat(sbuf);
- }
- }
- /* angle arguments are just passed along, with updated crot */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* convert size args, which may or may not be in pairs */
- else{
- if( SAVEANG ){
- dval = strtod(tbuf,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(saveang, SZ_LINE, DFMT1, dval);
- }
- /* arg 1 is associated with ra, arg2 with dec */
- if( XARG ){
- xpos = ABS(strtod(tbuf,NULL));
- ypos = 0.0;
- switch(lcx){
- case LCX_IMAGE:
- xpix = xpos;
- break;
- case LCX_PHYS:
- ft_phy2img_size(filt->fhd, xpos, ypos, &xpix, &ypix);
- break;
- case LCX_AMP:
- ft_amp2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- case LCX_DET:
- ft_det2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- }
- snprintf(sbuf, SZ_LINE, DFMT1, xpix);
- _FiltLexArgSave(xpix);
- }
- else{
- xpos = 0.0;
- ypos = ABS(strtod(tbuf,NULL));
- switch(lcx){
- case LCX_IMAGE:
- ypix = ypos;
- break;
- case LCX_PHYS:
- ft_phy2img_size(filt->fhd, xpos, ypos, &xpix, &ypix);
- break;
- case LCX_AMP:
- ft_amp2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- case LCX_DET:
- ft_det2phy_size(filt->fhd, xpos,ypos, &dval,&dval2);
- ft_phy2img_size(filt->fhd, dval,dval2, &xpix,&ypix);
- break;
- }
- snprintf(sbuf, SZ_LINE, DFMT1, ypix);
- _FiltLexArgSave(ypix);
- }
- _FiltLexCat(sbuf);
- }
- }
- }
- /* not lcx -- angle arguments are just passed along with updated crot */
- else if( ANGARG ){
- dval = strtod(tbuf,NULL);
- if( USEWCS ) dval += crot;
- if( IMFLIP ) dval = -dval;
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* panda numeric args are just passed along */
- else if( NUMARG ){
- dval = strtod(tbuf,NULL);
- snprintf(sbuf, SZ_LINE, DFMT1, dval);
- _FiltLexCat(sbuf);
- }
- /* not lcx -- everything else is assumed to be in units of "degrees"
- in the default system. add 'd' and put back for reparsing */
- else{
- int i;
- char *yycopy = xstrdup(tbuf);
- unput('d');
- for(i=yyleng-1; i>=0; --i)
- unput(yycopy[i]);
- xfree(yycopy);
- narg--;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltIncMask(FilterMask masks, int maxmask, int nmask)
-#else
-static int _FiltIncMask(masks, maxmask, nmask)
- FilterMask masks;
- int maxmask;
- int nmask;
-#endif
-{
- int omax;
- nmask++;
- if( nmask >= maxmask ){
- omax = maxmask;
- maxmask += MASKINC;
- masks = (FilterMask)xrealloc(masks, maxmask*sizeof(FilterMaskRec));
- memset(masks+omax, 0, (maxmask-omax)*sizeof(FilterMaskRec));
- }
- return nmask;
-}
-
-#ifdef YY_USE_PROTOS
-static int
-_FiltFitsMask(char *filename, FilterMask *rmasks, FITSHead *rhead, int *nreg)
-#else
-static int _FiltFitsMask(filename, rmasks, rhead, nreg)
- char *filename;
- FilterMask *rmasks;
- FITSHead *rhead;
- int *nreg;
-#endif
-{
- short *dptr;
- short *data=NULL;
- int x, y;
- int maxreg=-1;
- int maxmask; /* max masks allocated thus far */
- int nmask=0; /* number of mask segments */
- FilterMask masks=NULL; /* array valid region masks for one row */
- FITSHead head=NULL;
-
- /* read fits image */
- if( !ft_simpleimageread(filename, &head, (void *)&data, NULL, 16) ){
- return(-1);
- }
- if( !head->image ){
- if( data ) xfree(data);
- if( head ) ft_headfree(head, 1);
- return(-2);
- }
- if( !ft_naxes(head) || !ft_naxis(head, 1) || !ft_naxis(head, 2) ){
- if( data ) xfree(data);
- if( head ) ft_headfree(head, 1);
- return(-3);
- }
-
- /* allocate an array of masks, which will be returned to caller */
- maxmask = MASKINC;
- masks = (FilterMask)xcalloc(maxmask, sizeof(FilterMaskRec));
- /* seed the first region mask value */
- masks[nmask].region = 0;
- /* loop through y rows */
- for(y=1; y<=ft_naxis(head, 2); y++){
- dptr = data + ((y-1) * ft_naxis(head, 1));
- /* to start this line, we make a seed mask with no region */
- if( masks[nmask].region ){
- nmask = _FiltIncMask(masks, maxmask, nmask);
- masks[nmask].region = 0;
- }
- /* process each pixel in the row */
- for(x=1; x<=ft_naxis(head, 1); x++, dptr++){
- /* we do not allow negative values */
- if( *dptr < 0 ){
- if( data ) xfree(data);
- if( head ) ft_headfree(head, 1);
- if( masks ) xfree(masks);
- return(-4);
- }
- /* set max region as needed */
- if( *dptr > maxreg )
- maxreg = *dptr;
- /* look for a change in the mask */
- if( *dptr != masks[nmask].region ){
- /* if previous was non-zero region, finish it and bump to next */
- if( masks[nmask].region ){
- masks[nmask].xstop = x - 1;
- nmask = _FiltIncMask(masks, maxmask, nmask);
- }
- masks[nmask].y = y;
- masks[nmask].region = *dptr;
- masks[nmask].xstart = x;
- }
- }
- /* finish last non-zero segment, inc number of mask segs */
- if( masks[nmask].region ){
- masks[nmask].xstop = x;
- nmask = _FiltIncMask(masks, maxmask, nmask);
- }
- }
-
- /* free up data space */
- if( data ) xfree(data);
- /* allocate just enough mask space */
- masks = (FilterMask)xrealloc(masks, nmask*sizeof(FilterMaskRec));
- if( rmasks )
- *rmasks = masks;
- else
- xfree(masks);
- if( rhead )
- *rhead = head;
- else
- ft_headfree(head, 1);
- if( nreg )
- *nreg = maxreg;
-
- return(nmask);
-}
-
-/*
- *
- * Semi-public Routines
- *
- *
- */
-
-/*
- *
- * _FilterString -- return output filter from lexer
- *
- */
-#ifdef YY_USE_PROTOS
-char *
-_FilterString(void)
-#else
-char *_FilterString()
-#endif
-{
- if( filtlen <= 0 )
- _FiltLexMake();
- return(filter);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterRoutineCount(void)
-#else
-int FilterRoutineCount()
-#endif
-{
- return(nroutine);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterShapeCount(void)
-#else
-int FilterShapeCount()
-#endif
-{
- return(nshape);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterRegionCount(int type)
-#else
-int FilterRegionCount(type)
- int type;
-#endif
-{
- int i, j;
-
- /* handle fits image masks specially */
- if( nmask ){
- if( type & TOK_IREG )
- return(nregion);
- else
- return(0);
- }
-
- /* normal regions */
- for(i=0, j=0; i<nfiltseg; i++){
- if( filtseg[i]->type & type ){
- j += filtseg[i]->nregion;
- }
- }
- return(j);
-}
-
-#ifdef YY_USE_PROTOS
-char *
-FilterRadAng(void)
-#else
-char *FilterRadAng()
-#endif
-{
- return(radang);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterParseError(void)
-#else
-int FilterParseError()
-#endif
-{
- return(parse_error);
-}
-
-#ifdef YY_USE_PROTOS
-int
-FilterTlInfo(double *tlmins, double *binsizs, int *tltyps)
-#else
-int FilterTlInfo(tlmins, binsizs, tltyps)
- double *tlmins;
- double *binsizs;
- int *tltyps;
-#endif
-{
- tlmins[0] = tlmin[0];
- tlmins[1] = tlmin[1];
- binsizs[0] = binsiz[0];
- binsizs[1] = binsiz[1];
- tltyps[0] = tltyp[0];
- tltyps[1] = tltyp[1];
- return 1;
-}
-
-#ifdef YY_USE_PROTOS
-void
-FiltInitParser(void)
-#else
-void FiltInitParser()
-#endif
-{
- static int parser = 0;
- /* make sure we free'd up all space from last time */
- _FiltLexEnd();
- /* set up some convenience variables */
- filt = FilterDefault();
-/*
- if( parser )
- yyrestart(NULL);
-*/
- BEGIN INITIAL;
- parser++;
- laststart=INITIAL;
-}
-
-#ifdef YY_USE_PROTOS
-void
-FiltScanString(char *s)
-#else
-void FiltScanString(s)
- char *s;
-#endif
-{
- int i;
- char *t;
- /* make sure there is an explicit delim at end so we are done before
- lex finds EOF -- otherwise panda shapes don't get processed */
- i = strlen(s);
- t = xmalloc(i+2);
- strcpy(t, s);
- if( (t[i-1] != ';') && (t[i-1] != '\n') )
- strcat(t, "\n");
- yy_scan_string(t);
- if( t ) xfree(t);
-}
-
-/* yyerror -- renamed to _filterror because flex -P does not change this */
-#ifdef YY_USE_PROTOS
-int
-_filterror(char *msg)
-#else
-int _filterror(msg)
- char *msg;
-#endif
-{
- if( *yytext )
- gerror(stderr, "%s while parsing filter at: %s\n",
- msg ? msg : "filterr", yytext);
- else
- gerror(stderr, "%s\n", msg ? msg : "filterr");
- YY_FLUSH_BUFFER;
- parse_error = 1;
- yyterminate();
-}
-
-#ifdef YY_USE_PROTOS
-int yywrap(void)
-#else
-int yywrap()
-#endif
-{
- return 1;
-}
diff --git a/funtools/filter/lex.idx.c b/funtools/filter/lex.idx.c
deleted file mode 100644
index cfceac7..0000000
--- a/funtools/filter/lex.idx.c
+++ /dev/null
@@ -1,2829 +0,0 @@
-#define yy_create_buffer idx_create_buffer
-#define yy_delete_buffer idx_delete_buffer
-#define yy_scan_buffer idx_scan_buffer
-#define yy_scan_string idx_scan_string
-#define yy_scan_bytes idx_scan_bytes
-#define yy_flex_debug idx_flex_debug
-#define yy_init_buffer idx_init_buffer
-#define yy_flush_buffer idx_flush_buffer
-#define yy_load_buffer_state idx_load_buffer_state
-#define yy_switch_to_buffer idx_switch_to_buffer
-#define yyin idxin
-#define yyleng idxleng
-#define yylex idxlex
-#define yyout idxout
-#define yyrestart idxrestart
-#define yytext idxtext
-#define yywrap idxwrap
-
-/* A lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-#include <stdio.h>
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-#include <unistd.h>
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, idxtext_ptr )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-static YY_BUFFER_STATE yy_current_buffer = 0;
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart YY_PROTO(( FILE *input_file ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-typedef unsigned char YY_CHAR;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-typedef int yy_state_type;
-extern char yytext[];
-
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- idxtext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- if ( yyleng >= YYLMAX ) \
- YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
- yy_flex_strncpy( yytext, idxtext_ptr, yyleng + 1 ); \
- yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 15
-#define YY_END_OF_BUFFER 16
-static yyconst short int yy_accept[570] =
- { 0,
- 0, 0, 16, 14, 13, 15, 14, 14, 14, 14,
- 1, 1, 14, 14, 14, 6, 6, 6, 14, 10,
- 8, 0, 2, 2, 1, 0, 1, 0, 11, 9,
- 12, 0, 6, 0, 6, 6, 7, 0, 0, 0,
- 2, 1, 0, 0, 5, 0, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 0, 0, 2,
- 1, 0, 0, 0, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 0, 0,
- 0, 5, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 0, 0, 0,
-
- 6, 0, 6, 0, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 0, 0, 5, 0, 6,
- 6, 0, 6, 6, 6, 6, 6, 6, 6, 0,
- 5, 6, 0, 6, 0, 6, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
- 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
- 0, 0, 0, 0, 0, 4, 0, 0, 3, 0,
- 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
- 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 4, 0,
- 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
- 0, 0, 0, 0, 4, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0
- } ;
-
-static yyconst int yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 1, 1, 1, 1, 5, 1, 6,
- 7, 1, 8, 9, 10, 11, 1, 12, 13, 14,
- 15, 16, 17, 15, 18, 19, 15, 1, 1, 20,
- 21, 22, 1, 1, 26, 27, 28, 29, 30, 31,
- 32, 25, 33, 25, 25, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 25, 45, 46, 25,
- 23, 1, 24, 1, 25, 1, 26, 27, 28, 29,
-
- 30, 31, 32, 25, 33, 25, 25, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 25, 45,
- 46, 25, 1, 47, 1, 48, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst int yy_meta[49] =
- { 0,
- 1, 1, 2, 1, 1, 3, 4, 5, 6, 5,
- 7, 8, 8, 8, 8, 8, 8, 8, 8, 1,
- 1, 1, 9, 1, 10, 11, 11, 11, 11, 12,
- 11, 10, 10, 13, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 13, 10, 1, 14
- } ;
-
-static yyconst short int yy_base[607] =
- { 0,
- 0, 0, 2154, 2377, 2377, 2377, 2132, 2119, 2056, 0,
- 38, 39, 2040, 2015, 2014, 47, 48, 51, 1979, 2377,
- 2377, 2009, 1994, 1993, 0, 48, 2377, 0, 2377, 2377,
- 2377, 45, 53, 1995, 87, 1987, 2377, 2003, 52, 53,
- 0, 1979, 58, 2005, 2377, 1987, 61, 71, 74, 96,
- 82, 73, 75, 51, 116, 118, 121, 1991, 81, 0,
- 2377, 2002, 93, 139, 129, 124, 132, 127, 145, 150,
- 151, 153, 155, 158, 166, 164, 169, 176, 1991, 179,
- 194, 1983, 198, 187, 189, 202, 203, 205, 209, 210,
- 213, 214, 228, 217, 229, 233, 237, 1988, 255, 243,
-
- 257, 262, 242, 252, 264, 249, 267, 268, 271, 276,
- 286, 291, 292, 295, 297, 0, 304, 310, 97, 315,
- 307, 334, 323, 325, 330, 296, 336, 329, 338, 1992,
- 130, 341, 377, 348, 366, 345, 1987, 354, 367, 351,
- 1983, 390, 404, 402, 422, 1977, 433, 1922, 179, 470,
- 1915, 1942, 504, 416, 512, 447, 532, 451, 540, 1939,
- 563, 1910, 220, 600, 1899, 298, 2377, 634, 455, 642,
- 459, 662, 463, 670, 467, 693, 1898, 336, 730, 1896,
- 378, 173, 484, 764, 488, 784, 492, 792, 496, 448,
- 462, 815, 1895, 466, 360, 500, 282, 504, 849, 526,
-
- 420, 452, 503, 48, 527, 554, 94, 437, 102, 358,
- 1926, 555, 567, 136, 377, 1925, 1924, 575, 1904, 579,
- 1858, 1862, 299, 578, 1847, 221, 1864, 579, 1836, 1815,
- 345, 1828, 1829, 581, 1813, 559, 1799, 586, 1795, 400,
- 1784, 570, 1790, 353, 1785, 567, 1796, 190, 1758, 579,
- 0, 484, 1760, 596, 584, 604, 1781, 597, 616, 616,
- 1752, 857, 0, 576, 622, 1762, 0, 633, 1750, 694,
- 903, 706, 697, 1748, 1744, 684, 2377, 1717, 627, 943,
- 960, 984, 2377, 710, 1722, 1008, 1729, 1723, 628, 654,
- 658, 682, 712, 1043, 743, 716, 722, 1056, 758, 1699,
-
- 748, 1080, 1708, 1699, 726, 749, 746, 828, 1121, 1682,
- 1652, 1144, 747, 843, 1162, 1645, 1637, 1185, 1631, 1202,
- 1630, 1219, 1243, 1622, 1622, 124, 908, 1283, 753, 777,
- 707, 922, 1295, 804, 833, 805, 861, 1303, 933, 837,
- 956, 1316, 989, 1609, 1590, 802, 1086, 838, 938, 925,
- 1099, 847, 973, 988, 1262, 1334, 1581, 1551, 1357, 989,
- 1352, 1376, 1556, 1548, 1399, 1534, 1417, 990, 1114, 991,
- 1251, 801, 1430, 1453, 862, 1013, 904, 1443, 1466, 927,
- 1017, 0, 1528, 1527, 1104, 998, 1500, 1133, 1075, 1276,
- 1096, 1479, 1052, 1484, 1008, 1140, 1118, 1491, 1055, 1157,
-
- 1495, 1480, 1461, 1442, 1164, 1519, 1165, 1547, 1166, 1565,
- 1172, 1576, 1432, 1429, 1413, 1411, 1184, 1102, 1160, 1390,
- 1140, 1581, 1215, 1389, 1252, 1181, 1198, 1342, 1142, 1589,
- 1395, 1325, 1265, 1497, 1320, 1537, 1258, 1238, 1237, 1222,
- 1095, 1509, 1224, 1370, 1264, 1605, 1082, 1389, 1318, 1633,
- 1321, 1661, 1061, 1047, 1013, 1012, 1342, 1623, 1003, 1615,
- 1396, 1651, 989, 1679, 1301, 1432, 1435, 952, 1193, 1687,
- 1544, 921, 1398, 1451, 1499, 908, 1212, 1694, 1594, 843,
- 771, 756, 744, 723, 1255, 1701, 709, 1706, 1505, 1719,
- 697, 1725, 1585, 1732, 679, 1743, 1604, 1747, 678, 1757,
-
- 1070, 0, 0, 0, 1425, 1761, 649, 1772, 1438, 1776,
- 624, 1787, 1555, 1791, 615, 1800, 1603, 1808, 581, 1816,
- 1586, 1824, 547, 1837, 1819, 1841, 518, 1854, 1619, 1858,
- 473, 1866, 1647, 1871, 407, 1884, 1712, 1888, 0, 1897,
- 1804, 1901, 0, 1906, 1666, 1912, 287, 1917, 1675, 1928,
- 278, 1939, 1865, 1943, 172, 1956, 1944, 1968, 72, 1962,
- 1832, 1974, 0, 1980, 1893, 1984, 0, 1992, 2377, 70,
- 2008, 2019, 732, 2026, 2038, 2052, 1318, 2066, 2080, 2094,
- 2108, 2122, 2136, 2148, 2156, 2170, 2182, 2190, 2204, 2209,
- 2217, 2227, 2235, 2240, 58, 2253, 2264, 1349, 2278, 1379,
-
- 2292, 2306, 2320, 2334, 2348, 2362
- } ;
-
-static yyconst short int yy_def[607] =
- { 0,
- 569, 1, 569, 569, 569, 569, 569, 569, 569, 570,
- 571, 571, 569, 569, 569, 572, 572, 572, 569, 569,
- 569, 569, 570, 570, 12, 573, 569, 574, 569, 569,
- 569, 575, 572, 576, 572, 35, 569, 569, 577, 573,
- 40, 574, 575, 578, 569, 576, 576, 572, 572, 572,
- 572, 572, 572, 35, 572, 572, 572, 569, 577, 59,
- 569, 578, 569, 579, 572, 572, 572, 572, 572, 572,
- 572, 572, 572, 572, 572, 572, 572, 572, 569, 579,
- 580, 576, 579, 572, 572, 572, 572, 572, 572, 572,
- 572, 572, 572, 572, 572, 572, 572, 569, 580, 576,
-
- 580, 581, 572, 575, 572, 572, 572, 572, 572, 572,
- 572, 572, 572, 572, 572, 582, 581, 576, 583, 581,
- 572, 575, 572, 572, 572, 572, 572, 572, 572, 569,
- 569, 572, 575, 572, 575, 572, 569, 133, 133, 575,
- 569, 133, 575, 133, 133, 569, 133, 147, 144, 147,
- 150, 569, 133, 575, 133, 575, 133, 575, 133, 569,
- 133, 161, 155, 161, 164, 159, 569, 133, 575, 133,
- 575, 133, 575, 133, 575, 133, 176, 170, 176, 179,
- 174, 575, 575, 174, 575, 133, 575, 133, 575, 578,
- 184, 133, 192, 188, 578, 575, 575, 575, 188, 575,
-
- 578, 578, 199, 578, 578, 575, 578, 578, 578, 578,
- 578, 578, 584, 578, 585, 578, 569, 585, 586, 587,
- 569, 586, 586, 588, 569, 586, 569, 588, 589, 569,
- 586, 569, 589, 589, 569, 586, 569, 589, 569, 586,
- 569, 589, 569, 586, 569, 589, 569, 586, 569, 589,
- 590, 586, 569, 589, 591, 586, 569, 589, 592, 591,
- 593, 586, 594, 589, 592, 265, 595, 265, 593, 593,
- 596, 597, 589, 569, 268, 595, 569, 276, 598, 593,
- 586, 596, 569, 597, 599, 589, 569, 268, 600, 598,
- 290, 280, 280, 593, 280, 281, 281, 586, 281, 599,
-
- 599, 601, 569, 268, 600, 305, 593, 280, 593, 593,
- 309, 593, 586, 281, 586, 586, 315, 586, 599, 599,
- 589, 589, 601, 569, 268, 593, 280, 312, 312, 312,
- 586, 281, 318, 318, 318, 320, 320, 599, 320, 322,
- 322, 589, 322, 569, 268, 593, 280, 328, 328, 586,
- 281, 333, 333, 599, 320, 599, 599, 356, 599, 589,
- 322, 589, 589, 362, 589, 569, 602, 593, 280, 586,
- 281, 599, 320, 359, 359, 359, 589, 322, 365, 365,
- 365, 602, 569, 569, 265, 276, 268, 290, 593, 280,
- 586, 281, 599, 320, 374, 374, 589, 322, 379, 379,
-
- 569, 268, 276, 291, 593, 603, 586, 604, 599, 320,
- 589, 322, 569, 268, 276, 291, 603, 593, 593, 280,
- 309, 280, 593, 312, 604, 586, 586, 281, 315, 281,
- 586, 318, 599, 320, 589, 322, 569, 268, 276, 291,
- 593, 280, 309, 312, 586, 281, 315, 318, 599, 605,
- 589, 606, 569, 268, 276, 291, 593, 280, 309, 312,
- 586, 281, 315, 318, 605, 599, 599, 320, 356, 320,
- 599, 359, 606, 589, 589, 322, 362, 322, 589, 365,
- 569, 268, 276, 291, 593, 280, 309, 312, 586, 281,
- 315, 318, 599, 320, 356, 359, 589, 322, 362, 365,
-
- 569, 268, 276, 291, 593, 280, 309, 312, 586, 281,
- 315, 318, 599, 320, 356, 359, 589, 322, 362, 365,
- 593, 280, 309, 312, 586, 281, 315, 318, 599, 320,
- 356, 359, 589, 322, 362, 365, 593, 280, 309, 312,
- 586, 281, 315, 318, 599, 320, 356, 359, 589, 322,
- 362, 365, 599, 320, 356, 359, 589, 322, 362, 365,
- 599, 320, 356, 359, 589, 322, 362, 365, 0, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
-
- 569, 569, 569, 569, 569, 569
- } ;
-
-static yyconst short int yy_nxt[2426] =
- { 0,
- 4, 5, 6, 7, 8, 4, 4, 4, 4, 9,
- 10, 11, 12, 12, 12, 12, 12, 12, 12, 13,
- 14, 15, 4, 4, 16, 16, 16, 16, 16, 17,
- 16, 16, 18, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 19, 4, 24, 24,
- 44, 45, 32, 32, 63, 40, 32, 40, 32, 59,
- 569, 59, 569, 44, 45, 276, 64, 26, 26, 34,
- 34, 27, 27, 34, 207, 34, 32, 23, 32, 32,
- 32, 57, 28, 569, 47, 36, 33, 32, 569, 567,
- 569, 35, 32, 34, 33, 34, 34, 34, 44, 45,
-
- 63, 32, 44, 131, 34, 72, 65, 73, 63, 34,
- 66, 67, 48, 49, 50, 70, 51, 52, 34, 71,
- 53, 32, 54, 32, 55, 56, 32, 209, 68, 32,
- 54, 211, 32, 69, 32, 44, 45, 32, 34, 346,
- 34, 74, 63, 34, 81, 82, 34, 270, 75, 34,
- 32, 34, 76, 78, 34, 32, 32, 86, 32, 77,
- 32, 43, 83, 32, 84, 216, 87, 34, 85, 32,
- 88, 32, 34, 34, 32, 34, 90, 34, 190, 45,
- 34, 32, 91, 89, 81, 82, 34, 142, 34, 563,
- 92, 34, 32, 93, 104, 85, 94, 95, 34, 46,
-
- 100, 43, 83, 102, 82, 97, 96, 32, 32, 34,
- 32, 34, 156, 223, 32, 32, 62, 101, 32, 32,
- 43, 83, 32, 252, 34, 34, 231, 34, 153, 103,
- 106, 34, 34, 32, 32, 34, 34, 105, 32, 34,
- 107, 108, 32, 85, 223, 109, 110, 32, 81, 82,
- 34, 34, 112, 171, 32, 34, 111, 44, 45, 34,
- 46, 100, 64, 100, 34, 114, 47, 81, 118, 32,
- 115, 34, 32, 32, 113, 121, 32, 62, 101, 62,
- 101, 32, 124, 122, 119, 120, 34, 202, 45, 34,
- 34, 32, 123, 34, 559, 125, 32, 32, 34, 127,
-
- 32, 32, 32, 555, 128, 126, 157, 226, 34, 81,
- 118, 85, 32, 34, 34, 81, 82, 34, 34, 34,
- 102, 118, 223, 129, 85, 85, 119, 120, 32, 34,
- 32, 175, 85, 47, 135, 32, 134, 119, 120, 44,
- 45, 32, 133, 32, 168, 34, 32, 34, 85, 132,
- 32, 34, 34, 32, 85, 85, 44, 45, 34, 145,
- 34, 85, 142, 34, 63, 139, 63, 34, 223, 185,
- 34, 44, 45, 236, 136, 142, 223, 85, 139, 248,
- 85, 85, 44, 45, 212, 217, 172, 143, 138, 139,
- 139, 139, 139, 139, 139, 139, 201, 140, 144, 219,
-
- 143, 147, 148, 148, 148, 148, 148, 148, 148, 44,
- 45, 189, 142, 149, 149, 149, 149, 149, 149, 149,
- 149, 44, 45, 223, 153, 551, 63, 149, 149, 149,
- 149, 149, 149, 150, 151, 151, 151, 151, 151, 151,
- 151, 153, 244, 63, 148, 148, 148, 148, 148, 148,
- 148, 148, 44, 45, 63, 142, 44, 45, 63, 157,
- 44, 45, 204, 168, 44, 45, 154, 153, 44, 45,
- 182, 172, 44, 45, 186, 157, 195, 155, 157, 210,
- 205, 151, 151, 151, 151, 151, 151, 151, 151, 44,
- 45, 547, 182, 44, 45, 196, 168, 44, 45, 200,
-
- 186, 44, 45, 158, 172, 44, 45, 223, 182, 44,
- 45, 197, 197, 256, 159, 161, 162, 162, 162, 162,
- 162, 162, 162, 163, 163, 163, 163, 163, 163, 163,
- 163, 44, 45, 63, 186, 543, 206, 163, 163, 163,
- 163, 163, 163, 164, 165, 165, 165, 165, 165, 165,
- 165, 166, 166, 166, 166, 166, 166, 166, 166, 44,
- 45, 63, 197, 208, 539, 166, 166, 166, 166, 166,
- 166, 168, 44, 45, 162, 162, 162, 162, 162, 162,
- 162, 162, 223, 217, 44, 45, 227, 227, 214, 238,
- 234, 242, 259, 234, 535, 240, 169, 219, 246, 234,
-
- 229, 229, 234, 250, 234, 273, 261, 170, 172, 234,
- 262, 165, 165, 165, 165, 165, 165, 165, 165, 234,
- 234, 254, 258, 265, 259, 266, 267, 223, 531, 569,
- 264, 274, 267, 173, 290, 305, 290, 305, 261, 277,
- 527, 259, 569, 278, 174, 176, 177, 177, 177, 177,
- 177, 177, 177, 178, 178, 178, 178, 178, 178, 178,
- 178, 569, 279, 569, 277, 523, 259, 178, 178, 178,
- 178, 178, 178, 179, 180, 180, 180, 180, 180, 180,
- 180, 181, 181, 181, 181, 181, 181, 181, 181, 269,
- 277, 307, 259, 519, 515, 181, 181, 181, 181, 181,
-
- 181, 182, 280, 286, 177, 177, 177, 177, 177, 177,
- 177, 177, 283, 289, 259, 511, 283, 270, 259, 269,
- 234, 307, 350, 222, 308, 313, 183, 507, 285, 222,
- 223, 313, 285, 569, 314, 569, 41, 184, 186, 41,
- 504, 180, 180, 180, 180, 180, 180, 180, 180, 310,
- 269, 280, 269, 311, 319, 277, 320, 259, 326, 331,
- 269, 503, 269, 187, 316, 222, 281, 222, 317, 270,
- 223, 301, 312, 502, 188, 191, 191, 191, 191, 191,
- 191, 191, 191, 310, 269, 280, 269, 318, 501, 191,
- 191, 191, 191, 191, 191, 192, 193, 193, 193, 193,
-
- 193, 193, 193, 194, 194, 194, 194, 194, 194, 194,
- 194, 222, 300, 222, 354, 368, 393, 194, 194, 194,
- 194, 194, 194, 197, 301, 270, 193, 193, 193, 193,
- 193, 193, 193, 193, 310, 269, 280, 269, 311, 316,
- 222, 281, 222, 327, 233, 269, 360, 269, 198, 316,
- 222, 281, 222, 317, 222, 500, 222, 312, 332, 199,
- 203, 203, 203, 203, 203, 203, 203, 203, 300, 300,
- 354, 300, 318, 355, 203, 203, 203, 203, 203, 203,
- 223, 271, 271, 271, 271, 271, 271, 271, 271, 271,
- 271, 271, 271, 271, 271, 271, 271, 271, 271, 271,
-
- 271, 271, 271, 222, 222, 222, 222, 222, 222, 222,
- 222, 281, 222, 222, 310, 269, 280, 269, 311, 397,
- 498, 347, 222, 222, 222, 261, 223, 234, 316, 222,
- 281, 222, 317, 496, 233, 351, 233, 312, 370, 357,
- 300, 320, 300, 358, 310, 269, 280, 269, 223, 222,
- 292, 318, 293, 294, 295, 295, 295, 295, 295, 295,
- 295, 295, 359, 233, 494, 360, 270, 296, 361, 297,
- 298, 299, 299, 299, 299, 299, 299, 299, 299, 316,
- 222, 281, 222, 223, 222, 222, 222, 222, 222, 222,
- 222, 222, 281, 222, 222, 363, 233, 322, 233, 364,
-
- 372, 377, 491, 222, 222, 222, 261, 223, 389, 391,
- 403, 301, 234, 270, 223, 300, 487, 300, 365, 357,
- 300, 320, 300, 363, 233, 322, 233, 279, 484, 483,
- 222, 234, 302, 302, 302, 302, 302, 302, 302, 302,
- 302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
- 302, 302, 302, 302, 309, 309, 309, 309, 309, 309,
- 309, 309, 233, 482, 233, 409, 270, 315, 315, 315,
- 315, 315, 315, 315, 315, 301, 277, 481, 259, 223,
- 233, 233, 233, 233, 233, 233, 321, 233, 322, 233,
- 233, 405, 310, 269, 280, 269, 311, 463, 270, 233,
-
- 233, 233, 285, 234, 369, 316, 222, 281, 222, 317,
- 457, 265, 407, 266, 441, 312, 402, 371, 270, 223,
- 310, 269, 280, 269, 311, 270, 233, 310, 318, 280,
- 390, 411, 309, 309, 309, 309, 309, 309, 309, 309,
- 290, 234, 290, 312, 270, 404, 357, 300, 320, 300,
- 328, 329, 443, 329, 447, 330, 330, 330, 330, 330,
- 330, 330, 330, 363, 233, 322, 233, 270, 316, 312,
- 281, 318, 441, 315, 315, 315, 315, 315, 315, 315,
- 315, 417, 425, 270, 433, 223, 269, 270, 223, 301,
- 435, 333, 334, 445, 334, 234, 335, 335, 335, 335,
-
- 335, 335, 335, 335, 223, 495, 383, 423, 223, 336,
- 445, 337, 338, 339, 339, 339, 339, 339, 339, 339,
- 339, 223, 359, 280, 499, 301, 340, 441, 341, 342,
- 343, 343, 343, 343, 343, 343, 343, 343, 270, 459,
- 456, 365, 234, 233, 233, 233, 233, 233, 233, 321,
- 233, 322, 233, 233, 222, 455, 454, 316, 222, 281,
- 222, 317, 233, 233, 233, 285, 234, 392, 357, 300,
- 320, 300, 358, 505, 383, 431, 453, 373, 270, 461,
- 318, 449, 310, 269, 280, 269, 311, 223, 301, 233,
- 348, 359, 348, 406, 349, 349, 349, 349, 349, 349,
-
- 349, 349, 352, 300, 352, 312, 353, 353, 353, 353,
- 353, 353, 353, 353, 356, 356, 356, 356, 356, 356,
- 356, 356, 60, 383, 471, 60, 301, 362, 362, 362,
- 362, 362, 362, 362, 362, 465, 451, 448, 473, 234,
- 357, 301, 320, 234, 234, 356, 356, 356, 356, 356,
- 356, 356, 356, 291, 446, 485, 291, 301, 363, 233,
- 322, 233, 364, 374, 375, 270, 375, 378, 376, 376,
- 376, 376, 376, 376, 376, 376, 310, 269, 280, 269,
- 301, 365, 363, 306, 322, 460, 306, 362, 362, 362,
- 362, 362, 362, 362, 362, 316, 222, 281, 222, 234,
-
- 233, 444, 442, 226, 464, 379, 380, 445, 380, 489,
- 381, 381, 381, 381, 381, 381, 381, 381, 223, 223,
- 383, 479, 234, 384, 440, 385, 439, 386, 387, 387,
- 387, 387, 387, 387, 387, 387, 357, 300, 320, 300,
- 358, 521, 438, 394, 493, 437, 388, 493, 270, 363,
- 233, 322, 233, 364, 525, 301, 398, 416, 301, 359,
- 395, 223, 395, 497, 396, 396, 396, 396, 396, 396,
- 396, 396, 365, 399, 234, 399, 415, 400, 400, 400,
- 400, 400, 400, 400, 400, 316, 222, 281, 222, 317,
- 357, 300, 320, 300, 358, 414, 408, 363, 233, 322,
-
- 233, 364, 410, 357, 300, 320, 300, 358, 318, 412,
- 413, 497, 402, 359, 450, 310, 269, 280, 269, 311,
- 365, 269, 234, 509, 458, 419, 359, 420, 223, 421,
- 422, 422, 422, 422, 422, 422, 422, 422, 312, 401,
- 401, 383, 423, 363, 233, 322, 233, 364, 424, 222,
- 319, 382, 320, 427, 452, 428, 493, 429, 430, 430,
- 430, 430, 430, 430, 430, 430, 365, 301, 529, 383,
- 431, 357, 300, 320, 300, 358, 432, 365, 301, 234,
- 359, 434, 363, 233, 322, 233, 364, 310, 269, 280,
- 269, 311, 436, 442, 359, 316, 222, 281, 222, 317,
-
- 513, 446, 238, 537, 301, 365, 497, 367, 301, 270,
- 312, 316, 222, 281, 222, 317, 533, 234, 318, 517,
- 462, 310, 269, 280, 269, 366, 234, 234, 488, 310,
- 269, 280, 269, 311, 318, 300, 486, 545, 345, 467,
- 344, 468, 301, 469, 470, 470, 470, 470, 470, 470,
- 470, 470, 312, 234, 301, 383, 471, 316, 222, 281,
- 222, 317, 472, 233, 490, 549, 318, 475, 223, 476,
- 234, 477, 478, 478, 478, 478, 478, 478, 478, 478,
- 318, 312, 553, 383, 479, 316, 222, 281, 222, 301,
- 480, 557, 492, 357, 300, 320, 300, 358, 234, 494,
-
- 363, 233, 322, 233, 364, 270, 498, 310, 269, 280,
- 269, 311, 310, 269, 280, 269, 359, 325, 310, 506,
- 280, 324, 301, 365, 508, 316, 222, 281, 222, 317,
- 312, 316, 222, 281, 222, 270, 304, 510, 357, 300,
- 320, 300, 358, 512, 303, 301, 279, 514, 318, 357,
- 300, 320, 300, 363, 233, 322, 233, 364, 516, 288,
- 287, 359, 518, 363, 233, 322, 233, 310, 269, 280,
- 269, 311, 520, 270, 275, 270, 365, 522, 310, 269,
- 280, 269, 316, 222, 281, 222, 317, 263, 524, 257,
- 312, 253, 526, 316, 222, 281, 222, 357, 300, 320,
-
- 300, 358, 251, 528, 530, 318, 357, 300, 320, 300,
- 316, 249, 281, 532, 363, 233, 322, 233, 364, 247,
- 359, 534, 363, 233, 322, 233, 245, 223, 243, 536,
- 310, 269, 280, 269, 311, 241, 541, 365, 357, 239,
- 320, 538, 223, 310, 269, 280, 269, 316, 222, 281,
- 222, 317, 234, 312, 540, 301, 237, 235, 542, 234,
- 316, 222, 281, 222, 357, 300, 320, 300, 358, 232,
- 318, 544, 357, 300, 320, 300, 546, 363, 233, 322,
- 233, 364, 561, 230, 548, 223, 225, 359, 301, 550,
- 363, 233, 322, 233, 310, 269, 280, 269, 311, 363,
-
- 365, 322, 552, 310, 269, 280, 269, 316, 222, 281,
- 222, 317, 316, 222, 281, 222, 234, 312, 357, 300,
- 320, 300, 358, 357, 300, 320, 300, 223, 554, 221,
- 318, 220, 213, 556, 363, 233, 322, 233, 364, 43,
- 43, 359, 43, 43, 558, 363, 233, 322, 233, 357,
- 300, 320, 300, 358, 43, 560, 167, 365, 160, 43,
- 562, 565, 357, 300, 320, 300, 43, 234, 363, 233,
- 322, 233, 359, 564, 363, 233, 322, 233, 364, 568,
- 357, 300, 320, 300, 358, 566, 357, 300, 320, 300,
- 363, 233, 322, 233, 364, 152, 146, 365, 363, 233,
-
- 322, 233, 141, 359, 137, 116, 47, 98, 63, 79,
- 47, 63, 61, 365, 25, 25, 58, 57, 47, 25,
- 25, 33, 26, 39, 38, 37, 33, 33, 33, 33,
- 33, 33, 33, 42, 31, 30, 42, 42, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 46, 46, 46, 46, 46, 46, 46, 46,
- 29, 46, 46, 46, 46, 46, 62, 62, 22, 62,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 99, 99, 99, 99, 99, 99,
-
- 99, 99, 99, 99, 99, 99, 99, 99, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 130, 21, 130, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 119, 119, 119, 119,
- 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
- 215, 215, 20, 569, 569, 569, 569, 215, 215, 215,
- 215, 218, 569, 218, 218, 218, 218, 218, 218, 218,
- 222, 222, 222, 222, 222, 222, 222, 222, 569, 222,
- 222, 222, 222, 222, 224, 224, 569, 569, 569, 569,
- 569, 224, 224, 224, 224, 228, 569, 228, 228, 228,
-
- 228, 228, 228, 228, 233, 233, 233, 233, 233, 233,
- 233, 233, 569, 233, 233, 233, 233, 233, 255, 255,
- 255, 255, 260, 569, 260, 260, 260, 260, 260, 260,
- 260, 268, 569, 268, 268, 269, 269, 269, 269, 269,
- 269, 269, 269, 569, 269, 269, 269, 269, 269, 272,
- 272, 272, 272, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 284, 569, 284,
- 569, 284, 284, 284, 284, 284, 284, 284, 300, 300,
- 300, 300, 300, 300, 300, 300, 569, 300, 300, 300,
- 300, 300, 323, 323, 323, 323, 323, 323, 323, 323,
-
- 323, 323, 323, 323, 323, 323, 383, 569, 383, 383,
- 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
- 418, 418, 418, 418, 426, 426, 426, 426, 426, 426,
- 426, 426, 426, 426, 426, 426, 426, 426, 466, 466,
- 466, 466, 466, 466, 466, 466, 466, 466, 466, 466,
- 466, 466, 474, 474, 474, 474, 474, 474, 474, 474,
- 474, 474, 474, 474, 474, 474, 3, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
-
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569
- } ;
-
-static yyconst short int yy_chk[2426] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 11, 12,
- 32, 32, 16, 17, 204, 26, 18, 26, 33, 39,
- 40, 39, 40, 43, 43, 595, 47, 11, 12, 16,
- 17, 11, 12, 18, 204, 33, 48, 570, 52, 49,
- 53, 54, 11, 12, 47, 18, 54, 51, 59, 559,
- 59, 17, 35, 48, 54, 52, 49, 53, 63, 63,
-
- 207, 50, 119, 119, 51, 52, 48, 53, 209, 35,
- 49, 49, 35, 35, 35, 51, 35, 35, 50, 51,
- 35, 55, 35, 56, 35, 35, 57, 207, 50, 66,
- 35, 209, 68, 50, 65, 131, 131, 67, 55, 326,
- 56, 55, 214, 57, 64, 64, 66, 326, 55, 68,
- 69, 65, 55, 57, 67, 70, 71, 67, 72, 56,
- 73, 64, 64, 74, 65, 214, 68, 69, 66, 76,
- 69, 75, 70, 71, 77, 72, 71, 73, 182, 182,
- 74, 78, 72, 70, 80, 80, 76, 149, 75, 555,
- 73, 77, 84, 74, 85, 75, 76, 76, 78, 81,
-
- 81, 80, 80, 83, 83, 78, 77, 86, 87, 84,
- 88, 85, 149, 248, 89, 90, 81, 81, 91, 92,
- 83, 83, 94, 248, 86, 87, 226, 88, 163, 84,
- 87, 89, 90, 93, 95, 91, 92, 86, 96, 94,
- 88, 89, 97, 92, 226, 90, 91, 103, 100, 100,
- 93, 95, 94, 163, 106, 96, 93, 104, 104, 97,
- 99, 99, 101, 101, 103, 96, 100, 102, 102, 105,
- 97, 106, 107, 108, 95, 103, 109, 99, 99, 101,
- 101, 110, 106, 104, 102, 102, 105, 197, 197, 107,
- 108, 111, 105, 109, 551, 107, 112, 113, 110, 109,
-
- 114, 126, 115, 547, 110, 108, 166, 223, 111, 117,
- 117, 111, 121, 112, 113, 118, 118, 114, 126, 115,
- 120, 120, 223, 113, 114, 115, 117, 117, 123, 121,
- 124, 166, 112, 118, 128, 125, 126, 120, 120, 122,
- 122, 127, 122, 129, 178, 123, 132, 124, 123, 121,
- 136, 128, 125, 134, 124, 125, 140, 140, 127, 140,
- 129, 127, 138, 132, 210, 138, 195, 136, 231, 178,
- 134, 135, 135, 231, 129, 139, 244, 134, 139, 244,
- 136, 132, 133, 133, 210, 215, 181, 138, 133, 133,
- 133, 133, 133, 133, 133, 133, 195, 135, 138, 215,
-
- 139, 142, 142, 142, 142, 142, 142, 142, 142, 143,
- 143, 181, 143, 144, 144, 144, 144, 144, 144, 144,
- 144, 154, 154, 240, 154, 535, 201, 144, 144, 144,
- 144, 144, 144, 145, 145, 145, 145, 145, 145, 145,
- 145, 147, 240, 208, 147, 147, 147, 147, 147, 147,
- 147, 147, 156, 156, 190, 156, 158, 158, 202, 158,
- 169, 169, 201, 169, 171, 171, 147, 171, 173, 173,
- 191, 173, 175, 175, 194, 175, 190, 147, 150, 208,
- 202, 150, 150, 150, 150, 150, 150, 150, 150, 183,
- 183, 531, 183, 185, 185, 191, 185, 187, 187, 194,
-
- 187, 189, 189, 150, 189, 196, 196, 252, 196, 198,
- 198, 203, 198, 252, 150, 153, 153, 153, 153, 153,
- 153, 153, 153, 155, 155, 155, 155, 155, 155, 155,
- 155, 200, 200, 205, 200, 527, 203, 155, 155, 155,
- 155, 155, 155, 157, 157, 157, 157, 157, 157, 157,
- 157, 159, 159, 159, 159, 159, 159, 159, 159, 206,
- 206, 212, 206, 205, 523, 159, 159, 159, 159, 159,
- 159, 161, 213, 213, 161, 161, 161, 161, 161, 161,
- 161, 161, 236, 218, 220, 220, 224, 228, 212, 234,
- 246, 238, 255, 242, 519, 236, 161, 218, 242, 264,
-
- 224, 228, 250, 246, 234, 264, 255, 161, 164, 238,
- 256, 164, 164, 164, 164, 164, 164, 164, 164, 254,
- 258, 250, 254, 259, 260, 259, 259, 256, 515, 265,
- 258, 265, 265, 164, 279, 289, 279, 289, 260, 268,
- 511, 268, 268, 268, 164, 168, 168, 168, 168, 168,
- 168, 168, 168, 170, 170, 170, 170, 170, 170, 170,
- 170, 290, 268, 290, 291, 507, 291, 170, 170, 170,
- 170, 170, 170, 172, 172, 172, 172, 172, 172, 172,
- 172, 174, 174, 174, 174, 174, 174, 174, 174, 292,
- 276, 292, 276, 499, 495, 174, 174, 174, 174, 174,
-
- 174, 176, 270, 273, 176, 176, 176, 176, 176, 176,
- 176, 176, 272, 276, 272, 491, 284, 270, 284, 293,
- 273, 293, 331, 296, 293, 296, 176, 487, 272, 297,
- 331, 297, 284, 305, 297, 305, 573, 176, 179, 573,
- 484, 179, 179, 179, 179, 179, 179, 179, 179, 295,
- 295, 295, 295, 295, 301, 306, 301, 306, 307, 313,
- 329, 483, 329, 179, 299, 299, 299, 299, 299, 307,
- 313, 301, 295, 482, 179, 184, 184, 184, 184, 184,
- 184, 184, 184, 330, 330, 330, 330, 299, 481, 184,
- 184, 184, 184, 184, 184, 186, 186, 186, 186, 186,
-
- 186, 186, 186, 188, 188, 188, 188, 188, 188, 188,
- 188, 334, 336, 334, 336, 346, 372, 188, 188, 188,
- 188, 188, 188, 192, 372, 346, 192, 192, 192, 192,
- 192, 192, 192, 192, 308, 308, 308, 308, 308, 335,
- 335, 335, 335, 308, 340, 348, 340, 348, 192, 314,
- 314, 314, 314, 314, 352, 480, 352, 308, 314, 192,
- 199, 199, 199, 199, 199, 199, 199, 199, 337, 375,
- 337, 375, 314, 337, 199, 199, 199, 199, 199, 199,
- 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
- 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
-
- 262, 262, 262, 271, 271, 271, 271, 271, 271, 271,
- 271, 271, 271, 271, 327, 327, 327, 327, 327, 377,
- 476, 327, 271, 271, 271, 271, 271, 377, 332, 332,
- 332, 332, 332, 472, 380, 332, 380, 327, 350, 339,
- 339, 339, 339, 339, 349, 349, 349, 349, 350, 271,
- 280, 332, 280, 280, 280, 280, 280, 280, 280, 280,
- 280, 280, 339, 341, 468, 341, 280, 281, 341, 281,
- 281, 281, 281, 281, 281, 281, 281, 281, 281, 353,
- 353, 353, 353, 281, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 343, 343, 343, 343, 343,
-
- 354, 360, 463, 282, 282, 282, 282, 282, 368, 370,
- 386, 354, 360, 368, 370, 395, 459, 395, 343, 376,
- 376, 376, 376, 381, 381, 381, 381, 386, 456, 455,
- 282, 286, 286, 286, 286, 286, 286, 286, 286, 286,
- 286, 286, 286, 286, 286, 286, 286, 286, 286, 286,
- 286, 286, 286, 286, 294, 294, 294, 294, 294, 294,
- 294, 294, 399, 454, 399, 393, 294, 298, 298, 298,
- 298, 298, 298, 298, 298, 393, 501, 453, 501, 298,
- 302, 302, 302, 302, 302, 302, 302, 302, 302, 302,
- 302, 389, 347, 347, 347, 347, 347, 447, 389, 302,
-
- 302, 302, 302, 302, 347, 351, 351, 351, 351, 351,
- 441, 385, 391, 385, 418, 347, 385, 351, 441, 391,
- 369, 369, 369, 369, 369, 418, 302, 309, 351, 309,
- 369, 397, 309, 309, 309, 309, 309, 309, 309, 309,
- 388, 397, 388, 369, 309, 388, 396, 396, 396, 396,
- 309, 312, 421, 312, 429, 312, 312, 312, 312, 312,
- 312, 312, 312, 400, 400, 400, 400, 312, 315, 421,
- 315, 429, 419, 315, 315, 315, 315, 315, 315, 315,
- 315, 405, 407, 419, 409, 315, 417, 405, 407, 409,
- 411, 315, 318, 426, 318, 411, 318, 318, 318, 318,
-
- 318, 318, 318, 318, 426, 469, 417, 417, 318, 320,
- 427, 320, 320, 320, 320, 320, 320, 320, 320, 320,
- 320, 427, 469, 423, 477, 320, 322, 423, 322, 322,
- 322, 322, 322, 322, 322, 322, 322, 322, 423, 443,
- 440, 477, 322, 323, 323, 323, 323, 323, 323, 323,
- 323, 323, 323, 323, 425, 439, 438, 371, 371, 371,
- 371, 371, 323, 323, 323, 323, 323, 371, 355, 355,
- 355, 355, 355, 485, 425, 425, 437, 355, 485, 445,
- 371, 433, 390, 390, 390, 390, 390, 445, 433, 323,
- 328, 355, 328, 390, 328, 328, 328, 328, 328, 328,
-
- 328, 328, 333, 465, 333, 390, 333, 333, 333, 333,
- 333, 333, 333, 333, 338, 338, 338, 338, 338, 338,
- 338, 338, 577, 465, 465, 577, 338, 342, 342, 342,
- 342, 342, 342, 342, 342, 449, 435, 432, 451, 342,
- 356, 449, 356, 435, 451, 356, 356, 356, 356, 356,
- 356, 356, 356, 598, 428, 457, 598, 356, 361, 361,
- 361, 361, 361, 356, 359, 457, 359, 361, 359, 359,
- 359, 359, 359, 359, 359, 359, 444, 444, 444, 444,
- 359, 361, 362, 600, 362, 444, 600, 362, 362, 362,
- 362, 362, 362, 362, 362, 448, 448, 448, 448, 362,
-
- 473, 424, 420, 431, 448, 362, 365, 431, 365, 461,
- 365, 365, 365, 365, 365, 365, 365, 365, 431, 461,
- 473, 473, 365, 367, 416, 367, 415, 367, 367, 367,
- 367, 367, 367, 367, 367, 367, 373, 373, 373, 373,
- 373, 505, 414, 373, 466, 413, 367, 467, 505, 378,
- 378, 378, 378, 378, 509, 466, 378, 404, 467, 373,
- 374, 509, 374, 474, 374, 374, 374, 374, 374, 374,
- 374, 374, 378, 379, 474, 379, 403, 379, 379, 379,
- 379, 379, 379, 379, 379, 392, 392, 392, 392, 392,
- 394, 394, 394, 394, 394, 402, 392, 398, 398, 398,
-
- 398, 398, 394, 434, 434, 434, 434, 434, 392, 398,
- 401, 475, 387, 394, 434, 442, 442, 442, 442, 442,
- 398, 406, 475, 489, 442, 406, 434, 406, 489, 406,
- 406, 406, 406, 406, 406, 406, 406, 406, 442, 384,
- 383, 406, 406, 436, 436, 436, 436, 436, 406, 408,
- 471, 366, 471, 408, 436, 408, 471, 408, 408, 408,
- 408, 408, 408, 408, 408, 408, 436, 471, 513, 408,
- 408, 410, 410, 410, 410, 410, 408, 364, 513, 363,
- 358, 410, 412, 412, 412, 412, 412, 422, 422, 422,
- 422, 422, 412, 422, 410, 430, 430, 430, 430, 430,
-
- 493, 430, 479, 521, 357, 412, 479, 345, 493, 521,
- 422, 446, 446, 446, 446, 446, 517, 479, 430, 497,
- 446, 460, 460, 460, 460, 344, 517, 497, 460, 458,
- 458, 458, 458, 458, 446, 450, 458, 529, 325, 450,
- 324, 450, 529, 450, 450, 450, 450, 450, 450, 450,
- 450, 450, 458, 321, 319, 450, 450, 462, 462, 462,
- 462, 462, 450, 452, 462, 533, 317, 452, 316, 452,
- 533, 452, 452, 452, 452, 452, 452, 452, 452, 452,
- 462, 311, 545, 452, 452, 464, 464, 464, 464, 545,
- 452, 549, 464, 470, 470, 470, 470, 470, 549, 470,
-
- 478, 478, 478, 478, 478, 310, 478, 486, 486, 486,
- 486, 486, 488, 488, 488, 488, 470, 304, 537, 486,
- 537, 303, 300, 478, 488, 490, 490, 490, 490, 490,
- 486, 492, 492, 492, 492, 537, 288, 490, 494, 494,
- 494, 494, 494, 492, 287, 285, 278, 494, 490, 496,
- 496, 496, 496, 498, 498, 498, 498, 498, 496, 275,
- 274, 494, 498, 500, 500, 500, 500, 506, 506, 506,
- 506, 506, 500, 269, 266, 261, 498, 506, 508, 508,
- 508, 508, 510, 510, 510, 510, 510, 257, 508, 253,
- 506, 249, 510, 512, 512, 512, 512, 514, 514, 514,
-
- 514, 514, 247, 512, 514, 510, 516, 516, 516, 516,
- 541, 245, 541, 516, 518, 518, 518, 518, 518, 243,
- 514, 518, 520, 520, 520, 520, 241, 541, 239, 520,
- 522, 522, 522, 522, 522, 237, 525, 518, 561, 235,
- 561, 522, 525, 524, 524, 524, 524, 526, 526, 526,
- 526, 526, 233, 522, 524, 561, 232, 230, 526, 229,
- 528, 528, 528, 528, 530, 530, 530, 530, 530, 227,
- 526, 528, 532, 532, 532, 532, 530, 534, 534, 534,
- 534, 534, 553, 225, 532, 222, 221, 530, 553, 534,
- 536, 536, 536, 536, 538, 538, 538, 538, 538, 565,
-
- 534, 565, 536, 540, 540, 540, 540, 542, 542, 542,
- 542, 542, 544, 544, 544, 544, 565, 538, 546, 546,
- 546, 546, 546, 548, 548, 548, 548, 219, 546, 217,
- 542, 216, 211, 548, 550, 550, 550, 550, 550, 193,
- 180, 546, 177, 165, 550, 552, 552, 552, 552, 554,
- 554, 554, 554, 554, 162, 552, 160, 550, 152, 151,
- 554, 557, 556, 556, 556, 556, 148, 557, 560, 560,
- 560, 560, 554, 556, 558, 558, 558, 558, 558, 560,
- 562, 562, 562, 562, 562, 558, 564, 564, 564, 564,
- 566, 566, 566, 566, 566, 146, 141, 558, 568, 568,
-
- 568, 568, 137, 562, 130, 98, 82, 79, 62, 58,
- 46, 44, 42, 566, 571, 571, 38, 36, 34, 571,
- 571, 572, 24, 23, 22, 19, 572, 572, 572, 572,
- 572, 572, 572, 574, 15, 14, 574, 574, 575, 575,
- 575, 575, 575, 575, 575, 575, 575, 575, 575, 575,
- 575, 575, 576, 576, 576, 576, 576, 576, 576, 576,
- 13, 576, 576, 576, 576, 576, 578, 578, 9, 578,
- 578, 578, 578, 578, 578, 578, 578, 578, 578, 578,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 580, 580, 580, 580, 580, 580,
-
- 580, 580, 580, 580, 580, 580, 580, 580, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 582, 8, 582, 582, 582, 582, 582, 582,
- 582, 582, 582, 582, 582, 582, 583, 583, 583, 583,
- 583, 583, 583, 583, 583, 583, 583, 583, 583, 583,
- 584, 584, 7, 3, 0, 0, 0, 584, 584, 584,
- 584, 585, 0, 585, 585, 585, 585, 585, 585, 585,
- 586, 586, 586, 586, 586, 586, 586, 586, 0, 586,
- 586, 586, 586, 586, 587, 587, 0, 0, 0, 0,
- 0, 587, 587, 587, 587, 588, 0, 588, 588, 588,
-
- 588, 588, 588, 588, 589, 589, 589, 589, 589, 589,
- 589, 589, 0, 589, 589, 589, 589, 589, 590, 590,
- 590, 590, 591, 0, 591, 591, 591, 591, 591, 591,
- 591, 592, 0, 592, 592, 593, 593, 593, 593, 593,
- 593, 593, 593, 0, 593, 593, 593, 593, 593, 594,
- 594, 594, 594, 596, 596, 596, 596, 596, 596, 596,
- 596, 596, 596, 596, 596, 596, 596, 597, 0, 597,
- 0, 597, 597, 597, 597, 597, 597, 597, 599, 599,
- 599, 599, 599, 599, 599, 599, 0, 599, 599, 599,
- 599, 599, 601, 601, 601, 601, 601, 601, 601, 601,
-
- 601, 601, 601, 601, 601, 601, 602, 0, 602, 602,
- 602, 602, 602, 602, 602, 602, 602, 602, 602, 602,
- 603, 603, 603, 603, 603, 603, 603, 603, 603, 603,
- 603, 603, 603, 603, 604, 604, 604, 604, 604, 604,
- 604, 604, 604, 604, 604, 604, 604, 604, 605, 605,
- 605, 605, 605, 605, 605, 605, 605, 605, 605, 605,
- 605, 605, 606, 606, 606, 606, 606, 606, 606, 606,
- 606, 606, 606, 606, 606, 606, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
-
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
- 569, 569, 569, 569, 569
- } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#ifndef YYLMAX
-#define YYLMAX 8192
-#endif
-
-char yytext[YYLMAX];
-char *idxtext_ptr;
-#line 1 "idx.l"
-#define INITIAL 0
-#line 5 "idx.l"
-#include <math.h>
-#include <filter.h>
-#include <idx.h>
-#include <idx.tab.h>
-
-extern int idx_debug;
-
-static int _valint(char *s, idxvalrec **v);
-static int _valfloat(char *s, idxvalrec **v);
-static int _valname(char *s, idxvalrec **v);
-static int _valreg(char *s, idxvalrec **v);
-static int _valfunc(char *s, idxvalrec **v);
-/* note that negative numbers are not defined here, but in the grammar */
-/* must match regions in filt.l */
-#line 1133 "lex.idx.c"
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-#endif
-
-#ifndef idxtext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-#endif
-
-#if YY_STACK_USED
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-#line 35 "idx.l"
-
-
-#line 1287 "lex.idx.c"
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yy_start;
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 570 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 2377 );
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- yy_act = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 37 "idx.l"
-{return _valint(yytext, &(idxlval.val));}
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 39 "idx.l"
-{return _valfloat(yytext, &(idxlval.val));}
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 42 "idx.l"
-{
- return _valreg(yytext, &(idxlval.val));
-}
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 46 "idx.l"
-{
- return _valreg(yytext, &(idxlval.val));
-}
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 50 "idx.l"
-{
- /* support functions with one level of nested parens */
- return _valfunc(yytext, &(idxlval.val));
-}
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 55 "idx.l"
-{return _valname(yytext, &(idxlval.val));}
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 57 "idx.l"
-{return OR;}
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 58 "idx.l"
-{return AND;}
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 59 "idx.l"
-{return EQ;}
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 60 "idx.l"
-{return NE;}
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 61 "idx.l"
-{return LE;}
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 62 "idx.l"
-{return GE;}
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 64 "idx.l"
-{;}
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-#line 66 "idx.l"
-{
- yy_delete_buffer( YY_CURRENT_BUFFER );
- yyterminate();
- }
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 71 "idx.l"
-{return yytext[0];}
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 73 "idx.l"
-ECHO;
- YY_BREAK
-#line 1459 "lex.idx.c"
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - idxtext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = idxtext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = idxtext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = idxtext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- idxtext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = idxtext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = idxtext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-static int yy_get_next_buffer()
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = idxtext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - idxtext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - idxtext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
-
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- idxtext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = yy_start;
-
- for ( yy_cp = idxtext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 570 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
- {
- register int yy_is_jam;
- register char *yy_cp = yy_c_buf_p;
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 570 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 569);
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-
- idxtext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-#endif /* ifndef YY_NO_UNPUT */
-
-
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - idxtext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = idxtext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-
- return c;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- idxtext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
-
-
- {
- yy_flush_buffer( b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
-#else
-void yy_flush_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
- }
-
-
-#ifndef YY_NO_SCAN_BUFFER
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
-char *base;
-yy_size_t size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
-yyconst char *yy_str;
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len );
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
-yyconst char *bytes;
-int len;
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef idxtext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
-#line 73 "idx.l"
-
-
-#ifdef YY_USE_PROTOS
-static int _valint(char *s, idxvalrec **v)
-#else
-static int _valint(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- char *t;
- *v = idxvalnew(s);
- (*v)->ival = strtoll(s, &t, 0);
- if( *t )
- idxerror("bad integer value");
- (*v)->type = NUM;
- (*v)->ntype = PARSE_INTEGER;
- (*v)->dval = (double)(*v)->ival;
- return NUM;
-}
-
-#ifdef YY_USE_PROTOS
-static int _valfloat(char *s, idxvalrec **v)
-#else
-static int _valfloat(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- char *t;
- *v = idxvalnew(s);
- (*v)->dval = strtod(s, &t);
- if( *t )
- idxerror("bad float value");
- (*v)->type = NUM;
- (*v)->ntype = PARSE_FLOAT;
- return NUM;
-}
-
-#ifdef YY_USE_PROTOS
-static int _valname(char *s, idxvalrec **v)
-#else
-static int _valname(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- int i;
- int got;
- int oflag;
- int isize=0;
- char *iname;
- char *colname;
- char tail[SZ_LINE];
- FilterSymbols sp=NULL;
- idxvalrec *vv;
-
- *v = idxvalnew(s);
- /* lookup the string */
- if( !(sp=FilterSymbolLookup(FilterDefault(), s)) ){
- idxerror("column name not found in data file");
- (*v)->type = INDEF;
- return INDEF;
- }
- colname = idxinfo(IDX_COLNAME);
- /* see what sort of symbol it is */
- switch(sp->type){
- case SYM_COL:
- if( !(iname=idxindexfilename(s, &isize)) ){
- (*v)->type = INDEF;
- return INDEF;
- }
- /* if we already have opened this index, just use the existing handle */
- if( (vv=idxlookupfilename(iname)) ){
- (*v)->igio = vv->igio;
- (*v)->ifits = vv->ifits;
- }
- /* open index for first time and mark iname */
- else{
- oflag = setgerror(0);
- (*v)->igio = ft_fitsheadopen(iname, &((*v)->ifits), tail, SZ_LINE, "r");
- setgerror(oflag);
- if( !((*v)->igio) ){
- idxerror("existing index file can't be opened");
- (*v)->type = INDEF;
- return INDEF;
- }
- else{
- (*v)->iname = xstrdup(iname);
- }
- }
- xfree(iname);
- if( (*v)->ifits ){
- for(got=0, i=0; i<(*v)->ifits->table->tfields; i++){
- if( !strcasecmp(s, (*v)->ifits->table->col[i].name) ){
- (*v)->vtype = (*v)->ifits->table->col[i].type;
- (*v)->voffset = (*v)->ifits->table->col[i].offset;
- (*v)->vn = (*v)->ifits->table->col[i].n;
- got++;
- }
- if( !strcasecmp(colname, (*v)->ifits->table->col[i].name) ){
- (*v)->itype = (*v)->ifits->table->col[i].type;
- (*v)->ioffset = (*v)->ifits->table->col[i].offset;
- (*v)->in = (*v)->ifits->table->col[i].n;
- got++;
- }
- }
- if( got == 2 ){
-#ifdef HAVE_SYS_MMAN_H
- if( !(*v)->igio->gz ){
- if(!((*v)->idata = mmap(NULL, isize, PROT_READ, MAP_PRIVATE,
- fileno((*v)->igio->fp), 0)) ){
- idxerror("index file can't be mmap'ed");
- (*v)->type = INDEF;
- return INDEF;
- }
- (*v)->ilen = isize;
- }
-#endif
- (*v)->nrow = ft_naxis((*v)->ifits,2);
- (*v)->type = COL;
- return COL;
- }
- else{
- idxerror("column name and/or index not found in index file");
- }
- }
- else{
- (*v)->type = INDEF;
- return INDEF;
- }
- case SYM_PAR:
- (*v)->ntype=ParseDataType(sp->value, &(*v)->dval, &(*v)->ival);
- (*v)->type = NUM;
- switch((*v)->ntype){
- case PARSE_INTEGER:
- case PARSE_HEXINT:
- (*v)->dval = (double)(*v)->ival;
- return NUM;
- case PARSE_FLOAT:
- return NUM;
- default:
- idxerror("invalid parameter type in index");
- return 0;
- }
- default:
- idxerror("unknown symbol type in index");
- return 0;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int _valreglims(idxvalrec *v, char *s)
-#else
-static int _valreglims(v, s)
- idxvalrec *v;
- char *s;
-#endif
-{
- int i;
- int ip=0;
- int nd=0, maxd=0;
- double xcen, ycen;
- double dval;
- double *dvals;
- double pts[8];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- double angle;
- double xwidth, yheight;
- double angl; /* l: Cartesian angle in radians */
- double half_width, half_height;/* l: radii (1/2 width and height) */
- double cosangl, sinangl; /* l: sine, cosine of the Cartesian angle */
- double hw_cos, hw_sin; /* l: products of half_width with sin, cos */
- double hh_cos, hh_sin; /* l: products of half_height with sin, cos */
-
- if( !strcmp(v->s, "circle") || !strcmp(v->s, "ncircle") ||
- !strcmp(v->s, "annulus") || !strcmp(v->s, "nannulus") ){
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- dval = -1;
- if( *v->s == 'n' ){
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ) return 0;
- dval = MAX(atof(tbuf),dval);
- }
- else{
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") ){
- dval = MAX(atof(tbuf),dval);
- }
- }
- v->rlo[0] = xcen - dval - 1;
- v->rhi[0] = xcen + dval + 1;
- v->rlo[1] = ycen - dval - 1;
- v->rhi[1] = ycen + dval + 1;
- return 1;
- }
- else if( !strcmp(v->s, "box") || !strcmp(v->s, "nbox") ||
- !strcmp(v->s, "ellipse") || !strcmp(v->s, "nellipse") ){
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- maxd = SZ_LINE;
- if( !(dvals=(double *)malloc(maxd*sizeof(double))) ) return 0;
- if( *v->s == 'n' ){
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ) return 0;
- if( !word(s, tbuf, &ip) || !word(s, tbuf2, &ip) ) return 0;
- dvals[nd++] = atof(tbuf);
- dvals[nd++] = atof(tbuf2);
- if( word(s, tbuf, &ip) && word(s, tbuf, &ip) )
- dvals[nd++] = atof(tbuf);
- }
- else{
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") ){
- dvals[nd++] = atof(tbuf);
- if( nd == maxd ){
- maxd += SZ_LINE;
- if( !(dvals=(double *)realloc(dvals, maxd*sizeof(double))) ) return 0;
- }
- }
- }
-ellcom:
- if( nd == 2 ){
- angle = 0.0;
- xwidth = dvals[0];
- yheight = dvals[1];
- }
- else{
- angle = dvals[nd-1];
- xwidth = dvals[nd-3];
- yheight = dvals[nd-2];
- }
- if( dvals ) xfree(dvals);
-
- /* Why is this done in evfilter.c??? Doesn't seem necessary */
- /* angl = angle + 90.0; */
- angl = angle;
- while (angl >= 360.0) angl = angl - 360.0;
- /* convert to radians */
- angl = (angl / 180.0) * M_PI;
- sinangl = sin (angl);
- cosangl = cos (angl);
- /* Why is this done in evfilter.c??? Doesn't seem necessary */
- /* since we rotate by 90.0 degrees to get from astro angle to cartesian, */
- /* we also need to switch the width and height. we do this secretly so */
- /* that the display will turn out right, by doing it in the half terms */
- if( !strcmp(v->s, "box") ){
- /*
- half_width = yheight / 2.0;
- half_height = xwidth / 2.0;
- */
- half_width = xwidth / 2.0;
- half_height = yheight / 2.0;
- }
- else{
- /*
- half_width = yheight;
- half_height = xwidth;
- */
- half_width = xwidth;
- half_height = yheight;
- }
- hw_cos = half_width * cosangl;
- hw_sin = half_width * sinangl;
- hh_cos = half_height * cosangl;
- hh_sin = half_height * sinangl;
-
- pts[0] = xcen - hw_cos - hh_sin;
- pts[1] = ycen - hw_sin + hh_cos;
- pts[2] = xcen + hw_cos - hh_sin;
- pts[3] = ycen + hw_sin + hh_cos;
- pts[4] = xcen + hw_cos + hh_sin;
- pts[5] = ycen + hw_sin - hh_cos;
- pts[6] = xcen - hw_cos + hh_sin;
- pts[7] = ycen - hw_sin - hh_cos;
-
- v->rlo[0] = pts[0];
- v->rhi[0] = pts[0];
- v->rlo[1] = pts[1];
- v->rhi[1] = pts[1];
- for(i=2; i<8; i+=2){
- v->rlo[0] = MIN(pts[i],v->rlo[0]);
- v->rhi[0] = MAX(pts[i],v->rhi[0]);
- v->rlo[1] = MIN(pts[i+1],v->rlo[1]);
- v->rhi[1] = MAX(pts[i+1],v->rhi[1]);
- }
- return 1;
- }
- else if( !strcmp(v->s, "line") ){
- for(i=0; i<4; i++){
- if( word(s, tbuf, &ip) ){
- pts[i] = atof(tbuf);
- }
- }
- v->rlo[0] = MIN(pts[0],pts[2]);
- v->rhi[0] = MAX(pts[0],pts[2]);
- v->rlo[1] = MIN(pts[1],pts[3]);
- v->rhi[1] = MAX(pts[1],pts[3]);
- return 1;
- }
- else if( !strcmp(v->s, "point") || !strcmp(v->s, "polygon") ){
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- v->rlo[0] = xcen-1;
- v->rhi[0] = xcen+1;
- v->rlo[1] = ycen-1;
- v->rhi[1] = ycen+1;
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") &&
- word(s, tbuf2, &ip) ){
- dval = atof(tbuf);
- v->rlo[0] = MIN(dval-1,v->rlo[0]);
- v->rhi[0] = MAX(dval+1,v->rhi[0]);
- dval = atof(tbuf2);
- v->rlo[1] = MIN(dval-1,v->rlo[1]);
- v->rhi[1] = MAX(dval+1,v->rhi[1]);
- }
- return 1;
- }
- else if( !strcmp(v->s, "pie") || !strcmp(v->s, "qtpie") ){
- return 0;
- }
- else if( !strcmp(v->s, "panda") || !strcmp(v->s, "cpanda") ){
- maxd = SZ_LINE;
- if( !(dvals=(double *)malloc(maxd*sizeof(double))) ) return 0;
- while( word(s, tbuf, &ip) && strcmp(tbuf, "-142857.142857") ){
- dvals[nd++] = atof(tbuf);
- if( nd == maxd ){
- maxd += SZ_LINE;
- if( !(dvals=(double *)realloc(dvals, maxd*sizeof(double))) ) return 0;
- }
- }
- v->rlo[0] = dvals[0] - dvals[6] - 1;
- v->rhi[0] = dvals[0] + dvals[6] + 1;
- v->rlo[1] = dvals[1] - dvals[6] - 1;
- v->rhi[1] = dvals[1] + dvals[6] + 1;
- if( dvals ) xfree(dvals);
- return 1;
- }
- else if( !strcmp(v->s, "bpanda") || !strcmp(v->s, "epanda") ){
- maxd = 3;
- if( !(dvals=(double *)malloc(maxd*sizeof(double))) ) return 0;
- /* grab: xcen ycen */
- if( !word(s, tbuf, &ip)||!word(s, tbuf2, &ip) ) return 0;
- xcen = atof(tbuf);
- ycen = atof(tbuf2);
- /* skip: ang1 ang2 nang xwlo yhlo */
- for(i=0; i<5; i++){
- if( !word(s, tbuf, &ip) ) return 0;
- }
- /* grab: xwhi yhhi */
- for(i=0; i<2; i++){
- if( !word(s, tbuf, &ip) ) return 0;
- dvals[nd++] = atof(tbuf);
- }
- /* skip: nrad */
- if( !word(s, tbuf, &ip) ) return 0;
- /* grab: ang */
- if( !word(s, tbuf, &ip) ) return 0;
- dvals[nd++] = atof(tbuf);
- /* we can now handle this with box/ellipse code */
- goto ellcom;
- }
- else if( !strcmp(v->s, "field") ){
- return 0;
- }
- else{
- return 0;
- }
-}
-
-#ifdef YY_USE_PROTOS
-static int _valreg(char *s, idxvalrec **v)
-#else
-static int _valreg(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- int ip=0;
- char *t;
- char tbuf[SZ_LINE];
- *v = idxvalnew(NULL);
- newdtable("(),");
- while( *s == '(' ) s++;
- if( !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- if( strstr(tbuf, "field") ){
- (*v)->type = INDEF;
- return REG;
- }
- t = tbuf+2;
- if( *t == 'v' ) t++;
- (*v)->s = xstrdup(t);
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ||
- !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- /* include/exclude */
- if( !atoi(tbuf) ){
- (*v)->type = INDEF;
- return REG;
- }
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- culc(tbuf);
- _valname(tbuf, &(*v)->rv[0]);
- if( !word(s, tbuf, &ip) || !word(s, tbuf, &ip) ){
- (*v)->type = INDEF;
- return REG;
- }
- culc(tbuf);
- _valname(tbuf, &(*v)->rv[1]);
- if( !_valreglims(*v, &s[ip]) ){
- (*v)->type = INDEF;
- return REG;
- }
- freedtable();
- (*v)->type = REG;
- return REG;
-}
-
-#ifdef YY_USE_PROTOS
-static int _valfunc(char *s, idxvalrec **v)
-#else
-static int _valfunc(s, v)
- char *s;
- idxvalrec **v;
-#endif
-{
- *v = idxvalnew(s);
- (*v)->type = FUNC;
- return FUNC;
-}
-
-
-#ifdef YY_USE_PROTOS
-void
-idxstring(char *s)
-#else
-void idxstring(s)
- char *s;
-#endif
-{
- idx_scan_string(s);
-}
-
-#ifdef YY_USE_PROTOS
-int
-idxerror(char *msg)
-#else
-int idxerror(msg)
- char *msg;
-#endif
-{
- Filter filter;
-
- YY_FLUSH_BUFFER;
- /* turn indexing off */
- if( (filter=FilterDefault()) ){
- filter->doidx = -1;
- }
- /* output message, if necessary */
- if( idx_debug ){
- fprintf(stderr, "ERROR: %s", msg);
- if( !strcmp(msg, "syntax error") ){
- fprintf(stderr, " (terminating index processing)");
- }
- fprintf(stderr, "\n");
- }
- yyterminate();
-}
-
-#ifdef YY_USE_PROTOS
-int yywrap(void)
-#else
-int yywrap()
-#endif
-{
- return 1;
-}
-
diff --git a/funtools/filter/regions.h b/funtools/filter/regions.h
deleted file mode 100644
index 984323d..0000000
--- a/funtools/filter/regions.h
+++ /dev/null
@@ -1,408 +0,0 @@
-#if MINIMIZE_INCLUDES
-#include <stdarg.h>
-int sscanf(const char *s, const char *format, ...);
-typedef unsigned long size_t;
-size_t strlen();
-char *strcpy(), *strdup(), *strstr(), *getenv();
-void *calloc(), *malloc(), *memset(), *memmove();
-void exit();
-#else
-#include <stdio.h>
-#include <unistd.h>
-#include <math.h>
-#include <string.h>
-#include <sys/types.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#endif
-
-#if MINIMIZE_INCLUDES
-/* lots of math functions from math.h */
-extern double acos(double);
-extern double asin(double);
-extern double atan(double);
-extern double atan2(double, double);
-extern double cos(double);
-extern double sin(double);
-extern double tan(double);
-extern double acosh(double);
-extern double asinh(double);
-extern double atanh(double);
-extern double cosh(double);
-extern double sinh(double);
-extern double tanh(double);
-extern double exp (double);
-extern double exp2 (double);
-extern double expm1 (double);
-extern double log (double);
-extern double log10 (double);
-extern double log2 (double);
-extern double log1p (double);
-extern double logb (double);
-extern double modf (double, double *);
-extern double ldexp (double, int);
-extern double frexp (double, int *);
-extern int ilogb (double);
-extern double scalbn (double, int);
-extern double scalbln (double, long int);
-extern double fabs(double);
-extern double cbrt(double);
-extern double hypot (double, double);
-extern double pow (double, double);
-extern double sqrt(double);
-extern double erf(double);
-extern double erfc(double);
-extern double lgamma(double);
-extern double tgamma(double);
-extern double ceil (double);
-extern double floor (double);
-extern double nearbyint (double);
-extern double rint (double);
-extern long int lrint (double);
-extern double round (double);
-extern long int lround (double);
-extern double trunc (double);
-extern double fmod (double, double);
-extern double remainder (double, double);
-extern double remquo (double, double, int *);
-extern double copysign (double, double);
-extern double nan(const char *);
-extern double nextafter (double, double);
-extern double fdim (double, double);
-extern double fmax (double, double);
-extern double fmin (double, double);
-extern double fma (double, double, double);
-/* and math constants */
-#define M_E 2.71828182845904523536028747135266250 /* e */
-#define M_LOG2E 1.44269504088896340735992468100189214 /* log 2e */
-#define M_LOG10E 0.434294481903251827651128918916605082 /* log 10e */
-#define M_LN2 0.693147180559945309417232121458176568 /* log e2 */
-#define M_LN10 2.30258509299404568401799145468436421 /* log e10 */
-#define M_PI 3.14159265358979323846264338327950288 /* pi */
-#define M_PI_2 1.57079632679489661923132169163975144 /* pi/2 */
-#define M_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
-#define M_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
-#define M_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
-#define M_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */
-#define M_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
-#define M_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
-#endif
-
-#define MASKINC 10000
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#define SMALL_NUMBER 1.0E-24
-#define LARGE_NUMBER 65535
-#define PSTOP -142857.142857
-
-#ifndef SZ_LINE
-#define SZ_LINE 4096
-#endif
-#ifndef min
-#define min(x,y) (((x)<(y))?(x):(y))
-#endif
-#ifndef max
-#define max(x,y) (((x)>(y))?(x):(y))
-#endif
-#ifndef abs
-#define abs(x) ((x)<0?(-x):(x))
-#endif
-#ifndef feq
-#define feq(x,y) (fabs((double)x-(double)y)<=(double)1.0E-15)
-#endif
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-#ifndef TOK_EREG
-#define TOK_EREG 1
-#endif
-#ifndef TOK_NREG
-#define TOK_NREG 2
-#endif
-#ifndef TOK_IREG
-#define TOK_IREG 4
-#endif
-
-#define PIXCEN(a) (double)(a)
-#define PIXNUM(a) (int)((a)+0.5)
-#define PIXSTART(a) ((int)(a)+1)
-#define PIXSTOP(a) (((int)(a))==(a)?((int)(a)-1):((int)(a)))
-/* to assure that geometrically adjoining regions touch but don't overlap */
-/* when edge is exactly on a pixel center it goes to right or upper region. */
-/* used for non-radially symetric regions instead of PIXSTART, PIXSTOP */
-#define PIXINCL(a) (int)((a)+1.0)
-
-/* this is the filter string for field only */
-#define EVFIELDONLY "(evfield(g,1,1,1,(double)x,(double)y))"
-
-#define XSNO 3
-
-/* NB: these MUST match the definition in filter.h */
-#ifndef __filter_h
-typedef struct filtmaskrec {
- int region;
- int y;
- int xstart, xstop;
-} *FilterMask, FilterMaskRec;
-
-/* parameter structure for a scan entry */
-typedef struct scanrec{
- struct scanrec *next;
- int x;
-} *Scan, ScanRec;
-
-typedef struct shaperec {
- int init;
- double ystart, ystop;
- Scan *scanlist;
- /* varargs */
- int nv;
- double *xv;
- /* circle, annulus */
- double r1sq, r2sq;
- /* ellipse */
- double angl, sinangl, cosangl;
- double cossq, sinsq;
- double xradsq, yradsq;
- double a;
- /* polygon-style shapes */
- int npt;
- double *pts;
- /* line */
- int xonly;
- double x1, x2, y1;
- double invslope;
-} *Shape, ShapeRec;
-
-/* these are global for use with special region routines */
-typedef struct gfiltrec {
- int nshapes; /* number of shapes */
- int maxshapes; /* number of shape records we allocate */
- Shape shapes; /* array holding range limits for one shape */
- int rid; /* first valid region for current pixel */
- int usebinsiz; /* whether bindizx,binsizy are used */
- char *evsect; /* value of event section */
- double tlminx, tlminy; /* tlmin for event section */
- double binsizx, binsizy; /* bin sizes for event section */
- double tloff; /* offset for quick p2i conversion */
- int xmin, xmax, ymin, ymax; /* section limits in original image coords */
- int block; /* block factor */
- int x0, x1, y0, y1; /* section limits in section coords */
- int *ybuf; /* valid y row flags */
- int *x0s; /* valid x start values */
- int *x1s; /* valid x stop values */
- int nmask; /* number of image mask record */
- int maskdim; /* size of mask image */
- FilterMask masks; /* mask records */
-} *GFilt, GFiltRec;
-#endif
-
-/* declare image init routines */
-void imannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius);
-void imboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xwidth, double yheight,
- double angle);
-void imcirclei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double radius);
-void imellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double angle);
-void imfieldi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y);
-void imlinei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double x0, double y0, double x1, double y1);
-void impiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2);
-void imqtpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2);
-void impointi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen);
-void impandai(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn);
-void imnannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n);
-void imnboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double angle);
-void imnellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double angle);
-void imnpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n);
-
-#ifdef __STDC__
-void impolygoni(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...);
-void imvannulusi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-void imvboxi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-void imvellipsei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-void imvpiei(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-void imvpointi(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...);
-#endif
-
-
-/* declare image region routines */
-int imannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius);
-int imbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xwidth, double yheight,
- double angle);
-int imcircle(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double radius);
-int imellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double angle);
-int imfield(GFilt g, int rno, int sno, int flag, int type,
- double x, double y);
-int imline(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double x1, double y1, double x2, double y2);
-int impie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2);
-int imqtpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2);
-int impoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen);
-int impanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn);
-int imnannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n);
-int imnbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double angle);
-int imnellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double angle);
-int imnpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n);
-#ifdef __STDC__
-int impolygon(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...);
-int imvannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int imvbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int imvellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int imvpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int imvpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...);
-#endif
-
-/* declare event region routines */
-int evannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double iradius, double oradius);
-int evbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xwidth, double yheight,
- double angle);
-int evcircle(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double radius);
-int evellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double xrad, double yrad,
- double angle);
-int evfield(GFilt g, int rno, int sno, int flag, int type,
- double x, double y);
-int evline(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double x1, double y1, double x2, double y2);
-int evpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2);
-int evqtpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen, double angle1, double angle2);
-int evpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen);
-int evnannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n);
-int evnbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double angle);
-int evnellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lox, double loy, double hix, double hiy, int n,
- double angle);
-int evnpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double lo, double hi, int n);
-int evpanda(GFilt g, int rno, int sno, int flag, int type,
- double x, double y,
- double xcen, double ycen,
- double anglo, double anghi, double angn,
- double radlo, double radhi, double radn);
-#ifdef __STDC__
-int evpolygon(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...);
-int evvannulus(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int evvbox(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int evvellipse(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int evvpie(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, double xcen, double ycen, ...);
-int evvpoint(GFilt g, int rno, int sno, int flag, int type,
- double x, double y, ...);
-#endif
-
diff --git a/funtools/filter/regions_h.h b/funtools/filter/regions_h.h
deleted file mode 100644
index bfb0d57..0000000
--- a/funtools/filter/regions_h.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *REGIONS_H="\n#if MINIMIZE_INCLUDES\n#include <stdarg.h>\nint sscanf(const char *s, const char *format, ...);\ntypedef unsigned long size_t;\nsize_t strlen();\nchar *strcpy(), *strdup(), *strstr(), *getenv();\nvoid *calloc(), *malloc(), *memset(), *memmove();\nvoid exit();\n#else\n#include <stdio.h>\n#include <unistd.h>\n#include <math.h>\n#include <string.h>\n#include <sys/types.h>\n#ifdef __STDC__\n#include <stdlib.h>\n#include <stdarg.h>\n#else\n#include <varargs.h>\n#endif\n#endif\n\n#if MINIMIZE_INCLUDES\n\nextern double acos(double);\nextern double asin(double);\nextern double atan(double);\nextern double atan2(double, double);\nextern double cos(double);\nextern double sin(double);\nextern double tan(double);\nextern double acosh(double);\nextern double asinh(double);\nextern double atanh(double);\nextern double cosh(double);\nextern double sinh(double);\nextern double tanh(double);\nextern double exp (double);\nextern double exp2 (double); \nextern double expm1 (double); \nextern double log (double);\nextern double log10 (double);\nextern double log2 (double);\nextern double log1p (double);\nextern double logb (double);\nextern double modf (double, double *);\nextern double ldexp (double, int);\nextern double frexp (double, int *);\nextern int ilogb (double);\nextern double scalbn (double, int);\nextern double scalbln (double, long int);\nextern double fabs(double);\nextern double cbrt(double);\nextern double hypot (double, double);\nextern double pow (double, double);\nextern double sqrt(double);\nextern double erf(double);\nextern double erfc(double);\nextern double lgamma(double);\nextern double tgamma(double);\nextern double ceil (double);\nextern double floor (double);\nextern double nearbyint (double);\nextern double rint (double);\nextern long int lrint (double);\nextern double round (double);\nextern long int lround (double);\nextern double trunc (double);\nextern double fmod (double, double);\nextern double remainder (double, double);\nextern double remquo (double, double, int *);\nextern double copysign (double, double);\nextern double nan(const char *);\nextern double nextafter (double, double);\nextern double fdim (double, double);\nextern double fmax (double, double);\nextern double fmin (double, double);\nextern double fma (double, double, double);\n\n#define M_E 2.71828182845904523536028747135266250 \n#define M_LOG2E 1.44269504088896340735992468100189214 \n#define M_LOG10E 0.434294481903251827651128918916605082 \n#define M_LN2 0.693147180559945309417232121458176568 \n#define M_LN10 2.30258509299404568401799145468436421 \n#define M_PI 3.14159265358979323846264338327950288 \n#define M_PI_2 1.57079632679489661923132169163975144 \n#define M_PI_4 0.785398163397448309615660845819875721 \n#define M_1_PI 0.318309886183790671537767526745028724 \n#define M_2_PI 0.636619772367581343075535053490057448 \n#define M_2_SQRTPI 1.12837916709551257389615890312154517 \n#define M_SQRT2 1.41421356237309504880168872420969808 \n#define M_SQRT1_2 0.707106781186547524400844362104849039 \n#endif\n\n#define MASKINC 10000\n#ifndef M_PI\n#define M_PI 3.14159265358979323846\n#endif\n#define SMALL_NUMBER 1.0E-24\n#define LARGE_NUMBER 65535\n#define PSTOP -142857.142857\n\n#ifndef SZ_LINE\n#define SZ_LINE 4096\n#endif\n#ifndef min\n#define min(x,y) (((x)<(y))?(x):(y))\n#endif\n#ifndef max\n#define max(x,y) (((x)>(y))?(x):(y))\n#endif\n#ifndef abs\n#define abs(x) ((x)<0?(-x):(x))\n#endif\n#ifndef feq\n#define feq(x,y) (fabs((double)x-(double)y)<=(double)1.0E-15)\n#endif\n#ifndef NULL\n#define NULL (void *)0\n#endif\n\n#ifndef TOK_EREG\n#define TOK_EREG 1\n#endif\n#ifndef TOK_NREG\n#define TOK_NREG 2\n#endif\n#ifndef TOK_IREG\n#define TOK_IREG 4\n#endif\n\n#define PIXCEN(a) (double)(a)\n#define PIXNUM(a) (int)((a)+0.5) \n#define PIXSTART(a) ((int)(a)+1)\n#define PIXSTOP(a) (((int)(a))==(a)?((int)(a)-1):((int)(a)))\n\n\n\n#define PIXINCL(a) (int)((a)+1.0) \n\n\n#define EVFIELDONLY \"(evfield(g,1,1,1,(double)x,(double)y))\"\n\n#define XSNO 3\n\n\n#ifndef __filter_h\ntypedef struct filtmaskrec {\n int region;\n int y;\n int xstart, xstop;\n} *FilterMask, FilterMaskRec;\n\n\ntypedef struct scanrec{\n struct scanrec *next;\n int x;\n} *Scan, ScanRec;\n\ntypedef struct shaperec {\n int init;\n double ystart, ystop;\n Scan *scanlist;\n \n int nv;\n double *xv;\n \n double r1sq, r2sq;\n \n double angl, sinangl, cosangl;\n double cossq, sinsq;\n double xradsq, yradsq;\n double a;\n \n int npt;\n double *pts;\n \n int xonly;\n double x1, x2, y1;\n double invslope;\n} *Shape, ShapeRec;\n\n\ntypedef struct gfiltrec {\n int nshapes; \n int maxshapes; \n Shape shapes; \n int rid; \n int usebinsiz; \n char *evsect; \n double tlminx, tlminy; \n double binsizx, binsizy; \n double tloff; \n int xmin, xmax, ymin, ymax; \n int block; \n int x0, x1, y0, y1; \n int *ybuf; \n int *x0s; \n int *x1s; \n int nmask; \n int maskdim; \n FilterMask masks; \n} *GFilt, GFiltRec;\n#endif\n\n\nvoid imannulusi(GFilt g, int rno, int sno, int flag, int type, \n double x, double y,\n double xcen, double ycen, double iradius, double oradius);\nvoid imboxi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xwidth, double yheight,\n double angle);\nvoid imcirclei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double radius);\nvoid imellipsei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xrad, double yrad,\n double angle);\nvoid imfieldi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y);\nvoid imlinei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double x0, double y0, double x1, double y1);\nvoid impiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2);\nvoid imqtpiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2);\nvoid impointi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen);\nvoid impandai(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double radlo, double radhi, double radn);\nvoid imnannulusi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n);\nvoid imnboxi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double angle);\nvoid imnellipsei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double angle);\nvoid imnpiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n);\n\n#ifdef __STDC__\nvoid impolygoni(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...);\nvoid imvannulusi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nvoid imvboxi(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nvoid imvellipsei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nvoid imvpiei(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nvoid imvpointi(GFilt g, int rno, int sno, int flag, int type, \n double x, double y, ...);\n#endif\n\n\n\nint imannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double iradius, double oradius);\nint imbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xwidth, double yheight,\n double angle);\nint imcircle(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double radius);\nint imellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xrad, double yrad,\n double angle);\nint imfield(GFilt g, int rno, int sno, int flag, int type,\n double x, double y);\nint imline(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double x1, double y1, double x2, double y2);\nint impie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2);\nint imqtpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2);\nint impoint(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen);\nint impanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double radlo, double radhi, double radn);\nint imnannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n);\nint imnbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double angle);\nint imnellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double angle);\nint imnpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n);\n#ifdef __STDC__\nint impolygon(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...);\nint imvannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint imvbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint imvellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint imvpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint imvpoint(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...);\n#endif\n\n\nint evannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double iradius, double oradius);\nint evbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xwidth, double yheight,\n double angle);\nint evcircle(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double radius);\nint evellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double xrad, double yrad,\n double angle);\nint evfield(GFilt g, int rno, int sno, int flag, int type,\n double x, double y);\nint evline(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double x1, double y1, double x2, double y2);\nint evpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2);\nint evqtpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen, double angle1, double angle2);\nint evpoint(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen);\nint evnannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n);\nint evnbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double angle);\nint evnellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lox, double loy, double hix, double hiy, int n,\n double angle);\nint evnpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double lo, double hi, int n);\nint evpanda(GFilt g, int rno, int sno, int flag, int type,\n double x, double y,\n double xcen, double ycen,\n double anglo, double anghi, double angn,\n double radlo, double radhi, double radn);\n#ifdef __STDC__\nint evpolygon(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...);\nint evvannulus(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint evvbox(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint evvellipse(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint evvpie(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, double xcen, double ycen, ...);\nint evvpoint(GFilt g, int rno, int sno, int flag, int type,\n double x, double y, ...);\n#endif\n\n";
diff --git a/funtools/filter/sample.c b/funtools/filter/sample.c
deleted file mode 100644
index 4cacfca..0000000
--- a/funtools/filter/sample.c
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#define min(x,y) (((x)<(y))?(x):(y))
-#define max(x,y) (((x)>(y))?(x):(y))
-
-
-#define CONVERT 0
-#define FILTER (pha==1&&pi>3)
-#define ESIZE 20
-#define GET_pha LoadColumn(eptr+4,2,1,CONVERT,&pha)
-#define GET_pi LoadColumn(eptr+6,2,1,CONVERT,&pi)
-#define GET GET_pha;GET_pi;
-short pha;
-short pi;
-
-#define RADIAN 57.295779513082320877
-#define RADTODEG(r) ((r)*RADIAN)
-#define DEGTORAD(d) ((d)/RADIAN)
-#define INSIDE(a,r1,r2) (((a)>(r1))&&((a)<=((r2)<(r1)?(r2+360.0):(r2))))
-
-static double d;
-
-#define Annulus(X,Y,x,y,ri,ro) ((((X-x)*(X-x))+((Y-y)*(Y-y))<=(ro*ro))&& (((X-x)*(X-x))+((Y-y)*(Y-y))>(ri*ri)))
-#define annulus(x,y,ri,ro) Annulus(_X_,_Y_,x,y,ri,ro)
-
-#define Circle(X,Y,x,y,r) (((X-x)*(X-x))+((Y-y)*(Y-y))<=(r*r))
-#define circle(x,y,r) Circle(_X_,_Y_,x,y,r)
-
-#define Ellipse(X,Y,x,y,a,b) (((X-x)*(X-x))/(double)(a*a))+(((Y-y)*(Y-y))/(double)(b*b))<=1.0)
-#define ellipse(x,y,a,b) Ellipse(_X_,_Y_,x,y,a,b)
-
-#define Pie(X,Y,x,y,r1,r2) ((X==x)&&(Y==y)?1:(INSIDE(((d=RADTODEG(atan2(Y-y,X-x)))<90?d+270.0:d-90.0),r1,r2)))
-#define pie(x,y,r1,r2) Pie(_X_,_Y_,x,y,r1,r2)
-
-#define Point(X,Y,x,y) ((X==x)&&(Y==y))
-#define point(x,y) Point(_X_,_Y_,x,y)
-
-#define Box(X,Y,x,y,w,h) ((X>(x-(double)(w/2)))&&(X<=(x+(double)(w/2)))&&(Y>(y-(double)(h/2)))&&(Y<=(y+(double)(h/2))))
-#define box(x,y,w,h) Box(_X_,_Y_,x,y,w,h)
-
-LoadColumn(eptr, bytes, iter, convert, obuf)
- char *eptr;
- int bytes, iter, convert;
- char *obuf;
-{
- char *optr=obuf;
- int i, j;
- for(i=0; i<iter; i++){
- optr = obuf + (i*bytes);
- if( convert ){
- for(j=0; j<bytes; j++)
- optr[j] = *(eptr+bytes-1-j);
- }
- else{
- for(j=0; j<bytes; j++)
- optr[j] = *(eptr+j);
- }
- }
-}
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- char *ebuf=(char *)0, *eptr, *etop, *rptr;
- int get, got;
- while( read(0, &get, 4) >0 ){
- ebuf = (char *)malloc(get);
- for(etop=ebuf; get>0; etop += got, get -= got){
- if( (got=read(0, etop, get)) <=0 )
- break;
- }
- for(rptr=ebuf, eptr=ebuf; eptr<etop; rptr++, eptr += ESIZE){
- GET;
- *rptr = FILTER;
- }
- got = ((etop - ebuf)/ESIZE);
- write(1, &got, 4);
- write(1, ebuf, got);
- free(ebuf);
- }
- unlink(argv[0]);
-}
-
diff --git a/funtools/filter/swap.c b/funtools/filter/swap.c
deleted file mode 100644
index e7c9bfd..0000000
--- a/funtools/filter/swap.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#if __DARWIN_BYTE_ORDER
-#define XBYTE_ORDER __DARWIN_BYTE_ORDER
-#else
-#define XBYTE_ORDER 0
-#endif
-
-#ifndef MYBYTE_ORDER
-#define MYBYTE_ORDER XBYTE_ORDER
-#endif
-
-#ifndef DO_FILTER_SWAP
-#if (XBYTE_ORDER !=0) && (XBYTE_ORDER != MYBYTE_ORDER)
-#define DO_FILTER_SWAP 1
-#endif
-#endif
-
-#if DO_FILTER_SWAP
-char *_sw2(char *s, int n, char *_swf, int off)
-{
- char c;
- char *t=s;
- size_t i;
- if( !_swf || !_swf[off]++ ){
- for (i=0; i<n; i += 2, s += 2) {
- c = *s;
- *(s) = *(s+1);
- *(s+1) = c;
- }
- }
- return t;
-}
-
-char *_sw4(char *s, int n, char *_swf, int off)
-{
- char c;
- char *t=s;
- size_t i;
- if( !_swf || !_swf[off]++ ){
- for (i=0; i<n; i += 4, s += 4) {
- c = *s;
- *s = *(s+3);
- *(s+3) = c;
- c = *(s+1);
- *(s+1) = *(s+2);
- *(s+2) = c;
- }
- }
- return t;
-}
-
-char *_sw8(char *s, int n, char *_swf, int off)
-{
- char c;
- char *t=s;
- size_t i;
- if( !_swf || !_swf[off]++ ){
- for (i=0; i<n; i += 8, s += 8) {
- c = *(s+0);
- *(s+0) = *(s+7);
- *(s+7) = c;
- c = *(s+1);
- *(s+1) = *(s+6);
- *(s+6) = c;
- c = *(s+2);
- *(s+2) = *(s+5);
- *(s+5) = c;
- c = *(s+3);
- *(s+3) = *(s+4);
- *(s+4) = c;
- }
- }
- return t;
-}
-
-#define SW1(a,n,b,i) a
-#define SW2(a,n,b,i) _sw2(a,n,b,i)
-#define SW4(a,n,b,i) _sw4(a,n,b,i)
-#define SW8(a,n,b,i) _sw8(a,n,b,i)
-
-#if defined(FILTER_PTYPE) && (FILTER_PTYPE != c)
-#error "FILTER_PTYPE environment variable must be 'c' when running with Rosetta"
-#endif
-
-#else
-
-#define SW1(a,n,b,i) a
-#define SW2(a,n,b,i) a
-#define SW4(a,n,b,i) a
-#define SW8(a,n,b,i) a
-
-#endif
-
diff --git a/funtools/filter/swap_c.h b/funtools/filter/swap_c.h
deleted file mode 100644
index f58fe26..0000000
--- a/funtools/filter/swap_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *SWAP_C="\n#if __DARWIN_BYTE_ORDER\n#define XBYTE_ORDER __DARWIN_BYTE_ORDER\n#else\n#define XBYTE_ORDER 0\n#endif\n\n#ifndef MYBYTE_ORDER\n#define MYBYTE_ORDER XBYTE_ORDER\n#endif\n\n#ifndef DO_FILTER_SWAP\n#if (XBYTE_ORDER !=0) && (XBYTE_ORDER != MYBYTE_ORDER)\n#define DO_FILTER_SWAP 1\n#endif\n#endif\n\n#if DO_FILTER_SWAP\nchar *_sw2(char *s, int n, char *_swf, int off)\n{\n char c;\n char *t=s;\n size_t i;\n if( !_swf || !_swf[off]++ ){\n for (i=0; i<n; i += 2, s += 2) {\n c = *s;\n *(s) = *(s+1);\n *(s+1) = c;\n }\n }\n return t;\n}\n\nchar *_sw4(char *s, int n, char *_swf, int off)\n{\n char c;\n char *t=s;\n size_t i;\n if( !_swf || !_swf[off]++ ){\n for (i=0; i<n; i += 4, s += 4) {\n c = *s;\n *s = *(s+3);\n *(s+3) = c;\n c = *(s+1);\n *(s+1) = *(s+2);\n *(s+2) = c;\n }\n }\n return t;\n}\n\nchar *_sw8(char *s, int n, char *_swf, int off)\n{\n char c;\n char *t=s;\n size_t i;\n if( !_swf || !_swf[off]++ ){\n for (i=0; i<n; i += 8, s += 8) {\n c = *(s+0);\n *(s+0) = *(s+7);\n *(s+7) = c;\n c = *(s+1);\n *(s+1) = *(s+6);\n *(s+6) = c;\n c = *(s+2);\n *(s+2) = *(s+5);\n *(s+5) = c;\n c = *(s+3);\n *(s+3) = *(s+4);\n *(s+4) = c;\n }\n }\n return t;\n}\n\n#define SW1(a,n,b,i) a\n#define SW2(a,n,b,i) _sw2(a,n,b,i)\n#define SW4(a,n,b,i) _sw4(a,n,b,i)\n#define SW8(a,n,b,i) _sw8(a,n,b,i)\n\n#if defined(FILTER_PTYPE) && (FILTER_PTYPE != c)\n#error \"FILTER_PTYPE environment variable must be 'c' when running with Rosetta\"\n#endif\n\n#else\n\n#define SW1(a,n,b,i) a\n#define SW2(a,n,b,i) a\n#define SW4(a,n,b,i) a\n#define SW8(a,n,b,i) a\n\n#endif\n\n";
diff --git a/funtools/filter/symbols.c b/funtools/filter/symbols.c
deleted file mode 100644
index e6bb899..0000000
--- a/funtools/filter/symbols.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * symbols.c -- management of filter symbols
- *
- */
-
-#include <filter.h>
-
-#define SYMINC 100 /* increment for allocating symbols */
-
-static char *bincols=NULL;
-static char xbin[SZ_LINE];
-static char ybin[SZ_LINE];
-
-extern char *filtinchar;
-
-/*
- *
- * Public Routines
- *
- */
-
-/*
- *
- * FilterSymbolInit -- init the symbol table
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterSymbolInit(Filter filter)
-#else
-int FilterSymbolInit(filter)
- Filter filter;
-#endif
-{
- /* make sure we are init'ed */
- if( filter == NULL ){
- gerror(stderr, "symbol table not initialized\n");
- return(0);
- }
- filter->symtab = (FilterSymbols)xcalloc(SYMINC, sizeof(FilterSymRec));
- filter->nsyms = 0;
- filter->maxsyms = SYMINC;
- return(SYMINC);
-}
-
-/*
- *
- * FilterSymbolEnter -- enter a new symbol in the symbol table
- * The symbol will either be a column name, or
- * a parameter in the table header, or
- * a parameter in the primary header
- *
- */
-#ifdef ANSI_FUNC
-char *
-FilterSymbolEnter(Filter filter, char *s, int *got)
-#else
-char *FilterSymbolEnter(filter, s, got)
- Filter filter;
- char *s;
- int *got;
-#endif
-{
- int brack=0;
- int i, j;
- char *t;
- FilterSymbols sp;
- char name[SZ_LINE];
- FITSCard card;
- FITSHead fhd;
-
- /* see return value */
- if( got ) *got =-3;
-
- /* make sure we are init'ed */
- if( filter == NULL ){
- gerror(stderr, "symbol table not initialized\n");
- return(NULL);
- }
-
- /* make sure we are init'ed */
- if( filter->fhd == NULL ){
- gerror(stderr, "symbol table not initialized\n");
- return(NULL);
- }
- fhd = filter->fhd;
-
- /* make sure we have something */
- if( !s || !*s )
- return(NULL);
-
- /* this is the name of the variable in the filter program */
- nowhite(s, name);
- /* but strip off brackets */
- if( (t=strchr(name, '[')) != NULL ){
- brack=1;
- *t = '\0';
- }
-
- /* loop through the symbol table and look for existing symbol */
- for(i=0; i<filter->nsyms; i++){
- sp = &(filter->symtab[i]);
- /* skip accidentally empty ones */
- if( (sp->name == NULL) || (*sp->name == '\0') )
- continue;
- /* is this name already entered? */
- if( !strcasecmp(sp->name, name) ){
- if( got ) *got = 1;
- return (char *)sp->name;
- }
- }
-
- /* make sure there is room for a new symbol */
- if( i >= filter->maxsyms ){
- filter->maxsyms += SYMINC;
- filter->symtab = (FilterSymbols)xrealloc(filter->symtab,
- filter->maxsyms*sizeof(FilterSymRec));
- }
-
- /* this is where the next symbol will be entered */
- sp = &(filter->symtab[i]);
-
- /* look for name in the list of columns */
- if( fhd->table ){
- for(j=0; j<fhd->table->tfields; j++){
- if( !strcasecmp(name, fhd->table->col[j].name) ){
- if( brack && (fhd->table->col[j].n==1) ){
- if( got ) *got = -2;
- return(NULL);
- }
- sp->type = SYM_COL;
- sp->name = (char *)xstrdup(name);
- sp->idx = j;
- filter->size += fhd->table->col[j].size;
- filter->nsyms++;
- if( got ) *got = 1;
- return (char *)sp->name;
- }
- }
- }
- /* look for name in the table header */
- if( (t=ft_headgets(fhd, name, 0, NULL, &card)) ){
- sp->type = SYM_PAR;
- sp->name = xstrdup(name);
- sp->value = t;
- sp->idx = -1;
- filter->nsyms++;
- if( got ) *got = 2;
- return (char *)sp->name;
- }
- /* look for name in the primary header */
- else if( fhd->primary &&
- (t=ft_headgets(fhd->primary, name, 0, NULL, &card)) ){
- sp->type = SYM_PAR;
- sp->name = xstrdup(name);
- sp->value = t;
- sp->idx = -1;
- filter->nsyms++;
- if( got ) *got = 2;
- return (char *)sp->name;
- }
- /* did not find the symbol anywhere */
- else{
- gerror(stderr, "can't find '%s' in table\n", s);
- if( got ) *got = -1;
- return(NULL);
- }
-} /* EnterSymbol */
-
-
-/*
- *
- * FilterSymbolLookup -- lookup a symbol in the symbol table
- *
- */
-#ifdef ANSI_FUNC
-FilterSymbols
-FilterSymbolLookup(Filter filter, char *name)
-#else
-FilterSymbols FilterSymbolLookup(filter, name)
- Filter filter;
- char *s;
-#endif
-{
- int i;
-
- /* sanity check */
- if( !name || !*name ) return NULL;
-
- /* loop through the symbol table and look for existing symbol */
- for(i=0; i<filter->nsyms; i++){
- /* skip accidentally empty ones */
- if( (filter->symtab[i].name == NULL) || (*filter->symtab[i].name == '\0') )
- continue;
- /* look for name */
- if( !strcasecmp(filter->symtab[i].name, name) ){
- /* return symbol table record if found */
- return &filter->symtab[i];
- }
- }
- return NULL;
-}
-
-/*
- *
- * FilterSymbolDefaults -- enter default symbols for X and Y columns
- *
- */
-#ifdef ANSI_FUNC
-int
-FilterSymbolDefaults(Filter filter, int enter)
-#else
-int FilterSymbolDefaults(filter, enter)
- Filter filter;
- int enter;
-#endif
-{
- int ip=0;
- char tbuf[SZ_LINE];
- char *mbuf;
- char *k;
- char *s;
-
- /* this is only for events */
- if( !filter || !filter->fhd || !filter->fhd->table )
- return 0;
-
- /* parse bincols variable */
- if( !bincols ){
- mbuf = xstrdup(filter->mode);
- if( !keyword(mbuf, "bincols", tbuf, SZ_LINE) )
- return 0;
- if( mbuf ) xfree(mbuf);
- s = tbuf;
- /* parse the bincols string and add the symbols */
- newdtable(",:)");
- bincols = xstrdup(s);
- k = bincols;
- /* point past first paren */
- if( *bincols == '(' )
- k++;
- if( !word(k, xbin, &ip) || !word(k, ybin, &ip) ){
- freedtable();
- return 0;
- }
- freedtable();
- /* set the filter bin strings */
- if( filter->xbin ) xfree(filter->xbin);
- filter->xbin = xstrdup(xbin);
- if( filter->ybin ) xfree(filter->ybin);
- filter->ybin = xstrdup(ybin);
- }
- else if( !filter->xbin || !filter->ybin ){
- /* set the filter bin strings */
- if( filter->xbin ) xfree(filter->xbin);
- filter->xbin = xstrdup(xbin);
- if( filter->ybin ) xfree(filter->ybin);
- filter->ybin = xstrdup(ybin);
- }
-
- /* enter symbols if necessary */
- if( enter ){
- if( !FilterSymbolEnter(filter, xbin, NULL) ||
- !FilterSymbolEnter(filter, ybin, NULL) )
- return 0;
- }
- return 1;
-}
-
-/*
- *
- * FilterSymbolFree -- free space from symbol table
- *
- */
-#ifdef ANSI_FUNC
-void
-FilterSymbolFree(Filter filter)
-#else
-void FilterSymbolFree(filter)
- Filter filter;
-#endif
-{
- int i;
- FilterSymbols sp;
-
- /* if we have no symbols, just return */
- if( !filter || !filter->nsyms )
- return;
-
- /* loop through the symbol table and free up records */
- for(i=0; i<filter->nsyms; i++){
- sp = &(filter->symtab[i]);
- /* skip accidentally empty ones */
- if( (sp->name == NULL) || (*sp->name == '\0') )
- continue;
- /* process this type of symbol */
- switch(sp->type){
- case SYM_COL:
- xfree(sp->name);
- sp->name = NULL;
- break;
- case SYM_PAR:
- xfree(sp->name);
- xfree(sp->value);
- sp->name = NULL;
- break;
- }
- }
- /* no symbols */
- filter->nsyms = 0;
- if( bincols != NULL ){
- xfree(bincols);
- bincols = NULL;
- *xbin = '\0';
- *ybin = '\0';
- }
-}
-
diff --git a/funtools/filter/tfilt.c b/funtools/filter/tfilt.c
deleted file mode 100644
index 0eba0b1..0000000
--- a/funtools/filter/tfilt.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * tfilt.c -- test program for filtering tables
- *
- */
-
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include <sys/types.h>
-#include <prsetup.h>
-#include <filter.h>
-#include <idx.h>
-#include <word.h>
-
-extern char *optarg;
-extern int optind;
-
-char bincols[SZ_LINE];
-int debug=0;
-
-#define NEVENTS 10240
-
-/* from Harbison&Steele by way of GNU cinfigure ...
- returns 1 for bigendian, 0 for littleendian */
-#ifdef ANSI_FUNC
-int
-is_bigendian(void)
-#else
-int is_bigendian()
-#endif
-{
- union
- {
- long l;
- char c[sizeof (long)];
- } u;
- u.l = 1;
- return(u.c[sizeof (long) - 1] == 1);
-}
-
-/*
- *
- * ListEvents -- list events in a binary table
- *
- */
-#ifdef ANSI_FUNC
-static int
-ListEvents(GIO gio, FILE *ofd, FITSHead header, char *s, int iformat,
- char *mode)
-#else
-static int ListEvents(gio, ofd, header, s, iformat, mode)
- GIO gio; /* input FITS file handle */
- FILE *ofd; /* output file handle */
- FITSHead header; /* fitsy header */
- char *s; /* filter for events */
- int iformat; /* input format of data: 0=native, 1=fits */
- char *mode /* filteropen mode */
-#endif
-{
- int i, j; /* loop counters */
- int get; /* number of events to read */
- int got; /* number of events read */
- int left; /* number of events left to read */
- int total; /* total number of events in file */
- int convert; /* whether we have to convert to native */
- int nev; /* max number of events to read at once */
- int evsize; /* size of an event record */
- int ototal; /* output total events */
- int *vbuf; /* valid event flags */
- char *ebuf; /* event buffer */
- char *eptr; /* current pointer into ebuf */
- char tbuf[SZ_LINE]; /* ever-present temp buf */
- unsigned char bval; /* byte value */
- short sval; /* short value */
- unsigned short usval; /* short value */
- int ival; /* int value */
- long long lval; /* 64-bit int value */
- unsigned int uival; /* unsigned int value */
- float fval; /* float value */
- double dval; /* double value */
- int dofilt=0; /* true if we can filter */
- Filter filter=NULL;
-
- /* we have to convert to native if the data is not the
- same as the big-endian-ness of the machine */
- convert = (iformat != is_bigendian());
- /* create the mode string */
- if( convert )
- strcpy(tbuf, "convert=true");
- else
- strcpy(tbuf, "convert=false");
- strcat(tbuf, bincols);
- if( debug )
- strcat(tbuf, ",debug=2");
-
- /* now add the input mode */
- if( mode && *mode ){
- strcat(tbuf, ",");
- strcat(tbuf, mode);
- }
-
- /* init some convenience variables */
- evsize = header->basic->naxis[0];
- total = header->basic->naxis[1];
- ototal = 0;
-
- /* open the filter */
- if( (filter = FilterOpen(header, s, tbuf)) == NULL ){
- fprintf(stderr, "ERROR: tfilt could not open filter: %s\n",
- s ? s : "no filter");
- return(0);
- }
- else if( filter == NOFILTER ){
- fprintf(stderr, "no valid filter specified\n");
- return(0);
- }
-
- /* allocate space for a pile of event records */
- for(nev=NEVENTS; nev>0; nev /=2){
- if( ((ebuf = (char *)xmalloc(evsize*nev))!= NULL) &&
- ((vbuf = (int *)xmalloc(sizeof(int)*nev))!= NULL) )
- break;
- }
-
- /* print out header */
- for(j=0; j<header->table->tfields; j++){
- switch(header->table->col[j].type){
- case 'B':
- case 'L':
- fprintf(ofd, "%6s", header->table->col[j].name);
- break;
- case 'I':
- case 'U':
- fprintf(ofd, "%6s", header->table->col[j].name);
- break;
- case 'J':
- case 'V':
- fprintf(ofd, "%11s", header->table->col[j].name);
- break;
- case 'K':
- fprintf(ofd, "%20s", header->table->col[j].name);
- break;
- case 'E':
- fprintf(ofd, "%11s", header->table->col[j].name);
- break;
- case 'D':
- fprintf(ofd, "%17s", header->table->col[j].name);
- break;
- default:
- break;
- }
- }
- fprintf(ofd, "\n");
-
- for(j=0; j<header->table->tfields; j++){
- switch(header->table->col[j].type){
- case 'B':
- case 'L':
- fprintf(ofd, " -----");
- break;
- case 'I':
- case 'U':
- fprintf(ofd, " -----");
- break;
- case 'J':
- case 'V':
- fprintf(ofd, " ----------");
- break;
- case 'K':
- fprintf(ofd, " -------------------");
- break;
- case 'E':
- fprintf(ofd, " ----------");
- break;
- case 'D':
- fprintf(ofd, " ----------------");
- break;
- default:
- break;
- }
- }
- fprintf(ofd, "\n");
-
- /* set the total number of events or 'read til eof' */
- left = total;
-
- /* read all event records */
- while( left != 0 ){
- /* figure out how many to read this time */
- get = MIN(nev, left);
- /* read in a pile of events */
- got=gread(gio, ebuf, evsize, get);
- /* check for eof */
- if( got != get ){
- fprintf(stderr, "Warning: events ends at %d (expected %d)\n",
- total-left, total);
- /* we must be done */
- left = 0;
- }
- else{
- left -= got;
- }
- /* filter the events through the co-process */
- if( filter ){
- dofilt = FilterEvents(filter, ebuf, evsize, got, vbuf);
- }
- /* process each event in the pile */
- for(eptr=ebuf, i=0; i<got; i++, eptr += evsize){
- /* if its not a valid event, skip it */
- if( dofilt && (vbuf[i] == 0) )
- continue;
- /* else increment the total events */
- ototal++;
- /* process this event */
- for(j=0; j<header->table->tfields; j++){
- switch(header->table->col[j].type){
- case 'B':
- case 'L':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&bval);
- fprintf(ofd, "%6d", (int)bval);
- break;
- case 'I':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&sval);
- fprintf(ofd, "%6d", (int)sval);
- break;
- case 'U':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&usval);
- fprintf(ofd, "%6d", (int)usval);
- break;
- case 'J':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&ival);
- fprintf(ofd, "%11d", ival);
- break;
- case 'V':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&uival);
- fprintf(ofd, "%11d", uival);
- break;
- case 'K':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&lval);
- fprintf(ofd, "%20lld", lval);
- break;
- case 'E':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&fval);
- fprintf(ofd, "%11.2f", fval);
- break;
- case 'D':
- ColumnLoad(eptr+header->table->col[j].offset,
- header->table->col[j].size, 1, convert, (char *)&dval);
- fprintf(ofd, "%17.4f", dval);
- break;
- default:
- break;
- }
- }
- fprintf(ofd, "\n");
- }
- }
-
- /* free up allocated space */
- if( ebuf )
- xfree(ebuf);
- if( vbuf )
- xfree(vbuf);
-
- /* done with the filter process */
- if( filter )
- FilterClose(filter);
-
- /* final tally */
- fprintf(ofd, "\nTotal events: %d\n", ototal);
-
- /* that's good news */
- return(ototal);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int type;
- int x, y, n;
- int nmask;
- int x0, x1, y0, y1, block;
- int listev = 0;
- int dispim = 0;
- int dispfilt = 1;
- int doidx = 0;
- char *s;
- char *iname; /* input file name ptr */
- char fname[SZ_LINE]; /* input file name */
- char tail[SZ_LINE]; /* tail of file name */
- char tbuf[SZ_LINE]; /* ever-present temp buffer */
- char mode[SZ_LINE]; /* mode for FilterOpen */
- char evsect[SZ_LINE]; /* event section for image filters */
- long save_pos; /* save position in FITS file */
- GIO gio; /* input FITS file handle */
- FITSHead header; /* global fitsy header struct */
- Filter filter;
- FilterMask masks;
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* assume events */
- type = 'e';
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "d:efilxz")) != -1){
- switch(c){
- case 'd':
- dispim = 1;
- strcpy(evsect, optarg);
- if(sscanf(optarg, "%d %d %d %d %d", &x0, &x1, &y0, &y1, &block)!=5){
- fprintf(stderr, "-d requires x0, x1, y0, y1, block\n");
- exit(1);
- }
- break;
- case 'e':
- type = 'e';
- break;
- case 'f':
- dispfilt = 1;
- break;
- case 'i':
- type = 'i';
- break;
- case 'l':
- listev = 1;
- break;
- case 'x':
- doidx = 1;
- break;
- case 'z':
- putenv("FILTER_PAINT=true");
- break;
- }
- }
-
- if( type == 'e' ){
- strcpy(mode, "type=events");
- if( dispim ){
- snprintf(tbuf, SZ_LINE, ",evsect=\"%s\"", evsect);
- strcat(mode, tbuf);
- }
- }
- else{
- strcpy(mode, "type=image");
- }
-
-
- /* get file name or use a default */
- if( optind >= argc ){
- iname = "../funtest/test.ev[EVENTS]";
- }
- else{
- strncpy(fname, argv[optind], SZ_LINE);
- if( !strchr(fname, '[') )
- strncat(fname, "[EVENTS]", SZ_LINE);
- iname = fname;
- optind++;
- }
-
- /* if we do not list or display, we are in debug mode */
- if( !listev && !dispim && !dispfilt ){
- debug = 2;
- }
-
- /* open the binary table extension */
- if( (gio=ft_fitsheadopen(iname, &header, tail, SZ_LINE, "r")) == NULL ){
- fprintf(stderr, "ERROR: can't read FITS binary table: %s\n", iname);
- exit(1);
- }
- if( header == NULL ){
- fprintf(stderr, "ERROR: can't access FITS data: %s\n", iname);
- exit(1);
- }
-
- if( keyword(tail, "bincols", tbuf, SZ_LINE) ){
- snprintf(bincols, SZ_LINE, ",bincols=(%s)", tbuf);
- strcat(mode, bincols);
- }
- else{
- strcpy(bincols, ",bincols=(x,y)");
- strcat(mode, bincols);
- }
- if( debug )
- strcat(mode, ",debug=2");
- strcat(mode, ",lexonly=1");
- if( (s=getenv("FILTER_PAINT")) ){
- if( istrue(s) )
- strcat(mode, ",paint=true");
- else if( isfalse(s) )
- strcat(mode, ",paint=false");
- }
-
- while( 1 ){
- *tbuf = '\0';
- if( feof(stdin) )
- break;
- fgets(tbuf, SZ_LINE, stdin);
- if( *tbuf == 'q' )
- exit(0);
- if( *tbuf ){
- if( listev ){
- /* list out events */
- save_pos = gtell(gio);
- ListEvents(gio, stdout, header, tbuf, 1, mode);
- gseek(gio, save_pos, SEEK_SET);
- }
- if( dispim ){
- /* display image */
- if( *tbuf && (*tbuf != '\n') ){
- fprintf(stdout, "input string: %s", tbuf);
- filter = FilterOpen(header, tbuf, mode);
- if( !filter )
- fprintf(stderr, "Error in FilterOpen()\n");
- else if( filter == NOFILTER )
- fprintf(stderr, "No valid filter specified\n");
- else{
- nmask = FilterImage(filter, x0, x1, y0, y1, block, &masks, NULL);
- if( nmask ){
- /* loop through mask segments */
- y = 1;
- for(n=0; n<nmask; n++){
- /* process rows before the y row of this mask segment */
- for(; y<masks[n].y; y++){
- for(x=1; x<=(x1-x0+block)/block; x++)
- fprintf(stdout, "*");
- fprintf(stdout, "\n");
- }
- /* process each mask segment having the same y value */
- x = 1;
- while(1){
- /* process columns before the start column */
- for(; x<masks[n].xstart; x++)
- fprintf(stderr, ".");
- /* process columns in the mask */
- for(; x<=masks[n].xstop; x++)
- fprintf(stderr, "%d", masks[n].region);
- /* if we have another mask segment with the same y,
- we keep going */
- if( ((n+1)<nmask) && (masks[n+1].y==y) )
- n++;
- else
- break;
- }
- /* process the rest of the columns for this y row */
- for(; x<=(x1-x0+block)/block; x++)
- fprintf(stderr, ".");
- /* processed all mask segs in this y */
- fprintf(stderr, "\n");
- /* bump to next y row */
- y++;
- }
- /* process y rows after last row containing a mask segment */
- for(y=masks[nmask-1].y+1; y<=(y1-y0+block)/block; y++){
- for(x=1; x<=(x1-x0+block)/block; x++)
- fprintf(stdout, "*");
- fprintf(stdout, "\n");
- }
- }
- if( masks )
- xfree(masks);
- FilterClose(filter);
- }
- }
- }
- else{
- if( *tbuf && (*tbuf != '\n') ){
- fprintf(stdout, "input string: %s", tbuf);
- filter = FilterOpen(header, tbuf, mode);
- if( !filter )
- fprintf(stderr, "Error in FilterOpen()\n");
- else if( filter == NOFILTER )
- fprintf(stderr, "No valid filter specified\n");
- if( doidx ){
- if( (s = xstrdup(_FilterString()) ) ){
- fprintf(stdout, "index input: %s\n", s);
- idxinitparser(s);
- idxparse();
- idxendparser();
- xfree(s);
- }
- }
- if( dispfilt ){
- fprintf(stdout, "filter: %s\n", _FilterString());
- }
- FilterClose(filter);
- }
- }
- }
- }
- return(0);
-}
diff --git a/funtools/filter/tfilt.ex b/funtools/filter/tfilt.ex
deleted file mode 100644
index 0e54be2..0000000
--- a/funtools/filter/tfilt.ex
+++ /dev/null
@@ -1,24 +0,0 @@
-!foosub(pi, pichans, event,"this is a test", 'x')
-(pha*10)=='P'
-pha==phachans/2
-annulus(X,Y,503,512,30,80)
-(pow(x-400,2)+pow(y-400,2))<=16
-min(pi,pha)>1&&max(pi,pha)<3
-min(pi,pha)*14>x
-max(pi,pha)==(pi+1)
-(pi+pha)>2+log(pi)-pha
-(pi<3)&&(pi==pha)
-pi=3:4,(pha>1)
-pha=1,100<time
-pha=1,100||pi
-pha=1,100||pi=2
-pi=1,2&&pha>3
-pi>pha+1
-pha=1,3,5:7,pi=2,4,6:8&&time>100
-pha=1,3,5:7,pi=2,4,6:8,time<100
-pha=1,3,5:7
-pi=1,pha=2
-pi=1,pha==2
-pi=1,2==pha
-pha=1,3,5:7,pi=2:3
-pha=1,3,5:7,pi=2,4,6:8
diff --git a/funtools/filter/tl.c b/funtools/filter/tl.c
deleted file mode 100644
index a5aa346..0000000
--- a/funtools/filter/tl.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "word.h"
-#include "tl.h"
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-/*
- * getfitsfloatcenter: funtools and cfitsio have a 0.5 pixel descrepancy
- * when converting floating point physical coords to image coords.
- * setting this environment variable makes funtools work like cfitsio
- */
-static double fitscenval=0.5;
-static int ceninited=0;
-#ifdef ANSI_FUNC
-static double getfitsfloatcenter(void)
-#else
-static double getfitsfloatcenter()
-#endif
-{
- char *s=NULL;
- if( !ceninited ){
- if( (s=getenv("FILTER_CFITSIO")) && istrue(s) ){
- fitscenval = 1.0;
- }
- ceninited = 1;
- }
- return fitscenval;
-}
-
-#ifdef ANSI_FUNC
-double
-tlp2i (double dp, double tlmin, double binsiz, int type)
-#else
-double tlp2i (dp, tlmin, binsiz, type)
- double dp;
- double tlmin;
- double binsiz;
- int type;
-#endif
-{
- double dval = getfitsfloatcenter();
- if( (binsiz == 1.0) || (binsiz <= 0.0) ){
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- default:
- return ((dp - tlmin) + 1.0);
- case 'E':
- case 'D':
- return ((dp - tlmin) + dval);
- }
- }
- else{
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- default:
- return ((dp - tlmin)/binsiz + 1.0);
- case 'E':
- case 'D':
- return ((dp - tlmin)/binsiz + dval);
- }
- }
-}
-
-#ifdef ANSI_FUNC
-int
-itlp2i (double dp, double tlmin, double binsiz, int UNUSED(type))
-#else
-int itlp2i (dp, tlmin, binsiz, type)
- double dp;
- double tlmin;
- double binsiz;
- int type;
-#endif
-{
- if( (binsiz == 1.0) || (binsiz <= 0.0) ){
- return (int)((dp - tlmin) + 1.0);
- }
- else{
- return (int)((dp - tlmin)/binsiz + 1.0);
- }
-}
-
-#ifdef ANSI_FUNC
-double
-tli2p (double di, double tlmin, double binsiz, int type)
-#else
-double tli2p (di, tlmin, binsiz, type)
- double di;
- double tlmin;
- double binsiz;
- int type;
-#endif
-{
- double dval = getfitsfloatcenter();
- if( (binsiz == 1.0) || (binsiz <= 0.0) ){
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- default:
- return ((di - 1.0) + tlmin);
- case 'E':
- case 'D':
- return ((di - dval) + tlmin);
- }
- }
- else{
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- default:
- return ((di - 1.0)*binsiz + tlmin);
- case 'E':
- case 'D':
- return ((di - dval)*binsiz + tlmin);
- }
- }
-}
-
-#ifdef ANSI_FUNC
-double
-tldim (double tlmin, double tlmax, double binsiz, int type)
-#else
-double tldim (tlmin, tlmax, binsiz, type)
- double tlmin;
- double tlmax;
- double binsiz;
- int type;
-#endif
-{
- if( (binsiz == 1.0) || (binsiz <= 0.0) ){
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- default:
- return ((tlmax-tlmin) + 1.0);
- case 'E':
- case 'D':
- return (tlmax-tlmin);
- }
- }
- else{
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- default:
- return ((tlmax-tlmin)/binsiz + 1.0);
- case 'E':
- case 'D':
- return ((tlmax-tlmin)/binsiz);
- }
- }
-}
-
diff --git a/funtools/filter/tl.h b/funtools/filter/tl.h
deleted file mode 100644
index 4e7dcfe..0000000
--- a/funtools/filter/tl.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * tl.h -- declarations for tl parsing
- *
- */
-
-#ifndef __tl_h
-#define __tl_h
-
-#include "prsetup.h"
-
-_PRbeg
-
-double tlp2i _PRx((double dp, double tlmin, double binsiz, int type));
-int itlp2i _PRx((double dp, double tlmin, double binsiz, int type));
-double tli2p _PRx((double di, double tlmin, double binsiz, int type));
-double tldim _PRx((double tlmin, double tlmax, double binsiz, int type));
-
-_PRend
-
-#endif
diff --git a/funtools/filter/xalloc_c.h b/funtools/filter/xalloc_c.h
deleted file mode 100644
index a25dbc3..0000000
--- a/funtools/filter/xalloc_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *XALLOC_C="\n/*\n * Copyright (c) 2004-2009 Smithsonian Astrophysical Observatory\n */\n\n/*\n *\n * xalloc -- safe memory allocation with error checking\n *\n */\n\n/* this module is compiled within a funtools filter and must not require\n the header files */\n#ifdef FILTER_PTYPE\n#define ANSI_FUNC 1\n#else\n#include <xalloc.h>\n#endif\n\n#define XALLOC_ERROR \"ERROR: can't allocate memory (xalloc)\\n\"\n\n#if XALLOC_SETJMP\n\nstatic jmp_buf *xalloc_envptr=NULL;\n\n#ifdef ANSI_FUNC\nvoid xalloc_savejmp(jmp_buf *env)\n#else\nvoid xalloc_savejmp(env)\n jmp_buf *env;\n#endif\n{\n xalloc_envptr = env;\n}\n#endif\n\n\n#ifdef ANSI_FUNC\nstatic void _xalloc_error(void)\n#else\nstatic void _xalloc_error()\n#endif\n{\n write(1, XALLOC_ERROR, strlen(XALLOC_ERROR));\n#if XALLOC_SETJMP\n if( xalloc_envptr )\n longjmp(*xalloc_envptr, XALLOC_SETJMP);\n else\n#endif\n exit(1);\n}\n\n#ifdef ANSI_FUNC\nvoid *xmalloc(size_t n)\n#else\nvoid *xmalloc(n)\n size_t n;\n#endif\n{\n void *p;\n \n if( !(p = (void *)malloc(n)) )\n _xalloc_error();\n return p;\n}\n\n#ifdef ANSI_FUNC\nvoid *xcalloc (size_t n, size_t s)\n#else\nvoid *xcalloc (n, s)\n size_t n, s;\n#endif\n{\n void *p;\n\n if( !(p = (void *)calloc(n, s)) )\n _xalloc_error();\n return p;\n}\n\n#ifdef ANSI_FUNC\nvoid *xrealloc (void *p, size_t n)\n#else\nvoid *xrealloc (p, n)\n void *p;\n size_t n;\n#endif\n{\n if( !p )\n return xmalloc(n);\n if( !(p = (void *)realloc(p, n)) )\n _xalloc_error();\n return p;\n}\n\n#ifdef ANSI_FUNC\nvoid xfree (void *p)\n#else\nvoid xfree (p)\n void *p;\n#endif\n{\n if( p )\n free(p);\n}\n\n#ifdef ANSI_FUNC\nchar *xstrdup (char *s)\n#else\nchar *xstrdup (s)\n char *s;\n#endif\n{\n if( s )\n return((char *)strcpy((char *)xmalloc((size_t)strlen(s)+1), s));\n else\n return NULL;\n}\n";
diff --git a/funtools/fitsy/Imakefile b/funtools/fitsy/Imakefile
deleted file mode 100644
index 52727ba..0000000
--- a/funtools/fitsy/Imakefile
+++ /dev/null
@@ -1,54 +0,0 @@
-XCOMM Makefile for fitsy library
-
-#include "../config/Imake.rules"
-
-LBINDIR = `$(TOP)/pathname $(TOP)/bin`
-LMANDIR = $(TOP)/man
-LLIBDIR = $(TOP)/lib
-
-INCLUDES= -I.
-
-SRCS= cardpar.c \
- cardfmt.c \
- cardins.c \
- cardfind.c \
- headget.c \
- headset.c \
- headins.c \
- headinit.c \
- headdata.c \
- headfind.c \
- headfile.c \
- headimage.c \
- headtable.c \
- dataimage.c \
- fitshead.c \
- fitsimage.c \
- ftacht.c \
- nd.c
-
-OBJS= cardpar.o \
- cardfmt.o \
- cardins.o \
- cardfind.o \
- headget.o \
- headset.o \
- headins.o \
- headinit.o \
- headdata.o \
- headfind.o \
- headfile.o \
- headimage.o \
- headtable.o \
- dataimage.o \
- fitshead.o \
- fitsimage.o \
- ftacht.o \
- nd.o
-
-NormalLibraryObjectRule()
-NormalLibraryTarget(fitsy,$(OBJS))
-
-DependTarget()
-LintTarget()
-
diff --git a/funtools/fitsy/Makefile.in b/funtools/fitsy/Makefile.in
deleted file mode 100644
index 5504778..0000000
--- a/funtools/fitsy/Makefile.in
+++ /dev/null
@@ -1,240 +0,0 @@
-# Makefile for library files used by GNU text utilities.
-# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# Directory in which to install the .a, .so, and .o files:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the programs:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the include files:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = ./install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-CC = @CC@
-#CC = gcc -fPIC -Wall -Wno-comment
-#CC = gcc -fbounds-checking -DBOUNDS_CHECKING
-AR = ar
-RANLIB = @RANLIB@
-#DEFS = -DCONFIG_BROKETS @DEFS@
-DEFS = @DEFS@
-#CFLAGS = -g
-# CFLAGS = @CFLAGS@
-#CFLAGS = -ansi -pedantic -Wimplicit -Wreturn-type -Wunused -Wformat -Wuninitialized -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Werror
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
-YACC = @YACC@
-
-# extra libs
-EXTRA_LIBS = @EXTRA_LIBS@
-
-# extra objs (usually set to $ZOBJS)
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# the full set of libraries for linking
-LIBS = $(EXTRA_LIBS)
-
-OBJECTS=cardpar.o \
- cardfmt.o \
- cardins.o \
- cardfind.o \
- headget.o \
- headset.o \
- headins.o \
- headinit.o \
- headdata.o \
- headfind.o \
- headfile.o \
- headimage.o \
- headtable.o \
- headsimple.o \
- headwcs.o \
- inverse.o \
- dataimage.o \
- fitshead.o \
- fitsimage.o \
- ftacht.o \
- ftacht2.o \
- nd.o \
- tableheader.o \
- $(EXTRA_OBJS)
-
-# comment this out to use default defintions for stand-alone compile
-XFILE = -DUSE_XFILEIO=1 -I../util
-
-INCL = $(XFILE) -I$(srcdir)
-
-# the default library for this package
-DEFLIB = @DEFLIB@
-# the actual library we are building (if this is a subpackage)
-LIB = @LIB@
-
-all: $(LIB)
-
-progs: $(PROGS)
-
-All: $(LIB) $(PROGS)
-
-.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) $<
-
-$(LIB): $(OBJECTS)
- $(AR) cruv $@ $(OBJECTS)
- $(RANLIB) $@
-
-objects:$(OBJECTS)
-
-fitsy: Force
- $(MAKE) clean
- $(MAKE) objects XFILE=""
- $(MAKE) libfitsy.a
-
-libfitsy.a : Force
- $(AR) cruv $@ $(OBJECTS)
- $(RANLIB) $@
-
-
-# these are the zlib routines:
-adler32.o: $(ZDIR)/adler32.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/adler32.c
-compress.o: $(ZDIR)/compress.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/compress.c
-crc32.o: $(ZDIR)/crc32.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/crc32.c
-gzio.o: $(ZDIR)/gzio.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/gzio.c
-uncompr.o: $(ZDIR)/uncompr.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/uncompr.c
-deflate.o: $(ZDIR)/deflate.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/deflate.c
-trees.o: $(ZDIR)/trees.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/trees.c
-zutil.o: $(ZDIR)/zutil.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/zutil.c
-inflate.o: $(ZDIR)/inflate.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/inflate.c
-infblock.o: $(ZDIR)/infblock.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/infblock.c
-inftrees.o: $(ZDIR)/inftrees.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/inftrees.c
-infcodes.o: $(ZDIR)/infcodes.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/infcodes.c
-infutil.o: $(ZDIR)/infutil.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/infutil.c
-inffast.o: $(ZDIR)/inffast.c
- $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \
- $(ZDIR)/inffast.c
-
-install: install-binaries
-
-install-binaries: $(LIB)
- @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @if [ "$(LIB)" = "$(DEFLIB)" ] ; then \
- XLIB=`basename $(LIB)`; \
- echo "Installing $$XLIB"; \
- $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \
- (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \
- chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \
- fi;
- @echo "Installing fitsy.h"
- @$(INSTALL_DATA) fitsy.h $(INCLUDE_INSTALL_DIR)/fitsy.h
- @echo "Installing xfile.h"
- @$(INSTALL_DATA) xfile.h $(INCLUDE_INSTALL_DIR)/xfile.h
-# @for i in $(PROGS) ; \
-# do \
-# if [ -f $$i ] ; then \
-# echo "Installing $$i" ; \
-# $(INSTALL_PROGRAM) $$i $(BIN_INSTALL_DIR)/$$i ; \
-# fi; \
-# done;
-
-uninstall:
-
-TAGS: $(SOURCES)
- etags $(SOURCES)
-
-check:
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(ZDIR)/*.o \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak \
- config.info config.log \
- doc/*~
- $(RM) -r autom4te.cache
-
-mostlyclean: clean
-
-distclean: clean
- $(RM) Makefile config.cache config.status config.log
-
-realclean: distclean
- $(RM) TAGS
-
diff --git a/funtools/fitsy/ac_c_long_long.m4 b/funtools/fitsy/ac_c_long_long.m4
deleted file mode 100644
index fb6df1e..0000000
--- a/funtools/fitsy/ac_c_long_long.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-##### http://autoconf-archive.cryp.to/ac_c_long_long.html
-#
-# SYNOPSIS
-#
-# AC_C_LONG_LONG
-#
-# DESCRIPTION
-#
-# Provides a test for the existance of the long long int type and
-# defines HAVE_LONG_LONG if it is found.
-#
-# LAST MODIFICATION
-#
-# 2006-10-30
-#
-# COPYLEFT
-#
-# Copyright (c) 2006 Caolan McNamara <caolan@skynet.ie>
-#
-# Copying and distribution of this file, with or without
-# modification, are permitted in any medium without royalty provided
-# the copyright notice and this notice are preserved.
-
-AC_DEFUN([AC_C_LONG_LONG],
-[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
-[if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- AC_TRY_COMPILE(,[long long int i;],
- ac_cv_c_long_long=yes,
- ac_cv_c_long_long=no)
- fi])
- if test $ac_cv_c_long_long = yes; then
- AC_DEFINE(HAVE_LONG_LONG, 1, [compiler understands long long])
- fi
-])
diff --git a/funtools/fitsy/aclocal.m4 b/funtools/fitsy/aclocal.m4
deleted file mode 100644
index 65f68be..0000000
--- a/funtools/fitsy/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-builtin(include,ac_c_long_long.m4)
diff --git a/funtools/fitsy/cardfind.c b/funtools/fitsy/cardfind.c
deleted file mode 100644
index 999d143..0000000
--- a/funtools/fitsy/cardfind.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Fitsy FITS card find routines.
-
- DESCRIPTION
-
- Routines to find FITS cards in a FITS headers data structure.
-
- EXAMPLES
-+
-
- /-* Declair some fitsy types.
- *-/
- #FITSHead fits;
- #FITSCard foo;
- #FITSCard goo;
- #FITSBuff key;
-
- /-* Look up a card using sequential search.
- *-/
- #ft_cardkey(key, "FOO");
- foo = #ft_cardfind(fits, key, 0);
-
- /-* This is the same thing. But the card is added to the header
- if it isn't found. This will also invalidate the index if
- there is one.
- *-/
- #ft_cardkey(key, "FOO");
- foo = #ft_cardfind(fits, key, 1);
-
- /-* Now index the header so that searches are faster. #ft_cardfind
- will automatically use the index if its valid.
- *-/
- #ft_index(fits);
- #ft_cardkey(key, "GOO", 0);
- goo = #ft_cardfind(fits, key, 0);
-+
- */
-
-#include "fitsy.h"
-
-int ft_compare(a, b)
- char **a;
- char **b;
-
-{
- int ax, bx;
-
- if ( !strncmp(*a, *b, 5)
- && ((*a)[5] != ' ') && ((*b)[5] != ' ')
- && (ax = atoi(&(*a)[5]))
- && (bx = atoi(&(*b)[5])) ) {
- if ( ax < bx ) return -1;
- if ( ax == bx ) return 0;
- if ( ax > bx ) return 1;
- }
-
- return strncmp(*a, *b, 8);
-}
-
-/* Find a FITS card in the header.
-
- #cardfind will use the index if is has been created otherwise
- it searches sequentially through the header to find the card.
- */
-FITSCard ft_cardfind(fits, key, add)
- FITSHead fits; /* The FITS header to look in. */
- FITSCard key; /* The card keyword to lookup. */
- int add; /* If add is true the card will
- be added to the header if it is
- not found.
- */
-{
- FITSCard card;
- int match;
-
- if ( fits == NULL ) return NULL;
- if ( key == NULL ) return NULL;
-
- if ( fits->index ) card = ft_cardfindidx(fits, key, &match);
- else card = ft_cardfindseq(fits, key, &match);
-
- if ( !match && add )
- return ft_cardins(fits, key, card);
- else return match ? card : NULL;
-}
-
-/* Find a FITS card in the header using an index.
-
- If the header is not indexed an index is created for it.
- */
-FITSCard ft_cardfindidx(fits, key, match)
- FITSHead fits;
- FITSCard key;
- int *match; /* Returns true if the card found is
- an exact match for the keyword requested.
- */
-{
- FITSCard *base;
- int length;
-
- int lo, hi, cut;
- int i;
-
- if ( fits == NULL ) return NULL;
- if ( key == NULL ) return NULL;
-
- base = fits->index;
- length = ft_ncards(fits);
-
- lo = -1;
- hi = length;
- cut = length / 2;
-
- if ( !fits->index ) ft_headindex(fits);
-
- *match = 0;
- while ( hi - lo > 1 ) {
- if ( !(i = ft_compare((char **)&key, (char **)&base[cut])) ) {
- *match = 1;
- return base[cut];
- }
-
- if ( i < 0 ) {
- hi = cut;
- cut = (lo + hi) / 2;
- } else {
- lo = cut;
- cut = (lo + hi) / 2;
- }
- }
-
- if ( !strncmp(key->c, base[cut]->c, 5) )
- return base[cut];
-
- return NULL;
-}
-
-/* Find a card in the FITS header using sequential search.
-
- If the requested card is a FITS indexed keyword and an exact match
- is not found, the last card of that type is returned and
- match is set to 0.
- */
-FITSCard ft_cardfindseq(fits, key, match)
- FITSHead fits;
- FITSCard key;
- int *match;
-{
- FITSCard card;
- FITSCard xnear = NULL;
-
- if ( fits == NULL ) return NULL;
- if ( key == NULL ) return NULL;
-
- *match = 0;
- for ( card = fits->cards; card != &fits->cards[fits->ncard]; card++ ) {
- if ( !strncmp(key->c, card->c, 8) ) {
- *match = 1;
- return card;
- }
- if ( !strncmp(key->c, card->c, 5)
- && (isdigit((unsigned int) (*card).c[5]) || (*card).c[5] == ' ' )
- && (isdigit((unsigned int) (*card).c[6]) || (*card).c[6] == ' ' )
- && (isdigit((unsigned int) (*card).c[7]) || (*card).c[7] == ' ' ) ) {
- xnear = card;
- }
- }
-
- return xnear;
-}
-
-FITSCard ft_cardfindblok(cards, key, match, nhist)
- FITSCard cards;
- FITSCard key;
- int *match;
- int *nhist;
-{
- FITSCard card;
- FITSCard xnear = NULL;
-
- if ( cards== NULL ) return NULL;
- if ( key == NULL ) return NULL;
-
- *nhist = 0;
- *match = 0;
- for ( card = cards; card != &cards[FT_CARDS]; card++ ) {
- if ( !strncmp(key->c, card->c, 8) ) {
- *match = 1;
- return card;
- }
- if ( !strncmp(key->c, card->c, 5)
- && (isdigit((unsigned int) (*card).c[5]) || (*card).c[5] == ' ' )
- && (isdigit((unsigned int) (*card).c[6]) || (*card).c[6] == ' ' )
- && (isdigit((unsigned int) (*card).c[7]) || (*card).c[7] == ' ' ) ) {
- xnear = card;
- }
-
- if ( !strncmp(key->c, "HISTORY", 7) ) (*nhist)++;
- }
-
- return xnear;
-}
diff --git a/funtools/fitsy/cardfmt.c b/funtools/fitsy/cardfmt.c
deleted file mode 100644
index 58d2301..0000000
--- a/funtools/fitsy/cardfmt.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/* Fitsy FITS card set routines.
-
- EXAMPLES
-
- Format the keyword part of a card:
-+
-
- FITSHead fits;
- FITSBuff card;
- FITSCard here;
-
- #ft_cardclr(&card, 1); /-* Clear out the card first *-/
-
- #ft_cardkey(&card, "RA"); /-* Set the keyword *-/
- #ft_cardsetr(&card, 14.789, 3, "OBS RA"); /-* Set the value of RA. *-/
-
- here = #ft_cardapp(fits, &card); /-* Put the new card into a header*-/
-
- #ft_cardsetr(here, 15.567, 3, FT_Comment); /-* Set a new value after it's in
- the header and reuse the existing
- comment *-/
-+
-
- Format the value part of a card:
-+
- int l = 1;
- int i = 15;
- double d = 34.7;
- char *c = "Shutter";
-
- FITSHead fits;
- FITSCard card;
-
- /-* Get a card pointer from the header
- *-/
- card = #ft_cardfind(fits, "Keyword", 0);
-
- #ft_cardsetl(card, l, "A true value");
- #ft_cardseti(card, i, "15 is the number");
- #ft_cardsetr(card, d, 4, "Four digits of precision here");
-
- /-* In this example the special pointer #FT_Comment is used to
- use the existing comment in the card.
- *-/
- #ft_cardsets(card, c, FT_Comment);
-+
- */
-
-#include <ctype.h>
-#include <math.h>
-#include "fitsy.h"
-#include "xos.h"
-
-char FT_comment='\0';
-char *FT_Comment = &FT_comment;
-
-
-/* look for blank name */
-int ft_isblank(s)
- char *s;
-{
- if( !s || !*s )
- return 1;
- for(; *s; s++){
- if( *s != ' ' )
- return 0;
- }
- return 1;
-}
-
-/* Format a FITS card with the supplied values.
- */
-FITSCard ft_cardfmt(card, name, n, type, value, prec, comm)
- FITSCard card; /* FITS card to format. */
- char *name; /* keyword name. */
- int n; /* keyword index number, if is zero no
- index number is appended to the
- keyword.
- */
- FITSType type; /* type of the card. */
- void *value; /* pointer to the value to format. The
- pointer must be of the apropriate type.
- */
- int prec; /* If type is FT_REAL the value is formatted
- at this precision. Otherwise this parameter
- is ignored.
- */
- char *comm; /* Comment for the card. */
-{
- int i, j;
- int card_len = 30;
- FITSBuff comment;
-
- if ( card == NULL ) return NULL;
-
- if ( comm == FT_Comment ) {
- ft_cardclr((FITSCard) comment.c, 1);
-
- for ( i = 8; i < FT_CARDLEN && card->c[i] != '/'; i++ );
- i++;
- for ( j = 0; i < FT_CARDLEN; i++, j++ )
- comment.c[j] = card->c[i];
- if ( j ) comment.c[j+1] = '\0';
- else comment.c[0] = '\0';
- }
-
- memset(&(*card).c[8], ' ', FT_CARDLEN-8);
-
- if ( name ) {
- int len = Min(strlen(name), 8);
-
- memset(&(*card).c[0], ' ', 8);
- memcpy(&(*card).c[0], name, len);
-
- if ( n != 0 ) {
- char tbuf[32]; /* Vestigial remains of Eric's fix. */
- snprintf(tbuf, 32, "%d", n);
-
- memcpy(&(*card).c[len], tbuf, Min((int)strlen(tbuf), 8-len));
- }
- /* sense HISTORY AND COMMENT cards */
- if( !n && (ft_isblank(name) ||
- !strcmp(name, "HISTORY") ||
- !strcmp(name, "CONTINUE") ||
- !strcmp(name, "COMMENT")) )
- type = FT_COMMENT;
- }
-
- if ( value ) {
- switch ( type ) {
- case FT_COMMENT: {
- char *v = (char *) value;
-
- for ( i = 0, j = 8; j < FT_CARDLEN && v[i]; i++, j++ ) {
- card->c[j] = v[i];
- }
-
- goto docomm;
- }
-
- case FT_VALUE: {
- char *v = (char *) value;
-
- card->c[8] = '=';
-
- for ( i = 0, j = 10; j < FT_CARDLEN && v[i]; i++, j++ ) {
- if ( v[i] == '\'' ) {
- j--;
- continue;
- }
-
- card->c[j] = v[i];
- }
- if ( j < 29 ) j = 29;
-
- card_len = j;
- break;
- }
-
- case FT_STRING: {
- char *v = (char *) value;
-
- card->c[8] = '=';
- card->c[10] = '\'';
-
- for ( i = 0, j = 11; j < FT_CARDLEN-1 && v[i]; i++, j++ ) {
- if ( v[i] == '\'' ) {
- j--;
- continue;
- }
- card->c[j] = v[i];
- }
- if ( j < 19 ) j = 19;
-
- card->c[j++] = '\'';
-
- card_len = j;
- break;
- }
-
- case FT_INTEGER: {
- int *v = (int *) value;
-
- card->c[8] = '=';
- sprintf(&card->c[10], "%20d", *v);
- card_len = strlen((card->c));
- card->c[card_len] = ' ';
- break;
- }
-
- case FT_LONG: {
- longlong *v = (longlong *) value;
-
- card->c[8] = '=';
-#if HAVE_LONG_LONG
- sprintf(&card->c[10], "%20lld", *v);
-#else
- sprintf(&card->c[10], "%20ld", *v);
-#endif
- card_len = strlen((card->c));
- card->c[card_len] = ' ';
- break;
- }
-
- case FT_REAL: {
- double *v = (double *) value;
-
- card->c[8] = '=';
- /* use e format if the number is too big/small */
- if( Abs(*v) < 0.1 )
- sprintf(&card->c[10], "%#20.*E", prec, *v);
- else if( Abs(*v) >= pow(10.0,(double)(20-2-prec)) )
- sprintf(&card->c[10], "%#20.*E",
- Min(17,prec+(int)log10(*v)) , *v);
- else
- sprintf(&card->c[10], "%#20.*f", prec, *v);
- card_len = strlen(card->c);
- card->c[card_len] = ' ';
- break;
- }
- case FT_LOGICAL: {
- int *v = (int *) value;
-
- card->c[8] = '=';
- card->c[29] = *v ? 'T' : 'F';
- card_len = 30;
- break;
- }
- case FT_COMPLEX: break;
- case FT_UNKNOWN: break;
- }
- }
-
-docomm:
- if ( comm != NULL ) {
- if ( comm == FT_Comment ) comm = comment.c;
- if ( *comm ) {
- int comm_len;
-
- while( *comm == ' ' )
- comm++;
- comm_len = strlen(comm);
-
- if ( card_len + comm_len + 3 > FT_CARDLEN ) {
- /* Clip the comment
- */
- comm_len = FT_CARDLEN-(card_len + 3);
- }
-
- if ( comm_len <= 0 ) return card;
-
- /* start as close to col 29 as we can to make it look nice */
- if ( (card_len < 30) &&
- (card_len + comm_len + 3 < FT_CARDLEN) ) {
- int spaces;
- spaces = Min(30-card_len,FT_CARDLEN-(card_len+comm_len+3));
- if( spaces > 0 ){
- while( spaces-- )
- card->c[card_len++] = ' ';
- }
- }
-
- card->c[card_len+1] = '/';
- card->c[card_len+2] = ' ';
- memmove(&(*card).c[card_len+3], comm, comm_len);
- }
- }
-
- return card;
-}
-
-/* Format a keyword into a FITS card.
- */
-FITSCard ft_cardkey(card, name, n)
- FITSCard card;
- char *name;
- int n;
-{
- return ft_cardfmt(card, name, n, FT_UNKNOWN, NULL, 0, NULL);
-}
-
-/* Format a value into a FITS card.
- */
-FITSCard ft_cardset(card, type, value, prec, comm)
- FITSCard card;
- FITSType type;
- void *value;
- int prec;
- char *comm;
-{
- return ft_cardfmt(card, NULL, 0, type, value, prec, comm);
-}
-
-/* Format a logical value into a FITS card.
- */
-FITSCard ft_cardsetl(card, lvalue, comm)
- FITSCard card;
- int lvalue; /* Logical to format as a FITS value. */
- char *comm;
-{
- return ft_cardfmt (card, NULL, 0, FT_LOGICAL, &lvalue, 0, comm);
-}
-
-/* Format an integer value into a FITS card.
- */
-FITSCard ft_cardseti(card, ivalue, comm)
- FITSCard card;
- int ivalue; /* Integer to format as a FITS value. */
- char *comm;
-{
- return ft_cardfmt (card, NULL, 0, FT_INTEGER, &ivalue, 0, comm);
-}
-
-/* Format an 64-bit integer value into a FITS card.
- */
-FITSCard ft_cardsetil(card, ivalue, comm)
- FITSCard card;
- longlong ivalue; /* Integer to format as a FITS value. */
- char *comm;
-{
- return ft_cardfmt (card, NULL, 0, FT_LONG, &ivalue, 0, comm);
-}
-
-/* Format a real value into a FITS card.
- */
-FITSCard ft_cardsetr(card, rvalue, prec, comm)
- FITSCard card;
- double rvalue; /* Double to format as a FITS value. */
- int prec;
- char *comm;
-{
- return ft_cardfmt (card, NULL, 0, FT_REAL , &rvalue, prec, comm);
-}
-
-/* Format a string value into a FITS card.
- */
-FITSCard ft_cardsets(card, svalue, comm)
- FITSCard card;
- char *svalue; /* String to format as a FITS value. */
- char *comm;
-{
- return ft_cardfmt (card, NULL, 0, FT_STRING , svalue, 0, comm);
-}
-
-/* Clear FITS cards by writing space into them.
- */
-FITSCard ft_cardclr(card, ncards)
- FITSCard card;
- int ncards; /* Number of 80 character FITS cards to clear */
-{
- if ( card != NULL )
- memset(card, ' ', sizeof(FITSBuff) * ncards);
-
- return card;
-}
-
-/* Copy a FITS card.
- */
-FITSCard ft_cardcpy(card1, card2)
- FITSCard card1; /* Destination card */
- FITSCard card2; /* Source card */
-{
- if ( card1 != NULL && card2 != NULL )
- memmove(card1->c, card2->c, sizeof(FITSBuff));
-
- return card1;
-}
diff --git a/funtools/fitsy/cardins.c b/funtools/fitsy/cardins.c
deleted file mode 100644
index 59ce7a8..0000000
--- a/funtools/fitsy/cardins.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Fitsy FITS card insert and delete routines.
-
- EXAMPLES
-+
- FITSCard here;
- FITSBuff card;
-
- #ft_cardkey(&card, "Keyword", 0);
- #ft_cardseti(&card, 4, NULL);
-
- /-* Insert a new card "Keyword" after the 4th card.
- *-/
- here = #ft_cardins(fits, &card, #ft_cardnth(4));
-
- /-* Append the same card to the header
- *-/
- card = #ft_cardapp(fits, &card);
-
- /-* Delete the first card.
- *-/
- #ft_carddel(fits, here);
-+
- */
-
-#include "xos.h"
-#include "fitsy.h"
-
-/* Insert a #card into a FITS header after #here.
-
- If #here is NULL #card is inserted before the END card.
-
- Returns #card;
- */
-FITSCard ft_cardins(fits, card, here)
- FITSHead fits; /* FITS header. */
- FITSCard card; /* FITS card to insert, append or
- delete. */
- FITSCard here; /* Insert #card after #here */
-{
-
- if ( fits == NULL ) return NULL;
- if ( fits->cards == NULL ) return NULL;
- if ( card == NULL ) return NULL;
-
- if ( fits->index ) (void)Free(fits->index);
-
- if ( fits->ncard+1 > fits->acard ) {
- int hereoffset = 0;
-
- if ( here != NULL ) hereoffset = here - fits->cards;
-
- if ( fits->mem != FT_MALLOC ) return NULL;
-
- fits->acard += FT_CARDS;
- /* fits->data = fits->acard * FT_CARDLEN; */
- (void)ReAlloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1);
- /* make sure there is a null at the end (EGM) */
- ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0';
-
- if ( here != NULL ) here = fits->cards + hereoffset;
-
- ft_cardclr(&fits->cards[fits->acard-FT_CARDS], FT_CARDS);
- }
-
- if ( here == NULL ) here = &fits->cards[fits->ncard-2];
-
- memmove(here+2, here+1
- , (&fits->cards[fits->ncard-1]-here) * sizeof(FITSBuff));
- memmove(here+1, card , sizeof(FITSBuff));
-
- fits->ncard++;
-
- return (here+1);
-}
-
-/* Append a card to the end of the FITS header.
-
- Retuns #card.
- */
-FITSCard ft_cardapp(fits, card)
- FITSHead fits;
- FITSCard card;
-{
- return ft_cardins(fits, card, NULL);
-}
-
-/* Delete a card from a FITS header.
-
- Returns #card which now points the the card after
- the one deleted
- */
-FITSCard ft_carddel(fits, card)
- FITSHead fits;
- FITSCard card;
-{
- if ( fits == NULL ) return NULL;
- if ( card == NULL ) return NULL;
-
- (void)Free(fits->index);
- memmove(card, card+1, (ft_last(fits) - card) * sizeof(FITSBuff));
- ft_cardclr(ft_last(fits), 1);
-
- fits->ncard--;
-
- return card;
-}
-
diff --git a/funtools/fitsy/cardpar.c b/funtools/fitsy/cardpar.c
deleted file mode 100644
index df45248..0000000
--- a/funtools/fitsy/cardpar.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Fitsy FITS card parsing routines.
-
- DESCRIPTION
- These routines parse FITS cards. Usually the header value routines will
- be used instead of these.
-
- EXAMPLES
-+
- FITSHead fits;
- FITSCard card;
- FITSType type;
- char value[FT_CARDLEN];
- int index;
- char comment[FT_CARDLEN];
-
- int im; /-* Is this a primary image? *-/
-
- #ft_cardpar(card, &type, value, &index, comm);
-
- card = #ft_headfind(fits, "SIMPLE", 0, 0);
-
- im = #ft_cardgetl(card);
- */
-
-#include "fitsy.h"
-
-/* Parse a FITS card in to its type, value index and comment parts
-
- The ft_cardpar will parse an 80 character fits card in memory
- into its parts according to the standard. Some non-standard
- card formats are recognized.
-
- Returns
- The value parameter.
- */
-char *ft_cardpar(card, type, value, index, comm)
- FITSCard card; /* FITS card to parse. */
- FITSType *type; /* Returned card type. */
- char *value; /* Returned card value string. */
- int *index; /* Returned index of the card keyword. */
- char *comm; /* Returned card comment. */
-{
- int i=0, j;
-
- if ( card == NULL ) {
- *value = '\0';
- return value;
- }
-
- if ( index ) *index = strtol(&card->c[5], NULL, 0);
-
- value[0] = '\0';
-
- if ( !strncmp(card->c, "HISTORY ", 8) || !strncmp(card->c, "COMMENT ", 8)
- || !strncmp(card->c, "CONTINUE ", 9)
- || !strncmp(card->c, " ", 8) || (*card).c[8] != '=' ) {
- strncpy(value, &(*card).c[8], sizeof(FITSBuff) - 8);
- if ( type != NULL ) *type = FT_COMMENT;
- } else {
- if ( card->c[10] == '\'' ) {
- if ( type != NULL ) *type = FT_STRING;
-
- for ( i = 11, j = 0; i < FT_CARDLEN; i++, j++ ) {
- if ( card->c[i] == '\'' ) {
- if ( i+1 == FT_CARDLEN || card->c[i+1] != '\'' ) {
- break;
- } else {
- i++;
- }
- }
-
- value[j] = card->c[i];
- }
- for ( ; j && value[j-1] == ' '; j-- );
- value[j] = '\0';
- } else {
- if ( type != NULL ) *type = FT_INTEGER;
-
- for ( i = 10; i < FT_CARDLEN; i++ )
- if ( card->c[i] != ' ' )
- break;
-
- if ( ( card->c[i] == 'T' || card->c[i] == 'F'
- || card->c[i] == 't' || card->c[i] == 'f' )
- && type != NULL ) *type = FT_LOGICAL;
-
- for ( j = 0; i < FT_CARDLEN; i++, j++ ) {
- if ( card->c[i] == '/' ) break;
- if ( card->c[i] == '.' && type != NULL ) *type = FT_REAL;
-
- value[j] = (*card).c[i];
- }
- value[j] = '\0';
- }
- }
-
- if ( comm != NULL ) {
- for ( ; i < FT_CARDLEN && card->c[i] != '/' ; i++ );
- i++;
-
- for ( j = 0; i < FT_CARDLEN; i++, j++ )
- comm[j] = card->c[i];
- comm[j] = '\0';
- }
-
- return value;
-}
-
-static FITSBuff ft_value;
-
-/* Return the value of a FITS card in a static buffer.
- */
-char *ft_cardget(card)
- FITSCard card;
-{
- return ft_cardpar(card, NULL, (char *) ft_value.c, NULL, NULL);
-}
-
-/* Return the value of a FITS card as a logical.
- */
-int ft_cardgetl(card)
- FITSCard card;
-{
- char *value = ft_cardget(card);
-
- return *value == 'T' || *value == 't';
-}
-
-/* Return the value of a FITS card as an integer.
- */
-int ft_cardgeti(card)
- FITSCard card;
-{
- /* return strtol(ft_cardget(card), NULL, 0); */
- return (int)ft_cardgetr(card);
-}
-
-/* Return the value of a FITS card as an integer.
- */
-longlong ft_cardgetil(card)
- FITSCard card;
-{
- /* return strtol(ft_cardget(card), NULL, 0); */
- return (longlong)ft_cardgetr(card);
-}
-
-/* Return the value of a FITS card as a double.
- */
-double ft_cardgetr(card)
- FITSCard card;
-{
- int i;
- char *s = ft_cardget(card);
-
- /* change final 'D' to 'E' so that strtod() can convert correctly */
- for(i=strlen(s)-1; i>=0; i--){
- if( s[i] == 'D' ){
- s[i] = 'E';
- break;
- }
- }
- return strtod(s, NULL);
-}
-
-/* Return the value of a FITS card as an allocated string.
-
- The returned string is allocated with strdup().
- */
-char *ft_cardgets(card)
- FITSCard card;
-{
- return (char *)strdup(ft_cardget(card));
-}
diff --git a/funtools/fitsy/compat/install-sh b/funtools/fitsy/compat/install-sh
deleted file mode 100755
index ab74c88..0000000
--- a/funtools/fitsy/compat/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/funtools/fitsy/conf.h.in b/funtools/fitsy/conf.h.in
deleted file mode 100644
index 5f3fa16..0000000
--- a/funtools/fitsy/conf.h.in
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Define as 1 if this compiler supports long long. */
-#undef HAVE_LONG_LONG
-
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
diff --git a/funtools/fitsy/config.guess b/funtools/fitsy/config.guess
deleted file mode 100644
index 44290b8..0000000
--- a/funtools/fitsy/config.guess
+++ /dev/null
@@ -1,1435 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-23'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches to <config-patches@gnu.org>.
-
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
- echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine=${arch}${endian}-unknown
- ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
- earm*)
- expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
- ;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
- x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
-esac
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/fitsy/config.sub b/funtools/fitsy/config.sub
deleted file mode 100644
index bc855a2..0000000
--- a/funtools/fitsy/config.sub
+++ /dev/null
@@ -1,1807 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-22'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- moxiebox)
- basic_machine=moxie-unknown
- os=-moxiebox
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
- ;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/fitsy/configure-failsafe b/funtools/fitsy/configure-failsafe
deleted file mode 100755
index 9a9478b..0000000
--- a/funtools/fitsy/configure-failsafe
+++ /dev/null
@@ -1,6199 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for fitsy 1.0.0.
-#
-# Report bugs to <saord@cfa.harvard.edu>.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME='fitsy'
-PACKAGE_TARNAME='fitsy'
-PACKAGE_VERSION='1.0.0'
-PACKAGE_STRING='fitsy 1.0.0'
-PACKAGE_BUGREPORT='saord@cfa.harvard.edu'
-
-ac_unique_file="./fitsy.h"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP LIB DEFLIB DOSHARED LLIB USE_DL EXTRA_LIBS EXTRA_OBJS LIBOBJS LTLIBOBJS'
-ac_subst_files=''
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-ac_prev=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures fitsy 1.0.0 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
- cat <<_ACEOF
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of fitsy 1.0.0:";;
- esac
- cat <<\_ACEOF
-
-Optional Features:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-shared build shared libraries
- --enable-dl allow use of dynamic loading if available
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-altlib=LIB library name
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <saord@cfa.harvard.edu>.
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
- else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
- done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
- cat <<\_ACEOF
-fitsy configure 1.0.0
-generated by GNU Autoconf 2.59
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by fitsy $as_me 1.0.0, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-{
- (set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
- *)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-}
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- sed "/^$/d" confdefs.h | sort
- echo
- fi
- test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
- ' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
- esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ac_config_headers="$ac_config_headers conf.h"
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f $ac_dir/shtool; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
- { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
- ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
- { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
- ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-
-#
-# checks that we use in most projects
-#
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CC" && break
-done
-
- CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-
-echo "$as_me:$LINENO: checking for long long int" >&5
-echo $ECHO_N "checking for long long int... $ECHO_C" >&6
-if test "${ac_cv_c_long_long+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-long long int i;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_long_long=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_long_long=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5
-echo "${ECHO_T}$ac_cv_c_long_long" >&6
- if test $ac_cv_c_long_long = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
- fi
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- RANLIB=$ac_ct_RANLIB
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in malloc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in getopt.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in values.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/un.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/mman.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/ipc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
-
-for ac_header in sys/shm.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
- ;;
-esac
-
-echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
-if test "${ac_cv_type_socklen_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/socket.h>
-
-int
-main ()
-{
-if ((socklen_t *) 0)
- return 0;
-if (sizeof (socklen_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_socklen_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_socklen_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
-if test $ac_cv_type_socklen_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SOCKLEN_T 1
-_ACEOF
-
-
-fi
-
-
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- }
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_const=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_const=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-
-fi
-
-
-
-
-
-for ac_func in strchr memcpy snprintf
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
-if test "${ac_cv_func_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define connect to an innocuous variant, in case <limits.h> declares connect.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define connect innocuous_connect
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef connect
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != connect;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
-
-if test $ac_cv_func_connect = no; then
- echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-int
-main ()
-{
-connect ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_socket_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_socket_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-if test $ac_cv_lib_socket_connect = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lsocket"
-fi
-
-fi
-echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-if test "${ac_cv_func_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define gethostbyname innocuous_gethostbyname
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef gethostbyname
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != gethostbyname;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
-
-if test $ac_cv_func_gethostbyname = no; then
- echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-int
-main ()
-{
-gethostbyname ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_nsl_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lnsl"
-fi
-
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-DEFLIB="libfitsy.a"
-echo "$as_me:$LINENO: checking for alternate target library" >&5
-echo $ECHO_N "checking for alternate target library... $ECHO_C" >&6
-
-# Check whether --with-altlib or --without-altlib was given.
-if test "${with_altlib+set}" = set; then
- withval="$with_altlib"
- alt_lib=yes LIB=$withval
-else
- alt_lib=no LIB=$DEFLIB
-fi;
-echo "$as_me:$LINENO: result: $alt_lib ($LIB)" >&5
-echo "${ECHO_T}$alt_lib ($LIB)" >&6
-
-
-
-echo "$as_me:$LINENO: checking for shared library build" >&5
-echo $ECHO_N "checking for shared library build... $ECHO_C" >&6
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
-
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-
-# Check whether --enable-dl or --disable-dl was given.
-if test "${enable_dl+set}" = set; then
- enableval="$enable_dl"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-echo "$as_me:$LINENO: checking for dynamic loading (with gcc) " >&5
-echo $ECHO_N "checking for dynamic loading (with gcc) ... $ECHO_C" >&6
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- echo "$as_me:$LINENO: checking for dlopen in -lc" >&5
-echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6
-if test $ac_cv_lib_c_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-echo "$as_me:$LINENO: result: $using_dl ($CC)" >&5
-echo "${ECHO_T}$using_dl ($CC)" >&6
-fi
-
-
-echo "$as_me:$LINENO: checking $host_os configuration" >&5
-echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CYGWIN
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging Cygwin" >&5
-echo "${ECHO_T}flagging Cygwin" >&6
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MINGW32
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging MinGW" >&5
-echo "${ECHO_T}flagging MinGW" >&6
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fno-common, -fPIC to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common, -fPIC to CFLAGS" >&6
- else
- echo "$as_me:$LINENO: result: adding -fno-common to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common to CFLAGS" >&6
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fPIC to gcc" >&5
-echo "${ECHO_T}adding -fPIC to gcc" >&6
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- ;;
-esac
-
-
-
-
- ac_config_files="$ac_config_files Makefile"
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by fitsy $as_me 1.0.0, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-fitsy config.status 1.0.0
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-
-
-
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@LIB@,$LIB,;t t
-s,@DEFLIB@,$DEFLIB,;t t
-s,@DOSHARED@,$DOSHARED,;t t
-s,@LLIB@,$LLIB,;t t
-s,@USE_DL@,$USE_DL,;t t
-s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t
-s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- # Do quote $f, to prevent DOS paths from being IFS'd.
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
- rm -f conftest.defines
- mv conftest.tail conftest.defines
-done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
-
-cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
- if test x"$ac_file" != x-; then
- if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
- { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
- else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- rm -f $ac_file
- mv $tmp/config.h $ac_file
- fi
- else
- cat $tmp/config.h
- rm -f $tmp/config.h
- fi
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-
diff --git a/funtools/fitsy/configure.ac b/funtools/fitsy/configure.ac
deleted file mode 100644
index 2095085..0000000
--- a/funtools/fitsy/configure.ac
+++ /dev/null
@@ -1,168 +0,0 @@
-# This file is an input file used by the GNU "autoconf" program to
-# generate the file "configure", which is run during XPA installation
-# to configure the system for the local environment.
-AC_INIT(fitsy, 1.0.0, saord@cfa.harvard.edu, fitsy)
-
-AC_CONFIG_HEADERS([conf.h])
-AC_CONFIG_SRCDIR(./fitsy.h)
-AC_CANONICAL_HOST
-
-#
-# checks that we use in most projects
-#
-AC_PROG_CC
-
-AC_EXEEXT
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-AC_C_LONG_LONG
-
-AC_PROG_RANLIB
-
-AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(getopt.h)
-AC_CHECK_HEADERS(values.h)
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_HEADERS(sys/un.h)
-AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_HEADERS(sys/ipc.h)
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
- AC_CHECK_HEADERS(sys/shm.h)
- ;;
-esac
-
-AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])
-
-AC_C_CONST
-
-AC_CHECK_FUNCS(strchr memcpy snprintf)
-
-AC_CHECK_FUNC(connect)
-if test $ac_cv_func_connect = no; then
- AC_CHECK_LIB(socket, connect, EXTRA_LIBS="$EXTRA_LIBS -lsocket")
-fi
-AC_CHECK_FUNC(gethostbyname)
-if test $ac_cv_func_gethostbyname = no; then
- AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-DEFLIB="libfitsy.a"
-AC_MSG_CHECKING(for alternate target library)
-AC_ARG_WITH(altlib, [ --with-altlib=LIB library name],
- alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB)
-AC_MSG_RESULT($alt_lib ($LIB))
-AC_SUBST(LIB)
-AC_SUBST(DEFLIB)
-
-AC_MSG_CHECKING(for shared library build)
-AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
- AC_SUBST(DOSHARED)
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-AC_SUBST(LLIB)
-AC_MSG_RESULT($fun_ok)
-
-AC_ARG_ENABLE(dl, [ --enable-dl allow use of dynamic loading if available],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-AC_MSG_CHECKING([for dynamic loading (with gcc) ])
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-AC_MSG_RESULT([$using_dl ($CC)])
-fi
-AC_SUBST(USE_DL)
-
-AC_MSG_CHECKING([$host_os configuration])
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
- AC_DEFINE([HAVE_CYGWIN])
- AC_MSG_RESULT(flagging Cygwin)
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
- AC_DEFINE([HAVE_MINGW32])
- AC_MSG_RESULT(flagging MinGW)
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT([adding -fno-common, -fPIC to CFLAGS])
- else
- AC_MSG_RESULT([adding -fno-common to CFLAGS])
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT(adding -fPIC to gcc)
- else
- AC_MSG_RESULT(none)
- fi
- else
- AC_MSG_RESULT(none)
- fi
- ;;
-esac
-
-AC_SUBST(EXTRA_LIBS)
-AC_SUBST(EXTRA_OBJS)
-
-AC_CONFIG_FILES(Makefile)
-
-AC_OUTPUT
diff --git a/funtools/fitsy/data b/funtools/fitsy/data
deleted file mode 100644
index e2b25d6..0000000
--- a/funtools/fitsy/data
+++ /dev/null
@@ -1,95 +0,0 @@
-cardfind.c: if ( fits->index ) card = ft_cardfindidx(fits, key, &match);
-cardfind.c: base = fits->index;
-cardfind.c: if ( !fits->index ) ft_headindex(fits);
-cardfind.c: for ( card = fits->cards; card != &fits->cards[fits->ncard]; card++ ) {
-cardins.c: if ( fits->cards == NULL ) return NULL;
-cardins.c: if ( fits->index ) Free(fits->index);
-cardins.c: if ( fits->ncard+1 > fits->acard ) {
-cardins.c: if ( here != NULL ) hereoffset = here - fits->cards;
-cardins.c: if ( fits->mem != FT_MALLOC ) return NULL;
-cardins.c: fits->acard += FT_CARDS;
-cardins.c: fits->data = fits->acard * FT_CARDLEN;
-cardins.c: ReAlloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1);
-cardins.c: ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0';
-cardins.c: if ( here != NULL ) here = fits->cards + hereoffset;
-cardins.c: ft_cardclr(&fits->cards[fits->acard-FT_CARDS], FT_CARDS);
-cardins.c: if ( here == NULL ) here = &fits->cards[fits->ncard-2];
-cardins.c: , (&fits->cards[fits->ncard-1]-here) * sizeof(FITSBuff));
-cardins.c: fits->ncard++;
-cardins.c: Free(fits->index);
-cardins.c: fits->ncard--;
-headdata.c: return Seek(sfile, fits->data, 0) != -1;
-headfile.c: fits->seek = Tell(file);
-headfile.c: memmove(fits->cards, card1, n);
-headfile.c: if ( Read(file, (void *)&fits->cards[0].c[n],
-headfile.c: Free(fits->cards);
-headfile.c: if ( (end = ft_cardfindblok(&fits->cards[(nbloks-1) * FT_CARDS]
-headfile.c: fits->ncard += FT_CARDS;
-headfile.c: ReAlloc(fits->cards, (nbloks+1) * FT_BLOCK + 1);
-headfile.c: ((char *)fits->cards)[(nbloks+1) * FT_BLOCK] = '\0';
-headfile.c: ft_cardclr(&fits->cards[nbloks * FT_CARDS], FT_CARDS);
-headfile.c: if ( Read(file, (void *)&fits->cards[nbloks * FT_CARDS],
-headfile.c: Free(fits->cards);
-headfile.c: fits->data = Tell(file);
-headfile.c: fits->ncard = end - fits->cards + 1;
-headfile.c: fits->acard = nbloks * FT_CARDS;
-headfile.c: if ( fits->sync ) ft_synchead(fits);
-headfile.c: Write(file, (void *)fits->cards,
-headfile.c: FT_BLOCK, ((fits->ncard+FT_CARDS-1)/FT_CARDS));
-headfile.c: return Seek(file, fits->seek, 0) != -1;
-headfile.c: sync = fits->sync;
-headfile.c: fits->sync = x;
-headfind.c: if ( fits->index ) Free(fits->index);
-headfind.c: Malloc(fits->index, sizeof(FITSCard *) * fits->ncard);
-headfind.c: for ( i = 0; i < fits->ncard; i++ ) {
-headfind.c: fits->index[i] = (FITSCard) &fits->cards[i];
-headfind.c: qsort(fits->index, fits->ncard, sizeof(FITSCard *), ft_compare);
-headimage.c: if ( fits->basic ) ft_basicfree(fits->basic);
-headimage.c: if ( fits->image ) ft_imagefree(fits->image);
-headimage.c: if ( fits->table ) ft_tablefree(fits->table);
-headimage.c: fits->basic = ft_basicloadhead(fits);
-headimage.c: fits->image = ft_imageloadhead(fits);
-headimage.c: fits->table = ft_tableloadhead(fits);
-headimage.c: if ( fits->basic ) ft_basicstorhead(fits, fits->basic);
-headimage.c: if ( fits->image ) ft_imagestorhead(fits, fits->image);
-headimage.c: if ( fits->table ) ft_tablestorhead(fits, fits->table);
-headimage.c: if ( fits->basic == NULL ) return NULL;
-headimage.c: if ( fits->basic->bitpix > 0 )
-headinit.c: fits->mem = FT_MALLOC;
-headinit.c: fits->primary = NULL;
-headinit.c: fits->rfcount = 1;
-headinit.c: fits->cards = fits->last = cards;
-headinit.c: fits->acard = fits->ncard = Abs(bytes/FT_CARDLEN);
-headinit.c: if ( bytes > 0 ) fits->mem = FT_EXTERN;
-headinit.c: fits->ncard = end - fits->cards + 1;
-headinit.c: fits->acard = ((fits->ncard+FT_CARDS-1)/FT_CARDS) * FT_CARDS;
-headinit.c: fits->data = fits->acard * FT_CARDLEN;
-headinit.c: fits->acard = bytes/FT_CARDLEN ? bytes/FT_CARDLEN : FT_CARDS;
-headinit.c: (void)Calloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1);
-headinit.c: ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0';
-headinit.c: ft_cardclr(fits->cards, fits->acard);
-headinit.c: fits->ncard = 0;
-headinit.c: fits->data = fits->acard * FT_CARDLEN;
-headinit.c: fits->index = NULL;
-headinit.c: fits->last = fits->cards;
-headinit.c: fits->ncard = 1;
-headinit.c: ft_cardkey(fits->cards, "END", 0);
-headinit.c: fits->sync = 0;
-headinit.c: fits->cache = NULL;
-headinit.c: if ( fits->primary )
-headinit.c: ft_primlink(fits->primary, head);
-headinit.c: memmove(head->cards, fits->cards, head->acard * FT_CARDLEN);
-headinit.c: if( head->index && !fits->index ){
-headinit.c: if ( --fits->rfcount ) return;
-headinit.c: if ( fits->index ) Free(fits->index);
-headinit.c: if ( fits->basic ) ft_basicfree(fits->basic);
-headinit.c: if ( fits->image ) ft_imagefree(fits->image);
-headinit.c: if ( fits->table ) ft_tablefree(fits->table);
-headinit.c: if ( fits->mem == FT_MALLOC && freecards ) Free(fits->cards);
-headinit.c: if ( fits->mem == FT_MMAP ) ft_munmap(fits);
-headinit.c: if ( fits->mem == FT_SHMAT ) ft_shmdt(fits);
-headinit.c: if ( fits->primary ) ft_headfree(fits->primary, 1);
-headinit.c: fits->primary = prim;
-headinit.c: fits->cards = (FITSCard) cards;
-headtable.c: table->col[i-1].width = fits->basic->naxis[0] - table->col[i-1].offset;
-headtable.c: ft_basicstorhead(fits, fits->basic);
diff --git a/funtools/fitsy/dataimage.c b/funtools/fitsy/dataimage.c
deleted file mode 100644
index e627f84..0000000
--- a/funtools/fitsy/dataimage.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* Routines to handle FITS image data.
- */
-
-#include <xos.h>
-#include "fitsy.h"
-
-/* Read data from a file pointer and convert it to the requested type.
- */
-void *ft_dataread(file, fits, dataptr, pixtype)
- File file; /* File pointer to read data from. */
- FITSHead fits;
- void *dataptr; /* Pointer to data buffer to store data. */
- int pixtype; /* Pixtype to convert data to. */
-{
- void *fdata;
- void *mdata;
- size_t fsize;
- size_t msize;
-
- if ( file == NULL ) return NULL;
- if ( fits == NULL ) return NULL;
-
- if ( pixtype == FT_BITPIX )
- pixtype = ft_bitpix(fits);
-
- fsize = Abs(ft_bitpix(fits)/8);
- msize = pixtype ? (size_t)((Abs(pixtype) & ~FT_UNSIGNED)/8) : fsize;
-
- if ( dataptr == NULL ) {
- Malloc(mdata, ft_fitsbloks(ft_datapixls(fits) * msize) * FT_BLOCK);
- if ( mdata == NULL ) {
- return NULL;
- }
- } else
- mdata = dataptr;
-
-
- if ( pixtype && msize != fsize ) {
- Malloc(fdata, ft_databloks(fits) * FT_BLOCK);
- if ( fdata == NULL ) {
- if ( mdata && dataptr == NULL ) (void)Free(mdata);
- return NULL;
- }
- } else
- fdata = mdata;
-
- /* Read in enough data but don't show an error in a short data
- * block.
- */
- if(ftRead(file, fdata, 1, ft_databloks(fits)*FT_BLOCK) < ft_databytes(fits)){
- if ( dataptr == NULL ) {
- if ( fdata != mdata ) (void)Free(fdata);
- (void)Free(mdata);
- }
- return NULL;
- }
-
- if ( pixtype ) {
- ft_dataswap(fdata, fdata, ft_databytes(fits), ft_bitpix(fits));
-
- if ( pixtype != ft_bitpix(fits)
- || ft_hasbscale(fits)
- || ft_hasbzero(fits) ) {
- ft_acht(pixtype, mdata, ft_bitpix(fits), fdata
- , ft_datapixls(fits)
- , 1
- , ft_hasbscale(fits) || ft_hasbzero(fits)
- , ft_bscale(fits)
- , ft_bzero(fits));
- }
- }
-
- if ( mdata != fdata ) (void)Free(fdata);
- return mdata;
-}
-
-
-int ft_datawrite(file, fits, data, pixtype)
- File file;
- FITSHead fits;
- void *data;
- int pixtype;
-{
- void *fdata;
- void *mdata = data;
- int fsize;
- int msize;
- int pad;
- char blok[FT_BLOCK];
-
- if ( file == NULL ) return 0;
- if ( fits == NULL ) return 0;
-
- if ( pixtype == FT_BITPIX )
- pixtype = ft_bitpix(fits);
-
- fsize = Abs(ft_bitpix(fits)/8);
- msize = pixtype ? (Abs(pixtype) & ~FT_UNSIGNED)/8 : fsize;
-
- if ( pixtype && msize != fsize ) {
- Malloc(fdata, ft_databloks(fits) * FT_BLOCK);
- if ( fdata == NULL ) {
- return 0;
- }
- } else
- fdata = mdata;
-
- if ( pixtype ) {
- if ( pixtype != ft_bitpix(fits)
- || ft_hasbscale(fits)
- || ft_hasbzero(fits) ) {
- ft_acht(ft_bitpix(fits), fdata, pixtype, mdata
- , ft_datapixls(fits)
- , 0
- , ft_hasbscale(fits) || ft_hasbzero(fits)
- , ft_bscale(fits)
- , ft_bzero(fits));
- }
-
- ft_dataswap(fdata, fdata, ft_databytes(fits), ft_bitpix(fits));
- }
-
- memset(blok, 0, FT_BLOCK);
-
- ftWrite(file, fdata, 1, ft_databytes(fits));
-
- /* this is how John would do it ...
- ftWrite(file, blok , 1,
- (FT_BLOCK - ft_databytes(fits) % FT_BLOCK) % FT_BLOCK);
- */
-
- /* ... and this is Eric's way ... */
- pad = FT_BLOCK - ft_databytes(fits) % FT_BLOCK;
- if( pad && (pad != FT_BLOCK) )
- ftWrite(file, blok , 1, pad);
-
- if ( mdata != fdata ) (void)Free(fdata);
- return 1;
-}
-
-
-void swap2(to, from, nbytes)
- char *to;
- char *from;
- size_t nbytes;
-{
- char c;
- size_t i;
- for ( i=0; i < nbytes; i += 2, (to += 2), (from += 2) ) {
- c = *from;
- *(to) = *(from+1);
- *(to+1) = c;
- }
-}
-
-void swap4(to, from, nbytes)
- char *to;
- char *from;
- size_t nbytes;
-{
- char c;
- size_t i;
- for ( i=0; i < nbytes; i += 4, (to += 4), (from += 4) ) {
- c = *from;
- *to = *(from+3);
- *(to+3) = c;
- c = *(from+1);
- *(to+1) = *(from+2);
- *(to+2) = c;
- }
-}
-
-void swap8(to, from, nbytes)
- char *to;
- char *from;
- size_t nbytes;
-{
- char c;
- size_t i;
- for ( i=0; i < nbytes; i += 8, (to += 8), (from += 8) ) {
- c = *(from+0);
- *(to+0) = *(from+7);
- *(to+7) = c;
- c = *(from+1);
- *(to+1) = *(from+6);
- *(to+6) = c;
- c = *(from+2);
- *(to+2) = *(from+5);
- *(to+5) = c;
- c = *(from+3);
- *(to+3) = *(from+4);
- *(to+4) = c;
- }
-}
-
-/* Swap n bytes of data if necessary.
- */
-void *ft_dataswap(to, from, n, type)
- void *to; /* Pointer to data to swap. */
- void *from; /* Pointer to data to swap. */
- size_t n; /* N bytes */
- int type; /* Swap 2, swap 4, swap 8. */
-{
- if ( !from || !to ) return NULL;
- if ( !ft_byteswap() ) {
- if ( from == to ) return to;
-
- memcpy(to, from, n);
- return to;
- }
-
- if ( type && Abs(type) != 8 ) {
- switch ( Abs(type) ) {
- case 16: swap2(to, from, n); break;
- case 32: swap4(to, from, n); break;
- case 64: swap8(to, from, n); break;
- }
- }
-
- return to;
-}
diff --git a/funtools/fitsy/datatable.c b/funtools/fitsy/datatable.c
deleted file mode 100644
index 9d596ff..0000000
--- a/funtools/fitsy/datatable.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* datatable.c
- */
-
-ft_tablerecread()
-{
-
-}
-
-ft_tablerecwrite()
-{
-
-}
-
-
-
diff --git a/funtools/fitsy/doc/basicval.html b/funtools/fitsy/doc/basicval.html
deleted file mode 100644
index d849b10..0000000
--- a/funtools/fitsy/doc/basicval.html
+++ /dev/null
@@ -1,77 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<p>
-<!-- pnuts --> <a href="headfile.html">[Previous]</a> <a href="imageval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-<A NAME="section-1.1.1"><H3>Basic FITS Values</H3></A>
-
-
-<P>
- When a FITS header is scanned in memory or read from a file several
- basic values are retrieved from the header and stored in the <B>FITSHead</B>
- or <B>FITSBasic</B> structures. This structure may be accesed with the following
- macros:
-
-<PRE>
- #define <B>ft_ncards</B>(fits) ( fits-&gt;ncard )
- #define <B>ft_cardnth</B>(fits, nth) ( ( nth &lt;= fits-&gt;ncard ) \
- ? &amp;fits-&gt;cards[nth-1] \
- : NULL )
-
- #define <B>ft_last</B>(fits) ft_cardnth(fits, fits-&gt;ncard)
-
- #define <B>ft_swapped</B>() (*(short *)"001000" &amp; 0x0001)
- #define <B>ft_seek</B>(fits) ( fits-&gt;seek )
-
- typedef struct <B>FITSHead</B> {
- FITSCard cards;
- FITSCard *index;
- FITSCard last;
- int acard;
- int ncard;
-
- int mem;
- int seek;
- int data;
-
- FITSBasic basic;
- FITSImage image;
- FITSTable table;
- } <B>*FITSHead</B>;
-
-
- #define <B>ft_simple</B>(fits) ( fits-&gt;basic-&gt;simple )
- #define <B>ft_name</B>(fits) ( fits-&gt;basic-&gt;name )
- #define <B>ft_bitpix</B>(fits) ( fits-&gt;basic-&gt;bitpix )
- #define <B>ft_naxes</B>(fits) ( fits-&gt;basic-&gt;naxes )
- #define <B>ft_naxis</B>(fits, i) ( fits-&gt;basic-&gt;naxis[i-1])
- #define <B>ft_pcount</B>(fits) ( fits-&gt;basic-&gt;pcount )
- #define <B>ft_gcount</B>(fits) ( fits-&gt;basic-&gt;gcount )
- #define <B>ft_databytes</B>(fits) ( fits-&gt;basic-&gt;databytes)
- #define <B>ft_databloks</B>(fits) ( fits-&gt;basic-&gt;databloks)
-
- typedef struct <B>FITSBasic</B> {
- int simple;
- char *name;
-
- int bitpix;
- int naxes;
- int *naxis;
-
- int gcount;
- int pcount;
-
- int databytes;
- int databloks;
- } <B>*FITSBasic</B>;
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="headfile.html">[Previous]</a> <a href="imageval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/basicval.wu b/funtools/fitsy/doc/basicval.wu
deleted file mode 100644
index aba50b9..0000000
--- a/funtools/fitsy/doc/basicval.wu
+++ /dev/null
@@ -1,62 +0,0 @@
-
-Basic FITS Values
-=================
-
- When a FITS header is scanned in memory or read from a file several
- basic values are retrieved from the header and stored in the #FITSHead
- or #FITSBasic structures. This structure may be accesed with the following
- macros:
-
-+
- ##define #ft_ncards(fits) ( fits->ncard )
- ##define #ft_cardnth(fits, nth) ( ( nth <= fits->ncard ) \
- ? &fits->cards[nth-1] \
- : NULL )
-
- ##define #ft_last(fits) ft_cardnth(fits, fits->ncard)
-
- ##define #ft_swapped() (*(short *)"\001\000" & 0x0001)
- ##define #ft_seek(fits) ( fits->seek )
-
- typedef struct #FITSHead {
- FITSCard cards;
- FITSCard *index;
- FITSCard last;
- int acard;
- int ncard;
-
- int mem;
- int seek;
- int data;
-
- FITSBasic basic;
- FITSImage image;
- FITSTable table;
- } #"*FITSHead";
-
-
- ##define #ft_simple(fits) ( fits->basic->simple )
- ##define #ft_name(fits) ( fits->basic->name )
- ##define #ft_bitpix(fits) ( fits->basic->bitpix )
- ##define #ft_naxes(fits) ( fits->basic->naxes )
- ##define #ft_naxis(fits, i) ( fits->basic->naxis[i-1])
- ##define #ft_pcount(fits) ( fits->basic->pcount )
- ##define #ft_gcount(fits) ( fits->basic->gcount )
- ##define #ft_databytes(fits) ( fits->basic->databytes)
- ##define #ft_databloks(fits) ( fits->basic->databloks)
-
- typedef struct #FITSBasic {
- int simple;
- char *name;
-
- int bitpix;
- int naxes;
- int *naxis;
-
- int gcount;
- int pcount;
-
- int databytes;
- int databloks;
- } #"*FITSBasic";
-+
diff --git a/funtools/fitsy/doc/cardfind.html b/funtools/fitsy/doc/cardfind.html
deleted file mode 100644
index 4562c29..0000000
--- a/funtools/fitsy/doc/cardfind.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> cardfind
-</TITLE>
-<p>
-<!-- pnuts --> <a href="cardfmt.html">[Previous]</a> <a href="cardins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_cardfind,ft_cardfindidx,ft_cardfindseq -Fitsy FITS card find routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSCard ft_cardfind(FITSHead fits, FITSCard key, int add);
-FITSCard ft_cardfindidx(FITSHead fits, FITSCard key, int *match);
-FITSCard ft_cardfindseq(FITSHead fits, FITSCard key, int *match);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - The FITS header to look in.
- <LI> <B>FITSCard key</B> - The card keyword to lookup.
- <LI> <B>int add</B> - If add is true the card will
- be added to the header if it is
- not found.
- <LI> <B>int *match</B> - Returns true if the card found is
- an exact match for the keyword requested.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-<P>
- Routines to find FITS cards in a FITS headers data structure.
-
-<A NAME="section-1.1.4.1"><H4>ft_cardfind</H4></A>
-
-<P>
- Find a FITS card in the header.
-
-<P>
- <B>cardfind</B> will use the index if is has been created otherwise
- it searches sequentially through the header to find the card.
-
-<A NAME="section-1.1.4.2"><H4>ft_cardfindidx</H4></A>
-
-<P>
- Find a FITS card in the header using an index.
-
-<P>
- If the header is not indexed an index is created for it.
-
-<A NAME="section-1.1.4.3"><H4>ft_cardfindseq</H4></A>
-
-<P>
- Find a card in the FITS header using sequential search.
-
-<P>
- If the requested card is a FITS indexed keyword and an exact match
- is not found, the last card of that type is returned and
- match is set to 0.
-
-<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A>
-
-
-<PRE>
-
- /* Declair some fitsy types.
- */
- <B>FITSHead</B> fits;
- <B>FITSCard</B> foo;
- <B>FITSCard</B> goo;
- <B>FITSBuff</B> key;
-
- /* Look up a card using sequential search.
- */
- <B>ft_cardkey</B>(key, "FOO");
- foo = <B>ft_cardfind</B>(fits, key, 0);
-
- /* This is the same thing. But the card is added to the header
- if it isn't found. This will also invalidate the index if
- there is one.
- */
- <B>ft_cardkey</B>(key, "FOO");
- foo = <B>ft_cardfind</B>(fits, key, 1);
-
- /* Now index the header so that searches are faster. <B>ft_cardfind</B>
- will automatically use the index if its valid.
- */
- <B>ft_index</B>(fits);
- <B>ft_cardkey</B>(key, "GOO", 0);
- goo = <B>ft_cardfind</B>(fits, key, 0);
-
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="cardfmt.html">[Previous]</a> <a href="cardins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/cardfind.wu b/funtools/fitsy/doc/cardfind.wu
deleted file mode 100644
index b854c3d..0000000
--- a/funtools/fitsy/doc/cardfind.wu
+++ /dev/null
@@ -1,85 +0,0 @@
-Title: cardfind
-
-
-NAME
-====
- ft_cardfind,ft_cardfindidx,ft_cardfindseq -Fitsy FITS card find routines.
-
-SYNOPSIS
-========
-
-
--
-FITSCard ft_cardfind(FITSHead fits, FITSCard key, int add);
-FITSCard ft_cardfindidx(FITSHead fits, FITSCard key, int *match);
-FITSCard ft_cardfindseq(FITSHead fits, FITSCard key, int *match);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - The FITS header to look in.
- * #"FITSCard key" - The card keyword to lookup.
- * #"int add" - If add is true the card will
- be added to the header if it is
- not found.
- * #"int *match" - Returns true if the card found is
- an exact match for the keyword requested.
-
-DESCRIPTION
-===========
- Routines to find FITS cards in a FITS headers data structure.
-
- ft_cardfind
- -----------
- Find a FITS card in the header.
-
- #cardfind will use the index if is has been created otherwise
- it searches sequentially through the header to find the card.
-
- ft_cardfindidx
- --------------
- Find a FITS card in the header using an index.
-
- If the header is not indexed an index is created for it.
-
- ft_cardfindseq
- --------------
- Find a card in the FITS header using sequential search.
-
- If the requested card is a FITS indexed keyword and an exact match
- is not found, the last card of that type is returned and
- match is set to 0.
-
-EXAMPLES
-========
-
-+
-
- /* Declair some fitsy types.
- *-/
- #FITSHead fits;
- #FITSCard foo;
- #FITSCard goo;
- #FITSBuff key;
-
- /* Look up a card using sequential search.
- *-/
- #ft_cardkey(key, "FOO");
- foo = #ft_cardfind(fits, key, 0);
-
- /* This is the same thing. But the card is added to the header
- if it isn't found. This will also invalidate the index if
- there is one.
- *-/
- #ft_cardkey(key, "FOO");
- foo = #ft_cardfind(fits, key, 1);
-
- /* Now index the header so that searches are faster. #ft_cardfind
- will automatically use the index if its valid.
- *-/
- #ft_index(fits);
- #ft_cardkey(key, "GOO", 0);
- goo = #ft_cardfind(fits, key, 0);
-
-+
diff --git a/funtools/fitsy/doc/cardfmt.html b/funtools/fitsy/doc/cardfmt.html
deleted file mode 100644
index 0ab1cd6..0000000
--- a/funtools/fitsy/doc/cardfmt.html
+++ /dev/null
@@ -1,181 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> cardfmt
-</TITLE>
-<p>
-<!-- pnuts --> <a href="cardpar.html">[Previous]</a> <a href="cardfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_cardfmt,ft_cardkey,ft_cardset,ft_cardsetl,ft_cardseti,ft_cardsetr,ft_cardsets,ft_cardclr,ft_cardcpy
-- Fitsy FITS card set routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSCard ft_cardfmt(FITSCard card, char *name, int n, FITSType type, void *value, int prec, char *comm);
-FITSCard ft_cardkey(FITSCard card, char *name, int n);
-FITSCard ft_cardset(FITSCard card, FITSType type, void *value, int prec, char *comm);
-FITSCard ft_cardsetl(FITSCard card, int lvalue, char *comm);
-FITSCard ft_cardseti(FITSCard card, int ivalue, char *comm);
-FITSCard ft_cardsetr(FITSCard card, double rvalue, int prec, char *comm);
-FITSCard ft_cardsets(FITSCard card, char *svalue, char *comm);
-FITSCard ft_cardclr(FITSCard card, int ncards);
-FITSCard ft_cardcpy(FITSCard card1, FITSCard card2);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSCard card</B> - FITS card to format.
- <LI> <B>char *name</B> - keyword name.
- <LI> <B>int n</B> - keyword index number, if is zero no
- index number is appended to the
- keyword.
- <LI> <B>FITSType type</B> - type of the card.
-
-<P>
- Possible values for a <B>FITSType</B> are as follows:
- <UL>
-<P>
- <LI> <B>FT_COMMENT</B>
- <LI> <B>FT_LOGICAL</B>
- <LI> <B>FT_INTEGER</B>
- <LI> <B>FT_STRING</B>
- <LI> <B>FT_VALUE</B>
- <LI> <B>FT_REAL</B>
- <LI> <B>FT_COMPLEX</B>
-
- </UL>
-<P>
- <LI> <B>void *value</B> - pointer to the value to format. The
- pointer must be of the apropriate type.
- <LI> <B>int prec</B> - If type is FT_REAL the value is formatted
- at this precision. Otherwise this parameter
- is ignored.
- <LI> <B>char *comm</B> - Comment for the card.
- <LI> <B>int lvalue</B> - Logical to format as a FITS value.
- <LI> <B>int ivalue</B> - Integer to format as a FITS value.
- <LI> <B>double rvalue</B> - Double to format as a FITS value.
- <LI> <B>char *svalue</B> - String to format as a FITS value.
- <LI> <B>int ncards</B> - Number of 80 character FITS cards to clear
- <LI> <B>FITSCard card1</B> - Destination card
- <LI> <B>FITSCard card2</B> - Source card
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_cardfmt</H4></A>
-
-<P>
- Format a FITS card with the supplied values.
-
-<A NAME="section-1.1.4.2"><H4>ft_cardkey</H4></A>
-
-<P>
- Format a keyword into a FITS card.
-
-<A NAME="section-1.1.4.3"><H4>ft_cardset</H4></A>
-
-<P>
- Format a value into a FITS card.
-
-<A NAME="section-1.1.4.4"><H4>ft_cardsetl</H4></A>
-
-<P>
- Format a logical value into a FITS card.
-
-<A NAME="section-1.1.4.5"><H4>ft_cardseti</H4></A>
-
-<P>
- Format an integer value into a FITS card.
-
-<A NAME="section-1.1.4.6"><H4>ft_cardsetr</H4></A>
-
-<P>
- Format a real value into a FITS card.
-
-<A NAME="section-1.1.4.7"><H4>ft_cardsets</H4></A>
-
-<P>
- Format a string value into a FITS card.
-
-<A NAME="section-1.1.4.8"><H4>ft_cardclr</H4></A>
-
-<P>
- Clear FITS cards by writing space into them.
-
-<A NAME="section-1.1.4.9"><H4>ft_cardcpy</H4></A>
-
-<P>
- Copy a FITS card.
-
-<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A>
-
-<P>
- Format the keyword part of a card:
-
-<PRE>
-
- FITSHead fits;
- FITSBuff card;
- FITSCard here;
-
- <B>ft_cardclr</B>(&amp;card, 1); /* Clear out the card first */
-
- <B>ft_cardkey</B>(&amp;card, "RA"); /* Set the keyword */
- <B>ft_cardsetr</B>(&amp;card, 14.789, 3, "OBS RA"); /* Set the value of RA. */
-
- here = <B>ft_cardapp</B>(fits, &amp;card); /* Put the new card into a header*/
-
- <B>ft_cardsetr</B>(here, 15.567, 3, FT_Comment); /* Set a new value after it's in
- the header and reuse the existing
- comment */
-
-<P>
-</PRE>
-
-<P>
- Format the value part of a card:
-
-<PRE>
- int l = 1;
- int i = 15;
- double d = 34.7;
- char *c = "Shutter";
-
- FITSHead fits;
- FITSCard card;
-
- /* Get a card pointer from the header
- */
- card = <B>ft_cardfind</B>(fits, "Keyword", 0);
-
- <B>ft_cardsetl</B>(card, l, "A true value");
- <B>ft_cardseti</B>(card, i, "15 is the number");
- <B>ft_cardsetr</B>(card, d, 4, "Four digits of precision here");
-
- /* In this example the special pointer <B>FT_Comment</B> is used to
- use the existing comment in the card.
- */
- <B>ft_cardsets</B>(card, c, FT_Comment);
-
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="cardpar.html">[Previous]</a> <a href="cardfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/cardfmt.wu b/funtools/fitsy/doc/cardfmt.wu
deleted file mode 100644
index ce072e8..0000000
--- a/funtools/fitsy/doc/cardfmt.wu
+++ /dev/null
@@ -1,144 +0,0 @@
-Title: cardfmt
-
-
-NAME
-====
- ft_cardfmt,ft_cardkey,ft_cardset,ft_cardsetl,ft_cardseti,ft_cardsetr,ft_cardsets,ft_cardclr,ft_cardcpy
-- Fitsy FITS card set routines.
-
-SYNOPSIS
-========
-
-
--
-FITSCard ft_cardfmt(FITSCard card, char *name, int n, FITSType type, void *value, int prec, char *comm);
-FITSCard ft_cardkey(FITSCard card, char *name, int n);
-FITSCard ft_cardset(FITSCard card, FITSType type, void *value, int prec, char *comm);
-FITSCard ft_cardsetl(FITSCard card, int lvalue, char *comm);
-FITSCard ft_cardseti(FITSCard card, int ivalue, char *comm);
-FITSCard ft_cardsetr(FITSCard card, double rvalue, int prec, char *comm);
-FITSCard ft_cardsets(FITSCard card, char *svalue, char *comm);
-FITSCard ft_cardclr(FITSCard card, int ncards);
-FITSCard ft_cardcpy(FITSCard card1, FITSCard card2);
-
-
--
-PARAMETERS
-==========
- * #"FITSCard card" - FITS card to format.
- * #"char *name" - keyword name.
- * #"int n" - keyword index number, if is zero no
- index number is appended to the
- keyword.
- * #"FITSType type" - type of the card.
-
- Possible values for a #FITSType are as follows:
- * #"FT_COMMENT"
- * #"FT_LOGICAL"
- * #"FT_INTEGER"
- * #"FT_STRING"
- * #"FT_VALUE"
- * #"FT_REAL"
- * #"FT_COMPLEX"
-
- * #"void *value" - pointer to the value to format. The
- pointer must be of the apropriate type.
- * #"int prec" - If type is FT_REAL the value is formatted
- at this precision. Otherwise this parameter
- is ignored.
- * #"char *comm" - Comment for the card.
- * #"int lvalue" - Logical to format as a FITS value.
- * #"int ivalue" - Integer to format as a FITS value.
- * #"double rvalue" - Double to format as a FITS value.
- * #"char *svalue" - String to format as a FITS value.
- * #"int ncards" - Number of 80 character FITS cards to clear
- * #"FITSCard card1" - Destination card
- * #"FITSCard card2" - Source card
-
-DESCRIPTION
-===========
-
- ft_cardfmt
- ----------
- Format a FITS card with the supplied values.
-
- ft_cardkey
- ----------
- Format a keyword into a FITS card.
-
- ft_cardset
- ----------
- Format a value into a FITS card.
-
- ft_cardsetl
- -----------
- Format a logical value into a FITS card.
-
- ft_cardseti
- -----------
- Format an integer value into a FITS card.
-
- ft_cardsetr
- -----------
- Format a real value into a FITS card.
-
- ft_cardsets
- -----------
- Format a string value into a FITS card.
-
- ft_cardclr
- ----------
- Clear FITS cards by writing space into them.
-
- ft_cardcpy
- ----------
- Copy a FITS card.
-
-EXAMPLES
-========
- Format the keyword part of a card:
-
-+
-
- FITSHead fits;
- FITSBuff card;
- FITSCard here;
-
- #ft_cardclr(&card, 1); /* Clear out the card first *-/
-
- #ft_cardkey(&card, "RA"); /* Set the keyword *-/
- #ft_cardsetr(&card, 14.789, 3, "OBS RA"); /* Set the value of RA. *-/
-
- here = #ft_cardapp(fits, &card); /* Put the new card into a header*-/
-
- #ft_cardsetr(here, 15.567, 3, FT_Comment); /* Set a new value after it's in
- the header and reuse the existing
- comment *-/
-
-+
-
- Format the value part of a card:
-
-+
- int l = 1;
- int i = 15;
- double d = 34.7;
- char *c = "Shutter";
-
- FITSHead fits;
- FITSCard card;
-
- /* Get a card pointer from the header
- *-/
- card = #ft_cardfind(fits, "Keyword", 0);
-
- #ft_cardsetl(card, l, "A true value");
- #ft_cardseti(card, i, "15 is the number");
- #ft_cardsetr(card, d, 4, "Four digits of precision here");
-
- /* In this example the special pointer #FT_Comment is used to
- use the existing comment in the card.
- *-/
- #ft_cardsets(card, c, FT_Comment);
-
-+
diff --git a/funtools/fitsy/doc/cardins.html b/funtools/fitsy/doc/cardins.html
deleted file mode 100644
index 26c9acc..0000000
--- a/funtools/fitsy/doc/cardins.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> cardins
-</TITLE>
-<p>
-<!-- pnuts --> <a href="cardfind.html">[Previous]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_cardins,ft_cardapp,ft_carddel -Fitsy FITS card insert and delete routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSCard ft_cardins(FITSHead fits, FITSCard card, FITSCard here);
-FITSCard ft_cardapp(FITSHead fits, FITSCard card);
-FITSCard ft_carddel(FITSHead fits, FITSCard card);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - FITS header.
- <LI> <B>FITSCard card</B> - FITS card to insert, append or
- delete.
- <LI> <B>FITSCard here</B> - Insert <B>card</B> after <B>here</B>
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_cardins</H4></A>
-
-<P>
- Insert a <B>card</B> into a FITS header after <B>here.</B>
-
-<P>
- If <B>here</B> is NULL <B>card</B> is inserted before the END card.
-
-<P>
- Returns <B>card</B>;
-
-<A NAME="section-1.1.4.2"><H4>ft_cardapp</H4></A>
-
-<P>
- Append a card to the end of the FITS header.
-
-<P>
- Retuns <B>card.</B>
-
-<A NAME="section-1.1.4.3"><H4>ft_carddel</H4></A>
-
-<P>
- Delete a card from a FITS header.
-
-<P>
- Returns <B>card</B> which now points the the card after
- the one deleted
-
-<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A>
-
-
-<PRE>
- FITSCard here;
- FITSBuff card;
-
- <B>ft_cardkey</B>(&amp;card, "Keyword", 0);
- <B>ft_cardseti</B>(&amp;card, 4, NULL);
-
- /* Insert a new card "Keyword" after the 4th card.
- */
- here = <B>ft_cardins</B>(fits, &amp;card, <B>ft_cardnth</B>(4));
-
- /* Append the same card to the header
- */
- card = <B>ft_cardapp</B>(fits, &amp;card);
-
- /* Delete the first card.
- */
- <B>ft_carddel</B>(fits, here);
-
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="cardfind.html">[Previous]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/cardins.wu b/funtools/fitsy/doc/cardins.wu
deleted file mode 100644
index 26109f9..0000000
--- a/funtools/fitsy/doc/cardins.wu
+++ /dev/null
@@ -1,72 +0,0 @@
-Title: cardins
-
-
-NAME
-====
- ft_cardins,ft_cardapp,ft_carddel -Fitsy FITS card insert and delete routines.
-
-SYNOPSIS
-========
-
-
--
-FITSCard ft_cardins(FITSHead fits, FITSCard card, FITSCard here);
-FITSCard ft_cardapp(FITSHead fits, FITSCard card);
-FITSCard ft_carddel(FITSHead fits, FITSCard card);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - FITS header.
- * #"FITSCard card" - FITS card to insert, append or
- delete.
- * #"FITSCard here" - Insert #card after #here
-
-DESCRIPTION
-===========
-
- ft_cardins
- ----------
- Insert a #card into a FITS header after #here.
-
- If #here is NULL #card is inserted before the END card.
-
- Returns #card;
-
- ft_cardapp
- ----------
- Append a card to the end of the FITS header.
-
- Retuns #card.
-
- ft_carddel
- ----------
- Delete a card from a FITS header.
-
- Returns #card which now points the the card after
- the one deleted
-
-EXAMPLES
-========
-
-+
- FITSCard here;
- FITSBuff card;
-
- #ft_cardkey(&card, "Keyword", 0);
- #ft_cardseti(&card, 4, NULL);
-
- /* Insert a new card "Keyword" after the 4th card.
- *-/
- here = #ft_cardins(fits, &card, #ft_cardnth(4));
-
- /* Append the same card to the header
- *-/
- card = #ft_cardapp(fits, &card);
-
- /* Delete the first card.
- *-/
- #ft_carddel(fits, here);
-
-+
diff --git a/funtools/fitsy/doc/cardpar.html b/funtools/fitsy/doc/cardpar.html
deleted file mode 100644
index 9d91fd6..0000000
--- a/funtools/fitsy/doc/cardpar.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> cardpar
-</TITLE>
-<p>
-<!-- pnuts --> <a href="dataimage.html">[Previous]</a> <a href="cardfmt.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_cardpar,ft_cardget,ft_cardgetl,ft_cardgeti,ft_cardgetr,ft_cardgets -Fitsy
- FITS card parsing routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-char *ft_cardpar(FITSCard card, FITSType *type, char *value, int *index, char *comm);
-char *ft_cardget(FITSCard card);
-int ft_cardgetl(FITSCard card);
-int ft_cardgeti(FITSCard card);
-double ft_cardgetr(FITSCard card);
-char *ft_cardgets(FITSCard card);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSCard card</B> - FITS card to parse.
- <LI> <B>FITSType *type</B> - Returned card type.
-
-<P>
- Possible values for a <B>FITSType</B> are as follows:
- <UL>
-<P>
- <LI> <B>FT_COMMENT</B>
- <LI> <B>FT_LOGICAL</B>
- <LI> <B>FT_INTEGER</B>
- <LI> <B>FT_STRING</B>
- <LI> <B>FT_VALUE</B>
- <LI> <B>FT_REAL</B>
- <LI> <B>FT_COMPLEX</B>
-
- </UL>
-<P>
- <LI> <B>char *value</B> - Returned card value string.
- <LI> <B>int *index</B> - Returned index of the card keyword.
- <LI> <B>char *comm</B> - Returned card comment.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-<P>
- These routines parse FITS cards. Usually the header value routines will
- be used instead of these.
-
-<A NAME="section-1.1.4.1"><H4>ft_cardpar</H4></A>
-
-<P>
- Parse a FITS card in to its type, value index and comment parts
-
-<P>
- The ft_cardpar will parse an 80 character fits card in memory
- into its parts according to the standard. Some non-standard
- card formats are recognized.
-
-<A NAME="section-1.1.4.2"><H4>ft_cardget</H4></A>
-
-<P>
- Return the value of a FITS card in a static buffer.
-
-<A NAME="section-1.1.4.3"><H4>ft_cardgetl</H4></A>
-
-<P>
- Return the value of a FITS card as a logical.
-
-<A NAME="section-1.1.4.4"><H4>ft_cardgeti</H4></A>
-
-<P>
- Return the value of a FITS card as a integer.
-
-<A NAME="section-1.1.4.5"><H4>ft_cardgetr</H4></A>
-
-<P>
- Return the value of a FITS card as a double.
-
-<A NAME="section-1.1.4.6"><H4>ft_cardgets</H4></A>
-
-<P>
- Return the value of a FITS card as a allocated string.
-
-<P>
- The returned string is allocated with strdup().
-
-<A NAME="section-1.1.5"><H3>RETURNS</H3></A>
-
-
-<A NAME="section-1.1.5.1"><H4>ft_cardpar</H4></A>
-
-<P>
- The value parameter.
-<A NAME="section-1.1.6"><H3>EXAMPLES</H3></A>
-
-
-<PRE>
- FITSHead fits;
- FITSCard card;
- FITSType type;
- char value[FT_CARDLEN];
- int index;
- char comment[FT_CARDLEN];
-
- int im; /* Is this a primary image? */
-
- <B>ft_cardpar</B>(card, &amp;type, value, &amp;index, comm);
-
- card = <B>ft_headfind</B>(fits, "SIMPLE", 0, 0);
-
- im = <B>ft_cardgetl</B>(card);
-
-</PRE>
-<p>
-<!-- pnuts --> <a href="dataimage.html">[Previous]</a> <a href="cardfmt.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/cardpar.wu b/funtools/fitsy/doc/cardpar.wu
deleted file mode 100644
index 604390b..0000000
--- a/funtools/fitsy/doc/cardpar.wu
+++ /dev/null
@@ -1,99 +0,0 @@
-Title: cardpar
-
-
-NAME
-====
- ft_cardpar,ft_cardget,ft_cardgetl,ft_cardgeti,ft_cardgetr,ft_cardgets -Fitsy
- FITS card parsing routines.
-
-SYNOPSIS
-========
-
-
--
-char *ft_cardpar(FITSCard card, FITSType *type, char *value, int *index, char *comm);
-char *ft_cardget(FITSCard card);
-int ft_cardgetl(FITSCard card);
-int ft_cardgeti(FITSCard card);
-double ft_cardgetr(FITSCard card);
-char *ft_cardgets(FITSCard card);
-
-
--
-PARAMETERS
-==========
- * #"FITSCard card" - FITS card to parse.
- * #"FITSType *type" - Returned card type.
-
- Possible values for a #FITSType are as follows:
- * #"FT_COMMENT"
- * #"FT_LOGICAL"
- * #"FT_INTEGER"
- * #"FT_STRING"
- * #"FT_VALUE"
- * #"FT_REAL"
- * #"FT_COMPLEX"
-
- * #"char *value" - Returned card value string.
- * #"int *index" - Returned index of the card keyword.
- * #"char *comm" - Returned card comment.
-
-DESCRIPTION
-===========
- These routines parse FITS cards. Usually the header value routines will
- be used instead of these.
-
- ft_cardpar
- ----------
- Parse a FITS card in to its type, value index and comment parts
-
- The ft_cardpar will parse an 80 character fits card in memory
- into its parts according to the standard. Some non-standard
- card formats are recognized.
-
- ft_cardget
- ----------
- Return the value of a FITS card in a static buffer.
-
- ft_cardgetl
- -----------
- Return the value of a FITS card as a logical.
-
- ft_cardgeti
- -----------
- Return the value of a FITS card as a integer.
-
- ft_cardgetr
- -----------
- Return the value of a FITS card as a double.
-
- ft_cardgets
- -----------
- Return the value of a FITS card as a allocated string.
-
- The returned string is allocated with strdup().
-
-RETURNS
-=======
-
- ft_cardpar
- ----------
- The value parameter.
-EXAMPLES
-========
-
-+
- FITSHead fits;
- FITSCard card;
- FITSType type;
- char value[FT_CARDLEN];
- int index;
- char comment[FT_CARDLEN];
-
- int im; /* Is this a primary image? *-/
-
- #ft_cardpar(card, &type, value, &index, comm);
-
- card = #ft_headfind(fits, "SIMPLE", 0, 0);
-
- im = #ft_cardgetl(card);
diff --git a/funtools/fitsy/doc/dataimage.html b/funtools/fitsy/doc/dataimage.html
deleted file mode 100644
index 9de21fe..0000000
--- a/funtools/fitsy/doc/dataimage.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> dataimage
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headdata.html">[Previous]</a> <a href="cardpar.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_dataread,ft_dataswap -Routines to handle FITS image data.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-void *ft_dataread(File file, FITSHead fits, void *dataptr, int pixtype);
-void *ft_dataswap(void *data, int n, int type);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>File file</B> - File pointer to read data from.
- <LI> <B>FITSHead fits</B> - Not Documented.
- <LI> <B>void *dataptr</B> - Pointer to data buffer to store data.
- <LI> <B>int pixtype</B> - Pixtype to convert data to.
- <LI> <B>void *data</B> - Pointer to data to swap.
- <LI> <B>int n</B> - N bytes
- <LI> <B>int type</B> - Swap 2 or swap 4.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_dataread</H4></A>
-
-<P>
- Read data from a file pointer and convert it to the requested type.
-
-<A NAME="section-1.1.4.2"><H4>ft_dataswap</H4></A>
-
-<P>
- Swap n bytes of data if necessary.
-
-<p>
-<!-- pnuts --> <a href="headdata.html">[Previous]</a> <a href="cardpar.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/dataimage.wu b/funtools/fitsy/doc/dataimage.wu
deleted file mode 100644
index 67edfe1..0000000
--- a/funtools/fitsy/doc/dataimage.wu
+++ /dev/null
@@ -1,37 +0,0 @@
-Title: dataimage
-
-
-NAME
-====
- ft_dataread,ft_dataswap -Routines to handle FITS image data.
-
-SYNOPSIS
-========
-
-
--
-void *ft_dataread(File file, FITSHead fits, void *dataptr, int pixtype);
-void *ft_dataswap(void *data, int n, int type);
-
-
--
-PARAMETERS
-==========
- * #"File file" - File pointer to read data from.
- * #"FITSHead fits" - Not Documented.
- * #"void *dataptr" - Pointer to data buffer to store data.
- * #"int pixtype" - Pixtype to convert data to.
- * #"void *data" - Pointer to data to swap.
- * #"int n" - N bytes
- * #"int type" - Swap 2 or swap 4.
-
-DESCRIPTION
-===========
-
- ft_dataread
- -----------
- Read data from a file pointer and convert it to the requested type.
-
- ft_dataswap
- -----------
- Swap n bytes of data if necessary.
diff --git a/funtools/fitsy/doc/examples.wu b/funtools/fitsy/doc/examples.wu
deleted file mode 100644
index 23e8d25..0000000
--- a/funtools/fitsy/doc/examples.wu
+++ /dev/null
@@ -1,36 +0,0 @@
-Here is an example of writing a FITS image.
-
- header = ft_imagehead(simple, bitpix, naxis, ax1, ax2, ...);
- ft_imagewite(file, header, data, bitpix);
-
- These routines allow access to complete multiextension
- FITS files. If bitpix is given as 0 no data will be read
- in on the first pass. If bitpix is specified the data
- blocks will be read and converted (if images) to the given
- type. If the file is not seekable the data will be
- buffered in any event.
-
- FITSFile = ft_fileopen(filenamei, bitpix);
- FITSFile = ft_fileread(file, bitpix);
-
- hdu = ft_filematch(fitsfile, hduname);
-
- ft_filehduhead(fitsfile, hdu);
- ft_filehdudata(fitsfile, hdu);
-
- ft_filevali(fitsfile, hdu, name, n, &card);
- ft_fileseti(fitsfile, hdu, name, n, &card);
- ft_fileappi(fitsfile, hdu, name, n);
-
- data = ft_fileimageread(fitsfile, bitpix);
-
- data = ft_filetableload(fitsfile)
- data = ft_filetablerowload(fitsfile, row);
-
- Toss in xx_alloc and get 1, 2, 3 dim edges.
- Toss in acht and get type changes.
-
- Add macros for all struct value access +
- ft_headblocks(head)
- ft_datablocks(head)
-
diff --git a/funtools/fitsy/doc/fitsimage.html b/funtools/fitsy/doc/fitsimage.html
deleted file mode 100644
index 934e68a..0000000
--- a/funtools/fitsy/doc/fitsimage.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> fitsimage
-</TITLE>
-<p>
-<!-- pnuts --> <a href="fitsy.html">[Previous]</a> <a href="headinit.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_simpleimageread,ft_simpleimagewrite,ft_imageread,ft_imagewrite -Fitsy FITS
- routines to read and write FITS images.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-int ft_simpleimageread(char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype);
-int ft_simpleimagewrite(char *filename, FITSHead fits, float *data, int pixtype);
-int ft_imageread(File file, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype);
-int ft_imagewrite(File file, FITSHead fits, float *data, int pixtype);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>char *filename</B> - FITS image file name.
- <LI> <B>FITSHead *headptr</B> - Returned pointer to FITS header
- <LI> <B>void **dataptr</B> - Returned pointer to FITS data.
- <LI> <B>void ***data2dptr</B> - Returned edge vector to data.
- <LI> <B>int pixtype</B> - pixtype to convert data to.
- <LI> <B>FITSHead fits</B> - FITS header to write.
- <LI> <B>float *data</B> - Data to write into FITS file.
- <LI> <B>File file</B> - File pointer to read header and data from.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_simpleimageread</H4></A>
-
-<P>
- Read a FITS image from the named file.
-
-<A NAME="section-1.1.4.2"><H4>ft_simpleimagewrite</H4></A>
-
-<P>
- Write a FITS image to a named file.
-
-<A NAME="section-1.1.4.3"><H4>ft_imageread</H4></A>
-
-<P>
- Read a FITS image from a file pointer.
-
-<A NAME="section-1.1.4.4"><H4>ft_imagewrite</H4></A>
-
-<P>
- Write a FITS image to a file.
-
-<p>
-<!-- pnuts --> <a href="fitsy.html">[Previous]</a> <a href="headinit.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/fitsimage.wu b/funtools/fitsy/doc/fitsimage.wu
deleted file mode 100644
index 43f6066..0000000
--- a/funtools/fitsy/doc/fitsimage.wu
+++ /dev/null
@@ -1,49 +0,0 @@
-Title: fitsimage
-
-
-NAME
-====
- ft_simpleimageread,ft_simpleimagewrite,ft_imageread,ft_imagewrite -Fitsy FITS
- routines to read and write FITS images.
-
-SYNOPSIS
-========
-
-
--
-int ft_simpleimageread(char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype);
-int ft_simpleimagewrite(char *filename, FITSHead fits, float *data, int pixtype);
-int ft_imageread(File file, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype);
-int ft_imagewrite(File file, FITSHead fits, float *data, int pixtype);
-
-
--
-PARAMETERS
-==========
- * #"char *filename" - FITS image file name.
- * #"FITSHead *headptr" - Returned pointer to FITS header
- * #"void **dataptr" - Returned pointer to FITS data.
- * #"void ***data2dptr" - Returned edge vector to data.
- * #"int pixtype" - pixtype to convert data to.
- * #"FITSHead fits" - FITS header to write.
- * #"float *data" - Data to write into FITS file.
- * #"File file" - File pointer to read header and data from.
-
-DESCRIPTION
-===========
-
- ft_simpleimageread
- ------------------
- Read a FITS image from the named file.
-
- ft_simpleimagewrite
- -------------------
- Write a FITS image to a named file.
-
- ft_imageread
- ------------
- Read a FITS image from a file pointer.
-
- ft_imagewrite
- -------------
- Write a FITS image to a file.
diff --git a/funtools/fitsy/doc/fitsy.html b/funtools/fitsy/doc/fitsy.html
deleted file mode 100644
index a4fcb6c..0000000
--- a/funtools/fitsy/doc/fitsy.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> Fitsy FITS Library TOC
-</TITLE>
-<p>
-<!-- pnuts --> <a href="../mmtilib.html">[Previous]</a> <a href="fitsimage.html">[Next]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-<A NAME="section-1.1.1"><H3>Fitsy FITS Routines</H3></A>
-
-
-<UL>
-<P>
- <LI> Routines to handle complete FITS files. ::fitsfile.html
- <LI> <A HREF="fitsimage.html">Routines to handle FITS images.</A>
- <LI> <A HREF="fitstable.html">Routines to handle FITS tables.</A>
- <LI> Routines to handle FITS headers.
- <UL>
- <LI> <A HREF="headinit.html">Creating the <B>FITSHead</B> data structure.</A>
- <LI> <A HREF="headfile.html">Reading and writing FITS headers.</A>
- <LI> Getting basic values in a header.
-
-<P>
- Many of the most basic FITS values are retrieved in when a fits
- file is scanned in memory or read from disk.
-
- <UL>
-<P>
- <LI> <A HREF="basicval.html">Basic values</A>
- <LI> <A HREF="imageval.html">Image values</A>
- <LI> <A HREF="tableval.html">Table values</A>
-
- </UL>
-<P>
- These data structures are transfered to and from the FITS header
- with these routines.
-
- <UL>
-<P>
- <LI> <A HREF="headimage.html">Load and store basic and image header values.</A>
- <LI> <A HREF="headtable.html">Load and store table header values.</A>
-
- </UL>
-<P>
- <LI> <A HREF="headget.html">Getting the value of cards in a header.</A>
- <LI> <A HREF="headset.html">Setting the value of cards in a header.</A>
- <LI> <A HREF="headfind.html">Finding cards in a header</A>
- <LI> <A HREF="headins.html">Inserting, appending and deleting cards in a header.</A>
- </UL>
- <LI> Routines to handle the data portion of a FITS file.
- <UL>
- <LI> <A HREF="headdata.html">Moving to and skipping over the data portion of a FITS HDU.</A>
- <LI> <A HREF="dataimage.html">Reading FITS image data</A>
- </UL>
- <LI> Low level routines to handle FITS Cards.
- <UL>
- <LI> <A HREF="cardpar.html">Parsing values from FITS cards.</A>
- <LI> <A HREF="cardfmt.html">Formatting FITS cards.</A>
- <LI> <A HREF="cardfind.html">Finding cards in a header</A>
- <LI> <A HREF="cardins.html">Inserting, appending and deleting cards in a header.</A>
-
- </UL>
-<P>
- <LI> Examples
- <UL>
- <LI> <A HREF="headex.html">Basic header examples.</A>
- <LI> <A HREF="cardex.html">Basic card examples.</A>
- <LI> <A HREF="examples.html">More examples.</A>
- </UL>
-</UL>
-
-<p>
-<!-- pnuts --> <a href="../mmtilib.html">[Previous]</a> <a href="fitsimage.html">[Next]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/fitsy.pnuts b/funtools/fitsy/doc/fitsy.pnuts
deleted file mode 100644
index a0250e6..0000000
--- a/funtools/fitsy/doc/fitsy.pnuts
+++ /dev/null
@@ -1,20 +0,0 @@
-../mmtilib.html
-fitsy.html
- fitsimage.html
- headinit.html
- headfile.html
- basicval.html
- imageval.html
- tableval.html
- headimage.html
- headtable.html
- headget.html
- headset.html
- headfind.html
- headins.html
- headdata.html
- dataimage.html
- cardpar.html
- cardfmt.html
- cardfind.html
- cardins.html
diff --git a/funtools/fitsy/doc/fitsy.wu b/funtools/fitsy/doc/fitsy.wu
deleted file mode 100644
index 5815b67..0000000
--- a/funtools/fitsy/doc/fitsy.wu
+++ /dev/null
@@ -1,43 +0,0 @@
-Title: Fitsy FITS Library TOC
-
-Fitsy FITS Routines
-===================
-
- * Routines to handle complete FITS files. ::fitsfile.html
- * @"Routines to handle FITS images."::fitsimage.html
- * @"Routines to handle FITS tables."::fitstable.html
- * Routines to handle FITS headers.
- * @"Creating the #FITSHead data structure."::headinit.html
- * @"Reading and writing FITS headers."::headfile.html
- * Getting basic values in a header.
-
- Many of the most basic FITS values are retrieved in when a fits
- file is scanned in memory or read from disk.
-
- * @"Basic values"::basicval.html
- * @"Image values"::imageval.html
- * @"Table values"::tableval.html
-
- These data structures are transfered to and from the FITS header
- with these routines.
-
- * @"Load and store basic and image header values."::headimage.html
- * @"Load and store table header values."::headtable.html
-
- * @"Getting the value of cards in a header."::headget.html
- * @"Setting the value of cards in a header."::headset.html
- * @"Finding cards in a header"::headfind.html
- * @"Inserting, appending and deleting cards in a header."::headins.html
- * Routines to handle the data portion of a FITS file.
- * @"Moving to and skipping over the data portion of a FITS HDU."::headdata.html
- * @"Reading FITS image data"::dataimage.html
- * Low level routines to handle FITS Cards.
- * @"Parsing values from FITS cards."::cardpar.html
- * @"Formatting FITS cards."::cardfmt.html
- * @"Finding cards in a header"::cardfind.html
- * @"Inserting, appending and deleting cards in a header."::cardins.html
-
- * Examples
- * @"Basic header examples."::headex.html
- * @"Basic card examples."::cardex.html
- * @"More examples."::examples.html
diff --git a/funtools/fitsy/doc/ftimage.wu b/funtools/fitsy/doc/ftimage.wu
deleted file mode 100644
index ecf12c6..0000000
--- a/funtools/fitsy/doc/ftimage.wu
+++ /dev/null
@@ -1,41 +0,0 @@
-Title: ftimage
-
-
-NAME
-====
- ft_imageloadhead,ft_imagestorhead,ft_basicloadhead,ft_basicstorhead - Fitsy
- FITS routines for reading and writing image related cards.
-
-SYNOPSIS
-========
--
-FITSImage ft_imageloadhead(FITSHead fits);
-void ft_imagestorhead(FITSHead fits, FITSImage image);
-FITSBasic ft_basicloadhead(FITSHead fits);
-void ft_basicstorhead(FITSHead fits, FITSBasic basic);
--
-
-PARAMETERS
-==========
- * #"FITSHead fits" - Not Documented.
- * #"FITSImage image" - Not Documented.
- * #"FITSBasic basic" - Not Documented.
-
-DESCRIPTION
-===========
-
- ft_imageloadhead
- ----------------
- Load image FITS values into the #FITSImage structure.
-
- ft_imagestorhead
- ----------------
- Store image FITS values from a #FITSImage structure into a header.
-
- ft_basicloadhead
- ----------------
- Load basic FITS values into the #FITSBasic structure.
-
- ft_basicstorhead
- ----------------
- Store basic FITS values from a #FITSBasic structre into a fits header.
diff --git a/funtools/fitsy/doc/fttable.wu b/funtools/fitsy/doc/fttable.wu
deleted file mode 100644
index de0b5e0..0000000
--- a/funtools/fitsy/doc/fttable.wu
+++ /dev/null
@@ -1,35 +0,0 @@
-Title: fttable
-
-
-NAME
-====
- ft_tableloadhead,ft_tablestorhead,ft_tablefree - Fitsy FITS routines to load
- and store #FITSTable structures.
-
-SYNOPSIS
-========
--
-FITSTable ft_tableloadhead(FITSHead fits);
-void ft_tablestorhead(FITSHead fits, FITSTable table);
-void ft_tablefree(FITSTable table);
--
-
-PARAMETERS
-==========
- * #"FITSHead fits" - Not Documented.
- * #"FITSTable table" - Not Documented.
-
-DESCRIPTION
-===========
-
- ft_tableloadhead
- ----------------
- Allocate and load a #FITSTable data structure.
-
- ft_tablestorhead
- ----------------
- Store a #FITSTable structure in a FITS header.
-
- ft_tablefree
- ------------
- Free a #FITSTable structure.
diff --git a/funtools/fitsy/doc/headdata.html b/funtools/fitsy/doc/headdata.html
deleted file mode 100644
index 9d586fb..0000000
--- a/funtools/fitsy/doc/headdata.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headdata
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headins.html">[Previous]</a> <a href="dataimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_dataskip,ft_dataseek -Fitsy FITS routines to work with the data portion of
- a FITS file.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-void ft_dataskip(File ifile, FITSHead fits, File ofile);
-int ft_dataseek(File sfile, FITSHead fits);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>File ifile</B> - File pointer to read FITS data from.
- <LI> <B>FITSHead fits</B> - FITS header associated with data.
- <LI> <B>File ofile</B> - File pointer to write data to.
- <LI> <B>File sfile</B> - File pointer to seek.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_dataskip</H4></A>
-
-<P>
- Skip over the data part of a FITS header data unit.
-
-<P>
- If the file is seekable and the <B>ofile</B> file pointer is
- <B>NULL</B> the data are skipped with an <B>fseek</B>().
-
-<P>
- If the <B>ofile</B> file pointer is <B>NULL</B> no data is written.
-
-<A NAME="section-1.1.4.2"><H4>ft_dataseek</H4></A>
-
-<P>
- Seek to the data portion of prevoiusly read fits header data unit.
-
-<p>
-<!-- pnuts --> <a href="headins.html">[Previous]</a> <a href="dataimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headdata.wu b/funtools/fitsy/doc/headdata.wu
deleted file mode 100644
index cf4b7da..0000000
--- a/funtools/fitsy/doc/headdata.wu
+++ /dev/null
@@ -1,40 +0,0 @@
-Title: headdata
-
-
-NAME
-====
- ft_dataskip,ft_dataseek -Fitsy FITS routines to work with the data portion of
- a FITS file.
-
-SYNOPSIS
-========
-
-
--
-void ft_dataskip(File ifile, FITSHead fits, File ofile);
-int ft_dataseek(File sfile, FITSHead fits);
-
-
--
-PARAMETERS
-==========
- * #"File ifile" - File pointer to read FITS data from.
- * #"FITSHead fits" - FITS header associated with data.
- * #"File ofile" - File pointer to write data to.
- * #"File sfile" - File pointer to seek.
-
-DESCRIPTION
-===========
-
- ft_dataskip
- -----------
- Skip over the data part of a FITS header data unit.
-
- If the file is seekable and the #ofile file pointer is
- #NULL the data are skipped with an #fseek().
-
- If the #ofile file pointer is #NULL no data is written.
-
- ft_dataseek
- -----------
- Seek to the data portion of prevoiusly read fits header data unit.
diff --git a/funtools/fitsy/doc/headfile.html b/funtools/fitsy/doc/headfile.html
deleted file mode 100644
index 32c8978..0000000
--- a/funtools/fitsy/doc/headfile.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headfile
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headinit.html">[Previous]</a> <a href="basicval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_headread,ft_headwrite,ft_headseek -Fitsy FITS read and write header routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSHead ft_headread(File file);
-int ft_headwrite(File file, FITSHead fits);
-int ft_headseek(File file, FITSHead fits);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>File file</B> - File pointer to read or write a FITS header on.
- <LI> <B>FITSHead fits</B> - Header to write.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_headread</H4></A>
-
-<P>
- Read a FITS header from a file pointer.
-
-<A NAME="section-1.1.4.2"><H4>ft_headwrite</H4></A>
-
-<P>
- Write a FITS header to a file pointer.
-
-<A NAME="section-1.1.4.3"><H4>ft_headseek</H4></A>
-
-<P>
- Seek back to the header part of a FITS HDU. The file handle must be the same
- one from which the FITS header was read and must be seekable.
-
-<A NAME="section-1.1.5"><H3>RETURNS</H3></A>
-
-
-<A NAME="section-1.1.5.1"><H4>ft_headread</H4></A>
-
-<P>
- The <B>FITSHead</B> read from <B>file.</B>
-<p>
-<!-- pnuts --> <a href="headinit.html">[Previous]</a> <a href="basicval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headfile.wu b/funtools/fitsy/doc/headfile.wu
deleted file mode 100644
index 23aa8e8..0000000
--- a/funtools/fitsy/doc/headfile.wu
+++ /dev/null
@@ -1,45 +0,0 @@
-Title: headfile
-
-
-NAME
-====
- ft_headread,ft_headwrite,ft_headseek -Fitsy FITS read and write header routines.
-
-SYNOPSIS
-========
-
-
--
-FITSHead ft_headread(File file);
-int ft_headwrite(File file, FITSHead fits);
-int ft_headseek(File file, FITSHead fits);
-
-
--
-PARAMETERS
-==========
- * #"File file" - File pointer to read or write a FITS header on.
- * #"FITSHead fits" - Header to write.
-
-DESCRIPTION
-===========
-
- ft_headread
- -----------
- Read a FITS header from a file pointer.
-
- ft_headwrite
- ------------
- Write a FITS header to a file pointer.
-
- ft_headseek
- -----------
- Seek back to the header part of a FITS HDU. The file handle must be the same
- one from which the FITS header was read and must be seekable.
-
-RETURNS
-=======
-
- ft_headread
- -----------
- The #FITSHead read from #file. \ No newline at end of file
diff --git a/funtools/fitsy/doc/headfind.html b/funtools/fitsy/doc/headfind.html
deleted file mode 100644
index 1c1edc2..0000000
--- a/funtools/fitsy/doc/headfind.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headfind
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headset.html">[Previous]</a> <a href="headins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_headfind,ft_headindex,ft_headfindidx,ft_headfindseq -Fitsy FITS header find
- routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSCard ft_headfind(FITSHead fits, char *name, int n, int add);
-void ft_headindex(FITSHead fits);
-FITSCard ft_headfindidx(FITSHead fits, char *name, int n, int *match);
-FITSCard ft_headfindseq(FITSHead fits, char *name, int n, int *match);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - The FITS header to search.
- <LI> <B>char *name</B> - Name of the card keyword to search for.
- <LI> <B>int n</B> - keyword index number, if is zero no
- index number is appended to the keyword.
- <LI> <B>int add</B> - If add is true the card will
- be added to the header if it is
- not found.
- <LI> <B>int *match</B> - Returns true if the card found is
- an exact match for the keyword
- requested.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_headfind</H4></A>
-
-<P>
- Find a FITS card in the header.
-
-<P>
- If the header has been indexed the index will be used
- otherwise a sequential search will be done.
-
-<A NAME="section-1.1.4.2"><H4>ft_headindex</H4></A>
-
-<P>
- Index a header for use with <B>ft_headfind.</B>
-
-<A NAME="section-1.1.4.3"><H4>ft_headfindidx</H4></A>
-
-<P>
- Find a FITS card in the header.
-
-<P>
- <B>headfindidx</B> uses an index to find the card.
-
-<A NAME="section-1.1.4.4"><H4>ft_headfindseq</H4></A>
-
-<P>
- Find a FITS card in the header.
-
-<P>
- Find a card in the header using sequential search.
-
-<P>
- If the requested card is a FITS indexed keyword and an exact match
- is not found, the highest existing card of that type is returned and
- match is set to 0.
-
-<A NAME="section-1.1.5"><H3>RETURNS</H3></A>
-
-
-<A NAME="section-1.1.5.1"><H4>ft_headfind</H4></A>
-
-<P>
- The card found or NULL if an exact match was not found.
-<p>
-<!-- pnuts --> <a href="headset.html">[Previous]</a> <a href="headins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headfind.wu b/funtools/fitsy/doc/headfind.wu
deleted file mode 100644
index 20b143d..0000000
--- a/funtools/fitsy/doc/headfind.wu
+++ /dev/null
@@ -1,69 +0,0 @@
-Title: headfind
-
-
-NAME
-====
- ft_headfind,ft_headindex,ft_headfindidx,ft_headfindseq -Fitsy FITS header find
- routines.
-
-SYNOPSIS
-========
-
-
--
-FITSCard ft_headfind(FITSHead fits, char *name, int n, int add);
-void ft_headindex(FITSHead fits);
-FITSCard ft_headfindidx(FITSHead fits, char *name, int n, int *match);
-FITSCard ft_headfindseq(FITSHead fits, char *name, int n, int *match);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - The FITS header to search.
- * #"char *name" - Name of the card keyword to search for.
- * #"int n" - keyword index number, if is zero no
- index number is appended to the keyword.
- * #"int add" - If add is true the card will
- be added to the header if it is
- not found.
- * #"int *match" - Returns true if the card found is
- an exact match for the keyword
- requested.
-
-DESCRIPTION
-===========
-
- ft_headfind
- -----------
- Find a FITS card in the header.
-
- If the header has been indexed the index will be used
- otherwise a sequential search will be done.
-
- ft_headindex
- ------------
- Index a header for use with #ft_headfind.
-
- ft_headfindidx
- --------------
- Find a FITS card in the header.
-
- #headfindidx uses an index to find the card.
-
- ft_headfindseq
- --------------
- Find a FITS card in the header.
-
- Find a card in the header using sequential search.
-
- If the requested card is a FITS indexed keyword and an exact match
- is not found, the highest existing card of that type is returned and
- match is set to 0.
-
-RETURNS
-=======
-
- ft_headfind
- -----------
- The card found or NULL if an exact match was not found. \ No newline at end of file
diff --git a/funtools/fitsy/doc/headget.html b/funtools/fitsy/doc/headget.html
deleted file mode 100644
index a9b666c..0000000
--- a/funtools/fitsy/doc/headget.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headget
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headtable.html">[Previous]</a> <a href="headset.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_headget,ft_headgetl,ft_headgeti,ft_headgetr,ft_headgets -Find and return
- values from a FITS header.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-char *ft_headget(FITSHead fits, char *name, int n, FITSCard *card);
-int ft_headgetl(FITSHead fits, char *name, int n, int ldefault, FITSCard *card);
-int ft_headgeti(FITSHead fits, char *name, int n, int idefault, FITSCard *card);
-double ft_headgetr(FITSHead fits, char *name, int n, double ddefault, FITSCard *card);
-char *ft_headgets(FITSHead fits, char *name, int n, char *sdefault, FITSCard *card);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - The FITS header to search.
- <LI> <B>char *name</B> - Name of the card keyword to search for.
- <LI> <B>int n</B> - keyword index number, if is zero no
- index number is appended to the keyword.
- <LI> <B>FITSCard *card</B> - The FITS card that was found.
- <LI> <B>int ldefault</B> - Default logical value to return.
- <LI> <B>int idefault</B> - Default integer value to return.
- <LI> <B>double ddefault</B> - Default real value to return.
- <LI> <B>char *sdefault</B> - Default string value to return.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_headget</H4></A>
-
-<P>
- Find and return the value of a FITS card as a static string.
-
-<A NAME="section-1.1.4.2"><H4>ft_headgetl</H4></A>
-
-<P>
- Find and return the value of a FITS card as a logical.
-
-<A NAME="section-1.1.4.3"><H4>ft_headgeti</H4></A>
-
-<P>
- Find and return the value of a FITS card as an integer.
-
-<A NAME="section-1.1.4.4"><H4>ft_headgetr</H4></A>
-
-<P>
- Find and return the value of a FITS card as a real.
-
-<A NAME="section-1.1.4.5"><H4>ft_headgets</H4></A>
-
-<P>
- Find and return the value of a FITS card as a allocated string.
-
-<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A>
-
-
-<PRE>
- FITSHead fits;
- FITSCard card;
-
-
- int simple;
- int ax1, ax2;
-
- /* Look up the SIMPLE card in the header and see if its is
- True. If it's not found return False.
- */
- simple = <B>ft_headgetl</B>(fits, "SIMPLE", 0, 0, &amp;card);
-
- /* Look up the NAXIS1 and NAXIS2 cards in the header
- if a card is not found return 0.
- */
- ax1 = <B>ft_headgeti</B>(fits, "NAXIS", 1, 0, &amp;card);
- ax2 = <B>ft_headgeti</B>(fits, "NAXIS", 2, 0, &amp;card);
-
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="headtable.html">[Previous]</a> <a href="headset.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headget.wu b/funtools/fitsy/doc/headget.wu
deleted file mode 100644
index 9b74c96..0000000
--- a/funtools/fitsy/doc/headget.wu
+++ /dev/null
@@ -1,79 +0,0 @@
-Title: headget
-
-
-NAME
-====
- ft_headget,ft_headgetl,ft_headgeti,ft_headgetr,ft_headgets -Find and return
- values from a FITS header.
-
-SYNOPSIS
-========
-
-
--
-char *ft_headget(FITSHead fits, char *name, int n, FITSCard *card);
-int ft_headgetl(FITSHead fits, char *name, int n, int ldefault, FITSCard *card);
-int ft_headgeti(FITSHead fits, char *name, int n, int idefault, FITSCard *card);
-double ft_headgetr(FITSHead fits, char *name, int n, double ddefault, FITSCard *card);
-char *ft_headgets(FITSHead fits, char *name, int n, char *sdefault, FITSCard *card);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - The FITS header to search.
- * #"char *name" - Name of the card keyword to search for.
- * #"int n" - keyword index number, if is zero no
- index number is appended to the keyword.
- * #"FITSCard *card" - The FITS card that was found.
- * #"int ldefault" - Default logical value to return.
- * #"int idefault" - Default integer value to return.
- * #"double ddefault" - Default real value to return.
- * #"char *sdefault" - Default string value to return.
-
-DESCRIPTION
-===========
-
- ft_headget
- ----------
- Find and return the value of a FITS card as a static string.
-
- ft_headgetl
- -----------
- Find and return the value of a FITS card as a logical.
-
- ft_headgeti
- -----------
- Find and return the value of a FITS card as an integer.
-
- ft_headgetr
- -----------
- Find and return the value of a FITS card as a real.
-
- ft_headgets
- -----------
- Find and return the value of a FITS card as a allocated string.
-
-EXAMPLES
-========
-
-+
- FITSHead fits;
- FITSCard card;
-
-
- int simple;
- int ax1, ax2;
-
- /* Look up the SIMPLE card in the header and see if its is
- True. If it's not found return False.
- *-/
- simple = #ft_headgetl(fits, "SIMPLE", 0, 0, &card);
-
- /* Look up the NAXIS1 and NAXIS2 cards in the header
- if a card is not found return 0.
- *-/
- ax1 = #ft_headgeti(fits, "NAXIS", 1, 0, &card);
- ax2 = #ft_headgeti(fits, "NAXIS", 2, 0, &card);
-
-+
diff --git a/funtools/fitsy/doc/headimage.html b/funtools/fitsy/doc/headimage.html
deleted file mode 100644
index cfb98bf..0000000
--- a/funtools/fitsy/doc/headimage.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headimage
-</TITLE>
-<p>
-<!-- pnuts --> <a href="tableval.html">[Previous]</a> <a href="headtable.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_syncdata,ft_synchead,ft_imageloadhead,ft_imagestorhead,ft_imagefree,ft_basicloadhead,ft_basicstorhead,ft_basicfree
-- Fitsy FITS routines for reading and writing image related cards.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-void ft_syncdata(FITSHead fits);
-void ft_synchead(FITSHead fits);
-FITSImage ft_imageloadhead(FITSHead fits);
-void ft_imagestorhead(FITSHead fits, FITSImage image);
-void ft_imagefree(FITSImage image);
-FITSBasic ft_basicloadhead(FITSHead fits);
-void ft_basicstorhead(FITSHead fits, FITSBasic basic);
-void ft_basicfree(FITSBasic basic);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - FITS header to read/write image
- cards from/to.
- <LI> <B>FITSImage image</B> - Image data to copy into header.
- <LI> <B>FITSBasic basic</B> - FITSBasic structure
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-<P>
- The routines on this page are usually called automatically from
- <B>ft_headinit</B>, <B>ft_headread</B>, <B>ft_headwrite</B> and other higher level
- routines. This user should never need to call them with the
- exception of <B>ft_synchead</B> or <B>ft_syncdata.</B>
-
-<A NAME="section-1.1.4.1"><H4>ft_syncdata</H4></A>
-
-<P>
- Copy information from a <B>FITSHead</B> into the <B>FITSBasic</B>, <B>FITSImage</B>
- and <B>FITSTable</B> data structures.
-
-<A NAME="section-1.1.4.2"><H4>ft_synchead</H4></A>
-
-<P>
- Copy information from the <B>FITSBasic</B>, <B>FITSImage</B> and <B>FITSTable</B> data
- structures into a <B>FITSHead.</B>
-
-<A NAME="section-1.1.4.3"><H4>ft_imageloadhead</H4></A>
-
-<P>
- Load image FITS values into the <B>FITSImage</B> structure.
-
-<A NAME="section-1.1.4.4"><H4>ft_imagestorhead</H4></A>
-
-<P>
- Store image FITS values from a <B>FITSImage</B> structure into a header.
-
-<A NAME="section-1.1.4.5"><H4>ft_imagefree</H4></A>
-
-<P>
- Free a FITSImage data structure.
-
-<A NAME="section-1.1.4.6"><H4>ft_basicloadhead</H4></A>
-
-<P>
- Load basic FITS values into the <B>FITSBasic</B> structure.
-
-<A NAME="section-1.1.4.7"><H4>ft_basicstorhead</H4></A>
-
-<P>
- Store basic FITS values from a <B>FITSBasic</B> structre into a fits header.
-
-<A NAME="section-1.1.4.8"><H4>ft_basicfree</H4></A>
-
-<P>
- Free a FITSBasic data structure.
-
-<p>
-<!-- pnuts --> <a href="tableval.html">[Previous]</a> <a href="headtable.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headimage.wu b/funtools/fitsy/doc/headimage.wu
deleted file mode 100644
index 8c92b08..0000000
--- a/funtools/fitsy/doc/headimage.wu
+++ /dev/null
@@ -1,71 +0,0 @@
-Title: headimage
-
-
-NAME
-====
- ft_syncdata,ft_synchead,ft_imageloadhead,ft_imagestorhead,ft_imagefree,ft_basicloadhead,ft_basicstorhead,ft_basicfree
-- Fitsy FITS routines for reading and writing image related cards.
-
-SYNOPSIS
-========
-
-
--
-void ft_syncdata(FITSHead fits);
-void ft_synchead(FITSHead fits);
-FITSImage ft_imageloadhead(FITSHead fits);
-void ft_imagestorhead(FITSHead fits, FITSImage image);
-void ft_imagefree(FITSImage image);
-FITSBasic ft_basicloadhead(FITSHead fits);
-void ft_basicstorhead(FITSHead fits, FITSBasic basic);
-void ft_basicfree(FITSBasic basic);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - FITS header to read/write image
- cards from/to.
- * #"FITSImage image" - Image data to copy into header.
- * #"FITSBasic basic" - FITSBasic structure
-
-DESCRIPTION
-===========
- The routines on this page are usually called automatically from
- #ft_headinit, #ft_headread, #ft_headwrite and other higher level
- routines. This user should never need to call them with the
- exception of #ft_synchead or #ft_syncdata.
-
- ft_syncdata
- -----------
- Copy information from a #FITSHead into the #FITSBasic, #FITSImage
- and #FITSTable data structures.
-
- ft_synchead
- -----------
- Copy information from the #FITSBasic, #FITSImage and #FITSTable data
- structures into a #FITSHead.
-
- ft_imageloadhead
- ----------------
- Load image FITS values into the #FITSImage structure.
-
- ft_imagestorhead
- ----------------
- Store image FITS values from a #FITSImage structure into a header.
-
- ft_imagefree
- ------------
- Free a FITSImage data structure.
-
- ft_basicloadhead
- ----------------
- Load basic FITS values into the #FITSBasic structure.
-
- ft_basicstorhead
- ----------------
- Store basic FITS values from a #FITSBasic structre into a fits header.
-
- ft_basicfree
- ------------
- Free a FITSBasic data structure.
diff --git a/funtools/fitsy/doc/headinit.html b/funtools/fitsy/doc/headinit.html
deleted file mode 100644
index 78e6078..0000000
--- a/funtools/fitsy/doc/headinit.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headinit
-</TITLE>
-<p>
-<!-- pnuts --> <a href="fitsimage.html">[Previous]</a> <a href="headfile.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_headinit,ft_headcopy,ft_headfree,ft_setcards,ft_primary,ft_headmerge -Fitsy
- FITS header creation routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSHead ft_headinit(void *data, int bytes);
-FITSHead ft_headcopy(FITSHead fits);
-void ft_headfree(FITSHead fits, int freecards);
-void ft_setcards(FITSHead fits, void *cards);
-FITSHead ft_primary(FITSHead fits);
-FITSHead ft_headmerge(FITSHead fits1, FITSHead fits2);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>void *data</B> - Pointer to FITS cards.
- <LI> <B>int bytes</B> - Number of bytes in buffer.
- <LI> <B>FITSHead fits</B> - Not Documented.
- <LI> <B>int freecards</B> - Free the FITS cards?
- <LI> <B>void *cards</B> - Not Documented.
- <LI> <B>FITSHead fits1</B> - Not Documented.
- <LI> <B>FITSHead fits2</B> - Not Documented.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_headinit</H4></A>
-
-<P>
- Create or import a FITS header to Fitsy.
-
-<P>
- This is the primary way in which FITSHead structures are created.
-
-<P>
- If <B>cards</B> is not NULL then then <B>acard</B> cards are scanned from the memory
- in search of the END card. When a memory block is passed in to <B>ft_headinit</B>
- then it is considered <I>unmanaged</I> and will not be freed by <B>ft_headfree.</B>
-
-<P>
- If <B>cards</B> is NULL, then <B>acards</B> cards will be allocated for use as a FITSHead.
- If <B>acards</B> is 0 the <B>FT_CARDS</B> will be allocated (36).
-
-<A NAME="section-1.1.4.2"><H4>ft_headcopy</H4></A>
-
-<P>
- Make a copy of a <B>FITSHead</B> data structure.
-
-<A NAME="section-1.1.4.3"><H4>ft_headfree</H4></A>
-
-<P>
- Free a Fitsy FITS header data structure.
-
-<A NAME="section-1.1.4.4"><H4>ft_setcards</H4></A>
-
-<P>
- Set the card buffer
-
-<A NAME="section-1.1.4.5"><H4>ft_primary</H4></A>
-
-<P>
- Make a copy of the header and force it to be a simple primary header.
-
-<A NAME="section-1.1.4.6"><H4>ft_headmerge</H4></A>
-
-<P>
- Merge cards from fits1 to fits2
-
-<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A>
-
-
-<PRE>
- FITSHead fits;
-
- fits = <B>ft_headinit</B>(NULL, 0); /* Create an empty header */
-
- /* Build a FITS file header by hand.
- */
- <B>ft_headappl</B>(fits, "SIMPLE", 0, 1, "Primary FITS image array");
- <B>ft_headappi</B>(fits, "BITPIX", 0, -32, "Single floats");
- <B>ft_headappi</B>(fits, "NAXIS" , 0, 2, "2d image");
- <B>ft_headappi</B>(fits, "NAXIS" , 1, 256, "X axis is 256");
- <B>ft_headappi</B>(fits, "NAXIS" , 2, 256, "Y axis is 256");
-
-
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="fitsimage.html">[Previous]</a> <a href="headfile.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headinit.wu b/funtools/fitsy/doc/headinit.wu
deleted file mode 100644
index 1828a8f..0000000
--- a/funtools/fitsy/doc/headinit.wu
+++ /dev/null
@@ -1,86 +0,0 @@
-Title: headinit
-
-
-NAME
-====
- ft_headinit,ft_headcopy,ft_headfree,ft_setcards,ft_primary,ft_headmerge -Fitsy
- FITS header creation routines.
-
-SYNOPSIS
-========
-
-
--
-FITSHead ft_headinit(void *data, int bytes);
-FITSHead ft_headcopy(FITSHead fits);
-void ft_headfree(FITSHead fits, int freecards);
-void ft_setcards(FITSHead fits, void *cards);
-FITSHead ft_primary(FITSHead fits);
-FITSHead ft_headmerge(FITSHead fits1, FITSHead fits2);
-
-
--
-PARAMETERS
-==========
- * #"void *data" - Pointer to FITS cards.
- * #"int bytes" - Number of bytes in buffer.
- * #"FITSHead fits" - Not Documented.
- * #"int freecards" - Free the FITS cards?
- * #"void *cards" - Not Documented.
- * #"FITSHead fits1" - Not Documented.
- * #"FITSHead fits2" - Not Documented.
-
-DESCRIPTION
-===========
-
- ft_headinit
- -----------
- Create or import a FITS header to Fitsy.
-
- This is the primary way in which FITSHead structures are created.
-
- If #cards is not NULL then then #acard cards are scanned from the memory
- in search of the END card. When a memory block is passed in to #ft_headinit
- then it is considered ~unmanaged~ and will not be freed by #ft_headfree.
-
- If #cards is NULL, then #acards cards will be allocated for use as a FITSHead.
- If #acards is 0 the #FT_CARDS will be allocated (36).
-
- ft_headcopy
- -----------
- Make a copy of a #FITSHead data structure.
-
- ft_headfree
- -----------
- Free a Fitsy FITS header data structure.
-
- ft_setcards
- -----------
- Set the card buffer
-
- ft_primary
- ----------
- Make a copy of the header and force it to be a simple primary header.
-
- ft_headmerge
- ------------
- Merge cards from fits1 to fits2
-
-EXAMPLES
-========
-
-+
- FITSHead fits;
-
- fits = #ft_headinit(NULL, 0); /* Create an empty header *-/
-
- /* Build a FITS file header by hand.
- *-/
- #ft_headappl(fits, "SIMPLE", 0, 1, "Primary FITS image array");
- #ft_headappi(fits, "BITPIX", 0, -32, "Single floats");
- #ft_headappi(fits, "NAXIS" , 0, 2, "2d image");
- #ft_headappi(fits, "NAXIS" , 1, 256, "X axis is 256");
- #ft_headappi(fits, "NAXIS" , 2, 256, "Y axis is 256");
-
-
-+
diff --git a/funtools/fitsy/doc/headins.html b/funtools/fitsy/doc/headins.html
deleted file mode 100644
index 311f343..0000000
--- a/funtools/fitsy/doc/headins.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headins
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headfind.html">[Previous]</a> <a href="headdata.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_headinsl,ft_headinsi,ft_headinsr,ft_headinss,ft_headinsv,ft_headappl,ft_headappi,ft_headappr,ft_headapps,ft_headappv,ft_headdel
-- Routines to insert, append and delete FITS cards from a header.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSCard ft_headinsl(FITSHead fits, char *name, int n, int lvalue, char *comm, FITSCard here);
-FITSCard ft_headinsi(FITSHead fits, char *name, int n, int ivalue, char *comm, FITSCard here);
-FITSCard ft_headinsr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm, FITSCard here);
-FITSCard ft_headinss(FITSHead fits, char *name, int n, char *svalue, char *comm, FITSCard here);
-FITSCard ft_headinsv(FITSHead fits, char *name, int n, char *vvalue, char *comm, FITSCard here);
-FITSCard ft_headappl(FITSHead fits, char *name, int n, int lvalue, char *comm);
-FITSCard ft_headappi(FITSHead fits, char *name, int n, int ivalue, char *comm);
-FITSCard ft_headappr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm);
-FITSCard ft_headapps(FITSHead fits, char *name, int n, char *svalue, char *comm);
-FITSCard ft_headappv(FITSHead fits, char *name, int n, char *vvalue, char *comm);
-FITSCard ft_headdel(FITSHead fits, char *name, int n);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - FITS header to insert, append or
- delete a card.
- <LI> <B>char *name</B> - Name of the FITS card.
- <LI> <B>int n</B> - keyword index number, if is zero no
- index number is appended to the
- keyword.
- <LI> <B>int lvalue</B> - Logical to format as a FITS value.
- <LI> <B>char *comm</B> - Comment for the new card.
- <LI> <B>FITSCard here</B> - Insert the new card after this card.
- <LI> <B>int ivalue</B> - Integer to format as a FITS value.
- <LI> <B>double dvalue</B> - Double to format as a FITS value.
- <LI> <B>int prec</B> - Precision for the value
- <LI> <B>char *svalue</B> - String to format as a FITS value
- <LI> <B>char *vvalue</B> - Raw value to format as a FITS value
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-<P>
- These routines allow FITS cards to be inserted, appended and deleted
- by keyword value.
-
-<P>
- The insertion routines format a new card with the supplied keyword and
- value and insert it after indicated card. The append routines add new
- cards to the end of the header (before the END card).
-
-<A NAME="section-1.1.4.1"><H4>ft_headinsl</H4></A>
-
-<P>
- Insert a logical value FITS card into a header.
-
-<A NAME="section-1.1.4.2"><H4>ft_headinsi</H4></A>
-
-<P>
- Insert a integer value FITS card into a header.
-
-<A NAME="section-1.1.4.3"><H4>ft_headinsr</H4></A>
-
-<P>
- Insert a real value FITS card into a header.
-
-<A NAME="section-1.1.4.4"><H4>ft_headinss</H4></A>
-
-<P>
- Insert a string value FITS card into a header.
-
-<A NAME="section-1.1.4.5"><H4>ft_headinsv</H4></A>
-
-<P>
- Insert a raw value FITS card into a header.
-
-<A NAME="section-1.1.4.6"><H4>ft_headappl</H4></A>
-
-<P>
- Append a logical value FITS card to a header.
-
-<A NAME="section-1.1.4.7"><H4>ft_headappi</H4></A>
-
-<P>
- Append a integer value FITS card to a header.
-
-<A NAME="section-1.1.4.8"><H4>ft_headappr</H4></A>
-
-<P>
- Append a real value FITS card to a header.
-
-<A NAME="section-1.1.4.9"><H4>ft_headapps</H4></A>
-
-<P>
- Append a string value FITS card to a header.
-
-<A NAME="section-1.1.4.10"><H4>ft_headappv</H4></A>
-
-<P>
- Append a raw value FITS card to a header.
-
-<A NAME="section-1.1.4.11"><H4>ft_headdel</H4></A>
-
-<P>
- Find and delete a card from a FITS header.
-
-<p>
-<!-- pnuts --> <a href="headfind.html">[Previous]</a> <a href="headdata.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headins.wu b/funtools/fitsy/doc/headins.wu
deleted file mode 100644
index a9852f4..0000000
--- a/funtools/fitsy/doc/headins.wu
+++ /dev/null
@@ -1,96 +0,0 @@
-Title: headins
-
-
-NAME
-====
- ft_headinsl,ft_headinsi,ft_headinsr,ft_headinss,ft_headinsv,ft_headappl,ft_headappi,ft_headappr,ft_headapps,ft_headappv,ft_headdel
-- Routines to insert, append and delete FITS cards from a header.
-
-SYNOPSIS
-========
-
-
--
-FITSCard ft_headinsl(FITSHead fits, char *name, int n, int lvalue, char *comm, FITSCard here);
-FITSCard ft_headinsi(FITSHead fits, char *name, int n, int ivalue, char *comm, FITSCard here);
-FITSCard ft_headinsr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm, FITSCard here);
-FITSCard ft_headinss(FITSHead fits, char *name, int n, char *svalue, char *comm, FITSCard here);
-FITSCard ft_headinsv(FITSHead fits, char *name, int n, char *vvalue, char *comm, FITSCard here);
-FITSCard ft_headappl(FITSHead fits, char *name, int n, int lvalue, char *comm);
-FITSCard ft_headappi(FITSHead fits, char *name, int n, int ivalue, char *comm);
-FITSCard ft_headappr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm);
-FITSCard ft_headapps(FITSHead fits, char *name, int n, char *svalue, char *comm);
-FITSCard ft_headappv(FITSHead fits, char *name, int n, char *vvalue, char *comm);
-FITSCard ft_headdel(FITSHead fits, char *name, int n);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - FITS header to insert, append or
- delete a card.
- * #"char *name" - Name of the FITS card.
- * #"int n" - keyword index number, if is zero no
- index number is appended to the
- keyword.
- * #"int lvalue" - Logical to format as a FITS value.
- * #"char *comm" - Comment for the new card.
- * #"FITSCard here" - Insert the new card after this card.
- * #"int ivalue" - Integer to format as a FITS value.
- * #"double dvalue" - Double to format as a FITS value.
- * #"int prec" - Precision for the value
- * #"char *svalue" - String to format as a FITS value
- * #"char *vvalue" - Raw value to format as a FITS value
-
-DESCRIPTION
-===========
- These routines allow FITS cards to be inserted, appended and deleted
- by keyword value.
-
- The insertion routines format a new card with the supplied keyword and
- value and insert it after indicated card. The append routines add new
- cards to the end of the header (before the END card).
-
- ft_headinsl
- -----------
- Insert a logical value FITS card into a header.
-
- ft_headinsi
- -----------
- Insert a integer value FITS card into a header.
-
- ft_headinsr
- -----------
- Insert a real value FITS card into a header.
-
- ft_headinss
- -----------
- Insert a string value FITS card into a header.
-
- ft_headinsv
- -----------
- Insert a raw value FITS card into a header.
-
- ft_headappl
- -----------
- Append a logical value FITS card to a header.
-
- ft_headappi
- -----------
- Append a integer value FITS card to a header.
-
- ft_headappr
- -----------
- Append a real value FITS card to a header.
-
- ft_headapps
- -----------
- Append a string value FITS card to a header.
-
- ft_headappv
- -----------
- Append a raw value FITS card to a header.
-
- ft_headdel
- ----------
- Find and delete a card from a FITS header.
diff --git a/funtools/fitsy/doc/headset.html b/funtools/fitsy/doc/headset.html
deleted file mode 100644
index e0a674a..0000000
--- a/funtools/fitsy/doc/headset.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headset
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headget.html">[Previous]</a> <a href="headfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_headsetl,ft_headseti,ft_headsetr,ft_headsets -Fitsy FITS header set routines.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSCard ft_headsetl(FITSHead fits, char *name, int n, int lvalue, char *comm);
-FITSCard ft_headseti(FITSHead fits, char *name, int n, int ivalue, char *comm);
-FITSCard ft_headsetr(FITSHead fits, char *name, int n, double rvalue, int prec, char *comm);
-FITSCard ft_headsets(FITSHead fits, char *name, int n, char *svalue, char *comm);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - FITS header to search in.
- <LI> <B>char *name</B> - keyword name.
- <LI> <B>int n</B> - keyword index number, if is zero no
- index number is appended to the keyword.
- <LI> <B>int lvalue</B> - Logical to format as a FITS value.
- <LI> <B>char *comm</B> - Comment for the card.
- <LI> <B>int ivalue</B> - Integer to format as a FITS value.
- <LI> <B>double rvalue</B> - Double to format as a FITS value.
- <LI> <B>int prec</B> - The value is formatted
- at this precision.
- <LI> <B>char *svalue</B> - String to format as a FITS value.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_headsetl</H4></A>
-
-<P>
- Find a FITS card in the header and format a logical value into it.
-
-<A NAME="section-1.1.4.2"><H4>ft_headseti</H4></A>
-
-<P>
- Find a FITS card in the header and format a logical value into it.
-
-<A NAME="section-1.1.4.3"><H4>ft_headsetr</H4></A>
-
-<P>
- Find a FITS card in the header and format a logical value into it.
-
-<A NAME="section-1.1.4.4"><H4>ft_headsets</H4></A>
-
-<P>
- Find a FITS card in the header and format a logical value into it.
-
-<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A>
-
-<P>
- Set the value part of a card in a header:
-
-<PRE>
- int i = 15;
- double d = 34.7;
- char *c = "Shutter";
-
- FITSCard fits;
- FITSCard card;
-
- card = <B>ft_headsetl</B>(fits, "Cosmic", 0, 1, "Removed Cosimics (silver bullet method)");
- card = <B>ft_headseti</B>(fits, "IValue" , 0, i, "15 is the number");
-
- card = <B>ft_headsetr</B>(fits, "Gain", 1, d, 2, "GAIN1");
- card = <B>ft_headsetr</B>(fits, "Gain", 2, d, 2, "GAIN2");
-
- card = <B>ft_headsets</B>(fits, "XHIST", 1, "Xray processed!", NULL);
-
- /* In this example the special pointer <B>ft_comment</B> is used to
- use the existing comment in the card.
- */
- card = <B>ft_headsets</B>(fits, "FILTER", 0, "V", ft_comment);
-
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="headget.html">[Previous]</a> <a href="headfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headset.wu b/funtools/fitsy/doc/headset.wu
deleted file mode 100644
index 779a7fb..0000000
--- a/funtools/fitsy/doc/headset.wu
+++ /dev/null
@@ -1,78 +0,0 @@
-Title: headset
-
-
-NAME
-====
- ft_headsetl,ft_headseti,ft_headsetr,ft_headsets -Fitsy FITS header set routines.
-
-SYNOPSIS
-========
-
-
--
-FITSCard ft_headsetl(FITSHead fits, char *name, int n, int lvalue, char *comm);
-FITSCard ft_headseti(FITSHead fits, char *name, int n, int ivalue, char *comm);
-FITSCard ft_headsetr(FITSHead fits, char *name, int n, double rvalue, int prec, char *comm);
-FITSCard ft_headsets(FITSHead fits, char *name, int n, char *svalue, char *comm);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - FITS header to search in.
- * #"char *name" - keyword name.
- * #"int n" - keyword index number, if is zero no
- index number is appended to the keyword.
- * #"int lvalue" - Logical to format as a FITS value.
- * #"char *comm" - Comment for the card.
- * #"int ivalue" - Integer to format as a FITS value.
- * #"double rvalue" - Double to format as a FITS value.
- * #"int prec" - The value is formatted
- at this precision.
- * #"char *svalue" - String to format as a FITS value.
-
-DESCRIPTION
-===========
-
- ft_headsetl
- -----------
- Find a FITS card in the header and format a logical value into it.
-
- ft_headseti
- -----------
- Find a FITS card in the header and format a logical value into it.
-
- ft_headsetr
- -----------
- Find a FITS card in the header and format a logical value into it.
-
- ft_headsets
- -----------
- Find a FITS card in the header and format a logical value into it.
-
-EXAMPLES
-========
- Set the value part of a card in a header:
-
-+
- int i = 15;
- double d = 34.7;
- char *c = "Shutter";
-
- FITSCard fits;
- FITSCard card;
-
- card = #ft_headsetl(fits, "Cosmic", 0, 1, "Removed Cosimics (silver bullet method)");
- card = #ft_headseti(fits, "IValue" , 0, i, "15 is the number");
-
- card = #ft_headsetr(fits, "Gain", 1, d, 2, "GAIN1");
- card = #ft_headsetr(fits, "Gain", 2, d, 2, "GAIN2");
-
- card = #ft_headsets(fits, "XHIST", 1, "Xray processed!", NULL);
-
- /* In this example the special pointer #ft_comment is used to
- use the existing comment in the card.
- *-/
- card = #ft_headsets(fits, "FILTER", 0, "V", ft_comment);
-
-+
diff --git a/funtools/fitsy/doc/headtable.html b/funtools/fitsy/doc/headtable.html
deleted file mode 100644
index bcb4229..0000000
--- a/funtools/fitsy/doc/headtable.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE> headtable
-</TITLE>
-<p>
-<!-- pnuts --> <a href="headimage.html">[Previous]</a> <a href="headget.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-
-<A NAME="section-1.1.1"><H3>NAME</H3></A>
-
-<P>
- ft_tableloadhead,ft_tablestorhead,ft_tablefree -Fitsy FITS routines to load
- and store <B>FITSTable</B> structures.
-
-<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A>
-
-
-
-<PRE>
-FITSTable ft_tableloadhead(FITSHead fits);
-void ft_tablestorhead(FITSHead fits, FITSTable table);
-void ft_tablefree(FITSTable table);
-
-
-<P>
-</PRE>
-<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A>
-
-<UL>
-<P>
- <LI> <B>FITSHead fits</B> - Not Documented.
- <LI> <B>FITSTable table</B> - Not Documented.
-
-</UL>
-<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A>
-
-
-<A NAME="section-1.1.4.1"><H4>ft_tableloadhead</H4></A>
-
-<P>
- Allocate and load a <B>FITSTable</B> data structure.
-
-<A NAME="section-1.1.4.2"><H4>ft_tablestorhead</H4></A>
-
-<P>
- Store a <B>FITSTable</B> structure in a FITS header.
-
-<A NAME="section-1.1.4.3"><H4>ft_tablefree</H4></A>
-
-<P>
- Free a <B>FITSTable</B> structure.
-
-<p>
-<!-- pnuts --> <a href="headimage.html">[Previous]</a> <a href="headget.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/headtable.wu b/funtools/fitsy/doc/headtable.wu
deleted file mode 100644
index 0c0f42f..0000000
--- a/funtools/fitsy/doc/headtable.wu
+++ /dev/null
@@ -1,38 +0,0 @@
-Title: headtable
-
-
-NAME
-====
- ft_tableloadhead,ft_tablestorhead,ft_tablefree -Fitsy FITS routines to load
- and store #FITSTable structures.
-
-SYNOPSIS
-========
-
-
--
-FITSTable ft_tableloadhead(FITSHead fits);
-void ft_tablestorhead(FITSHead fits, FITSTable table);
-void ft_tablefree(FITSTable table);
-
-
--
-PARAMETERS
-==========
- * #"FITSHead fits" - Not Documented.
- * #"FITSTable table" - Not Documented.
-
-DESCRIPTION
-===========
-
- ft_tableloadhead
- ----------------
- Allocate and load a #FITSTable data structure.
-
- ft_tablestorhead
- ----------------
- Store a #FITSTable structure in a FITS header.
-
- ft_tablefree
- ------------
- Free a #FITSTable structure.
diff --git a/funtools/fitsy/doc/imageval.html b/funtools/fitsy/doc/imageval.html
deleted file mode 100644
index 6811e73..0000000
--- a/funtools/fitsy/doc/imageval.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<p>
-<!-- pnuts --> <a href="basicval.html">[Previous]</a> <a href="tableval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-<A NAME="section-1.1.1"><H3>Image FITS Values</H3></A>
-
-
-<P>
- When a FITS header is scanned in memory or read from a file several
- image values are retrieved from the header and stored in s <B>FITSImage</B>
- structure. This structure may be accesed with the following macros:
-
-<PRE>
- #define <B>ft_hasbscale</B>(fits) ( fits-&gt;image-&gt;has_bscale )
- #define <B>ft_bscale</B>(fits) ( fits-&gt;image-&gt;bscale )
- #define <B>ft_hasbzero</B>(fits) ( fits-&gt;image-&gt;has_bzero )
- #define <B>ft_bzero</B>(fits) ( fits-&gt;image-&gt;bzero )
- #define <B>ft_hasblank</B>(fits) ( fits-&gt;image-&gt;has_blank )
- #define <B>ft_blank</B>(fits) ( fits-&gt;image-&gt;blank )
-
- typedef struct <B>FITSImage</B> {
- int has_bscale;
- int bscale;
- int has_bzero;
- int bzero;
-
- int has_blank;
- int blank;
- } <B>*FITSImage</B>;
-<P>
-</PRE>
-
-
-<p>
-<!-- pnuts --> <a href="basicval.html">[Previous]</a> <a href="tableval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/imageval.wu b/funtools/fitsy/doc/imageval.wu
deleted file mode 100644
index e5ab468..0000000
--- a/funtools/fitsy/doc/imageval.wu
+++ /dev/null
@@ -1,27 +0,0 @@
-
-Image FITS Values
-=================
-
- When a FITS header is scanned in memory or read from a file several
- image values are retrieved from the header and stored in s #FITSImage
- structure. This structure may be accesed with the following macros:
-
-+
- ##define #ft_hasbscale(fits) ( fits->image->has_bscale )
- ##define #ft_bscale(fits) ( fits->image->bscale )
- ##define #ft_hasbzero(fits) ( fits->image->has_bzero )
- ##define #ft_bzero(fits) ( fits->image->bzero )
- ##define #ft_hasblank(fits) ( fits->image->has_blank )
- ##define #ft_blank(fits) ( fits->image->blank )
-
- typedef struct #FITSImage {
- int has_bscale;
- int bscale;
- int has_bzero;
- int bzero;
-
- int has_blank;
- int blank;
- } #"*FITSImage";
-+
-
diff --git a/funtools/fitsy/doc/makefile-sao b/funtools/fitsy/doc/makefile-sao
deleted file mode 100644
index 6f33d5e..0000000
--- a/funtools/fitsy/doc/makefile-sao
+++ /dev/null
@@ -1,51 +0,0 @@
-SHELL = /bin/sh
-
-WU = cardpar.wu \
- cardfmt.wu \
- cardins.wu \
- cardfind.wu \
- headget.wu \
- headset.wu \
- headins.wu \
- headinit.wu \
- headdata.wu \
- headfind.wu \
- headfile.wu \
- headimage.wu \
- headtable.wu \
- dataimage.wu \
- fitsimage.wu
-
-HTML = fitsy.html \
- basicval.html \
- imageval.html \
- tableval.html \
- cardpar.html \
- cardfmt.html \
- cardins.html \
- cardfind.html \
- headinit.html \
- headdata.html \
- headfile.html \
- headget.html \
- headset.html \
- headins.html \
- headfind.html \
- headimage.html \
- headtable.html \
- dataimage.html \
- fitsimage.html
-
-doc: html
-
-clean:
- rm -f core *.a *.o *.bak $(WU) $(HTML)
-
-mostlyclean: clean
-
-html:
- wu srcdir=../ pnuts=fitsy.pnuts $(HTML)
-
-
-include $(MMTIMAKEFILE)
-
diff --git a/funtools/fitsy/doc/tableval.html b/funtools/fitsy/doc/tableval.html
deleted file mode 100644
index b069502..0000000
--- a/funtools/fitsy/doc/tableval.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<p>
-<!-- pnuts --> <a href="imageval.html">[Previous]</a> <a href="headimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-<META NAME="generator" CONTENT="txt2html v1.3">
-</HEAD>
-<BODY>
-
-<A NAME="section-1.1.1"><H3>Table FITS Values</H3></A>
-
-
-<P>
- When a FITS header is scanned in memory or read from a file several
- table values are retrieved from the header and stored in the <B>FITSTable.</B>
- This structure may be accesed with the following macros:
-
-<PRE>
- typedef struct <B>FITSTCol</B> {
- int type;
- int n;
- int size;
- int width;
- int offset;
- char *format;
-
- int heap;
-
- char *name;
- char *unit;
- char *disp;
-
- int prec;
-
- int has_scale;
- double scale;
- int has_zero;
- double zero;
-
- int has_blank;
- char *ablank;
- double dblank;
- } <B>*FITSTCol</B>;
-
- typedef struct <B>FITSTable</B> {
- int tabtype; /* TABLE or BINTABLE */
- int tfields; /* # of fields */
- FITSTCol col; /* Column pointers */
- } <B>*FITSTable</B>;
-<P>
-</PRE>
-
-<p>
-<!-- pnuts --> <a href="imageval.html">[Previous]</a> <a href="headimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a>
-</BODY>
-</HTML>
diff --git a/funtools/fitsy/doc/tableval.wu b/funtools/fitsy/doc/tableval.wu
deleted file mode 100644
index ae5ff39..0000000
--- a/funtools/fitsy/doc/tableval.wu
+++ /dev/null
@@ -1,41 +0,0 @@
-
-Table FITS Values
-=================
-
- When a FITS header is scanned in memory or read from a file several
- table values are retrieved from the header and stored in the #FITSTable.
- This structure may be accesed with the following macros:
-
-+
- typedef struct #FITSTCol {
- int type;
- int n;
- int size;
- int width;
- int offset;
- char *format;
-
- int heap;
-
- char *name;
- char *unit;
- char *disp;
-
- int prec;
-
- int has_scale;
- double scale;
- int has_zero;
- double zero;
-
- int has_blank;
- char *ablank;
- double dblank;
- } #"*FITSTCol";
-
- typedef struct #FITSTable {
- int tabtype; /* TABLE or BINTABLE */
- int tfields; /* # of fields */
- FITSTCol col; /* Column pointers */
- } #"*FITSTable";
-+
diff --git a/funtools/fitsy/fitsfile.c b/funtools/fitsy/fitsfile.c
deleted file mode 100644
index 035726c..0000000
--- a/funtools/fitsy/fitsfile.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Fitsy FITS routines to handle a complete multi extension FITS file.
- */
-
-typedef struct Ft_fileread {
- int n;
- int flag;
- int pixtype;
-} Ft_fileread;
-
-ft_fileimageread(file, fits, data, x)
- File file;
- FITSHead fits;
- FITSFile *data;
- Ft_fileread *x;
-{
- int size;
-
- (void)ReAlloc(*data, sizeof(struct FITSFile) * ++x->n);
-
- (*data)[x->n-1].bitpix = x->pixtype;
-
- if ( x->flag || ft_seek(fits) == -1 ) {
- if ( ((*data)[x->n-1].data = ft_dataread(file, fits, NULL, x->pixtype))
- == NULL ) {
- return 0;
- }
- }
-}
-
-/* Read an entire FITS file.
- */
-FITSFile ft_fileread(file, flag, pixtype, n)
- File file;
- int flag;
- int pixtype;
- int *n;
-{
- Ft_fileread x;
- FITSFile data;
-
- x.n = 0;
- x.flag = flag;
- x.pixtype = pixtype;
-
- data = (FITSFile) ft_fileparse(file, ft_fileimageread, &x);
- *n = x.n;
-
- return data;
-}
-
-/* Return a pointer the data poriton of a FITS HDU.
- */
-void *ft_filedata(file, ft)
- File file;
- FITSFile ft;
-{
- if ( ft->data != NULL ) return ft->data;
- if ( ft_seek(ft->head) == -1 ) return NULL;
-
- if ( ftSeek(file, ft_seek(ft->head), 0) == -1 )
- return NULL;
-
- return ft->data = ft_dataread(file, ft->head, NULL, ft->bitpix);
-}
-
diff --git a/funtools/fitsy/fitshead.c b/funtools/fitsy/fitshead.c
deleted file mode 100644
index 01dfea2..0000000
--- a/funtools/fitsy/fitshead.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/* Fitsy FITS routines to read and write FITS headers.
- */
-
-#include <xos.h>
-#include "fitsy.h"
-
-#define MAX_COPY 1024
-static int ncopy_file=0;
-static File copy_files[MAX_COPY];
-
-static int GetWordType(fptr, tbuf, cflag)
- char **fptr;
- char *tbuf;
- int *cflag;
-{
- int alpha, digit, other, got;
- char *f, *t;
-
- /* start out clean */
- *tbuf = '\0';
-
- /* gather up characters until we have a delim */
- for(got=0, alpha=0, digit=0, other=0, f=*fptr, *tbuf='\0', t=tbuf;
- (*f!='\0') && (*f!=',') && (*f!=']');
- got++){
- if( isdigit((unsigned int)*f) ){
- digit++;
- *t++ = *f++;
- }
- else if( isalpha((unsigned int)*f) || (*f == '_') || (*f == '$') ){
- alpha++;
- *t++ = *f++;
- }
- /* special case: extension or index ending with '+' means copy extension */
- else if( (*f=='+') && ((*(f+1)=='\0') || (*(f+1)==',') || (*(f+1)==']')) ){
- /* don't add '+' to output, but inc past it in input */
- f++;
- /* we got the 'copy extension' flag */
- *cflag = 1;
- }
- else{
- /* - might be part of an extension */
- if( (*f=='-') && got && !other )
- alpha++;
- else
- other++;
- *t++ = *f++;
- }
- }
- /* null terminate working string */
- *t = '\0';
-
- /* update pointer */
- *fptr = f;
-
- /* determine what sort of beast we have and return */
- if( got == 0 )
- return(0);
- else if( other >0 )
- return(3);
- else if( (digit>0) && (alpha==0) )
- return(2);
- else
- return(1);
-}
-
-
-/*
- *
- * ft_parsefilename -- break a string into name, extension, index, tail
- * The possibilities are:
- *
- * name[extn], name[extn,index], name[index]
- * name[extn,tail], name[extn,index,tail], name[index,tail]
- *
- * where:
- * extn is composed of alphanumerics, index is numeric, tail is anything
- * and commas are separators.
- *
- * returns 1 if 'copy flag' was set (+extn, extn+, +index, index+), else 0
- *
- *
- */
-int ft_parsefilename(filename, name, extn, nmaxlen, indx, tail, tmaxlen)
- char *filename;
- char *name;
- char *extn;
- int nmaxlen;
- int *indx;
- char *tail;
- int tmaxlen;
-{
- char *f, *t;
- char *tbuf, *tbuf2;
- int i, len;
- int got;
- int cflag;
-
- /* start out clean */
- *extn = '\0';
- *indx = -1;
- *tail = '\0';
- cflag = 0;
-
- /* make sure we have something to work with */
- if( (filename == NULL) || (*filename == '\0') )
- return 0;
-
- /* handle pipe: specification specially */
- if( !strncasecmp(filename, "pipe:", 5) ){
- strncpy(name, filename, nmaxlen);
- return 0;
- }
-
- /* basic work buffers */
- tbuf = (char *)malloc(strlen(filename)+1);
- tbuf2 = (char *)malloc(strlen(filename)+1);
-
- /* this will be our pointer into the filename buffer */
- f = filename;
-
- /* maxlen generally is 1 more than we can handle */
- nmaxlen--;
- tmaxlen--;
-
- /* gather up the name */
- for(*tbuf='\0', t=tbuf; (*f!='\0') && (*f!='[') && (*f!=','); )
- *t++ = *f++;
- /* null terminate working string */
- *t = '\0';
- /* copy max from the work buffer to the name buffer */
- strncpy(name, tbuf, nmaxlen);
- name[nmaxlen] = '\0';
- /* check for done */
- if( *f == '\0' )
- goto cleanup;
- /* or skip past '[' delim following the name */
- else
- f++;
-
- /* get token and process type */
- switch(GetWordType(&f, tbuf, &cflag)){
- /* EOF */
- case 0:
- break;
- /* extn */
- case 1:
- strcpy(extn, tbuf);
- *tbuf = '\0';
- if( *f == ',' ){
- f++;
- switch(GetWordType(&f, tbuf, &cflag)){
- case 2:
- *indx = strtol(tbuf, NULL, 10);
- *tbuf = '\0';
- if( *f == ',' )
- f++;
- break;
- default:
- break;
- }
- }
- break;
- /* index */
- case 2:
- *indx = strtol(tbuf, NULL, 10);
- *tbuf = '\0';
- if( *f == ',' )
- f++;
- break;
- /* tail */
- case 3:
- break;
- }
-
- /* at this point, we are processing tail */
- strcpy(tbuf2, "[");
- if( *tbuf != '\0' )
- strcat(tbuf2, tbuf);
- if( *f != '\0' )
- strcat(tbuf2, f);
- strncpy(tail, tbuf2, tmaxlen);
- tail[tmaxlen] = '\0';
- /* get rid of any empty brackets */
- len = strlen(tail);
- for(i=0; i<len; i++){
- if( (tail[i] == '[') && (i+2 < len) && (tail[i+1] == ']') ){
- strcpy(tbuf, &(tail[i+2]));
- strcpy(&(tail[i]), tbuf);
- }
- }
- /* but don't bother passing back completely null brackets */
- len = strlen(tail);
- for(got=0, i=0; i<len; i++){
- if( (tail[i] != '[') && (tail[i] != ']') && (tail[i] != ' ') ){
- got = 1;
- break;
- }
- }
- if( !got ) *tail = '\0';
-
- /* clean up */
-cleanup:
- if( tbuf != NULL )
- free(tbuf);
- if( tbuf2 != NULL )
- free(tbuf2);
- return cflag;
-}
-
-/*
- *
- * ft_cfile -- change the static copy_file handle
- * This is used to set/unset the copy handle for when we open a fits file
- * (There is no other good place to store this copy handle!)
- * returns: old handle
- *
- */
-int ft_cfile(cfile)
- File cfile;
-{
- if( cfile ){
- if( ncopy_file >= MAX_COPY ) return -1;
- copy_files[ncopy_file++] = cfile;
- }
- else{
- ncopy_file = 0;
- }
- return ncopy_file;
-}
-
-/* Read a FITS header from the named file -- primitive of ft_fitsheadopen()
- */
-File ft_fitsheadread(file, filename, header, mode, iline, ifd)
- File file;
- char *filename; /* FITS image file name. */
- FITSHead *header;
- char *mode;
- char iline[FT_CARDLEN];
- File *ifd;
-{
- FITSHead prim = NULL;
- FITSHead head = NULL;
- char name[FT_FILENAME];
- char extn[FT_FILENAME];
- char tail[FT_FILENAME];
- char tbuf[FT_CARDLEN];
- char *e;
- char *i;
- char *tptr;
- int indx = 0;
- int len = FT_FILENAME;
- int tlen;
- int n;
- int nc;
- static int vlaerr=0;
-
- /* if the user called the wrong routine, fix it */
- if( !file ) return NULL;
-
- /* initialize return values */
- if( iline ) iline[0] = '\0';
- if( ifd ) *ifd = file;
-
- /* parse filename into extension, index, and tail */
- ft_parsefilename(filename, name, extn, len, &indx, tail, len);
-
- /* make sure this is a FITS file by looking at the first card */
- tptr = (iline ? iline : tbuf);
- if( ( !ftGets(file, tptr, 10) ) ||
- (strncmp(tptr, "SIMPLE =", 9) && strncmp(tptr, "XTENSION=", 9)) ){
- /* pass back opened file so someone else can make an attempt */
- if( !ifd ) ftClose(file);
- return NULL;
- }
- tlen = strlen(tptr);
- if( ftRead(file, &tptr[tlen], FT_CARDLEN-tlen, 1) != 1 ){
- /* pass back opened file so someone else can make an attempt */
- if( !ifd ) ftClose(file);
- return NULL;
- }
-
- /* don't return anything anymore, both ifd and line were used already */
- if( iline ){
- memcpy(tbuf, iline, FT_CARDLEN);
- iline[0] = '\0';
- }
- if( ifd ) *ifd = NULL;
-
- /* read primary header */
- if ( (prim = ft_headread0(file, tbuf, FT_CARDLEN)) == NULL ){
- ftClose(file);
- return NULL;
- }
-
- /* Only look in the environment if the primary header
- has no data and the user hasn't specified any thing
- in the brackets.
- */
- if ( ft_databytes(prim) == 0 && !*extn && indx == -1 ) {
- if ( (e = (char *)getenv("FITS_EXTNAME")) ) {
- strncpy(extn, e, len);
- extn[len-1] = '\0';
- }
- if ( (i = (char *)getenv("FITS_EXTNUM")) ) {
- indx = atoi(i);
- }
- }
-
- head = prim;
- if ( *extn ) { /* Extension and possible an index */
- do {
- char *ext=NULL;
- char *extcopy=(char *)strdup(extn);
- for(ext=(char *)strtok(extcopy," :;,");
- ext!=NULL;
- ext=(char *)strtok(NULL," :;,")){
- /* look for extname, then hduname, along with indx */
- if ( ((ft_name(head) && *ft_name(head) &&
- !strcasecmp(ext, ft_name(head))) ||
- (ft_hduname(head) && *ft_hduname(head) &&
- !strcasecmp(ext, ft_hduname(head)))) &&
- (indx == -1 || indx == ft_extn(head)) )
- break;
- }
- if( extcopy )
- free(extcopy);
- /* if we matched an extension, we are done */
- if( ext )
- break;
-
- /* copy header, if necessary */
- if( ncopy_file ){
- for(nc=0; nc<ncopy_file; nc++)
- ft_headwrite(copy_files[nc], head);
- }
- /* skip data, copying header if necessary */
- ft_dataskip(file, head, copy_files, ncopy_file);
-
- if ( head != prim ) ft_headfree(head, 1);
- } while ( (head = ft_headread(file)) );
-
- if ( !head ) {
- ft_headfree(prim, 1);
- ftClose(file);
- return NULL;
- }
- } else if ( indx > 0 ) { /* Extension index, not == 0 */
- int i;
-
- /* copy header, if necessary */
- if( ncopy_file ){
- for(nc=0; nc<ncopy_file; nc++)
- ft_headwrite(copy_files[nc], head);
- }
- ft_dataskip(file, prim, copy_files, ncopy_file);
-
- for ( i = 1; i <= indx; i++ ) {
- if ( (head = ft_headread(file)) == NULL ) {
- ft_headfree(prim, 1);
- ftClose(file);
- return NULL;
- }
- if( i != indx ){
- /* copy header, if necessary */
- if( ncopy_file ){
- for(nc=0; nc<ncopy_file; nc++)
- ft_headwrite(copy_files[nc], head);
- }
- /* skip data, copying header if necessary */
- ft_dataskip(file, head, copy_files, ncopy_file);
- ft_headfree(head, 1);
- }
- }
- }
-
- if ( head != prim ){
- ft_primlink(prim, head); /* Link the primary to the header */
- /* this primary header only exists as part of head */
- prim->rfcount = 1;
- }
-
- /* if this is a table and contains a variable length array, issue wanring */
- if( head && head->table && !vlaerr ){
- for ( n = 1; n <= head->table->tfields; n++ ) {
- if ( head->table->col[n-1].vla ){
- fprintf(stderr,
- "WARNING: The 'variable length array' is not part of the FITS Bintable standard. ");
- fprintf(stderr,
- "Funtools will pass it along, but will not process it.\n");
- vlaerr++;
- break;
- }
- }
- }
-
- if( header != NULL ){
- *header = head;
- }
-
- return file;
-}
-
-/* Read a FITS header from the named file.
- */
-File ft_fitsheadopen(filename, header, tail, len, mode)
- char *filename; /* FITS image file name. */
- FITSHead *header;
- char *tail;
- int len;
- char *mode;
-{
- return ft_fitsheadopenfd(filename, header, tail, len, mode, NULL,
- NULL, NULL);
-}
-
-/* Read a FITS header from the named file.
- */
-File ft_fitsheadopenfd(filename, header, tail, len, mode, file, iline, ifd)
- char *filename; /* FITS image file name. */
- FITSHead *header;
- char *tail;
- int len;
- char *mode;
- File file;
- char iline[FT_CARDLEN];
- File *ifd;
-{
- char *xmode;
- char name[FT_FILENAME];
- char extn[FT_FILENAME];
- int indx = 0;
- int cflag;
-
- /* initialize return values */
- if( iline ) iline[0] = '\0';
- if( ifd ) *ifd = NULL;
-
- /* parse filename into extension, index, and tail */
- cflag = ft_parsefilename(filename, name, extn, FT_FILENAME, &indx,
- tail, len);
-
- /* set mode or use 'r' as default */
- if( mode ){
- xmode = mode;
- }
- else
- xmode = "r";
-
- /* see if 'CopyExtension' mode was explicitly set in the mode */
- if( strchr(xmode, 'C') )
- cflag = 1;
- /* else see if it was set in the section and is permitted by the mode */
- else if( strchr(xmode, 'c') && cflag )
- cflag = 1;
- /* else we do not copy */
- else
- cflag = 0;
-
- if( !file ){
- if ( (file = ftOpen(name, xmode)) == NULL )
- return NULL;
- }
-
- /* if the "copy extension" flag was set, we can exit here */
- if( cflag ){
- /* flag header was not created */
- if( header )
- *header = NULL;
- return file;
- }
-
- /* now read the file up to the specified extension */
- file = ft_fitsheadread(file, filename, header, xmode, iline, ifd);
-
- /* save filename */
- if( file && header && *header && *name ){
- if( (*header)->filename ) (void)Free((*header)->filename);
- (*header)->filename = strdup(name);
- }
-
- return file;
-}
diff --git a/funtools/fitsy/fitsimage.c b/funtools/fitsy/fitsimage.c
deleted file mode 100644
index 516f7e1..0000000
--- a/funtools/fitsy/fitsimage.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/* Fitsy FITS routines to read and write FITS images.
- */
-
-#include <xos.h>
-#include <fcntl.h>
-#include "fitsy.h"
-
-#include <sys/types.h>
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#include <sys/stat.h>
-
-#ifdef HAVE_SYS_IPC_H
-#include <sys/ipc.h>
-#endif
-#ifdef HAVE_SYS_SHM_H
-#include <sys/shm.h>
-#endif
-
-/* int close PROTOTYPE((int)); */
-
-int ft_indxmemdata PROTOTYPE((
- char *data, /* Pointer to FITS */
- int size,
- int type, /* Type of memory */
- char *extn,
- int indx,
- FITSHead *headptr, /* Returned pointer to FITS header */
- void **dataptr, /* Returned pointer to FITS data. */
- void ***data2dptr /* Returned edge vector to data. */));
-
-/* changed name to add _ to avoid conflict with param lib egm 4/25/00 */
-int _filesize(file)
- int file;
-{
- struct stat info;
-
- if ( fstat(file, &info) < 0 ) return 0;
- else return info.st_size;
-}
-
-#ifdef HAVE_SYS_MMAN_H
-int ft_munmap(head)
- FITSHead head;
-{
- return munmap((caddr_t) head->mmap_here, head->mmap_size);
-}
-#endif
-
-#ifdef HAVE_SYS_SHM_H
-int ft_shmdt(head)
- FITSHead head;
-{
- return shmdt((caddr_t) head->mmap_here);
-}
-#endif
-
-#ifdef HAVE_SYS_SHM_H
-/* Attach a FITS image from shared memory.
- */
-
-int ft_simpleimageshm(filename, headptr, dataptr, data2dptr, size, flags)
- char *filename;
- FITSHead *headptr; /* Returned pointer to FITS header */
- void **dataptr; /* Returned pointer to FITS data. */
- void ***data2dptr; /* Returned edge vector to data. */
- int size;
- int flags;
-{
- char name[FT_FILENAME];
- char extn[FT_FILENAME];
- int indx = 0;
-
- char tail[FT_FILENAME];
- int max = FT_FILENAME;
-
- int shkey;
- char *data;
-
- char *isize;
-
- ft_parsefilename(filename, name, extn, max, &indx, tail, max);
-
- if ( size == 0 && (isize = strstr(tail, "size=")) ) size = atoi(isize+5);
-
- /* Attach the memory segment
- */
- shkey = shmget(atoi(name), size, flags);
- data = (void *) shmat(shkey, 0, 0);
-
- return ft_indxmemdata(data, size, FT_SHMAT, extn, indx, headptr, dataptr, data2dptr);
-}
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-/* MMap a FITS image from the named file.
- */
-int ft_simpleimagemmap(filename, headptr, dataptr, data2dptr, prot, share)
- char *filename; /* FITS image file name. */
- FITSHead *headptr; /* Returned pointer to FITS header */
- void **dataptr; /* Returned pointer to FITS data. */
- void ***data2dptr; /* Returned edge vector to data. */
- int prot; /* Mapped data protections */
- int share; /* Mapped data attributes */
-{
- int file;
-
- char name[FT_FILENAME];
- char extn[FT_FILENAME];
- int indx = 0;
-
- char tail[FT_FILENAME];
- int max = FT_FILENAME;
-
- char *data;
- int size;
- int mode;
-
- ft_parsefilename(filename, name, extn, max, &indx, tail, max);
-
- if ( prot & PROT_WRITE ) {
- mode = O_RDWR;
- } else {
- mode = O_RDONLY;
- }
-
- if ( (file = open(name, mode)) == -1) {
- if ( headptr ) *headptr = NULL;
- if ( data2dptr ) *data2dptr = NULL;
-
- return 0;
- }
-
- /* Map the file.
- */
- size = _filesize(file);
- data = (char *) mmap(NULL, size, prot, share, file, 0);
- close(file);
-
- if ( data == (char *)-1 ) return 0;
-
- return ft_indxmemdata(data, size, FT_MMAP, extn, indx, headptr, dataptr, data2dptr);
-}
-#endif
-
-#if defined(HAVE_SYS_SHM_H) || defined(HAVE_SYS_MMAN_H)
-int ft_indxmemdata(data, size, type, extn, indx, headptr, dataptr, data2dptr)
- char *data; /* Pointer to FITS */
- int size;
- int type; /* Type of memory */
- char *extn;
- int indx;
- FITSHead *headptr; /* Returned pointer to FITS header */
- void **dataptr; /* Returned pointer to FITS data. */
- void ***data2dptr; /* Returned edge vector to data. */
-{
- FITSHead head = NULL;
-
- char *here = (char *) data;
- void *mapdata = data;
- int mapsize = size;
-
- if ( *extn ) {
- while ( (head = ft_headinit(here, size)) && size >= FT_BLOCK ) {
- if ( !strcmp(extn, ft_name(head))
- && (indx == -1 || indx == ft_extn(head)) ) break;
- here += ft_data(head) + ft_databloks(head) * FT_BLOCK;
- size -= ft_data(head) + ft_databloks(head) * FT_BLOCK;
- ft_headfree(head, 0);
- }
- } else if ( indx > 0 ) {
- int i;
-
- for ( i = 0; i < indx && size >= FT_BLOCK; i++ ) {
- head = ft_headinit(here, size);
- if( !head ){
- if ( headptr ) *headptr = NULL;
- if ( data2dptr ) *data2dptr = NULL;
-
- return 0;
- }
- here += ft_data(head) + ft_databloks(head) * FT_BLOCK;
- size -= ft_data(head) + ft_databloks(head) * FT_BLOCK;
- ft_headfree(head, 0);
- }
- head = ft_headinit(here, size);
- data = here + ft_data(head);
-
- } else {
- head = ft_headinit(data, size);
- data = here + ft_data(head);
- }
-
- if ( head == NULL ) {
- switch(type){
-#ifdef HAVE_SYS_MMAN_H
- case FT_MMAP:
- munmap(data, mapsize);
- break;
-#endif
-#ifdef HAVE_SYS_SHM_H
- case FT_SHMAT:
- shmdt(mapdata);
- break;
-#endif
- default:
- break;
- }
- return 0;
- }
-
- head->mem = type;
- head->mmap_here = mapdata;
- head->mmap_size = mapsize;
-
- if ( dataptr != NULL ) *dataptr = data;
- if ( data2dptr != NULL ) {
- *data2dptr = (void **) ft_make2d((void *) data
- , Abs(ft_bitpix(head))/8
- , 0, 0
- , ft_naxis(head, 1)
- , ft_naxis(head, 2));
- }
- if ( headptr != NULL ) {
- *headptr = head;
- } else {
- ft_headfree(head, 0);
- }
-
- return 1;
-}
-#endif
-
-/* Read a FITS image from the named file.
- */
-int ft_simpleimageread(filename, headptr, dataptr, data2dptr, pixtype)
- char *filename; /* FITS image file name. */
- FITSHead *headptr; /* Returned pointer to FITS header */
- void **dataptr; /* Returned pointer to FITS data. */
- void ***data2dptr; /* Returned edge vector to data. */
- int pixtype; /* pixtype to convert data to. */
-{
- FITSHead head = NULL;
- File file;
- int ret = 1;
-
- char name[FT_FILENAME];
- char extn[FT_FILENAME];
- int indx = 0;
-
- char tail[FT_FILENAME];
- int max = FT_FILENAME;
-
- ft_parsefilename(filename, name, extn, max, &indx, tail, max);
-
- if ( (file = ftOpen(name, "r")) == NULL ) {
- if ( headptr ) *headptr = NULL;
- if ( data2dptr ) *data2dptr = NULL;
-
- return 0;
- }
-
- if ( *extn ) {
- while ( (head = ft_headread(file)) ) {
- if ( !strcmp(extn, ft_name(head))
- && (indx == -1 || indx == ft_extn(head)) ) break;
- ft_dataskip(file, head, NULL, 0);
- ft_headfree(head, 1);
- }
- } else if ( indx > 0 ) {
- int i;
-
- for ( i = 0; i < indx; i++ ) {
- head = ft_headread(file);
- if( !head ){
- if ( headptr ) *headptr = NULL;
- if ( data2dptr ) *data2dptr = NULL;
-
- return 0;
- }
- ft_dataskip(file, head, NULL, 0);
- ft_headfree(head, 1);
- }
- head = NULL;
- }
-
- ret = ft_imageread(file, &head, dataptr, data2dptr, pixtype);
- if ( headptr ){
- *headptr = head;
- if( *name && *headptr ) (*headptr)->filename = strdup(name);
- }
- else{
- ft_headfree(head, 1);
- }
- ftClose(file);
-
- return ret;
-}
-
-/* Write a FITS image to a named file.
- */
-int ft_simpleimagewrite(filename, fits, data, pixtype)
- char *filename;
- FITSHead fits; /* FITS header to write. */
- void *data; /* Data to write into FITS file. */
- int pixtype;
-{
- File file;
- FITSHead prim;
-
- if ( fits == NULL ) return 0;
-
- file = ftOpen(filename, "wb");
-
- if (file == NULL) {
- return 0;
- }
-
- prim = ft_primary(fits);
-
- ft_imagewrite(file, prim, data, pixtype);
- ftClose(file);
-
- ft_headfree(prim, 1);
- return 1;
-}
-
-/* Read a FITS image from a file pointer.
- */
-int ft_imageread(file, headptr, dataptr, data2dptr, pixtype)
- File file; /* File pointer to read header and data from.*/
- FITSHead *headptr;
- void **dataptr;
- void ***data2dptr;
- int pixtype;
-{
- FITSHead fits;
- float *data = NULL;
-
- if ( file == NULL ) return 0;
-
- if ( headptr == NULL || *headptr == NULL ) {
- if ( (fits = ft_headread(file)) == NULL ) return 0;
- } else fits = *headptr;
-
- if ( dataptr ) data = *dataptr;
- if ( data2dptr ) *data2dptr = NULL;
-
-
- if ( (data = ft_dataread(file, fits, data, pixtype)) == NULL ) {
- if ( !headptr ) ft_headfree(fits, 1);
- return 0;
- }
-
- if ( headptr != NULL ) {
- *headptr = fits;
- }
-
- if ( dataptr != NULL ) {
- *dataptr = data;
- }
-
- if ( data2dptr != NULL ) {
- *data2dptr = (void **) ft_make2d((void *) data
- , Abs(pixtype)/8
- , 0, 0
- , ft_naxis(fits, 1)
- , ft_naxis(fits, 2));
- }
-
- return 1;
-}
-
-
-/* Write a FITS image to a file.
- */
-int ft_imagewrite(file, fits, data, pixtype)
- File file;
- FITSHead fits;
- void *data;
- int pixtype;
-{
- if ( file == NULL ) return 0;
-
- ft_syncdata(fits);
- if ( ft_headwrite(file, fits) == 0 ) return 0;
- if ( ft_datawrite(file, fits, data, pixtype) == 0 ) return 0;
-
- return 1;
-}
-
diff --git a/funtools/fitsy/fitsy.h b/funtools/fitsy/fitsy.h
deleted file mode 100644
index 182be0e..0000000
--- a/funtools/fitsy/fitsy.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/* Fitsy FITS Image Library.
- */
-
-#ifndef FITSY_H
-#define FITSY_H
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if USE_XFILEIO
-#include "xfileio.h"
-#else
-#include "xfile.h"
-#endif
-
-#ifdef __STDC__
-#define PROTOTYPE(X) X
-#else
-#define PROTOTYPE(X) ( )
-#endif
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <ctype.h>
-
-#include "longlong.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define FT_BITS 23040
-#define FT_BLOCK 2880
-#define FT_CARDLEN 80
-#define FT_WORDLEN 8
-#define FT_CARDS (FT_BLOCK/FT_CARDLEN)
-
-#define FT_UNSIGNED 0x1000
-#define FT_BITPIX -1
-
-#define FT_FILENAME 4096
-#define FT_MAXAXES 10
-
-#define ft_fitsbloks(bytes) ((bytes+(FT_BLOCK-1))/FT_BLOCK)
-
-/* Card memory types
- */
-#define FT_MALLOC 1
-#define FT_MMAP 2
-#define FT_SHMAT 3
-#define FT_EXTERN 4
-
-typedef enum {
- FT_UNKNOWN = 0
- , FT_COMMENT
- , FT_LOGICAL
- , FT_INTEGER
- , FT_STRING
- , FT_VALUE
- , FT_REAL
- , FT_COMPLEX
- , FT_LONG
-} FITSType;
-
-typedef struct _FITSBuff {
- char c[FT_CARDLEN];
-} FITSBuff;
-
-typedef FITSBuff *FITSCard;
-
-extern char *FT_Comment;
-
-#define ft_simple(fits) ( fits->basic->simple )
-#define ft_name(fits) ( fits->basic->name )
-#define ft_hduname(fits) ( fits->basic->hduname )
-#define ft_extn(fits) ( fits->basic->extn )
-#define ft_bitpix(fits) ( fits->basic->bitpix )
-#define ft_naxes(fits) ( fits->basic->naxes )
-#define ft_naxis(fits, i) ( fits->basic->naxis[i-1])
-#define ft_pcount(fits) ( fits->basic->pcount )
-#define ft_gcount(fits) ( fits->basic->gcount )
-#define ft_databytes(fits) ( fits->basic->databytes)
-#define ft_datapixls(fits) ( fits->basic->datapixls)
-#define ft_databloks(fits) ( fits->basic->databloks)
-#define ft_rowbytes(fits) ( fits->basic->row_bytes)
-
-typedef struct _FITSBasic {
- int simple;
- char *name;
- char *hduname;
- int extn;
-
- int bitpix;
- int naxes;
- int naxis[FT_MAXAXES];
-
- int gcount;
- int pcount;
-
- size_t databytes;
- int datapixls;
- size_t databloks;
- int row_bytes;
-} *FITSBasic;
-
-
-#define ft_hasbscale(fits) ( fits->image->has_bscale )
-#define ft_bscale(fits) ( fits->image->dbscale )
-#define ft_hasbzero(fits) ( fits->image->has_bzero )
-#define ft_bzero(fits) ( fits->image->dbzero )
-#define ft_hasscaling(fits) ( fits->image->has_bzero || fits->image->has_bscale )
-#define ft_hasblank(fits) ( fits->image->has_blank )
-#define ft_blank(fits) ( fits->image->blank )
-
-typedef struct _FITSLinWCS {
- int has_wcs;
-
- double fwd[3][2];
- double rev[3][2];
-} *FITSLinWCS;
-
-#define ft_phy2img(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->log, x0, y0, x1, y1, 1)
-#define ft_img2phy(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->log, x0, y0, x1, y1, 0)
-#define ft_phy2amp(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->amp, x0, y0, x1, y1, 1)
-#define ft_amp2phy(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->amp, x0, y0, x1, y1, 0)
-#define ft_phy2det(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->det, x0, y0, x1, y1, 1)
-#define ft_det2phy(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->det, x0, y0, x1, y1, 0)
-
-#define ft_phy2img_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->log, x0, y0, x1, y1, 1)
-#define ft_img2phy_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->log, x0, y0, x1, y1, 0)
-#define ft_phy2amp_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->amp, x0, y0, x1, y1, 1)
-#define ft_amp2phy_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->amp, x0, y0, x1, y1, 0)
-#define ft_phy2det_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->det, x0, y0, x1, y1, 1)
-#define ft_det2phy_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->det, x0, y0, x1, y1, 0)
-
-typedef struct _FITSImage {
- int has_bscale;
- double dbscale;
- int has_bzero;
- double dbzero;
-
- int has_blank;
- int blank;
-
- struct _FITSLinWCS log;
- struct _FITSLinWCS det;
- struct _FITSLinWCS amp;
-} *FITSImage;
-
-typedef struct _FITSTCol {
- int type;
- int n;
- int size;
- int width;
- int offset;
- char *format;
-
- char *vla;
- int vla_type;
- int vla_max;
-
- int heap;
-
- char *name;
- char *unit;
- char *disp;
-
- int prec;
-
- int has_scale;
- double scale;
- int has_zero;
- double zero;
- int scaled;
-
- int has_blank;
- char *ablank;
- double dblank;
-} *FITSTCol;
-
-typedef struct _FITSTable {
- int tabtype; /* TABLE or BINTABLE */
- int tfields; /* # of fields */
- FITSTCol col; /* Column pointers */
-} *FITSTable;
-
-
-#define ft_cards(fits) ( (void *)fits->cards )
-#define ft_data(fits) ( fits->data )
-#define ft_ncards(fits) ( fits->ncard )
-#define ft_cardnth(fits, nth) ( ( nth <= fits->ncard ) \
- ? &fits->cards[nth-1] \
- : NULL )
-
-#define ft_last(fits) ft_cardnth(fits, fits->ncard)
-
-#define ft_byteswap() (*(short *)"\001\000" & 0x0001)
-#define ft_seek(fits) ( fits->seek )
-
-typedef struct _FITSHead {
- FITSCard cards;
- FITSCard *index;
- FITSCard last;
- int acard;
- int ncard;
-
- char *filename;
- File file;
-
- off_t seek;
- off_t data;
- int step;
-
- void *cache;
- int nbuffers;
- int buffrows;
-
- int mem;
- char *mmap_here;
- int mmap_size;
-
- int sync;
-
- FITSBasic basic;
- FITSImage image;
- FITSTable table;
-
- struct _FITSHead*primary;
- int rfcount;
-} *FITSHead;
-
-typedef struct _FITSFile {
- FITSHead head;
- void *data;
- int bitpix;
-} *FITSFile;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* cardfind.c */
-FITSCard ft_cardfind PROTOTYPE((FITSHead fits, FITSCard key, int add));
-FITSCard ft_cardfindidx PROTOTYPE((FITSHead fits, FITSCard key, int *match));
-FITSCard ft_cardfindseq PROTOTYPE((FITSHead fits, FITSCard key, int *match));
-FITSCard ft_cardfindblok PROTOTYPE((FITSCard cards, FITSCard key, int *match, int *nhist));
-/* cardfmt.c */
-int ft_isblank PROTOTYPE((char *s));
-FITSCard ft_cardfmt PROTOTYPE((FITSCard card, char *name, int n, FITSType type, void *value, int prec, char *comm));
-FITSCard ft_cardkey PROTOTYPE((FITSCard card, char *name, int n));
-FITSCard ft_cardset PROTOTYPE((FITSCard card, FITSType type, void *value, int prec, char *comm));
-FITSCard ft_cardsetl PROTOTYPE((FITSCard card, int lvalue, char *comm));
-FITSCard ft_cardseti PROTOTYPE((FITSCard card, int ivalue, char *comm));
-FITSCard ft_cardsetil PROTOTYPE((FITSCard card, longlong ivalue, char *comm));
-FITSCard ft_cardsetr PROTOTYPE((FITSCard card, double rvalue, int prec, char *comm));
-FITSCard ft_cardsets PROTOTYPE((FITSCard card, char *svalue, char *comm));
-FITSCard ft_cardclr PROTOTYPE((FITSCard card, int ncards));
-FITSCard ft_cardcpy PROTOTYPE((FITSCard card1, FITSCard card2));
-/* cardins.c */
-FITSCard ft_cardins PROTOTYPE((FITSHead fits, FITSCard card, FITSCard here));
-FITSCard ft_cardapp PROTOTYPE((FITSHead fits, FITSCard card));
-FITSCard ft_carddel PROTOTYPE((FITSHead fits, FITSCard card));
-/* cardpar.c */
-char *ft_cardpar PROTOTYPE((FITSCard card, FITSType *type, char *value, int *index, char *comm));
-char *ft_cardget PROTOTYPE((FITSCard card));
-int ft_cardgetl PROTOTYPE((FITSCard card));
-int ft_cardgeti PROTOTYPE((FITSCard card));
-longlong ft_cardgetil PROTOTYPE((FITSCard card));
-double ft_cardgetr PROTOTYPE((FITSCard card));
-char *ft_cardgets PROTOTYPE((FITSCard card));
-/* ftimage.c */
-int ft_shmdt PROTOTYPE((FITSHead fits));
-FITSImage ft_imageloadhead PROTOTYPE((FITSHead fits));
-void ft_imagestorhead PROTOTYPE((FITSHead fits, FITSImage image));
-void ft_imagefree PROTOTYPE((FITSImage image));
-FITSBasic ft_basicloadhead PROTOTYPE((FITSHead fits));
-void ft_basicstorhead PROTOTYPE((FITSHead fits, FITSBasic basic));
-void ft_basicfree PROTOTYPE((FITSBasic basic));
-/* fttable.c */
-FITSTable ft_tableloadhead PROTOTYPE((FITSHead fits));
-void ft_tablestorhead PROTOTYPE((FITSHead fits, FITSTable table));
-void ft_tablefree PROTOTYPE((FITSTable table));
-/* headtable.c */
-int ft_sizeof PROTOTYPE((int type));
-/* headfile.c */
-FITSHead ft_headread0 PROTOTYPE((File file, char *card1, size_t n));
-FITSHead ft_headread PROTOTYPE((File file));
-int ft_headwrite PROTOTYPE((File file, FITSHead fits));
-void *ft_fileparse PROTOTYPE((File ifile, int (*callback)(File ifile, FITSHead fits, void *data, void *cdata1), void *cdata));
-off_t ft_dataskip PROTOTYPE((File ifile, FITSHead fits, File *ofile, int nofile));
-off_t ft_dataseek PROTOTYPE((File file, FITSHead fits));
-void *ft_dataread PROTOTYPE((File file, FITSHead fits, void *dataptr, int pixtype));
-int ft_simpleimageread PROTOTYPE((char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype));
-int ft_simpleimagemmap PROTOTYPE((char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int prot, int share));
-int ft_munmap(FITSHead fits);
-int ft_imageread PROTOTYPE((File file, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype));
-int ft_simpleimagewrite PROTOTYPE((char *filename, FITSHead fits, void *data, int pixtype));
-int ft_imagewrite PROTOTYPE((File file, FITSHead fits, void *data, int pixtype));
-void *ft_dataswap PROTOTYPE((void *to, void *from, size_t n, int type));
-FITSFile ft_fileread PROTOTYPE((File file, int flag, int pixtype, int *n));
-void *ft_filedata PROTOTYPE((File file, FITSFile ft));
-/* headfind.c */
-FITSCard ft_headfind PROTOTYPE((FITSHead fits, char *name, int n, int add));
-void ft_headindex PROTOTYPE((FITSHead fits));
-FITSCard ft_headfindidx PROTOTYPE((FITSHead fits, char *name, int n, int *match));
-FITSCard ft_headfindseq PROTOTYPE((FITSHead fits, char *name, int n, int *match));
-/* headinit.c */
-FITSHead ft_headinit PROTOTYPE((void *cards, int acard));
-FITSHead ft_headcopy PROTOTYPE((FITSHead fits));
-void ft_primlink PROTOTYPE((FITSHead prim, FITSHead fits));
-
-void ft_headfree PROTOTYPE((FITSHead fits, int freecards));
-void ft_setcards PROTOTYPE((FITSHead fits, void *cards));
-/* headins.c */
-FITSCard ft_headinsl PROTOTYPE((FITSHead fits, char *name, int n, int lvalue, char *comm, FITSCard here));
-FITSCard ft_headinsi PROTOTYPE((FITSHead fits, char *name, int n, int ivalue, char *comm, FITSCard here));
-FITSCard ft_headinsr PROTOTYPE((FITSHead fits, char *name, int n, double dvalue, int prec, char *comm, FITSCard here));
-FITSCard ft_headinss PROTOTYPE((FITSHead fits, char *name, int n, char *svalue, char *comm, FITSCard here));
-FITSCard ft_headinsv PROTOTYPE((FITSHead fits, char *name, int n, char *vvalue, char *comm, FITSCard here));
-FITSCard ft_headappl PROTOTYPE((FITSHead fits, char *name, int n, int lvalue, char *comm));
-FITSCard ft_headappi PROTOTYPE((FITSHead fits, char *name, int n, int ivalue, char *comm));
-FITSCard ft_headappil PROTOTYPE((FITSHead fits, char *name, int n, longlong ivalue, char *comm));
-FITSCard ft_headappr PROTOTYPE((FITSHead fits, char *name, int n, double dvalue, int prec, char *comm));
-FITSCard ft_headapps PROTOTYPE((FITSHead fits, char *name, int n, char *svalue, char *comm));
-FITSCard ft_headappv PROTOTYPE((FITSHead fits, char *name, int n, char *vvalue, char *comm));
-FITSCard ft_headdel PROTOTYPE((FITSHead fits, char *name, int n));
-/* headset.c */
-FITSCard ft_headsetl PROTOTYPE((FITSHead fits, char *name, int n, int lvalue, char *comm, int append));
-FITSCard ft_headseti PROTOTYPE((FITSHead fits, char *name, int n, int ivalue, char *comm, int append));
-FITSCard ft_headsetil PROTOTYPE((FITSHead fits, char *name, int n, longlong ivalue, char *comm, int append));
-FITSCard ft_headsetr PROTOTYPE((FITSHead fits, char *name, int n, double rvalue, int prec, char *comm, int append));
-FITSCard ft_headsets PROTOTYPE((FITSHead fits, char *name, int n, char *svalue, char *comm, int append));
-/* headget.c */
-char *ft_headget PROTOTYPE((FITSHead fits, char *name, int n, FITSCard *card));
-int ft_headgetl PROTOTYPE((FITSHead fits, char *name, int n, int ldefault, FITSCard *card));
-int ft_headgeti PROTOTYPE((FITSHead fits, char *name, int n, int idefault, FITSCard *card));
-longlong ft_headgetil PROTOTYPE((FITSHead fits, char *name, int n, longlong idefault, FITSCard *card));
-double ft_headgetr PROTOTYPE((FITSHead fits, char *name, int n, double ddefault, FITSCard *card));
-char *ft_headgets PROTOTYPE((FITSHead fits, char *name, int n, char *sdefault, FITSCard *card));
-
-FITSHead ft_primary PROTOTYPE((FITSHead fits));
-FITSHead ft_headmerge PROTOTYPE((FITSHead fits1, FITSHead fits2, int copy));
-void ft_synchead PROTOTYPE((FITSHead fits));
-void ft_syncdata PROTOTYPE((FITSHead fits));
-
-void ft_acht PROTOTYPE((int type1, void* v1, int type2, void* v2, int npix, int direction, int hasscale, double dbscale, double dbzero));
-
-void ft_acht2 PROTOTYPE((int type1, void* v1, int type2, void* v2, int npix, int swap, int direction));
-
-char **ft_make2d PROTOTYPE((char *ptr, int size, int xstar, int ystar, int xsize, int ysize));
-int ft_datawrite PROTOTYPE((File file, FITSHead fits, void *data, int pixtype));
-
-/* fitshead.c */
-int ft_parsefilename PROTOTYPE((char *filename, char *name, char *extn, int nmaxlen, int *indx, char *tail, int tmaxlen));
-int ft_cfile PROTOTYPE((File cfile));
-File ft_fitsheadread PROTOTYPE((File file, char *filename, FITSHead *head, char *mode, char *iline, File *ifd));
-File ft_fitsheadopen PROTOTYPE((char *filename, FITSHead *head, char *tail, int size, char *mode));
-File ft_fitsheadopenfd PROTOTYPE((char *filename, FITSHead *head, char *tail, int size, char *mode, File file, char *iline, File *ifd));
-
-int ft_inverse PROTOTYPE((double f[3][2], double r[3][2]));
-
-/* dataimage.c */
-void swap2 PROTOTYPE((char *to, char *from, size_t nbytes));
-void swap4 PROTOTYPE((char *to, char *from, size_t nbytes));
-void swap8 PROTOTYPE((char *to, char *from, size_t nbytes));
-
-/* headwcs.c */
-int ft_trxlcs PROTOTYPE((FITSLinWCS lcs, double x0, double y0,
- double *x1, double *y1, int direction));
-int ft_trxsiz PROTOTYPE((FITSLinWCS lcs, double x0, double y0,
- double *x1, double *y1, int direction));
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-
diff --git a/funtools/fitsy/ftacht.c b/funtools/fitsy/ftacht.c
deleted file mode 100644
index b88892f..0000000
--- a/funtools/fitsy/ftacht.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* ft_acht.c
-**
-** Vector change type operators.
-** FITS adds bzero and bascle.
-**/
-
-#include "xos.h"
-#include "fitsy.h"
-#include "generic.h"
-
-
-#ifdef __STDC__
-#define achtxx(ch1, type1, ch2, type2) \
- \
-void acht##ch1##ch2(v1, v2, npix, direction, hasscale, bscale, bzero) \
- type1* v1; \
- type2* v2; \
- int npix; \
- int direction; \
- int hasscale; \
- double bscale; \
- double bzero; \
-{ \
- if ( hasscale ) { \
- if ( direction ) { \
- while ( npix-- ) v1[npix] = v2[npix] * bscale + bzero; \
- } else { \
- while ( npix-- ) v1[npix] = (v2[npix] - bzero) / bscale; \
- } \
- } else { \
- while ( npix-- ) v1[npix] = v2[npix]; \
- } \
-}
-#else
-#define achtxx(ch1, type1, ch2, type2) \
- \
-void acht/**/ch1/**/ch2(v1, v2, npix, direction, hasscale, bscale, bzero)\
- type1* v1; \
- type2* v2; \
- int npix; \
- int direction; \
- int hasscale; \
- double bscale; \
- double bzero; \
-{ \
- if ( hasscale ) { \
- if ( direction ) { \
- while ( npix-- ) v1[npix] = v2[npix] * bscale + bzero; \
- } else { \
- while ( npix-- ) v1[npix] = (v2[npix] - bzero) / bscale; \
- } \
- } else { \
- while ( npix-- ) v1[npix] = v2[npix]; \
- } \
-}
-#endif
-
-
-DOUBLE_GENERIC(achtxx)
-
-
-static int pixtype(type)
- int type;
-{
- switch ( type ) {
- case 8: return TY_UCHAR;
- case 16: return TY_SHORT;
- case 32: return TY_INT;
-
- case FT_UNSIGNED | 8: return TY_UCHAR;
- case FT_UNSIGNED | 16: return TY_USHORT;
- case FT_UNSIGNED | 32: return TY_UINT;
-
- case -32: return TY_REAL;
- case -64: return TY_DOUBLE;
- }
-
- return -1;
-}
-
-void ft_acht(type1, v1, type2, v2, npix, direction, hasscale, bscale, bzero)
- int type1;
- void* v1;
- int type2;
- void* v2;
- int npix;
- int direction;
- int hasscale;
- double bscale;
- double bzero;
-{
- typedef void (*vector)();
-
-static vector matrix[10][10] = {
- { achtcc,achtcs,achtci,achtcl,achtcr,achtcd,achtct,achtcu,achtcv }
- , { achtsc,achtss,achtsi,achtsl,achtsr,achtsd,achtst,achtsu,achtsv }
- , { achtic,achtis,achtii,achtil,achtir,achtid,achtit,achtiu,achtiv }
- , { achtlc,achtls,achtli,achtll,achtlr,achtld,achtlt,achtlu,achtlv }
- , { achtrc,achtrs,achtri,achtrl,achtrr,achtrd,achtrt,achtru,achtrv }
- , { achtdc,achtds,achtdi,achtdl,achtdr,achtdd,achtdt,achtdu,achtdv }
- , { achttc,achtts,achtti,achttl,achttr,achttd,achttt,achttu,achttv }
- , { achtuc,achtus,achtui,achtul,achtur,achtud,achtut,achtuu,achtuv }
- , { achtvc,achtvs,achtvi,achtvl,achtvr,achtvd,achtvt,achtvu,achtvv }
-};
-
- type1 = pixtype(type1);
- type2 = pixtype(type2);
-
- if ( type1 < 0 || type2 < 0 ) return;
-
- (*matrix[type1][type2])(v1, v2, npix, direction, hasscale, bscale, bzero);
-}
diff --git a/funtools/fitsy/ftacht2.c b/funtools/fitsy/ftacht2.c
deleted file mode 100644
index a4d2ec3..0000000
--- a/funtools/fitsy/ftacht2.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* ft_acht2.c
-**
-** Vector change type operators.
-** FITS adds bzero and bascle.
-**/
-
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-#include "xos.h"
-#include "fitsy.h"
-#include "longlong.h"
-#include "generic.h"
-
-typedef void (*vector)();
-
-#ifdef __STDC__
-#define cht2xx(ch1, type1, ch2, type2) \
- \
-void cht2##ch1##ch2(v1, v2, npix, rtn, direction) \
- void *v1; \
- void *v2; \
- int npix; \
- vector rtn; \
- int direction; \
-{ \
- type1 tval1; \
- type2 tval2; \
- if( direction == 0 ){ \
- while ( npix-- ) { \
- (rtn)(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \
- tval1 = tval2; \
- memcpy((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \
- } \
- } \
- else{ \
- while ( npix-- ) { \
- memcpy(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \
- tval1 = tval2; \
- (rtn)((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \
- } \
- } \
-}
-#else
-#define cht2xx(ch1, type1, ch2, type2) \
- \
-void cht2/**/ch1/**/ch2(v1, v2, npix, rtn, direction) \
- void *v1; \
- void *v2; \
- int npix; \
- vector rtn; \
- int direction; \
-{ \
- type1 tval1; \
- type2 tval2; \
- if( direction == 0 ){ \
- while ( npix-- ) { \
- (rtn)(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \
- tval1 = tval2; \
- memcpy((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \
- } \
- } \
- else{ \
- while ( npix-- ) { \
- memcpy(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \
- tval1 = tval2; \
- (rtn)((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \
- } \
- } \
-}
-#endif
-
-DOUBLE_GENERIC(cht2xx)
-
-static int pixtype2(type)
- int type;
-{
- switch ( type ) {
- case 'A': return TY_UCHAR;
- case 'B': return TY_UCHAR;
- case 'X': return TY_UCHAR;
- case 'I': return TY_SHORT;
- case 'K': return TY_LONG;
- case 'U': return TY_USHORT;
- case 'J': return TY_INT;
- case 'V': return TY_UINT;
- case 'L': return TY_UCHAR;
- case 'E': return TY_REAL;
- case 'D': return TY_DOUBLE;
- }
-
- return -1;
-}
-
-void ft_acht2(type1, v1, type2, v2, npix, swap, direction)
- int type1;
- void* v1;
- int type2;
- void* v2;
- int npix;
- int swap;
- int direction;
-{
- vector rtn=NULL;
- int offset1, offset2, type;
-
-static vector matrix[10][10] = {
- { cht2cc,cht2cs,cht2ci,cht2cl,cht2cr,cht2cd,cht2ct,cht2cu,cht2cv }
- , { cht2sc,cht2ss,cht2si,cht2sl,cht2sr,cht2sd,cht2st,cht2su,cht2sv }
- , { cht2ic,cht2is,cht2ii,cht2il,cht2ir,cht2id,cht2it,cht2iu,cht2iv }
- , { cht2lc,cht2ls,cht2li,cht2ll,cht2lr,cht2ld,cht2lt,cht2lu,cht2lv }
- , { cht2rc,cht2rs,cht2ri,cht2rl,cht2rr,cht2rd,cht2rt,cht2ru,cht2rv }
- , { cht2dc,cht2ds,cht2di,cht2dl,cht2dr,cht2dd,cht2dt,cht2du,cht2dv }
- , { cht2tc,cht2ts,cht2ti,cht2tl,cht2tr,cht2td,cht2tt,cht2tu,cht2tv }
- , { cht2uc,cht2us,cht2ui,cht2ul,cht2ur,cht2ud,cht2ut,cht2uu,cht2uv }
- , { cht2vc,cht2vs,cht2vi,cht2vl,cht2vr,cht2vd,cht2vt,cht2vu,cht2vv }
-};
-
- offset1 = pixtype2(type1);
- offset2 = pixtype2(type2);
- if ( offset1 < 0 || offset2 < 0 ) return;
-
- if( swap ){
- if( direction == 0 )
- type = type2;
- else
- type = type1;
- switch(ft_sizeof(type)){
- case 1:
- rtn = (vector)memcpy;
- break;
- case 2:
- rtn = swap2;
- break;
- case 4:
- rtn = swap4;
- break;
- case 8:
- rtn = swap8;
- break;
- default:
- rtn = (vector)memcpy;
- break;
- }
- }
- else{
- rtn = (vector)memcpy;
- }
-
- (*matrix[offset1][offset2])(v1, v2, npix, rtn, direction);
-}
diff --git a/funtools/fitsy/generic.h b/funtools/fitsy/generic.h
deleted file mode 100644
index 5835492..0000000
--- a/funtools/fitsy/generic.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* generic.h */
-
-typedef unsigned char _uchar;
-typedef unsigned short _ushort;
-typedef unsigned int _uint;
-
-#define DOUBLE_EXPAND(ch, type, FUNCTION) \
- \
-FUNCTION(ch,type,c,char) \
-FUNCTION(ch,type,s,short) \
-FUNCTION(ch,type,i,int) \
-FUNCTION(ch,type,l,longlong) \
-FUNCTION(ch,type,r,float) \
-FUNCTION(ch,type,d,double) \
-FUNCTION(ch,type,t,_uchar) \
-FUNCTION(ch,type,u,_ushort) \
-FUNCTION(ch,type,v,_uint) \
-
-#define DOUBLE_GENERIC(FUNCTION) \
- \
-DOUBLE_EXPAND(c,char,FUNCTION) \
-DOUBLE_EXPAND(s,short,FUNCTION) \
-DOUBLE_EXPAND(i,int,FUNCTION) \
-DOUBLE_EXPAND(l,longlong,FUNCTION) \
-DOUBLE_EXPAND(r,float,FUNCTION) \
-DOUBLE_EXPAND(d,double,FUNCTION) \
-DOUBLE_EXPAND(t,_uchar,FUNCTION) \
-DOUBLE_EXPAND(u,_ushort,FUNCTION) \
-DOUBLE_EXPAND(v,_uint,FUNCTION) \
-
diff --git a/funtools/fitsy/headdata.c b/funtools/fitsy/headdata.c
deleted file mode 100644
index 748fbea..0000000
--- a/funtools/fitsy/headdata.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Fitsy FITS routines to work with the data portion of a FITS file.
- */
-
-#include <xos.h>
-#include "fitsy.h"
-
-/* Skip over the data part of a FITS header data unit.
-
- If the file is seekable and the #ofile file pointer is
- #NULL or nfile is 0, the data are skipped with an #fseek().
-
- If the #ofile file pointer is #NULL no data is written.
-
- */
-
-#define NBLOCK 500
-
-off_t ft_dataskip(ifile, fits, ofiles, nofile)
- File ifile; /* File pointer to read FITS data from. */
- FITSHead fits; /* FITS header associated with data. */
- File* ofiles; /* File pointers to write data to. */
- int nofile; /* number of files */
-{
- int i;
- int blocks;
- char block[FT_BLOCK * NBLOCK];
- off_t pos=0;
-
- if ( ifile == NULL ) return pos;
- if ( fits == NULL ) return pos;
-
- if ( ft_seek(fits) != -1 && (!ofiles || !nofile) ) {
- if ( ft_databytes(fits) ){
- pos = ftSeek(ifile, ft_databloks(fits) * FT_BLOCK, 1);
- return pos;
- }
- }
-
- if ( ft_databytes(fits) ) {
- for ( blocks = ft_databloks(fits);
- blocks > NBLOCK; blocks -= NBLOCK ) {
- ftRead(ifile, block, 1, FT_BLOCK*NBLOCK);
- for(i=0; i<nofile; i++)
- ftWrite(ofiles[i], block, 1, FT_BLOCK*NBLOCK);
- }
- if ( blocks ) {
- ftRead(ifile, block, 1, FT_BLOCK*blocks);
- for(i=0; i<nofile; i++)
- ftWrite(ofiles[i], block, 1, FT_BLOCK*blocks);
- }
- }
- return pos;
-}
-
-/* Seek to the data portion of prevoiusly read fits header data unit.
- */
-off_t ft_dataseek(sfile, fits)
- File sfile; /* File pointer to seek. */
- FITSHead fits;
-{
- if ( sfile == NULL ) return -1;
- if ( fits == NULL ) return -1;
-
- return ftSeek(sfile, fits->data, 0) != -1;
-}
-
-
diff --git a/funtools/fitsy/headfile.c b/funtools/fitsy/headfile.c
deleted file mode 100644
index b80788d..0000000
--- a/funtools/fitsy/headfile.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Fitsy FITS read and write header routines.
- */
-
-#include <xos.h>
-#include "fitsy.h"
-
-FITSHead ft_headread0(file, card1, n)
- File file;
- char *card1;
- size_t n;
-{
- int nbloks;
-
- FITSHead fits;
- FITSCard cards;
- FITSCard end;
- FITSBuff key;
- int match;
- int nhist;
-
- if ( file == NULL ) return NULL;
-
- Malloc(cards, FT_BLOCK+1);
- ft_cardclr(cards, FT_CARDS);
- /* make sure there is a null at the end (EGM) */
- ((char *)cards)[FT_BLOCK] = '\0';
- fits = ft_headinit(cards, -FT_CARDS*FT_CARDLEN);
-
- fits->seek = ftTell(file);
-
- if ( card1 )
- memmove(fits->cards, card1, n);
-
- if ( ftRead(file, (void *)&fits->cards[0].c[n],
- 1, FT_BLOCK - n) != FT_BLOCK - n ) {
- (void)Free(fits->cards);
- (void)Free(fits);
- return NULL;
- };
-
- ft_cardkey(&key, "END", 0);
-
- for ( nbloks = 1; 1; nbloks++ ) {
- if ( (end = ft_cardfindblok(&fits->cards[(nbloks-1) * FT_CARDS]
- , &key, &match, &nhist)) ) break;
-
- if ( (nbloks <= 25) || (nbloks > 25 && nhist < FT_CARDS) ) {
- fits->ncard += FT_CARDS;
- (void)ReAlloc(fits->cards, (nbloks+1) * FT_BLOCK + 1);
- /* make sure there is a null at the end (EGM) */
- ((char *)fits->cards)[(nbloks+1) * FT_BLOCK] = '\0';
- ft_cardclr(&fits->cards[nbloks * FT_CARDS], FT_CARDS);
- } else
- nbloks--;
-
- if ( ftRead(file, (void *)&fits->cards[nbloks * FT_CARDS],
- 1, FT_BLOCK) != FT_BLOCK ) {
- (void)Free(fits->cards);
- (void)Free(fits);
- return NULL;
- }
- }
-
- fits->data = ftTell(file);
-
- fits->ncard = end - fits->cards + 1;
- fits->acard = nbloks * FT_CARDS;
-
- ft_syncdata(fits);
-
- return fits;
-}
-
-/* Read a FITS header from a file pointer.
-
- Returns
- The #FITSHead read from #file.
- */
-FITSHead ft_headread(file)
- File file; /* File pointer to read or write a FITS header on. */
-{
- return ft_headread0(file, NULL, 0);
-}
-
-/* Write a FITS header to a file pointer.
- */
-int ft_headwrite(file, fits)
- File file;
- FITSHead fits; /* Header to write. */
-{
- if ( file == NULL ) return 0;
- if ( fits == NULL ) return 0;
-
- if ( fits->sync ) ft_synchead(fits);
-
- ftWrite(file, (void *)fits->cards,
- FT_BLOCK, ((fits->ncard+FT_CARDS-1)/FT_CARDS));
- ftFlush(file);
-
- return 1;
-}
-
-void *ft_fileparse(ifile, callback, cdata)
- File ifile;
- int (*callback)();
- void *cdata;
-{
- FITSHead fits;
- void *data = NULL;
-
- if ( ifile == NULL ) return NULL;
-
- while ( (fits = ft_headread(ifile)) ) {
- if ( (*callback)(ifile, fits, &data, cdata) )
- return data;
- }
-
- return data;
-}
-
-/* Seek back to the header part of a FITS HDU. The file handle must be the same
- one from which the FITS header was read and must be seekable.
- */
-off_t ft_headseek(file, fits)
- File file;
- FITSHead fits;
-{
- if ( file == NULL ) return -1;
- if ( fits == NULL ) return -1;
-
- return ftSeek(file, fits->seek, 0) != -1;
-}
-
-int ft_sync(fits, x)
- FITSHead fits;
- int x;
-{
- int sync;
-
- if ( fits == NULL ) return -1;
-
- sync = fits->sync;
- fits->sync = x;
-
- return sync;
-
-}
diff --git a/funtools/fitsy/headfind.c b/funtools/fitsy/headfind.c
deleted file mode 100644
index 8095c15..0000000
--- a/funtools/fitsy/headfind.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Fitsy FITS header find routines.
- */
-
-#include "xos.h"
-#include "fitsy.h"
-
-extern int ft_compare();
-
-/* Find a FITS card in the header.
-
- If the header has been indexed the index will be used
- otherwise a sequential search will be done.
-
- Returns
- The card found or NULL if an exact match was not found.
- */
-FITSCard ft_headfind(fits, name, n, add)
- FITSHead fits; /* The FITS header to search. */
- char *name; /* Name of the card keyword to search for. */
- int n; /* keyword index number, if is zero no
- index number is appended to the keyword.
- */
- int add; /* If add is true the card will
- be added to the header if it is
- not found.
- */
-{
- FITSBuff key;
-
- return ft_cardfind(fits, ft_cardkey(&key, name, n), add);
-}
-
-/* Index a header for use with #ft_headfind.
- */
-void ft_headindex(fits)
- FITSHead fits;
-{
- int i;
-
- if ( fits->index ) (void)Free(fits->index);
-
- Malloc(fits->index, sizeof(FITSCard *) * fits->ncard);
- for ( i = 0; i < fits->ncard; i++ ) {
- fits->index[i] = (FITSCard) &fits->cards[i];
- }
-
- qsort(fits->index, fits->ncard, sizeof(FITSCard *), ft_compare);
-}
-
-/* Find a FITS card in the header.
-
- #headfindidx uses an index to find the card.
- */
-FITSCard ft_headfindidx(fits, name, n, match)
- FITSHead fits;
- char *name;
- int n;
- int *match; /* Returns true if the card found is
- an exact match for the keyword
- requested.
- */
-{
- FITSBuff key;
-
- return ft_cardfindidx(fits, ft_cardkey(&key, name, n), match);
-}
-
-/* Find a FITS card in the header.
-
- Find a card in the header using sequential search.
-
- If the requested card is a FITS indexed keyword and an exact match
- is not found, the highest existing card of that type is returned and
- match is set to 0.
- */
-FITSCard ft_headfindseq(fits, name, n, match)
- FITSHead fits;
- char *name;
- int n;
- int *match;
-{
- FITSBuff key;
-
- return ft_cardfindseq(fits, ft_cardkey(&key, name, n), match);
-}
-
diff --git a/funtools/fitsy/headget.c b/funtools/fitsy/headget.c
deleted file mode 100644
index 89dd7c9..0000000
--- a/funtools/fitsy/headget.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Find and return values from a FITS header.
-
- EXAMPLES
-+
- FITSHead fits;
- FITSCard card;
-
-
- int simple;
- int ax1, ax2;
-
- /-* Look up the SIMPLE card in the header and see if its is
- True. If it's not found return False.
- *-/
- simple = #ft_headgetl(fits, "SIMPLE", 0, 0, &card);
-
- /-* Look up the NAXIS1 and NAXIS2 cards in the header
- if a card is not found return 0.
- *-/
- ax1 = #ft_headgeti(fits, "NAXIS", 1, 0, &card);
- ax2 = #ft_headgeti(fits, "NAXIS", 2, 0, &card);
-+
- */
-
-#include <fitsy.h>
-
-/* Find and return the value of a FITS card as a static string.
- */
-char *ft_headget(fits, name, n, card)
- FITSHead fits; /* The FITS header to search. */
- char *name; /* Name of the card keyword to search for. */
- int n; /* keyword index number, if is zero no
- index number is appended to the keyword.
- */
- FITSCard *card; /* The FITS card that was found. */
-{
- return ft_cardget(*(card) = ft_headfind(fits, name, n, 0));
-}
-
-/* Find and return the value of a FITS card as a logical.
- */
-int ft_headgetl(fits, name, n, ldefault, card)
- FITSHead fits;
- char *name;
- int n;
- int ldefault; /* Default logical value to return. */
- FITSCard *card;
-{
- FITSCard C;
-
- if ( card == NULL ) card = &C;
-
- return ( (*(card) = ft_headfind(fits, name, n, 0)) ?
- ft_cardgetl(*(card)) : (int)(ldefault) );
-}
-
-
-/* Find and return the value of a FITS card as an integer.
- */
-int ft_headgeti(fits, name, n, idefault, card)
- FITSHead fits;
- char *name;
- int n;
- int idefault; /* Default integer value to return. */
- FITSCard *card;
-{
- FITSCard C;
-
- if ( card == NULL ) card = &C;
-
- return ( (*(card) = ft_headfind(fits, name, n, 0)) ?
- ft_cardgeti(*(card)) : (int)(idefault) );
-}
-
-/* Find and return the value of a FITS card as an integer.
- */
-longlong ft_headgetil(fits, name, n, idefault, card)
- FITSHead fits;
- char *name;
- int n;
- longlong idefault; /* Default integer value to return. */
- FITSCard *card;
-{
- FITSCard C;
-
- if ( card == NULL ) card = &C;
-
- return ( (*(card) = ft_headfind(fits, name, n, 0)) ?
- ft_cardgetil(*(card)) : (longlong)(idefault) );
-}
-
-/* Find and return the value of a FITS card as a real.
- */
-double ft_headgetr(fits, name, n, ddefault, card)
- FITSHead fits;
- char *name;
- int n;
- double ddefault; /* Default real value to return. */
- FITSCard *card;
-{
- FITSCard C;
-
- if ( card == NULL ) card = &C;
-
- return ( (*(card) = ft_headfind(fits, name, n, 0)) ?
- ft_cardgetr(*(card)) : (double)(ddefault) );
-
-}
-/* Find and return the value of a FITS card as a allocated string.
- */
-char *ft_headgets(fits, name, n, sdefault, card)
- FITSHead fits;
- char *name;
- int n;
- char *sdefault; /* Default string value to return. */
- FITSCard *card;
-{
- FITSCard C;
-
- if ( card == NULL ) card = &C;
-
- return ( (*(card) = ft_headfind(fits, name, n, 0)) ?
- ft_cardgets(*(card)) : (sdefault == NULL
- ? NULL
- : (char *)strdup(sdefault)) );
-}
diff --git a/funtools/fitsy/headimage.c b/funtools/fitsy/headimage.c
deleted file mode 100644
index 042cec9..0000000
--- a/funtools/fitsy/headimage.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Fitsy FITS routines for reading and writing image related cards.
-
- DESCRIPTION
-
- The routines on this page are usually called automatically from
- #ft_headinit, #ft_headread, #ft_headwrite and other higher level
- routines. This user should never need to call them with the
- exception of #ft_synchead or #ft_syncdata.
- */
-
-
-#include <xos.h>
-#include "fitsy.h"
-
-/* Copy information from a #FITSHead into the #FITSBasic, #FITSImage
- and #FITSTable data structures.
- */
-void ft_syncdata(fits)
- FITSHead fits;
-{
- if ( fits == NULL ) return;
-
- if ( fits->basic ) ft_basicfree(fits->basic);
- if ( fits->image ) ft_imagefree(fits->image);
- if ( fits->table ) ft_tablefree(fits->table);
-
- fits->basic = ft_basicloadhead(fits);
- fits->image = ft_imageloadhead(fits);
- fits->table = ft_tableloadhead(fits);
-}
-
-/* Copy information from the #FITSBasic, #FITSImage and #FITSTable data
- structures into a #FITSHead.
- */
-void ft_synchead(fits)
- FITSHead fits;
-{
- if ( fits == NULL ) return;
-
- if ( fits->basic ) ft_basicstorhead(fits, fits->basic);
- if ( fits->image ) ft_imagestorhead(fits, fits->image);
- if ( fits->table ) ft_tablestorhead(fits, fits->table);
-}
-
-/* Load image FITS values into the #FITSImage structure.
- */
-FITSImage ft_imageloadhead(fits)
- FITSHead fits; /* FITS header to read/write image
- cards from/to. */
-{
- FITSImage image = NULL;
- FITSCard card;
-
- char *xtension;
-
- if ( fits == NULL ) return NULL;
- if ( fits->basic == NULL ) return NULL;
-
- if ( ft_headgetl(fits, "SIMPLE", 0, 0, &card)
- || (( xtension = ft_headget(fits, "XTENSION", 0, &card))
- && !strcmp(xtension, "IMAGE")) ) {
- Malloc(image, sizeof(struct _FITSImage));
-
- image->blank = ft_headgeti(fits, "BLANK", 0, 0, &card);
- image->has_blank = card != NULL;
-
- image->dbzero = ft_headgetr(fits, "BZERO" , 0, 0.0, &card);
- image->has_bzero = image->dbzero != 0.0;
-
- image->dbscale = ft_headgetr(fits, "BSCALE", 0, 1.0, &card);
- image->has_bscale = image->dbscale != 1.0;
-
- /* Read in the IRAF Linear Image CS info
- */
- image->log.has_wcs = 0;
- image->log.fwd[0][0] = ft_headgetr(fits, "LTM1_1", 0, 1.0, &card);
- image->log.has_wcs |= card != NULL;
- image->log.fwd[1][0] = ft_headgetr(fits, "LTM2_1", 0, 0.0, &card);
- image->log.has_wcs |= card != NULL;
- image->log.fwd[0][1] = ft_headgetr(fits, "LTM1_2", 0, 0.0, &card);
- image->log.has_wcs |= card != NULL;
- image->log.fwd[1][1] = ft_headgetr(fits, "LTM2_2", 0, 1.0, &card);
- image->log.has_wcs |= card != NULL;
- image->log.fwd[2][0] = ft_headgetr(fits, "LTV1" , 0, 0.0, &card);
- image->log.has_wcs |= card != NULL;
- image->log.fwd[2][1] = ft_headgetr(fits, "LTV2" , 0, 0.0, &card);
- image->log.has_wcs |= card != NULL;
- image->log.has_wcs |= ft_inverse(image->log.fwd, image->log.rev);
-
- image->det.has_wcs = 0;
- image->det.fwd[0][0] = ft_headgetr(fits, "DTM1_1", 0, 1.0, &card);
- image->det.has_wcs |= card != NULL;
- image->det.fwd[1][0] = ft_headgetr(fits, "DTM2_1", 0, 0.0, &card);
- image->det.has_wcs |= card != NULL;
- image->det.fwd[0][1] = ft_headgetr(fits, "DTM1_2", 0, 0.0, &card);
- image->det.has_wcs |= card != NULL;
- image->det.fwd[1][1] = ft_headgetr(fits, "DTM2_2", 0, 1.0, &card);
- image->det.has_wcs |= card != NULL;
- image->det.fwd[2][0] = ft_headgetr(fits, "DTV1" , 0, 0.0, &card);
- image->det.has_wcs |= card != NULL;
- image->det.fwd[2][1] = ft_headgetr(fits, "DTV2" , 0, 0.0, &card);
- image->det.has_wcs |= card != NULL;
- image->det.has_wcs |= ft_inverse(image->det.fwd, image->det.rev);
-
- image->amp.has_wcs = 0;
- image->amp.fwd[0][0] = ft_headgetr(fits, "ATM1_1", 0, 1.0, &card);
- image->amp.has_wcs |= card != NULL;
- image->amp.fwd[1][0] = ft_headgetr(fits, "ATM2_1", 0, 0.0, &card);
- image->amp.has_wcs |= card != NULL;
- image->amp.fwd[0][1] = ft_headgetr(fits, "ATM1_2", 0, 0.0, &card);
- image->amp.has_wcs |= card != NULL;
- image->amp.fwd[1][1] = ft_headgetr(fits, "ATM2_2", 0, 1.0, &card);
- image->amp.has_wcs |= card != NULL;
- image->amp.fwd[2][0] = ft_headgetr(fits, "ATV1" , 0, 0.0, &card);
- image->amp.has_wcs |= card != NULL;
- image->amp.fwd[2][1] = ft_headgetr(fits, "ATV2" , 0, 0.0, &card);
- image->amp.has_wcs |= card != NULL;
- image->amp.has_wcs |= ft_inverse(image->amp.fwd, image->amp.rev);
- }
-
-
- return image;
-}
-
-/* Store image FITS values from a #FITSImage structure into a header.
- */
-void ft_imagestorhead(fits, image)
- FITSHead fits;
- FITSImage image; /* Image data to copy into header. */
-{
- if ( fits == NULL ) return;
- if ( image == NULL ) return;
-
- if ( image->has_blank ) {
- if ( fits->basic->bitpix > 0 )
- ft_headseti(fits, "BLANK", 0, image->blank, NULL, 0);
- }
-
- if ( image->has_bzero )
- ft_headsetr(fits, "BZERO" , 0, image->dbzero , 7, NULL, 0);
- if ( image->has_bscale )
- ft_headsetr(fits, "BSCALE", 0, image->dbscale, 7, NULL, 0);
-
- if ( image->log.has_wcs ) {
- ft_headsetr(fits, "LTM1_1", 0, image->log.fwd[0][0], 7, NULL, 0);
- ft_headsetr(fits, "LTM1_2", 0, image->log.fwd[0][1], 7, NULL, 0);
- ft_headsetr(fits, "LTM2_1", 0, image->log.fwd[1][0], 7, NULL, 0);
- ft_headsetr(fits, "LTM2_2", 0, image->log.fwd[1][1], 7, NULL, 0);
- ft_headsetr(fits, "LTV1", 0, image->log.fwd[2][0], 7, NULL, 0);
- ft_headsetr(fits, "LTV2", 0, image->log.fwd[2][1], 7, NULL, 0);
- }
- if ( image->amp.has_wcs ) {
- ft_headsetr(fits, "ATM1_1", 0, image->amp.fwd[0][0], 7, NULL, 0);
- ft_headsetr(fits, "ATM1_2", 0, image->amp.fwd[0][1], 7, NULL, 0);
- ft_headsetr(fits, "ATM2_1", 0, image->amp.fwd[1][0], 7, NULL, 0);
- ft_headsetr(fits, "ATM2_2", 0, image->amp.fwd[1][1], 7, NULL, 0);
- ft_headsetr(fits, "ATV1", 0, image->amp.fwd[2][0], 7, NULL, 0);
- ft_headsetr(fits, "ATV2", 0, image->amp.fwd[2][1], 7, NULL, 0);
- }
- if ( image->det.has_wcs ) {
- ft_headsetr(fits, "DTM1_1", 0, image->det.fwd[0][0], 7, NULL, 0);
- ft_headsetr(fits, "DTM1_2", 0, image->det.fwd[0][1], 7, NULL, 0);
- ft_headsetr(fits, "DTM2_1", 0, image->det.fwd[1][0], 7, NULL, 0);
- ft_headsetr(fits, "DTM2_2", 0, image->det.fwd[1][1], 7, NULL, 0);
- ft_headsetr(fits, "DTV1", 0, image->det.fwd[2][0], 7, NULL, 0);
- ft_headsetr(fits, "DTV2", 0, image->det.fwd[2][1], 7, NULL, 0);
- }
-}
-
-
-/* Free a FITSImage data structure.
- */
-void ft_imagefree(image)
- FITSImage image;
-{
- if ( image ) (void)Free(image);
-}
-
-/* Load basic FITS values into the #FITSBasic structure.
- */
-FITSBasic ft_basicloadhead(fits)
- FITSHead fits;
-{
- FITSBasic basic;
- FITSCard card;
- int i;
-
- if ( fits == NULL ) return NULL;
-
- Malloc(basic, sizeof(struct _FITSBasic));
-
- basic->simple = ft_headgetl(fits, "SIMPLE", 0, 0, &card);
- if ( basic->simple ) {
- basic->name = strdup("primary");
- } else {
- basic->name = ft_headgets(fits, "EXTNAME", 0, "None", &card);
- basic->hduname = ft_headgets(fits, "HDUNAME", 0, "None", &card);
- basic->extn = ft_headgeti(fits, "EXTVER", 0, 0, &card);
- }
-
- basic->naxes = ft_headgeti(fits, "NAXIS", 0, 0, &card);
-
- if ( basic->naxes > FT_MAXAXES ) return NULL;
-
- for ( i = 1; i <= basic->naxes; i++ )
- basic->naxis[i-1] = ft_headgeti(fits, "NAXIS", i, 0, &card);
-
- basic->bitpix = ft_headgeti(fits, "BITPIX", 0, 0, &card);
- basic->gcount = ft_headgeti(fits, "GCOUNT", 0, 1, &card);
- basic->pcount = ft_headgeti(fits, "PCOUNT", 0, 0, &card);
-
-
- if ( basic->naxes == 0 || basic->gcount == 0 ) {
- basic->datapixls = 0;
- } else {
- basic->datapixls = 1;
-
- for ( i = 1; i <= basic->naxes; i++ )
- basic->datapixls *= basic->naxis[i-1];
-
- basic->datapixls =
- basic->gcount
- * (basic->pcount + basic->datapixls);
- }
-
- basic->databytes = basic->datapixls * (Abs(basic->bitpix)/8);
- basic->databloks = ft_fitsbloks(basic->databytes);
- basic->row_bytes = basic->naxis[0] * (Abs(basic->bitpix)/8);
-
- return basic;
-}
-
-/* Store basic FITS values from a #FITSBasic structre into a fits header.
- */
-void ft_basicstorhead(fits, basic)
- FITSHead fits;
- FITSBasic basic; /* FITSBasic structure */
-{
- FITSCard card;
-
- int i;
- int naxes;
-
- if ( fits == NULL ) return;
- if ( basic == NULL ) return;
-
- naxes = ft_headgeti(fits, "NAXIS", 0, 0, &card);
-
- ft_headsetl(fits, "SIMPLE", 0, 1, NULL, 0);
-
- ft_headseti(fits, "BITPIX", 0, basic->bitpix, NULL, 0);
- ft_headseti(fits, "NAXIS" , 0, basic->naxes, NULL, 0);
-
- for ( i = 1; i <= naxes; i++ ) {
- if ( i < basic->naxes )
- ft_headseti(fits, "NAXIS", i, basic->naxis[i-1], NULL, 0);
- else
- ft_headdel (fits, "NAXIS", i);
- }
-
- ft_headseti(fits, "GCOUNT", basic->gcount, 0, NULL, 0);
- ft_headseti(fits, "PCOUNT", basic->pcount, 0, NULL, 0);
-}
-
-/* Free a FITSBasic data structure.
- */
-void ft_basicfree(basic)
- FITSBasic basic;
-{
- if ( basic->name ) (void)Free(basic->name );
- if ( basic->hduname ) (void)Free(basic->hduname );
- if ( basic ) (void)Free(basic );
-}
-
diff --git a/funtools/fitsy/headinit.c b/funtools/fitsy/headinit.c
deleted file mode 100644
index 8e27dc8..0000000
--- a/funtools/fitsy/headinit.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Fitsy FITS header creation routines.
-
- EXAMPLES
-+
- FITSHead fits;
-
- fits = #ft_headinit(NULL, 0); /-* Create an empty header *-/
-
- /-* Build a FITS file header by hand.
- *-/
- #ft_headappl(fits, "SIMPLE", 0, 1, "Primary FITS image array");
- #ft_headappi(fits, "BITPIX", 0, -32, "Single floats");
- #ft_headappi(fits, "NAXIS" , 0, 2, "2d image");
- #ft_headappi(fits, "NAXIS" , 1, 256, "X axis is 256");
- #ft_headappi(fits, "NAXIS" , 2, 256, "Y axis is 256");
-
-+
- */
-
-#include "xos.h"
-#include "fitsy.h"
-
-/* Create or import a FITS header to Fitsy.
-
- This is the primary way in which FITSHead structures are created.
-
- If #cards is not NULL then then #acard cards are scanned from the memory
- in search of the END card. When a memory block is passed in to #ft_headinit
- then it is considered ~unmanaged~ and will not be freed by #ft_headfree.
-
- If #cards is NULL, then #acards cards will be allocated for use as a FITSHead.
- If #acards is 0 the #FT_CARDS will be allocated (36).
-
-
- */
-FITSHead ft_headinit(data, bytes)
- void *data; /* Pointer to FITS cards. */
- int bytes; /* Number of bytes in buffer. */
-{
- int match;
- FITSHead fits;
- FITSCard end = NULL;
- FITSBuff *cards;
-
- /* cast the namby-pamby void into a real pointer
- */
- cards = (FITSCard) data;
-
- Calloc(fits, sizeof(struct _FITSHead));
- fits->mem = FT_MALLOC;
- fits->primary = NULL;
- fits->filename = NULL;
- fits->rfcount = 1;
-
- if ( cards ) {
- fits->cards = fits->last = cards;
- fits->acard = fits->ncard = Abs(bytes/FT_CARDLEN);
- if ( bytes > 0 ) fits->mem = FT_EXTERN;
-
- if ( bytes > 0 && (end=ft_headfindseq(fits, "END", 0, &match)) ) {
- fits->ncard = end - fits->cards + 1;
- fits->acard = ((fits->ncard+FT_CARDS-1)/FT_CARDS) * FT_CARDS;
- fits->data = fits->acard * FT_CARDLEN;
- }
- } else {
- if ( bytes == 0 ) bytes = FT_CARDS * FT_CARDLEN;
-
- fits->acard = bytes/FT_CARDLEN ? bytes/FT_CARDLEN : FT_CARDS;
- (void)Calloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1);
- /* make sure there is a null at the end (EGM) */
- ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0';
- ft_cardclr(fits->cards, fits->acard);
- fits->ncard = 0;
- fits->data = fits->acard * FT_CARDLEN;
- }
- fits->index = NULL;
- fits->last = fits->cards;
-
- if ( !cards || (bytes > 0 && !end) ) {
- fits->ncard = 1;
- ft_cardkey(fits->cards, "END", 0);
- } else {
- if ( end ) {
- ft_syncdata(fits);
- }
- }
-
- fits->sync = 0;
- fits->cache = NULL;
-
- return fits;
-}
-
-/* Make a copy of a #FITSHead data structure.
- */
-FITSHead ft_headcopy(fits)
- FITSHead fits;
-{
- FITSHead head;
-
- if ( fits == NULL ) return ft_headinit(NULL, 0);
-
- Calloc(head, sizeof(struct _FITSHead));
- head->primary = NULL;
- head->rfcount = 1;
-
- if ( fits->primary )
- ft_primlink(fits->primary, head);
-
- memmove(head, fits, sizeof(struct _FITSHead));
-
- (void)Calloc (head->cards, head->acard * FT_CARDLEN + 1);
- /* make sure there is a null at the end (EGM) */
- ((char *)head->cards)[head->acard * FT_CARDLEN] = '\0';
- memmove(head->cards, fits->cards, head->acard * FT_CARDLEN);
-
- head->index = NULL;
- head->basic = NULL;
- head->image = NULL;
- head->table = NULL;
- head->mem = FT_MALLOC;
- head->mmap_here = 0;
- head->mmap_size = 0;
-
- /* realloc filename string for the copy record */
- if( head->filename ) head->filename = strdup(head->filename);
-
- ft_syncdata(head);
-
- if( head->index && !fits->index ){
- (void)Free(head->index);
- head->index = NULL;
- }
-
- return head;
-}
-
-/* Free a Fitsy FITS header data structure.
- */
-void ft_headfree(fits, freecards)
- FITSHead fits;
- int freecards; /* Free the FITS cards? */
-{
- if ( fits == NULL ) return;
-
- if ( --fits->rfcount ) return;
-
- if ( fits->index ) (void)Free(fits->index);
- if ( fits->filename ) (void)Free(fits->filename);
-
- if ( fits->basic ) ft_basicfree(fits->basic);
- if ( fits->image ) ft_imagefree(fits->image);
- if ( fits->table ) ft_tablefree(fits->table);
-
- if ( fits->mem == FT_MALLOC && freecards ) (void)Free(fits->cards);
-
-#ifdef HAVE_SYS_MMAN_H
- if ( fits->mem == FT_MMAP ) ft_munmap(fits);
-#endif
-#ifdef HAVE_SYS_SHM_H
- if ( fits->mem == FT_SHMAT ) ft_shmdt(fits);
-#endif
-
- if ( fits->primary ) ft_headfree(fits->primary, 1);
-
- (void)Free(fits);
-}
-
-void ft_primlink(prim, fits)
- FITSHead prim;
- FITSHead fits;
-{
- if ( prim == NULL ) return;
- if ( fits == NULL ) return;
-
- fits->primary = prim;
- prim->rfcount++;
-}
-
-/* Set the card buffer
- */
-void ft_setcards(fits, cards)
- FITSHead fits;
- void *cards;
-{
- fits->cards = (FITSCard) cards;
-}
-
-/* Make a copy of the header and force it to be a simple primary header.
- */
-FITSHead ft_primary(fits)
- FITSHead fits;
-{
- FITSHead prim;
- int one = 1;
-
- prim = ft_headcopy(fits);
-
- ft_cardfmt(ft_cardnth(prim, 1)
- , "SIMPLE", 0, FT_LOGICAL, &one, 0, FT_Comment);
-
- ft_headdel(prim, "EXTVER", 0);
- ft_headdel(prim, "GCOUNT", 0);
- ft_headdel(prim, "PCOUNT", 0);
- ft_headdel(prim, "EXTEND", 0);
- ft_headdel(prim, "NEXTEND", 0);
- ft_headdel(prim, "INHERIT", 0);
-
- return prim;
-}
-
-/* Merge cards from fits1 to fits2
- */
-FITSHead ft_headmerge(fits1, fits2, copy)
- FITSHead fits1;
- FITSHead fits2;
- int copy;
-{
- FITSHead merge;
- FITSCard card;
- int i, match;
-
- merge = ft_headcopy(fits1);
-
- if ( fits2 != NULL ) {
- i = 1;
- card = ft_cardnth(fits2, 1);
- if( !strcmp(card->c, "SIMPLE") || !strcmp(card->c, "XTENSION") )
- i = 2;
- for ( ; i < ft_ncards(fits2); i++ ) {
- /* The card is not in the merge header
- */
- if ( !(card = ft_cardfindseq(merge
- , ft_cardnth(fits2, i), &match)) ) {
- ft_cardapp(merge, ft_cardnth(fits2, i));
- } else {
- if ( !match ) {
- ft_cardins(merge, ft_cardnth(fits2, i), card);
- } else {
- /* special cards always are inserted */
- if( !strncmp(card->c, "HISTORY ", 8) ||
- !strncmp(card->c, "CONTINUE ", 9) ||
- !strncmp(card->c, "COMMENT ", 8) ||
- !strncmp(card->c, " ", 8) )
- ft_cardapp(merge, ft_cardnth(fits2, i));
- else if( copy ) ft_cardcpy(card , ft_cardnth(fits2, i));
- }
- }
- }
-
- }
-
- ft_syncdata(merge);
-
- return merge;
-}
diff --git a/funtools/fitsy/headins.c b/funtools/fitsy/headins.c
deleted file mode 100644
index a83a9f4..0000000
--- a/funtools/fitsy/headins.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Routines to insert, append and delete FITS cards from a header.
-
- These routines allow FITS cards to be inserted, appended and deleted
- by keyword value.
-
- The insertion routines format a new card with the supplied keyword and
- value and insert it after indicated card. The append routines add new
- cards to the end of the header (before the END card).
-
- */
-
-#include "fitsy.h"
-
-/* Insert a logical value FITS card into a header.
- */
-FITSCard ft_headinsl(fits, name, n, lvalue, comm, here)
- FITSHead fits; /* FITS header to insert, append or
- delete a card.
- */
- char *name; /* Name of the FITS card. */
- int n; /* keyword index number, if is zero no
- index number is appended to the
- keyword.
- */
- int lvalue;/* Logical to format as a FITS value. */
- char *comm; /* Comment for the new card. */
- FITSCard here; /* Insert the new card after this card. */
-{
- FITSBuff card;
-
- return ft_cardins(fits
- , ft_cardfmt(&card, name, n, FT_LOGICAL, &lvalue, 0, comm)
- , here);
-}
-
-/* Insert a integer value FITS card into a header.
- */
-FITSCard ft_headinsi(fits, name, n, ivalue, comm, here)
- FITSHead fits;
- char *name;
- int n;
- int ivalue;/* Integer to format as a FITS value. */
- char *comm;
- FITSCard here;
-{
- FITSBuff card;
-
- return ft_cardins(fits
- , ft_cardfmt(&card, name, n, FT_INTEGER, &ivalue, 0, comm)
- , here);
-}
-
-/* Insert a longlong integer value FITS card into a header.
- */
-FITSCard ft_headinsil(fits, name, n, ivalue, comm, here)
- FITSHead fits;
- char *name;
- int n;
- longlong ivalue;/* Integer to format as a FITS value. */
- char *comm;
- FITSCard here;
-{
- FITSBuff card;
-
- return ft_cardins(fits
- , ft_cardfmt(&card, name, n, FT_LONG, &ivalue, 0, comm)
- , here);
-}
-
-/* Insert a real value FITS card into a header.
- */
-FITSCard ft_headinsr(fits, name, n, dvalue, prec, comm, here)
- FITSHead fits;
- char *name;
- int n;
- double dvalue;/* Double to format as a FITS value. */
- int prec; /* Precision for the value */
- char *comm;
- FITSCard here;
-{
- FITSBuff card;
-
- return ft_cardins(fits
- , ft_cardfmt(&card, name, n, FT_REAL, &dvalue, prec, comm)
- , here);
-}
-
-/* Insert a string value FITS card into a header.
- */
-FITSCard ft_headinss(fits, name, n, svalue, comm, here)
- FITSHead fits;
- char *name;
- int n;
- char *svalue;/* String to format as a FITS value */
- char *comm;
- FITSCard here;
-{
- FITSBuff card;
-
- return ft_cardins(fits
- , ft_cardfmt(&card, name, n, FT_STRING, svalue, 0, comm)
- , here);
-}
-
-/* Insert a raw value FITS card into a header.
- */
-FITSCard ft_headinsv(fits, name, n, vvalue, comm, here)
- FITSHead fits;
- char *name;
- int n;
- char *vvalue;/* Raw value to format as a FITS value */
- char *comm;
- FITSCard here;
-{
- FITSBuff card;
-
- return ft_cardins(fits
- , ft_cardfmt(&card, name, n, FT_VALUE, vvalue, 0, comm)
- , here);
-}
-
-/* Append a logical value FITS card to a header.
- */
-FITSCard ft_headappl(fits, name, n, lvalue, comm)
- FITSHead fits;
- char *name;
- int n;
- int lvalue;
- char *comm;
-{
- return ft_headinsl(fits, name, n, lvalue, comm, NULL);
-}
-
-/* Append a integer value FITS card to a header.
- */
-FITSCard ft_headappi(fits, name, n, ivalue, comm)
- FITSHead fits;
- char *name;
- int n;
- int ivalue;
- char *comm;
-{
- return ft_headinsi(fits, name, n, ivalue, comm, NULL);
-}
-
-/* Append a 64-bit integer value FITS card to a header.
- */
-FITSCard ft_headappil(fits, name, n, ivalue, comm)
- FITSHead fits;
- char *name;
- int n;
- longlong ivalue;
- char *comm;
-{
- return ft_headinsil(fits, name, n, ivalue, comm, NULL);
-}
-
-/* Append a real value FITS card to a header.
- */
-FITSCard ft_headappr(fits, name, n, dvalue, prec, comm)
- FITSHead fits;
- char *name;
- int n;
- double dvalue;
- int prec;
- char *comm;
-{
- return ft_headinsr(fits, name, n, dvalue, prec, comm, NULL);
-}
-
-/* Append a string value FITS card to a header.
- */
-FITSCard ft_headapps(fits, name, n, svalue, comm)
- FITSHead fits;
- char *name;
- int n;
- char *svalue;
- char *comm;
-{
- return ft_headinss(fits, name, n, svalue, comm, NULL);
-}
-
-
-/* Append a raw value FITS card to a header.
- */
-FITSCard ft_headappv(fits, name, n, vvalue, comm)
- FITSHead fits;
- char *name;
- int n;
- char *vvalue;
- char *comm;
-{
- return ft_headinsv(fits, name, n, vvalue, comm, NULL);
-}
-
-
-/* Find and delete a card from a FITS header.
- */
-FITSCard ft_headdel(fits, name, n)
- FITSHead fits;
- char *name;
- int n;
-{
- return ft_carddel(fits, ft_headfind(fits, name, n, 0));
-}
diff --git a/funtools/fitsy/headset.c b/funtools/fitsy/headset.c
deleted file mode 100644
index ed586c7..0000000
--- a/funtools/fitsy/headset.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Fitsy FITS header set routines.
-
- EXAMPLES
-
- Set the value part of a card in a header:
-+
- int i = 15;
- double d = 34.7;
- char *c = "Shutter";
-
- FITSCard fits;
- FITSCard card;
-
- card = #ft_headsetl(fits, "Cosmic", 0, 1, "Removed Cosimics (silver bullet method)");
- card = #ft_headseti(fits, "IValue" , 0, i, "15 is the number");
-
- card = #ft_headsetr(fits, "Gain", 1, d, 2, "GAIN1");
- card = #ft_headsetr(fits, "Gain", 2, d, 2, "GAIN2");
-
- card = #ft_headsets(fits, "XHIST", 1, "Xray processed!", NULL);
-
- /-* In this example the special pointer #ft_comment is used to
- use the existing comment in the card.
- *-/
- card = #ft_headsets(fits, "FILTER", 0, "V", ft_comment);
-+
- */
-
-#include "fitsy.h"
-
-/* Find a FITS card in the header and format a logical value into it.
- */
-FITSCard ft_headsetl(fits, name, n, lvalue, comm, append)
- FITSHead fits; /* FITS header to search in. */
- char *name; /* keyword name. */
- int n; /* keyword index number, if is zero no
- index number is appended to the keyword.
- */
-
- int lvalue; /* Logical to format as a FITS value. */
- char *comm; /* Comment for the card. */
- int append; /* Append the card if not found */
-{
- FITSCard card;
-
- if ( !(card = ft_cardsetl(ft_headfind(fits, name, n, 1), lvalue, comm))
- && append )
- card = ft_headappl(fits, name, n, lvalue, comm);
-
- return card;
-}
-
-/* Find a FITS card in the header and format a logical value into it.
- */
-FITSCard ft_headseti(fits, name, n, ivalue, comm, append)
- FITSHead fits;
- char *name;
- int n;
- int ivalue; /* Integer to format as a FITS value. */
- char *comm;
- int append;
-{
- FITSCard card;
-
- if ( !(card = ft_cardseti(ft_headfind(fits, name, n, 1), ivalue, comm))
- && append )
- card = ft_headappi(fits, name, n, ivalue, comm);
-
- return card;
-}
-
-/* Find a FITS card in the header and format a logical value into it.
- */
-FITSCard ft_headsetil(fits, name, n, ivalue, comm, append)
- FITSHead fits;
- char *name;
- int n;
- longlong ivalue; /* Integer to format as a FITS value. */
- char *comm;
- int append;
-{
- FITSCard card;
-
- if ( !(card = ft_cardsetil(ft_headfind(fits, name, n, 1), ivalue, comm))
- && append )
- card = ft_headappil(fits, name, n, ivalue, comm);
-
- return card;
-}
-
-/* Find a FITS card in the header and format a logical value into it.
- */
-FITSCard ft_headsetr(fits, name, n, rvalue, prec, comm, append)
- FITSHead fits;
- char *name;
- int n;
- double rvalue; /* Double to format as a FITS value. */
- int prec; /* The value is formatted
- at this precision.
- */
- char *comm;
- int append;
-{
- FITSCard card;
-
- if ( !(card = ft_cardsetr(ft_headfind(fits, name, n, 1)
- , rvalue, prec, comm))
- && append )
- card = ft_headappr(fits, name, n, rvalue, prec, comm);
-
- return card;
-}
-
-/* Find a FITS card in the header and format a string value into it.
- */
-FITSCard ft_headsets(fits, name, n, svalue, comm, append)
- FITSHead fits;
- char *name;
- int n;
- char *svalue; /* String to format as a FITS value. */
- char *comm;
- int append;
-{
- FITSCard card;
-
- if ( !(card = ft_cardsets(ft_headfind(fits, name, n, 1), svalue, comm))
- && append )
- card = ft_headapps(fits, name, n, svalue, comm);
-
- return card;
-}
-
diff --git a/funtools/fitsy/headsimple.c b/funtools/fitsy/headsimple.c
deleted file mode 100644
index 79cefb1..0000000
--- a/funtools/fitsy/headsimple.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* headsimple.c
- */
-
-#include <xos.h>
-#include <fitsy.h>
-
-FITSHead ft_headsimple(mem, bytes, naxis, naxes, bitpix)
- void *mem;
- int bytes;
- int bitpix;
- int naxis;
- int *naxes;
-{
- FITSHead fits;
- int i;
-
- if ( mem ) memset(mem, 0, bytes);
-
- fits = ft_headinit((FITSCard) mem, bytes);
- ft_headappl(fits, "SIMPLE" , 0, 1 , NULL);
- ft_headappi(fits, "BITPIX" , 0, bitpix , NULL);
- ft_headappi(fits, "NAXIS" , 0, naxis , NULL);
-
- for ( i = 1; i <= naxis; i++ ) {
- ft_headappi(fits, "NAXIS" , 1, naxes[i], NULL);
- }
- return fits;
-}
-
-
diff --git a/funtools/fitsy/headtable.c b/funtools/fitsy/headtable.c
deleted file mode 100644
index 0e34d59..0000000
--- a/funtools/fitsy/headtable.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* Fitsy FITS routines to load and store #FITSTable structures.
- */
-
-#include <xos.h>
-#include "fitsy.h"
-
-char * ft_formattyp(c)
- char c;
-{
- switch ( c ) {
- case 'L': return "c";
- case 'X': return "x";
- case 'B': return "ud";
- case 'I': return "d";
- case 'J': return "d";
- case 'K': return "lld";
- case 'U': return "ud";
- case 'V': return "ud";
- case 'F': return "f";
- case 'E': return "f";
- case 'D': return "f";
- case 'A': return "s";
- case 'C': return "f";
- case 'M': return "f";
- case 'P': return "x";
- case 'G': return "f";
- }
-
- /* probably won't work, but a NULL will segv */
- return "";
-}
-
-char *ft_format(col)
- FITSTCol col;
-{
- char format[80];
-
- char t = col->type;
- int w = col->width;
- int p = col->prec;
-
- if ( col->disp != NULL ) {
- sscanf(col->disp, " %c %d.%d", &t, &w, &p);
- }
-
- snprintf(format, 80, "%%%d.%d%s", w, p, ft_formattyp(t));
- return strdup(format);
-}
-
-int ft_sizeof(c)
- int c;
-{
- switch ( c ) {
- case 'P': return 8;
- case 'U': return 2;
- case 'I': return 2;
- case 'V': return 4;
- case 'J': return 4;
- case 'K': return 8;
- case 'F': return 4;
- case 'E': return 4;
- case 'D': return 8;
- case 'A': return 1;
- case 'L': return 1;
- case 'X': return 1;
- case 'B': return 1;
- case 'C': return 8;
- case 'M': return 16;
-
- case 8: return 1;
- case 16: return 2;
- case 32: return 4;
- case 64: return 8;
-
- case FT_UNSIGNED | 8: return 1;
- case FT_UNSIGNED | 16: return 2;
- case FT_UNSIGNED | 32: return 4;
-
- case -32: return 4;
- case -64: return 8;
-
- }
-
- return 0;
-}
-
-
-/* Allocate and load a #FITSTable data structure.
- */
-FITSTable ft_tableloadhead(fits)
- FITSHead fits;
-{
- FITSTable table = NULL;
- FITSCard card;
- char *xtension;
- int i;
-
- int offset = 0;
-
- if ( (xtension = ft_headget(fits, "XTENSION", 0, &card)) != NULL
- && ( !strcmp(xtension, "TABLE")
- || !strcmp(xtension, "BINTABLE")
- || !strcmp(xtension, "A3DTABLE")
- || !strcmp(xtension, "3DTABLE") ) ) {
- Malloc(table, sizeof(struct _FITSTable));
-
- table->tabtype = !strcmp(xtension, "TABLE");
- if ( !(table->tfields = ft_headgeti(fits, "TFIELDS", 0, 0, &card)) ) {
- (void)Free(table);
- return NULL;
- }
-
- ft_headindex(fits);
-
- Malloc(table->col, sizeof(struct _FITSTCol) * table->tfields);
-
- for ( i = 1; i <= table->tfields; i++ ) {
- FITSCard card;
- char *tform;
- int r = 0, w = 0, p = 0;
- char t = ' ', h = ' ';
- char format[64];
-
- table->col[i-1].name = ft_headgets(fits, "TTYPE", i, NULL, &card);
- table->col[i-1].unit = ft_headgets(fits, "TUNIT", i, NULL, &card);
- table->col[i-1].scale = ft_headgetr(fits, "TSCAL", i, 1.0, &card);
- table->col[i-1].has_scale = card != NULL;
- table->col[i-1].zero = ft_headgetr(fits, "TZERO", i, 0.0, &card);
- table->col[i-1].has_zero = card != NULL;
- table->col[i-1].scaled = table->col[i-1].has_zero || table->col[i-1].has_scale;
- table->col[i-1].ablank = ft_headgets(fits, "TNULL", i, NULL, &card);
- table->col[i-1].has_blank = card != NULL;
- tform = ft_headget(fits, "TFORM", i, &card);
- /* if we have no TFORM, its an illegal binary table */
- if( !card ){
- table->tfields = i;
- ft_tablefree(table);
- return NULL;
- }
-
- /* hacked support for variable length arrays. we ignore the data
- and just process the 2 64-bit pointers */
- if ( sscanf(tform, "%d P %c ( %d )", &r, &t, &w) == 3 ) {
- /* save values for variable length array */
- table->col[i-1].vla = strdup(tform);
- table->col[i-1].vla_type = t;
- table->col[i-1].vla_max = w;
- /* set up vla pointer values in the table */
- r = 2;
- t = 'J';
- w = 0;
- }
- else if ( sscanf(tform, "P %c ( %d )", &t, &w) == 2 ) {
- /* save values for variable length array */
- table->col[i-1].vla = strdup(tform);
- table->col[i-1].vla_type = t;
- table->col[i-1].vla_max = w;
- /* set up vla pointer values in the table */
- r = 2;
- t = 'J';
- w = 0;
- }
- else if ( sscanf(tform, "%d Q %c ( %d )", &r, &t, &w) == 3 ) {
- /* save values for variable length array */
- table->col[i-1].vla = strdup(tform);
- table->col[i-1].vla_type = t;
- table->col[i-1].vla_max = w;
- /* set up vla pointer values in the table */
- r = 2;
- t = 'K';
- w = 0;
- }
- else if ( sscanf(tform, "Q %c ( %d )", &t, &w) == 2 ) {
- /* save values for variable length array */
- table->col[i-1].vla = strdup(tform);
- table->col[i-1].vla_type = t;
- table->col[i-1].vla_max = w;
- /* set up vla pointer values in the table */
- r = 2;
- t = 'K';
- w = 0;
- }
- else{
- if ( !sscanf(tform, " %d %c %d.%d", &r, &t, &w, &p) ) {
- r = 1;
- sscanf(tform, " %c %d.%d", &t, &w, &p);
- }
- }
- if ( table->tabtype ) { /* ASCII TABLE */
- table->col[i-1].format = strdup(format);
-
- table->col[i-1].type = 'A';
- table->col[i-1].n = 1;
- table->col[i-1].size = w;
- table->col[i-1].offset = ft_headgeti(fits, "TBCOL", i, 0, &card)
- - 1;
- table->col[i-1].heap = 0;
- table->col[i-1].prec = p;
-
- } else { /* BINTABLE */
-
- switch ( t ) {
- case 'P':
- table->col[i-1].heap = 1;
- table->col[i-1].type = h;
- table->col[i-1].n = p;
- table->col[i-1].size = ft_sizeof(table->col[i-1].type);
- table->col[i-1].width= table->col[i-1].size
- * table->col[i-1].n;
- break;
- case 'A':
- p = 1;
- if ( !sscanf(tform, " %d %c%d", &r, &t, &p) ) {
- r = 1;
- sscanf(tform, " %c%d", &t, &p);
- }
-
- table->col[i-1].heap = 0;
- table->col[i-1].type = t;
- table->col[i-1].n = r;
- table->col[i-1].size = 1;
- table->col[i-1].width= table->col[i-1].size
- * table->col[i-1].n;
- break;
- case 'X':
- table->col[i-1].heap = 0;
- table->col[i-1].type = t;
- table->col[i-1].n = r;
- table->col[i-1].size = ft_sizeof(table->col[i-1].type);
- table->col[i-1].width=
- ((table->col[i-1].size * table->col[i-1].n) + 7) / 8;
- table->col[i-1].prec = p;
- break;
- default:
- table->col[i-1].heap = 0;
- table->col[i-1].type = t;
- table->col[i-1].n = r;
- table->col[i-1].size = ft_sizeof(table->col[i-1].type);
- table->col[i-1].width= table->col[i-1].size
- * table->col[i-1].n;
- table->col[i-1].prec = p;
- break;
- }
-
- table->col[i-1].offset = offset;
-
- if ( table->col[i-1].heap )
- offset += 8;
- else
- offset += table->col[i-1].width;
-
- if ( table->col[i-1].ablank )
- table->col[i-1].dblank =
- strtod(table->col[i-1].ablank, NULL);
-
- table->col[i-1].disp = ft_headgets(fits, "TDISP", i, NULL, &card);
- table->col[i-1].format = ft_format(&table->col[i-1]);
- }
- }
- if ( table->tabtype ) { /* ASCII TABLE */
- for ( i = 1; i < table->tfields; i++ ) {
- table->col[i-1].width = table->col[i].offset - table->col[i-1].offset;
- }
- table->col[i-1].width = fits->basic->naxis[0] - table->col[i-1].offset;
- }
-
- }
-
- return table;
-}
-
-/* Store a #FITSTable structure in a FITS header.
- */
-void ft_tablestorhead(fits, table)
- FITSHead fits;
- FITSTable table;
-{
- ft_basicstorhead(fits, fits->basic);
-}
-
-/* Free a #FITSTable structure.
- */
-void ft_tablefree(table)
- FITSTable table;
-{
- int i;
-
- for ( i = 1; i <= table->tfields; i++ ) {
- if ( table->col[i-1].name ) free(table->col[i-1].name);
- if ( table->col[i-1].unit ) free(table->col[i-1].unit);
- if ( table->col[i-1].disp ) free(table->col[i-1].disp);
- if ( table->col[i-1].format ) free(table->col[i-1].format);
- if ( table->col[i-1].vla ) free(table->col[i-1].vla);
- if ( table->col[i-1].ablank ) free(table->col[i-1].ablank);
- }
-
- (void)Free(table->col);
- (void)Free(table);
-}
diff --git a/funtools/fitsy/headwcs.c b/funtools/fitsy/headwcs.c
deleted file mode 100644
index 8c41c95..0000000
--- a/funtools/fitsy/headwcs.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* headwcs.c
- */
-
-#include <xos.h>
-#include "fitsy.h"
-
-int ft_trxlcs(lcs, x0, y0, x1, y1, direction)
- FITSLinWCS lcs;
- double x0;
- double y0;
- double *x1;
- double *y1;
- int direction;
-{
- if ( !lcs->has_wcs ) {
- *x1 = x0;
- *y1 = y0;
- return 0;
- }
-
- if ( direction ) {
- *x1 = x0 * lcs->fwd[0][0] + y0 * lcs->fwd[1][0] + lcs->fwd[2][0];
- *y1 = x0 * lcs->fwd[0][1] + y0 * lcs->fwd[1][1] + lcs->fwd[2][1];
- } else {
- *x1 = x0 * lcs->rev[0][0] + y0 * lcs->rev[1][0] + lcs->rev[2][0];
- *y1 = x0 * lcs->rev[0][1] + y0 * lcs->rev[1][1] + lcs->rev[2][1];
- }
-
- return 1;
-}
-
-int ft_trxsiz(lcs, x0, y0, x1, y1, direction)
- FITSLinWCS lcs;
- double x0;
- double y0;
- double *x1;
- double *y1;
- int direction;
-{
- if ( !lcs->has_wcs ) {
- *x1 = x0;
- *y1 = y0;
- return 0;
- }
-
- if ( direction ) {
- *x1 = x0 * lcs->fwd[0][0];
- *y1 = y0 * lcs->fwd[1][1];
- } else {
- *x1 = x0 * lcs->rev[0][0];
- *y1 = y0 * lcs->rev[1][1];
- }
-
- return 1;
-}
-
-void ft_loglcs(fits, m11, m12, m21, m22, v1, v2)
- FITSHead fits;
- double m11, m12, m21, m22;
- double v1, v2;
-{
- if ( m11 != 1.0 ) ft_headsetr(fits, "LTM1_1", 0, m11, 7, NULL, 1);
- if ( m12 != 0.0 ) ft_headsetr(fits, "LTM1_2", 0, m12, 7, NULL, 1);
- if ( m21 != 0.0 ) ft_headsetr(fits, "LTM2_1", 0, m21, 7, NULL, 1);
- if ( m22 != 1.0 ) ft_headsetr(fits, "LTM2_2", 0, m22, 7, NULL, 1);
- if ( v1 != 0.0 ) ft_headsetr(fits, "LTV1" , 0, v1, 7, NULL, 1);
- if ( v2 != 0.0 ) ft_headsetr(fits, "LTV2" , 0, v2, 7, NULL, 1);
-}
-
-void ft_wcslcs(fits, m11, m12, m21, m22, crv1, crv2, crp1, crp2, cun1, cun2)
- FITSHead fits;
- double m11, m12, m21, m22;
- double crv1, crv2, crp1, crp2;
- char *cun1, *cun2;
-{
- ft_headsets(fits, "CTYPE1" , 0, "LINEAR", NULL, 1);
- ft_headsets(fits, "CTYPE2" , 0, "LINEAR", NULL, 1);
-
- if ( crv1 != 0.0 ) ft_headsetr(fits, "CRVAL1" , 0, crv1, 7, NULL, 1);
- if ( crp1 != 0.0 ) ft_headsetr(fits, "CRPIX1" , 0, crp1, 7, NULL, 1);
- if ( cun1 != NULL) ft_headsets(fits, "CUNIT1" , 0, cun1, NULL, 1);
-
- if ( crv2 != 0.0 ) ft_headsetr(fits, "CRVAL2" , 0, crv2, 7, NULL, 1);
- if ( crp2 != 0.0 ) ft_headsetr(fits, "CRPIX2" , 0, crp2, 7, NULL, 1);
- if ( cun2 != NULL) ft_headsets(fits, "CUNIT2" , 0, cun2, NULL, 1);
-
- if ( m11 != 1.0 ) ft_headsetr(fits, "CD1_1", 0, m11, 7, NULL, 1);
- if ( m12 != 0.0 ) ft_headsetr(fits, "CD1_2", 0, m12, 7, NULL, 1);
- if ( m21 != 0.0 ) ft_headsetr(fits, "CD2_1", 0, m21, 7, NULL, 1);
- if ( m22 != 1.0 ) ft_headsetr(fits, "CD2_2", 0, m22, 7, NULL, 1);
-}
diff --git a/funtools/fitsy/install-sh b/funtools/fitsy/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/fitsy/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/fitsy/inverse.c b/funtools/fitsy/inverse.c
deleted file mode 100644
index 1ed7b75..0000000
--- a/funtools/fitsy/inverse.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/****
- *
- * Chop the code to do this for 2D.
- *
- * affine_matrix4_inverse
- *
- * Computes the inverse of a 3D affine matrix; i.e. a matrix with a dimen-
- * sionality of 4 where the right column has the entries (0, 0, 0, 1).
- *
- * This procedure treats the 4 by 4 matrix as a block matrix and
- * calculates the inverse of one submatrix for a significant perform-
- * ance improvement over a general procedure that can invert any non-
- * singular matrix:
- * -- -- -- --
- * | | -1 | -1 |
- * | A 0 | | A 0 |
- * -1 | | | |
- * M = | | = | -1 |
- * | C 1 | | -C A 1 |
- * | | | |
- * -- -- -- --
- *
- * where M is a 4 by 4 matrix,
- * A is the 3 by 3 upper left submatrix of M,
- * C is the 1 by 3 lower left submatrix of M.
- *
- * Input:
- * in - 3D affine matrix
- *
- * Output:
- * out - inverse of 3D affine matrix
- *
- * Returned value:
- * TRUE if input matrix is nonsingular
- * FALSE otherwise
- *
- ***/
-
-#include <xos.h>
-
-
-typedef double Matrix3[3][2];
-
-int ft_inverse (in, out)
- register Matrix3 in;
- register Matrix3 out;
-{
- register double det_1;
- double pos, neg, temp;
-
-#define ACCUMULATE \
- if (temp >= 0.0) \
- pos += temp; \
- else \
- neg += temp;
-
-#define PRECISION_LIMIT (1.0e-15)
-
- /*
- * Calculate the determinant of submatrix A and determine if the
- * the matrix is singular as limited by the double precision
- * floating-point data representation.
- */
- pos = neg = 0.0;
- temp = in[0][0] * in[1][1];
- ACCUMULATE
- temp = -in[0][1] * in[1][0];
- ACCUMULATE
- det_1 = pos + neg;
-
- /* Is the submatrix A singular? */
- if ((det_1 == 0.0) || (Abs(det_1 / (pos - neg)) < PRECISION_LIMIT)) {
-
- /* Matrix M has no inverse */
- /* EPrint("affine_matrix3_inverse: singular matrix\n"); */
- return 0;
- }
-
- else {
- /* Calculate inverse(A) = adj(A) / det(A) */
- det_1 = 1.0 / det_1;
- out[0][0] = in[1][1] * det_1;
- out[1][0] = - in[1][0] * det_1;
- out[0][1] = - in[0][1] * det_1;
- out[1][1] = in[0][0] * det_1;
-
- /* Calculate -C * inverse(A) */
- out[2][0] = - ( in[2][0] * out[0][0] + in[2][1] * out[1][0] );
- out[2][1] = - ( in[2][0] * out[0][1] + in[2][1] * out[1][1] );
-
- return 1;
- }
-}
diff --git a/funtools/fitsy/longlong.h b/funtools/fitsy/longlong.h
deleted file mode 100644
index 0a0afc1..0000000
--- a/funtools/fitsy/longlong.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef LONGLONG_H
-#define LONGLONG_H
-
-#if HAVE_LONG_LONG
-typedef long long longlong;
-#else
-typedef long longlong;
-#endif
-
-#endif
-
-
diff --git a/funtools/fitsy/nd.c b/funtools/fitsy/nd.c
deleted file mode 100644
index 1ae3461..0000000
--- a/funtools/fitsy/nd.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* nd.c
- */
-
-#include <xos.h>
-#include <fitsy.h>
-
-void *ft_alloc2d(size, xstar, ystar, xsize, ysize)
- int size;
- int xstar;
- int ystar;
- int xsize;
- int ysize;
-{
- void *ptr;
-
- Malloc(ptr, xsize * ysize * size);
- return ft_make2d(ptr, size, xstar, ystar, xsize, ysize);
-}
-
-
-char **ft_make2d(ptr, size, xstar, ystar, xsize, ysize)
- char *ptr;
- int size;
- int xstar;
- int ystar;
- int xsize;
- int ysize;
-{
- char **ptr2d;
-
- if ( ptr == NULL ) return NULL;
-
- Malloc(ptr2d, ysize * sizeof(void *));
-
- if ( ptr2d == NULL ) return NULL;
-
- for (; ysize--;) {
- ptr2d[ysize] = ptr + xsize * ysize * size - xstar * size;
- }
- return ptr2d - ystar;
-}
-
-void ft_free2d(ptr2d, size, xstar, ystar)
- char **ptr2d;
- int size;
- int xstar;
- int ystar;
-{
- free(&ptr2d[ystar][xstar * size]);
- free(&ptr2d[ystar]);
-}
diff --git a/funtools/fitsy/parse.c b/funtools/fitsy/parse.c
deleted file mode 100644
index ffe0d52..0000000
--- a/funtools/fitsy/parse.c
+++ /dev/null
@@ -1,196 +0,0 @@
-
-#include <stdio.h>
-
-char *strchr();
-char *strchr();
-
-
-main()
-{
- char filename[1024];
-
- char xsect[1024];
- char ysect[1024];
-
- int x0, x1, y0, y1;
- int xsection = 0;
- int ysection = 0;
-
-
- char extn[1024];
- int exti;
- char tail[1024];
- char cattail[1024];
-
- char line[1024];
- char *l;
- char *k;
- int i, n;
-
- int length = 0;
-
- while ( l = gets(line) ) {
- i = 0;
- filename[i] = '\0';
-
- printf("line : %s\n", line);
-
- extn[0] = '\0';
- exti = -1;
- tail[0] = '\0';
- cattail[0] = '\0';
-
- xsection = 0;
- ysection = 0;
-
- while ( *l ) {
- if ( tail[0] ) {
- strcat(cattail, "[");
- strcat(cattail, tail);
- strcat(cattail, "]");
- }
- tail[0] = '\0';
-
- /* Copy characters to the filename until a
- section starts.
- */
- while ( *l && *l != '[' ) filename[i++] = *l++;
- if ( !*l ) break;
-
- /* Record where the section begins.
- Translate quoted "]" chars to '\001'
- */
- k = l;
- while ( *l && *l != ']' ) {
- if ( *l == '\'' || *l == '"' ) {
- char q = *l;
- l++;
-
- while ( *l && *l != q ) {
- if ( *l == ']' ) *l = '\001';
- l++;
- }
- }
- l++;
- }
- if ( *l != ']' ) fprintf(stderr, "unterminated section\n");
- l++;
-
- /* Look for sections
- */
- length = l - k;
-
- /* IMIO Image Section ?
- */
- if ( sscanf(k, "[%[-+0-9:*],%[-+0-9:*]]%n", xsect, ysect, &n) == 2 && n == length ) {
- if ( !strcmp(xsect, "*") ) xsection = 1;
- else
- if ( !strcmp(xsect, "-*") ) xsection = -1;
- else
- if ( sscanf(xsect, "%d:%d", &x0, &x1) == 2 )
- xsection = 2;
- else
- goto tryagain;
-
- if ( !strcmp(ysect, "*") ) ysection = 1;
- else
- if ( !strcmp(ysect, "-*") ) ysection = -1;
- else
- if ( sscanf(ysect, "%d:%d", &y0, &y1) == 2 )
- ysection = 2;
- else
- goto tryagain;
-
- continue;
- }
-
- /* The section looked a little like an image section
- but its didn't work out.
- */
- tryagain:
-
- if ( sscanf(k, "[%d]%n" , &exti, &n) == 1 /* exti */
- && n == length )
- continue;
-
- exti = -1;
-
- if ( sscanf(k, "[%[^]\"',=+-]]%n" , extn, &n) == 1 /* extn */
- && n == length )
- continue;
-
- extn[0] = '\0';
-
- if ( sscanf(k, "[%[^]\"',=+-],%d]%n" , extn, &exti, &n) == 2 /* extn, exti */
- && n == length )
- continue;
-
- exti = -1;
- extn[0] = '\0';
-
- if ( sscanf(k, "[%[^]\"',=+-],%d, %[^]]]%n",extn, &exti, tail, &n)==3 /* extn, exti, tail */
- && n == length )
- continue;
-
- exti = -1;
- extn[0] = '\0';
- tail[0] = '\0';
-
- if ( sscanf(k, "[%d,%[^]]]%n" , &exti, tail, &n) == 2 /* exti, tail */
- && n == length )
- continue;
-
- exti = -1;
- tail[0] = '\0';
-
- if ( sscanf(k, "[%[^]\"',=+-],%[^]]]%n", extn, tail, &n) == 2 /* extn, tail */
- && n == length )
- continue;
-
- extn[0] = '\0';
- tail[0] = '\0';
-
- if ( sscanf(k, "[%[^]]]%n" , tail, &n) == 1 /* tail */
- && n == length )
- continue;
-
- tail[0] = '\0';
-
- fprintf(stderr, "unparsable section\n");
- }
-
- if ( tail[0] ) {
- strcat(cattail, "[");
- strcat(cattail, tail);
- strcat(cattail, "]");
- }
- filename[i] = '\0';
-
- /* Restore the "]" chars that might be lurking in
- the tail.
- */
- {
- char *t = cattail;
- while ( *t ) {
- if ( *t == '\001' ) *t = ']';
- t++;
- }
- }
-
- printf("filenname: %s\n", filename);
- switch ( xsection ) {
- case 0: printf(" no xsection\n"); break;
- case 1: printf(" xsection = *\n"); break;
- case -1: printf(" xsection = -*\n"); break;
- case 2: printf(" xsection = [%d:%d]\n", x0, x1); break;
- }
- switch ( ysection ) {
- case 0: printf(" no ysection\n"); break;
- case 1: printf(" ysection = *\n"); break;
- case -1: printf(" ysection = -*\n"); break;
- case 2: printf(" ysection = [%d:%d]\n", y0, y1); break;
- }
- printf(" extn = [%s, %d]\n", extn, exti);
- printf(" tail = %s\n", cattail);
- }
-}
diff --git a/funtools/fitsy/ptest.c b/funtools/fitsy/ptest.c
deleted file mode 100644
index eb84411..0000000
--- a/funtools/fitsy/ptest.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdio.h>
-
-#define SZ_LINE 256
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- char tbuf[SZ_LINE];
- char name[SZ_LINE];
- char extn[SZ_LINE];
- char tail[SZ_LINE];
- int indx;
-
- while( 1 ){
- *tbuf = '\0';
- if( feof(stdin) )
- break;
- gets(tbuf);
- if( *tbuf == 'q' )
- exit(0);
- if( (*tbuf == '\0') || (*tbuf == '\n') )
- continue;
- ft_parsefilename(tbuf, name, extn, SZ_LINE, &indx, tail, SZ_LINE);
- fprintf(stderr, "%s ->\nname='%s' extn='%s' indx='%d' tail='%s'\n\n",
- tbuf, name, extn, indx, tail);
- }
-}
diff --git a/funtools/fitsy/tableheader.c b/funtools/fitsy/tableheader.c
deleted file mode 100644
index e7a48e4..0000000
--- a/funtools/fitsy/tableheader.c
+++ /dev/null
@@ -1,230 +0,0 @@
-#include <xos.h>
-#include "fitsy.h"
-
-/*
- *
- * ft_tableheader -- read a string that details the structure
- * of the event record and generate a fitsy table header
- *
- * The structure of the string is:
- *
- * [name]:[n][type]:[(lodim:)hidim]
- *
- * Data types follow standard conventions for FITS binary tables, but include
- * two extra unsigned types ('U' and 'V'):
- *
- * B -- unsigned 8-bit char
- * I -- signed 16-bit int
- * J -- signed 32-bit int
- * K -- signed 64-bit int
- * E -- 32-bit float
- * D -- 64-bit float
- * U -- unsigned 16-bit int
- * V -- unsigned 32-bit int
- *
- * An optional integer value n can be prefixed to the type to indicate
- * that the element actually is an array of n values.
- *
- * Furthermore, image dimensions are attached to the event specification
- * in order to tell FITS how to bin the events into an image. They
- * follow the conventions for the FITS TLMIN, TLMAX, and TALEN
- * keywords. If the low image dimension is not specified, it defaults to
- * 1. Thus:
- *
- * RAWX:J:1:100
- * RAWX:J:100
- *
- * both specify that the dimension of this column runs from 1 to 100.
- * Note that it is required that all padding be specified in the record
- * definition.
- *
- *
- * For example, suppose a FITS binary table has the following set of column
- * definitions:
- *
- *
- * TTYPE1 = 'X ' / Label for field
- * TFORM1 = '1I ' / Data type for field
- * TLMIN1 = 1 / Min. axis value
- * TLMAX1 = 10 / Max. axis value
- * TTYPE2 = 'Y ' / Label for field
- * TFORM2 = '1I ' / Data type for field
- * TLMIN2 = 2 / Min. axis value
- * TLMAX2 = 11 / Max. axis value
- * TTYPE3 = 'PHA ' / Label for field
- * TFORM3 = '1I ' / Data type for field
- * TTYPE4 = 'PI ' / Label for field
- * TFORM4 = '1J ' / Data type for field
- * TTYPE5 = 'TIME ' / Label for field
- * TFORM5 = '1D ' / Data type for field
- * TTYPE6 = 'DX ' / Label for field
- * TFORM6 = '1E ' / Data type for field
- * TLMIN6 = 1 / Min. axis value
- * TLMAX6 = 10 / Max. axis value
- * TTYPE7 = 'DY ' / Label for field
- * TFORM7 = '1E ' / Data type for field
- * TLMIN7 = 3 / Min. axis value
- * TLMAX7 = 12 / Max. axis value
- *
- * An raw event file containing these same data would have the event
- * specification:
- *
- * X:I:10,Y:I:2:11,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:3:12
- *
- */
-FITSHead ft_tableheader(char *eventdef, int nev)
-{
- FITSHead header;
- char type[SZ_LINE];
- char name[SZ_LINE];
- char dim[SZ_LINE];
- char *neventdef = NULL;
- char *nevdef;
- char *d, *n, *s, *t, u[2];
- char **names, **types, **dims;
- char *extname="EVENTS";
- int extver=1;
- int cols, width, got;
- int i, r;
- int *lodims, *hidims, *widths;
-
- /* init the fitsy header */
- header = ft_headinit(NULL, 0);
-
- /* get rid of enclosing parens */
- if(*eventdef == '('){
- NewString(neventdef, eventdef+1);
- i = strlen(neventdef);
- if( neventdef[i-1] == ')' )
- neventdef[i-1] = '\0';
- }
- else{
- NewString(neventdef, eventdef);
- }
- /* we only deal with upper case in FITS */
- for(nevdef=neventdef; *nevdef; nevdef++){
- if( islower((int)*nevdef) )
- *nevdef = toupper(*nevdef);
- }
-
- /* first count the number of columns we have specified,
- separated by ',' */
- for(s=neventdef, cols=1; *s; s++){
- if( *s == ',' )
- cols++;
- }
-
- /* allocate string space for each column */
- names = (char **)calloc(cols, sizeof(char *));
- types = (char **)calloc(cols, sizeof(char *));
- dims = (char **)calloc(cols, sizeof(char *));
- lodims = (int *)calloc(cols, sizeof(int));
- hidims = (int *)calloc(cols, sizeof(int));
- widths = (int *)calloc(cols, sizeof(int));
-
- /* process the string and gather up the information */
- for(s=neventdef, width=0, got=0; *s; ){
- /* get name */
- n=name;
- *n = '\0';
- while( *s && (*s != ':') )
- *n++ = *s++;
- *n = '\0';
- NewString(names[got], name);
- /* skip delim */
- if( *s == ':' )
- s++;
- if( *s == '\0' )
- break;
-
- /* get type, which might be preceded by a count */
- r = strtol(s, &t, 10);
- if( s != t )
- s = t;
- else
- r = 1;
- /* cast unsupported unsigned type, if necessary */
- u[0] = *s;
- u[1] = '\0';
- snprintf(type, SZ_LINE, "%d%c", r, *u);
- NewString(types[got], type);
- width += ft_sizeof(*u)*r;
- widths[got] = ft_sizeof(*u);
- /* bump past type character */
- s++;
-
- /* get optional image dimension */
- if( *s == ':' ){
- /* skip past ':' */
- s++;
- *dim = '\0';
- for( d=dim; *s && (*s != ',') && (*s != ':'); )
- *d++ = *s++;
- *d = '\0';
- NewString(dims[got], dim);
- if( *s == ':' ){
- lodims[got] = atoi(dims[got]);
- s++;
- *dim = '\0';
- for( d=dim; *s && (*s != ','); )
- *d++ = *s++;
- *d = '\0';
- hidims[got] = atoi(dim);
- }
- else{
- lodims[got] = 0;
- hidims[got] = atoi(dims[got])-1;
- }
- if( *s == ',' )
- s++;
- }
- else
- dims[got] = NULL;
-
- /* bump past the comma */
- if( *s == ',' )
- s++;
- /* done with another header value */
- got++;
- }
-
- /* fake the header to a binary table */
- ft_headsets(header, "XTENSION", 0, "BINTABLE", "FITS BINARY TABLE", 1);
- ft_headseti(header, "BITPIX", 0, 8, "Binary data", 1);
- ft_headseti(header, "NAXIS", 0, 2, "Table is a matrix", 1);
- ft_headseti(header, "NAXIS", 1, width, "Width of table in bytes", 1);
- ft_headseti(header, "NAXIS", 2, nev, "Number of entries in table", 1);
- ft_headseti(header, "PCOUNT", 0, 0, "Random parameter count", 1);
- ft_headseti(header, "GCOUNT", 0, 1, "Group count", 1);
- ft_headseti(header, "TFIELDS", 0, got, "Number of fields in each row", 1);
- ft_headsets(header, "EXTNAME", 0, extname, "Table name", 1);
- ft_headseti(header, "EXTVER", 0, extver, "Version number of table", 1);
- /* info for each column */
- for(i=0; i<got; i++){
- ft_headsets(header, "TFORM", i+1, types[i], "Data type for field", 1);
- ft_headsets(header, "TTYPE", i+1, names[i], "Label for field", 1);
- if( dims[i] != NULL ){
- ft_headseti(header, "TLMIN", i+1, lodims[i], "Min. axis value", 1);
- ft_headseti(header, "TLMAX", i+1, hidims[i], "Max. axis value", 1);
- }
- }
-
- /* now turn this into a table header */
- ft_syncdata(header);
-
- /* free up the column strings */
- for(i=0; i<cols; i++){
- if( names[i] ) free(names[i]);
- if( types[i] ) free(types[i]);
- if( dims[i] ) free(dims[i]);
- }
- if( names ) free(names);
- if( types ) free(types);
- if( dims ) free(dims);
- if( lodims ) free(lodims);
- if( hidims ) free(hidims);
- if( widths ) free(widths);
- if( neventdef ) free(neventdef);
-
- return header;
-}
diff --git a/funtools/fitsy/xfile.h b/funtools/fitsy/xfile.h
deleted file mode 100644
index 6d8e60c..0000000
--- a/funtools/fitsy/xfile.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* default xfile.h
- */
-
-#ifndef XFILE_H
-#define XFILE_H
-
-#include <stdio.h>
-
-typedef FILE *File;
-#define ftOpen(n, m) fopen(n, m)
-#define ftWrite(f, b, s, n) fwrite(b, s, n, f)
-#define ftRead(f, b, s, n) fread(b, s, n, f)
-#define ftGets(f, b, n) fgets(b, n, f)
-#define ftFlush(f) fflush(f)
-#define ftSeek(f, o, n) (fseek(f, o, n), ftell(f))
-#define ftTell(f) ftell(f)
-#define ftOpenFd(fd, mode) fdopen(fd, mode)
-#define ftClose(fd) fclose(fd)
-
-#endif
diff --git a/funtools/fitsy/xos.h b/funtools/fitsy/xos.h
deleted file mode 100644
index 8677a4f..0000000
--- a/funtools/fitsy/xos.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* xos.h
-**/
-
-#ifndef os_h
-#define os_h
-
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-
-#include "longlong.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef __STDC__
-#include <stdarg.h>
-#define PROTOTYPE(X) X
-#else
-#include <varargs.h>
-#define PROTOTYPE(X) ( )
-#endif
-
-#if HAVE_STRING_H
-#include <string.h>
-#else
-char *strchr();
-char *strrchr();
-
-char *strcpy();
-char *strncpy();
-int strlen();
-void *memset();
-#endif
-
-#ifndef HAVE_STRCHR
-#define strchr index
-#define strrchr rindex
-#endif
-#ifndef HAVE_MEMCPY
-#ifndef memcpy
-#define memcpy(d, s, n) bcopy ((s), (d), (n))
-#endif
-#ifndef memmove
-#define memmove(d, s, n) bcopy ((s), (d), (n))
-#endif
-#else
-#ifndef bcopy
-#define bcopy(s, d, n) memcpy( (d), (s), (n))
-#endif
-#endif
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#else
-void *malloc();
-void *calloc();
-void *realloc();
-void free();
-#endif
-
-#define Min(x, y) (((x) < (y)) ? (x) : (y))
-#define Max(x, y) (((x) > (y)) ? (x) : (y))
-
-#define Clip(min, max, val) (((val) < (min) ) ? (min) : \
- ((val) > (max) ) ? (max) : (val) )
-
-#define Abs(xx) (((xx) > 0) ? (xx) : -(xx) )
-
-#ifdef MSDOS
-#define sleep SAOSleep
-#endif
-
-#ifdef __GNU_C__
-#define INLINE inline
-#else
-#define INLINE
-#endif
-
-
-#define New(space, thing) Calloc(space, sizeof(thing))
-#ifndef NewString
-#define NewString(space, str) (( str == NULL ) \
- ? NULL \
- : strcpy(Malloc(space, strlen(str) + 1) \
- , str))
-#endif
-
-#ifdef _EXCEPT_H
-
-extern exception ex_malloc;
-#define MEMEX(exc, space) , ((space) ? (space) : \
- ( except(exc, "cannot allocate %s line %d", __FILE__, __LINE__) \
- , space))
-#else
-#define MEMEX(exc, space)
-#endif
-
-#ifdef DEBUG
-#define Malloc(space, size) ( ((space) = (void *) malloc(size)) \
- , printf("malloc : 0x%09lx %10d bytes - " #space "\n" \
- , space, size) \
- , space)
-
-
-#define Calloc(space, size) ( ((space) = (void *) malloc(size)) \
- , printf("calloc : 0x%09lx %10d bytes - " #space "\n"\
- , space, size) \
- , memset(space, 0, size) \
- , space)
-
-#define Free(space) ( space != NULL ? \
- printf("free : 0x%09lx - " #space "\n", space) \
- , free((char *) space), (int) (space = NULL) \
- : printf("free : (null)\n"), (void *) NULL )
-
-#define ReAlloc(space, size) ( space != NULL ? \
- printf("relloc : 0x%09lx %10d bytes - " #space "\n" \
- , ((space) = (void *) realloc((void*)space, size)) \
- , size), (void *) space \
- : (void *) Malloc(space, size) )
-
-#define D(args) printf args
-
-#else
-#define Malloc(space, size) ( (space) = (void *) calloc(size, 1) MEMEX(ex_malloc, space) )
-#define ReAlloc(space, size) ( space ? \
- (void *)(((space) = (void *) realloc((void*)space, size)) \
- MEMEX(ex_malloc, space)) \
- : (void *) Malloc(space, size) )
-
-#define Calloc(space, size) ( Malloc(space, size), memset(space, 0, size), space )
-
-#define Free(space) ( space ? ( free((char *) space), (void *)(space = NULL)) \
- : (void *) NULL )
-
-#define D(args)
-#endif
-
-
-#ifdef TYPES
-typedef double real;
-typedef int bool;
-
-typedef struct _complex {
- double r;
- double i;
-} complex;
-
-typedef bool (*bfunct) ();
-typedef short (*sfunct) ();
-typedef int (*ifunct) ();
-typedef longlong (*lfunct) ();
-typedef real (*rfunct) ();
-typedef double (*dfunct) ();
-typedef complex (*xfunct) ();
-#endif
-
-#define MIN_normal 0.99e-306
-#define MAX_normal 0.99e306
-
-
-/* Types.h
-**
-** Data type constants
-**/
-
-#ifndef INDEFS
-#define INDEFS (-32767)
-#endif
-#ifndef INDEFL
-#define INDEFL ((unsigned long) 0x80000001)
-#endif
-#ifndef INDEFI
-#define INDEFI INDEFL
-#endif
-#ifndef INDEFR
-#define INDEFR 1.6e38
-#endif
-#ifndef INDEFD
-#define INDEFD 1.6e308
-#endif
-#ifndef INDEF
-#define INDEF INDEFR
-#endif
-
-
-#define TY_CHAR 0
-#define TY_SHORT 1
-#define TY_INT 2
-#define TY_LONG 3
-#define TY_REAL 4
-#define TY_DOUBLE 5
-
-#define TY_UCHAR 6
-#define TY_USHORT 7
-#define TY_UINT 8
-#define TY_ULONG 9
-
-
-#define SZ_CHAR 1
-#define SZ_SHORT 2
-#define SZ_INT 4
-#define SZ_LONG 8
-#define SZ_REAL 4
-#define SZ_DOUBLE 8
-
-#define X__PI 3.14159265358979323846
-#define X_2PI ( 2 * X__PI )
-#define X_R2D (X_2PI / 360.0)
-#define X_R2H (X_2PI / 24.0)
-#define X_H2D (360.0 / 24.0)
-
-#define r2h(r) ( (r) / X_R2H )
-#define h2r(d) ( (d) * X_R2H )
-#define r2d(r) ( (r) / X_R2D )
-#define d2r(d) ( (d) * X_R2D )
-#define h2d(r) ( (r) * X_H2D )
-#define d2h(d) ( (d) / X_H2D )
-#endif
-
-#define DPrint(X) EPrint X
-#define XPrint(X)
-
-/* end os_h */
diff --git a/funtools/fun2table b/funtools/fun2table
deleted file mode 100755
index 829fde7..0000000
--- a/funtools/fun2table
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-
- read HEADER
- read DASHES
-
- fldtotable $HEADER
diff --git a/funtools/funcalc.c b/funtools/funcalc.c
deleted file mode 100644
index 835b3fa..0000000
--- a/funtools/funcalc.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-#include <funtools.h>
-#include <file.h>
-#include <find.h>
-#include <word.h>
-#ifdef USE_LAUNCH
-#include <xlaunch.h>
-#endif
-#include <mkrtemp.h>
-#include <calc.h>
-
-extern char *optarg;
-extern int optind;
-
-#ifndef FUN_INCLUDE
-#define FUN_INCLUDE "-I."
-#endif
-
-#ifndef FUN_LIB
-#define FUN_LIB "-L. -lfuntools -lsocket -ldl -lm"
-#endif
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s [-n] [-a 'args'] [-e expr] [-f file] [-l libs] [-p prog] [-u] iname [oname [columns]]\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -a 'args' # arguments to add to program command line\n");
- fprintf(stderr, " -e 'expr' # funcalc expression to execute\n");
- fprintf(stderr, " -f [filename] # filename containing funcalc expression\n");
- fprintf(stderr, " -l [libs] # extra libraries to link\n");
- fprintf(stderr, " -n # write program to stdout instead of executing it \n");
- fprintf(stderr, " -p [prog] # create prog instead of executing it\n");
- fprintf(stderr, " -u # no auto-define: die if variable is undefined\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i, j=0;
- int dosave = 0;
- int c, args;
- int got, len, doexe;
- int exprlen, autolen;
- int tries;
- int error;
- int fd;
- char *s=NULL;
- char *cc, *cflags, *funpath;
- char *expr, *argstr, *libs, *autodefs, *codestr=NULL;
- char *tmpdir;
- char *iname=NULL, *oname=NULL;
- char prefix[SZ_LINE];
- char code[SZ_LINE], prog[SZ_LINE], log[SZ_LINE];
- char cmd[SZ_LINE], cmd2[SZ_LINE];
- char tbuf[SZ_LINE];
- char **nargv;
-#ifdef USE_LAUNCH
- char *stdfiles[3];
-#endif
- FILE *fp;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* init */
- tries = 0;
- doexe = 1;
- expr = NULL;
- argstr = NULL;
- autodefs = xstrdup("");
- libs = xstrdup("");
- error = 0;
- *prog = '\0';
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "a:1e:f:hl:np:u")) != -1){
- switch(c){
- case '1':
- tries = 1;
- break;
- case 'a':
- argstr = xstrdup(optarg);
- break;
- case 'e':
- expr = xstrdup(optarg);
- break;
- case 'f':
- expr = FileContents(optarg, 0, NULL);
- if( !expr || !*expr )
- gerror(stderr, "invalid funcalc expression file: %s\n", optarg);
- break;
- case 'h':
- usage(argv[0]);
- break;
- case 'l':
- libs = xstrdup(optarg);
- break;
- case 'n':
- doexe = 0;
- break;
- case 'p':
- strncpy(prog, optarg, SZ_LINE-1);
- doexe = 0;
- dosave = 1;
- break;
- case 'u':
- tries = 1;
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- if( args == 0 ) usage(argv[0]);
- iname = argv[optind+0];
- if( args >= 2 )
- oname = argv[optind+1];
-
- /* if an expression has not been supplied, read stdin */
- if( !expr || !*expr ){
- exprlen=0;
- while( fgets(tbuf, SZ_LINE-1, stdin) )
- _CalcCat(tbuf, &expr, &exprlen);
- }
-
- /* make sure we have something to work with */
- if( !expr || !*expr ) usage(argv[0]);
-
- /* generate code and exec */
- funpath = (char *)getenv("PATH");
- if( !(cc = xstrdup(getenv("FUNCALC_CC"))) &&
- !(cc = xstrdup(FUNCALC_CC)) &&
- !(cc = xstrdup(getenv("CC"))) &&
- !(cc = Find("gcc", "x", NULL, funpath)) &&
- !(cc = Find("cc", "x", NULL, ".")) &&
- !(cc = Find("cc", "x", NULL, FUNCALC_PATH)) ){
- gerror(stderr, "no compiler for program generation\n");
- }
-
- /* get cflags */
- if( !(cflags = xstrdup(getenv("FUNCALC_CFLAGS"))) &&
- !(cflags = xstrdup(FUNCALC_CFLAGS)) )
- cflags = xstrdup(" ");
-
- /* get prefix for filter source and program */
- if( !(tmpdir = (char *)getenv("FUNCALC_TMPDIR")) &&
- !(tmpdir = (char *)getenv("TMPDIR")) &&
- !(tmpdir = (char *)getenv("TMP")) )
- tmpdir = DEFAULT_FUNCALC_TMPDIR;
- if( !*tmpdir )
- tmpdir = ".";
- snprintf(prefix, SZ_LINE-1, "%s/c", tmpdir);
-
-again:
- /* make up name of C source file we will generate */
- if( (fd=mkrtemp(prefix, ".c", code, SZ_LINE, 1)) < 0 ){
- fprintf(stderr, "ERROR: could not generate C funcalc source name: %s\n",
- prefix);
- error = 1;
- goto endgame;
- }
-
- /* make up the name of the program we will compile into.
- we make this different from the .c file name to make interception
- by an intruder harder */
- if( !*prog ){
- if( mkrtemp(prefix, NULL, prog, SZ_LINE, 0) < 0 ){
- fprintf(stderr, "ERROR: could not generate C funcalc program name: %s\n",
- prefix);
- error = 1;
- goto endgame;
- }
- }
-
- /* make up the command strings */
- snprintf(cmd, SZ_LINE-1, "%s %s %s -o %s %s %s %s",
- cc, cflags, FUN_INCLUDE, prog, code, libs, FUN_LIB);
- snprintf(cmd2, SZ_LINE-1, "%s %s %s -o <prog> <this file>.c %s %s",
- cc, cflags, FUN_INCLUDE, libs, FUN_LIB);
-
- /* parse expression */
- if(!(codestr = FunCalcParse(iname, oname, cmd2, expr, autodefs, args))){
- fprintf(stderr, "ERROR: no program generated!\n");
- error = 1;
- goto endgame;
- }
-
- /* get stdio handle and output the generated code */
- if( !(fp = fdopen(fd, "w+b")) ){
- fprintf(stderr, "ERROR: could not open funcalc source file: %s\n", code);
- error = 1;
- goto endgame;
- }
- fprintf(fp, "%s\n", codestr);
- fclose(fp);
-
- /* make log file name */
- snprintf(log, SZ_LINE-1, "%s.log", prog);
-
- /* issue the shell command to compile the program */
-#ifdef USE_LAUNCH
- stdfiles[0] = NULL;
- stdfiles[1] = "/dev/null";
- stdfiles[2] = log;
- got = Launch(cmd, 1, stdfiles, NULL);
-#else
- snprintf(tbuf, SZ_LINE-1, " 1>/dev/null 2>%s", log);
- strcat(cmd, tbuf);
- got = system(cmd);
-#endif
- /* now we can see if we succeeded in issuing the command */
- if( got < 0 ){
- fprintf(stderr, "could not run funcalc compilation\n");
- error = 1;
- goto endgame;
- }
-
- /* if we have no executable program, we failed */
- if( !(s=Find(prog, "x", NULL, funpath)) ){
- if( autodefs ){
- xfree(autodefs);
- autodefs = NULL;
- }
- autolen = 0;
- if( s ){
- xfree(s);
- s = NULL;
- }
- /* first time through, see if we can auto-define undefined variables */
- if( !tries ){
- if( (s=Find(FUNCALC_SED, "r", NULL, funpath)) ){
- snprintf(tbuf, SZ_LINE-1,
- "sed -n -f %s %s | awk '{print \"double\",$1\"=0.0;\"}'\n",
- s, log);
- if( (fp = popen(tbuf, "r")) ){
- while( fgets(tbuf, SZ_LINE, fp) )
- _CalcCat(tbuf, &autodefs, &autolen);
- pclose(fp);
- /* clean up from previous attempt */
- if( s ){
- xfree(s);
- s = NULL;
- }
- if( codestr ){
- xfree(codestr);
- codestr = NULL;
- }
- unlink(code);
- unlink(log);
- tries++;
- goto again;
- }
- }
- }
- fprintf(stderr, "ERROR: funcalc compilation failed\n");
- if( s ){
- xfree(s);
- s = NULL;
- }
- s = FileContents(log, 0, &len);
- if( s && *s && len )
- fprintf(stderr, "Compilation error message:\n%s\n", s);
- error = 1;
- goto endgame;
- }
-
-endgame:
- /* done with the expression */
- if( autodefs ) xfree(autodefs);
- if( expr ) xfree(expr);
- if( s ) xfree(s);
- if( libs ) xfree(libs);
- if( cc ) xfree(cc);
- if( cflags ) xfree(cflags);
- if( argstr && !doexe ) xfree(argstr);
-
- /* delete the program body */
- if( !(s=getenv("FUNCALC_KEEP")) || !istrue(s) )
- unlink(code);
-
- /* Sun cc can leave an extraneous .o around, which we don't want */
- strcpy(tbuf, code);
- /* change .c to .o */
- tbuf[strlen(tbuf)-1] = 'o';
- unlink(tbuf);
- /* ... actually its usually left in the current directory */
- if( (s = strrchr(tbuf, '/')) )
- unlink(s+1);
-
- /* Sun cc can leave an extraneous .o around, which we don't want */
- snprintf(tbuf, SZ_LINE-1, "%s.o", prog);
- unlink(tbuf);
- /* ... actually its usually left in the current directory */
- if( (s = strrchr(tbuf, '/')) )
- unlink(s+1);
-
- /* delete log file */
- unlink(log);
-
- /* finally -- we have an executable and no errors, execute it */
- if( doexe ){
- if( codestr ) xfree(codestr);
- if( !error ){
- nargv = xcalloc(args+6, sizeof(char *));
- nargv[0] = prog;
- nargv[1] = "-d";
- if( argstr && *argstr ){
- nargv[2] = "-a";
- nargv[3] = argstr;
- j = 2;
- }
- for(i=0; i<args; i++){
- nargv[i+j+2] = argv[optind+i];
- nargv[i+j+3] = NULL;
- }
- execv(prog, (void *)nargv);
- }
- }
- else{
- /* output and delete program, if necesssary */
- if( !dosave ){
- /* output generated code */
- fprintf(stdout, "%s\n", codestr);
- /* delete executable */
- unlink(prog);
- }
- if( codestr ) xfree(codestr);
- }
- return(0);
-}
diff --git a/funtools/funcalc.sed b/funtools/funcalc.sed
deleted file mode 100644
index d9f3b18..0000000
--- a/funtools/funcalc.sed
+++ /dev/null
@@ -1,11 +0,0 @@
-# cc <foo.c> 2>&1 | sed -n -f funauto.sed
-# Linux gcc (and others)
-s/.*[`'‘]\([^)]*\)['’] *undeclared (first use in this function).*/\1/p
-# Solaris cc
-s/.*undefined symbol: \([^)]*\)/\1/p
-# Dec Alpha/OSF cc
-s/.*In this statement, "\([^)]*\)" is not declared.*/\1/p
-# SGI cc
-s/.*The identifier "\([^)]*\)" is undefined.*/\1/p
-# Intel icc
-s/.*identifier "\([^)]*\)" is undefined.*/\1/p
diff --git a/funtools/funcen.c b/funtools/funcen.c
deleted file mode 100644
index a2efae0..0000000
--- a/funtools/funcen.c
+++ /dev/null
@@ -1,830 +0,0 @@
-/*
- * Copyright (c) 2004 Smithsonian Astrophysical Observatory
- */
-
-/*
- * osx, linux:
- * gcc -O2 -g -o funcen funcen.c -I $HOME/include -L$HOME/lib -lfuntools -lm
- *
- * solaris:
- * gcc -O2 -g -o funcen funcen.c -I /soft/saord/include -L/soft/saord/lib \
- * -lfuntools -lsocket -lnsl -ldl -lm
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <funtools.h>
-#include <filter.h>
-#include <swap.h>
-#include <word.h>
-#include <wcs.h>
-#include <xalloc.h>
-
-#define MAXROW 8192
-#define MAXREGIONS 8192
-#define WCSSYS "j2000"
-
-extern char *optarg;
-extern int optind;
-
-/* single event (used in array of structs) */
-typedef struct evstruct{
- int region;
- double x, y;
-} *Ev, EvRec;
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s <switches> eventfile region(s)\n", fname);
- fprintf(stderr, "\n");
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -i\t\t# use image filtering (default: event filtering)\n");
- fprintf(stderr, " -n iter\t# max number of iterations (default: 0)\n");
- fprintf(stderr, " -t tol\t# pixel tolerance distance (default: 1.0)\n");
- fprintf(stderr, " -v [0,1,2,3]\t# output verbosity level (default: 0)\n");
- fprintf(stderr, "\n");
- fprintf(stderr,
- "The default output consists of one line for each region containing:\n");
- fprintf(stderr, "cnts x y [ra dec]. Use -v for prettier output and diagnostics.\n");
- fprintf(stderr,
- "Filter extensions are permitted as part of the file specification.\n");
- fprintf(stderr,
- "WCS info, if available, matches the coordinate system of the data file.\n");
- fprintf(stderr,
- "Input regions can be in physical or wcs coordinates (with coordsys),\n");
- fprintf(stderr,
- "Multiple regions and region files are supported but compound regions,\n");
- fprintf(stderr, "polygons, and points are not permitted.\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "examples:\n");
- fprintf(stderr,
- " %s -n 5 -t .1 snr.ev'[pha=1:3]' 'cir(512,512,10);cir 450 450 10'\n",
- fname);
- fprintf(stderr,
- " %s -n 5 -t .1 snr.ev 'fk5;circle(345.292335 58.881625,78.458952\")'\n",
- fname);
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int iter;
- int i;
- int got;
- int ntol;
- int len;
- int dowcs=0;
- int doimfilt=0;
- int domem=0;
- int ip=0, wcnt=0, incl=0;
- int verbose=0;
- int args=0;
- int maxrow=MAXROW;
- int niter=0;
- int nregion=0;
- int type, endian, x0, x1, y0, y1, block, rawsize;
- int nev[MAXREGIONS+1];
- int tflag[MAXREGIONS+1];
- int *rbuf=NULL;
- int cfd;
- int clen=0;
- int tltyp[2];
- int bin[2];
- double tlmin[2];
- // double tlmax[2];
- double binsiz[2];
- double xtot[MAXREGIONS+1], ytot[MAXREGIONS+1];
- double xavg[MAXREGIONS+1], yavg[MAXREGIONS+1];
- double ox[MAXREGIONS+1], oy[MAXREGIONS+1];
- double pxavg[MAXREGIONS+1], pyavg[MAXREGIONS+1];
- double xim, yim;
- double ra, dec;
- double ctolsq=0.0, tolsq=0.0;
- double tol=1.0;
- char *s;
- char *fname=NULL;
- char *iregion=NULL;
- char *cname=NULL;
- char *cregion=NULL;
- char *rawbuf=NULL;
- char *bincols=NULL;
- char *tmpdir=NULL;
- char prefix[SZ_LINE];
- char cregionfile[SZ_LINE];
- char mode[SZ_LINE];
- char lastd[2];
- char extn[3];
- char fname2[SZ_LINE];
- char coorsys[SZ_LINE];
- char wcssys[SZ_LINE];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char *regions[MAXREGIONS+1];
- struct stat statbuf;
- FILE *fd;
- Fun fun=NULL;
- Ev ev, ebuf=NULL;
- FITSHead header=NULL;
- Filter filter=NULL;
- struct WorldCoor *wcs=NULL;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* init wcssys to default */
- strncpy(wcssys, WCSSYS, SZ_LINE-1);
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "imn:t:v:w:")) != -1){
- switch(c){
- case 'i':
- doimfilt=1;
- break;
- case 'm':
- domem=1;
- break;
- case 'n':
- niter = atoi(optarg);
- if( niter < 0 ) niter = 0;
- break;
- case 't':
- tol = strtod(optarg, (char **)NULL);
- break;
- case 'v':
- verbose = atoi(optarg);
- if( verbose < 0 ) verbose = 0;
- break;
- case 'w':
- strncpy(wcssys, optarg, SZ_LINE-1);
- break;
- }
- }
-
- /* get maxrow, if user-specified */
- if( (s=(char *)getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* check for required arguments */
- args = argc - optind;
- if( args < 2 ) usage(argv[0]);
- /* arg 1: input file name */
- fname = argv[optind+0];
- /* arg 2: initial region */
- iregion = argv[optind+1];
-
- /* intialization: clear buffers */
- memset(regions, 0, sizeof(char *)*(MAXREGIONS+1));
- memset(ox, 0, sizeof(double)*(MAXREGIONS+1));
- memset(oy, 0, sizeof(double)*(MAXREGIONS+1));
- memset(pxavg, 0, sizeof(double)*(MAXREGIONS+1));
- memset(pyavg, 0, sizeof(double)*(MAXREGIONS+1));
- memset(tflag, 0, sizeof(int)*(MAXREGIONS+1));
- /* deal with the square of the tolerance */
- tolsq = tol*tol;
- /* no coords system yet */
- *coorsys = '\0';
- /* no temp region file yet */
- *cregionfile = '\0';
-
- /* get prefix for filter region temp file */
- if( !(tmpdir = (char *)getenv("FILTER_TMPDIR")) &&
- !(tmpdir = (char *)getenv("TMPDIR")) &&
- !(tmpdir = (char *)getenv("TMP")) )
- tmpdir = DEFAULT_FILTER_TMPDIR;
- if( !*tmpdir )
- tmpdir = ".";
- snprintf(prefix, SZ_LINE-1, "%s/funcen", tmpdir);
-
- /* if processing in memory, read all events now */
- if( domem ){
- /* open the data file once */
- if( !(fun = FunOpen(fname, "r", NULL)) ){
- gerror(stderr, "can't FunOpen file (or find extension): %s\n", fname);
- }
- /* make sure we have a table */
- FunInfoGet(fun, FUN_TYPE, &type, 0);
- if( type != FUN_TABLE ){
- gerror(stderr,
- "please specify a table (image support not yet implemented)\n");
- }
- /* for wcs output, get info to allow conversion of phyiscal to image */
- FunInfoGet(fun, FUN_BINOFFS, bin, 0);
- for(i=0; i<=1; i++){
- if( bin[i] >=0 ){
- FunColumnLookup(fun, NULL, bin[i], NULL,
- &(tltyp[i]), NULL, NULL, NULL, NULL);
- tlmin[i] = FunParamGetd(fun, "TLMIN", bin[i]+1, 0.0, &got);
- // tlmax[i] = FunParamGetd(fun, "TLMAX", bin[i]+1, 0.0, &got);
- binsiz[i] = FunParamGetd(fun, "TDBIN", bin[i]+1, 1.0, &got);
- }
- }
- /* get row number that we need to read */
- maxrow = FunParamGeti(fun, "NAXIS", 2, -1, &got);
- if( (maxrow < 0) || !got ){
- gerror(stderr, "can't determine total number of events in table\n");
- }
- /* select binning columns */
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "$x", "D", "r", FUN_OFFSET(Ev, x),
- "$y", "D", "r", FUN_OFFSET(Ev, y),
- "$region", "J", "r", FUN_OFFSET(Ev, region),
- NULL);
- if( !(ebuf=(Ev)xmalloc(maxrow*sizeof(EvRec))) ){
- gerror(stderr, "can't allocate memory for all events in table\n");
- }
- ebuf = (Ev)FunTableRowGet(fun, ebuf, maxrow, NULL, &got);
- if( got != maxrow ){
- gerror(stderr,
- "could not read all rows into memory (wanted %d, got %d)\n",
- maxrow, got);
- }
- }
-
- /* if we are filtering internally, allocate the return buffer */
- if( domem || doimfilt ){
- if( !(rbuf = xmalloc(maxrow*sizeof(int))) ){
- gerror(stderr, "can't allocate memory\n");
- }
- }
- /* not filtering internally:, prepare the ifile for new filter each time */
- else{
- /* make up the beginning of the file name -- we will append the region */
- strncpy(fname2, fname, SZ_LINE-2);
- i = strlen(fname2)-1;
- /* if we have an extension, prepare to append to it */
- if( fname2[i] == ']' ){
- fname2[i] = '\0';
- strncat(fname2, ",(", SZ_LINE-1);
- strcpy(extn, ")]");
- }
- /* otherwise, start a new extension */
- else{
- strncat(fname2, "[", SZ_LINE-1);
- strcpy(extn, "]");
- }
- }
-
- /* check for region file and retrieve contents, if necessary */
- if( *iregion != '@' ){
- clen = SZ_LINE;
- if( !(cregion = xcalloc(clen, sizeof(char))) ){
- gerror(stderr, "can't allocate memory\n");
- }
- if( !(cname = xcalloc(clen, sizeof(char))) ){
- gerror(stderr, "can't allocate memory\n");
- }
- strncpy(cregion, iregion, SZ_LINE-1);
- }
- /* yes, its a file */
- else{
- if( (fd=fopen(iregion+1, "r")) == NULL ){
- gerror(stderr, "can't open file: %s\n", iregion);
- }
- if( fstat(fileno(fd), &statbuf) <0 ){
- gerror(stderr, "can't get file information: %s\n", iregion);
- }
- clen = statbuf.st_size + SZ_LINE;
- if( !(cregion=(char *)xcalloc(clen, sizeof(char))) ){
- gerror(stderr, "can't allocate memory for region file: %s\n", iregion);
- }
- if( !(cname=(char *)xcalloc(clen, sizeof(char))) ){
- gerror(stderr, "can't allocate memory for region file: %s\n", iregion);
- }
- while( fgets(tbuf, SZ_LINE, fd) ){
- if( *tbuf == '#' || *tbuf == '\n' ) continue;
- if( (s=strchr(tbuf, '#')) ) *s = '\0';
- nowhite(tbuf, tbuf2);
- len = strlen(tbuf2);
- if( len > 1 ){
- strncat(cregion, tbuf2, SZ_LINE-1);
- if( tbuf2[len-1] != ';' )
- strncat(cregion, ";", SZ_LINE-1);
- }
- }
- fclose(fd);
- }
-
- /* process each region to make up a region formatting string */
- newdtable(";\n,()");
- while( word(cregion, tbuf, &ip) ){
- lastd[0] = lastdelim();
- lastd[1] = '\0';
- switch(++wcnt){
- case 1:
- /* handle coorsys specially */
- if( strstr("j2000|fk5|icrs|b1950|fk4|galactic|ecliptic|linear|image|physical|amplifier|detector", tbuf) ){
- strncat(coorsys, tbuf, SZ_LINE-1);
- strncat(coorsys, lastd, SZ_LINE-1);
- wcnt--;
- continue;
- }
- if( strstr(tbuf, "pol") ){
- gerror(stderr, "polygons are not allowed\n");
- }
- if( strstr(tbuf, "poi") ){
- gerror(stderr, "points are not allowed\n");
- }
- if( *tbuf == '-' ){
- incl = 0;
- }
- else{
- incl = 1;
- nregion++;
- }
- if( !regions[nregion] ){
- if( !(regions[nregion] = xcalloc(SZ_LINE, sizeof(char))) ){
- gerror(stderr, "can't allocate memory\n");
- }
- }
- if( *coorsys ){
- strncat(regions[nregion], coorsys, SZ_LINE-1);
- }
- strncat(regions[nregion], tbuf, SZ_LINE-1);
- break;
- case 2:
- if( incl ){
- ox[nregion] = strtod(tbuf, (char **)NULL);
- if( *coorsys && strncmp(coorsys, "physical", 8) )
- strncat(regions[nregion], "%.2fp", SZ_LINE-1);
- else
- strncat(regions[nregion], "%.2f", SZ_LINE-1);
- }
- else{
- strncat(regions[nregion], tbuf, SZ_LINE-1);
- }
- break;
- case 3:
- if( incl ){
- oy[nregion] = strtod(tbuf, (char **)NULL);
- if( *coorsys && strncmp(coorsys, "physical", 8) )
- strncat(regions[nregion], "%.2fp", SZ_LINE-1);
- else
- strncat(regions[nregion], "%.2f", SZ_LINE-1);
- }
- else{
- strncat(regions[nregion], tbuf, SZ_LINE-1);
- }
- break;
- default:
- strncat(regions[nregion], tbuf, SZ_LINE-1);
- break;
- }
- if( (lastd[0] != ';') && (lastd[0] != '\n') ){
- strncat(regions[nregion], lastd, SZ_LINE-1);
- }
- if( (lastd[0] == ';') || (lastd[0] == ')') || (lastd[0] == '\n') ){
- wcnt = 0;
- *coorsys = '\0';
- }
- }
- freedtable();
-
- /* iterate n times (or until tolerance is reached) to calculate centroid */
- for(iter=0; iter<niter; iter++){
- /* reset temp buffers */
- for(i=1; i<=nregion; i++){
- if( !tflag[i] ){
- xtot[i] = 0;
- ytot[i] = 0;
- xavg[i] = 0;
- yavg[i] = 0;
- nev[i] = 0;
- }
- }
- /* process file: re-open the input file, possibly with a new region */
- if( !domem ){
- /* append current region to filename root */
- if( !doimfilt ){
- /* if the region string is not long, we append it to the file name */
- if( (strlen(fname2) + strlen(cregion) + strlen(extn)) < (SZ_LINE-1) ){
- snprintf(cname, clen-1, "%s%s%s", fname2, cregion, extn);
- }
- /* otherwise we have to use a temp file */
- else{
- /* delete previous temp region file */
- if( *cregionfile ) unlink(cregionfile);
- /* get new temp file name */
- if( !(cfd=mkrtemp(prefix, ".reg", cregionfile, SZ_LINE, 1)) ){
- gerror(stderr, "can't open temp region file: %s\n", cregionfile);
- }
- else{
- if( !write(cfd, cregion, strlen(cregion)) ){
- gerror(stderr, "can't write temp file: %s\n", cregionfile);
- }
- close(cfd);
- }
- snprintf(cname, clen-1, "%s@%s%s", fname2, cregionfile, extn);
- }
- }
- /* but not for image-style filtering -- we filter the region manually */
- else{
- strncpy(cname, fname, clen-1);
- }
- if( verbose >= 2 ){
- if( iter > 0 ) fprintf(stdout, "\n");
- fprintf(stdout, "iter%d: %s\n", iter, cname);
- }
- /* make sure total data file name is less than SZ_LINE */
- if( strlen(cname) >= SZ_LINE ){
- gerror(stderr,
- "region length (%d) > max allowable (4096 - filename_length)\n",
- strlen(cregion));
- }
- /* open the data file with the new region as part of the filter */
- if( !(fun = FunOpen(cname, "r", NULL)) ){
- gerror(stderr, "can't FunOpen file (or find extension): %s\n", fname);
- }
- /* make sure we have a table */
- FunInfoGet(fun, FUN_TYPE, &type, 0);
- if( type != FUN_TABLE ){
- gerror(stderr,
- "please specify a table (image support not yet implemented)\n");
- }
- /* for wcs output, get info to allow conversion of phyiscal to image */
- FunInfoGet(fun, FUN_BINOFFS, bin, 0);
- for(i=0; i<=1; i++){
- if( bin[i] >=0 ){
- FunColumnLookup(fun, NULL, bin[i], NULL,
- &(tltyp[i]), NULL, NULL, NULL, NULL);
- tlmin[i] = FunParamGetd(fun, "TLMIN", bin[i]+1, 0.0, &got);
- // tlmax[i] = FunParamGetd(fun, "TLMAX", bin[i]+1, 0.0, &got);
- binsiz[i] = FunParamGetd(fun, "TDBIN", bin[i]+1, 1.0, &got);
- }
- }
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "$x", "D", "r", FUN_OFFSET(Ev, x),
- "$y", "D", "r", FUN_OFFSET(Ev, y),
- "$region", "J", "r", FUN_OFFSET(Ev, region),
- NULL);
- }
- else{
- if( verbose >= 2 ){
- if( iter > 0 ) fprintf(stdout, "\n");
- fprintf(stdout, "iter%d: %s\n", iter, cregion);
- }
- }
- /* for internal filtering, open up a new filter */
- if( domem || doimfilt ){
- FunInfoGet(fun, FUN_ENDIAN, &endian, FUN_HEADER, &header,
- FUN_SECT_X0, &x0, FUN_SECT_X1, &x1,
- FUN_SECT_Y0, &y0, FUN_SECT_Y1, &y1,
- FUN_SECT_BLOCK, &block, FUN_BINCOLS, &bincols,
- FUN_RAWSIZE, &rawsize,
- 0);
- if( doimfilt ){
- /* make sure we will have a valid image section in which to filter */
- if( (x1-x0 <= 0) || (y1-y0 <= 0) )
- gerror(stderr, "invalid or zero image dimensions(s) for table\n",
- bincols ? bincols : "invalid bincols?");
- /* make up the mode string */
- snprintf(mode, SZ_LINE-1,
- "type=events,convert=%s,evsect=\"%d %d %d %d %d\"",
- (endian == is_bigendian()) ? "false" : "true",
- x0, x1, y0, y1, block);
- }
- else{
- snprintf(mode, SZ_LINE-1,
- "type=events,convert=%s",
- (endian == is_bigendian()) ? "false" : "true");
- }
- /* add columns */
- if( bincols ){
- strcat(mode, ",");
- strcat(mode, bincols);
- }
- filter = FilterOpen(header, cregion, mode);
- }
-
- /* filter events and accumulate total events for each region */
- while( 1 ){
- /* get data (already have it for memory processing */
- if( !domem ){
- if( !(ebuf = (Ev)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) )
- break;
- }
- /* do standard event filtering */
- if( !domem && !doimfilt ){
- for(i=0; i<got; i++){
- ev = ebuf+i;
- if( ev->region > nregion ){
- gerror(stderr, "compound regions are not allowed!\n");
- }
- if( !tflag[ev->region] ){
- xtot[ev->region] += ev->x;
- ytot[ev->region] += ev->y;
- nev[ev->region] += 1;
- /* debugging output */
- if( verbose > 2 ){
- fprintf(stdout, "\t%.2f %.2f %d\n", ev->x, ev->y, ev->region);
- }
- }
- }
- }
- /* memory and image-style filtering is done manually */
- else{
- /* get pointer to raw buffer */
- FunInfoGet(fun, FUN_RAWBUF, &rawbuf, 0);
- /* get events which pass the region filter */
- if( filter && (filter != NOFILTER) &&
- FilterEvents(filter, rawbuf, rawsize, got, rbuf)){
- /* loop through events, process those which are in a region */
- for(i=0; i<got; i++){
- if( rbuf[i] > 0 ){
- ev = ebuf + i;
- if( !tflag[rbuf[i]] ){
- xtot[rbuf[i]] += ev->x;
- ytot[rbuf[i]] += ev->y;
- nev[rbuf[i]] += 1;
- }
- }
- }
- }
- }
- if( domem ) {
- break;
- }
- else{
- if( ebuf ) xfree(ebuf);
- }
- }
- /* calculate centroid position for each region */
- ntol = 0;
- for(i=1; i<=nregion; i++){
- if( !tflag[i] ){
- if( nev[i] > 0 ){
- xavg[i] = xtot[i] / nev[i];
- yavg[i] = ytot[i] / nev[i];
- }
- else{
- xavg[i] = 0.0;
- yavg[i] = 0.0;
- }
- /* check tolerance of this centroid */
- ctolsq = (((xavg[i] - pxavg[i]) * (xavg[i] - pxavg[i])) +
- ((yavg[i] - pyavg[i]) * (yavg[i] - pyavg[i])));
- if( ctolsq <= tolsq ){
- tflag[i] = 1;
- }
- else{
- ntol++;
- }
- }
- if( verbose > 1 ){
- if( i != 1 ) fprintf(stdout, "\n");
- snprintf(tbuf, SZ_LINE-1, regions[i], xavg[i], yavg[i]);
- fprintf(stdout, "\tevents:\t\t%d\n", nev[i]);
- fprintf(stdout, "\tcentroid(x,y):\t%.2f %.2f\n", xavg[i], yavg[i]);
- if( tflag[i] )
- fprintf(stdout, "\ttol**2:\t\t%.4f (tolerance met)\n", ctolsq);
- else
- fprintf(stdout, "\ttol**2:\t\t%.4f\n", ctolsq);
- fprintf(stdout, "\tregion%d:\t%s\n", i, tbuf);
- }
- }
- /* close the event file */
- if( !domem ) FunClose(fun);
- /* close filter for image-style filtering */
- if( doimfilt || domem ) FilterClose(filter);
- /* generate a new current region string */
- *cregion = '\0';
- /* handle possible first exclude specially */
- if( regions[0] ){
- strncat(cregion, regions[0], clen-1);
- if( cregion[strlen(cregion)-1] != ';' )
- strncat(cregion, ";", clen-1);
- }
- /* handle all other regions */
- for(i=1; i<=nregion; i++){
- snprintf(tbuf, SZ_LINE-1, regions[i], xavg[i], yavg[i]);
- while( (int)(strlen(tbuf) + strlen(cregion)) >= (clen-2) ){
- clen += SZ_LINE;
- cregion = xrealloc(cregion, clen);
- }
- strncat(cregion, tbuf, clen-1);
- if( (i != nregion) && (cregion[strlen(cregion)-1] != ';') )
- strncat(cregion, ";", clen-1);
- }
- /* check for no tolerances left to do */
- if( ntol == 0 ){
- if( verbose > 1 ) fprintf(stdout, "All tolerances have been met.\n");
- break;
- }
- else{
- /* save averages for this iteration for next tolerance check */
- memcpy(pxavg, xavg, sizeof(double)*(MAXREGIONS+1));
- memcpy(pyavg, yavg, sizeof(double)*(MAXREGIONS+1));
- }
- }
-
- /* final count of events using current region */
- if( verbose >= 2 ){
- if( iter > 0 ) fprintf(stdout, "\n");
- fprintf(stdout, "final: %s\n", cname);
- }
- memset(nev, 0, sizeof(int)*(MAXREGIONS+1));
- if( !domem ){
- /* append current region to filename root */
- if( !doimfilt ){
- /* if the region string is not long, we append it to the file name */
- if( (strlen(fname2) + strlen(cregion) + strlen(extn)) < (SZ_LINE-1) ){
- snprintf(cname, clen-1, "%s%s%s", fname2, cregion, extn);
- }
- /* otherwise we have to use a temp file */
- else{
- /* delete previous temp region file */
- if( *cregionfile ) unlink(cregionfile);
- /* get new temp file name */
- if( !(cfd=mkrtemp(prefix, ".reg", cregionfile, SZ_LINE, 1)) ){
- gerror(stderr, "can't open temp region file: %s\n", cregionfile);
- }
- else{
- if( !write(cfd, cregion, strlen(cregion)) ){
- gerror(stderr, "can't write temp file: %s\n", cregionfile);
- }
- close(cfd);
- }
- snprintf(cname, clen-1, "%s@%s%s", fname2, cregionfile, extn);
- }
- }
- /* but not for image-style filtering -- we filter the region manually */
- else{
- strncpy(cname, fname, clen-1);
- }
- /* open the data file with the new region as part of the filter */
- if( !(fun = FunOpen(cname, "r", NULL)) ){
- gerror(stderr, "can't FunOpen file (or find extension): %s\n", fname);
- }
- /* make sure we have a table */
- FunInfoGet(fun, FUN_TYPE, &type, 0);
- if( type != FUN_TABLE ){
- gerror(stderr,
- "please specify a table (image support not yet implemented)\n");
- }
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "$x", "D", "r", FUN_OFFSET(Ev, x),
- "$y", "D", "r", FUN_OFFSET(Ev, y),
- "$region", "J", "r", FUN_OFFSET(Ev, region),
- NULL);
- }
- if( domem || doimfilt ){
- FunInfoGet(fun, FUN_ENDIAN, &endian, FUN_HEADER, &header,
- FUN_SECT_X0, &x0, FUN_SECT_X1, &x1,
- FUN_SECT_Y0, &y0, FUN_SECT_Y1, &y1,
- FUN_SECT_BLOCK, &block, FUN_BINCOLS, &bincols,
- FUN_RAWSIZE, &rawsize,
- 0);
- if( doimfilt ){
- /* make sure we will have a valid image section in which to filter */
- if( (x1-x0 <= 0) || (y1-y0 <= 0) )
- gerror(stderr, "invalid or zero image dimensions(s) for table\n",
- bincols ? bincols : "invalid bincols?");
- /* make up the mode string */
- snprintf(mode, SZ_LINE-1,
- "type=events,convert=%s,evsect=\"%d %d %d %d %d\"",
- (endian == is_bigendian()) ? "false" : "true",
- x0, x1, y0, y1, block);
- }
- else{
- snprintf(mode, SZ_LINE-1,
- "type=events,convert=%s",
- (endian == is_bigendian()) ? "false" : "true");
- }
- /* add columns */
- if( bincols ){
- strcat(mode, ",");
- strcat(mode, bincols);
- }
- filter = FilterOpen(header, cregion, mode);
- }
-
- /* get wcs info */
- FunInfoGet(fun, FUN_WCS, &wcs, 0);
- /* and set output */
- if( (dowcs = (wcs && iswcs(wcs))) ){
- wcsoutinit(wcs, wcssys);
- }
-
- /* filter events and accumulate total events for each region */
- while( 1 ){
- if( !domem ){
- if( !(ebuf = (Ev)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) )
- break;
- }
- /* standard event filtering */
- if( !domem && !doimfilt ){
- for(i=0; i<got; i++){
- ev = ebuf+i;
- if( ev->region > nregion ){
- gerror(stderr, "compound regions are not allowed!\n");
- }
- nev[ev->region] += 1;
- }
- }
- /* memory and image-style filtering is done manually */
- else{
- /* get pointer to raw buffer */
- FunInfoGet(fun, FUN_RAWBUF, &rawbuf, 0);
- /* get events which pass the region filter */
- if( filter && (filter != NOFILTER) &&
- FilterEvents(filter, rawbuf, rawsize, got, rbuf)){
- /* loop through events, process those which are in a region */
- for(i=0; i<got; i++){
- if( rbuf[i] > 0 ){
- ev = ebuf + i;
- nev[rbuf[i]] += 1;
- }
- }
- }
- }
- if( ebuf ) xfree(ebuf);
- if( domem ) break;
- }
-
- /* final display */
- if( verbose > 1) fprintf(stdout, "\n");
- for(i=1; i<=nregion; i++){
- /* if we did not iterate, then final x, y is same as initial x, y */
- if( niter == 0 ){
- xavg[i] = ox[i];
- yavg[i] = oy[i];
- }
- if( dowcs ){
- /* convert physical pixels to image */
- xim = tlp2i(xavg[i], tlmin[0], binsiz[0], tltyp[0]);
- yim = tlp2i(yavg[i], tlmin[1], binsiz[1], tltyp[1]);
- pix2wcs(wcs, xim, yim, &ra, &dec);
- }
- if( verbose <= 0 ){
- fprintf(stdout, "%d", nev[i]);
- if( nev[i] > 0 ){
- fprintf(stdout, " %.2f %.2f", xavg[i], yavg[i]);
- if( dowcs ){
- fprintf(stdout, " %.6f %.6f %s", ra, dec, wcssys);
- }
- }
- else{
- fprintf(stdout, " 0.00 0.00");
- if( dowcs ){
- fprintf(stdout, " 0.0000 0.0000 none");
- }
- }
- fprintf(stdout, "\n");
- }
- else{
- if( i == 1 ){
- fprintf(stdout, "event_file:\t%s\n", fname);
- fprintf(stdout, "initial_region:\t%s\n", iregion);
- fprintf(stdout, "iterations:\t%d\n", niter);
- fprintf(stdout, "tolerance:\t%.4f\n", tol);
- }
- fprintf(stdout, "\n");
- fprintf(stdout, "events:\t\t%d\n", nev[i]);
- if( nev[i] > 0 ){
- fprintf(stdout, "x,y(physical):\t%.2f %.2f\n", xavg[i], yavg[i]);
- if( dowcs ){
- fprintf(stdout, "ra,dec(%s):\t%.6f %.6f\n", wcssys, ra, dec);
- }
- snprintf(tbuf, SZ_LINE-1, regions[i], xavg[i], yavg[i]);
- fprintf(stdout, "final_region%d:\t%s\n", i, tbuf);
- }
- }
- if( regions[i] ) xfree(regions[i]);
- }
- FunClose(fun);
- /* close filter for manual filtering */
- if( doimfilt || domem ) FilterClose(filter);
- /* handle overflow region specially */
- if( regions[0] ) xfree(regions[0]);
- if( cregion ) xfree(cregion);
- if( cname ) xfree(cname);
- if( rbuf ) xfree(rbuf);
- if( *cregionfile ) unlink(cregionfile);
- /* success */
- return(0);
-}
diff --git a/funtools/funcnts.c b/funtools/funcnts.c
deleted file mode 100644
index 6da09ed..0000000
--- a/funtools/funcnts.c
+++ /dev/null
@@ -1,1693 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <math.h>
-#include <funtools.h>
-#include <NaN.h>
-#include <filter.h>
-#include <swap.h>
-#include <word.h>
-#include <xalloc.h>
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-
-/* max number of intervals we will process in one pass through table data */
-#define MAXINTV 1024
-
-/* type of data we process */
-#define SRC 0
-#define BKG 1
-/* this must match number of types above */
-#define NTYPE 2
-
-/* how corrections (time and exposure) are applied to source/bkgd */
-#define NONE 0
-#define SCORR 1
-#define BCORR 2
-#define BOTH 3
-
-/* types of background */
-#define BKG_VAL 1
-#define BKG_ALL 2
-#define BKG_EACH 3
-
-/* types of image -> exposure pixel conversion algorithms */
-#define EXP_RATIO 1
-#define EXP_WCS 2
-
-#define ARCSEC_PER_DEG 3600.0
-#define ARCSEC_PER_DEGSQ (ARCSEC_PER_DEG*ARCSEC_PER_DEG)
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s <switches> sname [sreg] [bname breg|breg|cnts]\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -e \"source_exposure[;bkgd_exposure]\" # exp matches data\n");
- fprintf(stderr, " -w \"source_exposure[;bkgd_exposure]\" # WCS method\n");
- fprintf(stderr, "\t\t# source (bkgd) FITS exposure image\n");
- fprintf(stderr, " -t \"source_timecorr[;bkgd_timecorr]\"\n");
- fprintf(stderr, "\t\t# source (bkgd) time correction value or header parameter name\n");
- fprintf(stderr, " -g\t\t# output using nice g format\n");
- fprintf(stderr, " -G\t\t# output using %%.14g format (maximum precision)\n");
- fprintf(stderr, " -i \"[column;]int1;int2...\" # column-based intervals\n");
- fprintf(stderr, " -m\t\t# match individual source and bkgd regions\n");
- fprintf(stderr, " -p\t\t# output in pixels, even if wcs is present\n");
- fprintf(stderr, " -r\t\t# output inner/outer radii (and angles) for annuli (and pandas)\n");
- fprintf(stderr, " -s\t\t# output summed values\n");
- fprintf(stderr, " -v \"scol[;bcol]\" # src and bkgd value columns for tables\n");
- fprintf(stderr, " -T\t\t# output in starbase/rdb table format\n");
- fprintf(stderr, " -z\t\t# include regions with zero area in output\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-static double
-DConvert (char *buf, int type, int n)
-#else
-static double
-DConvert(buf, type, n)
- char *buf;
- int type;
- int n;
-#endif
-{
- int ival;
- double dval=0.0;
-
- switch(type){
- case 'X':
- if( n == 16 )
- dval = (double)*(unsigned short *)buf;
- else if( n == 32 )
- dval = (double)*(unsigned int *)buf;
- else
- dval = (double)*(unsigned char *)buf;
- break;
- case 'B':
- dval = (double)*(unsigned char *)buf;
- break;
- case 'I':
- dval = (double)*(short *)buf;
- break;
- case 'U':
- dval = (double)*(unsigned short *)buf;
- break;
- case 'J':
- dval = (double)*(int *)buf;
- break;
- case 'K':
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- break;
- case 'V':
- dval = (double)*(unsigned int *)buf;
- break;
- case 'E':
- dval = (double)*(float *)buf;
- break;
- case 'D':
- dval = *(double *)buf;
- break;
- case 'L':
- ival = (int)*(unsigned char *)buf;
- if( !ival || (ival == 'F') || (ival == 'f') )
- dval = 0.0;
- else
- dval = 1.0;
- break;
- default:
- dval = 0.0;
- break;
- }
- return(dval);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i, j, k, v;
- int args;
- int bkarea=0;
- int bktype=BKG_VAL;
- int dosum=0;
- int dog=0;
- int domatch=0;
- int doradang=0;
- int dobkgderr=1;
- int doexp=0;
- int dotim=0;
- int dopixels=0;
- int dozero=0;
- int evimage=0;
- int cold=' ';
- int nintv=1;
- int endian[NTYPE], type[NTYPE], rawsize[NTYPE], rowsize[NTYPE];
- int x0[NTYPE], x1[NTYPE], y0[NTYPE], y1[NTYPE];
- int dim1[4], dim2[4], block[4];
- int *area[NTYPE];
- int *savearea[NTYPE];
- int nmask[NTYPE]={0,0};
- int nreg[NTYPE]={0,0};
- int valtypes[NTYPE]={0,0};
- int valoffsets[NTYPE]={0,0};
- int valns[NTYPE]={0,0};
- int exptrans[NTYPE]={EXP_RATIO,EXP_RATIO};
- double bkexp=0.0;
- double dpp[NTYPE]={-1.0,-1.0};
- double timecorr[NTYPE]={1.0,1.0};
- double *cnts[MAXINTV][NTYPE];
- double *savecnts[MAXINTV][NTYPE];
- double *bncnts[MAXINTV];
- double *bnerr[MAXINTV];
- double *bscnts[MAXINTV];
- double *bserr[MAXINTV];
- double *exp[NTYPE];
- double *saveexp[NTYPE];
- double dppnorm=1.0;
- double bkval=0.0;
- char mode[SZ_LINE];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char *intvs[MAXINTV];
- char *s, *t, *u;
- char *ebuf;
- char *eptr;
- char *fmt=NULL;
- char *expstr=NULL;
- char *intvstr=NULL;
- char *valstr=NULL;
- char *timestr=NULL;
- char *radang=NULL;
- char *cradang=NULL;
- char *tradang=NULL;
- char *region[NTYPE]={NULL,NULL};
- char *filtstr[NTYPE]={NULL,NULL};
- char *bincols[NTYPE]={NULL,NULL};
- char *valname[2]={NULL,NULL};
- char *name[4]={NULL,NULL,NULL, NULL};
- Fun fun[4]={NULL,NULL,NULL,NULL};
- FITSHead header[NTYPE]={NULL,NULL};
- FilterMask masks[NTYPE]={NULL,NULL};
- Filter filter[NTYPE]={NULL,NULL};
- struct WorldCoor *wcs[4]={NULL,NULL,NULL,NULL};
-
- /* clear array elelemts to mark them as unallocated */
- memset(cnts, 0, MAXINTV*NTYPE*sizeof(double *));
- memset(savecnts, 0, MAXINTV*NTYPE*sizeof(double *));
- memset(bncnts, 0, NTYPE*sizeof(double *));
- memset(bnerr, 0, NTYPE*sizeof(double *));
- memset(bscnts, 0, NTYPE*sizeof(double *));
- memset(bserr, 0, NTYPE*sizeof(double *));
- memset(exp, 0, NTYPE*sizeof(double *));
- memset(saveexp, 0, NTYPE*sizeof(double *));
- memset(area, 0, NTYPE*sizeof(int *));
- memset(savearea, 0, NTYPE*sizeof(int *));
- memset(intvs, 0, MAXINTV*sizeof(char *));
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "e:gGhi:mprst:v:w:zEIT")) != -1){
- switch(c){
- case 'e':
- expstr = optarg;
- break;
- case 'g':
- dog = 1;
- break;
- case 'G':
- dog = 2;
- break;
- case 'h':
- usage(argv[0]);
- break;
- case 'i':
- intvstr = optarg;
- break;
- case 'm':
- domatch = 1;
- break;
- case 'p':
- dopixels = 1;
- break;
- case 'r':
- doradang = 1;
- break;
- case 's':
- dosum = 1;
- break;
- case 't':
- timestr = optarg;
- break;
- case 'v':
- valstr = optarg;
- break;
- case 'w':
- putenv("FUNCNTS_EXPTRANS=wcs");
- expstr = optarg;
- break;
- case 'z':
- dozero = 1;
- break;
- case 'E':
- evimage = 0;
- break;
- case 'I':
- evimage = 1;
- break;
- case 'T':
- cold = '\t';
- break;
- }
- }
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* check for required arguments */
- args = argc - optind;
- if( args < 1 ) usage(argv[0]);
-
- /* arg 1: source file name */
- name[SRC] = xstrdup(argv[optind+0]);
-
- /* arg 2: source region */
- if( (args == 1) || !*(region[SRC] = argv[optind+1]) )
- region[SRC] = "field()";
-
- /* arg 3: background region */
- if( args >= 3 ){
- if( args == 3 ){
- name[BKG] = NULL;
- region[BKG] = argv[optind+2];
- }
- else{
- name[BKG] = xstrdup(argv[optind+2]);
- region[BKG] = argv[optind+3];
- }
- /* check for constant numeric value -- background counts */
- bkval = strtod(region[BKG], &s);
- /* if we did not get a valid numeric constant, its a region */
- if( region[BKG] && *region[BKG] && (s == region[BKG]) ){
- bktype = BKG_ALL;
- bkval = 0.0;
- }
- else{
- /* can't have background file and background value */
- if( args == 4 ) usage(argv[0]);
- bktype = BKG_VAL;
- region[BKG] = NULL;
- }
- }
-
- /* get value column names, if necessary */
- if( valstr ){
- int ip=0;
- int i=0;
- newdtable(";");
- for(i=0; i<NTYPE; i++){
- if( word(valstr, tbuf, &ip) && *tbuf ){
- if( strcasecmp(tbuf, "$none") )
- valname[i] = xstrdup(tbuf);
- else
- valname[i] = xstrdup("-");
- }
- }
- freedtable();
- }
-
- /* open the source FITS file */
- if( !(fun[SRC] = FunOpen(name[SRC], "r", NULL)) )
- gerror(stderr, "can't FunOpen source file (or find extension): %s\n",
- name[SRC]);
- /* get required information from funtools structure */
- FunInfoGet(fun[SRC], FUN_ENDIAN, &endian[SRC],
- FUN_TYPE, &type[SRC], FUN_HEADER, &header[SRC],
- FUN_SECT_X0, &x0[SRC], FUN_SECT_X1, &x1[SRC],
- FUN_SECT_Y0, &y0[SRC], FUN_SECT_Y1, &y1[SRC],
- FUN_SECT_DIM1, &dim1[SRC], FUN_SECT_DIM2, &dim2[SRC],
- FUN_SECT_BLOCK, &block[SRC], FUN_WCS, &wcs[SRC],
- FUN_RAWSIZE, &rawsize[SRC], FUN_BINCOLS, &bincols[SRC],
- FUN_ROWSIZE, &rowsize[SRC],
- 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2[SRC] == 0 ) dim2[SRC] = 1;
- /* make up filter mode string using source bincols */
- strcpy(mode, "type=image");
- /* add the binning key */
- if( bincols[SRC] ){
- strcat(mode, ",");
- strcat(mode, bincols[SRC]);
- }
-
- /* open the source region */
- filter[SRC] = FilterOpen(header[SRC], region[SRC], mode);
- if( filter[SRC] && (filter[SRC] != NOFILTER) ){
- /* retrieve region mask segments */
- nmask[SRC] = FilterImage(filter[SRC],
- x0[SRC], x1[SRC], y0[SRC], y1[SRC],
- block[SRC], &masks[SRC], &nreg[SRC]);
-
- /* filtstr[SRC] = xstrdup(FilterString(filter[SRC])); */
- /* for display, we have to add # comment chars after each \n */
- t = FilterString(filter[SRC]);
- filtstr[SRC] = calloc(strlen(t)*3, sizeof(char));
- for(u=filtstr[SRC]; *t; t++){
- *u++ = *t;
- if( *t == '\n' ){
- *u++ = '#';
- *u++ = ' ';
- }
- }
- filtstr[SRC] = realloc(filtstr[SRC], strlen(filtstr[SRC])+1);
- }
- if( filter[SRC] ) FilterClose(filter[SRC]);
-
- /* make sure we have something to do */
- if( nreg[SRC] == 0 )
- gerror(stderr, "no valid regions included in '%s'\n", region[SRC]);
-
- /* gather up intervals, if necessary (must be done before memory alloc) */
- if( intvstr ){
- int ip=0;
- int ntok=0;
- newdtable(";");
- nintv = 0;
- *tbuf2 = '\0';
- while( word(intvstr, tbuf, &ip) && *tbuf ){
- /* check for default column as first token */
- if( !ntok && !strpbrk(tbuf, "=><&|") ){
- strcpy(tbuf2, tbuf);
- strcat(tbuf2, "=");
- }
- else{
- if( nintv >= MAXINTV ){
- gwarning(stderr, "Too many intervals; ignoring: %s\n", tbuf);
- continue;
- }
- intvs[nintv] = (char *)calloc(SZ_LINE, sizeof(char));
- if( *tbuf2 ) strcat(intvs[nintv], tbuf2);
- strcat(intvs[nintv], tbuf);
- nintv++;
- }
- ntok++;
- }
- freedtable();
- }
-
- /* if a value name was specified, make sure its a calid column */
- if( valname[SRC] && (*valname[SRC] != '-') ){
- if( !FunColumnLookup(fun[SRC], valname[SRC], 0, NULL,
- &valtypes[SRC], NULL,
- &valoffsets[SRC], NULL, NULL) ){
- gerror(stderr, "value column does not exist: %s\n", valname[SRC]);
- }
- }
-
- /* allocate space for results */
- for(i=0; i<nintv; i++){
- cnts[i][SRC] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- savecnts[i][SRC] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- bncnts[i] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- bnerr[i] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- bscnts[i] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- bserr[i] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- }
- area[SRC] = (int *)xcalloc(nreg[SRC]+1, sizeof(int));
- exp[SRC] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- savearea[SRC] = (int *)xcalloc(nreg[SRC]+1, sizeof(int));
- saveexp[SRC] = (double *)xcalloc(nreg[SRC]+1, sizeof(double));
- /* get radii and angle string, if needed */
- if( doradang ){
- if( (radang = FilterRadAng()) )
- radang = xstrdup(radang);
- }
-
- /* process background region, if necessary */
- if( region[BKG] ){
- /* open the background FITS file */
- if( name[BKG] ){
- if( !(fun[BKG] = FunOpen(name[BKG], "r", NULL)) )
- gerror(stderr,
- "can't FunOpen background file (or find extension): %s\n",
- name[BKG]);
- /* get required information from funtools structure */
- FunInfoGet(fun[BKG], FUN_ENDIAN, &endian[BKG],
- FUN_TYPE, &type[BKG], FUN_HEADER, &header[BKG],
- FUN_SECT_X0, &x0[BKG], FUN_SECT_X1, &x1[BKG],
- FUN_SECT_Y0, &y0[BKG], FUN_SECT_Y1, &y1[BKG],
- FUN_SECT_DIM1, &dim1[BKG], FUN_SECT_DIM2, &dim2[BKG],
- FUN_SECT_BLOCK, &block[BKG], FUN_WCS, &wcs[BKG],
- FUN_RAWSIZE, &rawsize[BKG], FUN_BINCOLS, &bincols[BKG],
- FUN_ROWSIZE, &rowsize[BKG],
- 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2[BKG] == 0 ) dim2[BKG] = 1;
- /* make up filter mode string using back bincols */
- strcpy(mode, "type=image");
- /* add the binning key */
- if( bincols[BKG] ){
- strcat(mode, ",");
- strcat(mode, bincols[BKG]);
- }
- }
- /* use values from the source */
- else{
- fun[BKG] = fun[SRC];
- endian[BKG] = endian[SRC];
- type[BKG] = type[SRC]; header[BKG] = header[SRC];
- x0[BKG] = x0[SRC]; x1[BKG] = x1[SRC];
- y0[BKG] = y0[SRC]; y1[BKG] = y1[SRC];
- dim1[BKG] = dim1[SRC]; dim2[BKG] = dim2[SRC];
- block[BKG] = block[SRC];
- rawsize[BKG] = rawsize[SRC];
- rowsize[BKG] = rowsize[SRC];
- bincols[BKG] = bincols[SRC];
- }
-
- /* open the background region */
- filter[BKG] = FilterOpen(header[BKG], region[BKG], mode);
- if( filter[BKG] && (filter[BKG] != NOFILTER) ){
- /* retrieve region mask segments */
- nmask[BKG] = FilterImage(filter[BKG],
- x0[BKG], x1[BKG], y0[BKG], y1[BKG],
- block[BKG], &masks[BKG], &nreg[BKG]);
- /* see if we want to, and can, match source and bkgd regions */
- if( domatch && (nreg[SRC] == nreg[BKG]) )
- bktype = BKG_EACH;
- /* filtstr[BKG] = xstrdup(FilterString(filter[BKG])); */
- /* for display, we have to add # comment chars after each \n */
- t = FilterString(filter[BKG]);
- filtstr[BKG] = calloc(strlen(t)*3, sizeof(char));
- for(u=filtstr[BKG]; *t; t++){
- *u++ = *t;
- if( *t == '\n' ){
- *u++ = '#';
- *u++ = ' ';
- }
- }
- filtstr[BKG] = realloc(filtstr[BKG], strlen(filtstr[BKG])+1);
- }
- if( filter[BKG] ) FilterClose(filter[BKG]);
-
- /* if a value name was specified, make sure its a calid column */
- if( valname[BKG] ){
- if( *valname[BKG] != '-' ){
- if( !FunColumnLookup(fun[BKG], valname[BKG], 0, NULL,
- &valtypes[BKG], NULL,
- &valoffsets[BKG], NULL, NULL) ){
- gerror(stderr, "value column does not exist: %s\n", valname[BKG]);
- }
- }
- }
- else{
- if( valname[SRC] && (*valname[SRC] != '-') ){
- valname[BKG] = xstrdup(valname[SRC]);
- valtypes[BKG] = valtypes[SRC];
- valoffsets[BKG] = valoffsets[SRC];
- }
- }
-
- /* allocate space for results */
- for(i=0; i<nintv; i++){
- cnts[i][BKG] = (double *)xcalloc(nreg[BKG]+1, sizeof(double));
- savecnts[i][BKG] = (double *)xcalloc(nreg[BKG]+1, sizeof(double));
- }
- area[BKG] = (int *)xcalloc(nreg[BKG]+1, sizeof(int));
- exp[BKG] = (double *)xcalloc(nreg[BKG]+1, sizeof(double));
- savearea[BKG] = (int *)xcalloc(nreg[BKG]+1, sizeof(int));
- saveexp[BKG] = (double *)xcalloc(nreg[BKG]+1, sizeof(double));
- }
-
- /* look for degrees/pixel in source and background files -- we will
- use these to normalize background area, if both are present */
- if( name[BKG] ){
- for(i=0; i<2; i++){
- if( wcs[i] && iswcs(wcs[i]) ){
- if( !wcs[i]->coorflip )
- dpp[i] = ABS(wcs[i]->cdelt[0]) * block[i];
- else
- dpp[i] = ABS(wcs[i]->cdelt[1]) * block[i];
- }
- }
- /* note that BOTH must be present or we do not do this normalization */
- if( (dpp[SRC] > 0.0) && (dpp[BKG] > 0.0) )
- dppnorm = (dpp[SRC]/dpp[BKG]) * (dpp[SRC]/dpp[BKG]);
- }
- /* get degrees/pixel for source; not used in norm, but users want to know */
- else{
- if( wcs[SRC] && iswcs(wcs[SRC]) ){
- if( !wcs[SRC]->coorflip )
- dpp[SRC] = ABS(wcs[SRC]->cdelt[0]) * block[SRC];
- else
- dpp[SRC] = ABS(wcs[SRC]->cdelt[1]) * block[SRC];
- }
- }
-
- /* open exposure file(s), if necessary */
- if( expstr ){
- int ip=0;
- int i=0;
- int got=0;
- newdtable(";");
- for(i=0; i<NTYPE; i++){
- if( word(expstr, tbuf, &ip) && *tbuf ){
- name[NTYPE+i] = xstrdup(tbuf);
- if( !(fun[NTYPE+i] = FunOpen(name[NTYPE+i], "r", NULL)) )
- gerror(stderr, "can't FunOpen exp file: %s\n", name[NTYPE+i]);
- FunInfoGet(fun[NTYPE+i],
- FUN_SECT_DIM1, &dim1[NTYPE+i],
- FUN_SECT_DIM2, &dim2[NTYPE+i],
- FUN_SECT_BLOCK, &block[NTYPE+i], FUN_WCS, &wcs[NTYPE+i], 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2[NTYPE+i] == 0 ) dim2[NTYPE+i] = 1;
- doexp |= (i+1);
- got++;
- }
- }
- freedtable();
- /* if we have wcs for the data and exposure, and the user asks for it,
- use wcs for conversion */
- if( (s=getenv("FUNCNTS_EXPTRANS")) && !strcasecmp(s, "wcs") ){
- for(i=0; i<got; i++){
- if( wcs[i] && wcs[NTYPE+i] )
- exptrans[i] = EXP_WCS;
- else
- gerror(stderr,
- "no WCS present for WCS-based exposure", name[NTYPE+i]);
- }
- }
- }
-
- /* if we have source exposure file but no background exposure file,
- and if background data comes from source file , then use the source
- exposure file for bkgd exposure as well */
- if( (doexp == SCORR) && !name[BKG] && (bktype != BKG_VAL) ){
- doexp |= BCORR;
- fun[3] = fun[2];
- dim1[3] = dim1[2];
- dim2[3] = dim2[2];
- block[3] = block[2];
- }
-
- /* get time correction values */
- if( timestr ){
- int ip=0;
- int i=0;
- int got;
- double dval;
- char *t;
- newdtable(";");
- for(i=0; i<2; i++){
- if( word(timestr, tbuf, &ip) && *tbuf ){
- dval = strtod(tbuf, &t);
- if( t != tbuf ){
- timecorr[i] = dval;
- }
- else{
- timecorr[i] = FunParamGetd(fun[i], tbuf, 0, 1.0, &got);
- if( !got ){
- /* try pure upper case */
- cluc(tbuf);
- timecorr[i] = FunParamGetd(fun[i], tbuf, 0, 1.0, &got);
- if( !got ){
- gerror(stderr, "can't find time correction parameter: %s\n",
- tbuf);
- }
- }
- }
- dotim |= (i+1);
- }
- }
- freedtable();
- }
- /* if we have source time correction but no background time correction,
- and if background data comes from source file , then use the source
- correction for bkgd as well */
- if( (dotim == SCORR) && !name[BKG] && (bktype != BKG_VAL) ){
- dotim |= BCORR;
- timecorr[BKG] = timecorr[SRC];
- }
-
- /* process separate source/background files */
- if( name[BKG] ){
- for(k=0; k<NTYPE; k++){
- /* process counts in all regions */
- switch(type[k]){
- case FUN_IMAGE:
- case FUN_ARRAY:
- {
- int y, lasty;
- double *dbuf=NULL;
- /* allocate a row buffer */
- dbuf = xmalloc(dim1[k] * sizeof(double));
- /* seed with impossible value so we load first line */
- lasty = -1;
- for(i=0; i<nmask[k]; i++){
- y = masks[k][i].y;
- if( y != lasty ){
- if( !FunImageRowGet(fun[k], dbuf, y, y, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", y, name[k]);
- lasty = y;
- }
- area[k][masks[k][i].region-1] +=
- masks[k][i].xstop - masks[k][i].xstart + 1;
- for(j=masks[k][i].xstart-1; j<=masks[k][i].xstop-1; j++){
- if( !isnand(dbuf[j]) ){
- cnts[0][k][masks[k][i].region-1] += dbuf[j];
- }
- }
- }
- /* free temp buffers */
- if( dbuf ) xfree(dbuf);
- }
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- if( evimage ){
- int *iptr;
- int *ibuf=NULL;
- /* read data as ints */
- if( !(ibuf = FunImageGet(fun[k], NULL, "bitpix=32")) )
- gerror(stderr, "can't FunImageGet: %s\n", name[k]);
- /* get source counts */
- for(i=0; i<nmask[k]; i++){
- iptr = &(ibuf[(masks[k][i].y-1)*dim1[k]]);
- for(j=masks[k][i].xstart-1; j<=masks[k][i].xstop-1; j++){
- cnts[0][k][masks[k][i].region-1] += iptr[j];
- }
- }
- /* free up space */
- if( ibuf ) xfree(ibuf);
- }
- else{
- int *rbuf;
- int got;
- char *rawbuf;
- Filter efilter[MAXINTV];
- /* make sure we will have a valid image section in which to filter */
- if( (x1[k]-x0[k] <= 0) || (y1[k]-y0[k] <= 0) )
- gerror(stderr,
- "invalid or zero image dimensions(s) for table (%s)\n",
- bincols[k] ? bincols[k] : "invalid bincols?");
- /* make up the mode string */
- snprintf(mode, SZ_LINE,
- "type=events,convert=%s,evsect=\"%d %d %d %d %d\"",
- (endian[k] == is_bigendian()) ? "false" : "true",
- x0[k], x1[k], y0[k], y1[k], block[k]);
- /* add columns */
- if( bincols[k] ){
- strcat(mode, ",");
- strcat(mode, bincols[k]);
- }
- /* open filters for all intervals */
- for(v=0; v<nintv; v++){
- strcpy(tbuf, region[k]);
- if( intvs[v] ){
- strcat(tbuf, "&&(");
- strcat(tbuf, intvs[v]);
- strcat(tbuf, ")");
- }
- efilter[v] = FilterOpen(header[k], tbuf, mode);
- }
- /* allocate region value buffer */
- rbuf = xmalloc(maxrow*sizeof(int));
- /* extract events */
- while( (ebuf = FunTableRowGet(fun[k], NULL, maxrow, NULL, &got)) ){
- /* get pointer to raw buffer */
- FunInfoGet(fun[k], FUN_RAWBUF, &rawbuf, 0);
- /* process all intervals in one pass through this data */
- for(v=0; v<nintv; v++){
- /* get events which pass the region filter */
- if( efilter[v] && (efilter[v] != NOFILTER) &&
- FilterEvents(efilter[v], rawbuf, rawsize[k], got, rbuf)){
- /* loop through events, process those which are in a region */
- for(i=0; i<got; i++){
- eptr = (char *)(ebuf+(rowsize[k]*i)+valoffsets[k]);
- if( rbuf[i] > 0 ){
- if( valname[k] && (*valname[k] != '-') )
- cnts[v][k][rbuf[i]-1] +=
- DConvert(eptr, valtypes[k], valns[k]);
- else
- cnts[v][k][rbuf[i]-1] += 1;
- }
- }
- }
- }
- /* free for next read */
- if( ebuf ) xfree(ebuf);
- }
- /* Done with region values */
- if( rbuf ) xfree(rbuf);
- /* close filters */
- for(v=0; v<nintv; v++){
- if( efilter[v] && (efilter[v] != NOFILTER) ){
- FilterClose(efilter[v]);
- }
- }
- }
- /* get area */
- for(i=0; i<nmask[k]; i++){
- area[k][masks[k][i].region-1] +=
- masks[k][i].xstop - masks[k][i].xstart + 1;
- }
- break;
- }
- }
- }
- /* same file for source and background:
- this code is optimized so that we only traverse the file once
- */
- else{
- /* process counts in all regions */
- switch(type[SRC]){
- case FUN_IMAGE:
- case FUN_ARRAY:
- {
- int state;
- int y, lasty;
- double *dbuf=NULL;
- /* allocate a row buffer */
- dbuf = xmalloc(dim1[SRC] * sizeof(double));
- /* seed with impossible value so we load first line */
- lasty = -1;
- for(i=0, j=0; i<nmask[SRC] || j<nmask[BKG]; ){
- if( (i<nmask[SRC]) && (j<nmask[BKG]) ) state = 3;
- else if( i<nmask[SRC] ) state = 1;
- else if( j<nmask[BKG] ) state = 2;
- else break;
- switch(state){
- case 1:
- sline:
- y = masks[SRC][i].y;
- if( y != lasty ){
- if( !FunImageRowGet(fun[SRC], dbuf, y, y, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", y, name[SRC]);
- lasty = y;
- }
- area[SRC][masks[SRC][i].region-1] +=
- masks[SRC][i].xstop - masks[SRC][i].xstart + 1;
- for(k=masks[SRC][i].xstart-1; k<=masks[SRC][i].xstop-1; k++){
- if( !isnand(dbuf[k]) ){
- cnts[0][SRC][masks[SRC][i].region-1] += dbuf[k];
- }
- }
- i++;
- break;
- case 2:
- bline:
- y = masks[BKG][j].y;
- if( y != lasty ){
- if( !FunImageRowGet(fun[SRC], dbuf, y, y, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", y, name[SRC]);
- lasty = y;
- }
- area[BKG][masks[BKG][j].region-1] +=
- masks[BKG][j].xstop - masks[BKG][j].xstart + 1;
- for(k=masks[BKG][j].xstart-1; k<=masks[BKG][j].xstop-1; k++){
- if( !isnand(dbuf[k]) ){
- cnts[0][BKG][masks[BKG][j].region-1] += dbuf[k];
- }
- }
- j++;
- break;
- case 3:
- if( masks[SRC][i].y <= masks[BKG][j].y ){
- goto sline;
- }
- goto bline;
- }
- }
- if( dbuf ) xfree(dbuf);
- }
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- if( evimage ){
- int *iptr;
- int *ibuf=NULL;
- /* read data as ints */
- if( !(ibuf = FunImageGet(fun[SRC], NULL, "bitpix=32")) )
- gerror(stderr, "can't FunImageGet: %s\n", name[SRC]);
- /* get source counts */
- for(i=0; i<nmask[SRC]; i++){
- iptr = &(ibuf[(masks[SRC][i].y-1)*dim1[SRC]]);
- for(j=masks[SRC][i].xstart-1; j<=masks[SRC][i].xstop-1; j++){
- cnts[0][SRC][masks[SRC][i].region-1] += iptr[j];
- }
- }
- /* get background counts and area, if necessary */
- if( bktype != BKG_VAL ){
- for(i=0; i<nmask[BKG]; i++){
- iptr = &(ibuf[(masks[BKG][i].y-1)*dim1[SRC]]);
- for(j=masks[BKG][i].xstart-1; j<=masks[BKG][i].xstop-1; j++){
- cnts[0][BKG][masks[BKG][i].region-1] += iptr[j];
- }
- }
- }
- /* free up space */
- if( ibuf ) xfree(ibuf);
- }
- else{
- int *rbuf;
- int got;
- char *rawbuf;
- Filter efilter[MAXINTV][NTYPE];
- /* make sure we will have a valid image section in which to filter */
- if( (x1[SRC]-x0[SRC] <= 0) || (y1[SRC]-y0[SRC] <= 0) )
- gerror(stderr,
- "invalid or zero image dimensions(s) for table (%s)\n",
- bincols[SRC] ? bincols[SRC] : "invalid bincols?");
- /* open new filters to filter events through regions */
- snprintf(mode, SZ_LINE,
- "type=events,convert=%s,evsect=\"%d %d %d %d %d\"",
- (endian[SRC] == is_bigendian()) ? "false" : "true",
- x0[SRC], x1[SRC], y0[SRC], y1[SRC], block[SRC]);
- /* add columns */
- if( bincols[SRC] ){
- strcat(mode, ",");
- strcat(mode, bincols[SRC]);
- }
- /* open filters for all intervals */
- for(v=0; v<nintv; v++){
- for(i=0; i<NTYPE; i++){
- if( region[i] ){
- strcpy(tbuf, region[i]);
- if( intvs[v] ){
- strcat(tbuf, "&&(");
- strcat(tbuf, intvs[v]);
- strcat(tbuf, ")");
- }
- efilter[v][i] = FilterOpen(header[i], tbuf, mode);
- }
- else{
- efilter[v][i] = NULL;
- }
- }
- }
- /* allocate region value buffer */
- rbuf = xmalloc(maxrow*sizeof(int));
- /* extract and filter events */
- while( (ebuf = FunTableRowGet(fun[SRC], NULL, maxrow, NULL, &got)) ){
- /* get pointer to raw buffer */
- FunInfoGet(fun[SRC], FUN_RAWBUF, &rawbuf, 0);
- /* process all intervals in one pass through this data */
- for(v=0; v<nintv; v++){
- /* get events which pass the region filter */
- for(i=0; i<NTYPE; i++){
- if( efilter[v][i] && (efilter[v][i] != NOFILTER) &&
- FilterEvents(efilter[v][i], rawbuf, rawsize[i], got, rbuf)){
- /* count events which are in a region */
- for(j=0; j<got; j++){
- eptr = (char *)(ebuf+(rowsize[i]*j)+valoffsets[i]);
- if( rbuf[j] > 0 ){
- if( valname[i] && (*valname[i] != '-') )
- cnts[v][i][rbuf[j]-1] +=
- DConvert(eptr, valtypes[i], valns[i]);
- else
- cnts[v][i][rbuf[j]-1] += 1;
- }
- }
- }
- }
- }
- /* free for next read */
- if( ebuf ) xfree(ebuf);
- }
- /* done with region values */
- if( rbuf ) xfree(rbuf);
- /* close filters */
- for(v=0; v<nintv; v++)
- for(i=0; i<NTYPE; i++){
- if( efilter[v][i] && (efilter[v][i] != NOFILTER) ){
- FilterClose(efilter[v][i]);
- }
- }
- }
- /* get source area */
- for(i=0; i<nmask[SRC]; i++){
- area[SRC][masks[SRC][i].region-1] +=
- masks[SRC][i].xstop - masks[SRC][i].xstart + 1;
- }
- /* get background area, if necessary */
- if( bktype != BKG_VAL ){
- for(i=0; i<nmask[BKG]; i++){
- area[BKG][masks[BKG][i].region-1] +=
- masks[BKG][i].xstop - masks[BKG][i].xstart + 1;
- }
- }
- break;
- }
- }
-
- /* accumulate averge exposure for each region */
- if( doexp ){
- for(k=0; k<2; k++){
- if( fun[NTYPE+k] ){
- int ex, ey, lastey;
- double d1, d2;
- double *exbuf=NULL;
- char *tname="unknown";
- exbuf = xmalloc(dim1[NTYPE+k] * sizeof(double));
- if( name[NTYPE+k] )
- tname = name[NTYPE+k];
- else if( (k>0) && name[NTYPE+k-1] )
- tname = name[NTYPE+k-1];
- switch(exptrans[k]){
- case EXP_RATIO:
- lastey = -1;
- d1 = ((double)dim1[NTYPE+k]/(double)dim1[k]);
- d2 = ((double)dim2[NTYPE+k]/(double)dim2[k]);
- for(i=0; i<nmask[k]; i++){
- ey = ((masks[k][i].y - 1) * d2) + 1;
- if( ey != lastey ){
- if( !FunImageRowGet(fun[NTYPE+k], exbuf, ey, ey, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet (exp file): %d %s\n",
- ey, tname);
- lastey = ey;
- }
- for(j=masks[k][i].xstart; j<=masks[k][i].xstop; j++){
- ex = (j-1) * d1 + 1;
- if( ex < 1 ) ex = 1;
- if( ex > dim1[NTYPE+k] ) ex = dim1[NTYPE+k];
- exp[k][masks[k][i].region-1] += exbuf[ex-1];
- }
- }
- break;
- case EXP_WCS:
- lastey = -1;
- for(i=0; i<nmask[k]; i++){
- for(j=masks[k][i].xstart; j<=masks[k][i].xstop; j++){
- double dval1, dval2;
- double dex, dey;
- int offscl;
- /* convert data image pixels to ra/dec using wcs */
- pix2wcs(wcs[k], (double)j,(double)masks[k][i].y, &dval1,&dval2);
- /* convert ra/dec to exp image pixels using wcs */
- wcs2pix(wcs[NTYPE+k], dval1, dval2, &dex, &dey, &offscl);
- ex = (int)(dex+0.5); ey = (int)(dey+0.5);
- if( ex < 1 ) ex = 1;
- if( ex > dim1[NTYPE+k] ) ex = dim1[NTYPE+k];
- if( ey < 1 ) ey = 1;
- if( ey > dim2[NTYPE+k] ) ey = dim2[NTYPE+k];
- if( ey != lastey ){
- if( !FunImageRowGet(fun[NTYPE+k], exbuf, ey, ey, "bitpix=-64") )
- gerror(stderr, "can't FunImageRowGet (exp file): %d %s\n",
- ey, tname);
- lastey = ey;
- }
- exp[k][masks[k][i].region-1] += exbuf[ex-1];
- }
- }
- break;
- default:
- gerror(stderr, "unknown exposure conversion type");
- }
- if( exbuf ) xfree(exbuf);
- }
- /* since we already checked for source exposure, we must be missing
- bkgd exposure. This is OK, unless we have a bkgd file. In that case,
- we need to warn the user and make an assumption about errors */
- else if( (k==1) && name[BKG] ){
- gwarning(stderr,
- "No exposure file was specified for the background file.\nWe therefore assume that the bkgd already has been corrected for\nexposure and that the error associated with each bkgd pixel is 0.\n");
- dobkgderr = 0;
- }
- }
- }
-
- /* reset the interval index for next stage of proessing*/
- v = 0;
- /* come back here if we are processing multiple intervals */
-intvagain:
- /* for data-based background, check validity of background area */
- if( bktype != BKG_VAL ){
- bkval = 0.0;
- bkarea = 0;
- bkexp = 0.0;
- for(i=0; i<nreg[BKG]; i++){
- bkval += cnts[v][BKG][i];
- bkarea += area[BKG][i];
- bkexp += exp[BKG][i];
- }
- /* if background area is 0, that is bad */
- if( bkarea == 0 ){
- gerror(stdout, "background has zero area\n");
- }
- }
-
- /* display source header information */
- fprintf(stdout, "# source\n");
- fprintf(stdout, "# data_file:\t\t%s\n", name[SRC]);
- if( intvs[v] )
- fprintf(stdout, "# interval:\t\t%s\n", intvs[v]);
- if( valname[SRC] && (*valname[SRC] != '-') )
- fprintf(stdout, "# value column:\t%s\n", valname[SRC]);
- if( dpp[SRC] > 0.0 )
- fprintf(stdout, "# arcsec/pixel:\t%g\n", dpp[SRC]*ARCSEC_PER_DEG);
- if( doexp & SCORR )
- fprintf(stdout, "# exp_correction:\t%s\n", name[NTYPE+SRC]);
- if( dotim & SCORR )
- fprintf(stdout, "# time_correction:\t%g\n", timecorr[SRC]);
-
- /* display bkgd header information */
- fprintf(stdout, "# background\n");
- if( name[BKG] ){
- fprintf(stdout, "# data_file:\t\t%s\n", name[BKG]);
- if( intvs[v] )
- fprintf(stdout, "# interval:\t\t%s\n", intvs[v]);
- if( valname[BKG] && (*valname[BKG] != '-') )
- fprintf(stdout, "# value column:\t%s\n", valname[BKG]);
- if( dpp[BKG] > 0.0 )
- fprintf(stdout, "# arcsec/pixel:\t%g\n", dpp[BKG]*ARCSEC_PER_DEG);
- if( doexp & BCORR )
- fprintf(stdout, "# exp_correction:\t%s\n", name[NTYPE+BKG]);
- if( dotim & BCORR )
- fprintf(stdout, "# time_correction:\t%g\n", timecorr[BKG]);
- if( dppnorm != 1.0 )
- fprintf(stdout, "# wcs area norm factor:\t%g/%g (source/bkgd))\n",
- dpp[SRC],dpp[BKG]);
- }
- else if( bktype != BKG_VAL ){
- fprintf(stdout, "# data_file:\t\t%s\n", name[SRC]);
- if( valname[SRC] && valname[BKG] && strcmp(valname[SRC], valname[BKG]) &&
- (*valname[BKG] != '-') )
- fprintf(stdout, "# value_column:\t%s\n", valname[BKG]);
- }
- else
- fprintf(stdout, "# constant_value:\t%.6f\n", bkval);
-
- /* dislay table information */
- if( (dpp[SRC] > 0.0) && !dopixels )
- s = "arcsec";
- else
- s = "pixel";
- fprintf(stdout, "# column units\n");
- fprintf(stdout, "# area:\t\t%s**2\n", s);
- fprintf(stdout, "# surf_bri:\t\tcnts/%s**2%s%s\n",
- s, (dotim & SCORR)? "/sec" : "", (doexp & SCORR)? "/expval" : "");
- fprintf(stdout, "# surf_err:\t\tcnts/%s**2%s%s\n",
- s, (dotim & SCORR)? "/sec" : "", (doexp & SCORR)? "/expval" : "");
- if( doradang ){
- fprintf(stdout, "# radii:\t\t%ss\n", s);
- fprintf(stdout, "# angles:\t\tdegrees\n");
- }
-
- /* come back here if we also are outputting summed results */
-sumagain:
- /* if we need to display sums, so the sum now, but save unsummed values,
- because we will have to display those as well */
- switch(dosum){
- case 1:
- memcpy(savecnts[v][SRC], cnts[v][SRC], (nreg[SRC]+1)*sizeof(double));
- memcpy(savearea[SRC], area[SRC], (nreg[SRC]+1)*sizeof(int));
- for(i=1; i<nreg[SRC]; i++){
- cnts[v][SRC][i] += cnts[v][SRC][i-1];
- area[SRC][i] += area[SRC][i-1];
- }
- if( bktype != BKG_VAL ){
- memcpy(savecnts[v][BKG], cnts[v][BKG],
- (nreg[BKG]+1)*sizeof(double));
- memcpy(savearea[BKG], area[BKG], (nreg[BKG]+1)*sizeof(int));
- for(i=1; i<nreg[BKG]; i++){
- cnts[v][BKG][i] += cnts[v][BKG][i-1];
- area[BKG][i] += area[BKG][i-1];
- }
- }
- break;
- case 2:
- memcpy(cnts[v][SRC], savecnts[v][SRC], (nreg[SRC]+1)*sizeof(double));
- memcpy(area[SRC], savearea[SRC], (nreg[SRC]+1)*sizeof(int));
- if( bktype != BKG_VAL ){
- memcpy(cnts[v][BKG], savecnts[v][BKG],
- (nreg[BKG]+1)*sizeof(double));
- memcpy(area[BKG], savearea[BKG], (nreg[BKG]+1)*sizeof(int));
- }
- break;
- default:
- break;
- }
-
- /* process the background */
- switch(bktype){
- /* constant background is counts/pixel */
- case BKG_VAL:
- for(i=0; i<nreg[SRC]; i++){
- bncnts[v][i] = (bkval * area[SRC][i] * timecorr[SRC]);
- bscnts[v][i] = cnts[v][SRC][i] - bncnts[v][i];
- bserr[v][i] = sqrt(cnts[v][SRC][i]);
- bnerr[v][i] = 0.0;
- }
- break;
- case BKG_ALL:
- switch( dosum ){
- case 1:
- bkval = cnts[v][BKG][nreg[BKG]-1];
- bkarea = area[BKG][nreg[BKG]-1];
- bkexp = exp[BKG][nreg[BKG]-1];
- break;
- case 2:
- default:
- bkval = 0.0;
- bkarea = 0;
- bkexp = 0.0;
- /* get total background and background area */
- for(i=0; i<nreg[BKG]; i++){
- bkval += cnts[v][BKG][i];
- bkarea += area[BKG][i];
- bkexp += exp[BKG][i];
- }
- break;
- }
- {
- double tempnorm=0.0;
- /* subtract entire normalized background from each source region */
- for(i=0; i<nreg[SRC]; i++){
- /* get area and exposure normalization */
- switch(doexp){
- case NONE:
- tempnorm = (double)area[SRC][i] / bkarea;
- break;
- case SCORR:
- tempnorm = exp[SRC][i] / bkarea;
- break;
- case BCORR:
- tempnorm = (double)area[SRC][i] / bkexp;
- break;
- case BOTH:
- tempnorm = exp[SRC][i] / bkexp;
- break;
- }
- /* add time normalization */
- tempnorm *= (timecorr[SRC]/timecorr[BKG]);
- /* add normalization due to different pixels sizes in src and bkg */
- tempnorm *= dppnorm;
- bncnts[v][i] = (bkval * tempnorm);
- bscnts[v][i] = cnts[v][SRC][i] - bncnts[v][i];
- bserr[v][i] = sqrt(cnts[v][SRC][i] + (tempnorm*tempnorm*bkval));
- if( dobkgderr )
- bnerr[v][i] = sqrt(bkval) * tempnorm;
- else
- bnerr[v][i] = 0.0;
- }
- }
- break;
- case BKG_EACH:
- {
- double tempnorm=0.0;
- /* subtract each background from each source region */
- for(i=0; i<nreg[SRC]; i++){
- /* get area and exposure normalization */
- switch(doexp){
- case NONE:
- tempnorm = (double)area[SRC][i] / (double)area[BKG][i];
- break;
- case SCORR:
- tempnorm = exp[SRC][i] / (double)area[BKG][i];
- break;
- case BCORR:
- tempnorm = (double)area[SRC][i] / (double)exp[BKG][i];
- break;
- case BOTH:
- tempnorm = exp[SRC][i] / (double)exp[BKG][i];
- break;
- }
- /* add time normalization */
- tempnorm *= (timecorr[SRC]/timecorr[BKG]);
- /* add normalization due to different pixels sizes in src and bkg */
- tempnorm *= dppnorm;
- bncnts[v][i] = (cnts[v][BKG][i] * tempnorm);
- bscnts[v][i] = cnts[v][SRC][i] - bncnts[v][i];
- bserr[v][i] = sqrt(cnts[v][SRC][i] +
- (tempnorm * tempnorm * cnts[v][BKG][i]));
- if( dobkgderr )
- bnerr[v][i] = sqrt(cnts[v][BKG][i]) * tempnorm;
- else
- bnerr[v][i] = 0.0;
- }
- }
- break;
- }
-
- /* display results */
- /* display the main output table */
- switch( dosum ){
- case 1:
- fprintf(stdout, "\n");
- fprintf(stdout, "# summed background-subtracted results\n");
- fprintf(stdout, "upto%c net_counts%c error", cold, cold);
- break;
- case 2:
- default:
- if( cold == '\t' ) fprintf(stdout, "\f");
- fprintf(stdout, "\n");
- fprintf(stdout, "# background-subtracted results\n");
- fprintf(stdout, " reg%c net_counts%c error", cold, cold);
- break;
- }
- fprintf(stdout, "%c background%c berror", cold, cold);
- fprintf(stdout, "%c area%c surf_bri%c surf_err", cold, cold, cold);
- if( doradang )
- fprintf(stdout, "%c radius1%c radius2%c angle1%c angle2",
- cold, cold, cold, cold);
- fprintf(stdout, "\n");
- fprintf(stdout, "----%c------------%c---------", cold, cold);
- fprintf(stdout, "%c------------%c---------", cold, cold);
- fprintf(stdout, "%c---------%c---------%c---------", cold, cold, cold);
- if( doradang )
- fprintf(stdout, "%c---------%c---------%c---------%c---------",
- cold, cold, cold, cold);
- fprintf(stdout, "\n");
- if( radang )
- newdtable(",");
- cradang = radang;
- for(i=0; i<nreg[SRC]; i++){
- /* get next line from radii/angle string */
- if( cradang ){
- tradang = (char *)strchr(cradang, '\n');
- if( tradang )
- *tradang = '\0';
- }
- if( area[SRC][i] ){
- double cntsperarea;
- double errperarea;
- double areasq;
- if( doexp & SCORR ){
- cntsperarea = bscnts[v][i]/(exp[SRC][i]*timecorr[SRC]);
- errperarea = bserr[v][i]/(exp[SRC][i]*timecorr[SRC]);
- areasq = area[SRC][i];
- }
- else{
- cntsperarea = bscnts[v][i]/(area[SRC][i]*timecorr[SRC]);
- errperarea = bserr[v][i]/(area[SRC][i]*timecorr[SRC]);
- areasq = area[SRC][i];
- }
- /* if we know how to convert to cnts/pix**2 to cnts/arcsec**2, do it */
- if( !dopixels && (dpp[SRC] > 0.0) ){
- cntsperarea = (cntsperarea / (dpp[SRC]*dpp[SRC])) / ARCSEC_PER_DEGSQ;
- errperarea = (errperarea / (dpp[SRC]*dpp[SRC])) / ARCSEC_PER_DEGSQ;
- areasq = (areasq * (dpp[SRC]*dpp[SRC])) * ARCSEC_PER_DEGSQ;
- }
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%4d%c%12.3f%c%9.3f%c%12.3f%c%9.3f%c%9.2f%c%9.3f%c%9.3f";
- break;
- case 1:
- fmt = "%4d%c%12.3g%c%9.3g%c%12.3g%c%9.3g%c%9.2g%c%9.3g%c%9.3g";
- break;
- case 2:
- fmt = "%4d%c%.14g%c%.14g%c%.14g%c%.14g%c%.14g%c%.14g%c%.14g";
- break;
- }
- fprintf(stdout, fmt,
- i+1, cold,
- bscnts[v][i], cold, bserr[v][i], cold,
- bncnts[v][i], cold, bnerr[v][i], cold,
- areasq, cold, cntsperarea, cold, errperarea);
- /* display values from this line of radii/angles */
- if( doradang && cradang ){
- int ip=0;
- double dval;
- for(j=0; j<4; j++){
- if( word(cradang, tbuf, &ip) && strcmp(tbuf, "NA") ){
- dval = strtod(tbuf, NULL);
- if( (j<2) && !dopixels && (dpp[SRC]>0.0) )
- fprintf(stdout, "%c%9.3f", cold, (dval*dpp[SRC]*ARCSEC_PER_DEG));
- else
- fprintf(stdout, "%c%9.3f", cold, dval);
- }
- else{
- fprintf(stdout, "%c%9.9s", cold, "NA");
- }
- }
- }
- /* new-line at end */
- fprintf(stdout, "\n");
- }
- /* might have to display zero area pixels */
- else if( dozero ){
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%4d%c%12.3f%c%9.3f%c%12.3f%c%9.3f%c%9.2f%c%9.3f%c%9.3f";
- break;
- case 1:
- fmt = "%4d%c%12.3g%c%9.3g%c%12.3g%c%9.3g%c%9.2g%c%9.3g%c%9.3g";
- break;
- case 2:
- fmt = "%4d%c%.14g%c%.14g%c%.14g%c%.14g%c%.14g%c%.14g%c%.14g";
- break;
- }
- fprintf(stdout, fmt, i+1, cold, 0.0, cold, 0.0, cold, 0.0, cold, 0.0,
- cold, 0.0, cold, 0.0, cold, 0.0);
- /* add the correct radii and angle info, to make plotting easier */
- if( doradang && cradang ){
- int ip=0;
- double dval;
- for(j=0; j<4; j++){
- if( word(cradang, tbuf, &ip) && strcmp(tbuf, "NA") ){
- dval = strtod(tbuf, NULL);
- if( (j<2) && !dopixels && (dpp[SRC]>0.0) )
- fprintf(stdout, "%c%9.3f", cold, (dval*dpp[SRC]*ARCSEC_PER_DEG));
- else
- fprintf(stdout, "%c%9.3f", cold, dval);
- }
- else{
- fprintf(stdout, "%c%9.9s", cold, "NA");
- }
- }
- }
- /* new-line at end */
- fprintf(stdout, "\n");
- }
- /* bump to next line of radii/angles */
- if( tradang ){
- cradang = tradang+1;
- /* put back the cr in case we pass through again */
- *tradang = '\n';
- }
- }
- if( radang )
- freedtable();
- fprintf(stdout, "\n");
- fflush(stdout);
-
- /* if we just summed, go back and display unsummed values */
- switch(dosum){
- case 1:
- dosum = 2;
- goto sumagain;
- /* set flag back to 1 in case we have multiple intervals to process */
- case 2:
- dosum = 1;
- break;
- default:
- break;
- }
-
- /* display raw source counts */
- if( dosum ){
- int tarea=0;
- double tcnts=0;
- if( cold == '\t' ) fprintf(stdout, "\f");
- fprintf(stdout, "\n");
- /* display source info */
- if( filtstr[SRC] ){
- fprintf(stdout, "# source_region(s):\n");
- fprintf(stdout, "# %s\n\n", filtstr[SRC]);
- }
- fprintf(stdout, "# summed_source_data\n");
- fprintf(stdout,
- " reg%c counts%c pixels%c sumcnts%c sumpix\n",
- cold, cold, cold, cold);
- fprintf(stdout,
- "----%c------------%c---------%c------------%c---------\n",
- cold, cold, cold, cold);
- for(i=0; i<nreg[SRC]; i++){
- tcnts += cnts[v][SRC][i];
- tarea += area[SRC][i];
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%4d%c%12.3f%c%9d%c%12.3f%c%9d\n";
- break;
- case 1:
- fmt = "%4d%c%12.3g%c%9d%c%12.3g%c%9d\n";
- break;
- case 2:
- fmt = "%4d%c%.14g%c%9d%c%.14g%c%9d\n";
- break;
- }
- fprintf(stdout, fmt,
- i+1, cold,
- cnts[v][SRC][i], cold, area[SRC][i], cold,
- tcnts, cold, tarea);
- }
- } else{
- if( cold == '\t' ) fprintf(stdout, "\f");
- fprintf(stdout, "\n");
- /* display source info */
- if( filtstr[SRC] ){
- fprintf(stdout, "# source_region(s):\n");
- fprintf(stdout, "# %s\n\n", filtstr[SRC]);
- }
- fprintf(stdout, "# source_data\n");
- fprintf(stdout, " reg%c counts%c pixels", cold, cold);
- if( doexp & SCORR )
- fprintf(stdout, "%c avg_exp", cold);
- fprintf(stdout, "\n");
- fprintf(stdout, "----%c------------%c---------", cold, cold);
- if( doexp & SCORR )
- fprintf(stdout, "%c---------", cold);
- fprintf(stdout, "\n");
- for(i=0; i<nreg[SRC]; i++){
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%4d%c%12.3f%c%9d";
- break;
- case 1:
- fmt = "%4d%c%12.3g%c%9d";
- break;
- case 2:
- fmt = "%4d%c%.14g%c%9d";
- break;
- }
- fprintf(stdout, fmt, i+1, cold, cnts[v][SRC][i], cold, area[SRC][i]);
-
- if( doexp & SCORR ){
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%c%9.3f";
- break;
- case 1:
- fmt = "%c%9.3g";
- break;
- case 2:
- fmt = "%c%.14g";
- break;
- }
- if( area[SRC][i] > 0 )
- fprintf(stdout, fmt, cold, exp[SRC][i]/area[SRC][i]);
- else
- fprintf(stdout, fmt, cold, 0.0);
- }
- fprintf(stdout, "\n");
- }
- }
- fprintf(stdout, "\n");
- fflush(stdout);
-
- /* display raw background info */
- switch(bktype){
- case BKG_VAL:
- break;
- case BKG_ALL:
- if( cold == '\t' ) fprintf(stdout, "\f");
- fprintf(stdout, "\n");
- if( filtstr[BKG] ){
- fprintf(stdout, "# background_region(s)\n");
- fprintf(stdout, "# %s\n\n", filtstr[BKG]);
- }
- fprintf(stdout, "# background_data\n");
- fprintf(stdout, " reg%c counts%c pixels", cold, cold);
- if( doexp & BCORR )
- fprintf(stdout, "%c avg_exp", cold);
- fprintf(stdout, "\n");
- fprintf(stdout, "----%c------------%c---------", cold, cold);
- if( doexp & BCORR )
- fprintf(stdout, "%c---------", cold);
- fprintf(stdout, "\n");
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%s%c%12.3f%c%9d";
- break;
- case 1:
- fmt = "%s%c%12.3g%c%9d";
- break;
- case 2:
- fmt = "%s%c%.14g%c%9d";
- break;
- }
- fprintf(stdout, fmt, "all ", cold, bkval, cold, bkarea);
- if( doexp & BCORR ){
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%c%9.3f";
- break;
- case 1:
- fmt = "%c%9.3g";
- break;
- case 2:
- fmt = "%c%.14g";
- break;
- }
- fprintf(stdout, fmt, cold, bkexp/bkarea);
- }
- fprintf(stdout, "\n");
- break;
- case BKG_EACH:
- if( dosum ){
- int tarea=0;
- double tcnts=0;
- if( cold == '\t' ) fprintf(stdout, "\f");
- fprintf(stdout, "\n");
- if( filtstr[BKG] ){
- fprintf(stdout, "# background_region(s)\n");
- fprintf(stdout, "# %s\n\n", filtstr[BKG]);
- }
- fprintf(stdout, "# summed_background_data\n");
- fprintf(stdout,
- " reg%c counts%c pixels%c sumcnts%c sumpix\n",
- cold, cold, cold, cold);
- fprintf(stdout,
- "----%c------------%c---------%c------------%c---------\n",
- cold, cold, cold, cold);
- for(i=0; i<nreg[BKG]; i++){
- tcnts += cnts[v][BKG][i];
- tarea += area[BKG][i];
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%4d%c%12.3f%c%9d%c%12.3f%c%9d\n";
- break;
- case 1:
- fmt = "%4d%c%12.3g%c%9d%c%12.3g%c%9d\n";
- break;
- case 2:
- fmt = "%4d%c%.14g%c%9d%c%.14g%c%9d\n";
- break;
- }
- fprintf(stdout, fmt, i+1, cold,
- cnts[v][BKG][i], cold, area[BKG][i], cold,
- tcnts, cold, tarea);
- }
- } else{
- if( cold == '\t' ) fprintf(stdout, "\f");
- fprintf(stdout, "\n");
- if( filtstr[BKG] ){
- fprintf(stdout, "# background_region(s)\n");
- fprintf(stdout, "# %s\n\n", filtstr[BKG]);
- }
- fprintf(stdout, "# background_data\n");
- fprintf(stdout, " reg%c counts%c pixels", cold, cold);
- if( doexp & BCORR )
- fprintf(stdout, "%c avg_exp", cold);
- fprintf(stdout, "\n");
- fprintf(stdout, "----%c------------%c---------", cold, cold);
- if( doexp & BCORR )
- fprintf(stdout, "%c---------", cold);
- fprintf(stdout, "\n");
- for(i=0; i<nreg[BKG]; i++){
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%4d%c%12.3f%c%9d";
- break;
- case 1:
- fmt = "%4d%c%12.3g%c%9d";
- break;
- case 2:
- fmt = "%4d%c%.14g%c%9d";
- break;
- }
- fprintf(stdout, fmt, i+1, cold,
- cnts[v][BKG][i], cold, area[BKG][i]);
- if( doexp & BCORR ){
- /* get correctly precisioned format statement */
- switch(dog){
- case 0:
- fmt = "%c%9.3f";
- break;
- case 1:
- fmt = "%c%9.3g";
- break;
- case 2:
- fmt = "%c%.14g";
- break;
- }
- if( area[BKG][i] > 0 )
- fprintf(stdout, fmt, cold, exp[BKG][i]/area[BKG][i]);
- else
- fprintf(stdout, fmt, cold, 0.0);
- }
- fprintf(stdout, "\n");
- }
- }
- break;
- }
- fprintf(stdout, "\n");
- fflush(stdout);
-
- /* process the next interval, if necessary */
- if( ++v < nintv ){
- fprintf(stdout, "\014\n");
- goto intvagain;
- }
-
- /* cleanup */
- for(i=0; i<nintv; i++){
- if( bncnts[i] ) xfree(bncnts[i]);
- if( bnerr[i] ) xfree(bnerr[i]);
- if( bscnts[i] ) xfree(bscnts[i]);
- if( bserr[i] ) xfree(bserr[i]);
- for(j=0; j<2; j++){
- if( cnts[i][j] ) xfree(cnts[i][j]);
- if( savecnts[i][j] ) xfree(savecnts[i][j]);
- }
- if( intvs[i] ) xfree(intvs[i]);
- }
- for(i=0; i<2; i++){
- if( masks[i] ) xfree(masks[i]);
- if( area[i] ) xfree(area[i]);
- if( exp[i] ) xfree(exp[i]);
- if( savearea[i] ) xfree(savearea[i]);
- if( saveexp[i] ) xfree(saveexp[i]);
- if( filtstr[i] ) xfree(filtstr[i]);
- if( valname[i] ) xfree(valname[i]);
- }
- if( radang ) xfree(radang);
- for(i=0; i<4; i++){
- if( name[i] ){
- xfree(name[i]);
- if( fun[i] ) FunClose(fun[i]);
- }
- }
-
- return(0);
-}
diff --git a/funtools/funcnts_plot.tmpl b/funtools/funcnts_plot.tmpl
deleted file mode 100755
index dace624..0000000
--- a/funtools/funcnts_plot.tmpl
+++ /dev/null
@@ -1,171 +0,0 @@
-#!/bin/sh
-# set -x
-
-LC_NUMERIC=en_US.ISO8859-1
-export LC_NUMERIC
-
-files="None"
-while [ x"$1" != x ]; do
- case $1 in
- -file)
- files="$2"
- shift
- shift
- continue;;
- *)
- break;;
- esac
-done
-
-if [ x"$1" = xgnuplot ]; then
-
- if [ x`which gnuplot 2>/dev/null` = x ]; then
- echo "ERROR: gnuplot not available"
- exit 1
- fi
- AWK '
- BEGIN{
- mode=1
- xlabel="unknown"
- ylabel="unknown"
- prev="noprev"
- ind=0
- plots=0
- counts = 0
- initparam=0
- }
- mode==1{
- if( initparam == 0 ){
- if( files == "None" ){
- files=""
- dofile="true"
- }
- else{
- dofile="false"
- }
- initparam=1
- }
- if( dofile == "true" && $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( files != "" ) files = files ","
- files = files $4
- }
- else if( $1 == "#" && $2 == "radii:" ){
- xlabel = $3
- }
- else if( $1 == "#" && $2 == "surf_bri:" ){
- ylabel = $3
- }
- else if( $1 == "----" ){
- head = sprintf("set title \"funcnts(%s)\"\n", files)
- head = head sprintf("set xlabel \" radius(%s)\"\n", xlabel)
- head = head sprintf("set ylabel \"surf_bri(%s)\"\n", ylabel)
- head = head "plot "
- mode = 2
- next
- }
- }
- mode==2{
- if( NF == 12 ){
- if( $11 == prev ){
- ind += 1
- }
- else{
- ind = 1
- plots += 1
- i = (plots - 1) * 4 + 2
- if( plots > 1 )
- head = head ", "
- head = head sprintf("\"-\" using 1:%d:%d:%d:%d title \"profile #%d\" with boxerrorbars", i, i+1, i+2, i+3, plots)
- }
- if( data[ind] == "" )
- data[ind] = sprintf("%s", ($9+$10)/2)
- data[ind] = data[ind] sprintf(" %s %s %s %s", $7, $7-$8, $7+$8, $10-$9)
- counts += $7
- prev = $11
- }
- else{
- mode = 3
- }
- }
- END{
- if( counts == 0 ){
- exit 0
- }
- print head
- for(i=1; i<=plots; i++){
- for(j=1; j<=ind; j++){
- print data[j]
- }
- print "e"
- }
- }
- ' files="$files" | gnuplot -persist - 1>/dev/null 2>&1
- exit 0
-
-elif [ x"$1" = xds9 ]; then
-
- AWK '
- BEGIN{
- mode=1
- xlabel="unknown"
- ylabel="unknown"
- initparam=0
- }
- mode==1{
- if( initparam == 0 ){
- if( files == "None" ){
- files=""
- dofile="true"
- }
- else{
- dofile="false"
- }
- initparam=1
- }
- if( dofile == "true" && $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( files != "" ) files = files ","
- files = files $4
- }
- else if( $1 == "#" && $2 == "radii:" ){
- xlabel = $3
- }
- else if( $1 == "#" && $2 == "surf_bri:" ){
- ylabel = $3
- }
- else if( $1 == "----" ){
- ds9header="'"${DS9_PLOT_HEADER}"'"
- if( ds9header != "" ) {
- printf "%s 3\n", ds9header
- }
- else{
- printf "funcnts(%s) avg_radius(%s) surf_bri(%s) 3\n", files, xlabel, ylabel
- }
- mode = 2
- next
- }
- }
- mode==2{
- if( NF == 12 ){
- if( $9 != "NA" ){
- print ($9+$10)/2, $7, $8
- }
- else{
- print "ERROR: annulus, circle, panda regions only"
- exit 1
-# print $7, "non-annulus-region", "specified!"
-# mode = 3
- }
- }
- else{
- mode = 3
- }
- }
- ' files="$files"
- exit 0
-else
-
- echo "ERROR: unknown argument: " $1
- echo "funcnts -r ... | funcnts.plot [ds9|gnuplot]"
- exit 1
-
-fi
diff --git a/funtools/funcnts_sed.tmpl b/funtools/funcnts_sed.tmpl
deleted file mode 100755
index 28a2dcb..0000000
--- a/funtools/funcnts_sed.tmpl
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-sed '1,/---- .*/d
-/^$/,$d'
diff --git a/funtools/funcol.c b/funtools/funcol.c
deleted file mode 100644
index 277cc86..0000000
--- a/funtools/funcol.c
+++ /dev/null
@@ -1,1461 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-/*
- *
- * _FunColCmp -- compare routine for qsort
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunColCmp(const void *s1, const void *s2)
-#else
-static int _FunColCmp(s1, s2)
- const void *s1;
- const void *s2;
-#endif
-{
- FunCol *f1 = (FunCol *)s1;
- FunCol *f2 = (FunCol *)s2;
-
- /* user order flag */
- if( (*f1)->order > (*f2)->order )
- return -1;
- if( (*f1)->order < (*f2)->order )
- return 1;
- else
- return 0;
-}
-
-#ifdef ANSI_FUNC
-static int
-mparse (char *mode)
-#else
-static int mparse(mode)
- char *mode;
-#endif
-{
- int xmode = 0;
- xmode |= ( strpbrk(mode, "a") != NULL ? COL_ACTIVE : 0 );
- xmode |= ( strpbrk(mode, "i") != NULL ? COL_IBUF : 0 );
- xmode |= ( strpbrk(mode, "p") != NULL ? COL_PTR : 0 );
- xmode |= ( strpbrk(mode, "r") != NULL ? COL_READ : 0 );
- xmode |= ( strpbrk(mode, "w") != NULL ? COL_WRITE : 0 );
- return xmode;
-}
-
-#ifdef ANSI_FUNC
-static void
-_FunGetAlias(Fun fun, char *iname, char *oname)
-#else
-static void _FunGetAlias(fun, iname, oname)
- Fun fun;
- char *iname;
- char *oname;
-#endif
-{
- strcpy(oname, iname);
- if( !strcasecmp(iname, "$x") ){
- if( fun->bin[0] >= 0 ){
- strcpy(oname, fun->header->table->col[fun->bin[0]].name);
- }
- }
- else if( !strcasecmp(iname, "$y") ){
- if( fun->bin[1] >= 0 ){
- strcpy(oname, fun->header->table->col[fun->bin[1]].name);
- }
- }
-}
-
-
-/*
- *
- * _FunColumnAddRegion -- primitive to add region to a list of columns
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunColumnAddRegion(Fun fun, int dopad, char *mode, int *rgot, size_t *rsize)
-#else
-static int
-_FunColumnAddRegion(fun, dopad, mode, rgot, rsize)
- Fun fun;
- int dopad;
- char *mode;
- int *rgot;
- size_t *rsize;
-#endif
-{
- int got=*rgot;
- size_t tsize=*rsize;
- size_t pad;
-
- /* only add region if we do not have it already, but don't activate it */
- if( !FunColumnLookup(fun, COL_REGION_NAME, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- /* allocate a new column struct */
- if( !(fun->cols[got] = (FunCol)xcalloc(1, sizeof(FunColRec))) ){
- gerror(stderr, "can't allocate FunCol struct\n");
- return 0;
- }
- /* fill in the blanks with the known info */
- fun->cols[got]->tcol = COL_REGION_ID;
- fun->cols[got]->name = xstrdup(COL_REGION_NAME);
- fun->cols[got]->type = 'J';
- fun->cols[got]->from = -1;
- fun->cols[got]->mode = mparse(mode);
- fun->cols[got]->mode &= ~COL_ACTIVE;
- fun->cols[got]->n = 1;
- fun->cols[got]->width = ft_sizeof(fun->cols[got]->type);
- /* pad for alignment */
- if( dopad ){
- pad = (sizeof(int) - (tsize % sizeof(int)));
- if( pad != sizeof(int) )
- tsize += pad;
- }
- fun->cols[got]->offset = tsize;
- tsize += sizeof(int);
- got++;
-
- /* reset return values */
- *rgot = got;
- *rsize = tsize;
- /* return the news */
- return got;
- }
- else
- return 0;
-}
-
-/*
- *
- * _FunColumnAddNum -- primitive to add num to a list of columns
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunColumnAddNum(Fun fun, int dopad, char *mode, int *rgot, size_t *rsize)
-#else
-static int
-_FunColumnAddNum(fun, dopad, mode, rgot, rsize)
- Fun fun;
- int dopad;
- char *mode;
- int *rgot;
- size_t *rsize;
-#endif
-{
- int got=*rgot;
- size_t tsize=*rsize;
- size_t pad;
-
- /* only add num if we do not have it already, but don't activate it */
- if( !FunColumnLookup(fun, COL_NUM_NAME, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- /* allocate a new column struct */
- if( !(fun->cols[got] = (FunCol)xcalloc(1, sizeof(FunColRec))) ){
- gerror(stderr, "can't allocate FunCol struct\n");
- return 0;
- }
- /* fill in the blanks with the known info */
- fun->cols[got]->tcol = COL_NUM_ID;
- fun->cols[got]->name = xstrdup(COL_NUM_NAME);
- fun->cols[got]->type = 'J';
- fun->cols[got]->from = -1;
- fun->cols[got]->mode = mparse(mode);
- fun->cols[got]->mode &= ~COL_ACTIVE;
- fun->cols[got]->n = 1;
- fun->cols[got]->width = ft_sizeof(fun->cols[got]->type);
- /* pad for alignment */
- if( dopad ){
- pad = (sizeof(int) - (tsize % sizeof(int)));
- if( pad != sizeof(int) )
- tsize += pad;
- }
- fun->cols[got]->offset = tsize;
- tsize += sizeof(int);
- got++;
-
- /* reset return values */
- *rgot = got;
- *rsize = tsize;
- /* return the news */
- return got;
- }
- else
- return 0;
-}
-
-/*
- *
- * _FunColumnAddTable -- primitive to add entries from a binary table to list
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunColumnAddTable(Fun fun, FITSHead header, char *mode,
- int dopad, int *got, size_t *size)
-#else
-static int
-_FunColumnAddTable(fun, header, mode, dopad, got, size)
- Fun fun;
- FITSHead header;
- char *mode;
- int dopad;
- int *got;
- size_t *size;
-#endif
-{
- int i;
- int pad;
- int fsize;
- FITSCard card1, card2, card3;
-
- for(i=0; (i<header->table->tfields) && (*got<FUN_MAXCOL) ; i++){
- /* sanity check */
- if( !ft_sizeof(header->table->col[i].type) ){
- gwarning(stderr,
- "skipping column %s with no width (FITS TFORM%d is probably unknown)\n",
- header->table->col[i].name, i+1);
- continue;
- }
- /* allocate a new column struct */
- if( !(fun->cols[*got] = (FunCol)xcalloc(1, sizeof(FunColRec))) ){
- gerror(stderr, "can't allocate FunCol struct\n");
- return 0;
- }
- /* fill in the blanks with the info directly from the table */
- fun->cols[*got]->tcol = i;
- fun->cols[*got]->name = xstrdup(header->table->col[i].name);
-
- fun->cols[*got]->from = -1;
- fun->cols[*got]->mode = mparse(mode);
- fun->cols[*got]->n = header->table->col[i].n;
- fun->cols[*got]->tblank = header->table->col[i].dblank;
- fun->cols[*got]->doblank = header->table->col[i].has_blank;
- fun->cols[*got]->tlmin = ft_headgetr(header, "TLMIN", i+1, 0.0, &card1);
- fun->cols[*got]->tlmax = ft_headgetr(header, "TLMAX", i+1, 0.0, &card2);
- fun->cols[*got]->binsiz = ft_headgetr(header, "TDBIN", i+1, 0.0, &card3);
- fun->cols[*got]->type = header->table->col[i].type;
- if( header->table->col[i].scaled && (header->table->col[i].type != 'X')){
- /* for input data, just set the scale values */
- if( fun->cols[*got]->mode & COL_IBUF ){
- fun->cols[*got]->tzero = header->table->col[i].zero;
- fun->cols[*got]->tscale = header->table->col[i].scale;
- fun->cols[*got]->scaled = FUN_SCALE_EXISTS;
- }
- /* otherwise, change type of column to double */
- else{
- switch(header->table->col[i].type){
- case 'B':
- fun->cols[*got]->type = 'I';
- break;
- case 'I':
- case 'U':
- fun->cols[*got]->type = 'J';
- break;
- default:
- fun->cols[*got]->type = 'D';
- break;
- }
- }
- }
- /* save wcs keywords */
- fun->cols[*got]->tctyp = ft_headgets(header, "TCTYP",
- i+1, NULL, &card1);
- fun->cols[*got]->tcrvl = ft_headgets(header, "TCRVL",
- i+1, NULL, &card1);
- fun->cols[*got]->tcdlt = ft_headgets(header, "TCDLT",
- i+1, NULL, &card1);
- fun->cols[*got]->tcrpx = ft_headgets(header, "TCRPX",
- i+1, NULL, &card1);
- fun->cols[*got]->tcrot = ft_headgets(header, "TCROT",
- i+1, NULL, &card1);
- fun->cols[*got]->tunit = ft_headgets(header, "TUNIT",
- i+1, NULL, &card1);
- fun->cols[*got]->vla = xstrdup(header->table->col[i].vla);
- /* now that we have the type, calculate offset, width, etc. */
- fsize = ft_sizeof(fun->cols[*got]->type);
- /* pad for alignment, if necessary */
- if( dopad ){
- pad = (fsize - (*size % fsize));
- if( pad != fsize ) *size += pad;
- }
- fun->cols[*got]->offset = *size;
- fun->cols[*got]->width = fsize * fun->cols[*got]->n;
- /* size of bitfield adjusted specially */
- if( fun->cols[*got]->type == 'X' )
- fun->cols[*got]->width = (fun->cols[*got]->width + 7) / 8;
- *size += fun->cols[*got]->width;
- /* make column active */
- fun->cols[*got]->mode |= COL_ACTIVE;
- *got += 1;
- }
- /* add special columns, if necessary */
- _FunColumnAddRegion(fun, dopad, "rw", got, size);
- _FunColumnAddNum(fun, dopad, "rw", got, size);
- return *got;
-}
-
-/*
- *
- * _FunColumnSelect -- primitive to add columns to the selected column list
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunColumnSelect(Fun fun, size_t size, char *mode, char **names, char **types,
- char **modes, int *offsets, int nargs)
-#else
-static int
-_FunColumnSelect(fun, size, mode, names, types, modes, offsets, nargs)
- Fun fun;
- size_t size;
- char *mode;
- char **names;
- char **types;
- char **modes;
- int *offsets;
- int nargs;
-#endif
-{
- int i;
- int got;
- int flag;
- int type;
- int ptype;
- int poff;
- int n;
- int narg;
- int offset;
- int dopad;
- int doselect;
- int doref;
- int idx;
- int dims;
- int scaled;
- size_t pad;
- size_t tsize;
- char *mbuf;
- char name[SZ_LINE];
- char tbuf[SZ_LINE];
- char *s, *t, *m;
- char *activate=NULL;
- double tlmin;
- double tlmax;
- double binsiz;
- double tscale;
- double tzero;
- FITSHead header;
-
- /* make sure we have something */
- if( !_FunValid(fun) )
- return 0;
-
- /* make sure we have something like a table */
- if( fun->header && fun->header->table ){
- header = fun->header;
- activate = NULL;
- }
- /* if not, we can use the input fun handle's table */
- else if( fun->ifun && fun->ifun->header && fun->ifun->header->table ){
- header = fun->ifun->header;
- activate = fun->ifun->activate;
- }
- /* else die */
- else{
- header = NULL;
- activate = NULL;
- }
-
- /* this extension must be a table */
- fun->type = FUN_TABLE;
- /* reset the io flag, since we are presumably preparing a new table */
- fun->io = 0;
- /* assume array of structs */
- fun->org = FUN_ORG_AOS;
- /* init flag */
- flag = 0;
-
- /* process mode string */
- doselect = 0;
- doref = 0;
- mbuf = xstrdup(mode);
- if( _FunKeyword(mbuf, "pad", NULL, tbuf, SZ_LINE) )
- dopad = istrue(tbuf);
- else
- dopad = 1;
- if( _FunKeyword(mbuf, "copy", NULL, tbuf, SZ_LINE) ){
- doselect = !strcasecmp(tbuf, "select") && (fun->ifun && fun->ifun->ncol);
- doref = !strcasecmp(tbuf, "reference");
- }
- if( _FunKeyword(mbuf, "org", NULL, tbuf, SZ_LINE) ){
- if( !strcasecmp(tbuf, "soa") || !strcasecmp(tbuf, "structofarrays") )
- fun->org = FUN_ORG_SOA;
- else if( !strcasecmp(tbuf, "aos") || !strcasecmp(tbuf, "arrayofstructs") )
- fun->org = FUN_ORG_AOS;
- }
- if( mbuf ) xfree(mbuf);
-
- /* process the argument list */
- tsize = 0;
- for(narg=0, got=fun->ncol; (narg<nargs) && (got<FUN_MAXCOL); narg++){
- /* we got info from the routine call, not from the FITS file */
- flag = 1;
- /* get name, type, and mode, and make sure they are valid */
- s = names[narg];
- t = types[narg];
- m = modes[narg];
- if( !s || !*s || !t || !*t || !m || !*m )
- continue;
- offset = offsets[narg];
- _FunGetAlias(fun, s, name);
- _FunColumnType(t, &type, &n, &tlmin, &tlmax, &binsiz, &dims,
- &tscale, &tzero, &scaled, &ptype, &poff);
- /* allocate a new column struct */
- if( !(fun->cols[got] = (FunCol)xcalloc(1, sizeof(FunColRec))) ){
- gerror(stderr, "can't allocate FunCol struct\n");
- return 0;
- }
- /* if we have a header, look for the specified column */
- if( header ){
- for(i=0; i<header->table->tfields; i++){
- if( !header->table->col[i].name ) continue;
- if( !strcasecmp(header->table->col[i].name, name) ){
- fun->cols[got]->tcol = i;
- fun->cols[got]->name = xstrdup(header->table->col[i].name);
- break;
- }
- }
- }
- /* if we did not find the name in the header, maybe its "$region" */
- if( !fun->cols[got]->name && !strcasecmp(name, COL_REGION_NAME) ){
- fun->cols[got]->tcol = COL_REGION_ID;
- fun->cols[got]->name = xstrdup(COL_REGION_NAME);
- }
- if( !fun->cols[got]->name && !strcasecmp(name, COL_NUM_NAME) ){
- fun->cols[got]->tcol = COL_NUM_ID;
- fun->cols[got]->name = xstrdup(COL_NUM_NAME);
- }
- /* for reading, make sure we found it */
- if( !fun->cols[got]->name ){
- if( strchr(m, 'w') ){
- fun->cols[got]->tcol = COL_UNKNOWN_ID;
- fun->cols[got]->name = xstrdup(name);
- }
- else{
- gerror(stderr,
- "selected column '%s' does not exist in table\n", name);
- return 0;
- }
-
- }
- /* fill in the remaining info */
- fun->cols[got]->type = type;
- fun->cols[got]->from = -1;
- fun->cols[got]->mode = mparse(m);
- fun->cols[got]->mode |= COL_ACTIVE;
- fun->cols[got]->mode |= ptype;
- if( poff >= 0 )
- /* offset is in units of data type */
- fun->cols[got]->poff = poff*ft_sizeof(fun->cols[got]->type);
- else
- /* negative means its a byte offset */
- fun->cols[got]->poff = -poff;
- fun->cols[got]->n = n;
- fun->cols[got]->offset = offset;
- fun->cols[got]->tlmin = tlmin;
- fun->cols[got]->tlmax = tlmax;
- fun->cols[got]->binsiz = binsiz;
- fun->cols[got]->tscale = tscale;
- fun->cols[got]->tzero = tzero;
- fun->cols[got]->scaled = scaled;
- fun->cols[got]->width = fun->cols[got]->n*ft_sizeof(fun->cols[got]->type);
- /* size of bitfield adjusted specially */
- if( fun->cols[got]->type == 'X' )
- fun->cols[got]->width = (fun->cols[got]->width + 7) / 8;
- if( fun->cols[got]->mode & COL_PTR )
- tsize += sizeof(char *);
- else
- tsize += fun->cols[got]->width;
- /* if we are merging, we may have to set the mode on an original column */
- switch( fun->merge ){
- case MERGE_UPDATE:
- /* for update, we change the value of the original column -- that is,
- if this is a writable column itself */
- if( fun->cols[got]->mode & COL_WRITE ){
- if( (idx = FunColumnLookup(fun, fun->cols[got]->name, 0, NULL,
- NULL, NULL, NULL, NULL, NULL)) ){
- idx--;
- /* we don't write the updating column */
- fun->cols[got]->mode &= ~COL_WRITE;
- /* instead we write the updated column with the updating info */
- fun->cols[idx]->from = got;
- }
- }
- break;
- case MERGE_REPLACE:
- /* for replace, we don't write the original column -- that is,
- if this is a writable column itself */
- if( fun->cols[got]->mode & COL_WRITE ){
- if( (idx = FunColumnLookup(fun, fun->cols[got]->name, 0, NULL,
- NULL, NULL, NULL, NULL, NULL)) ){
- idx--;
- fun->cols[idx]->mode |= COL_REPLACEME;
- /* if the replacing column has no tlmin,tlmax, but the replaced
- column does, we use the replaced column's values */
- if( !fun->cols[got]->tlmin && !fun->cols[got]->tlmax ){
- if( fun->cols[idx]->tlmin || fun->cols[idx]->tlmax ){
- fun->cols[got]->tlmin = fun->cols[idx]->tlmin;
- fun->cols[got]->tlmax = fun->cols[idx]->tlmax;
- fun->cols[got]->binsiz = fun->cols[idx]->binsiz;
- }
- }
-
- }
- }
- break;
- case MERGE_APPEND:
- /* for append, only write user columns if they are new */
- if( (idx = FunColumnLookup(fun, fun->cols[got]->name, 0, NULL,
- NULL, NULL, NULL, NULL, NULL)) ){
- fun->cols[got]->mode &= ~COL_WRITE;
- }
- break;
- }
- got++;
- }
-
- /* if select, and no args, use the defaults from the FITS table itself or
- from selected input columns */
- if( !got ){
- /* copy selected columns from input struct */
- if( doselect ){
- /* flag input from columns */
- flag = 1;
- /* copy column records */
- memcpy(fun->cols, fun->ifun->cols, fun->ifun->ncol*sizeof(FunCol));
- for(got=0; got<fun->ifun->ncol; got++){
- if( !(fun->cols[got] = (FunCol)xcalloc(1, sizeof(FunColRec))) ){
- gerror(stderr, "can't allocate FunCol struct\n");
- return 0;
- }
- memcpy(fun->cols[got], fun->ifun->cols[got], sizeof(FunColRec));
- fun->cols[got]->name = xstrdup(fun->ifun->cols[got]->name);
- fun->cols[got]->tctyp = xstrdup(fun->ifun->cols[got]->tctyp);
- fun->cols[got]->tcrvl = xstrdup(fun->ifun->cols[got]->tcrvl);
- fun->cols[got]->tcdlt = xstrdup(fun->ifun->cols[got]->tcdlt);
- fun->cols[got]->tcrpx = xstrdup(fun->ifun->cols[got]->tcrpx);
- fun->cols[got]->tcrot = xstrdup(fun->ifun->cols[got]->tcrot);
- fun->cols[got]->tunit = xstrdup(fun->ifun->cols[got]->tunit);
- fun->cols[got]->vla = xstrdup(fun->ifun->cols[got]->vla);
- }
- size = fun->ifun->rowsize;
- /* copy activation string */
- fun->activate = xstrdup(fun->ifun->activate);
- }
- /* copy all of the columns from the reference file */
- else if( doref ){
- if( header ){
- /* flag that we got info from FITS file, not from the routine call */
- flag = 0;
- /* add columns from table */
- if( !_FunColumnAddTable(fun, header, "rw", dopad, &got, &tsize) )
- return 0;
- /* if we are copying raw columns from a reference file,
- we have to call the reference activate routine */
- if( activate ) FunColumnActivate(fun, activate, NULL);
- }
- else{
- gerror(stderr, "no reference header passed to FunColumnSelect()\n");
- return 0;
- }
- }
- }
-
- /* this is how many specified columns we have */
- fun->ncol = got;
-
- /* if we had input, we have to accept the size */
- if( flag )
- fun->rowsize = size;
- else{
- /* make sure we are padded properly */
- if( dopad ){
- pad = sizeof(double) - (tsize % sizeof(double));
- if( pad != sizeof(double) )
- tsize += pad;
- }
- fun->rowsize = tsize;
- }
- if( fun->rowsize < 0 ){
- gerror(stderr, "invalid event record size in FunColumnSelect (%d)\n",
- fun->rowsize);
- return 0;
- }
-
- /* return the number of selected columns */
- return fun->ncol;
-}
-
-/*
- *
- * semi-public routines
- *
- */
-
-/*
- *
- * _FunColumnHeader -- generate a fitsy header from the col array
- *
- */
-#ifdef ANSI_FUNC
-void
-_FunColumnHeader(Fun fun, FunCol *cols, int ncol)
-#else
-void _FunColumnHeader(fun, cols, ncol)
- Fun fun;
- FunCol *cols;
- int ncol;
-#endif
-{
- int i, j, k;
- int width;
- int acol;
-
- char tbuf[SZ_LINE];
- char *extname="EVENTS";
- int extver = 1;
- FITSHead old, merge;
- FITSCard card;
-
- /* make sure we have something to work with */
- if( !_FunValid(fun) )
- return;
-
- /* create a fitsy header, if necessary */
- if( !fun->header ){
- if( (fun->header = ft_headinit(NULL, 0)) == NULL )
- return;
- }
-
- /* get width of each row */
- for(acol=0, width=0, i=0; i<ncol; i++){
- if( (cols[i]->mode & COL_ACTIVE) &&
- (cols[i]->mode & COL_WRITE) &&
- !(cols[i]->mode & COL_REPLACEME) ){
- width += cols[i]->width;
- acol++;
- }
- }
-
- /* if there is an input table, look for a name */
- if( fun->ifun && fun->ifun->header && fun->ifun->header->basic ){
- if( ft_name(fun->ifun->header) && *ft_name(fun->ifun->header) )
- extname = ft_name(fun->ifun->header);
- extver = MAX(1, ft_extn(fun->ifun->header));
- }
-
- /* fill in the header to this binary table */
- ft_headsets(fun->header, "XTENSION", 0, "BINTABLE", "FITS BINARY TABLE", 1);
- ft_headseti(fun->header, "BITPIX", 0, 8, "Binary data", 1);
- ft_headseti(fun->header, "NAXIS", 0, 2, "Table is a matrix", 1);
- ft_headseti(fun->header, "NAXIS", 1, width, "Width of table in bytes", 1);
- ft_headseti(fun->header, "NAXIS", 2, -1, "Number of entries in table", 1);
- ft_headseti(fun->header, "PCOUNT", 0, 0, "Random parameter count", 1);
- ft_headseti(fun->header, "GCOUNT", 0, 1, "Group count", 1);
- ft_headseti(fun->header, "TFIELDS", 0, acol, "Number of fields in row", 1);
- if( !ft_headfind(fun->header, "EXTNAME", 0, 0) )
- ft_headsets(fun->header, "EXTNAME", 0, extname, "Ext. name", 1);
- if( !ft_headfind(fun->header, "EXTVER", 0, 0) )
- ft_headseti(fun->header, "EXTVER", 0, extver, "Ext. version", 1);
-
-
- /* now add the info for each active column */
- for(i=0, j=1; i<ncol; i++){
- if( !(cols[i]->mode & COL_ACTIVE) ||
- !(cols[i]->mode & COL_WRITE) ||
- (cols[i]->mode & COL_REPLACEME) )
- continue;
- if( cols[i]->vla ){
- ft_headsets(fun->header, "TFORM", j, cols[i]->vla,
- "Data type for field", 1);
- }
- else{
- snprintf(tbuf, SZ_LINE-1, "%d%c", cols[i]->n, toupper(cols[i]->type));
- ft_headsets(fun->header, "TFORM", j, tbuf, "Data type for field", 1);
- }
- /* name of column */
- if( fun->cols[i]->name ){
- /* we change "$region" to "region" */
- if( !strcasecmp(cols[i]->name, COL_REGION_NAME) ){
- /* best to use "region", if its not already used */
- if( !FunColumnLookup(fun, COL_REGION_ONAME, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) )
- ft_headsets(fun->header,
- "TTYPE", j, COL_REGION_ONAME, "Label for field", 1);
- /* otherwise use region[n], using the first free value for n */
- else{
- for(k=1; ; k++){
- snprintf(tbuf, SZ_LINE-1, "%s%d", COL_REGION_ONAME, k);
- if( !FunColumnLookup(fun, tbuf, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- ft_headsets(fun->header, "TTYPE", j, tbuf, "Label for field", 1);
- break;
- }
- }
- }
- }
- /* might have to change "$n" to something else */
- else if( !strcasecmp(cols[i]->name, COL_NUM_NAME) ){
- /* best to use "n", if its not already used */
- if( !FunColumnLookup(fun, COL_NUM_ONAME, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) )
- ft_headsets(fun->header,
- "TTYPE", j, COL_NUM_ONAME, "Label for field", 1);
- /* otherwise use n[n], using the first free value for n */
- else{
- for(k=1; ; k++){
- snprintf(tbuf, SZ_LINE-1, "%s%d", COL_NUM_ONAME, k);
- if( !FunColumnLookup(fun, tbuf, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- ft_headsets(fun->header, "TTYPE", j, tbuf, "Label for field", 1);
- break;
- }
- }
- }
- }
- /* not a special name, just use as is */
- else{
- ft_headsets(fun->header,
- "TTYPE", j, cols[i]->name, "Label for field", 1);
- }
- }
- /* write out tlmin/tlmax values if either is set */
- if( cols[i]->tlmin || cols[i]->tlmax ){
- /* match data type of number to data type of column */
- switch(cols[i]->type){
- case 'D':
- case 'E':
- if( !ft_headfind(fun->header, "TLMIN", j, 0) )
- ft_headsetr(fun->header, "TLMIN", j, cols[i]->tlmin, 7,
- "Min. axis value", 1);
- if( !ft_headfind(fun->header, "TLMAX", j, 0) )
- ft_headsetr(fun->header, "TLMAX", j, cols[i]->tlmax, 7,
- "Max. axis value", 1);
- if( cols[i]->binsiz != 0.0 ){
- if( !ft_headfind(fun->header, "TDBIN", j, 0) )
- ft_headsetr(fun->header, "TDBIN", j, cols[i]->binsiz, 7,
- "Binsize", 1);
- }
- break;
- default:
- if( !ft_headfind(fun->header, "TLMIN", j, 0) )
- ft_headseti(fun->header, "TLMIN", j, (int)cols[i]->tlmin,
- "Min. axis value", 1);
- if( !ft_headfind(fun->header, "TLMAX", j, 0) )
- ft_headseti(fun->header, "TLMAX", j, (int)cols[i]->tlmax,
- "Max. axis value", 1);
- if( cols[i]->binsiz != 0.0 ){
- if( !ft_headfind(fun->header, "TDBIN", j, 0) )
- ft_headsetr(fun->header, "TDBIN", j, cols[i]->binsiz, 7,
- "Binsize", 1);
- }
- break;
- }
- }
- /* add wcs info */
- if( cols[i]->tctyp && !ft_headfind(fun->header, "TCTYP", j, 0))
- ft_headsets(fun->header,
- "TCTYP", j, cols[i]->tctyp, "axis type (e.g. RA---TAN)", 1);
- if( cols[i]->tcrvl && !ft_headfind(fun->header, "TCRVL", j, 0))
- ft_headappv(fun->header,
- "TCRVL", j, cols[i]->tcrvl, "sky coord (deg.)");
- if( cols[i]->tcdlt && !ft_headfind(fun->header, "TCDLT", j, 0))
- ft_headappv(fun->header,
- "TCDLT", j, cols[i]->tcdlt, "degrees per pixel");
- if( cols[i]->tcrpx && !ft_headfind(fun->header, "TCRPX", j, 0))
- ft_headappv(fun->header,
- "TCRPX", j, cols[i]->tcrpx, "pixel of tangent plane direc.");
- if( cols[i]->tcrot && !ft_headfind(fun->header, "TCROT", j, 0))
- ft_headappv(fun->header,
- "TCROT", j, cols[i]->tcrot, "rotation angle (degrees)");
- if( cols[i]->tunit && !ft_headfind(fun->header, "TUNIT", j, 0))
- ft_headsets(fun->header,
- "TUNIT", j, cols[i]->tunit, "axis units", 1);
- if( cols[i]->tblank && !ft_headfind(fun->header, "TNULL", j, 0))
- ft_headsetr(fun->header, "TNULL", j, (double)cols[i]->tblank, 7,
- "undefined value", 1);
- if( cols[i]->scaled & FUN_SCALE_APPLIED ){
- if( ft_headfind(fun->header, "TZERO", j, 0) )
- ft_headdel(fun->header, "TZERO", j);
- if( ft_headfind(fun->header, "TSCAL", j, 0) )
- ft_headdel(fun->header, "TSCAL", j);
- }
- else if( cols[i]->scaled & FUN_SCALE_EXISTS ){
- ft_headsetr(fun->header, "TZERO", j, cols[i]->tzero, 7,
- "phys_val = tzero + tscale * field_val", 1);
- ft_headsetr(fun->header, "TSCAL", j, cols[i]->tscale, 7,
- "phys_val = tzero + tscale * field_val", 1);
- }
- j++;
- }
-
- /* now turn this into a table header */
- ft_syncdata(fun->header);
-
- /* merge in params from original header, if they exist */
- if( fun->ifun && fun->ifun->header && fun->ifun->header->table ){
- old = ft_headcopy(fun->ifun->header);
- i = ft_headgeti(old, "TFIELDS", 0, 0, &card);
- _FunCopyBinDelete(old, i);
- /* merge, but don't overwrite new with old */
- merge = ft_headmerge(fun->header, old, 0);
- ft_headfree(old, 1);
- ft_headfree(fun->header, 1);
- fun->header = merge;
- ft_syncdata(fun->header);
- }
-
- /* merge in user-specified params with overwrite */
- merge = ft_headmerge(fun->header, fun->theader, 1);
- ft_headfree(fun->theader, 1);
- fun->theader = NULL;
- ft_headfree(fun->header, 1);
- fun->header = merge;
- ft_syncdata(fun->header);
-}
-
-/*
- *
- * _FunColumnReplace -- replace values from one set of columns into another
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunColumnReplace(Fun fund, char *d, Fun funs, char *s,
- int convert, int direction, int n)
-#else
-int _FunColumnReplace(fund, d, funs, s, convert, direction, n)
- Fun fund;
- char *d;
- Fun funs;
- char *s;
- int convert;
- int direction;
- int n;
-#endif
-{
- int i, j;
- int got = 0;
- char *ss, *dd;
-
- n = MAX(1,n);
- while( n-- ){
- for(i=0; i<funs->ncol; i++){
- for(j=0; j<fund->ncol; j++){
- if( !strcasecmp(funs->cols[i]->name, fund->cols[j]->name) ){
- /* determine addresses for pointers or offsets */
- if( !(funs->cols[i]->mode & COL_PTR) )
- ss = s+funs->cols[i]->offset;
- else
- ss = *((char **)(((char *)s)+funs->cols[i]->offset));
- ss += funs->cols[i]->poff;
- if( !(fund->cols[j]->mode & COL_PTR) )
- dd = d+fund->cols[j]->offset;
- else
- dd = *((char **)(((char *)d)+fund->cols[j]->offset));
- dd += fund->cols[i]->poff;
- /* convert dest to source type and replace */
- ft_acht2(fund->cols[j]->offset, dd, funs->cols[i]->offset, ss,
- MIN(funs->cols[i]->n,fund->cols[j]->n),
- convert, direction);
- got++;
- break;
- }
- }
- }
- s += funs->rowsize;
- d += fund->rowsize;
- }
- return got;
-}
-
-#ifdef ANSI_FUNC
-void
-_FunColumnFree(Fun fun)
-#else
-void _FunColumnFree(fun)
- Fun fun;
-#endif
-{
- int i;
-
- if( !_FunValid(fun) )
- return;
- if( fun->cols ){
- for(i=0; i<fun->ncol; i++){
- if( fun->cols[i] ){
- if( fun->cols[i]->name ) xfree(fun->cols[i]->name);
- if( fun->cols[i]->tctyp ) xfree(fun->cols[i]->tctyp);
- if( fun->cols[i]->tcrvl ) xfree(fun->cols[i]->tcrvl);
- if( fun->cols[i]->tcdlt ) xfree(fun->cols[i]->tcdlt);
- if( fun->cols[i]->tcrpx ) xfree(fun->cols[i]->tcrpx);
- if( fun->cols[i]->tcrot ) xfree(fun->cols[i]->tcrot);
- if( fun->cols[i]->tunit ) xfree(fun->cols[i]->tunit);
- if( fun->cols[i]->vla ) xfree(fun->cols[i]->vla);
- xfree(fun->cols[i]);
- }
- }
- xfree(fun->cols);
- fun->cols = NULL;
- }
- fun->ncol = 0;
- fun->rowsize = 0;
- fun->merge = 0;
-}
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *
- * FunColumnActivate -- activate/de-activate a list of columns
- *
- */
-#ifdef ANSI_FUNC
-void
-FunColumnActivate(Fun fun, char *s, char *mode)
-#else
-void FunColumnActivate(fun, s, mode)
- Fun fun;
- char *s;
- char *mode;
-#endif
-{
- int i, j;
- int xmode;
- int dosort;
- int matches;
- int ip=0;
- int ncol=0;
- int imodes=0;
- int emodes=0;
- int amode=0;
- int modes[FUN_MAXCOL];
- char *names[FUN_MAXCOL];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char *t;
- char *mbuf;
-
- /* sanity check */
- if( !fun ) return;
-
- /* if no columns on the commmand line ... */
- if( !s ){
- /* check for existence of previously specified view cols */
- if( fun->vcols ){
- s = fun->vcols;
- }
- /* or look for environment variable */
- else{
- s = getenv("FUN_COLUMNS");
- }
- }
-
- /* sanity check */
- if( !s || !*s ) return;
-
- /* process mode string */
- mbuf = xstrdup(mode);
- if( _FunKeyword(mbuf, "sort", NULL, tbuf, SZ_LINE) )
- dosort = istrue(tbuf);
- else
- dosort = -1;
- if( _FunKeyword(mbuf, "mode", NULL, tbuf, SZ_LINE) )
- amode = mparse(tbuf);
- if( mbuf ) xfree(mbuf);
-
- /* parse entries and create a list of names/modes */
- while( word(s, tbuf, &ip) ){
- if( _FunKeyword(tbuf, "sort", NULL, tbuf2, SZ_LINE) ){
- dosort = istrue(tbuf2);
- continue;
- }
- /* convert to upper case */
- t = tbuf;
- /* set activate mode and get name without prefix */
- if( *tbuf == '-' ){
- t++;
- xmode = 0;
- }
- else if( *tbuf == '+' ){
- t++;
- xmode = 1;
- }
- else
- xmode = 1;
- if( xmode )
- imodes++;
- else
- emodes++;
- /* look up aliases for this name */
- _FunGetAlias(fun, t, tbuf2);
- /* save this entry */
- names[ncol] = xstrdup(tbuf2);
- modes[ncol] = xmode;
- ncol++;
- }
-
- /* loop through the (possible) list */
- for(; fun != NULL; fun=fun->next){
- if( !_FunValid(fun) )
- return;
-
- /* if we delayed the open for reading before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* if we have no columns yet, try to get some from the assoc. input file */
- if( !fun->ncol ){
- /* if we have a header to copy from, that is */
- if( fun->ifun && fun->ifun->header && fun->ifun->header->table ){
- FunColumnSelect(fun, 0, "copy=select", NULL);
- /* grab the copied merge value as well */
- fun->merge = fun->ifun->merge;
- }
- /* else we lose */
- else
- return;
- }
-
- /* save activation string */
- if( fun->activate ) xfree(fun->activate );
- fun->activate = xstrdup(s);
-
- /* handle the case of setting the mode specially */
- if( amode ) goto doamode;
-
- /* if we have excludes, activate all to start with */
- if( emodes && !imodes ){
- for(i=0; i<fun->ncol; i++){
- if( !fun->cols[i]->name ) continue;
- /* all except the special columns, that is! */
- if( strcasecmp(fun->cols[i]->name, COL_REGION_NAME) &&
- strcasecmp(fun->cols[i]->name, COL_NUM_NAME) )
- fun->cols[i]->mode |= COL_ACTIVE;
- }
- }
- /* otherwise, we de-activate all to start with */
- else if( imodes ){
- if( dosort < 0 )
- dosort = 1;
- for(i=0; i<fun->ncol; i++){
- fun->cols[i]->mode &= ~COL_ACTIVE;
- fun->cols[i]->order = 0;
- }
- }
-
- /* process entries */
- for(j=0; j<ncol; j++){
- /* "+" means activate all, "-" means de-activate all,
- (nb: we removed the +/i earlier, leaving no name) */
- if( !*names[j] ){
- for(i=0; i<fun->ncol; i++){
- if( modes[j] ){
- if( !fun->cols[i]->name ) continue;
- /* all except the special columns, that is! */
- if( strcasecmp(fun->cols[i]->name, COL_REGION_NAME) &&
- strcasecmp(fun->cols[i]->name, COL_NUM_NAME) )
- fun->cols[i]->mode |= COL_ACTIVE;
- }
- else{
- fun->cols[i]->mode &= ~COL_ACTIVE;
- fun->cols[i]->order = 0;
- }
- }
- continue;
- }
- /* look for corresponding selected column and set status */
- for(matches=0, i=0; i<fun->ncol; i++){
- if( !fun->cols[i]->name ) continue;
- if( !strcasecmp(fun->cols[i]->name, names[j]) ||
- tmatch(fun->cols[i]->name, names[j]) ){
- matches++;
- if( modes[j] ){
- fun->cols[i]->mode |= COL_ACTIVE;
- if( dosort == 1 )
- fun->cols[i]->order = ncol-j;
- }
- else{
- fun->cols[i]->mode &= ~COL_ACTIVE;
- }
- }
- }
- /* can't activate a non-existent column, but ok to de-activate one */
- if( !matches && modes[j] ){
- gerror(stderr, "no column named '%s' in table\n", names[j]);
- return;
- }
- }
-
- /* re-sort, if necessary */
- if( dosort == 1 ){
- /* save current indexes to adjust the 'from' value after sorting */
- for(i=0; i<fun->ncol; i++)
- fun->cols[i]->ofrom = i;
- /* sort the column records */
- qsort(fun->cols, fun->ncol, sizeof(FunCol), _FunColCmp);
- /* fix up the 'from' indices to reflect the new indexes */
- for(i=0; i<fun->ncol; i++){
- /* if 'from' is not 'self' ... */
- if( fun->cols[i]->from >=0 ){
- /* look through al columns ... */
- for(j=0; j<fun->ncol; j++){
- /* ... for the original index */
- if( fun->cols[i]->from == fun->cols[j]->ofrom ){
- /* reset the 'from' value to the new index of this column */
- fun->cols[i]->from = j;
- break;
- }
- }
- }
- }
- }
- continue;
-
-/* special code to activate and change access mode */
-doamode:
- for(j=0; j<ncol; j++){
- /* "+" means activate all, "-" means de-activate all,
- (nb: we removed the +/i earlier, leaving no name) */
- if( *names[j] ){
- /* look for corresponding selected column and set status */
- for(matches=0, i=0; i<fun->ncol; i++){
- if( !fun->cols[i]->name ) continue;
- if( !strcasecmp(fun->cols[i]->name, names[j]) ||
- tmatch(fun->cols[i]->name, names[j]) ){
- /* set the new mode */
- fun->cols[i]->mode = amode;
- if( modes[j] ){
- fun->cols[i]->mode |= COL_ACTIVE;
- }
- else{
- fun->cols[i]->mode &= ~COL_ACTIVE;
- }
- }
- }
- }
- }
- continue;
- }
-
- /* clean up */
- for(j=0; j<ncol; j++){
- /* done with this one */
- if( names[j] ) xfree(names[j]);
- }
-}
-
-/*
- *
- * FunColumnSelectArr -- non-varargs add columns to the selected column list
- *
- */
-#ifdef ANSI_FUNC
-int
-FunColumnSelectArr(Fun fun, size_t size, char *mode,
- char **names, char **types,
- char **modes, int *offsets, int nargs)
-#else
-int FunColumnSelectArr(fun, size, mode, names, types, modes, offsets, nargs)
- Fun fun;
- size_t size;
- char *mode;
- char **names;
- char **types;
- char **modes;
- int *offsets;
- int nargs;
-#endif
-{
- int got, goterr;
- int domerge;
- size_t tsize;
- char *mbuf;
- char *activate;
- char tbuf[SZ_LINE];
- FITSHead header;
-
- /* start out with no error */
- goterr = 0;
-
- /* how many args have we got? */
- got = nargs;
-
- /* look at keywords */
- mbuf = xstrdup(mode);
- if( _FunKeyword(mbuf, "merge", NULL, tbuf, SZ_LINE) ){
- if( !strncasecmp(tbuf, "replace", 7) )
- domerge = MERGE_REPLACE;
- else if( !strncasecmp(tbuf, "append", 6) )
- domerge = MERGE_APPEND;
- else if( !strncasecmp(tbuf, "update", 6) )
- domerge = MERGE_UPDATE;
- else if( istrue(tbuf) )
- domerge = MERGE_UPDATE;
- else
- domerge = 0;
- }
- else
- domerge = 0;
- if( mbuf ) xfree(mbuf);
-
- /* loop through the (possible) list */
- for(; fun != NULL; fun=fun->next){
- /* make sure we have something */
- if( !_FunValid(fun) ){
- goterr = 1;
- goto done;
- }
-
- /* if we delayed the open for reading before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* free previous -- this is a new start */
- _FunColumnFree(fun);
- /* allocate space for these new columns */
- if( !(fun->cols = (FunCol *)xcalloc(FUN_MAXCOL, sizeof(FunCol))) ){
- gerror(stderr, "can't allocate FunCol array\n");
- goterr = 1;
- goto done;
- }
-
- /* if merging, we need to set up the raw input columns for writing */
- if( (fun->merge=domerge) != 0 ){
- if( fun->header && fun->header->table ){
- header = fun->header;
- activate = NULL;
- }
- /* if not, we can use the input fun handle's table */
- else if( fun->ifun && fun->ifun->header && fun->ifun->header->table ){
- header = fun->ifun->header;
- activate = fun->ifun->activate;
- }
- /* else die */
- else{
- goterr = 1;
- goto done;
- }
- /* set flag for writing, also flag this as input data, not user data */
- tsize=0;
- if( !_FunColumnAddTable(fun, header, "iw", 0, &(fun->ncol), &tsize) ){
- goterr = 1;
- goto done;
- }
- /* if we are copying raw columns from a reference file,
- we have to call the reference activate routine */
- if( activate ) FunColumnActivate(fun, activate, NULL);
- }
-
- /* we can't have no columns and no mode */
- if( !got && !mode ){
- gerror(stderr, "FunColumnSelect requires valid column(s) or mode\n");
- goterr = 1;
- goto done;
- }
-
- /* add columns (or add default columns if none were specified) */
- _FunColumnSelect(fun, size, mode, names, types, modes, offsets, got);
- }
-
-done:
- /* return the news */
- if( goterr )
- got = 0;
- return got;
-}
-
-/*
- *
- * FunColumnSelect -- select columns for extraction
- *
- */
-#ifdef __STDC__
-int FunColumnSelect(Fun fun, size_t size, char *mode, ...)
-{
- int i;
- int got, got2;
- char *s;
- char *names[FUN_MAXCOL];
- char *types[FUN_MAXCOL];
- char *modes[FUN_MAXCOL];
- int offsets[FUN_MAXCOL];
- va_list args;
- va_start(args, mode);
-#else
-int FunColumnSelect(va_alist) va_dcl
-{
- Fun fun;
- size_t size;
- int i;
- int got, got2;
- char *s;
- char *mode;
- char *names[FUN_MAXCOL];
- char *types[FUN_MAXCOL];
- char *modes[FUN_MAXCOL];
- int offsets[FUN_MAXCOL];
- va_list args;
- va_start(args);
- fun = va_arg(args, Fun);
- size = va_arg(args, size_t);
- mode = va_arg(args, char *);
-#endif
-
- /* collect variable arguments */
- for(got=0; (s=va_arg(args, char *)) && *s && (got<FUN_MAXCOL); got++ ){
- names[got] = xstrdup(s);
- s = va_arg(args, char *);
- types[got] = xstrdup(s);
- s = va_arg(args, char *);
- modes[got] = xstrdup(s);
- offsets[got] = va_arg(args, int);
- }
-
- /* call non-varargs version */
- got2=FunColumnSelectArr(fun, size, mode, names, types, modes, offsets, got);
-
- /* clean up */
- for(i=0; i<got; i++){
- if( names[i] ) xfree(names[i]);
- if( types[i] ) xfree(types[i]);
- if( modes[i] ) xfree(modes[i]);
- }
-
- /* return the news */
- return got2;
-}
-
-#ifdef ANSI_FUNC
-int
-FunColumnLookup(Fun fun, char *s, int which, char **name,
- int *type, int *mode, int *offset, int *n, int *width)
-#else
-int FunColumnLookup(fun, s, which, name, type, mode, offset, n, width)
- Fun fun;
- char *s;
- int which;
- char **name;
- int *type;
- int *mode;
- int *offset;
- int *n;
- int *width;
-#endif
-{
- int i;
- int got = 0;
-
- /* make sure we have something */
- if( !_FunValid(fun) )
- return 0;
-
- /* if we delayed the open for reading before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* if we were passed a string, use that as the name for the lookup */
- if( s ){
- for(i=0; i<fun->ncol; i++){
- if( !fun->cols[i]->name ) continue;
- if( !strcasecmp(s, fun->cols[i]->name) ){
- got = i+1;
- break;
- }
- }
- }
- /* otherwise, we got the zero-based index to lookup */
- else
- got = which+1;
-
- /* if we have something to look up, do it */
- if( got ){
- i = got - 1;
- if( name ) *name = fun->cols[i]->name;
- if( type ) *type = fun->cols[i]->type;
- if( mode ) *mode = fun->cols[i]->mode;
- if( offset ) *offset = fun->cols[i]->offset;
- if( n ) *n = fun->cols[i]->n;
- if( width ) *width = fun->cols[i]->width;
- }
- return got;
-}
-
-#ifdef ANSI_FUNC
-int
-FunColumnLookup2(Fun fun, char *s, int which, double *tlmin, double *tlmax,
- double *binsize, double *tscale, double *tzero)
-#else
-int FunColumnLookup2(fun, s, which, tlmin, tlmax, binsize, tscale, tzero)
- Fun fun;
- char *s;
- int which;
- double *tlmin;
- double *tlmax;
- double *binsize;
- double *tscale;
- double *tzero;
-#endif
-{
- int i;
- int got = 0;
-
- /* make sure we have something */
- if( !_FunValid(fun) )
- return 0;
-
- /* if we delayed the open for reading before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* if we were passed a string, use that as the name for the lookup */
- if( s ){
- for(i=0; i<fun->ncol; i++){
- if( !fun->cols[i]->name ) continue;
- if( !strcasecmp(s, fun->cols[i]->name) ){
- got = i+1;
- break;
- }
- }
- }
- /* otherwise, we got the zero-based index to lookup */
- else
- got = which+1;
-
- /* if we have something to look up, do it */
- if( got ){
- i = got - 1;
- if( tlmin ) *tlmin = fun->cols[i]->tlmin;
- if( tlmax ) *tlmax = fun->cols[i]->tlmax;
- if( binsize ) *binsize = fun->cols[i]->binsiz;
- if( tscale ) *tscale = fun->cols[i]->tscale;
- if( tzero ) *tzero = fun->cols[i]->tzero;
- }
- return got;
-}
-
diff --git a/funtools/funcone.c b/funtools/funcone.c
deleted file mode 100644
index e1610fe..0000000
--- a/funtools/funcone.c
+++ /dev/null
@@ -1,1473 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-/* code shamelessly ripped off from John Roll's search program in starbase
- (http://cfa-www.harvard.edu/~john/starbase/starbase.html) */
-
-#include <math.h>
-/* some experimental black magic in this code requires ... */
-#include <funtoolsP.h>
-#include <filter.h>
-#include <swap.h>
-#include <word.h>
-#include <xalloc.h>
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-
-extern char *optarg;
-extern int optind;
-
-#define RA_DEFAULT "RA:h"
-#define DEC_DEFAULT "DEC:d"
-
-#define RA_DEFAULT_UNITS "h"
-#define DEC_DEFAULT_UNITS "d"
-#define RAD_DEFAULT_UNITS "d"
-
-#define RA_NAME "RA_CEN"
-#define DEC_NAME "DEC_CEN"
-#define RAD_NAME "RAD_CEN"
-#define KEY_NAME "CONE_KEY"
-
-#define RA_FLAG 1
-#define DEC_FLAG 2
-#define RAD_FLAG 4
-#define ALL_FLAG (RA_FLAG|DEC_FLAG|RAD_FLAG)
-
-#define X__PI 3.14159265358979323846
-#define X_2PI ( 2 * X__PI )
-#define X_R2D (X_2PI / 360.0)
-#define X_R2H (X_2PI / 24.0)
-#define X_H2D (360.0 / 24.0)
-
-#define r2h(r) ( (r) / X_R2H )
-#define h2r(d) ( (d) * X_R2H )
-#define r2d(r) ( (r) / X_R2D )
-#define d2r(d) ( (d) * X_R2D )
-#define h2d(r) ( (r) * X_H2D )
-#define d2h(d) ( (d) / X_H2D )
-
-#define Abs(xx) (((xx) >= 0) ? (xx) : -(xx) )
-#define Max(x, y) (((x) > (y)) ? (x) : (y))
-
-#define MIN_COLS 6
-
-#define ALL_DATA 1
-#define ALL_LIST 2
-#define ALL_FILT 4
-#define ALL_ANY (ALL_DATA|ALL_LIST)
-
-typedef struct evstruct{
- double val0, val1, val2;
- double ra, dec, rad;
- int key;
- char *row;
-} *Ev, EvRec;
-
-typedef struct Value {
- char *colname;
- double val;
- double lo;
- double hi;
- int dtype;
- int offset;
- int n;
-} Value;
-
-typedef struct Csys {
- char type[3];
- Value value[3];
-} Csys;
-
-typedef struct List {
- Fun fun;
- Csys *csys;
- int nline;
- int litflag;
- char *lits[3];
- char *row;
- int rowsize;
- int ncol;
-} List;
-
-#ifdef ANSI_FUNC
-static void
-slaDcs2c(double a, double b, double v[3])
-#else
-static void slaDcs2c(a, b, v)
- double a;
- double b;
- double v[3];
-#endif
-{
- double cosb;
- cosb = cos ( b );
- v[0] = cos ( a ) * cosb;
- v[1] = sin ( a ) * cosb;
- v[2] = sin ( b );
-}
-
-#ifdef ANSI_FUNC
-static double
-slaDsep(double a1, double b1, double a2, double b2)
-#else
-static double slaDsep(a1, b1, a2, b2)
- double a1;
- double b1;
- double a2;
- double b2;
-#endif
-{
- int i;
- double d, v1[3], v2[3], s2, c2;
-
- slaDcs2c ( a1, b1, v1 );
- slaDcs2c ( a2, b2, v2 );
-
- s2 = 0.0;
- for ( i = 0; i < 3; i++ ) {
- d = v1[i] - v2[i];
- s2 += d * d;
- }
- s2 /= 4.0;
-
- c2 = 1.0 - s2;
- return 2.0 * atan2 ( sqrt ( s2 ), sqrt ( Max ( 0.0, c2 )));
-}
-
-#ifdef ANSI_FUNC
-static int
-ConeFilter(Csys *csys, double val0, double val1)
-#else
-static int ConeFilter(csys, val0, val1)
- Csys *csys;
- double val0;
- double val1;
-#endif
-{
- double r1=0.0, r2=0.0, d1=0.0, d2=0.0;
- double radius=0.0;
-
- switch( csys->type[0] ) {
- case 'h':
- r1 = h2r(csys->value[0].val);
- r2 = h2r(val0);
- break;
- case 'd':
- r1 = d2r(csys->value[0].val);
- r2 = d2r(val0);
- break;
- case 'r':
- r1 = csys->value[0].val;
- r2 = val0;
- break;
- }
- switch( csys->type[1] ) {
- case 'h':
- d1 = h2r(csys->value[1].val);
- d2 = h2r(val1);
- break;
- case 'd':
- d1 = d2r(csys->value[1].val);
- d2 = d2r(val1);
- break;
- case 'r':
- d1 = csys->value[1].val;
- d2 = val1;
- break;
- }
- switch( csys->type[2] ) {
- case 'h':
- radius = h2r(csys->value[2].val);
- break;
- case 'd':
- radius = d2r(csys->value[2].val);
- break;
- case 'r':
- radius = csys->value[2].val;
- break;
- case '\'':
- radius = d2r(csys->value[2].val/60.0);
- break;
- case '"':
- radius = d2r(csys->value[2].val/3600.0);
- break;
- }
-
- /* check angular separation */
- if ( slaDsep(r1, d1, r2, d2) <= radius )
- return 1;
- else
- return 0;
-}
-
-#ifdef ANSI_FUNC
-static void
-radecbox(double ra, double dec, double width,
- double *r1, double *r2, double *d1, double *d2)
-#else
-static void radecbox(ra, dec, width, r1, r2, d1, d2)
- double ra;
- double dec;
- double width;
- double *r1, *r2, *d1, *d2;
-#endif
-{
- double cosdec;
-
- *d1 = dec - width / 2.0;
- if ( *d1 <= -90.0 ) {
- *d1 = -90.0;
- *d2 = dec + width / 2.0;
- *r1 = 0.0;
- *r2 = 24.0;
- } else {
- *d2 = dec + width / 2.0;
- if ( *d2 >= 90.0 ) {
- *d1 = dec - width / 2.0;
- *d2 = 90.0;
- *r1 = 0.0;
- *r2 = 24.0;
- } else {
- if ( dec > 0.0 ) cosdec = Abs(cos(d2r(*d1)));
- else cosdec = Abs(cos(d2r(*d2)));
-
- *r1 = ra - d2h(width) / 2 / cosdec;
- *r2 = ra + d2h(width) / 2 / cosdec;
-
- if ( *r1 < 0.0 ) *r1 += 24;
- if ( *r2 > 24.0 ) *r2 -= 24;
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-ConeLimits(Csys *csys, char *rastr, char *decstr, char *radstr)
-#else
-static void ConeLimits(csys, rastr, decstr, radstr)
- Csys *csys;
- char *rastr;
- char *decstr;
- char *radstr;
-#endif
-{
- int xtype=0;
- char *p=NULL;
- double dval=0.0;
- double ra=0.0, dec=0.0, radius=0.0;
- double r0=0.0, r1=0.0, d0=0.0, d1=0.0;
-
- /* Input units conversion. */
- /* process input ra */
- dval = SAOstrtod(rastr, &p);
- if( rastr == p )
- gerror(stderr, "invalid RA value: '%s' (columns go with -l list)\n",
- rastr);
- xtype = *p;
- if( (xtype != 'h') && (xtype != 'd') && (xtype != 'r') ) {
- if( SAOdtype == 'd' )
- xtype = 'd';
- else
- xtype = 'h';
- }
- switch( xtype ) {
- case 'h':
- ra = dval;
- break;
- case 'd':
- ra = d2h(dval);
- break;
- case 'r':
- ra = r2h(dval);
- break;
- }
-
- /* process input dec */
- dval = SAOstrtod(decstr, &p);
- if( decstr == p )
- gerror(stderr, "invalid Dec value: '%s' (columns go with -l list)\n",
- decstr);
- xtype = *p;
- if( (xtype != 'h') && (xtype != 'd') && (xtype != 'r') ) {
- if( SAOdtype == 'h' )
- xtype = 'h';
- else
- xtype = 'd';
- }
- switch( xtype ) {
- case 'h':
- dec = h2d(dval);
- break;
- case 'd':
- dec = dval;
- break;
- case 'r':
- dec = r2d(dval);
- break;
- }
-
- /* process input radius */
- dval = SAOstrtod(radstr, &p);
- if( radstr == p )
- gerror(stderr, "invalid radius value: '%s'(columns go with -l list)\n",
- radstr);
- xtype = *p;
- if( (xtype != 'h') && (xtype != 'd') && (xtype != 'r') &&
- (xtype != '\'') && (xtype != '"') ){
- if( SAOdtype == 'h' )
- xtype = 'h';
- else
- xtype = 'd';
- }
- switch( xtype ) {
- case 'h':
- radius = h2d(dval);
- break;
- case 'd':
- radius = dval;
- break;
- case 'r':
- radius = r2d(dval);
- break;
- case '\'':
- radius = dval/60.0;
- break;
- case '"':
- radius = dval/3600.0;
- break;
- default:
- radius = dval;
- break;
- }
-
- /* calculate box limits, units in degrees */
- radecbox(ra, dec, radius*2, &r0, &r1, &d0, &d1);
-
- /* Output units conversion */
- switch( csys->type[0] ) {
- case 'h':
- csys->value[0].val = ra;
- csys->value[0].lo = r0;
- csys->value[0].hi = r1;
- break;
- case 'd':
- csys->value[0].val = h2d(ra);
- csys->value[0].lo = h2d(r0);
- csys->value[0].hi = h2d(r1);
- break;
- case 'r':
- csys->value[0].val = h2r(ra);
- csys->value[0].lo = h2r(r0);
- csys->value[0].hi = h2r(r1);
- break;
- }
- switch( csys->type[1] ) {
- case 'h':
- csys->value[1].val = d2h(dec);
- csys->value[1].lo = d2h(d0);
- csys->value[1].hi = d2h(d1);
- break;
- case 'd':
- csys->value[1].val = dec;
- csys->value[1].lo = d0;
- csys->value[1].hi = d1;
- break;
- case 'r':
- csys->value[1].val = d2r(dec);
- csys->value[1].lo = d2r(d0);
- csys->value[1].hi = d2r(d1);
- break;
- }
- csys->type[2] = xtype;
- csys->value[2].val = dval;
-#ifdef FOO
- /* force separation to be in radians, as needed by angular sep code */
- csys->type[2] = 'r';
- csys->value[2].val = d2r(radius);
-#endif
-}
-
-#ifdef ANSI_FUNC
-static char *
-ColumnName(Fun fun, char *def)
-#else
-static char *ColumnName(fun, def)
- Fun fun;
- char *def;
-#endif
-{
- int i;
- char tbuf[SZ_LINE];
-
- /* sanity check */
- if( !def || !*def ) return NULL;
-
- /* see if default is available */
- if( !FunColumnLookup(fun, def, 0, NULL, NULL, NULL, NULL, NULL, NULL) ){
- return xstrdup(def);
- }
- /* add numeric until a column name is available */
- else{
- i = 2;
- while( 1 ){
- snprintf(tbuf, SZ_LINE-1, "%s_%d", def, i);
- if( !FunColumnLookup(fun, tbuf, 0, NULL, NULL, NULL, NULL, NULL, NULL) ){
- return xstrdup(tbuf);
- }
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static int
-ColumnInfo(Csys *csys, char *colstr[], int flag)
-#else
- static int ColumnInfo(csys, colstr, flag)
- Csys *csys;
- char *colstr[];
- int flag;
-#endif
-{
- int i;
- int ip;
- int got=0;
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
-
- newdtable(":");
- for(i=0; i<3; i++){
- /* flag tells which of the three possible inputs to check */
- if( ((1<<i)&flag) == 0 ) continue;
- ip = 0;
- /* name of column */
- if( !word(colstr[i], tbuf, &ip) ){
- gerror(stderr, "invalid column #%d specification\n", i+1);
- goto done;
- }
- /* units */
- if( !word(colstr[i], tbuf2, &ip) ){
- switch(i){
- case 0:
- strcpy(tbuf2, RA_DEFAULT_UNITS);
- break;
- case 1:
- strcpy(tbuf2, DEC_DEFAULT_UNITS);
- break;
- case 2:
- strcpy(tbuf2, RAD_DEFAULT_UNITS);
- break;
- default:
- gerror(stderr, "internal funcone error: bad iter %d\n", i);
- break;
- }
- }
- else{
- /* quotes get handled as delimiters, so look for them here */
- if( i == 2 ){
- if( !*tbuf2 && (lastdelim() == '"' ) ){
- strcpy(tbuf2, "\"");
- }
- else if( !*tbuf2 && (lastdelim() == '\'' ) ){
- strcpy(tbuf2, "'");
- }
- }
- }
- /* column info */
- csys->value[i].colname = xstrdup(tbuf);
- switch(*tbuf2){
- case 'h':
- csys->type[i] = 'h';
- break;
- case 'd':
- csys->type[i] = 'd';
- break;
- case 'r':
- csys->type[i] = 'r';
- break;
- default:
- /* additional units for radius values */
- if( i == 2 ){
- switch(*tbuf2){
- case '\'':
- csys->type[i] = '\'';
- break;
- case '"':
- csys->type[i] = '"';
- break;
- default:
- gerror(stderr,
- "invalid units specification '%s' for %s\n", tbuf2, tbuf);
- goto done;
- }
- }
- else{
- gerror(stderr,
- "invalid units specification '%s' for %s\n", tbuf2, tbuf);
- goto done;
- }
- }
- }
- got = 1;
-
-done:
- freedtable();
- return got;
-}
-
-#ifdef ANSI_FUNC
-static double
-DConvert (char *buf, int type, int offset, int n)
-#else
-static double
-DConvert(buf, type, offset, n)
- char *buf;
- int type;
- int offset;
- int n;
-#endif
-{
- int ival;
- double dval;
-
- switch(type){
- case 'X':
- if( n == 16 )
- dval = (double)*(unsigned short *)(buf+offset);
- else if( n == 32 )
- dval = (double)*(unsigned int *)(buf+offset);
- else
- dval = (double)*(unsigned char *)(buf+offset);
- break;
- case 'B':
- dval = (double)*(unsigned char *)(buf+offset);
- break;
- case 'I':
- dval = (double)*(short *)(buf+offset);
- break;
- case 'U':
- dval = (double)*(unsigned short *)(buf+offset);
- break;
- case 'J':
- dval = (double)*(int *)(buf+offset);
- break;
- case 'K':
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- dval = (double)*(longlong *)(buf+offset);
- break;
- case 'V':
- dval = (double)*(unsigned int *)(buf+offset);
- break;
- case 'E':
- dval = (double)*(float *)(buf+offset);
- break;
- case 'D':
- dval = *(double *)(buf+offset);
- break;
- case 'L':
- ival = (int)*(unsigned char *)(buf+offset);
- if( !ival || (ival == 'F') || (ival == 'f') )
- dval = 0.0;
- else
- dval = 1.0;
- break;
- default:
- dval = 0.0;
- break;
- }
- return dval;
-}
-
-#ifdef ANSI_FUNC
-static void
-CloseList(List *list)
-#else
-static void CloseList(List *list)
- char *s;
-#endif
-{
- int i;
- /* sanity check */
- if( !list ) return;
- if( list->fun ) FunClose(list->fun);
- /* free up memory */
- if( list->row ){
- xfree(list->row);
- list->row=NULL;
- }
- for(i=0; i<3; i++){
- if( list->lits[i] ) xfree(list->lits[i]);
- }
- if( list->csys ){
- for(i=0; i<3; i++){
- if( list->csys->value[i].colname ) xfree(list->csys->value[i].colname);
- }
- xfree(list->csys);
- }
- xfree(list);
-}
-
-#ifdef ANSI_FUNC
-static List *
-OpenList(char *lname, char *rastr, char *decstr, char *radstr)
-#else
-static List *OpenList(lname, rastr, decstr, radstr)
- char *lname;
- char *rastr;
- char *decstr;
- char *radstr;
-#endif
-{
- char *colstr[3];
- char tbuf[SZ_LINE];
- char *p;
- int flag=0;
- List *list;
-
- /* allocate list struct */
- if( !(list = (List *)xcalloc(sizeof(List), 1)) ){
- gerror(stderr, "can't allocate list record\n");
- return NULL;
- }
- if( !(list->csys = (Csys *)xcalloc(sizeof(Csys), 1)) ){
- CloseList(list);
- gerror(stderr, "can't allocate list coordinate system record\n");
- return NULL;
- }
- /* open list file */
- if( !(list->fun = FunOpen(lname, "r", NULL)) ){
- CloseList(list);
- gerror(stderr, "can't FunOpen list file: %s\n", lname);
- return NULL;
- }
- /* look for literal numeric values (columns can't start with a number) */
- (void)strtod(rastr, &p);
- if( p != rastr ){
- list->lits[0] = xstrdup(rastr);
- list->litflag |= RA_FLAG;
- }
- else{
- flag |= RA_FLAG;
- colstr[0] = rastr;
- }
- (void)strtod(decstr, &p);
- if( p != decstr ){
- list->lits[1] = xstrdup(decstr);
- list->litflag |= DEC_FLAG;
- }
- else{
- flag |= DEC_FLAG;
- colstr[1] = decstr;
- }
- (void)strtod(radstr, &p);
- if( p != radstr ){
- list->lits[2] = xstrdup(radstr);
- list->litflag |= RAD_FLAG;
- }
- else{
- flag |= RAD_FLAG;
- colstr[2] = radstr;
- }
- /* look for column info as needed */
- if( flag ){
- if( ColumnInfo(list->csys, colstr, flag) ){
- if( flag & RA_FLAG ){
- if( !FunColumnLookup(list->fun, list->csys->value[0].colname, 0,
- NULL,
- &(list->csys->value[0].dtype),
- NULL,
- &(list->csys->value[0].offset),
- &(list->csys->value[0].n),
- NULL) ){
- strncpy(tbuf, list->csys->value[0].colname, SZ_LINE-1);
- CloseList(list);
- gerror(stderr, "can't get column info for: %s\n", tbuf);
- return NULL;
- }
- }
- if( flag & DEC_FLAG ){
- if( !FunColumnLookup(list->fun, list->csys->value[1].colname, 0,
- NULL,
- &(list->csys->value[1].dtype),
- NULL,
- &(list->csys->value[1].offset),
- &(list->csys->value[1].n),
- NULL) ){
- strncpy(tbuf, list->csys->value[0].colname, SZ_LINE-1);
- CloseList(list);
- gerror(stderr, "can't get column info for: %s\n", tbuf);
- return NULL;
- }
- }
- if( flag & RAD_FLAG ){
- if( !FunColumnLookup(list->fun, list->csys->value[2].colname, 0,
- NULL,
- &(list->csys->value[2].dtype),
- NULL,
- &(list->csys->value[2].offset),
- &(list->csys->value[2].n),
- NULL) ){
- strncpy(tbuf, list->csys->value[0].colname, SZ_LINE-1);
- CloseList(list);
- gerror(stderr, "can't get column info for: %s\n", tbuf);
- return NULL;
- }
- }
- }
- else{
- CloseList(list);
- gerror(stderr, "can't get column info for list: %s %s\n",
- colstr[0], colstr[1]);
- return NULL;
- }
- }
- return list;
-}
-
-#ifdef ANSI_FUNC
-static int
-NextList(List *list, char *rastr, char *decstr, char *radstr, int maxlen)
-#else
-static int NextList(list, rastr, decstr, radstr, maxlen)
- List *list;
- char *rastr;
- char *decstr;
- char *radstr;
- int maxlen;
-#endif
-{
- int got;
-
- /* sanity check */
- if( !list ) return 0;
-
- /* clean up from previous */
- if( list->row ){
- xfree(list->row);
- list->row=NULL;
- }
-
- /* if we have all literal values, end after one line */
- if( (list->litflag == ALL_FLAG) && (list->nline) ) return 0;
-
- /* read next record and exit on EOF */
- if( !(list->row=FunTableRowGet(list->fun, NULL, 1, NULL, &got)) || !got)
- return 0;
-
- /* ra */
- if( list->lits[0] )
- strncpy(rastr, list->lits[0], maxlen-1);
- else
- snprintf(rastr, SZ_LINE-1, "%15.10f%c",
- DConvert(list->row,
- list->csys->value[0].dtype,
- list->csys->value[0].offset,
- list->csys->value[0].n),
- list->csys->type[0]);
- /* dec */
- if( list->lits[1] )
- strncpy(decstr, list->lits[1], maxlen-1);
- else
- snprintf(decstr, SZ_LINE-1, "%15.10f%c",
- DConvert(list->row,
- list->csys->value[1].dtype,
- list->csys->value[1].offset,
- list->csys->value[1].n),
- list->csys->type[1]);
- /* radius */
- if( list->lits[2] )
- strncpy(radstr, list->lits[2], maxlen-1);
- else
- snprintf(radstr, SZ_LINE-1, "%15.10f%c",
- DConvert(list->row,
- list->csys->value[2].dtype,
- list->csys->value[2].offset,
- list->csys->value[2].n),
- list->csys->type[2]);
-
- /* got another line */
- list->nline++;
- /* return line number */
- return list->nline;
-}
-
-#ifdef ANSI_FUNC
-static int FilterSpec(Csys *csys, char *filter, int maxlen)
-#else
-static int FilterSpec(csys, filter, maxlen)
- Csys *csys;
- char *filter;
- int maxlen;
-#endif
-{
- int i, j;
- char tbuf[SZ_LINE];
-
- /* sanity check */
- if( !csys ) return 0;
-
- /* this is the indexed filter */
- if( csys->value[0].lo < csys->value[0].hi ){
- snprintf(filter, maxlen-1, "%s=%15.10f:%15.10f&&",
- csys->value[0].colname, csys->value[0].lo, csys->value[0].hi);
- }
- else{
- snprintf(filter, maxlen-1, "(%s>=%15.10f||%s<=%15.10f)&&",
- csys->value[0].colname, csys->value[0].lo,
- csys->value[0].colname, csys->value[0].hi);
- }
- if( csys->value[1].lo < csys->value[1].hi ){
- snprintf(tbuf, SZ_LINE-1, "%s=%15.10f:%15.10f",
- csys->value[1].colname, csys->value[1].lo, csys->value[1].hi);
- }
- else{
- snprintf(tbuf, SZ_LINE-1, "(%s>=%15.10f||%s<=%15.10f)",
- csys->value[1].colname, csys->value[1].lo,
- csys->value[1].colname, csys->value[1].hi);
- }
- strncat(filter, tbuf, maxlen-1);
-
- /* remove spaces (avoid old bug in filter range lists) */
- for(i=0, j=0; filter[i]; i++){
- if( filter[i] != ' ' ){
- filter[j++] = filter[i];
- }
- }
-
- filter[j] = '\0';
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *pname)
-#else
-static void usage(pname)
- char *pname;
-#endif
-{
- fprintf(stderr,
- "usage: %s <switches> iname oname ra[hdr] dec[hdr] radius[dr\"'] [columns [listcols]]\n",
- pname);
- fprintf(stderr, "\n");
- fprintf(stderr, " iname: input FITS file name\n");
- fprintf(stderr, " oname: output FITS file name\n");
- fprintf(stderr, " ra: RA center position, optional units (def: hours)\n");
- fprintf(stderr, " dec: Dec center position, optional units (def: degrees)\n");
- fprintf(stderr, " radius: Search radius, optional units (def: degrees)\n");
- fprintf(stderr, " columns: optional columns to output\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, "\n");
- fprintf(stderr, " -d deccol:[hdr] # Dec column name, units (def: DEC:d)\n");
- fprintf(stderr, " -j # join columns from list file\n");
- fprintf(stderr, " -J # join columns from list file, output all rows\n");
- fprintf(stderr, " -l listfile # read centers and radii from a list\n");
- fprintf(stderr, " -L listfile # read centers and radii from a list, output list rows\n");
- fprintf(stderr, " -n # don't use cone limits as a filter\n");
- fprintf(stderr, " -r racol:[hdr] # RA column name, units (def: RA:h)\n");
- fprintf(stderr, " -x # append RA_CEN, DEC_CEN, RAD_CEN, KEY cols\n");
- fprintf(stderr, " -X # append RA_CEN, DEC_CEN, RAD_CEN, KEY cols, output all rows\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "The default units for input center and radius are:\n");
- fprintf(stderr, " ra:hours, dec:degrees, radius: degrees.\n");
- fprintf(stderr, "Sexagesimal notation is supported.\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "If a list is specified, then the ra, dec, and radius\n");
- fprintf(stderr, "can be a list column name or numeric value. Col name\n");
- fprintf(stderr, "specifiers support the :hdr suffix.\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "The -n switch can speed up processing of small tables\n");
- fprintf(stderr, "by skipping the overhead associated with filtering on\n");
- fprintf(stderr, "the cone limits.\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "examples:\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "# defaults: RA col in hours, DEC col in degrees\n");
- fprintf(stderr, "# RA pos in hours, DEC pos and radius in degrees\n");
- fprintf(stderr, "%s in.fits out.fits 23.45 34.56 0.01\n",
- pname);
- fprintf(stderr, "# defaults, but with RA position in degrees:\n");
- fprintf(stderr, "%s in.fits out.fits 23.45d 34.56 0.01\n",
- pname);
- fprintf(stderr, "# user specified columns in degrees\n");
- fprintf(stderr, "# RA pos in hms, DEC pos in dms, radius in arcmin:\n");
- fprintf(stderr, "%s -r myRa:d -d myDec in.fits out.fits 12:30:15.5 30:12 15'\n",
- pname);
- fprintf(stderr, "# take positions from rax and decx columns in a FITS table\n");
- fprintf(stderr, "# and join columns from list to output\n");
- fprintf(stderr, "%s -j -l lst.fits in.fits out.fits 'rax:d' 'decx:d' '0.003:d'\n",
- pname);
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i;
- int got;
- int total;
- int rawsize;
- int havefilt=0;
- int debug=0;
- int args=0;
- int ioff=0;
- int dolist=0;
- int dolimfilt=1;
- int dojoin=0;
- int doall=0;
- int iter=0;
- int irow=0;
- int ncol=0;
- int nrow=0;
- int *rbuf=NULL;
- int *offsets=NULL;
- int ltype, lmode, loffset, ln, lwidth;
- size_t tsize=0;
- char *s;
- char *rawbuf;
- char *adbuf=NULL;
- char *albuf=NULL;
- char *iname=NULL;
- char *oname=NULL;
- char *lname=NULL;
- char *xmode=NULL;
- char *xmode2=NULL;
- char *raname=NULL;
- char *decname=NULL;
- char *radname=NULL;
- char *keyname=NULL;
- char *actcols=NULL;
- char *lcol=NULL;
- char *params="merge=update";
- char *colstr[2];
- char filter[SZ_LINE];
- char rastr[SZ_LINE];
- char decstr[SZ_LINE];
- char radstr[SZ_LINE];
- char mode[SZ_LINE];
- char tbuf[SZ_LINE];
- char **names=NULL;
- char **types=NULL;
- char **modes=NULL;
- Fun fun, ofun;
- Csys *csys=NULL;
- List *list=NULL;
- Filter filt=NULL;
- FITSHead header=NULL;
- Ev ev=NULL, ebuf=NULL;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* initialize names of columns */
- colstr[0]=RA_DEFAULT;
- colstr[1]=DEC_DEFAULT;
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "Dd:jJl:L:nr:xX")) != -1){
- switch(c){
- case 'D':
- debug = 1;
- break;
- case 'd':
- colstr[1] = optarg;
- break;
- case 'J':
- doall |= ALL_DATA;
- /* drop through */
- case 'j':
- dojoin = 1;
- break;
- case 'L':
- dojoin = 1;
- doall |= ALL_LIST;
- /* drop through */
- case 'l':
- dolist=1;
- lname = optarg;
- break;
- case 'n':
- dolimfilt = 0;
- break;
- case 'r':
- colstr[0] = optarg;
- break;
- case 'X':
- doall |= ALL_DATA;
- /* drop through */
- case 'x':
- xmode="w";
- break;
- }
- }
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* check for required arguments */
- args = argc - optind;
- if( args < 5 ) usage(argv[0]);
-
- /* get required arguments */
- iname = xstrdup(argv[optind+ioff++]);
- oname = xstrdup(argv[optind+ioff++]);
- strncpy(rastr, argv[optind+ioff++], SZ_LINE-1);
- strncpy(decstr, argv[optind+ioff++], SZ_LINE-1);
- strncpy(radstr, argv[optind+ioff++], SZ_LINE-1);
-
- /* dolimfilt does not work with doall */
- if( doall ) dolimfilt = 0;
-
- /* process list arguments */
- if( dolist ){
- if( !(list=OpenList(lname, rastr, decstr, radstr)) ){
- gerror(stderr, "can't FunOpen list file: %s\n", lname);
- }
- if( doall & ALL_LIST ){
- FunInfoGet(list->fun, FUN_NROWS, &nrow, 0);
- if( !(albuf=xcalloc(nrow+1, sizeof(char))) ){
- gerror(stderr, "can't allocate all (-L) buffer of size %d\n", nrow);
- }
- }
- }
- if( debug ) fprintf(stderr, "input file: %s\n", iname);
-
- if( !(csys = (Csys *)xcalloc(sizeof(Csys), 1)) ){
- gerror(stderr, "can't allocate coordinate system record\n");
- exit(1);
- }
-
- /* get information for the ra, dec columns */
- if( !ColumnInfo(csys, colstr, (RA_FLAG|DEC_FLAG)) ){
- gerror(stderr, "can't get column info for: %s %s\n",
- colstr[0], colstr[1]);
- exit(1);
- }
-
- /* open input file */
- if( !(fun = FunOpen(iname, "rc", NULL)) ){
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
- }
-
- /* consistency checks */
- if( dojoin && !dolist ){
- gerror(stderr, "join (-j) requires a list (-l listfile)\n");
- }
- if( dojoin && xmode ){
- gerror(stderr, "join (-j) and column output (-x) together are redundant\n");
- }
-
- /* get fitsy header */
- FunInfoGet(fun, FUN_HEADER, &header, 0);
-
- /* allocate buffer to hold flags for data rows that were written out */
- if( doall ){
- FunInfoGet(fun, FUN_NROWS, &nrow, 0);
- if( !(adbuf=xcalloc(nrow+1, sizeof(char))) ){
- gerror(stderr, "can't allocate all (-J|-X) buffer of size %d\n", nrow);
- }
- /* must read one event at a time, or else we can't tell the event num */
- maxrow = 1;
- }
-
- /* activate columns specified by user, if necessary */
- if( args >= ioff ) actcols = argv[optind+ioff++];
- FunColumnActivate(fun, actcols, NULL);
- if( dolist ){
- if( args >= ioff ) actcols = argv[optind+ioff++];
- FunColumnActivate(list->fun, actcols, NULL);
- }
-
- /* make sure columns are in the table */
- for(i=0; i<2; i++){
- if( !FunColumnLookup(fun, csys->value[i].colname, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- gerror(stderr, "column '%s' not found in data file\n",
- csys->value[i].colname);
- }
- }
-
- /* open output file */
- if( !(ofun = FunOpen(oname, "w", fun)) ){
- gerror(stderr, "can't FunOpen output file: %s\n", oname);
- }
-
- /* set up xmode variables */
- if( xmode ){
- /* look for xmode column names not already in the input file */
- raname = ColumnName(fun, RA_NAME);
- decname = ColumnName(fun, DEC_NAME);
- radname = ColumnName(fun, RAD_NAME);
- keyname = ColumnName(fun, KEY_NAME);
-
- /* might have to set xmode2 (the mode for key) */
- if( dolist ) xmode2 = "w";
- }
- if( dojoin ){
- keyname = ColumnName(fun, KEY_NAME);
- }
-
- /* get list info needed for join */
- if( dojoin ){
- FunInfoGet(list->fun,
- FUN_ROWSIZE, &(list->rowsize), FUN_NCOL, &(list->ncol), 0);
- }
-
- /* allocate space for the max number of columns we can have */
- if( dojoin ){
- names = (char **)xcalloc(list->ncol+MIN_COLS, sizeof(char *));
- types = (char **)xcalloc(list->ncol+MIN_COLS, sizeof(char *));
- modes = (char **)xcalloc(list->ncol+MIN_COLS, sizeof(char *));
- offsets = (int *)xcalloc(list->ncol+MIN_COLS, sizeof(int));
- }
- else{
- names = (char **)xcalloc(MIN_COLS, sizeof(char *));
- types = (char **)xcalloc(MIN_COLS, sizeof(char *));
- modes = (char **)xcalloc(MIN_COLS, sizeof(char *));
- offsets = (int *)xcalloc(MIN_COLS, sizeof(int));
- }
-
- /* total sizeof of an input event record */
- tsize = sizeof(EvRec);
-
- /* input columns */
- names[ncol] = xstrdup(csys->value[0].colname);
- types[ncol] = xstrdup("D");
- modes[ncol] = "r";
- offsets[ncol] = FUN_OFFSET(Ev, val0);
- ncol++;
-
- names[ncol] = xstrdup(csys->value[1].colname);
- types[ncol] = xstrdup("D");
- modes[ncol] = "r";
- offsets[ncol] = FUN_OFFSET(Ev, val1);
- ncol++;
-
- if( dojoin ){
- for(i=0; i<list->ncol; i++){
- if( !FunColumnLookup(list->fun, NULL, i,
- &lcol,
- &ltype,
- &lmode,
- &loffset,
- &ln,
- &lwidth) ){
- gerror(stderr, "can't find column %d in list file\n", i);
- }
- /* skip columns that are not active */
- if( !(lmode & COL_ACTIVE) ) continue;
- names[ncol] = ColumnName(fun, lcol);
- snprintf(tbuf, SZ_LINE-1, "@%d%c[B%d]", ln, ltype, loffset);
- types[ncol] = xstrdup(tbuf);
- modes[ncol] = "w";
- offsets[ncol] = FUN_OFFSET(Ev, row);
- ncol++;
- }
- names[ncol] = xstrdup(keyname);
- types[ncol] = xstrdup("J");
- modes[ncol] = "w";
- offsets[ncol] = FUN_OFFSET(Ev, key);
- ncol++;
- }
- else{
- /* output columns (aside from the catalog columns) */
- if( xmode ){
- names[ncol] = xstrdup(raname);
- types[ncol] = xstrdup("D");
- modes[ncol] = xmode;
- offsets[ncol] = FUN_OFFSET(Ev, ra);
- ncol++;
-
- names[ncol] = xstrdup(decname);
- types[ncol] = xstrdup("D");
- modes[ncol] = xmode;
- offsets[ncol] = FUN_OFFSET(Ev, dec);
- ncol++;
-
- names[ncol] = xstrdup(radname);
- types[ncol] = xstrdup("D");
- modes[ncol] = xmode;
- offsets[ncol] = FUN_OFFSET(Ev, rad);
- ncol++;
- }
- if( xmode2 ){
- names[ncol] = xstrdup(keyname);
- types[ncol] = xstrdup("J");
- modes[ncol] = xmode;
- offsets[ncol] = FUN_OFFSET(Ev, key);
- ncol++;
- }
- }
-
- /* reallocate output column array to correct size */
- names = (char **)xrealloc(names, ncol*sizeof(char *));
- types = (char **)xrealloc(types, ncol*sizeof(char *));
- modes = (char **)xrealloc(modes, ncol*sizeof(char *));
- offsets = (int *)xrealloc(offsets, ncol*sizeof(int));
-
- /* set up the output columns */
- FunColumnSelectArr(fun, tsize, params, names, types, modes, offsets, ncol);
-
- /* loop starts here. get next ra, dec, rad value and process events */
-loop:
- iter++;
- if( dolist && !NextList(list, rastr, decstr, radstr, SZ_LINE) ) goto done;
-
- /* calculate limits from ra, dec, and radius */
- ConeLimits(csys, rastr, decstr, radstr);
-
- /* get indexed filter specification */
- if( !FilterSpec(csys, filter, SZ_LINE) ){
- gerror(stderr, "can't get filter specification\n");
- }
-
- if( debug ){
- fprintf(stderr, "ra,dec,rad(%d): %s,%s,%s\nfilter: %s\n",
- iter, rastr, decstr, radstr, filter);
- }
-
- /* black magic: combine main filter with cone limits filter */
- if( dolimfilt ){
- /* only use index filter if main allowed it */
- if( fun->idx == 1 ){
- strncpy(mode, ",idx=true", SZ_LINE-1);
- }
- else if( fun->idx == -1 ){
- strncpy(mode, ",idx=false", SZ_LINE-1);
- }
- /* open the cone limits filter */
- filt = FilterOpen(header, filter, mode);
- /* read zero events from main to start up the main filter */
- FunTableRowGet(fun, NULL, 0, NULL, &got);
- /* if the main filter exists ... */
- if( fun->filt && (fun->filt != NOFILTER) ){
- /* if joining, we must process rows specially with a main filter */
- if( doall ){
- doall |= ALL_FILT;
- maxrow = 1;
- }
- /* splice in the index, if it exists */
- if( filt->idx ){
- fun->filt->doidx = filt->doidx;
- fun->filt->valhead = filt->valhead;
- fun->filt->rowhead = filt->rowhead;
- fun->filt->idx = filt->idx;
- fun->filt->idx->dofilt = 1;
- /* clear index in limits filter, so we don't free it twice */
- filt->doidx = 0;
- filt->valhead = NULL;
- filt->rowhead = NULL;
- filt->idx = NULL;
- havefilt = 1;
- }
- /* otherwise we will filter a second time */
- else{
- havefilt = 2;
- }
- }
- /* if no main filter exists, use the entire cone limits filter */
- else{
- fun->filt = filt;
- havefilt = 0;
- }
- }
-
- /* process events */
- total=0;
- while( 1 ){
- if( doall ) FunInfoGet(fun, FUN_ROW, &irow, 0);
- if( !(ebuf = (Ev)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) )
- break;
- /* perform explicit cone limit filter, if necessary */
- if( havefilt == 2 ){
- if( !rbuf ) rbuf = xmalloc(maxrow*sizeof(int));
- /* get pointer to raw buffer */
- FunInfoGet(fun, FUN_RAWBUF, &rawbuf, FUN_RAWSIZE, &rawsize, 0);
- FilterEvents(filt, rawbuf, rawsize, got, rbuf);
- }
- /* process all rows */
- for(i=0; i<got; i++){
- /* check limit filter explicitly, if necessary */
- if( (havefilt==2) && (rbuf[i]==0) ) continue;
- /* point to the i'th row */
- ev = ebuf+i;
- /* is this event within the cone? */
- if( ConeFilter(csys, ev->val0, ev->val1) ){
- /* yes, add extra values if necessary */
- if( xmode ){
- ev->ra = csys->value[0].val;
- ev->dec = csys->value[1].val;
- ev->rad = csys->value[2].val;
- }
- if( dojoin ){
- ev->row = list->row;
- }
- if( dolist ) ev->key = list->nline;
- /* and write out this event */
- if( FunTableRowPut(ofun, ev, 1, i, NULL) == 1 ){
- total++;
- if( doall ){
- /* if we have a filter, then we don't know the row number til after
- we read the event, i.e. now */
- if( doall > 1 ) FunInfoGet(fun, FUN_ROW, &irow, 0);
- adbuf[irow] = 1;
- }
- }
- else{
- gerror(stderr, "could not write row %d\n", i);
- }
- }
- }
- if( ebuf ) xfree(ebuf);
- }
- if( debug ) fprintf(stderr, "matched rows: %d\n", total);
-
- /* close cone filter if it wasn't assigned wholesale to main filter */
- if( filt && havefilt ){
- FilterClose(filt);
- }
-
- /* iterate, if necessary */
- if( dolist ){
- if( (doall & ALL_LIST) && total ){
- FunInfoGet(list->fun, FUN_ROW, &irow, 0);
- albuf[irow] = 1;
- }
- FunTableRowSeek(fun, 1, NULL);
- goto loop;
- }
-
-done:
- /* write out all rows not previously written, if necessary */
- if( doall & ALL_DATA ){
- /* seek back to beginning */
- FunTableRowSeek(fun, 1, NULL);
- irow = 0;
- /* clear list information */
- if( dojoin ){
- if( list->row ){
- xfree(list->row);
- }
- list->row = xcalloc(list->rowsize, sizeof(char));
- }
- /* redo the read loop */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) ){
- /* if we have a filter, then we don't know the row number til after
- we read the event, i.e. now */
- FunInfoGet(fun, FUN_ROW, &irow, 0);
- /* process all rows */
- for(i=0; i<got; i++){
- /* skip rows that already were written out */
- if( adbuf[irow+i] ) continue;
- /* point to the i'th row */
- ev = ebuf+i;
- /* flag that this is a row not in any cone */
- ev->key = -1;
- /* clear extra values if necessary */
- if( xmode ){
- ev->ra = 0.0;
- ev->dec = 0.0;
- ev->rad = 0.0;
- }
- if( dojoin ){
- ev->row = list->row;
- }
- /* and write out this event */
- if( !FunTableRowPut(ofun, ev, 1, i, NULL) ){
- gerror(stderr, "could not write row %d\n", i);
- }
- }
- irow += got;
- if( ebuf ) xfree(ebuf);
- }
- if( dojoin && list->row ){
- xfree(list->row);
- list->row = NULL;
- }
- }
-
- /* write out all list rows not previously written, if necessary */
- if( doall & ALL_LIST ){
- /* fake an event */
- ev = (Ev)xcalloc(1, sizeof(EvRec));
- /* flag that this is a list row not close to any data row */
- ev->key = -2;
- /* clear underlying raw buffer */
- FunInfoGet(fun, FUN_RAWBUF, &rawbuf, FUN_RAWSIZE, &rawsize, 0);
- memset(rawbuf, 0, rawsize);
- /* seek back to beginning of list file */
- FunTableRowSeek(list->fun, 1, NULL);
- /* for each row in the list ... */
- for(i=1; NextList(list, rastr, decstr, radstr, SZ_LINE); i++){
- /* if we already wrote this row, skip it */
- if( albuf[i] ) continue;
- /* add the list row to the fake event */
- ev->row = list->row;
- /* and write out this event */
- if( !FunTableRowPut(ofun, ev, 1, 0, NULL) ){
- gerror(stderr, "could not write row %d\n", i);
- }
- }
- if( ev ) xfree(ev);
- }
-
- /* close files */
- FunClose(ofun);
- FunClose(fun);
- if( dolist ) CloseList(list);
- /* free up memory */
- if( csys ){
- for(i=0; i<3; i++){
- if( csys->value[i].colname ) xfree(csys->value[i].colname);
- }
- xfree(csys);
- }
- if( adbuf ) xfree(adbuf);
- if( albuf ) xfree(albuf);
- if( rbuf ) xfree(rbuf);
- if( iname) xfree(iname);
- if( oname) xfree(oname);
- if( raname) xfree(raname);
- if( decname) xfree(decname);
- if( radname) xfree(radname);
- if( keyname) xfree(keyname);
- if( names ){
- for(i=0; i<ncol; i++){
- if( names[i] ) xfree(names[i]);
- }
- xfree(names);
- }
- if( types ){
- for(i=0; i<ncol; i++){
- if( types[i] ) xfree(types[i]);
- }
- xfree(types);
- }
- if( modes ) xfree(modes);
- if( offsets ) xfree(offsets);
-
- /* success */
- return(0);
-}
diff --git a/funtools/funcopy.c b/funtools/funcopy.c
deleted file mode 100644
index dc2861e..0000000
--- a/funtools/funcopy.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-/*
- *
- * semi-public routines -- used by other fun routines, but not by users
- *
- */
-
-#ifdef ANSI_FUNC
-void
-_FunCopyBinDelete(FITSHead header, int n)
-#else
-void _FunCopyBinDelete(header, n)
- FITSHead header;
- int n;
-#endif
-{
- int i;
- char *s;
- FITSCard card;
-
- /* delete unwanted fields */
- ft_headdel(header, "TFIELDS", 0);
- /* delete checksum header params */
- if( (s=ft_headgets(header, "CHECKSUM", 0, NULL, &card)) && card){
- ft_headdel(header, "CHECKSUM", 0);
- xfree(s);
- }
- if( (s=ft_headgets(header, "DATASUM", 0, NULL, &card)) && card){
- ft_headdel(header, "DATASUM", 0);
- xfree(s);
- }
- for(i=1; i<=n; i++){
- if( (s=ft_headgets(header, "TFORM", i, NULL, &card)) && card){
- ft_headdel(header, "TFORM", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TTYPE", i, NULL, &card)) && card){
- ft_headdel(header, "TTYPE", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TUNIT", i, NULL, &card)) && card){
- ft_headdel(header, "TUNIT", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TDISP", i, NULL, &card)) && card){
- ft_headdel(header, "TDISP", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TSCAL", i, NULL, &card)) && card ){
- ft_headdel(header, "TSCAL", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TZERO", i, NULL, &card)) && card ){
- ft_headdel(header, "TZERO", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TNULL", i, NULL, &card)) && card ){
- ft_headdel(header, "TNULL", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TLMIN", i, NULL, &card)) && card ){
- ft_headdel(header, "TLMIN", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TLMAX", i, NULL, &card)) && card ){
- ft_headdel(header, "TLMAX", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TDMIN", i, NULL, &card)) && card ){
- ft_headdel(header, "TDMIN", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TDMAX", i, NULL, &card)) && card ){
- ft_headdel(header, "TDMAX", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TDBIN", i, NULL, &card)) && card ){
- ft_headdel(header, "TDBIN", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TCTYP", i, NULL, &card)) && card ){
- ft_headdel(header, "TCTYP", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TCRVL", i, NULL, &card)) && card ){
- ft_headdel(header, "TCRVL", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TCDLT", i, NULL, &card)) && card ){
- ft_headdel(header, "TCDLT", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TCRPX", i, NULL, &card)) && card ){
- ft_headdel(header, "TCRPX", i);
- xfree(s);
- }
- if( (s=ft_headgets(header, "TCROT", i, NULL, &card)) && card ){
- ft_headdel(header, "TCROT", i);
- xfree(s);
- }
- }
-}
-
-/*
- *
- * _FunCopy2ImageHeader -- copy FITS header, transforming it to primary image.
- * This beastly routine is used by FunImagePut to make ordinary life easier.
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunCopy2ImageHeader(Fun from, Fun to)
-#else
-int _FunCopy2ImageHeader(from, to)
- Fun from; /* input FITS header */
- Fun to; /* output FITS header */
-#endif
-{
- int simple=1;
- int i, j;
- int cols;
- char *s;
- char tbuf[SZ_LINE];
- double dval;
- double crpix1, crpix2;
- double cdelt1, cdelt2;
- double ltv1, ltv2;
- double ltm1_1, ltm2_1, ltm1_2, ltm2_2;
- FITSCard card;
-
- /* make sure we have something to work with */
- if( !from )
- return 0;
-
- /* make a copy of the header */
- to->header = ft_headcopy(from->header);
-
- /* make sure this is a primary FITS file */
- ft_cardfmt((FITSCard)to->header->cards,
- "SIMPLE", 0, FT_LOGICAL, &simple, 0, "Standard FITS");
-
- /* add/edit image-related keywords based on the orig binning values */
- ft_headseti(to->header,
- "NAXIS", 0, from->odims, "number of axes", 1);
- ft_headseti(to->header,
- "NAXIS", 1, from->odim1, "x axis dimension", 1);
- if( from->odims >= 2 ){
- ft_headseti(to->header,
- "NAXIS", 2, from->odim2, "y axis dimension", 1);
-
- }
- else{
- ft_headdel(to->header, "NAXIS", 2);
- }
- ft_headseti(to->header,
- "BITPIX", 0, from->obitpix, "bits/pixel", 1);
- /* synchronize the header and the cards after any changes */
- ft_syncdata(to->header);
-
- /* get dimensions of the new image back into the struct */
- to->dim1 = ft_headgeti(to->header, "NAXIS", 1, 0, &card);
- to->dim2 = ft_headgeti(to->header, "NAXIS", 2, 0, &card);
- /* determine dimensionality */
- if( card )
- to->dims = 2;
- else
- to->dims = 1;
- /* get bitpix */
- to->bitpix = ft_headgeti(to->header, "BITPIX", 0, 0, &card);
-
- /* now get image size based on these params */
- _FunImageSize(to);
-
- /* delete checksum header params */
- if( ft_headgets(to->header, "CHECKSUM", 0, NULL, &card) && card)
- ft_headdel(to->header, "CHECKSUM", 0);
- if( ft_headgets(to->header, "DATASUM", 0, NULL, &card) && card)
- ft_headdel(to->header, "DATASUM", 0);
-
- /* now perform the transformation based on input type */
- switch(from->type){
- case FUN_TABLE:
- case FUN_EVENTS:
- /* delete extraneous bintable keyword */
- /* but leave the XTENSION card so we can overwrite it later */
- /* ft_headdel(to->header, "XTENSION", 0); */
- ft_headdel(to->header, "PCOUNT", 0);
- ft_headdel(to->header, "GCOUNT", 0);
- if( (s=ft_headgets(to->header, "EXTNAME", 0, NULL, &card)) && card){
- ft_headdel(to->header, "EXTNAME", 0);
- xfree(s);
- }
- if( (ft_headgeti(to->header, "EXTVER", 0, 0, &card)!=0) && card)
- ft_headdel(to->header, "EXTVER", 0);
- if( (ft_headgeti(to->header, "EXTLEVEL", 0, 0, &card)!=0) && card)
- ft_headdel(to->header, "EXTLEVEL", 0);
- /* process table columns */
- cols = ft_headgeti(to->header, "TFIELDS", 0, 0, &card);
- /* transform WCS cards for the two columns on which we are binning */
- /* this assumes the TFORMnnn are in order ... hmmm! */
- for(j=1; j<=2; j++){
- if( (i=from->bin[j-1]+1) >= 1 ){
- if( (s=ft_headgets(from->header, "TCTYP", i, NULL, &card)) && card ){
- ft_headapps(to->header, "CTYPE", j, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(from->header, "TCRVL", i, NULL, &card)) && card ){
- ft_headappv(to->header, "CRVAL", j, s, NULL);
- xfree(s);
- }
- if((dval=ft_headgetr(from->header, "TCDLT", i, 0.0, &card)) && card){
- /* factor in binsize */
- if( from->cols[i-1] && (from->cols[i-1]->binsiz > 0) )
- dval *= from->cols[i-1]->binsiz;
- ft_headsetr(to->header, "CDELT", j, dval, 7, NULL, 1);
- }
- if( (s=ft_headgets(from->header, "TCROT", i, NULL, &card)) && card ){
- ft_headappv(to->header, "CROTA", j, s, NULL);
- xfree(s);
- }
- if((dval=ft_headgetr(from->header, "TCRPX", i, 0.0, &card)) && card){
- /* convert WCS center value from physical to image coords */
- if( from->cols[i-1] ){
- dval = tlp2i(dval,
- from->cols[i-1]->tlmin, from->cols[i-1]->binsiz, 'D');
- }
- ft_headsetr(to->header, "CRPIX", j, dval, 7, NULL, 1);
- }
- }
- }
- /* delete unwanted fields */
- _FunCopyBinDelete(to->header, cols);
- break;
- case FUN_IMAGE:
- /* delete all signs of higher axes */
- for(i=3; i<=ft_naxes(to->header); i++)
- ft_headdel(to->header, "NAXIS", i);
- /* if bscale and bzero were applied to the input, delete them */
- if( from->scaled & FUN_SCALE_APPLIED ){
- if( ft_headfind(to->header, "BSCALE", 0, 0) )
- ft_headdel(to->header, "BSCALE", 0);
- if( ft_headfind(to->header, "BZERO", 0, 0) )
- ft_headdel(to->header, "BZERO", 0);
- }
- /* if an image section is blocked and we are summing,
- we have to take that into account when setting the bzero factor */
- else if( (ft_bzero(to->header) != 0.0) &&
- (from->block != 1) && (from->btype == FUN_SUM) ){
- dval = ft_bzero(to->header) * from->block * from->block;
- ft_headsetr(to->header, "BZERO", 0, dval, 7, "", 1);
- }
- /* deal with the IRAF DETSEC keyword */
- if( (s=ft_headgets(from->header, "DATASEC", 0, NULL, &card)) && card ){
- int dx0, dx1, dy0, dy1;
- char s1[SZ_LINE], s2[SZ_LINE], s3[SZ_LINE], s4[SZ_LINE];
- char *t=s;
- if( *t == '[' ) t++;
- if(sscanf(t, "%[-0-9.*] : %[-0-9.*] , %[-0-9.*] : %[-0-9.*]",
- s1, s2, s3, s4) == 4){
- dx0 = MAX(1,atoi(s1)-from->x0+1);
- dx1 = MIN(from->odim1,atoi(s2)-from->x0+1);
- dy0 = MAX(1,atoi(s3)-from->y0+1);
- dy1 = MIN(from->odim2,atoi(s4)-from->y0+1);
- snprintf(s1, SZ_LINE, "[%d:%d,%d:%d]", dx0, dx1, dy0, dy1);
- ft_headsets(to->header, "DATASEC", 0, s1, NULL, 1);
- }
- xfree(s);
- }
- break;
- case FUN_ARRAY:
- default:
- break;
- }
-
- /* update WCS values */
- /* re-set the tangent plane point */
- crpix1 = ft_headgetr(to->header, "CRPIX", 1, 0.0, &card);
- if( card != NULL ){
- crpix1 = (crpix1 + 1.0 - from->x0 - 0.5)/from->block + 0.5;
- ft_headsetr(to->header, "CRPIX", 1, crpix1, 7, "reference point", 1);
- }
- crpix2 = ft_headgetr(to->header, "CRPIX", 2, 0.0, &card);
- if( card != NULL ){
- crpix2 = (crpix2 + 1.0 - from->y0 - 0.5)/from->block + 0.5;
- ft_headsetr(to->header, "CRPIX", 2, crpix2, 7, "reference point", 1);
- }
-
- /* update degrees/pixel */
- cdelt1 = ft_headgetr(to->header, "CDELT", 1, 0.0, &card);
- if( card != NULL ){
- cdelt1 *= from->block;
- ft_headsetr(to->header, "CDELT", 1, cdelt1, 7, "degrees/pixel", 1);
- }
- cdelt2 = ft_headgetr(to->header, "CDELT", 2, 0.0, &card);
- if( card != NULL ){
- cdelt2 *= from->block;
- ft_headsetr(to->header, "CDELT", 2, cdelt2, 7, "degrees/pixel", 1);
- }
-
- /* WCS matrix-style */
- for(i=1; i<=2; i++){
- for(j=1; j<=2; j++){
- snprintf(tbuf, SZ_LINE, "CD%d_%d", i, j);
- dval = ft_headgetr(to->header, tbuf, 0, 0.0, &card);
- if( card != NULL ){
- dval *= from->block;
- ft_headsetr(to->header, tbuf, 0, dval, 7, "WCS matrix value", 1);
- }
- }
- }
-
- /* re-set the tangent plane point for IRAF matrix */
- /* for images, ltv values are in file */
- if( from->odims >= 2 ){
- if( from->header->image ){
- ltv1 = ft_headgetr(from->header, "LTV", 1, 0.0, &card);
- ltv2 = ft_headgetr(from->header, "LTV", 2, 0.0, &card);
- }
- /* for tables, ltv is related to tlmin value of binned columns */
- else{
- ltv1 = 1.0 - (int)(from->min1 + 0.5);
- ltv2 = 1.0 - (int)(from->min2 + 0.5);
- }
- ltv1 = (ltv1 + 1.0 - from->x0 - 0.5 )/(from->block * from->binsiz1) + 0.5;
- ltv2 = (ltv2 + 1.0 - from->y0 - 0.5 )/(from->block * from->binsiz2) + 0.5;
- ft_headsetr(to->header, "LTV", 1, ltv1, 7, "IRAF ref. point", 1);
- ft_headsetr(to->header, "LTV", 2, ltv2, 7, "IRAF ref. point", 1);
-
- /* IRAF matrix values */
- ltm1_1 = ft_headgetr(from->header, "LTM1_1", 0, 1.0, &card);
- ltm2_1 = ft_headgetr(from->header, "LTM2_1", 0, 0.0, &card);
- ltm1_2 = ft_headgetr(from->header, "LTM1_2", 0, 0.0, &card);
- ltm2_2 = ft_headgetr(from->header, "LTM2_2", 0, 1.0, &card);
- ltm1_1 /= (from->block * from->binsiz1);
- ltm2_1 /= (from->block * from->binsiz2);
- ltm1_2 /= (from->block * from->binsiz1);
- ltm2_2 /= (from->block * from->binsiz2);
- ft_headsetr(to->header, "LTM1_1", 0, ltm1_1, 7, "IRAF matrix value", 1);
- ft_headsetr(to->header, "LTM2_1", 0, ltm2_1, 7, "IRAF matrix value", 1);
- ft_headsetr(to->header, "LTM1_2", 0, ltm1_2, 7, "IRAF matrix value", 1);
- ft_headsetr(to->header, "LTM2_2", 0, ltm2_2, 7, "IRAF matrix value", 1);
- }
-
- return(1);
-}
-
-/*
- *
- * public routines
- *
- */
-
-/* none */
diff --git a/funtools/fundisp.c b/funtools/fundisp.c
deleted file mode 100644
index 6ae508a..0000000
--- a/funtools/fundisp.c
+++ /dev/null
@@ -1,1126 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtools.h>
-#include <word.h>
-
-extern char *optarg;
-extern int optind;
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-
-/* from funtoolsP.h */
-#define COL_REGION_NAME "$REGION"
-#define COL_REGION_ONAME "REGION"
-#define COL_NUM_NAME "$N"
-#define COL_NUM_ONAME "N"
-
-/* display directives */
-#define DMODE_MASKONLY 1
-#define DMODE_RDB 2
-
-#define NFORMAT 12
-/* default format values */
-static int _fmti[NFORMAT] = {21, 11, 10, 8, 6, 12, 10, 8, 10, 6, 20, 1};
-static char *_fmts[NFORMAT] = {"%21.21s", "%11.11s", "%10.10s", "%8.8s",
- "%6.6s", "%12.12s", "%10.10s", "%8.8s",
- "%10.10s", "%6.6s", "%20.20s", "%1.1s"};
-static char *_fmt[NFORMAT] = {"%21.8f", "%11.2f", "%10d", "%8d",
- "%6d", "%12.12s", "%10.10s", "%8d",
- "%10d", "%6s", "%20lld", "%1x"};
-
-/* global format values, used everywhere */
-static int fmti[NFORMAT];
-static char *fmts[NFORMAT];
-static char *fmt[NFORMAT];
-
-/* holds temp index string for header */
-static char _tdim[SZ_LINE];
-
-/* column delimiter */
-static int coldelim=' ';
-
-#define MAX_COLFMTS 1024
-/* column-specific formats */
-static struct colfmtrec{
- char *name;
- int fmti;
- char *fmts;
- char *fmt;
-} colfmts[MAX_COLFMTS];
-static int ncolfmt=0;
-
-#ifdef ANSI_FUNC
-int
-Index(int type)
-#else
-int Index(type)
- int type;
-#endif
-{
- switch ( type ) {
- case 'D': return 0;
- case -64: return 0;
- case 'E': return 1;
- case -32: return 1;
- case 'J': return 2;
- case 32: return 2;
- case 'I': return 3;
- case 16: return 3;
- case 'B': return 4;
- case 8: return 4;
- case 'A': return 5;
- case 'X': return 6;
- case 'U': return 7;
- case -16: return 7;
- case 'V': return 8;
- case 'L': return 9;
- case 'K': return 10;
- case 64: return 10;
- }
- return(-1);
-}
-
-/* order of formats: double float int short byte string bits ushort uint */
-#ifdef ANSI_FUNC
-static void
-Format (char *s, char **names, int n)
-#else
-static void
-Format (s, names, n)
- char *s;
- char **names;
- int n;
-#endif
-{
- int i, j, x;
- int col;
- int ival;
- int ip=0;
- char format[SZ_LINE];
- char tbuf[SZ_LINE];
- char *e;
- char *f;
-
- i = 0;
- newdtable(",");
- while( 1 ){
- col = -1;
- x = i;
- if( !word(s, format, &ip) )
- break;
- if( !strcmp(format, "-") || !strncasecmp(format, "def", 3) ){
- i++;
- continue;
- }
- /* look for "=", meaning we have a column format */
- if( (e = strchr(format, '=')) != NULL ){
- if( ncolfmt >= MAX_COLFMTS ){
- fprintf(stderr, "WARNING: too many column formats; skipping %s\n",
- format);
- continue;
- }
- f = e+1;
- *e = '\0';
- if( (strlen(format) != 1) || ((x=Index(*format)) < 0) ){
- for(j=0; j<n; j++){
- if( !strcasecmp(format, names[j]) ){
- if( colfmts[ncolfmt].name ) xfree(colfmts[ncolfmt].name);
- colfmts[ncolfmt].name = xstrdup(names[j]);
- col = j;
- break;
- }
- }
- if( col < 0 ){
- fprintf(stderr,
- "WARNING: bad '%s' format: missing column or unknown datatype\n",
- format);
- continue;
- }
- }
- }
- /* no column format, its a global format */
- else{
- f = format;
- }
- if( *f == '%' ) f++;
- ival = ABS(atoi(f));
- if( ival == 0 ){
- switch(f[strlen(f)-1]){
- case 'g':
- case 'f':
- ival = _fmti[0];
- break;
- case 'd':
- case 'x':
- ival = _fmti[2];
- break;
- case 's':
- ival = _fmti[5];
- break;
- case 'c':
- ival = _fmti[4];
- break;
- default:
- ival = _fmti[2];
- }
- }
-
- if( col >= 0 ){
- colfmts[ncolfmt].fmti = ival;
- snprintf(tbuf, SZ_LINE-1, "%%%d.%ds", ival, ival);
- if( colfmts[ncolfmt].fmts ) xfree(colfmts[ncolfmt].fmts);
- colfmts[ncolfmt].fmts = xstrdup(tbuf);
- if( strchr(f, '%') )
- snprintf(tbuf, SZ_LINE-1, "%s", f);
- else
- snprintf(tbuf, SZ_LINE-1, "%%%s", f);
- if( colfmts[ncolfmt].fmt ) xfree(colfmts[ncolfmt].fmt);
- colfmts[ncolfmt].fmt = xstrdup(tbuf);
- ncolfmt++;
- }
- else{
- fmti[x] = ival;
- snprintf(tbuf, SZ_LINE-1, "%%%d.%ds", ival, ival);
- if( fmts[x] ) xfree(fmts[x]);
- fmts[x] = xstrdup(tbuf);
- if( strchr(f, '%') )
- snprintf(tbuf, SZ_LINE-1, "%s", f);
- else
- snprintf(tbuf, SZ_LINE-1, "%%%s", f);
- if( fmt[x] ) xfree(fmt[x]);
- fmt[x] = xstrdup(tbuf);
- if( x == i ){
- i++;
- }
- }
- }
- freedtable();
-}
-
-#ifdef ANSI_FUNC
-static char *
-tdimstr (int *dims, int ndim, int ival)
-#else
-static char *
-tdimstr (dims, ndim, ival)
- int *dims;
- int ndim;
- int ival;
-#endif
-{
- int i, j;
- int *prods;
- int *idxs;
- char tbuf[SZ_LINE];
-
- *_tdim = '\0';
- if( ndim <= 1 ){
- snprintf(_tdim, SZ_LINE, "%d", ival);
- }
- else{
- prods=xcalloc(ndim, sizeof(int));
- idxs=xcalloc(ndim, sizeof(int));
- for(i=0; i<ndim; i++){
- prods[i] = 1;
- }
- for(i=1; i<ndim; i++){
- for(j=0; j<i; j++){
- prods[i] *= dims[j];
- }
- }
- for(i=ndim-1; i>=0; i--){
- if( i == 0 ){
- idxs[i] = ival;
- }
- else{
- idxs[i] = ival / prods[i];
- ival %= prods[i];
- }
- }
- for(i=0; i<ndim; i++){
- /* add separator, but avoid comma because text parser gets messed up */
- if( *_tdim ) strncat(_tdim, ",", SZ_LINE-1);
- snprintf(tbuf, SZ_LINE, "%d", idxs[i]);
- strncat(_tdim, tbuf, SZ_LINE-1);
- }
- if( prods ) xfree(prods);
- if( idxs ) xfree(idxs);
- }
- return _tdim;
-}
-
-#ifdef ANSI_FUNC
-static void
-Header (FILE *fp, int dmode, char *name, int type, int n, char *tdim)
-#else
-static void
-Header (fp, dmode, name, type, n, tdim)
- FILE *fp;
- int dmode;
- char *name;
- int type;
- int n;
- char *tdim;
-#endif
-{
- int ind;
- int i, j;
- int xfmti;
- int ip;
- int dims[SZ_LINE];
- int ndim;
- char *xfmts;
- // char *xfmt;
- char *t;
- char tbuf[SZ_LINE];
-
- if( dmode & DMODE_MASKONLY )
- ind = NFORMAT-1;
- else{
- if( (ind = Index(type)) == -1 )
- ind = NFORMAT-1;
- }
-
- /* see values for format */
- xfmts = fmts[ind];
- xfmti = fmti[ind];
- // xfmt = fmt[ind];
- /* some columns don't have a name */
- if( !name || !*name )
- name = "";
- /* see if we have a column format and overwrite format values if so */
- else{
- for(i=0; i<ncolfmt; i++){
- if( !strcasecmp(name, colfmts[i].name) ){
- xfmts = colfmts[i].fmts;
- xfmti = colfmts[i].fmti;
- // xfmt = colfmts[i].fmt;
- break;
- }
- }
- }
-
- /* for bitfields, we process bytes */
- if( type == 'X' ){
- if( n == 16 ){
- n = 1;
- }
- else if( n == 32 ){
- n = 1;
- }
- else{
- n = (n+7)/8;
- }
- }
- /* for ascii, we process strings */
- else if( type == 'A' )
- n = 1;
- /* init tdim arrays, if necessary */
- ndim = 0;
- if( (n>1) && tdim ){
- newdtable(",()");
- for(ip=0; word(tdim, tbuf, &ip); ndim++){
- if( ndim >= SZ_LINE ) gerror(stderr, "too many dimensions in TDIM\n");
- dims[ndim] = atoi(tbuf);
- }
- freedtable();
- }
- /* output each sub-column in this column */
- for(i=0; i<n; i++){
- /* reset region column name */
- if( !strcasecmp(name, COL_REGION_NAME) )
- t = "REGION";
- else if( !strcasecmp(name, COL_NUM_NAME) )
- t = "N";
- else
- t = name;
- if( n > 1 ){
- if( dmode & DMODE_RDB ){
- if( i == (n-1) )
- strcpy(tbuf, t);
- else
- strcpy(tbuf, " ");
- }
- else{
- snprintf(tbuf, SZ_LINE-1, "%s[%s]", t, tdimstr(dims,ndim,i));
- }
- }
- else
- strcpy(tbuf, t);
- /* only display last characters of string, if its too long */
- j = strlen(tbuf) - xfmti;
- if( j > 0 ) {
- /* this ensures we print out at least one character */
- j = MIN((int)strlen(tbuf)-1,j);
- if( !(dmode & DMODE_RDB) )
- t = tbuf + j;
- /* for rdb, we want the whole string, since alignment is unimportant */
- else
- t = tbuf;
- }
- else
- t = tbuf;
- if( i ) fprintf(fp, " ");
- /* for rdb, we want the whole string, since alignment is unimportant */
- if( (dmode & DMODE_RDB) && (j > 0) )
- fprintf(fp, "%s", t);
- /* else print out what we can */
- else
- fprintf(fp, xfmts, t);
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-Dashes (FILE *fp, int dmode, char *name, int type, int n)
-#else
-static void
-Dashes (fp, dmode, name, type, n)
- FILE *fp;
- int dmode;
- char *name;
- int type;
- int n;
-#endif
-{
- int ind;
- int i, j;
- int xfmti;
- // char *xfmts;
- // char *xfmt;
-
- if( dmode & DMODE_MASKONLY )
- ind = NFORMAT-1;
- else{
- if( (ind = Index(type)) == -1 )
- ind = NFORMAT-1;
- }
-
- /* see values for format */
- // xfmts = fmts[ind];
- xfmti = fmti[ind];
- // xfmt = fmt[ind];
- /* some columns don't have a name */
- if( !name || !*name )
- name = "";
- /* see if we have a column format and overwrite format values if so */
- else{
- for(i=0; i<ncolfmt; i++){
- if( !strcasecmp(name, colfmts[i].name) ){
- // xfmts = colfmts[i].fmts;
- xfmti = colfmts[i].fmti;
- // xfmt = colfmts[i].fmt;
- break;
- }
- }
- }
-
- /* for bitfields, we process bytes */
- if( type == 'X' ){
- if( n == 16 ){
- n = 1;
- }
- else if( n == 32 ){
- n = 1;
- }
- else{
- n = (n+7)/8;
- }
- }
- /* for ascii, we process strings */
- else if( type == 'A' )
- n = 1;
- for(i=0; i<n; i++){
- if( dmode & DMODE_MASKONLY ){
- j = 1;
- }
- else{
- j = xfmti;
- if( i ){
- if( dmode & DMODE_RDB )
- fprintf(fp, "-");
- else
- fprintf(fp, " ");
- }
- }
- while( j-- ){
- fprintf(fp, "-");
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-Display (FILE *fp, int dmode, char *name, int type, int n, char *buf)
-#else
-static void
-Display(fp, dmode, name, type, n, buf)
- FILE *fp;
- int dmode;
- char *name;
- int type;
- int n;
- char *buf;
-#endif
-{
- int ind;
- int i;
- int ival=0;
- int xn=0;
- int maskonly;
- // int xfmti;
- char *xfmts;
- char *xfmt;
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- unsigned short sval;
- unsigned int xval;
- longlong lval;
- float fval;
- double dval;
-
- /* get maskonly flag */
- maskonly = dmode & DMODE_MASKONLY;
-
- if( maskonly )
- ind = NFORMAT-1;
- else{
- if( (ind = Index(type)) == -1 )
- ind = NFORMAT-1;
- }
-
- /* see values for format */
- xfmts = fmts[ind];
- // xfmti = fmti[ind];
- xfmt = fmt[ind];
- /* some columns don't have a name */
- if( !name )
- name = "";
- /* see if we have a column format and overwrite format values if so */
- else{
- for(i=0; i<ncolfmt; i++){
- if( !strcasecmp(name, colfmts[i].name) ){
- xfmts = colfmts[i].fmts;
- // xfmti = colfmts[i].fmti;
- xfmt = colfmts[i].fmt;
- break;
- }
- }
- }
-
- /* for bitfields, we process bytes */
- if( type == 'X' ){
- if( n == 16 ){
- xn = 1;
- n = 1;
- }
- else if( n == 32 ){
- xn = 2;
- n = 1;
- }
- else{
- xn = 0;
- n = (n+7)/8;
- }
- }
- for(i=0; i<n; i++){
- if( i && !maskonly ) fprintf(fp, " ");
- switch(type){
- case 'X':
- switch(xn){
- case 1:
- memcpy(&sval, buf, sizeof(unsigned short));
- xval = (unsigned int)sval;
- break;
- case 2:
- memcpy(&xval, buf, sizeof(unsigned int));
- break;
- case 0:
- default:
- xval = (unsigned int)*(unsigned char *)buf;
- break;
- }
- if( maskonly && !ival ){
- fprintf(fp, xfmts, ".");
- }
- else{
- /* make sure 0x is prepended to the hex value */
- tbuf[0] = '0';
- tbuf[1] = 'x';
- snprintf(&tbuf[2], SZ_LINE-2, "%x", xval);
- if( (strlen(tbuf) >= 4) && (tbuf[2] == '0') &&
- ((tbuf[3] == 'x') || (tbuf[3] == 'X')) )
- fprintf(fp, xfmt, &tbuf[2]);
- else
- fprintf(fp, xfmt, tbuf);
- }
- switch(xn){
- case 1:
- buf += sizeof(unsigned short);
- break;
- case 2:
- buf += sizeof(unsigned int);
- break;
- case 0:
- default:
- buf += sizeof(unsigned char);
- break;
- }
- break;
- case 'B':
- case 8:
- ival = (int)*(unsigned char *)buf;
- if( maskonly && !ival )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, ival);
- buf += sizeof(unsigned char);
- break;
- case 'I':
- case 16:
- ival = (int)*(short *)buf;
- if( maskonly && !ival )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, ival);
- buf += sizeof(short);
- break;
- case 'U':
- case -16:
- ival = (int)*((unsigned short *)buf);
- if( maskonly && !ival )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, ival);
- buf += sizeof(unsigned short);
- break;
- case 'J':
- case 32:
- ival = *(int *)buf;
- if( maskonly && !ival )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, ival);
- buf += sizeof(int);
- break;
- case 'K':
- case 64:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- lval = *(longlong *)buf;
- if( maskonly && !lval )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, lval);
- buf += sizeof(longlong);
- break;
- case 'V':
- ival = *(unsigned int *)buf;
- if( maskonly && !ival )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, ival);
- buf += sizeof(unsigned int);
- break;
- case 'E':
- case -32:
- fval = *(float *)buf;
- if( maskonly && (fval==0) )
- fprintf(fp, xfmts, ".");
- else if( maskonly )
- fprintf(fp, xfmt, (int)fval);
- else
- fprintf(fp, xfmt, fval);
- buf += sizeof(float);
- break;
- case 'D':
- case -64:
- dval = *(double *)buf;
- if( maskonly && (dval==0) )
- fprintf(fp, xfmts, ".");
- else if( maskonly )
- fprintf(fp, xfmt, (int)dval);
- else
- fprintf(fp, xfmt, dval);
- buf += sizeof(double);
- break;
- case 'A':
- if( maskonly && !*buf )
- fprintf(fp, xfmts, ".");
- else if( maskonly )
- fprintf(fp, "%c", *buf);
- else{
- if( dmode & DMODE_RDB ){
- fprintf(fp, xfmt, buf);
- }
- else{
- /* make sure we have enough room */
- if( (n+3) >= SZ_LINE) n = SZ_LINE-3;
- /* enclose string in single quotes */
- strncpy(tbuf, "'", SZ_LINE-1);
- memmove(&tbuf[1], buf, n);
- strncat(tbuf, "'", SZ_LINE-1);
- snprintf(tbuf2, SZ_LINE-1, xfmt, tbuf);
- /* make sure we end with a single quote */
- if( tbuf2[strlen(tbuf2)-1] != '\'' )
- tbuf2[strlen(tbuf2)-1] = '\'';
- fprintf(fp, "%s", tbuf2);
- }
- }
- i += n;
- break;
- case 'L':
- ival = (int)*(unsigned char *)buf;
- if( maskonly ){
- if( !ival || (ival == 'F') || (ival == 'f') )
- fprintf(fp, xfmts, ".");
- else
- fprintf(fp, xfmt, "T");
- }
- else{
- if( !ival || (ival == 'F') || (ival == 'f') )
- fprintf(fp, xfmt, "F");
- else
- fprintf(fp, xfmt, "T");
- }
- buf += sizeof(char);
- break;
- default:
- fprintf(fp, xfmts, "?");
- break;
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s [-f format] [-l] [-n] [-T] iname [columns|bitpix=n]\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -f 'format' # format definitions for table columns\n");
- fprintf(stderr, " -l # display image as a list containing the columns X, Y, VAL\n");
- fprintf(stderr, " -n # don't output header\n");
- fprintf(stderr, " -F [c] # use specified character as column separator (def: space)\n");
- fprintf(stderr, " -T # output in rdb/starbase format (tab separators)\n");
- fprintf(stderr, "For tables, columns to display can be specified.\n");
- fprintf(stderr, "For images, data type (bitpix) of display can be specified.\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i, j, k;
- int args;
- int got;
- int type;
- int x0;
- int y0;
- int dim1;
- int dim2;
- int block;
- int bitpix;
- int dtype;
- int scaled;
- int ibitpix;
- int rowsize;
- int val;
- int ncol=0;
- int dmode=0;
- int dolist=0;
- int dohead=1;
- size_t size;
- char *mode=NULL;
- char *formatstr=NULL;
- char *actcols=NULL;
- char *vfmt=NULL;
- char *s;
- char *buf;
- char *ebuf;
- char *eptr;
- char *mbuf;
- char tbuf[SZ_LINE];
- char **names=NULL;
- char **tdims=NULL;
- int *types=NULL;
- int *modes=NULL;
- int *ns=NULL;
- int *offsets=NULL;
- double dval;
- Fun fun;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process the type of data we have */
- /* process switch arguments */
- while ((c = getopt(argc, argv, "f:lnF:T")) != -1){
- switch(c){
- case 'f':
- formatstr = xstrdup(optarg);
- break;
- case 'l':
- dolist = 1;
- break;
- case 'n':
- dohead = 0;
- break;
- case 'F':
- coldelim = *optarg;
- break;
- case 'T':
- dmode |= DMODE_RDB;
- coldelim = '\t';
- break;
- }
- }
-
- args = argc - optind;
- if( args < 1 ) usage(argv[0]);
-
- /* seed the format buffers with the default values */
- for(i=0; i<NFORMAT; i++){
- fmti[i] = _fmti[i];
- fmts[i] = xstrdup(_fmts[i]);
- fmt[i] = xstrdup(_fmt[i]);
- }
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[optind], "r", NULL)) )
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- argv[optind]);
-
- /* determine which type of data we have */
- FunInfoGet(fun, FUN_TYPE, &type, 0);
-
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- /* set mode if present (i.e., bitpix) */
- if( args >= 2 ){
- mode = argv[optind+1];
- }
- else{
- /* if not present and if the data is scaled and int, read it as float */
- FunInfoGet(fun,
- FUN_SCALED, &scaled,
- FUN_DTYPE, &dtype,
- 0);
- if( scaled && (dtype>=-2) )
- mode = "bitpix=-32";
- }
- /* see if we want only the mask */
- mbuf = xstrdup(mode);
- if( _FunKeyword(mbuf, "mask", "FUN_MASK", tbuf, SZ_LINE) ){
- if( !strcasecmp(tbuf, "all") )
- dmode |= DMODE_MASKONLY;
- }
- if( mbuf ) xfree(mbuf);
- /* extract and bin the data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, mode)) )
- gerror(stderr, "can't FunImageGet: %s\n", argv[optind]);
- /* get required information from funtools structure.
- this should come after the ImageGet call, in case that call
- changed fun_sect_bitpix value */
- FunInfoGet(fun,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- FUN_SECT_X0, &x0,
- FUN_SECT_Y0, &y0,
- FUN_SECT_BLOCK, &block,
- FUN_SECT_BITPIX, &bitpix,
- FUN_BITPIX, &ibitpix,
- 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2 == 0 ) dim2 = 1;
- /* display header */
- if( dolist ){
- if( dmode & DMODE_MASKONLY )
- gerror(stderr, "'list' and 'maskonly' are mutually exclusive\n");
- if( dohead ){
- Header(stdout, dmode, "X", 'J', 1, NULL);
- fprintf(stdout, "%c", coldelim);
- Header(stdout, dmode, "Y", 'J', 1, NULL);
- fprintf(stdout, "%c", coldelim);
- Header(stdout, dmode, "VALUE", bitpix, 1, NULL);
- fprintf(stdout, "%c", '\n');
- Dashes(stdout, dmode, NULL, 'J', 1);
- fprintf(stdout, "%c", coldelim);
- Dashes(stdout, dmode, NULL, 'J', 1);
- fprintf(stdout, "%c", coldelim);
- Dashes(stdout, dmode, NULL, bitpix, 1);
- fprintf(stdout, "%c", '\n');
- }
- if( ft_sizeof(bitpix) )
- size = ft_sizeof(bitpix);
- else
- size = ft_sizeof(ibitpix);
- /* print out values */
- for(i=0; i<dim2; i++){
- for(j=0; j<dim1; j++){
- val = j + x0;
- Display(stdout, dmode, NULL, 32, 1, (char *)&val);
- fprintf(stdout, "%c", coldelim);
- val = i + y0;
- Display(stdout, dmode, NULL, 32, 1, (char *)&val);
- fprintf(stdout, "%c", coldelim);
- Display(stdout, dmode, "VALUE",
- bitpix, 1, buf+((i*dim1+j)*size));
- fprintf(stdout, "\n");
- }
- }
- }
- else{
- if( dmode & DMODE_RDB )
- gerror(stderr, "'table' mode is only for tables or 'list' images\n");
- /* output header */
- fprintf(stdout, " ");
- for(i=0; i<dim1; i++){
- if( block == 1 ){
- snprintf(tbuf, SZ_LINE-1, "%d", x0+i);
- if( i )
- fprintf(stdout, "%c", coldelim);
- Header(stdout, dmode, tbuf, bitpix, 1, NULL);
- }
- else{
- for(dval=0.0, j=0; j<block; j++){
- dval += j;
- }
- dval /= block;
- snprintf(tbuf, SZ_LINE-1, "%8.1f", y0 + (i * block) + dval);
- if( i )
- fprintf(stdout, "%c", coldelim);
- Header(stdout, dmode, tbuf, bitpix, 1, NULL);
- }
- }
- fprintf(stdout, "\n");
- /* output dashes */
- fprintf(stdout, " ");
- for(i=0; i<dim1; i++){
- if( i )
- fprintf(stdout, "%c", coldelim);
- Dashes(stdout, dmode, NULL, bitpix, 1);
- }
- fprintf(stdout, "\n");
- /* print out values */
- for(i=dim2-1; i>=0; i--){
- if( block == 1 ){
- fprintf(stdout, "%8d:", y0+i);
- }
- else{
- for(dval=0.0, j=0; j<block; j++){
- dval += j;
- }
- dval /= block;
- fprintf(stdout, "%8.1f:", y0 + (i * block) + dval);
- }
- if( ft_sizeof(bitpix) )
- size = ft_sizeof(bitpix);
- else
- size = ft_sizeof(ibitpix);
- for(j=0; j<dim1; j++){
- fprintf(stdout, "%c", coldelim);
- Display(stdout, dmode, NULL,
- bitpix, 1, buf+((i*dim1+j)*size));
- }
- fprintf(stdout, "\n");
- }
- }
- /* free up space */
- if( buf ) xfree(buf);
- break;
-
- case FUN_TABLE:
- case FUN_EVENTS:
- /* set activate specified output columns */
- if( args >= 2 ) actcols = argv[optind+1];
- FunColumnActivate(fun, actcols, NULL);
-
- /* if we specified columns, we also can specify "mask=transparent"
- and get all events, with the regionid (assuming we specified
- the region column to display as well) */
- if( args >= 3 ){
- mode = argv[optind+2];
- }
- FunInfoGet(fun,
- FUN_ROWSIZE, &rowsize,
- FUN_NCOL, &ncol,
- 0);
- /* get information for each column */
- names = (char **)xcalloc(ncol, sizeof(char *));
- tdims = (char **)xcalloc(ncol, sizeof(char *));
- types = (int *)xcalloc(ncol, sizeof(int));
- modes = (int *)xcalloc(ncol, sizeof(int));
- ns = (int *)xcalloc(ncol, sizeof(int));
- offsets = (int *)xcalloc(ncol, sizeof(int));
- for(i=0; i<ncol; i++){
- FunColumnLookup(fun, NULL, i, &names[i],
- &types[i], &modes[i], &offsets[i], &ns[i], NULL);
- /* get tdim, if available */
- tdims[i] = FunParamGets(fun, "TDIM", i+1, NULL, &got);
- /* use dynamically allocated names ... */
- names[i] = xstrdup(names[i]);
- /* ... since might have to change "$region" to something else */
- if( names[i] && !strcasecmp(names[i], COL_REGION_NAME) ){
- xfree(names[i]);
- /* best to use "region", if its not already used */
- if( !FunColumnLookup(fun, COL_REGION_ONAME, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) )
- names[i] = xstrdup(COL_REGION_ONAME);
- /* otherwise use region<n>, using the first free int value for <n> */
- else{
- for(j=1; ; j++){
- snprintf(tbuf, SZ_LINE-1, "%s%d", COL_REGION_ONAME, j);
- if( !FunColumnLookup(fun, tbuf, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- names[i] = xstrdup(tbuf);
- break;
- }
- }
- }
- }
- /* ... since might have to change "$n" to something else */
- if( names[i] && !strcasecmp(names[i], COL_NUM_NAME) ){
- xfree(names[i]);
- /* best to use "n", if its not already used */
- if( !FunColumnLookup(fun, COL_NUM_ONAME, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) )
- names[i] = xstrdup(COL_NUM_ONAME);
- /* otherwise use region<n>, using the first free int value for <n> */
- else{
- for(j=1; ; j++){
- snprintf(tbuf, SZ_LINE-1, "%s%d", COL_NUM_ONAME, j);
- if( !FunColumnLookup(fun, tbuf, 0,
- NULL, NULL, NULL, NULL, NULL, NULL) ){
- names[i] = xstrdup(tbuf);
- break;
- }
- }
- }
- }
- }
-
- /* if we have a formatstring, we need to process it now */
- if( formatstr ){
- Format(formatstr, names, ncol);
- }
- /* otherwise look for a view format or an environment variable */
- else{
- FunInfoGet(fun, FUN_VFMT, &vfmt, 0);
- if( vfmt ){
- Format(vfmt, names, ncol);
- }
- /* look for environment variable */
- else if( (s=getenv("FUN_FORMAT")) != NULL ){
- Format(s, names, ncol);
- }
- }
-
- /* output header, if necessary */
- if( dohead ){
- /* output header */
- for(i=0, j=0; i<ncol; i++){
- if( !(modes[i]&COL_ACTIVE) )
- continue;
- if( j )
- fprintf(stdout, "%c", coldelim);
- Header(stdout, dmode, names[i], types[i], ns[i], tdims[i]);
- j++;
- }
- fprintf(stdout, "\n");
- fflush(stdout);
-
- /* output dashes */
- for(i=0, j=0; i<ncol; i++){
- if( !(modes[i]&COL_ACTIVE) )
- continue;
- if( j )
- fprintf(stdout, "%c", coldelim);
- Dashes(stdout, dmode, names[i], types[i], ns[i]);
- j++;
- }
- fprintf(stdout, "\n");
- fflush(stdout);
- }
-
- /* for each event, display each specified column */
- while( (ebuf = FunTableRowGet(fun, NULL, maxrow, mode, &got)) ){
- for(k=0; k<got; k++){
- eptr = (char *)(ebuf+(rowsize*k));
- for(i=0, j=0; i<ncol; i++){
- if( !(modes[i]&COL_ACTIVE) )
- continue;
- if( j )
- fprintf(stdout, "%c", coldelim);
- Display(stdout, dmode, names[i], types[i], ns[i], eptr+offsets[i]);
- j++;
- }
- fprintf(stdout, "\n");
- fflush(stdout);
- }
- xfree(ebuf);
- }
- break;
- }
-
- /* free up alloc'ed space */
- if( names ){
- for(i=0; i<ncol; i++)
- if( names[i] ) xfree(names[i]);
- xfree(names);
- }
- if( tdims ){
- for(i=0; i<ncol; i++)
- if( tdims[i] ) xfree(tdims[i]);
- xfree(tdims);
- }
- if( types ) xfree(types);
- if( modes ) xfree(modes);
- if( ns ) xfree(ns);
- if( offsets ) xfree(offsets);
- if( formatstr ) xfree(formatstr);
- /* free the format buffers */
- for(i=0; i<NFORMAT; i++){
- if( fmts[i] ) xfree(fmts[i]);
- if( fmt[i] ) xfree(fmt[i]);
- }
- /* free column format data */
- for(i=0; i<ncolfmt; i++){
- if( colfmts[ncolfmt].name ) xfree(colfmts[ncolfmt].name);
- if( colfmts[ncolfmt].fmts ) xfree(colfmts[ncolfmt].fmts);
- if( colfmts[ncolfmt].fmt ) xfree(colfmts[ncolfmt].fmt);
- }
- /* close file */
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funds9.tmpl b/funtools/funds9.tmpl
deleted file mode 100755
index 4c0d7e4..0000000
--- a/funtools/funds9.tmpl
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/bin/sh
-# set -x
-
-# make sure we have minimum arg count
-if [ $# -lt 3 ]; then
- echo "funds9 [cmd] [xpa] [filename or filelist] [args ...]"
- exit 1
-fi
-
-# don't use gnuplot by default
-DOGP=0
-# disable multi-file support -- it conflicts with spaced directory support
-DOMULTI=0
-
-# process standard arguments
-CMD="$1"; shift;
-XPA="$1"; shift;
-FILES="$1"; shift;
-
-if [ x$DOMULTI = x1 ]; then
- if [ "GNUPLOT" != "NONE" ]; then
- NFILES=`echo $FILES | AWK '{print NF}'`
- if [ $NFILES -gt 1 ]; then
- VERSION=`echo "show version" | gnuplot 2>&1 | grep version | AWK '{print $3*10}'`
- if [ x"$VERSION" != x -a $VERSION -ge 37 ]; then
- DOGP=1
- fi
- fi
- fi
-else
- FILE="$FILES"
-fi
-
-# process commands
-case $CMD in
-
-funcnts)
- if [ $# = 0 ]; then
- echo "ERROR: funcnts filename [source] [bkgd]"
- exit 1
- fi
- if [ x$DOMULTI = x1 ]; then
- for FILE in $FILES; do
- funcnts "$FILE" $* 2>&1
- done
- else
- funcnts "$FILE" $* 2>&1
- fi
- exit 0
- ;;
-
-funhist)
- if [ $# != 3 ]; then
- echo "ERROR: funhist filename [norm width] [column] [bin]"
- exit 1
- fi
- ARGS=""
- PARAM=$1; shift;
- read NORM WIDTH <<EOF
- $PARAM
-EOF
- if [ $NORM = 1 ]; then
- ARGS="$ARGS -n"
- fi
- if [ $WIDTH = 1 ]; then
- ARGS="$ARGS -w"
- fi
- if [ x$DOMULTI = x1 ]; then
- for FILE in $FILES; do
- funhist $ARGS "$FILE" $* 2>&1
- done
- else
- funhist $ARGS "$FILE" $* 2>&1
- fi
- exit 0
- ;;
-
-funcnts_plot)
- if [ $# = 0 ]; then
- echo "ERROR: funcnts filename [source] [bkgd]"
- exit 1
- fi
- if [ x$DOMULTI = x1 ]; then
- for FILE in $FILES; do
- if [ $DOGP = 1 ]; then
- funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" gnuplot
- else
- funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" ds9 2>&1
- fi
- done
- else
- if [ $DOGP = 1 ]; then
- funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" gnuplot
- else
- funcnts -rG "$FILE" $* | funcnts.plot -file "$FILE" ds9 2>&1
- fi
- fi
- exit 0
- ;;
-
-funhist_plot)
- if [ $# != 3 ]; then
- echo "ERROR: funhist filename [norm width] [column] [bin]"
- exit 1
- fi
- ARGS=""
- PARAM=$1; shift;
- read NORM WIDTH <<EOF
- $PARAM
-EOF
- if [ $NORM = 1 ]; then
- ARGS="$ARGS -n"
- fi
- if [ $WIDTH = 1 ]; then
- ARGS="$ARGS -w"
- fi
- if [ x$DOMULTI = x1 ]; then
- for FILE in $FILES; do
- if [ $DOGP = 1 ]; then
- funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" gnuplot
- else
- funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" ds9 2>&1
- fi
- done
- else
- if [ $DOGP = 1 ]; then
- funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" gnuplot
- else
- funhist $ARGS "$FILE" $* | funhist.plot -file "$FILE" ds9 2>&1
- fi
- fi
- exit 0
- ;;
-
-funcen)
- if [ $# != 5 ]; then
- echo "ERROR: funcen filename region(s) niter tol disp ftype"
- exit 1
- fi
- ARGS=""
- REGION=$1; shift;
- if [ x"$REGION" = x ]; then
- echo "ERROR: no region(s) specified"
- exit 1
- fi
- NITER=$1; shift;
- TOL=$1; shift;
- DISP=$1; shift;
- FTYPE=$1; shift;
- if [ "$FTYPE" = 1 ]; then
- ARGS="$ARGS -i"
- fi
- VERB=1
- TMP="/tmp/fun_${CMD}_$$.out"
- if [ x$DOMULTI = x1 ]; then
- for FILE in $FILES; do
- funcen $ARGS -n $NITER -t $TOL -v $VERB "$FILE" "$REGION" $* 2>&1 > $TMP
- cat $TMP
- if [ $DISP = "1" ]; then
- xpaset -p $XPA regions deleteall
- grep final_region $TMP | AWK '{print $2}'| xpaset $XPA regions
- fi
- done
- else
- funcen $ARGS -n $NITER -t $TOL -v $VERB "$FILE" "$REGION" $* 2>&1 > $TMP
- cat $TMP
- if [ $DISP = "1" ]; then
- xpaset -p $XPA regions deleteall
- grep final_region $TMP | AWK '{print $2}'| xpaset $XPA regions
- fi
- fi
- exit 0
- ;;
-
-*)
- echo "ERROR: unknown function: " "$CMD"
- exit 1
- ;;
-esac
-
diff --git a/funtools/funhead.c b/funtools/funhead.c
deleted file mode 100644
index 1ba03f5..0000000
--- a/funtools/funhead.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Copyright (c) 1999-2005 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-
-#define BLANK " "
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-static int
-_FunHeadEdit(char *iname, char *oname, char *ename)
-#else
- static int _FunHeadEdit(iname, oname, ename)
- char *iname;
- char *oname;
- char *ename;
-#endif
-{
- int i;
- int type;
- int dim2;
- int action=1;
- int got=0;
- int put=0;
- int pgot=0;
- char *ev;
- char *eptr=NULL;
- char ebuf[SZ_LINE];
- char key[SZ_LINE];
- char val[SZ_LINE];
- char com[SZ_LINE];
- char tfile[SZ_LINE];
- char tbuf[SZ_LINE];
- char *buf=NULL;
- Fun ifun=NULL;
- Fun ofun=NULL;
- GIO efd=NULL;
- FITSHead header=NULL, theader=NULL;
- FITSCard card;
-
- /* sanity check */
- if( !*iname || !*ename ) return 0;
-
- /* temp file if no output name is given */
- if( !oname ){
- if( !mkrtemp("fun", ".fits", tfile, SZ_LINE, 0) ){
- gerror(stderr, "can't open temp file for param editing\n");
- }
- oname = tfile;
- }
-
- /* open file(s) */
- if( !(efd = gopen(ename, "r")) ){
- gerror(stderr, "can't open edit file: %s\n", ename);
- }
- if( !(ifun = FunOpen(iname, "rC", NULL)) ){
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
- }
- if( !(ofun = FunOpen(oname, "w", ifun)) ){
- gerror(stderr, "can't FunOpen output file: %s\n",
- oname);
- }
-
- /* we write into the temp space of the output header */
- FunInfoGet(ifun, FUN_HEADER, &header, FUN_TYPE, &type, 0);
- FunInfoGet(ofun, FUN_THEADER, &theader, 0);
-
- /* read and process the edit commands */
- while( ggets (efd, ebuf, SZ_LINE) ){
- eptr = ebuf;
- /* skip comments and blank lines */
- if( (*eptr == '#') || (*eptr == '\n') ) continue;
- /* skip whitespace */
- while( isspace((int)*eptr) ) eptr++;
- /* check for action type */
- switch((int)*eptr){
- case '-':
- action = 1;
- eptr++;
- break;
- case '?':
- action = 2;
- eptr++;
- break;
- default:
- action = 3;
- break;
- }
- /* analyze string */
- pgot = FunTextParam(NULL, eptr, key, val, com, SZ_LINE);
- /* key is always upper case */
- cluc(key);
- /* process action for this parameter */
- switch(action){
- case 1:
- /* delete the parameter */
- if( (card=ft_headfind(theader, key, 0, 0)) && *card->c ){
- ft_headdel(theader, key, 0);
- }
- else if( (card=ft_headfind(header, key, 0, 0)) && *card->c ){
- ft_headdel(header, key, 0);
- }
- else{
- fprintf(stdout, "WARNING: %s not found\n", key);
- }
- break;
- case 2:
- /* display the parameter */
- if( ((card=ft_headfind(theader, key, 0, 0)) && *card->c) ||
- ((card=ft_headfind(header, key, 0, 0)) && *card->c) ){
- strncpy(tbuf, card->c, FT_CARDLEN);
- tbuf[FT_CARDLEN] = '\0';
- fprintf(stdout, "%s\n", tbuf);
- }
- else{
- fprintf(stdout, "WARNING: %s not found\n", key);
- }
- fflush(stdout);
- break;
- case 3:
- /* add or modify the parameter */
- FunTextParamHeader(theader, eptr, key, val, com, pgot);
- break;
- default:
- break;
- }
- }
- if( efd ) gclose(efd);
-
- /* copy data */
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- FunInfoGet(ifun, FUN_SECT_DIM2, &dim2, 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2 == 0 ) dim2 = 1;
- /* copy the image from input to output */
- for(i=1; i<=dim2; i++){
- /* extract image row by row */
- if( !(buf = FunImageRowGet(ifun, buf, i, i, NULL)) )
- gerror(stderr, "can't FunImageRowGet: %s\n", iname);
- /* write output image row by row */
- if( !FunImageRowPut(ofun, buf, i, i, 0, 0, 0, NULL) )
- gerror(stderr, "can't FunImageRowPut: %s\n", oname);
- }
- if( buf ) xfree(buf);
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- /* copy the events from input to output */
- while( (ev = FunTableRowGet(ifun, NULL, maxrow, NULL, &got)) ){
- if( (put=FunTableRowPut(ofun, ev, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- if( ev ) xfree(ev);
- }
- break;
- }
-
- /* flush and close files */
- if( ofun ) FunClose(ofun);
- if( ifun ) FunClose(ifun);
- return 0;
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s [-a] [-s] [-t] [-L] iname[ext] [oname ename]\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -a # display all extension headers\n");
- fprintf(stderr, " -s # display 79 chars instead of 80 before the new-line \n");
- fprintf(stderr, " -t # prepend data type char to each line of output\n");
- fprintf(stderr, " -L # output in rdb/starbase list format\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i;
- int args;
- int got;
- int clen=0;
- int extno=0;
- int doall=0;
- int dotype=0;
- int dolist=0;
- int rcode=0;
- char *s, *t;
- char *ind;
- char *fmt="%.80s\n";
- char *iname=NULL;
- char *oname=NULL;
- char *ename=NULL;
- char *cname=NULL;
- Fun fun;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "astL")) != -1){
- switch(c){
- case 'a':
- doall = 1;
- break;
- case 's':
- fmt = "%.79s\n";
- break;
- case 't':
- dotype = 1;
- fmt = "%.77s\n";
- break;
- case 'L':
- dolist = 1;
- break;
- }
- }
-
- /* get maxrow,if user-specified */
- if( (s=(char *)getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* check for required arguments */
- args = argc - optind;
- if( (args != 1) && (args != 3) ) usage(argv[0]);
-
- /* input file name */
- iname = xstrdup(argv[optind+0]);
-
- /* edit expression right here and exit */
- if( args >= 2 ){
- if( args >= 3 ){
- oname = xstrdup(argv[optind+1]);
- ename = xstrdup(argv[optind+2]);
- }
- else{
- ename = xstrdup(argv[optind+1]);
- }
- rcode = _FunHeadEdit(iname, oname, ename);
- goto done;
- }
-
- /* if we are doing all extensions, remove bracket specifcation from base */
- if( doall ){
- if( (ind=strchr(iname, '[')) || (ind=strchr(iname, ',')) ){
- *ind = '\0';
- }
- }
-
- /* set up current name */
- clen = strlen(iname) + SZ_LINE;
- cname = xcalloc(clen, sizeof(char));
-
- /* set up the first extension */
- if( doall ){
- snprintf(cname, clen, "%s[%d]", iname, extno);
- extno++;
- }
- else{
- strncpy(cname, iname, clen);
- }
-
-again:
- /* open the input FITS extension */
- if( !(fun = FunOpen(cname, "r", NULL)) ){
- /* if we are doing all extension, an error means we are done */
- if( doall )
- return(0);
- /* not doing all, so if no extension was given, try primary */
- if( !strchr(iname, '[') && !strchr(iname, ',') ){
- snprintf(cname, clen, "%s[0]", iname);
- if( !(fun = FunOpen(cname, "r", NULL)) )
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
- }
- else{
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
- }
- }
-
-
- if ( dolist ) {
- fprintf(stdout, "\n");
- fprintf(stdout, "FITSNAME\t%s\n", iname);
- } else {
- /* get extension name */
- if( (s=FunParamGets(fun, "EXTNAME", 0, NULL, &got)) ){
- fprintf(stdout, "\t\tExtension: %s", s);
- if( (t=FunParamGets(fun, "HDUNAME", 0, NULL, &got)) )
- fprintf(stdout, "/%s", t);
- fprintf(stdout, "\n\n");
- if( s ) xfree(s);
- if( t ) xfree(t);
- }
- }
-
- /* display cards */
- for(i=1; ;i++){
- if( (s = FunParamGets(fun, NULL, i, NULL, &got)) ){
- if( dolist ) {
- if( strncmp(s, " ", 8) ) {
- /* John did this -- its not my fault */
- fprintf(stdout, "%8.8s\t%s\n", s,
- (char *)ft_cardget((FITSCard)s));
- }
- } else {
- if( dotype )
- fprintf(stdout, "%c ", got);
- fprintf(stdout, fmt, s);
- }
- xfree(s);
- }
- else{
- break;
- }
- }
- fflush(stdout);
-
- /* close file */
- FunClose(fun);
-
- /* if we are processing all extensions, go back for more */
- if( doall ){
- snprintf(cname, clen, "%s[%d]", iname, extno);
- extno++;
- goto again;
- }
-
-done:
- /* clean up */
- if( iname ) xfree(iname);
- if( oname ) xfree(oname);
- if( cname ) xfree(cname);
- if( ename ) xfree(ename);
-
- return(rcode);
-}
diff --git a/funtools/funhist.c b/funtools/funhist.c
deleted file mode 100644
index 88f6d35..0000000
--- a/funtools/funhist.c
+++ /dev/null
@@ -1,632 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <math.h>
-#include <funtoolsP.h>
-#include <filter.h>
-#include <word.h>
-
-static char *dash="----------------------------------------";
-
-extern char *optarg;
-extern int optind;
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-int cold=' ';
-
-#ifdef ANSI_FUNC
-void
-GetArgs (int argc, char **argv, int arg,
- double *tlmin, double *tlmax, double *dval, int *got1, int *got2)
-#else
-void GetArgs(argc, argv, arg, tlmin, tlmax, dval, got1, got2)
- int argc;
- char **argv;
- int arg;
- double *tlmin;
- double *tlmax;
- double *dval;
- int *got1;
- int *got2;
-#endif
-{
- int ip=0;
- int n;
- char tbufs[3][SZ_LINE];
-
- /* process the appropriate argument */
- if( argc > arg ){
- /* collect arguments: bins, or lo:hi, or lo:hi:bins */
- newdtable(",:)");
- for(n=0; (n<3) && word(argv[arg], tbufs[n], &ip); n++)
- ;
- freedtable();
- /* process arguments */
- switch(n){
- case 0:
- break;
- case 1:
- *dval = atof(tbufs[0]);
- break;
- case 2:
- *tlmin = atof(tbufs[0]);
- *tlmax = atof(tbufs[1]);
- *got1 = 1;
- *got2 = 1;
- break;
- case 3:
- *tlmin = atof(tbufs[0]);
- *tlmax = atof(tbufs[1]);
- *got1 = 1;
- *got2 = 1;
- *dval = atof(tbufs[2]);
- break;
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s [-n|-w|-T] iname [column|x|y|xy] [[lo_edge:hi_edge:]bins]\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -n # normalize bin value by the width of each bin\n");
- fprintf(stderr, " -w # specify bin width instead of number of bins in arg3\n");
- fprintf(stderr, " -T # output in rdb/starbase format (tab separators)\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i, j;
- int in, ix, iy;
- int arg, args;
- int idx;
- int got;
- int nrow;
- int rsize;
- int bitpix;
- int x0, y0;
- int x1, y1;
- int block;
- int dim1, dim2;
- int dtype;
- int type;
- int lasty=0;
- int obins=0;
- int got1=0, got2=0;
- int gotimage=0;
- int doproj = 0;
- int donorm = 0;
- int dowidth = 0;
- int nmask=0;
- int nreg=0;
- char *s;
- char *iname;
- char *col;
- char *filtstr=NULL;
- char *bincols=NULL;
- char tbuf[SZ_LINE];
- double tlmin=0, tlmax=0;
- double tlwidth, tlinc;
- double lo, hi;
- double dval=0.0;
- double *buf=NULL, *rbuf=NULL, *rptr=NULL;
- Filter filter;
- FilterMask masks=NULL;
- FITSHead header=NULL;
- Fun fun=NULL;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "nwT")) != -1){
- switch(c){
- case 'n':
- donorm = 1;
- break;
- case 'w':
- dowidth = 1;
- break;
- case 'T':
- cold = '\t';
- break;
- }
- }
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* process arguments */
- /* check for required arguments */
- args = argc - optind;
- if( args < 1 ) usage(argv[0]);
- iname = argv[optind+0];
- /* open the input FITS file */
- if( !(fun = FunOpen(iname, "r", NULL)) )
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
- /* make sure we have the right type of input file */
- FunInfoGet(fun, FUN_TYPE, &type, 0);
-
- /* process the different types */
- switch(type){
- case FUN_TABLE:
- case FUN_EVENTS:
- if( args < 2 ) usage(argv[0]);
- /* get column */
- col = argv[optind+1];
- /* make sure we can find the specified column */
- if( !(idx = FunColumnLookup(fun, col, 0, NULL,
- &dtype, NULL, NULL, NULL, NULL)) )
- gerror(stderr, "can't find specified column: %s\n", col);
- /* get tlmin/tlmax, etc. */
- GetArgs(argc, argv, optind+2, &tlmin, &tlmax, &dval, &got1, &got2);
- if( dowidth && (dval<=0) )
- gerror(stderr, "-w requires a positive bin width value\n");
- else
- obins = (int)dval;
- /* select column to read */
- FunColumnSelect(fun, sizeof(double), NULL, col, "D", "r", 0, NULL);
- /* for fp data, we cannot determine obins, so choose an arbitrary value */
- if( !dowidth && ((dtype == 'D') || (dtype == 'E')) && (obins <= 0) )
- obins = 128;
- /* read specified column for all rows into a double array */
- rsize = maxrow;
- rbuf = xmalloc(rsize*sizeof(double));
- rptr = rbuf;
- nrow = 0;
- while( 1 ){
- FunTableRowGet(fun, rptr, maxrow, NULL, &got);
- if( !got ) break;
- rsize += maxrow;
- rbuf = xrealloc(rbuf, rsize*sizeof(double));
- nrow += got;
- rptr = rbuf + nrow;
- }
- /* get tlmin value */
- if( !got1 ){
- snprintf(tbuf, SZ_LINE, "TLMIN%d", idx);
- tlmin = FunParamGetd(fun, tbuf, 0, 0.0, &got1);
- }
- /* get tlmax value */
- if( !got2 ){
- snprintf(tbuf, SZ_LINE, "TLMAX%d", idx);
- tlmax = FunParamGetd(fun, tbuf, 0, 0.0, &got2);
- }
- /* if we do not have tlmin or tlmax, we need to calculate them now */
- if( !got1 || !got2 ){
- if( !got1 ) tlmin = rbuf[0];
- if( !got2 ) tlmax = rbuf[0];
- for(i=0; i<nrow; i++){
- if( !got1 && (rbuf[i] < tlmin) ) tlmin = rbuf[i];
- if( !got2 && (rbuf[i] > tlmax) ) tlmax = rbuf[i];
- }
- /* add 1/2 bin to ends of float tlmin and tlmax */
- if( !got1 && ((dtype == 'D') || (dtype == 'E')) ) tlmin -= 0.5;
- if( !got2 && ((dtype == 'D') || (dtype == 'E')) ) tlmax += 0.5;
- }
- /* tlmin/tlmax are displayed as edges, even with int data */
- if( (dtype != 'D') && (dtype != 'E') ){
- tlmin -= 0.5;
- tlmax += 0.5;
- }
- /* width was specified instead of number of bins */
- if( dowidth ){
- tlinc = dval;
- obins = (int)((tlmax - tlmin)/tlinc);
- if( obins <= 0 )
- gerror(stderr, "calculated number of bins (%d) must be positive\n",
- obins);
- tlwidth = (double)obins*tlinc;
- if( tlwidth <= 0 )
- gerror(stderr, "calculated bin width (%.8f) must be positive\n",
- tlwidth);
- tlmax = tlmin+tlwidth;
- }
- else{
- /* get total number of input bins */
- tlwidth = tlmax - tlmin;
- /* calculate the number of output bins */
- if( obins <= 0 )
- obins = (int)tlwidth;
- /* this is the increment between each bin */
- tlinc = tlwidth/obins;
- if( tlwidth <= 0 )
- gerror(stderr, "bin width (%.8f) must be positive\n", tlwidth);
- }
-
- /* allocate bin buffer */
- if( !(buf=xcalloc(sizeof(double), obins)) )
- gerror(stderr, "can't allocate image buffer\n");
- /* bin up all rows */
- for(i=0; i<nrow; i++){
- if( (rbuf[i]<tlmin) || (rbuf[i]>tlmax) )
- continue;
- idx = (int)(((rbuf[i] - tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- buf[idx] += 1;
- }
- /* output header */
- fprintf(stdout, "# data file:\t\t%s\n", iname);
- fprintf(stdout, "# column:\t\t%s\n", col);
- fprintf(stdout, "# min,max,bins:\t\t%g %g %d\n", tlmin, tlmax, obins);
- if( dowidth )
- fprintf(stdout, "# user-specified width: %.8f\n", tlinc);
- if( donorm )
- fprintf(stdout, "# width normalization applied: %.8f\n", tlinc);
- fprintf(stdout, "\n");
- /* output data */
- if( donorm ){
- fprintf(stdout,
- "%6s%c%21s%c%21s%c%21s\n",
- "bin", cold, "value", cold, "lo_edge", cold, "hi_edge");
- fprintf(stdout,
- "%6.6s%c%21.21s%c%21.21s%c%21.21s\n",
- dash, cold, dash, cold, dash, cold, dash);
- }
- else{
- fprintf(stdout,
- "%6s%c%9s%c%21s%c%21s\n",
- "bin", cold, "value", cold, "lo_edge", cold, "hi_edge");
- fprintf(stdout,
- "%6.6s%c%9.9s%c%21.21s%c%21.21s\n",
- dash, cold, dash, cold, dash, cold, dash);
- }
- for(i=0; i<obins; i++){
- lo = tlmin+(i*tlinc);
- hi = tlmin+((i+1)*tlinc);
- if( donorm ){
- fprintf(stdout, "%6d%c%21.8f%c%21.8f%c%21.8f\n",
- i+1, cold, buf[i]/tlinc, cold, lo, cold, hi);
- }
- else{
- fprintf(stdout, "%6d%c%9d%c%21.8f%c%21.8f\n",
- i+1, cold, (int)buf[i], cold, lo, cold, hi);
- }
- }
- /* free up buffers */
- if( buf ) xfree(buf);
- if( rbuf ) xfree(rbuf);
- break;
-
- case FUN_IMAGE:
- case FUN_ARRAY:
- /* -w only useful for tabular data */
- if( dowidth )
- gerror(stderr, "specifying bin width (-w) not supported with images\n");
- /* determine if we are doing a proj on a single column or a histogram
- on the array values */
- arg = optind+1;
- if( args >=2 ){
- col = argv[optind+1];
- cluc(col);
- if( !strcasecmp(col, "X") || !strcasecmp(col, "Y") ){
- doproj = 1;
- arg = optind+2;
- }
- else if( !strcasecmp(col, "XY") || !strcasecmp(col, "YX") ){
- arg = optind+2;
- }
- else
- gerror(stderr, "can't find specified column: %s\n", col);
- }
- /* projection of a single axis */
- if( doproj ){
- /* get tlmin/tlmax, etc. */
- GetArgs(argc, argv, arg, &tlmin, &tlmax, &dval, &got1, &got2);
- obins = (int)dval;
- FunInfoGet(fun,
- FUN_SECT_BLOCK, &block,
- FUN_SECT_X0, &x0, FUN_SECT_Y0, &y0,
- FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2,
- 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2 == 0 ) dim2 = 1;
- /* get tlmin/tlmax values, etc. */
- if( tlmin <=0 )
- tlmin = 1;
- if( tlmax <=0 ){
- if( *col == 'X' )
- tlmax = dim1;
- else
- tlmax = dim2;
- }
- /* get total number of input bins */
- tlwidth = tlmax - tlmin + 1;
- /* calculate the number of output bins */
- if( obins <= 0 ){
- /* use input bin number as default */
- obins = (int)tlwidth;
- }
- tlinc = tlwidth/obins;
- /* allocate bin buffer */
- if( !(buf=xcalloc(sizeof(double), obins)) )
- gerror(stderr, "can't allocate image buffer\n");
- if( *col == 'X' ){
- for(i=1; i<=dim2; i++){
- if( !(rbuf = FunImageRowGet(fun, rbuf, i, i, "bitpix=-64")) )
- gerror(stderr, "can't FunImageRowGet: %s\n", iname);
- for(j=(int)tlmin; j<=(int)tlmax; j++){
- idx = (int)(((j-tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- buf[idx] += rbuf[j-1];
- }
- }
- }
- else{
- for(i=(int)tlmin; i<=(int)tlmax; i++){
- if( !(rbuf = FunImageRowGet(fun, rbuf, i, i, "bitpix=-64")) )
- gerror(stderr, "can't FunImageRowGet: %s\n", iname);
- idx = (int)(((i-tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- for(j=0; j<dim1; j++)
- buf[idx] += rbuf[j];
- }
- }
- /* output header */
- fprintf(stdout, "# data file:\t\t%s\n", iname);
- fprintf(stdout, "# column:\t\t%s\n", col);
- fprintf(stdout, "# min,max,bins:\t\t%g %g %d\n", tlmin, tlmax, obins);
- fprintf(stdout, "\n");
- /* output data */
- fprintf(stdout,
- "%6s%c%21s%c%21s%c%21s\n",
- "bin", cold, "value", cold, "lo_bin", cold, "hi_bin");
- fprintf(stdout,
- "%6.6s%c%21.21s%c%21.21s%c%21.21s\n",
- dash, cold, dash, cold, dash, cold, dash);
- for(i=0; i<obins; i++){
- fprintf(stdout, "%6d%c%21.8f%c%21.8f%c%21.8f\n",
- i+1, cold, buf[i], cold,
- ceil(tlmin+(i*tlinc)), cold, ceil(tlmin+((i+1)*tlinc))-1);
- }
- /* free up buffers */
- if( buf ) xfree(buf);
- if( rbuf ) xfree(rbuf);
- }
- /* histogram of the values in the image */
- else{
- /* get tlmin/tlmax, etc. */
- GetArgs(argc, argv, arg, &tlmin, &tlmax, &dval, &got1, &got2);
- obins = (int)dval;
- FunInfoGet(fun,
- FUN_FILTER, &filtstr, FUN_HEADER, &header,
- FUN_SECT_X0, &x0, FUN_SECT_Y0, &y0,
- FUN_SECT_X1, &x1, FUN_SECT_Y1, &y1,
- FUN_SECT_BLOCK, &block, FUN_BITPIX, &bitpix,
- FUN_BINCOLS, &bincols,
- FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2,
- 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2 == 0 ) dim2 = 1;
- /* get filter masks, if necessary */
- if( filtstr && *filtstr ){
- /* make up filter plist string */
- strcpy(tbuf, "type=image");
- /* add the binning key */
- if( bincols ){
- strcat(tbuf, ",");
- strcat(tbuf, bincols);
- }
- filter = FilterOpen(header, filtstr, tbuf);
- if( filter && (filter != NOFILTER) ){
- /* retrieve region mask segments */
- nmask = FilterImage(filter, x0, x1, y0, y1, block, &masks, &nreg);
- }
- FilterClose(filter);
- }
- /* if min/max not given on command line, look in data file */
- if( !got1 )
- tlmin=FunParamGetd(fun, "DATAMIN", 0, 0.0, &got1);
- if( !got2 )
- tlmax=FunParamGetd(fun, "DATAMAX", 0, 0.0, &got2);
- /* for image, we must have min/max values */
- if( !got1 || !got2 ){
- if( (rbuf = FunImageGet(fun, rbuf, "bitpix=-64")) ){
- if( nmask ){
- tlmin = MAXDBL;
- tlmax = MINDBL;
- /* loop through mask segments */
- for(in=0; in<nmask; in++){
- iy=masks[in].y;
- /* process each mask segment having the same y value */
- while(1){
- /* process columns in the mask */
- for(ix=masks[in].xstart; ix<=masks[in].xstop; ix++){
- i = ((iy-1)*dim1)+(ix-1);
- if( rbuf[i] < tlmin )
- tlmin = rbuf[i];
- if( rbuf[i] > tlmax )
- tlmax = rbuf[i];
- }
- /* if another mask segment has the same y, keep going */
- if( ((in+1)<nmask) && (masks[in+1].y==iy) )
- in++;
- else
- break;
- }
- }
- }
- else{
- tlmin = rbuf[0];
- tlmax = rbuf[0];
- for(i=0; i<dim1*dim2; i++){
- if( rbuf[i] < tlmin )
- tlmin = rbuf[i];
- if( rbuf[i] > tlmax )
- tlmax = rbuf[i];
- }
- }
- gotimage = 1;
- }
- else{
- gerror(stderr,
- "please supply min:max:bins (file is lacking DATAMIN/DATAMAX)\n");
- }
- }
- /* get total number of input bins */
- if( bitpix >= 0 )
- tlwidth = tlmax - tlmin + 1;
- else
- tlwidth = tlmax - tlmin;
- /* calculate the number of output bins */
- if( obins <= 0 ){
- /* use input bin number as default */
- if( bitpix >= 0 )
- obins = (int)tlwidth;
- /* but for floating point data, obins must a valid int */
- else
- obins = 128;
- }
- /* this is the increment between each bin */
- tlinc = tlwidth/obins;
- /* allocate bin buffer */
- if( !(buf=xcalloc(sizeof(double), obins)) )
- gerror(stderr, "can't allocate image buffer\n");
- /* bin up all rows */
- if( gotimage ){
- if( nmask ){
- /* loop through mask segments */
- for(in=0; in<nmask; in++){
- iy=masks[in].y;
- /* process each mask segment having the same y value */
- while(1){
- /* process columns in the mask */
- for(ix=masks[in].xstart; ix<=masks[in].xstop; ix++){
- j = ((iy-1)*dim1)+(ix-1);
- if( (rbuf[j]<tlmin) || (rbuf[j]>tlmax) )
- continue;
- idx = (int)(((rbuf[j] - tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- buf[idx] += 1;
- }
- /* if another mask segment has the same y, keep going */
- if( ((in+1)<nmask) && (masks[in+1].y==iy) )
- in++;
- else
- break;
- }
- }
- }
- else{
- for(j=0; j<dim1*dim2; j++){
- if( (rbuf[j]<tlmin) || (rbuf[j]>tlmax) )
- continue;
- idx = (int)(((rbuf[j] - tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- buf[idx] += 1;
- }
- }
- }
- else{
- if( nmask ){
- /* loop through mask segments */
- for(in=0; in<nmask; in++){
- iy=masks[in].y;
- if( iy != lasty ){
- if( !(rbuf = FunImageRowGet(fun, rbuf, iy, iy, "bitpix=-64")) )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", iy, iname);
- lasty = iy;
- }
- /* process each mask segment having the same y value */
- while(1){
- /* process columns in the mask */
- for(ix=masks[in].xstart; ix<=masks[in].xstop; ix++){
- j = ((iy-1)*dim1)+ix-1;
- if( (rbuf[j]<tlmin) || (rbuf[j]>tlmax) )
- continue;
- idx = (int)(((rbuf[j] - tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- buf[idx] += 1;
- }
- /* if another mask segment has the same y, keep going */
- if( ((in+1)<nmask) && (masks[in+1].y==iy) )
- in++;
- else
- break;
- }
- }
- }
- else{
- for(i=0; i<dim2; i++){
- if( !(rbuf = FunImageRowGet(fun, rbuf, i+1, i+1, "bitpix=-64")) )
- gerror(stderr, "can't FunImageRowGet: %d %s\n", i+1, iname);
- /* bin up all rows */
- for(j=0; j<dim1; j++){
- if( (rbuf[j]<tlmin) || (rbuf[j]>tlmax) )
- continue;
- idx = (int)(((rbuf[j] - tlmin)/tlwidth)*obins);
- if( (idx<0) || (idx>=obins) )
- continue;
- buf[idx] += 1;
- }
- }
- }
- }
- /* output header */
- fprintf(stdout, "# data file:\t\t%s\n", iname);
- fprintf(stdout, "# min,max,bins:\t\t%g %g %d\n", tlmin, tlmax, obins);
- fprintf(stdout, "\n");
- /* output data */
- fprintf(stdout,
- "%6s%c%21s%c%21s%c%21s\n",
- "bin", cold, "value", cold, "lo_val", cold, "hi_val");
- fprintf(stdout,
- "%6.6s%c%21.21s%c%21.21s%c%21.21s\n",
- dash, cold, dash, cold, dash, cold, dash);
- for(i=0; i<obins; i++){
- if( bitpix >= 0 )
- fprintf(stdout, "%6d%c%21.8f%c%21.8f%c%21.8f\n",
- i+1, cold, buf[i], cold,
- ceil(tlmin+(i*tlinc)), cold, ceil(tlmin+((i+1)*tlinc))-1);
- else
- fprintf(stdout, "%6d%c%21.8f%c%21.8f%c%21.8f\n",
- i+1, cold, buf[i], cold,
- tlmin+(i*tlinc), cold, tlmin+((i+1)*tlinc));
- }
- /* free up buffers */
- if( buf ) xfree(buf);
- if( rbuf ) xfree(rbuf);
- if( masks ) xfree(masks);
- }
- break;
- }
-
-
- /* close files */
- FunClose(fun);
-
- return(0);
-}
diff --git a/funtools/funhist_plot.tmpl b/funtools/funhist_plot.tmpl
deleted file mode 100755
index 06670e0..0000000
--- a/funtools/funhist_plot.tmpl
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/sh
-
-LC_NUMERIC=en_US.ISO8859-1
-export LC_NUMERIC
-
-files="None"
-while [ x"$1" != x ]; do
- case $1 in
- -file)
- files="$2"
- shift
- shift
- continue;;
- *)
- break;;
- esac
-done
-
-if [ x"$1" = xgnuplot ]; then
-
- if [ x`which gnuplot 2>/dev/null` = x ]; then
- echo "ERROR: gnuplot not available"
- exit 1
- fi
- AWK '
- BEGIN{
- mode=1
- initparam=0
- counts=0
- }
- mode==1{
- if( initparam == 0 ){
- if( files == "None" ){
- files=""
- dofile="true"
- }
- else{
- dofile="false"
- }
- initparam=1
- }
- if( dofile == "true" && $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( files != "" ) files = files ","
- files = files $4
- }
- else if( $1 == "#" && $2 == "column:" ){
- column = $3
- }
- else if( $1 == "------" ){
- head = sprintf("set nokey; set title \"funhist(%s)\"\n", files)
- head = head sprintf("set xlabel \"%s_bin\"\n", column)
- head = head sprintf("set ylabel \"value\"\n")
- head = head sprintf("plot \"-\" with boxes\n")
- mode = 2
- next
- }
- }
- mode==2{
- if( NF == 4 ){
- if( $4 > $3 ){
- data = data sprintf("%.8f %s %s\n", ($3+$4)/2, $2, ($4-$3))
- }
- else{
- data = data sprintf("%.8f %s 1\n", ($3+$4)/2, $2)
- }
- counts += $2
- }
- else{
- mode = 3
- }
- }
- END{
- if( counts == 0 ){
- exit 0
- }
- else{
- print head
- print data
- }
- }
- ' files="$files" | gnuplot -persist - 1>/dev/null 2>&1
- exit 0
-
-elif [ x"$1" = xds9 ]; then
-
- AWK '
- BEGIN{
- mode=1
- initparam=0
- }
- mode==1{
- if( initparam == 0 ){
- if( files == "None" ){
- files=""
- dofile="true"
- }
- else{
- dofile="false"
- }
- initparam=1
- }
- if( dofile == "true" && $1 == "#" && $2 == "data" && $3 == "file:" ){
- if( files != "" ) files = files ","
- files = files $4
- }
- else if( $1 == "#" && $2 == "column:" ){
- column = $3
- }
- else if( $1 == "------" ){
- ds9header="'"${DS9_PLOT_HEADER}"'"
- if( ds9header != "" ) {
- printf "%s 2\n", ds9header
- }
- else{
- printf "funhist(%s) %s_bin value 2\n", files, column
- }
- mode = 2
- next
- }
- }
- mode==2{
- if( NF == 4 ){
- printf "%.8f %s\n", ($3+$4)/2, $2
- }
- else{
- mode = 3
- }
- }
- ' files="$files"
- exit 0
-else
-
- echo "ERROR: unknown argument: " $1
- echo "funhist ... | funhist.plot [ds9|gnuplot]"
- exit 1
-
-fi
diff --git a/funtools/funim.c b/funtools/funim.c
deleted file mode 100644
index f15e4f3..0000000
--- a/funtools/funim.c
+++ /dev/null
@@ -1,1680 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-#define MAXEV 10240
-
-/*
- *
- * _FunTableBin -- bin a blocked section of data from a table
- *
-*/
-#ifdef ANSI_FUNC
-static void *
-_FunTableBin(Fun fun, void *buf, char *plist)
-#else
-static void *_FunTableBin(fun, buf, plist)
- Fun fun;
- void *buf;
- char *plist;
-#endif
-{
- int skip; /* temp for skipping data to end of ext */
- int offset[2]; /* offset into event record for x, y */
- int size[2]; /* size of x, y value in bytes */
- int val[2]; /* x, y bin values of this event */
- int convert; /* whether we have to convert to native */
- int index; /* index into image array for this pixel */
- int esize; /* max number of events to read at once */
- int dofilt; /* true if we can filter */
- int dovcol; /* true if we use a value column */
- int voffset; /* offset into event record for vcol */
- /* not used, so avoid gcc compiler warning */
- /* int vsize; */ /* size of vcol in bytes */
- int vtype; /* data type of event vcol */
- int imdim; /* total dims of image buffer */
- int itsnan; /* if value is a nan */
- int transparent; /* allow everything through the filter? */
- int *rbuf=NULL; /* valid event flags */
- size_t i, j; /* loop counters */
- size_t get; /* number of events to read */
- size_t got; /* number of events read */
- unsigned char *ebuf=NULL; /* event buffer */
- unsigned char *eptr; /* current pointer into ebuf */
- double block2; /* block * block */
- double minval[2]; /* x, y min axis values */
- double binsiz[2]; /* x, y bin values */
- char *obuf; /* output image buffer */
- char *pbuf; /* temp plist buf */
- char tbuf[SZ_LINE]; /* ever-present temp buffer */
- short sval; /* short val */
- unsigned short usval; /* unsigned short val */
- int ival; /* int val */
- longlong lval; /* 64-bit int val */
- unsigned int uival; /* unsigned int vala */
- float fval; /* float val */
- double dval; /* double val */
- double vval; /* value of the event */
-
- /* just in case ... */
- if( !_FunValid(fun) ){
- gerror(stderr, "invalid funtools handle\n");
- return NULL;
- }
-
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* make sure something good can happen */
- if( !fun->header || !fun->header->table ){
- gerror(stderr, "not a binary table\n");
- return NULL;
- }
-
- /* make sure we have binning parameters */
- if( (fun->bin[0] < 0) || ((fun->dims > 1) && (fun->bin[1] < 0)) ){
- gerror(stderr, "invalid or missing binning column(s) for table\n");
- return NULL;
- }
-
- /* make sure we have valid output dimensions */
- if( (fun->odim1 <= 0) || ((fun->dims > 1) && (fun->odim2 <= 0)) ){
- gerror(stderr, "invalid or zero image dimension(s) for table (%s;%d,%d)\n",
- fun->bincols ? fun->bincols : "invalid bincols?",
- fun->odim1, fun->odim2);
- return NULL;
- }
-
- /* we have to convert to native if the data is not the
- same as the big-endian-ness of the machine */
- convert = (fun->endian != is_bigendian());
-
- /* set x and y info -- whatever columns they actually are */
- offset[0] = fun->header->table->col[fun->bin[0]].offset;
- size[0] = fun->header->table->col[fun->bin[0]].size;
- minval[0] = fun->min1;
- binsiz[0] = fun->binsiz1;
- if( fun->dims > 1 ){
- offset[1] = fun->header->table->col[fun->bin[1]].offset;
- size[1] = fun->header->table->col[fun->bin[1]].size;
- minval[1] = fun->min2;
- binsiz[1] = fun->binsiz2;
- }
- /* optional value column for binning */
- if( fun->vbin >= 0 ){
- dovcol = 1;
- voffset = fun->header->table->col[fun->vbin].offset;
- /* not used, so avoid gcc compiler warning */
- /* vsize = fun->header->table->col[fun->vbin].size; */
- vtype = fun->header->table->col[fun->vbin].type;
- }
- else{
- dovcol = 0;
- }
-
- /* init some convenience variables */
- imdim = fun->odim1*MAX(fun->odim2,1);
- block2 = (double)fun->block*fun->block;
- transparent = 0;
-
- /* see if default data type is to be over-ridden */
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "bitpix", NULL, tbuf, SZ_LINE) ){
- if( (i = atoi(tbuf)) ){
- fun->obitpix = i;
- fun->odtype = fun->obitpix / FT_WORDLEN;
- }
- }
- else if( _FunKeyword(pbuf, "mask", "FUN_MASK", tbuf, SZ_LINE) ){
- if( !strcasecmp(tbuf, "transparent") )
- transparent = 1;
- }
- if( pbuf ) xfree(pbuf);
-
- /* allocate output buffer, if necessary */
- if( buf )
- obuf = buf;
- else{
- obuf = (char *)xcalloc(imdim, ABS(fun->odtype));
- if( !obuf ){
- gerror(stderr, "can't allocate image buffer (%dx%dx%d)\n",
- fun->odim1, MAX(fun->odim2,1), ABS(fun->odtype));
- return NULL;
- }
- }
-
- /* create the plist string */
- if( convert )
- strcpy(tbuf, "convert=true");
- else
- strcpy(tbuf, "convert=false");
- /* add the binning key */
- if( fun->bincols ){
- strcat(tbuf, ",");
- strcat(tbuf, fun->bincols);
- }
- /* add the index flag */
- if( fun->idx == 1 ){
- strcat(tbuf, ",idx=true");
- }
- else if( fun->idx == -1 ){
- strcat(tbuf, ",idx=false");
- }
-
- /* open the filter, if its not already been done */
- if( !fun->filt ){
- if( fun->filter && *fun->filter ){
- fun->filt = FilterOpen(fun->header, fun->filter, tbuf);
- /* check for error */
- if( fun->filt == NULL ){
- fun->filt = NOFILTER;
- gerror(stderr, "can't open filter: %s\n", fun->filter);
- return NULL;
- }
- }
- else{
- fun->filt = NOFILTER;
- fun->dofilt = 0;
- }
- }
-
- /* allocate space for a pile of event records */
- for(esize=MIN(MAXEV,(fun->left>0?fun->left:MAXEV)); esize>0; esize /=2){
- if( ((ebuf = (unsigned char *)malloc(fun->rawsize*esize)) != NULL) &&
- ((rbuf = (int *)malloc(sizeof(int)*esize)) != NULL) )
- break;
- }
-
- /* while there are still events to read ... */
- while( fun->left != 0 ){
- /* figure out how many to read this time */
- if( fun->left > 0 )
- get = MIN(esize, fun->left);
- /* read to EOF */
- else
- get = esize;
- /* read in a pile of events */
- _FunRead(fun, (void *)ebuf, fun->rawsize, get, &got);
- /* if we got what we asked for ... */
- if( got == get ){
- /* if we are reading a set number of rows ... */
- if( fun->left > 0 ){
- /* subtract the number we just got */
- fun->left -= got;
- /* just in case! */
- if( fun->left < 0 )
- fun->left = 0;
- }
- }
- /* didn't get what we asked for ... */
- else{
- /* if we are reading a set number of rows ... */
- if( fun->left > 0 ){
- /* using an index => already filtering, so fewer rows are acceptable */
- if( (fun->filt == NOFILTER) || (fun->filt->doidx != 1) ){
- /* otherwise its unexpected */
- gerror(stderr, "unexpected EOF reading rows\n");
- }
- /* ensure we stop after this iteration */
- fun->left = 0;
- }
- /* if we are reading til EOF, we just got there */
- else{
- fun->left = 0;
- }
- }
- /* update how many input events we have read */
- fun->io += got;
- fun->bytes += (got*fun->rawsize);
-
- /* filter these events through the co-process */
- if( fun->dofilt )
- dofilt = FilterEvents(fun->filt, (void *)ebuf, fun->rawsize, (int)got,
- (void *)rbuf);
- else
- dofilt = 0;
-
- /* process each event in this batch */
- for(eptr=ebuf, i=0; i<got; i++, eptr += fun->rawsize){
- /* if its not a valid event, skip it */
- if( dofilt && !transparent && !rbuf[i] ){
- continue;
- }
-
- /* get y and x values and convert to int data type for indexing */
- for(j=0; j<(size_t)fun->dims; j++){
- switch(fun->header->table->col[fun->bin[j]].type){
- /* unsigned 8-bit int */
- case 'B':
- val[j] = itlp2i((double)eptr[offset[j]], minval[j], binsiz[j], 'B');
- break;
- /* 16-bit short */
- case 'I':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &sval);
- val[j] = itlp2i((double)sval, minval[j], binsiz[j], 'I');
- break;
- /* unsigned 16-bit int */
- case 'U':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &usval);
- val[j] = itlp2i((double)usval, minval[j], binsiz[j], 'U');
- break;
- /* 32-bit int */
- case 'J':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &ival);
- val[j] = itlp2i((double)ival, minval[j], binsiz[j], 'J');
- break;
- /* unsigned 32-bit int */
- case 'K':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &lval);
- val[j] = itlp2i((double)ival, minval[j], binsiz[j], 'K');
- break;
- /* unsigned 32-bit int */
- case 'V':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &uival);
- val[j] = itlp2i((double)uival, minval[j], binsiz[j], 'V');
- break;
- /* 32-bit float */
- case 'E':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &fval);
- val[j] = itlp2i((double)fval, minval[j], binsiz[j], 'E');
- break;
- /* 64-bit float */
- case 'D':
- ColumnLoad((void *)(eptr+offset[j]), size[j], 1, convert, &dval);
- val[j] = itlp2i(dval, minval[j], binsiz[j], 'D');
- break;
- case 'X':
- case 'L':
- case 'C':
- case 'A':
- case 'M':
- case 'P':
- default:
- goto done;
- }
- }
-
- /* make sure we are in the desired section, and
- calculate the offset into the image array */
- if( fun->dims == 1 ){
- if( (val[0] < fun->x0) || (val[0] > fun->x1) )
- continue;
- index = (val[0] - fun->x0)/fun->block;
- }
- else{
- if( (val[0] < fun->x0) || (val[0] > fun->x1) ||
- (val[1] < fun->y0) || (val[1] > fun->y1) )
- continue;
- index = ((val[1] - fun->y0)/fun->block)*fun->odim1 +
- (val[0] - fun->x0)/fun->block;
- }
-
- /* make sure its valid */
- if( (index<0) || (index>=imdim) )
- continue;
-
- /* use value column or 1 as event value */
- itsnan = 0;
- if( dovcol ){
- /* if vcol is not double, we must do full type convert */
- if( vtype != 'D' ){
- ft_acht2('D', &vval, vtype, eptr+voffset, 1, convert, 0);
- }
- /* for same types, we might have to swap the bytes of the double */
- else if( convert ){
- swap8((char *)&vval, (char *)(eptr+voffset), 8);
- }
- /* otherwise its an easy copy */
- else{
- memcpy(&vval, eptr+voffset, ft_sizeof(vtype));
- }
- /* value operators */
- switch(fun->vop){
- case '/':
- if( vval ){
- vval = 1.0/vval;
- }
- else{
- itsnan = 1;
- }
- break;
- default:
- break;
- }
- if( vval == getnand() ){
- itsnan = 1;
- vval = 0.0;
- }
- }
- else{
- vval = 1.0;
- }
-
- /* add this event to the image array */
- switch(fun->odtype){
- case TY_CHAR:
- if( !dovcol ){
- if( ((unsigned char *)obuf)[index] >
- (((unsigned char *)obuf)[index]+(unsigned char)vval) ){
- fun->overflow++;
- }
- else{
- ((unsigned char *)obuf)[index] += (unsigned char)vval;
- }
- }
- else{
- if(fun->doblank && (((unsigned char *)obuf)[index] == fun->blank)){
- ;
- }
- else if( itsnan ){
- ((unsigned char *)obuf)[index] = fun->blank;
- }
- else{
- ((unsigned char *)obuf)[index] += (unsigned char)vval;
- }
- }
- break;
- /* 32-bit int */
- case TY_USHORT:
- if( !dovcol ){
- if( ((unsigned short *)obuf)[index] >
- (((unsigned short *)obuf)[index]+(unsigned short)vval) ){
- fun->overflow++;
- }
- else{
- ((unsigned short *)obuf)[index] += (unsigned short)vval;
- }
- }
- else{
- if(fun->doblank && (((unsigned short *)obuf)[index] == fun->blank)){
- ;
- }
- else if( itsnan ){
- ((unsigned short *)buf)[index] = fun->blank;
- }
- else{
- ((unsigned short *)buf)[index] += (unsigned short)vval;
- }
- }
- break;
- /* 32-bit int */
- case TY_SHORT:
- if( !dovcol ){
- if( ((short *)obuf)[index] > (((short *)obuf)[index]+(short)vval) ){
- fun->overflow++;
- }
- else{
- ((short *)obuf)[index] += (short)vval;
- }
- }
- else{
- if( fun->doblank && (((short *)obuf)[index] == fun->blank) ){
- ;
- }
- else if( itsnan ){
- ((short *)obuf)[index] = fun->blank;
- }
- else{
- ((short *)obuf)[index] += (short)vval;
- }
- }
- break;
- /* 32-bit int */
- case TY_INT:
- if( !dovcol ){
- if( ((int *)obuf)[index] > (((int *)obuf)[index]+(int)vval) ){
- fun->overflow++;
- }
- else{
- ((int *)obuf)[index] += (int)vval;
- }
- }
- else{
- if( fun->doblank && (((int *)obuf)[index] == fun->blank) ){
- ;
- }
- else if( itsnan ){
- ((int *)obuf)[index] = fun->blank;
- }
- else{
- ((int *)obuf)[index] += (int)vval;
- }
- }
- break;
- /* 64-bit int */
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- if( !dovcol ){
- if(((longlong *)obuf)[index] >
- (((longlong *)obuf)[index]+(longlong)vval)){
- fun->overflow++;
- }
- else{
- ((longlong *)obuf)[index] += (longlong)vval;
- }
- }
- else{
- if( fun->doblank && (((longlong *)obuf)[index] == fun->blank) ){
- ;
- }
- else if( itsnan ){
- ((longlong *)obuf)[index] = fun->blank;
- }
- else{
- ((longlong *)obuf)[index] += (longlong)vval;
- }
- }
- break;
- /* 32-bit float */
- case TY_FLOAT:
- if( !dovcol ){
- ((float *)obuf)[index] += (float)vval;
- }
- else{
- if( isnanf(((float *)obuf)[index]) ){
- ;
- }
- else if( itsnan ){
- ((float *)obuf)[index] = getnanf();
- }
- else{
- ((float *)obuf)[index] += (float)vval;
- }
- }
- break;
- /* 64-bit float */
- case TY_DOUBLE:
- if( !dovcol ){
- ((double *)obuf)[index] += (double)vval;
- }
- else{
- if( isnand(((double *)obuf)[index]) ){
- ;
- }
- else if( itsnan ){
- ((double *)obuf)[index] = getnand();
- }
- else{
- ((double *)obuf)[index] += (double)vval;
- }
- }
- break;
- default:
- goto done;
- }
- }
- }
-
- /* binned all events, average each pixel, if necessary */
- if( fun->btype == FUN_AVG ){
- for(i=0; i<(size_t)imdim; i++){
- switch(fun->odtype){
- case TY_CHAR:
- ((unsigned char *)obuf)[i] /= block2;
- break;
- case TY_USHORT:
- ((unsigned short *)obuf)[i] /= block2;
- break;
- case TY_SHORT:
- ((short *)obuf)[i] /= block2;
- break;
- case TY_INT:
- ((int *)obuf)[i] /= block2;
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- ((longlong *)obuf)[i] /= block2;
- break;
- case TY_FLOAT:
- ((float *)obuf)[i] /= block2;
- break;
- case TY_DOUBLE:
- ((double *)obuf)[i] /= block2;
- break;
- default:
- break;
- }
- }
- }
-
-done:
- /* free up space */
- if( ebuf ) xfree(ebuf);
- if( rbuf ) xfree(rbuf);
-
- /* if we have no more rows left, clean up */
- if( !fun->left ){
- /* skip to end of extension */
- if( fun->bytes ){
- /* skip any unread events */
- skip = (fun->rawsize*fun->total) - fun->bytes;
- gskip(fun->gio, (off_t)skip);
- fun->bytes += skip;
- /* skip padding */
- if( (skip = FT_BLOCK - (fun->bytes % FT_BLOCK)) == FT_BLOCK )
- skip = 0;
- gskip(fun->gio, (off_t)skip);
- /* reset io flag */
- /* fun->io = 0; */
- }
- }
-
- /* close filter if done with the filter process */
- if( !fun->left && (fun->filt != NOFILTER) ){
- FilterClose(fun->filt);
- fun->filt = NULL;
- }
-
- /* that's good news */
- return (void *)obuf;
-}
-
-/*
- *
- * _FunImageExtract -- grab a blocked section of data from an array
- *
-*/
-#ifdef ANSI_FUNC
-static void *
-_FunImageExtract(Fun fun, void *buf, int rstart, int rstop, char *plist)
-#else
-static void *_FunImageExtract(fun, buf, rstart, rstop, plist)
- Fun fun;
- void *buf;
- int rstart;
- int rstop;
- char *plist;
-#endif
-{
- int i, j, k;
- int ox, oy;
- int convert;
- int yoff;
- int doscale=0;
- size_t got;
- off_t newpos;
- char *obuf;
- char *pbuf;
- char **bufs;
- char tbuf[SZ_LINE];
- unsigned char cval;
- unsigned short usval;
- short sval;
- int ival;
- longlong lval;
- float fval;
- double dval;
- double block2;
- register double val;
- longlong vall;
-
- /* make sure we have something */
- if( !_FunValid(fun) )
- return NULL;
-
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* just in case ... */
- if( !fun->header || !fun->header->image ){
- gerror(stderr, "data is not a table or an image\n");
- return NULL;
- }
-
- /* make sure we have valid dimensions */
- if( fun->odim1 <=0 ){
- gerror(stderr, "invalid dim1 (%d) from x0,x1=%d,%d\n",
- fun->odim1, fun->x0, fun->x1);
- return NULL;
- }
- if( (fun->dims > 1) && (fun->odim2 <=0) ){
- gerror(stderr, "invalid dim2 (%d) from y0,y1=%d,%d\n",
- fun->odim2, fun->y0, fun->y1);
- return NULL;
- }
-
- /* we have to convert to native if the data is not the
- same as the big-endian-ness of the machine */
- convert = (fun->endian != is_bigendian());
-
- /* set up some oft-used variables */
- block2 = (double)fun->block*fun->block;
-
- /* we cannot handle BLANK==0 */
- if( (fun->dtype>=-2) && fun->doblank && (fun->blank==0) ){
- gwarning(stderr, "BLANK==0 detected ... disabling NaN checking\n");
- fun->doblank = 0;
- }
-
- /* see if default data type is to be over-ridden */
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "bitpix", NULL, tbuf, SZ_LINE) ){
- if( (i = atoi(tbuf)) ){
- fun->obitpix = i;
- fun->odtype = fun->obitpix / FT_WORDLEN;
- }
- }
- /* see if scaling is explicitly turned off */
- if( _FunKeyword(pbuf, "bscale", NULL, tbuf, SZ_LINE) ){
- if( isfalse(tbuf) )
- doscale = -1;
- }
- if( pbuf ) xfree(pbuf);
-
- /* actually, we only scale if we have scaled int data */
- if( (doscale==0) && (fun->scaled&FUN_SCALE_EXISTS) && (fun->dtype>=-2) ){
- /* flag that we scaled the input data */
- fun->scaled |= FUN_SCALE_APPLIED;
- doscale = 1;
- }
- else
- doscale = 0;
-
- /* make sure we are not out of bounds */
- if( rstart < 1 ) rstart = 1;
- if( rstop < 1 ) rstop = 1;
- if( rstop > MAX(fun->odim2,1) ) rstop = MAX(fun->odim2,1);
-
- /* allocate output buffer, if necessary */
- if( buf )
- obuf = buf;
- else{
- obuf = (char *)xcalloc(fun->odim1*(rstop-rstart+1), ABS(fun->odtype));
- if( !obuf ){
- gerror(stderr, "can't allocate image buffer (%dx%dx%d)\n",
- fun->odim1, (rstop-rstart+1), ABS(fun->odtype));
- return NULL;
- }
- }
-
- /* allocate some row buffers: number of bufs is equal to the block factor */
- bufs = (char **)xmalloc(fun->block * sizeof(char *));
- for(i=0; i<fun->block; i++){
- bufs[i] = (char *)xmalloc((fun->x1-fun->x0+1)*ABS(fun->dtype));
- }
-
- /* for all rows in the output image (or image section) ... */
- for(oy=rstart; oy<=rstop; oy++){
- yoff = (oy-rstart) * fun->odim1;
- /* get input rows associated with this output row (by block factor) */
- for(j=0; j<fun->block; i++, j++){
- /* calculate specific y line we are processing */
- i = (fun->y0 - 1) + ((oy-1) * fun->block) + j;
- /* calculate the new position into the data */
- newpos = ((i*fun->dim1)+(fun->x0-1)) * ABS(fun->dtype);
- /* skip to new position */
- if( gskip(fun->gio, newpos - fun->curpos) < 0 ){
- gerror(stderr,
- "_FunImageExtract can't seek %d bytes into image data\n",
- newpos - fun->curpos);
- if( !buf && obuf ) xfree(obuf);
- return(NULL);
- }
- /* read the row */
- _gread(fun->gio, bufs[j], ABS(fun->dtype), (fun->x1-fun->x0+1), &got);
- /* check for EOF */
- if( got != (size_t)(fun->x1-fun->x0+1) ){
- gerror(stderr, "unexpected EOF reading data\n");
- if( !buf && obuf ) xfree(obuf);
- return(NULL);
- }
- /* convert to native, if necessary */
- if( convert )
- swap_data(bufs[j], got, fun->dtype);
- /* update the current position */
- fun->curpos = newpos + (got * ABS(fun->dtype));
- }
-
- /* process all pixels in this output row */
- for(ox=0; ox<fun->odim1; ox++){
- /* reset temp value */
- val = 0.0;
- vall = 0;
- /* for all rows in the input blocks */
- for(i=0; i<fun->block; i++){
- /* sum the input pixels which make up this output pixel */
- for(j=ox*fun->block, k=0; k<fun->block; j++, k++){
- switch(fun->dtype){
- case TY_CHAR:
- cval = ((unsigned char **)bufs)[i][j];
- if( fun->doblank && (cval == fun->blank) )
- goto blank;
- if( doscale )
- val += ((double)cval*fun->bscale)+fun->bzero;
- else
- val += (double)cval;
- break;
- case TY_USHORT:
- usval = ((unsigned short **)bufs)[i][j];
- if( fun->doblank && (usval == fun->blank) )
- goto blank;
- if( doscale )
- val += ((double)usval*fun->bscale)+fun->bzero;
- else
- val += (double)usval;
- break;
- case TY_SHORT:
- sval = ((short **)bufs)[i][j];
- if( fun->doblank && (sval == fun->blank) )
- goto blank;
- if( doscale )
- val += ((double)sval*fun->bscale)+fun->bzero;
- else
- val += (double)sval;
- break;
- case TY_INT:
- ival = ((int **)bufs)[i][j];
- if( fun->doblank && (ival == fun->blank) )
- goto blank;
- if( doscale )
- val += ((double)ival*fun->bscale)+fun->bzero;
- else
- val += (double)ival;
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- /* argh ... 64-bit does not fit into a double! */
- lval = ((longlong **)bufs)[i][j];
- if( fun->doblank && (lval == fun->blank) )
- goto blank;
- /* probably going to lose precision here */
- if( doscale )
- vall += ((double)lval*fun->bscale)+fun->bzero;
- else
- vall += lval;
- break;
- case TY_FLOAT:
- fval = ((float **)bufs)[i][j];
- if( isnanf(fval) )
- goto blank;
- val += (double)fval;
- break;
- case TY_DOUBLE:
- dval = ((double **)bufs)[i][j];
- if( isnand(dval) )
- goto blank;
- val += dval;
- break;
- default:
- break;
- }
- }
- } /* x block loop */
-
- /* take average of this output pixel, if necessary */
- if( fun->btype == FUN_AVG ){
- val /= block2;
- vall /= block2;
- }
-
- /* store the resulting value in the output image */
- /* argh ... 64-bit does not fit into a double! */
- if( fun->dtype == TY_LONG ){
- switch(fun->odtype){
- case TY_CHAR:
- ((unsigned char *)obuf)[yoff+ox] = (unsigned char)vall;
- break;
- case TY_USHORT:
- ((unsigned short *)obuf)[yoff+ox] = (unsigned short)vall;
- break;
- case TY_SHORT:
- ((short *)obuf)[yoff+ox] = (short)vall;
- break;
- case TY_INT:
- ((int *)obuf)[yoff+ox] = (int)vall;
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- ((longlong *)obuf)[yoff+ox] = (longlong)vall;
- break;
- case TY_FLOAT:
- ((float *)obuf)[yoff+ox] = (float)vall;
- break;
- case TY_DOUBLE:
- ((double *)obuf)[yoff+ox] = (double)vall;
- break;
- default:
- break;
- }
- }
- else{
- switch(fun->odtype){
- case TY_CHAR:
- ((unsigned char *)obuf)[yoff+ox] = (unsigned char)val;
- break;
- case TY_USHORT:
- ((unsigned short *)obuf)[yoff+ox] = (unsigned short)val;
- break;
- case TY_SHORT:
- ((short *)obuf)[yoff+ox] = (short)val;
- break;
- case TY_INT:
- ((int *)obuf)[yoff+ox] = (int)val;
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- ((longlong *)obuf)[yoff+ox] = (longlong)val;
- break;
- case TY_FLOAT:
- ((float *)obuf)[yoff+ox] = (float)val;
- break;
- case TY_DOUBLE:
- ((double *)obuf)[yoff+ox] = (double)val;
- break;
- default:
- break;
- }
- }
-
- /* skip the blank assignment */
- continue;
-
-blank:
- /* arrive here is we found a blank or nan */
- switch(fun->odtype){
- case TY_CHAR:
- ((unsigned char *)obuf)[yoff+ox] = fun->blank;
- break;
- case TY_USHORT:
- ((unsigned short *)obuf)[yoff+ox] = fun->blank;
- break;
- case TY_SHORT:
- ((short *)obuf)[yoff+ox] = fun->blank;
- break;
- case TY_INT:
- ((int *)obuf)[yoff+ox] = fun->blank;
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- ((longlong *)obuf)[yoff+ox] = fun->blank;
- break;
- case TY_FLOAT:
- ((float *)obuf)[yoff+ox] = getnanf();
- break;
- case TY_DOUBLE:
- ((double *)obuf)[yoff+ox] = getnand();
- break;
- default:
- break;
- }
-
- } /* x loop */
- } /* y loop */
-
- /* free allocated space */
- for(i=0; i<fun->block; i++){
- if( bufs[i] ) xfree(bufs[i]);
- }
- if( bufs ) xfree(bufs);
-
- /* calculate the position to the end of the data, if we read last line */
- if( rstop == MAX(fun->odim2,1) ){
- newpos = ((MAX(fun->dim2,1)*fun->dim1)) * ABS(fun->dtype);
- /* skip to end of data */
- gskip(fun->gio, newpos - fun->curpos);
- /* skip padding as well */
- gskip(fun->gio, (off_t)fun->dpad);
- /* reset current position to end of image */
- fun->curpos = newpos + fun->dpad;
- }
-
- return (void *)obuf;
-}
-
-/*
- *
- * semi-public routines
- *
- */
-
-
-#ifdef ANSI_FUNC
-void *
-_FunImageMask(Fun fun, void *buf, int rstart, int rstop,
- FilterMask masks, int nmask, char *plist)
-#else
-void *_FunImageMask(fun, buf, rstart, rstop, masks, nmask, plist)
- Fun fun;
- void *buf;
- int rstart;
- int rstop;
- FilterMask masks;
- int nmask;
- char *plist;
-#endif
-{
- int len;
- int i, n;
- int pixsize;
- int rowsize;
- int flag;
- int bitpix;
- int dtype;
- int x=0, y=0;
- char *pbuf;
- char *obuf;
- char *optr;
- char tbuf[SZ_LINE];
-
- /* make sure we have something to do */
- if( !_FunValid(fun) )
- return buf;
-
- /* make sure we really want to mask, and figure out which sort of mask */
- flag = 0;
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "mask", "FUN_MASK", tbuf, SZ_LINE) ){
- if( isfalse(tbuf) ){
- if( pbuf ) xfree(pbuf);
- return buf;
- }
- /* 'all' means we change each pixel, setting pixels to 0 outside,
- and setting pixels to region value inside */
- else if( !strcasecmp(tbuf, "all") ){
- /* if we are allocating the buffer, we can change bitpix as well */
- if( !buf && _FunKeyword(pbuf, "bitpix", NULL, tbuf, SZ_LINE) ){
- if( (i = atoi(tbuf)) ){
- fun->obitpix = i;
- fun->odtype = fun->obitpix / FT_WORDLEN;
- }
- }
- flag = 1;
- }
- }
- if( pbuf ) xfree(pbuf);
- bitpix = fun->obitpix;
- dtype = fun->odtype;
-
- /* make sure we are not out of bounds */
- if( rstart < 1 ) rstart = 1;
- if( rstop > MAX(fun->odim2,1) ) rstop = MAX(fun->odim2,1);
-
- /* allocate output buffer, if necessary */
- if( buf )
- obuf = buf;
- else{
- obuf = (char *)xcalloc(fun->odim1*(rstop-rstart+1), ABS(dtype));
- if( !obuf ){
- gerror(stderr, "can't allocate image buffer (%dx%dx%d)\n",
- fun->odim1, (rstop-rstart+1), ABS(fun->odtype));
- return NULL;
- }
- }
-
- /* this is the size of a single pixel in bytes */
- pixsize = ABS(bitpix/FT_WORDLEN);
- /* this is the number of bytes per line */
- rowsize = fun->odim1 * pixsize;
-
- /* clear y rows before first row containing a mask segment */
- if( nmask ){
- for(y=rstart; y<=MIN(masks[0].y-1,rstop); y++){
- optr = (char *)obuf + ((y-rstart) * rowsize);
- memset(optr, 0, rowsize);
- }
- }
-
- /* process all mask segments */
- for(n=0; n<nmask; n++){
- /* do not process mask values greater than rstop */
- if( masks[n].y < rstart ) continue;
- if( masks[n].y > rstop ) break;
- /* blank out rows before the y row associated with this mask segment */
- for(; y<masks[n].y; y++){
- optr = (char *)obuf + ((y-rstart) * rowsize);
- memset(optr, 0, rowsize);
- }
- /* process each mask segment having this same y value */
- x = 1;
- while(1){
- /* clear columns before the start of this segment */
- optr = (char *)obuf + ((y-rstart) * rowsize) + ((x-1) * pixsize);
- if( (len = (masks[n].xstart - x) * pixsize) >0 )
- memset(optr, 0, len);
- x = masks[n].xstart;
- /* if flag is set, we set the pixel values to be the region id */
- if( flag ){
- optr = (char *)obuf + ((y-rstart) * rowsize) + ((x-1) * pixsize);
- for(x=masks[n].xstart; x<=masks[n].xstop; x++){
- switch(dtype){
- case TY_CHAR:
- *((char *)optr) = (char)masks[n].region;
- optr += pixsize;
- break;
- case TY_USHORT:
- *((unsigned short *)optr) = (unsigned short)masks[n].region;
- optr += pixsize;
- break;
- case TY_SHORT:
- *((short *)optr) = (short)masks[n].region;
- optr += pixsize;
- break;
- case TY_INT:
- *((int *)optr) = (int)masks[n].region;
- optr += pixsize;
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- *((longlong *)optr) = (longlong)masks[n].region;
- optr += pixsize;
- break;
- case TY_FLOAT:
- *((float *)optr) = (float)masks[n].region;
- optr += pixsize;
- break;
- case TY_DOUBLE:
- *((double *)optr) = (double)masks[n].region;
- optr += pixsize;
- break;
- default:
- break;
- }
- }
- }
- /* position after end of segment */
- x = masks[n].xstop+1;
- /* if we have another mask segment with the same y,
- we keep going */
- if( ((n+1) < nmask) && (masks[n+1].y == y) )
- n++;
- else
- break;
- }
- /* clear the rest of the columns for this y row */
- optr = (char *)obuf + ((y-rstart) * rowsize) + ((x-1) * pixsize);
- if( (len = (fun->odim1 - x + 1) * pixsize) >0 )
- memset(optr, 0, len);
- /* bump to next y row */
- y++;
- }
-
- /* clear y rows after last row containing a mask segment */
- for(y = (nmask ? MAX(rstart,masks[nmask-1].y+1) : rstart); y<=rstop; y++){
- optr = (char *)obuf + ((y-rstart) * rowsize);
- memset(optr, 0, rowsize);
- }
-
- /* return result */
- return obuf;
-}
-
-
-/*
- *
- * _FunImagePutHeader -- writes header to file
- * used by FunImagePut and sometimes FunFlush (if no Put was done)
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunImagePutHeader(Fun fun, int dim1, int dim2, int bitpix)
-#else
-int _FunImagePutHeader(fun, dim1, dim2, bitpix)
- Fun fun;
- int dim1, dim2, bitpix;
-#endif
-{
- int i;
- int extver=1;
- int domerge=0;
- char *extname="IMAGE";
- FITSHead merge;
-
- /* if no operation has been performed, we have no header */
- if( !fun->ops ){
- /* if we do not have header info yet, we should be able to copy it */
- if( !fun->header ){
- /* copy header from reference image */
- if( fun->ifun )
- _FunCopy2ImageHeader(fun->ifun, fun);
- /* use passed dims and bitpix, if possible */
- if( dim1 && bitpix ){
- /* note that we may not have a header yet -- make one here */
- if( !fun->header ){
- fun->header = ft_headinit(NULL, 0);
- ft_headsetl(fun->header, "SIMPLE", 0, 1, "FITS STANDARD", 1);
- }
- /* add the passed dim and bitpix values */
- ft_headseti(fun->header, "BITPIX", 0, bitpix, "Bits/pixel", 1);
- if( dim2 ){
- ft_headseti(fun->header, "NAXIS", 0, 2, "2-D image", 1);
- ft_headseti(fun->header, "NAXIS", 1, dim1, "Axis 1 dimension", 1);
- ft_headseti(fun->header, "NAXIS", 2, dim2, "Axis 2 dimension", 1);
- }
- else{
- ft_headseti(fun->header, "NAXIS", 0, 1, "1-D image", 1);
- ft_headseti(fun->header, "NAXIS", 1, dim1, "Axis 1 dimension", 1);
- }
- ft_headsetl(fun->header, "EXTEND", 0, 1,
- "Standard extensions might follow", 1);
- /* synchronize the header and the cards after any changes */
- ft_syncdata(fun->header);
- /* fill in values */
- if( dim2 ){
- fun->dims = 2;
- fun->dim1 = dim1;
- fun->dim2 = dim2;
- }
- else{
- fun->dims = 1;
- fun->dim1 = dim1;
- fun->dim2 = 1;
- }
- fun->bitpix = bitpix;
- _FunImageSize(fun);
- }
- /* hmmm ... could not make a header of any sort */
- if( !fun->header )
- return 0;
- /* flag that we need to merge in user params before writing */
- domerge = 1;
- }
- /* if something is already written, this is an image extension */
- if( fun->primio || gtell(fun->gio)>0 ){
- /* required after naxis */
- ft_headseti(fun->header, "PCOUNT", 0, 0, "Random parameter count", 1);
- ft_headseti(fun->header, "GCOUNT", 0, 1, "Group count", 1);
- /* convert first card to a FITS image extension */
- ft_cardfmt((FITSCard)fun->header->cards,
- "XTENSION", 0, FT_STRING, "IMAGE", 0, "FITS Image Extension");
- if( !ft_headfind(fun->header, "EXTNAME", 0, 0) )
- ft_headsets(fun->header, "EXTNAME", 0, extname, "Ext. name", 1);
- if( !ft_headfind(fun->header, "EXTVER", 0, 0) )
- ft_headseti(fun->header, "EXTVER", 0, extver, "Ext. version", 1);
- /* delete EXTEND keyword, which is for primary only */
- if( ft_headfind(fun->header, "EXTEND", 0, 0) )
- ft_headdel(fun->header, "EXTEND", 0);
- }
- else{
- /* flag that we have written the primary header */
- fun->primio++;
- }
- /* if the data are floats, we must delete BSCALE and BZERO */
- if( fun->bitpix < 0 ){
- if( ft_headfind(fun->header, "BSCALE", 0, 0) )
- ft_headdel(fun->header, "BSCALE", 0);
- if( ft_headfind(fun->header, "BZERO", 0, 0) )
- ft_headdel(fun->header, "BZERO", 0);
- }
- /* merge in user-specified params with overwrite */
- if( domerge && fun->theader ){
- merge = ft_headmerge(fun->header, fun->theader, 1);
- ft_headfree(fun->theader, 1);
- fun->theader = NULL;
- ft_headfree(fun->header, 1);
- fun->header = merge;
- ft_syncdata(fun->header);
- }
- /* for a 1D image, we have to delete 2D header params */
- if( fun->dims == 1 ){
- ft_headdel(fun->header, "NAXIS", 2);
- /* remove 2D WCS header parameters */
- for(i=0; i<=2; i++){
- ft_headdel(fun->header, "CTYPE", i);
- ft_headdel(fun->header, "CRVAL", i);
- ft_headdel(fun->header, "CRPIX", i);
- ft_headdel(fun->header, "CDELT", i);
- ft_headdel(fun->header, "LTV", i);
- ft_headdel(fun->header, "LTM1_", i);
- ft_headdel(fun->header, "LTM2_", i);
- ft_headdel(fun->header, "CD1_", i);
- ft_headdel(fun->header, "CD2_", i);
- ft_headdel(fun->header, "CD3_", i);
- }
- }
-
- /* save file position for later updating */
- fun->headpos = gtell(fun->gio);
-
- /* write the header */
- ft_headwrite(fun->gio, fun->header);
-
- /* we just wrote the header */
- fun->ops |= OP_WRHEAD;
- }
-
- /* good news */
- return 1;
-}
-
-/*
- *
- * public routines
- *
- */
-
-#ifdef ANSI_FUNC
-void *
-FunImageGet (Fun fun, void *buf, char *plist)
-#else
-void *FunImageGet (fun, buf, plist)
- Fun fun;
- void *buf;
- char *plist;
-#endif
-{
- int domask;
- int doimage;
- int imagetable;
- char *pbuf;
- char *s;
- void *obuf=NULL;
- char paint[SZ_LINE];
- char debug[SZ_LINE];
- char tbuf[SZ_LINE];
-
- /* sanity checks */
- if( !_FunValid(fun) ){
- gerror(stderr, "data does not contain a valid header\n");
- return NULL;
- }
-
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* sanity checks */
- if( !fun->header ){
- gerror(stderr, "data does not contain a valid header\n");
- return NULL;
- }
-
- pbuf = xstrdup(plist);
- domask = 1;
- doimage = 1;
- imagetable = 0;
- if( _FunKeyword(pbuf, "mask", "FUN_MASK", tbuf, SZ_LINE) ){
- if( isfalse(tbuf) )
- domask = 0;
- /* mask=all => no data, just make the mask */
- else if( !strcasecmp(tbuf, "all") )
- doimage = 0;
- /* mask=image => we want to use image masking on a table */
- else if( !strcasecmp(tbuf, "image") )
- imagetable = 1;
- }
- if( _FunKeyword(pbuf, "paint", "FILTER_PAINT", tbuf, SZ_LINE) ){
- strncpy(paint, tbuf, SZ_LINE);
- }
- else{
- *paint = '\0';
- }
- if( _FunKeyword(pbuf, "debug", "FILTER_DEBUG", tbuf, SZ_LINE) ){
- strncpy(debug, tbuf, SZ_LINE);
- }
- else{
- *debug = '\0';
- }
- if( pbuf ) xfree(pbuf);
-
- /* pick the appropriate routine for tables and/or images */
- if( doimage ){
- if( fun->header->image ){
- obuf = _FunImageExtract(fun, buf, 1, MAX(fun->odim2,1), plist);
- }
- else if( fun->header->table ){
- obuf = _FunTableBin(fun, buf, plist);
- /* if mask=image, we remask using image binning, otherwise not */
- if( !imagetable )
- domask = 0;
- }
- /* don't bother masking if we have no image */
- if( obuf == NULL )
- domask = 0;
- }
-
- /* filter resulting image, if we have one */
- if( domask ){
- if( fun->filter && *fun->filter )
- s = fun->filter;
- else if( !doimage )
- s = "field";
- else
- s = NULL;
- if( s ){
- /* open the filter, first time through */
- if( !fun->filt ){
- /* make up filter plist string */
- strncpy(tbuf, "type=image", SZ_LINE-1);
- /* add the binning key */
- if( fun->bincols ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, fun->bincols, SZ_LINE-1);
- }
- /* add paint mode */
- if( *paint ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, "paint=", SZ_LINE-1);
- strncat(tbuf, paint, SZ_LINE-1);
- }
- /* add debug flag */
- if( *debug ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, "debug=", SZ_LINE-1);
- strncat(tbuf, debug, SZ_LINE-1);
- }
- fun->filt = FilterOpen(fun->header, s, tbuf);
- if( fun->filt && (fun->filt != NOFILTER) ){
- fun->nmask = FilterImage(fun->filt,
- fun->x0, fun->x1, fun->y0, fun->y1, fun->block,
- &(fun->masks), NULL);
- }
- }
- /* perform the filter, if necessary */
- if( fun->filt && (fun->filt != NOFILTER) ){
- obuf = _FunImageMask(fun, obuf, 1, MAX(fun->odim2,1),
- fun->masks, fun->nmask, plist);
- }
- /* close filters, free masks */
- if( fun->filt && (fun->filt != NOFILTER) ){
- FilterClose(fun->filt);
- fun->filt = NULL;
- }
- if( fun->masks ){
- xfree(fun->masks);
- fun->masks = NULL;
- }
- fun->nmask = 0;
- }
- }
-
- /* we just read an image */
- fun->ops |= OP_RDIMAGE;
-
- /* return result */
- return obuf;
-}
-
-#ifdef ANSI_FUNC
-void *
-FunImageRowGet (Fun fun, void *buf, int rstart, int rstop, char *plist)
-#else
-void *FunImageRowGet (fun, buf, rstart, rstop, plist)
- Fun fun;
- void *buf;
- int rstart;
- int rstop;
- char *plist;
-#endif
-{
- int domask;
- int doimage;
- char *pbuf;
- void *obuf=NULL;
- char paint[SZ_LINE];
- char debug[SZ_LINE];
- char tbuf[SZ_LINE];
-
- /* sanity checks */
- if( !_FunValid(fun) ){
- gerror(stderr, "data does not contain a valid header\n");
- return NULL;
- }
-
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* sanity checks */
- if( !fun->header ){
- gerror(stderr, "data does not contain a valid header\n");
- return NULL;
- }
-
- pbuf = xstrdup(plist);
- domask = 1;
- doimage = 1;
- if( _FunKeyword(pbuf, "mask", "FUN_MASK", tbuf, SZ_LINE) ){
- if( isfalse(tbuf) )
- domask = 0;
- else if( !strcasecmp(tbuf, "all") )
- doimage = 0;
- }
- if( _FunKeyword(pbuf, "paint", "FILTER_PAINT", tbuf, SZ_LINE) ){
- strncpy(paint, tbuf, SZ_LINE);
- }
- else{
- *paint = '\0';
- }
- if( _FunKeyword(pbuf, "debug", "FILTER_DEBUG", tbuf, SZ_LINE) ){
- strncpy(debug, tbuf, SZ_LINE);
- }
- else{
- *debug = '\0';
- }
-
- if( pbuf ) xfree(pbuf);
-
- /* pick the appropriate routine for tables and/or images */
- if( doimage ){
- if( fun->header->image ){
- obuf = _FunImageExtract(fun, buf, rstart, rstop, plist);
- }
- /* we do not get lines for tables (they are not sorted) */
- else if( fun->header->table ){
- obuf = NULL;
- domask = 0;
- }
- else{
- obuf = NULL;
- }
- if( obuf == NULL )
- domask = 0;
- }
-
- /* filter resulting image, if we have one */
- if( domask ){
- if( fun->filter && *fun->filter ){
- /* open the filter, first time through */
- if( !fun->filt ){
- /* make up filter plist string */
- strncpy(tbuf, "type=image", SZ_LINE-1);
- /* add the binning key */
- if( fun->bincols ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, fun->bincols, SZ_LINE-1);
- }
- /* add paint mode */
- if( *paint ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, "paint=", SZ_LINE-1);
- strncat(tbuf, paint, SZ_LINE-1);
- }
- /* add debug flag */
- if( *debug ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, "debug=", SZ_LINE-1);
- strncat(tbuf, debug, SZ_LINE-1);
- }
- fun->filt = FilterOpen(fun->header, fun->filter, tbuf);
- if( fun->filt && (fun->filt != NOFILTER) ){
- fun->nmask = FilterImage(fun->filt,
- fun->x0, fun->x1, fun->y0, fun->y1, fun->block,
- &(fun->masks), NULL);
- }
- }
- /* perform the filter, if necessary */
- if( fun->filt && (fun->filt != NOFILTER) ){
- obuf = _FunImageMask(fun, obuf, rstart, rstop,
- fun->masks, fun->nmask, plist);
- }
- }
- }
-
- /* we just read an image row */
- fun->ops |= OP_RDIMAGE;
-
- /* return result */
- return obuf;
-}
-
-#ifdef ANSI_FUNC
-static int
-_FunImagePut (Fun fun, void *buf, int rstart, int rstop,
- int dim1, int dim2, int bitpix, char *plist)
-#else
-static int _FunImagePut (fun, buf, rstart, rstop, dim1, dim2, bitpix, plist)
- Fun fun;
- void *buf;
- int rstart;
- int rstop;
- int dim1;
- int dim2;
- int bitpix;
- char *plist;
-#endif
-{
- char tbuf[SZ_LINE];
- char *pbuf;
- char *zbuf;
- int convert;
- int dlen;
- int dpad;
- int tdim;
- off_t newpos;
-
- /* sanity checks */
- if( !_FunValid(fun) )
- return 0;
-
- /* this extension is an image */
- fun->type = FUN_IMAGE;
-
- /* put header */
- if( !_FunImagePutHeader(fun, dim1, dim2, bitpix) )
- return 0;
-
- /* fill in the blanks, if necessary */
- if( (dim1 == 0) && (dim2 == 0) && (bitpix == 0) ){
- bitpix = fun->bitpix;
- dim1 = fun->dim1;
- dim2 = fun->dim2;
- }
-
- /* see if we override the normal data conversion */
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "convert", NULL, tbuf, SZ_LINE) )
- convert = istrue(tbuf);
- else
- convert = !is_bigendian();
- if( pbuf ) xfree(pbuf);
-
- /* determine if we are writing one line or the whole image */
- if( !rstart )
- tdim = dim1 * MAX(dim2,1);
- else
- tdim = dim1 * (rstop-rstart+1);
-
- /* convert to IEEE, if necessary */
- if( convert )
- swap_data(buf, tdim, bitpix/FT_WORDLEN);
-
- /* determine data size */
- dlen = tdim * ABS(bitpix/FT_WORDLEN);
-
- /* we need to skip to the right row */
- if( rstart ){
- newpos = ((rstart-1) * dim1) * ABS(fun->dtype);
- if( gskip(fun->gio, newpos - fun->curpos) < 0 ){
- gerror(stderr,
- "FunImagePut can't seek %d bytes into image data\n",
- newpos - fun->curpos);
- return 0;
- }
- fun->curpos = newpos;
- }
-
- /* write the data */
- gwrite(fun->gio, buf, sizeof(char), dlen);
-
- /* update the current position */
- fun->curpos += dlen;
-
- /* and the current number of bytes read */
- fun->bytes += dlen;
-
- /* write the padding, if we just wrote the last row (or full image) */
- if( !rstart || (rstop == MAX(dim2,1)) ){
- if( (dpad = FT_BLOCK - (fun->bytes % FT_BLOCK)) != FT_BLOCK ){
- zbuf = xcalloc(dpad, sizeof(char));
- gwrite(fun->gio, zbuf, sizeof(char), dpad);
- if( zbuf ) xfree(zbuf);
- /* update current position */
- fun->curpos += dpad;
- fun->bytes += dpad;
- }
- }
-
- /* we just wrote an image */
- fun->ops |= OP_WRIMAGE;
-
- /* success */
- return 1;
-}
-
-#ifdef ANSI_FUNC
-int
-FunImagePut (Fun fun, void *buf, int dim1, int dim2, int bitpix, char *plist)
-#else
-int FunImagePut (fun, buf, dim1, dim2, bitpix, plist)
- Fun fun;
- void *buf;
- int dim1;
- int dim2;
- int bitpix;
- char *plist;
-#endif
-{
- return _FunImagePut(fun, buf, 0, 0, dim1, dim2, bitpix, plist);
-}
-
-#ifdef ANSI_FUNC
-int
-FunImageRowPut (Fun fun, void *buf, int rstart, int rstop, int dim1, int dim2,
- int bitpix, char *plist)
-#else
-int FunImageRowPut (fun, buf, rstart, rstop, dim1, dim2, bitpix, plist)
- Fun fun;
- void *buf;
- int rstart;
- int rstop;
- int dim1;
- int dim2;
- int bitpix;
- char *plist;
-#endif
-{
- return _FunImagePut(fun, buf, rstart, rstop, dim1, dim2, bitpix, plist);
-}
-
diff --git a/funtools/funimage.c b/funtools/funimage.c
deleted file mode 100644
index e763510..0000000
--- a/funtools/funimage.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
- * Copyright (c) 1999-2005 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-extern char *optarg;
-extern int optind;
-
-#define FORCE_IMAGE -1
-
-/* list definitions */
-#define X_DEFAULT "X"
-#define Y_DEFAULT "Y"
-#define VAL_DEFAULT "VAL"
-#define COL1_DEFAULT "COL1"
-#define COL2_DEFAULT "COL2"
-#define COL3_DEFAULT "COL3"
-
-/* list event structure */
-typedef struct evstruct{
- double x, y, val;
-} *Ev, EvRec;
-
-/* list structure */
-typedef struct List {
- Fun fun;
- char *colname[3];
- double tlmin[2];
- double tlmax[2];
- double binsiz[2];
- int dim[2];
- double tscale[2];
- double tzero[2];
- int scaled[2];
-} List;
-
-#ifdef ANSI_FUNC
-static void
-doimproj(int dim, int bitpix, void *buf, int i, int j, void *pbuf, int idx)
-#else
-static void
-doimproj(dim, bitpix, buf, i, j, pbuf, idx)
- int dim;
- int bitpix;
- void *buf;
- int i;
- int j;
- void *pbuf;
- int idx;
-#endif
-{
- switch(bitpix/FT_WORDLEN){
- case TY_CHAR:
- ((unsigned char *)pbuf)[idx] += ((unsigned char *)buf)[(j*dim)+i];
- break;
- case TY_USHORT:
- ((unsigned short *)pbuf)[idx] += ((unsigned short *)buf)[(j*dim)+i];
- break;
- case TY_SHORT:
- ((short *)pbuf)[idx] += ((short *)buf)[(j*dim)+i];
- break;
- case TY_INT:
- ((int *)pbuf)[idx] += ((int *)buf)[(j*dim)+i];
- break;
- case TY_LONG:
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- ((longlong *)pbuf)[idx] += ((longlong *)buf)[(j*dim)+i];
- break;
- case TY_FLOAT:
- ((float *)pbuf)[idx] += ((float *)buf)[(j*dim)+i];
- break;
- case TY_DOUBLE:
- ((double *)pbuf)[idx] += ((double *)buf)[(j*dim)+i];
- break;
- default:
- break;
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr, "usage:\n");
- fprintf(stderr,
- "%s [-a] iname oname [bitpix=n[,bscale=false]]\n",
- fname);
- fprintf(stderr,
- "%s -l [-a] iname oname xcol:xdims ycol:ydims vcol bitpix=n\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -a # append to existing output file as an image extension\n");
- fprintf(stderr, " -l # input is a list file containing xcol, ycol, value\n");
- fprintf(stderr, " -p [x|y] # project along x or y axis to create a 1D image\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "Specify output image data type using bitpix=n, where n is:\n");
- fprintf(stderr, " 8 # unsigned char\n");
- fprintf(stderr, " 16 # short\n");
- fprintf(stderr, " 32 # int\n");
- fprintf(stderr, " -32 # float\n");
- fprintf(stderr, " -64 # double\n");
- fprintf(stderr, "(Defaults: same as input image, or 32 (int) for tables.)\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "List format requires x, y column information of the form:\n");
- fprintf(stderr, " name:dim # values range from 1 to dim\n");
- fprintf(stderr, " name:min:max # values range from min to max\n");
- fprintf(stderr, " name:min:max:binsiz # dimensions scaled by binsize\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-static List *
-ColumnInfo(Fun fun, char *colstr[])
-#else
-static List *
-ColumnInfo(fun, colstr)
- Fun fun;
- char *colstr[];
-#endif
-{
- int i;
- int ip;
- char tbuf[SZ_LINE];
- List *list;
-
- /* allocate list struct */
- if( !(list = (List *)xcalloc(sizeof(List), 1)) ){
- gerror(stderr, "can't allocate list record\n");
- return NULL;
- }
-
- /* process column info */
- newdtable(":");
- for(i=0; i<3; i++){
- ip = 0;
- /* column name */
- if( !*colstr[i] || (*colstr[i] == ':') || !word(colstr[i], tbuf, &ip) ){
- switch(i){
- case 0:
- if(FunColumnLookup(fun, COL1_DEFAULT, 0,
- NULL, NULL, NULL, NULL, NULL, NULL))
- strcpy(tbuf, COL1_DEFAULT);
- else{
- strcpy(tbuf, X_DEFAULT);
- }
- break;
- case 1:
- if(FunColumnLookup(fun, COL2_DEFAULT, 0,
- NULL, NULL, NULL, NULL, NULL, NULL))
- strcpy(tbuf, COL2_DEFAULT);
- else{
- strcpy(tbuf, Y_DEFAULT);
- }
- break;
- case 2:
- if(FunColumnLookup(fun, COL3_DEFAULT, 0,
- NULL, NULL, NULL, NULL, NULL, NULL))
- strcpy(tbuf, COL3_DEFAULT);
- else{
- strcpy(tbuf, VAL_DEFAULT);
- }
- break;
- }
- }
- list->colname[i] = xstrdup(tbuf);
-
- /* back up to the previous ':' as required by column dimension routine */
- if( ip && (lastdelim() == ':') ) ip--;
- /* column dimensions */
- if( colstr[i][ip] != '\0' ){
- switch(i){
- case 0:
- case 1:
- _FunColumnDims(&colstr[i][ip], 'I',
- &list->tlmin[i], &list->tlmax[i],
- &list->binsiz[i], &list->dim[i],
- &list->tscale[i], &list->tzero[i], &list->scaled[i]);
- if( list->tlmin[i] && list->tlmax[i] )
- list->dim[i] = (int)tldim(list->tlmin[i], list->tlmax[i],
- list->binsiz[i], 'I');
- else
- list->dim[i] = 0;
- break;
- case 2:
- break;
- }
- }
- /* must have dimesion info for x and y */
- else{
- switch(i){
- case 0:
- case 1:
- gerror(stderr, "dimension specification missing for %s\n", colstr[i]);
- return NULL;
- case 2:
- break;
- }
- }
- }
- freedtable();
-
- /* set up to read the specified columns */
- FunColumnSelect(fun, sizeof(EvRec), NULL,
- list->colname[0], "D", "r", FUN_OFFSET(Ev, x),
- list->colname[1], "D", "r", FUN_OFFSET(Ev, y),
- list->colname[2], "D", "r", FUN_OFFSET(Ev, val),
- NULL);
-
- /* return list */
- return list;
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i, j;
- int args;
- int dim1, dim2;
- int idx;
- int dim=0;
- int maxidx=0;
- int type=0;
- int bitpix=0;
- int doscale=1;
- int doproj=0;
- char *s, *t;
- char *mode=NULL;
- char *tmode=NULL;
- char *omode="w";
- char *iname=NULL;
- char *oname=NULL;
- char *colstr[3];
- char *buf=NULL;
- char *pbuf=NULL;
- char tbuf[SZ_LINE];
- char newname[SZ_LINE];
- Fun fun, fun2;
-
- /* list variables */
- int dolist=0;
- int ix, iy;
- int got;
- List *list=NULL;
- EvRec evrec;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "ailp:")) != -1){
- switch(c){
- case 'a':
- omode = "a";
- case 'i':
- type = FORCE_IMAGE;
- break;
- case 'l':
- dolist = 1;
- break;
- case 'p':
- doproj = *optarg;
- break;
- }
- }
-
- /* sanity checks */
- if( doproj ){
- if( dolist ) gerror(stderr, "-p and -l are mutually exclusive\n");
- switch(doproj){
- case 'x':
- case 'y':
- break;
- case 'X':
- case 'Y':
- doproj = tolower(doproj);
- break;
- default:
- gerror(stderr, "proj specifier must be 'x' or 'y'\n");
- break;
- }
- }
-
- /* process arguments */
- args = argc - optind;
- if( args < 2 ) usage(argv[0]);
- iname = argv[optind+0];
- oname = argv[optind+1];
- if( dolist ){
- if( args != 6 ) usage(argv[0]);
- colstr[0] = argv[optind+2];
- colstr[1] = argv[optind+3];
- colstr[2] = argv[optind+4];
- mode = xstrdup(argv[optind+5]);
- }
- else{
- if( args > 2 ) mode = xstrdup(argv[optind+2]);
- }
-
- /* check for $NEW and rewrite name as /dev/null[TEXT(),...] */
- if( !strncmp(iname, "$NEW[", 5 ) || !strncmp(iname, "$MASK[", 6 ) ){
- /* for masks, we add to the mode */
- if( !strncmp(iname, "$MASK[", 6 ) ){
- if( mode && *mode ){
- snprintf(tbuf, SZ_LINE-1, "%s,mask=all", mode);
- xfree(mode);
- mode = xstrdup(tbuf);
- }
- else{
- mode = xstrdup("mask=all,bitpix=8");
- }
- }
- /* re-write file name as an empty text table */
- memset(newname, 0, SZ_LINE);
- strncpy(newname, "/dev/null[TEXT(x:", SZ_LINE-1);
- s = strchr(iname, '[')+1;
- t = strchr(s, ',');
- strncat(newname, s, t-s);
- strncat(newname, ",y:", SZ_LINE-strlen(newname));
- if (t != NULL) {
- s = ++t;
- t = strchr(s, ',');
- strncat(newname, s, t-s);
- }
- strncat(newname, "),", SZ_LINE-strlen(newname));
- if (t != NULL) {
- s = ++t;
- strncat(newname, s, SZ_LINE-strlen(newname));
- }
- iname = newname;
- }
-
- /* open the input FITS file */
- if( !(fun = FunOpen(iname, "rc", NULL)) ){
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
- }
-
- /* open the output FITS image, preparing to copy input params */
- if( !(fun2 = FunOpen(oname, omode, fun)) ){
- gerror(stderr, "can't FunOpen output file: %s\n", oname);
- }
-
- /* list: read x, y, val from list file */
- if( dolist ){
- /* make sure bitpix=n is specified */
- tmode = xstrdup(mode);
- if( _FunKeyword(tmode, "bitpix", NULL, tbuf, SZ_LINE) ){
- bitpix = atoi(tbuf);
- }
- else{
- gerror(stderr, "missing bitpix specification: '%s'\n", mode);
- }
- if( tmode ) xfree(tmode);
-
- /* parse column string */
- if( !(list = ColumnInfo(fun, colstr)) ){
- gerror(stderr, "can't get column info\n");
- }
-
- /* allocate space for the image */
- if( list->dim[1] )
- maxidx = list->dim[0]*list->dim[1];
- else
- maxidx = list->dim[0];
- if( !(buf=(char *)xcalloc(maxidx, ft_sizeof(bitpix))) ){
- gerror(stderr, "can't allocate image buffer of size %d\n", maxidx);
- }
-
- /* process events */
- while( FunTableRowGet(fun, &evrec, 1, NULL, &got) && got){
- /* get x, y indices */
- ix = (int)((evrec.x - list->tlmin[0]) / list->binsiz[0]);
- if( list->dim[1] )
- iy = (int)((evrec.y - list->tlmin[1]) / list->binsiz[1]);
- else
- iy = 0;
- /* make sure this pixel is within the image */
- idx = iy*list->dim[0]+ix;
- if( (idx < 0) || (idx >= maxidx) ){
- gerror(stderr,
- "indices (%d,%d) outside of image array (%d,%d) [tlmin problem?]\n",
- ix, iy, list->dim[0], list->dim[1]);
- }
- /* add pixel value */
- switch(bitpix){
- case 8:
- ((unsigned char *)buf)[idx] += (unsigned char)evrec.val;
- break;
- case 16:
- ((short *)buf)[idx] += (short)evrec.val;
- break;
- case 32:
- ((int *)buf)[idx] += (int)evrec.val;
- break;
- case -32:
- ((float *)buf)[idx] += (float)evrec.val;
- break;
- case -64:
- ((double *)buf)[idx] += evrec.val;
- break;
- }
- }
- /* write the output image, updating the FITS header from the orig file */
- if( !FunImagePut(fun2, buf, list->dim[0], list->dim[1], bitpix, NULL) ){
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
- }
- }
- /* no list: bin input data into an image */
- else{
- /* get required information from funtools structure */
- FunInfoGet(fun,
- FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
- if( type != FORCE_IMAGE ) FunInfoGet(fun, FUN_TYPE, &type, 0);
- /* set dim2 to 1 for a 1D image */
- if( dim2 == 0 ){
- /* oops, can't project a 1D image */
- if( doproj )
- gerror(stderr, "can't project a 1D image\n");
- else
- dim2 = 1;
- }
- /* dimension of projected 1D image */
- if( doproj ){
- switch(doproj ){
- case 'x':
- dim = dim1;
- break;
- case 'y':
- dim = dim2;
- break;
- }
- /* allocate buffer for 1D projected image */
- pbuf = (char *)xcalloc(dim, ABS(bitpix)/FT_WORDLEN);
- }
-
- /* process specific type of data */
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- /* if input data is int */
- if( bitpix >= 0 ){
- /* start by assuming we don't want to apply bscale ... */
- doscale = 0;
- if( mode && *mode ){
- tmode = xstrdup(mode);
- /* but if output data is float, we will apply bscale */
- if( _FunKeyword(tmode, "bitpix", NULL, tbuf, SZ_LINE) ){
- if( (i=atoi(tbuf)) < 0 ){
- /* apple bscale */
- doscale=1;
- }
- }
- if( tmode ) xfree(tmode);
- }
- }
- /* for float data, we apply bscale (won't actually happen) */
- else{
- doscale = 1;
- }
- if( !doscale ){
- if( mode && *mode ){
- mode = xrealloc(mode, strlen(mode)+SZ_LINE);
- strcat(mode, ",bscale=false");
- }
- else{
- mode = xstrdup("bscale=false");
- }
- }
- switch(doproj ){
- case 0:
- buf = NULL;
- for(j=1; j<=dim2; j++){
- /* extract and bin 1 row of the data section into an image buffer */
- if( !(buf = FunImageRowGet(fun, buf, j, j, mode)) )
- gerror(stderr, "can't FunImageRowGet: %s\n", iname);
- /* write output image, updating the FITS header from the orig file */
- if( !FunImageRowPut(fun2, buf, j, j, 0, 0, 0, NULL) )
- gerror(stderr, "can't FunImageRowPut: %s\n", oname);
- }
- break;
- case 'x':
- case 'y':
- buf = NULL;
- for(j=0; j<dim2; j++){
- /* extract and bin 1 row of the data section into an image buffer */
- if( !(buf = FunImageRowGet(fun, buf, j+1, j+1, mode)) )
- gerror(stderr, "can't FunImageRowGet: %s\n", iname);
- /* project each pixel of each line */
- for(i=0; i<dim1; i++){
- idx = (doproj == 'x') ? i : j;
- doimproj(dim, bitpix, (void *)buf, i, 0, (void *)pbuf, idx);
- }
- }
- /* write output image, updating the FITS header from the orig file */
- if( !FunImagePut(fun2, pbuf, dim, 0, bitpix, NULL) )
- gerror(stderr, "can't FunImagePut: %s\n", oname);
- break;
- }
- break;
-
- case FUN_TABLE:
- case FUN_EVENTS:
- case FORCE_IMAGE:
- switch(doproj ){
- case 0:
- /* extract and bin the data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, mode)) )
- gerror(stderr, "can't FunImageGet: %s\n", iname);
- /* write output image, updating the FITS header from the orig file */
- if( !FunImagePut(fun2, buf, 0, 0, 0, NULL) )
- gerror(stderr, "can't FunImagePut: %s\n", oname);
- break;
- case 'x':
- case 'y':
- /* extract and bin the data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, mode)) )
- gerror(stderr, "can't FunImageGet: %s\n", iname);
- /* project each pixel of each line */
- for(j=0; j<dim2; j++){
- for(i=0; i<dim1; i++){
- idx = (doproj == 'x') ? i : j;
- doimproj(dim, bitpix, (void *)buf, i, j, (void *)pbuf, idx);
- }
- }
- /* write output image, updating the FITS header from the orig file */
- if( !FunImagePut(fun2, pbuf, dim, 0, bitpix, NULL) )
- gerror(stderr, "can't FunImagePut: %s\n", oname);
- break;
- }
- break;
-
- default:
- gerror(stderr, "internal error: unknown type\n");
- break;
- }
- }
-
- /* we can explicitly flush remaining extensions that need copying ... */
- FunFlush(fun2, "copy=remaining");
-
- /* ... since we already flushed, we can close files in any order */
- FunClose(fun);
- FunClose(fun2);
-
- /* free up space */
- if( dolist ){
- /* free up memory */
- for(i=0; i<3; i++){
- if( list->colname[i] ) xfree(list->colname[i]);
- }
- xfree(list);
- }
- if( buf ) xfree(buf);
- if( pbuf ) xfree(pbuf);
- if( mode ) xfree(mode);
-
- return(0);
-}
diff --git a/funtools/funindex.tmpl b/funtools/funindex.tmpl
deleted file mode 100755
index 0bdbe44..0000000
--- a/funtools/funindex.tmpl
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/sh
-# set -x
-
-# initialize
-doascii=false
-doverbose=true
-gz=cat
-
-# process switches
-while [ x"$1" != x ]; do
- case $1 in
- -a) doascii=true
- shift
- continue;;
-
- -c) gz="gzip -c"
- shift
- continue;;
-
- -f) doascii=false
- shift
- continue;;
-
- -l) doverbose=true
- shift
- continue;;
-
- -s) doverbose=false
- shift
- continue;;
-
- *) break;;
- esac
-done
-
-# check for required arguments
-if [ x"$2" = x ]; then
- echo "usage: $0 [switches] input_fits 'key1 ... keyn' [output]"
- echo "output file is set to root_key.idx for use with funtools processing"
- echo " "
- echo "experimental switches (don't use unless you know what you are doing):"
- echo " -a # ASCII output, ignore -c (default: FITS table)"
- echo " -c # compress output using gzip"
- echo " -f # FITS table output (default: FITS table)"
- echo " -l # long output, i.e. with key value(s) (default: long)"
- echo " -s # short output, i.e. no key value(s) (default: long)"
- echo " "
- echo "output file name can be specified but funtools will not find it"
- exit 1
-fi
-
-# required arguments
-FILE=$1
-KEYS=$2
-if [ x"$3" != x ]; then
- IDX=$3
-fi
-
-# output index file name
-if [ x"$IDX" = x ]; then
- IDX1=`basename $FILE | sed 's/\(.*\)\.[^.]*/\1/g'`
- if [ x"$IDX1" = x ]; then
- IDX1=$FILE
- fi
- IDX2=`echo $KEYS | sed 's/ /_/g'`
- IDX=${IDX1}_${IDX2}.idx
-fi
-
-# input and output rows
-ROWS1="\$N $KEYS"
-if [ $doverbose = true ]; then
- ROWS2="N $KEYS"
-else
- ROWS2='N'
-fi
-
-# remove possible already existing columns named N
-# sort on the key column and output an additional column N
-# output only the key and N columns
-if [ $doascii = true ]; then
- funtable $FILE stdout "-N" | \
- funtable -s "$KEYS" stdin stdout "$ROWS1" | \
- fundisp -T stdin'[1]' "$ROWS2" > $IDX
-else
- funtable $FILE stdout "-N" | \
- funtable -s "$KEYS" stdin stdout "$ROWS1" | \
- funtable stdin'[1]' $IDX "$ROWS2"
-fi
-if [ x"$gz" != x"cat" ]; then
- gzip $IDX
- IDX=$IDX.gz
-fi
-
-if [ -s $IDX ]; then
- echo "Index file $IDX created for data file $FILE"
-else
- echo "ERROR: Index file $IDX not created"
-fi
diff --git a/funtools/funinfo.c b/funtools/funinfo.c
deleted file mode 100644
index 598bf4e..0000000
--- a/funtools/funinfo.c
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * FunInfoGet -- get information from the funtools struct
- *
- */
-#ifdef __STDC__
-int FunInfoGet(Fun fun, ...)
-{
- int type;
- int got;
- char *addr;
- Fun ofun;
- va_list args;
- va_start(args, fun);
-#else
-int FunInfoGet(va_alist) va_dcl
-{
- Fun fun;
- int type;
- int got;
- char *addr;
- Fun ofun;
- va_list args;
- va_start(args);
- fun = va_arg(args, Fun);
-#endif
- /* just in case ... */
- if( !_FunValid(fun) ){
- gerror(stderr, "invalid funtools handle\n");
- return 0;
- }
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- for(got=0; (type=va_arg(args, int)); got++){
- addr=va_arg(args, void *);
- ofun = fun;
- if( fun->current ) fun = fun->current;
- switch(type){
- case FUN_FNAME:
- if( addr ) memcpy(addr, &fun->fname, sizeof(fun->fname));
- break;
- case FUN_GIO:
- if( addr ) memcpy(addr, &fun->gio, sizeof(fun->gio));
- break;
- case FUN_HEADER:
- if( addr ) memcpy(addr, &fun->header, sizeof(fun->header));
- break;
- case FUN_THEADER:
- if( addr ) memcpy(addr, &fun->theader, sizeof(fun->theader));
- break;
- case FUN_WCS:
- if( addr ) memcpy(addr, &fun->wcs, sizeof(fun->wcs));
- break;
- case FUN_WCS0:
- if( addr ) memcpy(addr, &fun->wcs0, sizeof(fun->wcs0));
- break;
- case FUN_TYPE:
- if( addr ) memcpy(addr, &fun->type, sizeof(fun->type));
- break;
- case FUN_BITPIX:
- if( addr ) memcpy(addr, &fun->bitpix, sizeof(fun->bitpix));
- break;
- case FUN_MIN1:
- if( addr ) memcpy(addr, &fun->min1, sizeof(fun->min1));
- break;
- case FUN_MAX1:
- if( addr ) memcpy(addr, &fun->max1, sizeof(fun->max1));
- break;
- case FUN_MIN2:
- if( addr ) memcpy(addr, &fun->min2, sizeof(fun->min2));
- break;
- case FUN_MAX2:
- if( addr ) memcpy(addr, &fun->max2, sizeof(fun->max2));
- break;
- case FUN_DIM1:
- if( addr ) memcpy(addr, &fun->dim1, sizeof(fun->dim1));
- break;
- case FUN_DIM2:
- if( addr ) memcpy(addr, &fun->dim2, sizeof(fun->dim2));
- break;
- case FUN_DIMS:
- if( addr ) memcpy(addr, &fun->dims, sizeof(fun->dims));
- break;
- case FUN_ENDIAN:
- if( addr ) memcpy(addr, &fun->endian, sizeof(fun->endian));
- break;
- case FUN_FILTER:
- if( addr ) memcpy(addr, &fun->filter, sizeof(fun->filter));
- break;
- case FUN_OPS:
- if( addr ) memcpy(addr, &fun->ops, sizeof(fun->ops));
- break;
- /* image information */
- case FUN_DTYPE:
- if( addr ) memcpy(addr, &fun->dtype, sizeof(fun->dtype));
- break;
- case FUN_DLEN:
- if( addr ) memcpy(addr, &fun->dlen, sizeof(fun->dlen));
- break;
- case FUN_DPAD:
- if( addr ) memcpy(addr, &fun->dpad, sizeof(fun->dpad));
- break;
- case FUN_DOBLANK:
- if( addr ) memcpy(addr, &fun->doblank, sizeof(fun->doblank));
- break;
- case FUN_BLANK:
- if( addr ) memcpy(addr, &fun->blank, sizeof(fun->blank));
- break;
- case FUN_SCALED:
- if( addr ) memcpy(addr, &fun->scaled, sizeof(fun->scaled));
- break;
- case FUN_BSCALE:
- if( addr ) memcpy(addr, &fun->bscale, sizeof(fun->bscale));
- break;
- case FUN_BZERO:
- if( addr ) memcpy(addr, &fun->bzero, sizeof(fun->bzero));
- break;
- /* table information */
- case FUN_BINCOLS:
- if( addr ) memcpy(addr, &fun->bincols, sizeof(fun->bincols));
- break;
- case FUN_BINOFFS:
- if( addr ) memcpy(addr, fun->bin, sizeof(fun->bin));
- break;
- case FUN_ROWSIZE:
- if( addr ) memcpy(addr, &fun->rowsize, sizeof(fun->rowsize));
- break;
- case FUN_NROWS:
- if( addr ) memcpy(addr, &fun->total, sizeof(fun->total));
- break;
- case FUN_ROW:
- if( addr ) memcpy(addr, &fun->io, sizeof(fun->io));
- break;
- case FUN_OVERFLOW:
- if( addr ) memcpy(addr, &fun->overflow, sizeof(fun->overflow));
- break;
- /* array information */
- case FUN_SKIP:
- if( addr ) memcpy(addr, &fun->skip, sizeof(fun->skip));
- break;
- /* section information */
- case FUN_IFUN:
- case FUN_IFUN0:
- if( addr ) memcpy(addr, &fun->ifun, sizeof(fun->ifun));
- break;
- case FUN_BFUN:
- if( addr ) memcpy(addr, fun->bfun, sizeof(fun->bfun));
- break;
- case FUN_SECT_X0:
- if( addr ) memcpy(addr, &fun->x0, sizeof(fun->x0));
- break;
- case FUN_SECT_X1:
- if( addr ) memcpy(addr, &fun->x1, sizeof(fun->x1));
- break;
- case FUN_SECT_Y0:
- if( addr ) memcpy(addr, &fun->y0, sizeof(fun->y0));
- break;
- case FUN_SECT_Y1:
- if( addr ) memcpy(addr, &fun->y1, sizeof(fun->y1));
- break;
- case FUN_SECT_BLOCK:
- if( addr ) memcpy(addr, &fun->block, sizeof(fun->block));
- break;
- case FUN_SECT_BTYPE:
- if( addr ) memcpy(addr, &fun->btype, sizeof(fun->btype));
- break;
- case FUN_SECT_DIM1:
- if( addr ) memcpy(addr, &fun->odim1, sizeof(fun->odim1));
- break;
- case FUN_SECT_DIM2:
- if( addr ) memcpy(addr, &fun->odim2, sizeof(fun->odim2));
- break;
- case FUN_SECT_DIMS:
- if( addr ) memcpy(addr, &fun->odims, sizeof(fun->odims));
- break;
- case FUN_SECT_BITPIX:
- if( addr ) memcpy(addr, &fun->obitpix, sizeof(fun->obitpix));
- break;
- case FUN_SECT_DTYPE:
- if( addr ) memcpy(addr, &fun->odtype, sizeof(fun->odtype));
- break;
- /* convenient ways to get to data in binned images and tables */
- case FUN_RAWBUF:
- if( addr ) memcpy(addr, &fun->rawbuf, sizeof(fun->rawbuf));
- break;
- case FUN_RAWSIZE:
- if( addr ) memcpy(addr, &fun->rawsize, sizeof(fun->rawsize));
- break;
- /* specified columns */
- case FUN_NCOL:
- if( addr ) memcpy(addr, &fun->ncol, sizeof(fun->ncol));
- break;
- case FUN_COLS:
- if( addr ) memcpy(addr, &fun->cols, sizeof(fun->cols));
- break;
- case FUN_LTYPE:
- if( addr ) memcpy(addr, &ofun->ltype, sizeof(ofun->ltype));
- break;
- case FUN_LMEM:
- if( addr ) memcpy(addr, &ofun->lmem, sizeof(ofun->lmem));
- break;
- case FUN_HEAD:
- if( addr ) memcpy(addr, &ofun->head, sizeof(ofun->head));
- break;
- case FUN_CURRENT:
- if( addr ) memcpy(addr, &ofun->current, sizeof(ofun->current));
- break;
- case FUN_NEXT:
- if( addr ) memcpy(addr, &ofun->next, sizeof(ofun->next));
- break;
- case FUN_RAWPARAM:
- if( addr ) memcpy(addr, &fun->doraw, sizeof(fun->doraw));
- break;
- case FUN_PRIMARYHEADER:
- if( addr ) memcpy(addr, &fun->doprim, sizeof(fun->doprim));
- break;
- case FUN_VCOLS:
- if( addr ) memcpy(addr, &fun->vcols, sizeof(fun->vcols));
- break;
- case FUN_VFMT:
- if( addr ) memcpy(addr, &fun->vfmt, sizeof(fun->vfmt));
- break;
- default:
- gerror(stderr,
- "invalid info parameter passed to FunInfoGet: %d\n", type);
- return(got);
- }
- }
- return got;
-}
-
-/*
- *
- * FunInfoPut -- set information in the funtools struct
- *
- */
-#ifdef __STDC__
-int FunInfoPut(Fun fun, ...)
-{
- Fun ref;
- Fun oifun;
- Fun ofun;
- int i;
- int type;
- int got;
- char *addr;
- va_list args;
- va_start(args, fun);
-#else
-int FunInfoPut(va_alist) va_dcl
-{
- Fun fun;
- Fun ref;
- Fun oifun;
- Fun ofun;
- int i;
- int type;
- int got;
- char *addr;
- va_list args;
- va_start(args);
- fun = va_arg(args, Fun);
-#endif
- /* just in case ... */
- if( !_FunValid(fun) ){
- gerror(stderr, "invalid funtools handle\n");
- return 0;
- }
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- ofun = fun;
- if( fun->current ) fun = fun->current;
- for(got=0; (type=va_arg(args, int)); got++){
- addr=va_arg(args, void *);
- switch(type){
- case FUN_FNAME:
- if( addr ){
- if( fun->fname ) xfree(fun->fname);
- fun->fname = xstrdup(addr);
- }
- break;
- case FUN_GIO:
- if( addr ) memcpy(&fun->gio, addr, sizeof(fun->gio));
- break;
- case FUN_HEADER:
- if( addr ) memcpy(&fun->header, addr, sizeof(fun->header));
- break;
- case FUN_THEADER:
- if( addr ) memcpy(&fun->theader, addr, sizeof(fun->theader));
- break;
- case FUN_WCS:
- if( addr ) memcpy(&fun->wcs, addr, sizeof(fun->wcs));
- break;
- case FUN_WCS0:
- if( addr ) memcpy(&fun->wcs0, addr, sizeof(fun->wcs0));
- break;
- case FUN_TYPE:
- if( addr ) memcpy(&fun->type, addr, sizeof(fun->type));
- break;
- case FUN_BITPIX:
- if( addr ) memcpy(&fun->bitpix, addr, sizeof(fun->bitpix));
- break;
- case FUN_MIN1:
- if( addr ) memcpy(&fun->min1, addr, sizeof(fun->min1));
- break;
- case FUN_MAX1:
- if( addr ) memcpy(&fun->max1, addr, sizeof(fun->max1));
- break;
- case FUN_MIN2:
- if( addr ) memcpy(&fun->min2, addr, sizeof(fun->min2));
- break;
- case FUN_MAX2:
- if( addr ) memcpy(&fun->max2, addr, sizeof(fun->max2));
- break;
- case FUN_DIM1:
- if( addr ) memcpy(&fun->dim1, addr, sizeof(fun->dim1));
- break;
- case FUN_DIM2:
- if( addr ) memcpy(&fun->dim2, addr, sizeof(fun->dim2));
- break;
- case FUN_DIMS:
- if( addr ) memcpy(&fun->dims, addr, sizeof(fun->dims));
- break;
- case FUN_ENDIAN:
- if( addr ) memcpy(&fun->endian, addr, sizeof(fun->endian));
- break;
- case FUN_OPS:
- if( addr ) memcpy(&fun->ops, addr, sizeof(fun->ops));
- break;
- case FUN_FILTER:
- if( addr ) memcpy(&fun->filter, addr, sizeof(fun->filter));
- break;
- /* image information */
- case FUN_DTYPE:
- if( addr ) memcpy(&fun->dtype, addr, sizeof(fun->dtype));
- break;
- case FUN_DLEN:
- if( addr ) memcpy(&fun->dlen, addr, sizeof(fun->dlen));
- break;
- case FUN_DPAD:
- if( addr ) memcpy(&fun->dpad, addr, sizeof(fun->dpad));
- break;
- case FUN_DOBLANK:
- if( addr ) memcpy(&fun->doblank, addr, sizeof(fun->doblank));
- break;
- case FUN_BLANK:
- if( addr ) memcpy(&fun->blank, addr, sizeof(fun->blank));
- break;
- case FUN_SCALED:
- if( addr ) memcpy(&fun->scaled, addr, sizeof(fun->scaled));
- break;
- case FUN_BSCALE:
- if( addr ) memcpy(&fun->bscale, addr, sizeof(fun->bscale));
- break;
- case FUN_BZERO:
- if( addr ) memcpy(&fun->bzero, addr, sizeof(fun->bzero));
- break;
- /* table information */
- case FUN_BINCOLS:
- if( addr ) memcpy(&fun->bincols, addr, sizeof(fun->bincols));
- break;
- case FUN_BINOFFS:
- if( addr ) memcpy(fun->bin, addr, sizeof(fun->bin));
- break;
- case FUN_ROWSIZE:
- if( addr ) memcpy(&fun->rowsize, addr, sizeof(fun->rowsize));
- break;
- case FUN_NROWS:
- if( addr ) memcpy(&fun->total, addr, sizeof(fun->total));
- break;
- case FUN_OVERFLOW:
- if( addr ) memcpy(&fun->overflow, addr, sizeof(fun->overflow));
- break;
- /* array information */
- case FUN_SKIP:
- if( addr ) memcpy(&fun->skip, addr, sizeof(fun->skip));
- break;
- /* section information */
- case FUN_IFUN:
- if( addr ){
- ref = *(Fun *)addr;
- if( _FunValid(ref) ){
- /* first, remove old ifun from the backlink list */
- if( (oifun = fun->ifun) != NULL ){
- for(i=0; i<FUN_MAXBFUN; i++){
- if( oifun->bfun[i] == fun ){
- oifun->bfun[i] = NULL;
- break;
- }
- }
- }
- /* set new reference handle */
- fun->ifun = ref;
- /* enter this handle in the backlink list of the reference file */
- for(i=0; i<FUN_MAXBFUN; i++){
- if( !fun->ifun->bfun[i] ){
- fun->ifun->bfun[i] = fun;
- break;
- }
- }
- /* free old columns */
- _FunColumnFree(fun);
- /* new ref handle means reset the ops for this funtools struct */
- fun->ops = 0;
- fun->bytes = 0;
- }
- }
- /* reset the fun handle */
- else
- fun->ifun = NULL;
- break;
- /* same as FUN_IFUN above, but don't reset I/O or columns */
- case FUN_IFUN0:
- if( addr ){
- ref = *(Fun *)addr;
- if( _FunValid(ref) ){
- /* first, remove old ifun from the backlink list */
- if( (oifun = fun->ifun) != NULL ){
- for(i=0; i<FUN_MAXBFUN; i++){
- if( oifun->bfun[i] == fun ){
- oifun->bfun[i] = NULL;
- break;
- }
- }
- }
- /* set new reference handle */
- fun->ifun = ref;
- /* enter this handle in the backlink list of the reference file */
- for(i=0; i<FUN_MAXBFUN; i++){
- if( !fun->ifun->bfun[i] ){
- fun->ifun->bfun[i] = fun;
- break;
- }
- }
- }
- }
- /* reset the fun handle */
- else
- fun->ifun = NULL;
- break;
- case FUN_BFUN:
- if( addr ) memcpy(fun->bfun, addr, sizeof(fun->bfun));
- break;
- case FUN_SECT_X0:
- if( addr ) memcpy(&fun->x0, addr, sizeof(fun->x0));
- break;
- case FUN_SECT_X1:
- if( addr ) memcpy(&fun->x1, addr, sizeof(fun->x1));
- break;
- case FUN_SECT_Y0:
- if( addr ) memcpy(&fun->y0, addr, sizeof(fun->y0));
- break;
- case FUN_SECT_Y1:
- if( addr ) memcpy(&fun->y1, addr, sizeof(fun->y1));
- break;
- case FUN_SECT_BLOCK:
- if( addr ) memcpy(&fun->block, addr, sizeof(fun->block));
- break;
- case FUN_SECT_BTYPE:
- if( addr ) memcpy(&fun->btype, addr, sizeof(fun->btype));
- break;
- case FUN_SECT_DIM1:
- if( addr ) memcpy(&fun->odim1, addr, sizeof(fun->odim1));
- break;
- case FUN_SECT_DIM2:
- if( addr ) memcpy(&fun->odim2, addr, sizeof(fun->odim2));
- break;
- case FUN_SECT_DIMS:
- if( addr ) memcpy(&fun->odims, addr, sizeof(fun->odims));
- break;
- case FUN_SECT_BITPIX:
- if( addr ) memcpy(&fun->obitpix, addr, sizeof(fun->obitpix));
- break;
- case FUN_SECT_DTYPE:
- if( addr ) memcpy(&fun->odtype, addr, sizeof(fun->odtype));
- break;
- /* convenient ways to get to data in binned images and tables */
- case FUN_RAWBUF:
- if( addr ) memcpy(&fun->rawbuf, addr, sizeof(fun->rawbuf));
- break;
- case FUN_RAWSIZE:
- if( addr ) memcpy(&fun->rawsize, addr, sizeof(fun->rawsize));
- break;
- /* specified columns */
- case FUN_NCOL:
- if( addr ) memcpy(&fun->ncol, addr, sizeof(fun->ncol));
- break;
- case FUN_COLS:
- if( addr ) memcpy(&fun->cols, addr, sizeof(fun->cols));
- break;
- case FUN_LTYPE:
- if( addr ) memcpy(&ofun->ltype, addr, sizeof(ofun->ltype));
- break;
- case FUN_LMEM:
- if( addr ) memcpy(&ofun->lmem, addr, sizeof(ofun->lmem));
- break;
- case FUN_HEAD:
- if( addr ) memcpy(&ofun->head, addr, sizeof(ofun->head));
- break;
- case FUN_CURRENT:
- if( addr ) memcpy(&ofun->current, addr, sizeof(ofun->current));
- break;
- case FUN_NEXT:
- if( addr ) memcpy(&ofun->next, addr, sizeof(ofun->next));
- break;
- case FUN_RAWPARAM:
- if( addr ) memcpy(&fun->doraw, addr, sizeof(fun->doraw));
- break;
- case FUN_PRIMARYHEADER:
- if( addr ) memcpy(&fun->doprim, addr, sizeof(fun->doprim));
- break;
- case FUN_VCOLS:
- if( addr ){
- if( fun->vcols ) xfree(fun->vcols);
- fun->vcols = xstrdup(addr);
- }
- case FUN_VFMT:
- if( addr ){
- if( fun->vfmt ) xfree(fun->vfmt);
- fun->vfmt = xstrdup(addr);
- }
- break;
- default:
- gerror(stderr,
- "invalid info parameter passed to FunInfoPut: %d\n", type);
- return(got);
- }
- }
- return got;
-}
-
diff --git a/funtools/funjoin.c b/funtools/funjoin.c
deleted file mode 100644
index 9ca019e..0000000
--- a/funtools/funjoin.c
+++ /dev/null
@@ -1,1172 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-/*
- * funjoin -j key t1.fits t2.fits t3.fits foo.fits
- */
-
-#include <math.h>
-#include <funtoolsP.h>
-#include <word.h>
-
-/* #define JOIN_DEBUG 1 */
-#if JOIN_DEBUG
-#define IPRINTF(x) fprintf x
-#else
-#define IPRINTF(x)
-#endif
-
-#ifndef ftol
-#define ftol(x,y,t) (fabs((double)x-(double)y)<=((double)t+(double)1.0E-15))
-#endif
-
-#ifndef feq
-#define feq(x,y) (fabs((double)x-(double)y)<=(double)1.0E-15)
-#endif
-
-#define MAXIFILE 32
-#define MAXOFILE 1
-#define MAXROW 8192
-
-#define KEY_STRING 1
-#define KEY_NUMERIC 2
-
-#define JFILES_COL "JFILES"
-
-typedef unsigned int JBITMASK;
-#define JBITSIZE (int)sizeof(JBITMASK)
-
-static int maxrow=MAXROW;
-
-typedef struct _colrec{
- char *name, *oname;
- int type, mode, offset, n, width;
- int coffset;
-} *XCol, XColRec;
-
-
-typedef struct _filerec{
- char *fname;
- char *jname;
- char *bstr;
- char *actstr;
- Fun fun;
- int eof;
- int rowsize;
- int rowoffset;
- char *rowbuf;
- char *blank;
- int counter;
- int tcol;
- int maxcol;
- int ncol;
- XCol cols;
- int dtype;
- int jtype, jmode, joffset, jn, jwidth;
- int idx;
- double dval;
- double mval;
- char *sval;
- int ibase;
- GIO igio;
- int irow;
- int maxindex;
- int nindex;
- int *indexes;
-} *XFile, XFileRec;
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s <switches> ifile1 ifile2 ... ifilen ofile\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -a cols # columns to activate in all files\n");
- fprintf(stderr, " -a1 cols ... an cols # columns to activate in each file\n");
- fprintf(stderr, " -b 'c1:bvl,c2:bv2' # blank values for common columns in all files\n");
- fprintf(stderr, " -bn 'c1:bv1,c2:bv2' # blank values for columns in specific files\n");
- fprintf(stderr, " -j col # column to join in all files\n");
- fprintf(stderr, " -j1 col ... jn col # column to join in each file\n");
- fprintf(stderr, " -m min # min matches to output a row\n");
- fprintf(stderr, " -M max # max matches to output a row\n");
- fprintf(stderr, " -s # add 'jfiles' status column\n");
- fprintf(stderr, " -S col # add col as status column\n");
- fprintf(stderr, " -t tol # tolerance for joining numeric cols [2 files only]\n");
- fprintf(stderr, "Between 2 and %d input files are allowed.\n", MAXIFILE);
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-static void
-JoinMakeBlank(XFile file, char *defblank)
-#else
-static void
-JoinMakeBlank(file, defblank)
- XFile file;
- char *defblank;
-#endif
-{
- int i, j;
- int ip=0;
- char tbuf[SZ_LINE];
- char *b;
- char *blanks[2];
- char *t, *v;
- unsigned char bval;
- short sval;
- unsigned short usval;
- int ival;
- longlong lval;
- unsigned int uival;
- float fval;
- double dval;
-
- /* start with a blank line */
- file->blank = xcalloc(file->rowsize, sizeof(char));
- /* blank specifications are separated by comma or semi */
- newdtable(",;");
-
- /* there are 2 places where we can get blank values: default and file */
- if( defblank )
- blanks[0] = xstrdup(defblank);
- else
- blanks[0] = NULL;
- if( file->bstr )
- blanks[1] = xstrdup(file->bstr);
- else
- blanks[1] = NULL;
-
-
- /* process defaults first, then overwrite with specifics */
- for(j=0; j<2; j++){
- if( !blanks[j] || !*blanks[j] ) continue;
- ip = 0;
- while( word(blanks[j], tbuf, &ip) ){
- if( (t=strchr(tbuf, ':')) ){
- v=t+1;
- *t = '\0';
- for(i=0; i<file->ncol; i++){
- if( !strcasecmp(tbuf, file->cols[i].oname) ){
- b = file->blank+file->cols[i].coffset;
- switch(file->cols[i].type){
- case 'L':
- bval = atoi(v);
- memcpy(b, &bval, sizeof(unsigned char));
- break;
- case 'X':
- switch(file->cols[i].width/file->cols[i].n){
- case 0:
- case 1:
- bval = atoi(v);
- memcpy(b, &bval, sizeof(unsigned char));
- break;
- case 2:
- sval = atoi(v);
- memcpy(b, &sval, sizeof(short));
- break;
- case 4:
- ival = atoi(v);
- memcpy(b, &ival, sizeof(int));
- break;
- default:
- gerror(stderr, "only set blank value on X of size 1,2,4\n");
- break;
- }
- break;
- case 'B':
- bval = atoi(v);
- memcpy(b, &bval, sizeof(unsigned char));
- break;
- case 'I':
- sval = atoi(v);
- memcpy(b, &sval, sizeof(short));
- break;
- case 'J':
- ival = atoi(v);
- memcpy(b, &ival, sizeof(int));
- break;
- case 'K':
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- lval = atoll(v);
- memcpy(b, &lval, sizeof(longlong));
- break;
- case 'U':
- usval = atoi(v);
- memcpy(b, &usval, sizeof(unsigned short));
- break;
- case 'V':
- uival = atoi(v);
- memcpy(b, &uival, sizeof(unsigned int));
- break;
- case 'E':
- if( !strcasecmp(t, "nan") ){
- fval = getnanf();
- }
- else{
- fval = atof(v);
- }
- memcpy(b, &fval, sizeof(float));
- break;
- case 'D':
- if( !strcasecmp(t, "nan") ){
- dval = getnand();
- }
- else{
- dval = atof(v);
- }
- memcpy(b, &dval, sizeof(double));
- break;
- case 'A':
- strncpy(b, v, file->cols[i].width);
- break;
- }
- }
- }
- }
- else{
- gerror(stderr, "invalid blank specification: %s\n", tbuf);
- }
- }
- }
- /* free up delim table */
- freedtable();
- /* free blank strings */
- for(i=0; i<2; i++){
- if( blanks[i] ) xfree(blanks[i]);
- }
-}
-
-#ifdef ANSI_FUNC
-static int
-JoinAddCol(XFile file, char *name, char *oname,
- int type, int mode, int offset, int n, int width, int coffset)
-#else
-static int
-JoinAddCol(file, name, oname, type, mode, offset, n, width, coffset)
- XFile file;
- char *name;
- char *oname;
- int type;
- int mode;
- int offset;
- int n;
- int width;
- int coffset;
-#endif
-{
- if( !file->maxcol ){
- file->maxcol = 1;
- file->cols = xcalloc(file->maxcol, sizeof(XColRec));
- }
- else if( file->ncol >= file->maxcol ){
- file->maxcol *= 2;
- file->cols = xrealloc(file->cols, file->maxcol*sizeof(XColRec));
- }
- file->cols[file->ncol].name = xstrdup(name);;
- file->cols[file->ncol].oname = xstrdup(oname);;
- file->cols[file->ncol].type = type;
- file->cols[file->ncol].mode = mode;
- file->cols[file->ncol].offset = offset;
- file->cols[file->ncol].n = n;
- file->cols[file->ncol].width = width;
- file->cols[file->ncol].coffset = coffset;
- file->ncol++;
- return file->ncol;
-}
-
-#ifdef ANSI_FUNC
-static int
-JoinFilesLeft(XFile ifiles, int nfile)
-#else
-static int
-JoinFilesLeft(ifiles, nfile)
- XFile ifiles;
- int nfile;
-#endif
-{
- int i;
- int left=0;
-
- for(i=0; i<nfile; i++){
- if( !ifiles[i].eof ){
- left++;
- }
- }
- return left;
-}
-
-#ifdef ANSI_FUNC
-static int
-JoinReadNext(XFile ifiles, int nfile, int which)
-#else
-static int
-JoinReadNext(ifiles, nfile, which)
- XFile ifiles;
- int nfile;
- int which;
-#endif
-{
- int i;
- int got;
- int lo, hi;
- int nrec=0;
-
- if( which < 0 ){
- lo = 0;
- hi = ABS(which)-1;
- }
- else{
- lo = which;
- hi = which;
- }
- if( hi > nfile ) return 0;
- for(i=lo; i<=hi; i++){
- if( ifiles[i].eof ) continue;
- FunTableRowGet(ifiles[i].fun, (void *)&(ifiles[i]), 1, NULL, &got);
- if( !got ){
- ifiles[i].eof = 1;
- }
- else{
- nrec++;
- }
- }
- return nrec;
-}
-
-#ifdef ANSI_FUNC
-static int
-JoinGetMatches(XFile ifiles, int nfile, int ktype, double tol, char *matches)
-#else
-static int
-JoinGetMatches(ifiles, nfile, ktype, tol, matches)
- XFile ifiles;
- int nfile;
- int ktype;
- double tol;
- char *matches;
-#endif
-{
- int i;
- int m=0;
- int ibase=-1;
- char *sval=NULL;
- double dval=0.0;
-
- /* no matches yet */
- memset(matches, 0, nfile);
- /* clear index position information */
- for(i=0; i<nfile; i++){
- ifiles[i].ibase = 0;
- ifiles[i].irow = -1;
- }
- /* get first valid file */
- for(i=0; i<nfile; i++){
- if( ifiles[i].eof ) continue;
- ibase = i;
- break;
- }
- /*make sure we have a valid file */
- if( ibase < 0 ) return 0;
- /* process all files and look for matches */
- switch(ktype){
- case KEY_STRING:
- /* get base */
- for(i=0; i<nfile; i++){
- if( ifiles[i].eof ) continue;
- /* smallest value is base */
- if( strcmp(ifiles[i].sval, ifiles[ibase].sval) < 0 ){
- ibase = i;
- }
- }
- /* this is the smallest value */
- sval = ifiles[ibase].sval;
- /* look for matches in all valid files */
- for(i=0; i<nfile; i++){
- if( ifiles[i].eof ) continue;
- /* ascii requires exact string match */
- if( !strcmp(ifiles[i].sval, sval) ){
- matches[m++] = i;
- }
- }
- break;
- case KEY_NUMERIC:
- /* get base */
- for(i=0; i<nfile; i++){
- if( ifiles[i].eof ) continue;
- /* smallest value is base */
- if( ifiles[i].dval < ifiles[ibase].dval ){
- ibase = i;
- }
- }
- /* this is the smallest value */
- dval = ifiles[ibase].dval;
- FunInfoGet(ifiles[ibase].fun, FUN_ROW, &ifiles[ibase].irow, 0);
- /* look for matches in all valid files */
- for(i=0; i<nfile; i++){
- if( ifiles[i].eof ) continue;
- /* tolerance test */
- if( (tol > 0.0) && ftol(ifiles[i].dval,dval,tol) ){
- matches[m++] = i;
- ifiles[i].mval = dval;
- FunInfoGet(ifiles[i].fun, FUN_ROW, &ifiles[i].irow, 0);
- }
- /* "exact" match */
- else if( feq(ifiles[i].dval,dval) ){
- matches[m++] = i;
- ifiles[i].irow = -1;
- }
- }
- break;
- }
- if( ibase >=0 ) ifiles[ibase].ibase = 1;
- return m;
-}
-
-#ifdef ANSI_FUNC
-static int
-JoinAddIndex(XFile ifile, int idx)
-#else
-static int
-JoinAddIndex(ifile, idx)
- XFile ifile;
- int idx;
-#endif
-{
- if( !ifile->maxindex ){
- ifile->maxindex = 1;
- ifile->indexes = xcalloc(ifile->maxindex, sizeof(int));
- }
- else if( ifile->nindex >= ifile->maxindex ){
- ifile->maxindex *= 2;
- ifile->indexes = xrealloc(ifile->indexes, ifile->maxindex*sizeof(int));
- }
- ifile->indexes[ifile->nindex++] = idx;
- return ifile->nindex;
-}
-
-#ifdef ANSI_FUNC
-static void
-JoinGatherRows(XFile ifiles, int nfile, int ktype, double tol,
- char *matches, int nmatch, int *resetflag)
-#else
-static void
-JoinGatherRows(ifiles, nfile, ktype, tol, matches, nmatch, resetflag)
- XFile ifiles;
- int nfile;
- int ktype;
- double tol;
- char *matches;
- int nmatch;
- int *resetflag
-#endif
-{
- int i, j;
- int ibase=-1;
- char *sval=NULL;
- double dval;
- double mval;
-
- /* no need to reset rows yet */
- *resetflag = -1;
- /* make sure we have matches to process */
- if( !nmatch ) return;
- /* find base value */
- for(j=0; j<nmatch; j++){
- i = matches[j];
- if( ifiles[i].ibase ){
- ibase = i;
- break;
- }
- }
- /* should never happen */
- if( ibase < 0 ) return;
- /* for each match file, look for successive rows that also match */
- for(j=0; j<nmatch; j++){
- i = matches[j];
- ifiles[i].nindex = 0;
- JoinAddIndex(&ifiles[i], ifiles[i].idx);
- switch(ktype){
- case KEY_STRING:
- sval = ifiles[i].sval;
- while( JoinReadNext(ifiles, nfile, i) ){
- if( !strcmp(sval,ifiles[i].sval) ){
- JoinAddIndex(&ifiles[i], ifiles[i].idx);
- }
- else{
- break;
- }
- }
- break;
- case KEY_NUMERIC:
- dval = ifiles[i].dval;
- mval = ifiles[i].mval;
- while( JoinReadNext(ifiles, nfile, i) ){
- if( (tol > 0.0) && (i!=ibase) && ftol(ifiles[i].dval,mval,tol) ){
- JoinAddIndex(&ifiles[i], ifiles[i].idx);
- }
- else if( feq(ifiles[i].dval,dval) ){
- JoinAddIndex(&ifiles[i], ifiles[i].idx);
- }
- else{
- /* If this is the base file and we are using a tolerance, and the
- difference between the last base and this base value is less than
- twice the tolerance, we have to reset all other file positions
- and re-check those values against this new base value. */
- if( (tol > 0.0) && (i==ibase) && ftol(ifiles[i].dval,dval,(2*tol)) ){
- *resetflag = ibase;
- }
- break;
- }
- }
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static int
-JoinWriteRows(XFile files, XFile ifiles, int nfile, char *matches,
- int nmatch, int jbits, XFile ofiles)
-#else
-static int
-JoinWriteRows(files, ifiles, nfile, matches, nmatch, jbits, ofiles)
- XFile files;
- XFile ifiles;
- int nfile;
- char *matches;
- int nmatch;
- int jbits;
- XFile ofiles;
-#endif
-{
- int i, j, k;
- int ii;
- int got;
- int nrow=1;
- char *buf;
- char *rowptr;
- char *flags=NULL;
- JBITMASK *jfiles=NULL;
-
- /* allocate flags to tell which files we proces */
- if( !(flags=xcalloc(nfile, sizeof(char))) ){
- return 0;
- }
- /* allocate space for joinfiles bitflag */
- if( jbits ){
- if( !(jfiles=xcalloc(jbits/JBITSIZE, JBITSIZE)) ){
- return 0;
- }
- }
-
- /* set initial values for files which have joins */
- for(i=0; i<nmatch; i++){
- ii = (int)matches[i];
- flags[ii] = 1;
- nrow *= ifiles[ii].nindex;
- ifiles[ii].counter = 0;
- }
-
- /* process all rows */
- for(i=0; i<nrow; i++){
- /* clear output rowbuf */
- memset(ofiles[0].rowbuf, 0, ofiles[0].rowsize);
- /* make up the row */
- for(j=0; j<nfile; j++){
- if( !flags[j] ){
- /* move blanks into output record for this row */
- IPRINTF((stderr, "blank "));
- memcpy(ofiles[0].rowbuf+files[j].rowoffset,
- files[j].blank, files[j].rowsize);
- }
- /* retrieve data and transfer active columns to output */
- else{
- ii = ifiles[j].counter;
- IPRINTF((stderr, "%d ", ifiles[j].indexes[ii]));
- if( FunTableRowSeek(files[j].fun, ifiles[j].indexes[ii], NULL) <0 ){
- gerror(stderr, "can't seek to row %d: %s\n",
- ifiles[j].indexes[ii], ifiles[j].fname);
- }
- if( !(buf=FunTableRowGet(files[j].fun, NULL, 1, NULL, &got)) || !got ){
- gerror(stderr, "can't read row %d: %s\n",
- ifiles[j].indexes[ii], ifiles[j].fname);
- }
- rowptr = ofiles[0].rowbuf+files[j].rowoffset;
- for(k=0; k<files[j].ncol; k++){
- memcpy(rowptr, buf+files[j].cols[k].offset, files[j].cols[k].width);
- rowptr += files[j].cols[k].width;
- }
- if( jbits ) jfiles[j/JBITSIZE] |= 1<<(j%JBITSIZE);
- if( buf ) xfree(buf);
- }
- }
- /* save jfiles flag value, if necessary */
- if( jbits ){
- rowptr = ofiles[0].rowbuf + ofiles[0].rowoffset;
- memcpy(rowptr, jfiles, jbits);
- }
- /* write row */
- IPRINTF((stderr, "\n"));
- if( !FunTableRowPut(ofiles[0].fun, ofiles[0].rowbuf, 1, 0, NULL) ){
- gerror(stderr, "can't write output row\n");
- }
- /* inc to next row */
- for(j=nmatch-1; j>=0; j--){
- ii = matches[j];
- ifiles[ii].counter++;
- if( ifiles[ii].counter >= ifiles[ii].nindex ){
- ifiles[ii].counter = 0;
- }
- else{
- break;
- }
- }
- }
- /* free up space */
- if( flags ) xfree(flags);
- if( jfiles) xfree(jfiles);
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static void
-JoinResetRows(XFile ifiles, char *matches, int nmatch, int resetflag)
-#else
-static void
-JoinResetRows(ifiles, matches, nmatch, resetflag)
- XFile ifiles;
- char *matches;
- int nmatch;
- int resetflag;
-#endif
-{
- int i, j;
- /* reset index positions so that we re-check tolerances */
- if( resetflag >= 0 ){
- for(j=0; j<nmatch; j++){
- i = matches[j];
- if( !ifiles[i].ibase && (ifiles[i].irow>=0) ){
- ifiles[i].eof = 0;
- FunTableRowSeek(ifiles[i].fun, ifiles[i].irow, NULL);
- JoinReadNext(ifiles, i, i);
- }
- }
- }
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i, j, k;
- int type, mode, offset, n, width;
- int namei;
- int coffset;
- int resetflag=-1;
- int jbits=0;
- int nmatch=0;
- int minmatch=1;
- int maxmatch=MAXIFILE;
- int nfile=0;
- int tcol=0;
- int osize=0;
- int oncol=0;
- int ktype=0;
- int *ooffsets=NULL;
- char *matches=NULL;
- char *name;
- char *basename;
- char *defact=NULL;
- char *defcol=NULL;
- char *defblank=NULL;
- char *s;
- char *filtstr;
- char *jfiles=NULL;
- char **onames=NULL;
- char **otypes=NULL;
- char **omodes=NULL;
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char namebuf[SZ_LINE];
- double tlmin, tlmax, binsiz, tscale, tzero;
- double tol;
- XFile files=NULL, ifiles=NULL, ofiles=NULL;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* we are using indexes specially and don't want to use them normally */
- putenv("FILTER_IDX_ACTIVATE=false");
-
- /* allocate input and output file arrays (we'll do the index array later) */
- if( !(files=xcalloc(MAXIFILE, sizeof(XFileRec))) ){
- gerror(stderr, "can't allocate primary record structure for join\n");
- }
- if( !(ofiles=xcalloc(MAXOFILE, sizeof(XFileRec))) ){
- gerror(stderr, "can't allocate output record structure for join\n");
- }
-
- /* process arguments */
- for(i=1; i<argc; i++) {
- if ( argv[i][0] == '-' ) {
- switch (argv[i][1]) {
- case 'a':
- if( argv[i][2] ){
- j = atoi(&argv[i][2])-1;
- if( (j >= 0) && (j < MAXIFILE) && (i < argc-1)){
- files[j].actstr = argv[++i];
- }
- else{
- gerror(stderr, "invalid index for column activate: %d\n", j+1);
- }
- }
- else{
- defact = argv[++i];
- }
- break;
- case 'b':
- if( argv[i][2] ){
- j = atoi(&argv[i][2])-1;
- if( (j >= 0) && (j < MAXIFILE) && (i < argc-1)){
- files[j].bstr = argv[++i];
- }
- else{
- gerror(stderr, "invalid index for join column: %d\n", j+1);
- }
- }
- else{
- defblank = argv[++i];
- }
- break;
- case 'j':
- if( argv[i][2] ){
- j = atoi(&argv[i][2])-1;
- if( (j >= 0) && (j < MAXIFILE) && (i < argc-1)){
- files[j].jname = argv[++i];
- }
- else{
- gerror(stderr, "invalid index for join column: %d\n", j+1);
- }
- }
- else{
- if (i < argc-1) {
- defcol = argv[++i];
- }
- }
- break;
- case 'm':
- if (i < argc-1) {
- minmatch = atoi(argv[++i])+1;
- }
- if( minmatch < 1 ) minmatch = 1;
- break;
- case 'M':
- if (i < argc-1) {
- maxmatch = atoi(argv[++i])+1;
- }
- if( maxmatch < 1 ) maxmatch = 1;
- break;
- case 's':
- jfiles = JFILES_COL;
- break;
- case 'S':
- if (i < argc-1) {
- jfiles = argv[++i];
- }
- break;
- case 't':
- if (i < argc-1) {
- tol = atof(argv[++i]);
- }
- if( tol <= 0 ){
- gerror(stderr, "tolerance value must be positive\n");
- }
- break;
- }
- continue;
- }
- /* no switch -- must be a file name */
- if( nfile < MAXIFILE ){
- files[nfile].fname = argv[i];
- nfile++;
- }
- else{
- gerror(stderr, "too many files (%d > %d)\n", nfile, MAXIFILE);
- }
- }
-
- /* make sure we have at least 2 input + 1 output file args */
- if( nfile < 3 ) usage(argv[0]);
-
- /* for now, tolerance only works with 2 files */
- if( (tol > 0.0) && (nfile > 3) ){
- gerror(stderr, "for now, -t [tol] can only join 2 files\n");
- }
-
- /* move last input to output and decrement number of input files */
- ofiles[0].fname = files[nfile-1].fname;
- nfile--;
-
- /* reallocate input files */
- if( !(files=xrealloc(files, nfile*sizeof(XFileRec))) ){
- gerror(stderr, "can't re-allocate primary record structure for join\n");
- }
-
- /* make sure we have a join column name for each file */
- for(i=0; i<nfile; i++){
- if( !files[i].jname ){
- if( defcol ){
- files[i].jname = defcol;
- }
- else{
- gerror(stderr,
- "no join column specified for file: %s\n", files[i].fname);
- }
- }
- }
-
- /* allocate exact number of index file records */
- if( !(ifiles=xcalloc(nfile, sizeof(XFileRec))) ){
- gerror(stderr, "can't allocate primary record structure for join\n");
- }
- if( !(matches=(char *)xcalloc(nfile, sizeof(char))) ){
- gerror(stderr, "can't allocate key result buffer\n");
- }
-
- /* open input and index files */
- for(i=0; i<nfile; i++){
- /* open the input data file */
- if( !(files[i].fun = FunOpen(files[i].fname, "r", NULL)) ){
- gerror(stderr,
- "can't FunOpen input file (or find extension): %s\n",
- files[i].fname);
- }
- /* make sure the join column is in this file */
- if( !FunColumnLookup(files[i].fun, files[i].jname, 0, NULL,
- &files[i].jtype,
- &files[i].jmode,
- &files[i].joffset,
- &files[i].jn,
- &files[i].jwidth) ){
- gerror(stderr, "can't find column %s in input file: %s\n",
- files[i].jname, files[i].fname);
- }
- /* check for filter (we read index directly, bypassing filters) */
- filtstr=NULL;
- FunInfoGet(files[i].fun, FUN_FILTER, &filtstr, 0);
- if( filtstr && *filtstr ){
- gerror(stderr, "row filters are not permitted: %s\n", files[i].fname);
- }
- /* activate specified columns */
- if( files[i].actstr )
- FunColumnActivate(files[i].fun, files[i].actstr, NULL);
- else
- FunColumnActivate(files[i].fun, defact, NULL);
- /* reset rowoffset flag for this file */
- files[i].rowoffset = -1;
- /* get number of possible columns */
- FunInfoGet(files[i].fun, FUN_NCOL, &(files[i].tcol), 0);
- /* temp counter of total number of columns */
- tcol += files[i].tcol;
- /* open the index for the specified join column */
- idxinitfilenames(files[i].fun->header->filename, NULL);
- s = idxindexfilename(files[i].jname, NULL);
- idxfreefilenames();
- if( !s ){
- gerror(stderr, "can't find index file for column '%s' in file: %s\n",
- files[i].jname, files[i].fname);
- }
- if( !(ifiles[i].fun = FunOpen(s, "r", NULL)) ){
- gerror(stderr, "can't FunOpen index file (or find extension): %s\n", s);
- }
- /* get gio handle for seeking and sving */
- FunInfoGet(ifiles[i].fun, FUN_GIO, &ifiles[i].igio, 0);
- /* make sure the join column is in the index file */
- ifiles[i].fname = xstrdup(s);
- ifiles[i].jname = files[i].jname;
- if( !FunColumnLookup(ifiles[i].fun, ifiles[i].jname, 0, NULL,
- &ifiles[i].jtype,
- &ifiles[i].jmode,
- &ifiles[i].joffset,
- &ifiles[i].jn,
- &ifiles[i].jwidth) ){
- gerror(stderr, "can't find column %s in index file: %s\n",
- ifiles[i].jname, ifiles[i].fname);
- }
- /* define how we will read index file, based on data type of join column */
- switch(ifiles[i].jtype){
- case 'B':
- case 'I':
- case 'J':
- case 'K':
- case 'U':
- case 'V':
- case 'L':
- case 'X':
- FunColumnSelect(ifiles[i].fun, sizeof(XFileRec), NULL,
- "n", "J", "r", FUN_OFFSET(XFile, idx),
- ifiles[i].jname, "D", "r", FUN_OFFSET(XFile, dval),
- NULL);
- ifiles[i].dtype = 'D';
- ktype |= KEY_NUMERIC;
- break;
- case 'D':
- case 'E':
- FunColumnSelect(ifiles[i].fun, sizeof(XFileRec), NULL,
- "n", "J", "r", FUN_OFFSET(XFile, idx),
- ifiles[i].jname, "D", "r", FUN_OFFSET(XFile, dval),
- NULL);
- ifiles[i].dtype = 'D';
- ktype |= KEY_NUMERIC;
- break;
- case 'A':
- snprintf(tbuf, SZ_LINE-1, "@%dA", ifiles[i].jn);
- FunColumnSelect(ifiles[i].fun, sizeof(XFileRec), NULL,
- "n", "J", "r", FUN_OFFSET(XFile, idx),
- ifiles[i].jname, tbuf, "r", FUN_OFFSET(XFile, sval),
- NULL);
- ifiles[i].dtype = 'A';
- ifiles[i].sval = xcalloc(ifiles[i].jn+1, sizeof(char));
- ktype |= KEY_STRING;
- break;
- default:
- gerror(stderr, "bad datatype for join column: %c\n", ifiles[i].jtype);
- }
- /* free up temp space */
- if( s ) xfree(s);
- }
- /* we don't allow mixing of string and numeric values */
- if( ktype == (KEY_STRING|KEY_NUMERIC) ){
- gerror(stderr, "can't mix string and numeric join columns\n");
- }
-
- /* open output file */
- if( !(ofiles[0].fun = FunOpen(ofiles[0].fname, "w", NULL)) ){
- gerror(stderr, "can't FunOpen output file: %s\n", ofiles[0].fname);
- }
-
- /* allocate space for the max number of columns we can have (incl jfiles) */
- onames = (char **)xcalloc(tcol+1, sizeof(char *));
- otypes = (char **)xcalloc(tcol+1, sizeof(char *));
- omodes = (char **)xcalloc(tcol+1, sizeof(char *));
- ooffsets = (int *)xcalloc(tcol+1, sizeof(int));
-
- /* contruct list of output columns */
- for(i=0; i<nfile; i++){
- coffset = 0;
- for(j=0; j<files[i].tcol; j++){
- if( !FunColumnLookup(files[i].fun, NULL, j,
- &name, &type, &mode, &offset, &n, &width) ){
- gerror(stderr,
- "can't find column %d in input file: %s\n", j, files[i].fname);
- }
- if( mode & COL_ACTIVE ){
- /* save original name in case of duplicate */
- basename = name;
- /* first numeric value we will append */
- namei = 2;
-again:
- for(k=0; k<oncol; k++){
- if( !strcasecmp(name, onames[k]) ){
- k = -1;
- break;
- }
- }
- /* append a file number to duplicate names */
- if( k < 0 ){
- snprintf(namebuf, SZ_LINE-1, "%s_%d", basename, namei);
- name = namebuf;
- namei++;
- IPRINTF((stderr, "trying new col name for file %d: %s\n", i, name));
- goto again;
- }
- /* add column */
- JoinAddCol(&files[i], name, basename, type, mode, offset, n, width,
- coffset);
- /* bump offset into current row */
- coffset += width;
- /* size of active columns for this file only -- save in index rec */
- files[i].rowsize += width;
- /* offset into output where this file's contribution starts */
- if( files[i].rowoffset < 0 ) files[i].rowoffset = osize;
- /* get auxiliary info */
- FunColumnLookup2(files[i].fun, NULL, j,
- &tlmin, &tlmax, &binsiz, &tscale, &tzero);
- /* generate type string */
- snprintf(tbuf, SZ_LINE-1, "%d%c", n, type);
- if( !feq(tlmin, tlmax) ){
- snprintf(tbuf2, SZ_LINE-1, ":%f:%f", tlmin, tlmax);
- strncat(tbuf, tbuf2, SZ_LINE-1);
- }
- if( !feq(binsiz, 0.0) && !feq(binsiz, 1.0) ){
- snprintf(tbuf2, SZ_LINE-1, ":%f", binsiz);
- strncat(tbuf, tbuf2, SZ_LINE-1);
- }
- if( !feq(tscale, 0.0) ){
- snprintf(tbuf2, SZ_LINE-1, ";%f", tscale);
- strncat(tbuf, tbuf2, SZ_LINE-1);
- if( !feq(tzero, 0.0) ){
- snprintf(tbuf2, SZ_LINE-1, ":%f", tzero);
-
- strncat(tbuf, tbuf2, SZ_LINE-1);
- }
- }
- IPRINTF((stderr, "%d: name=%s type=%c mode=%o offset=%d n=%d => %s\n",
- i, name, type, mode, offset, n, tbuf));
- /* save column info */
- onames[oncol] = xstrdup(name);
- otypes[oncol] = xstrdup(tbuf);
- omodes[oncol] = "w";
- ooffsets[oncol] = osize;
- /* total size for all files */
- osize += width;
- oncol++;
- }
- }
- /* create blank line for this file */
- JoinMakeBlank(&files[i], defblank);
- /* add filename to header */
- FunParamPuts(ofiles[0].fun, "JFILE", i+1, files[i].fname, "join file", 1);
- }
-
- /* and one more for joinfiles, if needed */
- if( jfiles ){
- strncpy(tbuf, jfiles, SZ_LINE-1);
- cluc(tbuf);
- onames[oncol] = xstrdup(tbuf);
- jbits = ((MAXIFILE+7)/8)*8;
- snprintf(tbuf, SZ_LINE-1, "%dX", jbits);
- otypes[oncol] = xstrdup(tbuf);
- omodes[oncol] = "w";
- ooffsets[oncol] = osize;
- /* save for later use */
- ofiles[0].rowoffset = osize;
- /* total size for all files */
- osize += (jbits/8);
- oncol++;
- }
-
- /* reallocate output column array to correct size */
- onames = (char **)xrealloc(onames, oncol*sizeof(char *));
- otypes = (char **)xrealloc(otypes, oncol*sizeof(char *));
- omodes = (char **)xrealloc(omodes, oncol*sizeof(char *));
- ooffsets = (int *)xrealloc(ooffsets, oncol*sizeof(int));
-
- /* set up the output columns */
- FunColumnSelectArr(ofiles[0].fun, osize, NULL,
- onames, otypes, omodes, ooffsets, oncol);
-
- /* this tells us the size of the output buffer */
- FunInfoGet(ofiles[0].fun, FUN_ROWSIZE, &(ofiles[0].rowsize), 0);
- ofiles[0].rowbuf = xcalloc(ofiles[0].rowsize, sizeof(char));
-
- /* read a record from each index */
- JoinReadNext(ifiles, nfile, -nfile);
-
- /* check for joins, all rows in all files */
- while( JoinFilesLeft(ifiles, nfile) > 0 ){
- nmatch = JoinGetMatches(ifiles, nfile, ktype, tol, matches);
- /* yikes ... when we reset rows to check against the next base,
- we don't want to write out anything if there is no match, since this
- was already done with the last base ... its confusing */
- if( (tol > 0.0) && (nmatch == 1) && (resetflag >=0) &&
- (resetflag != matches[0]) ){
- for(i=0; i<nmatch; i++){
- JoinReadNext(ifiles, nfile, matches[i]);
- }
- }
- /* this is the normal output of matched rows */
- else if( (nmatch >= minmatch) && (nmatch <= maxmatch) ){
- JoinGatherRows(ifiles, nfile, ktype, tol, matches, nmatch, &resetflag);
- /* write all matched rows */
- if(!JoinWriteRows(files, ifiles, nfile, matches, nmatch, jbits, ofiles)){
- gerror(stderr, "can't write rows for join\n");
- }
- /* might have to reset the rows when using tolerance values */
- JoinResetRows(ifiles, matches, nmatch, resetflag);
- }
- /* no output, so we advance the rows that matched */
- else{
- for(i=0; i<nmatch; i++){
- JoinReadNext(ifiles, nfile, matches[i]);
- }
- }
- }
-
- /* free output column arrays */
- if( omodes ) xfree(omodes);
- if( ooffsets ) xfree(ooffsets);
- if( otypes ){
- for(i=0; i<oncol; i++){
- if( otypes[i] ) xfree(otypes[i]);
- }
- xfree(otypes);
- }
- if( onames ){
- for(i=0; i<oncol; i++){
- if( onames[i] ) xfree(onames[i]);
- }
- xfree(onames);
- }
-
- /* close input files and index files */
- if( files ){
- for(i=0; i<nfile; i++){
- if( files[i].fun ) FunClose(files[i].fun);
- if( files[i].blank ) xfree(files[i].blank);
- if( files[i].cols ){
- for(j=0; j<files[i].ncol; j++){
- if( files[i].cols[j].name ) xfree(files[i].cols[j].name);
- if( files[i].cols[j].oname ) xfree(files[i].cols[j].oname);
- }
- xfree(files[i].cols);
- }
- }
- xfree(files);
- }
- if( ifiles ){
- for(i=0; i<nfile; i++){
- if( ifiles[i].fun ) FunClose(ifiles[i].fun);
- if( ifiles[i].fname ) xfree(ifiles[i].fname);
- if( ifiles[i].indexes ) xfree(ifiles[i].indexes);
- if( ifiles[i].sval ) xfree(ifiles[i].sval);
- }
- xfree(ifiles);
- }
- if( ofiles ){
- for(i=0; i<MAXOFILE; i++){
- if( ofiles[i].fun ) FunClose(ofiles[i].fun);
- if( ofiles[i].rowbuf ) xfree(ofiles[i].rowbuf);
- }
- xfree(ofiles);
- }
-
- /* free up everything else */
- if( matches ) xfree(matches);
-
- return(0);
-}
diff --git a/funtools/funmainlib.c b/funtools/funmainlib.c
deleted file mode 100644
index 4af894e..0000000
--- a/funtools/funmainlib.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <mainlib.h>
-
-
-int funcalc_main _PRx((int argc, char **argv));
-int funcen_main _PRx((int argc, char **argv));
-int funcnts_main _PRx((int argc, char **argv));
-int funcone_main _PRx((int argc, char **argv));
-int fundisp_main _PRx((int argc, char **argv));
-int funhead_main _PRx((int argc, char **argv));
-int funhist_main _PRx((int argc, char **argv));
-int funimage_main _PRx((int argc, char **argv));
-int funjoin_main _PRx((int argc, char **argv));
-int funmerge_main _PRx((int argc, char **argv));
-int funsky_main _PRx((int argc, char **argv));
-int funtable_main _PRx((int argc, char **argv));
-
-void *funtoolsMainLibInit(void)
-{
- MainLib ml;
- if( !(ml=MainLibNew()) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funcalc", funcalc_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funcen", funcen_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funcnts", funcnts_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funcone", funcone_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "fundisp", fundisp_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funhead", funhead_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funhist", funhist_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funimage", funimage_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funjoin", funjoin_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funmerge", funmerge_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funsky", funsky_main, MAINLIB_ARGV) )
- return NULL;
- if( !MainLibAdd(ml, "funtools", "funtable", funtable_main, MAINLIB_ARGV) )
- return NULL;
- return ml;
-}
-
diff --git a/funtools/funmerge.c b/funtools/funmerge.c
deleted file mode 100644
index f141716..0000000
--- a/funtools/funmerge.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtools.h>
-#include <fitsy.h>
-#include <wcs.h>
-#include <gio.h>
-#include <tl.h>
-#include <word.h>
-
-/* mode flags for processing */
-#define FLAG_FILE 1 /* save file name for each event */
-#define FLAG_WCS 2 /* do wcs conversion */
-#define FLAG_SAVE 4 /* do wcs conversion and save old event values */
-#define FLAG_IWCS 8 /* use image wcs */
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-
-extern char *optarg;
-extern int optind;
-
-typedef struct evstruct{
- double x, y;
- double ox, oy;
- short nfile;
-} *Ev, EvRec;
-
-typedef struct filestruct{
- struct filestruct *next;
- char *fname;
- Fun fun;
- FITSHead header;
- struct WorldCoor *wcs;
- int type;
- int tltyp[2];
- double tlmin[2];
- double tlmax[2];
- double binsiz[2];
- int bin[2];
- char *bincols[2];
- int nfile;
-} *MFile, MFileRec;
-
-#ifdef ANSI_FUNC
-static void InputFileParams(MFile ifile, int flag)
-#else
-static void InputFileParams(ifile, flag)
- MFile ifile;
- int flag;
-#endif
-{
- int i;
- int got;
-
- /* get bin offsets for bin columns */
- FunInfoGet(ifile->fun, FUN_BINOFFS, ifile->bin, 0);
- for(i=0; i<=1; i++){
- if( ifile->bin[i] >=0 ){
- FunColumnLookup(ifile->fun, NULL, ifile->bin[i], &(ifile->bincols[i]),
- &(ifile->tltyp[i]), NULL, NULL, NULL, NULL);
- ifile->tlmin[i] =
- FunParamGetd(ifile->fun, "TLMIN", ifile->bin[i]+1, 0.0, &got);
- ifile->tlmax[i] =
- FunParamGetd(ifile->fun, "TLMAX", ifile->bin[i]+1, 0.0, &got);
- ifile->binsiz[i] =
- FunParamGetd(ifile->fun, "TDBIN", ifile->bin[i]+1, 1.0, &got);
- }
- }
- /* get WCS info if necessary */
- if( flag & FLAG_WCS ){
- if( flag & FLAG_IWCS )
- FunInfoGet(ifile->fun, FUN_WCS, &(ifile->wcs), 0);
- else
- FunInfoGet(ifile->fun, FUN_WCS0, &(ifile->wcs), 0);
- if( !ifile->wcs )
- gerror(stderr, "no WCS found in %s\n", ifile->fname);
- }
- /* fitsy header is used for consistency check oncolumns */
- FunInfoGet(ifile->fun, FUN_HEADER, &(ifile->header), 0);
-}
-
-#ifdef ANSI_FUNC
-static int OpenInputFile(MFile ifile, int flag)
-#else
-static int OpenInputFile(ifile, flag)
- MFile ifile;
- int flag;
-#endif
-{
- char *mode;
-
- /* mode depends on file count */
- if( ifile->nfile == 1 )
- mode = "rc";
- else
- mode = "r";
-
- /* open input file */
- if( !(ifile->fun = FunOpen(ifile->fname, mode, NULL)) ){
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- ifile->fname);
- return 0;
- }
-
- /* check data type */
- FunInfoGet(ifile->fun, FUN_TYPE, &(ifile->type), 0);
- if( (ifile->type != FUN_TABLE) && (ifile->type != FUN_EVENTS) ){
- gerror(stderr, "Sorry, only binary tables can be merged (thus far)\n");
- return 0;
- }
-
- /* get params */
- InputFileParams(ifile, flag);
-
- /* return the good news */
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static MFile NewInputFile( MFile head, char *s, int flag)
-#else
- static MFile NewInputFile(head, s, flag)
- MFile head;
- char *s;
- int flag;
-#endif
-{
- MFile thead, cfile, cur;
-
- /* allocate space */
- if( !(cfile = (MFile)xcalloc(1, sizeof(MFileRec))) ){
- gerror(stderr, "can't allocate input file record for %s\n", s);
- return NULL;
- }
- /* fill in the blanks */
- cfile->fname = xstrdup(s);
- /* add to list */
- if( head == NULL ){
- thead = cfile;
- cfile->nfile = 1;
- /* we open the first input file, which the the base file for wcs */
- if( !OpenInputFile(cfile, flag) ){
- gerror(stderr, "can't open input file: %s\n", cfile->fname);
- xfree(cfile);
- return NULL;
- }
- }
- else{
- thead = head;
- for(cur=head; cur->next!=NULL; cur=cur->next)
- ;
- cur->next = cfile;
- cfile->nfile = cur->nfile+1;
- }
- /* return head of list */
- return thead;
-}
-
-#ifdef ANSI_FUNC
-static void FreeInputFile(MFile file)
-#else
-static void FreeInputFile(file)
- MFile file;
-#endif
-{
- if( file->fname ) xfree(file->fname);
- if( file ) xfree(file);
-}
-
-#ifdef ANSI_FUNC
-static void
-ConvertEvents(MFile ifile, MFile ofile, MFile file1, Ev ebuf, int nrow,
- int flag)
-#else
-static void
-ConvertEvents(ifile, ofile, file1, ebuf, nrow, flag)
- MFile ifile;
- MFile ofile;
- MFile file1;
- Ev ebuf;
- int nrow;
- int flag;
-#endif
-{
- int i;
- int offscl;
- double dval1, dval2;
- Ev ev=NULL;
-
- for(i=0; i<nrow; i++){
- if( flag & (FLAG_WCS | FLAG_FILE) ){
- ev = ebuf+i;
- }
- /* do wcs translation, if necessary */
- if( flag & FLAG_WCS ){
- /* save old coord, might have to write it back out */
- ev->ox = ev->x;
- ev->oy = ev->y;
- /* wcs convert all but the first file (which is the base file) */
- if( ifile != file1 ){
- if( flag & FLAG_IWCS ){
- /* convert physical pixels to image */
- ev->x = tlp2i(ev->x,
- ifile->tlmin[0], ifile->binsiz[0], ifile->tltyp[0]);
- ev->y = tlp2i(ev->y,
- ifile->tlmin[1], ifile->binsiz[1], ifile->tltyp[1]);
- }
- /* convert image pixels to ra/dec using wcs */
- pix2wcs(ifile->wcs, ev->x, ev->y, &dval1, &dval2);
- /* convert ra/dec to image pixels using base wcs */
- wcs2pix(file1->wcs, dval1, dval2, &(ev->x), &(ev->y), &offscl);
- if( flag & FLAG_IWCS ){
- /* convert pixels back to physical in base system */
- ev->x = tli2p(ev->x,
- file1->tlmin[0], file1->binsiz[0], file1->tltyp[0]);
- ev->y = tli2p(ev->y,
- file1->tlmin[1], file1->binsiz[1], file1->tltyp[1]);
- }
- /* if output coords are not float, we need to round before update */
- switch( ofile->tltyp[0] ){
- case 'D':
- case 'E':
- break;
- default:
- if( ev->x >=0 ) ev->x += 0.5;
- else ev->x -= 0.5;
- break;
- }
- switch( ofile->tltyp[1] ){
- case 'D':
- case 'E':
- break;
- default:
- if( ev->y >=0 ) ev->y += 0.5;
- else ev->y -= 0.5;
- break;
- }
- }
- }
- /* save file number, if necessary */
- if( flag & FLAG_FILE ){
- ev->nfile = ifile->nfile;
- }
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s [-w|-x] [-f colname] iname1 iname2 ... oname\n", fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -f # output a column specifying file from which this event came\n");
- fprintf(stderr, " -w # adjust position values using WCS info\n");
- fprintf(stderr, " -x # adjust position values using WCS info and save old values\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int c;
- int iargs;
- int nrow;
- int flag;
- int put;
- char tbuf[SZ_LINE];
- char onames[2][SZ_LINE];
- char colname[SZ_LINE];
- char *s;
- char *oname=NULL;
- char *mode=NULL;
- char *filemode=NULL, *savemode=NULL, *wcsmode=NULL;
- double tlmin0, tlmin1, tlmax0, tlmax1;
- GIO gio;
- Ev ev, ebuf;
- EvRec tev;
- Fun ofun;
- MFile ifiles=NULL, ofile=NULL, cfile=NULL, tfile=NULL;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* set colname to something silly. it won't actually be added to the
- file unless -c <name> is on the command line, because the mode is
- NULL by default */
- strcpy(colname, "???");
- strcpy(onames[0], "???");
- strcpy(onames[1], "???");
-
- /* init flag: assume we will use image wcs */
- flag = FLAG_IWCS;
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "f:wxIT")) != -1){
- switch(c){
- case 'f':
- flag |= FLAG_FILE;
- filemode = "w";
- strcpy(colname, optarg);
- break;
- case 'w':
- flag |= FLAG_WCS;
- wcsmode = "rw";
- break;
- case 'x':
- flag |= FLAG_SAVE;
- savemode = "w";
- flag |= FLAG_WCS;
- wcsmode = "rw";
- break;
- case 'I':
- flag |= FLAG_IWCS;
- break;
- case 'T':
- flag &= ~FLAG_IWCS;
- break;
- default:
- break;
- }
- }
-
- iargs = argc - optind - 1;
- /* make sure we have something to do */
- if( iargs < 1 ) usage(argv[0]);
-
- /* process input files */
- for(i=optind; i<optind+iargs; i++){
- if( argv[i][0] != '@' ){
- /* allocate new ifile (and open the first file, i.e. the base) */
- ifiles = NewInputFile(ifiles, argv[i], flag);
- }
- /* @ sign means this file contains file names */
- else{
- if( !(gio = gopen(&argv[i][1], "r")) ){
- gerror(stderr, "can't open include file: %s\n", argv[i]);
- }
- while( ggets(gio, tbuf, SZ_LINE) ){
- if( (*tbuf == '\n') || (*tbuf == '#') ) continue;
- nowhite(tbuf, tbuf);
- /* allocate new ifile (and open the first file, i.e. the base) */
- ifiles = NewInputFile(ifiles, tbuf, flag);
- }
- gclose(gio);
- }
- }
-
- /* final argument is the output file */
- oname = argv[argc-1];
- /* open the output FITS image, preparing to copy input params */
- if( !(ofun = FunOpen(oname, "w", ifiles->fun)) )
- gerror(stderr, "can't FunOpen output file: %s\n", oname);
- /* allocate record for the output file */
- ofile = (MFile)xcalloc(1, sizeof(MFileRec));
- ofile->fun = ofun;
- ofile->fname = xstrdup(oname);
- InputFileParams(ofile, 0);
-
- /* get old column names from base file, if necessary */
- if( savemode ){
- for(i=0; i<=1; i++){
- if( ifiles->bincols[i] ){
- snprintf(onames[i], SZ_LINE-1, "OLD_%s", ifiles->bincols[i]);
- }
- }
- }
-
- /* add merge filename parameters */
- for(cfile=ifiles; cfile; cfile=cfile->next){
- snprintf(tbuf, SZ_LINE-1, "MIF%d", cfile->nfile);
- FunParamPuts(ofun, tbuf, 0, cfile->fname, "merge input file", 1);
- }
-
- /* adjust the TLMIN/TLMAX of the base file to accommodate all of the
- possible position values from this event file. This effectively
- enlargens the size of the output image. */
- /* set temp tlmin variables */
- tlmin0 = ifiles->tlmin[0];
- tlmin1 = ifiles->tlmin[1];
- tlmax0 = ifiles->tlmax[0];
- tlmax1 = ifiles->tlmax[1];
- for(cfile=ifiles->next; cfile; cfile=cfile->next){
- if( !OpenInputFile(cfile, flag) ){
- gerror(stderr, "can't open input file: %s\n", cfile->fname);
- }
- /* make sure stdin was not specified for one of these input files */
- FunInfoGet(cfile->fun, FUN_GIO, &gio, 0);
- if( gio->type & GIO_STREAM ){
- gerror(stderr, "a stream can only be used for the first input file\n");
- }
- /* make sure we have the same column structure as the base file */
- if( ifiles->header->table->tfields != cfile->header->table->tfields ){
- gerror(stderr,
- "%s and %s have a different number of columns (%d, %d)\n",
- ifiles->fname, cfile->fname,
- ifiles->header->table->tfields, cfile->header->table->tfields);
- }
- for(i=0; i<cfile->header->table->tfields; i++){
- if( strcasecmp(ifiles->header->table->col[i].name,
- cfile->header->table->col[i].name) ){
- gerror(stderr,
- "column names for %s and %s differ in column #%d (%s, %s)\n",
- ifiles->fname, cfile->fname,
- i+1,
- ifiles->header->table->col[i].name,
- cfile->header->table->col[i].name);
- }
- else if( (ifiles->header->table->col[i].type!=
- cfile->header->table->col[i].type) ||
- (ifiles->header->table->col[i].n !=
- cfile->header->table->col[i].n) ){
- gerror(stderr,
- "data types for %s and %s differ in column '%s' (%d%c, %d%c)\n",
- ifiles->fname,
- cfile->fname,
- ifiles->header->table->col[i].name,
- ifiles->header->table->col[i].n,
- ifiles->header->table->col[i].type,
- cfile->header->table->col[i].n,
- cfile->header->table->col[i].type);
- }
- }
- ev = &tev;
- /* this is the smallest x,y we can have */
- ev->x = cfile->tlmin[0];
- ev->y = cfile->tlmin[1];
- ConvertEvents(cfile, ofile, ifiles, ev, 1, flag);
- if( ev->x < tlmin0 ){
- tlmin0 = (int)(ev->x-1);
- FunParamPutd(ofun, "TLMIN", cfile->bin[0]+1, tlmin0, 7,
- "Min. axis value", 1);
- }
- if( ev->y < tlmin1 ){
- tlmin1 = (int)(ev->y-1);
- FunParamPutd(ofun, "TLMIN", cfile->bin[1]+1, tlmin1, 7,
- "Min. axis value", 1);
- }
- /* this is the largest x,y we can have */
- ev->x = cfile->tlmax[0];
- ev->y = cfile->tlmax[1];
- ConvertEvents(cfile, ofile, ifiles, ev, 1, flag);
- if( ev->x > tlmax0 ){
- tlmax0 = (int)(ev->x+1);
- FunParamPutd(ofun, "TLMAX", cfile->bin[0]+1, tlmax0, 7,
- "Max. axis value", 1);
- }
- if( ev->y > tlmax1 ){
- tlmax1 = (int)(ev->y+1);
- FunParamPutd(ofun, "TLMAX", cfile->bin[1]+1, tlmax1, 7,
- "Max. axis value", 1);
- }
- /* we have to close the file now so as not to run out of descriptors */
- FunClose(cfile->fun);
- }
-
- /* in some cases, we an avoid transfering anything into user space,
- by not calling FunColumnSelect() on the input file, but we must
- explicitly make a select call to output the raw data */
- if( !filemode && !wcsmode ){
- FunColumnSelect(ofun, 0, "merge=update", NULL);
- /* flag that we do not convert data on input or output */
- mode = "convert=false";
- }
-
- /* now we can process the events in all of the input files */
- for(cfile=ifiles; cfile; cfile=cfile->next){
- /* for all but the base file, re-open input file */
- if( cfile != ifiles ){
- if( !OpenInputFile(cfile, flag) ){
- gerror(stderr, "can't open input file: %s\n", cfile->fname);
- }
- }
- /* select columns for processing */
- if( filemode || wcsmode ){
- FunColumnSelect(cfile->fun, sizeof(EvRec), "merge=update",
- "$X", "D", wcsmode, FUN_OFFSET(Ev, x),
- "$Y", "D", wcsmode, FUN_OFFSET(Ev, y),
- onames[0], "D", savemode, FUN_OFFSET(Ev, ox),
- onames[1], "D", savemode, FUN_OFFSET(Ev, oy),
- colname, "I", filemode, FUN_OFFSET(Ev, nfile),
- NULL);
- }
- /* make the new extension the reference handle for the output file */
- FunInfoPut(ofile->fun, FUN_IFUN0, &cfile->fun, 0);
- /* extract events from this file */
- while( (ebuf = FunTableRowGet(cfile->fun, NULL, maxrow, mode, &nrow)) ){
- /* translate events, if necessary */
- ConvertEvents(cfile, ofile, ifiles, ebuf, nrow, flag);
- /* write to output file */
- if( (put=FunTableRowPut(ofile->fun, ebuf, nrow, 0, mode)) != nrow ){
- gerror(stderr, "expected to write %d events; only wrote %d\n",
- nrow, put);
- }
- xfree(ebuf);
- }
- /* close all files but the first */
- if( cfile != ifiles ) FunClose(cfile->fun);
- }
-
- /* close output before input, so end flush is done automatically */
- FunClose(ofun);
- FreeInputFile(ofile);
-
- /* close base file */
- FunClose(ifiles->fun);
-
- /* clean up */
- for(cfile=ifiles; cfile;){
- tfile = cfile->next;
- FreeInputFile(cfile);
- cfile = tfile;
- }
- return(0);
-}
diff --git a/funtools/funopen.c b/funtools/funopen.c
deleted file mode 100644
index fc686fe..0000000
--- a/funtools/funopen.c
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-/*
- *
- * _FunRawEvOpen -- open a raw events file,
- * set up binning and filtering parameters
- *
- */
-#ifdef ANSI_FUNC
-static Fun
-_FunRawEvOpen(char *fname, char *tail, char *mode, char *eventdef)
-#else
-static Fun _FunRawEvOpen(fname, tail, mode, eventdef)
- char *fname;
- char *tail;
- char *mode;
- char *eventdef;
-#endif
-{
- Fun fun;
- char tbuf[SZ_LINE];
-
- /* sanity check */
- if( !eventdef || !*eventdef )
- return NULL;
-
- /* allocate a fun record */
- if( !(fun = _FunNew()) ) return NULL;
-
- /* see if this file name is a view */
- FunView(fun, fname, mode, tbuf, SZ_LINE);
-
- /* try to open the file */
- if( !(fun->gio=gopen(tbuf, mode)) ) goto error;
-
- /* save filename and mode */
- fun->fname = xstrdup(tbuf);
- fun->mode = xstrdup(mode);
-
- /* create a fake table header from the event description */
- if( !(fun->header = _FunRawEvHeader(fun, tbuf, tail, eventdef)) )
- goto error;
-
- /* its a valid event file */
- fun->type = FUN_EVENTS;
- /* no blanks for events */
- fun->doblank = 0;
-
- /* look for indication of whether these data are bigendian */
- if( _FunKeyword(tail, "endian", "EVENTS_ENDIAN", tbuf, SZ_LINE) )
- fun->endian = ((*tbuf == 'b') || (*tbuf == 'B'));
- else if( _FunKeyword(tail, "bigendian", "EVENTS_BIGENDIAN", tbuf, SZ_LINE) )
- fun->endian = istrue(tbuf);
- /* otherwise assume we have native format */
- else
- fun->endian = is_bigendian();
-
- /* look for indication of bitpix */
- if( _FunKeyword(tail, "bitpix", "EVENTS_BITPIX", tbuf, SZ_LINE) )
- fun->bitpix = atoi(tbuf);
- /* else assume a safe value */
- else
- fun->bitpix = 32;
- if( _FunKeyword(tail, "skip", "EVENTS_SKIP", tbuf, SZ_LINE) )
- fun->skip = atoi(tbuf);
-
- /* determine whether we are only processing specific rows */
- _FunRowNum(fun, tail, NULL);
- /* get the key for binning */
- _FunTableBinCols(fun, tail, "EVENTS_BINCOLS");
- /* get the key for the value column for binning */
- _FunTableValCol(fun, tail, "EVENTS_VCOL");
- /* calculate the image length including padding */
- _FunImageSize(fun);
- /* now parse the section specification */
- _FunParseSection(fun, tail,
- &(fun->x0), &(fun->x1), &(fun->y0), &(fun->y1),
- &(fun->block), &(fun->btype), tail, SZ_LINE);
- /* get maxbufsize for table access */
- _FunMaxBufSize(fun, tail);
- /* what's left in the tail is the filter */
- fun->filter = xstrdup(tail);
- /* fill in the default selected columns */
- FunColumnSelect(fun, 0, "copy=reference", NULL);
-
- /* skip events header, if necessary */
- if( fun->skip )
- gskip(fun->gio, (off_t)fun->skip);
-
- /* common code */
- if( !_FunOpenCommon(fun) ) goto error;
-
- /* return completed struct */
- return fun;
-
-error:
- _FunFree(fun, 1);
- return NULL;
-}
-
-/*
- *
- * _FunArrayOpen -- open a raw array file,
- * set up binning and filtering parameters
- *
- */
-#ifdef ANSI_FUNC
-static Fun
-_FunArrayOpen(char *fname, char *tail, char *mode, char *arraydef)
-#else
-static Fun _FunArrayOpen(fname, tail, mode, arraydef)
- char *fname;
- char *tail;
- char *mode;
- char *arraydef;
-#endif
-{
- Fun fun;
- char tbuf[SZ_LINE];
-
- /* sanity check */
- if( !arraydef || !*arraydef )
- return NULL;
-
- /* allocate a fun record */
- if( !(fun = _FunNew()) ) return NULL;
-
- /* see if this file name is a view */
- FunView(fun, fname, mode, tbuf, SZ_LINE);
-
- /* try to open the file */
- if( !(fun->gio=gopen(tbuf, mode)) ) goto error;
-
- /* save filename and mode */
- fun->fname = xstrdup(tbuf);
- fun->mode = xstrdup(mode);
-
- /* look for indication of whether these data are bigendian */
- if( _FunKeyword(tail, "endian", "ARRAY_ENDIAN", tbuf, SZ_LINE) )
- fun->endian = ((*tbuf == 'b') || (*tbuf == 'B'));
- else if( _FunKeyword(tail, "bigendian", "ARRAY_BIGENDIAN", tbuf, SZ_LINE) )
- fun->endian = istrue(tbuf);
- /* otherwise assume we have native format */
- else
- fun->endian = is_bigendian();
-
- /* parse the array spec for dimension info */
- if( ParseArraySpec(arraydef, &(fun->dim1), &(fun->dim2),
- &(fun->bitpix), &(fun->skip), &(fun->endian)) ){
- fun->min1 = 1;
- fun->max1 = fun->dim1;
- if( fun->dim2 ){
- fun->dims = 2;
- fun->min2 = 1;
- fun->max2 = fun->dim2;
- }
- else{
- fun->dims = 1;
- fun->dim2 = 1;
- fun->min2 = 1;
- fun->max2 = 1;
- }
- }
- else
- goto error;
-
- /* we have a valid array */
- fun->type = FUN_ARRAY;
- /* no blanks for arrays */
- fun->doblank = 0;
-
- /* make a dummy FITS header for this array */
- fun->header = ft_headinit(NULL, 0);
- ft_headsetl(fun->header, "SIMPLE", 0, 1, "Is FITS of standard type?", 1);
- ft_headseti(fun->header, "BITPIX", 0, fun->bitpix, "bits/pixel", 1);
- ft_headseti(fun->header, "NAXIS", 0, fun->dims, "number of axes", 1);
- ft_headseti(fun->header, "NAXIS", 1, fun->dim1, "x axis dimension", 1);
- if( fun->dims >= 2 )
- ft_headseti(fun->header, "NAXIS", 2, fun->dim2, "y axis dimension", 1);
- ft_syncdata(fun->header);
-
- /* calculate the image length including padding */
- _FunImageSize(fun);
- /* now parse the section specification */
- _FunParseSection(fun, tail,
- &(fun->x0), &(fun->x1), &(fun->y0), &(fun->y1),
- &(fun->block), &(fun->btype), tail, SZ_LINE);
-
- /* get maxbufsize for table access */
- _FunMaxBufSize(fun, tail);
- /* what's left in the tail is the filter */
- fun->filter = xstrdup(tail);
-
- /* skip array header, if necessary */
- if( fun->skip )
- gskip(fun->gio, (off_t)fun->skip);
-
- /* common code */
- if( !_FunOpenCommon(fun) ) goto error;
-
- /* return completed struct */
- return fun;
-
-error:
- _FunFree(fun, 1);
- return NULL;
-}
-
-/*
- *
- * _FunFITSOpen -- open a FITS-type file, scan to the appropriate extension,
- * set up binning and filtering parameters
- *
- */
-#ifdef ANSI_FUNC
-Fun
-_FunFITSOpen(Fun ifun, char *fname, char *mode)
-#else
-Fun _FunFITSOpen(ifun, fname, mode)
- Fun ifun;
- char *fname;
- char *mode;
-#endif
-{
- char tbuf[SZ_LINE];
- char tail[SZ_LINE];
- char iline[SZ_LINE];
- GIO ifd=NULL;
- Fun fun;
-
- /* initialize iline */
- memset(iline, 0, SZ_LINE);
-
- /* use old fun handle */
- if( ifun ){
- fun = ifun;
- strncpy(tbuf, fname, SZ_LINE);
- }
- /* allocate a fun record */
- else{
- if( !(fun = _FunNew()) ) return NULL;
- /* see if this file name is a view */
- FunView(fun, fname, mode, tbuf, SZ_LINE);
- /* save filename and mode */
- fun->fname = xstrdup(tbuf);
- fun->mode = xstrdup(mode);
- }
-
- /* set up a default ext name for searching table extensions */
- if( getenv("FITS_EXTNAME") == NULL )
- putenv("FITS_EXTNAME=EVENTS STDEVT");
-
- /* try to open as FITS */
- if(!(fun->gio=ft_fitsheadopenfd(tbuf, &(fun->header), tail, SZ_LINE, mode,
- fun->gio, iline, &ifd))){
- /* if its not FITS, try opening as ascii text */
- if( ifd && ( !iline[0] || (iline[0] && isascii(iline[0]))) ){
- if( !ifun ) _FunFree(fun, 1);
- return FunTextOpen(tbuf, mode, iline, ifd);
- }
- else{
- goto error;
- }
- }
-
- /* if we are delaying the real file positioning, exit here */
- if( !fun->header )
- return(fun);
-
- /* we have a valid header -- process its specific type */
- if( fun->header ){
- /* its a FITS image */
- if( fun->header->image ){
- /* its an image */
- fun->type = FUN_IMAGE;
- /* if its FITS, its big-endian */
- fun->endian = 1;
- /* get info about the image */
- fun->dims = ft_naxes(fun->header);
- fun->min1 = 1;
- fun->max1 = ft_naxis(fun->header, 1);
- fun->dim1 = tldim(fun->min1, fun->max1, fun->binsiz1, 0);
- if( fun->dims == 1 ){
- fun->min2 = 1;
- fun->max2 = 1;
- fun->dim2 = 1;
- }
- else{
- fun->min2 = 1;
- fun->max2 = ft_naxis(fun->header, 2);
- fun->dim2 = tldim(fun->min2, fun->max2, fun->binsiz2, 0);
- }
- if( (fun->max1 <0) || (fun->max2 <0) )
- return 0;
- fun->bitpix = ft_bitpix(fun->header);
- fun->dtype = fun->bitpix / FT_WORDLEN;
-
- /* determine scaling and blank parameters */
- fun->bscale = ft_bscale(fun->header);
- fun->bzero = ft_bzero(fun->header);
- if( (ft_hasbscale(fun->header) && (fun->bscale != 1.0)) ||
- (ft_hasbzero(fun->header) && (fun->bzero != 0.0)) )
- fun->scaled = FUN_SCALE_EXISTS;
- fun->doblank = ft_hasblank(fun->header);
- fun->blank = ft_blank(fun->header);
-
- /* if more than 2 axes, we might have to skip to an image plane ...
- we assume that the first 2 dimensions are the image */
- if( ft_naxes(fun->header) > 2 ){
- if( (fun->skip = _FunImageSkip(fun, tail)) <0 )
- return 0;
- /* skip, if necessary */
- if( fun->skip )
- gskip(fun->gio, (off_t)fun->skip);
- }
- /* calculate the image length including padding */
- _FunImageSize(fun);
- /* now parse the section specification */
- _FunParseSection(fun, tail,
- &(fun->x0), &(fun->x1), &(fun->y0), &(fun->y1),
- &(fun->block), &(fun->btype), tail, SZ_LINE);
- /* get maxbufsize for table access */
- _FunMaxBufSize(fun, tail);
- /* what's left in the tail is the filter */
- fun->filter = xstrdup(tail);
- /* common code */
- if( !_FunOpenCommon(fun) ) goto error;
- /* return completed struct */
- return fun;
- }
-
- /* its a FITS binary table */
- else if( fun->header->table ){
- /* start positive */
- fun->type = FUN_TABLE;
- /* if its FITS, its big-endian */
- fun->endian = 1;
- /* no blanks for tables */
- fun->doblank = 0;
- /* get size of record and number of records */
- if( fun->header->basic ){
- fun->rawsize = fun->header->basic->naxis[0];
- fun->total = fun->header->basic->naxis[1];
- fun->left = fun->total;
- }
- /* look for indication of bitpix */
- if( _FunKeyword(tail, "bitpix", "FITS_BITPIX", tbuf, SZ_LINE) )
- fun->bitpix = atoi(tbuf);
- /* else assume a safe value */
- else
- fun->bitpix = 32;
- /* should we use indices if we find them? */
- if( _FunKeyword(tail, "idx_activate", "FILTER_IDX_ACTIVATE", tbuf, SZ_LINE) ){
- if( istrue(tbuf) )
- fun->idx = 1;
- else if( isfalse(tbuf) )
- fun->idx = -1;
- }
- /* else assume yes */
- else
- fun->idx = 1;
- if( _FunKeyword(tail, "idx_debug", "FILTER_IDX_DEBUG", tbuf, SZ_LINE) ){
- if( istrue(tbuf) )
- idxdebug(1);
- else if( isfalse(tbuf) )
- idxdebug(0);
- }
- /* determine whether we are only processing specific rows */
- _FunRowNum(fun, tail, NULL);
- /* get the key for binning */
- _FunTableBinCols(fun, tail, "FITS_BINCOLS");
- /* get the key for the value column for binning */
- _FunTableValCol(fun, tail, "FITS_VCOL");
- /* calculate the image length including padding */
- _FunImageSize(fun);
- /* now parse the section specification */
- _FunParseSection(fun, tail,
- &(fun->x0), &(fun->x1), &(fun->y0), &(fun->y1),
- &(fun->block), &(fun->btype), tail, SZ_LINE);
- /* get maxbufsize for table access */
- _FunMaxBufSize(fun, tail);
- /* what's left in the tail is the filter */
- fun->filter = xstrdup(tail);
- /* fill in the default selected columns */
- FunColumnSelect(fun, 0, "copy=reference", NULL);
- /* common code */
- if( !_FunOpenCommon(fun) ) goto error;
- /* return completed struct */
- return fun;
- }
- else
- goto error;
- }
- else
- goto error;
-
-error:
- if( !ifun ) _FunFree(fun, 1);
- return NULL;
-}
-
-#ifdef ANSI_FUNC
-static Fun
-_FunOpen(char *fname, char *name, char *tail, int len, char *mode)
-#else
-static Fun
-_FunOpen(fname, name, tail, len, mode)
- char *fname;
- char *name;
- char *tail;
- int len;
- char *mode;
-#endif
-{
- Fun fun=NULL;
- char *special=NULL;
- char *xname=NULL;
-
- /* string to hold special characteristics must be len length */
- if( !(special = xcalloc(len, sizeof(char))) ) return NULL;
- /* remove quotes, if nexessary */
- if( (*fname == '\'') || (*fname == '"') ){
- xname = xstrdup(fname+1);
- if( xname[strlen(xname)-1] == *fname ){
- xname[strlen(xname)-1] = '\0';
- }
- }
- else{
- xname = xstrdup(fname);
- }
- if( _FunSpecialFile(xname, "ARRAY", name, tail, special, len) )
- fun = _FunArrayOpen(name, tail, mode, special);
- /* look for non-FITS events file */
- else if( _FunSpecialFile(xname, "EVENTS", name, tail, special, len) )
- fun = _FunRawEvOpen(name, tail, mode, special);
- /* just a normal FITS file */
- else
- fun = _FunFITSOpen(NULL, xname, mode);
- /* hack */
- if( fun ){
- /* here is the bad bit: we will want to select on the input file fd, but
- gio "files" do not always have an fd and when they do, they might
- have two of them. I am hacking this for the time being */
- if( (fun->gio->type == GIO_DISK) || (fun->gio->type == GIO_STREAM) )
- fun->ifd = fileno(fun->gio->fp);
- else if((fun->gio->type == GIO_SOCKET)||(fun->gio->type == GIO_PIPE))
- fun->ifd = fun->gio->ifd;
- else
- fun->ifd = -1;
- }
- /* clean up */
- if( xname ) xfree(xname);
- if( special ) xfree(special);
- return fun;
-}
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *
- * FunOpen -- open a FITS-type file, scan to the appropriate extension,
- * set up binning and filtering parameters
- *
- */
-#ifdef ANSI_FUNC
-Fun
-FunOpen(char *fname, char *mode, Fun ref)
-#else
-Fun FunOpen(fname, mode, ref)
- char *fname;
- char *mode;
- Fun ref;
-#endif
-{
- int i;
- int ltype;
- int lmem;
- int ip=0;
- int got=0;
- char name[SZ_LINE];
- char tail[SZ_LINE];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- Fun tfun, fun=NULL;
- Fun cur, last=NULL;
-
- /* better have a filename and a mode */
- if( !fname || !*fname || !mode || !*mode )
- goto error;
-
- /* handle non-read opens specially -- we have to create a file */
- if( !strchr(mode, 'r') ){
- /* allocate a fun record */
- if( !(fun = _FunNew()) )
- goto error;
- /* for 'A' (mimick of append), we open r+ and seek to end */
- if( strchr(mode, 'A') ){
- if( !(fun->gio=gopen(fname, "r+")) )
- goto error;
- gseek(fun->gio, 0, SEEK_END);
- }
- /* normal open */
- else{
- if( !(fun->gio=gopen(fname, mode)) )
- goto error;
- }
- /* save filename and mode */
- fun->fname = xstrdup(fname);
- fun->mode = xstrdup(mode);
- /* make a primary header */
- fun->primary = ft_headinit(NULL, 0);
- /* make a header for temp variables */
- fun->theader = ft_headinit(NULL, 0);
- /* if a ref struct was specified, make a ref from the fun struct */
- if( ref && (*(short *)ref == FUN_MAGIC) ){
- fun->ifun = ref;
- /* if we have delayed opening the reference for a copy, do it now */
- if( !fun->ifun->header ){
- /* set copy flag */
- fun->icopy = 1;
- /* set internal fitsy output channel */
- ft_cfile(fun->gio);
- /* open the file Now unless delay is requested */
- if( !strchr(mode, 'd') ){
- _FunFITSOpen(fun->ifun, fun->ifun->fname, "r");
- /* reset output channel */
- ft_cfile(NULL);
- }
- }
- /* enter this handle in the backlink list of the reference file */
- for(i=0; i<FUN_MAXBFUN; i++){
- if( !fun->ifun->bfun[i] ){
- fun->ifun->bfun[i] = fun;
- break;
- }
- }
- }
- }
- /* this is "read" mode */
- else{
- ltype = LIST_FILEORDER;
- lmem = -1;
- /* process as a space-delimited list of files */
- while( _FunFile(fname, tbuf, SZ_LINE, &ip) ){
- if( _FunKeyword(tbuf, "listorder", "FUN_LISTORDER", tbuf2, SZ_LINE) ){
- if( !strncasecmp(tbuf2, "s", 1) )
- ltype = LIST_SORT;
- else if( !strncasecmp(tbuf2, "t", 1) )
- ltype = LIST_TRYSORT;
- else if( !strncasecmp(tbuf2, "u", 1) )
- ltype = LIST_UNSORT;
- else if( !strncasecmp(tbuf2, "f", 1) )
- ltype = LIST_FILEORDER;
- continue;
- }
- if( _FunKeyword(tbuf, "listmem", "FUN_LISTMEM", tbuf2, SZ_LINE) ){
- lmem = (int)(atof(tbuf2)*1000000);
- continue;
- }
- /* try to open this possible file */
- if( !(tfun=_FunOpen(tbuf, name, tail, SZ_LINE, mode)) )
- goto error;
- if( !fun )
- fun = tfun;
- else if( last )
- last->next = tfun;
- last = tfun;
- got++;
- }
- /* only set current if we actually have a list */
- if( got == 1 )
- fun->ltype = LIST_NONE;
- else{
- fun->ltype = ltype;
- fun->lmem = lmem;
- fun->current = fun;
- /* list pre-processing */
- for(cur=fun; cur; cur=cur->next){
- /* set head of list */
- cur->head = fun;
- cur->lefp = tmpfile();
- cur->lrfp = tmpfile();
- }
- }
- }
- return(fun);
-
-error:
- if( fun ) _FunFree(fun, 1);
- return NULL;
-}
-
-#ifdef ANSI_FUNC
-void
-FunFlush(Fun fun, char *plist)
-#else
-void FunFlush(fun, plist)
- Fun fun;
- char *plist;
-#endif
-{
- int i;
- int pad;
- int got;
- int doref=0;
- int dorest=0;
- int doback=0;
- int skip;
- char *pbuf;
- char tbuf[SZ_LINE];
- Fun tfun=NULL;
- GIO gios[1];
-
- /* make sure we have something to do */
- if( !_FunValid(fun) )
- return;
-
- /* check plist for copy mode -- but only if we have a reference handle */
- if( fun->ifun ){
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "copy", NULL, tbuf, SZ_LINE) ){
- if( !strncasecmp(tbuf, "ref", 3) )
- doref = 1;
- else if( fun->icopy && !strncasecmp(tbuf, "remain", 6) )
- dorest = 1;
- }
- if( pbuf ) xfree(pbuf);
- }
- else{
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "copy", NULL, tbuf, SZ_LINE) ){
- if( !strncasecmp(tbuf, "ref", 3) ){
- doback = 1;
- /* perform ordinary flush on each backlink */
- for(i=0; i<FUN_MAXBFUN; i++){
- if( fun->bfun[i] ){
- FunFlush(fun->bfun[i], NULL);
- }
- }
- }
- }
- if( pbuf ) xfree(pbuf);
- }
-
- /* If we did not set a type, perhaps because this is an output file
- that we did not write to, we might be able to set the type now to
- be the reference type. This will allow us to flush the ref header
- to the output file. */
- if( !fun->type && fun->ifun )
- fun->type = fun->ifun->type;
-
- /* if we are writing out the full reference extension, we just do it */
- if( doref ){
- /* copy header */
- ft_headwrite(fun->gio, fun->ifun->header);
- /* try to get back to the data, in case we read any already */
- gseek(fun->ifun->gio, ft_data(fun->ifun->header), 0);
- /* skip data, copying header if necessary */
- gios[0] = fun->gio;
- ft_dataskip(fun->ifun->gio, fun->ifun->header, gios, 1);
- }
- else{
- /* for writing, we might have to output the FITS header, padding, etc. */
- if( strchr(fun->mode, 'w') || strchr(fun->mode, 'a') ||
- strchr(fun->mode, 'A') ){
- /* process extension-specific flush */
- switch(fun->type){
- case FUN_IMAGE:
- /* might have to write the header */
- _FunImagePutHeader(fun, fun->dim1, fun->dim2, fun->bitpix);
- /* pad to end of extension, if necessary */
- pad = FT_BLOCK - (fun->bytes % FT_BLOCK);
- if( pad && (pad != FT_BLOCK) ){
- pbuf = (char *)xcalloc(pad, sizeof(char));
- gwrite(fun->gio, pbuf, 1, pad);
- xfree(pbuf);
- fun->io = 0;
- }
- break;
- case FUN_TABLE:
- /* might have to write the header */
- _FunTablePutHeader(fun);
- /* try to fix the naxis2 param, and if so, write padding as well */
- if( _FunFixNaxis2(fun) ){
- pad = FT_BLOCK - (fun->bytes % FT_BLOCK);
- if( pad && (pad != FT_BLOCK) ){
- pbuf = (char *)xcalloc(pad, sizeof(char));
- gwrite(fun->gio, pbuf, 1, pad);
- xfree(pbuf);
- fun->io = 0;
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
- /* if this is final flush, might have to copy remaining input extensions */
- if( dorest || doback ){
- if( dorest )
- tfun = fun->ifun;
- else if( doback )
- tfun = fun;
- /* might have to skip to end of this extension */
- switch(tfun->type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- /* calculate bytes we should have read to end of extension, but didn't */
- skip = ((MAX(tfun->dim2,1)*tfun->dim1)*ABS(tfun->dtype)) +
- tfun->dpad - tfun->curpos;
- if( skip ){
- gskip(tfun->gio, (off_t)skip);
- fun->curpos += skip;
- }
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- /* calculate bytes we should have read to end of extension, but didn't */
- skip = ((tfun->rawsize*tfun->total)+ft_pcount(tfun->header))-tfun->bytes;
- /* if there are any ... */
- if( skip ){
- /* ... it also means we did not skip the padding */
- pad = FT_BLOCK - ((tfun->rawsize*tfun->total) % FT_BLOCK);
- if( pad == FT_BLOCK ) pad = 0;
- skip += pad;
- /* do it now */
- gskip(tfun->gio, (off_t)skip);
- }
- break;
- default:
- break;
- }
- /* write out the rest of the reference file */
- while( (got=gread(tfun->gio, tbuf, sizeof(char), SZ_LINE)) >0 ){
- if( dorest ){
- gwrite(fun->gio, tbuf, sizeof(char), got);
- }
- else if( doback ){
- for(i=0; i<FUN_MAXBFUN; i++){
- if( fun->bfun[i] && fun->bfun[i]->gio ){
- gwrite(fun->bfun[i]->gio, tbuf, sizeof(char), got);
- }
- }
- }
- }
- }
-
- /* we can free up most structure, but leave enough to carry on */
- _FunFree(fun,0);
- /* since we just flushed, flag that we can start again */
- fun->ops = 0;
-}
-
-#ifdef ANSI_FUNC
-void
-FunClose(Fun fun)
-#else
-void FunClose(fun)
- Fun fun;
-#endif
-{
- int i;
- Fun tfun;
- if( !_FunValid(fun) )
- return;
- /* close all files (this might be a list) */
- while( fun ){
- tfun = fun->next;
- FunFlush(fun, "copy=remaining");
- gclose(fun->gio);
- fun->gio = NULL;
- /* remove this handle from the backlink list of the reference file */
- if( fun->ifun && (*(short *)fun->ifun == FUN_MAGIC) ){
- for(i=0; i<FUN_MAXBFUN; i++){
- if( fun->ifun->bfun[i] == fun ){
- fun->ifun->bfun[i] = (Fun)NULL;
- break;
- }
- }
- }
- /* if this is a ref file for other files, clear all of those ifun flags */
- for(i=0; i<FUN_MAXBFUN; i++){
- if( fun->bfun[i] && (*(short *)fun->bfun[i] == FUN_MAGIC) )
- fun->bfun[i]->ifun = (Fun)NULL;;
- }
- _FunFree(fun,1);
- fun = tfun;
- }
-}
-
diff --git a/funtools/funopenp.c b/funtools/funopenp.c
deleted file mode 100644
index e98bbc3..0000000
--- a/funtools/funopenp.c
+++ /dev/null
@@ -1,1065 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-#include <ctype.h>
-
-/*
- *
- * semi-public routines shared between funopen.c and other open modules
- *
- */
-
-/*
- *
- * _FunNew -- allocate a new fun record
- *
- */
-#ifdef ANSI_FUNC
-Fun
-_FunNew(void)
-#else
-Fun _FunNew()
-#endif
-{
- Fun fun;
-
- fun = (Fun)xcalloc(1, sizeof(FunRec));
- /* set the magic value */
- fun->magic = FUN_MAGIC;
- /* set table binning values to impossible values */
- fun->bin[0] = -1;
- fun->bin[1] = -1;
- /* no value column for binning yet */
- fun->vbin = -1;
- /* reset header position flag */
- fun->headpos = (off_t)-1;
- /* no data yet */
- fun->datastart = (off_t)-1;
- /* init save fd's to impossible values */
- fun->lmem = -1;
- /* set binsiz values to default value of 1 */
- fun->binsiz1 = 1;
- fun->binsiz2 = 1;
- /* no reaon why we can't filter */
- fun->dofilt = 1;
- /* convert flags not yet set */
- fun->iconvert = -1;
- fun->oconvert = -1;
- /* assume 2D image */
- fun->dims = 2;
-
- return fun;
-}
-
-#ifdef ANSI_FUNC
-int
-_FunSpecialFile(char *fname, char *type,
- char *name, char *tail, char *special, int mlen)
-#else
-int _FunSpecialFile(fname, type, name, tail, special, mlen)
- char *fname;
- char *type;
- char *name;
- char *tail;
- char *special;
- int mlen;
-#endif
-{
- int len, tlen;
- char *s, *t;
- char tbuf[SZ_LINE];
-
- /* start off pessimistically */
- *name = '\0';
- *tail = '\0';
- *special = '\0';
-
- /* get type string */
- strncpy(tbuf, type, SZ_LINE-1);
- strncat(tbuf, "(", SZ_LINE-1);
- len = strlen(tbuf);
-
- /* look for [TYPE(...) */
- if( ((s=strchr(fname, '['))||(s=strchr(fname, ','))) &&
- !strncasecmp(s+1, tbuf, len) && (t=strchr(s, ')')) &&
- ((*(t+1) == ')') || (*(t+1) == ',') || (*(t+1) == ']')) ){
- tlen = MIN(mlen-1,s-fname);
- strncpy(name, fname, tlen);
- name[tlen] = '\0';
- while( *(s+len+1) == '(' ) s++;
- tlen = MIN(mlen-1,t-(s+len+1));
- strncpy(special, s+len+1, tlen);
- special[tlen] = '\0';
- /* if special specification is blank, try to get it from the environment */
- if( !*special && getenv(type) ) strncpy(special, getenv(type), mlen);
- special[mlen-1] = '\0';
- /* create tail, skipping empty section if necessary */
- while( *t == ')' ) t++;
- if( *t != ']' ){
- strncpy(tail, "[", mlen);
- strncat(tail, t, mlen);
- }
- else{
- strncpy(tail, ++t, mlen);
- }
- tail[mlen-1] = '\0';
- return 1;
- }
- else{
- return 0;
- }
-}
-
-/*
- *
- * _FunRowNum -- get table/event row limits
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunRowNum(Fun fun, char *tail, char *env)
-#else
-int _FunRowNum(fun, tail, env)
- Fun fun;
- char *tail;
- char *env;
-#endif
-{
- char lobuf[SZ_LINE];
- char hibuf[SZ_LINE];
- char key[SZ_LINE];
- char *k;
- int ip=0;
- int lo, hi;
- int skip;
-
- /* first look in the extension for row range specification */
- if( _FunKeyword(tail, "row#", env, key, SZ_LINE) ){
- /* use a few command separators (as well as \n) */
- newdtable(",:)");
- k = key;
- /* point past first paren */
- if( *k == '(' )
- k++;
- /* process row specifiers */
- if( word(k, lobuf, &ip) ){
- /* set lo limit */
- if( !strcmp(lobuf, "*") )
- lo = 1;
- else
- lo = atoi(lobuf);
- /* set hi limit */
- if( word(k, hibuf, &ip) ){
- if( !strcmp(hibuf, "*") )
- hi = fun->total;
- else
- hi = atoi(hibuf);
- }
- /* if no hi limit, use lo (i.e. 1 row) ... or maybe use all rows */
- else{
- if( !strcmp(lobuf, "*") )
- hi = fun->total;
- else
- hi = lo;
- }
- /* must be within range */
- lo = MAX(1,lo);
- hi = MIN(fun->total,hi);
- /* skip past initial rows we are not interested in */
- if( lo > 1 ){
- skip = (lo-1) * fun->rawsize;
- gskip(fun->gio, (off_t)skip);
- fun->bytes += skip;
- }
- fun->left -= (lo-1);
- fun->left -= (fun->total-hi);
- }
- freedtable();
- return 1;
- }
- else
- return 0;
-}
-
-/*
- *
- * _FunTableBinCols -- get table columns for binning
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunTableBinCols(Fun fun, char *tail, char *env)
-#else
-int _FunTableBinCols(fun, tail, env)
- Fun fun;
- char *tail;
- char *env;
-#endif
-{
- FITSCard card;
- int i, j, n;
- int got;
- int ip=0;
- int dims;
- int scaled;
- double tlmin, tlmax, binsiz, tscale, tzero;
- char *s;
- char *k;
- char key[SZ_LINE];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char binstr[2][SZ_LINE];
- static char *tstr[] = {"X", "Y"};
- static char *tstr2[] = {"x", "y"};
-
- /* set keys to impossible values */
- fun->bin[0] = -1;
- fun->bin[1] = -1;
-
- /* for backward compatibility, we look for binkey as well */
- if( !strcmp(env, "FITS_BINCOLS" ) )
- strcpy(tbuf2, "FITS_BINKEY");
- else if( !strcmp(env, "EVENTS_BINCOLS" ) )
- strcpy(tbuf2, "EVENTS_BINKEY");
- else if( !strcmp(env, "TEXT_BINCOLS" ) )
- strcpy(tbuf2, "TEXT_BINKEY");
- else
- *tbuf2 = '\0';
-
- /* first look in the extension for binning specification */
- if( _FunKeyword(tail, "bincols", env, tbuf, SZ_LINE) ){
- strcpy(key, tbuf);
- }
- else if( _FunKeyword(tail, "bincol", env, tbuf, SZ_LINE) ){
- strcpy(key, tbuf);
- }
- /* backward compatibility */
- else if( _FunKeyword(tail, "binkey", tbuf2, tbuf, SZ_LINE) ){
- strcpy(key, tbuf);
- }
- /* look for default binning specifications */
- else{
- got = 0;
- *key = '\0';
- /* look for CHANDRA PREFX keyword */
- for(j=1; j<=2; j++){
- if( (s=ft_headgets(fun->header, "CPREF", j, NULL, &card)) && card){
- strcat(key, s);
- strcat(key, ",");
- got |= j;
- if( s ) xfree(s);
- }
- else if( (s=ft_headgets(fun->header, "PREFX", j, NULL, &card)) && card){
- strcat(key, s);
- strcat(key, ",");
- got |= j;
- if( s ) xfree(s);
- }
- }
- /* look specifically for X, Y */
- if( got != 3 ){
- got = 0;
- *key = '\0';
- for(j=0; j<=1; j++){
- /* first look for X,Y as the default */
- for(i=0; i<fun->header->table->tfields; i++){
- if( !fun->header->table->col[i].name ) continue;
- if( !strcasecmp(fun->header->table->col[i].name, tstr[j]) ){
- strcat(key, tstr[j]);
- strcat(key, ",");
- got |= (j+1);
- break;
- }
- }
- }
- }
- /* if we did not get X (or Y), look for anything containing an X (or Y) */
- if( got != 3 ){
- got = 0;
- *key = '\0';
- for(j=0; j<=1; j++){
- /* don't look a second time for a bin value we already have */
- if( got & (j+1) )
- continue;
- for(i=0; i<fun->header->table->tfields; i++){
- if( !fun->header->table->col[i].name ) continue;
- if( strstr(fun->header->table->col[i].name, tstr[j]) != NULL ){
- strcat(key, fun->header->table->col[i].name);
- strcat(key, ",");
- break;
- }
- /* sigh ... its gotta be case insensitive */
- else if( strstr(fun->header->table->col[i].name, tstr2[j]) != NULL ){
- strcat(key, fun->header->table->col[i].name);
- strcat(key, ",");
- break;
- }
- }
- }
- }
- }
-
- /* seed the dim values */
- fun->min1 = 1;
- fun->max1 = -1;
- fun->min2 = 1;
- fun->max2 = -1;
-
- /* prepare to parse the bincol specifier */
- newdtable(",)");
- k = key;
- /* point past first paren */
- while( (*k == '(') || (*k == '"') ) k++;
- /* separate x and y specifiers */
- if( !word(k, binstr[0], &ip) )
- goto error;
- else
- n=1;
- if( word(k, binstr[1], &ip) )
- n++;
- freedtable();
-
- /* make sure columns are in the table, and check for
- manually-specified image dimensions and binsize info */
- for(got=0, j=0; j<n; j++){
- /* look for specifiers after the name */
- if( (s = strchr(binstr[j], ':')) ){
- strncpy(tbuf, binstr[j], s-binstr[j]);
- tbuf[s-binstr[j]] = '\0';
- }
- else{
- strcpy(tbuf, binstr[j]);
- }
- /* look among columns for this column name */
- for(i=0; i<fun->header->table->tfields; i++){
- if( !fun->header->table->col[i].name ) continue;
- if( !strcasecmp(fun->header->table->col[i].name, tbuf) ){
- /* save the column number */
- fun->bin[j] = i;
- /* if dim/binsize was specified, put it all back into the header */
- if( _FunColumnDims(s, fun->header->table->col[i].type,
- &tlmin, &tlmax, &binsiz, &dims,
- &tscale, &tzero, &scaled)){
- switch(fun->header->table->col[i].type){
- case 'D':
- case 'E':
- if( tlmin != tlmax ){
- ft_headsetr(fun->header, "TLMIN", i+1, tlmin, 7,
- "Min. axis value", 1);
- ft_headsetr(fun->header, "TLMAX", i+1, tlmax, 7,
- "Max. axis value", 1);
- }
- if( binsiz > 0 ){
- ft_headsetr(fun->header, "TDBIN", i+1, binsiz, 7,
- "Binsize", 1);
- }
- break;
- default:
- if( tlmin != tlmax ){
- ft_headseti(fun->header, "TLMIN", i+1, (int)tlmin,
- "Min. axis value", 1);
- ft_headseti(fun->header, "TLMAX", i+1, (int)tlmax,
- "Max. axis value", 1);
- }
- if( binsiz > 0 ){
- ft_headsetr(fun->header, "TDBIN", i+1, binsiz, 7,
- "Binsize", 1);
- }
- break;
- }
- }
- /* add scaling parameters if necessary */
- if( scaled ){
- ft_headsetr(fun->header, "TSCAL", i+1, tscale, 7,
- "phys_val= tzero + tscale * field_val", 1);
- ft_headsetr(fun->header, "TZERO", i+1, tscale, 7,
- "phys_val= tzero + tscale * field_val", 1);
- }
- got |= (j+1);
- break;
- }
- }
- }
- /* better have at least one column and, if we have only one binning
- parameter, it has to be in bin[0] */
- if( (got==0) || (got==2) )
- return 0;
-
- /* save bincols (string is used in FilterOpen, for example) */
- switch(got){
- case 1:
- snprintf(tbuf, SZ_LINE-1, "bincols=(%s)",
- fun->header->table->col[fun->bin[0]].name);
- fun->dims = 1;
- break;
- case 2:
- /* this never gets executed because we disallow this case */
- snprintf(tbuf, SZ_LINE-1, "bincols=(%s)",
- fun->header->table->col[fun->bin[1]].name);
- fun->dims = 1;
- break;
- case 3:
- snprintf(tbuf, SZ_LINE-1, "bincols=(%s,%s)",
- fun->header->table->col[fun->bin[0]].name,
- fun->header->table->col[fun->bin[1]].name);
- fun->dims = 2;
- break;
- }
- fun->bincols=xstrdup(tbuf);
-
- /* make sure these keys have valid axis lengths associated with them */
- /* first look for TLMAX (and perhaps TLMIN) */
- if( got & 1 ){
- fun->max1 = ft_headgetr(fun->header, "TLMAX", fun->bin[0]+1, 0.0, &card);
- if( !card ) return 0;
- fun->min1 = ft_headgetr(fun->header, "TLMIN", fun->bin[0]+1, 1.0, &card);
- fun->binsiz1 = ft_headgetr(fun->header, "TDBIN", fun->bin[0]+1, 1.0,&card);
- fun->dim1 = tldim(fun->min1, fun->max1, fun->binsiz1,
- fun->header->table->col[fun->bin[0]].type);
- }
- if( got & 2 ){
- fun->max2 = ft_headgetr(fun->header, "TLMAX", fun->bin[1]+1, 0.0, &card);
- if( !card ) return 0;
- fun->min2 = ft_headgetr(fun->header, "TLMIN", fun->bin[1]+1, 1.0, &card);
- fun->binsiz2 = ft_headgetr(fun->header, "TDBIN", fun->bin[1]+1, 1.0,&card);
- fun->dim2 = tldim(fun->min2, fun->max2, fun->binsiz2,
- fun->header->table->col[fun->bin[1]].type);
- }
- return 1;
-
-error:
- freedtable();
- return 0;
-}
-
-/*
- *
- * _FunTableValCol -- get value table column for binning
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunTableValCol(Fun fun, char *tail, char *env)
-#else
-int _FunTableValCol(fun, tail, env)
- Fun fun;
- char *tail;
- char *env;
-#endif
-{
- int i;
- int got;
- int ip=0;
- char *k=NULL;
- char *v=NULL;
- char key[SZ_LINE];
- char tbuf[SZ_LINE];
- char valstr[SZ_LINE];
-
- /* initialize */
- *key = '\0';
- /* set to impossible value */
- fun->vbin = -1;
-
- /* look in the extension for value column specification */
- if( _FunKeyword(tail, "vcol", env, tbuf, SZ_LINE) ) strcpy(key, tbuf);
- if( !*key ) return 0;
-
- /* prepare to parse the bincol specifier */
- newdtable(",)");
- k = key;
- /* point past first paren */
- while( (*k == '(') || (*k == '"') ) k++;
- /* look for vcol specifier */
- got=word(k, valstr, &ip);
- freedtable();
- if( !got ) return 0;
-
- /* look for operator before the name */
- v = valstr;
- if( *valstr == '/' ){
- fun->vop = '/';
- v++;
- }
- /* look among columns for this column name */
- for(i=0, got=0; i<fun->header->table->tfields; i++){
- if( !fun->header->table->col[i].name ) continue;
- if( !strcasecmp(fun->header->table->col[i].name, v) ){
- /* save the value column number */
- fun->vbin = i;
- got++;
- break;
- }
- }
- return got;
-}
-
-/*
- *
- * FunRawEvHeader -- read a string that details the structure
- * of the event record and generate a fitsy header
- *
- */
-#ifdef ANSI_FUNC
-FITSHead
-_FunRawEvHeader(Fun fun, char *iname, char *iext, char *eventdef)
-#else
-FITSHead _FunRawEvHeader(fun, iname, iext, eventdef)
- Fun fun;
- char *iname;
- char *iext;
- char *eventdef;
-#endif
-{
- char tbuf[SZ_LINE];
- char *s;
- char *neventdef=NULL;
- char **names=NULL;
- char **types=NULL;
- char *extname="EVENTS";
- int extver=1;
- int width=0;
- int ncol=0;
- int got;
- int i, r;
- int total;
- int skip;
- int type;
- int dim, scaled;
- int xtype, xoff;
- int *dims=NULL;
- int *scaleds=NULL;
- int *widths=NULL;
- double tlmin, tlmax, binsiz, tscale, tzero;
- double *tlmins=NULL, *tlmaxs=NULL, *binsizs=NULL;
- double *tscales=NULL, *tzeros=NULL;
- FITSHead header=NULL;
- struct stat buf;
-
- /* make sure we have some columns */
- if( !eventdef || !*eventdef ){
- gerror(stderr, "Event definition is empty\n");
- goto done;
- }
-
- /* init the fitsy header */
- header = ft_headinit(NULL, 0);
-
- /* get rid of enclosing parens */
- if(*eventdef == '('){
- neventdef = xstrdup(eventdef+1);
- i = strlen(neventdef);
- if( neventdef[i-1] == ')' )
- neventdef[i-1] = '\0';
- }
- /* get rid of enclosing quotes */
- else if( (*eventdef == '"') || (*eventdef == '\'') ){
- neventdef = xstrdup(eventdef+1);
- i = strlen(neventdef);
- if( neventdef[i-1] == *eventdef )
- neventdef[i-1] = '\0';
- }
- else{
- neventdef = xstrdup(eventdef);
- }
- /* we only deal with upper case in FITS */
- cluc(neventdef);
-
- /* count the number of columns, separated by ',' */
- for(ncol=0, s=neventdef; *s; s++){
- if( *s == ',' ) ncol++;
- }
- /* last column had a null after it */
- ncol++;
-
- /* allocate string space for each column */
- names = (char **)xcalloc(ncol, sizeof(char *));
- types = (char **)xcalloc(ncol, sizeof(char *));
- dims = (int *)xcalloc(ncol, sizeof(int));
- scaleds = (int *)xcalloc(ncol, sizeof(int));
- tlmins = (double *)xcalloc(ncol, sizeof(double));
- tlmaxs = (double *)xcalloc(ncol, sizeof(double));
- binsizs = (double *)xcalloc(ncol, sizeof(double));
- tscales = (double *)xcalloc(ncol, sizeof(double));
- tzeros = (double *)xcalloc(ncol, sizeof(double));
- widths = (int *)xcalloc(ncol, sizeof(int));
-
- /* process the string and gather up the information on each column */
- s = neventdef;
- for(got=0; got<ncol; got++){
- /* get name */
- for(i=0; (i < SZ_LINE-1) && *s && (*s != ':'); i++, s++){
- tbuf[i] = *s;
- tbuf[i+1] = '\0';
- }
- names[got] = xstrdup(tbuf);
- /* skip delim */
- if( *s == ':' ) s++;
- /* make sure we have something */
- if( *s == '\0' ) break;
-
- /* get column specification up to next comma */
- for(i=0; (i < SZ_LINE-1) && *s && (*s != ','); i++, s++){
- tbuf[i] = *s;
- tbuf[i+1] = '\0';
- }
-
- /* parse values for various column parameters */
- _FunColumnType(tbuf, &type, &r, &tlmin, &tlmax, &binsiz, &dim,
- &tscale, &tzero, &scaled, &xtype, &xoff);
-
- /* save info for this column */
- snprintf(tbuf, SZ_LINE-1, "%d%c", r, type);
- types[got] = xstrdup(tbuf);
- tlmins[got] = tlmin;
- tlmaxs[got] = tlmax;
- binsizs[got] = binsiz;
- dims[got] = dim;
- tscales[got] = tscale;
- tzeros[got] = tzero;
- scaleds[got] = scaled;
- widths[got] = ft_sizeof(type);
- /* add to total width */
- if( type == 'X' )
- width += ((widths[got]*r) + 7 ) / 8;
- else
- width += widths[got] * r;
- /* bump past the comma */
- if( *s == ',' ) s++;
- }
- /* make sure we have some columns */
- if( width == 0 ){
- gerror(stderr, "Table width is zero\n");
- goto done;
- }
-
- /* get the size of the file and from this, the number of events */
- if( !iname || !*iname ||
- !strcasecmp(iname, "stdin") || (stat(iname, &buf) <0) ){
- total = -1;
- }
- else{
- if( fun == NULL )
- skip = 0;
- else
- skip = fun->skip;
- total = (buf.st_size - skip)/width;
- }
-
- /* check for monotonically desceasing widths */
- if( _FunKeyword(iext, "align", "EVENTS_ALIGN", tbuf, SZ_LINE) &&
- istrue(tbuf) ){
- for(i=1; i<got; i++){
- if(widths[i] > widths[i-1]){
- gwarning(stderr,
- "event alignment warning: %s (%d) follows %s (%d)\n",
- names[i], widths[i], names[i-1], widths[i-1]);
- }
- }
- }
-
- /* fake the header to a binary table */
- ft_headsets(header, "XTENSION", 0, "BINTABLE", "FITS BINARY TABLE", 1);
- ft_headseti(header, "BITPIX", 0, 8, "Binary data", 1);
- ft_headseti(header, "NAXIS", 0, 2, "Table is a matrix", 1);
- ft_headseti(header, "NAXIS", 1, width, "Width of table in bytes", 1);
- ft_headseti(header, "NAXIS", 2, total, "Number of entries in table", 1);
- ft_headseti(header, "PCOUNT", 0, 0, "Random parameter count", 1);
- ft_headseti(header, "GCOUNT", 0, 1, "Group count", 1);
- ft_headseti(header, "TFIELDS", 0, got, "Number of fields in each row", 1);
- ft_headsets(header, "EXTNAME", 0, extname, "Table name", 1);
- ft_headseti(header, "EXTVER", 0, extver, "Version number of table", 1);
- /* info for each column */
- for(i=0; i<got; i++){
- ft_headsets(header, "TFORM", i+1, types[i], "Data type for field", 1);
- ft_headsets(header, "TTYPE", i+1, names[i], "Label for field", 1);
- if( dims[i] ){
- if( (tlmins[i] == (int)tlmins[i]) && (tlmaxs[i] == (int)tlmaxs[i]) ){
- ft_headseti(header, "TLMIN", i+1, (int)tlmins[i],
- "Min. axis value", 1);
- ft_headseti(header, "TLMAX", i+1, (int)tlmaxs[i],
- "Max. axis value", 1);
- }
- else{
- ft_headsetr(header, "TLMIN", i+1, tlmins[i], 7, "Min. axis value", 1);
- ft_headsetr(header, "TLMAX", i+1, tlmaxs[i], 7, "Max. axis value", 1);
- }
- }
- if( binsizs[i] != 1.0 ){
- ft_headsetr(header, "TDBIN", i+1, binsizs[i], 7, "Bin size", 1);
- }
- if( scaleds[i] ){
- ft_headsetr(header, "TSCAL", i+1, tscales[i], 7,
- "phys_val = tzero + tscale * field_val", 1);
- ft_headsetr(header, "TZERO", i+1, tzeros[i], 7,
- "phys_val = tzero + tscale * field_val", 1);
- }
- }
-
- /* get size of record and number of records */
- fun->rawsize = width;
- fun->total = total;
- fun->left = fun->total;
-
- /* now turn this into a table header */
- ft_syncdata(header);
-
-done:
- /* free up the column strings */
- for(i=0; i<ncol; i++){
- if( names[i] ) xfree(names[i]);
- if( types[i] ) xfree(types[i]);
- }
- if( names ) xfree(names);
- if( types ) xfree(types);
- if( dims ) xfree(dims);
- if( tlmins ) xfree(tlmins);
- if( tlmaxs ) xfree(tlmaxs);
- if( binsizs ) xfree(binsizs);
- if( scaleds ) xfree(scaleds);
- if( tscales ) xfree(tscales);
- if( tzeros ) xfree(tzeros);
- if( widths ) xfree(widths);
- if( neventdef ) xfree(neventdef);
-
- return header;
-}
-
-/*
- *
- * _FunImageSkip -- caclulcate the number of bytes to skip to get
- * to specified image plane of an N-dimensional image
- *
- */
-#ifdef ANSI_FUNC
-off_t
-_FunImageSkip(Fun fun, char *tail)
-#else
-off_t _FunImageSkip(fun, tail)
- Fun fun;
- char *tail;
-#endif
-{
- int i,j,k;
- int naxes;
- int plane;
- int planes[8];
- int skip;
- off_t total;
- char tbuf[SZ_LINE];
- char *s, *t;
-
- /* nothing to skip yet */
- total = 0;
-
- /* nothing to do if its not an n-D image */
- if( (naxes=ft_naxes(fun->header)) <= 2 )
- return total;
-
- /* look for a bracket specification */
- if( !_FunKeyword(tail, "plane", NULL, tbuf, SZ_LINE) )
- return 0;
- else
- s = tbuf;
-
- /* skip open parens */
- if( *s == '(' )
- s++;
- planes[1] = ft_naxis(fun->header, 1);
- planes[2] = ft_naxis(fun->header, 2);
- /* see the other planes */
- for(i=3; i<=7; i++)
- planes[i] = 1;
- /* we look for a plane specification for each axis > 2 */
- for(i=3; i<=naxes; i++){
- plane = strtol(s, &t, 10);
- if( s == t )
- plane = 1;
- else if( (plane < 1) || (plane > ft_naxis(fun->header, i)) )
- return -1;
- /* save the image plane desired for this dimension */
- planes[i] = plane;
- /* point past delimiter */
- if( *t == ':' )
- t++;
- /* see if we ran out of running room */
- if( (*t == '\0') || (*t == ']') || (*t == ')') )
- break;
- /* this is where we look next */
- s = t;
- }
- /* skip n-dimensional cubes of various dimensions until we
- get to the desired 2d image */
- for(j=naxes; j>2; j--){
- for(skip=1,k=1; k<j; k++)
- skip *= ft_naxis(fun->header, k);
- skip *= (planes[j]-1) * (ABS(fun->dtype));
- total += skip;
- }
- return total;
-}
-
-#ifdef ANSI_FUNC
-Fun
-_FunValid(Fun fun)
-#else
-Fun _FunValid(fun)
- Fun fun;
-#endif
-{
- Fun current;
- if( !fun ) return NULL;
- /* if a current list member is defined, test that one */
- if( fun->current )
- current = fun->current;
- /* else test this one */
- else
- current = fun;
- if( FUN_VALID(current) )
- return current;
- else
- return NULL;
-}
-
-/*
- *
- * _FunFree -- free up a fun record
- *
- */
-#ifdef ANSI_FUNC
-void
-_FunFree(Fun fun, int flag)
-#else
-void _FunFree(fun, flag)
- Fun fun;
- int flag;
-#endif
-{
- int i;
- SaveBuf cur, tcur;
-
- if( fun ){
- _FunColumnFree(fun);
- if( fun->filter ){
- xfree(fun->filter);
- fun->filter = NULL;
- }
- if( fun->rawbuf ){
- xfree(fun->rawbuf);
- fun->rawbuf = NULL;
- }
- if( fun->bincols ){
- xfree(fun->bincols);
- fun->bincols = NULL;
- }
- if( fun->activate ){
- xfree(fun->activate);
- fun->activate = NULL;
- }
- if( fun->header ){
- ft_headfree(fun->header, 1);
- fun->header = NULL;
- }
- if( fun->theader ){
- ft_headfree(fun->theader, 1);
- fun->theader = NULL;
- }
- if( fun->primary ){
- ft_headfree(fun->primary, 1);
- fun->primary = NULL;
- }
- /* close "save buffer" fds */
- if( fun->lefp ){
- fclose(fun->lefp);
- fun->lefp = NULL;
- }
- if( fun->lrfp ){
- fclose(fun->lrfp);
- fun->lrfp = NULL;
- }
- /* free save buffers */
- for(cur=fun->save; cur; ){
- tcur = cur->next;
- if(cur->ebuf ) xfree(cur->ebuf);
- if(cur->rbuf ) xfree(cur->rbuf);
- if( cur ) xfree(cur);
- cur = tcur;
- }
- fun->save = NULL;
-
- /* close filters, free masks */
- if( fun->filt && (fun->filt != NOFILTER) ){
- FilterClose(fun->filt);
- fun->filt = NULL;
- }
- if( fun->masks ){
- xfree(fun->masks);
- fun->masks = NULL;
- }
- fun->nmask = 0;
-
- /* free up text parsers */
- if( fun->parsers ){
- for(i=0; i<fun->nparser; i++){
- if( fun->parsers[i] ) ParseFree(fun->parsers[i]);
- }
- xfree(fun->parsers);
- fun->parsers = NULL;
- }
- /* free up view info */
- if( fun->vcols ){
- xfree(fun->vcols);
- fun->vcols = NULL;
- }
- if( fun->vfmt ){
- xfree(fun->vfmt);
- fun->vfmt = NULL;
- }
-
- /* if flag is true, we free up all space
- otherwise, its assumed we will do some more writing */
- if( flag ){
- if( fun->fname ) xfree(fun->fname);
- if( fun->mode ) xfree(fun->mode);
- if( fun->wcs ) wcsfree(fun->wcs);
- if( fun->wcs0 ) wcsfree(fun->wcs0);
- /* clear the magic flag as a last resort */
- fun->magic = 0;
- xfree(fun);
- }
- else{
- fun->type = 0;
- fun->overflow = 0;
- fun->rowsize = 0;
- fun->rawsize = 0;
- fun->total = 0;
- fun->left = 0;
- fun->io = 0;
- fun->bytes = 0;
- fun->rawbufsize = 0;
- /* re-init header for temp variables for next extension */
- fun->theader = ft_headinit(NULL, 0);
- }
- }
-}
-
-/*
- *
- * _FunImageSize -- calculate the size of the image, including padding
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunImageSize(Fun fun)
-#else
-int _FunImageSize(fun)
- Fun fun;
-#endif
-{
- /* get data type code (which is abs(length)) */
- fun->dtype = fun->bitpix / FT_WORDLEN;
- /* this is the length of the image, without padding */
- fun->dlen = fun->dim1 * fun->dim2 * ABS(fun->dtype);
- /* determine the padding */
- if( (fun->dpad = FT_BLOCK - (fun->dlen % FT_BLOCK)) == FT_BLOCK )
- fun->dpad = 0;
- return fun->dlen;
-}
-
-/*
- *
- * _FunMaxBufSize -- calculate the size of the image, including padding
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunMaxBufSize(Fun fun, char *tail)
-#else
-int _FunMaxBufSize(fun, tail)
- Fun fun;
- char *tail;
-#endif
-{
- char tbuf[SZ_LINE];
-
- fun->maxbufsize = 0;
- if( _FunKeyword(tail, "maxbufsize", "FUN_MAXBUFSIZE", tbuf, SZ_LINE) )
- fun->maxbufsize = atoi(tbuf);
- if( fun->maxbufsize <= 0 )
- fun->maxbufsize = FUN_MAXBUFSIZE;
- return(fun->maxbufsize);
-}
-
-/*
- *
- * _FunOpenCommon -- common code for different Fun open routines
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunOpenCommon(Fun fun)
-#else
-int _FunOpenCommon(fun)
- Fun fun;
-#endif
-{
- int tval;
-
- if( fun && fun->header ){
- /* current file position is datapos */
- fun->datastart = gtell(fun->gio);
- /* calculate binning values */
- if( fun->header->table && (fun->bin[0]>=0) )
- tval = tldim(fun->min1, fun->max1, fun->binsiz1,
- fun->header->table->col[fun->bin[0]].type);
- else
- tval = tldim(fun->min1, fun->max1, fun->binsiz1, 0);
- if( (fun->x0 < 1) || (fun->x0 > tval) ) fun->x0 = 1;
- if( (fun->x1 < 1) || (fun->x1 > tval) ) fun->x1 = tval;
- if( fun->header->table && (fun->bin[1]>=0) )
- tval = tldim(fun->min2,fun->max2, fun->binsiz2,
- fun->header->table->col[fun->bin[1]].type);
- else
- tval = tldim(fun->min2, fun->max2, fun->binsiz2, 0);
- if( (fun->y0 < 1) || (fun->y0 > tval) ) fun->y0 = 1;
- if( (fun->y1 < 1) || (fun->y1 > tval) ) fun->y1 = tval;
- /* make sure the block factor divides the dimension evenly */
- if( (fun->x1 - fun->x0 + 1)%fun->block ){
- gwarning(stderr,
- "block factor does not divide dim1 evenly; decreasing dim1\n");
- while( (fun->x1 - fun->x0 + 1)%fun->block ) fun->x1--;
- }
- if( fun->dims > 1 ){
- if( (fun->y1 - fun->y0 + 1)%fun->block ){
- gwarning(stderr,
- "block factor does not divide dim2 evenly; decreasing dim2\n");
- while( (fun->y1 - fun->y0 + 1)%fun->block ) fun->y1--;
- }
- }
- /* initialize output binning parameters */
- /* fun->dims is set based on input data and bincol (cf. _FunFITSOpen) */
- if( fun->dims == 1 ){
- fun->odims = 1;
- fun->odim1 = (fun->x1 - fun->x0 + 1) / fun->block;
- fun->odim2 = 1;
- }
- else{
- fun->odims = 2;
- fun->odim1 = (fun->x1 - fun->x0 + 1) / fun->block;
- fun->odim2 = (fun->y1 - fun->y0 + 1) / fun->block;
- }
- fun->obitpix = fun->bitpix;
- fun->odtype = fun->dtype;
- /* initialize WCS -- this is the proper WCS, converted to image coords */
- fun->wcs = _FunWCS(fun, 1);
- /* initialize WCS -- not converted to image coords */
- fun->wcs0 = _FunWCS(fun, 0);
- return 1;
- }
- else{
- return 0;
- }
-}
-
diff --git a/funtools/funparam.c b/funtools/funparam.c
deleted file mode 100644
index 88e5f4b..0000000
--- a/funtools/funparam.c
+++ /dev/null
@@ -1,804 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-static int doprim=0;
-static int doraw=0;
-
-#define BLANK_NAME " "
-
-#define MULTI_ENTRY(name,n) (!n && (!strcmp(name, BLANK_NAME) || \
- !strcmp(name, "HISTORY") || \
- !strcmp(name, "CONTINUE") || \
- !strcmp(name, "COMMENT")) )
-
-#ifdef ANSI_FUNC
-static int
-_FunParamGetType(FITSCard card)
-#else
-static int _FunParamGetType(card)
- FITSCard card;
-#endif
-{
- FITSType type;
- char tbuf[SZ_LINE];
-
- if( ft_cardpar(card, &type, tbuf, NULL, NULL) != NULL ){
- switch(type){
- case FT_UNKNOWN:
- return(FUN_PAR_UNKNOWN);
- case FT_COMMENT:
- return(FUN_PAR_COMMENT);
- case FT_LOGICAL:
- return(FUN_PAR_LOGICAL);
- case FT_INTEGER:
- return(FUN_PAR_INTEGER);
- case FT_STRING:
- return(FUN_PAR_STRING);
- case FT_VALUE:
- return(FUN_PAR_VALUE);
- case FT_REAL:
- return(FUN_PAR_REAL);
- case FT_COMPLEX:
- return(FUN_PAR_COMPLEX);
- default:
- return(FUN_PAR_UNKNOWN);
- }
- }
- return(0);
-}
-
-/*
- *
- * _FunParamUpdateFile -- make a stab at updating a param value
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunParamUpdateFile(Fun fun, FITSCard ocard, FITSCard card)
-#else
-static int _FunParamUpdateFile(fun, ocard, card)
- Fun fun;
- FITSCard card;
- FITSCard ocard;
-#endif
-{
- off_t pos, opos;
-
- /* sanity check */
- if( !ocard ) return 0;
-
- /* try to update file if necessary */
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- pos = fun->headpos + (char *)ocard - (char *)fun->header->cards;
- if( ((opos=gtell(fun->gio)) >=0) && (gseek(fun->gio, pos, 0) >=0) ){
- gwrite(fun->gio, (char *)card, sizeof(char), FT_CARDLEN);
- gseek(fun->gio, opos, 0);
- return 1;
- }
- else
- return 0;
- }
- else
- return 1;
-}
-
-/*
- *
- * FUN_PRIMARY -- set the doprim flag
- * this is meant to look like one of the funtools defines
- *
- */
-#ifdef ANSI_FUNC
-Fun
-FUN_PRIMARY(Fun fun)
-#else
-Fun FUN_PRIMARY(fun)
- Fun fun;
-#endif
-{
- doprim = 1;
- return fun;
-}
-
-/*
- *
- * FUN_RAW -- set the doraw flag
- * this is meant to look like one of the funtools defines
- *
- */
-#ifdef ANSI_FUNC
-char *
-FUN_RAW(char *name)
-#else
-char *FUN_RAW(name)
- char *name;
-#endif
-{
- doraw = 1;
- return name;
-}
-
-/*
- *
- * FunParamGetb -- get a parameter as a logical
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamGetb(Fun fun, char *name, int n, int defval, int *got)
-#else
-int FunParamGetb(fun, name, n, defval, got)
- Fun fun;
- char *name;
- int n;
- int defval;
- int *got;
-#endif
-{
- FITSCard card;
- FITSHead hd;
- int val;
-
- *got = 0;
- val = defval;
- if( doprim || fun->doprim ){
- if( fun->header->primary )
- hd = fun->header->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
- val = ft_headgetl(hd, name, n, defval, &card);
- if( card ){
- *got = _FunParamGetType(card);
- }
-
-done:
- doprim = 0;
- doraw = 0;
- return val;
-}
-
-/*
- *
- * FunParamGeti -- get a parameter as an integer
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamGeti(Fun fun, char *name, int n, int defval, int *got)
-#else
-int FunParamGeti(fun, name, n, defval, got)
- Fun fun;
- char *name;
- int n;
- int defval;
- int *got;
-#endif
-{
- FITSCard card;
- FITSHead hd;
- int val;
-
- *got = 0;
- val = defval;
- if( doprim || fun->doprim ){
- if( fun->header->primary )
- hd = fun->header->primary;
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- val = ft_headgeti(hd, name, n, defval, &card);
- if( card ){
- *got = _FunParamGetType(card);
- }
-
-done:
- doprim = 0;
- doraw = 0;
- return val;
-}
-
-/*
- *
- * FunParamGetl -- get a parameter as a longlong
- *
- */
-#ifdef ANSI_FUNC
-longlong
-FunParamGetl(Fun fun, char *name, int n, longlong defval, int *got)
-#else
-longlong FunParamGetl(fun, name, n, defval, got)
- Fun fun;
- char *name;
- int n;
- longlong defval;
- int *got;
-#endif
-{
- FITSCard card;
- FITSHead hd;
- int val;
-
- *got = 0;
- val = defval;
- if( doprim || fun->doprim ){
- if( fun->header->primary )
- hd = fun->header->primary;
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- val = ft_headgetil(hd, name, n, defval, &card);
- if( card ){
- *got = _FunParamGetType(card);
- }
-
-done:
- doprim = 0;
- doraw = 0;
- return val;
-}
-
-/*
- *
- * FunParamGetd -- get a parameter as a double float
- *
- */
-#ifdef ANSI_FUNC
-double
-FunParamGetd(Fun fun, char *name, int n, double defval, int *got)
-#else
-double FunParamGetd(fun, name, n, defval, got)
- Fun fun;
- char *name;
- int n;
- double defval;
- int *got;
-#endif
-{
- FITSCard card;
- FITSHead hd;
- double val;
-
- *got = 0;
- val = defval;
- if( doprim || fun->doprim ){
- if( fun->header->primary )
- hd = fun->header->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- val = ft_headgetr(hd, name, n, defval, &card);
- if( card ){
- *got = _FunParamGetType(card);
- }
-
-done:
- doprim = 0;
- doraw = 0;
- return val;
-}
-
-/*
- *
- * FunParamGets -- get a parameter as a string
- *
- */
-#ifdef ANSI_FUNC
-char *
-FunParamGets(Fun fun, char *name, int n, char *defval, int *got)
-#else
-char *FunParamGets(fun, name, n, defval, got)
- Fun fun;
- char *name;
- int n;
- char * defval;
- int *got;
-#endif
-{
- FITSCard card;
- FITSHead hd;
- char tbuf[FT_CARDLEN+1];
- char *val;
-
- *got = 0;
- if( doprim || fun->doprim ){
- if( fun->header->primary )
- hd = fun->header->primary;
- else
- goto dodef;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto dodef;
- }
-
- if( name && *name ){
- val = ft_headgets(hd, name, n, defval, &card);
- if( doraw || fun->doraw ){
- if( val ) xfree(val);
- if( card && *card->c ){
- strncpy(tbuf, card->c, FT_CARDLEN);
- tbuf[FT_CARDLEN] = '\0';
- val = xstrdup(tbuf);
- }
- else{
- goto dodef;
- }
- }
- }
- else{
- if( n > 0 ){
- card = ft_cardnth(hd, n);
- if( card && *card->c ){
- strncpy(tbuf, card->c, FT_CARDLEN);
- tbuf[FT_CARDLEN] = '\0';
- val = xstrdup(tbuf);
- }
- else
- goto dodef;
- }
- else{
- goto dodef;
- }
- }
- if( card ){
- *got = _FunParamGetType(card);
- }
- doprim = 0;
- doraw = 0;
- return val;
-
-dodef:
- *got = 0;
- doprim = 0;
- doraw = 0;
- if( defval && *defval )
- val = xstrdup(defval);
- else
- val = NULL;
- return val;
-}
-
-/*
- *
- * FunParamPutb -- set a logical parameter value
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamPutb(Fun fun, char *name, int n, int value, char *comm,
- int append)
-#else
-int FunParamPutb(fun, name, n, value, comm, append)
- Fun fun;
- char *name;
- int n;
- int value;
- char *comm;
- int append;
-#endif
-{
- FITSCard card=NULL, ocard=NULL, tcard=NULL;
- FITSHead hd;
- int got;
- int ip;
- char tbuf[SZ_LINE], tbuf2[SZ_LINE];
-
- got = -1;
- if( !name ) name = BLANK_NAME;
- if( doprim || fun->doprim ){
- if( fun->primary )
- hd = fun->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- /* see if we have to update file (if we already have written this param) */
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- /* look for the exact card */
- ocard=ft_headfind(hd, name, n, 0);
- /* look for a blank placeholder card whose value is the card name */
- if( !ocard && (append == 2) ){
- if( n != 0 )
- snprintf(tbuf2, SZ_LINE-1, "%s%d", name, n);
- else
- strncpy(tbuf2, name, SZ_LINE-1);
- for(tcard=hd->cards; tcard!=&(hd->cards[hd->ncard]); tcard++){
- if( !strncmp((*tcard).c, BLANK_NAME, 8) ){
- ip = 0;
- if( word((*tcard).c, tbuf, &ip) && !strcasecmp(tbuf, tbuf2) ){
- ocard = tcard;
- break;
- }
- }
- }
- }
- }
-
- /* set parameter value */
- if( MULTI_ENTRY(name, n) )
- card = ft_headappl(hd, name, n, value, comm);
- else
- card = ft_headsetl(hd, name, n, value, comm, append);
- /* so far, so good */
- if( card ) got = 1;
-
- /* update file if necessary */
- if( ocard && card ) got = _FunParamUpdateFile(fun, ocard, card);
-
-done:
- doprim = 0;
- doraw = 0;
- return got;
-}
-
-/*
- *
- * FunParamPuti -- set an integer parameter value
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamPuti(Fun fun, char *name, int n, int value, char *comm, int append)
-#else
-int FunParamPuti(fun, name, n, value, comm, append)
- Fun fun;
- char *name;
- int n;
- int value;
- char *comm;
- int append;
-#endif
-{
- FITSCard card=NULL, ocard=NULL, tcard=NULL;
- FITSHead hd;
- int got;
- int ip;
- char tbuf[SZ_LINE], tbuf2[SZ_LINE];
-
- got = -1;
- if( !name ) name = BLANK_NAME;
- if( doprim || fun->doprim ){
- if( fun->primary )
- hd = fun->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- /* see if we have to update file (if we already have written this param) */
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- /* look for the exact card */
- ocard=ft_headfind(hd, name, n, 0);
- /* look for a blank placeholder card whose value is the card name */
- if( !ocard && (append == 2) ){
- if( n != 0 )
- snprintf(tbuf2, SZ_LINE-1, "%s%d", name, n);
- else
- strncpy(tbuf2, name, SZ_LINE-1);
- for(tcard=hd->cards; tcard!=&(hd->cards[hd->ncard]); tcard++){
- if( !strncmp((*tcard).c, BLANK_NAME, 8) ){
- ip = 0;
- if( word((*tcard).c, tbuf, &ip) && !strcasecmp(tbuf, tbuf2) ){
- ocard = tcard;
- break;
- }
- }
- }
- }
- }
-
- /* set parameter value */
- if( MULTI_ENTRY(name, n) )
- card = ft_headappi(hd, name, n, value, comm);
- else
- card = ft_headseti(hd, name, n, value, comm, append);
- /* so far, so good */
- if( card ) got = 1;
-
- /* update file if necessary */
- if( ocard && card ) got = _FunParamUpdateFile(fun, ocard, card);
-
-done:
- doprim = 0;
- doraw = 0;
- return got;
-}
-
-/*
- *
- * FunParamPutl -- set a integer64 parameter value
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamPutl(Fun fun, char *name, int n, longlong value, char *comm, int append)
-#else
-int FunParamPutl(fun, name, n, value, comm, append)
- Fun fun;
- char *name;
- int n;
- longlong value;
- char *comm;
- int append;
-#endif
-{
- FITSCard card=NULL, ocard=NULL, tcard=NULL;
- FITSHead hd;
- int got;
- int ip;
- char tbuf[SZ_LINE], tbuf2[SZ_LINE];
-
- got = -1;
- if( !name ) name = BLANK_NAME;
- if( doprim || fun->doprim ){
- if( fun->primary )
- hd = fun->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- /* see if we have to update file (if we already have written this param) */
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- /* look for the exact card */
- ocard=ft_headfind(hd, name, n, 0);
- /* look for a blank placeholder card whose value is the card name */
- if( !ocard && (append == 2) ){
- if( n != 0 )
- snprintf(tbuf2, SZ_LINE-1, "%s%d", name, n);
- else
- strncpy(tbuf2, name, SZ_LINE-1);
- for(tcard=hd->cards; tcard!=&(hd->cards[hd->ncard]); tcard++){
- if( !strncmp((*tcard).c, BLANK_NAME, 8) ){
- ip = 0;
- if( word((*tcard).c, tbuf, &ip) && !strcasecmp(tbuf, tbuf2) ){
- ocard = tcard;
- break;
- }
- }
- }
- }
- }
-
- /* set parameter value */
- if( MULTI_ENTRY(name, n) )
- card = ft_headappil(hd, name, n, value, comm);
- else
- card = ft_headsetil(hd, name, n, value, comm, append);
- /* so far, so good */
- if( card ) got = 1;
-
- /* update file if necessary */
- if( ocard && card ) got = _FunParamUpdateFile(fun, ocard, card);
-
-done:
- doprim = 0;
- doraw = 0;
- return got;
-}
-
-/*
- *
- * FunParamPutd -- set a double parameter value
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamPutd(Fun fun, char *name, int n, double value, int prec,
- char *comm, int append)
-#else
-int FunParamPutd(fun, name, n, value, prec, comm, append)
- Fun fun;
- char *name;
- int n;
- double value;
- int prec;
- char *comm;
- int append;
-#endif
-{
- FITSCard card=NULL, ocard=NULL, tcard=NULL;
- FITSHead hd;
- int got;
- int ip;
- char tbuf[SZ_LINE], tbuf2[SZ_LINE];
-
- got = -1;
- if( !name ) name = BLANK_NAME;
- if( doprim || fun->doprim ){
- if( fun->primary )
- hd = fun->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- /* see if we have to update file (if we already have written this param) */
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- /* look for the exact card */
- ocard=ft_headfind(hd, name, n, 0);
- /* look for a blank placeholder card whose value is the card name */
- if( !ocard && (append == 2) ){
- if( n != 0 )
- snprintf(tbuf2, SZ_LINE-1, "%s%d", name, n);
- else
- strncpy(tbuf2, name, SZ_LINE-1);
- for(tcard=hd->cards; tcard!=&(hd->cards[hd->ncard]); tcard++){
- if( !strncmp((*tcard).c, BLANK_NAME, 8) ){
- ip = 0;
- if( word((*tcard).c, tbuf, &ip) && !strcasecmp(tbuf, tbuf2) ){
- ocard = tcard;
- break;
- }
- }
- }
- }
- }
-
- /* set parameter value */
- if( MULTI_ENTRY(name, n) )
- card = ft_headappr(hd, name, n, value, prec, comm);
- else
- card = ft_headsetr(hd, name, n, value, prec, comm, append);
- /* so far, so good */
- if( card ) got = 1;
-
- /* update file if necessary */
- if( ocard && card ) got = _FunParamUpdateFile(fun, ocard, card);
-
-done:
- doprim = 0;
- doraw = 0;
- return got;
-}
-
-/*
- *
- * FunParamPuts -- set a string parameter value
- *
- */
-#ifdef ANSI_FUNC
-int
-FunParamPuts(Fun fun, char *name, int n, char *value, char *comm,
- int append)
-#else
-int FunParamPuts(fun, name, n, value, comm, append)
- Fun fun;
- char *name;
- int n;
- char *value;
- char *comm;
- int append;
-#endif
-{
- FITSCard card=NULL, ocard=NULL, tcard=NULL;
- FITSHead hd;
- int got;
- int ip;
- char tbuf[SZ_LINE], tbuf2[SZ_LINE];
-
- got = -1;
- if( !name ) name = BLANK_NAME;
- if( doprim || fun->doprim ){
- if( fun->primary )
- hd = fun->primary;
- else
- goto done;
- }
- else{
- if( fun->header )
- hd = fun->header;
- else if( fun->theader )
- hd = fun->theader;
- else
- goto done;
- }
-
- /* see if we have to update file (if we already have written this param) */
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- /* look for the exact card */
- ocard=ft_headfind(hd, name, n, 0);
- /* look for a blank placeholder card whose value is the card name */
- if( !ocard && (append == 2) ){
- if( n != 0 )
- snprintf(tbuf2, SZ_LINE-1, "%s%d", name, n);
- else
- strncpy(tbuf2, name, SZ_LINE-1);
- for(tcard=hd->cards; tcard!=&(hd->cards[hd->ncard]); tcard++){
- if( !strncmp((*tcard).c, BLANK_NAME, 8) ){
- ip = 0;
- if( word((*tcard).c, tbuf, &ip) && !strcasecmp(tbuf, tbuf2) ){
- ocard = tcard;
- break;
- }
- }
- }
- }
- }
-
- /* set parameter value */
- if( MULTI_ENTRY(name, n) )
- card = ft_headapps(hd, name, n, value, comm);
- else
- card = ft_headsets(hd, name, n, value, comm, append);
- /* so far, so good */
- if( card ) got = 1;
-
- /* update file if necessary */
- if( ocard && card ) got = _FunParamUpdateFile(fun, ocard, card);
-
-done:
- doprim = 0;
- doraw = 0;
- return got;
-}
diff --git a/funtools/funsky.c b/funtools/funsky.c
deleted file mode 100644
index 9c2b483..0000000
--- a/funtools/funsky.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-#include <math.h>
-#include <funtoolsP.h>
-#include <strtod.h>
-
-extern char *optarg;
-extern int optind;
-
-#define RA_DEFAULT "RA"
-#define DEC_DEFAULT "DEC"
-#define RA_DEFAULT_UNITS "d"
-#define DEC_DEFAULT_UNITS "d"
-
-#define X_DEFAULT "X"
-#define Y_DEFAULT "Y"
-#define X_DEFAULT_UNITS "h"
-#define Y_DEFAULT_UNITS "d"
-
-#define COL1_DEFAULT "COL1"
-#define COL2_DEFAULT "COL2"
-
-#define X__PI 3.14159265358979323846
-#define X_2PI ( 2 * X__PI )
-#define X_R2D (X_2PI / 360.0)
-#define X_R2H (X_2PI / 24.0)
-#define X_H2D (360.0 / 24.0)
-
-#define r2h(r) ( (r) / X_R2H )
-#define h2r(d) ( (d) * X_R2H )
-#define r2d(r) ( (r) / X_R2D )
-#define d2r(d) ( (d) * X_R2D )
-#define h2d(r) ( (r) * X_H2D )
-#define d2h(d) ( (d) / X_H2D )
-
-typedef struct evstruct{
- double val1, val2;
-} *Ev, EvRec;
-
-typedef struct List {
- Fun fun;
- char type[2];
- char *colname[2];
-} List;
-
-#ifdef ANSI_FUNC
-static int
-ColInfo(List *list, char *colstr[], int flag)
-#else
-static int
-ColInfo(list, colstr, flag)
- List *list;
- char *colstr[];
- int flag;
-#endif
-{
- int i;
- int ip;
- char tbuf[SZ_LINE];
-
- newdtable(":");
- for(i=0; i<2; i++){
- ip = 0;
- /* column name */
- if( !*colstr[i] || (*colstr[i] == ':') || !word(colstr[i], tbuf, &ip) ){
- switch(i){
- case 0:
- if(FunColumnLookup(list->fun, COL1_DEFAULT, 0,
- NULL, NULL, NULL, NULL, NULL, NULL))
- strcpy(tbuf, COL1_DEFAULT);
- else{
- if( flag ){
- strcpy(tbuf, RA_DEFAULT);
- }
- else{
- strcpy(tbuf, X_DEFAULT);
- }
- }
- break;
- case 1:
- if(FunColumnLookup(list->fun, COL2_DEFAULT, 0,
- NULL, NULL, NULL, NULL, NULL, NULL))
- strcpy(tbuf, COL2_DEFAULT);
- else{
- if( flag ){
- strcpy(tbuf, DEC_DEFAULT);
- }
- else{
- strcpy(tbuf, Y_DEFAULT);
- }
- }
- break;
- }
- }
- list->colname[i] = xstrdup(tbuf);
-
- /* column units */
- if( !word(colstr[i], tbuf, &ip) ){
- switch(i){
- case 0:
- strcpy(tbuf, RA_DEFAULT_UNITS);
- break;
- case 1:
- strcpy(tbuf, DEC_DEFAULT_UNITS);
- break;
- }
- }
- list->type[i] = *tbuf;
- }
- freedtable();
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static void
-CloseList(List *list)
-#else
-static void
-CloseList(list)
- List *list;
-#endif
-{
- int i;
- /* sanity check */
- if( !list ) return;
- if( list->fun ) FunClose(list->fun);
- /* free up memory */
- for(i=0; i<2; i++){
- if( list->colname[i] ) xfree(list->colname[i]);
- }
- xfree(list);
-}
-
-#ifdef ANSI_FUNC
-static List *
-OpenList(char *lname, char *pos1str, char *pos2str, int flag)
-#else
-static List *
-OpenList(lname, pos1str, pos2str, flag)
- char *lname;
- char *pos1str;
- char *pos2str;
- int flag;
-#endif
-{
- char *colstr[2];
- List *list;
-
- /* allocate list struct */
- if( !(list = (List *)xcalloc(sizeof(List), 1)) ){
- gerror(stderr, "can't allocate list record\n");
- return NULL;
- }
- /* open list file, if necessary */
- if( !(list->fun = FunOpen(lname, "r", NULL)) ){
- CloseList(list);
- gerror(stderr, "can't FunOpen list file: %s\n", lname);
- return NULL;
- }
- /* get info on the specified columns */
- colstr[0] = pos1str;
- colstr[1] = pos2str;
- if( !ColInfo(list, colstr, flag) ){
- CloseList(list);
- gerror(stderr, "can't get column info for list: %s %s\n",
- colstr[0], colstr[1]);
- return NULL;
- }
- /* set up to read the specified columns */
- FunColumnSelect(list->fun, sizeof(EvRec), NULL,
- list->colname[0], "D", "r", FUN_OFFSET(Ev, val1),
- list->colname[1], "D", "r", FUN_OFFSET(Ev, val2),
- NULL);
- return list;
-}
-
-#ifdef ANSI_FUNC
-static int
-NextFromList(List *list, double *dval1, double *dval2, int flag)
-#else
-static int
-NextFromList(list, dval1, dval2, flag)
- List *list;
- double *dval1;
- double *dval2;
- int flag;
-#endif
-{
- int got;
- EvRec evrec;
-
- /* sanity check */
- if( !list ) return 0;
-
- /* read next line from table */
- if( !FunTableRowGet(list->fun, &evrec, 1, NULL, &got) || !got)
- return 0;
-
- /* non-zero flag means we have sky coords and need degrees */
- if( flag ){
- /* perform unit conversion -- wcslib requires degrees */
- switch( list->type[0] ) {
- case 'h':
- *dval1 = h2d(evrec.val1);
- break;
- case 'r':
- *dval1 = r2d(evrec.val1);
- break;
- case 'd':
- *dval1 = evrec.val1;
- break;
- }
- switch( list->type[1] ) {
- case 'h':
- *dval2 = h2d(evrec.val2);
- break;
- case 'r':
- *dval2 = r2d(evrec.val2);
- break;
- case 'd':
- *dval2 = evrec.val2;
- break;
- }
- }
- /* image coords -- leave alone */
- else{
- *dval1 = evrec.val1;
- *dval2 = evrec.val2;
- }
- /* got a row */
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static void
-usage(char *fname)
-#else
-static void
-usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr, "usage:\n");
- fprintf(stderr, "%s iname[ext]\t\t\t# RA,Dec (deg) or image pix from stdin\n", fname);
- fprintf(stderr, "%s iname[ext] [lname]\t\t# RA,Dec (deg) or image pix from list\n", fname);
- fprintf(stderr, "%s iname[ext] [col1] [col2]\t# named cols:units from stdin\n", fname);
- fprintf(stderr, "%s iname[ext] [lname] [col1] [col2] # named cols:units from list\n", fname);
- fprintf(stderr, "\n");
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, "-d\t# always use integer tlmin conversion (as ds9 does)\n");
- fprintf(stderr, "-r\t# convert x,y to RA,Dec (default: convert RA,Dec to x,y)\n");
- fprintf(stderr, "-v\t# display input values also (default: display output only)\n");
- fprintf(stderr, "-o\t# include offset from the nominal target position (in arcsec)\n");
- fprintf(stderr, "-T\t# output display in rdb format (w/header,tab delimiters)\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "The coord. system is taken from the header (might differ from ds9).\n");
- fprintf(stderr, "By default, input RA and Dec are converted into x and y (use the\n");
- fprintf(stderr, "-r to convert from x,y to RA,Dec.) Output x,y values are physical\n");
- fprintf(stderr, "coords for event data, image coords for image data.\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i;
- int type;
- int offscl;
- int args;
- int got;
- int ioff=0;
- int verbose=0;
- int offaxis=0;
- int dods9=0;
- int dotab=0;
- int sky2im=1;
- int tltyp[2];
- double dval1=0.0, dval2=0.0, dval3=0.0, dval4=0.0;
- double ra_target=0.0, dec_target=0.0, x_target=0.0, y_target=0.0;
- double off_axis=0.0;
- double tlmin[2];
- double binsiz[2];
- double zero=0.0;
- char sp=' ';
- char iname[SZ_LINE];
- char lname[SZ_LINE];
- char pos1str[SZ_LINE];
- char pos2str[SZ_LINE];
- char *s0, *s1;
- Fun fun=NULL;
- List *list=NULL;
- void *wcs=NULL;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "drtoTv")) != -1){
- switch(c){
- case 'd':
- dods9=1;
- break;
- case 'r':
- sky2im=0;
- break;
- case 'o':
- offaxis=1;
- break;
- case 'v':
- verbose=1;
- break;
- case 't':
- dotab = 1;
- break;
- case 'T':
- sp = '\t';
- dotab = 1;
- break;
- default:
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- switch(args){
- case 1:
- /* first argument is input file name containing WCS */
- strncpy(iname, argv[optind+ioff++], SZ_LINE-1);
- /* read positions from stdin */
- strncpy(lname, "stdin", SZ_LINE-1);
- /* using default columns and units */
- *pos1str = '\0';
- *pos2str = '\0';
- break;
- case 2:
- /* first argument is input file name containing WCS */
- strncpy(iname, argv[optind+ioff++], SZ_LINE-1);
- /* read positions from list file */
- strncpy(lname, argv[optind+ioff++], SZ_LINE-1);
- /* using default columns and units */
- *pos1str = '\0';
- *pos2str = '\0';
- break;
- case 3:
- /* first argument is input file name containing WCS */
- strncpy(iname, argv[optind+ioff++], SZ_LINE-1);
- /* read positions from stdin */
- strncpy(lname, "stdin", SZ_LINE-1);
- /* using specified columns and units */
- strncpy(pos1str, argv[optind+ioff++], SZ_LINE-1);
- strncpy(pos2str, argv[optind+ioff++], SZ_LINE-1);
- break;
- case 4:
- /* first argument is input file name containing WCS */
- strncpy(iname, argv[optind+ioff++], SZ_LINE-1);
- /* read positions from list file */
- strncpy(lname, argv[optind+ioff++], SZ_LINE-1);
- /* using specified columns and units */
- strncpy(pos1str, argv[optind+ioff++], SZ_LINE-1);
- strncpy(pos2str, argv[optind+ioff++], SZ_LINE-1);
- break;
- default:
- usage(argv[0]);
- break;
- }
-
- /* open input file */
- if( !(fun = FunOpen(iname, "r", NULL)) ){
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n", iname);
- }
-
- /* if offaxis is set, read the aimpoint information from the header */
- /* This will only work for Chandra Style files */
- if( (offaxis) && (sky2im) ) {
- ra_target = FunParamGetd(fun, "RA_TARG ", 1, -1.0, &got);
- dec_target = FunParamGetd(fun, "DEC_TARG", 1, -2.0, &got);
- if( (ra_target == -1.0) || (dec_target == -2.0) ) {
- gerror(stderr, "no aim point information in header: %s\n", iname);
- }
- }
-
-
- /* make sure we have wcs info */
- FunInfoGet(fun, FUN_WCS, &wcs, FUN_TYPE, &type, 0);
- if( !iswcs(wcs) ){
- gerror(stderr, "could not load WCS information from header: %s\n", iname);
- }
-
- /* open list to read positions from somewhere (list or stdin) */
- if( !(list=OpenList(lname, pos1str, pos2str, sky2im)) ){
- gerror(stderr, "can't FunOpen list file: %s\n", lname);
- }
-
- /* for tables, we need some extra column info */
- switch(type){
- case FUN_TABLE:
- case FUN_EVENTS:
- s0 = fun->header->table->col[fun->bin[0]].name;
- s1 = fun->header->table->col[fun->bin[1]].name;
- if( s0 ){
- FunColumnLookup(fun, s0, 0, NULL, &tltyp[0], NULL, NULL, NULL, NULL);
- FunColumnLookup2(fun, s0, 0, &tlmin[0], NULL, &binsiz[0], NULL, NULL);
- }
- else{
- tlmin[0] = 0;
- binsiz[0] = 0;
- tltyp[0] = 'I';
- }
- if( s1 ){
- FunColumnLookup(fun, s1, 0, NULL, &tltyp[1], NULL, NULL, NULL, NULL);
- FunColumnLookup2(fun, s1, 0, &tlmin[1], NULL, &binsiz[1], NULL, NULL);
- }
- else{
- tlmin[1] = 0;
- binsiz[1] = 0;
- tltyp[1] = 'I';
- }
- break;
- default:
- break;
- }
-
- /* ds9-style processing requires special treatment */
- if( dods9 ){
- tltyp[0] = 'J';
- tltyp[1] = 'J';
- }
-
- /* output header if necessary */
- if( dotab ){
- if( verbose ){
- fprintf(stdout, "# IFILE = %s\n", iname);
- }
- if( (sky2im) && (!offaxis) ){
- if( verbose ){
- for(i=0; i<2; i++){
- fprintf(stdout, "# ICOL%d = %s\n", i+1, list->colname[i]);
- }
- for(i=0; i<2; i++){
- fprintf(stdout, "# IUNITS%d = %c\n", i+1, list->type[i]);
- }
- fprintf(stdout, "# OCOL1 = X\n");
- fprintf(stdout, "# OCOL2 = Y\n");
- fprintf(stdout, "\n");
- fprintf(stdout, "%12.12s%c%12.12s%c",
- list->colname[0], sp, list->colname[1], sp);
- }
- fprintf(stdout, "%12.12s%c%12.12s\n", "X",sp,"Y");
- if( verbose ) fprintf(stdout, "------------%c------------%c", sp, sp);
- fprintf(stdout, "------------%c------------\n", sp);
- } else if( (sky2im) && (offaxis) ){
- if( verbose ){
- for(i=0; i<2; i++){
- fprintf(stdout, "# ICOL%d = %s\n", i+1, list->colname[i]);
- }
- for(i=0; i<2; i++){
- fprintf(stdout, "# IUNITS%d = %c\n", i+1, list->type[i]);
- }
- fprintf(stdout, "# OCOL1 = X\n");
- fprintf(stdout, "# OCOL2 = Y\n");
- fprintf(stdout, "# OFF_AXIS = OFF_AXIS\n");
- fprintf(stdout, "\n");
- fprintf(stdout, "%12.12s%c%12.12s%c",
- list->colname[0], sp, list->colname[1], sp);
- }
- fprintf(stdout, "%12.12s%c%12.12s%c%12.12s\n", "X",sp,"Y",sp,"OFF_AXIS");
- if( verbose ) fprintf(stdout, "------------%c------------%c", sp, sp);
- fprintf(stdout, "------------%c------------%c------------\n", sp, sp);
- }
- else{
- if( verbose ){
- for(i=0; i<2; i++){
- fprintf(stdout, "# ICOL%d = %s\n", i+1, list->colname[i]);
- }
- fprintf(stdout, "# OCOL1 = RA\n");
- fprintf(stdout, "# OCOL2 = DEC\n");
- for(i=0; i<2; i++){
- fprintf(stdout, "# OUNITS%d = %c\n", i+1, list->type[i]);
- }
- fprintf(stdout, "\n");
- if( verbose ) fprintf(stdout, "%12.12s%c%12.12s%c",
- list->colname[0], sp, list->colname[1], sp);
- }
- fprintf(stdout, " RA%c DEC\n", sp);
- if( verbose ) fprintf(stdout, "------------%c------------%c", sp, sp);
- fprintf(stdout, "------------%c------------\n", sp);
- }
- fflush(stdout);
- }
-
- /* if offaxis requested (and sky2img) */
- if( (sky2im) && (offaxis) ){
- /* convert the aim point to image pixels */
- wcs2pix(wcs, ra_target, dec_target, &dval3, &dval4, &offscl);
- if( verbose) {
- fprintf(stdout, "%12.6f%c%12.6f%c", ra_target, sp, dec_target, sp);
- }
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- x_target = dval3;
- y_target = dval4;
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- x_target = tli2p(dval3, tlmin[0], binsiz[0], tltyp[0]);
- y_target = tli2p(dval4, tlmin[1], binsiz[1], tltyp[1]);
- break;
- default:
- gerror(stderr, "unknown FITS data type\n");
- break;
- }
- if( verbose) {
- fprintf(stdout, "%12.2f%c%12.2f%c%10.3f\n",
- x_target, sp, y_target, sp, zero);
- }
- fflush(stdout);
- }
-
- /* get position values, convert, and output */
- while( NextFromList(list, &dval1, &dval2, sky2im) ){
- /* perform the required conversion */
- if( sky2im ){
- /* convert sky coordinates to image pixels */
- wcs2pix(wcs, dval1, dval2, &dval3, &dval4, &offscl);
- if( verbose ) fprintf(stdout, "%12.6f%c%12.6f%c", dval1, sp, dval2, sp);
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- fprintf(stdout, "%12.2f%c%12.2f%c", dval3, sp, dval4, sp);
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- dval3 = tli2p(dval3, tlmin[0], binsiz[0], tltyp[0]);
- dval4 = tli2p(dval4, tlmin[1], binsiz[1], tltyp[1]);
- fprintf(stdout, "%12.2f%c%12.2f%c", dval3, sp, dval4, sp);
- break;
- default:
- gerror(stderr, "unknown FITS data type\n");
- break;
- }
- if( offaxis ) {
- off_axis = 0.5*sqrt( (x_target - dval3)*(x_target - dval3) +
- (y_target - dval4)*(y_target - dval4) );
- fprintf(stdout, "%10.3f\n", off_axis);
- } else {
- fprintf(stdout, "\n");
- }
-
- fflush(stdout);
- } else {
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- dval1 = tlp2i(dval1, tlmin[0], binsiz[0], tltyp[0]);
- dval2 = tlp2i(dval2, tlmin[1], binsiz[1], tltyp[1]);
- break;
- default:
- gerror(stderr, "unknown FITS data type\n");
- break;
- }
- /* convert image pixels to sky coordinates */
- pix2wcs(wcs, (double)dval1, (double)dval2, &dval3, &dval4);
- if( list ){
- /* units */
- switch( list->type[0] ) {
- case 'h':
- dval3 = d2h(dval3);
- break;
- case 'r':
- dval3 = d2r(dval3);
- break;
- case 'd':
- break;
- }
- /* units */
- switch( list->type[1] ) {
- case 'h':
- dval4 = d2h(dval4);
- break;
- case 'r':
- dval4 = d2r(dval4);
- break;
- case 'd':
- break;
- }
- }
- if( verbose ) fprintf(stdout, "%12.2f%c%12.2f%c", dval1, sp, dval2, sp);
- fprintf(stdout, "%12.6f%c%12.6f\n", dval3, sp, dval4);
- fflush(stdout);
- }
- }
-
- /* close up shop */
- FunClose(fun);
- CloseList(list);
- return(0);
-}
diff --git a/funtools/funtab.c b/funtools/funtab.c
deleted file mode 100644
index 5f0a3f3..0000000
--- a/funtools/funtab.c
+++ /dev/null
@@ -1,1412 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <ctype.h>
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-#ifdef ANSI_FUNC
-static void *
-swap(void *obuf, void *ibuf, int width, int type)
-#else
-static void *swap(obuf, ibuf, width, type)
- void *obuf;
- void *ibuf;
- int width;
- int type;
-#endif
-{
- switch ( type ) {
- case 'A':
- case 'B':
- case 'X':
- case 'L':
- memcpy(obuf, ibuf, width);
- break;
- case 'I':
- case 'U':
- swap2(obuf, ibuf, width);
- break;
- case 'J':
- case 'V':
- case 'E':
- swap4(obuf, ibuf, width);
- break;
- case 'K':
- case 'D':
- swap8(obuf, ibuf, width);
- break;
- default:
- memcpy(obuf, ibuf, width);
- break;
- }
- return obuf;
-}
-
-#ifdef ANSI_FUNC
-static void
-_FunTableSave(Fun fun, char *rows, char *ebuf, int nrow)
-#else
-static void _FunTableSave(fun, rows, ebuf, nrow)
- Fun fun;
- char *rows;
- char *ebuf;
- int nrow;
-#endif
-{
- SaveBuf new, cur;
- int n;
-
- /* allocate new data space */
- new = (SaveBuf)xcalloc(1, sizeof(SaveBufRec));
- /* this is how many rows we are saving */
- new->nrow = nrow;
- /* see if we can store in memory or if we have to shunt to a file */
- n = nrow * (fun->rowsize + fun->rawsize);
- if( (fun->head->lmem < 0) || ((fun->head->lmem-n)>0) ){
- new->type = 1;
- /* save alloc'ed raw buf null out buf so funtools does not free it */
- new->rbuf = fun->rawbuf;
- fun->rawbuf = NULL;
- /* if user passed in a row buffer, we save a copy */
- if( rows ){
- new->ebuf = xmalloc(nrow*fun->rawsize);
- memcpy(new->ebuf, ebuf, new->nrow*fun->rowsize);
- }
- /* otherwise just save funtools-allocated row buffer */
- else{
- new->ebuf = ebuf;
- }
- /* decrease amount of memory we have left for saved data */
- if( fun->head->lmem > 0 )
- fun->head->lmem -= n;
- }
- else{
- new->type = 2;
- /* write user rows */
- fwrite(ebuf, fun->rowsize, nrow, fun->lefp);
- /* free up user row buffer unless user allocated it */
- if( !rows && ebuf ) xfree(ebuf);
- /* write raw rows */
- fwrite(fun->rawbuf, fun->rawsize, nrow, fun->lrfp);
- /* free up raw buffer */
- if( fun->rawbuf ) xfree(fun->rawbuf);
- fun->rawbuf = NULL;
- }
- /* add to end of list */
- if( fun->save == NULL ){
- fun->save = new;
- }
- else{
- for(cur=fun->save; cur->next!=NULL; cur=cur->next)
- ;
- cur->next = new;
- }
-}
-
-#ifdef ANSI_FUNC
-static char *
-_FunTableRestore(Fun fun, char *rows, int *nrow)
-#else
-static char *_FunTableRestore(fun, rows, nrow)
- Fun fun;
- char *rows;
- int *nrow;
-#endif
-{
- SaveBuf cur;
- char *ebuf=NULL;
- unsigned char *rbuf;
-
- /* start of pessimistically */
- *nrow = 0;
- /* make sure we have something to restore */
- if( !fun->save )
- return NULL;
- /* bump list to next */
- cur = fun->save;
- fun->save = cur->next;
- /* fill in the blanks */
- *nrow = cur->nrow;
- switch(cur->type){
- case 1:
- /* we might have to fill the passed row buffer */
- if( rows ){
- /* copy into user-supplied buffer */
- memcpy(rows, cur->ebuf, cur->nrow*fun->rowsize);
- /* we will return user-supplied buffer */
- ebuf = rows;
- /* free up temp buffer */
- if(cur->ebuf ) xfree(cur->ebuf);
- }
- /* otherwise, we just pass back the saved row buffer */
- else{
- ebuf = cur->ebuf;
- }
- /* move raw rows buf back into funtools struct */
- if( fun->rawbuf ) xfree(fun->rawbuf);
- fun->rawbuf = cur->rbuf;
- break;
- case 2:
- /* we might have to fill the passed row buffer */
- if( rows )
- ebuf = rows;
- else
- ebuf = xmalloc(fun->rowsize*cur->nrow);
- /* read into user-supplied buffer */
- fread(ebuf, fun->rowsize, cur->nrow, fun->lefp);
- /* allocate space for the raw buffer */
- rbuf = xmalloc(fun->rawsize*cur->nrow);
- /* read into raw buffer */
- fread(rbuf, fun->rawsize, cur->nrow, fun->lrfp);
- /* move raw rows buf back into funtools struct */
- if( fun->rawbuf ) xfree(fun->rawbuf);
- fun->rawbuf = rbuf;
- break;
- }
- /* this is the last file we "read" in the list */
- if( fun->head )
- fun->head->current = fun;
- else
- fun->current = fun;
- if( cur ) xfree(cur);
- /* return results */
- return ebuf;
-}
-
-#ifdef ANSI_FUNC
-static void
-_FunBlank(Fun fun, int type, char *buf)
-#else
-static void _FunBlank(fun, type, buf)
- Fun fun;
- int type;
- char *buf;
-#endif
-{
- unsigned char bval;
- short sval;
- int ival;
- longlong lval;
- float fval;
- double dval;
-
- switch(type){
- case 'B':
- bval = fun->blank;
- memcpy(buf, &bval, sizeof(char));
- break;
- case 'I':
- case 'U':
- sval = fun->blank;
- memcpy(buf, &sval, sizeof(short));
- break;
- case 'J':
- case 'V':
- ival = fun->blank;
- memcpy(buf, &ival, sizeof(int));
- break;
- case 'K':
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "long long support was not built into this program\n");
- exit(1);
-#endif
- lval = fun->blank;
- memcpy(buf, &lval, sizeof(longlong));
- break;
- case 'E':
- fval = getnanf();
- memcpy(buf, &fval, sizeof(float));
- break;
- case 'D':
- dval = getnand();
- memcpy(buf, &dval, sizeof(double));
- break;
- default:
- memset(buf, 0, ft_sizeof(type));
- break;
- }
-}
-
-#ifdef ANSI_FUNC
-static void *
-_FunTextRead(Fun fun, char *buf, size_t UNUSED(size), size_t get, size_t *got)
-#else
-static void *_FunTextRead(fun, buf, size, get, got)
- Fun fun;
- char *buf;
- size_t size;
- size_t get;
- size_t *got;
-#endif
-{
- int p, t;
- int len;
- int dodata1;
- int xtype;
- int ntoken;
- int nline=0;
- char lbuf[SZ_LINE];
- char *bp;
- Parse parser=NULL;
- ParsedLine line;
-
- /* sanity checks
- NB: the order of ascii columns should be identical to the fitsy columns
- (since the latter was generated by the former) */
- if( !fun->header || !fun->header->table || !fun->header->table->col )
- return 0;
-
- /* if we have not read any bytes, use data1 */
- dodata1 = (fun->bytes==0);
-
- /* convert ASCII columns to binary columns */
- bp = buf;
- while( (size_t)nline < get ){
- /* first line should be in data1 */
- if( dodata1 ){
- /* look for the parser with data1 that has the most tokens */
- for(parser=NULL, ntoken=0, p=0; p<fun->nparser; p++){
- if( !(fun->parsers[p]->state & PARSE_STATE_BAD) &&
- fun->parsers[p]->data1 ){
- if( fun->parsers[p]->ntoken > ntoken ){
- parser = fun->parsers[p];
- ntoken = parser->ntoken;
- }
- }
- }
- /* use the parser with the max number of tokens */
- if( parser ){
- line = parser->data1;
- if( PARSE_ISCOMMENT(line) ) continue;
- for(t=0; t<line->ntoken; t++){
- switch(line->tokens[t].type){
- case PARSE_FLOAT:
- case PARSE_HEXINT:
- case PARSE_INTEGER:
- /* handle string type specially */
- if( fun->header->table->col[t].type == 'A' ){
- len = strlen(line->tokens[t].sval);
- if( len >= fun->header->table->col[t].width){
- memmove(bp, line->tokens[t].sval,
- fun->header->table->col[t].width);
- }
- else{
- memmove(bp, line->tokens[t].sval, len);
- memset(bp+len, 0, fun->header->table->col[t].width-len);
- }
- }
- /* handle bit-field processing specially */
- else if( fun->header->table->col[t].type == 'X' ){
- switch(fun->header->table->col[t].width){
- case 0:
- case 1:
- xtype = 'B'; break;
- case 2:
- xtype = 'U'; break;
- case 4:
- xtype = 'V'; break;
- default:
- xtype = 'B'; break;
- }
- if( (line->tokens[t].type == PARSE_INTEGER) ||
- (line->tokens[t].type == PARSE_HEXINT) )
- ft_acht2(xtype, bp, 'K', &line->tokens[t].lval, 1, 0, 0);
- else
- ft_acht2(xtype, bp, 'D', &line->tokens[t].dval, 1, 0, 0);
- }
- else{
- if( (line->tokens[t].type == PARSE_INTEGER) ||
- (line->tokens[t].type == PARSE_HEXINT) )
- ft_acht2(fun->header->table->col[t].type, bp,
- 'K', &line->tokens[t].lval, 1, 0, 0);
- else
- ft_acht2(fun->header->table->col[t].type, bp,
- 'D', &line->tokens[t].dval, 1, 0, 0);
- }
- bp += fun->header->table->col[t].width;
- break;
- case PARSE_NULL:
- _FunBlank(fun, fun->header->table->col[t].type, bp);
- bp += fun->header->table->col[t].width;
- break;
- case PARSE_STRING:
- len = strlen(line->tokens[t].sval);
- if( len >= fun->header->table->col[t].width){
- memmove(bp, line->tokens[t].sval,
- fun->header->table->col[t].width);
- }
- else{
- memmove(bp, line->tokens[t].sval, len);
- memset(bp+len, 0, fun->header->table->col[t].width-len);
- }
- bp += fun->header->table->col[t].width;
- break;
- default:
- break;
- }
- }
- /* processed data1 line */
- nline++;
- }
- /* went through all parsers looking for data1 */
- dodata1 = 0;
- }
- /* read and process the next line */
- else{
- /* get next line or be done */
- if( !ggets(fun->gio, lbuf, SZ_LINE) )
- break;
- /* analyze line and make sure one parser succeeded (even if its EOT) */
- if( !ParseAnalyze(fun->parsers, fun->nparser, lbuf) ){
- gerror(stderr, "text parser failure analyzing line: %s\n", lbuf);
- break;
- }
- /* look for valid parser with the most tokens */
- for(parser=NULL, ntoken=0, parser=NULL, p=0; p<fun->nparser; p++){
- if( fun->parsers[p]->state & PARSE_STATE_BAD)
- continue;
- else if( fun->parsers[p]->ntoken > ntoken ){
- parser = fun->parsers[p];
- ntoken = parser->ntoken;
- }
- }
- /* stop if no valid parser or valid parser found EOT */
- if( !parser ) break;
- if( parser->state & PARSE_STATE_EOT) break;
- /* use selected parser to fill up row buffer */
- line = parser->cur;
- if( PARSE_ISCOMMENT(line) ) continue;
- for(t=0; t<line->ntoken; t++){
- switch(line->tokens[t].type){
- case PARSE_FLOAT:
- case PARSE_HEXINT:
- case PARSE_INTEGER:
- /* handle string type specially */
- if( fun->header->table->col[t].type == 'A' ){
- len = strlen(line->tokens[t].sval);
- if( len >= fun->header->table->col[t].width){
- memmove(bp, line->tokens[t].sval,
- fun->header->table->col[t].width);
- }
- else{
- memmove(bp, line->tokens[t].sval, len);
- memset(bp+len, 0, fun->header->table->col[t].width-len);
- }
- }
- /* handle bit-field processing specially */
- else if( fun->header->table->col[t].type == 'X' ){
- switch(fun->header->table->col[t].width){
- case 0:
- case 1:
- xtype = 'B'; break;
- case 2:
- xtype = 'U'; break;
- case 4:
- xtype = 'V'; break;
- default:
- xtype = 'B'; break;
- }
- if( (line->tokens[t].type == PARSE_INTEGER) ||
- (line->tokens[t].type == PARSE_HEXINT) )
- ft_acht2(xtype, bp, 'K', &line->tokens[t].lval, 1, 0, 0);
- else
- ft_acht2(xtype, bp, 'D', &line->tokens[t].dval, 1, 0, 0);
- }
- else{
- if( (line->tokens[t].type == PARSE_INTEGER) ||
- (line->tokens[t].type == PARSE_HEXINT) )
- ft_acht2(fun->header->table->col[t].type, bp,
- 'K', &line->tokens[t].lval, 1, 0, 0);
- else
- ft_acht2(fun->header->table->col[t].type, bp,
- 'D', &line->tokens[t].dval, 1, 0, 0);
- }
- bp += fun->header->table->col[t].width;
- break;
- case PARSE_STRING:
- /* handle string type specially */
- if( fun->header->table->col[t].type == 'A' ){
- len = strlen(line->tokens[t].sval);
- if( len >= fun->header->table->col[t].width){
- memmove(bp, line->tokens[t].sval,
- fun->header->table->col[t].width);
- }
- else{
- memmove(bp, line->tokens[t].sval, len);
- memset(bp+len, 0, fun->header->table->col[t].width-len);
- }
- }
- bp += fun->header->table->col[t].width;
- break;
- case PARSE_NULL:
- _FunBlank(fun, fun->header->table->col[t].type, bp);
- bp += fun->header->table->col[t].width;
- break;
- default:
- break;
- }
- }
- /* processed another line */
- nline++;
- }
- }
- *got = nline;
- return buf;
-}
-
-/*
- *
- * semi-public routines
- *
- */
-
-#ifdef ANSI_FUNC
-void *
-_FunRead(Fun fun, char *buf, size_t size, size_t get, size_t *got)
-#else
-void *_FunRead(fun, buf, size, get, got)
- Fun fun;
- char *buf;
- size_t size;
- size_t get;
- size_t *got;
-#endif
-{
- /* initialize */
- *got = 0;
-
- /* sanity check */
- if( !fun || !buf ) return NULL;
-
- /* text parsers are handled one line at a time */
- if( fun->parsers ){
- return _FunTextRead(fun, buf, size, get, got);
- }
- /* binary reads */
- else{
- /* ordinary binary read */
- if( (fun->filt == NOFILTER) || (fun->filt->doidx != 1) ){
- return _gread(fun->gio, (void *)buf, size, get, got);
- }
- /* indexed read */
- else{
- return idxread(fun->filt->idx, fun->gio, fun->header,
- (void *)buf, size, get, got, &fun->dofilt);
- }
- }
-}
-
-/*
- *
- * _FunFixNaxis2 -- change the value of an NAXIS2 card
- * used to correct a copied binary table after we filter
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunFixNaxis2(Fun fun)
-#else
-int _FunFixNaxis2(fun)
- Fun fun;
-#endif
-{
- if( (fun->ops & OP_WRHEAD) && (fun->headpos >=0) ){
- return FunParamPuti(fun,
- "NAXIS", 2, fun->io, "Number of entries in table", 0);
- }
- else{
- return(0);
- }
-}
-
-/*
- *
- * _FunTablePutHeader -- writes binary table header to file
- * used by FunTablePut and sometimes FunFlush (if no Put was done)
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunTablePutHeader(Fun fun)
-#else
-int _FunTablePutHeader(fun)
- Fun fun;
-#endif
-{
- /* write table header, if necessary */
- if( !fun->ops ){
- /* if we have no columns yet, try to get some from the assoc. input file */
- if( !fun->ncol ){
- /* if we have a header to copy from, that is */
- if( fun->ifun && fun->ifun->header && fun->ifun->header->table ){
- FunColumnSelect(fun, 0, "copy=select", NULL);
- /* grab the copied merge value */
- fun->merge = fun->ifun->merge;
- /* and the organization value */
- fun->org = fun->ifun->org;
- }
- /* else we lose */
- else
- return 0;
- }
-
- /* write the dummy primary header, if necessary */
- _FunPrimaryExtension(fun);
-
- /* generate the fitsy header for specified columns */
- _FunColumnHeader(fun, fun->cols, fun->ncol);
-
- /* save file position for later updating */
- fun->headpos = gtell(fun->gio);
-
- /* write the binary table header */
- ft_headwrite(fun->gio, fun->header);
-
- /* we just wrote the header */
- fun->ops |= OP_WRHEAD;
- }
- return 1;
-}
-
-/*
- *
- * _FunTableRowGet -- get rows from a table
- *
-*/
-#ifdef ANSI_FUNC
-void *
-_FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist, int *nrow)
-#else
-void *_FunTableRowGet(fun, rows, maxrow, plist, nrow)
- Fun fun;
- void *rows;
- int maxrow;
- char *plist;
- int *nrow;
-#endif
-{
- int i, j, k, l; /* counters */
- int tival; /* temp int value */
- int dofilt; /* true if we can filter */
- int skip; /* bytes to skip to end of extension */
- int *rbuf; /* valid row flags */
- int rowbufsize; /* alloc'ed output buffer size */
- int maxbufsize; /* max alloc'ed output buffer size */
- int smax; /* max elements in sbuf */
- int pad=sizeof(double); /* double boundary pad bytes */
- size_t get; /* number of rows to read */
- size_t got; /* number of rows read */
- double *sbuf=NULL; /* temp buffer for scaling */
- unsigned char *vheap; /* vheap space for output vector allocation */
- unsigned char *rawbase=NULL; /* base pointer into rawbuf */
- unsigned char *rawptr; /* current pointer into rawbuf */
- unsigned char *rowbase=NULL; /* base pointer to output row buf */
- unsigned char *rowptr; /* current pointer into output row buf */
- char *rawoff; /* temp pointer to input */
- char *rowoff; /* temp pointer to output */
- char *pbuf; /* temp plist buffer */
- char tbuf[SZ_LINE]; /* ever-present temp buffer */
- static char paint[SZ_LINE]; /* paint mode (like zhtools) */
- static char debug[SZ_LINE];
- static int rconvert;
-
- /* init result */
- *nrow = 0;
- rbuf = NULL;
-
- /* just in case ... */
- if( !_FunValid(fun) ){
- gerror(stderr, "invalid funtools handle\n");
- return NULL;
- }
-
- /* if we delayed the open before, we have to open now */
- if( !fun->header && strchr(fun->mode, 'r') )
- _FunFITSOpen(fun, fun->fname, "r");
-
- /* make sure something good happened */
- if( !fun->header || !fun->header->table ){
- gerror(stderr, "not a binary table\n");
- return NULL;
- }
-
- /* check plist values: convert, mask ... */
- if( fun->iconvert < 0 ){
- rconvert = 0;
- fun->transparent = 0;
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "convert", NULL, tbuf, SZ_LINE) ){
- fun->iconvert = istrue(tbuf);
- if( fun->iconvert != is_bigendian() ){
- rconvert = 1;
- }
- }
- else{
- fun->iconvert = (fun->endian != is_bigendian());
- }
- if( _FunKeyword(pbuf, "mask", "FUN_MASK", tbuf, SZ_LINE) ){
- if( !strcasecmp(tbuf, "transparent") )
- fun->transparent = 1;
- }
- if( _FunKeyword(pbuf, "paint", "FILTER_PAINT", tbuf, SZ_LINE) ){
- strncpy(paint, tbuf, SZ_LINE);
- }
- else{
- *paint = '\0';
- }
- if( _FunKeyword(pbuf, "debug", "FILTER_DEBUG", tbuf, SZ_LINE) ){
- strncpy(debug, tbuf, SZ_LINE);
- }
- else{
- *debug = '\0';
- }
- if( pbuf ) xfree(pbuf);
- }
-
- /* check for no more row to read in this file */
- if( !fun->left ){
- /* if possible, set up to read next file in list */
- if((fun->head) && (fun->head->ltype != LIST_NONE) && fun->head->current){
- fun->head->current = fun->next;
- /* if there is a next file, set it up */
- if( fun->head->current ){
- /* rewind save file pointers */
- rewind(fun->head->current->lefp);
- rewind(fun->head->current->lrfp);
- /* and if we read no rows but we have set up a next file,
- try again immediately */
- return FunTableRowGet(fun->head, rows, maxrow, plist, nrow);
- }
- }
- return NULL;
- }
-
- /* open the filter, if its not already been done */
- if( !fun->filt ){
- if( fun->filter && *fun->filter ){
- /* create the mode string */
- if( fun->endian != is_bigendian() )
- strncpy(tbuf, "convert=true", SZ_LINE-1);
- else
- strncpy(tbuf, "convert=false", SZ_LINE-1);
- /* add the binning key */
- if( fun->bincols ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, fun->bincols, SZ_LINE-1);
- }
- /* add the index flag */
- if( fun->idx == 1 ){
- strncat(tbuf, ",idx=true", SZ_LINE-1);
- }
- else if( fun->idx == -1 ){
- strncat(tbuf, ",idx=false", SZ_LINE-1);
- }
- /* add paint mode */
- if( *paint ){
- strncat(tbuf, ",", SZ_LINE-1);
- strncat(tbuf, "paint=", SZ_LINE-1);
- strncat(tbuf, paint, SZ_LINE-1);
- }
- /* add debug flag */
- if( *debug ){
- strcat(tbuf, ",");
- strcat(tbuf, "debug=");
- strcat(tbuf, debug);
- }
- fun->filt = FilterOpen(fun->header, fun->filter, tbuf);
- if( fun->filt == NULL ){
- gerror(stderr, "can't open filter\n");
- return NULL;
- }
- else if( fun->filt == NOFILTER ){
- fun->dofilt = 0;
- }
- }
- else{
- fun->filt = NOFILTER;
- fun->dofilt = 0;
- }
- }
-
- /* sanity check (after setup, to allow setup without actually reading) */
- if( maxrow <=0 ) return NULL;
-
- /* allocate output buffer, if necessary */
- if( rows ){
- rowbase = rows;
- }
- else{
- maxbufsize = fun->maxbufsize;
- rowbufsize = fun->rowsize + pad;
- /* we might have to allocate space for pointers as well */
- for(j=0; j<fun->ncol; j++){
- if( fun->cols[j]->mode & COL_PTR ){
- if( fun->cols[j]->poff && (fun->cols[j]->mode & COL_READ) ){
- gerror(stderr,
- "FunTableRowGet: [poff] not yet supported for allocated pointers\n");
- }
- rowbufsize += (fun->cols[j]->width + pad);
- }
- }
- /* ensure that we don't try to allocate too large a buffer, or we might
- swap our brains out and then die anyway */
- if( maxrow * rowbufsize > maxbufsize ){
- if( rowbufsize > maxbufsize )
- maxrow = 1;
- else
- maxrow = maxbufsize / rowbufsize;
- }
- if( maxrow <= 0 ) maxrow = 1;
- /* don't call xcalloc (which has internal error checking) but instead
- call system calloc and handle failure by halving the row number */
- while( !(rowbase = (unsigned char *)malloc(maxrow*rowbufsize+pad)) ){
- maxrow /= 2;
- if( maxrow <= 0 ){
- gerror(stderr, "can't allocate row buffer\n");
- return NULL;
- }
- }
- /* clear buffer */
- memset(rowbase, 0, maxrow*rowbufsize+pad);
- /* the vheap for pointers starts after row buffer */
- vheap = rowbase + (maxrow * fun->rowsize);
- /* make sure its on a double boundary */
- vheap += (pad - ((long)vheap % pad));
- /* set up the allocated pointers in each record */
- for(j=0; j<fun->ncol; j++){
- if( fun->cols[j]->mode & COL_PTR ){
- for(i=0; i<maxrow; i++){
- rowptr = rowbase + (i*fun->rowsize);
- *((unsigned char **)(rowptr+fun->cols[j]->offset)) = vheap;
- vheap += fun->cols[j]->width + (pad - (fun->cols[j]->width % pad));
- if( vheap >= (rowbase + (maxrow*rowbufsize+pad)) ){
- gerror(stderr, "internal funtools error: vheap too small\n");
- return NULL;
- }
- }
- }
- }
- }
-
- /* free previously saved buffer of raw input data */
- if( fun->rawbuf ) xfree(fun->rawbuf);
- /* allocate space for a pile of row records */
- if( fun->left > 0 )
- fun->rawbufsize = MIN(maxrow, fun->left);
- /* this is the case where we read til EOF */
- else
- fun->rawbufsize = maxrow;
- if( !(fun->rawbuf=(unsigned char *)xmalloc(fun->rawsize*fun->rawbufsize)) ||
- !(rbuf = (int *)xmalloc(sizeof(int)*fun->rawbufsize)) ){
- gerror(stderr, "can't allocate row buffer\n");
- return NULL;
- }
-
- /* allocate a scaling buffer for the largest input or output column */
- smax = -1;
- for(j=0; j<fun->ncol; j++){
- smax = MAX(fun->cols[j]->n, smax);
- }
- if( smax >0 )
- sbuf = (double *)malloc(smax*sizeof(double));
-
- /* seed output pointer to start of output buffer */
- rowptr = rowbase;
-
- /* while there are still rows to read and we have not read the max ... */
- while( (fun->left != 0) && (*nrow < maxrow) ){
- /* figure out how many to read this time */
- if( fun->left > 0 )
- get = MIN(maxrow - *nrow, fun->left);
- /* read to EOF */
- else
- get = maxrow - *nrow;
- /* read in a pile of rows AFTER the currently saved raw rows */
- rawbase = fun->rawbuf + (*nrow * fun->rawsize);
- _FunRead(fun, (void *)rawbase, fun->rawsize, get, &got);
- /* if we got what we asked for ... */
- if( got == get ){
- /* if we are reading a set number of rows ... */
- if( fun->left > 0 ){
- /* subtract the number we just got */
- fun->left -= got;
- /* just in case! */
- if( fun->left < 0 )
- fun->left = 0;
- }
- }
- /* didn't get what we asked for ... */
- else{
- /* if we are reading a set number of rows ... */
- if( fun->left > 0 ){
- /* using an index => already filtering, so fewer rows are acceptable */
- if( (fun->filt == NOFILTER) || (fun->filt->doidx != 1) ){
- /* otherwise its unexpected */
- gerror(stderr, "unexpected EOF reading rows\n");
- }
- /* ensure we stop after this iteration */
- fun->left = 0;
- }
- /* if we are reading til EOF, we just got there */
- else{
- fun->left = 0;
- }
- }
-
- /* filter these rows through the co-process */
- if( fun->dofilt ){
- dofilt = FilterEvents(fun->filt, (void *)rawbase, fun->rawsize, (int)got,
- (void *)rbuf);
- /* look for error on filter call */
- if( dofilt < 0 ){
- gerror(stderr, "event filter failed\n");
- }
- }
- else{
- dofilt = 0;
- }
-
- /* process each row in this batch */
- for(rawptr=rawbase, i=0; (size_t)i<got; i++, rawptr += fun->rawsize){
- /* if its not a valid row, skip it */
- if( dofilt && !fun->transparent && !rbuf[i] ){
- continue;
- }
- /* get specified columns, convert to type, and store in output */
- for(j=0; j<fun->ncol; j++){
- /* if this column is not active, or is not to be read, or if its
- to be taken from the input data, skip it */
- if(!(fun->cols[j]->mode & COL_ACTIVE) ||
- !(fun->cols[j]->mode & COL_READ) ||
- (fun->cols[j]->mode & COL_IBUF) )
- continue;
- /* this is the (input) fitsy column number */
- k = fun->cols[j]->tcol;
- if( fun->cols[j]->mode & COL_PTR )
- rowoff = *((char **)(((char *)rowptr)+fun->cols[j]->offset));
- else
- rowoff = (char *)rowptr+fun->cols[j]->offset;
- rowoff += fun->cols[j]->poff;
- /* for soa, rowbuf (i.e. rowbase) is indexed by nrows */
- if( fun->org == FUN_ORG_SOA )
- rowoff += *nrow * fun->cols[j]->width;
- /* process special values, or data values */
- switch(k){
- /* unknown means mode is "rw" but we don't actually have the col
- in the input data -- do nothing */
- case COL_UNKNOWN_ID:
- break;
- /* $region: the special region id */
- case COL_REGION_ID:
- case COL_NUM_ID:
- if( k == COL_REGION_ID ){
- /* we either use the return value or -1 (no region filtering) */
- if( dofilt )
- tival = rbuf[i];
- else
- tival = COL_REGION_ID;
- }
- if( k == COL_NUM_ID ){
- tival = fun->io + i + 1;
- }
- /* common code */
- /* if source and dest type diff, we must do full type convert */
- if( fun->cols[j]->type != 'J' ){
- ft_acht2(fun->cols[j]->type, rowoff, 'J', &tival, 1, rconvert, 0);
- }
- /* for same types, we might have to swap bytes */
- else if( rconvert ){
- swap(rowoff, &tival, ft_sizeof('J'), 'J');
- }
- /* otherwise its an easy copy */
- else{
- memcpy(rowoff, &tival, ft_sizeof('J'));
- }
- break;
- /* data column */
- default:
- /* this is the offset into the input record */
- rawoff = (char *)rawptr + fun->header->table->col[k].offset;
- /* if source and dest type diff or we are scaling the column,
- we must do full type convert */
- if( (fun->cols[j]->type != fun->header->table->col[k].type) ||
- fun->header->table->col[k].scaled ){
- /* handle bit-field processing specially */
- if( fun->header->table->col[k].type == 'X' ){
- int xtype;
- switch(fun->header->table->col[k].width/fun->cols[j]->n){
- case 0:
- case 1:
- xtype = 'B'; break;
- case 2:
- xtype = 'U'; break;
- case 4:
- xtype = 'V'; break;
- default:
- xtype = 'B'; break;
- }
- ft_acht2(fun->cols[j]->type, rowoff,
- xtype, rawoff,
- fun->cols[j]->n, fun->iconvert, 0);
- }
- /* handle scaled input data */
- else if( fun->header->table->col[k].scaled ){
- /* convert raw to double */
- ft_acht2('D', sbuf,
- fun->header->table->col[k].type, rawoff,
- fun->cols[j]->n, fun->iconvert, 0);
- /* calculate scaled value */
- for(l=0; l<fun->cols[j]->n; l++){
- sbuf[l] = sbuf[l] * fun->header->table->col[k].scale +
- fun->header->table->col[k].zero;
- }
- /* convert double to type */
- ft_acht2(fun->cols[j]->type, rowoff,
- 'D', sbuf, fun->cols[j]->n, 0, 0);
- /* mark column as having been scaled */
- fun->cols[j]->scaled |= FUN_SCALE_APPLIED;
- }
- /* handle straight-forward change of type */
- else{
- ft_acht2(fun->cols[j]->type, rowoff,
- fun->header->table->col[k].type, rawoff,
- fun->cols[j]->n, fun->iconvert, 0);
- }
- }
- /* for same types, we might have to swap bytes */
- else if( fun->iconvert ){
- if( fun->header->table->col[k].width >= fun->cols[j]->width ){
- swap(rowoff, rawoff, fun->cols[j]->width, fun->cols[j]->type);
- }
- else{
- swap(rowoff, rawoff, fun->header->table->col[k].width,
- fun->cols[j]->type);
- memset(rowoff+fun->header->table->col[k].width, 0,
- fun->cols[j]->width-fun->header->table->col[k].width);
- }
- }
- /* otherwise its an easy copy */
- else{
- if( fun->header->table->col[k].width >= fun->cols[j]->width ){
- memcpy(rowoff, rawoff, fun->cols[j]->width);
- }
- else{
- memcpy(rowoff, rawoff, fun->header->table->col[k].width);
- memset(rowoff+fun->header->table->col[k].width, 0,
- fun->cols[j]->width-fun->header->table->col[k].width);
- }
- }
- break;
- }
- }
- /* save the input data in rawbuf */
- if( (fun->rawbuf + (*nrow * fun->rawsize)) != rawptr)
- memcpy((fun->rawbuf + (*nrow * fun->rawsize)), rawptr, fun->rawsize);
- /* got another row */
- *nrow += 1;
- /* bump to next output pointer */
- if( fun->org == FUN_ORG_AOS )
- rowptr += fun->rowsize;
- }
- /* update how many input rows we have read */
- fun->io += got;
- fun->bytes += (got*fun->rawsize);
- }
-
- /* free up space */
- if( rbuf ) xfree(rbuf);
- if( sbuf ) xfree(sbuf);
-
- /* we just read a table */
- fun->ops |= OP_RDTABLE;
- /* this is the last file we read in the list */
- if( fun->head )
- fun->head->current = fun;
- else
- fun->current = fun;
-
- /* if we have no more rows left, clean up */
- if( !fun->left ){
- /* skip to end of extension */
- if( fun->bytes ){
- /* skip any unread rows */
- skip = (fun->rawsize*fun->total) - fun->bytes;
- gskip(fun->gio, (off_t)skip);
- fun->bytes += skip;
- /* skip padding */
- if( (skip = FT_BLOCK - (fun->bytes % FT_BLOCK)) == FT_BLOCK )
- skip = 0;
- gskip(fun->gio, (off_t)skip);
- /* reset io flag */
- /* fun->io = 0; */
- }
- /* close filter if done with the filter process */
- if( fun->filt && (fun->filt != NOFILTER) ){
- FilterClose(fun->filt);
- fun->filt = NULL;
- }
- }
-
- /* return buffer */
- return rowbase;
-}
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *
- * FunTableRowGet -- get rows from a table
- *
-*/
-#ifdef ANSI_FUNC
-void *
-FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist, int *nrow)
-#else
-void *FunTableRowGet(fun, rows, maxrow, plist, nrow)
- Fun fun;
- void *rows;
- int maxrow;
- char *plist;
- int *nrow;
-#endif
-{
- int got;
- fd_set readfds; /* read fds for select() */
- char *obuf;
- Fun cur, wrap, mark=NULL;
-
- /* just in case ... */
- *nrow = 0;
- if( !_FunValid(fun) ){
- gerror(stderr, "invalid data handle\n");
- return NULL;
- }
-
- /* process list type */
- switch(fun->ltype){
- case LIST_NONE:
- return _FunTableRowGet(fun, rows, maxrow, plist, nrow);
- case LIST_FILEORDER:
- return _FunTableRowGet(fun->current, rows, maxrow, plist, nrow);
- case LIST_SORT:
- case LIST_UNSORT:
- case LIST_TRYSORT:
-again:
- /* if we are sorting -- look for first valid file before we read */
- if( fun->ltype == LIST_SORT ){
- for(mark=fun->head; mark; mark=mark->next ){
- if( mark->left )
- break;
- }
- /* if we have no valid files left, we are done */
- if( !mark ){
- return NULL;
- }
- /* if we are sorting and we have current buffers, use one of them */
- else if( mark->save ){
- return _FunTableRestore(mark, rows, nrow);
- }
- }
- /* if we have no more active fds to process, select() for more */
- FD_ZERO(&readfds);
- for(got=0, cur=fun; cur; cur=cur->next){
- if( (cur->ifd >=0) && cur->left ){
- FD_SET(cur->ifd, &readfds);
- got++;
- }
- }
- /* if we have no more files, we are done */
- if( got == 0 ) return NULL;
- /* find out who is ready to be read */
- got = select(FD_SETSIZE, &readfds, NULL, NULL, NULL);
- if( got >0 ){
- /* get current starting place in list */
- if( fun->current && fun->current->next )
- cur = fun->current->next;
- else
- cur = fun;
- wrap = cur;
- while( !FD_ISSET(cur->ifd, &readfds) ){
- /* next file in list (with wrap around) */
- if( cur->next )
- cur = cur->next;
- else
- cur = fun;
- /* should not happen -- we went through the whole list unsucessfully */
- if( cur == wrap ){
- return NULL;
- }
- }
- /* read rows */
- obuf = _FunTableRowGet(cur, rows, maxrow, plist, nrow);
- /* return if not sorting, or if we are and this file is current */
- if( fun->ltype != LIST_SORT ){
- return obuf;
- }
- else{
- /* if the currently accessed file is the one we want, return it */
- if( fun->current == mark ){
- return obuf;
- }
- /* else we must save these rows for when this file is current */
- else{
- /* store these rows */
- _FunTableSave(fun->current, rows, obuf, *nrow);
- /* reset, go back for current */
- *nrow = 0;
- goto again;
- }
- }
- }
- else
- return NULL;
- default:
- return NULL;
- }
-}
-
-/*
- *
- * FunTableRowPut -- put rows to a table
- *
-*/
-#ifdef ANSI_FUNC
-int
-FunTableRowPut(Fun fun, void *rows, int nrow, int idx, char *plist)
-#else
-int FunTableRowPut(fun, rows, nrow, idx, plist)
- Fun fun;
- void *rows;
- int nrow;
- int idx;
- char *plist;
-#endif
-{
- int i;
- int ieoff1, ieoff2;
- int to, from;
- int width;
- int convert;
- int shortcut;
- char *rawptr;
- char *oebuf;
- char *rowptr;
- char *pbuf;
- char tbuf[SZ_LINE];
- Fun ifun;
-
- /* gotta have it */
- if( !_FunValid(fun) )
- return 0;
-
- /* this extension is a table */
- fun->type = FUN_TABLE;
-
- /* temp switch this fun's ifun to be the last fun we read in the ifun list */
- /* we need to do this to pick up the correct raw rawbuf */
- if( (ifun = fun->ifun) ){
- if( ifun->current )
- ifun = ifun->current;
- }
- /* no reference fun handle -- rely on the output fun */
- else
- ifun = fun;
-
- /* we have to convert from native if the data is the big-endian */
- if( fun->oconvert < 0 ){
- pbuf = xstrdup(plist);
- if( _FunKeyword(pbuf, "convert", NULL, tbuf, SZ_LINE) )
- fun->oconvert = istrue(tbuf);
- else
- fun->oconvert = !is_bigendian();
- if( pbuf ) xfree(pbuf);
- }
-
- /* initialize for writing */
- if( !_FunTablePutHeader(fun) )
- return(0);
-
- /* exit if we are not actually writing any events */
- if( !nrow )
- return(0);
-
- /* allocate temp buffer for rows */
- shortcut = 1;
- for(width=0, i=0; i<fun->ncol; i++){
- if( (fun->cols[i]->mode & COL_ACTIVE) &&
- (fun->cols[i]->mode & COL_WRITE) &&
- !(fun->cols[i]->mode & COL_REPLACEME) ){
- /* if we are writing anything from the user buffer, no shortcuts */
- if( !(fun->cols[i]->mode & COL_IBUF) || (i != fun->cols[i]->from) )
- shortcut = 0;
- /* add to the size of the output row record */
- width += fun->cols[i]->width;
- }
- /* if we are not writing anything from the input buffer, no shortcuts */
- else if( (fun->cols[i]->mode & COL_IBUF) )
- shortcut = 0;
- }
-
- /* make sure we have something to write */
- if( !width ){
- gerror(stderr, "No columns defined for FunTableRowPut()\n");
- }
-
- /* if we are just writing the input rows, we can do it much faster */
- if( shortcut ){
- oebuf = (char *)ifun->rawbuf + (idx * ifun->rawsize);
- }
- /* normally, we have to move all columns to a temp buffer and then write */
- else{
- /* write rows (might have to convert to big_endian) */
- oebuf = xmalloc(width*nrow);
- rowptr = oebuf;
- ieoff1 = idx * ifun->rawsize;
- ieoff2 = 0;
- /* process rows */
- for(i=0; i<nrow; i++){
- /* process columns in a row */
- for(to=0; to<fun->ncol; to++){
- /* skip if necessary */
- if( !(fun->cols[to]->mode & COL_ACTIVE) ||
- !(fun->cols[to]->mode & COL_WRITE) ||
- (fun->cols[to]->mode & COL_REPLACEME) )
- continue;
- /* if from value is -1, that means "use value from this column" */
- if( fun->cols[to]->from <0 )
- from = to;
- /* otherwise we use the value from some other column */
- else
- from = fun->cols[to]->from;
- /* raw input data */
- if( (fun->cols[from]->mode & COL_IBUF) ){
- rawptr = (char *)ifun->rawbuf+ieoff1;
- convert = !ifun->endian;
- }
- /* user data */
- else{
- rawptr = (char *)rows+ieoff2;
- convert = fun->oconvert;
- }
- if( fun->cols[from]->mode & COL_PTR ){
- rawptr = *((char **)(((char *)rawptr)+fun->cols[from]->offset));
- }
- else{
- rawptr = rawptr + fun->cols[from]->offset;
- }
- rawptr += fun->cols[from]->poff;
- /* for soa, rowbuf (i.e. rowbase) is indexed by nrows */
- if( fun->org == FUN_ORG_SOA )
- rawptr += i * fun->cols[from]->width;
- /* if source and dest type are different, we do full type convert */
- if( fun->cols[to]->type != fun->cols[from]->type ){
- /* but try to handle writing int to bit-field specially */
- if( fun->cols[to]->type == 'X' ){
- int xtype;
- switch(fun->cols[to]->width/fun->cols[from]->n){
- case 0:
- case 1:
- xtype = 'B'; break;
- case 2:
- xtype = 'U'; break;
- case 4:
- xtype = 'V'; break;
- default:
- xtype = 'B'; break;
- }
- ft_acht2(xtype, rowptr,
- fun->cols[from]->type, rawptr,
- fun->cols[from]->n, convert, 1);
- }
- else{
- ft_acht2(fun->cols[to]->type, rowptr,
- fun->cols[from]->type, rawptr,
- fun->cols[from]->n, convert, 1);
- }
- }
- /* for same types, we might have to swap bytes */
- else if( convert ){
- swap(rowptr, rawptr, fun->cols[to]->width, fun->cols[to]->type);
- }
- /* otherwise its an easy copy */
- else{
- memcpy(rowptr, rawptr, fun->cols[to]->width);
- }
- /* bump output pointer */
- rowptr += fun->cols[to]->width;
- }
- /* bump raw and user row pointers */
- ieoff1 += ifun->rawsize;
- if( fun->org == FUN_ORG_AOS )
- ieoff2 += fun->rowsize;
- }
- }
-
- /* write rows */
- if( gwrite(fun->gio, oebuf, width, nrow) != (size_t)nrow ){
- gerror(stderr, "unexpected error writing rows\n");
- return 0;
- }
-
- /* update bookkeeping */
- fun->io += nrow;
- fun->bytes += (width*nrow);
-
- /* free up allocated space */
- if( !shortcut && oebuf ) xfree(oebuf);
-
- /* we just wrote a table */
- fun->ops |= OP_WRTABLE;
-
- /* return the number of rows output */
- return nrow;
-}
-
-/*
- *
- * FunTableRowSeek -- seek to a specified rows in a table
- *
-*/
-#ifdef ANSI_FUNC
-off_t
-FunTableRowSeek(Fun fun, int nrow, char *UNUSED(plist))
-#else
-off_t FunTableRowSeek(fun, nrow, plist)
- Fun fun;
- int nrow;
- char *plist;
-#endif
-{
- off_t ipos, opos;
-
- /* gotta have it */
- if( !_FunValid(fun) )
- return (off_t)-1;
- /* get new position */
- ipos = fun->datastart + (fun->rawsize*(nrow-1));
- /* try to set position */
- opos = gseek(fun->gio, ipos, 0);
- /* if successful, reset the byte positon */
- if( opos >= 0 ){
- fun->bytes = opos;
- fun->io = nrow-1;
- fun->left = fun->total - fun->io;
- opos = ((opos - fun->datastart) / fun->rawsize) + 1;
- /* a negative record number only means we started from an odd place */
- if( opos < 0 ) opos = 0;
- }
- /* return results */
- return opos;
-}
diff --git a/funtools/funtable.c b/funtools/funtable.c
deleted file mode 100644
index 2418241..0000000
--- a/funtools/funtable.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-#include <find.h>
-#include <zprocess.h>
-#include <chandra.h>
-
-#define MAXROW 8192
-static int maxrow=MAXROW;
-static char macrobuf[SZ_LINE];
-
-#define SORTPROG "_funsort"
-
-typedef struct rowstruct{
- int x, y;
- double value;
- int region;
- int n;
-} *Row, RowRec;
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-static char *
-_funtableCB(char *name, void *client_data)
-#else
-static char *_funtableCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- int n=*(int *)client_data;
- if( !strcasecmp(name, "n") ){
- snprintf(macrobuf, SZ_LINE-1, "%d", n);
- return(macrobuf);
- }
- else{
- return NULL;
- }
-}
-
-#ifdef ANSI_FUNC
-static void
-usage (char *fname)
-#else
-static void usage(fname)
- char *fname;
-#endif
-{
- fprintf(stderr,
- "usage: %s [-a] [-i|-z] [-m] [-s cols] iname oname [columns]\n",
- fname);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -a # append to existing output file as a table extension\n");
- fprintf(stderr, " -i # for image data, only generate X and Y columns\n");
- fprintf(stderr, " -m # for tables, write a separate file for each region\n");
- fprintf(stderr, " -s 'col1 ...' # columns on which to sort\n");
- fprintf(stderr, " -z # for image data, output zero-valued pixels\n");
- fprintf(stderr, "\n(version: %s)\n", FUN_VERSION);
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i, j, k, n;
- int args;
- int nfile;
- int got, put;
- int type, isize;
- int dim1, dim2, dims;
- int ichan, ochan, pid, status;
- int rtype, rmode, roffset;
- int r=0;
- int rval=0;
- int ncol=0;
- int ip=0;
- int doindiv=0, dozero=0, dosort=0, domulti=0;
- int dtype, doffset, dmode, dn;
- int plen, elen, flen;
- int epad, ppad;
- int rlen;
- double dval;
- char *iname=NULL;
- char *oname=NULL;
- char *mode=NULL;
- char *sortcols=NULL;
- char *actcols=NULL;
- char *prog=NULL;
- char *path=NULL;
- char *ebuf=NULL;
- char *eptr=NULL;
- char *omode="w";
- char *s=NULL;
- char *t=NULL;
- char *u=NULL;
- char *fits=NULL;
- char *extn=NULL;
- char col[SZ_LINE];
- char tbuf[SZ_LINE];
- char cmd[SZ_LINE];
- double *dbuf=NULL;
- FILE *ifile;
- Fun fun, tfun=NULL;
- Fun *funs=NULL;
- Filter filt=NULL;
- FITSCard card;
- Row rowbuf, row;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "aims:z")) != -1){
- switch(c){
- case 'a':
- omode = "A";
- case 'i':
- doindiv = 1;
- break;
- case 'm':
- domulti=1;
- break;
- case 's':
- dosort = 1;
- sortcols=xstrdup(optarg);
- break;
- case 'z':
- dozero = 1;
- break;
- }
- }
-
- /* get maxrow,if user-specified */
- if( (s=getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* check for required arguments */
- args = argc - optind;
- if( args < 2 ) usage(argv[0]);
- iname = argv[optind+0];
- oname = xstrdup(argv[optind+1]);
-
- if( !(fun = FunOpen(iname, "rc", NULL)) )
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
-
- /* for multiple outputs, we need a file for each region and one extra */
- if( domulti ){
- if( fun->filter )
- tfun = fun;
- else{
- /* for non-disk files, we should punt, but we'll open a fake
- Chandra/ACIS FITS file and hope for the best */
- if( !strncasecmp(iname, "stdin", 5) || !strncmp(iname, "-", 1) ||
- !strncasecmp(iname, "pipe:", 5) ){
- extn = FileExtension(iname);
- plen = strlen(_prim);
- if( (ppad = FT_BLOCK - (plen % FT_BLOCK)) == FT_BLOCK ) ppad = 0;
- elen = strlen(_extn);
- if( (epad = FT_BLOCK - (elen % FT_BLOCK)) == FT_BLOCK ) epad = 0;
- flen = plen + ppad + elen + epad;
- fits = (char *)calloc(flen+1, sizeof(char));
- memset(fits, (int)' ', flen);
- memcpy(fits, _prim, plen);
- memcpy(fits+plen+ppad, _extn, elen);
- snprintf(tbuf, SZ_LINE-1,
- "buf:%#lx:%d%s", (long)fits, flen, extn?extn:"");
- tfun = FunOpen(tbuf, "r", NULL);
- }
- /* otherwise we can open the input file once again */
- else
- tfun = FunOpen(iname, "r", NULL);
- }
- FunInfoGet(tfun, FUN_TYPE, &type, 0);
- if( (type == FUN_IMAGE) || (type == FUN_ARRAY) )
- gerror(stderr, "can't output to multiple image files\n");
- strcpy(tbuf, "lexonly=true");
- if( tfun->bincols ){
- strcat(tbuf, ",");
- strcat(tbuf, tfun->bincols);
- }
- filt = FilterOpen(tfun->header, tfun->filter, tbuf);
- nfile = FilterRegionCount(TOK_IREG)+1;
- FilterClose(filt);
- if( tfun != fun )
- FunClose(tfun);
- }
- /* output a single file */
- else{
- nfile = 1;
- /* current fun handle is always first */
- r = 0;
- }
- /* should work for multi and single file output */
- if( !(funs = (Fun *)xcalloc(nfile, sizeof(Fun))) )
- gerror(stderr, "can't allocate space for multiple fun handles\n");
- /* make up output file names and open files */
- if( domulti ){
- /* open the input FITS file */
- if( !(u=strchr(oname, '$')) ){
- s = calloc(SZ_LINE, sizeof(char));
- if( (t=strchr(oname, '.')) ){
- *t='\0';
- t++;
- }
- }
- for(i=0; i<nfile; i++){
- /* put ivalue exactly where the user asked for it */
- if( u )
- s = ExpandMacro(oname, NULL, NULL, 0, _funtableCB, (void *)&i);
- /* put ivalue before first '.' */
- else if( t )
- snprintf(s, SZ_LINE-1, "%s%d.%s", oname, i, t);
- /* no hint about what to do -- prepend the ivalue */
- else
- snprintf(s, SZ_LINE-1, "%s%d", oname, i);
- /* last one triggers open of input file and possible copy */
- if( i == (nfile-1) )
- strncpy(tbuf, omode, SZ_LINE-1);
- /* otherwise, just add output fd to list of output file */
- else
- snprintf(tbuf, SZ_LINE-1, "%sd", omode);
- /* open the output FITS table, preparing to copy input params.
- must be done before accessing the input file to allow for ext copy */
- if( !(funs[i] = FunOpen(s, tbuf, fun)) )
- gerror(stderr, "can't FunOpen output file #%d: %s\n", i, s);
- if( u && s ) xfree(s);
- }
- if( !u && s ) xfree(s);
- }
- else{
- if( !(funs[r] = FunOpen(oname, omode, fun)) )
- gerror(stderr, "can't FunOpen output file: %s\n", oname);
- }
-
- /* get type of input data */
- FunInfoGet(fun, FUN_TYPE, &type, 0);
-
- /* process data by type */
- switch(type){
- case FUN_TABLE:
- case FUN_EVENTS:
- /* uness we are sorting, only read $region & $n into user space so we
- can override their values (by merging with raw data) */
- if( !dosort ){
- FunColumnSelect(fun, sizeof(RowRec), "merge=replace",
- "$REGION", "J", "rw", FUN_OFFSET(Row, region),
- "$N", "J", "rw", FUN_OFFSET(Row, n),
- NULL);
- FunColumnActivate(fun, "-$REGION -$N", NULL);
- }
-
- /* set activate specified output columns */
- if( args >= 3 ) actcols = argv[optind+2];
- FunColumnActivate(fun, actcols, NULL);
-
- /* if region was not activiated by the user, activate now for read only */
- if( domulti ){
- if( !FunColumnLookup(fun, COL_REGION_NAME,
- 0, NULL, &rtype, &rmode, &roffset, NULL, NULL) ||
- !(rmode&COL_ACTIVE))
- FunColumnActivate(fun, "+$REGION", "mode=r");
- }
- /* if we specified columns, we also can specify "mask=transparent"
- and get all events, with the regionid (assuming we specified
- the region column to display as well) */
- if( args >= 4 ) mode = argv[optind+3];
-
- /* set up sorting, if necessary */
- if( dosort ){
- /* look for sort program */
- path = (char *)getenv("PATH");
- if( !(prog=Find(SORTPROG, "x", NULL, path)) )
- gerror(stderr, "can't locate sort program: %s\n", SORTPROG);
- /* allow commas as delims */
- newdtable(",");
- /* get the size of the input record */
- FunInfoGet(fun, FUN_ROWSIZE, &isize, 0);
- /* construct argument list for sort program */
- snprintf(cmd, SZ_LINE-1, "%s -B%d", prog, isize);
- rlen = SZ_LINE - strlen(cmd) - 1;
- for(ncol=0; word(sortcols, col, &ip); ncol++ ){
- if( !FunColumnLookup(fun, col, 0, NULL, &dtype, &dmode, &doffset, &dn,
- NULL) ){
- gerror(stderr, "can't find sort column '%s'\n", col);
- }
- if( !(dmode & COL_ACTIVE) ){
- gerror(stderr, "sort column '%s' must be active\n", col);
- }
- switch(dtype){
- case 'A':
- snprintf(tbuf, SZ_LINE-1, "+t%d.%d", doffset, dn);
- break;
- case 'B':
- snprintf(tbuf, SZ_LINE-1, "+B%d", doffset);
- break;
- case 'I':
- snprintf(tbuf, SZ_LINE-1, "+s%d", doffset);
- break;
- case 'U':
- snprintf(tbuf, SZ_LINE-1, "+S%d", doffset);
- break;
- case 'J':
- snprintf(tbuf, SZ_LINE-1, "+i%d", doffset);
- break;
- case 'K':
- snprintf(tbuf, SZ_LINE-1, "+l%d", doffset);
- break;
- case 'V':
- snprintf(tbuf, SZ_LINE-1, "+I%d", doffset);
- break;
- case 'E':
- snprintf(tbuf, SZ_LINE-1, "+f%d", doffset);
- break;
- case 'D':
- snprintf(tbuf, SZ_LINE-1, "+d%d", doffset);
- break;
- default:
- gerror(stderr, "unsupported sort data type for column %s\n", tbuf);
- }
- strncat(cmd, " ", rlen);
- rlen--;
- strncat(cmd, tbuf, rlen);
- rlen -= strlen(tbuf);
- if( rlen <=0 ){
- gerror(stderr, "too many arguments for sort\n");
- exit(1);
- }
- }
- freedtable();
- /* start the sort program */
- if( !ProcessOpen(cmd, &ichan, &ochan, &pid) ){
- gerror(stderr, "ERROR: can't start sort program: %s\n", prog);
- }
- }
- /* extract events */
- while( (ebuf = FunTableRowGet(fun, NULL, maxrow, mode, &got)) ){
- /* sort: write unsorted events to sort program */
- if( dosort ){
- write(ochan, ebuf, got*isize);
- }
- /* no sort: copy directly to output */
- else{
- /* multiple files -- one for each region id */
- if( domulti ){
- for(n=0; n<got; n++){
- row = (Row)ebuf+n;
- r = MAX(0,row->region);
- if( (put=FunTableRowPut(funs[r], row, 1, n, NULL)) != 1 ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- 1, put);
- }
- }
- }
- /* single file output */
- else{
- if( (put=FunTableRowPut(funs[r], ebuf, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- }
- xfree(ebuf);
- }
- /* finish up sorting, if necessary */
- if( dosort ){
- /* signal EOF to sort program */
- close(ochan);
- if( maxrow * isize > fun->maxbufsize ){
- if( isize > fun->maxbufsize )
- maxrow = 1;
- else
- maxrow = fun->maxbufsize / isize;
- }
- if( maxrow <= 0 ) maxrow = 1;
- ebuf = xmalloc(maxrow*isize);
- /* use stdio to avoid returning partial records */
- if( !(ifile = fdopen(ichan, "r")) ){
- gerror(stderr, "can't retrieve sorted records\n");
- }
- while( (got=fread(ebuf, isize, maxrow, ifile)) ){
- /* multiple files -- one for each region id */
- if( domulti ){
- for(n=0; n<got; n++){
- /* point at next event */
- eptr = ebuf + (n*isize);
- /* get region id */
- switch(rtype){
- case 'B':
- rval = (int)*(unsigned char *)(eptr+roffset);
- break;
- case 'I':
- rval = (int)*(short *)(eptr+roffset);
- break;
- case 'U':
- rval = (int)*(unsigned short *)(eptr+roffset);
- break;
- case 'J':
- rval = *(int *)(eptr+roffset);
- break;
- case 'K':
-#if HAVE_LONG_LONG == 0
- gerror(stderr,
- "64-bit data support not built (long long not available)\n");
-#endif
- rval = *(longlong *)(eptr+roffset);
- break;
- case 'V':
- rval = (int)*(unsigned int *)(eptr+roffset);
- break;
- case 'E':
- rval = (int)*(float *)(eptr+roffset);
- break;
- case 'D':
- rval = (int)*(double *)(eptr+roffset);
- break;
- }
- /* offset is region id (but not less than 0) */
- r = MAX(0, rval);
- /* output event to appropriate file */
- if( (put=FunTableRowPut(funs[r], eptr, 1, n, NULL)) != 1 ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- 1, put);
- }
- }
- }
- /* single file output */
- else{
- /* output all events in this buffer to single file */
- if( (put=FunTableRowPut(funs[r], ebuf, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- }
- /* done with sorting process */
- ProcessClose(pid, &status);
- fclose(ifile);
- if( sortcols ) xfree(sortcols);
- if( ebuf ) xfree(ebuf);
- }
- /* write out heap space, if it exists -- this quick hack needs cleanup! */
- if( fun->header && (ft_pcount(fun->header) > 0) ){
- int got;
- int hlen;
- char *heap;
- hlen=ft_pcount(fun->header);
- if( (heap = xmalloc(hlen)) ){
- /* read heap data */
- got = gread (fun->gio, heap, sizeof(char), hlen);
- fun->bytes += got;
- /* write heap data to each output file */
- for(n=0; n<nfile; n++){
- got = gwrite (funs[n]->gio, heap, sizeof(char), got);
- funs[n]->bytes += got;
- }
- xfree(heap);
- }
- }
- break;
- case FUN_IMAGE:
- case FUN_ARRAY:
- if( dosort ) gerror(stderr, "can't sort image data\n");
- if( domulti ) gerror(stderr, "can't output to multiple image files\n");
- /* get image section information */
- FunInfoGet(fun,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- FUN_SECT_DIMS, &dims, 0);
- /* make a standard extension name for the new binary table */
- FunParamPuts(funs[r], "EXTNAME", 0, "EVENTS", NULL, 1);
- if( dims >= 2 ){
- /* add tlmin/tlmax values for the x,y columns */
- FunParamPuti(funs[r], "TLMIN1", 0, 1, NULL, 1);
- FunParamPuti(funs[r], "TLMAX1", 0, dim1, NULL, 1);
- FunParamPuti(funs[r], "TLMIN2", 0, 1, NULL, 1);
- FunParamPuti(funs[r], "TLMAX2", 0, dim2, NULL, 1);
- /* transform WCS cards from image to binary table */
- for(i=1; i<=2; i++){
- if( (s=ft_headgets(fun->header, "CTYPE", i, NULL, &card)) && card ){
- FunParamPuts(funs[r], "TCTYP", i, s, NULL, 1);
- xfree(s);
- }
- if((dval=ft_headgetr(fun->header, "CRVAL", i, 0.0, &card)) && card){
- FunParamPutd(funs[r], "TCRVL", i, dval, 7, NULL, 1);
- }
- if((dval=ft_headgetr(fun->header, "CDELT", i, 0.0, &card)) && card){
- FunParamPutd(funs[r], "TCDLT", i, dval, 7, NULL, 1);
- }
- if((dval=ft_headgetr(fun->header, "CROTA", i, 0.0, &card)) && card){
- FunParamPutd(funs[r], "TCROT", i, dval, 7, NULL, 1);
- }
- if((dval=ft_headgetr(fun->header, "CRPIX", i, 0.0, &card)) && card){
- FunParamPutd(funs[r], "TCRPX", i, dval, 7, NULL, 1);
- }
- }
- /* select columns */
- if( doindiv ){
- FunColumnSelect(funs[r], sizeof(RowRec), NULL,
- "X", "J", "w", FUN_OFFSET(Row, x),
- "Y", "J", "w", FUN_OFFSET(Row, y),
- NULL);
- }
- else{
- FunColumnSelect(funs[r], sizeof(RowRec), NULL,
- "X", "J", "w", FUN_OFFSET(Row, x),
- "Y", "J", "w", FUN_OFFSET(Row, y),
- "VALUE", "D", "rw", FUN_OFFSET(Row, value),
- NULL);
- }
- }
- else{
- /* set dim2 to 1 for 1D image */
- dim2 = 1;
- /* select columns */
- if( doindiv ){
- FunColumnSelect(funs[r], sizeof(RowRec), NULL,
- "X", "J", "w", FUN_OFFSET(Row, x),
- NULL);
- }
- else{
- FunColumnSelect(funs[r], sizeof(RowRec), NULL,
- "X", "J", "w", FUN_OFFSET(Row, x),
- "VALUE", "D", "rw", FUN_OFFSET(Row, value),
- NULL);
- }
- }
- /* we will make event row(s) for each x,y pixel */
- rowbuf = xcalloc(dim1, sizeof(RowRec));
- /* process each image row */
- for(j=1; j<=dim2; j++){
- /* extract image data and make event rows */
- if( !(dbuf = FunImageRowGet(fun, dbuf, j, j, "bitpix=-64")) )
- gerror(stderr, "can't FunImageRowGet: %s\n", iname);
- if( doindiv ){
- /* generate an event for this pixel */
- for(i=0; i<dim1; i++){
- /* replicate individual row according to the value of the pixel.
- don't replicate pixels values less than zero; round fp values */
- if( dbuf[i] >0 ){
- rowbuf[i].x = i+1;
- rowbuf[i].y = j;
- for(k=0; k<(int)(dbuf[i]+0.5); k++){
- /* write replicated row */
- if( FunTableRowPut(funs[r], &rowbuf[i], 1, 0, NULL) != 1 )
- gerror(stderr, "can't FunTableRowPut: %s\n", oname);
- }
- }
- }
- }
- else{
- /* generate one event per pixel, with an accompanying value column */
- for(i=0; i<dim1; i++){
- /* don't write zero rows unless asked */
- if( dozero || (dbuf[i] > 0) ){
- rowbuf[i].x = i+1;
- rowbuf[i].y = j;
- rowbuf[i].value = dbuf[i];
- /* write row */
- if( FunTableRowPut(funs[r], &rowbuf[i], 1, 0, NULL) != 1 )
- gerror(stderr, "can't FunTableRowPut: %s\n", oname);
- }
- }
- }
- }
- if( rowbuf ) xfree(rowbuf);
- if( dbuf ) xfree(dbuf);
- break;
- default:
- gerror(stderr, "unknown Funtools data type: %d\n", type);
- exit(1);
- }
-
- /* for multiple outputs, flush the input extension to all files at once */
- if( domulti ){
- FunFlush(fun, "copy=ref");
- }
-
- /* if we close output before input, all flushing is done automatically */
- /* free up space from multiple fun handles */
- for(i=0; i<nfile; i++){
- if( funs[i] ){
- FunClose(funs[i]);
- }
- }
- xfree(funs);
- if( oname ) xfree(oname);
- if( fits ) xfree(fits);
- if( extn ) xfree(extn);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtbl.tmpl b/funtools/funtbl.tmpl
deleted file mode 100755
index c230c0e..0000000
--- a/funtools/funtbl.tmpl
+++ /dev/null
@@ -1,202 +0,0 @@
-#!/bin/sh
-
-EXE=AWK
-N=1
-FILE=-
-DOHEAD=0
-DORDB=0
-XHEAD=""
-SEP=" "
-
-# process args
-while [ x"$1" != x ]; do
- case $1 in
- -c) shift
- COLS=$1
- shift
- continue;;
- -help|--help)
- echo "usage:"
- echo " "
- echo " funtbl [switches] input_file"
- echo " funtbl [switches] < input_file"
- echo " "
- echo "switches (optional):"
- echo " "
- echo " -c \"col1 ...\" # output columns numbers (def: all)"
- echo " -h # prepend column names as a header"
- echo " -H prefix # prepend prefix and column names"
- echo " -n num # extract the nth data table (def: 1)"
- echo " -p prog # awk program (def: host-specific)"
- echo " -s sep # output separator (def: space)"
- echo " -T # output rdb table format"
- echo " "
- echo " -help # print this message"
- echo " "
- echo "examples:"
- echo " "
- echo " funcnts -rs ... | funtbl -c \"1 3\" -n 4 -s \"\t\""
- echo " funtbl -c \"1 3\" -n 4 -h -s \"\t\" foo.out"
- echo " funtbl -c \"1 3\" -n 4 -T foo.out"
- echo " "
- echo "All 3 will output the first and third columns of the fourth"
- echo "table, with the columns separated by a tab. The second form"
- echo "will output a single line header of column names. The third"
- echo "form will output 2-line rdb header."
- echo " "
- exit 0;;
- -h) DOHEAD=1
- XHEAD="# "
- shift
- continue;;
- -H) DOHEAD=1
- shift
- XHEAD=$1
- shift
- continue;;
- -n) shift
- N=$1
- shift
- continue;;
- -p) shift
- EXE=$1
- shift
- continue;;
- -s) shift
- SEP=$1
- shift
- continue;;
- -T) DORDB=1
- DOHEAD=1
- SEP="\t"
- shift
- continue;;
- *) FILE=$1
- shift
- continue;;
- esac
-done
-
-cat $FILE | \
-$EXE '
-
-BEGIN{
- I=0
- STATE=0
- N='"$N"'
- COLS="'"$COLS"'"
- DOHEAD='"$DOHEAD"'
- DORDB='"$DORDB"'
- SEP="'"$SEP"'"
- XHEAD="'"$XHEAD"'"
- if( COLS == "" ){
- NCOL=0
- }
- else{
- NCOL=split(COLS,COLNAMES);
- }
-}
-
-# state 0: looking for nth header
-STATE==0{
- last = cur
- cur = $0
- dashes=0
- for(j=1; j<=NF; j++){
- if( $j ~ /--*/ ){
- dashes++;
- }
- else{
- break;
- }
- }
- if( (dashes >= 1) && (dashes == NF) ){
- I=I+1
- if( I==N ){
- STATE=1
- LINES=0
- if( DOHEAD == 1 ){
- split(last, HEADER)
- split($0, DASHES)
- }
- }
- }
-}
-
-# look for blank line to end row output
-$0 ~ /^$/{
- if( STATE == 1 ){
- STATE=2
- }
-}
-
-# state 1: output this line of data
-STATE==1{
- # output header, if necessary
- if( LINES == 0 ){
- if( DOHEAD == 1 ){
- # output as comment if not rdb
- if( DORDB != 1 ){
- printf("%s", XHEAD)
- }
- # specific columns
- if( COLS == "" ){
- for(i=1; i<=NF; i++){
- printf("%s", HEADER[i])
- if( i != NF )
- printf("%s", SEP)
- }
- printf("\n")
- if( DORDB == 1 ){
- for(i=1; i<=NF; i++){
- printf("%s", DASHES[i])
- if( i != NF )
- printf("%s", SEP)
- }
- printf("\n")
- }
- }
- # all columns
- else{
- for(i=1; i<=NCOL; i++){
- printf("%s", HEADER[COLNAMES[i]])
- if( i != NCOL ){
- printf("%s", SEP)
- }
- }
- printf("\n")
- if( DORDB == 1 ){
- for(i=1; i<=NCOL; i++){
- printf("%s", DASHES[COLNAMES[i]])
- if( i != NCOL ){
- printf("%s", SEP)
- }
- }
- printf("\n")
- }
- }
- }
- }
- else{
- if( COLS == "" ){
- for(i=1; i<=NF; i++){
- printf("%s", $i)
- if( i != NF )
- printf("%s", SEP)
- }
- printf("\n")
- }
- else{
- split($0, ARGS)
- for(i=1; i<=NCOL; i++){
- printf("%s", ARGS[COLNAMES[i]])
- if( i != NCOL )
- printf("%s", SEP)
- }
- printf("\n")
- }
- }
- LINES=LINES+1
-}
-'
-
diff --git a/funtools/funtclmainlib.c b/funtools/funtclmainlib.c
deleted file mode 100644
index e2f9569..0000000
--- a/funtools/funtclmainlib.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <tclmainlib.h>
-
-int funcen_main(int argc, char **argv);
-int funcnts_main(int argc, char **argv);
-int fundisp_main(int argc, char **argv);
-int funhead_main(int argc, char **argv);
-int funhist_main(int argc, char **argv);
-int funimage_main(int argc, char **argv);
-int funmerge_main(int argc, char **argv);
-int funtable_main(int argc, char **argv);
-int funcalc_main(int argc, char **argv);
-#if HAVE_TCL
-#include <tcl.h>
-
-int Funtools_Init (void *vinterp)
-{
- Tcl_Interp *interp = (Tcl_Interp *)vinterp;
-
- Tcl_CreateObjCommand(interp, "funcen", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funcnts", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "fundisp", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funhead", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funhist", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funimage", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funmerge", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funtable", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_CreateObjCommand(interp, "funcalc", MainLib_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-
- Tcl_PkgProvide(interp, "funtools", "1.0");
- return(TCL_OK);
-}
-
-int funtclmainlib=1;
-#else
-
-int funtclmainlib=0;
-#endif
diff --git a/funtools/funtest/Makefile.in b/funtools/funtest/Makefile.in
deleted file mode 100644
index 2b7cc77..0000000
--- a/funtools/funtest/Makefile.in
+++ /dev/null
@@ -1,274 +0,0 @@
-#
-# This is a Makefile for the Funtools testing. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# extra includes for compiling
-INCLUDES = -I. -I$(prefix)/include
-
-# extra libs
-EXTRA_LIBS = @EXTRA_LIBS@
-
-# the full set of libraries for linking
-LIBS = -L.. -lfuntools $(EXTRA_LIBS) -lm
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = @srcdir@/install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-DEPEND_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-SRCS = evread.c evreplace.c evmerge.c evmerge2.c evcol.c evnext.c \
- evcre.c imblank.c imtest.c wtest.c evtest.c mkev.c filt.c \
- asc2fits.c bigfits.c
-
-OBJS = evread.o evreplace.o evmerge.o evmerge2.o evcol.o evnext.o \
- evcre.o imblank.o imtest.o wtest.o evtest.o mkev.o filt.o \
- asc2fits.o bigfits.o
-
-PROGS = evread evreplace evmerge evmerge2 evcol evnext evcre \
- imblank imtest wtest evtest mkev filt asc2fits bigfits
-
-all: $(PROGS)
-
-evread: evread.o
- $(CC) $(LDFLAGS) evread.o -o evread $(LIBS)
-
-evreplace: evreplace.o
- $(CC) $(LDFLAGS) evreplace.o -o evreplace $(LIBS)
-
-evmerge: evmerge.o
- $(CC) $(LDFLAGS) evmerge.o -o evmerge $(LIBS)
-
-evmerge2: evmerge2.o
- $(CC) $(LDFLAGS) evmerge2.o -o evmerge2 $(LIBS)
-
-evcol: evcol.o
- $(CC) $(LDFLAGS) evcol.o -o evcol $(LIBS)
-
-evnext: evnext.o
- $(CC) $(LDFLAGS) evnext.o -o evnext $(LIBS)
-
-evcre: evcre.o
- $(CC) $(LDFLAGS) evcre.o -o evcre $(LIBS)
-
-imblank: imblank.o
- $(CC) $(LDFLAGS) imblank.o -o imblank $(LIBS)
-
-imtest: imtest.o
- $(CC) $(LDFLAGS) imtest.o -o imtest $(LIBS)
-
-wtest: wtest.o
- $(CC) $(LDFLAGS) wtest.o -o wtest $(LIBS)
-
-evtest: evtest.o
- $(CC) $(LDFLAGS) evtest.o -o evtest $(LIBS)
-
-mkev: mkev.o
- $(CC) $(LDFLAGS) mkev.o -o mkev $(LIBS)
-
-filt: filt.o
- $(CC) $(LDFLAGS) filt.o -o filt $(LIBS)
-
-asc2fits: asc2fits.o
- $(CC) $(LDFLAGS) asc2fits.o -o asc2fits $(LIBS)
-
-bigfits: bigfits.o
- $(CC) $(LDFLAGS) bigfits.o -o bigfits $(LIBS)
-
-Makefile: Makefile.in
- $(SHELL) ../config.status
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak tview.fit tview.fits \
- config.info config.log \
- *fun*.out doc/*~
- $(RM) -r autom4te.cache
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log
-
-install:
- @echo "Nothing to install in funtest"
-
-pclean:
- $(RM) $(PROGS)
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-evread.o: evread.c
- $(CC) -c $(CC_SWITCHES) evread.c
-
-evreplace.o: evreplace.c
- $(CC) -c $(CC_SWITCHES) evreplace.c
-
-evmerge.o: evmerge.c
- $(CC) -c $(CC_SWITCHES) evmerge.c
-
-evmerge2.o: evmerge2.c
- $(CC) -c $(CC_SWITCHES) evmerge2.c
-
-evcol.o: evcol.c
- $(CC) -c $(CC_SWITCHES) evcol.c
-
-evnext.o: evnext.c
- $(CC) -c $(CC_SWITCHES) evnext.c
-
-evcre.o: evcre.c
- $(CC) -c $(CC_SWITCHES) evcre.c
-
-imblank.o: imblank.c
- $(CC) -c $(CC_SWITCHES) imblank.c
-
-imtest.o: imtest.c
- $(CC) -c $(CC_SWITCHES) imtest.c
-
-wtest.o: wtest.c
- $(CC) -c $(CC_SWITCHES) wtest.c
-
-evtest.o: evtest.c
- $(CC) -c $(CC_SWITCHES) evtest.c
-
-mkev.o: mkev.c
- $(CC) -c $(CC_SWITCHES) mkev.c
-
-filt.o: filt.c
- $(CC) -c $(CC_SWITCHES) filt.c
-
-asc2fits.o: asc2fits.c
- $(CC) -c $(CC_SWITCHES) asc2fits.c
-
-bigfits.o: bigfits.c
- $(CC) -c $(CC_SWITCHES) bigfits.c
-
-pure: evread.pure evreplace.pure evmerge.pure evmerge2.pure \
- evcol.pure evnext.pure evcre.pure \
- imblank.pure imtest.pure wtest.pure filt.pure \
- evtest.pure asc2fits.pure bigfits.pure
-
-evread.pure: $(FUNLIB) evread.o
- purify $(CC) $(LDFLAGS) evread.o -o evread.pure \
- $(FUNLIB) $(LIBS)
-
-evreplace.pure: $(FUNLIB) evreplace.o
- purify $(CC) $(LDFLAGS) evreplace.o -o evreplace.pure \
- $(FUNLIB) $(LIBS)
-
-evmerge.pure: $(FUNLIB) evmerge.o
- purify $(CC) $(LDFLAGS) evmerge.o -o evmerge.pure \
- $(FUNLIB) $(LIBS)
-
-evmerge2.pure: $(FUNLIB) evmerge2.o
- purify $(CC) $(LDFLAGS) evmerge2.o -o evmerge2.pure \
- $(FUNLIB) $(LIBS)
-
-evcol.pure: $(FUNLIB) evcol.o
- purify $(CC) $(LDFLAGS) evcol.o -o evcol.pure \
- $(FUNLIB) $(LIBS)
-
-evnext.pure: $(FUNLIB) evnext.o
- purify $(CC) $(LDFLAGS) evnext.o -o evnext.pure \
- $(FUNLIB) $(LIBS)
-
-evcre.pure: $(FUNLIB) evcre.o
- purify $(CC) $(LDFLAGS) evcre.o -o evcre.pure \
- $(FUNLIB) $(LIBS)
-
-imblank.pure: $(FUNLIB) imblank.o
- purify $(CC) $(LDFLAGS) imblank.o -o imblank.pure \
- $(FUNLIB) $(LIBS)
-
-imtest.pure: $(FUNLIB) imtest.o
- purify $(CC) $(LDFLAGS) imtest.o -o imtest.pure \
- $(FUNLIB) $(LIBS)
-
-wtest.pure: $(FUNLIB) wtest.o
- purify $(CC) $(LDFLAGS) wtest.o -o wtest.pure \
- $(FUNLIB) $(LIBS)
-
-filt.pure: $(FUNLIB) filt.o
- purify $(CC) $(LDFLAGS) filt.o -o filt.pure \
- $(FUNLIB) $(LIBS)
-
-evtest.pure: $(FUNLIB) evtest.o
- purify $(CC) $(LDFLAGS) evtest.o -o evtest.pure \
- $(FUNLIB) $(LIBS)
-
-asc2fits.pure: $(FUNLIB) asc2fits.o
- purify $(CC) $(LDFLAGS) asc2fits.o -o asc2fits.pure \
- $(FUNLIB) $(LIBS)
-
-bigfits.pure: $(FUNLIB) bigfits.o
- purify $(CC) $(LDFLAGS) bigfits.o -o bigfits.pure \
- $(FUNLIB) $(LIBS)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/funtest/arg3.inc b/funtools/funtest/arg3.inc
deleted file mode 100644
index 9c05967..0000000
--- a/funtools/funtest/arg3.inc
+++ /dev/null
@@ -1 +0,0 @@
-@t4.reg
diff --git a/funtools/funtest/asc2fits.c b/funtools/funtest/asc2fits.c
deleted file mode 100644
index 7644dce..0000000
--- a/funtools/funtest/asc2fits.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * asc2fits foo.fits < foo.ascii
- *
- * This is an example of generating a binary table from specific ASCII input.
- * The more general case is much harder.
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <funtools.h>
-
-#define MAXREC 30
-
-typedef struct EvStruct{
- int x, y, pha;
- double time;
-} *Event, EventRec;
-
-int main(int argc, char **argv)
-{
- int got, put;
- char tbuf[SZ_LINE];
- Fun fun;
- EventRec events[MAXREC];
- Event ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- if( argc < 2 ){
- fprintf( stderr, "usage: %s oname\n", argv[0]);
- exit(1);
- }
-
- /* open output file */
- if( !(fun = FunOpen(argv[1],"w", NULL)) )
- gerror(stderr, "Could not open the output file: %s\n", argv[1]);
-
- /* set up the (hardwired) columns */
- FunColumnSelect( fun, sizeof(EventRec), NULL,
- "x", "J", "w", FUN_OFFSET(Event, x),
- "y", "J", "w", FUN_OFFSET(Event, y),
- "pha", "J", "w", FUN_OFFSET(Event, pha),
- "time", "D", "w", FUN_OFFSET(Event, time),
- NULL);
-
- /* ignore first line, which is the header */
- fgets(tbuf, SZ_LINE, stdin);
-
- /* process data lines */
- got = 0;
- /* get next line */
- while( fgets(tbuf, SZ_LINE, stdin) ){
- /* ignore comments */
- if( (*tbuf == '\n') || (*tbuf == '#') )
- continue;
- /* point to next buffer to fill */
- ev = &events[got];
- /* parse data record */
- if(sscanf(tbuf, "%d %d %d %lf", &ev->x, &ev->y, &ev->pha, &ev->time) != 4)
- break;
- /* got another record */
- got++;
- /* flush this batch of records if necessary */
- if( got == MAXREC ){
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- /* reset record counter */
- got = 0;
- }
- }
- /* final flush */
- if( got ){
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/ascii2fits.c b/funtools/funtest/ascii2fits.c
deleted file mode 100644
index 048167c..0000000
--- a/funtools/funtest/ascii2fits.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Solaris:
- * gcc -o foo foo.c -I ../include -L../lib -lfuntools -lsocket -lnsl -ldl -lm
- * Linux:
- * gcc -o foo foo.c -I ../include -L../lib -lfuntools -lm
- *
- * asc2fits foo.fits < foo.ascii
- *
- * This is an example of generating a binary table from specific ASCII input.
- * The more general case is much harder.
- *
- * input looks like this:
- *
- * 1 100.0 200.0 5.0 14 13 11 3.0
- * 2 101.0 202.2 7.0 11 12 10 4.0
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <funtools.h>
-
-#define MAXREC 30
-
-typedef struct EvStruct{
- int i1, i2, i3, i4;
- double d1, d2, d3, d4;
-} *Event, EventRec;
-
-int main(int argc, char **argv)
-{
- int got, put;
- char tbuf[SZ_LINE];
- Fun fun;
- EventRec events[MAXREC];
- Event ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- if( argc < 2 ){
- fprintf( stderr, "usage: %s oname\n", argv[0]);
- exit(1);
- }
-
- /* open output file */
- if( !(fun = FunOpen(argv[1],"w", NULL)) )
- gerror(stderr, "Could not open the output file: %s\n", argv[1]);
-
- /* set up the (hardwired) columns */
- FunColumnSelect( fun, sizeof(EventRec), NULL,
- "i1", "J", "w", FUN_OFFSET(Event, i1),
- "d1", "D", "w", FUN_OFFSET(Event, d1),
- "d2", "D", "w", FUN_OFFSET(Event, d2),
- "d3", "D", "w", FUN_OFFSET(Event, d3),
- "i2", "J", "w", FUN_OFFSET(Event, i2),
- "i3", "J", "w", FUN_OFFSET(Event, i3),
- "i4", "J", "w", FUN_OFFSET(Event, i4),
- "d4", "D", "w", FUN_OFFSET(Event, d4),
- NULL);
-
- /* process data lines */
- got = 0;
- /* get next line */
- while( fgets(tbuf, SZ_LINE, stdin) ){
- /* ignore comments */
- if( (*tbuf == '\n') || (*tbuf == '#') )
- continue;
- /* point to next buffer to fill */
- ev = &events[got];
- /* parse data record */
- if(sscanf(tbuf, "%d %lf %lf %lf %d %d %d %lf",
- &ev->i1,
- &ev->d1, &ev->d2, &ev->d3,
- &ev->i2, &ev->i3, &ev->i4,
- &ev->d4) != 8)
- break;
- /* got another record */
- got++;
- /* flush this batch of records if necessary */
- if( got == MAXREC ){
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- /* reset record counter */
- got = 0;
- }
- }
- /* final flush */
- if( got ){
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/avg b/funtools/funtest/avg
deleted file mode 100644
index 0ba7500..0000000
--- a/funtools/funtest/avg
+++ /dev/null
@@ -1,2 +0,0 @@
-cur->avg:E=(cur->x+cur->y)/2.0;fprintf(stdout,"%d %d %d %d %f %f\\n",cur->x,cur->y,cur->pha,cur->pi,cur->avg,cur->time);
-
diff --git a/funtools/funtest/bigfits.c b/funtools/funtest/bigfits.c
deleted file mode 100644
index 1762be4..0000000
--- a/funtools/funtest/bigfits.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * bigfits -- test large file creation
- *
- * gcc -g -o bigfits -I $HOME/include -L$HOME/lib bigfits.c -lfuntools
- *
- * gcc -g -o bigfits -I $HOME/include -L$HOME/lib bigfits.c -lfuntools -lm -lsocket -ldl -lnsl
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <funtools.h>
-
-#define MAXX 100
-#define MAXY 100
-#define MAXREC (MAXX*MAXY)
-
-typedef struct EvStruct{
- unsigned int n;
- short x, y;
- unsigned short block;
-} *Event, EventRec;
-
-int main(int argc, char **argv)
-{
- int i, j, n;
- int put;
- unsigned int total=0;
- char *oname;
- Fun fun;
- EventRec events[MAXREC];
- Event ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- if( argc < 3 ){
- fprintf( stderr, "usage: %s oname n\n", argv[0]);
- exit(1);
- }
- oname = argv[1];
- n = atoi(argv[2]);
-
- fprintf(stderr, "writing 10 bytes * %d groups of records * %d times\n",
- MAXREC, n);
-
- /* fill in the records */
- for(j=0; j<MAXY; j++){
- for(i=0; i<MAXX; i++){
- ev = &events[j*MAXY+i];
- ev->x = i;
- ev->y = j;
- ev->n = total++;
- }
- }
-
- /* open output file */
- if( !(fun = FunOpen(oname,"w", NULL)) )
- gerror(stderr, "Could not open the output file: %s\n", oname);
-
- /* set up the (hardwired) columns */
- FunColumnSelect( fun, sizeof(EventRec), NULL,
- "x", "I:0:99", "w", FUN_OFFSET(Event, x),
- "y", "I:0:99", "w", FUN_OFFSET(Event, y),
- "block","I", "w", FUN_OFFSET(Event, block),
- "n", "J", "w", FUN_OFFSET(Event, n),
- NULL);
-
-
- /* write n * MAXREC records */
- for(i=0; i<n; i++){
- /* set block count */
- for(j=0; j<MAXREC; j++){
- ev = &events[j];
- ev->block = i;
- }
- if( (put=FunTableRowPut(fun, events, MAXREC, 0, NULL)) != MAXREC ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- MAXREC, put);
- }
- }
-
- FunClose(fun);
-
- return(0);
-}
diff --git a/funtools/funtest/bpix.ev b/funtools/funtest/bpix.ev
deleted file mode 100644
index 7aecaa8..0000000
--- a/funtools/funtest/bpix.ev
+++ /dev/null
@@ -1,3 +0,0 @@
-SIMPLE = T / file does conform to FITS standard BITPIX = 8 / number of bits per data pixel NAXIS = 0 / number of data axes EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format defined in Astronomy andCOMMENT Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.COMMENT Contact the NASA Science Office of Standards and Technology for the COMMENT FITS Definition document #100 and other FITS information. LONGSTRN= 'OGIP 1.0' / The HEASARC Long String Convention may be used.COMMENT This FITS file may contain long string keyword values that are COMMENT continued over multiple keywords. The HEASARC convention uses the & COMMENT character at the end of each substring which is then continued COMMENT on the next keyword which has the name CONTINUE. ORIGIN = 'ASC ' / Source of FITS file CREATOR = 'acis_build_badpix - Version 1.2' / tool that created this output CHECKSUM= 'PopaQmmXPmmaPmmU' / HDU checksum updated 1999-12-28T03:42:04 DATASUM = ' ' DATE = '1999-12-27T22:42:04' / Date and time of file creation DATE-OBS= '1999-12-11T08:07:57' / Date and time of observation start DATE-END= '1999-12-11T10:41:09' / Date and time of observation stop TIMESYS = 'TT ' / Time system MJDREF = 5.0814000000000E+04 / MJD zero point for times TIMEZERO= 0.0000000000000E+00 / Clock correction TIMEUNIT= 's ' / Time unit CLOCKAPP= T / default TSTART = 6.1286877053705E+07 TSTOP = 6.1296068519518E+07 MISSION = 'AXAF ' / Mission TELESCOP= 'CHANDRA ' / Telescope INSTRUME= 'ACIS ' / Instrument OBS_ID = '550 ' / Observation id OBI_NUM = 0 / Obi number SEQ_NUM = '800058 ' / Sequence number STARTMJF= 66563 STOPMJF = 66563 STARTMNF= 57 STOPMNF = 57 END XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 36 / width of table in bytes NAXIS2 = 3 PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 6 / number of fields in each row EXTNAME = 'BADPIX ' / name of this binary table extension EXTVER = 0 HDUNAME = 'BADPIX0 ' / ASCDM block name TTYPE1 = 'SHAPE ' / region shape TFORM1 = '16A ' / format of field TTYPE2 = 'COMPONENT' / Component number TFORM2 = '1I ' / format of field TLMIN2 = 0 TLMAX2 = 36 LONGSTRN= 'OGIP 1.0' / The HEASARC Long String Convention may be used.COMMENT This FITS file may contain long string keyword values that are COMMENT continued over multiple keywords. The HEASARC convention uses the & COMMENT character at the end of each substring which is then continued COMMENT on the next keyword which has the name CONTINUE. MTYPE1 = 'CHIP ' MFORM1 = 'CHIPX,CHIPY' TTYPE3 = 'CHIPX ' / CHIP X location TFORM3 = '2I ' / format of field TUNIT3 = 'pixel ' TLMIN3 = 1 TLMAX3 = 1024 TTYPE4 = 'CHIPY ' / CHIP Y location TFORM4 = '2I ' / format of field TUNIT4 = 'pixel ' TLMIN4 = 1 TLMAX4 = 1024 TTYPE5 = 'TIME ' / Time pixel went bad TFORM5 = '1D ' / format of field TUNIT5 = 's ' TTYPE6 = 'STATUS ' / Badpixel status code TFORM6 = '16X ' / format of field TUNIT6 = 'coded ' CONTENT = 'BADPIX ' HDUCLASS= 'ASC ' HDUCLAS1= 'REGION ' ORIGIN = 'ASC ' / Source of FITS file CREATOR = 'acis_build_badpix - Version 1.2' / tool that created this output REVISION= 1 / Processing version of data ASCDSVER= 'R4CU4UPD4' / ASCDS version number CHECKSUM= '77ZWB5ZT95ZTA5ZT' / HDU checksum updated 1999-12-28T03:42:04 DATASUM = '2927251180' / data unit checksum updated 1999-12-28T03:42:04 DATE = '1999-12-27T22:42:04' / Date and time of file creation DATE-OBS= '1999-12-11T07:30:44' / Date and time of observation start DATE-END= '1999-12-11T10:47:37' / Date and time of observation stop TIMESYS = 'TT ' / Time system MJDREF = 5.0814000000000E+04 / MJD zero point for times TIMEZERO= 0.0000000000000E+00 / Clock correction TIMEUNIT= 's ' / Time unit TIMEREF = 'LOCAL ' / Time reference (barycenter/local) TASSIGN = 'SATELLITE' / Time assigned by clock CLOCKAPP= T / default TIERRELA= 1.0000000000000E-09 / default TIERABSO= 1.0000000000000E-03 / default TIMVERSN= 'ASC-FITS-2' / Timing system definition TSTART = 6.1284644870344E+07 / Observation start time TSTOP = 6.1296457995772E+07 / Observation end time TIMEPIXR= 5.0000000000000E-01 / default MISSION = 'AXAF ' / Mission TELESCOP= 'CHANDRA ' / Telescope INSTRUME= 'ACIS ' / Instrument DETNAM = 'ACIS-01236' / Detector GRATING = 'NONE ' / Grating OBJECT = 'A2261 ' / Source name TITLE = 'DETERMINATION OF H0/Q0' / Proposal title OBSERVER= ' Leon VanSpeybroeck' / Principal investigator OBS_ID = '550 ' / Observation id OBI_NUM = 0 / Obi number SEQ_NUM = '800058 ' / Sequence number SIM_X = -7.8090834371673E-01 / SIM focus pos (mm) SIM_Y = 0.0000000000000E+00 / SIM orthogonal axis pos (mm) SIM_Z = -2.2578551408009E+02 / SIM translation stage pos (mm) DEFOCUS = 1.4398718632593E-03 / SIM defocus (mm) FOC_LEN = 1.0061620000000E+04 / HRMA focal length (mm) OBS_MODE= 'POINTING' / Observation mode DATAMODE= 'VFAINT ' / Data mode RA_NOM = 2.6067999657378E+02 / Nominal RA DEC_NOM = 3.2121556687915E+01 / Nominal Dec ROLL_NOM= 3.5702297219635E+02 / Nominal Roll EQUINOX = 2.0000000000000E+03 / default RADECSYS= 'ICRS ' / default DATACLAS= 'OBSERVED' / default READMODE= 'TIMED ' CCD_ID = 0 FEP_ID = 0 STARTBEP= 3828670882 STOPBEP = 452862530 HISTNUM = 40 HISTORY TOOL :acis_build_badpix 1999-12-27T22:42:04 ASC00001HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00002HISTORY CONT :08n823/input/acisf061286877N001_pbk0.fits[time=61284644.ASC00003HISTORY CONT :8703440:61296457.9957720] ASC00004HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00005HISTORY CONT :08n823/input/acisf061286877N001_1_berr0.fits[time=612846ASC00006HISTORY CONT :44.8703440:61296457.9957720] ASC00007HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00008HISTORY CONT :08n823/input/acisf061286877N001_2_berr0.fits[time=612846ASC00009HISTORY CONT :44.8703440:61296457.9957720] ASC00010HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00011HISTORY CONT :08n823/input/acisf061286877N001_3_berr0.fits[time=612846ASC00012HISTORY CONT :44.8703440:61296457.9957720] ASC00013HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00014HISTORY CONT :08n823/input/acisf061285682N001_1_bias0.fits ASC00015HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00016HISTORY CONT :08n823/input/acisf061285682N001_2_bias0.fits ASC00017HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00018HISTORY CONT :08n823/input/acisf061285682N001_3_bias0.fits ASC00019HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00020HISTORY CONT :08n823/input/acisf061285682N001_4_bias0.fits ASC00021HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00022HISTORY CONT :08n823/input/acisf061285682N001_5_bias0.fits ASC00023HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00024HISTORY CONT :08n823/input/acisf061286877N001_1_evt0.fits[time=6128464ASC00025HISTORY CONT :4.8703440:61296457.9957720] ASC00026HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00027HISTORY CONT :08n823/input/acisf061286877N001_2_evt0.fits[time=6128464ASC00028HISTORY CONT :4.8703440:61296457.9957720] ASC00029HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00030HISTORY CONT :08n823/input/acisf061286877N001_3_evt0.fits[time=6128464ASC00031HISTORY CONT :4.8703440:61296457.9957720] ASC00032HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00033HISTORY CONT :08n823/input/acisf061286877N001_4_evt0.fits[time=6128464ASC00034HISTORY CONT :4.8703440:61296457.9957720] ASC00035HISTORY PARM :infile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_0626349ASC00036HISTORY CONT :08n823/input/acisf061286877N001_5_evt0.fits[time=6128464ASC00037HISTORY CONT :4.8703440:61296457.9957720] ASC00038HISTORY PARM :outfile=/dsops/ap/sdp/opus/prs_run/tmp//ACIS_F_L1_062634ASC00039HISTORY CONT :908n823/output/acisf00550_000N001_bpix1.fits ASC00040END rectangle
-point
diff --git a/funtools/funtest/cat.ls b/funtools/funtest/cat.ls
deleted file mode 100644
index edad0d1..0000000
--- a/funtools/funtest/cat.ls
+++ /dev/null
@@ -1,3 +0,0 @@
-RA_N DEC_N
----- -----
-216.103 35.665
diff --git a/funtools/funtest/cat.txt b/funtools/funtest/cat.txt
deleted file mode 100644
index f3f9f90..0000000
--- a/funtools/funtest/cat.txt
+++ /dev/null
@@ -1,102 +0,0 @@
- MAG_R ERR_R AMAG_R AERR_R RA_R DEC_R AWORLD_R BWORLD_R THETA_R ELONG_R ELLIP_R FLAGS IMAFLAGS_R CLASS_R DFLAG_R ITFLAG_R MAG_I ERR_I AMAG_I AERR_I RA_I DEC_I AWORLD_I BWORLD_I THETA_I ELONG_I ELLIP_I FLAGS_I IMAFLAGS_I CLASS_I DFLAG_I ITFLAG_I MAG_B ERR_B AMAG_B AERR_B RA_B DEC_B AWORLD_B BWORLD_B THETA_B ELONG_B ELLIP_B FLAGS_B IMAFLAGS_B CLASS_B DFLAG_B ITFLAG_B MAG_K ERR_K AMAG_K AERR_K RA_K DEC_K AWORLD_K BWORLD_K THETA_K ELONG_K ELLIP_K FLAGS_K IMAFLAGS_K CLASS_K DFLAG_K ITFLAG_K NDWFS_NAME RA_N DEC_N
---------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- --------------------- ----------- --------------------- --------------------- -------- ---------- ----------- -------- -------- ------------ --------------------- ---------------------
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.13510000 0.26310000 18.43120000 0.15600000 216.09715930 35.57213060 0.00007240 0.00004195 19.60 1.71600000 0.41700000 0 2 0.73 0 0 'NDWFS_J142' 216.09708333 35.57194444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.76660000 0.29910000 17.34280000 1474.41580000 216.09817510 35.59888400 0.00010407 0.00005839 2.60 1.78100000 0.43900000 0 2 0.72 0 0 'NDWFS_J142' 216.09791667 35.59861111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.36650000 0.25000000 17.76580000 0.30720000 216.09902060 35.21971580 0.00008169 0.00005793 28.60 1.40700000 0.28900000 0 2 0.85 0 0 'NDWFS_J142' 216.09875000 35.21944444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.28660000 0.15500000 16.58530000 733.86490000 216.09955970 35.28452600 0.00011305 0.00006754 59.60 1.68300000 0.40600000 2 0 0.85 0 0 'NDWFS_J142' 216.09916667 35.28444444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.09320000 0.20880000 18.30430000 0.21740000 216.09943570 35.29183850 0.00007158 0.00004246 -15.90 1.69500000 0.41000000 0 0 0.63 0 0 'NDWFS_J142' 216.09916667 35.29166667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.37140000 0.17870000 18.16770000 0.22990000 216.09971980 35.01669160 0.00011426 0.00004636 27.00 2.43500000 0.58900000 0 2 0.80 0 0 'NDWFS_J142' 216.09958333 35.01666667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.31570000 0.21340000 17.68130000 0.25000000 216.09999260 35.19214480 0.00010302 0.00006189 -61.70 1.65500000 0.39600000 0 2 0.63 0 0 'NDWFS_J142' 216.09958333 35.19194444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.36080000 0.16570000 16.22570000 0.15710000 216.09988510 35.19502390 0.00014744 0.00009985 -81.70 1.47300000 0.32100000 0 2 0.93 0 0 'NDWFS_J142' 216.09958333 35.19500000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.88030000 0.25600000 17.59980000 0.39100000 216.09973330 35.19576170 0.00008751 0.00007457 -62.50 1.17100000 0.14600000 0 3 0.88 0 0 'NDWFS_J142' 216.09958333 35.19555556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.39170000 0.13310000 16.16290000 0.14230000 216.09975060 35.28013580 0.00014365 0.00009449 8.40 1.51700000 0.34100000 0 0 0.92 0 0 'NDWFS_J142' 216.09958333 35.28000000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.60370000 0.23180000 17.55830000 0.32320000 216.09968520 35.28498600 0.00010224 0.00004155 -88.90 2.46000000 0.59300000 3 0 0.70 0 0 'NDWFS_J142' 216.09958333 35.28472222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.97840000 0.27470000 18.23860000 0.25370000 216.10010750 35.18600510 0.00007251 0.00004229 -17.80 1.72500000 0.42000000 0 2 0.69 0 0 'NDWFS_J142' 216.10000000 35.18583333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.81420000 0.28980000 17.70800000 0.27940000 216.10025590 35.29139420 0.00007329 0.00005317 -45.70 1.37800000 0.27400000 0 0 0.87 0 0 'NDWFS_J142' 216.10000000 35.29138889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.08290000 0.23650000 17.94080000 0.28240000 216.10065710 35.57122560 0.00007076 0.00004297 -18.30 1.65500000 0.39600000 0 2 0.71 0 0 'NDWFS_J142' 216.10041667 35.57111111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 12.37600000 0.01680000 12.37090000 0.01760000 216.10124780 35.19885350 0.00095540 0.00038518 73.60 2.51600000 0.60300000 0 2 0.03 0 0 'NDWFS_J142' 216.10083333 35.19861111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.24370000 0.11330000 17.42650000 1592.59350000 216.10083490 35.29064640 0.00012447 0.00005848 -19.20 2.15100000 0.53500000 0 0 0.91 0 0 'NDWFS_J142' 216.10083333 35.29055556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.83000000 0.32300000 17.70360000 0.26520000 216.10133800 34.95826030 0.00007250 0.00005436 43.70 1.33400000 0.25000000 0 2 0.85 0 0 'NDWFS_J142' 216.10125000 34.95805556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.77190000 0.28620000 17.87650000 0.29170000 216.10144990 35.20173430 0.00007207 0.00004259 72.10 1.70300000 0.41300000 2 3 0.73 0 0 'NDWFS_J142' 216.10125000 35.20166667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.26210000 0.17380000 16.75050000 0.19380000 216.10134820 35.29164700 0.00017490 0.00005157 8.90 3.34700000 0.70100000 0 0 0.85 0 0 'NDWFS_J142' 216.10125000 35.29138889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.70860000 0.22900000 17.11050000 1374.67970000 216.10137310 35.30623130 0.00010474 0.00004786 -68.70 2.16400000 0.53800000 0 0 0.92 0 0 'NDWFS_J142' 216.10125000 35.30611111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.94260000 0.14750000 15.97520000 966.21800000 216.10130350 35.55450960 0.00014293 0.00008309 68.80 1.73200000 0.42300000 0 2 0.92 0 0 'NDWFS_J142' 216.10125000 35.55444444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.22880000 0.17410000 16.26120000 0.14830000 216.10193030 35.20218600 0.00019437 0.00007964 31.90 2.41700000 0.58600000 3 3 0.76 0 0 'NDWFS_J142' 216.10166667 35.20194444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.78960000 0.23430000 17.80860000 0.22620000 216.10204950 35.30292160 0.00008392 0.00004605 2.70 1.82100000 0.45100000 0 0 0.83 0 0 'NDWFS_J142' 216.10166667 35.30277778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.35260000 0.12330000 17.55090000 0.27000000 216.10175750 35.47289140 0.00009205 0.00008139 26.80 1.13000000 0.11500000 0 2 0.85 0 0 'NDWFS_J142' 216.10166667 35.47277778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 16.95920000 0.14380000 16.23670000 0.14920000 216.10247110 35.20260660 0.00020080 0.00012157 70.50 1.66200000 0.39800000 2 3 0.13 0 0 'NDWFS_J142' 216.10208333 35.20250000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.57470000 0.25850000 17.33640000 0.23240000 216.10228640 35.28054270 0.00010388 0.00004719 0.60 2.20200000 0.54600000 0 0 0.68 0 0 'NDWFS_J142' 216.10208333 35.28027778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.52360000 0.14640000 18.22170000 0.26380000 216.10217080 35.38430610 0.00007025 0.00004248 -71.50 1.64500000 0.39200000 0 2 0.81 0 0 'NDWFS_J142' 216.10208333 35.38416667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.08400000 0.14870000 17.09030000 0.22160000 216.10220130 35.55488380 0.00013776 0.00006684 11.50 2.04900000 0.51200000 0 2 0.94 0 0 'NDWFS_J142' 216.10208333 35.55472222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.26500000 0.11760000 17.96750000 0.17790000 216.10282030 34.73210690 0.00009024 0.00007888 14.50 1.14300000 0.12500000 0 2 0.91 0 0 'NDWFS_J142' 216.10250000 34.73194444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.11960000 0.17590000 17.55840000 0.22260000 216.10253660 35.19448360 0.00009417 0.00006897 1.40 1.36600000 0.26800000 0 3 0.89 0 0 'NDWFS_J142' 216.10250000 35.19444444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.47060000 0.27860000 17.62350000 0.30520000 216.10260060 35.28174800 0.00009675 0.00004524 82.60 2.15100000 0.53500000 0 0 0.79 0 0 'NDWFS_J142' 216.10250000 35.28166667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.40760000 0.17460000 17.59890000 0.26890000 216.10303540 34.29395850 0.00007052 0.00006489 -77.60 1.08600000 0.07900000 0 2 0.79 0 0 'NDWFS_J142' 216.10291667 34.29388889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.18680000 0.18120000 17.73390000 0.28110000 216.10303900 35.29419470 0.00010160 0.00006930 1.20 1.46600000 0.31800000 0 0 0.92 0 0 'NDWFS_J142' 216.10291667 35.29416667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.41820000 0.10170000 23.43920000 0.15290000 216.10321970 35.55618100 0.00029317 0.00009247 -4.20 3.19800000 0.68700000 17 1 0.97 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.55611111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.31060000 0.21270000 25.12690000 1.02380000 216.10299530 35.56239140 0.00020489 0.00003580 1.10 5.72400000 0.82500000 17 0 0.35 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.56222222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.36580000 0.12050000 22.55440000 0.13450000 216.10313020 35.56361750 0.00026410 0.00011304 2.80 2.33300000 0.57100000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.56361111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.11010000 0.09090000 23.13420000 0.13180000 216.10314990 35.56544160 0.00027453 0.00012558 1.70 2.18500000 0.54200000 17 1 0.09 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.56527778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.62550000 0.09970000 24.29360000 0.36680000 216.10314350 35.57564030 0.00025492 0.00007567 1.00 3.37000000 0.70300000 17 1 0.16 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.57555556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 25.60140000 0.31890000 24.44070000 0.29190000 216.10302050 35.57653650 0.00020652 0.00002067 1.10 9.99300000 0.90000000 17 0 0.88 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.57638889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.08790000 0.08890000 23.08530000 0.19240000 216.10310940 35.57869120 0.00027392 0.00013129 1.60 2.08600000 0.52100000 17 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.57861111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.82430000 0.13120000 23.47660000 0.13540000 216.10312650 35.58766990 0.00025613 0.00007497 -0.40 3.42600000 0.70800000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.58750000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.22230000 0.09760000 22.96560000 0.10900000 216.10316590 35.58909380 0.00029230 0.00011063 0.30 2.64500000 0.62200000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.58888889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.22480000 0.13560000 24.11360000 0.18620000 216.10302890 35.59523230 0.00020927 0.00005509 2.00 3.79100000 0.73600000 17 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.59500000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.56600000 0.11270000 23.58960000 0.16480000 216.10315520 35.59752790 0.00025332 0.00009267 1.70 2.73200000 0.63400000 17 1 0.18 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.59750000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.49880000 0.10940000 23.40960000 0.14400000 216.10316850 35.60196610 0.00026664 0.00009218 -0.20 2.89800000 0.65500000 17 1 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60194444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.53500000 0.12240000 23.04380000 0.21500000 216.10312040 35.60639190 0.00023835 0.00011405 -0.50 2.09200000 0.52200000 19 1 0.18 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60638889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.99450000 0.15520000 23.61930000 0.20710000 216.10313570 35.60744430 0.00022686 0.00007500 2.30 3.01900000 0.66900000 17 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60722222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.76650000 0.11670000 23.54120000 0.14370000 216.10314710 35.60886990 0.00024778 0.00007731 0.80 3.20700000 0.68800000 17 1 0.89 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.60861111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.49590000 0.14670000 23.52370000 0.12510000 216.10307940 35.61394420 0.00023171 0.00003898 2.20 5.90800000 0.83100000 17 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.61388889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.16960000 0.09640000 23.21730000 0.13990000 216.10323210 35.61785280 0.00026396 0.00012617 -0.60 2.09500000 0.52300000 1 1 0.92 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.61777778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.64530000 0.11790000 23.04330000 0.18170000 216.10319490 35.62030510 0.00023856 0.00009605 4.40 2.47600000 0.59600000 1 0 0.26 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62027778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 99.00000000 99.00000000 99.00000000 99.00000000 216.10325720 35.62181370 0.00028358 0.00022798 0.10 1.24400000 0.19600000 19 1 0.79 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62166667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.02220000 0.16710000 23.88700000 0.20330000 216.10315180 35.62499450 0.00021952 0.00007597 3.10 2.88200000 0.65300000 1 0 0.07 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62472222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.17360000 0.10480000 23.98670000 0.14540000 216.10322180 35.62849220 0.00022768 0.00003558 1.10 6.39900000 0.84400000 1 0 0.95 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.62833333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.02630000 0.11140000 23.41120000 0.17920000 216.10325010 35.63524110 0.00022449 0.00017035 -3.30 1.31900000 0.24200000 1 0 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.63500000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.19860000 0.18480000 23.94080000 0.23400000 216.10326620 35.63740820 0.00023895 0.00005740 0.30 4.17200000 0.76000000 1 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.63722222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.49890000 0.08490000 23.30410000 0.22340000 216.10330180 35.63841660 0.00025107 0.00017619 -9.60 1.42800000 0.30000000 3 1 0.12 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10291667 35.63833333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.74910000 0.18300000 24.03500000 0.26900000 216.10361760 35.47882210 0.00020518 0.00003580 1.10 5.73200000 0.82600000 16 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.47861111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.96240000 0.15880000 23.71530000 0.16280000 216.10372720 35.48756390 0.00023210 0.00007567 1.90 3.06400000 0.67400000 16 0 0.48 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.48750000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.92660000 0.14040000 23.70900000 0.16070000 216.10374100 35.49100090 0.00023398 0.00007437 1.00 3.14700000 0.68200000 16 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.49083333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.86570000 0.06120000 23.68340000 0.22330000 216.10364530 35.49744030 0.00021667 0.00003566 0.40 6.10400000 0.83600000 17 0 0.70 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.49722222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.58050000 0.13310000 23.28820000 0.13010000 216.10372660 35.50177440 0.00026123 0.00009974 0.80 2.62000000 0.61800000 17 1 0.07 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50166667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.08490000 0.13320000 23.94860000 0.17420000 216.10367110 35.50621720 0.00024243 0.00005758 1.00 4.21100000 0.76300000 17 0 0.90 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50611111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.32560000 0.19650000 23.72540000 0.21320000 216.10359650 35.50692520 0.00021648 0.00005599 -0.70 3.88400000 0.74300000 17 0 0.98 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50666667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.88050000 0.13250000 24.11280000 0.23220000 216.10370050 35.50897060 0.00024864 0.00007279 0.50 3.42000000 0.70800000 17 1 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.50888889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.66070000 0.10920000 23.57340000 0.15250000 216.10367890 35.51212370 0.00027172 0.00007467 0.50 3.64400000 0.72600000 17 1 0.16 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51194444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.66830000 0.15050000 23.43420000 0.22860000 216.10364030 35.51327390 0.00026487 0.00007971 3.20 3.31100000 0.69800000 17 1 0.06 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51305556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.12550000 0.16470000 23.70210000 0.25750000 216.10371870 35.51424200 0.00026735 0.00005722 1.10 4.67400000 0.78600000 17 1 0.92 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51416667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.17270000 0.09700000 22.93480000 0.16450000 216.10363500 35.51761910 0.00027153 0.00012403 2.50 2.18700000 0.54300000 17 1 0.15 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51750000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.61090000 0.14550000 22.83820000 0.16840000 216.10362750 35.51903430 0.00024619 0.00009057 0.50 2.72100000 0.63200000 17 1 0.65 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.51888889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.55040000 0.12990000 23.24900000 0.21390000 216.10366180 35.52225940 0.00027373 0.00009497 3.90 2.87200000 0.65200000 17 1 0.88 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.52222222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.12380000 0.10220000 22.45450000 0.14550000 216.10364590 35.52302200 0.00025053 0.00015179 0.30 1.65100000 0.39400000 17 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.52277778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.58830000 0.16370000 24.15500000 0.16710000 216.10361070 35.53003170 0.00022442 0.00003578 1.10 6.27300000 0.84100000 17 0 0.89 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.53000000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.08160000 0.04220000 23.75330000 0.16300000 216.10358030 35.53074400 0.00022205 0.00007499 0.70 2.96300000 0.66300000 17 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.53055556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.87280000 0.16510000 23.60900000 0.22120000 216.10363410 35.53231760 0.00021965 0.00007813 -0.00 2.81600000 0.64500000 17 0 0.95 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.53222222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.11000000 0.09720000 22.98580000 0.11830000 216.10361290 35.54364710 0.00025632 0.00013770 1.50 1.86100000 0.46300000 17 1 0.93 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.54361111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 20.82180000 0.02080000 20.71470000 0.02680000 216.10370450 35.56077810 0.00048886 0.00025272 -22.50 1.95000000 0.48700000 17 1 0.03 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.56055556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 17.58030000 0.00130000 17.36890000 0.00110000 216.10334380 35.62319770 0.00033090 0.00020283 3.20 1.63000000 0.38700000 3 1 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.62305556
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.40610000 0.14120000 23.81090000 0.12910000 216.10344510 35.65299180 0.00024644 0.00003580 1.10 6.88600000 0.85500000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.65277778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.39090000 0.10870000 23.11050000 0.19470000 216.10343160 35.65442470 0.00026089 0.00010770 0.80 2.42300000 0.58700000 1 1 0.95 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.65416667
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.71920000 0.17780000 24.39350000 0.35580000 216.10338010 35.65957820 0.00020560 0.00003580 1.10 5.74400000 0.82600000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.65944444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.86350000 0.13780000 23.92020000 0.28380000 216.10346210 35.66023030 0.00025436 0.00007504 1.70 3.38600000 0.70500000 1 0 0.90 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66000000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.50600000 0.12360000 23.18130000 0.17580000 216.10359330 35.66095120 0.00028251 0.00010121 -5.60 2.81400000 0.64500000 1 1 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66083333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.92180000 0.14770000 23.51650000 0.25780000 216.10350050 35.66509810 0.00024057 0.00007825 2.00 3.07000000 0.67400000 1 0 0.36 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66500000
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 25.21930000 0.20080000 24.48120000 0.23730000 216.10346590 35.66541600 0.00022758 0.00002067 1.10 11.01200000 0.90900000 1 0 0.98 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66527778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.61580000 0.08470000 22.76280000 0.16630000 216.10369620 35.66742190 0.00033435 0.00018691 2.50 1.78800000 0.44100000 1 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.66722222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.26560000 0.10900000 23.24260000 0.14060000 216.10358100 35.67086270 0.00025350 0.00012662 0.00 2.00400000 0.50100000 1 0 0.12 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.67083333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.69010000 0.20430000 23.92260000 0.23680000 216.10359980 35.67547700 0.00023513 0.00003578 0.50 6.60000000 0.84800000 1 0 0.97 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.67527778
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.31490000 0.15840000 24.63290000 0.58400000 216.10369000 35.68118050 0.00021703 0.00005610 3.00 3.85200000 0.74000000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68111111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.18480000 0.11440000 24.18600000 0.18480000 216.10368830 35.68149850 0.00025489 0.00003550 1.60 7.15000000 0.86000000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68138889
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.45920000 0.11990000 23.09380000 0.19520000 216.10369210 35.68593560 0.00035488 0.00009713 5.40 3.62100000 0.72400000 3 1 0.02 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68583333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.98810000 0.11340000 23.74490000 0.24360000 216.10372860 35.68848010 0.00023211 0.00005613 1.00 4.13600000 0.75800000 1 0 1.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10333333 35.68833333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 18.38050000 0.16340000 17.80220000 0.18380000 216.10403290 34.19493450 0.00007308 0.00004088 -71.00 1.77600000 0.43700000 0 2 0.75 0 0 'NDWFS_J142' 216.10375000 34.19472222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.17280000 0.15380000 18.63080000 0.21720000 216.10389610 34.91720860 0.00007287 0.00004136 20.90 1.75200000 0.42900000 0 2 0.61 0 0 'NDWFS_J142' 216.10375000 34.91694444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.80670000 0.21630000 24.14450000 0.28360000 216.10413590 35.44713750 0.00015807 0.00005502 1.10 2.87300000 0.65200000 16 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.44694444
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.89530000 0.22220000 24.11230000 0.20340000 216.10409950 35.44870530 0.00015264 0.00005273 1.00 2.89600000 0.65500000 16 0 0.99 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.44861111
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 24.06380000 0.12850000 23.90920000 0.17120000 216.10410290 35.44987430 0.00021776 0.00006832 1.30 3.18700000 0.68600000 24 1 0.12 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.44972222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 19.38380000 0.00740000 19.39050000 0.00840000 216.10411610 35.46110670 0.00045521 0.00037135 88.50 1.22600000 0.18400000 27 1 0.08 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 16.68110000 0.08940000 16.44180000 0.13030000 216.10422860 35.46108030 0.00018791 0.00017880 75.50 1.05200000 0.04900000 0 4 0.01 0 0 'NDWFS_J142' 216.10375000 35.46083333
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 22.99500000 0.06540000 24.43990000 0.39150000 216.10381860 35.46729200 0.00019538 0.00003545 2.00 5.48700000 0.81800000 16 0 0.96 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.46722222
- 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 23.34970000 0.11290000 24.80620000 0.58570000 216.10377030 35.47398820 0.00031837 0.00012216 0.80 2.60800000 0.61600000 19 1 0.22 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00 0.00000000 0.00000000 0 0 0.00 0 0 'NDWFS_J142' 216.10375000 35.47388889
diff --git a/funtools/funtest/comm b/funtools/funtest/comm
deleted file mode 100644
index 4f49e6a..0000000
--- a/funtools/funtest/comm
+++ /dev/null
@@ -1,15 +0,0 @@
- double a; # comment
- # comment
- {
- struct foo{
- double sa;
- } foo;
- if( cur->x:D == cur->y:D ) continue;
- a = cur->x;
- /* comment */
- foo.sa = a;
- b = (int)a;
- cur->x = cur->y;
- cur->y = a;
- cur->avg:E = (cur->x+cur->y)/2.0;
- }
diff --git a/funtools/funtest/conf.h.in b/funtools/funtest/conf.h.in
deleted file mode 100644
index e60ee1d..0000000
--- a/funtools/funtest/conf.h.in
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
diff --git a/funtools/funtest/evcol.c b/funtools/funtest/evcol.c
deleted file mode 100644
index 5b6a4cb..0000000
--- a/funtools/funtest/evcol.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * evcol.c -- example program for processing all extensions and adding a
- * column to the binary tables
- *
- */
-#include <funtools.h>
-#include <word.h>
-
-#define MAXROW 8192
-
-typedef struct evstruct{
- char shape[17];
- int mycol;
-} *Ev, EvRec;
-
-int main (int argc, char **argv)
-{
- int i, got;
- int idx;
- int tlmax;
- int ext=1;
- int total=1;
- int haveshape=0;
- char *s[3];
- char tbuf[SZ_LINE];
- Fun fun, fun2;
- Ev ebuf, ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 3 )
- gerror(stderr, "usage: %s iname oname\n", argv[0]);
-
- /* open a new output FITS file */
- if( !(fun2 = FunOpen(argv[2], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* process each input extension in turn */
- for(ext=0; ;ext++){
- /* get new extension name */
- sprintf(tbuf, "%s[%d]", argv[1], ext);
- /* open it -- if we cannot open it, we are done */
- if( !(fun=FunOpen(tbuf, "r", NULL)) )
- break;
-
- /* make the new extension the reference handle for the output file */
- FunInfoPut(fun2, FUN_IFUN, &fun, 0);
-
- /* if its not a binary table, just write it out */
- for(i=0; i<=2; i++) s[i] = NULL;
- if( !(s[0]=FunParamGets(fun, "XTENSION", 0, NULL, &got)) ||
- strcmp(s[0], "BINTABLE")){
- if( s[0] ) free(s[0]);
- FunFlush(fun2, "copy=reference");
- FunClose(fun);
- continue;
- }
- else{
- if( (s[1]=FunParamGets(fun, "EXTNAME", 0, NULL, &got)) ){
- fprintf(stdout, "processing %s", s[1]);
- if( (s[2]=FunParamGets(fun, "HDUNAME", 0, NULL, &got)) )
- fprintf(stdout, " %s", s[2]);
- fprintf(stdout, "\n");
- }
- }
- for(i=0; i<=2; i++) if( s[i] ) free(s[i]);
-
- /* select columns from this new extension for merging */
- /* we have some special code to test various bugs with bpix.fits */
- if( (idx = FunColumnLookup(fun, "SHAPE", 0,
- NULL, NULL, NULL, NULL, NULL, NULL)) ){
- haveshape = 1;
- FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "SHAPE", "16A", "rw", FUN_OFFSET(Ev, shape),
- "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
- NULL);
- }
- else{
- FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
- NULL);
- }
-
- /* we have some special code to test various bugs with bpix.fits */
- /* we need to increase tlmax value of the "component" column */
- if( (idx = FunColumnLookup(fun, "COMPONENT", 0,
- NULL, NULL, NULL, NULL, NULL, NULL)) ){
- if( (tlmax=FunParamGeti(fun, "TLMAX", idx, -1, &got)) && got )
- FunParamPuti(fun2, "TLMAX", idx, tlmax+100, NULL, 0);
- }
-
- /* get input rows (let routine allocate the row array) */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- /* make sure ascii vector is null-terminated */
- ev->shape[16] = '\0';
- /* used with bpix.ev */
- if( haveshape ){
- cluc(ev->shape);
- fprintf(stdout, "\tshape: %s\n", ev->shape);
- }
- ev->mycol = total++;
- }
- /* write out this batch of rows, along with the new column */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* write out one more record with special marker */
- ev = ebuf;
- strcpy(ev->shape, "hexagon ");
- ev->mycol = -1;
- FunTableRowPut(fun2, (char *)ev, 1, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
- /* flush output extension (write padding, etc.) */
- FunFlush(fun2, NULL);
- /* close the input extension */
- FunClose(fun);
- }
-
- /* all done -- close output */
- FunClose(fun2);
- return(0);
-}
diff --git a/funtools/funtest/evcre.c b/funtools/funtest/evcre.c
deleted file mode 100644
index b5b2cd3..0000000
--- a/funtools/funtest/evcre.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- * evcre foo.fits -- test event creation
- *
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <funtools.h>
-
-#define MAXREC 10
-
-typedef struct EvStruct{
- short x[4], *atp;
-} *Event, EventRec;
-
-int main(int argc, char **argv)
-{
- int i, j;
- int val=1;
- int got, put;
- Fun fun;
- EventRec events[MAXREC];
- Event ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- if( argc < 2 ){
- fprintf( stderr, "usage: %s oname\n", argv[0]);
- exit(1);
- }
-
- /* fill in the records */
- got = MAXREC;
- for(i=0; i<got; i++){
- ev = &events[i];
- for(j=0; j<4; j++){
- ev->x[j] = -i-j;
- }
- ev->atp = calloc(10,sizeof(short));
- for(j=0; j<10; j++){
- ev->atp[j] = i+j;
- }
- }
-
- /* open output file */
- if( !(fun = FunOpen(argv[1],"w", NULL)) )
- gerror(stderr, "Could not open the output file: %s\n", argv[1]);
-
- /* set up the (hardwired) columns */
- FunColumnSelect(fun, sizeof(EventRec), NULL,
- "2i", "2I ", "w", FUN_OFFSET(Event, x),
- "2i2", "2I[2]", "w", FUN_OFFSET(Event, x),
- "at2p", "@2I", "w", FUN_OFFSET(Event, atp),
- "at2p4", "@2I[4]", "w", FUN_OFFSET(Event, atp),
- "atp9", "@I[9]", "w", FUN_OFFSET(Event, atp),
- NULL);
-
- /* put these in extension header */
- FunParamPuti(fun, "IPAR", 0, 100, "INTEGER Param", 0);
- FunParamPuti(fun, "IPAR", 1, 101, "INTEGER Param", 0);
- FunParamPutd(fun, "DPAR", 0, 123456789.9876, 12, "DOUBLE Param", 0);
- FunParamPutd(fun, "DPAR", 1, 123456.780, 4, "DOUBLE Param", 0);
- FunParamPuts(fun, NULL, 0, "", NULL, 0);
- FunParamPuts(fun, NULL, 0, "Null param", NULL, 0);
- FunParamPuts(fun, "COMMENT", 0, "This is comment #1", "Comment card", 0);
- FunParamPuts(fun, "COMMENT", 0, "This is comment #2", "Comment card", 0);
- FunParamPuts(fun, "COMMENT", 0, "This is comment #3", "Comment card", 0);
-
- /* put these in primary header */
- val = 1;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0);
- FunParamPuti(fun, "IPAR", 0, -100, "INTEGER Param", 0);
- FunParamPuti(fun, "IPAR", 1, -101, "INTEGER Param", 0);
- FunParamPutd(fun, "DPAR", 0, -123456789.9876, 12, "DOUBLE Param", 0);
- FunParamPutd(fun, "DPAR", 1, -123456.780, 4, "DOUBLE Param", 0);
-
- /* put these in extension header */
- val = 0;
- FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0);
- FunParamPuti(fun, "IPAR", 2, 200, "INTEGER Param", 0);
- /* blank card used as a place holder */
- FunParamPuts(fun, NULL, 0, "IPAR3", "INTEGER Param", 0);
- FunParamPuts(fun, NULL, 0, "IPAR4", "INTEGER Param", 0);
-
- /* put these in primary header */
- FunParamPuti(FUN_PRIMARY(fun), "IPAR", 2, -200, "INTEGER Param", 0);
-
- if( (put=FunTableRowPut(fun, events, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
-
- /* update file after writing data */
- FunParamPuti(fun, "IPAR", 2, 400, "INTEGER Param", 0);
- FunParamPuti(fun, "IPAR", 3, 600, "INTEGER Param", 2);
- /* this will not update because append flag is 1, not 2 */
- FunParamPuti(fun, "IPAR", 4, 800, "INTEGER Param", 1);
- /* this will not update because there was no space saved */
- FunParamPuti(fun, "IPAR", 5, 1000, "INTEGER Param", 2);
-
- /* close file */
- FunClose(fun);
-
-
- /* fill in the records */
- for(i=0; i<got; i++){
- ev = &events[i];
- free(ev->atp);
- }
-
- return(0);
-}
diff --git a/funtools/funtest/evmerge.c b/funtools/funtest/evmerge.c
deleted file mode 100644
index 6b7cebc..0000000
--- a/funtools/funtest/evmerge.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * evmerge.c -- example program for merging user values into a table file
- *
- */
-#include <funtools.h>
-#include <word.h>
-
-#define MAXROW 8192
-
-typedef struct evstruct{
- double time;
- int time2;
-} *Ev, EvRec;
-
-int main (int argc, char **argv)
-{
- int i, got;
- char tbuf[SZ_LINE];
- Fun fun, fun2;
- Ev ebuf, ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 4 )
- gerror(stderr, "usage: %s iname oname mergetype [columns]\n", argv[0]);
-
- /* open input file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* "merge=[type]" merges original input columns with new ones, where type is:
- * update -- add new columns, update value of existing ones (same data type)
- * replace -- add new columns, replace data type and value of existing ones
- * append -- only add new columns, do not "replace" or "update" existing ones
- * If tbuf argument is NULL, no merging is performed -- only user-specified
- * columns are output.
- */
- if( isfalse(argv[3]) )
- *tbuf = '\0';
- else
- sprintf(tbuf, "merge=%s", argv[3]);
- FunColumnSelect(fun, sizeof(EvRec), tbuf,
- "time", "D", "rw", FUN_OFFSET(Ev, time),
- "time2", "J", "w", FUN_OFFSET(Ev, time2),
- NULL);
-
- /* activate specified columns -- these will be written to the output file */
- if( argc >= 5 )
- FunColumnActivate(fun, argv[4], NULL);
-
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ev->time2 = (int)(ev->time+.5);
- ev->time = -(ev->time/10.0);
- }
- /* write out this batch of rows with the new column */
- FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
- /* clean up -- close output before input to perform flush automatically */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/evmerge2.c b/funtools/funtest/evmerge2.c
deleted file mode 100644
index c9b3509..0000000
--- a/funtools/funtest/evmerge2.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * evmerge2.c -- example program for combining extensions from 2 binary tables
- * we write the primary extension of file 1 along with its event extension,
- * and the GTI extension of file2.
- *
- */
-#include <funtools.h>
-#define MAXROW 8192
-
-typedef struct gtistruct{
- double start, stop;
-} *GTI, GTIRec;
-
-/* sample event struct */
-typedef struct evstruct{
- double time;
-} *Ev, EvRec;
-
-int main (int argc, char **argv)
-{
- int i, j;
- int get, got;
- int ngti;
- char *idx;
- char tbuf[SZ_LINE];
- Fun ifun1, ifun2, ofun;
- GTI gtibuf=NULL, gti;
- Ev ebuf=NULL, ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 4 )
- gerror(stderr, "usage: %s iname1 iname2 oname\n", argv[0]);
-
- /* open a new output FITS file */
- if( !(ofun = FunOpen(argv[3], "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* open the primary extension of the event file (file #1) and output it */
- /* first strip off the event extension from the filename */
- strcpy(tbuf, argv[1]);
- if( (idx=strchr(tbuf, '[')) ) *idx = '\0';
- /* add '[0]' to denote primary */
- strcat(tbuf, "[0]");
- /* open primary extension */
- if( !(ifun1 = FunOpen(tbuf, "r", NULL)) )
- gerror(stderr, "could not FunOpen primary extension of file1: %s\n", tbuf);
- /* make this extension the reference handle for the output file */
- FunInfoPut(ofun, FUN_IFUN, &ifun1, 0);
- /* a flush will write primary extension to the output file */
- FunFlush(ofun, "copy=reference");
- /* close primary */
- FunClose(ifun1);
-
- /* open the GTI file (file #2) */
- strcpy(tbuf, argv[2]);
- /* add GTI extension, if user left it off */
- if( !(idx=strchr(tbuf, '[')) ) strcat(tbuf, "[GTI]");
- if( !(ifun2 = FunOpen(tbuf, "r", NULL)) )
- gerror(stderr, "could not FunOpen input GTI file: %s\n", tbuf);
- /* select columns that we need to process */
- /* NB: this is the entire GTI record (start,stop) */
- FunColumnSelect(ifun2, sizeof(GTIRec), NULL,
- "START", "D", "rw", FUN_OFFSET(GTI, start),
- "STOP", "D", "rw", FUN_OFFSET(GTI, stop),
- NULL);
- /* read and store all GTI records for later processing and output */
- ngti = FunParamGeti(ifun2, "NAXIS2", 0, 0, &get);
- gtibuf = FunTableRowGet(ifun2, NULL, ngti, NULL, &got);
-
- /* open the EVENTS extension (file #1) */
- strcpy(tbuf, argv[1]);
- /* add EVENTS extension, if user left it off */
- if( !(idx=strchr(tbuf, '[')) ) strcat(tbuf, "[EVENTS]");
- if( !(ifun1 = FunOpen(tbuf, "r", NULL)) )
- gerror(stderr, "could not FunOpen EVENTS input file: %s\n", tbuf);
- /* we need the time to get the right gti record */
- FunColumnSelect(ifun1, sizeof(EvRec), "merge=update",
- "TIME", "D", "rw", FUN_OFFSET(Ev, time),
- NULL);
- /* make this extension the reference handle for the output file */
- FunInfoPut(ofun, FUN_IFUN, &ifun1, 0);
- /* get input rows (let routine allocate the row array) */
- while( (ebuf = (Ev)FunTableRowGet(ifun1, NULL, MAXROW, NULL, &got)) ){
- /* process each row */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- /* look through gti records for the right one */
- for(j=0; j<ngti; j++){
- gti = gtibuf + j;
- /* if this row is in a good time interval, writ it out */
- if( (ev->time > gti->start) && (ev->time <= gti->stop) ){
- FunTableRowPut(ofun, (char *)ev, 1, i, NULL);
- break;
- }
- }
- }
- /* free row data */
- if( ebuf ) free(ebuf);
- }
- /* flush output extension (write padding, etc.) so we can start next one */
- FunFlush(ofun, NULL);
-
- /* we now write the gti records into the extension following the rows */
- /* make the GTI extension the reference handle for the output file, which
- also sets up the default columns from the input gti file */
- FunInfoPut(ofun, FUN_IFUN, &ifun2, 0);
- /* write the GTI records */
- FunTableRowPut(ofun, (char *)gtibuf, ngti, 0, NULL);
-
- /* close output */
- FunClose(ofun);
- /* close the inputs */
- FunClose(ifun1);
- FunClose(ifun2);
-
- /* free gti buffer */
- if( gtibuf ) free(gtibuf);
- return(0);
-}
diff --git a/funtools/funtest/evnext.c b/funtools/funtest/evnext.c
deleted file mode 100644
index 3050548..0000000
--- a/funtools/funtest/evnext.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * evnext.c -- example program for changing the time of an row to have
- * the value from the next row
- *
- */
-
-#include <funtools.h>
-
-#define MAXROW 100
-
-typedef struct evstruct{
- double time;
-} *Ev, EvRec;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int got, ogot;
- char *oraw;
- char *nraw;
- char *null=NULL;
- Ev ebuf, oebuf=NULL;
- Ev ev, nev, oev;
- Fun fun, fun2;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 3 )
- gerror(stderr, "usage: %s iname oname [columns]\n", argv[0]);
-
- /* open file */
- if( !(fun = FunOpen(argv[1], "r", NULL)) )
- gerror(stderr, "could not FunOpen %s\n", argv[1]);
-
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* specify columns we want */
- got = FunColumnSelect(fun, sizeof(EvRec), "merge=update",
- "time", "1D", "rw", FUN_OFFSET(Ev, time),
- NULL);
- /* activate specified columns -- these will be written to the output file */
- if( argc >= 4 )
- FunColumnActivate(fun, argv[3], NULL);
-
- /* get rows */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- /* process the last row from previous batch, if we have it */
- if( oebuf ){
- /* this is the old array of rows -- we point to the last one */
- oev = oebuf+(ogot-1);
- /* this is the new array of rows -- we point to the first one */
- ev = ebuf;
- /* change time value of old row to new row's value */
- oev->time = ev->time;
- /* now we have to write out this last row */
- /* first, save pointer to the new raw data */
- FunInfoGet(fun, FUN_RAWBUF, &nraw, 0);
- /* put back old pointer so we merge it with last row */
- FunInfoPut(fun, FUN_RAWBUF, &oraw, 0);
- /* write out last row merging with its raw data */
- /* (its arg 4 that tells funtools to merge with the last raw row) */
- FunTableRowPut(fun2, oebuf, 1, ogot-1, NULL);
- /* free up old raw data */
- if( oraw ) free(oraw);
- /* free up old user data */
- if( oebuf ) free(oebuf);
- /* finally, put back new raw data pointer, so we can process new batch */
- FunInfoPut(fun, FUN_RAWBUF, &nraw, 0);
- }
- /* process the got-1 rows by replacing the time with time from
- the succeeding row */
- for(i=0; i<(got-1); i++){
- /* point to the i'th row */
- ev = ebuf+i;
- nev = ebuf+(i+1);
- ev->time = nev->time;
- }
- /* if we processed at least one row this time ... */
- if( got > 1 ){
- /* write out got-1 rows with the raw columns */
- FunTableRowPut(fun2, (char *)ebuf, (got-1), 0, NULL);
- }
- /* if we have a "last" row to process next time ... */
- if( got ){
- /* save the user row for when we have the next batch */
- oebuf = ebuf;
- /* save pointer to raw data */
- FunInfoGet(fun, FUN_RAWBUF, &oraw, 0);
- /* null out rawbuf pointer so Funtools does not free it automatically */
- FunInfoPut(fun, FUN_RAWBUF, &null, 0);
- /* save old value of got */
- ogot = got;
- }
- }
-
- /* clean up last saved batch */
- if( oraw ) free(oraw);
- if( oebuf ) free(oebuf);
-
- /* close and return */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/evread.c b/funtools/funtest/evread.c
deleted file mode 100644
index f93d80c..0000000
--- a/funtools/funtest/evread.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- *
- * evread.c -- example program for reading rows in different ways
- *
- */
-
-#include <funtoolsP.h>
-
-#define MAXROW 10000
-
-extern char *optarg;
-extern int optind;
-
-/* single event (used in array of structs) */
-typedef struct evstruct{
- short region;
- double x, y;
- int pi, pha;
- double time;
- double dx, dy;
-} *Ev, EvRec;
-
-/* arrays of columns (used in struct of arrays) */
-typedef struct aevstruct{
- short region[MAXROW];
- double x[MAXROW], y[MAXROW];
- int pi[MAXROW], pha[MAXROW];
- double time[MAXROW];
- double dx[MAXROW], dy[MAXROW];
-} *AEv, AEvRec;
-
-/* pointers to arrays of columns (used in struct of arrays) */
-typedef struct pevstruct{
- short *region;
- double *x, *y;
- int *pi, *pha;
- double *time;
- double *dx, *dy;
-} *PEv, PEvRec;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int c;
- int got;
- int put;
- int args;
- int ncol;
- int ctype, cn, tcol;
- int doev=0;
- int doseek=0;
- int doualloc=0;
- int nrow;
- int maxrow;
- char tbuf[SZ_LINE];
- char *mode="r";
- char *iname;
- char *oname=NULL;
- char *params=NULL;
- char *cname;
- Fun fun=NULL;
- Fun ofun=NULL;
- void *buf=NULL;
- Ev ev, ebuf=NULL;
- AEv aev, abuf=NULL;
- PEv pev, pbuf=NULL;
- FITSHead header=NULL;
- FunCol *cols;
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "aepusw:")) != -1){
- switch(c){
- case 'a':
- doev = 1;
- params = "org=soa";
- break;
- case 'e':
- doev = 0;
- params = "org=aos";
- break;
- case 'f':
- doev = 3;
- params = "org=aos";
- break;
- case 'p':
- doev = 2;
- params = "org=soa";
- break;
- case 's':
- doseek = 1;
- break;
- case 'u':
- doualloc = 1;
- break;
- case 'w':
- oname = optarg;
- mode = "rw";
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- if( args == 0 )
- iname = "test.ev[EVENTS]";
- else
- iname = argv[optind];
-
- /* open input file */
- if( !(fun = FunOpen(iname, "r", NULL)) ){
- gerror(stderr, "could not FunOpen %s\n", iname);
- exit(1);
- }
-
- /* open output file, if necessary */
- if( oname ){
- if( !(ofun = FunOpen(oname, "w", fun)) ){
- gerror(stderr, "could not FunOpen outout %s\n", oname);
- exit(1);
- }
- }
-
- /* set number of rows to read at once */
- if( doseek )
- maxrow = 1;
- else
- maxrow = MAXROW;
-
- /* display column information from raw data file */
- /* first get fitsy header info */
- FunInfoGet(fun, FUN_HEADER, &header, FUN_COLS, &cols, FUN_NCOL, &ncol, 0);
- if( !header->table ){
- gerror(stderr, "not a table\n");
- exit(1);
- }
- fprintf(stdout, " name\t type\t n\t col\t otype\t scaled\n");
- fprintf(stdout, "-------\t-------\t-------\t-------\t-------\t-------\n");
- for(i=0; i<ncol; i++){
- /* current type info, which might have a changed data type if its scaled */
- if( !FunColumnLookup(fun, NULL, i,
- &cname, &ctype, NULL, NULL, &cn, NULL) ){
- gerror(stderr, "missing column %d\n", i);
- exit(1);
- }
- /* non-negative tcols point to raw columns in FITS table, where we can
- determine the original data type and whether scaling params exist */
- if( (tcol = cols[i]->tcol) >= 0 ){
- fprintf(stdout, "%7s\t%7c\t%7d\t%7d\t%7c\t%7d\n",
- cname, ctype, cn,
- tcol,
- header->table->col[tcol].type,
- header->table->col[tcol].scaled);
- }
- }
- fprintf(stdout, "\n");
-
- /* specify columns we want */
- switch(doev){
- /* array of structs */
- case 0:
- got = FunColumnSelect(fun, sizeof(EvRec), params,
- "x", "D:10:10", mode, FUN_OFFSET(Ev, x),
- "y", "D:10:10", mode, FUN_OFFSET(Ev, y),
- "pha", "J", mode, FUN_OFFSET(Ev, pha),
- "pi", "J", mode, FUN_OFFSET(Ev, pi),
- "time", "1D", mode, FUN_OFFSET(Ev, time),
- "dx", "D:10:10", mode, FUN_OFFSET(Ev, dx),
- "dy", "D:10:10", mode, FUN_OFFSET(Ev, dy),
- "$region", "I", mode, FUN_OFFSET(Ev, region),
- NULL);
- if( doualloc ){
- ebuf = calloc(MAXROW, sizeof(EvRec));
- buf = ebuf;
- }
- break;
- /* struct of arrays */
- case 1:
- got = FunColumnSelect(fun, sizeof(AEvRec), params,
- "x", "D:10:10", mode, FUN_OFFSET(AEv, x),
- "y", "D:10:10", mode, FUN_OFFSET(AEv, y),
- "pha", "J", mode, FUN_OFFSET(AEv, pha),
- "pi", "J", mode, FUN_OFFSET(AEv, pi),
- "time", "1D", mode, FUN_OFFSET(AEv, time),
- "dx", "D:10:10", mode, FUN_OFFSET(AEv, dx),
- "dy", "D:10:10", mode, FUN_OFFSET(AEv, dy),
- "$region", "I", mode, FUN_OFFSET(AEv, region),
- NULL);
- if( doualloc ){
- abuf = calloc(1, sizeof(AEvRec));
- buf = abuf;
- }
- break;
- /* struct of pointers */
- case 2:
- got = FunColumnSelect(fun, sizeof(PEvRec), params,
- "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
- "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
- "pha", "@J", mode, FUN_OFFSET(PEv, pha),
- "pi", "@J", mode, FUN_OFFSET(PEv, pi),
- "time", "@1D", mode, FUN_OFFSET(PEv, time),
- "dx", "@D:10:10", mode, FUN_OFFSET(PEv, dx),
- "dy", "@D:10:10", mode, FUN_OFFSET(PEv, dy),
- "$region", "@I", mode, FUN_OFFSET(PEv, region),
- NULL);
- if( doualloc ){
- pbuf = calloc(1, sizeof(PEvRec));
- pbuf->region = calloc(MAXROW, sizeof(short));
- pbuf->x = calloc(MAXROW, sizeof(double));
- pbuf->y = calloc(MAXROW, sizeof(double));
- pbuf->pi = calloc(MAXROW, sizeof(int));
- pbuf->pha = calloc(MAXROW, sizeof(int));
- pbuf->time = calloc(MAXROW, sizeof(double));
- pbuf->dx = calloc(MAXROW, sizeof(double));
- pbuf->dy = calloc(MAXROW, sizeof(double));
- buf = pbuf;
- }
- break;
- /* array of structs containing pointers */
- case 3:
- got = FunColumnSelect(fun, sizeof(PEvRec), params,
- "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
- "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
- "pha", "@J", mode, FUN_OFFSET(PEv, pha),
- "pi", "@J", mode, FUN_OFFSET(PEv, pi),
- "time", "@1D", mode, FUN_OFFSET(PEv, time),
- "dx", "@D:10:10", mode, FUN_OFFSET(PEv, dx),
- "dy", "@D:10:10", mode, FUN_OFFSET(PEv, dy),
- "$region", "@I", mode, FUN_OFFSET(PEv, region),
- NULL);
- if( doualloc ){
- pbuf = calloc(1, sizeof(PEvRec));
- pbuf->region = calloc(1, sizeof(short));
- pbuf->x = calloc(1, sizeof(double));
- pbuf->y = calloc(1, sizeof(double));
- pbuf->pi = calloc(1, sizeof(int));
- pbuf->pha = calloc(1, sizeof(int));
- pbuf->time = calloc(1, sizeof(double));
- pbuf->dx = calloc(1, sizeof(double));
- pbuf->dy = calloc(1, sizeof(double));
- buf = pbuf;
- }
- break;
- default:
- gerror(stderr, "unknown params value: %d\n", doev);
- break;
- }
-
- /* get rows */
- while( 1 ){
- if( doseek ){
- fprintf(stdout, "Enter row: ");
- fflush(stdout);
- fgets(tbuf, SZ_LINE, stdin);
- nrow = atoi(tbuf);
- if( nrow <=0 ) break;
- if( FunTableRowSeek(fun, nrow, NULL) < 0 ){
- gerror(stderr, "FunTableRowSeek() failed on row %d\n", nrow);
- exit(1);
- }
- }
- buf = (void *)FunTableRowGet(fun, buf, maxrow, NULL, &got);
- if( !buf ) break;
- /* output if necessary */
- if( ofun ){
- if( (put=FunTableRowPut(ofun, buf, got, 0, NULL)) != got ){
- gerror(stderr, "expected to write %d rows; only wrote %d\n",
- got, put);
- }
- }
- /* and display */
- switch(doev){
- case 0:
- for(i=0; i<got; i++){
- ev = (Ev)buf+i;
- fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
- ev->x, ev->y,
- ev->pha, ev->pi,
- ev->time,
- ev->dx, ev->dy,
- (int)ev->region);
- fflush(stdout);
- }
- break;
- case 1:
- aev = (AEv)buf;
- for(i=0; i<got; i++){
- fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
- aev->x[i], aev->y[i],
- aev->pha[i], aev->pi[i],
- aev->time[i],
- aev->dx[i], aev->dy[i],
- (int)aev->region[i]);
- fflush(stdout);
- }
- break;
- case 2:
- pev = (PEv)buf;
- for(i=0; i<got; i++){
- fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
- pev->x[i], pev->y[i],
- pev->pha[i], pev->pi[i],
- pev->time[i],
- pev->dx[i], pev->dy[i],
- (int)pev->region[i]);
- fflush(stdout);
- }
- break;
- case 3:
- for(i=0; i<got; i++){
- pev = (PEv)buf+i;
- fprintf(stdout, "%12.8f %12.8f %4d %4d %18.8f %8.4f %8.4f %4d\n",
- pev->x[0], pev->y[0],
- pev->pha[0], pev->pi[0],
- pev->time[0],
- pev->dx[0], pev->dy[0],
- (int)pev->region[0]);
- fflush(stdout);
- }
- break;
- default:
- gerror(stderr, "unknown params value: %d\n", doev);
- break;
- }
- /* if funtools did allocation, free it now */
- if( !doualloc ){
- if( buf ) xfree(buf);
- buf = NULL;
- }
- }
-
- /* clean up */
- if( doualloc ){
- switch(doev){
- case 0:
- if( ebuf ) xfree(ebuf);
- break;
- case 1:
- if( abuf ) xfree(abuf);
- break;
- case 2:
- if( pbuf->region ) xfree(pbuf->region);
- if( pbuf->x ) xfree(pbuf->x);
- if( pbuf->y ) xfree(pbuf->y);
- if( pbuf->pi ) xfree(pbuf->pi);
- if( pbuf->pha ) xfree(pbuf->pha);
- if( pbuf->time ) xfree(pbuf->time);
- if( pbuf->dx ) xfree(pbuf->dx);
- if( pbuf->dy ) xfree(pbuf->dy);
- if( pbuf ) xfree(pbuf);
- break;
- }
- }
- if( ofun ) FunClose(ofun);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/evreplace.c b/funtools/funtest/evreplace.c
deleted file mode 100644
index 48d2b54..0000000
--- a/funtools/funtest/evreplace.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <funtools.h>
-
-/* if defined, user allocated row buffer, otherwise let funtools do it */
-/* #define USER_ALLOC 1 */
-
-#define MAXROW 100000
-
-typedef struct evstruct{
- double x, y;
- int *phas;
-} *Ev, EvRec;
-
-void Reverse(double x, double y, int *phas,
- double *nx, double *ny, int *nphas, int npha)
-{
- int i;
- *nx = y;
- *ny = x;
- for(i=0; i<npha; i++){
- nphas[npha-(i+1)] = phas[i];
- }
-}
-
-int main(int argc, char **argv)
-{
- int i;
- int got;
- int npha;
- char tbuf[SZ_LINE];
- Ev ebuf, ev, nev;
- Fun fun, fun2;
-
- /* make sure we have minimal arguments */
- if( argc < 3 ){
- fprintf(stderr, "usage: %s iname oname [columns]\n", argv[0]);
- exit(1);
- }
-
- /* exit on gio errors */
- setgerror(2);
-
- /* open input FITS file for reading, and allowing copy of other extensions */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* look for the size of the phas vector */
- if( !FunColumnLookup(fun, "phas", 0, NULL, NULL, NULL, NULL, &npha, NULL) )
- gerror(stderr, "can't find phas column\n");
-
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* allocate a new row buffer, now that we know the size of phas */
- nev = (Ev)calloc(1, sizeof(EvRec));
- nev->phas = (int *)calloc(npha, sizeof(int));
-
- /* create format statement for the pha vector, @ means its a pointer */
- sprintf(tbuf, "@%dJ", npha);
- /* specify input columns we want brought into user space */
- FunColumnSelect(fun, sizeof(EvRec), "merge=replace",
- "$x", "D", "rw", FUN_OFFSET(Ev, x),
- "$y", "D", "rw", FUN_OFFSET(Ev, y),
- "phas", tbuf, "rw", FUN_OFFSET(Ev, phas),
- NULL);
-
- /* set columns to be written to the output file */
- if( argc >= 4 )
- FunColumnActivate(fun, argv[3], NULL);
-
- /* loop through rows and replicate */
- while( (ebuf=(Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
- for(i=0; i<got; i++){
- /* get pointer to the user info containing x,y, phas */
- ev = ebuf+i;
- /* generate a new rows (with new x, y, phas values) */
- Reverse(ev->x, ev->y, ev->phas,
- &(nev->x), &(nev->y), nev->phas, npha);
- /* write this new row -- with the replacements from user space */
- FunTableRowPut(fun2, nev, 1, i, NULL);
- }
- if( ebuf ) free(ebuf);
- }
-
- /* free the new row */
- if( nev ){
- if( nev->phas ) free(nev->phas);
- free(nev);
- }
-
- /* close output before input so that funtools will copy the rest of the
- input extensions to the output (if such copy is requred) */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/evtest.c b/funtools/funtest/evtest.c
deleted file mode 100644
index 975b298..0000000
--- a/funtools/funtest/evtest.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * evmerge.c -- example program for merging user values into a table file
- *
- */
-
-#include <math.h>
-#include <funtools.h>
-
-#define MAXROW 8192
-
-typedef struct evstruct{
- double time;
- double ntime;
- double tinc;
-} *Ev, EvRec;
-
-int main (int argc, char **argv)
-{
- int i, got;
- int maxrow=MAXROW;
- double x=0.5;
- char *tmode;
- char *s;
- Fun fun, fun2;
- Ev ebuf, ev;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* make sure we have minimal arguments */
- if( argc < 3 )
- gerror(stderr, "usage: %s iname oname [columns]\n", argv[0]);
-
- /* get maxrow,if user-specified */
- if( (s=(char *)getenv("FUN_MAXROW")) != NULL )
- maxrow = atoi(s);
-
- /* open input file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* open the output FITS image, inheriting params from input */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* if we have "time2", read it, else create it */
- if( FunColumnLookup(fun, "tinc", 0, NULL, NULL, NULL, NULL, NULL, NULL) )
- tmode = "rw";
- else
- tmode = "w";
-
- FunColumnSelect(fun, sizeof(EvRec), "merge=replace",
- "time", "D", "r", FUN_OFFSET(Ev, time),
- "ntime", "D", "rw", FUN_OFFSET(Ev, ntime),
- "tinc", "D", tmode, FUN_OFFSET(Ev, tinc),
- NULL);
-
- /* activate specified columns -- these will be written to the output file */
- if( argc >= 4 )
- FunColumnActivate(fun, argv[3], NULL);
-
- /* get rows -- let routine allocate the row array */
- while( (ebuf = (Ev)FunTableRowGet(fun, NULL, maxrow, NULL, &got)) ){
- /* process all rows */
- for(i=0; i<got; i++){
- /* point to the i'th row */
- ev = ebuf+i;
- ev->tinc += (i*sqrt(cos(x)*cos(x) + sin(x)*sin(x)));
- ev->ntime = ev->time + ev->tinc;
- /* write out row with the new columns */
- FunTableRowPut(fun2, (char *)ev, 1, i, NULL);
- }
- /* free row data */
- if( ebuf ) free(ebuf);
- }
-
- /* clean up -- close output before input to perform flush automatically */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/fctest b/funtools/funtest/fctest
deleted file mode 100755
index ad9d34d..0000000
--- a/funtools/funtest/fctest
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-set -x
-
-funcnts $* | awk 'start==1{print $0};/^---- ------------ ---------$/{start=1}'
diff --git a/funtools/funtest/filt.c b/funtools/funtest/filt.c
deleted file mode 100644
index 37c5ccf..0000000
--- a/funtools/funtest/filt.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* NB: for pre-funtools.1.0.b24:
- * copy pixels.h from funtools/filter/pixels.h to your include directory
- */
-
-/*
- *
- * On Linux:
- * gcc -o filt filt.c -I<install>/include -L<install>/lib -lfuntools -ldl -lm
- *
- * Run example:
- *
- * filt funtest/test.ev @foo
- *
- * where foo is a file containing:
- * circle 1 1 .1
- * circle 3 3 .1
- * circle 5 5 .1
- * circle 7 7 .1
- */
-
-#include <funtools.h>
-#include <filter.h>
-#include <swap.h>
-
-#define MAXROW 10000
-
-typedef struct evstruct{
- double x, y;
-} *Ev, EvRec;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int got;
- int rawsize;
- int endian;
- int *rbuf;
- char *fname=NULL;
- char *region=NULL;
- char *rawbuf;
- char *bincols;
- char tbuf[SZ_LINE];
- Fun fun;
- Ev ebuf, ev;
- FITSHead header;
- Filter filt;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* process args */
- if( argc < 3 )
- gerror(stderr, "usage: filt fname region\n");
- else{
- fname = argv[1];
- region = argv[2];
- }
-
- /* open input file */
- if( !(fun = FunOpen(fname, "r", NULL)) ){
- gerror(stderr, "could not FunOpen %s\n", fname);
- }
- /* specify columns we want, as usual */
- got = FunColumnSelect(fun, sizeof(EvRec), NULL,
- "x", "D", "r", FUN_OFFSET(Ev, x),
- "y", "D", "r", FUN_OFFSET(Ev, y),
- NULL);
-
- /* FILTER STUFF: get fitsy header and some other information for filtering */
- FunInfoGet(fun,
- FUN_ENDIAN, &endian,
- FUN_HEADER, &header,
- FUN_RAWSIZE, &rawsize,
- FUN_BINCOLS, &bincols,
- 0);
-
- /* FILTER STUFF: make up the filter mode for FilterOpen() specifying:
- 1. event processing
- 2. the binning column names (needed for region processing)
- 3. whether we have to convert raw data to native format
- */
- /* event (not image) filtering */
- strcpy(tbuf, "type=events");
- /* add the binning key -- required for region filtering */
- if( bincols ){
- strcat(tbuf, ",");
- strcat(tbuf, bincols);
- }
- /* filter code should convert data to native format if its not already */
- if( is_bigendian() == endian )
- strcat(tbuf, ",convert=false");
- else
- strcat(tbuf, ",convert=true");
-
- /* FILTER STUFF: allocate return filter buffer for FilterOpen() */
- rbuf = (int *)malloc(MAXROW*sizeof(int));
-
- /* FILTER STUFF: FilterOpen: new filter that will return region ids or 0 */
- if( !(filt = FilterOpen(header, region, tbuf)) )
- gerror(stderr, "can't open region filter: %s", region);
-
- /* get events */
- while( (ebuf=(Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-
- /* FILTER STUFF: get pointer to current raw buffer of events to filter */
- FunInfoGet(fun, FUN_RAWBUF, &rawbuf, 0);
-
- /* FILTER STUFF: filter the raw events we just read -- answers in rbuf */
- if( FilterEvents(filt, rawbuf, rawsize, got, rbuf) ){
-
- /* loop through events, process them based on returned region value */
- for(i=0; i<got; i++){
- ev = ebuf+i;
- /* FILTER STUFF: rbuf[i] is:
- 0 if we failed filter
- -1 if we passed filter but its not in a region
- +n if we passed filter in a region (n is region id)
- */
- if( rbuf[i] > 0 )
- fprintf(stdout, "YES %d\t%.2f\t%.2f\n", rbuf[i], ev->x, ev->y);
- else
- fprintf(stdout, "NO %d\t%.2f\t%.2f\n", rbuf[i], ev->x, ev->y);
- fflush(stdout);
- }
- }
- /* free for next read */
- if( ebuf ) free(ebuf);
- }
-
- /* free up space */
- if( rbuf ) free(rbuf);
-
- /* close filter */
- if( filt ) FilterClose(filt);
-
- /* close file */
- FunClose(fun);
-
- return(0);
-}
diff --git a/funtools/funtest/funcalc.sed b/funtools/funtest/funcalc.sed
deleted file mode 100644
index d9f3b18..0000000
--- a/funtools/funtest/funcalc.sed
+++ /dev/null
@@ -1,11 +0,0 @@
-# cc <foo.c> 2>&1 | sed -n -f funauto.sed
-# Linux gcc (and others)
-s/.*[`'‘]\([^)]*\)['’] *undeclared (first use in this function).*/\1/p
-# Solaris cc
-s/.*undefined symbol: \([^)]*\)/\1/p
-# Dec Alpha/OSF cc
-s/.*In this statement, "\([^)]*\)" is not declared.*/\1/p
-# SGI cc
-s/.*The identifier "\([^)]*\)" is undefined.*/\1/p
-# Intel icc
-s/.*identifier "\([^)]*\)" is undefined.*/\1/p
diff --git a/funtools/funtest/funcheck b/funtools/funtest/funcheck
deleted file mode 100755
index c5b0a43..0000000
--- a/funtools/funtest/funcheck
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if [ x$1 != x ]; then
- FILE=$1
- echo "checking $FILE ..."
-else
- echo "checking stdin ..."
-fi
-
-egrep -v 'REV|EXACT|SUM|OPROG|NPROG|FILE|block factor does|0a1,2|\*\*\*|^ *$|^foo|idx|^tboxell|^\)|^HERE\)\]' $FILE
diff --git a/funtools/funtest/funchecks b/funtools/funtest/funchecks
deleted file mode 100755
index 44c5d7b..0000000
--- a/funtools/funtest/funchecks
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-for file in foo.[in][cdpt]*
-do
- funcheck $file
-done
diff --git a/funtools/funtest/funcones b/funtools/funtest/funcones
deleted file mode 100755
index fcf2457..0000000
--- a/funtools/funtest/funcones
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-# fundisp keyfile | funcones [datafile] [radius]
-set -x
-
-# first argument: input file name
-if [ x$1 = x ]; then
- echo "usage: $0 file < keyfile"
- exit 1
-else
- FILE=$1
- OBASE=`basename $FILE | awk -F. '{x=NF-1;print $x}'`
- shift
-fi
-
-# second argument: input file's RA column name and units
-if [ x$1 = x ]; then
- RACOL="RA:h"
-else
- RACOL=$1
- shift
-fi
-
-# third argument: input file's DEC column name and units
-if [ x$1 = x ]; then
- DECCOL="DEC:d"
-else
- DECCOL=$1
- shift
-fi
-
-# fourth optional arg: radius
-if [ x$1 = x ]; then
- RAD=".1d"
-else
- RAD=$1
-fi
-
-# make sure input file is available
-if [ ! -r $FILE ]; then
- echo "ERROR: $FILE not found"
- exit 1
-fi
-
-# read column names
-read COLS
-# skip dashes
-read DASHES
-
-i=1
-# read each line into its column names
-while read $COLS
-do
-# output filename just has a number id
- OFILE=${OBASE}_${i}.mat
-# display relationship between id and ra, dec
- echo "${OFILE} ${RA} ${DEC} ${SEP}"
-# specific funcone command line goes here (add unit specifiers, etc.)
-funcone -r ${RACOL} -d ${DECCOL} ${FILE}'[1]' ${OFILE} ${RA}d ${DEC} ${RAD}
-# exit
- i=`echo "$i+1" | bc`
-done
diff --git a/funtools/funtest/fundisp1out b/funtools/funtest/fundisp1out
deleted file mode 100644
index e69de29..0000000
--- a/funtools/funtest/fundisp1out
+++ /dev/null
diff --git a/funtools/funtest/funsky.c b/funtools/funtest/funsky.c
deleted file mode 100644
index 0151235..0000000
--- a/funtools/funtest/funsky.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-/* gcc -g -o funsky funsky.c -I $HOME/include -L$HOME/lib -lfuntools
- -ldl -lnsl -lsocket -lm
- */
-
-#include <funtoolsP.h>
-#include <strtod.h>
-
-extern char *optarg;
-extern int optind;
-
-#define X__PI 3.14159265358979323846
-#define X_2PI ( 2 * X__PI )
-#define X_R2D (X_2PI / 360.0)
-#define X_R2H (X_2PI / 24.0)
-#define X_H2D (360.0 / 24.0)
-
-#define r2h(r) ( (r) / X_R2H )
-#define h2r(d) ( (d) * X_R2H )
-#define r2d(r) ( (r) / X_R2D )
-#define d2r(d) ( (d) * X_R2D )
-#define h2d(r) ( (r) * X_H2D )
-#define d2h(d) ( (d) / X_H2D )
-
-#ifdef ANSI_FUNC
-void usage(char *s)
-#else
-void usage(s)
- char *s;
-#endif
-{
- fprintf(stderr, "usage: [switches] %s fname[ext]\n", s);
- fprintf(stderr, "\n");
- fprintf(stderr, "switches:\n");
- fprintf(stderr, "-d\t# always use integer tlmin conversion (as ds9 does)\n");
- fprintf(stderr, "-r\t# convert x,y to RA,Dec (default: convert RA,Dec to x,y)\n");
- fprintf(stderr, "-v\t# display input values also (default: display output only)\n");
- fprintf(stderr, "-T\t# output display in rdb format\n");
- fprintf(stderr, "\n");
- fprintf(stderr, "Pairs of space- or comma-delimited numeric values are input to stdin.\n");
- fprintf(stderr, "By default, input RA and Dec are converted into x and y. (Use the\n");
- fprintf(stderr, "-r to convert from x,y to RA,Dec.) When RA and Dec are input, \n");
- fprintf(stderr, "floating point numbers are degrees, but h:m:s, d:m:s also are valid.\n");
- fprintf(stderr, "The coord. system is taken from the header (might differ from ds9).\n");
- fprintf(stderr, "NB: x,y values are physical coords for event data, image coords\n");
- fprintf(stderr, "for image data.\n");
- fprintf(stderr, "\n");
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int ip;
- int type;
- int offscl;
- int verbose=0;
- int dods9=0;
- int skytopix=1;
- int tltyp[2];
- double dval1, dval2, dval3, dval4;
- double tlmin[2];
- double binsiz[2];
- char sp=' ';
- char iname[SZ_LINE];
- char lbuf[SZ_LINE];
- char tbuf1[SZ_LINE];
- char tbuf2[SZ_LINE];
- char *s0, *s1;
- Fun fun;
- void *wcs;
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "drvT")) != -1){
- switch(c){
- case 'd':
- dods9=1;
- break;
- case 'r':
- skytopix=0;
- break;
- case 'v':
- verbose=1;
- break;
- case 'T':
- sp = '\t';
- break;
- default:
- break;
- }
- }
-
- /* check for required arguments */
- if( (argc - optind) != 1 ){
- usage(argv[0]);
- }
-
- /* input file name */
- strcpy(iname, argv[optind+0]);
-
- /* open input file */
- if( !(fun = FunOpen(iname, "r", NULL)) ){
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n", iname);
- }
-
- /* get wcs info */
- FunInfoGet(fun, FUN_WCS, &wcs, FUN_TYPE, &type, 0);
-
- /* for tables, we need some extra column info */
- switch(type){
- case FUN_TABLE:
- case FUN_EVENTS:
- s0 = fun->header->table->col[fun->bin[0]].name;
- s1 = fun->header->table->col[fun->bin[1]].name;
- if( s0 ){
- FunColumnLookup(fun, s0, 0, NULL, &tltyp[0], NULL, NULL, NULL, NULL);
- FunColumnLookup2(fun, s0, 0, &tlmin[0], NULL, &binsiz[0], NULL, NULL);
- }
- else{
- tlmin[0] = 0;
- binsiz[0] = 0;
- tltyp[0] = 'I';
- }
- if( s1 ){
- FunColumnLookup(fun, s1, 0, NULL, &tltyp[1], NULL, NULL, NULL, NULL);
- FunColumnLookup2(fun, s1, 0, &tlmin[1], NULL, &binsiz[1], NULL, NULL);
- }
- else{
- tlmin[1] = 0;
- binsiz[1] = 0;
- tltyp[1] = 'I';
- }
- break;
- default:
- break;
- }
-
- if( dods9 ){
- tltyp[0] = 'J';
- tltyp[1] = 'J';
- }
-
- if( !iswcs(wcs) ){
- gerror(stderr, "could not load WCS information from header: %s\n", iname);
- }
-
- /* output header if necessary */
- if( sp == '\t' ){
- if( skytopix ){
- if( verbose ) fprintf(stdout, " RA\t Dec\t");
- fprintf(stdout, " X\t Y\n");
- if( verbose ) fprintf(stdout, "------------\t------------\t");
- fprintf(stdout, "------------\t------------\n");
- }
- else{
- if( verbose ) fprintf(stdout, " X\t Y\t");
- fprintf(stdout, " RA\t Dec\n");
- if( verbose ) fprintf(stdout, "------------\t------------\t");
- fprintf(stdout, "------------\t------------\n");
- }
- fflush(stdout);
- }
-
- /* read lines, split into 2 args, convert, and output */
- newdtable(",");
- while( fgets(lbuf, SZ_LINE, stdin) ){
- ip = 0;
- if( !word(lbuf, tbuf1, &ip) || !word(lbuf, tbuf2, &ip) ) break;
- dval1 = SAOstrtod(tbuf1,NULL);
- if( (SAOdtype !=0) && (SAOdtype != '.') && (SAOdtype != 'd') ){
- dval1 = h2d(dval1);
- }
- dval2 = SAOstrtod(tbuf2,NULL);
- if( skytopix ){
- wcs2pix(wcs, dval1, dval2, &dval3, &dval4, &offscl);
- if( verbose ) fprintf(stdout, "%12.6f%c%12.6f%c", dval1, sp, dval2, sp);
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- fprintf(stdout, "%12.2f%c%12.2f\n", dval3, sp, dval4);
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- dval3 = tli2p(dval3, tlmin[0], binsiz[0], tltyp[0]);
- dval4 = tli2p(dval4, tlmin[1], binsiz[1], tltyp[1]);
- fprintf(stdout, "%12.2f%c%12.2f\n", dval3, sp, dval4);
- break;
- default:
- gerror(stderr, "unknown FITS data type\n");
- break;
- }
- fflush(stdout);
- }
- else{
- switch(type){
- case FUN_IMAGE:
- case FUN_ARRAY:
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- dval1 = tlp2i(dval1, tlmin[0], binsiz[0], tltyp[0]);
- dval2 = tlp2i(dval2, tlmin[1], binsiz[1], tltyp[1]);
- break;
- default:
- gerror(stderr, "unknown FITS data type\n");
- break;
- }
- pix2wcs(wcs, (double)dval1, (double)dval2, &dval3, &dval4);
- if( verbose ) fprintf(stdout, "%12.2f%c%12.2f%c", dval1, sp, dval2, sp);
- fprintf(stdout, "%12.6f%c%12.6f\n", dval3, sp, dval4);
- fflush(stdout);
- }
- }
- freedtable();
-
- /* close up shop */
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/funstack b/funtools/funtest/funstack
deleted file mode 100755
index bbcfc3d..0000000
--- a/funtools/funtest/funstack
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-if [ x"$3" = x ]; then
- echo "usage: $0 ifile ofile regions"
- echo "The regions specification should be in physical coords and can be:"
- echo " a region string e.g. 'circle 512 512 .1;box(606,606,3,4)'"
- echo " a region file e.g. 'foo.reg' (nb: s9 file OK, but no @ prefix)"
- exit 1
-fi
-
-# input parameters
-IFILE=$1
-OFILE=$2
-REGIONS=$3
-
-# temporary fits file
-TFITS=./tfunstack.fits
-rm -f ${TFITS}
-
-# temporary funcalc command file
-TFC=./tfunstack.fc
-rm -f ${TFC}
-
-# convert file to region string, if necessary
-if [ -r "${REGIONS}" ]; then
- REGIONS=`cat ${REGIONS} | awk '{print $0";"}'`
-fi
-
-# generate the funcalc command file from region string
-# we do this so that awk can parse the region and add in the region centers
-echo "${REGIONS}" | \
-sed '/^physical/d;s/[\(\),]/ /g' | \
-sed '/^#/d;/^global/d' | \
-awk 'BEGIN{RS=";"};
-BEGIN{
- print "local"
- print "int nreg;"
- print "int xdim, ydim;"
- print "double xmin, xmax, umin, ymax;"
- print "double xref, yref;"
- print "double xreg[1024], yreg[1024];"
- print "end"
- print "before"
- print "FunInfoGet(fun, FUN_SECT_DIM1, &xdim, FUN_SECT_DIM2, &ydim, 0);"
- print "FunInfoGet(fun, FUN_MIN1, &xmin, FUN_MAX1, &xmax, 0);"
- print "FunInfoGet(fun, FUN_MIN2, &ymin, FUN_MAX2, &ymax, 0);"
- print "xref = (xmin + xmax)/2.0;"
- print "yref = (ymin + ymax)/2.0;"
- i=1
-};
-{
- if( ($1!="polygon") && ($1!="pie") ){
- if( ($2 != "") && ($3 != "") ){
- print "xreg["i"]="$2";"
- print "yreg["i"]="$3";"
- i = i+1
- }
- if( i >= 1024 ){
- printf "ERROR: too many regions (1024 max)" > "dev/stderr"
- exit
- }
- }
-}
-END{
- print "nreg="i-1";"
- print "end"
- print "if( cur->region > nreg ){"
- print " gerror(stderr, \"%d exceeds input reg %d\\n\", cur-> region, nreg);"
- print " exit(1);"
- print "}"
- print "cur->x = cur->x - xreg[cur->region] + xref;"
- print "cur->y = cur->y - yreg[cur->region] + yref;"
-}' > ${TFC}
-
-# funtools seems to rearrange the order of columns when $REGION is specified
-# so here we get the column names explicitly to preserve order
-COLS=`funhead ${IFILE} | egrep 'TTYPE[0-9]' | awk '{print $3}' | sed "s/'//g"`
-
-# first filter the input file and preserve the region ids
-funtable ${IFILE}"[${REGIONS}]" ${TFITS} "${COLS} "'$REGION'
-
-# now run the funcalc script to stack the events
-funcalc -f ${TFC} ${TFITS} ${OFILE}
-
-# clean up
-rm -f ${TFC} ${TFITS}
diff --git a/funtools/funtest/funtest b/funtools/funtest/funtest
deleted file mode 100755
index c2515ec..0000000
--- a/funtools/funtest/funtest
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/bin/sh
-
-TEXT=0
-CONTAINED=0
-DYNAMIC=0
-PROCESS=0
-
-INDEX=0
-NOINDEX=0
-
-ROOT=foo
-
-while [ x"$1" != x ]; do
- case $1 in
- -a0)
- DYNAMIC=1
- INDEX=1
- NOINDEX=1
- shift
- continue;;
-
- -a1)
- DYNAMIC=1
- PROCESS=1
- INDEX=1
- NOINDEX=1
- shift
- continue;;
-
- -a2)
- DYNAMIC=1
- PROCESS=1
- CONTAINED=1
- INDEX=1
- NOINDEX=1
- shift
- continue;;
-
- -a3)
- DYNAMIC=1
- PROCESS=1
- CONTAINED=1
- TEXT=1
- INDEX=1
- NOINDEX=1
- shift
- continue;;
-
- -b)
- INDEX=1
- NOINDEX=1
- shift
- continue;;
-
- -c)
- CONTAINED=1
- shift
- continue;;
-
- -d)
- DYNAMIC=1
- shift
- continue;;
-
- -i)
- INDEX=1
- shift
- continue;;
-
- -n)
- NOINDEX=1
- shift
- continue;;
-
- -p)
- PROCESS=1
- shift
- continue;;
-
- -t)
- TEXT=1
- shift
- continue;;
-
- -z)
- FILTER_PAINT=true
- export FILTER_PAINT
- shift
- continue;;
-
- *)
- shift
- continue;;
- esac
-done
-
-if [ $TEXT = 0 -a $CONTAINED = 0 -a $DYNAMIC = 0 -a $PROCESS = 0 ]; then
- DYNAMIC=1
- PROCESS=1
- TEXT=1
-fi
-
-if [ $INDEX = 0 -a $NOINDEX = 0 ]; then
- INDEX=1
-fi
-
-echo " "
-echo "dynamic=$DYNAMIC text=$TEXT process=$PROCESS contained=$CONTAINED"
-echo "index=$INDEX noindex=$NOINDEX"
-if [ x$FILTER_PAINT = xtrue ]; then
- X=z
- echo "filter paint mode is on"
-else
- X=""
-fi
-echo "testing against old funcnts: `which funcnts`"
-echo "making evread ..."
-make evread
-echo " "
-
-FILTER_IDX_DEBUG=0
-export FILTER_IDX_DEBUG
-
-if [ x$DYNAMIC = x1 ]; then
- echo "dynamic ..."
- FILTER_PTYPE=d
- export FILTER_PTYPE
- if [ x$INDEX = x1 ]; then
- echo "with index ..."
- date
- FILTER_IDX_ACTIVATE=1
- export FILTER_IDX_ACTIVATE
- ./funtests $* >${ROOT}.id$X 2>&1
- if [ x$TEXT = x1 ]; then
- echo "... and with text ..."
- date
- ./funtexts > ${ROOT}.it$X 2>&1
- fi
- fi
- if [ x$NOINDEX = x1 ]; then
- echo "no index ..."
- date
- FILTER_IDX_ACTIVATE=0
- export FILTER_IDX_ACTIVATE
- ./funtests $* >${ROOT}.nd$X 2>&1
- if [ x$TEXT = x1 ]; then
- echo "... and with text ..."
- date
- ./funtexts > ${ROOT}.nt$X 2>&1
- fi
- fi
-fi
-
-if [ x$PROCESS = x1 ]; then
- echo "process ..."
- FILTER_PTYPE=p
- export FILTER_PTYPE
- if [ x$INDEX = x1 ]; then
- echo "with index ..."
- date
- FILTER_IDX_ACTIVATE=1
- export FILTER_IDX_ACTIVATE
- ./funtests $* >${ROOT}.ip$X 2>&1
- fi
- if [ x$NOINDEX = x1 ]; then
- echo "no index ..."
- date
- FILTER_IDX_ACTIVATE=0
- export FILTER_IDX_ACTIVATE
- ./funtests $* >${ROOT}.np$X 2>&1
- fi
-fi
-
-if [ x$CONTAINED = x1 ]; then
- echo "contained ..."
- FILTER_PTYPE=c
- export FILTER_PTYPE
- if [ x$INDEX = x1 ]; then
- echo "with index ..."
- date
- FILTER_IDX_ACTIVATE=1
- export FILTER_IDX_ACTIVATE
- ./funtests $* >${ROOT}.ic$X 2>&1
- fi
- if [ x$NOINDEX = x1 ]; then
- echo "no index ..."
- date
- FILTER_IDX_ACTIVATE=0
- export FILTER_IDX_ACTIVATE
- ./funtests $* >${ROOT}.nc$X 2>&1
- fi
-fi
-
-echo "done"
-date
diff --git a/funtools/funtest/funtesti b/funtools/funtest/funtesti
deleted file mode 100755
index e84c770..0000000
--- a/funtools/funtest/funtesti
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/tcsh -f
-rm -f foo.idx foo.noidx
-
-# setenv FILTER_PTYPE c
-setenv FILTER_IDX_DEBUG 0
-
-setenv FILTER_IDX_ACTIVATE 1
-date >> foo.idx
-funtests >>& foo.idx
-date >> foo.idx
-
-setenv FILTER_IDX_ACTIVATE 0
-date > foo.noidx
-funtests >>& foo.noidx
-date >> foo.noidx
-
-
-
diff --git a/funtools/funtest/funtests b/funtools/funtest/funtests
deleted file mode 100755
index df7079f..0000000
--- a/funtools/funtest/funtests
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/bin/sh
-# set -x
-
-ARGS=$*
-
-echo "************** Executing tfundisp with regions **************"
-echo " "
-tfundisp $ARGS < tregions.in
-
-echo "************** Executing tfundisp with boxes, ellipses **************"
-echo " "
-tfundisp $ARGS < tboxell.in
-
-echo "************** Executing tfundisp with columns **************"
-echo " "
-tfundisp $ARGS < tcols.in
-
-echo "************** Executing tfunhead **************"
-echo " "
-tfunhead $ARGS < thead.in
-
-echo "************** Executing tfuncalc **************"
-echo " "
-tfuncalc < tcalc.in
-
-echo "************** Executing tfunmerge **************"
-echo " "
-tfunmerge < tmerge.in
-
-echo "************** Executing tfuncone **************"
-echo " "
-tfuncone < tcone.in
-
-echo "************** Executing tfuncnts **************"
-echo " "
-tfuncnts $ARGS < tregions.in
-
-echo "************** Executing tfuncnts with filter **************"
-echo " "
-tfuncnts $ARGS -b "pha=5:7&&pi=6:8" < tregions.in
-
-echo "************** Executing tfuncnts with boxes, ellipses **************"
-echo " "
-tfuncnts $ARGS < tboxell.in
-
-echo "************** Executing tfundisp with paren checks **************"
-echo " "
-tfundisp $ARGS < tparen.in
-
-echo "************** Executing tfundisp with filter **************"
-echo " "
-tfundisp $ARGS -b "pha=5:7&&pi=6:8&&" < tregions.in
-
-echo "************** Executing tfundisp w/include file **************"
-echo " "
-tfundisp -i -b "pha=5:7&&pi=6:8&&" $ARGS < tregions.in
-
-echo "************** Executing timev [*,*,2] **************"
-echo " "
-
-timev $ARGS -b "[*,*,2]" < tregions.in
-
-echo "************** Executing timev [*,*,3] **************"
-echo " "
-timev $ARGS -b "[*,*,3]" < tregions.in
-
-echo "************** Executing timev [404:603,412:611] **************"
-echo " "
-timev $ARGS -b "[404:603,412:611]" < tregions.in
-
-echo "************** Executing timev [404:603,412:611,2] **************"
-echo " "
-timev $ARGS -b "[404:603,412:611,2]" < tregions.in
-
-echo "************** Executing timev [404:603,412:611,3] **************"
-echo " "
-timev $ARGS -b "[404:603,412:611,3]" < tregions.in
-
-echo "************** Executing tfuncnts, blocked w/phys. coords **********"
-echo " "
-tfuncnts -f1 ${HOME}/data/snr2.fits -c physical $ARGS < tregions.in
-
-echo "************** Executing tfuncnts on files **************"
-echo " "
-tfuncnts $ARGS < tfile.in
-
-echo "************** Executing tfundisp on files **************"
-echo " "
-tfundisp $ARGS < tfile.in
-
-echo "************** Executing tfundisp w/include file **************"
-echo " "
-tfundisp -i -b "pha=5:7&&pi=6:8&&" $ARGS < tfile.in
-
-echo "************** Executing tfundisp with filter2 **************"
-echo " "
-tfundisp $ARGS -b "(pha=5:7||pi=6:8)&&" < tregions.in
-
-echo "************** Executing tfundisp with filter3 **************"
-echo " "
-tfundisp $ARGS -b "(pha=5:7,pi=6:8)&&" < tregions.in
-
-echo "************** Executing tfunimage with sections **************"
-echo " "
-if [ x"$TXT" = x0 ]; then
- tfunimage $ARGS < tsections.in
-else
- F2=`echo "$ARGS" | awk '{print $3}'`
- F1=`echo $T | awk -F. '{print $1}'`.fits
- tfunimage -f $F1 $F2 < tsections.in
-fi
-
-echo "************** Executing tevread with regions **************"
-echo " "
-tevread $ARGS < tregions.in
-
-echo "************** Executing tevread with column filters **************"
-echo " "
-tevread $ARGS < tcols.in
-
-echo "************** Executing tfunview **************"
-echo " "
-tfunview $ARGS < tview.in
-
-echo "************** Executing tfunview with alt view db **************"
-echo " "
-tfunview -f ./funtools2.vu $ARGS < tview.in
diff --git a/funtools/funtest/funtexts b/funtools/funtest/funtexts
deleted file mode 100755
index e5c5088..0000000
--- a/funtools/funtest/funtexts
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-tfuntext $* < ttext.in
-
-TEXT_EXTNAME=EVENTS
-export TEXT_EXTNAME
-
-S=$HOME/data/snr.ev
-T=$HOME/data/snr.txt.gz
-
-export S
-export T
-
-funtests -f2 $S $T $*
diff --git a/funtools/funtest/funtools1.vu b/funtools/funtest/funtools1.vu
deleted file mode 100644
index a8fb74b..0000000
--- a/funtools/funtest/funtools1.vu
+++ /dev/null
@@ -1,10 +0,0 @@
-view file format columns filter
------- ---------------------- -------------- ------------ ---------------
-x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
-x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
-x1 ${HOME}/data/snr.ev cir 512 512 .1
-x0 ${HOME}/data/snr.ev
-xf I=%4d
-xc x y pi pha
-xr cir 512 512 .1
- *.fit x y pi pha cir 512 512 .1
diff --git a/funtools/funtest/funtools2.vu b/funtools/funtest/funtools2.vu
deleted file mode 100644
index 81eefdd..0000000
--- a/funtools/funtest/funtools2.vu
+++ /dev/null
@@ -1,11 +0,0 @@
-VIEW FILE FORMAT COLUMNS FILTER
----- -------------------- ------ ------------ ----------------
-x3 ${HOME}/data/snr.ev 'I=%4d' 'x y pi pha' 'cir 512 512 .1'
-x2 ${HOME}/data/snr.ev '' 'x y pi pha' 'cir 512 512 .1'
-x1 ${HOME}/data/snr.ev '' '' 'cir 512 512 .1'
-x0 ${HOME}/data/snr.ev '' '' ''
-xf '' 'I=%4d' '' ''
-xc '' '' 'x y pi pha' ''
-xr '' '' '' 'cir 512 512 .1'
-'' *.fit '' 'x y pi pha' 'cir 512 512 .1'
-
diff --git a/funtools/funtest/goo.ls b/funtools/funtest/goo.ls
deleted file mode 100644
index e69de29..0000000
--- a/funtools/funtest/goo.ls
+++ /dev/null
diff --git a/funtools/funtest/group.calc b/funtools/funtest/group.calc
deleted file mode 100644
index ef5543f..0000000
--- a/funtools/funtest/group.calc
+++ /dev/null
@@ -1,125 +0,0 @@
-/* globals go before main */
-global
-#define SAVEINC 100
-/* not available before 1.3.0b25 */
-#define I __i
-/* our save record contains a funcalc row record and a place for raw data */
-typedef struct savestruct{
- RowRec row;
- char *raw;
-} *Save, SaveRec;
-
-/* qsort comparison routine -- reverse order of x */
-static int _Cmp(const void *s1, const void *s2)
-{
- Save f1 = (Save)s1;
- Save f2 = (Save)s2;
- /* order flag */
- if( f1->row.x < f2->row.x )
- return -1;
- if( f1->row.x > f2->row.x )
- return 1;
- else
- return 0;
-}
-
-/* this is the heart of the algorithm */
-static void ProcessRows(Fun fun, Fun ofun, Save save, int nsave)
-{
- int i;
- /* sort rows */
- qsort(save, nsave, sizeof(SaveRec), _Cmp);
- /* output rows in new order */
- for(i=0; i<nsave; i++){
- /* re-associate raw data with this row */
- FunInfoPut(fun, FUN_RAWBUF, &save[i].raw, 0);
- /* write the row */
- FunTableRowPut(ofun, &save[i].row, 1, 0, NULL);
- }
-}
-end
-
-/* locals go immediately after local variables in main */
-local
- char *cptr=NULL;
- char *rptr=NULL;
- int i=0;
- int group=0;
- int rawsize=0;
- int lastkey=0;
- int maxsave=0;
- int nsave=0;
- Save save=NULL;
-end
-
-/* execute this before we enter inner loop */
-before
- /* get size of raw input record */
- FunInfoGet(fun, FUN_RAWSIZE, &rawsize, 0);
-end
-
-/* MAIN ROW PROCESSING LOOP */
-
-/* first time through, just seed last key */
-if( NROW == 0 ) lastkey=cur->key;
-
-/* save raw data for this set of rows */
-FunInfoGet(fun, FUN_RAWBUF, &rptr, 0);
-
-/* if this key starts a new group, process and output previous group */
-if( cur->key != lastkey ){
- /* process current group */
- ProcessRows(fun, ofun, save, nsave);
- /* restore the current row pointers so we can process the next row */
- FunInfoPut(fun, FUN_RAWBUF, &rptr, 0);
- /* reset number of keys in this group */
- nsave = 0;
- /* got another group */
- group++;
-}
-
-/* user manipulation */
-/* set values of a new column */
-cur->group:I = group;
-/* manipulate one of the user columns */
-cur->x = -cur->x;
-
-/* save this row ... first make sure we have enough space */
-if( nsave >= maxsave ){
- maxsave += SAVEINC;
- if( !save )
- save = xmalloc(maxsave*sizeof(SaveRec));
- else
- save = xrealloc(save, maxsave*sizeof(SaveRec));
- /* clear what we just alloc'ed (wish realloc() would do this! */
- memset(save+((maxsave-SAVEINC)*sizeof(SaveRec)), 0, SAVEINC*sizeof(SaveRec));
-}
-/* save the user part of this row */
-memcpy(&(save[nsave].row), cur, sizeof(RowRec));
-/* might have to allocate space for raw */
-if( !save[nsave].raw ) save[nsave].raw = xmalloc(rawsize);
-/* save raw data for this row */
-memcpy(save[nsave].raw, rptr+(I*rawsize), rawsize);
-/* saved another key in this group */
-nsave++;
-
-/* this key becomes last key */
-lastkey = cur->key;
-
-/* prevent funcalc from writing out the current record */
-continue;
-
-/* END OF INNER LOOP */
-
-/* after we leave inner loop */
-after
- /* process rows in last group */
- ProcessRows(fun, ofun, save, nsave);
- /* restore raw buf pointer so FunClose can free it properly */
- FunInfoPut(fun, FUN_RAWBUF, &rptr, 0);
- /* clean up saved data */
- for(i=0; i<maxsave; i++){
- if( save[i].raw ) xfree(save[i].raw);
- }
- if( save ) xfree(save);
-end
diff --git a/funtools/funtest/imblank.c b/funtools/funtest/imblank.c
deleted file mode 100644
index 309aa1f..0000000
--- a/funtools/funtest/imblank.c
+++ /dev/null
@@ -1,107 +0,0 @@
-#include <funtools.h>
-#include <stdlib.h>
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- int bitpix, dim1, dim2;
- int total;
- double blimit, bvalue;
- char *buf;
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- float *fbuf;
- double *dbuf;
- Fun fun, fun2;
-
- if( argc < 4 ){
- fprintf(stderr, "usage: %s iname oname blimit bvalue\n", argv[0]);
- exit(1);
- }
-
- /* get blank limit and optional blank value */
- blimit = atof(argv[3]);
- bvalue = 0;
- if( argc >= 5 )
- bvalue = atof(argv[4]);
-
- /* exit on gio errors */
- setgerror(2);
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[1], "rc", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
-
- /* open the output FITS image, preparing to copy input params */
- if( !(fun2 = FunOpen(argv[2], "w", fun)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[2]);
-
- /* extract and bin the data section into an image buffer */
- if( !(buf = FunImageGet(fun, NULL, NULL)) )
- gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
-
- /* get required information from funtools structure.
- this should come after the ImageGet call, in case that call
- changed fun_sect_bitpix value */
- FunInfoGet(fun,
- FUN_SECT_BITPIX, &bitpix,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- 0);
-
- /* set appropriate data type buffer to point to image buffer */
- switch(bitpix){
- case 8:
- cbuf = (unsigned char *)buf; break;
- case 16:
- sbuf = (short *)buf; break;
- case 32:
- ibuf = (int *)buf; break;
- case -32:
- fbuf = (float *)buf; break;
- case -64:
- dbuf = (double *)buf; break;
- }
-
- /* loop through pixels and reset values below limit to value */
- total = dim1*dim2;
- for(i=0; i<total; i++){
- switch(bitpix){
- case 8:
- if( cbuf[i] <= blimit ) cbuf[i] = bvalue;
- break;
- case 16:
- if( sbuf[i] <= blimit ) sbuf[i] = bvalue;
- break;
- case 32:
- if( ibuf[i] <= blimit ) ibuf[i] = bvalue;
- break;
- case -32:
- if( fbuf[i] <= blimit ) fbuf[i] = bvalue;
- break;
- case -64:
- if( dbuf[i] <= blimit ) dbuf[i] = bvalue;
- break;
- }
- }
-
- /* write the output image, updating the FITS header from the orig file */
- if( !FunImagePut(fun2, buf, 0, 0, 0, NULL) )
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
-
- /* free up space */
- if( buf ) free(buf);
-
- /* close output first so that flush happens automatically */
- FunClose(fun2);
- FunClose(fun);
- return(0);
-}
diff --git a/funtools/funtest/imtest.c b/funtools/funtest/imtest.c
deleted file mode 100644
index 25e35fa..0000000
--- a/funtools/funtest/imtest.c
+++ /dev/null
@@ -1,156 +0,0 @@
-#include <funtools.h>
-#include <stdlib.h>
-#include <file.h>
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i, j;
- int c;
- int args;
- int ptype;
- int dim1, dim2, bitpix, skip, bigendian;
- int tdim;
- char dims[SZ_LINE];
- char *buf=NULL;
- char *iname=NULL, *oname=NULL;
-
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- float *fbuf;
- double *dbuf;
- double *dbuf2;
-
- Fun ifun=NULL, ofun=NULL;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "c:l")) != -1){
- switch(c){
- case 'c':
- ptype = 'c';
- strcpy(dims, optarg);
- ParseArraySpec(dims, &dim1, &dim2, &bitpix, &skip, &bigendian);
- break;
- case 'l':
- ptype = 'l';
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- switch(ptype){
- case 'c':
- if( args < 1 )
- gerror(stderr, "usage: %s -c dims fname\n", argv[0]);
- iname = NULL;
- oname = argv[optind++];
- break;
- case 'l':
- if( args < 2 )
- gerror(stderr, "usage: %s -l iname oname\n", argv[0]);
- iname = argv[optind++];
- oname = argv[optind++];
- break;
- default:
- gerror(stderr, "usage: %s requires -c [dims] or -l\n", argv[0]);
- }
-
- /* open the input FITS file */
- if( iname ){
- if( !(ifun = FunOpen(iname, "r", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[optind-1]);
- }
-
- /* open the output FITS file */
- if( oname ){
- if( !(ofun = FunOpen(oname, "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[optind-1]);
- }
-
- /* set appropriate data type buffer to point to image buffer */
- if( ptype == 'c' ){
- /* allocate the buffer */
- tdim = dim1*dim2;
- buf = malloc(tdim*ft_sizeof(bitpix));
- switch(bitpix){
- case 8:
- cbuf = (unsigned char *)buf;
- for(i=0; i<tdim; i++)
- cbuf[i] = i;
- break;
- case 16:
- sbuf = (short *)buf;
- for(i=0; i<tdim; i++)
- sbuf[i] = i;
- break;
- case 32:
- ibuf = (int *)buf;
- for(i=0; i<tdim; i++)
- ibuf[i] = i;
- break;
- case -32:
- fbuf = (float *)buf;
- for(i=0; i<tdim; i++)
- fbuf[i] = i;
- break;
- case -64:
- dbuf = (double *)buf;
- for(i=0; i<tdim; i++)
- dbuf[i] = i;
- break;
- }
- /* write the output image, updating the FITS header from the orig file */
- if( ofun && buf ){
- if( !FunImagePut(ofun, buf, dim1, dim2, bitpix, NULL) )
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
- }
- if( buf ) free(buf);
- }
-
- /* reverse each line of the image */
- if( ptype == 'l' ){
- /* get required information from funtools structure */
- FunInfoGet(ifun,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- 0);
- /* we will generate an image of type double xon output */
- dbuf = malloc(dim1 * sizeof(double));
- dbuf2 = malloc(dim1 * sizeof(double));
- for(i=1; i<=dim2; i++){
- /* reach next line */
- if( !FunImageRowGet(ifun, dbuf, i, i, "bitpix=-64") )
- gerror(stderr, "could not FunImageRowGet: %d %s\n", i, iname);
- /* reverse the line */
- for(j=1; j<=dim1; j++){
- dbuf2[dim1-j] = dbuf[j-1];
- }
- /* write theline */
- FunImageRowPut(ofun, dbuf2, i, i, dim1, dim2, -64, NULL);
- }
- if( dbuf ) free(dbuf);
- if( dbuf2 ) free(dbuf2);
- }
-
- if( ifun ) FunClose(ifun);
- if( ofun ) FunClose(ofun);
- return(0);
-}
diff --git a/funtools/funtest/install-sh b/funtools/funtest/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/funtest/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/funtest/mif.lst b/funtools/funtest/mif.lst
deleted file mode 100644
index 0545c47..0000000
--- a/funtools/funtest/mif.lst
+++ /dev/null
@@ -1,4 +0,0 @@
-mif1.fits
-mif2.fits
-mif3.fits
-mif4.fits
diff --git a/funtools/funtest/mif1.fits b/funtools/funtest/mif1.fits
deleted file mode 100644
index b8f750f..0000000
--- a/funtools/funtest/mif1.fits
+++ /dev/null
@@ -1,2 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.120000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.129999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
-%…C=
diff --git a/funtools/funtest/mif2.fits b/funtools/funtest/mif2.fits
deleted file mode 100644
index ab2fbaa..0000000
--- a/funtools/funtest/mif2.fits
+++ /dev/null
@@ -1,2 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.110000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.129999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
-%…C=
diff --git a/funtools/funtest/mif3.fits b/funtools/funtest/mif3.fits
deleted file mode 100644
index 4f12c43..0000000
--- a/funtools/funtest/mif3.fits
+++ /dev/null
@@ -1,2 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.120000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.119999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
-%…C=
diff --git a/funtools/funtest/mif4.fits b/funtools/funtest/mif4.fits
deleted file mode 100644
index 1a8bff9..0000000
--- a/funtools/funtest/mif4.fits
+++ /dev/null
@@ -1,2 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 5 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.130000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.139999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END 
-%…C=
diff --git a/funtools/funtest/mkdim.c b/funtools/funtest/mkdim.c
deleted file mode 100644
index d0f468d..0000000
--- a/funtools/funtest/mkdim.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Solaris:
- gcc -g -o mkdim mkdim.c -I /soft/saord/include -L/soft/saord/lib -lfuntools
- -ldl -lsocket -lnsl -lm
- OS X:
- gcc -g -o mkdim mkdim.c -I /soft/saord/include -L/soft/saord/lib -lfuntools -lm
-
-*/
-
-#include <funtools.h>
-#include <stdlib.h>
-#include <string.h>
-#include <file.h>
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int dim1, dim2, bitpix;
- int tdim;
- char *buf=NULL;
- char *oname=NULL;
- char lbuf[SZ_LINE];
- unsigned char *cbuf;
- short *sbuf;
- int *ibuf;
- float *fbuf;
- double *dbuf;
- double x, y, val;
- Fun ofun=NULL;
-
- /* exit on gio errors */
- setgerror(2);
-
- if( argc != 5 ){
- gerror(stderr, "usage: cat tfile | %s oname xdim ydim bitpix\n", argv[0]);
- return 1;
- }
- oname = argv[1];
- dim1 = atoi(argv[2]);
- dim2 = atoi(argv[3]);
- bitpix = atoi(argv[4]);
-
- /* open the output FITS file */
- if( oname ){
- if( !(ofun = FunOpen(oname, "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[optind-1]);
- }
-
- /* set appropriate data type buffer to point to image buffer */
- /* allocate the buffer */
- tdim = dim1*dim2;
- buf = malloc(tdim*ft_sizeof(bitpix));
- while( fgets(lbuf, SZ_LINE, stdin) ){
- if( sscanf(lbuf, "%lf %lf %lf", &x, &y, &val) != 3 ){
- gerror(stderr, "invalid input: requires x, y, val; got %s\n", lbuf);
- }
- switch(bitpix){
- case 8:
- cbuf = (unsigned char *)buf;
- cbuf[(int)y*dim2+(int)x] = (unsigned char)val;
- break;
- case 16:
- sbuf = (short *)buf;
- sbuf[(int)y*dim2+(int)x] = (short)val;
- break;
- case 32:
- ibuf = (int *)buf;
- ibuf[(int)y*dim2+(int)x] = (int)val;
- break;
- case -32:
- fbuf = (float *)buf;
- fbuf[(int)y*dim2+(int)x] = (float)val;
- break;
- case -64:
- dbuf = (double *)buf;
- dbuf[(int)y*dim2+(int)x] = val;
- break;
- }
- }
- /* write the output image, updating the FITS header from the orig file */
- if( ofun && buf ){
- if( !FunImagePut(ofun, buf, dim1, dim2, bitpix, NULL) )
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
- }
- if( buf ) free(buf);
- if( ofun ) FunClose(ofun);
- return(0);
-}
diff --git a/funtools/funtest/mkev.c b/funtools/funtest/mkev.c
deleted file mode 100644
index 5cb6722..0000000
--- a/funtools/funtest/mkev.c
+++ /dev/null
@@ -1,335 +0,0 @@
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#include <math.h>
-#include <prsetup.h>
-#include <macro.h>
-#include <swap.h>
-#include <xalloc.h>
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-extern char *optarg;
-extern int optind;
-
-#ifndef ABS
-#define ABS(x) ((x)<0?(-x):(x))
-#endif
-
-#define EVSIZE 26
-
-#define FITS_HEADER "\
-SIMPLE = T / FITS STANDARD \
-BITPIX = 8 / Binary data \
-NAXIS = 0 / No image array present \
-EXTEND = T / There may be standard extensions \
-END \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
- \
-XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE \
-BITPIX = 8 / Binary data \
-NAXIS = 2 / Table is a matrix \
-NAXIS1 = $EVSIZE / Width of table in bytes \
-NAXIS2 = $TEV / Number of entries in table \
-PCOUNT = 0 / Random parameter count \
-GCOUNT = 1 / Group count \
-TFIELDS = 7 / Number of fields in row \
-EXTNAME = 'EVENTS ' / Table name \
-EXTVER = 1 / Version number of table \
-TFORM1 = '1I ' / Data type for field \
-TTYPE1 = 'X ' / Label for field \
-TSCAL1 = 10.0 / Label for field \
-TZERO1 = 1.0 / Label for field \
-TUNIT1 = ' ' / Physical units for field \
-TFORM2 = '1I ' / Data type for field \
-TTYPE2 = 'Y ' / Label for field \
-TSCAL2 = 20.0 / Label for field \
-TZERO2 = 2.0 / Label for field \
-TUNIT2 = ' ' / Physical units for field \
-TFORM3 = '1I ' / Data type for field \
-TTYPE3 = 'PHA ' / Label for field \
-TUNIT3 = ' ' / Physical units for field \
-TFORM4 = '1J ' / Data type for field \
-TTYPE4 = 'PI ' / Label for field \
-TUNIT4 = ' ' / Physical units for field \
-TFORM5 = '1D ' / Data type for field \
-TTYPE5 = 'TIME ' / Label for field \
-TUNIT5 = ' ' / Physical units for field \
-TFORM6 = '1E ' / Data type for field \
-TTYPE6 = 'DX ' / Label for field \
-TUNIT6 = ' ' / Physical units for field \
-TFORM7 = '1E ' / Data type for field \
-TTYPE7 = 'DY ' / Label for field \
-TUNIT7 = ' ' / Physical units for field \
-RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) \
-EQUINOX = 2.000000E3 / equinox (epoch) for WCS \
-TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) \
-TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) \
-TCRVL1 = 9.000000000000000E1 / sky coord (deg.) \
-TCRVL2 = 6.000000000000000E1 / sky coord (deg.) \
-TCDLT1 = -1.00000000000000E-1 / degrees per pixel \
-TCDLT2 = 1.000000000000002E-1 / degrees per pixel \
-TCRPX1 = 5.000000000000000E0 / pixel of tangent plane direc. \
-TCRPX2 = 5.000000000000000E0 / pixel of tangent plane direc. \
-TCROT2 = 0.000000000000000E0 / rotation angle (degrees) \
-TLMIN1 = $IXLO / Min. axis value \
-TLMAX1 = $IXHI / Max. axis value \
-TLMIN2 = $IYLO / Min. axis value \
-TLMAX2 = $IYHI / Max. axis value \
-TLMIN6 = $XLO / Min. axis value \
-TLMAX6 = $XHI / Max. axis value \
-TLMIN7 = $YLO / Min. axis value \
-TLMAX7 = $XHI / Max. axis value \
-END \
- "
-
-/* these are used in the macro expansion and must be global */
-static double xlo, xhi, ylo, yhi;
-static int tev;
-static char macrobuf[SZ_LINE];
-
-#ifdef ANSI_FUNC
-static char *
-MacroCB(char *name, void *UNUSED(client_data))
-#else
-static char *MacroCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- if( !strcmp(name, "TEV") ){
- sprintf(macrobuf, "%10d", tev);
- return macrobuf;
- }
- else if( !strcmp(name, "XLO") ){
- sprintf(macrobuf, "%10.2f", xlo);
- return macrobuf;
- }
- else if( !strcmp(name, "XHI") ){
- sprintf(macrobuf, "%10.2f", xhi);
- return macrobuf;
- }
- else if( !strcmp(name, "IXLO") ){
- if( xlo > 0 )
- sprintf(macrobuf, "%10d", (int)xlo);
- else
- sprintf(macrobuf, "%10d", (int)ceil(xlo));
- return macrobuf;
- }
- else if( !strcmp(name, "IXHI") ){
- if( xhi > 0 )
- sprintf(macrobuf, "%10d", (int)xhi);
- else
- sprintf(macrobuf, "%10d", (int)ceil(xhi));
- return macrobuf;
- }
- else if( !strcmp(name, "DIM1") ){
- sprintf(macrobuf, "%6d", (int)(xhi-xlo));
- return macrobuf;
- }
- else if( !strcmp(name, "YLO") ){
- sprintf(macrobuf, "%10.2f", ylo);
- return macrobuf;
- }
- else if( !strcmp(name, "YHI") ){
- sprintf(macrobuf, "%10.2f", yhi);
- return macrobuf;
- }
- else if( !strcmp(name, "IYLO") ){
- if( ylo > 0 )
- sprintf(macrobuf, "%10d", (int)ylo);
- else
- sprintf(macrobuf, "%10d", (int)ceil(ylo));
- return macrobuf;
- }
- else if( !strcmp(name, "IYHI") ){
- if( yhi > 0 )
- sprintf(macrobuf, "%10d", (int)yhi);
- else
- sprintf(macrobuf, "%10d", (int)ceil(yhi));
- return macrobuf;
- }
- else if( !strcmp(name, "DIM2") ){
- sprintf(macrobuf, "%6d", (int)(yhi-ylo));
- return macrobuf;
- }
- else if( !strcmp(name, "EVSIZE") ){
- sprintf(macrobuf, "%4d", EVSIZE);
- return macrobuf;
- }
- else{
- return NULL;
- }
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int convert;
- int nev;
- int ii, kk;
- int pad;
- int pi;
- int args;
- int doraw=0;
- char *padbuf;
- short x, y;
- short pha;
- double i, j;
- double time;
- float dx, dy;
- char *s, *t;
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "r")) != -1){
- switch(c){
- case 'r':
- doraw = 1;
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- /* process arguments */
- if( args != 4 ){
- fprintf(stderr, "usage: %s xlo xhi ylo yhi\n", argv[0]);
- exit(1);
- }
- else{
- xlo = atof(argv[optind]);
- xhi = atof(argv[optind+1]);
- ylo = atof(argv[optind+2]);
- yhi = atof(argv[optind+3]);
- }
-
- /* get initial header string */
- s = xstrdup(FITS_HEADER);
- /* see if we have to convert to IEEE format */
- convert = !is_bigendian();
-
- /* determine how many events we will have */
- for(tev=0,j=ylo; j<=yhi; j++){
- for(i=xlo; i<=xhi; i++){
- if( i != j )
- nev = 1;
- else
- nev = ABS(i);
- tev += nev;
- }
- }
-
- /* expand header to fill in number of events and dimensions */
- t = ExpandMacro(s, NULL, NULL, 0, MacroCB, NULL);
-
- /* write header, if necessary */
- if( !doraw ){
- ii = strlen(t);
- if( (ii % 2880) != 0 ){
- fprintf(stderr, "internal error: bad size (%d) for header\n", ii);
- }
- write(1, t, ii);
- }
-
- /* write events */
- for(tev=0,j=ylo; j<=yhi; j++){
- for(i=xlo; i<=xhi; i++){
- if( i != j )
- nev = 1;
- else
- nev = ABS(i);
- tev += nev;
- for(kk=0; kk<nev; kk++){
- x = i;
- y = j;
- pha = i;
- pi = j;
- time = (double)tev + (double)(i+j+kk)/100.0;
- dx = i;
- dy = j;
- if( convert ){
- swap_short(&x, 1);
- swap_short(&y, 1);
- swap_short(&pha, 1);
- swap_int(&pi, 1);
- swap_double(&time, 1);
- swap_float(&dx, 1);
- swap_float(&dy, 1);
- }
- write(1, &x, sizeof(short));
- write(1, &y, sizeof(short));
- write(1, &pha, sizeof(short));
- write(1, &pi, sizeof(int));
- write(1, &time, sizeof(double));
- write(1, &dx, sizeof(float));
- write(1, &dy, sizeof(float));
- }
- }
- }
-
- /* write padding, if necessary */
- if( !doraw ){
- pad = 2880 - ((tev*EVSIZE)%2880);
- if( pad == 2880 ) pad = 0;
- if( pad ){
- padbuf = (char *)calloc(pad, sizeof(char));
- write(1, padbuf, pad);
- }
- }
-
- return(0);
-}
-
diff --git a/funtools/funtest/mkev2.c b/funtools/funtest/mkev2.c
deleted file mode 100644
index 98e706b..0000000
--- a/funtools/funtest/mkev2.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-int main(argc, argv)
- int argc;
- char **argv;
-{
- int i;
- int nrec;
- unsigned char bval;
- unsigned short usval;
- unsigned int uival;
- short sval;
- int ival;
- float fval;
- double dval;
-
- if( argc > 1 )
- nrec = atoi(argv[1]);
- else
- nrec = 100;
- if( nrec < 0 )
- nrec = 100;
-
- for(i=0; i<nrec; i++){
- dval = (double)i + (double)i/nrec;
- write(1, &dval, sizeof(dval));
- fval = (float)-i;
- write(1, &fval, sizeof(fval));
- ival = i;
- write(1, &ival, sizeof(ival));
- sval = (short)-i;
- write(1, &sval, sizeof(sval));
- bval = (unsigned char)i;
- write(1, &bval, sizeof(bval));
-
- usval = (unsigned short)i;
- write(1, &usval, sizeof(usval));
-
- bval = (unsigned char)i;
- write(1, &bval, sizeof(bval));
- bval++;
- write(1, &bval, sizeof(bval));
- bval++;
- write(1, &bval, sizeof(bval));
-
- uival = (unsigned int)i;
- write(1, &uival, sizeof(uival));
- }
- fprintf(stderr, "setenv EVENTS \"(dval:D,fval:E,ival:J,sval:I,bval:B,x16:16X,x24:24X,x32:32X)\"\n");
- return(0);
-}
diff --git a/funtools/funtest/ntest.ev b/funtools/funtest/ntest.ev
deleted file mode 100644
index 155c02d..0000000
--- a/funtools/funtest/ntest.ev
+++ /dev/null
@@ -1,98 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 26 / Width of table in bytes NAXIS2 = 296 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1J ' / Data type for field TFORM3 = '1D ' / Data type for field TFORM4 = '1E ' / Data type for field TFORM5 = '1E ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'PHA ' / Label for field TTYPE2 = 'PI ' / Label for field TTYPE3 = 'TIME ' / Label for field TTYPE4 = 'DX ' / Label for field TTYPE5 = 'DY ' / Label for field TTYPE6 = 'X ' / Label for field TTYPE7 = 'Y ' / Label for field TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TLMIN4 = -7.5000000 / Min. axis value TLMIN5 = -7.5000000 / Min. axis value TLMIN6 = 0 / Min. axis value TLMIN7 = 0 / Min. axis value TLMAX4 = 7.5000000 / Max. axis value TLMAX5 = 7.5000000 / Max. axis value TLMAX6 = 14 / Max. axis value TLMAX7 = 14 / Max. axis value RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) EQUINOX = 2.000000E3 / equinox (epoch) for WCS END ÿùÿÿÿù@ffffffÀð
-=qÀð
-=p¤Àð
-=qÀÐ
-=À°
-=p£×¿
-
-=@Ð
-=p¤ÀÐ
-=p¤À
-=p£×¿
-
-=@
-=qÀÐ
-=p£×À°
-=p£×¿À
-=@`
-
-=qÀð
-=?
-
-=q@°
-À°
-=¿
-
-=q@
-ÀÐ
-=À
-=¿À
-=q@`
-
-Àð
-=À
-=q@`
-
-=Àð
-=p£×À
-=q@
-
-@ð
-=p£×À`
-=q?À
-
-@Ð
-=p£×À
-=q?
-
-@°
-=p£×À°
-=q¿
-
-@
-ÿú
-=p£×ÀÐ
-ÿû
-ÿü
-ÿý
-ÿþ
-ÿÿ
-=q¿À
-
-
-
-
-
-@`
-
-
-
-
-
-
-
-
-
-ÿù
-=p£×Àð
-=qÀ
-@
-
-=p¤@
-=p¤@ð
-=qÀ`
-?À
-
-=p¤@°
-=p¤@Ð
-=qÀ
-=@
-
-@Ð
-@ð
-=qÀ`
-=?À
-
-@Ð
-=p£×@ð
diff --git a/funtools/funtest/nwcs b/funtools/funtest/nwcs
deleted file mode 100755
index cc21ba7..0000000
--- a/funtools/funtest/nwcs
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/sh
-# set -x
-
-if [ x"$3" = x ]; then
- echo "usage: $0 ievents iwcs oimage"
- echo "where:"
- echo " ievents # input events file"
- echo " iwcs # input image file containing new WCS header"
- echo " oimage # output image file"
- echo " "
- echo "The x, y position of each event in the input file is transformed to"
- echo "the a new x, y based on the specified WCS and the result is written"
- echo "to the specified output image."
- exit 1
-fi
-
-IEVENTS="$1"
-IWCS="$2"
-OIMAGE="$3"
-
-WEDIT=wcs.edit
-WCALC=nwcs.calc
-TEVENTS=tevents.fits
-TIMAGE=timage.fits
-
-echo "retrieving WCS information from $IWCS ..."
-funhead "$IWCS" | egrep "^EPOCH|^RADECSYS|^EQUINOX|^CTYPE1|^CTYPE2|^CRVAL1|^CRVAL2|^CRPIX1|^CRPIX2|^CDELT1|^CDELT2|^CROTA1|^CROTA2|^CUNIT1|^CUNIT2|^CD1_1|^CD1_2|^CD2_1|^CD2_2|^PV1_0|^PV1_1|^PV1_2|^PV1_3|^PV1_4|^PV1_5|^PV1_6|^PV1_7|^PV1_8|^PV1_9|^PV2_0|^PV2_1|^PV2_2|^PV2_3|^PV2_4|^PV2_5|^PV2_6|^PV2_7|^PV2_8|^PV2_9|^LTM1_1|^LTM1_2|^LTM2_1|^LTM2_2|^LTV1|^LTV2|^DTM1_1|^DTM1_2|^DTM2_1|^DTM2_2|^DTV1|^DTV2" > $WEDIT
-
-echo "converting events from $IEVENTS using new WCS ..."
-cat <<END > $WCALC
-local
-double tli2p (double di, double tlmin, double binsiz, int type);
-char *wcsfile=NULL;
-char *s;
-int i;
-int init=0;
-int got=0;
-int offscl;
-double tlmin1, tlmin2;
-double dval1, dval2;
-double nx, ny;
-void *wcs1;
-void *wcs2;
-Fun fun2;
-FITSCard card;
-end
-before
- if( ARGC < 1 ){
- gerror(stderr, "requires -a wcsfile\n");
- exit(1);
- }
- wcsfile = ARGV(0);
- if( !(fun2 = FunOpen(wcsfile, "r", NULL)) ){
- gerror(stderr, "can't FunOpen wcs file (or find extension): %s\n",
- wcsfile);
- }
- FunInfoGet(fun2, FUN_WCS, &wcs2, 0);
- FunInfoGet(fun, FUN_WCS, &wcs1, FUN_MIN1, &tlmin1, FUN_MIN2, &tlmin2, 0);
- xdim=FunParamGeti(fun2, "NAXIS1", 0, -1, &got);
- if( !got ){
- gerror(stderr, "NAXIS1 missing from WCS image\n");
- exit(1);
- }
- ydim=FunParamGeti(fun2, "NAXIS2", 0, -1, &got);
- if( !got ){
- gerror(stderr, "NAXIS2 missing from WCS image\n");
- exit(1);
- }
- pix2wcs(wcs2, (double)0, (double)0, &dval1, &dval2);
- wcs2pix(wcs1, dval1, dval2, &nx, &ny, &offscl);
- nx = tli2p(nx, tlmin1, 0, 'D');
- ny = tli2p(ny, tlmin2, 0, 'D');
- FunParamPuti(ofun, "NWCSX", 1, (int)nx, "lower corner x of wcs image", 1);
- FunParamPuti(ofun, "NWCSY", 1, (int)ny, "lower corner y of wcs image", 1);
- pix2wcs(wcs2, (double)xdim-1, (double)ydim-1, &dval1, &dval2);
- wcs2pix(wcs1, dval1, dval2, &nx, &ny, &offscl);
- nx = (double)tli2p(nx, tlmin1, 0, 'D');
- ny = (double)tli2p(ny, tlmin2, 0, 'D');
- FunParamPuti(ofun, "NWCSX", 2, (int)nx, "upper corner x of wcs image", 1);
- FunParamPuti(ofun, "NWCSY", 2, (int)ny, "upper corner y of wcs image", 1);
-end
-pix2wcs(wcs1, (double)cur->x, (double)cur->y, &dval1, &dval2);
-wcs2pix(wcs2, dval1, dval2, &nx, &ny, &offscl);
-/* cur->x = (int)(nx+0.5); */
-/* cur->y = (int)(ny+0.5); */
-cur->x = nx;
-cur->y = ny;
-END
-funcalc -n -f "$WCALC" -a "$IWCS" "$IEVENTS" "$TEVENTS" > foo.c
-funcalc -f "$WCALC" -a "$IWCS" "$IEVENTS" "$TEVENTS"
-
-XDIM=`funhead $IWCS | egrep NAXIS1 | awk '{print $3}'`
-YDIM=`funhead $IWCS | egrep NAXIS2 | awk '{print $3}'`
-XCEN=`expr $XDIM / 2`
-YCEN=`expr $YDIM / 2`
-echo "found wcs image dimensions $XCEN@$XDIM, $YCEN@$YDIM ..."
-
-echo "converting new event file to image file $OIMAGE ..."
-funimage "$TEVENTS[$XDIM@$XCEN,$YDIM@$YCEN]" "$TIMAGE"
-
-echo "adding new WCS to output image $OIMAGE ..."
-funhead "$TIMAGE" "$OIMAGE" "$WEDIT"
-
-echo "determine lower and upper corners of $IWCS image in event coords:"
-funhead "$OIMAGE" | egrep "corner . of wcs image"
-
-echo "cleaning up ..."
-rm -f "$WEDIT" "$WCALC" "$TEVENTS" "$TIMAGE"
-
diff --git a/funtools/funtest/parse.in b/funtools/funtest/parse.in
deleted file mode 100644
index 800283a..0000000
--- a/funtools/funtest/parse.in
+++ /dev/null
@@ -1,24 +0,0 @@
-[100:200,300:400,5]
-[100:200,300:400]
-[*,300:400,5]
-[*,300:400]
-[100:200,*,5]
-[100:200,*]
-[*,*,5]
-[*,5]
-[100:200,300:400,5][pha==1&&pi>2]
-[100:200,300:400][pha==1&&pi>2]
-[*,300:400,5][pha==1&&pi>2]
-[*,300:400][pha==1&&pi>2]
-[100:200,*,5][pha==1&&pi>2]
-[100:200,*][pha==1&&pi>2]
-[*,*,5][pha==1&&pi>2]
-[*,5][pha==1&&pi>2]
-[100:200,300:400,5,pha==1&&pi>2]
-[100:200,300:400,pha==1&&pi>2]
-[*,300:400,5,pha==1&&pi>2]
-[*,300:400,pha==1&&pi>2]
-[100:200,*,5,pha==1&&pi>2]
-[100:200,*,pha==1&&pi>2]
-[*,*,5,pha==1&&pi>2]
-[*,5,pha==1&&pi>2]
diff --git a/funtools/funtest/pr b/funtools/funtest/pr
deleted file mode 100644
index 1c0d23c..0000000
--- a/funtools/funtest/pr
+++ /dev/null
@@ -1,8 +0,0 @@
-/* comment */
-# another comment
-if( cur->x > cur->y )
- fprintf(stdout, "X: %d %d\n", cur->x, cur->y);
-else if( cur->x == cur->y )
- fprintf(stdout, "E: %d\n", cur->x);
-else
- fprintf(stdout, "Y: %d %d\n", cur->x, cur->y);
diff --git a/funtools/funtest/qcon.c b/funtools/funtest/qcon.c
deleted file mode 100644
index a5d2e2d..0000000
--- a/funtools/funtest/qcon.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* gcc -g -o qcon qcon.c -I/soft/saord/include -L/soft/saord/lib -lfuntools -lsocket -lnsl -ldl -lm */
-
-#include <funtools.h>
-#include <stdlib.h>
-
-extern char *optarg;
-extern int optind;
-
-int main(int argc, char **argv)
-{
- int c;
- int args;
- int offscl;
- int dim1, dim2;
- int ix, iy;
- int offset;
- int debug=0;
- int dowcs=1;
- int idx=0;
- char tbuf[SZ_LINE];
- double dval1, dval2;
- double dx, dy;
- double *dbuf;
- struct WorldCoor *wcs;
- Fun fun;
-
- /* process switch arguments */
- while( (c = getopt(argc, argv, "d")) != -1){
- switch(c){
- case 'd':
- debug = 1;
- break;
- case 'i':
- dowcs = 0;
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- if( args < 1 ){
- fprintf(stderr, "usage: %s iname -d -i\n", argv[0]);
- fprintf(stderr, "\n");
- fprintf(stderr, "where:\n");
- fprintf(stderr, " -d\tprint out input and output position values\n");
- fprintf(stderr, " -i\tinput values are image x,y (not ra,dec in deg)\n");
- fprintf(stderr, "\n");
- exit(1);
- }
-
- /* exit on gio errors */
- setgerror(2);
-
- /* open the input FITS file */
- if( !(fun = FunOpen(argv[optind], "r", NULL)) )
- gerror(stderr, "could not FunOpen input file: %s\n", argv[optind]);
-
- /* extract and bin the data section into a double float image buffer */
- if( !(dbuf = FunImageGet(fun, NULL, "bitpix=-64")) )
- gerror(stderr, "could not FunImageGet: %s\n", argv[1]);
-
- /* get required information from funtools structure */
- FunInfoGet(fun,
- FUN_SECT_DIM1, &dim1,
- FUN_SECT_DIM2, &dim2,
- FUN_WCS, &wcs,
- 0);
-
- /* for each line in the contour file ... */
- while( fgets(tbuf, SZ_LINE, stdin) ){
- /* ignore comments */
- if( *tbuf == '#' )
- continue;
- /* blank lines means reset counter */
- if( *tbuf == '\n' ){
- fprintf(stdout, "\n");
- idx = 0;
- continue;
- }
- /* input contour values: ra, dec in degrees (or image coords if -i) */
- if(sscanf(tbuf, "%lf %lf", &dval1, &dval2) != 2){
- gerror(stderr, "invalid line in contour file: %s\n", tbuf);
- }
- /* convert input ra, dec to image x, y */
- if( dowcs ){
- wcs2pix(wcs, dval1, dval2, &dx, &dy, &offscl);
- /* make sure we are not off scale */
- if( offscl ){
- fprintf(stderr, "warning: wcs position is offscale: %s\n", tbuf);
- continue;
- }
- }
- else{
- dx = dval1;
- dy = dval2;
- }
- /* convert image values to integers */
- ix = (int)(dx+0.5);
- iy = (int)(dy+0.5);
- /* sanity checks -- must be inside the image */
- if( (ix < 1) || (ix > dim1) || (iy < 1) || (iy > dim2)){
- fprintf(stderr, "warning: image position off image: %s\n", tbuf);
- continue;
- }
- /* calculate offset into dbuf */
- offset = (iy-1)*dim1 + ix-1;
- /* write out the index and the pixel value at the image position */
- fprintf(stdout, "%d\t%f", idx, dbuf[offset]);
- /* debugging info, if necessary */
- if( debug ){
- fprintf(stdout, "\t %f %f\t%d %d", dval1, dval2, ix, iy);
- }
- /* finish off line */
- fprintf(stdout, "\n");
- /* bump to next index */
- idx++;
- }
-
- /* close output first so that flush happens automatically */
- FunClose(fun);
- if( dbuf ) free(dbuf);
- return(0);
-}
diff --git a/funtools/funtest/resample.fc b/funtools/funtest/resample.fc
deleted file mode 100644
index 00ef7c4..0000000
--- a/funtools/funtest/resample.fc
+++ /dev/null
@@ -1,70 +0,0 @@
-global
-#include <stdlib.h>
-
-int icmp( const void *e1, const void *e2 )
-{
- int i1 = *(int*) e1;
- int i2 = *(int*) e2;
-
- return i1 < i2 ? -1 : i1 == i2 ? 0 : 1;
-}
-
-end
-
-local
-int got;
-size_t irow = 0;
-size_t oidx = 0;
-size_t* output_irow;
-int naxis2;
-long int seed = getenv("SEED") ? atoi(getenv("SEED")) : 1 ;
-
-srand48(seed);
-end
-
-before
-
-naxis2 = FunParamGeti(fun, "NAXIS", 2, -1, &got);
-if ( ! got )
-{
- gerror(stderr, "error retrieving naxis2\n" );
- goto error;
-}
-
-/* allocate one more than we need. we stick a sentinel valuethat is
- always greater than the number of rows in the file in the last
- slot. that way we never fall off the end of output_irow in the
- processing loop below. */
-
-if ( ! (output_irow = malloc( (naxis2+1) * sizeof(*output_irow) ) ) )
- {
- gerror(stderr, "error allocating index array of size %d\n", naxis2 );
- goto error;
- }
-
-{ size_t i;
- for ( i = 0 ; i < naxis2 ; i++ )
- output_irow[i] = drand48() * naxis2;
- qsort( output_irow, naxis2, sizeof(*output_irow), icmp );
- output_irow[naxis2] = naxis2;
-}
-
-end
-
-
-cur->x;
-
-/* if the current row index is the next one to write, write it.
- the row may be used multiple times, so keep incrementing the
- list of rows to write until it doesn't match the current row */
-
-while( irow == output_irow[oidx] )
-{
- FunTableRowPut(ofun, (char *)cur, 1, __i, NULL);
- oidx++;
-}
-irow++;
-
-/* don't let funcalc write anything out; we've handled that */
-continue;
-
diff --git a/funtools/funtest/sample.fc b/funtools/funtest/sample.fc
deleted file mode 100644
index 4384176..0000000
--- a/funtools/funtest/sample.fc
+++ /dev/null
@@ -1,13 +0,0 @@
-global
-#include <stdlib.h>
-end
-
-local
-long int seed = getenv("SEED") ? atoi(getenv("SEED")) : 1 ;
-double limit = getenv("LIMIT") ? atof(getenv("LIMIT")) : 0.8;
-
-srand48(seed);
-end
-
-cur->x;
-if ( drand48() > limit ) continue;
diff --git a/funtools/funtest/snr100.reg b/funtools/funtest/snr100.reg
deleted file mode 100644
index 0a5ee2f..0000000
--- a/funtools/funtest/snr100.reg
+++ /dev/null
@@ -1,100 +0,0 @@
-circle(350,350,4)
-circle(380,350,4)
-circle(410,350,4)
-circle(440,350,4)
-circle(470,350,4)
-circle(500,350,4)
-circle(530,350,4)
-circle(560,350,4)
-circle(590,350,4)
-circle(620,350,4)
-circle(350,380,4)
-circle(380,380,4)
-circle(410,380,4)
-circle(440,380,4)
-circle(470,380,4)
-circle(500,380,4)
-circle(530,380,4)
-circle(560,380,4)
-circle(590,380,4)
-circle(620,380,4)
-circle(350,410,4)
-circle(380,410,4)
-circle(410,410,4)
-circle(440,410,4)
-circle(470,410,4)
-circle(500,410,4)
-circle(530,410,4)
-circle(560,410,4)
-circle(590,410,4)
-circle(620,410,4)
-circle(350,440,4)
-circle(380,440,4)
-circle(410,440,4)
-circle(440,440,4)
-circle(470,440,4)
-circle(500,440,4)
-circle(530,440,4)
-circle(560,440,4)
-circle(590,440,4)
-circle(620,440,4)
-circle(350,470,4)
-circle(380,470,4)
-circle(410,470,4)
-circle(440,470,4)
-circle(470,470,4)
-circle(500,470,4)
-circle(530,470,4)
-circle(560,470,4)
-circle(590,470,4)
-circle(620,470,4)
-circle(350,500,4)
-circle(380,500,4)
-circle(410,500,4)
-circle(440,500,4)
-circle(470,500,4)
-circle(500,500,4)
-circle(530,500,4)
-circle(560,500,4)
-circle(590,500,4)
-circle(620,500,4)
-circle(350,530,4)
-circle(380,530,4)
-circle(410,530,4)
-circle(440,530,4)
-circle(470,530,4)
-circle(500,530,4)
-circle(530,530,4)
-circle(560,530,4)
-circle(590,530,4)
-circle(620,530,4)
-circle(350,560,4)
-circle(380,560,4)
-circle(410,560,4)
-circle(440,560,4)
-circle(470,560,4)
-circle(500,560,4)
-circle(530,560,4)
-circle(560,560,4)
-circle(590,560,4)
-circle(620,560,4)
-circle(350,590,4)
-circle(380,590,4)
-circle(410,590,4)
-circle(440,590,4)
-circle(470,590,4)
-circle(500,590,4)
-circle(530,590,4)
-circle(560,590,4)
-circle(590,590,4)
-circle(620,590,4)
-circle(350,620,4)
-circle(380,620,4)
-circle(410,620,4)
-circle(440,620,4)
-circle(470,620,4)
-circle(500,620,4)
-circle(530,620,4)
-circle(560,620,4)
-circle(590,620,4)
-circle(620,620,4)
diff --git a/funtools/funtest/snr400.reg b/funtools/funtest/snr400.reg
deleted file mode 100644
index c7a02c4..0000000
--- a/funtools/funtest/snr400.reg
+++ /dev/null
@@ -1,400 +0,0 @@
-circle(350,350,4)
-circle(365,350,4)
-circle(380,350,4)
-circle(395,350,4)
-circle(410,350,4)
-circle(425,350,4)
-circle(440,350,4)
-circle(455,350,4)
-circle(470,350,4)
-circle(485,350,4)
-circle(500,350,4)
-circle(515,350,4)
-circle(530,350,4)
-circle(545,350,4)
-circle(560,350,4)
-circle(575,350,4)
-circle(590,350,4)
-circle(605,350,4)
-circle(620,350,4)
-circle(635,350,4)
-circle(350,365,4)
-circle(365,365,4)
-circle(380,365,4)
-circle(395,365,4)
-circle(410,365,4)
-circle(425,365,4)
-circle(440,365,4)
-circle(455,365,4)
-circle(470,365,4)
-circle(485,365,4)
-circle(500,365,4)
-circle(515,365,4)
-circle(530,365,4)
-circle(545,365,4)
-circle(560,365,4)
-circle(575,365,4)
-circle(590,365,4)
-circle(605,365,4)
-circle(620,365,4)
-circle(635,365,4)
-circle(350,380,4)
-circle(365,380,4)
-circle(380,380,4)
-circle(395,380,4)
-circle(410,380,4)
-circle(425,380,4)
-circle(440,380,4)
-circle(455,380,4)
-circle(470,380,4)
-circle(485,380,4)
-circle(500,380,4)
-circle(515,380,4)
-circle(530,380,4)
-circle(545,380,4)
-circle(560,380,4)
-circle(575,380,4)
-circle(590,380,4)
-circle(605,380,4)
-circle(620,380,4)
-circle(635,380,4)
-circle(350,395,4)
-circle(365,395,4)
-circle(380,395,4)
-circle(395,395,4)
-circle(410,395,4)
-circle(425,395,4)
-circle(440,395,4)
-circle(455,395,4)
-circle(470,395,4)
-circle(485,395,4)
-circle(500,395,4)
-circle(515,395,4)
-circle(530,395,4)
-circle(545,395,4)
-circle(560,395,4)
-circle(575,395,4)
-circle(590,395,4)
-circle(605,395,4)
-circle(620,395,4)
-circle(635,395,4)
-circle(350,410,4)
-circle(365,410,4)
-circle(380,410,4)
-circle(395,410,4)
-circle(410,410,4)
-circle(425,410,4)
-circle(440,410,4)
-circle(455,410,4)
-circle(470,410,4)
-circle(485,410,4)
-circle(500,410,4)
-circle(515,410,4)
-circle(530,410,4)
-circle(545,410,4)
-circle(560,410,4)
-circle(575,410,4)
-circle(590,410,4)
-circle(605,410,4)
-circle(620,410,4)
-circle(635,410,4)
-circle(350,425,4)
-circle(365,425,4)
-circle(380,425,4)
-circle(395,425,4)
-circle(410,425,4)
-circle(425,425,4)
-circle(440,425,4)
-circle(455,425,4)
-circle(470,425,4)
-circle(485,425,4)
-circle(500,425,4)
-circle(515,425,4)
-circle(530,425,4)
-circle(545,425,4)
-circle(560,425,4)
-circle(575,425,4)
-circle(590,425,4)
-circle(605,425,4)
-circle(620,425,4)
-circle(635,425,4)
-circle(350,440,4)
-circle(365,440,4)
-circle(380,440,4)
-circle(395,440,4)
-circle(410,440,4)
-circle(425,440,4)
-circle(440,440,4)
-circle(455,440,4)
-circle(470,440,4)
-circle(485,440,4)
-circle(500,440,4)
-circle(515,440,4)
-circle(530,440,4)
-circle(545,440,4)
-circle(560,440,4)
-circle(575,440,4)
-circle(590,440,4)
-circle(605,440,4)
-circle(620,440,4)
-circle(635,440,4)
-circle(350,455,4)
-circle(365,455,4)
-circle(380,455,4)
-circle(395,455,4)
-circle(410,455,4)
-circle(425,455,4)
-circle(440,455,4)
-circle(455,455,4)
-circle(470,455,4)
-circle(485,455,4)
-circle(500,455,4)
-circle(515,455,4)
-circle(530,455,4)
-circle(545,455,4)
-circle(560,455,4)
-circle(575,455,4)
-circle(590,455,4)
-circle(605,455,4)
-circle(620,455,4)
-circle(635,455,4)
-circle(350,470,4)
-circle(365,470,4)
-circle(380,470,4)
-circle(395,470,4)
-circle(410,470,4)
-circle(425,470,4)
-circle(440,470,4)
-circle(455,470,4)
-circle(470,470,4)
-circle(485,470,4)
-circle(500,470,4)
-circle(515,470,4)
-circle(530,470,4)
-circle(545,470,4)
-circle(560,470,4)
-circle(575,470,4)
-circle(590,470,4)
-circle(605,470,4)
-circle(620,470,4)
-circle(635,470,4)
-circle(350,485,4)
-circle(365,485,4)
-circle(380,485,4)
-circle(395,485,4)
-circle(410,485,4)
-circle(425,485,4)
-circle(440,485,4)
-circle(455,485,4)
-circle(470,485,4)
-circle(485,485,4)
-circle(500,485,4)
-circle(515,485,4)
-circle(530,485,4)
-circle(545,485,4)
-circle(560,485,4)
-circle(575,485,4)
-circle(590,485,4)
-circle(605,485,4)
-circle(620,485,4)
-circle(635,485,4)
-circle(350,500,4)
-circle(365,500,4)
-circle(380,500,4)
-circle(395,500,4)
-circle(410,500,4)
-circle(425,500,4)
-circle(440,500,4)
-circle(455,500,4)
-circle(470,500,4)
-circle(485,500,4)
-circle(500,500,4)
-circle(515,500,4)
-circle(530,500,4)
-circle(545,500,4)
-circle(560,500,4)
-circle(575,500,4)
-circle(590,500,4)
-circle(605,500,4)
-circle(620,500,4)
-circle(635,500,4)
-circle(350,515,4)
-circle(365,515,4)
-circle(380,515,4)
-circle(395,515,4)
-circle(410,515,4)
-circle(425,515,4)
-circle(440,515,4)
-circle(455,515,4)
-circle(470,515,4)
-circle(485,515,4)
-circle(500,515,4)
-circle(515,515,4)
-circle(530,515,4)
-circle(545,515,4)
-circle(560,515,4)
-circle(575,515,4)
-circle(590,515,4)
-circle(605,515,4)
-circle(620,515,4)
-circle(635,515,4)
-circle(350,530,4)
-circle(365,530,4)
-circle(380,530,4)
-circle(395,530,4)
-circle(410,530,4)
-circle(425,530,4)
-circle(440,530,4)
-circle(455,530,4)
-circle(470,530,4)
-circle(485,530,4)
-circle(500,530,4)
-circle(515,530,4)
-circle(530,530,4)
-circle(545,530,4)
-circle(560,530,4)
-circle(575,530,4)
-circle(590,530,4)
-circle(605,530,4)
-circle(620,530,4)
-circle(635,530,4)
-circle(350,545,4)
-circle(365,545,4)
-circle(380,545,4)
-circle(395,545,4)
-circle(410,545,4)
-circle(425,545,4)
-circle(440,545,4)
-circle(455,545,4)
-circle(470,545,4)
-circle(485,545,4)
-circle(500,545,4)
-circle(515,545,4)
-circle(530,545,4)
-circle(545,545,4)
-circle(560,545,4)
-circle(575,545,4)
-circle(590,545,4)
-circle(605,545,4)
-circle(620,545,4)
-circle(635,545,4)
-circle(350,560,4)
-circle(365,560,4)
-circle(380,560,4)
-circle(395,560,4)
-circle(410,560,4)
-circle(425,560,4)
-circle(440,560,4)
-circle(455,560,4)
-circle(470,560,4)
-circle(485,560,4)
-circle(500,560,4)
-circle(515,560,4)
-circle(530,560,4)
-circle(545,560,4)
-circle(560,560,4)
-circle(575,560,4)
-circle(590,560,4)
-circle(605,560,4)
-circle(620,560,4)
-circle(635,560,4)
-circle(350,575,4)
-circle(365,575,4)
-circle(380,575,4)
-circle(395,575,4)
-circle(410,575,4)
-circle(425,575,4)
-circle(440,575,4)
-circle(455,575,4)
-circle(470,575,4)
-circle(485,575,4)
-circle(500,575,4)
-circle(515,575,4)
-circle(530,575,4)
-circle(545,575,4)
-circle(560,575,4)
-circle(575,575,4)
-circle(590,575,4)
-circle(605,575,4)
-circle(620,575,4)
-circle(635,575,4)
-circle(350,590,4)
-circle(365,590,4)
-circle(380,590,4)
-circle(395,590,4)
-circle(410,590,4)
-circle(425,590,4)
-circle(440,590,4)
-circle(455,590,4)
-circle(470,590,4)
-circle(485,590,4)
-circle(500,590,4)
-circle(515,590,4)
-circle(530,590,4)
-circle(545,590,4)
-circle(560,590,4)
-circle(575,590,4)
-circle(590,590,4)
-circle(605,590,4)
-circle(620,590,4)
-circle(635,590,4)
-circle(350,605,4)
-circle(365,605,4)
-circle(380,605,4)
-circle(395,605,4)
-circle(410,605,4)
-circle(425,605,4)
-circle(440,605,4)
-circle(455,605,4)
-circle(470,605,4)
-circle(485,605,4)
-circle(500,605,4)
-circle(515,605,4)
-circle(530,605,4)
-circle(545,605,4)
-circle(560,605,4)
-circle(575,605,4)
-circle(590,605,4)
-circle(605,605,4)
-circle(620,605,4)
-circle(635,605,4)
-circle(350,620,4)
-circle(365,620,4)
-circle(380,620,4)
-circle(395,620,4)
-circle(410,620,4)
-circle(425,620,4)
-circle(440,620,4)
-circle(455,620,4)
-circle(470,620,4)
-circle(485,620,4)
-circle(500,620,4)
-circle(515,620,4)
-circle(530,620,4)
-circle(545,620,4)
-circle(560,620,4)
-circle(575,620,4)
-circle(590,620,4)
-circle(605,620,4)
-circle(620,620,4)
-circle(635,620,4)
-circle(350,635,4)
-circle(365,635,4)
-circle(380,635,4)
-circle(395,635,4)
-circle(410,635,4)
-circle(425,635,4)
-circle(440,635,4)
-circle(455,635,4)
-circle(470,635,4)
-circle(485,635,4)
-circle(500,635,4)
-circle(515,635,4)
-circle(530,635,4)
-circle(545,635,4)
-circle(560,635,4)
-circle(575,635,4)
-circle(590,635,4)
-circle(605,635,4)
-circle(620,635,4)
-circle(635,635,4)
diff --git a/funtools/funtest/snr900.reg b/funtools/funtest/snr900.reg
deleted file mode 100644
index a8dccca..0000000
--- a/funtools/funtest/snr900.reg
+++ /dev/null
@@ -1,900 +0,0 @@
-circle(350,350,4)
-circle(360,350,4)
-circle(370,350,4)
-circle(380,350,4)
-circle(390,350,4)
-circle(400,350,4)
-circle(410,350,4)
-circle(420,350,4)
-circle(430,350,4)
-circle(440,350,4)
-circle(450,350,4)
-circle(460,350,4)
-circle(470,350,4)
-circle(480,350,4)
-circle(490,350,4)
-circle(500,350,4)
-circle(510,350,4)
-circle(520,350,4)
-circle(530,350,4)
-circle(540,350,4)
-circle(550,350,4)
-circle(560,350,4)
-circle(570,350,4)
-circle(580,350,4)
-circle(590,350,4)
-circle(600,350,4)
-circle(610,350,4)
-circle(620,350,4)
-circle(630,350,4)
-circle(640,350,4)
-circle(350,360,4)
-circle(360,360,4)
-circle(370,360,4)
-circle(380,360,4)
-circle(390,360,4)
-circle(400,360,4)
-circle(410,360,4)
-circle(420,360,4)
-circle(430,360,4)
-circle(440,360,4)
-circle(450,360,4)
-circle(460,360,4)
-circle(470,360,4)
-circle(480,360,4)
-circle(490,360,4)
-circle(500,360,4)
-circle(510,360,4)
-circle(520,360,4)
-circle(530,360,4)
-circle(540,360,4)
-circle(550,360,4)
-circle(560,360,4)
-circle(570,360,4)
-circle(580,360,4)
-circle(590,360,4)
-circle(600,360,4)
-circle(610,360,4)
-circle(620,360,4)
-circle(630,360,4)
-circle(640,360,4)
-circle(350,370,4)
-circle(360,370,4)
-circle(370,370,4)
-circle(380,370,4)
-circle(390,370,4)
-circle(400,370,4)
-circle(410,370,4)
-circle(420,370,4)
-circle(430,370,4)
-circle(440,370,4)
-circle(450,370,4)
-circle(460,370,4)
-circle(470,370,4)
-circle(480,370,4)
-circle(490,370,4)
-circle(500,370,4)
-circle(510,370,4)
-circle(520,370,4)
-circle(530,370,4)
-circle(540,370,4)
-circle(550,370,4)
-circle(560,370,4)
-circle(570,370,4)
-circle(580,370,4)
-circle(590,370,4)
-circle(600,370,4)
-circle(610,370,4)
-circle(620,370,4)
-circle(630,370,4)
-circle(640,370,4)
-circle(350,380,4)
-circle(360,380,4)
-circle(370,380,4)
-circle(380,380,4)
-circle(390,380,4)
-circle(400,380,4)
-circle(410,380,4)
-circle(420,380,4)
-circle(430,380,4)
-circle(440,380,4)
-circle(450,380,4)
-circle(460,380,4)
-circle(470,380,4)
-circle(480,380,4)
-circle(490,380,4)
-circle(500,380,4)
-circle(510,380,4)
-circle(520,380,4)
-circle(530,380,4)
-circle(540,380,4)
-circle(550,380,4)
-circle(560,380,4)
-circle(570,380,4)
-circle(580,380,4)
-circle(590,380,4)
-circle(600,380,4)
-circle(610,380,4)
-circle(620,380,4)
-circle(630,380,4)
-circle(640,380,4)
-circle(350,390,4)
-circle(360,390,4)
-circle(370,390,4)
-circle(380,390,4)
-circle(390,390,4)
-circle(400,390,4)
-circle(410,390,4)
-circle(420,390,4)
-circle(430,390,4)
-circle(440,390,4)
-circle(450,390,4)
-circle(460,390,4)
-circle(470,390,4)
-circle(480,390,4)
-circle(490,390,4)
-circle(500,390,4)
-circle(510,390,4)
-circle(520,390,4)
-circle(530,390,4)
-circle(540,390,4)
-circle(550,390,4)
-circle(560,390,4)
-circle(570,390,4)
-circle(580,390,4)
-circle(590,390,4)
-circle(600,390,4)
-circle(610,390,4)
-circle(620,390,4)
-circle(630,390,4)
-circle(640,390,4)
-circle(350,400,4)
-circle(360,400,4)
-circle(370,400,4)
-circle(380,400,4)
-circle(390,400,4)
-circle(400,400,4)
-circle(410,400,4)
-circle(420,400,4)
-circle(430,400,4)
-circle(440,400,4)
-circle(450,400,4)
-circle(460,400,4)
-circle(470,400,4)
-circle(480,400,4)
-circle(490,400,4)
-circle(500,400,4)
-circle(510,400,4)
-circle(520,400,4)
-circle(530,400,4)
-circle(540,400,4)
-circle(550,400,4)
-circle(560,400,4)
-circle(570,400,4)
-circle(580,400,4)
-circle(590,400,4)
-circle(600,400,4)
-circle(610,400,4)
-circle(620,400,4)
-circle(630,400,4)
-circle(640,400,4)
-circle(350,410,4)
-circle(360,410,4)
-circle(370,410,4)
-circle(380,410,4)
-circle(390,410,4)
-circle(400,410,4)
-circle(410,410,4)
-circle(420,410,4)
-circle(430,410,4)
-circle(440,410,4)
-circle(450,410,4)
-circle(460,410,4)
-circle(470,410,4)
-circle(480,410,4)
-circle(490,410,4)
-circle(500,410,4)
-circle(510,410,4)
-circle(520,410,4)
-circle(530,410,4)
-circle(540,410,4)
-circle(550,410,4)
-circle(560,410,4)
-circle(570,410,4)
-circle(580,410,4)
-circle(590,410,4)
-circle(600,410,4)
-circle(610,410,4)
-circle(620,410,4)
-circle(630,410,4)
-circle(640,410,4)
-circle(350,420,4)
-circle(360,420,4)
-circle(370,420,4)
-circle(380,420,4)
-circle(390,420,4)
-circle(400,420,4)
-circle(410,420,4)
-circle(420,420,4)
-circle(430,420,4)
-circle(440,420,4)
-circle(450,420,4)
-circle(460,420,4)
-circle(470,420,4)
-circle(480,420,4)
-circle(490,420,4)
-circle(500,420,4)
-circle(510,420,4)
-circle(520,420,4)
-circle(530,420,4)
-circle(540,420,4)
-circle(550,420,4)
-circle(560,420,4)
-circle(570,420,4)
-circle(580,420,4)
-circle(590,420,4)
-circle(600,420,4)
-circle(610,420,4)
-circle(620,420,4)
-circle(630,420,4)
-circle(640,420,4)
-circle(350,430,4)
-circle(360,430,4)
-circle(370,430,4)
-circle(380,430,4)
-circle(390,430,4)
-circle(400,430,4)
-circle(410,430,4)
-circle(420,430,4)
-circle(430,430,4)
-circle(440,430,4)
-circle(450,430,4)
-circle(460,430,4)
-circle(470,430,4)
-circle(480,430,4)
-circle(490,430,4)
-circle(500,430,4)
-circle(510,430,4)
-circle(520,430,4)
-circle(530,430,4)
-circle(540,430,4)
-circle(550,430,4)
-circle(560,430,4)
-circle(570,430,4)
-circle(580,430,4)
-circle(590,430,4)
-circle(600,430,4)
-circle(610,430,4)
-circle(620,430,4)
-circle(630,430,4)
-circle(640,430,4)
-circle(350,440,4)
-circle(360,440,4)
-circle(370,440,4)
-circle(380,440,4)
-circle(390,440,4)
-circle(400,440,4)
-circle(410,440,4)
-circle(420,440,4)
-circle(430,440,4)
-circle(440,440,4)
-circle(450,440,4)
-circle(460,440,4)
-circle(470,440,4)
-circle(480,440,4)
-circle(490,440,4)
-circle(500,440,4)
-circle(510,440,4)
-circle(520,440,4)
-circle(530,440,4)
-circle(540,440,4)
-circle(550,440,4)
-circle(560,440,4)
-circle(570,440,4)
-circle(580,440,4)
-circle(590,440,4)
-circle(600,440,4)
-circle(610,440,4)
-circle(620,440,4)
-circle(630,440,4)
-circle(640,440,4)
-circle(350,450,4)
-circle(360,450,4)
-circle(370,450,4)
-circle(380,450,4)
-circle(390,450,4)
-circle(400,450,4)
-circle(410,450,4)
-circle(420,450,4)
-circle(430,450,4)
-circle(440,450,4)
-circle(450,450,4)
-circle(460,450,4)
-circle(470,450,4)
-circle(480,450,4)
-circle(490,450,4)
-circle(500,450,4)
-circle(510,450,4)
-circle(520,450,4)
-circle(530,450,4)
-circle(540,450,4)
-circle(550,450,4)
-circle(560,450,4)
-circle(570,450,4)
-circle(580,450,4)
-circle(590,450,4)
-circle(600,450,4)
-circle(610,450,4)
-circle(620,450,4)
-circle(630,450,4)
-circle(640,450,4)
-circle(350,460,4)
-circle(360,460,4)
-circle(370,460,4)
-circle(380,460,4)
-circle(390,460,4)
-circle(400,460,4)
-circle(410,460,4)
-circle(420,460,4)
-circle(430,460,4)
-circle(440,460,4)
-circle(450,460,4)
-circle(460,460,4)
-circle(470,460,4)
-circle(480,460,4)
-circle(490,460,4)
-circle(500,460,4)
-circle(510,460,4)
-circle(520,460,4)
-circle(530,460,4)
-circle(540,460,4)
-circle(550,460,4)
-circle(560,460,4)
-circle(570,460,4)
-circle(580,460,4)
-circle(590,460,4)
-circle(600,460,4)
-circle(610,460,4)
-circle(620,460,4)
-circle(630,460,4)
-circle(640,460,4)
-circle(350,470,4)
-circle(360,470,4)
-circle(370,470,4)
-circle(380,470,4)
-circle(390,470,4)
-circle(400,470,4)
-circle(410,470,4)
-circle(420,470,4)
-circle(430,470,4)
-circle(440,470,4)
-circle(450,470,4)
-circle(460,470,4)
-circle(470,470,4)
-circle(480,470,4)
-circle(490,470,4)
-circle(500,470,4)
-circle(510,470,4)
-circle(520,470,4)
-circle(530,470,4)
-circle(540,470,4)
-circle(550,470,4)
-circle(560,470,4)
-circle(570,470,4)
-circle(580,470,4)
-circle(590,470,4)
-circle(600,470,4)
-circle(610,470,4)
-circle(620,470,4)
-circle(630,470,4)
-circle(640,470,4)
-circle(350,480,4)
-circle(360,480,4)
-circle(370,480,4)
-circle(380,480,4)
-circle(390,480,4)
-circle(400,480,4)
-circle(410,480,4)
-circle(420,480,4)
-circle(430,480,4)
-circle(440,480,4)
-circle(450,480,4)
-circle(460,480,4)
-circle(470,480,4)
-circle(480,480,4)
-circle(490,480,4)
-circle(500,480,4)
-circle(510,480,4)
-circle(520,480,4)
-circle(530,480,4)
-circle(540,480,4)
-circle(550,480,4)
-circle(560,480,4)
-circle(570,480,4)
-circle(580,480,4)
-circle(590,480,4)
-circle(600,480,4)
-circle(610,480,4)
-circle(620,480,4)
-circle(630,480,4)
-circle(640,480,4)
-circle(350,490,4)
-circle(360,490,4)
-circle(370,490,4)
-circle(380,490,4)
-circle(390,490,4)
-circle(400,490,4)
-circle(410,490,4)
-circle(420,490,4)
-circle(430,490,4)
-circle(440,490,4)
-circle(450,490,4)
-circle(460,490,4)
-circle(470,490,4)
-circle(480,490,4)
-circle(490,490,4)
-circle(500,490,4)
-circle(510,490,4)
-circle(520,490,4)
-circle(530,490,4)
-circle(540,490,4)
-circle(550,490,4)
-circle(560,490,4)
-circle(570,490,4)
-circle(580,490,4)
-circle(590,490,4)
-circle(600,490,4)
-circle(610,490,4)
-circle(620,490,4)
-circle(630,490,4)
-circle(640,490,4)
-circle(350,500,4)
-circle(360,500,4)
-circle(370,500,4)
-circle(380,500,4)
-circle(390,500,4)
-circle(400,500,4)
-circle(410,500,4)
-circle(420,500,4)
-circle(430,500,4)
-circle(440,500,4)
-circle(450,500,4)
-circle(460,500,4)
-circle(470,500,4)
-circle(480,500,4)
-circle(490,500,4)
-circle(500,500,4)
-circle(510,500,4)
-circle(520,500,4)
-circle(530,500,4)
-circle(540,500,4)
-circle(550,500,4)
-circle(560,500,4)
-circle(570,500,4)
-circle(580,500,4)
-circle(590,500,4)
-circle(600,500,4)
-circle(610,500,4)
-circle(620,500,4)
-circle(630,500,4)
-circle(640,500,4)
-circle(350,510,4)
-circle(360,510,4)
-circle(370,510,4)
-circle(380,510,4)
-circle(390,510,4)
-circle(400,510,4)
-circle(410,510,4)
-circle(420,510,4)
-circle(430,510,4)
-circle(440,510,4)
-circle(450,510,4)
-circle(460,510,4)
-circle(470,510,4)
-circle(480,510,4)
-circle(490,510,4)
-circle(500,510,4)
-circle(510,510,4)
-circle(520,510,4)
-circle(530,510,4)
-circle(540,510,4)
-circle(550,510,4)
-circle(560,510,4)
-circle(570,510,4)
-circle(580,510,4)
-circle(590,510,4)
-circle(600,510,4)
-circle(610,510,4)
-circle(620,510,4)
-circle(630,510,4)
-circle(640,510,4)
-circle(350,520,4)
-circle(360,520,4)
-circle(370,520,4)
-circle(380,520,4)
-circle(390,520,4)
-circle(400,520,4)
-circle(410,520,4)
-circle(420,520,4)
-circle(430,520,4)
-circle(440,520,4)
-circle(450,520,4)
-circle(460,520,4)
-circle(470,520,4)
-circle(480,520,4)
-circle(490,520,4)
-circle(500,520,4)
-circle(510,520,4)
-circle(520,520,4)
-circle(530,520,4)
-circle(540,520,4)
-circle(550,520,4)
-circle(560,520,4)
-circle(570,520,4)
-circle(580,520,4)
-circle(590,520,4)
-circle(600,520,4)
-circle(610,520,4)
-circle(620,520,4)
-circle(630,520,4)
-circle(640,520,4)
-circle(350,530,4)
-circle(360,530,4)
-circle(370,530,4)
-circle(380,530,4)
-circle(390,530,4)
-circle(400,530,4)
-circle(410,530,4)
-circle(420,530,4)
-circle(430,530,4)
-circle(440,530,4)
-circle(450,530,4)
-circle(460,530,4)
-circle(470,530,4)
-circle(480,530,4)
-circle(490,530,4)
-circle(500,530,4)
-circle(510,530,4)
-circle(520,530,4)
-circle(530,530,4)
-circle(540,530,4)
-circle(550,530,4)
-circle(560,530,4)
-circle(570,530,4)
-circle(580,530,4)
-circle(590,530,4)
-circle(600,530,4)
-circle(610,530,4)
-circle(620,530,4)
-circle(630,530,4)
-circle(640,530,4)
-circle(350,540,4)
-circle(360,540,4)
-circle(370,540,4)
-circle(380,540,4)
-circle(390,540,4)
-circle(400,540,4)
-circle(410,540,4)
-circle(420,540,4)
-circle(430,540,4)
-circle(440,540,4)
-circle(450,540,4)
-circle(460,540,4)
-circle(470,540,4)
-circle(480,540,4)
-circle(490,540,4)
-circle(500,540,4)
-circle(510,540,4)
-circle(520,540,4)
-circle(530,540,4)
-circle(540,540,4)
-circle(550,540,4)
-circle(560,540,4)
-circle(570,540,4)
-circle(580,540,4)
-circle(590,540,4)
-circle(600,540,4)
-circle(610,540,4)
-circle(620,540,4)
-circle(630,540,4)
-circle(640,540,4)
-circle(350,550,4)
-circle(360,550,4)
-circle(370,550,4)
-circle(380,550,4)
-circle(390,550,4)
-circle(400,550,4)
-circle(410,550,4)
-circle(420,550,4)
-circle(430,550,4)
-circle(440,550,4)
-circle(450,550,4)
-circle(460,550,4)
-circle(470,550,4)
-circle(480,550,4)
-circle(490,550,4)
-circle(500,550,4)
-circle(510,550,4)
-circle(520,550,4)
-circle(530,550,4)
-circle(540,550,4)
-circle(550,550,4)
-circle(560,550,4)
-circle(570,550,4)
-circle(580,550,4)
-circle(590,550,4)
-circle(600,550,4)
-circle(610,550,4)
-circle(620,550,4)
-circle(630,550,4)
-circle(640,550,4)
-circle(350,560,4)
-circle(360,560,4)
-circle(370,560,4)
-circle(380,560,4)
-circle(390,560,4)
-circle(400,560,4)
-circle(410,560,4)
-circle(420,560,4)
-circle(430,560,4)
-circle(440,560,4)
-circle(450,560,4)
-circle(460,560,4)
-circle(470,560,4)
-circle(480,560,4)
-circle(490,560,4)
-circle(500,560,4)
-circle(510,560,4)
-circle(520,560,4)
-circle(530,560,4)
-circle(540,560,4)
-circle(550,560,4)
-circle(560,560,4)
-circle(570,560,4)
-circle(580,560,4)
-circle(590,560,4)
-circle(600,560,4)
-circle(610,560,4)
-circle(620,560,4)
-circle(630,560,4)
-circle(640,560,4)
-circle(350,570,4)
-circle(360,570,4)
-circle(370,570,4)
-circle(380,570,4)
-circle(390,570,4)
-circle(400,570,4)
-circle(410,570,4)
-circle(420,570,4)
-circle(430,570,4)
-circle(440,570,4)
-circle(450,570,4)
-circle(460,570,4)
-circle(470,570,4)
-circle(480,570,4)
-circle(490,570,4)
-circle(500,570,4)
-circle(510,570,4)
-circle(520,570,4)
-circle(530,570,4)
-circle(540,570,4)
-circle(550,570,4)
-circle(560,570,4)
-circle(570,570,4)
-circle(580,570,4)
-circle(590,570,4)
-circle(600,570,4)
-circle(610,570,4)
-circle(620,570,4)
-circle(630,570,4)
-circle(640,570,4)
-circle(350,580,4)
-circle(360,580,4)
-circle(370,580,4)
-circle(380,580,4)
-circle(390,580,4)
-circle(400,580,4)
-circle(410,580,4)
-circle(420,580,4)
-circle(430,580,4)
-circle(440,580,4)
-circle(450,580,4)
-circle(460,580,4)
-circle(470,580,4)
-circle(480,580,4)
-circle(490,580,4)
-circle(500,580,4)
-circle(510,580,4)
-circle(520,580,4)
-circle(530,580,4)
-circle(540,580,4)
-circle(550,580,4)
-circle(560,580,4)
-circle(570,580,4)
-circle(580,580,4)
-circle(590,580,4)
-circle(600,580,4)
-circle(610,580,4)
-circle(620,580,4)
-circle(630,580,4)
-circle(640,580,4)
-circle(350,590,4)
-circle(360,590,4)
-circle(370,590,4)
-circle(380,590,4)
-circle(390,590,4)
-circle(400,590,4)
-circle(410,590,4)
-circle(420,590,4)
-circle(430,590,4)
-circle(440,590,4)
-circle(450,590,4)
-circle(460,590,4)
-circle(470,590,4)
-circle(480,590,4)
-circle(490,590,4)
-circle(500,590,4)
-circle(510,590,4)
-circle(520,590,4)
-circle(530,590,4)
-circle(540,590,4)
-circle(550,590,4)
-circle(560,590,4)
-circle(570,590,4)
-circle(580,590,4)
-circle(590,590,4)
-circle(600,590,4)
-circle(610,590,4)
-circle(620,590,4)
-circle(630,590,4)
-circle(640,590,4)
-circle(350,600,4)
-circle(360,600,4)
-circle(370,600,4)
-circle(380,600,4)
-circle(390,600,4)
-circle(400,600,4)
-circle(410,600,4)
-circle(420,600,4)
-circle(430,600,4)
-circle(440,600,4)
-circle(450,600,4)
-circle(460,600,4)
-circle(470,600,4)
-circle(480,600,4)
-circle(490,600,4)
-circle(500,600,4)
-circle(510,600,4)
-circle(520,600,4)
-circle(530,600,4)
-circle(540,600,4)
-circle(550,600,4)
-circle(560,600,4)
-circle(570,600,4)
-circle(580,600,4)
-circle(590,600,4)
-circle(600,600,4)
-circle(610,600,4)
-circle(620,600,4)
-circle(630,600,4)
-circle(640,600,4)
-circle(350,610,4)
-circle(360,610,4)
-circle(370,610,4)
-circle(380,610,4)
-circle(390,610,4)
-circle(400,610,4)
-circle(410,610,4)
-circle(420,610,4)
-circle(430,610,4)
-circle(440,610,4)
-circle(450,610,4)
-circle(460,610,4)
-circle(470,610,4)
-circle(480,610,4)
-circle(490,610,4)
-circle(500,610,4)
-circle(510,610,4)
-circle(520,610,4)
-circle(530,610,4)
-circle(540,610,4)
-circle(550,610,4)
-circle(560,610,4)
-circle(570,610,4)
-circle(580,610,4)
-circle(590,610,4)
-circle(600,610,4)
-circle(610,610,4)
-circle(620,610,4)
-circle(630,610,4)
-circle(640,610,4)
-circle(350,620,4)
-circle(360,620,4)
-circle(370,620,4)
-circle(380,620,4)
-circle(390,620,4)
-circle(400,620,4)
-circle(410,620,4)
-circle(420,620,4)
-circle(430,620,4)
-circle(440,620,4)
-circle(450,620,4)
-circle(460,620,4)
-circle(470,620,4)
-circle(480,620,4)
-circle(490,620,4)
-circle(500,620,4)
-circle(510,620,4)
-circle(520,620,4)
-circle(530,620,4)
-circle(540,620,4)
-circle(550,620,4)
-circle(560,620,4)
-circle(570,620,4)
-circle(580,620,4)
-circle(590,620,4)
-circle(600,620,4)
-circle(610,620,4)
-circle(620,620,4)
-circle(630,620,4)
-circle(640,620,4)
-circle(350,630,4)
-circle(360,630,4)
-circle(370,630,4)
-circle(380,630,4)
-circle(390,630,4)
-circle(400,630,4)
-circle(410,630,4)
-circle(420,630,4)
-circle(430,630,4)
-circle(440,630,4)
-circle(450,630,4)
-circle(460,630,4)
-circle(470,630,4)
-circle(480,630,4)
-circle(490,630,4)
-circle(500,630,4)
-circle(510,630,4)
-circle(520,630,4)
-circle(530,630,4)
-circle(540,630,4)
-circle(550,630,4)
-circle(560,630,4)
-circle(570,630,4)
-circle(580,630,4)
-circle(590,630,4)
-circle(600,630,4)
-circle(610,630,4)
-circle(620,630,4)
-circle(630,630,4)
-circle(640,630,4)
-circle(350,640,4)
-circle(360,640,4)
-circle(370,640,4)
-circle(380,640,4)
-circle(390,640,4)
-circle(400,640,4)
-circle(410,640,4)
-circle(420,640,4)
-circle(430,640,4)
-circle(440,640,4)
-circle(450,640,4)
-circle(460,640,4)
-circle(470,640,4)
-circle(480,640,4)
-circle(490,640,4)
-circle(500,640,4)
-circle(510,640,4)
-circle(520,640,4)
-circle(530,640,4)
-circle(540,640,4)
-circle(550,640,4)
-circle(560,640,4)
-circle(570,640,4)
-circle(580,640,4)
-circle(590,640,4)
-circle(600,640,4)
-circle(610,640,4)
-circle(620,640,4)
-circle(630,640,4)
-circle(640,640,4)
diff --git a/funtools/funtest/swap b/funtools/funtest/swap
deleted file mode 100644
index fc72efc..0000000
--- a/funtools/funtest/swap
+++ /dev/null
@@ -1,5 +0,0 @@
- if( cur->x:D == cur->y:D ) continue;
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- cur->avg:E = (cur->x+cur->y)/2.0;
diff --git a/funtools/funtest/swap1 b/funtools/funtest/swap1
deleted file mode 100644
index be9672e..0000000
--- a/funtools/funtest/swap1
+++ /dev/null
@@ -1,8 +0,0 @@
- double a; # this is not passed to the generated C file
- # nor is this
- if( cur->x == cur->y ) continue;
- a = cur->x;
- cur->x = cur->y;
- cur->y = a;
- /* this comment is passed to the C file */
- cur->avg:E = (cur->x+cur->y)/2.0;
diff --git a/funtools/funtest/t1.reg b/funtools/funtest/t1.reg
deleted file mode 100644
index ec28a17..0000000
--- a/funtools/funtest/t1.reg
+++ /dev/null
@@ -1,6 +0,0 @@
-# Region file format: DS9 version 3.0
-# Filename: /home/eric/data/snr.fits
-global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
-fk5
-circle(345.2926,58.879817,151.99998")
-circle(344.86479,59.014261,223.99998")
diff --git a/funtools/funtest/t2.reg b/funtools/funtest/t2.reg
deleted file mode 100644
index c90cf83..0000000
--- a/funtools/funtest/t2.reg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Region file format: DS9 version 3.0
-# Filename: /home/eric/data/snr.fits
-global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
-fk5;circle(345.2926,58.879817,151.99998") # color=red
-fk5;circle(344.86479,59.014261,223.99998") # color=red
diff --git a/funtools/funtest/t3.reg b/funtools/funtest/t3.reg
deleted file mode 100644
index b5ca9e6..0000000
--- a/funtools/funtest/t3.reg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Region file format: DS9 version 3.0
-# Filename: /home/eric/data/snr.fits
-global color=green font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
-fk5, circle(345.2926,58.879817,151.99998"), circle(344.86479,59.014261,223.99998") # color=red
diff --git a/funtools/funtest/t4.reg b/funtools/funtest/t4.reg
deleted file mode 100644
index 01e908b..0000000
--- a/funtools/funtest/t4.reg
+++ /dev/null
@@ -1 +0,0 @@
-fk5; circle(345.2926,58.879817,151.99998"); circle(344.86479,59.014261,223.99998")
diff --git a/funtools/funtest/tboxell.in b/funtools/funtest/tboxell.in
deleted file mode 100644
index ffb46cd..0000000
--- a/funtools/funtest/tboxell.in
+++ /dev/null
@@ -1,50 +0,0 @@
-#OPROG funcnts
-#NPROG ../funcnts
-#OFILE /home/eric/data/snr.ev
-#NFILE /home/eric/data/snr.ev
-
-#CMD Old Region New region
-#--- ----------------- ---------------------
-EXACT ell $X $Y 10 20 ell $X $Y 10 20
-EXACT ell $X $Y 10 20 0 ell $X $Y 10 20 0
-EXACT ell $X $Y 10 20 90 ell $X $Y 10 20 90
-EXACT ell $X $Y 10 20 180 ell $X $Y 10 20 180
-EXACT ell $X $Y 10 20 270 ell $X $Y 10 20 270
-EXACT ell $X $Y 10 20 360 ell $X $Y 10 20 360
-
-EXACT ell $X $Y 10 20 1 ell $X $Y 10 20 1
-EXACT ell $X $Y 10 20 27 ell $X $Y 10 20 27
-EXACT ell $X $Y 10 20 54 ell $X $Y 10 20 54
-EXACT ell $X $Y 10 20 81 ell $X $Y 10 20 81
-EXACT ell $X $Y 10 20 108 ell $X $Y 10 20 108
-EXACT ell $X $Y 10 20 135 ell $X $Y 10 20 135
-EXACT ell $X $Y 10 20 162 ell $X $Y 10 20 162
-EXACT ell $X $Y 10 20 189 ell $X $Y 10 20 189
-EXACT ell $X $Y 10 20 216 ell $X $Y 10 20 216
-EXACT ell $X $Y 10 20 243 ell $X $Y 10 20 243
-EXACT ell $X $Y 10 20 270 ell $X $Y 10 20 270
-EXACT ell $X $Y 10 20 297 ell $X $Y 10 20 297
-EXACT ell $X $Y 10 20 324 ell $X $Y 10 20 324
-EXACT ell $X $Y 10 20 351 ell $X $Y 10 20 351
-
-EXACT box $X $Y 10 20 box $X $Y 10 20
-EXACT box $X $Y 10 20 0 box $X $Y 10 20 0
-EXACT box $X $Y 10 20 90 box $X $Y 10 20 90
-EXACT box $X $Y 10 20 180 box $X $Y 10 20 180
-EXACT box $X $Y 10 20 270 box $X $Y 10 20 270
-EXACT box $X $Y 10 20 360 box $X $Y 10 20 360
-EXACT box $X $Y 10 20 1 box $X $Y 10 20 1
-EXACT box $X $Y 10 20 27 box $X $Y 10 20 27
-EXACT box $X $Y 10 20 54 box $X $Y 10 20 54
-EXACT box $X $Y 10 20 81 box $X $Y 10 20 81
-EXACT box $X $Y 10 20 108 box $X $Y 10 20 108
-EXACT box $X $Y 10 20 135 box $X $Y 10 20 135
-EXACT box $X $Y 10 20 162 box $X $Y 10 20 162
-EXACT box $X $Y 10 20 189 box $X $Y 10 20 189
-EXACT box $X $Y 10 20 216 box $X $Y 10 20 216
-EXACT box $X $Y 10 20 243 box $X $Y 10 20 243
-EXACT box $X $Y 10 20 270 box $X $Y 10 20 270
-EXACT box $X $Y 10 20 297 box $X $Y 10 20 297
-EXACT box $X $Y 10 20 324 box $X $Y 10 20 324
-EXACT box $X $Y 10 20 351 box $X $Y 10 20 351
-
diff --git a/funtools/funtest/tcalc.in b/funtools/funtest/tcalc.in
deleted file mode 100644
index 1421d6d..0000000
--- a/funtools/funtest/tcalc.in
+++ /dev/null
@@ -1,14 +0,0 @@
-#OPROG funcalc
-#NPROG ../funcalc
-#OFILE /home/eric/data/snr.ev
-#NFILE /home/eric/data/snr.ev.gz
-
-#CMD #files funcalc expression
-#--- ------ ---------------------
-EXACT 1 fprintf(stdout,"%d %d %d %d %f\\n",cur->x,cur->y,cur->pha,cur->pi,cur->time);
-EXACT 1 cur->avg:E=(cur->x+cur->y)/2.0;fprintf(stdout,"%d %d %d %d %f %f\\n",cur->x,cur->y,cur->pha,cur->pi,cur->avg,cur->time);
-EXACT 2 a=cur->x;cur->x=cur->y;cur->y=a;
-EXACT 2 cur->avg:E=(cur->x+cur->y)/2.0;
-EXACT 2 if(cur->x==cur->y:D )continue;a=cur->x;cur->x=cur->y;cur->y=a;
-EXACT 2 cur->val[0]:3D = cur->x; cur->val[1] = cur->y; cur->val[2] = cur->pha;
-EXACT 2 cur->diff:E=cur->x-prev->x;cur->px:I=prev->x;
diff --git a/funtools/funtest/tcols.in b/funtools/funtest/tcols.in
deleted file mode 100644
index 206b0cb..0000000
--- a/funtools/funtest/tcols.in
+++ /dev/null
@@ -1,56 +0,0 @@
-#OPROG fundisp
-#NPROG ../fundisp
-#OFILE ./test.ev
-#NFILE ./test.ev
-
-#CMD Old Filter New Filter
-#--- ----------------- ---------------------
-EXACT pha=1:3&&pi=5:6 pha=1:3&&pi=5:6
-EXACT pha=1:3&&pi=5:6 pha=1,2,3&&pi=5,6
-EXACT pha=1,3&&pi=6 pha=1,3&&pi=6
-EXACT pha=1,3&&pi==6 pha=1,3&&pi=6
-EXACT pha=1,3&&pi>5 pha=1,3&&pi>5
-EXACT pha=1,3,pi>5 pha=1,3,pi>5
-EXACT pi=3:4&&pha>4 pi=3:4&&pha>4
-EXACT pi=3:4&&pha>4 pi=3,4,pha>4
-EXACT pi=3:4&&4<pha pi=3:4&&4<pha
-EXACT pi=3:4&&4<pha pi=3:4,4<pha
-EXACT pi=3:4,4<pha pi=3:4,4<pha
-EXACT pi=3:4,4<pha pi=3:4,(4<pha)
-EXACT pi=3:4,4<pha pi=3:4,((4<pha))
-EXACT pi=3:4,(4<pha) pi=3:4,(4<pha)
-EXACT pi=3:4&&(pha>4) pi=3:4&&(pha>4)
-EXACT pi=3:4&&(4<pha) pi=3:4&&(4<pha)
-EXACT pi=3:4,(pha>4) pi=3:4,(pha>4)
-EXACT pi=3:4,pha>4 pi=3:4,pha>4
-EXACT pha=1,79494600<time pha==1,79494600<time
-EXACT pi>pha+3 pi>pha+3
-EXACT pha=1,3,5:7,pi=2,4,6:8&&time>79494600 pha=1,3,5:7,pi=2,4,6:8&&time>79494600
-EXACT pha=1,3,5:7,pi=2,4,6:8,time<79487100 pha=1,3,5:7,pi=2,4,6:8,time<79487100
-EXACT pi=1,pha=3 pi=1,pha=3
-EXACT pi=1,pha=3 pi=1,pha==3
-EXACT pi=1&&pha=3 pi=1,pha=3
-EXACT pha=1,3,5:7,pi=2:4 pha=1,3,5:7,pi=2:4
-EXACT pha=1,3,5:7,pi=2:4 pha=1,3,5:7&&pi=2:4
-EXACT pha=1,3,5:7,pi=2,4,6:8 pha=1,3,5:7,pi=2,4,6:8
-EXACT pi=3:4,max(pi,pha)==pi+1 pi=3:4,max(pi,pha)==pi+1
-EXACT pi=3:4,max(pi,pha)==pi+1 pi=3:4,(max(pi,pha)==pi+1)
-EXACT (pow(x-$X,2)+pow(y-$Y,2))<=4 (pow(x-$X,2)+pow(y-$Y,2))<=4
-EXACT min(pi,pha)==2&&max(pi,pha)==3 min(pi,pha)==2&&max(pi,pha)==3
-EXACT min(pi,pha)*64==x min(pi,pha)*64==x
-EXACT max(pi,pha)==(pi+1) max(pi,pha)==(pi+1)
-EXACT (pi-pha)>(2+pha-log(pi)) (pi-pha)>(2+pha-log(pi))
-EXACT (pi<=2)&&(pi==pha) (pi<=2)&&(pi==pha)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==017)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0xf)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0b1111)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&017)==017)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0xf)==0xf)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0b1111)==0b1111)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=017)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0xf)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0b1111)
-
-
-
-
diff --git a/funtools/funtest/tcone.in b/funtools/funtest/tcone.in
deleted file mode 100644
index 30fc72b..0000000
--- a/funtools/funtest/tcone.in
+++ /dev/null
@@ -1,8 +0,0 @@
-#CMD CMD1 CMD2(def: use cmd1)
-#--- ---------- -------------------
-EXACT -r RA_N:d -d Dec_N:d cat.txt stdout 216.103d 35.665d ".1'"
-EXACT -l cat.ls -r RA_N:d -d Dec_N:d cat.txt stdout RA_N:d DEC_N:d ".1'"
-EXACT -r RA_N:d -d Dec_N:d cat.txt stdout 216.103d 35.665d ".1'" -l cat.ls -r RA_N:d -d Dec_N:d cat.txt stdout RA_N:d DEC_N:d ".1'"
-EXACT -l cat.ls -r RA_N:d -d Dec_N:d cat.txt stdout RA_N:d DEC_N:d ".1'" -r RA_N:d -d Dec_N:d cat.txt stdout 216.103d 35.665d ".1'"
-
-
diff --git a/funtools/funtest/tenv b/funtools/funtest/tenv
deleted file mode 100755
index 7190649..0000000
--- a/funtools/funtest/tenv
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# set -x
-
-X=504
-Y=512
-X2=`echo "$X + 10" | bc`
-Y2=`echo "$Y + 10" | bc`
-X3=`echo "$X + 20" | bc`
-Y3=$Y
-X4=`echo "$X + 10" | bc`
-Y4=`echo "$Y - 10" | bc`
-
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- echo before: $ARG3
- ARG3=`eval "echo \"${C}${ARG3}\""`
- echo after: $ARG3
-done
diff --git a/funtools/funtest/test.asc b/funtools/funtest/test.asc
deleted file mode 100644
index dfab34c..0000000
--- a/funtools/funtest/test.asc
+++ /dev/null
@@ -1,298 +0,0 @@
-# X Y PHA TIME
-#------- -------- -------- ---------------------
- -7 -7 -7 6.85000000
- -7 -7 -7 6.86000000
- -7 -7 -7 6.87000000
- -7 -7 -7 6.88000000
- -7 -7 -7 6.89000000
- -7 -7 -7 6.90000000
- -7 -7 -7 6.91000000
- -6 -7 -6 7.86000000
- -5 -7 -5 8.87000000
- -4 -7 -4 9.88000000
- -3 -7 -3 10.89000000
- -2 -7 -2 11.90000000
- -1 -7 -1 12.91000000
- 0 -7 0 13.92000000
- 0 -7 0 14.93000000
- 1 -7 1 15.94000000
- 2 -7 2 16.95000000
- 3 -7 3 17.96000000
- 4 -7 4 18.97000000
- 5 -7 5 19.98000000
- 6 -7 6 20.99000000
- 7 -7 7 22.00000000
- -7 -6 -7 22.86000000
- -6 -6 -6 28.87000000
- -6 -6 -6 28.88000000
- -6 -6 -6 28.89000000
- -6 -6 -6 28.90000000
- -6 -6 -6 28.91000000
- -6 -6 -6 28.92000000
- -5 -6 -5 29.88000000
- -4 -6 -4 30.89000000
- -3 -6 -3 31.90000000
- -2 -6 -2 32.91000000
- -1 -6 -1 33.92000000
- 0 -6 0 34.93000000
- 0 -6 0 35.94000000
- 1 -6 1 36.95000000
- 2 -6 2 37.96000000
- 3 -6 3 38.97000000
- 4 -6 4 39.98000000
- 5 -6 5 40.99000000
- 6 -6 6 42.00000000
- 7 -6 7 43.01000000
- -7 -5 -7 43.87000000
- -6 -5 -6 44.88000000
- -5 -5 -5 49.89000000
- -5 -5 -5 49.90000000
- -5 -5 -5 49.91000000
- -5 -5 -5 49.92000000
- -5 -5 -5 49.93000000
- -4 -5 -4 50.90000000
- -3 -5 -3 51.91000000
- -2 -5 -2 52.92000000
- -1 -5 -1 53.93000000
- 0 -5 0 54.94000000
- 0 -5 0 55.95000000
- 1 -5 1 56.96000000
- 2 -5 2 57.97000000
- 3 -5 3 58.98000000
- 4 -5 4 59.99000000
- 5 -5 5 61.00000000
- 6 -5 6 62.01000000
- 7 -5 7 63.02000000
- -7 -4 -7 63.88000000
- -6 -4 -6 64.89000000
- -5 -4 -5 65.90000000
- -4 -4 -4 69.91000000
- -4 -4 -4 69.92000000
- -4 -4 -4 69.93000000
- -4 -4 -4 69.94000000
- -3 -4 -3 70.92000000
- -2 -4 -2 71.93000000
- -1 -4 -1 72.94000000
- 0 -4 0 73.95000000
- 0 -4 0 74.96000000
- 1 -4 1 75.97000000
- 2 -4 2 76.98000000
- 3 -4 3 77.99000000
- 4 -4 4 79.00000000
- 5 -4 5 80.01000000
- 6 -4 6 81.02000000
- 7 -4 7 82.03000000
- -7 -3 -7 82.89000000
- -6 -3 -6 83.90000000
- -5 -3 -5 84.91000000
- -4 -3 -4 85.92000000
- -3 -3 -3 88.93000000
- -3 -3 -3 88.94000000
- -3 -3 -3 88.95000000
- -2 -3 -2 89.94000000
- -1 -3 -1 90.95000000
- 0 -3 0 91.96000000
- 0 -3 0 92.97000000
- 1 -3 1 93.98000000
- 2 -3 2 94.99000000
- 3 -3 3 96.00000000
- 4 -3 4 97.01000000
- 5 -3 5 98.02000000
- 6 -3 6 99.03000000
- 7 -3 7 100.04000000
- -7 -2 -7 100.90000000
- -6 -2 -6 101.91000000
- -5 -2 -5 102.92000000
- -4 -2 -4 103.93000000
- -3 -2 -3 104.94000000
- -2 -2 -2 106.95000000
- -2 -2 -2 106.96000000
- -1 -2 -1 107.96000000
- 0 -2 0 108.97000000
- 0 -2 0 109.98000000
- 1 -2 1 110.99000000
- 2 -2 2 112.00000000
- 3 -2 3 113.01000000
- 4 -2 4 114.02000000
- 5 -2 5 115.03000000
- 6 -2 6 116.04000000
- 7 -2 7 117.05000000
- -7 -1 -7 117.91000000
- -6 -1 -6 118.92000000
- -5 -1 -5 119.93000000
- -4 -1 -4 120.94000000
- -3 -1 -3 121.95000000
- -2 -1 -2 122.96000000
- -1 -1 -1 123.97000000
- 0 -1 0 124.98000000
- 0 -1 0 125.99000000
- 1 -1 1 127.00000000
- 2 -1 2 128.01000000
- 3 -1 3 129.02000000
- 4 -1 4 130.03000000
- 5 -1 5 131.04000000
- 6 -1 6 132.05000000
- 7 -1 7 133.06000000
- -7 0 -7 133.92000000
- -6 0 -6 134.93000000
- -5 0 -5 135.94000000
- -4 0 -4 136.95000000
- -3 0 -3 137.96000000
- -2 0 -2 138.97000000
- -1 0 -1 139.98000000
- 0 0 0 141.00000000
- 1 0 1 142.01000000
- 2 0 2 143.02000000
- 3 0 3 144.03000000
- 4 0 4 145.04000000
- 5 0 5 146.05000000
- 6 0 6 147.06000000
- 7 0 7 148.07000000
- -7 0 -7 148.93000000
- -6 0 -6 149.94000000
- -5 0 -5 150.95000000
- -4 0 -4 151.96000000
- -3 0 -3 152.97000000
- -2 0 -2 153.98000000
- -1 0 -1 154.99000000
- 0 0 0 156.00000000
- 1 0 1 157.02000000
- 2 0 2 158.03000000
- 3 0 3 159.04000000
- 4 0 4 160.05000000
- 5 0 5 161.06000000
- 6 0 6 162.07000000
- 7 0 7 163.08000000
- -7 1 -7 163.94000000
- -6 1 -6 164.95000000
- -5 1 -5 165.96000000
- -4 1 -4 166.97000000
- -3 1 -3 167.98000000
- -2 1 -2 168.99000000
- -1 1 -1 170.00000000
- 0 1 0 171.01000000
- 0 1 0 172.02000000
- 1 1 1 173.03000000
- 2 1 2 174.04000000
- 3 1 3 175.05000000
- 4 1 4 176.06000000
- 5 1 5 177.07000000
- 6 1 6 178.08000000
- 7 1 7 179.09000000
- -7 2 -7 179.95000000
- -6 2 -6 180.96000000
- -5 2 -5 181.97000000
- -4 2 -4 182.98000000
- -3 2 -3 183.99000000
- -2 2 -2 185.00000000
- -1 2 -1 186.01000000
- 0 2 0 187.02000000
- 0 2 0 188.03000000
- 1 2 1 189.04000000
- 2 2 2 191.05000000
- 2 2 2 191.06000000
- 3 2 3 192.06000000
- 4 2 4 193.07000000
- 5 2 5 194.08000000
- 6 2 6 195.09000000
- 7 2 7 196.10000000
- -7 3 -7 196.96000000
- -6 3 -6 197.97000000
- -5 3 -5 198.98000000
- -4 3 -4 199.99000000
- -3 3 -3 201.00000000
- -2 3 -2 202.01000000
- -1 3 -1 203.02000000
- 0 3 0 204.03000000
- 0 3 0 205.04000000
- 1 3 1 206.05000000
- 2 3 2 207.06000000
- 3 3 3 210.07000000
- 3 3 3 210.08000000
- 3 3 3 210.09000000
- 4 3 4 211.08000000
- 5 3 5 212.09000000
- 6 3 6 213.10000000
- 7 3 7 214.11000000
- -7 4 -7 214.97000000
- -6 4 -6 215.98000000
- -5 4 -5 216.99000000
- -4 4 -4 218.00000000
- -3 4 -3 219.01000000
- -2 4 -2 220.02000000
- -1 4 -1 221.03000000
- 0 4 0 222.04000000
- 0 4 0 223.05000000
- 1 4 1 224.06000000
- 2 4 2 225.07000000
- 3 4 3 226.08000000
- 4 4 4 230.09000000
- 4 4 4 230.10000000
- 4 4 4 230.11000000
- 4 4 4 230.12000000
- 5 4 5 231.10000000
- 6 4 6 232.11000000
- 7 4 7 233.12000000
- -7 5 -7 233.98000000
- -6 5 -6 234.99000000
- -5 5 -5 236.00000000
- -4 5 -4 237.01000000
- -3 5 -3 238.02000000
- -2 5 -2 239.03000000
- -1 5 -1 240.04000000
- 0 5 0 241.05000000
- 0 5 0 242.06000000
- 1 5 1 243.07000000
- 2 5 2 244.08000000
- 3 5 3 245.09000000
- 4 5 4 246.10000000
- 5 5 5 251.11000000
- 5 5 5 251.12000000
- 5 5 5 251.13000000
- 5 5 5 251.14000000
- 5 5 5 251.15000000
- 6 5 6 252.12000000
- 7 5 7 253.13000000
- -7 6 -7 253.99000000
- -6 6 -6 255.00000000
- -5 6 -5 256.01000000
- -4 6 -4 257.02000000
- -3 6 -3 258.03000000
- -2 6 -2 259.04000000
- -1 6 -1 260.05000000
- 0 6 0 261.06000000
- 0 6 0 262.07000000
- 1 6 1 263.08000000
- 2 6 2 264.09000000
- 3 6 3 265.10000000
- 4 6 4 266.11000000
- 5 6 5 267.12000000
- 6 6 6 273.13000000
- 6 6 6 273.14000000
- 6 6 6 273.15000000
- 6 6 6 273.16000000
- 6 6 6 273.17000000
- 6 6 6 273.18000000
- 7 6 7 274.14000000
- -7 7 -7 275.00000000
- -6 7 -6 276.01000000
- -5 7 -5 277.02000000
- -4 7 -4 278.03000000
- -3 7 -3 279.04000000
- -2 7 -2 280.05000000
- -1 7 -1 281.06000000
- 0 7 0 282.07000000
- 0 7 0 283.08000000
- 1 7 1 284.09000000
- 2 7 2 285.10000000
- 3 7 3 286.11000000
- 4 7 4 287.12000000
- 5 7 5 288.13000000
- 6 7 6 289.14000000
- 7 7 7 296.15000000
- 7 7 7 296.16000000
- 7 7 7 296.17000000
- 7 7 7 296.18000000
- 7 7 7 296.19000000
- 7 7 7 296.20000000
- 7 7 7 296.21000000
diff --git a/funtools/funtest/test.ev b/funtools/funtest/test.ev
deleted file mode 100644
index 7b7c8e4..0000000
--- a/funtools/funtest/test.ev
+++ /dev/null
@@ -1,62 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / There may be standard extensions END XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 26 / Width of table in bytes NAXIS2 = 296 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Table name EXTVER = 1 / Version number of table TFORM1 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TUNIT1 = ' ' / Physical units for field TFORM2 = '1I ' / Data type for field TTYPE2 = 'Y ' / Label for field TUNIT2 = ' ' / Physical units for field TFORM3 = '1I ' / Data type for field TTYPE3 = 'PHA ' / Label for field TUNIT3 = ' ' / Physical units for field TFORM4 = '1J ' / Data type for field TTYPE4 = 'PI ' / Label for field TUNIT4 = ' ' / Physical units for field TFORM5 = '1D ' / Data type for field TTYPE5 = 'TIME ' / Label for field TUNIT5 = ' ' / Physical units for field TFORM6 = '1E ' / Data type for field TTYPE6 = 'DX ' / Label for field TUNIT6 = ' ' / Physical units for field TFORM7 = '1E ' / Data type for field TTYPE7 = 'DY ' / Label for field TUNIT7 = ' ' / Physical units for field RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) EQUINOX = 2.000000E3 / equinox (epoch) for WCS TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 9.000000000000000E1 / sky coord (deg.) TCRVL2 = 6.000000000000000E1 / sky coord (deg.) TCDLT1 = -1.00000000000000E-1 / degrees per pixel TCDLT2 = 1.000000000000002E-1 / degrees per pixel TCRPX1 = 5.000000000000000E0 / pixel of tangent plane direc. TCRPX2 = 5.000000000000000E0 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) TLMIN1 = -7 / Min. axis value TLMAX1 = 7 / Max. axis value TLMIN2 = -7 / Min. axis value TLMAX2 = 7 / Max. axis value TLMIN6 = -7.50 / Min. axis value TLMAX6 = 7.50 / Max. axis value TLMIN7 = -7.50 / Min. axis value TLMAX7 = 7.50 / Max. axis value END ÿùÿùÿùÿÿÿù@ffffffÀð
-=qÀð
-=p¤Àð
-=qÀÐ
-=À°
-=p£×¿
-=@Ð
-=p¤ÀÐ
-=p¤À
-=p£×¿
-=@
-=qÀÐ
-=p£×À°
-=p£×¿À
-=@`
-=qÀð
-=?
-=q@°
-À°
-=¿
-=q@
-ÀÐ
-=À
-=¿À
-=q@`
-Àð
-=À
-=q@`
-=Àð
-=p£×À
-=q@
-@ð
-=p£×À`
-=q?À
-@Ð
-=p£×À
-=q?
-@°
-=p£×À°
-=q¿
-@
-=p£×ÀÐ
-=q¿À
-@`
-=p£×Àð
-=qÀ
-@
-=p¤@
-=p¤@ð
-=qÀ`
-?À
-=p¤@°
-=p¤@Ð
-=qÀ
-=@
-@Ð
-@ð
-=qÀ`
-=?À
-@Ð
-=p£×@ð
diff --git a/funtools/funtest/test.fits b/funtools/funtest/test.fits
deleted file mode 100644
index 8a58321..0000000
--- a/funtools/funtest/test.fits
+++ /dev/null
Binary files differ
diff --git a/funtools/funtest/test2.ev b/funtools/funtest/test2.ev
deleted file mode 100644
index 852f476..0000000
--- a/funtools/funtest/test2.ev
+++ /dev/null
@@ -1,113 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / There may be standard extensions END XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 26 / Width of table in bytes NAXIS2 = 145 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Table name EXTVER = 1 / Version number of table TFORM1 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TSCAL1 = 10.0 / Label for field TZERO1 = 1.0 / Label for field TUNIT1 = ' ' / Physical units for field TFORM2 = '1I ' / Data type for field TTYPE2 = 'Y ' / Label for field TSCAL2 = 20.0 / Label for field TZERO2 = 2.0 / Label for field TUNIT2 = ' ' / Physical units for field TFORM3 = '1I ' / Data type for field TTYPE3 = 'PHA ' / Label for field TUNIT3 = ' ' / Physical units for field TFORM4 = '1J ' / Data type for field TTYPE4 = 'PI ' / Label for field TUNIT4 = ' ' / Physical units for field TFORM5 = '1D ' / Data type for field TTYPE5 = 'TIME ' / Label for field TUNIT5 = ' ' / Physical units for field TFORM6 = '1E ' / Data type for field TTYPE6 = 'DX ' / Label for field TUNIT6 = ' ' / Physical units for field TFORM7 = '1E ' / Data type for field TTYPE7 = 'DY ' / Label for field TUNIT7 = ' ' / Physical units for field RADECSYS= 'FK5 ' / WCS for this file (e.g. Fk4) EQUINOX = 2.000000E3 / equinox (epoch) for WCS TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 9.000000000000000E1 / sky coord (deg.) TCRVL2 = 6.000000000000000E1 / sky coord (deg.) TCDLT1 = -1.00000000000000E-1 / degrees per pixel TCDLT2 = 1.000000000000002E-1 / degrees per pixel TCRPX1 = 5.000000000000000E0 / pixel of tangent plane direc. TCRPX2 = 5.000000000000000E0 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) TLMIN1 = 1 / Min. axis value TLMAX1 = 10 / Max. axis value TLMIN2 = 1 / Min. axis value TLMAX2 = 10 / Max. axis value TLMIN6 = 1.00 / Min. axis value TLMAX6 = 10.00 / Max. axis value TLMIN7 = 1.00 / Min. axis value TLMAX7 = 10.00 / Max. axis value END
-=@
-=@ 
-
-
-=p£×@à
-
-
-=p£×
-?€
-=p£×@À
-
-
-=qA
-=p£×
-@€
-=qA
-
-
-@@
-=q@ 
-=qA
-
-
-=p£×
-@
-=p£×@ 
-@À
-
-
-A
-=p£×@€
-=p£×
-@à
-áG®{@à
-A
-
-
-=p£×@@
-A
-=A
-
-
-=p£×@
-@à
-áG®{A
-=A
-=qA
-
-
-
-@_Ç
-=p£×?€
-
-@`×
-=p¤@
-
-@`$(õÂ\@@
-
-@`DzáG®@€
-
-@`dÌÌÌÌÍ@ 
-
-@`…¸Që…@À
-
-@`¥p£×
-=@à
-
-@`ÅÂ\(öA
-
-@`æzáG®A
-
-
-
-@b&fffffA
-
-
-
-@b&¸Që…A
-
-
-
-@b'
-=p£×A
-
-
-
-@b'\(õÂA
-
-
-
-@b'®záHA
-
-
-
-@b(
-
-
-
-@b(Që…¸A
-
-
-
-@b(£×
-=qA
-
-
-
-@b(õÂ\)A
-
-
-
-@b)G®záA
diff --git a/funtools/funtest/test2.raw b/funtools/funtest/test2.raw
deleted file mode 100644
index 24d57fb..0000000
--- a/funtools/funtest/test2.raw
+++ /dev/null
Binary files differ
diff --git a/funtools/funtest/tevread b/funtools/funtest/tevread
deleted file mode 100755
index 407953c..0000000
--- a/funtools/funtest/tevread
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-
-if [ ! -x evread ]; then
- echo "making evread ..."
- make evread
-fi
-
-PRE=foo
-S=${HOME}/data/snr.ev
-PROG=./evread
-X=504
-Y=512
-
-while [ x"$1" != x ]; do
- case $1 in
- -P)
- PROG=./evread.pure
- shift
- continue;;
- -f)
- shift
- S=$1
- shift
- S=$1
- shift
- continue;;
- -x)
- shift
- X=$1
- shift
- continue;;
- -y)
- shift
- Y=$1
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-X2=`echo "$X + 10" | bc`
-Y2=`echo "$Y + 10" | bc`
-X3=`echo "$X + 20" | bc`
-Y3=$Y
-X4=`echo "$X + 10" | bc`
-Y4=`echo "$Y - 10" | bc`
-
-echo "${PRE}: array of structs, funtools alloc ..."
-echo "${PRE}1: array of structs, user alloc ..."
-echo "${PRE}2: struct of arrays, funtools alloc ..."
-echo "${PRE}3: struct of arrays, user alloc ..."
-echo "${PRE}4: struct of pointers, funtools alloc ..."
-echo "${PRE}5: struct of pointers, user alloc ..."
-echo "${PRE}6: array of pointers, funtools alloc ..."
-echo "${PRE}7: array of pointers, user alloc ..."
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- eval "E=\"[$ARG2]\""
- echo FILE $S"$E"
- ${PROG} -w ${PRE}.fits $S"$E" > ${PRE}.ls
- ${PROG} -u -w ${PRE}1.fits $S"$E" > ${PRE}1.ls
- ${PROG} -a -w ${PRE}2.fits $S"$E" > ${PRE}2.ls
- ${PROG} -a -u -w ${PRE}3.fits $S"$E" > ${PRE}3.ls
- ${PROG} -p -w ${PRE}4.fits $S"$E" > ${PRE}4.ls
- ${PROG} -p -u -w ${PRE}5.fits $S"$E" > ${PRE}5.ls
- ${PROG} -e -w ${PRE}6.fits $S"$E" > ${PRE}6.ls
- ${PROG} -e -u -w ${PRE}7.fits $S"$E" > ${PRE}7.ls
- for i in 1 2 3 4 5 6 7
- do
- echo "EXACT ${PRE} and ${PRE}${i} ..."
- cmp ${PRE}.fits ${PRE}${i}.fits
-# if [ $? != 0 ]; then
-# exit
-# fi
- diff ${PRE}.ls ${PRE}${i}.ls
-# if [ $? != 0 ]; then
-# exit
-# fi
- done
- rm -f ${PRE}*.fits
- rm -f ${PRE}*.ls
-
-done
-
diff --git a/funtools/funtest/tfile.in b/funtools/funtest/tfile.in
deleted file mode 100644
index ecc3b6e..0000000
--- a/funtools/funtest/tfile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-#OPROG funcnts
-#NPROG ../funcnts
-#OFILE /home/eric/data/snr.ev
-#NFILE /home/eric/data/snr.ev
-
-#CMD Old Region New region
-#--- ----------------- ---------------------
-EXACT @t1.reg @t1.reg
-EXACT @t2.reg @t2.reg
-EXACT @t3.reg @t3.reg
-EXACT @t4.reg @t4.reg
-EXACT @t1.reg @t2.reg
-EXACT @t1.reg @t3.reg
-EXACT @t1.reg @t4.reg
-EXACT @t2.reg @t3.reg
-EXACT @t2.reg @t4.reg
-EXACT @t3.reg @t4.reg
diff --git a/funtools/funtest/tfuncalc b/funtools/funtest/tfuncalc
deleted file mode 100755
index 6f532b6..0000000
--- a/funtools/funtest/tfuncalc
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/bin/sh
-#set -x
-
-VERBOSE=0
-OPROG=funcalc
-NPROG=../funcalc
-R="cir(511,512,1)"
-OFILE="${HOME}/data/snr.ev"
-NFILE="${HOME}/data/snr.ev.gz"
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -f2)
- shift
- OFILE=$1
- shift
- NFILE=$1
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../funcalc.pure
- shift
- continue;;
- -V)
- DO1=YES
- NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funcalc"
- shift
- continue;;
- -r)
- shift
- R=$1
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -v2)
- VERBOSE=2
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-OFILE="${OFILE}[${R}]"
-NFILE="${NFILE}[${R}]"
-$ECHO "OPROG="${OPROG} "FILE="${OFILE}
-$ECHO "NPROG="${NPROG} "FILE="${NFILE}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=${ARG1}
- if [ x"$ARG2" = x1 ]; then
- OUT=FALSE
- else
- OUT=TRUE
- fi
- EXPR=${ARG3}
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- ;;
- NPROG)
- NPROG=$ARG2
- ;;
- OFILE)
- OFILE=$ARG2
- ;;
- NFILE)
- NFILE=$ARG2
- ;;
- REGION)
- R=$ARG2
- ;;
- EXIT)
- exit
- ;;
- EXACT|SUM|REV)
- if [ x"$DO1" = xYES ]; then
- $ECHO "DO1: $EXPR"
- if [ x"$OUT" = xFALSE ]; then
- $NPROG -l "-L.." -e "${EXPR}" ${NFILE} > funcalc1.out
- else
- $NPROG -l "-L.." -e "${EXPR}" ${NFILE} stdout | fundisp stdin > funcalc1.out
- fi
- else
- $ECHO "EXACT: $EXPR"
- CMP=yes
- XPROG=""
- if [ x"$OUT" = xFALSE ]; then
- $OPROG -e ${EXPR} ${OFILE} > tfuncalc1.out 2>err.log
- else
- $OPROG -e ${EXPR} ${OFILE} stdout | fundisp stdin > tfuncalc1.out 2>err.log
- fi
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
- if [ x"$OUT" = xFALSE ]; then
- $NPROG -l "-L.." -e ${EXPR} ${NFILE} > tfuncalc2.out
- else
- $NPROG -l "-L.." -e ${EXPR} ${NFILE} stdout | fundisp stdin > tfuncalc2.out
- fi
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-""}${XPROG:+" "}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- mv tfuncalc1.out funcalc1.out
- mv tfuncalc2.out funcalc2.out
- diff funcalc1.out funcalc2.out
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** funcalc1.out *****"
- cat funcalc1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** funcalc1.out *****"
- cat funcalc1.out
- $ECHO "***** funcalc2.out *****"
- cat funcalc2.out
- fi
- rm -f err.log
-done
-
-rm -f funcalc1.out funcalc2.out tfuncalc1.out tfuncalc2.out
diff --git a/funtools/funtest/tfuncnts b/funtools/funtest/tfuncnts
deleted file mode 100755
index 8ad5539..0000000
--- a/funtools/funtest/tfuncnts
+++ /dev/null
@@ -1,307 +0,0 @@
-#!/bin/sh
-# set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-SW="-r"
-X=504
-Y=512
-STDIN=/dev/null
-OPROG=funcnts
-NPROG=../funcnts
-OFILE=${HOME}/data/snr.ev
-NFILE=${HOME}/data/snr.ev.gz
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-EAWK='start==1&&NF>0{tpix += $2; tarea +=$3; print $0};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
-
-SAWK='start==1&&NF>0{tpix += $2; tarea +=$3};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
-
-FAWK='{tpix = $1};END{print tpix}'
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -b)
- shift
- B="$1"
- shift
- continue;;
- -c)
- shift
- C="$1;"
- shift
- continue;;
- -E)
- DOEXACT=YES
- shift
- continue;;
- -e)
- FIELD=`${OPROG} ${OFILE} "field" | awk "$SAWK" | awk "$FAWK"`
- $ECHO "FIELD: $FIELD"
- $ECHO " "
- M="-"
- shift
- continue;;
- -f1)
- shift
- OFILE=$1
- NFILE=$1
- shift
- continue;;
- -f2)
- shift
- OFILE=$1
- shift
- NFILE=$1
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$1
- if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- continue;;
- -P)
- PURE=YES
- NPROG=../funcnts.pure
- shift
- continue;;
- -V)
- DO1=YES
- NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funcnts"
- shift
- continue;;
- -s)
- shift
- SW=$1
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -v2)
- VERBOSE=2
- shift
- continue;;
- -x)
- shift
- X=$1
- shift
- continue;;
- -y)
- shift
- Y=$1
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-if [ x"$B" != x ]; then
- OFILE=${OFILE}"[$B]"
- NFILE=${NFILE}"[$B]"
-fi
-
-X2=`$ECHO "$X + 10" | bc`
-Y2=`$ECHO "$Y + 10" | bc`
-X3=`$ECHO "$X + 20" | bc`
-Y3=$Y
-X4=`$ECHO "$X + 10" | bc`
-Y4=`$ECHO "$Y - 10" | bc`
-
-$ECHO "OPROG="${OPROG} "OFILE="${OFILE}
-$ECHO "NPROG="${NPROG} "NFILE="${NFILE}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- eval "ARG2=\"${C}$ARG2\""
- eval "ARG3=\"${C}$ARG3\""
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- ;;
- NPROG)
- NPROG=$ARG2
- ;;
- OFILE)
- OFILE=$ARG2
- ;;
- NFILE)
- NFILE=$ARG2
- ;;
- EXCLUDE)
- FIELD=`$OPROG ${OFILE} "field" | awk "$SAWK" | awk "$FAWK"`
- $ECHO "FIELD: $FIELD"
- $ECHO " "
- M="-"
- ;;
- EXIT)
- exit
- ;;
- EXACT)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
- else
- $ECHO "${M}EXACT: $ARG2 ... $ARG3"
- if [ x"$DOEXACT" = xYES ]; then
- CMP=yes
- XPROG=""
- $OPROG ${SW} ${OFILE} "$ARG2" > funcnts1.out 2>err.log
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- cat err.log
- fi
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-''}${XPROG:+' '}$NPROG"
- fi
- else
- CMP=yes
- XPROG=""
- $OPROG ${SW} ${OFILE} "$ARG2" | awk $EAWK > funcnts1.out 2>err.log
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- cat err.log
- fi
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" |awk $EAWK >funcnts2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-''}${XPROG:+' '}$NPROG"
- fi
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x$M = x ]; then
- diff funcnts1.out funcnts2.out
- else
- V1=`cat funcnts1.out | awk $FAWK`
- V2=`cat funcnts2.out | awk $FAWK`
- V2=`$ECHO "$FIELD-$V2" | bc`
- if [ $V1 != $V2 ]; then
- $ECHO "V1=$V1 V2=$V2"
- fi
- fi
- fi
- fi
- $ECHO " "
- ;;
- REV)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
- else
- $ECHO "${M}REV: $ARG2 ... $ARG3"
- $OPROG ${SW} ${OFILE} "$ARG2" | awk $EAWK > tfuncnts1.out
- if test $? -ne 0; then
- $ECHO "skipping $NPROG due to error"
- else
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" | awk $EAWK > tfuncnts2.out
- if [ x$M = x ]; then
- awk 'NF==3{print $0}' < tfuncnts1.out | sort -r | awk '{print $2,$3}' > funcnts1.out
- awk 'NF==3{print $2,$3}' < tfuncnts2.out > funcnts2.out
- diff funcnts1.out funcnts2.out
- else
- V1=`cat funcnts1.out | awk $FAWK`
- V2=`cat funcnts2.out | awk $FAWK`
- V2=`$ECHO "$FIELD-$V2" | bc`
- if [ $V1 != $V2 ]; then
- $ECHO "V1=$V1 V2=$V2"
- fi
- fi
- fi
- fi
- $ECHO " "
- ;;
- SUM)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" > funcnts2.out
- else
- $ECHO "${M}SUM: $ARG2 ... $ARG3"
- $OPROG ${SW} ${OFILE} "$ARG2" | awk $SAWK > funcnts1.out
- if test $? -ne 0; then
- $ECHO "skipping $NPROG due to error"
- else
- cat $STDIN | $NPROG ${SW} ${NFILE} "${M}$ARG3" | awk $SAWK > funcnts2.out
- if [ x$M = x ]; then
- diff funcnts1.out funcnts2.out
- else
- V1=`cat funcnts1.out | awk $FAWK`
- V2=`cat funcnts2.out | awk $FAWK`
- V2=`$ECHO "$FIELD-$V2" | bc`
- if [ $V1 != $V2 ]; then
- $ECHO "V1=$V1 V2=$V2"
- fi
- fi
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** funcnts1.out *****"
- cat funcnts1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** funcnts1.out *****"
- cat funcnts1.out
- $ECHO "***** funcnts2.out *****"
- cat funcnts2.out
- fi
- rm -f err.log
-done
-
-rm -f funcnts1.out funcnts2.out tfuncnts1.out tfuncnts2.out
diff --git a/funtools/funtest/tfuncone b/funtools/funtest/tfuncone
deleted file mode 100755
index 7b307c4..0000000
--- a/funtools/funtest/tfuncone
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/bin/sh
-#set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-OPROG=funcone
-NPROG=../funcone
-STDIN=/dev/null
-FILE=cat.txt
-LIST="cat.ls"
-
-# avoid setting EXTNAME since we are not using
-if [ x$TEXT_EXTNAME != x ]; then
- unset TEXT_EXTNAME
-fi
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../funcone.pure
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -V)
- VERBOSE=2
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-$ECHO "OPROG="${OPROG}
-$ECHO "NPROG="${NPROG}
-
-IFS=" "
-while read ARG1 ARG2 ARG3 ARG4; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
-
- if [ x$ARG3 = x ]; then
- ARG3="$ARG2"
- fi
-
- case $CMD in
- EXIT)
- exit
- ;;
- EXACT)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- eval "$NPROG $ARG3" | fundisp stdin > funcone2.out
- else
- $ECHO "${M}EXACT: $ARG2 ... $ARG3"
- CMP=yes
- XPROG=""
- eval "$OPROG $ARG2" | fundisp stdin > tfuncone1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
-
- eval "$NPROG $ARG3" | fundisp stdin > tfuncone2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfuncone1.out > funcone1.out
- sed "/^ *$X $Y.*$/d" < tfuncone2.out > funcone2.out
- else
- mv tfuncone1.out funcone1.out
- mv tfuncone2.out funcone2.out
- fi
- diff funcone1.out funcone2.out
- else
- $ECHO "skipping compare due to errors in $XPROG"
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** funcone1.out *****"
- cat funcone1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** funcone1.out *****"
- cat funcone1.out
- $ECHO "***** funcone2.out *****"
- cat funcone2.out
- fi
- rm -f err.log
-done
-
-rm -f funcone1.out funcone2.out tfuncone1.out tfuncone2.out
diff --git a/funtools/funtest/tfundisp b/funtools/funtest/tfundisp
deleted file mode 100755
index 6edfb82..0000000
--- a/funtools/funtest/tfundisp
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/sh
-# set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-OPROG=fundisp
-NPROG=../fundisp
-STDIN=/dev/null
-OFILE=${HOME}/data/snr.ev
-NFILE=${HOME}/data/snr.ev.gz
-X=504
-Y=512
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -b)
- shift
- B="$1("
- B2=")"
- shift
- continue;;
- -c)
- shift
- C="$1\;"
- shift
- continue;;
- -e)
- OM="field;-"
- NM="-"
- shift
- continue;;
- -f2)
- shift
- OFILE=$1
- shift
- NFILE=$1
- shift
- continue;;
- -i)
- DOINC=YES
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$1
- if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../fundisp.pure
- shift
- continue;;
- -V)
- DO1=YES
- NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../fundisp"
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -v2)
- VERBOSE=2
- shift
- continue;;
- -x)
- shift
- X=$1
- shift
- continue;;
- -y)
- shift
- Y=$1
- shift
- continue;;
- -z)
- ZBUG=true
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-X2=`$ECHO "$X + 10" | bc`
-Y2=`$ECHO "$Y + 10" | bc`
-X3=`$ECHO "$X + 20" | bc`
-Y3=$Y
-X4=`$ECHO "$X + 10" | bc`
-Y4=`$ECHO "$Y - 10" | bc`
-
-$ECHO "OPROG="${OPROG} "FILE="${OFILE}
-$ECHO "NPROG="${NPROG} "FILE="${NFILE}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- eval "ARG2=\"${C}$ARG2\""
- eval "ARG3=\"${C}$ARG3\""
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- $ECHO OPROG="${OPROG}"
- ;;
- NPROG)
- NPROG=$ARG2
- $ECHO NPROG="${NPROG}"
- ;;
- OFILE)
- OFILE=$ARG2
- $ECHO OFILE="${OFILE}"
- ;;
- NFILE)
- NFILE=$ARG2
- $ECHO NFILE="${NFILE}"
- ;;
- EXCLUDE)
- OM="field;-"
- NM="-"
- ;;
- EXIT)
- exit
- ;;
- EXACT|SUM|REV)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- eval "cat $STDIN | $NPROG ${NFILE}\"[${NM}$ARG3]\" > fundisp2.out"
- else
- if [ x"$DOINC" = xYES ]; then
- $ECHO "$ARG3" > arg3.inc
- $ECHO "${M}EXACT: ${B}$ARG2${B2} ... ${B}@include($ARG3)${B2}"
- ARG3="@arg3.inc"
- else
- $ECHO "${M}EXACT: ${B}$ARG2 ... ${B}$ARG3"
- fi
- CMP=yes
- XPROG=""
- $OPROG ${OFILE}"[${B}${OM}$ARG2${B2}]" > tfundisp1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
- cat $STDIN | $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" > tfundisp2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfundisp1.out > fundisp1.out
- sed "/^ *$X $Y.*$/d" < tfundisp2.out > fundisp2.out
- else
- mv tfundisp1.out fundisp1.out
- mv tfundisp2.out fundisp2.out
- fi
- diff fundisp1.out fundisp2.out
- else
- $ECHO "skipping compare due to errors in $XPROG"
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** fundisp1.out *****"
- cat fundisp1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** fundisp1.out *****"
- cat fundisp1.out
- $ECHO "***** fundisp2.out *****"
- cat fundisp2.out
- fi
- rm -f err.log
-done
-
-rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
diff --git a/funtools/funtest/tfunhead b/funtools/funtest/tfunhead
deleted file mode 100755
index 7c2a742..0000000
--- a/funtools/funtest/tfunhead
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/bin/sh
-# set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-TEXT=0
-OPROG=funhead
-NPROG=../funhead
-STDIN=/dev/null
-OFILE=${HOME}/data/snr.ev
-NFILE=${HOME}/data/snr.ev.gz
-X=504
-Y=512
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -b)
- shift
- B="$1("
- B2=")"
- shift
- continue;;
- -c)
- shift
- C="$1\;"
- shift
- continue;;
- -e)
- OM="field;-"
- NM="-"
- shift
- continue;;
- -f2)
- shift
- OFILE=$1
- shift
- NFILE=$1
- shift
- continue;;
- -i)
- DOINC=YES
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$NFILE
- if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../funhead.pure
- shift
- continue;;
- -V)
- DO1=YES
- NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funhead"
- shift
- continue;;
- -t)
- TEXT=1
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -v2)
- VERBOSE=2
- shift
- continue;;
- -x)
- shift
- X=$1
- shift
- continue;;
- -y)
- shift
- Y=$1
- shift
- continue;;
- -z)
- ZBUG=true
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-X2=`$ECHO "$X + 10" | bc`
-Y2=`$ECHO "$Y + 10" | bc`
-X3=`$ECHO "$X + 20" | bc`
-Y3=$Y
-X4=`$ECHO "$X + 10" | bc`
-Y4=`$ECHO "$Y - 10" | bc`
-
-$ECHO "OPROG="${OPROG} "FILE="${OFILE}
-$ECHO "NPROG="${NPROG} "FILE="${NFILE}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- eval "ARG2=\"${C}$ARG2\""
- eval "ARG3=\"${C}$ARG3\""
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- $ECHO OPROG="${OPROG}"
- ;;
- NPROG)
- NPROG=$ARG2
- $ECHO NPROG="${NPROG}"
- ;;
- OFILE)
- OFILE=$ARG2
- $ECHO OFILE="${OFILE}"
- ;;
- NFILE)
- NFILE=$ARG2
- $ECHO NFILE="${NFILE}"
- ;;
- EXCLUDE)
- OM="field;-"
- NM="-"
- ;;
- EXIT)
- exit
- ;;
- EXACT|SUM|REV)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- $NPROG ${NFILE}"[${NM}$ARG3]" < $STDIN | egrep -v OBS_ID | \
- sed 's/ */ /g' | sort | \
- awk -F/ '{print $1}' | awk -F= '$2 ~ /'\''/{print $1,$2; next}{printf("%s %f\n", $1, $2)}' > funhead2.out
- else
- if [ x"$DOINC" = xYES ]; then
- $ECHO "$ARG3" > arg3.inc
- $ECHO "${M}EXACT: ${B}$ARG2${B2} ... ${B}@include($ARG3)${B2}"
- ARG3="@arg3.inc"
- else
- $ECHO "${M}EXACT: ${B}$ARG2 ... ${B}$ARG3"
- fi
- CMP=yes
- XPROG=""
- $OPROG ${OFILE}"[${B}${OM}$ARG2${B2}]" | egrep -v OBS_ID | \
- sed 's/ */ /g' | sort | \
- awk -F/ '{print $1}' | awk -F= '$2 ~ /'\''/{print $1,$2; next}{printf("%s %f\n", $1, $2)}' > tfunhead1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
- if [ x$TEXT = x1 ]; then
- ARG3=`$ECHO "$ARG3-1" | bc`
- fi
- $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" < $STDIN | egrep -v OBS_ID | \
- sed 's/ */ /g' | sort | \
- awk -F/ '{print $1}' | awk -F= '$2 ~ /'\''/{print $1,$2; next}{printf("%s %f\n", $1, $2)}' > tfunhead2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfunhead1.out > funhead1.out
- sed "/^ *$X $Y.*$/d" < tfunhead2.out > funhead2.out
- else
- mv tfunhead1.out funhead1.out
- mv tfunhead2.out funhead2.out
- fi
- diff funhead1.out funhead2.out
- else
- $ECHO "skipping compare due to errors in $XPROG"
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** funhead1.out *****"
- cat funhead1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** funhead1.out *****"
- cat funhead1.out
- $ECHO "***** funhead2.out *****"
- cat funhead2.out
- fi
- rm -f err.log
-done
-
-rm -f funhead1.out funhead2.out tfunhead1.out tfunhead2.out
diff --git a/funtools/funtest/tfunimage b/funtools/funtest/tfunimage
deleted file mode 100755
index ee8b5a8..0000000
--- a/funtools/funtest/tfunimage
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/sh
-# set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-OPROG=../fundisp
-NPROG=../funimage
-STDIN=/dev/null
-OFILE=${HOME}/data/snr.fits
-NFILE=${HOME}/data/bzero.fits
-X=504
-Y=512
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -b)
- shift
- B="$1("
- B2=")"
- shift
- continue;;
- -c)
- shift
- C="$1\;"
- shift
- continue;;
- -e)
- OM="field;-"
- NM="-"
- shift
- continue;;
- -f2)
- shift
- OFILE=$1
- shift
- NFILE=$1
- shift
- continue;;
- -i)
- DOINC=YES
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$NFILE
- if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../funimage.pure
- shift
- continue;;
- -V)
- DO1=YES
- NPROG="/usr/bin/valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes ../funimage"
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -v2)
- VERBOSE=2
- shift
- continue;;
- -x)
- shift
- X=$1
- shift
- continue;;
- -y)
- shift
- Y=$1
- shift
- continue;;
- -z)
- ZBUG=true
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-X2=`$ECHO "$X + 10" | bc`
-Y2=`$ECHO "$Y + 10" | bc`
-X3=`$ECHO "$X + 20" | bc`
-Y3=$Y
-X4=`$ECHO "$X + 10" | bc`
-Y4=`$ECHO "$Y - 10" | bc`
-
-$ECHO "OPROG="${OPROG} "FILE="${OFILE}
-$ECHO "NPROG="${NPROG} "FILE="${NFILE}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- eval "ARG2=\"${C}$ARG2\""
- eval "ARG3=\"${C}$ARG3\""
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- $ECHO OPROG="${OPROG}"
- ;;
- NPROG)
- NPROG=$ARG2
- $ECHO NPROG="${NPROG}"
- ;;
- OFILE)
- OFILE=$ARG2
- $ECHO OFILE="${OFILE}"
- ;;
- NFILE)
- NFILE=$ARG2
- $ECHO NFILE="${NFILE}"
- ;;
- EXCLUDE)
- OM="field;-"
- NM="-"
- ;;
- EXIT)
- exit
- ;;
- EXACT|SUM|REV)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- cat $STDIN | $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" stdout | $OPROG stdin| sed -e '1,2d;s/[0-9]*://g;s/ +/ /g' | awk '{for(i=1;i<=NF;i++){printf("%.2f ",$i)}printf("\n");}' > funimage2.out
- else
- if [ x"$DOINC" = xYES ]; then
- $ECHO "$ARG3" > arg3.inc
- $ECHO "${M}EXACT: ${B}$ARG2${B2} ... ${B}@include($ARG3)${B2}"
- ARG3="@arg3.inc"
- else
- $ECHO "${M}EXACT: ${B}$ARG2 ... ${B}$ARG3"
- fi
- CMP=yes
- XPROG=""
- $OPROG ${OFILE}"[${B}${OM}$ARG2${B2}]" | sed -e '1,2d;s/[0-9]*://g;s/ +/ /g' | awk '{for(i=1;i<=NF;i++){printf("%.2f ",$i)}printf("\n");}'> tfunimage1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
- cat $STDIN | $NPROG ${NFILE}"[${B}${NM}$ARG3${B2}]" stdout | $OPROG stdin| sed -e '1,2d;s/[0-9]*://g;s/ +/ /g' | awk '{for(i=1;i<=NF;i++){printf("%.2f ",$i)}printf("\n");}' > tfunimage2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfunimage1.out > funimage1.out
- sed "/^ *$X $Y.*$/d" < tfunimage2.out > funimage2.out
- else
- mv tfunimage1.out funimage1.out
- mv tfunimage2.out funimage2.out
- fi
- diff funimage1.out funimage2.out
- else
- $ECHO "skipping compare due to errors in $XPROG"
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** funimage1.out *****"
- cat funimage1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** funimage1.out *****"
- cat funimage1.out
- $ECHO "***** funimage2.out *****"
- cat funimage2.out
- fi
- rm -f err.log
-done
-
-rm -f funimage1.out funimage2.out tfunimage1.out tfunimage2.out
diff --git a/funtools/funtest/tfunmerge b/funtools/funtest/tfunmerge
deleted file mode 100755
index 674381c..0000000
--- a/funtools/funtest/tfunmerge
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/sh
-#set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-OPROG=funmerge
-NPROG=../funmerge
-STDIN=/dev/null
-DIR=../txt/
-FILES="mif1.fits mif2.fits mif3.fits mif4.fits"
-LIST="@mif.lst"
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../funmerge.pure
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -V)
- VERBOSE=2
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-$ECHO "OPROG="${OPROG}
-$ECHO "NPROG="${NPROG}
-
-IFS=" "
-while read ARG1 ARG2 ARG3 ARG4; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
-
- eval "ARG3=\"$ARG3\""
- eval "ARG4=\"$ARG4\""
-
- case $CMD in
- EXIT)
- exit
- ;;
- EXACT)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG2"
- eval "$NPROG $ARG2 $ARG3 stdout" | fundisp stdin > funmerge2.out
- else
- $ECHO "${M}EXACT: $ARG2 $ARG3 ... $ARG2 $ARG4"
- CMP=yes
- XPROG=""
- eval "$OPROG $ARG2 $ARG3 stdout" | fundisp stdin > tfunmerge1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
-
- eval "$NPROG $ARG2 $ARG4 stdout" | fundisp stdin > tfunmerge2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfunmerge1.out > funmerge1.out
- sed "/^ *$X $Y.*$/d" < tfunmerge2.out > funmerge2.out
- else
- mv tfunmerge1.out funmerge1.out
- mv tfunmerge2.out funmerge2.out
- fi
- diff funmerge1.out funmerge2.out
- else
- $ECHO "skipping compare due to errors in $XPROG"
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** funmerge1.out *****"
- cat funmerge1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** funmerge1.out *****"
- cat funmerge1.out
- $ECHO "***** funmerge2.out *****"
- cat funmerge2.out
- fi
- rm -f err.log
-done
-
-rm -f funmerge1.out funmerge2.out tfunmerge1.out tfunmerge2.out
diff --git a/funtools/funtest/tfuntext b/funtools/funtest/tfuntext
deleted file mode 100755
index 70547fb..0000000
--- a/funtools/funtest/tfuntext
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/bin/sh
-#set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-OPROG=fundisp
-NPROG=../fundisp
-STDIN=/dev/null
-DIR=../txt/
-
-if [ -r /usr/ucb/echo ]; then
- ECHO=/usr/ucb/echo
-else
- ECHO=echo
-fi
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$1
- if [ x`$ECHO $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- shift
- continue;;
- -P)
- DO1=YES
- NPROG=../fundisp.pure
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -V)
- VERBOSE=2
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-$ECHO "OPROG="${OPROG}
-$ECHO "NPROG="${NPROG}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`$ECHO $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- ARG2=${DIR}${ARG2}
- ARG3=${DIR}${ARG3}
-
- case $CMD in
- OPROG)
- OPROG=$ARG2
- $ECHO OPROG="${OPROG}"
- ;;
- NPROG)
- NPROG=$ARG2
- $ECHO NPROG="${NPROG}"
- ;;
- EXIT)
- exit
- ;;
- EXACT|SUM|REV)
- if [ x"$DO1" = xYES ]; then
- $ECHO "${M}DO1: $ARG3"
- cat $STDIN | $NPROG $ARG3 > fundisp1.out
- else
- $ECHO "${M}EXACT: $ARG2 ... $ARG3"
- CMP=yes
- XPROG=""
- $OPROG $ARG2 > tfundisp1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
- cat $STDIN | $NPROG $ARG3 > tfundisp2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfundisp1.out > fundisp1.out
- sed "/^ *$X $Y.*$/d" < tfundisp2.out > fundisp2.out
- else
- mv tfundisp1.out fundisp1.out
- mv tfundisp2.out fundisp2.out
- fi
- diff fundisp1.out fundisp2.out
- else
- $ECHO "skipping compare due to errors in $XPROG"
- fi
- fi
- $ECHO " "
- ;;
- *)
- $ECHO "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- $ECHO "***** fundisp1.out *****"
- cat fundisp1.out
- fi
- if [ $VERBOSE = 2 ]; then
- $ECHO "***** fundisp1.out *****"
- cat fundisp1.out
- $ECHO "***** fundisp2.out *****"
- cat fundisp2.out
- fi
- rm -f err.log
-done
-
-rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
diff --git a/funtools/funtest/tfunview b/funtools/funtest/tfunview
deleted file mode 100755
index 93f4710..0000000
--- a/funtools/funtest/tfunview
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/bin/sh
-#set -x
-
-rm -f tview.fits tview.fit
-ln -s $HOME/data/snr.ev tview.fits
-ln -s $HOME/data/snr.ev tview.fit
-
-FUN_VIEWFILE=./funtools1.vu
-export FUN_VIEWFILE
-
-PLATFORM=`uname`
-VERBOSE=0
-OPROG=../fundisp
-NPROG=../fundisp
-STDIN=/dev/null
-# DIR=../txt/
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -f)
- shift
- FUN_VIEWFILE=$1
- export FUN_VIEWFILE
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$1
- if [ x`echo $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- shift
- continue;;
- -P)
- DO1=YES
- OPROG=../fundisp.pure
- NPROG=../fundisp.pure
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -V)
- VERBOSE=2
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-echo "OPROG ="${OPROG}
-echo "NPROG ="${NPROG}
-echo "VIEWFILE="${FUN_VIEWFILE}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
-# ARG2=${DIR}${ARG2}
-# ARG3=${DIR}${ARG3}
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- echo OPROG="${OPROG}"
- ;;
- NPROG)
- NPROG=$ARG2
- echo NPROG="${NPROG}"
- ;;
- EXIT)
- exit
- ;;
- EXACT|SUM|REV)
- if [ x"$DO1" = xYES ]; then
- echo "${M}DO1: $ARG2"
- eval $OPROG $ARG2 > fundisp1.out
- else
- echo "${M}EXACT: $ARG2 ... $ARG3"
- CMP=yes
- XPROG=""
- eval $OPROG $ARG2 > tfundisp1.out
- if test $? -ne 0; then
- CMP=no
- XPROG="$OPROG"
- fi
- eval $NPROG $ARG3 > tfundisp2.out
- if test $? -ne 0; then
- CMP=no
- XPROG="${XPROG:-}${XPROG:+' '}$NPROG"
- fi
- if [ x"$CMP" = xyes ]; then
- if [ x"$ZBUG" = xtrue ]; then
- sed "/^ *$X $Y.*$/d" < tfundisp1.out > fundisp1.out
- sed "/^ *$X $Y.*$/d" < tfundisp2.out > fundisp2.out
- else
- mv tfundisp1.out fundisp1.out
- mv tfundisp2.out fundisp2.out
- fi
- diff fundisp1.out fundisp2.out
- else
- echo "skipping compare due to errors in $XPROG"
- fi
- fi
- echo " "
- ;;
- *)
- echo "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- echo "***** fundisp1.out *****"
- cat fundisp1.out
- fi
- if [ $VERBOSE = 2 ]; then
- echo "***** fundisp1.out *****"
- cat fundisp1.out
- echo "***** fundisp2.out *****"
- cat fundisp2.out
- fi
- rm -f err.log
-done
-
-rm -f fundisp1.out fundisp2.out tfundisp1.out tfundisp2.out
-rm -f tview.fits tview.fit
diff --git a/funtools/funtest/thead.in b/funtools/funtest/thead.in
deleted file mode 100644
index 2ec5d43..0000000
--- a/funtools/funtest/thead.in
+++ /dev/null
@@ -1,12 +0,0 @@
-#OPROG fundisp
-#NPROG ../funimage
-#OFILE ./test.ev
-#NFILE ./test.ev
-
-#CMD Old Filter New Filter
-#--- ----------------- ---------------------
-EXACT 1 1
-EXACT 2 2
-EXACT 3 3
-EXACT 4 4
-
diff --git a/funtools/funtest/timev b/funtools/funtest/timev
deleted file mode 100755
index d5e71e3..0000000
--- a/funtools/funtest/timev
+++ /dev/null
@@ -1,264 +0,0 @@
-#!/bin/sh
-# set -x
-
-PLATFORM=`uname`
-VERBOSE=0
-SW="-r"
-X=504
-Y=512
-
-STDIN=/dev/null
-OPROG=funcnts
-NPROG=../funcnts
-OFILE=${HOME}/data/snr.fits
-NFILE=${HOME}/data/snr.ev.gz
-
-
-EAWK='start==1&&NF>0{tpix += $2; tarea +=$3; print $0};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
-
-SAWK='start==1&&NF>0{tpix += $2; tarea +=$3};/^---- ------------ ---------$/{start=1}END{print tpix,tarea}'
-
-FAWK='{tpix = $1};END{print tpix}'
-
-while [ x"$1" != x ]; do
- case $1 in
- -1)
- DO1=YES
- shift
- continue;;
- -b)
- shift
- B=$1
- shift
- continue;;
- -c)
- shift
- C="$1\;"
- shift
- continue;;
- -e)
- FIELD=`${OPROG} ${OFILE}${B} "field" | awk "$SAWK" | awk "$FAWK"`
- echo "FIELD: $FIELD"
- echo " "
- M="-"
- shift
- continue;;
- -f)
- shift
- FILE=$1
- shift
- continue;;
- -n)
- shift
- NPROG=$1
- shift
- continue;;
- -o)
- shift
- OPROG=$1
- shift
- continue;;
- -p)
- shift
- STDIN=$1
- if [ x`echo $STDIN | awk -F. '{print $NF}'` = x"gz" ]; then
- NFILE=stdin.gz
- else
- NFILE=stdin
- fi
- shift
- continue;;
- -P)
- PURE=YES
- DO1=YES
- NPROG=../funcnts.pure
- shift
- continue;;
- -s)
- shift
- SW=$1
- shift
- continue;;
- -v)
- VERBOSE=1
- shift
- continue;;
- -V)
- VERBOSE=2
- shift
- continue;;
- -x)
- shift
- X=$1
- shift
- continue;;
- -y)
- shift
- Y=$1
- shift
- continue;;
- *)
- shift
- continue;;
- esac
-done
-
-X2=`echo "$X + 10" | bc`
-Y2=`echo "$Y + 10" | bc`
-X3=`echo "$X + 20" | bc`
-Y3=$Y
-X4=`echo "$X + 10" | bc`
-Y4=`echo "$Y - 10" | bc`
-
-B1=`echo "$X - 100" | bc`
-B2=`echo "$X + 99" | bc`
-B3=`echo "$Y - 100" | bc`
-B4=`echo "$Y + 99" | bc`
-if [ x"$B" = x ]; then
- B="[$B1:$B2,$B3:$B4,3]"
-fi
-
-echo "OPROG="${OPROG} "OFILE="${OFILE}${B} X=${X} Y=${Y}
-echo "NPROG="${NPROG} "NFILE="${NFILE}${B} X=${X} Y=${Y}
-
-IFS=" "
-while read ARG1 ARG2 ARG3; do
- if [ x"$ARG1" = x ]; then
- continue
- fi
- if [ x`echo $ARG1 | sed 's/^#.*/YES/g'` = x"YES" ]; then
- continue
- fi
- CMD=$ARG1
- eval "ARG2=\"${C}$ARG2\""
- eval "ARG3=\"${C}$ARG3\""
- if [ x$CMD = xZIEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- continue
- else
- CMD=EXACT
- fi
- fi
- if [ x$CMD = xZEXACT ]; then
- if [ x$FILTER_PAINT = xtrue ]; then
- CMD=SUM
- else
- CMD=EXACT
- fi
- fi
- case $CMD in
- OPROG)
- OPROG=$ARG2
- ;;
- NPROG)
- NPROG=$ARG2
- ;;
- FILE)
- FILE=$ARG2
- ;;
- EXCLUDE)
- FIELD=`$OPROG ${OFILE}${B} "field" | awk "$SAWK" | awk "$FAWK"`
- echo "FIELD: $FIELD"
- echo " "
- M="-"
- ;;
- EXIT)
- exit
- ;;
- EXACT)
- if [ x"$DO1" = xYES ]; then
- echo "${M}DO1: $ARG3"
- ($NPROG ${SW} ${NFILE}${B} "${M}$ARG3") >funcnts2.out 2>&1
- else
- echo "${M}EXACT: $ARG2 ... $ARG3"
- ($OPROG ${SW} ${OFILE}${B} "$ARG2" | awk $EAWK) >funcnts1.out 2>err.log
- if test $? -ne 0; then
- echo "skipping $NPROG due to error"
- else
- (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3" | awk $EAWK) >funcnts2.out 2>&1
- if [ x$M = x ]; then
- diff funcnts1.out funcnts2.out
- else
- V1=`cat funcnts1.out | awk $FAWK`
- V2=`cat funcnts2.out | awk $FAWK`
- V2=`echo "$FIELD-$V2" | bc`
- if [ $V1 != $V2 ]; then
- echo "V1=$V1 V2=$V2"
- fi
- fi
- fi
- fi
- echo " "
- ;;
- REV)
- if [ x"$DO1" = xYES ]; then
- echo "${M}DO1: $ARG3"
- (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3") >funcnts2.out 2>&1
- else
- echo "${M}REV: $ARG2 ... $ARG3"
- ($OPROG ${SW} ${OFILE}${B} "$ARG2" | awk $EAWK) >tfuncnts1.out 2>err.log
- if test $? -ne 0; then
- echo "skipping $NPROG due to error"
- else
- (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3" | awk $EAWK) >tfuncnts2.out 2>&1
- if [ x$M = x ]; then
- awk 'NF==3{print $0}' < tfuncnts1.out | sort -r | awk '{print $2,$3}' > funcnts1.out
- awk 'NF==3{print $2,$3}' < tfuncnts2.out >funcnts2.out 2>&1
- diff funcnts1.out funcnts2.out
- else
- V1=`cat funcnts1.out | awk $FAWK`
- V2=`cat funcnts2.out | awk $FAWK`
- V2=`echo "$FIELD-$V2" | bc`
- if [ $V1 != $V2 ]; then
- echo "V1=$V1 V2=$V2"
- fi
- fi
- fi
- fi
- echo " "
- ;;
- SUM)
- if [ x"$DO1" = xYES ]; then
- echo "${M}DO1: $ARG3"
- (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3") >funcnts2.out 2>&1
- else
- echo "${M}SUM: $ARG2 ... $ARG3"
- ($OPROG ${SW} ${OFILE}${B} "$ARG2" | awk $SAWK) >funcnts1.out 2>err.log
- if test $? -ne 0; then
- echo "skipping $NPROG due to error"
- else
- (cat $STDIN | $NPROG ${SW} ${NFILE}${B} "${M}$ARG3" | awk $SAWK) >funcnts2.out 2>&1
- if [ x$M = x ]; then
- diff funcnts1.out funcnts2.out
- else
- V1=`cat funcnts1.out | awk $FAWK`
- V2=`cat funcnts2.out | awk $FAWK`
- V2=`echo "$FIELD-$V2" | bc`
- if [ $V1 != $V2 ]; then
- echo "V1=$V1 V2=$V2"
- fi
- fi
- fi
- fi
- echo " "
- ;;
- *)
- echo "ERROR: unknown command: $CMD"
- exit 1
- ;;
- esac
- if [ $VERBOSE = 1 ]; then
- echo "***** funcnts1.out *****"
- cat funcnts1.out
- fi
- if [ $VERBOSE = 2 ]; then
- echo "***** funcnts1.out *****"
- cat funcnts1.out
- echo "***** funcnts2.out *****"
- cat funcnts2.out
- fi
- rm -f err.log
-done
-
-rm -f funcnts1.out funcnts2.out tfuncnts1.out tfuncnts2.out
-
diff --git a/funtools/funtest/tmerge.in b/funtools/funtest/tmerge.in
deleted file mode 100644
index 11eb989..0000000
--- a/funtools/funtest/tmerge.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#CMD FLAGS FILES1 FILES2
-#--- ---------- ------ ------
-EXACT -I $FILES $FILES
-EXACT -w $FILES $FILES
-EXACT -x $FILES $FILES
-EXACT -f foo $FILES $FILES
-EXACT -f foo -w $FILES $FILES
-EXACT -f foo -x $FILES $FILES
-
-EXACT -I $FILES $LIST
-EXACT -w $FILES $LIST
-EXACT -x $FILES $LIST
-EXACT -f foo $FILES $LIST
-EXACT -f foo -w $FILES $LIST
-EXACT -f foo -x $FILES $LIST
-
diff --git a/funtools/funtest/tnum.in b/funtools/funtest/tnum.in
deleted file mode 100644
index f3fa3c6..0000000
--- a/funtools/funtest/tnum.in
+++ /dev/null
@@ -1,9 +0,0 @@
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==017)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0xf)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha==0b1111)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&017)==017)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0xf)==0xf)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&((pha&0b1111)==0b1111)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=017)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0xf)
-EXACT (pi=13:14)&&pha==0xf (pi=13:14)&&(pha=0b1111)
diff --git a/funtools/funtest/tparen.in b/funtools/funtest/tparen.in
deleted file mode 100644
index 514edb0..0000000
--- a/funtools/funtest/tparen.in
+++ /dev/null
@@ -1,50 +0,0 @@
-#OPROG fundisp
-#NPROG ../fundisp
-#OFILE ./test.ev
-#NFILE ./test.ev
-
-#CMD Old Filter New Filter
-#--- ----------------- ---------------------
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
-
-EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
-
-EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
-
-EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
-
-EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) pi=2:3,(physical;cir($X,$Y,5),-cir($X,$Y,2))
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
-
-EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
-
-EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
-
-EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
-
-EXACT pi=2:3,(-cir($X,$Y,2),cir($X,$Y,5)) (physical;cir($X,$Y,5),-cir($X,$Y,2)),pi=2:3
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
-
-EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2),cir($X2,$Y2,5),-cir($X2,$Y2,2)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),cir($X2,$Y2,5),-cir($X2,$Y2,2)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
-
-EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
-
-EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) pi=2:3,(physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2))
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
-
-EXACT pi=2:3&&(cir($X,$Y,5),-cir($X,$Y,2),cir($X2,$Y2,5),-cir($X2,$Y2,2)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),cir($X2,$Y2,5),-cir($X2,$Y2,2)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
-
-EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
-
-EXACT pi=2:3&&(-cir($X,$Y,2),-cir($X2,$Y2,2),cir($X,$Y,5),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
-
-EXACT pi=2:3&&(-cir($X,$Y,2),cir($X,$Y,5),-cir($X2,$Y2,2),cir($X2,$Y2,5)) (physical;cir($X,$Y,5),cir($X2,$Y2,5),-cir($X,$Y,2),-cir($X2,$Y2,2)),pi=2:3
diff --git a/funtools/funtest/tregions.in b/funtools/funtest/tregions.in
deleted file mode 100644
index 56520f0..0000000
--- a/funtools/funtest/tregions.in
+++ /dev/null
@@ -1,67 +0,0 @@
-#OPROG funcnts
-#NPROG ../funcnts
-#OFILE /home/eric/data/snr.ev
-#NFILE /home/eric/data/snr.ev
-
-#CMD Old Region New region
-#--- ----------------- ---------------------
-EXACT cir $X $Y .1 cir $X $Y .1
-EXACT ann $X $Y 0 5 10 15 20 (ann $X $Y 0 5 10 15 20)
-EXACT ann $X $Y 0 5 10 15 20 (ann $X $Y 0 20 n=4 # color=red\\n)
-EXACT cir $X $Y 20 cir $X $Y 20
-EXACT box $X $Y 10 20 box $X $Y 10 20 # color=red\\n
-EXACT box $X $Y 10 20 45 box $X $Y 10 20 45 # color=red\\n
-EXACT box $X $Y 10 20 115 box $X $Y 10 20 115 # color=red\\n
-EXACT ell $X $Y 10 20 (ell $X $Y 10 20)
-EXACT ell $X $Y 10 20 20 40 40 60 (ell $X $Y 10 20 20 40 40 60 # color=red\\n)
-EXACT ell $X $Y 10 20 45 (ell $X $Y 10 20 45)
-EXACT ell $X $Y 10 20 115 (ell $X $Y 10 20 115)
-EXACT lin $X $Y $X2 $Y2 lin $X2 $Y2 $X $Y
-REV poi $X $Y $X2 $Y2 (poi $X2 $Y2 $X $Y)
-ZIEXACT -cir $X $Y 20 (-cir $X $Y 20)
-EXACT box $X $Y 5 10,box $X $Y 10 20 box $X $Y 0 0 10 20 n=2 # color=red\\n
-EXACT ell $X $Y 5 10,ell $X $Y 10 20 (ell $X $Y 0 0 10 20 n=2)
-EXACT box $X $Y 5 10,box $X $Y 7 12 (box $X $Y 0 0 5 10 7 12 # color=red\\n)
-EXACT ell $X $Y 5 10,ell $X $Y 7 12 ell $X $Y 0 0 5 10 7 12
-EXACT ell $X $Y 5 10,ell $X $Y 10 20,ell $X $Y 20 40 ell $X $Y 0 0 5 10 10 20 20 40 # color=red\\n
-EXACT ell $X $Y 7 12,-ell $X $Y 5 10 (ell $X $Y 5 10 7 12)
-EXACT box $X $Y 7 12,-box $X $Y 5 10 (box $X $Y 5 10 7 12 # color=red\\n)
-ZEXACT ell $X $Y 10 20 20 40 40 60 ell $X $Y 20 40, ell $X $Y 40 60, -ell $X $Y 10 20 # color=red\\n
-
-EXACT cir $X $Y 20 ell $X $Y 20 20
-EXACT cir $X $Y 20 ann $X $Y 0 20 # color=red\\n
-EXACT cir $X $Y 20 (pan $X $Y 0 360 1 0 20 1)
-ZEXACT pan $X $Y 0 360 1 0 20 4 cir $X $Y 5, cir $X $Y 10, cir $X $Y 15, cir $X $Y 20 # color=red\\n
-EXACT pan $X $Y 0 360 1 0 20 4 cir $X $Y 0 5 10 15 20 # color=red\\n
-
-EXACT ann $X $Y 0 20 n=4 (ell $X $Y 0 0 20 20 n=4 # color=red\\n)
-EXACT ann $X $Y 0 5 10 15 20 ell $X $Y 0 0 20 20 n=4
-EXACT ann $X $Y 5 20 n=3 ell $X $Y 5 5 10 10 15 15 20 20 # color=red\\n
-EXACT ann $X $Y 0 20 n=4 (cir $X $Y 0 20 n=4)
-EXACT ann $X $Y 0 20 n=4 (cir $X $Y 0 5 10 15 20 # color=red\\n)
-EXACT ann $X $Y 0 20 n=4 pan $X $Y 0 360 1 0 20 4
-
-SUM cir $X $Y 20 cir $X $Y 0 20 n=10
-SUM cir $X $Y 20 cir $X $Y 0 5 10 20 # color=red\\n
-SUM cir $X $Y 20 (ell $X $Y 0 0 10 10 15 15 20 20 # color=red\\n)
-SUM cir $X $Y 20 (ell $X $Y 0 0 20 20 n=10 # color=red\\n)
-SUM cir $X $Y 20 (ann $X $Y 0 5 10 15 20 # color=red\\n)
-SUM cir $X $Y 20 (ann $X $Y 0 20 n=10 # color=red\\n)
-
-SUM ell $X $Y 10 20 (ell $X $Y 0 0 10 20 n=4 # color=red\\n)
-SUM ell $X $Y 10 20 (ell $X $Y 0 0 5 10 7 15 10 20 # color=red\\n)
-SUM box $X $Y 10 20 (box $X $Y 0 0 10 20 n=4 # color=red\\n)
-SUM box $X $Y 10 20 (box $X $Y 0 0 5 10 7 15 10 20 # color=red\\n)
-
-SUM ell $X $Y 20 10 (epa $X $Y 0 360 4 0 0 20 10 4 # color=red\\n)
-SUM box $X $Y 20 10 (bpa $X $Y 0 360 4 0 0 20 10 4 # color=red\\n)
-SUM cir $X $Y 20 (cpa $X $Y 0 360 4 0 20 4 # color=red\\n)
-
-EXACT pie $X $Y 0 5 10 15 20 pie $X $Y 0 5 10 15 20
-EXACT pie $X $Y 0 5 10 15 20 pie $X $Y 0 20 n=4 # color=red\\n
-EXACT pie $X $Y 0 5 10 15 20 pie $X $Y 0 5, pie $X $Y 5 10, pie $X $Y 10 15, pie $X $Y 15 20
-EXACT pan $X $Y 35 80 3 0 20 4 pan $X $Y 35 80 3 0 20 4 # color=red\\n
-EXACT cir $X $Y 20, -pie $X $Y 0 90 (cir $X $Y 20,-panda $X $Y 0 90 5 0 20 5)
-EXACT cir $X $Y 20, -pie $X $Y 0 90,-pie $X $Y 180 270 cir $X $Y 20,-panda $X $Y 0 90 1 0 20 1,-panda $X $Y 180 270 1 0 20 1 # color=red\\n
-
-# EXACT pol $X $Y $X2 $Y2 $X3 $Y3 $X4 $Y4 (pol $X3 $Y3 $X4 $Y4 $X $Y $X2 $Y2 # color=red\\n)
diff --git a/funtools/funtest/tsections.in b/funtools/funtest/tsections.in
deleted file mode 100644
index 71f0665..0000000
--- a/funtools/funtest/tsections.in
+++ /dev/null
@@ -1,11 +0,0 @@
-#OPROG fundisp
-#NPROG ../funimage
-#OFILE ./test.ev
-#NFILE ./test.ev
-
-#CMD Old Filter New Filter
-#--- ----------------- ---------------------
-EXACT 509:515,509:515 509:515,509:515
-EXACT 6@512,6@512 6@512,6@512
-EXACT 509:515,509:515 6@512,6@512
-EXACT 6@512,6@512 509:515,509:515
diff --git a/funtools/funtest/ttext.in b/funtools/funtest/ttext.in
deleted file mode 100644
index 7bb7648..0000000
--- a/funtools/funtest/ttext.in
+++ /dev/null
@@ -1,91 +0,0 @@
-#CMD File Spec 1 File Spec 2
-#--- ----------------- ---------------------
-EXACT blank.txt blank2.txt
-EXACT crtab.txt nltab.txt
-EXACT crcomma.txt nlcomma.txt
-EXACT int64.fits[1] int64.tab
-EXACT int64.fits[Value=-9223372036854775806:9223372036854775805] int64.tab[Value=-9223372036854775806:9223372036854775805]
-EXACT test.fits tab.txt
-EXACT test.fits[1] tab.txt[1]
-EXACT test.fits[2] tab.txt[2]
-EXACT test.fits bar.txt
-EXACT test.fits[1] bar.txt[1]
-EXACT test.fits[2] bar.txt[2]
-EXACT test.fits comma.txt
-EXACT test.fits comma3.txt
-EXACT test.fits[1] comma.txt[1]
-EXACT test.fits[1] comma3.txt[1]
-EXACT test.fits[2] comma.txt[2]
-EXACT test.fits rdb.txt
-EXACT test.fits[1] rdb.txt[1]
-EXACT test.fits[2] rdb.txt[2]
-
-EXACT test.fits eot.txt[TEXT(eot=EOT)]
-EXACT test.fits[2] eot.txt[2,TEXT(eot=EOT)]
-EXACT test.fits[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
-EXACT test.fits[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
-
-EXACT tab.txt bar.txt
-EXACT tab.txt comma.txt
-EXACT tab.txt rdb.txt
-EXACT tab.txt space.txt
-
-EXACT space.txt sptab.txt
-EXACT tab.txt sptab.txt
-EXACT comma.txt sptab.txt
-EXACT rdb.txt sptab.txt
-
-EXACT bar.txt comma.txt
-EXACT bar.txt rdb.txt
-EXACT bar.txt space.txt
-EXACT comma.txt rdb.txt
-EXACT comma.txt space.txt
-EXACT rdb.txt space.txt
-
-EXACT tab.txt bar.txt[1]
-EXACT tab.txt comma.txt[1]
-EXACT tab.txt rdb.txt[1]
-EXACT tab.txt space.txt[1]
-EXACT bar.txt comma.txt[1]
-EXACT bar.txt rdb.txt[1]
-EXACT bar.txt space.txt[1]
-EXACT comma.txt rdb.txt[1]
-EXACT comma.txt space.txt[1]
-EXACT rdb.txt space.txt[1]
-
-EXACT tab.txt[2] bar.txt[2]
-EXACT tab.txt[2] comma.txt[2]
-EXACT tab.txt[2] rdb.txt[2]
-EXACT tab.txt[2] space.txt[2]
-EXACT bar.txt[2] comma.txt[2]
-EXACT bar.txt[2] rdb.txt[2]
-EXACT bar.txt[2] space.txt[2]
-EXACT comma.txt[2] rdb.txt[2]
-EXACT comma.txt[2] space.txt[2]
-EXACT rdb.txt[2] space.txt[2]
-
-EXACT tab.txt eot.txt[TEXT(eot=EOT)]
-EXACT bar.txt eot.txt[TEXT(eot=EOT)]
-EXACT comma.txt eot.txt[TEXT(eot=EOT)]
-EXACT rdb.txt eot.txt[TEXT(eot=EOT)]
-EXACT space.txt eot.txt[TEXT(eot=EOT)]
-
-EXACT tab.txt[2] eot.txt[2,TEXT(eot=EOT)]
-EXACT bar.txt[2] eot.txt[2,TEXT(eot=EOT)]
-EXACT comma.txt[2] eot.txt[2,TEXT(eot=EOT)]
-EXACT rdb.txt[2] eot.txt[2,TEXT(eot=EOT)]
-EXACT space.txt[2] eot.txt[2,TEXT(eot=EOT)]
-
-EXACT tab.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
-EXACT bar.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
-EXACT comma.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
-EXACT rdb.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
-EXACT space.txt[1] eot2.txt[1,TEXT(eot=EOT\\nHERE)]
-
-EXACT tab.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
-EXACT bar.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
-EXACT comma.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
-EXACT rdb.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
-EXACT space.txt[2] eot2.txt[2,TEXT(eot=EOT\\nHERE)]
-
-EXACT headone.txt one.txt
diff --git a/funtools/funtest/tview.in b/funtools/funtest/tview.in
deleted file mode 100644
index b9b7976..0000000
--- a/funtools/funtest/tview.in
+++ /dev/null
@@ -1,11 +0,0 @@
-#CMD File Spec 1 File Spec 2
-#--- ----------- ---------------------
-EXACT v:x3 -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT v:snr.ev -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT v:snr.ev'[4]' -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT v:snr.ev'[cir(400,400,3)]' -f "I=%4d" $HOME/data/snr.ev'[cir(400,400,3)]' "x y pi pha"
-EXACT v::xf,xc,xr:tview.fits -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT -f "I=%4d" v:x2 -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT v::xf:tview.fit -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT v::xf:tview.fit'[4]' -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]' "x y pi pha"
-EXACT v:-xf:tview.fit'[cir(512,512,.1)]' -f "I=%4d" $HOME/data/snr.ev'[cir(512,512,.1)]'
diff --git a/funtools/funtest/twcs.c b/funtools/funtest/twcs.c
deleted file mode 100644
index 2da9319..0000000
--- a/funtools/funtest/twcs.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * twcs.c -- example using WCS Library
- *
- */
-
-#include <funtools.h>
-
-int main(int argc, char **argv)
-{
- int i;
- Fun fun;
- struct WorldCoor *wcs; /* WCS info */
- double x,y,ra,dec,xr,yr;
-
- if(argc == 1){
- fprintf(stderr, "usage: twcs iname\n");
- exit(1);
- }
-
- /* open Funtools file */
- /* Funopen makes initial WCS library call: wcs = wcsinit(header_string) */
- if( !(fun = FunOpen(argv[1], "r ", NULL)) ){
- fprintf(stderr, "ERROR can't open file: %s\n", argv[1]);
- exit(1);
- }
-
- /* get wcs structure */
- FunInfoGet(fun,FUN_WCS,&wcs,0);
- if( !wcs || !iswcs(wcs) ){
- fprintf(stderr,"No WCS data");
- return(1);
- }
-
- /* read input, convert pixels to wcs and back */
- while(1){
- fprintf(stdout,"\nInput x y: ");
- if(scanf("%lf %lf", &x, &y) != EOF){
- if(x <= -999)
- break;
- /* convert image pixels to sky coords */
- pix2wcs(wcs, x, y, &ra, &dec);
- fprintf(stdout,"Convert from pixels to ra,dec using pix2wcs()\n");
- fprintf(stdout, "x=%.10g y=%.10g -> ra=%.10g dec=%.10g\n",
- x, y, ra, dec);
- /* convert sky coords to image pixels */
- fprintf(stdout,"Convert from ra,dec -> pixels using wcs2pix()\n");
- wcs2pix(wcs, ra, dec, &xr, &yr, &i);
- fprintf(stdout, "ra=%.10g dec=%.10g -> x=%.10g y=%.10g offscale=%d\n",
- ra, dec, xr, yr, i);
- }
- else
- break;
- }
-
- /* clean up */
- /* FunClose makes final WCS library call: wcsfree(wcs) */
- FunClose(fun);
- return(0);
-}
-
diff --git a/funtools/funtest/unwcs.in b/funtools/funtest/unwcs.in
deleted file mode 100644
index f8cc6e3..0000000
--- a/funtools/funtest/unwcs.in
+++ /dev/null
@@ -1,12 +0,0 @@
-local
-double dval1, dval2;
-FITSHead wcs;
-int offscl;
-int init=0;
-end
-
-if( !init++ ) FunInfoGet(fun, FUN_WCS, &wcs, 0);
-wcs2pix(wcs, (double)cur->ra, (double)cur->dec, &dval1, &dval2, &offscl);
-cur->nx:J:1:1024 = (int)(dval1+0.5);
-cur->ny:J:1:1024 = (int)(dval2+0.5);
-
diff --git a/funtools/funtest/wcs.in b/funtools/funtest/wcs.in
deleted file mode 100644
index 4464246..0000000
--- a/funtools/funtest/wcs.in
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ./funcalc -f wcs.in $S foo.fits */
-local
-double dval1, dval2;
-void *wcs;
-int init=0;
-end
-
-if( !init++ ) FunInfoGet(fun, FUN_WCS, &wcs, 0);
-pix2wcs(wcs, (double)cur->x, (double)cur->y, &dval1, &dval2);
-cur->RA:D = dval1;
-cur->Dec:D = dval2;
-
diff --git a/funtools/funtest/wtest.c b/funtools/funtest/wtest.c
deleted file mode 100644
index 500d6fc..0000000
--- a/funtools/funtest/wtest.c
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <funtools.h>
-#include <stdlib.h>
-#include <file.h>
-
-extern char *optarg;
-extern int optind;
-
-#define DIM1 5
-#define DIM2 8
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i;
- int args;
- int doext=0;
- int doover=0;
- int dim1=DIM1;
- int dim2=DIM2;
- int bitpix1=32;
- int bitpix2=-32;
- int buf1[DIM1*DIM2];
- float buf2[DIM1*DIM2];
- char *oname;
- Fun ofun=NULL;
-
- /* fill in data buffers */
- for(i=0; i<DIM1*DIM2; i++){
- buf1[i] = i;
- buf2[i] = (float)(DIM1*DIM2)-(float)i;
- }
-
- /* exit on gio errors */
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "eo")) != -1){
- switch(c){
- case 'e':
- doext=1;
- break;
- case 'o':
- doover=1;
- break;
- default:
- break;
- }
- }
-
- /* check for required arguments */
- args = argc - optind;
- if( args < 1 )
- gerror(stderr, "usage: %s fname\n", argv[0]);
- oname = argv[optind++];
-
- /* open the output FITS file */
- if( oname ){
- if( !(ofun = FunOpen(oname, "w", NULL)) )
- gerror(stderr, "could not FunOpen output file: %s\n", argv[optind-1]);
- }
-
- /* write params, if necessary */
- FunParamPuts(ofun, "", 0, "this is a comment", "Blank Keyword", 0);
- FunParamPuts(ofun, " ", 0, "a 2nd comment", "Blank Keyword", 0);
- FunParamPuts(ofun, "BPAR", 0, "", "Blank Param", 0);
- FunParamPuts(ofun, "BPAR", 1, NULL, "Blank Param", 0);
- FunParamPuti(ofun, "IPAR", 0, -100, "INTEGER Param", 0);
- FunParamPuti(ofun, "IPAR", 1, -101, "INTEGER Param", 0);
- FunParamPutd(ofun, "DPAR", 0, 123456789.9876, 12, "DOUBLE Param", 0);
- FunParamPutd(ofun, "DPAR", 1, 123456.780, 4, "DOUBLE Param", 0);
- FunParamPuts(ofun, "SPAR", 0, argv[0],
- "long comment string that will test column alignment", 0);
- FunParamPuts(ofun, "SPAR", 1, argv[1], "STRING Param", 0);
-
- /* write the primary output image */
- if( !FunImagePut(ofun, buf1, dim1, dim2, bitpix1, NULL) ){
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
- }
- if( doover ){
- FunParamPuti(ofun, "IPAR", 1, 101, "OVERWRITTEN INT Param", 0);
- FunParamPuts(ofun, "SPAR", 1, argv[0], "OVERWRITTEN STR Param", 0);
- }
-
- /* we have to finish the first image if we want to write a second one */
- FunFlush(ofun, NULL);
-
- /* write the image extension */
- if( doext ){
- FunParamPuts(ofun, "", 0, "this is a comment", "Blank Keyword", 0);
- FunParamPuts(ofun, " ", 0, "a 2nd comment", "Blank Keyword", 0);
- FunParamPuts(ofun, "XBPAR", 0, "", "Blank Param", 0);
- FunParamPuts(ofun, "XBPAR", 1, NULL, "Blank Param", 0);
- FunParamPuti(ofun, "XIPAR", 0, 100, "INTEGER Param", 0);
- FunParamPuti(ofun, "XIPAR", 1, 101, "INTEGER Param", 0);
- FunParamPutd(ofun, "XDPAR", 0, -123456789.9876, 12, "DOUBLE Param", 0);
- FunParamPutd(ofun, "XDPAR", 1, -123456.780, 4, "DOUBLE Param", 0);
- FunParamPuts(ofun, "XSPAR", 0, argv[0],
- "long comment string that will test column alignment", 0);
- FunParamPuts(ofun, "XSPAR", 1, argv[1], "STRING Param", 0);
- if( !FunImagePut(ofun, buf2, dim1, dim2, bitpix2, NULL) ){
- gerror(stderr, "could not FunImagePut: %s\n", argv[2]);
- }
- if( doover ){
- FunParamPuti(ofun, "XIPAR", 1, -101, "OVERWRITTEN EXT INT Param", 0);
- /* NB: this param does not exist in this header and should be ignored */
- FunParamPuts(ofun, "SPAR", 1, argv[0], "OVERWRITTEN EXT STR Param", 0);
- }
- }
-
- if( ofun ) FunClose(ofun);
- return(0);
-}
diff --git a/funtools/funtest/x.fits b/funtools/funtest/x.fits
deleted file mode 100644
index 051b435..0000000
--- a/funtools/funtest/x.fits
+++ /dev/null
@@ -1 +0,0 @@
-SIMPLE = T / FITS STANDARD BITPIX = 8 / Binary data NAXIS = 0 / No image array present EXTEND = T / Standard extensions might follow END XTENSION= 'BINTABLE' / FITS BINARY TABLE BITPIX = 8 / Binary data NAXIS = 2 / Table is a matrix NAXIS1 = 20 / Width of table in bytes NAXIS2 = 4 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count TFIELDS = 7 / Number of fields in row EXTNAME = 'EVENTS ' / Ext. name EXTVER = 1 / Ext. version TFORM1 = '1I ' / Data type for field TFORM2 = '1I ' / Data type for field TFORM3 = '1I ' / Data type for field TFORM4 = '1I ' / Data type for field TFORM5 = '1D ' / Data type for field TFORM6 = '1I ' / Data type for field TFORM7 = '1I ' / Data type for field TTYPE1 = 'X ' / Label for field TTYPE2 = 'Y ' / Label for field TTYPE3 = 'PHA ' / Label for field TTYPE4 = 'PI ' / Label for field TTYPE5 = 'TIME ' / Label for field TTYPE6 = 'DX ' / Label for field TTYPE7 = 'DY ' / Label for field TLMIN1 = 1 / Min. axis value TLMIN2 = 1 / Min. axis value TLMAX1 = 1024 / Max. axis value TLMAX2 = 1024 / Max. axis value TCTYP1 = 'RA---TAN' / axis type (e.g. RA---TAN) TCTYP2 = 'DEC--TAN' / axis type (e.g. RA---TAN) TCRVL1 = 3.447319000000002E2 / sky coord (deg.) TCDLT1 = -2.22222200000000E-3 / degrees per pixel TCRPX1 = 5.120000000000000E2 / pixel of tangent plane direc. TUNIT1 = ' ' / axis units TUNIT2 = ' ' / axis units TUNIT3 = ' ' / axis units TUNIT4 = ' ' / axis units TUNIT5 = ' ' / axis units TUNIT6 = ' ' / axis units TUNIT7 = ' ' / axis units TCRVL2 = 5.861319000000003E1 / sky coord (deg.) TCDLT2 = 2.222222000000002E-3 / degrees per pixel TCRPX2 = 5.129999999999999E2 / pixel of tangent plane direc. TCROT2 = 0.000000000000000E0 / rotation angle (degrees) NAXLEN = 2 / Number of QPOE axes AXLEN1 = 1024 / Dim. of qpoe axis 1 AXLEN2 = 1024 / Dim. of qpoe axis 2 OBJECT = 'CTB 109 ' / target object name TELESCOP= 'EINSTEIN' / telescope (mission) name INSTRUME= 'IPC ' / instrument (detector) name RADECSYS= 'FK4 ' / WCS for this file (e.g. Fk4) EQUINOX = 1.950000E3 / equinox (epoch) for WCS MJD-OBS = 4.442798E4 / MJD of start of obs. DATE-OBS= '07/07/80' / date of observation start TIME-OBS= '23:26:57' / time of observation start DATE-END= '08/07/80' / date of observation end TIME-END= '01:37:20' / time of observation end OBS_ID = '8102 ' / observation ID OBSERVER= ' ' / observation PI ROR_NUM = 563 / observation id ORIGIN = 'USA ' / country where data was processed FILTER = 'NONE ' / filter id OBS_MODE= 'POINTING' / pointing mode TIMEREF = 'LOCAL ' / timing reference system TIMESYS = 'UNKNOWN ' / time coordinate system POISSERR= T / clock drift corrections MJDREFI = 43508 / integer portion of mjd for SC clock start MJDREFF = 0.000000000000000E0 / fractional portion of mjd for SC clock start XS-EVREF= 0 / day offset from mjdrday to event start times XS-TBASE= 7.948683414530913E7 / seconds from s/c clock start to obs start ONTIME = 4.440957031250007E3 / on time (seconds) LIVETIME= 4.255773437500007E3 / live time (seconds) DTCOR = 9.583015E-1 / dead time correction RA_NOM = 3.447319E2 / nominal right ascension (degrees) DEC_NOM = 5.861319E1 / nominal declination (degrees) ROLL_NOM= -5.130594E1 / nominal roll angle (degrees) XS-XPT = 512 / target pointing direction (pixels) XS-YPT = 512 / target pointing direction (pixels) XS-XDET = 1024 / x dimen. of detector XS-YDET = 1024 / y dimen. of detector XS-FOV = 0 / field of view (degrees) XS-INPXX= 2.222222E-3 / original degrees per pixel XS-INPXY= 2.222222E-3 / original degrees per pixel OPTAXISX= 5.145000E2 / detector opt. axis x in detector pixels OPTAXISY= 4.993000E2 / detector opt. axis y in detector pixels PHACHANS= 16 / number pha channels PICHANS = 16 / number pi energy channels MINPI = 0 / min pi channels MAXPI = 0 / max pi channels MINPHA = 0 / min pha channels MAXPHA = 0 / max pha channels FORMAT = 1 / PROS/QPOE Format Number REVISION= 0 / PROS/QPOE Revision Number TALEN1 = 1024 / x axis dimension TALEN2 = 1024 / y axis dimension TALEN6 = 1024 / x axis dimension TALEN7 = 1024 / x axis dimension XS-SORT = 'EOF ' / type of event sort END øì
diff --git a/funtools/funtext.c b/funtools/funtext.c
deleted file mode 100644
index 8189a26..0000000
--- a/funtools/funtext.c
+++ /dev/null
@@ -1,1194 +0,0 @@
-/*
- * Copyright (c) 1999-2005 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-/* struct for getting column info from headers */
-typedef struct _hcstruct{
- int args;
- int eflag;
- int clen;
- int maxlen;
- char *fmt;
- char *expr;
- char mbuf[SZ_LINE];
- char tbuf[SZ_LINE];
-} *HC, HCRec;
-
-/* parser characteristics struct */
-typedef struct _ptyperec{
- char *delims;
- char *comchars;
- char *eot;
- int nullvalue;
- int whitespace;
- int units;
- int comeot;
- int lazyeot;
- char *hcolfmt;
-} *PType, PTypeRec;
-
-static PTypeRec ptype[] =
- {{" \t,\n", "#\n", NULL, 0, 0, 0, 1, 1, NULL}, /* funtools */
- {" \t\n", "#\n", NULL, 0, 0, 0, 1, 1, NULL}, /* spaces */
- {",\n", "#\n", NULL, 1, 0, 0, 1, 1, NULL}, /* commas */
- {"\t\n", "#\n", "\f\n", 1, 0, 0, 1, 0, NULL}, /* rdb */
- {"\t\n", "#\n", NULL, 1, 0, 1, 1, 1, "Column $col ($fmt)"}, /* VizieR */
- {"|;\n", "#\n", NULL, 1, 0, 0, 1, 1, NULL}}; /* other */
-
-/* macro return buffer */
-static char macrobuf[SZ_LINE];
-
-/*
- *
- * _HCCB -- callback for macro expansion
- *
- */
-#ifdef ANSI_FUNC
-static char *_HCCB(char *name, void *client_data)
-#else
-static char *_HCCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- HC hc = (HC)client_data;
-
- /* perform macro replacement */
- if( !strcmp(name, "name") || !strcmp(name, "col") ){
- if( strchr(hc->mbuf, 'n') ){
- hc->eflag = 1;
- gerror(stderr,
- "$%s can only be specified once in headcol format\n", name);
- return NULL;
- }
- strncpy(macrobuf, "%s", SZ_LINE);
- strncat(hc->mbuf, "n", SZ_LINE);
- hc->args++;
- return macrobuf;
- }
- else if( !strcmp(name, "format") || !strcmp(name, "fmt") ){
- if( strchr(hc->mbuf, 'f') ){
- hc->eflag = 1;
- gerror(stderr,
- "$%s can only be specified once in headcol format\n", name);
- return NULL;
- }
- strncpy(macrobuf, "%[a-zA-Z0-9.]", SZ_LINE);
- strncat(hc->mbuf, "f", SZ_LINE);
- hc->args++;
- return macrobuf;
- }
- else if( !strcmp(name, "skip") ){
- strncpy(macrobuf, "%*s", SZ_LINE);
- return macrobuf;
- }
- else if( !strcmp(name, "skipi") ){
- strncpy(macrobuf, "%*d", SZ_LINE);
- return macrobuf;
- }
- else if( !strcmp(name, "skipf") ){
- strncpy(macrobuf, "%*f", SZ_LINE);
- return macrobuf;
- }
- else{
- return NULL;
- }
-}
-
-/*
- *
- * HCFree -- free up headercolumn struct
- *
- */
-#ifdef ANSI_FUNC
-static void
-HCFree(HC hc)
-#else
-static void
-HCFree(hc)
- HC hc;
-#endif
-{
- /* sanity check */
- if( !hc ) return;
- if( hc->fmt ) xfree(hc->fmt);
- if( hc->expr ) xfree(hc->expr);
- xfree(hc);
-}
-
-/*
- *
- * HCNew -- allocate header/column struct and generate scanf expression
- *
- */
-#ifdef ANSI_FUNC
-static HC
-HCNew(char *s)
-#else
-static HC
-HCNew(s)
- char *s;
-#endif
-{
- HC hc=NULL;
-
- /* sanity check */
- if( !s ) return NULL;
-
- /* allocate record */
- if( !(hc=xcalloc(1, sizeof(HCRec))) ) return NULL;
- /* expand format specification to make a scanf format */
- if( !(hc->fmt = ExpandMacro(s, NULL, NULL, 0, _HCCB, hc)) ||
- hc->eflag ){
- HCFree(hc);
- return NULL;
- }
- return hc;
-}
-
-/*
- *
- * HCProcess -- process a header line to see if it contains column info
- *
- */
-#ifdef ANSI_FUNC
-static char *
-HCProcess(HC hc, char *s)
-#else
-static char *
-HCProcess(hc, s)
- HC hc;
- char *s;
-#endif
-{
- int got;
- int len;
- char tbuf[SZ_LINE];
- char tbuf1[SZ_LINE];
- char tbuf2[SZ_LINE];
-
- /* sanity check */
- if( !hc || !*hc->mbuf || !hc->fmt || !s ) return NULL;
-
- /* clear buffers */
- *tbuf = '\0';
- *tbuf1 = '\0';
- *tbuf2 = '\0';
-
- /* skip leading white space */
- while( isspace((int)*s) ) s++;
-
- /* try to recognize a type specification */
- if( !strcmp(hc->mbuf, "n") ){
- if( (got = sscanf(s, hc->fmt, tbuf1)) != hc->args ) return NULL;
- strncpy(tbuf, tbuf1, SZ_LINE);
- }
- else if( !strcmp(hc->mbuf, "f") ){
- if( (got = sscanf(s, hc->fmt, tbuf1)) != hc->args ) return NULL;
- strncpy(tbuf, tbuf1, SZ_LINE);
- }
- else if( !strcmp(hc->mbuf, "nf") ){
- if( (got = sscanf(s, hc->fmt, tbuf1, tbuf2)) != hc->args ) return NULL;
- switch(*tbuf2){
- case 'I':
- snprintf(tbuf, SZ_LINE, "%s:J", tbuf1);
- break;
- case 'F':
- snprintf(tbuf, SZ_LINE, "%s:D", tbuf1);
- break;
- case 'A':
- snprintf(tbuf, SZ_LINE, "%s:%sA", tbuf1, &tbuf2[1]?&tbuf2[1]:"");
- break;
- default:
- snprintf(tbuf, SZ_LINE, "%s:%s", tbuf1, tbuf2);
- break;
- }
- }
- else if( !strcmp(hc->mbuf, "fn") ){
- if( (got = sscanf(s, hc->fmt, tbuf1, tbuf2)) != hc->args ) return NULL;
- switch(*tbuf2){
- case 'I':
- snprintf(tbuf, SZ_LINE, "%s:J", tbuf2);
- break;
- case 'F':
- snprintf(tbuf, SZ_LINE, "%s:D", tbuf2);
- break;
- case 'A':
- snprintf(tbuf, SZ_LINE, "%s:%sA", tbuf2, &tbuf1[1]?&tbuf1[1]:"");
- break;
- default:
- snprintf(tbuf, SZ_LINE, "%s:%s", tbuf2, tbuf1);
- break;
- }
- }
- else{
- *tbuf = '\0';
- }
-
- /* add to expression */
- if( *hc->tbuf ){
- len = strlen(tbuf);
- /* make sure we have ennough room */
- if( (len + hc->clen + 1) >= hc->maxlen ){
- while( (len + hc->clen +1) > hc->maxlen ){
- hc->maxlen += SZ_LINE;
- }
- if( hc->clen == 0 )
- hc->expr = (char *)xcalloc(hc->maxlen, sizeof(char));
- else
- hc->expr = (char *)xrealloc(hc->expr, hc->maxlen);
- }
- /* eventdef syntax requires a comma between column arguments */
- if( *hc->expr ) strncat(hc->expr, ",", SZ_LINE-1);
- /* add new column */
- strncat(hc->expr, tbuf, SZ_LINE-1);
- }
-
- /* return what we just got */
- return hc->tbuf;
-}
-
-/*
- *
- * _FunTextGetLine -- get a line of text (using existing line if possible)
- *
- */
-#ifdef ANSI_FUNC
-static int
-_FunTextGetLine(Fun fun, char *iline, char *lbuf, int llen)
-#else
-static int _FunTextGetLine(fun, iline, lbuf, llen)
- Fun fun;
- char *iline;
- char *lbuf;
- int llen;
-#endif
-{
- int len;
- char *lptr=NULL;
-
- /* initialize */
- *lbuf = '\0';
-
- /* seed with previously-read partial line, if necessary */
- if( iline && iline[0] ){
- strncpy(lbuf, iline, llen-1);
- lbuf[llen-1] = '\0';
- iline[0] = '\0';
- /* get actual length of string */
- len = strlen(lbuf);
- /* check for complete line (EOL at end of string) */
- if( lbuf[len-1] == '\n' )
- lptr = NULL;
- /* otherwise prepare to read rest of line */
- else
- lptr = &lbuf[len];
- }
- /* need a whole line */
- else{
- lptr = lbuf;
- }
- /* read more if we need it */
- if( lptr ){
- /* get next line, error if none */
- if( !ggets(fun->gio, lptr, llen) ){
- return 0;
- }
- }
- return strlen(lbuf);
-}
-
-/*
- *
- * semi-public routines, used by other modules
- *
- */
-
-/*
- *
- * FunTextParam -- parse a line, looking for a valid parameter
- *
- */
-#ifdef ANSI_FUNC
-int
-FunTextParam(char *pdelims,
- char *lbuf, char *kbuf, char *vbuf, char *cbuf, int maxlen)
-#else
-int FunTextParam(pdelims, lbuf, kbuf, vbuf, cbuf, maxlen)
- char *pdelims;
- char *lbuf, *kbuf, *vbuf, *cbuf;
- int maxlen;
-#endif
-{
- int i;
- int hstate=0;
- int got=0;
- int kgot=0;
- int len=0;
- int docom=0;
- int dtable[PARSE_TABLE_SIZE];
- char *s;
- char *kptr, *vptr, *cptr;
- char *tptr;
- char *tbuf;
- char quote='\0';
-
- kptr = kbuf;
- vptr = vbuf;
- cptr = cbuf;
- *kptr = '\0';
- *vptr = '\0';
- *cptr = '\0';
-
- /* set up delim table for removing enclosing chars from keyword strings */
- memset(dtable, 0, PARSE_TABLE_SIZE*sizeof(int));
- if( pdelims && *pdelims ){
- /* set the delim table */
- for(s=pdelims; s && *s; s++){
- if( (i=(int)*s) == '\\' ){
- s++;
- if( *s == 'n' ) i = '\n';
- else if( *s == 't' ) i = '\t';
- else if( *s == 'r' ) i = '\r';
- else if( *s == 'f' ) i = '\014';
- }
- dtable[i] = 1;
- }
- }
- else{
- dtable[(int)'='] = 1;
- dtable[(int)':'] = 1;
- }
-
- /* get modifiable string */
- tbuf = xstrdup(lbuf);
- nocr(tbuf);
- nowhite(tbuf, tbuf);
-
- /* process it */
- for(tptr=tbuf; *tptr;){
- switch(hstate){
- /* gather up keyword */
- case 0:
- if( (*tptr == ' ') || (*tptr == '\t') || dtable[(int)*tptr] ){
- /* check for FITS-style comment */
- if( *tptr == '=' ) docom=1;
- hstate = 1;
- len = 0;
- }
- else{
- *kptr++ = *tptr;
- *kptr = '\0';
- if( ++len >= maxlen ) goto done;
- }
- tptr++;
- break;
- /* process whitespace, including = and : */
- case 1:
- /* skip past whitespace before value */
- if( (*tptr == ' ') || (*tptr == '\t') )
- tptr++;
- else if( dtable[(int)*tptr] ){
- /* check for FITS-style comment */
- if( *tptr == '=' ) docom=1;
- /*only one = or : allowed */
- kgot++;
- if( kgot > 1 ){
- hstate = 2;
- len = 0;
- }
- else{
- tptr++;
- }
- }
- else{
- hstate = 2;
- len = 0;
- }
- break;
- /* check for quoted string */
- case 2:
- if( *tptr == '"' ){
- quote = '"';
- docom = 1;
- hstate = 3;
- len = 0;
- }
- else if( *tptr == '\'' ){
- quote = '\'';
- docom = 1;
- hstate = 3;
- len = 0;
- }
- else{
- *vptr++ = *tptr;
- *vptr = '\0';;
- if( ++len >= maxlen ) goto done;
- hstate = 4;
- len = 0;
- }
- tptr++;
- break;
- /* gather up value in quoted string */
- case 3:
- if( *tptr == quote ){
- hstate = 5;
- len = 0;
- }
- else{
- *vptr++ = *tptr;
- *vptr = '\0';
- if( ++len >= maxlen ) goto done;
- }
- tptr++;
- break;
- /* gather value up to whitespace */
- case 4:
- /* gather up value */
- if( (*tptr == ' ') || (*tptr == '\t') ){
- hstate = 5;
- len = 0;
- }
- else{
- *vptr++ = *tptr;
- *vptr = '\0';
- if( ++len >= maxlen ) goto done;
- }
- tptr++;
- break;
- /* skip past whitespace before possible comment */
- case 5:
- if( docom ){
- if( (*tptr == ' ') || (*tptr == '\t') ){
- tptr++;
- }
- else{
- hstate = 6;
- len = 0;
- }
- }
- /* if comments are not wanted, then everything is value */
- else{
- *vptr++ = *tptr;
- *vptr = '\0';
- tptr++;
- if( ++len >= maxlen ) goto done;
- }
- break;
- /* look for comment */
- case 6:
- if( *tptr == '/' ){
- tptr++;
- hstate = 7;
- len = 0;
- }
- /* extra chars but no comment char */
- else{
- got = 4;
- goto done2;
- }
- break;
- /* skip past whitespace before possible comment */
- case 7:
- if( (*tptr == ' ') || (*tptr == '\t') ){
- tptr++;
- }
- else{
- hstate = 8;
- len = 0;
- }
- break;
- /* gather up comment to end of line */
- case 8:
- *cptr++ = *tptr++;
- *cptr = '\0';
- if( ++len >= maxlen ) goto done;
- break;
- default:
- gerror(stderr, "unknown state (%d) processing text header\n", hstate);
- break;
- }
- }
-
- /* result code depends on what we gathered up */
-done:
- if( *cbuf )
- got = 3;
- else if( *vbuf )
- got = 2;
- else if( *kbuf )
- got = 1;
- else
- got = 0;
-
-done2:
- if( tbuf ) xfree(tbuf);
- return got;
-}
-
-
-/*
- *
- * FunTextParamHeader -- put param into header
- *
- */
-#ifdef ANSI_FUNC
-void
-FunTextParamHeader(FITSHead theader,
- char *lbuf, char *key, char *val, char *com, int pgot)
-#else
-void FunTextParamHeader(theader, lbuf, key, val, com, pgot)
- FITSHead theader;
- char *lbuf, *key, *val, *com;
- int pgot;
-#endif
-{
- char *lptr;
- longlong ival;
- int dtype;
- double dval;
-
- switch(pgot){
- case -1:
- gerror(stderr, "internal text parser error: processing params\n");
- break;
- case 0:
- break;
- case 1:
- ft_headapps(theader, "COMMENT", 0, key, NULL);
- break;
- case 2:
- case 3:
- dtype = ParseDataType(val, &dval, &ival);
- switch( dtype ){
- case PARSE_COMMENT:
- case PARSE_DASH:
- case PARSE_EOL:
- case PARSE_NULL:
- case PARSE_EOT:
- break;
- case PARSE_FLOAT:
- ft_headsetr(theader, key, 0, dval, 7, com, 1);
- break;
- case PARSE_HEXINT:
- case PARSE_INTEGER:
- ft_headseti(theader, key, 0, (int)ival, com, 1);
- break;
- case PARSE_STRING:
- ft_headsets(theader, key, 0, val, com, 1);
- break;
- }
- break;
- case 4:
- /* clean up line */
- nocr(lbuf);
- nowhite(lbuf, lbuf);
- for(lptr=lbuf; *lptr; lptr++)
- if( *lptr == '\t' ) *lptr = ' ';
- ft_headapps(theader, "COMMENT", 0, lbuf, NULL);
- break;
- }
-}
-
-/*
- *
- * FunTextOpen -- open a ascii text events file,
- * set up binning and filtering parameters
- *
- */
-#ifdef ANSI_FUNC
-Fun
-FunTextOpen(char *fname, char *mode, char *iline, GIO ifd)
-#else
-Fun FunTextOpen(fname, mode, iline, ifd)
- char *fname;
- char *mode;
- char *iline;
- GIO ifd;
-#endif
-{
- int i=0, p=0, q=0, t=0;
- int got;
- int state;
- int alen=0;
- int indx=0;
- int pgot=0;
- int nheader=0;
- int ntheader=0;
- char *s;
- char *delim=NULL, *comchars=NULL, *eot=NULL, *textp=NULL;
- char **hcolfmts=NULL;
- char tdelims[SZ_LINE];
- char tdebug[SZ_LINE];
- char pdelims[SZ_LINE];
- char tcomchars[SZ_LINE];
- char thcolfmt[SZ_LINE];
- char teot[SZ_LINE];
- char tnull1[SZ_LINE];
- char lbuf[SZ_LINE];
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- char pmode[SZ_LINE];
- char key[SZ_LINE];
- char val[SZ_LINE];
- char com[SZ_LINE];
- char eventdef[SZ_LINE];
- char file[SZ_LINE];
- char extn[SZ_LINE];
- char textparams[SZ_LINE];
- char tail[SZ_LINE];
- char ttail[SZ_LINE];
- char tname[SZ_LINE];
- Parse parser;
- Parse fakep=NULL;
- ParsedLine line=NULL, header=NULL, data1=NULL;
- FITSHead theader=NULL, tmerge=NULL;
- Fun fun=NULL;
- HC *hc=NULL;
-
- /* intialize */
- *tdebug = '\0';
- *tdelims = '\0';
- *pdelims = '\0';
- *tcomchars = '\0';
- *thcolfmt = '\0';
- *eventdef = '\0';
- *teot = '\0';
- *tnull1 = '\0';
- *tbuf = '\0';
- *extn = '\0';
- *textparams = '\0';
- *tail = '\0';
- *ttail = '\0';
- *tname = '\0';
- *file = '\0';
-
- /* allocate a fun record */
- if( !(fun = _FunNew()) )
- return NULL;
-
- /* save filename and mode */
- fun->fname = xstrdup(fname);
- fun->mode = xstrdup(mode);
-
- /* parse filename and get extension, index and tail */
- ft_parsefilename(fname, file, extn, SZ_LINE, &indx, ttail, SZ_LINE);
- /* if TEXT() specified, strip it out and place in textparams */
- if( !_FunSpecialFile(ttail, "TEXT", tname, tail, textparams, SZ_LINE) ){
- strncpy(tail, ttail, SZ_LINE-1);
- }
-
- /* use passed-in fd or try to open the file */
- if( ifd )
- fun->gio = ifd;
- else if( !(fun->gio=gopen(file, mode)) )
- goto error;
-
- /* process section and keywords (but not mode keywords) */
- textp = textparams;
- _FunKeyword(textp, "debug", "TEXT_DEBUG", tdebug, SZ_LINE);
- _FunKeyword(textp, "delims", "TEXT_DELIMS", tdelims, SZ_LINE);
- _FunKeyword(textp, "pdelims", "TEXT_DELIMS", pdelims, SZ_LINE);
- _FunKeyword(textp, "comchars", "TEXT_COMCHARS", tcomchars, SZ_LINE);
- _FunKeyword(textp, "hcolfmt", "TEXT_HCOLFMT", thcolfmt, SZ_LINE);
- _FunKeyword(textp, "cols", "TEXT_COLUMNS", eventdef, SZ_LINE);
- _FunKeyword(textp, "eot", "TEXT_EOT", teot, SZ_LINE);
- _FunKeyword(textp, "null1", "TEXT_NULL1", tnull1, SZ_LINE);
- _FunKeyword(textp, "alen", "TEXT_ALEN", tbuf, SZ_LINE);
- if( *tbuf ) alen = atoi(tbuf);
- if( *textparams ){
- if( strlen(textp) && !strchr(textp, '=') ){
- /* the whole string is the column spec */
- strncpy(eventdef, textp, SZ_LINE-1);
- textp = NULL;
- }
- }
-
- /* make sure CR is in the delim table */
- if(*tdelims && !strstr(tdelims, "\\n")) strncat(tdelims, "\\n", SZ_LINE-1);
-
- /* create parsers */
- if( *tdelims ){
- fun->nparser = 1;
- fun->parsers = (Parse *)xcalloc(fun->nparser, sizeof(Parse));
- hcolfmts = xcalloc(fun->nparser, sizeof(char *));
- hc = xcalloc(fun->nparser, sizeof(HCRec));
- delim = tdelims;
- comchars = (*tcomchars ? tcomchars : PARSE_DEFAULT_COMCHARS);
- hcolfmts[0] = (*thcolfmt ? thcolfmt : NULL);
- hc[0] = HCNew(hcolfmts[0]);
- eot = (*teot ? teot : NULL);
- *pmode = '\0';
- if( textp && *textp ){
- strncat(pmode, textp, SZ_LINE-1);
- strncat(pmode, ",", SZ_LINE-1);
- }
- strncat(pmode, PARSE_DEFAULT_NULLVALUES, SZ_LINE-1);
- strncat(pmode, ",", SZ_LINE-1);
- strncat(pmode, PARSE_DEFAULT_WHITESPACE, SZ_LINE-1);
- strncat(pmode, ",", SZ_LINE-1);
- strncat(pmode, PARSE_DEFAULT_UNITS, SZ_LINE-1);
- strncat(pmode, ",", SZ_LINE-1);
- strncat(pmode, PARSE_DEFAULT_COMEOT, SZ_LINE-1);
- strncat(pmode, ",", SZ_LINE-1);
- strncat(pmode, PARSE_DEFAULT_LAZYEOT, SZ_LINE-1);
- if( !(fun->parsers[0] = ParseNew(delim, comchars, eot, pmode)) ){
- gwarning(stderr, "could not create parser #%d (%s)\n", p, delim);
- return NULL;
- }
- }
- else{
- fun->nparser = sizeof(ptype)/sizeof(PTypeRec);
- fun->parsers = (Parse *)xcalloc(fun->nparser, sizeof(Parse));
- hcolfmts = xcalloc(fun->nparser, sizeof(char *));
- hc = xcalloc(fun->nparser, sizeof(HCRec));
- for(p=0; p<fun->nparser; p++){
- delim = ptype[p].delims;
- comchars = (*tcomchars ? tcomchars : ptype[p].comchars);
- hcolfmts[p] = (*thcolfmt ? thcolfmt : ptype[p].hcolfmt);
- hc[p] = HCNew(hcolfmts[p]);
- eot = (*teot ? teot : ptype[p].eot);
- *pmode = '\0';
- if( textp && *textp ){
- strncat(pmode, textp, SZ_LINE-1);
- }
- if( *pmode ) strncat(pmode, ",", SZ_LINE-1);
- if( ptype[p].nullvalue ){
- strncat(pmode, "nullvalues=true", SZ_LINE-1);
- }
- else{
- strncat(pmode, "nullvalues=false", SZ_LINE-1);
- }
- if( *pmode ) strncat(pmode, ",", SZ_LINE-1);
- if( ptype[p].whitespace ){
- strncat(pmode, "whitespace=true", SZ_LINE-1);
- }
- else{
- strncat(pmode, "whitespace=false", SZ_LINE-1);
- }
- if( *pmode ) strncat(pmode, ",", SZ_LINE-1);
- if( ptype[p].units ){
- strncat(pmode, "units=true", SZ_LINE-1);
- }
- else{
- strncat(pmode, "units=false", SZ_LINE-1);
- }
- if( *pmode ) strncat(pmode, ",", SZ_LINE-1);
- snprintf(tbuf, SZ_LINE-1, "comeot=%d", ptype[p].comeot);
- strncat(pmode, tbuf, SZ_LINE-1);
- if( *pmode ) strncat(pmode, ",", SZ_LINE-1);
- snprintf(tbuf, SZ_LINE-1, "lazyeot=%d", ptype[p].lazyeot);
- strncat(pmode, tbuf, SZ_LINE-1);
- if( *tdebug ){
- if( *pmode ) strncat(pmode, ",", SZ_LINE-1);
- if( istrue(tdebug) ) strcpy(tdebug, "1");
- else if( isfalse(tdebug) ) strcpy(tdebug, "0");
- snprintf(tbuf, SZ_LINE-1, "debug=%d", atoi(tdebug));
- strncat(pmode, tbuf, SZ_LINE-1);
- }
- if( !(fun->parsers[p] = ParseNew(delim, comchars, eot, pmode)) ){
- gwarning(stderr, "could not create text parser #%d (%s)\n", p, delim);
- goto error;
- }
- }
- }
-
- /* look for section specification in environment, if none was specified */
- if ( !*extn && (indx <=0) ) {
- if ( (s = (char *)getenv("TEXT_EXTNAME")) ) {
- strncpy(extn, s, SZ_LINE-1);
- extn[SZ_LINE-1] = '\0';
- }
- if ( (s = (char *)getenv("TEXT_EXTNUM")) ) {
- indx = atoi(s);
- }
- }
-
- /* skip to the specified table -- loop requires explicit break, which
- we do through a goto to the header processing section or to error */
- i = 0;
-ext:
- i++;
- /* if no extension was specified, we are at the right place already */
- if( !*extn && (indx <=0) ) goto ext2;
- /* index was found, break out and process header */
- if( i == indx ) goto ext2;
- /* grab next table: get next line, error if none */
- while( 1 ){
- if( !_FunTextGetLine(fun, iline, lbuf, SZ_LINE) ){
- gwarning(stderr,
- "text parser failure looking for extension: %s/%d\n",
- *extn?extn:"unnamed", (indx!=-1)?indx:1);
- goto error;
- }
- /* analyze line and make sure one parser succeeded (even if its EOT) */
- if( !ParseAnalyze(fun->parsers, fun->nparser, lbuf) ){
- gwarning(stderr, "text parser failure analyzing line:\n%s", lbuf);
- goto error;
- }
- /* look for that valid parser */
- for(got=0, parser=NULL, p=0; p<fun->nparser; p++){
- if( fun->parsers[p]->state & PARSE_STATE_BAD) continue;
- if( fun->parsers[p]->state & PARSE_STATE_EOT){
- for(q=0; q<fun->nparser; q++){
- if( fun->parsers[q]->state & PARSE_STATE_BAD) continue;
- /* a parser finding eot is still valid */
- if( fun->parsers[q]->state & PARSE_STATE_EOT) continue;
- /* all other parsers missed this eot, so they are "bad" */
- fun->parsers[q]->state = PARSE_STATE_BADMATCH;
- }
- got++;
- parser = NULL;
- break;
- }
- else{
- parser = fun->parsers[p];
- }
- }
- /* check for extn, if necessary */
- if( parser ){
- if( *extn ){
- if( parser->types[0] == PARSE_COMMENT ){
- if( FunTextParam(pdelims, &lbuf[1], key, val, com, SZ_LINE) >=2 ){
- /* initialize fitsy header, if necessary */
- if( !theader ) theader = ft_headinit(NULL, 0);
- /* add to temp header */
- FunTextParamHeader(theader, &lbuf[1], key, val, com, pgot);
- /* see if this is the right extension */
- nowhite(val, val);
- if( !strcasecmp(key, "extname") && !strcasecmp(val, extn) ){
- goto ext2;
- }
- }
- }
- }
- }
- /* found another EOT */
- else{
- /* did not find named extension, free temp header for this section */
- if( *extn ){
- ft_headfree(theader, 1);
- theader = NULL;
- }
- /* if we still have parsers, we can continue with the next section */
- if( got ){
- /* bad parsers are kept bad, but others are reset */
- for(p=0; p<fun->nparser; p++){
- if( fun->parsers[p]->state & PARSE_STATE_BAD) continue;
- /* if we read and analyzed into the next table, back up a bit */
- if( fun->parsers[p]->state & PARSE_STATE_NEXTLINE ){
- line = ParseLineDup(fun->parsers[p], fun->parsers[p]->cur);
- state = fun->parsers[p]->state;
- state &= ~(PARSE_STATE_NEXTLINE|PARSE_STATE_EOT);
- ParseReset(fun->parsers[p], line, state);
- }
- /* for comments, we just reprocess the line */
- else if( fun->parsers[p]->state & PARSE_STATE_REDOLINE ){
- ParseReset(fun->parsers[p], NULL, 0);
- strncpy(tbuf, lbuf, SZ_LINE-1);
- iline = tbuf;
- }
- else{
- ParseReset(fun->parsers[p], NULL, 0);
- }
- }
- /* go back to the outermost loop and look for next extension */
- goto ext;
- }
- else{
- gwarning(stderr,
- "text parser failure looking for data table %d\n",
- indx);
- goto error;
- }
- }
- }
-ext2:
-
-/* look for a header */
-header:
- /* get line, seeding with previously-read partial line, if necessary */
- if( !_FunTextGetLine(fun, iline, lbuf, SZ_LINE) ){
- /* if we ran out of file but eventdef was passed, we have an empty table */
- if( *eventdef ){
- goto evdef;
- }
- /* otherwise we're probably in trouble */
- /* we'll make some last-ditch checks for a header, which should be in
- parse.c but would be really hard to add there */
- else{
- /* it might be an empty table with a proper header */
- if( !nheader ) goto headguess;
- /* or, if all strings have ':' characters, it might be a header line */
- for(nheader=0, p=0; p<fun->nparser; p++){
- if( fun->parsers[p]->state & PARSE_STATE_BAD ) continue;
- if( fun->parsers[p]->types[0] == PARSE_STRING ){
- for(t=0; t<fun->parsers[p]->ntoken; t++){
- if( !strchr(fun->parsers[p]->tokens[t].sval, ':') ){
- nheader++;
- break;
- }
- }
- /* flag that we are past the header and into the data */
- fun->parsers[p]->state = PARSE_STATE_DATA;
- fun->parsers[p]->header =
- ParseLineDup(fun->parsers[p], fun->parsers[p]->cur);
- }
- else{
- nheader++;
- break;
- }
- }
- if( !nheader ) goto headguess;
- /* give up */
- gwarning(stderr, "text parser failure looking for header (section %d)\n",
- indx);
- goto error;
- }
- }
- /* parse and analyze line */
- if( !ParseAnalyze(fun->parsers, fun->nparser, lbuf) ){
- gwarning(stderr, "text parser failure analyzing header\n");
- goto error;
- }
- /* see if all are in data state, meaning we have found the header */
- for(p=0, nheader=0, ntheader=0; p<fun->nparser; p++){
- if( fun->parsers[p]->state & PARSE_STATE_BAD ) continue;
- /* process comment into a header parameter */
- if( fun->parsers[p]->types[0] == PARSE_COMMENT ){
- if( strlen(lbuf) ){
- /* try to process parameter as a header column spec */
- if( !hc[p] || !HCProcess(hc[p], &lbuf[1]) ){
- /* if not, process as an ordinary parameter (first time only) */
- if( !ntheader ){
- pgot = FunTextParam(pdelims, &lbuf[1], key, val, com, SZ_LINE);
- /* initialize fitsy header, if necessary */
- if( !theader ) theader = ft_headinit(NULL, 0);
- FunTextParamHeader(theader, &lbuf[1], key, val, com, pgot);
- ntheader++;
- }
- }
- }
- }
- if( !(fun->parsers[p]->state & PARSE_STATE_DATA) ) nheader++;
- }
- /* if we're not all in the data state, to back for more */
- if( nheader ) goto header;
-
- /* first line of data tells data types */
- for(p=0; p<fun->nparser; p++){
- if( !(fun->parsers[p]->state & PARSE_STATE_BAD) ){
- if( fun->parsers[p]->data1 ){
- data1 = fun->parsers[p]->data1;
- break;
- }
- }
- }
- /* make sure we read enough to get data */
- if( !data1 ) goto header;
-
- /* if the eventdef was not specified, make a guess */
-headguess:
- if( !*eventdef ){
- /* see if we got the evendef from the header */
- for(p=0; p<fun->nparser; p++){
- if( hc[p] && hc[p]->expr ){
- /* if it has type information, use it */
- if( strchr(hc[p]->expr, ':') ){
- strncpy(eventdef, hc[p]->expr, SZ_LINE-1);
- goto evdef;
- }
- else{
- /* if we have no header info, we should be able to get it here */
- if( !fun->parsers[p]->header ){
- if( (fakep = ParseNew(",\n", NULL, NULL, NULL)) ){
- ParseLine(fakep, hc[p]->expr, NULL);
- if( fakep->cur ){
- fun->parsers[p]->header = ParseLineDup(fakep, fakep->cur);
- }
- ParseFree(fakep);
- }
- }
- }
- }
- }
- /* a header tells column names (or else we have to make them up) */
- for(p=0; p<fun->nparser; p++){
- if( !(fun->parsers[p]->state & PARSE_STATE_BAD) ){
- if( fun->parsers[p]->header ){
- header = fun->parsers[p]->header;
- break;
- }
- }
- }
- /* fake header line, if necessary */
- if( !header ){
- *tbuf = '\0';
- *lbuf = '\0';
- if( !data1 ){
- gwarning(stderr,
- "internal text parser error: no data available to fake text header\n");
- goto error;
- }
- for(t=0; t<data1->ntoken; t++){
- snprintf(tbuf, SZ_LINE-1, "col%d", t+1);
- if( *lbuf )
- strncat(lbuf, " ", SZ_LINE-1);
- strncat(lbuf, tbuf, SZ_LINE-1);
- }
- if( !(fakep = ParseNew(" \n", NULL, NULL, NULL)) ) goto error;
- if( !ParseAnalyze(&fakep, 1, lbuf) ) goto error;
- header = fakep->cur;
- }
-
- /* make up the event definition */
- for(t=0; t<header->ntoken; t++){
- *tbuf = '\0';
- strncpy(tbuf, header->tokens[t].sval, SZ_LINE-1);
- if( !strchr(header->tokens[t].sval, ':') ) {
- if( !data1 ){
- gwarning(stderr,
- "an empty table must specify data types in the column header\n");
- goto error;
- }
- switch(data1->tokens[t].type){
- case PARSE_FLOAT:
- strncat(tbuf, ":1D", SZ_LINE-1);
- break;
- case PARSE_HEXINT:
- strncat(tbuf, ":32X", SZ_LINE-1);
- break;
- case PARSE_INTEGER:
- strncat(tbuf, ":1J", SZ_LINE-1);
- break;
- case PARSE_STRING:
- if( alen <=0 )
- alen = MAX(strlen(data1->tokens[t].sval), PARSE_DEFAULT_ALEN);
- snprintf(tbuf2, SZ_LINE-1, ":%dA", alen);
- strncat(tbuf, tbuf2, SZ_LINE-1);
- break;
- case PARSE_NULL:
- if( *tnull1 ){
- snprintf(tbuf, SZ_LINE-1, "%s:%s", header->tokens[t].sval, tnull1);
- }
- else{
- gwarning(stderr,
- "a NULL value in row1,col%d requires null1='[I|J|E|D|A]' or cols='...'\n",
- t+1);
- goto error;
- }
- break;
- /* ignore everything else */
- case PARSE_DASH:
- case PARSE_COMMENT:
- case PARSE_EOL:
- break;
- default:
- gwarning(stderr,
- "internal text parser error: invalid type in text header: '%c'\n",
- data1->tokens[t].type);
- goto error;
- }
- }
- if( *tbuf ){
- if( *eventdef ) strncat(eventdef, ",", SZ_LINE-1);
- strncat(eventdef, tbuf, SZ_LINE-1);
- }
- }
- }
-
-evdef:
- /* create a fake table header from the event description */
- if( !(fun->header = _FunRawEvHeader(fun, NULL, tail, eventdef)) )
- goto error;
-
- /* its a valid event file */
- fun->type = FUN_EVENTS;
- /* no blanks for events */
- fun->doblank = 0;
-
- /* data will not need conversion */
- fun->endian = is_bigendian();
-
- /* look for indication of bitpix */
- if( _FunKeyword(tail, "bitpix", "TEXT_BITPIX", tbuf, SZ_LINE) )
- fun->bitpix = atoi(tbuf);
- /* else assume a safe value */
- else
- fun->bitpix = 32;
-
- /* no header on text files */
- fun->skip = 0;
-
- /* determine whether we are only processing specific rows */
- _FunRowNum(fun, tail, NULL);
- /* get the key for binning */
- _FunTableBinCols(fun, tail, "TEXT_BINCOLS");
- /* get the key for the value column for binning */
- _FunTableValCol(fun, tail, "TEXT_VCOL");
- /* calculate the image length including padding */
- _FunImageSize(fun);
- /* now parse the section specification */
- _FunParseSection(fun, tail,
- &(fun->x0), &(fun->x1), &(fun->y0), &(fun->y1),
- &(fun->block), &(fun->btype), tail, SZ_LINE);
- /* get maxbufsize for table access */
- _FunMaxBufSize(fun, tail);
- /* what's left in the tail is the filter */
- fun->filter = xstrdup(tail);
- /* fill in the default selected columns */
- FunColumnSelect(fun, 0, "copy=reference", NULL);
-
- /* skip events header, if necessary */
- if( fun->skip )
- gskip(fun->gio, (off_t)fun->skip);
-
- /* merge in comments as params */
- if( theader && fun->header ){
- tmerge = ft_headmerge(fun->header, theader, 1);
- ft_headfree(fun->header, 1);
- ft_headfree(theader, 1);
- fun->header = tmerge;
- }
-
- /* common code */
- if( !_FunOpenCommon(fun) ) goto error;
-
- /* make sure we turned indexing off */
- fun->idx = -1;
-
- /* free up tem space */
- if( fakep ) ParseFree(fakep);
- if( hcolfmts) xfree(hcolfmts);
- if( hc ){
- for(i=0; i<fun->nparser; i++){
- if( hc[i] ) HCFree(hc[i]);
- }
- xfree(hc);
- }
- /* return completed struct */
- return fun;
-
-error:
- /* free up temp space */
- if( fakep ) ParseFree(fakep);
- if( theader ) ft_headfree(theader, 1);
- if( hcolfmts) xfree(hcolfmts);
- if( hc ){
- for(i=0; i<fun->nparser; i++){
- if( hc[i] ) HCFree(hc[i]);
- }
- xfree(hc);
- }
- _FunFree(fun, 1);
- return NULL;
-}
-
diff --git a/funtools/funtools.h b/funtools/funtools.h
deleted file mode 100644
index 2d2ff08..0000000
--- a/funtools/funtools.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * funtools.h
- *
- */
-
-#ifndef __funtools_h
-#define __funtools_h
-
-/* avoid use of system -- its not secure */
-/* but funtools cannot use launch for the Cygwin platform because the stdfiles
- support is missing in the Cygwin implementation of launch */
-#ifndef USE_LAUNCH
-#define USE_LAUNCH 1
-#endif
-#if HAVE_CYGWIN
-#undef USE_LAUNCH
-#endif
-
-#define FUN_MAJOR_VERSION 1
-#define FUN_MINOR_VERSION 4
-#define FUN_PATCH_LEVEL 7
-#define FUN_VERSION "1.4.7"
-
-#ifndef FUNTOOLS_PRIVATE
-#include "prsetup.h"
-#define USE_XFILEIO 1
-#include "fitsy.h"
-#undef USE_XFILEIO
-#include "wcs.h"
-typedef void *Fun;
-#endif
-
-/* types of data "files" we know about */
-#define FUN_UNKNOWN 0
-#define FUN_IMAGE 1
-#define FUN_TABLE 2
-#define FUN_ARRAY 3
-#define FUN_EVENTS 4
-
-/* param types: these more or less match FITSType in fitsy.h */
-#define FUN_PAR_UNKNOWN 'u'
-#define FUN_PAR_COMMENT 'c'
-#define FUN_PAR_LOGICAL 'l'
-#define FUN_PAR_INTEGER 'i'
-#define FUN_PAR_STRING 's'
-#define FUN_PAR_VALUE 'v'
-#define FUN_PAR_REAL 'r'
-#define FUN_PAR_COMPLEX 'x'
-
-/* column modes and status */
-#define COL_ACTIVE 1
-#define COL_IBUF 2
-#define COL_PTR 4
-#define COL_READ 010
-#define COL_WRITE 020
-#define COL_REPLACEME 040
-
-/* operations we keep track of */
-#define OP_WRHEAD 1
-#define OP_WRIMAGE 2
-#define OP_WRTABLE 3
-#define OP_RDIMAGE 4
-#define OP_RDTABLE 5
-
-/* to determine the byte offset of a field within a structure type */
-#define FUN_OFFSET(p_type,field) \
- ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-/* library declarations */
-_PRbeg
-
-/* funopen.c */
-Fun FunOpen _PRx((char *fname, char *mode, Fun copy));
-void FunFlush _PRx((Fun fun, char *plist));
-void FunClose _PRx((Fun fun));
-
-/* funim.c */
-void *FunImageGet _PRx((Fun fun, void *buf, char *plist));
-void *FunImageRowGet _PRx((Fun fun, void *buf,
- int ystart, int ystop, char *plist));
-int FunImagePut _PRx((Fun fun, void *buf,
- int dim1, int dim2, int bitpix, char *plist));
-int FunImageRowPut _PRx((Fun fun, void *buf, int rstart, int rstop,
- int dim1, int dim2, int bitpix, char *plist));
-
-/* funtab.c */
-void *FunTableRowGet _PRx((Fun fun, void *rows, int maxrow,
- char *plist, int *nrow));
-int FunTableRowPut _PRx((Fun fun, void *rows, int nrow,
- int idx, char *plist));
-off_t FunTableRowSeek _PRx((Fun fun, int nrow, char *plist));
-
-/* funcol.c */
-void FunColumnActivate _PRx((Fun fun, char *s, char *plist));
-int FunColumnSelectArr _PRx((Fun fun, size_t size, char *mode,
- char **names, char **types, char **modes,
- int *offsets, int nargs));
-#ifdef __STDC__
-int FunColumnSelect(Fun fun, size_t size, char *plist, ...);
-#else
-int FunColumnSelect();
-#endif
-int FunColumnLookup _PRx((Fun fun, char *s, int which, char **name,
- int *type, int *plist, int *offset, int *n,
- int *width));
-int FunColumnLookup2 _PRx((Fun fun, char *s, int which,
- double *tlmin, double *tlmax,
- double *binsize, double *tscale, double *tzero));
-/* funinfo.c */
-#ifdef __STDC__
-int FunInfoGet(Fun fun, ...);
-int FunInfoPut(Fun fun, ...);
-#else
-int FunInfoGet();
-int FunInfoPut();
-#endif
-/* funparam.c */
-Fun FUN_PRIMARY _PRx((Fun fun));
-char *FUN_RAW _PRx((char *name));
-int FunParamGetb _PRx((Fun fun, char *name, int n, int defval, int *got));
-int FunParamGeti _PRx((Fun fun, char *name, int n, int defval, int *got));
-longlong FunParamGetl _PRx((Fun fun, char *name, int n, longlong defval, int *got));
-double FunParamGetd _PRx((Fun fun, char *name, int n, double defval, int *got));
-char *FunParamGets _PRx((Fun fun, char *name, int n, char *defval, int *got));
-int FunParamPutb _PRx((Fun fun, char *name, int n, int value, char *comm,
- int append));
-int FunParamPuti _PRx((Fun fun, char *name, int n, int value, char *comm,
- int append));
-int FunParamPutl _PRx((Fun fun, char *name, int n, longlong value, char *comm,
- int append));
-int FunParamPutd _PRx((Fun fun, char *name, int n, double value,
- int prec, char *comm, int append));
-int FunParamPuts _PRx((Fun fun, char *name, int n, char *value,
- char *comm, int append));
-
-/* funcalc.l */
-char *FunCalcParse _PRx((char *iname, char *oname,
- char *cmd, char *expr, char *autod, int args));
-
-/* funwcs.c */
-struct WorldCoor *_FunWCS _PRx((Fun fun, int doimage));
-
-/* funutil.c */
-int _FunKeyword _PRx((char *buf, char *key, char *env, char *vbuf, int vlen));
-
-/* funtoolsmainlib.c */
-void FuntoolsMainLibInit _PRx((void));
-
-_PRend
-
-/* for backward compatibility */
-#define FunEventsGet FunTableRowGet
-#define FunEventsPut FunTableRowPut
-
-/* the following define for user access to fun record via FunInfo() */
-/* file information */
-#define FUN_FNAME 1
-#define FUN_GIO 2
-#define FUN_HEADER 3
-#define FUN_TYPE 4
-#define FUN_BITPIX 5
-#define FUN_MIN1 6
-#define FUN_MAX1 7
-#define FUN_MIN2 8
-#define FUN_MAX2 9
-#define FUN_DIM1 10
-#define FUN_DIM2 11
-#define FUN_ENDIAN 12
-#define FUN_FILTER 13
-#define FUN_OPS 14
-/* image information */
-#define FUN_DTYPE 15
-#define FUN_DLEN 16
-#define FUN_DPAD 17
-#define FUN_DOBLANK 18
-#define FUN_BLANK 19
-#define FUN_SCALED 20
-#define FUN_BSCALE 21
-#define FUN_BZERO 22
-/* table information */
-#define FUN_BINCOLS 23
-#define FUN_ROWSIZE 24
-/* for backward compatiblity */
-#define FUN_EVSIZE 24
-#define FUN_OVERFLOW 25
-/* array information */
-#define FUN_SKIP 26
-/* reference file */
-#define FUN_IFUN 27
-#define FUN_BFUN 28
-/* section information */
-#define FUN_SECT_X0 29
-#define FUN_SECT_X1 30
-#define FUN_SECT_Y0 31
-#define FUN_SECT_Y1 32
-#define FUN_SECT_BLOCK 33
-#define FUN_SECT_BTYPE 34
-#define FUN_SECT_DIM1 35
-#define FUN_SECT_DIM2 36
-#define FUN_SECT_BITPIX 37
-#define FUN_SECT_DTYPE 38
-/* convenient ways to get to data in binned images and tables */
-#define FUN_RAWBUF 39
-#define FUN_RAWSIZE 40
-/* specified columns */
-#define FUN_NCOL 41
-#define FUN_COLS 42
-/* hacks: ifun without the reset */
-#define FUN_IFUN0 43
-/* list information */
-#define FUN_LTYPE 44
-#define FUN_LMEM 45
-#define FUN_HEAD 46
-#define FUN_CURRENT 47
-#define FUN_MARK 48
-#define FUN_NEXT 49
-/* WCS */
-#define FUN_WCS 50
-#define FUN_WCS0 51
-/* binning offsets */
-#define FUN_BINOFFS 52
-/* param modes */
-#define FUN_RAWPARAM 53
-#define FUN_PRIMARYHEADER 54
-/* late additions */
-#define FUN_NROWS 55
-#define FUN_THEADER 56
-#define FUN_VCOLS 57
-#define FUN_VFMT 58
-#define FUN_ROW 59
-#define FUN_DIMS 60
-#define FUN_SECT_DIMS 61
-
-#endif /* __funtools.h */
-
diff --git a/funtools/funtools.pc.in b/funtools/funtools.pc.in
deleted file mode 100644
index de47d9b..0000000
--- a/funtools/funtools.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: @PACKAGE_NAME@
-Description: minimal buy-in FITS tools
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lfuntools @EXTRA_LIBS@ -lm
-Cflags: -I${includedir}
diff --git a/funtools/funtoolsP.h b/funtools/funtoolsP.h
deleted file mode 100644
index 14953ea..0000000
--- a/funtools/funtoolsP.h
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * funtools.h
- *
- */
-
-#ifndef __funtoolsP_h
-#define __funtoolsP_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <stdio.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-#include <sys/types.h>
-#include "prsetup.h"
-#define USE_XFILEIO 1
-#include "fitsy.h"
-#undef USE_XFILEIO
-#include "wcs.h"
-#include "filter.h"
-#include "file.h"
-#include "swap.h"
-#include "word.h"
-#include "parse.h"
-#include "xalloc.h"
-#include "mkrtemp.h"
-#include "NaN.h"
-#include "xlaunch.h"
-
-#ifndef MAXINT
-#define MAXINT 2147483647
-#endif
-#ifndef MININT
-#define MININT (-MAXINT - 1)
-#endif
-#ifndef MAXDBL
-#define MAXDBL 1.7976931348623157E+308
-#endif
-#ifndef MINDBL
-#define MINDBL (-MAXDBL)
-#endif
-
-/* blocking types */
-#define FUN_SUM 1
-#define FUN_AVG 2
-
-/* merge types */
-#define MERGE_UPDATE 1
-#define MERGE_REPLACE 2
-#define MERGE_APPEND 4
-
-/* special "region" column info */
-#define COL_REGION_NAME "$REGION"
-#define COL_REGION_ONAME "REGION"
-#define COL_REGION_ID -1
-#define COL_NUM_NAME "$N"
-#define COL_NUM_ONAME "N"
-#define COL_NUM_ID -2
-#define COL_UNKNOWN_ID -100
-
-/* image data types */
-#define TY_CHAR 1
-#define TY_USHORT -2
-#define TY_SHORT 2
-#define TY_INT 4
-#define TY_LONG 8
-#define TY_FLOAT -4
-#define TY_DOUBLE -8
-
-/* list types for multi-file list support */
-#define LIST_NONE 0
-#define LIST_FILEORDER 1
-#define LIST_SORT 2
-#define LIST_TRYSORT 3
-#define LIST_UNSORT 4
-
-/* values for scaled flag */
-#define FUN_SCALE_EXISTS 1
-#define FUN_SCALE_APPLIED 2
-
-/* for a table, do we have an array of structs or a struct of arrays? */
-#define FUN_ORG_AOS 1
-#define FUN_ORG_SOA 2
-
-/* the usual */
-#ifndef DEFAULT_TMPDIR
-#define DEFAULT_TMPDIR "/tmp"
-#endif
-
-/* max number of ifun links to a single ifun struct */
-#define FUN_MAXBFUN 1024
-
-/* max number of columns in a file */
-#define FUN_MAXCOL 1000
-
-/* max buffer size when allocating memory to read rows */
-#define FUN_MAXBUFSIZE 5000000
-
-/* validation */
-#define FUN_MAGIC 14285
-#define FUN_VALID(fun) (fun && (*(short *)fun == FUN_MAGIC))
-
-/* save buffer for reading multiple input files from one FunOpen() */
-typedef struct savebufstruct{
- struct savebufstruct *next;
- int type;
- int nrow;
- char *ebuf;
- unsigned char *rbuf;
-} *SaveBuf, SaveBufRec;
-
-/* columns record */
-typedef struct funcolrec {
- char *name;
- int order;
- int type;
- int from;
- int ofrom;
- int mode;
- int n;
- int offset;
- int width;
- int tcol;
- int tindex;
- int poff;
- double tlmin;
- double tlmax;
- double binsiz;
- int doblank; /* do we have a BLANK value? */
- int tblank; /* blank value */
- int scaled; /* valid bscale, bzero values exist */
- double tscale; /* bscale value */
- double tzero; /* bzero value */
- char *tunit;
- char *tctyp;
- char *tcrvl;
- char *tcdlt;
- char *tcrpx;
- char *tcrot;
- char *vla;
-} *FunCol, FunColRec;
-
-/*
- *
- *
- * funtools record structure
- *
- */
-typedef struct funrec {
- /* magic MUST be first */
- short magic; /* magic number identifying this as fun */
- /* top level file info */
- char *fname; /* file name */
- char *mode; /* open mode */
- int type; /* file type -- see above */
- int bitpix; /* FITS bitpix defines data type */
- double min1, max1; /* x limits for whole image or table */
- double min2, max2; /* y limits for whole image or table */
- double binsiz1, binsiz2; /* binsize for tables */
- int dims; /* number of image dimensions */
- int dim1, dim2; /* image dimensions */
- int endian; /* 0=little, 1=big */
- char *filter; /* filter info from bracket spec */
- FITSHead header; /* underlying fitsy handle */
- FITSHead theader; /* temp fitsy handle */
- FITSHead primary; /* fitsy handle for *output* of primary */
- GIO gio; /* I/O handle */
- struct WorldCoor *wcs; /* WCS info -- converted to image */
- struct WorldCoor *wcs0; /* WCS info -- unconverted to image */
- char *activate; /* activation flag */
- off_t datastart; /* starting position in file for data */
- /* param-specific info */
- int doprim; /* write to primary header */
- int doraw; /* get raw value */
- /* image-specific info */
- off_t curpos; /* current position into image */
- int primio; /* flag that the primary header was written */
- int dtype; /* type of data -- see fits.h */
- int dlen; /* length of data buffer */
- int dpad; /* length of data padding */
- int doblank; /* do we have a BLANK value? */
- int blank; /* blank value */
- int scaled; /* valid bscale, bzero values exist */
- double bscale; /* bscale value */
- double bzero; /* bzero value */
- /* table-specific info */
- char *bincols; /* binning columns string */
- int bin[3]; /* pointers to column offsets for binning */
- int vbin; /* column offset for val column when binning */
- int vop; /* operator to apply to vcol binning */
- int overflow; /* how many times we overflowed when binning */
- int ncol; /* current nuber of selected columns */
- int rowsize; /* size in bytes of selected column records */
- int maxbufsize; /* max size of buffer holding columns */
- int transparent; /* is mask transparent? */
- int org; /* array of structs or struct of arrays? */
- int idx; /* should we use filter index if found? */
- FunCol *cols; /* selected columns */
- off_t headpos; /* position in file for header start */
- /* array/table specific info */
- int total; /* number of rows in input table */
- int left; /* number of rows left to process in table */
- int io; /* count of number of putrows */
- int skip; /* bytes to skip (for arrays) */
- off_t bytes; /* count of bytes output via putrows */
- /* text file info */
- int nparser; /* number of parsers */
- Parse *parsers; /* array of parsers */
- /* raw row data buffer */
- int rawsize; /* size in bytes of one (input) table row */
- int rawbufsize; /* size in bytes of evbuf holding raw rows */
- unsigned char *rawbuf; /* raw row buffer */
- int dofilt; /* whether to run events through the filter */
- Filter filt; /* filter handle */
- int nmask; /* number of image masks */
- FilterMask masks; /* image masks */
- /* binning/section info */
- int x0, x1, y0, y1, block, btype;
- int odims;
- int odim1, odim2;
- int obitpix, odtype;
- /* input/output info */
- /* whether we convert data when moving from file to native */
- int iconvert, oconvert;
- /* input fun struct that we used to open */
- struct funrec *ifun;
- /* back-links to structs which use this struct as a reference */
- struct funrec *bfun[FUN_MAXBFUN];
- /* flag that we are copying all extensions from input */
- int icopy;
- /* whether we merge back into raw input data */
- int merge;
- /* operations performed on this handle */
- int ops;
- /* list support */
- int ltype; /* see LIST_XXX above */
- int lmem; /* amount of memory for saved buffers */
- int ifd; /* ifd of this gio for select() */
- struct funrec *head; /* list head, where "global" info resides */
- struct funrec *current; /* currently active member: stored in head */
- struct funrec *next; /* next member in linked list */
- SaveBuf save; /* linked list of save buffers */
- FILE *lefp; /* temp file for saved overflow (user data) */
- FILE *lrfp; /* temp file for saved overflow (raw data) */
- /* view support */
- char *view; /* original view */
- char *vcols; /* view columns */
- char *vfmt; /* view format */
-} *Fun, FunRec;
-
-#define FUNTOOLS_PRIVATE 1
-
-_PRbeg
-
-/* funopen.c */
-Fun _FunFITSOpen _PRx((Fun ifun, char *fname, char *mode));
-
-/* funim.c */
-void *_FunImageMask _PRx((Fun fun, void *buf, int rstart, int rstop,
- FilterMask masks, int nmask, char *mode));
-int _FunImagePutHeader _PRx((Fun fun, int dim1, int dim2, int bitpix));
-
-/* funtab.c */
-void *_FunRead _PRx((Fun fun, char *buf, size_t size, size_t get, size_t *got));
-void _FunSaveNaxis2 _PRx((Fun fun));
-int _FunFixNaxis2 _PRx((Fun fun));
-int _FunTablePutHeader _PRx((Fun fun));
-
-/* funcol.c */
-void _FunColumnHeader _PRx((Fun fun, FunCol *cols, int ncol));
-void _FunColumnFree _PRx((Fun fun));
-
-/* funcopy.c */
-void _FunCopyBinDelete _PRx((FITSHead header, int n));
-int _FunCopy2ImageHeader _PRx((Fun from, Fun to));
-
-/* funutils.c */
-int _FunPrimaryExtension _PRx((Fun fun));
-void _FunParseSection _PRx((Fun fun, char *section,
- int *min1, int *max1, int *min2, int *max2,
- int *block, int *btype, char *tail, int maxlen));
-int _FunColumnDims _PRx((char *s, int type, double *tlmin, double *tlmax,
- double *binsiz, int *dims,
- double *tscale, double *tzero, int *scaled));
-void _FunColumnType _PRx((char *s, int *type, int *n,
- double *tlmin, double *tlmax,
- double *binsiz, int *dims,
- double *tscale, double *tzero, int *scaled,
- int *ptype, int *poff));
-int _FunFile _PRx((char *lbuf, char *tbuf, int len, int *lptr));
-void * _FunSwap _PRx((void *obuf, void *ibuf, int width, int type));
-
-/* funtext.c */
-Fun FunTextOpen _PRx((char *fname, char *mode, char *iline, GIO ifd));
-int FunTextParam _PRx((char *pdelims, char *lbuf,
- char *kbuf, char *vbuf, char *cbuf, int maxlen));
-void FunTextParamHeader _PRx((FITSHead theader, char *lbuf,
- char *key, char *val, char *com, int pgot));
-
-/* funopenp.c */
-Fun _FunNew _PRx((void));
-int _FunSpecialFile _PRx((char *fname, char *type,
- char *name, char *tail, char *extn, int mlen));
-int _FunRowNum _PRx((Fun fun, char *tail, char *env));
-int _FunTableBinCols _PRx((Fun fun, char *tail, char *env));
-int _FunTableValCol _PRx((Fun fun, char *tail, char *env));
-FITSHead _FunRawEvHeader _PRx((Fun fun,
- char *iname, char *iext, char *eventdef));
-off_t _FunImageSkip _PRx((Fun fun, char *tail));
-Fun _FunValid _PRx((Fun fun));
-void _FunFree _PRx((Fun fun, int flag));
-int _FunImageSize _PRx((Fun fun));
-int _FunMaxBufSize _PRx((Fun fun, char *tail));
-int _FunOpenCommon _PRx((Fun fun));
-
-/* funvu.c */
-int FunView _PRx((Fun fun, char *view, char *vmode, char *fname, int fmax));
-
-_PRend
-
-#include "funtools.h"
-
-#endif /* __funtoolsP.h */
diff --git a/funtools/funtools_ds9.tmpl b/funtools/funtools_ds9.tmpl
deleted file mode 100644
index 98e8ff5..0000000
--- a/funtools/funtools_ds9.tmpl
+++ /dev/null
@@ -1,143 +0,0 @@
-#
-# Analysis command descriptions:
-# menu label/description
-# file templates for this command (* for all files)
-# "menu" (add to menu) |"bind" (bind to key)
-# analysis command line
-#
-
-hmenu Funtools
-
-# 1D histogram params for a table
-param thist
-column entry "Enter column name to histogram" pi "(histo)"
-bins entry "Enter [min:max:]bins" 0 "('0' for default number of bins)"
-bwidth checkbox "Use bin width instead of number of bins?" 0
-norm checkbox "Normalize by bin size?" 0
-end
-
-# 1D histogram params for an image
-param ihist
-bins entry "Enter [min:max:]bins" 0 "('0' for default number of bins)"
-end
-
-# Light Curve params
-param ltc
-bins entry "Enter [min:max:]bins" 0 "('0' for default number of bins)"
-bwidth checkbox "Use bin width instead of number of bins?" 0
-norm checkbox "Normalize by time?" 0
-end
-
-# funcen
-param funcen
-niter entry "Number of iterations" 5
-tol entry "Pixel tolerance distance" 1
-disp checkbox "Display refined region(s)?" 1
-ftype checkbox "Use image filtering?" 0 "(default: event filter)"
-end
-
-help Funtools Overview
-
-Funtools Tasks in DS9
-
-The tasks in this section of the Analysis menu utilize the Funtools
-programs 'funcnts', 'funhist', and 'funcen':
-
-1. Radial Profile Plot: run funcnts and pass results through funcnts.plot.
-Both source and background regions can be specified.
-
-2. Histogram Plot: run funhist on any column of a binary table and
-pass results through funhist.plot
-
-3. Light Curve Plot: run funhist on 'time' column of a binary table
-and pass results through funhist.plot
-
-4. Energy Spectrum Plot: run funhist on 'pi' column of a binary table
-and pass results through funhist.plot
-
-5. Counts in Regions: run funcnts and display textual output.
-Both source and background regions can be specified.
-
-6. Refine Positions for Binary Tables: run funcen (binary tables only)
-and display textual output. The input region(s) can be replaced by the
-refined regions.
-
-7. Column Histogram: run funhist on any column of a binary table and
-display textual output.
-
-8. Image Histogram: run funhist on image data and display textual output.
-
-All of these tasks work off the original disk-based FITS file. The
-funcnts-based tasks (radial profile, counts in regions) present their
-results using WCS units, if the appropriate info is present in the
-FITS header.
-
-For situations where a disk file is not available (e.g., image data
-generated by a program and sent to DS9's 'fits' XPA access point),
-alternate versions of the radial profile and counts in regions tasks
-are offered that work from DS9's internal image data. In these two
-cases, results are presented in pixels. Aside from the units, the
-results should be identical to the file-based results.
-
-For more sophisticated analysis, please consider using the underlying
-Funtools tasks directly. These are documented at:
-
-http://hea-www.harvard.edu/saord/funtools/programs.html
-
-endhelp
-
-Radial Profile Plot (annulus regions; options: none)
-*
-menu
-PRE funds9 funcnts_plot "$xpa" "$filename" "$regions(source,,)" "$regions(background,,)" POST | $plot(stdin)
-
-Histogram Plot (any column; options: column name, number of bins)
-*
-menu
-$param(thist); PRE funds9 funhist_plot "$xpa" "$filename[$regions]" "$norm $bwidth" "$column" "$bins" POST | $plot(stdin)
-
-Light Curve Plot ("time" column; options: number of bins)
-*
-menu
-$param(ltc); PRE funds9 funhist_plot "$xpa" "$filename[$regions]" "$norm $bwidth" time "$bins" POST | $plot(stdin)
-
-Energy Spectrum Plot ("pi" column; options: none)
-*
-menu
-PRE funds9 funhist_plot "$xpa" "$filename[$regions]" "0 0" "pi" "$bins" POST | $plot(stdin)
-
-Counts in Regions (any regions; options: none)
-*
-menu
-PRE funds9 funcnts "$xpa" "$filename" "$regions(source,,)" "$regions(background,,)" POST | $text
-
-Refine Positions for Binary Tables (options: niter, tol, display, filtertype)
-*
-menu
-$param(funcen); PRE funds9 funcen "$xpa" "$filename" "$regions(source,,)" $niter $tol $disp $ftype POST | $text
-
-Column Histogram (any column; options: colname, <min:max:>bins)
-*
-menu
-$param(thist); PRE funds9 funhist "$xpa" "$filename[$regions]" "$norm $bwidth" "$column" "$bins" POST | $text
-
-Image Histogram (options: <min:max:>bins)
-*
-menu
-$param(ihist); $data | PRE funhist "stdin[$regions]" xy "$bins" POST | $text
-
----
-
-Radial Profile Plot in Pixels using DS9's Internal Image Data (annulus regions)
-*
-menu
-$data | PRE funcnts -rpG stdin "$regions(source,,)" "$regions(background,,)" | funcnts.plot -file "$filename" ds9 POST | $plot(stdin)
-
-Counts in Regions in Pixels using DS9's Internal Image Data (any regions)
-*
-menu
-$data | PRE funcnts -rp stdin "$regions(source,,)" "$regions(background,,)" POST | $text
-
----
-
-end
diff --git a/funtools/funutil.c b/funtools/funutil.c
deleted file mode 100644
index a0fedd9..0000000
--- a/funtools/funutil.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-#define SLEN 32
-
-/*
- *
- * _FunKeyword -- look for a keyword=value string, or an environment variable
- *
- */
-#ifdef ANSI_FUNC
-int _FunKeyword(char *buf, char *key, char *env, char *vbuf, int vlen)
-#else
-int _FunKeyword(buf, key, env, vbuf, vlen)
- char *buf;
- char *key;
- char *env;
- char *vbuf;
- int vlen;
-#endif
-{
- char *eptr;
- /* look for the keyword in the input string */
- if( keyword(buf, key, vbuf, vlen) )
- return 1;
- else{
- /* look for an environment variable, if necessary */
- if( env && (eptr = (char *)getenv(env)) ){
- strncpy(vbuf, eptr, vlen);
- return 1;
- }
- else
- return 0;
- }
-}
-
-/*
- *
- * _FunParseSection -- parse section information
- * The possibilities are:
- *
- * name[xy0:xy1,block]
- * name[x0:x1,y0:y1,block]
- * name[x0:x1,*,block]
- * name[*,y0:y1,block]
- * name[*,block]
- *
- * where the min and max values can be ints or "*" for default. A single
- * "*" can be used instead of val:val, as shown.
- *
- * name[dim@cen1@cen2,block]
- * name[dim1@cen1,dim2@cen2,block]
- *
- * The values for dim, dim1, dim2, cen1, cen2 must be specified or else
- * the expression does not make sense!
- *
- * In all cases, block is optional and defaults to 1. An 's' or 'a' can be
- * appended to signify "sum" or "average" blocking
- *
- *
- */
-#ifdef ANSI_FUNC
-void
-_FunParseSection(Fun fun, char *section,
- int *x0, int *x1, int *y0, int *y1,
- int *block, int *btype, char *tail, int maxlen)
-#else
-void _FunParseSection(fun, section, x0, x1, y0, y1, block, btype, tail, maxlen)
- Fun fun;
- char *section;
- int *x0;
- int *x1;
- int *y0;
- int *y1;
- int *block;
- int *btype;
- char *tail;
- int maxlen;
-#endif
-{
- char *f;
- char *tbuf;
- char *s;
- char s1[SLEN], s2[SLEN], s3[SLEN], s4[SLEN], s5[SLEN];
- int i;
- int n;
- int got;
- int len;
- int itype;
- int type1, type2;
- double dim1=0.0, dim2=0.0;
- double tx0, tx1, ty0, ty1;
- double t0, t1;
- double cen1=0.0, cen2=0.0;
- double nan;
-
- /* start out impossible */
- *x0 = *y0 = MININT;
- *x1 = *y1 = MAXINT;
- *block = 1;
- *btype = FUN_SUM;
- /* 0 means section, 1 means dim@cen */
- itype = 0;
- /* get NaN value */
- nan = getnand();
- tx0 = tx1 = ty0 = ty1 = nan;
- /* flag no conversion */
- n = 0;
-
- /* make sure we have something to work with */
- if( (section == NULL) || (*section == '\0') )
- return;
-
- /* basic work buffers */
- tbuf = (char *)xmalloc(strlen(section)+1);
-
- /* this will be our pointer into the section buffer */
- f = section;
-
- /* maxlen generally is 1 more than we can handle */
- maxlen--;
-
- /* skip past the open bracket, but save it in the tail */
- if( *f == '[' ){
- f++;
- strcpy(tbuf, "[");
- }
-
- /* look for different ways of specifying the section -- order counts! */
- if(sscanf(f, "%[-0-9.*] : %[-0-9.*] , %[-0-9.*] : %[-0-9.*] , %[0-9as]%n",
- s1, s2, s3, s4, s5, &n) == 5){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- tx0 = (*s1 == '*') ? nan : atof(s1);
- tx1 = (*s2 == '*') ? nan : atof(s2);
- ty0 = (*s3 == '*') ? nan : atof(s3);
- ty1 = (*s4 == '*') ? nan : atof(s4);
- *block = MAX(1, strtol(s5, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- }
- else if(sscanf(f, "%[-0-9.*] : %[-0-9.*] , %[-0-9.*] : %[-0-9.*]%n",
- s1, s2, s3, s4, &n) == 4){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- tx0 = (*s1 == '*') ? nan : atof(s1);
- tx1 = (*s2 == '*') ? nan : atof(s2);
- ty0 = (*s3 == '*') ? nan : atof(s3);
- ty1 = (*s4 == '*') ? nan : atof(s4);
- f += n;
- }
- else if(sscanf(f, "%[-0-9.*] : %[-0-9.*] , %[*] , %[0-9as]%n",
- s1, s2, s3, s4, &n) == 4){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- tx0 = (*s1 == '*') ? nan : atof(s1);
- tx1 = (*s2 == '*') ? nan : atof(s2);
- *block = MAX(1, strtol(s4, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- }
- else if(sscanf(f, "%[-0-9.*] : %[-0-9.*] , %[*]%n",
- s1, s2, s3, &n) == 3){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- tx0 = (*s1 == '*') ? nan : atof(s1);
- tx1 = (*s2 == '*') ? nan : atof(s2);
- f += n;
- }
- else if(sscanf(f, "%[*] , %[-0-9.*] : %[-0-9.*] , %[0-9as]%n",
- s1, s2, s3, s4, &n) == 4){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- ty0 = (*s3 == '*') ? nan : atof(s2);
- ty1 = (*s4 == '*') ? nan : atof(s3);
- *block = MAX(1, strtol(s4, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- }
- else if(sscanf(f, "%[*] , %[-0-9.*] : %[-0-9.*]%n",
- s1, s2, s3, &n) == 3){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- ty0 = (*s3 == '*') ? nan : atof(s3);
- ty1 = (*s4 == '*') ? nan : atof(s4);
- f += n;
- }
- else if(sscanf(f, "%[-0-9.*] : %[-0-9.*] , %[0-9as]%n",
- s1, s2, s3, &n) == 3){
- tx0 = (*s1 == '*') ? nan : atof(s1);
- tx1 = (*s2 == '*') ? nan : atof(s2);
- ty0 = tx0;
- ty1 = tx1;
- *block = MAX(1, strtol(s3, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- }
- else if(sscanf(f, "%[-0-9.*] : %[-0-9.*]%n",
- s1, s2, &n) == 2){
- tx0 = (*s1 == '*') ? nan : atof(s1);
- tx1 = (*s2 == '*') ? nan : atof(s2);
- ty0 = tx0;
- ty1 = tx1;
- f += n;
- }
- else if(sscanf(f, "%[*] , %[*] , %[0-9as]%n",
- s1, s2, s3, &n) == 3){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- *block = MAX(1, strtol(s3, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- }
- else if(sscanf(f, "%[*] , %[0-9as]%n",
- s1, s2, &n) == 2){
- *block = MAX(1, strtol(s2, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- }
- else if(sscanf(f, "%[*] , %[*]%n",
- s1, s2, &n) == 2){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- f += n;
- }
-#ifdef BREAKS_STRING_FILTERING
- else if(sscanf(f, "%[*]%n",
- s1, &n) == 1){
- f += n;
- }
-#endif
-
- /* process dimension@center specifications */
- else if(sscanf(f, "%[0-9.*] @ %[-0-9.*] , %[0-9.*] @ %[-0-9.*] , %[0-9as]%n",
- s1, s2, s3, s4, s5, &n) == 5){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- dim1 = atof(s1);
- cen1 = atof(s2);
- dim2 = atof(s3);
- cen2 = atof(s4);
- *block = MAX(1, strtol(s5, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- itype++;
- }
- else if(sscanf(f, "%[0-9.*] @ %[-0-9.*] , %[0-9.*] @ %[-0-9.*]%n",
- s1, s2, s3, s4, &n) == 4){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify a 2D section with a 1D image\n");
- }
- dim1 = atof(s1);
- cen1 = atof(s2);
- dim2 = atof(s3);
- cen2 = atof(s4);
- f += n;
- itype++;
- }
- else if(sscanf(f, "%[0-9.*] @ %[-0-9.*] @ %[-0-9.*] , %[0-9as]%n",
- s1, s2, s3, s4, &n) == 4){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify 2D section with a 1D image\n");
- }
- dim1 = atof(s1);
- cen1 = atof(s2);
- dim2 = dim1;
- cen2 = atof(s3);
- *block = MAX(1, strtol(s4, &s, 0));
- if( s && *s && (tolower(*s) == 'a') )
- *btype = FUN_AVG;
- f += n;
- itype++;
- }
- else if(sscanf(f, "%[0-9.*] @ %[-0-9.*] @ %[-0-9.*]%n",
- s1, s2, s3, &n) == 3){
- /* sanity check */
- if( fun->dims == 1 ){
- gerror(stderr, "can't specify 2D section with a 1D image\n");
- }
- dim1 = atof(s1);
- cen1 = atof(s2);
- dim2 = dim1;
- cen2 = atof(s3);
- f += n;
- itype++;
- }
- else if(sscanf(f, "%[0-9.*] @ %[-0-9.*]%n",
- s1, s2, &n) == 2){
- dim1 = atof(s1);
- cen1 = atof(s2);
- dim2 = dim1;
- cen2 = cen1;
- f += n;
- itype++;
- }
-
- /* if we are processing dim@center, we need to calculate section values */
- if( itype ){
- tx0 = cen1 - ((dim1+1)/2) + 1;
- ty0 = cen2 - ((dim2+1)/2) + 1;
- /* this method maintains the center and changes the dimensions */
- /* Frank, Eric, and John all prefer this method, so that the user
- gets the center he asked for, even if the image is reduced */
- tx1 = cen1 + (dim1/2);
- ty1 = cen2 + (dim2/2);
- }
-
- /* if we converted, then a 'p' => physical, 'i' => image coords
- (image is the default) -- we need image */
- if( n && (*f == 'p') ){
- f++;
- if( fun ){
- switch(fun->type){
- case FUN_IMAGE:
- if( !isnand(tx0) && !isnand(ty0) ){
- ft_phy2img(fun->header, tx0, ty0, &t0, &t1);
- tx0 = t0;
- ty0 = t1;
- }
- if( !isnand(tx1) && !isnand(ty1) ){
- ft_phy2img(fun->header, tx1, ty1, &t0, &t1);
- tx1 = t0;
- ty1 = t1;
- }
- break;
- case FUN_TABLE:
- case FUN_EVENTS:
- type1 = MAX(0,fun->header->table->col[fun->bin[0]].type);
- type2 = MAX(0,fun->header->table->col[fun->bin[1]].type);
- if( !isnand(tx0) ) tx0 = tlp2i(tx0, fun->min1, fun->binsiz1, type1);
- if( !isnand(tx1) ) tx1 = tlp2i(tx1, fun->min1, fun->binsiz1, type1);
- if( !isnand(ty0) ) ty0 = tlp2i(ty0, fun->min2, fun->binsiz2, type2);
- if( !isnand(ty1) ) ty1 = tlp2i(ty1, fun->min2, fun->binsiz2, type2);
- break;
- case FUN_ARRAY:
- break;
- }
- }
- }
-
- /* now we can integerize and set the output values in image coords */
- if( !isnand(tx0) )
- *x0 = (int)tx0;
- else
- *x0 = -1;
- if( !isnand(tx1) )
- *x1 = (int)tx1;
- else
- *x1 = -1;
- if( !isnand(ty0) )
- *y0 = (int)ty0;
- else
- *y0 = -1;
- if( !isnand(ty1) )
- *y1 = (int)ty1;
- else
- *y1 = -1;
-
- /* at this point, we are processing tail */
- if( *f == ',' )
- f++;
- if( *f != '\0' ){
- strcat(tbuf, f);
-
- }
- strncpy(tail, tbuf, maxlen);
- tail[maxlen] = '\0';
- /* get rid of any empty brackets */
- len = strlen(tail);
- for(i=0; i<len; i++){
- if( (tail[i] == '[') && (i+2 < len) && (tail[i+1] == ']') ){
- strcpy(tbuf, &(tail[i+2]));
- strcpy(&(tail[i]), tbuf);
- }
- }
- /* but don't bother passing back completely null brackets */
- len = strlen(tail);
- for(got=0, i=0; i<len; i++){
- if( (tail[i] != '[') && (tail[i] != ']') && (tail[i] != ' ') ){
- got = 1;
- break;
- }
- }
- if( !got ) *tail = '\0';
-
- /* clean up */
- if( tbuf != NULL )
- xfree(tbuf);
-}
-
-/*
- *
- * FunPrimaryExtension -- write a dummy primary header for a FITS extension
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunPrimaryExtension(Fun fun)
-#else
-int _FunPrimaryExtension(fun)
- Fun fun;
-#endif
-{
- FITSHead header, merge;
-
- /* exit if we already have written the header (or if we have no funtools) */
- if( !_FunValid(fun) || fun->primio || (gtell(fun->gio)>0) )
- return 0;
-
- /* create a temp fitsy header */
- if( !(header = ft_headinit(NULL, 0)) )
- return 0;
-
- /* add the essential cards to indicate a FITS file with extensions */
- ft_headsetl(header, "SIMPLE", 0, 1, "FITS STANDARD", 1);
- ft_headseti(header, "BITPIX", 0, 8, "Binary data", 1);
- ft_headseti(header, "NAXIS", 0, 0, "No image array present", 1);
- ft_headsetl(header, "EXTEND", 0, 1, "Standard extensions might follow", 1);
- ft_syncdata(header);
-
- /* merge these new params in with any we added earlier using FunParamPut */
- if( fun->primary ){
- merge = ft_headmerge(header, fun->primary, 0);
- ft_syncdata(merge);
- ft_headwrite(fun->gio, merge);
- ft_headfree(merge, 1);
- }
- /* should not happen, but ... */
- else{
- ft_headwrite(fun->gio, header);
- }
-
- /* free up space */
- ft_headfree(header, 1);
-
- /* wrote the primary header */
- fun->primio++;
-
- return 1;
-}
-
-/*
- *
- * _FunColumnDims -- read a string that details the tlmin, tlmax, binsiz, and
- * tscale, tzero for a column; string is of the form:
- *
- * [:tlmin[:tmlax[:binsiz]]][;tscal:tzero]
- *
- * If only one arg is given, its assumed to be the overall image dimension,
- * and tlmin, tlmax defaults are calculated based on data type.
- *
- * We allow binsiz to be 0 as a flag that it was not set. The software that
- * uses binsize (filter/tl.c) will use 1.0 instead of 0.0.
- *
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunColumnDims(char *s, int type, double *tlmin, double *tlmax,
- double *binsiz, int *dims,
- double *tscale, double *tzero, int *scaled)
-#else
-int _FunColumnDims(s, type, tlmin, tlmax, binsiz, dims, tscale, tzero, scaled)
- char *s;
- int type;
- double *tlmin;
- double *tlmax;
- double *binsiz;
- int *dims;
- double *tscale;
- double *tzero;
- int *scaled;
-#endif
-{
- int i, got, got2;
- char *v;
- char vbuf[SZ_LINE];
- double val[3];
-
- /* intiialize */
- *tlmin = 0.0;
- *tlmax = 0.0;
- *binsiz = 1.0;
- *dims = 0;
- *tscale = 1.0;
- *tzero = 0.0;
- *scaled = 0;
-
- /* make sure we have something to do */
- if( !s || !*s )
- return 0;
-
- /* get image dimensions and bin size */
- for(i=0, got=0; i<3; i++, got++){
- if( *s != ':' )
- break;
- /* skip past ':' */
- s++;
- /* fill buffer with next value */
- *vbuf = '\0';
- for(v=vbuf; *s && (*s != ',') && (*s != ':') && (*s != ';'); )
- *v++ = *s++;
- *v = '\0';
- /* convert string to double */
- val[i] = atof(vbuf);
- }
- switch(got){
- case 0:
- break;
- case 1:
- switch(type){
- case 'B':
- case 'I':
- case 'U':
- case 'J':
- case 'K':
- case 'V':
- *tlmin = 1.0;
- *tlmax = val[0];
- *dims = 1;
- break;
- case 'E':
- case 'D':
- *tlmin = 0.5;
- *tlmax = val[0]+0.5;
- *dims = 1;
- break;
- default:
- *tlmin = 1.0;
- *tlmax = val[0];
- *dims = 1;
- break;
- }
- break;
- case 2:
- *tlmin = val[0];
- *tlmax = val[1];
- *dims = 1;
- break;
- case 3:
- default:
- *tlmin = val[0];
- *tlmax = val[1];
- *binsiz = val[2];
- *dims = 1;
- break;
- }
- /* check for next section: tscale, tzero */
- if( *s == ';' ){
- *s = ':';
- for(i=0, got2=0; i<3; i++, got2++){
- if( *s != ':' )
- break;
- /* skip past ':' */
- s++;
- /* fill buffer with next value */
- *vbuf = '\0';
- for(v=vbuf; *s && (*s != ',') && (*s != ':') && (*s != ';'); )
- *v++ = *s++;
- *v = '\0';
- /* convert string to double */
- val[i] = atof(vbuf);
- }
- switch(got2){
- case 0:
- break;
- case 1:
- *tscale = val[0];
- *tzero = 0.0;
- *scaled = 1;
- break;
- case 2:
- *tscale = val[0];
- *tzero = val[1];
- *scaled = 1;
- break;
- }
- }
- return got;
-}
-
-/*
- *
- * _FunColumnType -- read a string that details the type for a column
- * string is of the form:
- *
- * [@][<n>]<type>[[poff]][:[tlmin[:tmlax[:binsiz]]]]
- *
- * where @ means ptype (pointer type) is true
- *
- */
-#ifdef ANSI_FUNC
-void
-_FunColumnType(char *s, int *type, int *n,
- double *tlmin, double *tlmax, double *binsiz, int *dims,
- double *tscale, double *tzero, int *scaled,
- int *ptype, int *poff)
-#else
-void _FunColumnType(s, type, n, tlmin, tlmax, binsiz, dims,
- tscale, tzero, scaled, ptype, poff)
- char *s;
- int *type;
- int *n;
- double *tlmin;
- double *tlmax;
- double *binsiz;
- int *dims,
- double *tscale;
- double *tzero;
- int *scaled;
- int *ptype;
- int *poff;
-#endif
-{
- int ival;
- int boff=0;
- char *t;
-
- /* initialize values */
- *n = 1;
- *ptype = 0;
- *poff = 0;
- *type = '?';
- *tlmin = 0.0;
- *tlmax = 0.0;
- *binsiz = 1.0;
- *dims = 0;
- *tscale = 1.0;
- *tzero = 0.0;
- *scaled = 0;
-
- /* make sure we have something to do */
- if( !s || !*s )
- return;
-
- /* look for indication that this is a pointer */
- if( *s == '@' ){
- *ptype = COL_PTR;
- s++;
- }
- /* get optional count */
- ival = strtol(s, &t, 10);
- if( s != t ){
- *n = ival;
- s = t;
- }
- /* type character comes next */
- *type = *s;
- if( *type ){
- if( islower(*type) )
- *type = toupper(*type);
- s++;
- }
-
- /* we might have an offset specified as well */
- if( *s == '[' ){
- s++;
- /* 'B' means its a byte offset */
- if( (*s == 'B') || (*s == 'b') ){
- boff = 1;
- s++;
- }
- ival = strtol(s, &t, 10);
- if( s != t ){
- /* negative offset flags byte offset (not great, but ...) */
- if( boff )
- *poff = -ival;
- /* positive offset flags data-type offset */
- else
- *poff = ival;
- s = t;
- }
- if( *s == ']' )
- s++;
- }
-
- /* parse the rest of the string into tlmin, tlmax, binsiz, etc. */
- (void)_FunColumnDims(s, *type, tlmin, tlmax, binsiz, dims,
- tscale, tzero, scaled);
-}
-
-/*
- *
- * _FunFile -- parse next filename from a string
- *
- */
-#ifdef ANSI_FUNC
-int
-_FunFile (char *lbuf, char *tbuf, int len, int *lptr)
-#else
-int _FunFile(lbuf, tbuf, len, lptr)
- char *lbuf;
- char *tbuf;
- int len;
- int *lptr;
-#endif
-{
- int ip;
- int i;
- int bracklev=0;
- int atstart=0;
- char quotes;
-
- /* null out the output string */
- *tbuf = '\0';
-
- /* if no string was specified, just return */
- if( lbuf == NULL )
- return(0);
-
- /* just a more convenient pointer ... */
- ip = *lptr;
-
- /* if we are at the end of string, just return */
- if( lbuf[ip] == '\0' )
- return(0);
-
- /* start of the string can be "list:" for a list of files, else its a
- single file; we'll do the actual check after the whitespace */
- if( ip == 0 )
- atstart=1;
-
- /* skip over white space */
- while( isspace((int)lbuf[ip]) ){
- if( lbuf[ip] == '\0' ){
- *lptr = ip;
- return(0);
- }
- else
- ip++;
- }
-
- /* now check for list, but only at the start */
- if( atstart ){
- if( strncasecmp(&lbuf[ip], "list:", 5) ){
- /* not a list, return full string */
- i = strlen(&lbuf[ip]);
- if( i < len ){
- strncpy(tbuf, &lbuf[ip], i);
- ip += i;
- goto done;
- }
- else{
- ip += i;
- goto error;
- }
- }
- else{
- /* its a list, skip prefix */
- ip += 5;
- /* skip over white space ... again */
- while( isspace((int)lbuf[ip]) ){
- if( lbuf[ip] == '\0' ){
- *lptr = ip;
- return(0);
- }
- else
- ip++;
- }
- }
- }
-
- /* check for an explicit quote */
- quotes = '\0';
- if( lbuf[ip] == '"' ){
- quotes = '"';
- }
- if( lbuf[ip] == '\'' ){
- quotes = '\'';
- }
-
- /* grab next token */
- if( quotes != '\0' ){
- /* bump past quotes */
- ip++;
- /* grab up to next quotes -- but skip escaped quotes */
- for(i=0; lbuf[ip] != '\0'; i++, ip++){
- if( (lbuf[ip] == quotes) && (lbuf[ip-1] != '\\') )
- break;
- else{
- if( i >= len ) goto error;
- tbuf[i] = lbuf[ip];
- }
- }
- }
- else{
- /* grab up to next whitespace */
- i = 0;
-again:
- for(; lbuf[ip] && (!isspace((int)lbuf[ip]) || (bracklev>0)); i++, ip++){
- if( i >= len ) goto error;
- tbuf[i] = lbuf[ip];
- if( lbuf[ip] == '[' )
- bracklev++;
- else if( lbuf[ip] == ']' )
- bracklev--;
- }
- /* skip white space */
- while( lbuf[ip] && isspace((int)lbuf[ip]) )
- ip++;
- /* if the next char is '[', we are not done with this filename */
- if( lbuf[ip] == '[' )
- goto again;
- /* back up so we process this character next time */
- else
- ip--;
- }
-
-done:
- /* bump past delimiter (but not null terminator) */
- if( lbuf[ip] )
- ip++;
-
- /* null terminate */
- tbuf[i] = '\0';
-
- /* got something */
- *lptr = ip;
- return(1);
-
-/* file name is too long */
-error:
- gerror(stderr, "filename is larger than max allowable (%d)\n", len);
- *lptr = ip;
- return(0);
-}
-
diff --git a/funtools/funview.c b/funtools/funview.c
deleted file mode 100644
index a03bad3..0000000
--- a/funtools/funview.c
+++ /dev/null
@@ -1,632 +0,0 @@
-/*
- * Copyright (c) 2005 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-
-/*
- *
- * private routines
- *
- */
-
-/* default data base files */
-#define FUN_VIEWFILE ".funtools.vu"
-#define FUN_VIEWHOME "$HOME/.funtools.vu"
-
-/* default text options for database open */
-#define FUN_VIEWEXT "[1,TEXT(alen=1024)]"
-
-/* default is to allow multiple matches */
-#define FUN_VIEW_MATCH_DEFAULT 1
-
-/* if a list is specified, do we also match templates? */
-#define FUN_VIEW_DOROW_DEFAULT 1
-
-/* types of matches */
-#define MATCH_VIEW 1
-#define MATCH_FILE 2
-#define MATCH_VTMP 4
-#define MATCH_FTMP 8
-
-/* this should match what is in fun_viewopen's alen above */
-#define SZ_VIEW 1024
-
-/* parser characteristics struct */
-typedef struct _rowstruct{
- int type;
- char view[SZ_VIEW];
- char file[SZ_VIEW];
- char fmt[SZ_VIEW];
- char cols[SZ_VIEW];
- char filt[SZ_VIEW];
-} *Row, RowRec;
-
-typedef struct _viewstruct{
- char *vname;
- char *vroot;
- int nlist;
- int maxlist;
- char **vlist;
- Fun ifun;
- Fun vfun;
- int nrow;
- int maxrow;
- Row *rows;
- Row file, filt, cols, fmt;
- Row trow;
-} *View, ViewRec;
-
-#ifdef ANSI_FUNC
-static int
-pathcmp(char *s1, char *s2)
-#else
-static int
-pathcmp(s1, s2)
- char *s1;
- char *s2;
-#endif
-{
- char tbuf1[SZ_LINE];
- char tbuf2[SZ_LINE];
- char tbuf1a[SZ_LINE];
- char tbuf2a[SZ_LINE];
-
- /* resolve pathnames and expand environment variables */
- ExpandEnv(s1, tbuf1, SZ_LINE);
- ExpandEnv(s2, tbuf2, SZ_LINE);
- ResolvePath(tbuf1, tbuf1a, SZ_LINE);
- ResolvePath(tbuf2, tbuf2a, SZ_LINE);
-
- /* now compare strings */
- return strcmp(tbuf1a, tbuf2a);
-}
-
-#ifdef ANSI_FUNC
-static int
-ViewFree(View view)
-#else
-static int ViewFree(view)
- View view;
-#endif
-{
- int i;
-
- /* sanity check */
- if( !view ) return 0;
-
- /* free up resources */
- if( view->vfun ) FunClose(view->vfun);
- if( view->vname ) xfree(view->vname);
- if( view->vroot ) xfree(view->vroot);
- if( view->trow ) xfree(view->trow);
- if( view->rows ){
- for(i=0; i<view->nrow; i++){
- if( view->rows[i] ) xfree(view->rows[i]);
- }
- xfree(view->rows);
- }
- if( view->vlist ){
- for(i=0; i<view->nlist; i++){
- if( view->vlist[i] ) xfree(view->vlist[i]);
- }
- xfree(view->vlist);
- }
- xfree(view);
- return 1;
-}
-
-#ifdef ANSI_FUNC
-static View
-ViewNew(Fun fun, char *vname, char *vptr, char *vlist, char *dbname, int dbmax)
-#else
-static View
-ViewNew(fun, vname, vptr, vlist, dbname, dbmax)
- Fun fun;
- char *vname;
- char *vptr;
- char *vlist;
- char *dbname;
- int dbmax;
-#endif
-{
- int ip=0;
- char *s, *t;
- char *rmode="r";
- char *fmode="rV";
- char *params=NULL;
- char tbuf[SZ_LINE];
- char dtype[SZ_LINE];
- View view=NULL;
-
- /* look for view file in the usual places */
- if( (s=(char *)getenv("FUN_VIEWFILE")) && (t=Access(s, rmode)) ){
- xfree(t);
- goto gotv;
- }
- else if( (t=Access(FUN_VIEWFILE, rmode)) ){
- xfree(t);
- s = FUN_VIEWFILE;
- goto gotv;
- }
- else if( (t=Access(FUN_VIEWHOME, rmode)) ){
- xfree(t);
- s = FUN_VIEWHOME;
- goto gotv;
- }
- else{
- return NULL;
- }
-
-gotv:
- /* allocate the view struct */
- if( !(view=(View)xcalloc(1, sizeof(ViewRec))) ){
- gerror(stderr, "can't allocate view database struct\n");
- return NULL;
- }
- /* allocate temp row */
- if( !(view->trow=(Row)xcalloc(1, sizeof(RowRec))) ){
- gerror(stderr, "can't allocate view temp row struct\n");
- ViewFree(view);
- return NULL;
- }
-
- /* add default text options to the filename, if needed */
- if( strchr(s, '[') ){
- strncpy(tbuf, s, SZ_LINE);
- }
- else{
- snprintf(tbuf, SZ_LINE, "%s%s", s, FUN_VIEWEXT);
- }
-
- /* open the file */
- if( !(view->vfun=FunOpen(tbuf, fmode, NULL)) ){
- gerror(stderr, "can't open view database file: %s\n", s);
- ViewFree(view);
- return NULL;
- }
-
- /* select columns from view database */
- snprintf(dtype, SZ_LINE-1, "%dA", SZ_VIEW);
- FunColumnSelect(view->vfun, sizeof(RowRec), params,
- "view", dtype, rmode, FUN_OFFSET(Row, view),
- "file", dtype, rmode, FUN_OFFSET(Row, file),
- "format", dtype, rmode, FUN_OFFSET(Row, fmt),
- "columns", dtype, rmode, FUN_OFFSET(Row, cols),
- "filter", dtype, rmode, FUN_OFFSET(Row, filt),
- NULL);
-
- /* save original view string */
- view->vname = xstrdup(vname);
-
- /* save view name without any bracket extension */
- view->vroot = xstrdup(vptr);
- if( (s=strchr(view->vroot, '[')) ) *s = '\0';
-
- /* save original input Fun handle */
- view->ifun = fun;
-
- /* save vlist as separate strings */
- if( vlist ){
- newdtable(",");
- while( word(vlist, tbuf, &ip) ){
- if( view->nlist >= view->maxlist ){
- view->maxlist += SZ_VIEW;
- if( view->vlist )
- view->vlist = (char **)xrealloc(view->vlist,
- view->maxlist*sizeof(char **));
- else
- view->vlist = (char **)xmalloc(view->maxlist*sizeof(char **));
- }
- /* add this record to the array of matches */
- view->vlist[view->nlist++] = xstrdup(tbuf);
- }
- freedtable();
- }
-
- /* temp row, in case template is matched as a file => use input file name */
- strncpy(view->trow->file, vptr, SZ_VIEW-1);
- if( (s=strrchr(view->trow->file, '[')) ){
- /* remove extension from file (we'll put it back later, if necessary) */
- *s = '\0';
- }
- /* return name of database used, if necessary */
- if( dbname ){
- FunInfoGet(view->vfun, FUN_FNAME, &s, 0);
- strncpy(dbname, s, dbmax-1);
- }
-
- /* return the good news */
- return view;
-}
-
-#ifdef ANSI_FUNC
-static int
-ViewMatchRow(View view, Row row)
-#else
-static int
-ViewMatchRow(view, row)
- View view;
- Row row;
-#endif
-{
- char *root=NULL;
-
- /* sanity check */
- if( !row || !view->vroot || !*view->vroot ) return 0;
-
- /* root is file without path */
- if( (root=strrchr(row->file, '/')) )
- root++;
- else
- root=row->file;
-
- /* look for various types of match */
- if( *row->view && !strcmp(view->vroot, row->view) )
- row->type |= MATCH_VIEW;
- /* if not a vew, perhaps a view template */
- else if( *row->view && tmatch(view->vroot, row->view) )
- row->type |= MATCH_VTMP;
- /* check for file, with and without path */
- if( (*row->file &&!pathcmp(view->vroot, row->file)) ||
- (root && *root && !strcmp(view->vroot, root)))
- row->type |= MATCH_FILE;
- /* if not a file, perhaps a file template */
- else if( root && *root && tmatch(view->vroot, root) )
- row->type |= MATCH_FTMP;
-
- /* return the results */
- return row->type;
-}
-
-#ifdef ANSI_FUNC
-static int
-ViewSaveRow(View view, Row row)
-#else
-static int
-ViewSaveRow(view, row)
- View view;
- Row row;
-#endif
-{
- /* make sure we have enough space */
- if( view->nrow >= view->maxrow ){
- view->maxrow += SZ_VIEW;
- if( view->rows )
- view->rows = (Row *)xrealloc(view->rows, view->maxrow*sizeof(Row));
- else
- view->rows = (Row *)xmalloc(view->maxrow*sizeof(Row));
- }
- /* add this record to the array of matches */
- view->rows[view->nrow++] = row;
- return view->nrow;
-}
-
-#ifdef ANSI_FUNC
-static int
-ViewMatchList(View view, Row row, int dorow)
-#else
-static int
-ViewMatchList(view, row, dorow)
- View view;
- Row row;
- int dorow;
-#endif
-{
- int i;
-
- /* sanity check */
- if( !row || !view->vlist ) return 0;
-
- /* look though all view strings in the list */
- for(i=0; i<view->nlist; i++){
- /* does list view match row view? */
- if( !strcmp(view->vlist[i], row->view) ){
- row->type |= MATCH_VIEW;
- break;
- }
- }
-
- /* also check row matches, if necessary */
- if( dorow ) ViewMatchRow(view, row);
-
- /* return the results */
- return row->type;
-}
-
-#ifdef ANSI_FUNC
-static int
-ViewProcessMatches(View view, char *fname, int fmax)
-#else
-static int
-ViewProcessMatches(view, fname, fmax)
- View view;
- char *fname;
- int fmax;
-#endif
-{
- int i;
- int nv=0;
- int nf=0;
- int nvt=0;
- int nft=0;
- int fgot=-1;
- int tgot=-1;
- int domulti=FUN_VIEW_MATCH_DEFAULT;
- char *s=NULL;
-
- /* sanity check */
- if( !view ) return 0;
-
- /* do we match a single row or use multiple row to complete the spec? */
- if( (s=getenv("FUN_VIEWMATCH")) ){
- if( !strncmp(s, "m", 1) ){
- domulti = 1;
- }
- else if( !strncmp(s, "s", 1) ){
- domulti = 0;
- }
- }
-
- /* collect separate parts of fname using increasingly general matching */
- if( view->nrow ){
- /* get match counts */
- for(i=0; i<view->nrow; i++){
- if( view->rows[i]->type & MATCH_VIEW )
- nv++;
- if( view->rows[i]->type & MATCH_VTMP )
- nvt++;
- if( view->rows[i]->type & MATCH_FILE )
- nf++;
- if( view->rows[i]->type & MATCH_FTMP )
- nft++;
- }
- /* view matches are the most desirable */
- if( nv ){
- for(i=0; i<view->nrow; i++){
- if( view->rows[i]->type & MATCH_VIEW ){
- /* if we are using a list, we always take the original filename */
- if( view->nlist )
- view->file = view->trow;
- else if( !view->file && *view->rows[i]->file )
- view->file = view->rows[i];
- if( !view->filt && *view->rows[i]->filt )
- view->filt = view->rows[i];
- if( !view->cols && *view->rows[i]->cols )
- view->cols = view->rows[i];
- if( !view->fmt && *view->rows[i]->fmt )
- view->fmt = view->rows[i];
- tgot = i;
- /* we only use one, unless we are running off a list */
- if( !view->nlist ) break;
- }
- }
- }
- /* if no view matches, try file matches */
- else if( nf ){
- for(i=0; i<view->nrow; i++){
- if( view->rows[i]->type & MATCH_FILE ){
- if( !view->file && *view->rows[i]->file )
- view->file = view->rows[i];
- if( !view->filt && *view->rows[i]->filt )
- view->filt = view->rows[i];
- if( !view->cols && *view->rows[i]->cols )
- view->cols = view->rows[i];
- if( !view->fmt && *view->rows[i]->fmt )
- view->fmt = view->rows[i];
- fgot = i;
- break;
- }
- }
- }
- /* if we got a match, only do templates if multiple matches is true */
- if( (tgot==-1 && fgot==-1) || domulti ){
- for(i=0; i<view->nrow; i++){
- if( tgot == i ) continue;
- if( view->rows[i]->type & MATCH_VTMP ){
- /* use the input file name in this case */
- if( !view->file && *view->rows[i]->file )
- view->file = view->trow;
- if( !view->filt && *view->rows[i]->filt )
- view->filt = view->rows[i];
- if( !view->cols && *view->rows[i]->cols )
- view->cols = view->rows[i];
- if( !view->fmt && *view->rows[i]->fmt )
- view->fmt = view->rows[i];
- /* mark use of view template so we don't do file templates */
- tgot = i;
- /* stop at one if not domulti */
- if( !domulti ) break;
- }
- }
- }
- /* if we got a match, only do templates if multiple matches is true */
- if( (tgot==-1 && fgot==-1) || domulti ){
- for(i=0; i<view->nrow; i++){
- if( fgot == i ) continue;
- if( view->rows[i]->type & MATCH_FTMP ){
- /* use the input file name in this case */
- if( !view->file && *view->rows[i]->file )
- view->file = view->trow;
- if( !view->filt && *view->rows[i]->filt )
- view->filt = view->rows[i];
- if( !view->cols && *view->rows[i]->cols )
- view->cols = view->rows[i];
- if( !view->fmt && *view->rows[i]->fmt )
- view->fmt = view->rows[i];
- /* stop at one if not domulti */
- if( !domulti ) break;
- }
- }
- }
-
- /* now we can make up the fname from the pieces we have found */
- if( view->file && *view->file->file ){
- /* see if original input had an extension */
- if( (s=strchr(view->vname, '[')) ){
- /* if we can guess that original was a filter, don't add new one */
- if( strstr(s,"ann") ||
- strstr(s,"box") ||
- strstr(s,"cir") ||
- strstr(s,"ell") ||
- strstr(s,"lin") ||
- strstr(s,"pan") ||
- strstr(s,"pie") ||
- strstr(s,"poi") ||
- strstr(s,"qtp") ||
- strstr(s,"pol") ||
- strstr(s,"fie") ||
- strstr(s,"bpa") ||
- strstr(s,"cpa") ||
- strstr(s,"epa") ||
- /* guess at some sort of filter operation */
- strpbrk(s, "!&|~=<>+-/%^") ){
- snprintf(fname, fmax, "%s%s", view->file->file, s);
- }
- /* otherwise add original + new filter, if we have one */
- else{
- if( view->filt && *view->filt->filt ){
- snprintf(fname, fmax, "%s%s[%s]",
- view->file->file, s, view->filt->filt);
- }
- /* just add original */
- else{
- snprintf(fname, fmax, "%s%s", view->file->file, s);
- }
- }
- }
- /* no original filter */
- else{
- /* otherwise new filter, if we have one */
- if( view->filt && *view->filt->filt ){
- snprintf(fname, fmax, "%s[%s]", view->file->file, view->filt->filt);
- }
- /* just the file name */
- else{
- snprintf(fname, fmax, "%s", view->file->file);
- }
- }
- /* save other view info */
- if( view->ifun ){
- if( view->cols && *view->cols->cols )
- view->ifun->vcols = xstrdup(view->cols->cols);
- if( view->fmt && *view->fmt->fmt )
- view->ifun->vfmt = xstrdup(view->fmt->fmt);
- }
- }
- return 1;
- }
- else{
- return 0;
- }
-}
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *
- * FunView -- translate view into a filename + view params
- *
- */
-#ifdef ANSI_FUNC
-int
-FunView(Fun fun, char *vname, char *vmode, char *fname, int fmax)
-#else
-int
-FunView(fun, vname, vmode, fname, fmax)
- Fun fun;
- char *vname;
- char *vmode;
- char *fname;
- int fmax;
-#endif
-{
- int nev=0;
- int got=0;
- int dorow=FUN_VIEW_DOROW_DEFAULT;
- char *s=NULL;
- char *vptr=NULL;
- char vlist[SZ_LINE];
- Row row=NULL;
- View view=NULL;
-
- /* sanity checks */
- if( !fname || !fmax ) return 0;
- *fname = '\0';
- if( !vname || !*vname ) return 0;
-
- /* assume we don't have a view */
- strncpy(fname, vname, fmax-1);
- fname[fmax-1] = '\0';
-
- /* sanity check -- this prevents infinite recusion below */
- if( !fun || (vmode && strchr(vmode, 'V')) ) return 0;
-
- /* see if a view ("v:...") was specified */
- memset(vlist, 0, SZ_LINE);
- vptr = vname;
- if( !*vptr || (*vptr != 'v') ) return 0;
- vptr++;
- if( !*vptr || (*vptr != ':') ) return 0;
- vptr++;
- if( !*vptr ) return 0;
- /* v::vid1,vid2...:file... */
- if( (*vptr == ':') || (*vptr == '+') || (*vptr == '-') ){
- if( *vptr == '+' ) dorow = 1;
- else if( *vptr == '-' ) dorow = 0;
- vptr++;
- /* must have a closing ':' */
- if( !*vptr || !(s = strchr(vptr, ':')) ) return 0;
- /* copy the list */
- strncpy(vlist, vptr, MIN(s-vptr,SZ_LINE-1));
- /* bump past the ':' */
- vptr = s+1;
- }
- if( !*vptr ) return 0;
-
- /* now assume we don't match and want to use the supplied filename */
- strncpy(fname, vptr, fmax-1);
- fname[fmax-1] = '\0';
-
- /* open view file */
- if( !(view=ViewNew(fun, vname, vptr, vlist, NULL, 0)) ) goto done;
-
- /* read rows from view database */
- while( (row=FunTableRowGet(view->vfun, NULL, 1, NULL, &nev)) && nev ){
- /* look for a match */
- if( view->vlist ){
- if( ViewMatchList(view, row, dorow) ){
- ViewSaveRow(view, row);
- /* clear row */
- row = NULL;
- }
- }
- else{
- if( ViewMatchRow(view, row) ){
- ViewSaveRow(view, row);
- /* clear row */
- row = NULL;
- }
- }
- /* free record if it was not saved (and cleared) */
- if( row ){
- xfree(row);
- row = NULL;
- }
- }
-
- /* process view information and generate a new file name */
- got = ViewProcessMatches(view, fname, fmax);
-
-done:
- /* clean up */
- ViewFree(view);
- if( row ) xfree(row);
-
- /* return the news */
- return got;
-}
diff --git a/funtools/funwcs.c b/funtools/funwcs.c
deleted file mode 100644
index 02ae97b..0000000
--- a/funtools/funwcs.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <funtoolsP.h>
-#include <wcs.h>
-
-/*
- *
- * _FunWCS -- get a WCS struct, transforming table column info if required
- * If doimage is true, the physical tcrval values is transformed into image
- * crval, otherwise, its just transcribed. The former is used with images,
- * the latter is used with events.
- *
- */
-#ifdef ANSI_FUNC
-struct WorldCoor *
-_FunWCS(Fun fun, int doimage)
-#else
-struct WorldCoor *_FunWCS(fun, doimage)
- Fun fun;
- int doimage;
-#endif
-{
- int i, j;
- int ival;
- int simple=1;
- double dval;
- double binsiz;
- char *s;
- FITSHead iheader;
- FITSHead oheader;
- FITSCard card;
- struct WorldCoor *wcs;
-
- /* make sure we have something to process */
- if( !_FunValid(fun) )
- return NULL;
-
- /* get type and header info */
- FunInfoGet(fun, FUN_HEADER, &iheader, 0);
-
- /* make sure we have something to process */
- if( !iheader )
- return NULL;
-
- /* process image -- just call wcs routines */
- if( iheader->image ){
- /* init new wcs */
- if( hlength(ft_cards(iheader), 0) < 0 ) return NULL;
- wcs = wcsinit(ft_cards(iheader));
- return wcs;
- }
- /* for tables, we can init wcs only the specified columns */
- else if( iheader->table ){
- /* make sure we have valid binning columns */
- if( (fun->bin[0]<0) || (fun->bin[1]<0) )
- return NULL;
-
- /* make a copy of the header */
- oheader = ft_headcopy(iheader);
- /* make sure this is a primary FITS file */
- ft_cardfmt((FITSCard)oheader->cards,
- "SIMPLE", 0, FT_LOGICAL, &simple, 0, "Standard FITS");
-
- /* add/edit image-related keywords based on the orig binning values */
- ft_headseti(oheader, "NAXIS", 0, fun->dims, "number of axes", 1);
- /* set dimension info */
- for(j=0; j<fun->dims; j++){
- i = fun->bin[j];
- if( fun->cols[i] ){
- if( doimage && (fun->cols[i]->binsiz > 0) )
- binsiz = fun->cols[i]->binsiz;
- else
- binsiz = 1.0;
- ival = (int)tldim(fun->cols[i]->tlmin, fun->cols[i]->tlmax,
- binsiz, fun->cols[i]->type);
- }
- else
- ival = 1;
- ft_headseti(oheader, "NAXIS", j+1, ival, "axis dimension", 1);
- }
- /* set bitpix */
- ft_headseti(oheader, "BITPIX", 0, 32, "bits/pixel", 1);
- /* synchronize the header and the cards after any changes */
- ft_syncdata(oheader);
-
- /* transform WCS cards for the specified columns, if we have such */
- for(j=1; j<=2; j++){
- if( (i=fun->bin[j-1]+1) >= 1 ){
- if( (s=ft_headgets(iheader, "TCTYP", i, NULL, &card)) && card ){
- ft_headapps(oheader, "CTYPE", j, s, NULL);
- xfree(s);
- }
- if( (s=ft_headgets(iheader, "TCRVL", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CRVAL", j, s, NULL);
- xfree(s);
- }
- if( (dval=ft_headgetr(iheader, "TCDLT", i, 0.0, &card)) && card ){
- /* factor in binsize */
- if( doimage && (fun->cols[i-1]->binsiz >0) )
- dval *= fun->cols[i-1]->binsiz;
- ft_headsetr(oheader, "CDELT", j, dval, 15, NULL, 1);
- }
- if( (s=ft_headgets(iheader, "TCROT", i, NULL, &card)) && card ){
- ft_headappv(oheader, "CROTA", j, s, NULL);
- xfree(s);
- }
- if( (dval=ft_headgetr(iheader, "TCRPX", i, 0.0, &card)) && card ){
- /* convert floating WCS center value from physical to image coords */
- if( doimage ){
- if( fun->cols[i-1] )
- dval = tlp2i(dval,
- fun->cols[i-1]->tlmin, fun->cols[i-1]->binsiz, 'D');
- }
- ft_headsetr(oheader, "CRPIX", j, dval, 15, NULL, 1);
- }
- }
- }
- /* init new wcs */
- hlength(ft_cards(oheader),0);
- wcs = wcsinit(ft_cards(oheader));
- ft_headfree(oheader, 1);
- return wcs;
- }
- /* some other type */
- else
- return NULL;
-}
-
diff --git a/funtools/gnu/COPYING b/funtools/gnu/COPYING
deleted file mode 100644
index 60549be..0000000
--- a/funtools/gnu/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/funtools/gnu/Makefile.in b/funtools/gnu/Makefile.in
deleted file mode 100644
index 26cbf53..0000000
--- a/funtools/gnu/Makefile.in
+++ /dev/null
@@ -1,150 +0,0 @@
-#
-# This is a Makefile for the gnu binary sort. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# extra includes for compiling
-INCLUDES = -I. -I$(prefix)/include
-
-# extra libs
-EXTRA_LIBS = @EXTRA_LIBS@
-
-# the full set of libraries for linking
-LIBS =
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@ -DSAOMOD_BINARY
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# Directory in which to install the .a, .so, and .o files:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the programs:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the include files:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = @srcdir@/install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-EXE = @EXEEXT@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = ${CFLAGS} ${CPPFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-DEPEND_SWITCHES = ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-SRCS = sort.c
-
-OBJS = sort.o
-
-PROGS = _funsort
-
-TESTPROGS = sorttest
-
-all: $(PROGS)
-
-_funsort: $(OBJS)
- $(CC) $(LDFLAGS) $(OBJS) -o _funsort
-
-sorttest: sorttest.o
- $(CC) $(LDFLAGS) sorttest.o -o sorttest -L.. -lfuntools
-
-Makefile: Makefile.in
- $(SHELL) config.status
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak \
- config.info config.log \
- *fun*.out doc/*~
- $(RM) -r autom4te.cache
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log
-
-pclean:
- $(RM) $(PROGS)
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-sort.o: sort.c
- $(CC) -c $(CC_SWITCHES) sort.c
-
-install: $(PROGS)
- @for i in $(PROGS) ; \
- do \
- echo "Installing $$i$(EXE)" ; \
- $(INSTALL_PROGRAM) $$i$(EXE) $(BIN_INSTALL_DIR)/$$i$(EXE) ; \
- done;
-
-
-pure: _funsort.pure
-
-_funsort.pure: $(FUNLIB) sort.o
- purify $(CC) $(LDFLAGS) sort.o -o _funsort.pure \
- $(FUNLIB) $(LIBS)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/gnu/conf.h.in b/funtools/gnu/conf.h.in
deleted file mode 100644
index 5f3fa16..0000000
--- a/funtools/gnu/conf.h.in
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Define as 1 if this compiler supports long long. */
-#undef HAVE_LONG_LONG
-
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
diff --git a/funtools/gnu/copyright b/funtools/gnu/copyright
deleted file mode 100644
index 1778779..0000000
--- a/funtools/gnu/copyright
+++ /dev/null
@@ -1,29 +0,0 @@
-Unless otherwise indicated, all source is:
-
-Copyright (C) 1999-2003
-Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Correspondence concerning SAOds9 and SAOtk should be addressed as follows:
-
-William Joye
-Smithsonian Astrophysical Observatory
-Garden St.
-Cambridge, MA 02138 USA
-
-wjoye@cfa.harvard.edu
-
-http://hea-www.harvard.edu/RD/ds9/
diff --git a/funtools/gnu/install-sh b/funtools/gnu/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/gnu/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/gnu/sort.c b/funtools/gnu/sort.c
deleted file mode 100644
index 56d8bb2..0000000
--- a/funtools/gnu/sort.c
+++ /dev/null
@@ -1,2879 +0,0 @@
-/* sort - sort lines of text (with all kinds of options).
- Copyright (C) 1988, 1991, 1992, 1993, 1994, 1995 Free Software Foundation
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- Written December 1988 by Mike Haertel.
- The author may be reached (Email) at the address mike@gnu.ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-/* define to sort binary data */
-/* #define SAOMOD_BINARY 1 */
-
-/* define to sorts on hms, mjd */
-/* #define SAOMOD_ASTRO 1 */
-
-/* define to sort RDB tables */
-/* #define SAOMOD_TABLE 1 */
-
-/* always define --this just marks code fixes */
-#define SAOMOD_FIX 1
-
-/* Get isblank from GNU libc. */
-#define _GNU_SOURCE
-
-#include <sys/types.h>
-
-#ifndef RTMX
-#include <signal.h>
-#else
-#include <sys/signal.h>
-#endif
-
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#include "system.h"
-#ifdef LOCAL_INCLUDES
-#include "version.h"
-#include "error.h"
-#endif
-
-#ifdef SAOMOD_TABLE
-#include <table.h>
-#endif
-#ifdef SAOMOD_ASTRO
-double mjd();
-#endif
-
-#ifdef _POSIX_VERSION
-#include <limits.h>
-#else
-#ifndef UCHAR_MAX
-#define UCHAR_MAX 255
-#endif
-#endif
-
-#if HAVE_LONG_LONG
-typedef long long longlong;
-#else
-typedef long longlong;
-#endif
-
-static void usage ();
-
-#ifdef SAOMOD_TABLE
- int table = 0;
-#endif
-
-#ifdef SAOMOD_BINARY
- int BinarySort = 0;
-#endif
-
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#define UCHAR_LIM (UCHAR_MAX + 1)
-#define UCHAR(c) ((unsigned char) (c))
-
-#ifndef DEFAULT_TMPDIR
-#define DEFAULT_TMPDIR "/tmp"
-#endif
-
-/* The kind of blanks for '-b' to skip in various options. */
-enum blanktype { bl_start, bl_end, bl_both };
-
-/* The name this program was run with. */
-char *program_name;
-
-/* Table of digits. */
-static int digits[UCHAR_LIM];
-
-/* Table of white space. */
-static int blanks[UCHAR_LIM];
-
-/* Table of non-printing characters. */
-static int nonprinting[UCHAR_LIM];
-
-/* Table of non-dictionary characters (not letters, digits, or blanks). */
-static int nondictionary[UCHAR_LIM];
-
-/* Translation table folding lower case to upper. */
-static char fold_toupper[UCHAR_LIM];
-
-/* Table mapping 3-letter month names to integers.
- Alphabetic order allows binary search. */
-static struct month
-{
- char *name;
- int val;
-} const monthtab[] =
-{
- {"APR", 4},
- {"AUG", 8},
- {"DEC", 12},
- {"FEB", 2},
- {"JAN", 1},
- {"JUL", 7},
- {"JUN", 6},
- {"MAR", 3},
- {"MAY", 5},
- {"NOV", 11},
- {"OCT", 10},
- {"SEP", 9}
-};
-
-/* During the merge phase, the number of files to merge at once. */
-#define NMERGE 48
-
-/* Initial buffer size for in core sorting. Will not grow unless a
- line longer than this is seen. */
-static int sortalloc = 1024 * 1024;
-
-/* Initial buffer size for in core merge buffers. Bear in mind that
- up to NMERGE * mergealloc bytes may be allocated for merge buffers. */
-static int mergealloc = 32 * 1024;
-
-/* Guess of average line length. */
-static int linelength = 30;
-
-/* Maximum number of elements for the array(s) of struct line's, in bytes. */
-#define LINEALLOC (8 * 256 * 1024)
-
-/* Prefix for temporary file names. */
-static char *temp_file_prefix;
-
-/* Flag to reverse the order of all comparisons. */
-static int reverse;
-
-/* Flag for stable sort. This turns off the last ditch bytewise
- comparison of lines, and instead leaves lines in the same order
- they were read if all keys compare equal. */
-static int stable;
-
-/* Tab character separating fields. If NUL, then fields are separated
- by the empty string between a non-whitespace character and a whitespace
- character. */
-static char tab = '\0';
-
-/* Nonzero if any of the input files are the standard input. */
-static int have_read_stdin;
-
-/* Lines are held in core as counted strings. */
-struct line
-{
- char *text; /* Text of the line. */
- int length; /* Length not including final newline. */
- char *keybeg; /* Start of first key. */
- char *keylim; /* Limit of first key. */
-#ifdef SAOMOD_ASTRO
- int flag;
- double value; /* the chached value of the a numeric key. */
-#endif
-};
-
-/* Arrays of lines. */
-struct lines
-{
- struct line *lines; /* Dynamically allocated array of lines. */
- int used; /* Number of slots used. */
- int alloc; /* Number of slots allocated. */
- int limit; /* Max number of slots to allocate. */
-};
-
-/* Input buffers. */
-struct buffer
-{
- char *buf; /* Dynamically allocated buffer. */
- int used; /* Number of bytes used. */
- int alloc; /* Number of bytes allocated. */
- int left; /* Number of bytes left after line parsing. */
-};
-
-/* Lists of key field comparisons to be tried. */
-static struct keyfield
-{
- int sword; /* Zero-origin 'word' to start at. */
- int schar; /* Additional characters to skip. */
- int skipsblanks; /* Skip leading white space at start. */
- int eword; /* Zero-origin first word after field. */
- int echar; /* Additional characters in field. */
- int skipeblanks; /* Skip trailing white space at finish. */
- int *ignore; /* Boolean array of characters to ignore. */
- char *translate; /* Translation applied to characters. */
- int numeric; /* Flag for numeric comparison. */
- int month; /* Flag for comparison by month name. */
- int reverse; /* Reverse the sense of comparison. */
- int nzone;
- double dzone;
- int btype;
- struct keyfield *next; /* Next keyfield to try. */
-} keyhead;
-
-/* The list of temporary files. */
-static struct tempnode
-{
- char *name;
- struct tempnode *next;
-} temphead;
-
-
-/* Flag to remove consecutive duplicate lines from the output.
- Only the last of a sequence of equal lines will be output. */
-static int unique = 0;
-static int differ = 0;
-static int countr = 0;
-static int setcnt = 1;
-
-
-/* Clean up any remaining temporary files. */
-
-static void
-cleanup ()
-{
- struct tempnode *node;
-
- for (node = temphead.next; node; node = node->next)
- unlink (node->name);
-}
-
-/* Allocate N bytes of memory dynamically, with error checking. */
-
-char *
-xmalloc (n)
- unsigned n;
-{
- char *p;
-
- p = (char *)malloc (n);
- if (p == 0)
- {
- fprintf (stderr, "virtual memory exhausted");
- cleanup ();
- exit (2);
- }
- return p;
-}
-
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking.
- If P is NULL, run xmalloc.
- If N is 0, run free and return NULL. */
-
-char *
-xrealloc (p, n)
- char *p;
- unsigned n;
-{
- if (p == 0)
- return (char *)xmalloc (n);
- if (n == 0)
- {
- free (p);
- return 0;
- }
- p = (char *)realloc (p, n);
- if (p == 0)
- {
- fprintf (stderr, "virtual memory exhausted");
- cleanup ();
- exit (2);
- }
- return p;
-}
-static FILE *
-xfopen (file, how)
- char *file, *how;
-{
-#ifdef SAOMOD_TABLE
- FILE *fp = Open(file, how);
-#else
- FILE *fp;
- if ( !strcmp(file, "-") && !strcmp(how, "r") ) fp = stdin;
- else if ( !strcmp(file, "-") && !strcmp(how, "w") ) fp = stdout;
- else fp = fopen(file, how);
-#endif
-
- if (fp == 0) {
- perror (file);
- cleanup ();
- exit (2);
- }
-
- if (fp == stdin) have_read_stdin = 1;
-
- return fp;
-}
-
-static void
-xfclose (fp)
- FILE *fp;
-{
- if (fp == stdin) {
- /* Allow reading stdin from tty more than once. */
- if (feof (fp))
- clearerr (fp);
- } else if ( fp == stdout ) {
- if (fflush (fp) != 0) {
- perror ("flushing file");
- cleanup ();
- exit (2);
- }
- } else {
-#ifdef SAOMOD_TABLE
- if ( Close(fp) != 0 ) {
-#else
- if ( fclose(fp) != 0 ) {
-#endif
-
- perror ("closing file");
- cleanup ();
- exit (2);
- }
- }
-}
-
-static void
-xfwrite (buf, size, nelem, fp)
- char *buf;
- int size, nelem;
- FILE *fp;
-{
- if (fwrite (buf, size, nelem, fp) != (size_t)nelem)
- {
- perror ("writing file");
- cleanup ();
- exit (2);
- }
-}
-
-/* Return a name for a temporary file. */
-
-static char *
-tempname ()
-{
- static int seq;
- int len = strlen (temp_file_prefix);
- char *name = xmalloc (len + 16);
- struct tempnode *node =
- (struct tempnode *) xmalloc (sizeof (struct tempnode));
-
- sprintf (name,
- "%s%ssort%5.5d%5.5d",
- temp_file_prefix,
- (len && temp_file_prefix[len - 1] != '/') ? "/" : "",
- (unsigned int) getpid () & 0xffff, ++seq);
- node->name = name;
- node->next = temphead.next;
- temphead.next = node;
- return name;
-}
-
-/* Search through the list of temporary files for NAME;
- remove it if it is found on the list. */
-
-static void
-zaptemp (name)
- char *name;
-{
- struct tempnode *node, *temp;
-
- for (node = &temphead; node->next; node = node->next)
- if (!strcmp (name, node->next->name))
- break;
- if (node->next)
- {
- temp = node->next;
- unlink (temp->name);
- free (temp->name);
- node->next = temp->next;
- free ((char *) temp);
- }
-}
-
-/* Initialize the character class tables. */
-
-static void
-inittables ()
-{
- int i;
-
- for (i = 0; i < UCHAR_LIM; ++i)
- {
- if (ISBLANK (i))
- blanks[i] = 1;
- if (ISDIGIT (i))
- digits[i] = 1;
- if (!ISPRINT (i))
- nonprinting[i] = 1;
- if (!ISALNUM (i) && !ISBLANK (i))
- nondictionary[i] = 1;
- if (ISLOWER (i))
- fold_toupper[i] = toupper (i);
- else
- fold_toupper[i] = i;
- }
-}
-
-/* Initialize BUF, allocating ALLOC bytes initially. */
-
-static void
-initbuf (buf, alloc)
- struct buffer *buf;
- int alloc;
-{
- buf->alloc = alloc;
- buf->buf = xmalloc (buf->alloc);
- buf->used = buf->left = 0;
-}
-
-/* Fill BUF reading from FP, moving buf->left bytes from the end
- of buf->buf to the beginning first. If EOF is reached and the
- file wasn't terminated by a newline, supply one. Return a count
- of bytes buffered. */
-
-static int
-fillbuf (buf, fp)
- struct buffer *buf;
- FILE *fp;
-{
- int cc;
-
- memmove (buf->buf, buf->buf + buf->used - buf->left, buf->left);
- buf->used = buf->left;
-
-#ifdef SAOMOD_BINARY
- if ( BinarySort ) {
- cc = fread (buf->buf + buf->used, 1, buf->alloc - buf->used, fp);
-
- buf->used += cc;
-
- return buf->used;
- }
-#endif
-
- while (!feof (fp) && (buf->used == 0 || !memchr (buf->buf, '\n', buf->used)))
- {
- if (buf->used == buf->alloc)
- {
- buf->alloc *= 2;
- buf->buf = xrealloc (buf->buf, buf->alloc);
- }
- cc = fread (buf->buf + buf->used, 1, buf->alloc - buf->used, fp);
- if (ferror (fp))
- {
- perror ("reading file");
- cleanup ();
- exit (2);
- }
- buf->used += cc;
- }
-
- if (feof (fp) && buf->used && buf->buf[buf->used - 1] != '\n')
- {
- if (buf->used == buf->alloc)
- {
- buf->alloc *= 2;
- buf->buf = xrealloc (buf->buf, buf->alloc);
- }
- buf->buf[buf->used++] = '\n';
- }
-
- return buf->used;
-}
-
-/* Initialize LINES, allocating space for ALLOC lines initially.
- LIMIT is the maximum possible number of lines to allocate space
- for, ever. */
-
-static void
-initlines (lines, alloc, limit)
- struct lines *lines;
- int alloc;
- int limit;
-{
- lines->alloc = alloc;
- lines->lines = (struct line *) xmalloc (lines->alloc * sizeof (struct line));
- lines->used = 0;
- lines->limit = limit;
-}
-
-/* Return a pointer to the first character of the field specified
- by KEY in LINE. */
-
-static char *
-begfield (line, key)
- struct line *line;
- struct keyfield *key;
-{
- register char *ptr = line->text, *lim = ptr + line->length;
- register int sword = key->sword, schar = key->schar;
-
- if (tab)
- while (ptr < lim && sword--)
- {
- while (ptr < lim && *ptr != tab)
- ++ptr;
- if (ptr < lim)
- ++ptr;
- }
- else
- while (ptr < lim && sword--)
- {
- while (ptr < lim && blanks[UCHAR (*ptr)])
- ++ptr;
- while (ptr < lim && !blanks[UCHAR (*ptr)])
- ++ptr;
- }
-
- if (key->skipsblanks
-#ifdef SAOMOD_TABLE
-||table
-#endif
- )
- while (ptr < lim && blanks[UCHAR (*ptr)])
- ++ptr;
-
- while (ptr < lim && schar--)
- ++ptr;
-
- return ptr;
-}
-
-/* Return the limit of (a pointer to the first character after) the field
- in LINE specified by KEY. */
-
-static char *
-limfield (line, key)
- struct line *line;
- struct keyfield *key;
-{
- register char *ptr = line->text, *lim = ptr + line->length;
- register int eword = key->eword, echar = key->echar;
-
- if ( eword == -1 ) {
- eword = 1;
- echar = 0;
- }
-
- if (tab)
- while (ptr < lim && eword--)
- {
- while (ptr < lim && *ptr != tab)
- ++ptr;
- if (ptr < lim && (eword > 0 || key->skipeblanks))
- ++ptr;
- }
- else
- while (ptr < lim && eword--)
- {
- while (ptr < lim && blanks[UCHAR (*ptr)])
- ++ptr;
- while (ptr < lim && !blanks[UCHAR (*ptr)])
- ++ptr;
- }
-
-#ifdef SAOMOD_TABLE
- if ( table ) {
- if ( blanks[UCHAR (*ptr)] ) {
- while (ptr > line->text && blanks[UCHAR (*ptr)] ) --ptr;
- ptr++;
- }
- } else
-#endif
- {
- if (key->skipeblanks)
- while (ptr < lim && blanks[UCHAR (*ptr)])
- ++ptr;
-
- while (ptr < lim && echar--)
- ++ptr;
- }
-
- return ptr;
-}
-
-/* Find the lines in BUF, storing pointers and lengths in LINES.
- Also replace newlines with NULs. */
-
-static void
-findlines (buf, lines)
- struct buffer *buf;
- struct lines *lines;
-{
- register char *beg = buf->buf, *lim = buf->buf + buf->used, *ptr;
- struct keyfield *key = keyhead.next;
-
- lines->used = 0;
-
-#ifdef SAOMOD_BINARY
- if ( lim - beg < BinarySort ) {
- fprintf(stderr, "Odd sized records in buffer?\n");
- cleanup();
- abort();
- }
-#else
- if ( lim - beg < 0 ) {
- fprintf(stderr, "Odd sized records in buffer?\n");
- cleanup();
- abort();
- }
-#endif
-
-#ifdef SAOMOD_BINARY
- if ( BinarySort ) {
- while ( beg + BinarySort <= lim )
- {
-
- if (lines->used == lines->alloc)
- {
- lines->alloc *= 2;
- lines->lines = (struct line *)
- xrealloc ((char *) lines->lines,
- lines->alloc * sizeof (struct line));
- }
-
- lines->lines[lines->used].text = beg;
- lines->lines[lines->used].length = BinarySort;
-#ifdef SAOMOD_ASTRO
- lines->lines[lines->used].flag = 0;
-#endif
-
- beg += BinarySort;
- lines->used++;
- }
-
- buf->left = lim - beg;
- return;
- }
-#endif
-
- while (beg < lim && (ptr = memchr (beg, '\n', lim - beg))
- && lines->used < lines->limit)
- {
- /* There are various places in the code that rely on a NUL
- being at the end of in-core lines; NULs inside the lines
- will not cause trouble, though. */
- *ptr = '\0';
-
- if (lines->used == lines->alloc)
- {
- lines->alloc *= 2;
- lines->lines = (struct line *)
- xrealloc ((char *) lines->lines,
- lines->alloc * sizeof (struct line));
- }
-
- lines->lines[lines->used].text = beg;
- lines->lines[lines->used].length = ptr - beg;
-#ifdef SAOMOD_ASTRO
- lines->lines[lines->used].flag = 0;
-#endif
-
- /* Precompute the position of the first key for efficiency. */
- if (key)
- {
- if ( key->eword >= 0
-#ifdef SAOMOD_TABLE
- || table
-#endif
- )
- lines->lines[lines->used].keylim =
- limfield (&lines->lines[lines->used], key);
- else
- lines->lines[lines->used].keylim = ptr;
-
- if (key->sword >= 0)
- lines->lines[lines->used].keybeg =
- begfield (&lines->lines[lines->used], key);
- else
- {
- if (key->skipsblanks
-#ifdef SAOMOD_TABLE
-||table
-#endif
-)
- while (blanks[UCHAR (*beg)])
- ++beg;
- lines->lines[lines->used].keybeg = beg;
- }
- }
- else
- {
- lines->lines[lines->used].keybeg = 0;
- lines->lines[lines->used].keylim = 0;
- }
-
- ++lines->used;
- beg = ptr + 1;
- }
-
- buf->left = lim - beg;
-}
-
-/* Compare strings A and B containing decimal fractions < 1. Each string
- should begin with a decimal point followed immediately by the digits
- of the fraction. Strings not of this form are considered to be zero. */
-
-static int
-fraccompare (a, b)
- register char *a, *b;
-{
- register int tmpa = UCHAR (*a), tmpb = UCHAR (*b);
-
- if (tmpa == '.' && tmpb == '.')
- {
- do
- tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
- while (tmpa == tmpb && digits[tmpa]);
- if (digits[tmpa] && digits[tmpb])
- return tmpa - tmpb;
- if (digits[tmpa])
- {
- while (tmpa == '0')
- tmpa = UCHAR (*++a);
- if (digits[tmpa])
- return 1;
- return 0;
- }
- if (digits[tmpb])
- {
- while (tmpb == '0')
- tmpb = UCHAR (*++b);
- if (digits[tmpb])
- return -1;
- return 0;
- }
- return 0;
- }
- else if (tmpa == '.')
- {
- do
- tmpa = UCHAR (*++a);
- while (tmpa == '0');
- if (digits[tmpa])
- return 1;
- return 0;
- }
- else if (tmpb == '.')
- {
- do
- tmpb = UCHAR (*++b);
- while (tmpb == '0');
- if (digits[tmpb])
- return -1;
- return 0;
- }
- return 0;
-}
-
-/* Compare strings A and B as numbers without explicitly converting them to
- machine numbers. Comparatively slow for short strings, but asymptotically
- hideously fast. */
-
-static int
-numcompare (a, b)
- register char *a, *b;
-{
- register int tmpa, tmpb, loga, logb, tmp;
-
- tmpa = UCHAR (*a), tmpb = UCHAR (*b);
-
-
- while (blanks[tmpa])
- tmpa = UCHAR (*++a);
- while (blanks[tmpb])
- tmpb = UCHAR (*++b);
-
- if (tmpa == '-')
- {
- tmpa = UCHAR (*++a);
- if (tmpb != '-')
- {
- if (digits[tmpa] && digits[tmpb])
- return -1;
- return 0;
- }
- tmpb = UCHAR (*++b);
-
- while (tmpa == '0')
- tmpa = UCHAR (*++a);
- while (tmpb == '0')
- tmpb = UCHAR (*++b);
-
- while (tmpa == tmpb && digits[tmpa])
- tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
-
- if ((tmpa == '.' && !digits[tmpb]) || (tmpb == '.' && !digits[tmpa]))
- return -fraccompare (a, b);
-
- if (digits[tmpa])
- for (loga = 1; digits[UCHAR (*++a)]; ++loga)
- ;
- else
- loga = 0;
-
- if (digits[tmpb])
- for (logb = 1; digits[UCHAR (*++b)]; ++logb)
- ;
- else
- logb = 0;
-
- if ((tmp = logb - loga) != 0)
- return tmp;
-
- if (!loga)
- return 0;
-
- return tmpb - tmpa;
- }
- else if (tmpb == '-')
- {
- if (digits[UCHAR (tmpa)] && digits[UCHAR (*++b)])
- return 1;
- return 0;
- }
- else
- {
- while (tmpa == '0')
- tmpa = UCHAR (*++a);
- while (tmpb == '0')
- tmpb = UCHAR (*++b);
-
- while (tmpa == tmpb && digits[tmpa])
- tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
-
- if ((tmpa == '.' && !digits[tmpb]) || (tmpb == '.' && !digits[tmpa]))
- return fraccompare (a, b);
-
- if (digits[tmpa])
- for (loga = 1; digits[UCHAR (*++a)]; ++loga)
- ;
- else
- loga = 0;
-
- if (digits[tmpb])
- for (logb = 1; digits[UCHAR (*++b)]; ++logb)
- ;
- else
- logb = 0;
-
- if ((tmp = loga - logb) != 0)
- return tmp;
-
- if (!loga)
- return 0;
-
- return tmpa - tmpb;
- }
-}
-
-/* Return an integer <= 12 associated with month name S with length LEN,
- 0 if the name in S is not recognized. */
-
-static int
-getmonth (s, len)
- char *s;
- int len;
-{
- char month[4];
- register int i, lo = 0, hi = 12;
-
- while (len > 0 && blanks[UCHAR(*s)])
- ++s, --len;
-
- if (len < 3)
- return 0;
-
- for (i = 0; i < 3; ++i)
- month[i] = fold_toupper[UCHAR (s[i])];
- month[3] = '\0';
-
- while (hi - lo > 1)
- if (strcmp (month, monthtab[(lo + hi) / 2].name) < 0)
- hi = (lo + hi) / 2;
- else
- lo = (lo + hi) / 2;
- if (!strcmp (month, monthtab[lo].name))
- return monthtab[lo].val;
- return 0;
-}
-
-/* Compare two lines A and B trying every key in sequence until there
- are no more keys or a difference is found. */
-
-static int
-keycompare (a, b)
- struct line *a, *b;
-{
- register char *texta, *textb, *lima, *limb, *translate;
- register int *ignore;
- struct keyfield *key;
- int diff = 0, iter = 0, lena, lenb;
-
- for (key = keyhead.next; key; key = key->next, ++iter)
- {
- ignore = key->ignore;
- translate = key->translate;
-
-#ifdef SAOMOD_BINARY
- if ( BinarySort ) {
- switch ( key->btype ) {
- case 'c' :
- case 'b' : {
- char va, vb;
-
- va = *((char *) a->text+key->sword);
- vb = *((char *) b->text+key->sword);
-
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'C' :
- case 'B' : {
- unsigned char va, vb;
-
- va = *((unsigned char *) a->text+key->sword);
- vb = *((unsigned char *) b->text+key->sword);
-
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 's' : {
- short va, vb;
-
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(short));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(short));
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(short));
- if ( key->nzone ) va = (int) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(short));
- if ( key->nzone ) va = (int) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'S' : {
- unsigned short va, vb;
-
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(short));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(short));
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(short));
- if ( key->nzone ) va = (int) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(short));
- if ( key->nzone ) va = (int) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'i' : {
- int va, vb;
-
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(int));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(int));
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(int));
- if ( key->nzone ) va = (int) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(int));
- if ( key->nzone ) va = (int) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'l' : {
- longlong va, vb;
-#if HAVE_LONG_LONG == 0
- fprintf (stderr, "long long support was not built into this program\n");
- exit(1);
-#endif
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(longlong));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(longlong));
- if ( key->nzone ) {
- va = (longlong) (va / key->dzone);
- vb = (longlong) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(longlong));
- if ( key->nzone ) va = (longlong) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(longlong));
- if ( key->nzone ) va = (longlong) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'I' : {
- unsigned int va, vb;
-
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(int));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(int));
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(int));
- if ( key->nzone ) va = (int) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(int));
- if ( key->nzone ) va = (int) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'f' : {
- float va, vb;
-
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(float));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(float));
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(float));
- if ( key->nzone ) va = (int) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(float));
- if ( key->nzone ) va = (int) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 'd' : {
- double va, vb;
-
- if ( !iter ) {
- memcpy(&va, (void *) (a->text+key->sword), sizeof(double));
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(double));
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
- } else {
-#ifdef SAOMOD_ASTRO
- if ( a->flag ) va = a->value;
- else {
-#endif
- memcpy(&va, (void *) (a->text+key->sword), sizeof(double));
- if ( key->nzone ) va = (int) (va / key->dzone);
-#ifdef SAOMOD_ASTRO
- a->flag = 1;
- a->value = va;
- }
- if ( b->flag ) vb = b->value;
- else {
-#endif
- memcpy(&vb, (void *) (b->text+key->sword), sizeof(double));
- if ( key->nzone ) va = (int) (vb / key->dzone);
-#ifdef SAOMOD_ASTRO
- b->flag = 1;
- b->value = vb;
- }
-#endif
- }
-
- diff = va == vb ? 0 : ( va < vb ? -1 : 1 );
- break;
- }
- case 't' : {
- diff = strncmp(a->text+key->sword, b->text+key->sword, key->schar);
- break;
- }
- default:
- fprintf(stderr, "Bad type in binary value compare\n");
- cleanup();
- abort();
- }
-
- if ( diff ) return diff;
- continue;
- }
-#endif
-
- /* Find the beginning and limit of each field. */
- if (iter || a->keybeg == NULL || b->keybeg == NULL)
- {
- if ( key->eword >= 0
-#ifdef SAOMOD_TABLE
-|| table
-#endif
- ) {
- lima = limfield (a, key);
- limb = limfield (b, key);
- } else {
- lima = a->text + a->length;
- limb = b->text + b->length;
- }
-
- if (key->sword >= 0) {
- texta = begfield (a, key); textb = begfield (b, key);
- } else {
- texta = a->text; textb = b->text;
- if (key->skipsblanks
-#ifdef SAOMOD_TABLE
-||table
-#endif
-)
- {
- while (texta < lima && blanks[UCHAR (*texta)])
- ++texta;
- while (textb < limb && blanks[UCHAR (*textb)])
- ++textb;
- }
- }
- }
- else
- {
- /* For the first iteration only, the key positions have
- been precomputed for us. */
- texta = a->keybeg; lima = a->keylim;
- textb = b->keybeg; limb = b->keylim;
- }
-
- /* Find the lengths. */
- lena = lima - texta; lenb = limb - textb;
- if (lena < 0)
- lena = 0;
- if (lenb < 0)
- lenb = 0;
-
- /* Actually compare the fields. */
- if ( key->numeric ) {
-#ifdef SAOMOD_FIX
- if ( *texta != '+' && *texta != '-' && !ISDIGIT((int)*texta) ) {
- if ( *textb != '+' && *textb != '-' && !ISDIGIT((int)*textb) ) {
- diff = memcmp (texta, textb, min(lena, lenb));
- } else {
- diff = 1;
- }
- } else
- if ( *textb != '+' && *textb != '-' && !ISDIGIT((int)*textb) ) {
- diff = -1;
- } else
-#endif
-#ifdef SAOMOD_ASTRO
- if ( key->numeric == 2 || key->numeric == 3 ) {
- double va;
- double vb;
-
- static int x = 0;
-
- if ( iter ) {
- if (*lima || *limb) {
- char savea = *lima;
- char saveb = *limb;
-
- *lima = *limb = '\0';
-
- if ( key->numeric == 2 ) {
- va = SAOstrtod(texta, NULL);
- vb = SAOstrtod(textb, NULL);
- } else {
- va = mjd(texta, 0);
- vb = mjd(textb, 0);
- }
-
- *lima = savea; *limb = saveb;
- } else {
- if ( key->numeric == 2 ) {
- va = SAOstrtod(texta, NULL);
- vb = SAOstrtod(textb, NULL);
- } else {
- va = mjd(texta, 0);
- vb = mjd(textb, 0);
- }
- }
- } else {
- if ( a->flag ) va = a->value;
- else {
- char savea = *lima;
-
- *lima = '\0';
- if ( key->numeric == 2 ) {
- va = a->value = SAOstrtod(texta, NULL);
- } else {
- va = mjd(texta, 0);
- }
- *lima = savea;
- a->flag++;
-
- }
- if ( b->flag ) vb = b->value;
- else {
- char saveb = *limb;
-
- *limb = '\0';
- if ( key->numeric == 2 ) {
- vb = b->value = SAOstrtod(textb, NULL);
- } else {
- vb = mjd(textb, 0);
- }
- *limb = saveb;
- b->flag++;
- }
- }
-
- if ( key->nzone ) {
- va = (int) (va / key->dzone);
- vb = (int) (vb / key->dzone);
- }
-
- diff = (va < vb) ? -1 : ((va == vb) ? 0 : 1);
-
- if ( diff )
- return key->reverse ? -diff : diff;
- continue;
- } else
-#endif
- if ( key->numeric == 1 )
- {
- if (*lima || *limb)
- {
- char savea = *lima; char saveb = *limb;
-
- *lima = *limb = '\0';
-
- diff = numcompare (texta, textb);
- *lima = savea, *limb = saveb;
- }
- else {
- diff = numcompare (texta, textb);
- }
-
-
- if (diff)
- return key->reverse ? -diff : diff;
- continue;
- }
-#ifdef SAOMOD_FIX
- if (diff) /* This catches the text diffs */
- return key->reverse ? -diff : diff;
-#endif
- }
- else if (key->month)
- {
- diff = getmonth (texta, lena) - getmonth (textb, lenb);
- if (diff)
- return key->reverse ? -diff : diff;
- continue;
- }
- else if (ignore && translate)
- while (texta < lima && textb < limb)
- {
- while (texta < lima && ignore[UCHAR (*texta)])
- ++texta;
- while (textb < limb && ignore[UCHAR (*textb)])
- ++textb;
- if (texta < lima && textb < limb &&
- translate[UCHAR (*texta++)] != translate[UCHAR (*textb++)])
- {
- diff = translate[UCHAR (*--texta)] - translate[UCHAR (*--textb)];
- break;
- }
- else if (texta == lima && textb < limb) diff = -1;
- else if (texta < lima && textb == limb) diff = 1;
- }
- else if (ignore)
- while (texta < lima && textb < limb)
- {
- while (texta < lima && ignore[UCHAR (*texta)])
- ++texta;
- while (textb < limb && ignore[UCHAR (*textb)])
- ++textb;
- if (texta < lima && textb < limb && *texta++ != *textb++)
- {
- diff = *--texta - *--textb;
- break;
- }
- else if (texta == lima && textb < limb) diff = -1;
- else if (texta < lima && textb == limb) diff = 1;
- }
- else if (translate)
- while (texta < lima && textb < limb)
- {
- if (translate[UCHAR (*texta++)] != translate[UCHAR (*textb++)])
- {
- diff = translate[UCHAR (*--texta)] - translate[UCHAR (*--textb)];
- break;
- }
- }
- else
- diff = memcmp (texta, textb, min (lena, lenb));
-
- if (diff)
- return key->reverse ? -diff : diff;
- if ((diff = lena - lenb) != 0)
- return key->reverse ? -diff : diff;
- }
-
- return 0;
-}
-
-/* Compare two lines A and B, returning negative, zero, or positive
- depending on whether A compares less than, equal to, or greater than B. */
-
-static int
-compare (a, b)
- register struct line *a, *b;
-{
- int diff, tmpa, tmpb, mini;
-
- /* First try to compare on the specified keys (if any).
- The only two cases with no key at all are unadorned sort,
- and unadorned sort -r. */
- if (keyhead.next)
- {
- diff = keycompare (a, b);
- if (diff != 0)
- return diff;
- if (unique || stable)
- return 0;
- }
-
- /* If the keys all compare equal (or no keys were specified)
- fall through to the default byte-by-byte comparison. */
- tmpa = a->length, tmpb = b->length;
- mini = min (tmpa, tmpb);
- if (mini == 0)
- diff = tmpa - tmpb;
- else
- {
- char *ap = a->text, *bp = b->text;
-
- diff = UCHAR (*ap) - UCHAR (*bp);
- if (diff == 0)
- {
- diff = memcmp (ap, bp, mini);
- if (diff == 0)
- diff = tmpa - tmpb;
- }
- }
-
- return reverse ? -diff : diff;
-}
-
-/* Check that the lines read from the given FP come in order. Return
- 1 if they do and 0 if there is a disorder. */
-
-static int line;
-static int
-checkfp (fp)
- FILE *fp;
-{
- struct buffer buf; /* Input buffer. */
- struct lines lines; /* Lines scanned from the buffer. */
- struct line *prev_line; /* Pointer to previous line. */
- struct line temp; /* Copy of previous line. */
- int cc; /* Character count. */
- int cmp; /* Result of calling compare. */
- int alloc, i, success = 1;
-
- initbuf (&buf, mergealloc);
- initlines (&lines, mergealloc / linelength + 1,
- LINEALLOC / ((NMERGE + NMERGE) * sizeof (struct line)));
- alloc = linelength;
- temp.text = xmalloc (alloc);
-
- cc = fillbuf (&buf, fp);
- findlines (&buf, &lines);
-
- if (cc)
- do
- {
-
- /* Compare each line in the buffer with its successor. */
- for (i = 0; i < lines.used - 1; ++i)
- {
- line++;
- cmp = compare (&lines.lines[i], &lines.lines[i + 1]);
- if ((unique && cmp >= 0) || (cmp > 0))
- {
- success = 0;
- goto finish;
- }
- }
-
- /* Save the last line of the buffer and refill the buffer. */
- prev_line = lines.lines + lines.used - 1;
- if (prev_line->length > alloc)
- {
- while (prev_line->length + 1 > alloc)
- alloc *= 2;
- temp.text = xrealloc (temp.text, alloc);
- }
- memcpy (temp.text, prev_line->text, prev_line->length + 1);
- temp.length = prev_line->length;
- temp.keybeg = temp.text + (prev_line->keybeg - prev_line->text);
- temp.keylim = temp.text + (prev_line->keylim - prev_line->text);
-#ifdef SAOMOD_ASTRO
- temp.flag = prev_line->flag;
- temp.value = prev_line->value;
-#endif
-
- cc = fillbuf (&buf, fp);
- if (cc)
- {
- findlines (&buf, &lines);
- /* Make sure the line saved from the old buffer contents is
- less than or equal to the first line of the new buffer. */
- cmp = compare (&temp, &lines.lines[0]);
- if ((unique && cmp >= 0) || (cmp > 0))
- {
- success = 0;
- break;
- }
- }
- }
- while (cc);
-
-finish:
- xfclose (fp);
- free (buf.buf);
- free ((char *) lines.lines);
- free (temp.text);
- return success;
-}
-
-/* Merge lines from FPS onto OFP. NFPS cannot be greater than NMERGE.
- Close FPS before returning. */
-
-static void
-mergefps (fps, nfps, ofp)
- FILE *fps[], *ofp;
- register int nfps;
-{
- struct buffer buffer[NMERGE]; /* Input buffers for each file. */
- struct lines lines[NMERGE]; /* Line tables for each buffer. */
- struct line saved; /* Saved line for unique check. */
- int savedflag = 0; /* True if there is a saved line. */
- int savealloc = 0; /* Size allocated for the saved line. */
- int cur[NMERGE]; /* Current line in each line table. */
- int ord[NMERGE]; /* Table representing a permutation of fps,
- such that lines[ord[0]].lines[cur[ord[0]]]
- is the smallest line and will be next
- output. */
- register int i, j, t;
-
- /* Allocate space for a saved line if necessary. */
- if (unique)
- {
- savealloc = linelength;
- saved.text = xmalloc (savealloc);
-#ifdef SAOMOD_ASTRO
- saved.flag = 0;
-#endif
- }
-
- /* Read initial lines from each input file. */
- for (i = 0; i < nfps; ++i)
- {
- initbuf (&buffer[i], mergealloc);
- /* If a file is empty, eliminate it from future consideration. */
- while (i < nfps && !fillbuf (&buffer[i], fps[i]))
- {
- xfclose (fps[i]);
- --nfps;
- for (j = i; j < nfps; ++j)
- fps[j] = fps[j + 1];
- }
- if (i == nfps)
- free (buffer[i].buf);
- else
- {
- initlines (&lines[i], mergealloc / linelength + 1,
- LINEALLOC / ((NMERGE + NMERGE) * sizeof (struct line)));
- findlines (&buffer[i], &lines[i]);
- cur[i] = 0;
- }
- }
-
- /* Set up the ord table according to comparisons among input lines.
- Since this only reorders two items if one is strictly greater than
- the other, it is stable. */
- for (i = 0; i < nfps; ++i)
- ord[i] = i;
- for (i = 1; i < nfps; ++i)
- if (compare (&lines[ord[i - 1]].lines[cur[ord[i - 1]]],
- &lines[ord[i]].lines[cur[ord[i]]]) > 0)
- t = ord[i - 1], ord[i - 1] = ord[i], ord[i] = t, i = 0;
-
- /* Repeatedly output the smallest line until no input remains. */
- while ( nfps )
- {
- /* If uniqified output is turned on, output only the last of
- an identical series of lines. */
- if (unique)
- { int cmp;
-
- if ( savedflag ) {
- cmp = compare (&saved, &lines[ord[0]].lines[cur[ord[0]]]);
-
- if ( !cmp ) {
- savedflag++;
- } else {
- if ( savedflag >= 1 ) {
- if ( !differ ) {
- if ( countr )
- fprintf(ofp, "%d\t", savedflag);
- xfwrite (saved.text, 1, saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- } else {
- if ( (differ == 1 && savedflag == 1)
- || (differ == 2 && savedflag >= 2) ) {
- xfwrite (saved.text, 1, saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
- }
-
- if ( differ == 3 ) setcnt++;
-
- savedflag = 0;
- }
- }
- }
-
- if ( !savedflag) {
- if (savealloc < lines[ord[0]].lines[cur[ord[0]]].length + 1)
- {
- while (savealloc < lines[ord[0]].lines[cur[ord[0]]].length + 1)
- savealloc *= 2;
- saved.text = xrealloc (saved.text, savealloc);
- }
- saved.length = lines[ord[0]].lines[cur[ord[0]]].length;
- memcpy (saved.text, lines[ord[0]].lines[cur[ord[0]]].text,
- saved.length + 1);
- if (lines[ord[0]].lines[cur[ord[0]]].keybeg != NULL)
- {
- saved.keybeg = saved.text +
- (lines[ord[0]].lines[cur[ord[0]]].keybeg
- - lines[ord[0]].lines[cur[ord[0]]].text);
- }
- if (lines[ord[0]].lines[cur[ord[0]]].keylim != NULL)
- {
- saved.keylim = saved.text +
- (lines[ord[0]].lines[cur[ord[0]]].keylim
- - lines[ord[0]].lines[cur[ord[0]]].text);
- }
-
-#ifdef SAOMOD_ASTRO
- saved.flag = lines[ord[0]].lines[cur[ord[0]]].flag;
- saved.value = lines[ord[0]].lines[cur[ord[0]]].value;
-#endif
-
- savedflag = 1;
- }
-
- if ( differ == 3 ) {
- fprintf(ofp, "%d\t", setcnt);
- xfwrite (lines[ord[0]].lines[cur[ord[0]]].text, 1,
- lines[ord[0]].lines[cur[ord[0]]].length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- if ( savedflag >= 2 && differ == 4 ) {
- if ( savedflag == 2 ) {
- xfwrite (saved.text, 1,
- saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
- xfwrite (lines[ord[0]].lines[cur[ord[0]]].text, 1,
- lines[ord[0]].lines[cur[ord[0]]].length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- }
-
- else {
- xfwrite (lines[ord[0]].lines[cur[ord[0]]].text, 1,
- lines[ord[0]].lines[cur[ord[0]]].length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- /* Check if we need to read more lines into core. */
- if (++cur[ord[0]] == lines[ord[0]].used){
- if (fillbuf (&buffer[ord[0]], fps[ord[0]]))
- {
- findlines (&buffer[ord[0]], &lines[ord[0]]);
- cur[ord[0]] = 0;
- }
- else
- {
- /* We reached EOF on fps[ord[0]]. */
- for (i = 1; i < nfps; ++i)
- if (ord[i] > ord[0])
- --ord[i];
- --nfps;
- xfclose (fps[ord[0]]);
- free (buffer[ord[0]].buf);
- free ((char *) lines[ord[0]].lines);
- for (i = ord[0]; i < nfps; ++i)
- {
- fps[i] = fps[i + 1];
- buffer[i] = buffer[i + 1];
- lines[i] = lines[i + 1];
- cur[i] = cur[i + 1];
- }
- for (i = 0; i < nfps; ++i)
- ord[i] = ord[i + 1];
- continue;
- }
- }
- /* The new line just read in may be larger than other lines
- already in core; push it back in the queue until we encounter
- a line larger than it. */
- for (i = 1; i < nfps; ++i)
- {
- t = compare (&lines[ord[0]].lines[cur[ord[0]]],
- &lines[ord[i]].lines[cur[ord[i]]]);
- if (!t)
- t = ord[0] - ord[i];
- if (t < 0)
- break;
- }
- t = ord[0];
- for (j = 1; j < i; ++j)
- ord[j - 1] = ord[j];
- ord[i - 1] = t;
- }
-
- if (unique && savedflag)
- {
- if ( !differ && savedflag >= 1 )
- {
- if ( countr )
- fprintf(ofp, "%d\t", savedflag);
-
- xfwrite (saved.text, 1, saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- if ( (differ == 1 && savedflag == 1)
- || (differ == 2 && savedflag >= 2) ) {
- xfwrite (saved.text, 1,
- saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- free (saved.text);
- }
-}
-
-/* Sort the array LINES with NLINES members, using TEMP for temporary space. */
-
-static void
-sortlines (lines, nlines, temp)
- struct line *lines, *temp;
- int nlines;
-{
- register struct line *lo, *hi, *t;
- register int nlo, nhi;
-
- if (nlines == 2)
- {
- if (compare (&lines[0], &lines[1]) > 0)
- *temp = lines[0], lines[0] = lines[1], lines[1] = *temp;
- return;
- }
-
- nlo = nlines / 2;
- lo = lines;
- nhi = nlines - nlo;
- hi = lines + nlo;
-
- if (nlo > 1)
- sortlines (lo, nlo, temp);
-
- if (nhi > 1)
- sortlines (hi, nhi, temp);
-
- t = temp;
-
- while (nlo && nhi)
- if (compare (lo, hi) <= 0)
- *t++ = *lo++, --nlo;
- else
- *t++ = *hi++, --nhi;
- while (nlo--)
- *t++ = *lo++;
-
- for (lo = lines, nlo = nlines - nhi, t = temp; nlo; --nlo)
- *lo++ = *t++;
-}
-
-/* Check that each of the NFILES FILES is ordered.
- Return a count of disordered files. */
-
-
-static int
-check (files, nfiles)
- char *files[];
- int nfiles;
-{
- int i, disorders = 0;
- FILE *fp;
-
- for (i = 0; i < nfiles; ++i)
- {
- fp = xfopen (files[i], "r");
- line = 0;
- if (!checkfp (fp))
- {
- printf ("%s: disorder on %s at line %d\n", program_name, files[i]
- , line);
- ++disorders;
- }
- }
- return disorders;
-}
-
-/* Merge NFILES FILES onto OFP. */
-
-static void
-merge (files, nfiles, ofp)
- char *files[];
- int nfiles;
- FILE *ofp;
-{
- int i, j, t;
- char *temp;
- FILE *fps[NMERGE], *tfp;
-
-#ifdef SAOMOD_TABLE
- static TableHead TH = NULL;
- TableHead th;
-#endif
-
- int saveunique = unique;
-
- unique = 0;
-
- while (nfiles > NMERGE)
- {
- t = 0;
- for (i = 0; i < nfiles / NMERGE; ++i)
- {
- for (j = 0; j < NMERGE; ++j) {
- fps[j] = xfopen (files[i * NMERGE + j], "r");
-#ifdef SAOMOD_TABLE
- if ( table == 2 ) {
- if ( TH == NULL ) TH = table_header(fps[j], TABLE_PARSE);
- else {
- int k;
-
- th = table_header(fps[j], TABLE_PARSE);
- for ( k = 0; k < table_ncol(TH); k++ )
- if ( strcmp(table_colnam(TH, k + 1), table_colnam(th, k + 1)) ) {
- fprintf(stderr, "sorttable: can't merge tables with different column definitions: \"%\"s != \"%s\"\n", table_colnam(TH, k+1), table_colnam(th, k+1));
- exit(1);
- }
- table_hdrfree(th);
- }
- }
-#endif
- }
-
-
- tfp = xfopen (temp = tempname (), "w");
- mergefps (fps, NMERGE, tfp);
- xfclose (tfp);
- for (j = 0; j < NMERGE; ++j)
- zaptemp (files[i * NMERGE + j]);
- files[t++] = temp;
- }
-
- for (j = 0; j < nfiles % NMERGE; ++j) {
- fps[j] = xfopen (files[i * NMERGE + j], "r");
-#ifdef SAOMOD_TABLE
- if ( table == 2 ) {
- if ( TH == NULL ) TH = table_header(fps[j], TABLE_PARSE);
- else {
- int k;
-
- th = table_header(fps[j], TABLE_PARSE);
- for ( k = 0; k < table_ncol(TH); k++ )
- if ( strcmp(table_colnam(TH, k + 1), table_colnam(th, k + 1)) ) {
- fprintf(stderr, "sorttable: can't merge tables with different column definitions: \"%s\" != \"%s\"\n", table_colnam(TH, k+1), table_colnam(th, k+1));
- exit(1);
- }
- table_hdrfree(th);
- }
- }
-#endif
- }
-
-
- tfp = xfopen (temp = tempname (), "w");
- mergefps (fps, nfiles % NMERGE, tfp);
- xfclose (tfp);
- for (j = 0; j < nfiles % NMERGE; ++j)
- zaptemp (files[i * NMERGE + j]);
- files[t++] = temp;
- nfiles = t;
- }
-
- for (i = 0; i < nfiles; ++i) {
- fps[i] = xfopen (files[i], "r");
-#ifdef SAOMOD_TABLE
- if ( table == 2 ) {
- if ( TH == NULL ) TH = table_header(fps[i], TABLE_PARSE);
- else {
- int k;
-
- th = table_header(fps[i], TABLE_PARSE);
- for ( k = 0; k < table_ncol(TH); k++ ) {
- if ( strcmp(table_colnam(TH, k + 1), table_colnam(th, k + 1)) ) {
- fprintf(stderr, "sorttable: can't merge tables with different column definitions: \"%s\" != \"%s\"\n", table_colnam(TH, k+1), table_colnam(th, k+1));
- exit(1);
- }
- }
- table_hdrfree(th);
- }
- }
-#endif
- }
-
- unique = saveunique;
- mergefps (fps, i, ofp);
- for (i = 0; i < nfiles; ++i)
- zaptemp (files[i]);
-}
-
-/* Sort NFILES FILES onto OFP. */
-
-static void
-sort (files, nfiles, ofp)
- char **files;
- int nfiles;
- FILE *ofp;
-{
- struct buffer buf;
- struct lines lines;
- struct line saved; /* Saved line for unique check. */
- int savedflag = 0;
- int savealloc = 0; /* Size allocated for the saved line. */
- struct line *tmp;
- int i, ntmp;
- FILE *fp, *tfp;
- struct tempnode *node;
- int ntemp = 0;
- char **tempfiles;
-
- initbuf (&buf, sortalloc);
- initlines (&lines, sortalloc / linelength + 1,
- LINEALLOC / sizeof (struct line));
- ntmp = lines.alloc;
- tmp = (struct line *) xmalloc (ntmp * sizeof (struct line));
-
- /* Allocate space for a saved line if necessary. */
- if (unique)
- {
- savealloc = linelength;
- saved.text = xmalloc (savealloc);
-#ifdef SAOMOD_ASTRO
- saved.flag = 0;
-#endif
- }
-
- while (nfiles--)
- {
- fp = xfopen (*files++, "r");
- while (fillbuf (&buf, fp))
- {
- findlines (&buf, &lines);
- if (lines.used > ntmp)
- {
- while (lines.used > ntmp)
- ntmp *= 2;
- tmp = (struct line *)
- xrealloc ((char *) tmp, ntmp * sizeof (struct line));
- }
- sortlines (lines.lines, lines.used, tmp);
- if (feof (fp) && !nfiles && !ntemp && !buf.left)
- tfp = ofp;
- else
- {
- ++ntemp;
- tfp = xfopen (tempname (), "w");
- }
- if ( !unique || tfp != ofp )
- for (i = 0; i < lines.used; ++i) {
- xfwrite (lines.lines[i].text, 1, lines.lines[i].length, tfp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', tfp);
-#endif
- }
- else {
- for (i = 0; i < lines.used; ++i) {
- int cmp;
-
- if ( savedflag ) {
- cmp = compare (&saved, &lines.lines[i]);
-
- if ( !cmp ) {
- savedflag++;
- } else {
- if ( savedflag >= 1 ) {
- if ( !differ ) {
- if ( countr )
- fprintf(ofp, "%d\t", savedflag);
- xfwrite (saved.text, 1, saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- } else {
- if ( (differ == 1 && savedflag == 1)
- || (differ == 2 && savedflag >= 2) ) {
- xfwrite (saved.text, 1, saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
- }
-
- if ( differ == 3 ) setcnt++;
- savedflag = 0;
- }
- }
- }
-
- if ( !savedflag) {
- if (savealloc < lines.lines[i].length + 1)
- {
- while (savealloc < lines.lines[i].length + 1)
- savealloc *= 2;
- saved.text = xrealloc (saved.text, savealloc);
- }
- saved.length = lines.lines[i].length;
- memcpy (saved.text, lines.lines[i].text,
- saved.length + 1);
- if (lines.lines[i].keybeg != NULL)
- {
- saved.keybeg = saved.text +
- (lines.lines[i].keybeg - lines.lines[i].text);
- }
- if (lines.lines[i].keylim != NULL)
- {
- saved.keylim = saved.text +
- (lines.lines[i].keylim - lines.lines[i].text);
- }
-
-#ifdef SAOMOD_ASTRO
- saved.flag = lines.lines[i].flag;
- saved.value = lines.lines[i].value;
-#endif
-
- savedflag = 1;
- }
-
- if ( differ == 3 ) {
- fprintf(ofp, "%d\t", setcnt);
- xfwrite (lines.lines[i].text, 1, lines.lines[i].length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- if ( savedflag >= 2 && differ == 4 ) {
- if ( savedflag == 2 ) {
- xfwrite (saved.text, 1,
- saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
- xfwrite (lines.lines[i].text, 1, lines.lines[i].length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- }
- }
- if (tfp != ofp)
- xfclose (tfp);
- }
- xfclose (fp);
- }
-
- if (unique && savedflag)
- {
- if ( !differ && savedflag >= 1 )
- {
- if ( countr )
- fprintf(ofp, "%d\t", savedflag);
-
- xfwrite (saved.text, 1, saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- if ( (differ == 1 && savedflag == 1)
- || (differ == 2 && savedflag >= 2) ) {
- xfwrite (saved.text, 1,
- saved.length, ofp);
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) putc ('\n', ofp);
-#endif
- }
-
- free (saved.text);
- }
-
- free (buf.buf);
- free ((char *) lines.lines);
- free ((char *) tmp);
-
- if (ntemp)
- {
- tempfiles = (char **) xmalloc (ntemp * sizeof (char *));
- i = ntemp;
- for (node = temphead.next; i > 0; node = node->next)
- tempfiles[--i] = node->name;
- merge (tempfiles, ntemp, ofp);
- free ((char *) tempfiles);
- }
-}
-
-/* Insert key KEY at the end of the list (`keyhead'). */
-
-static void
-insertkey (key)
- struct keyfield *key;
-{
- struct keyfield *k = &keyhead;
-
- while (k->next)
- k = k->next;
- k->next = key;
- key->next = NULL;
-}
-
-static void
-badfieldspec (s)
- char *s;
-{
- fprintf (stderr, "invalid field specification `%s'", s);
- exit(2);
-}
-
-/* Handle interrupts and hangups. */
-
-static void
-sighandler (sig)
- int sig;
-{
-#ifdef _POSIX_VERSION
- struct sigaction sigact;
-
- sigact.sa_handler = SIG_DFL;
- sigemptyset (&sigact.sa_mask);
- sigact.sa_flags = 0;
- sigaction (sig, &sigact, NULL);
-#else /* !_POSIX_VERSION */
- signal (sig, SIG_DFL);
-#endif /* _POSIX_VERSION */
- cleanup ();
-#if HAVE_MINGW32==0
- kill (getpid (), sig);
-#else
- exit(1);
-#endif
-}
-
-/* Set the ordering options for KEY specified in S.
- Return the address of the first character in S that
- is not a valid ordering option.
- BLANKTYPE is the kind of blanks that 'b' should skip. */
-
-static char *
-set_ordering (s, key, blanktype)
- char *s;
- struct keyfield *key;
- enum blanktype blanktype;
-{
- while (*s)
- {
- switch (*s)
- {
- case 'b':
- if (blanktype == bl_start || blanktype == bl_both)
- key->skipsblanks = 1;
- if (blanktype == bl_end || blanktype == bl_both)
- key->skipeblanks = 1;
- break;
- case 'd':
- key->ignore = nondictionary;
- break;
- case 'f':
- key->translate = fold_toupper;
- break;
-#if 0
- case 'g':
- /* Reserved for comparing floating-point numbers. */
- break;
-#endif
- case 'i':
- key->ignore = nonprinting;
- break;
- case 'M':
- key->month = 1;
- break;
- case 'n':
- key->nzone = 0;
- key->numeric = 1;
- break;
-#ifdef SAOMOD_ASTRO
- case 'h':
- key->nzone = 0;
- key->numeric = 2;
- break;
-#endif
- case 'q':
- key->nzone = 0;
- key->numeric = 3;
- break;
-#ifdef SAOMOD_ASTRO
- case 'z':
- key->nzone = 1;
- key->numeric = 2;
- s++;
- key->dzone = SAOstrtod(s, &s);
- s--;
- break;
-#endif
- case 'r':
- key->reverse = 1;
- break;
- default:
- return s;
- }
- ++s;
- }
- return s;
-}
-
-int main (argc, argv)
- int argc;
- char *argv[];
-{
- struct keyfield *key = NULL, gkey;
- char *s;
- int i, t, t2;
- int checkonly = 0, mergeonly = 0, nfiles = 0;
- char *minus = "-", *outfile = minus, **files, *tmp;
- FILE *ofp;
-#ifdef _POSIX_VERSION
- struct sigaction oldact, newact;
-#endif /* _POSIX_VERSION */
-#ifdef SAOMOD_FIX
- int pipes[4];
- char *ss=NULL, *tt=NULL, *uu=NULL;
-#endif
-
- program_name = argv[0];
-
-#ifdef SAOMOD_FIX
- /* Launch() sometimes rearranges passed pipes to be stdin/stdout */
- if( (ss=getenv("LAUNCH_PIPES")) ){
- tt = (char *)strdup(ss);
- for(i=0, uu=(char *)strtok(tt, ","); i<4 && uu;
- i++, uu=(char *)strtok(NULL,",")){
- pipes[i] = atoi(uu);
- }
- if( tt ) free(tt);
- if( i < 4 ) return(1);
- close(pipes[0]);
- close(pipes[3]);
- dup2(pipes[2], 0); close(pipes[2]);
- dup2(pipes[1], 1); close(pipes[1]);
- }
-#endif
-
-#ifdef SAOMOD_FIX
- if ( (program_name = (char *)strrchr(program_name, '/')) )
- program_name++;
- else
- program_name = argv[0];
-#endif
-
-#ifdef SAOMOD_TABLE
- if ( strstr(program_name, "table") ) {
- table = 1;
- tab = '\t';
- }
-#endif
-
-#ifdef SAOMOD_FIX
- /* Ask for a stable sort
- */
- stable = 1;
-#endif
-
- have_read_stdin = 0;
- inittables ();
-
- temp_file_prefix = getenv ("TMPDIR");
- if (temp_file_prefix == NULL)
- temp_file_prefix = DEFAULT_TMPDIR;
-
-#ifdef _POSIX_VERSION
- newact.sa_handler = sighandler;
- sigemptyset (&newact.sa_mask);
- newact.sa_flags = 0;
-
- sigaction (SIGINT, NULL, &oldact);
- if (oldact.sa_handler != SIG_IGN)
- sigaction (SIGINT, &newact, NULL);
-#if HAVE_MINGW32==0
- sigaction (SIGHUP, NULL, &oldact);
- if (oldact.sa_handler != SIG_IGN)
- sigaction (SIGHUP, &newact, NULL);
- sigaction (SIGPIPE, NULL, &oldact);
- if (oldact.sa_handler != SIG_IGN)
- sigaction (SIGPIPE, &newact, NULL);
-#endif
- sigaction (SIGTERM, NULL, &oldact);
- if (oldact.sa_handler != SIG_IGN)
- sigaction (SIGTERM, &newact, NULL);
-#else /* !_POSIX_VERSION */
- if (signal (SIGINT, SIG_IGN) != SIG_IGN)
- signal (SIGINT, sighandler);
-#if HAVE_MINGW32==0
- if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
- signal (SIGHUP, sighandler);
- if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
- signal (SIGPIPE, sighandler);
-#endif
- if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
- signal (SIGTERM, sighandler);
-#endif /* !_POSIX_VERSION */
-
- gkey.sword = gkey.eword = -1;
- gkey.ignore = NULL;
- gkey.translate = NULL;
- gkey.nzone = gkey.numeric = gkey.month = gkey.reverse = 0;
- gkey.skipsblanks = gkey.skipeblanks = 0;
-
- files = (char **) xmalloc (sizeof (char *) * argc);
-
- for (i = 1; i < argc; ++i)
- {
- if( !strcasecmp(argv[1], "--help") ){
- usage(0);
- }
- if (argv[i][0] == '+')
- {
- if (key)
- insertkey (key);
- key = (struct keyfield *) xmalloc (sizeof (struct keyfield));
- key->eword = -1;
- key->ignore = NULL;
- key->translate = NULL;
- key->skipsblanks = key->skipeblanks = 0;
- key->nzone = key->numeric = key->month = key->reverse = 0;
- s = argv[i] + 1;
- if (!digits[UCHAR (*s)]) {
- switch ( *s ) {
- case 'c' :
- case 'C' :
- case 'b' :
- case 'B' :
- case 's' :
- case 'S' :
- case 'i' :
- case 'I' :
- case 'l' :
- case 'f' :
- case 'd' :
- case 't' :
-#ifdef SAOMOD_BINARY
- if ( !BinarySort ) BinarySort = -1;
-#endif
- key->btype = *s;
- s++;
-
- break;
-
- default:
- badfieldspec (argv[i]);
- }
- }
- for (t = 0; digits[UCHAR (*s)]; ++s)
- t = 10 * t + *s - '0';
- t2 = 0;
- if (*s == '.')
- for (++s; digits[UCHAR (*s)]; ++s)
- t2 = 10 * t2 + *s - '0';
- if (t2 || t)
- {
- key->sword = t;
- key->schar = t2;
- }
- else {
-#ifdef SAOMOD_BINARY
- if ( BinarySort == 0 ) {
- key->sword = -1;
- key->schar = 0;
- } else {
-#endif
- key->sword = t;
- key->schar = t2;
-#ifdef SAOMOD_BINARY
- }
-#endif
- }
- s = set_ordering (s, key, bl_start);
- if (*s)
- badfieldspec (argv[i]);
- }
- else if (argv[i][0] == '-' && argv[i][1])
- {
- s = argv[i] + 1;
- if (digits[UCHAR (*s)])
- {
- if (!key)
- usage (2);
- for (t = 0; digits[UCHAR (*s)]; ++s)
- t = t * 10 + *s - '0';
- t2 = 0;
- if (*s == '.')
- for (++s; digits[UCHAR (*s)]; ++s)
- t2 = t2 * 10 + *s - '0';
- key->eword = t;
- key->echar = t2;
- s = set_ordering (s, key, bl_end);
- if (*s)
- badfieldspec (argv[i]);
- insertkey (key);
- key = NULL;
- }
- else
- while (*s)
- {
- s = set_ordering (s, &gkey, bl_both);
- switch (*s)
- {
-#ifdef SAOMOD_BINARY
- case 'B' :
- s++;
- BinarySort = strtol(s, &s, 10);
- linelength = BinarySort;
- break;
-#endif
- case '\0':
- break;
- case 'c':
- checkonly = 1;
- break;
- case 'k':
- if (s[1])
- ++s;
- else
- {
- if (i == argc - 1){
- fprintf (stderr, "option `-k' requires an argument");
- exit(2);
- }
- else
- s = argv[++i];
- }
- if (key)
- insertkey (key);
- key = (struct keyfield *)
- xmalloc (sizeof (struct keyfield));
- key->eword = -1;
- key->echar = 0;
- key->ignore = NULL;
- key->translate = NULL;
- key->skipsblanks = key->skipeblanks = 0;
- key->nzone = key->numeric = key->month = key->reverse = 0;
- /* Get POS1. */
- if (!digits[UCHAR (*s)])
- badfieldspec (argv[i]);
- for (t = 0; digits[UCHAR (*s)]; ++s)
- t = 10 * t + *s - '0';
- if (t)
- t--;
- t2 = 0;
- if (*s == '.')
- {
- for (++s; digits[UCHAR (*s)]; ++s)
- t2 = 10 * t2 + *s - '0';
- if (t2)
- t2--;
- }
- if (t2 || t)
- {
- key->sword = t;
- key->schar = t2;
- }
- else
- key->sword = -1;
- s = set_ordering (s, key, bl_start);
- if (*s && *s != ',')
- badfieldspec (argv[i]);
- else if (*s++)
- {
- /* Get POS2. */
- for (t = 0; digits[UCHAR (*s)]; ++s)
- t = t * 10 + *s - '0';
- if (t)
- t--;
- t2 = 0;
- if (*s == '.')
- {
- for (++s; digits[UCHAR (*s)]; ++s)
- t2 = t2 * 10 + *s - '0';
- if (t2)
- t2--;
- }
- key->eword = t;
- key->echar = t2;
- s = set_ordering (s, key, bl_end);
- if (*s)
- badfieldspec (argv[i]);
- }
- insertkey (key);
- key = NULL;
- goto outer;
-#ifdef SAOMOD_TABLE
- case 'm':
- mergeonly = 1;
- if ( table ) table=2;
- break;
-#endif
- case 'o':
- if (s[1])
- outfile = s + 1;
- else
- {
- if (i == argc - 1){
- fprintf (stderr, "option `-o' requires an argument");
- exit(2);
- }
- else
- outfile = argv[++i];
- }
- goto outer;
- case 's':
- stable = 1;
- break;
- case 't':
- if (s[1])
- tab = *++s;
- else if (i < argc - 1)
- {
- tab = *argv[++i];
- goto outer;
- }
- else{
- fprintf (stderr, "option `-t' requires an argument");
- exit(2);
- }
- break;
- case 'T':
- if (s[1])
- temp_file_prefix = ++s;
- else
- {
- if (i < argc - 1)
- temp_file_prefix = argv[++i];
- else{
- fprintf (stderr, "option `-T' requires an argument");
- exit(2);
- }
- }
- goto outer;
-
- case 'u': unique = 1; differ = 0; break; /* One each only */
- case 'U': unique = 1; differ = 1; break; /* Unique lines only */
- case 'D': unique = 1; differ = 2; break; /* Duplic lines only */
- case 'A': unique = 1; differ = 4; break; /* All Duplic lines */
- case 'S': unique = 1; differ = 3; break; /* Set counter */
- case 'C': unique = 1; countr = 1; break; /* Count same lines */
- case 'y':
- /* Accept and ignore e.g. -y0 for compatibility with
- Solaris 2. */
- goto outer;
- default:
- fprintf (stderr, "%s: unrecognized option `-%c'\n",
- argv[0], *s);
- usage (2);
- }
- if (*s)
- ++s;
- }
- }
- else /* Not an option. */
- {
- files[nfiles++] = argv[i];
- }
- outer:;
- }
-
- if (key)
- insertkey (key);
-
-#ifdef SAOMOD_BINARY
- if ( BinarySort == -1 ) {
- fprintf (stderr, "No record length specified with binary file sort flags.\n");
- usage(2);
- }
- if ( BinarySort && key == NULL ) {
- fprintf (stderr, "Keys must be specified with binary file sort.\n");
- usage(2);
- }
-#endif
-
-#ifdef SAOMOD_BINARY
- /* Inheritance of global options to individual keys. */
-if ( !BinarySort ) {
- for (key = keyhead.next; key; key = key->next)
- if (!key->ignore && !key->translate && !key->skipsblanks && !key->reverse
- && !key->skipeblanks && !key->month && !key->numeric && !key->nzone)
- {
- key->ignore = gkey.ignore;
- key->translate = gkey.translate;
- key->skipsblanks = gkey.skipsblanks;
- key->skipeblanks = gkey.skipeblanks;
- key->month = gkey.month;
- key->numeric = gkey.numeric;
- key->reverse = gkey.reverse;
- key->nzone = gkey.nzone;
- key->dzone = gkey.dzone;
-
- }
-
- if (!keyhead.next && (gkey.ignore || gkey.translate || gkey.skipsblanks
- || gkey.skipeblanks || gkey.month || gkey.numeric))
- insertkey (&gkey);
-}
-#endif
-
- reverse = gkey.reverse;
-
- if (nfiles == 0)
- {
- nfiles = 1;
- files = &minus;
- }
-
- if (checkonly)
- exit (check (files, nfiles) != 0);
-
- if (strcmp (outfile, "-"))
- {
- struct stat outstat;
- if (stat (outfile, &outstat) == 0)
- {
- /* The following code prevents a race condition when
- people use the brain dead shell programming idiom:
- cat file | sort -o file
- This feature is provided for historical compatibility,
- but we strongly discourage ever relying on this in
- new shell programs. */
-
- /* Temporarily copy each input file that might be another name
- for the output file. When in doubt (e.g. a pipe), copy. */
- for (i = 0; i < nfiles; ++i)
- {
- char buf[8192];
- FILE *fp;
- int cc;
-
- if (S_ISREG (outstat.st_mode) && strcmp (outfile, files[i]))
- {
- struct stat instat;
- if ((strcmp (files[i], "-")
- ? stat (files[i], &instat)
- : fstat (fileno (stdin), &instat)) != 0)
- {
- perror (files[i]);
- cleanup ();
- exit (2);
- }
- if (S_ISREG (instat.st_mode)
- && (instat.st_ino != outstat.st_ino
- || instat.st_dev != outstat.st_dev))
- {
- /* We know the files are distinct. */
- continue;
- }
- }
-
- fp = xfopen (files[i], "r");
- tmp = tempname ();
- ofp = xfopen (tmp, "w");
- while ((cc = fread (buf, 1, sizeof buf, fp)) > 0)
- xfwrite (buf, 1, cc, ofp);
- if (ferror (fp))
- {
- fprintf (stderr, "%s", files[i]);
- cleanup ();
- exit (2);
- }
- xfclose (ofp);
- xfclose (fp);
- files[i] = tmp;
- }
- }
- ofp = xfopen (outfile, "w");
- }
- else
- ofp = stdout;
-
- if (mergeonly)
- merge (files, nfiles, ofp);
- else
- sort (files, nfiles, ofp);
- cleanup ();
-
- /* If we wait for the implicit flush on exit, and the parent process
- has closed stdout (e.g., exec >&- in a shell), then the output file
- winds up empty. I don't understand why. This is under SunOS,
- Solaris, Ultrix, and Irix. This premature fflush makes the output
- reappear. --karl@cs.umb.edu */
- if (fflush (ofp) < 0)
- perror (outfile);
-
- if (have_read_stdin && fclose (stdin) == EOF)
- perror (outfile);
- if (ferror (stdout) || fclose (stdout) == EOF)
- perror (outfile);
-
- return(0);
-}
-
-static void
-usage (status)
- int status;
-{
- if (status != 0)
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
- else
- {
- fprintf(stderr,"Usage: %s [OPTION]... [FILE]...\n", program_name);
- fprintf(stderr,"Write sorted concatenation of all FILE(s) to standard output.\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"+POS1 [-POS2] start a key at POS1, end it before POS2\n");
- fprintf(stderr,"-M compare (unknown) < `JAN' < ... < `DEC', imply -b\n");
- fprintf(stderr,"-T DIRECT use DIRECT for temporary files, not $TMPDIR or %s\n", DEFAULT_TMPDIR);
- fprintf(stderr,"-b ignore leading blanks in sort fields or keys\n");
- fprintf(stderr,"-c check if given files already sorted, do not sort\n");
- fprintf(stderr,"-d consider only [a-zA-Z0-9 ] characters in keys\n");
- fprintf(stderr,"-f fold lower case to upper case characters in keys\n");
- fprintf(stderr,"-i consider only [\\040-\\0176] characters in keys\n");
- fprintf(stderr,"-k POS1[,POS2] same as +POS1 [-POS2], but all positions counted from 1\n");
- fprintf(stderr,"-m merge already sorted files, do not sort\n");
- fprintf(stderr,"-n compare according to string numerical value, imply -b\n");
- fprintf(stderr,"-o FILE write result on FILE instead of standard output\n");
- fprintf(stderr,"-r reverse the result of comparisons\n");
- fprintf(stderr,"-s stabilize sort by disabling last resort comparison\n");
- fprintf(stderr,"-t SEP use SEParator instead of non- to whitespace transition\n");
- fprintf(stderr,"-u with -c, check for strict ordering\n");
- fprintf(stderr,"-u with -m, only output the first of an equal sequence\n");
- fprintf(stderr,"-U output only unique records.\n");
- fprintf(stderr,"-D output only duplicate records.\n");
- fprintf(stderr,"--help display this help and exit\n");
- fprintf(stderr,"--version output version information and exit\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"Binary File Options:\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"-Blen record length in bytes\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"+<type1>offset1 +<type2>.offset2 ...\n");
- fprintf(stderr,"or\n");
- fprintf(stderr,"+<type1>offset1.len1 ... (+t text data only)\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"where <type> can be:\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"c character data\n");
- fprintf(stderr,"C unsigned character data\n");
- fprintf(stderr,"b byte data\n");
- fprintf(stderr,"B unsigned byte data\n");
- fprintf(stderr,"s short data\n");
- fprintf(stderr,"S unsigned short data\n");
- fprintf(stderr,"i integer data\n");
- fprintf(stderr,"I unsigned integer data\n");
- fprintf(stderr,"f float data\n");
- fprintf(stderr,"d double data\n");
- fprintf(stderr,"t text data\n");
- fprintf(stderr,"\n");
- fprintf(stderr,"POS is F[.C][OPTS], where F is the field number and C the character\n");
- fprintf(stderr,"position in the field, both counted from zero. OPTS is made up of one\n");
- fprintf(stderr,"or more of Mbdfinr; this effectively disables global -Mbdfinr settings\n");
- fprintf(stderr,"for that key. If no key given, use the entire line as key. With no\n");
- fprintf(stderr,"FILE, or when FILE is -, read standard input.\n");
- fprintf(stderr,"\n");
- }
- exit (status);
-}
-
diff --git a/funtools/gnu/sorttest.c b/funtools/gnu/sorttest.c
deleted file mode 100644
index 5cc0ad2..0000000
--- a/funtools/gnu/sorttest.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- export EVENTS="(dval:D,fval:E,ival:J,uival:V,sval:I,cval:B,cval2:B)"
- sorttest | _funsort -B24 +... | fundisp "stdin[EVENTS()]"
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <salloc.h>
-
-extern char *optarg;
-extern int optind;
-
-#define NREC 10
-#define SZ_LINE 1024
-
-#define MAX(a,b) (((a)>(b))?(a):(b))
-
-typedef struct brec{
- double dval;
- float fval;
- int ival;
- unsigned int uival;
- short sval;
- char cval;
- char cval2;
-} Binary;
-
-void
-fillb(Binary *b, int i, int dodouble)
-{
- int idiv;
- b->dval = (double)rand();
- b->fval = (float)rand();
- if( dodouble ){
- if( (i%2) == 0 )
- b->ival = rand();
- }
- else{
- b->ival = rand();
- }
- b->uival = (unsigned)rand();
- idiv = MAX(1,(RAND_MAX/32768));
- b->sval = rand()/idiv;
- idiv = MAX(1,(RAND_MAX/128));
- b->cval = rand()/idiv;
- b->cval2 = rand()/idiv;
-}
-
-int main(int argc, char **argv)
-{
- int i;
- int c;
- int ival;
- int ichan, ochan, pid, status;
- int rlen;
- int nrec=NREC;
- int dodouble=0;
- int doxeq=0;
- char *prog="_funsort";
- char *slist=NULL;
- char *s;
- char tbuf[SZ_LINE];
- char cmd[SZ_LINE];
- FILE *fp=stdout;
- Binary b;
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "dn:s:x")) != -1){
- switch(c){
- case 'd':
- dodouble = 1;
- break;
- case 'n':
- nrec = atoi(optarg);
- break;
- case 's':
- doxeq = 1;
- slist=(char *)NewString(optarg);
- break;
- case 'x':
- doxeq = 1;
- break;
- }
- }
-
- /* see rand */
- srand(time(NULL));
-
- /* generate sort parameters and start sort program */
- if( doxeq ){
- snprintf(cmd, SZ_LINE-1, "%s -B%d %s", prog, sizeof(Binary), tbuf);
- rlen = SZ_LINE - strlen(cmd);
- if( !slist ){
- slist = (char *)NewString("d");
- }
- for(s=slist; *s; s++){
- switch(*s){
- case 'd':
- sprintf(tbuf, "+d0");
- break;
- case 'f':
- sprintf(tbuf, "+f8");
- break;
- case 'i':
- sprintf(tbuf, "+i12");
- break;
- case 'I':
- sprintf(tbuf, "+I16");
- break;
- case 's':
- sprintf(tbuf, "+s20");
- break;
- case 'c':
- sprintf(tbuf, "+c22");
- break;
- default:
- fprintf(stderr, "ERROR: unknown sort type: %s\n", s);
- exit(1);
- }
- strncat(cmd, " ", rlen);
- rlen--;
- strncat(cmd, tbuf, rlen);
- rlen -= strlen(tbuf);
- if( rlen <=0 ){
- fprintf(stderr, "ERROR: too many arguments\n");
- exit(1);
- }
- }
- if( !ProcessOpen(cmd, &ichan, &ochan, &pid) ){
- fprintf(stderr, "ERROR: can't start %s\n", prog);
- exit(1);
- }
- /* write unsorted records */
- for(i=0; i<nrec; i++){
- fillb(&b, i, dodouble);
- write(ochan, &b, sizeof(Binary));
- }
- /* signal EOF to sort program */
- close(ochan);
- while( read(ichan, &b, sizeof(Binary)) == sizeof(Binary) )
- write(1, &b, sizeof(Binary));
- if( slist ) free(slist);
- ProcessClose(pid, &status);
- }
- else{
- /* write unsorted records */
- for(i=0; i<nrec; i++){
- fillb(&b, i, dodouble);
- fwrite(&b, sizeof(Binary), 1, fp);
- }
- }
-}
diff --git a/funtools/gnu/system.h b/funtools/gnu/system.h
deleted file mode 100644
index 6ebebda..0000000
--- a/funtools/gnu/system.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* system-dependent definitions for textutils programs.
- Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Include sys/types.h before this file. */
-
-#include <sys/stat.h>
-
-#ifdef STAT_MACROS_BROKEN
-#undef S_ISBLK
-#undef S_ISCHR
-#undef S_ISDIR
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISMPB
-#undef S_ISMPC
-#undef S_ISNWK
-#undef S_ISREG
-#undef S_ISSOCK
-#endif /* STAT_MACROS_BROKEN. */
-
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-#if !defined(HAVE_MKFIFO)
-#define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
-#endif
-
-/*
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-*/
-
-#ifndef _POSIX_VERSION
-off_t lseek ();
-#endif
-
-#ifndef STDIN_FILENO
-#define STDIN_FILENO 0
-#endif
-
-#ifndef STDOUT_FILENO
-#define STDOUT_FILENO 1
-#endif
-
-#ifndef STDERR_FILENO
-#define STDERR_FILENO 2
-#endif
-
-/* Don't use bcopy! Use memmove if source and destination may overlap,
- memcpy otherwise. */
-
-#ifdef HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#else
-# include <strings.h>
-char *memchr ();
-#endif
-
-#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *getenv ();
-#endif
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-#endif
-
-#if !defined(SEEK_SET)
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-
-#ifndef _POSIX_SOURCE
-#include <sys/param.h>
-#endif
-
-/* Get or fake the disk device blocksize.
- Usually defined by sys/param.h (if at all). */
-#if !defined(DEV_BSIZE) && defined(BSIZE)
-#define DEV_BSIZE BSIZE
-#endif
-#if !defined(DEV_BSIZE) && defined(BBSIZE) /* SGI */
-#define DEV_BSIZE BBSIZE
-#endif
-#ifndef DEV_BSIZE
-#define DEV_BSIZE 4096
-#endif
-
-/* Extract or fake data from a `struct stat'.
- ST_BLKSIZE: Optimal I/O blocksize for the file, in bytes. */
-#ifndef HAVE_ST_BLKSIZE
-# define ST_BLKSIZE(statbuf) DEV_BSIZE
-#else /* HAVE_ST_BLKSIZE */
-/* Some systems, like Sequents, return st_blksize of 0 on pipes. */
-# define ST_BLKSIZE(statbuf) ((statbuf).st_blksize > 0 \
- ? (statbuf).st_blksize : DEV_BSIZE)
-#endif /* HAVE_ST_BLKSIZE */
-
-#ifndef S_ISLNK
-#define lstat stat
-#endif
-
-#ifndef RETSIGTYPE
-#define RETSIGTYPE void
-#endif
-
-#include <ctype.h>
-
-#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
-#define ISASCII(c) 1
-#else
-#define ISASCII(c) isascii(c)
-#endif
-
-#ifdef isblank
-#define ISBLANK(c) (ISASCII (c) && isblank (c))
-#else
-#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-#endif
-#ifdef isgraph
-#define ISGRAPH(c) (ISASCII (c) && isgraph (c))
-#else
-#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) (ISASCII (c) && isprint (c))
-#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
-#define ISALNUM(c) (ISASCII (c) && isalnum (c))
-#define ISALPHA(c) (ISASCII (c) && isalpha (c))
-#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
-#define ISLOWER(c) (ISASCII (c) && islower (c))
-#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
-#define ISSPACE(c) (ISASCII (c) && isspace (c))
-#define ISUPPER(c) (ISASCII (c) && isupper (c))
-#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
diff --git a/funtools/inc.sed b/funtools/inc.sed
deleted file mode 100755
index b550331..0000000
--- a/funtools/inc.sed
+++ /dev/null
@@ -1,12 +0,0 @@
-:
-NAME="$1"
-sed '
-1i\
-static char *XXXX="\\n
-
-s/"/\\"/g
-s/\\n/\\\\n/g
-s/$/\\n/
-$a\
-\"
-' | sed "s/XXXX/$NAME/" | awk '{printf("%s", $0)};END{printf(";\n")}'
diff --git a/funtools/install-sh b/funtools/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/jointable.c b/funtools/jointable.c
deleted file mode 100644
index 418d0fb..0000000
--- a/funtools/jointable.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/* join - join lines of two files on a common field
- Copyright (C) 1991, 1995 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- Written by Mike Haertel, mike@gnu.ai.mit.edu. */
-
-#include <config.h>
-
-/* Get isblank from GNU libc. */
-#define _GNU_SOURCE
-
-#include <xos.h>
-#include <xfile.h>
-#include <sys/types.h>
-#include "system.h"
-#include "version.h"
-
-#include <table.h>
-
-int table = 1;
-File ofile;
-
-char *xmalloc ();
-char *xrealloc ();
-static void usage ();
-
-#define min(A, B) ((A) < (B) ? (A) : (B))
-#define max(A, B) ((A) > (B) ? (A) : (B))
-
-/* An element of the list describing the format of each
- output line. */
-struct outlist
- {
- int file; /* File to take field from (1 or 2). */
- int field; /* Field number to print. */
- struct outlist *next;
- };
-
-/* A field of a line. */
-struct field
- {
- char *beg; /* First character in field. */
- size_t len; /* The length of the field. */
- };
-
-/* A line read from an input file. Newlines are not stored. */
-struct line
- {
- char *beg; /* First character in line. */
- char *lim; /* Character after last character in line. */
- int nfields; /* Number of elements in `fields'. */
- int nfields_allocated; /* Number of elements in `fields'. */
- struct field *fields;
- };
-
-/* One or more consecutive lines read from a file that all have the
- same join field value. */
-struct seq
- {
- int count; /* Elements used in `lines'. */
- int alloc; /* Elements allocated in `lines'. */
- struct line *lines;
- };
-
-/* The name this program was run with. */
-char *program_name;
-
-/* If nonzero, print unpairable lines in file 1 or 2. */
-static int print_unpairables_1, print_unpairables_2;
-
-/* If nonzero, print pairable lines. */
-static int print_pairables;
-
-/* Empty output field filler. */
-static char *empty_filler = NULL;
-
-/* Field to join on. */
-static int join_field_1, join_field_2;
-
-/* List of fields to print. */
-static struct outlist *outlist;
-
-/* Last element in `outlist', where a new element can be added. */
-static struct outlist *outlist_end;
-
-/* Tab character separating fields; if this is NUL fields are separated
- by any nonempty string of white space, otherwise by exactly one
- tab character. */
-static char tab = '\t';
-
-/* Used to print non-joining lines */
-static struct line uni_blank;
-static struct line blank1;
-static struct line blank2;
-
-static void
-ADD_FIELD (line, field, len)
- struct line *line;
- char *field;
- size_t len;
-{
- if (line->nfields >= line->nfields_allocated)
- {
- line->nfields_allocated = (3 * line->nfields_allocated) / 2 + 1;
- line->fields = (struct field *) xrealloc ((char *) line->fields,
- (line->nfields_allocated
- * sizeof (struct field)));
- }
- line->fields[line->nfields].beg = field;
- line->fields[line->nfields].len = len;
- ++(line->nfields);
-}
-
-/* Fill in the `fields' structure in LINE. */
-
-static void
-xfields (line)
- struct line *line;
-{
- int i;
- register char *ptr, *lim;
-
- ptr = line->beg;
- lim = line->lim;
-
- for (i = 0; ptr < lim; ++i)
- {
- if (tab)
- {
- char *beg, *end;
-
- if ( table ) while ( ptr < lim && *ptr == ' ' ) ptr++;
- beg = ptr;
- while (ptr < lim && *ptr != tab)
- ++ptr;
- if ( table ) {
- end = ptr;
- while (ptr > beg && *(ptr - 1) == ' ' ) ptr--;
- ADD_FIELD (line, beg, ptr - beg);
- ptr = end;
- } else
- ADD_FIELD (line, beg, ptr - beg);
-
- if (ptr < lim)
- ++ptr;
- }
- else
- {
- char *beg;
-
- beg = ptr;
- while (ptr < lim && !ISSPACE (*ptr))
- ++ptr;
- ADD_FIELD (line, beg, ptr - beg);
- while (ptr < lim && ISSPACE (*ptr))
- ++ptr;
- }
- }
-
- if ( !table ) {
- if (ptr > line->beg && ((tab && ISSPACE (ptr[-1])) || ptr[-1] == tab))
- {
- /* Add one more (empty) field because the last character of the
- line was a delimiter. */
- ADD_FIELD (line, NULL, 0);
- }
- } else {
- if ( ptr > line->beg && ptr[-1] == tab ) {
- ADD_FIELD (line, NULL, 0);
- }
- }
-}
-
-/* Read a line from FP into LINE and split it into fields.
- Return 0 if EOF, 1 otherwise. */
-
-int GetCh(fp)
- FILE *fp;
-{
- int c;
-
- while ( (c = getc(fp)) == '\r' ) ;
- return c;
-}
-
-static int
-get_line (fp, line)
- FILE *fp;
- struct line *line;
-{
- static int linesize = 80;
- int c, i;
- char *ptr;
-
- if (feof (fp))
- return 0;
-
- ptr = xmalloc (linesize);
-
- for (i = 0; (c = GetCh (fp)) != EOF && c != '\n'; ++i)
- {
- if (i == linesize)
- {
- linesize *= 2;
- ptr = xrealloc (ptr, linesize);
- }
- ptr[i] = c;
- }
-
- if (c == EOF && i == 0)
- {
- free (ptr);
- return 0;
- }
-
- line->beg = ptr;
- line->lim = line->beg + i;
- line->nfields_allocated = 0;
- line->nfields = 0;
- line->fields = NULL;
- xfields (line);
- return 1;
-}
-
-static void
-freeline (line)
- struct line *line;
-{
- free ((char *) line->fields);
- free (line->beg);
- line->beg = NULL;
-}
-
-static void
-initseq (seq)
- struct seq *seq;
-{
- seq->count = 0;
- seq->alloc = 1;
- seq->lines = (struct line *) xmalloc (seq->alloc * sizeof (struct line));
-}
-
-/* Read a line from FP and add it to SEQ. Return 0 if EOF, 1 otherwise. */
-
-static int
-getseq (fp, seq)
- FILE *fp;
- struct seq *seq;
-{
- if (seq->count == seq->alloc)
- {
- seq->alloc *= 2;
- seq->lines = (struct line *)
- xrealloc ((char *) seq->lines, seq->alloc * sizeof (struct line));
- }
-
- if (get_line (fp, &seq->lines[seq->count]))
- {
- ++seq->count;
- return 1;
- }
- return 0;
-}
-
-static void
-delseq (seq)
- struct seq *seq;
-{
- int i;
- for (i = 0; i < seq->count; i++)
- if (seq->lines[i].beg)
- freeline (&seq->lines[i]);
- free ((char *) seq->lines);
-}
-
-/* Return <0 if the join field in LINE1 compares less than the one in LINE2;
- >0 if it compares greater; 0 if it compares equal. */
-
-static int Numeric = 0;
-static int Reverse = 0;
-
-static int
-keycmp (line1, line2)
- struct line *line1;
- struct line *line2;
-{
- char *beg1, *beg2; /* Start of field to compare in each file. */
- int len1, len2; /* Length of fields to compare. */
- int diff;
-
- if (join_field_1 < line1->nfields)
- {
- beg1 = line1->fields[join_field_1].beg;
- len1 = line1->fields[join_field_1].len;
- }
- else
- {
- beg1 = NULL;
- len1 = 0;
- }
-
- if (join_field_2 < line2->nfields)
- {
- beg2 = line2->fields[join_field_2].beg;
- len2 = line2->fields[join_field_2].len;
- }
- else
- {
- beg2 = NULL;
- len2 = 0;
- }
-
- if (len1 == 0)
- return len2 == 0 ? 0 : -1;
- if (len2 == 0)
- return 1;
-
-#ifdef SAOMOD
- if ( Numeric ) {
- char chr1 = *(beg1 + len1);
- char chr2 = *(beg2 + len2);
-
- *(beg1+len1) = '\0';
- *(beg2+len2) = '\0';
-
- if ( *beg1 != '+' && *beg1 != '-' && !ISDIGIT(*beg1) )
-
- if ( *beg2 != '+' && *beg2 != '-' && !ISDIGIT(*beg2) )
- diff = memcmp (beg1, beg2, min(len1, len2));
- else
- diff = 1;
- else
- if ( *beg2 != '+' && *beg2 != '-' && !ISDIGIT(*beg2) )
-
- diff = -1;
- else
- if ( Numeric == 1 ) {
- double f1 = strtod(beg1, 0);
- double f2 = strtod(beg2, 0);
-
-
- diff = f1 < f2 ? -1 : (f1 == f2 ? 0 : 1);
- } else {
- double f1 = SAOstrtod(beg1, 0);
- double f2 = SAOstrtod(beg2, 0);
-
- diff = f1 < f2 ? -1 : (f1 == f2 ? 0 : 1);
- }
-
- *(beg1+len1) = chr1;
- *(beg2+len2) = chr2;
-
- } else
-#endif
- diff = memcmp (beg1, beg2, min (len1, len2));
-
- if (diff)
-#ifndef SAOMOD
- return diff;
-#else
- return Reverse ? -diff : diff;
-
- if ( Numeric ) return diff;
-#endif
-
- return len1 - len2;
-}
-
-/* Print field N of LINE if it exists and is nonempty, otherwise
- `empty_filler' if it is nonempty. */
-
-static void
-prfield (n, line)
- int n;
- struct line *line;
-{
- int len;
-
- if (n < line->nfields)
- {
- len = line->fields[n].len;
- if (len)
- fwrite (line->fields[n].beg, 1, len, ofile);
- else if (empty_filler)
- fputs (empty_filler, ofile);
- }
- else if (empty_filler)
- fputs (empty_filler, ofile);
-}
-
-/* Print the join of LINE1 and LINE2. */
-
-static void
-prjoin (line1, line2)
- struct line *line1;
- struct line *line2;
-{
- if (outlist)
- {
- struct outlist *o;
-
- prfield (outlist->field - 1, outlist->file == 1 ? line1 : line2);
- for (o = outlist->next; o; o = o->next)
- {
- putchar (tab ? tab : ' ');
- prfield (o->field - 1, o->file == 1 ? line1 : line2);
- }
- putchar ('\n');
- }
- else
- {
- int i;
-
- if ( line1 == &blank1 )
- prfield (join_field_2, line2);
- else
- prfield (join_field_1, line1);
-
- for (i = 0; i < join_field_1 && i < line1->nfields; ++i)
- {
- putchar (tab ? tab : ' ');
- prfield (i, line1);
- }
- for (i = join_field_1 + 1; i < line1->nfields; ++i)
- {
- putchar (tab ? tab : ' ');
- prfield (i, line1);
- }
-
- for (i = 0; i < join_field_2 && i < line2->nfields; ++i)
- {
- putchar (tab ? tab : ' ');
- prfield (i, line2);
- }
- for (i = join_field_2 + 1; i < line2->nfields; ++i)
- {
- putchar (tab ? tab : ' ');
- prfield (i, line2);
- }
- putchar ('\n');
- }
-}
-
-/* Print the join of the files in FP1 and FP2. */
-
-static void
-join (fp1, fp2)
- FILE *fp1;
- FILE *fp2;
-{
- struct seq seq1, seq2;
- struct line line;
- int diff, i, j, eof1, eof2;
-
- /* Read the first line of each file. */
- initseq (&seq1);
- getseq (fp1, &seq1);
- initseq (&seq2);
- getseq (fp2, &seq2);
-
- while (seq1.count && seq2.count)
- {
- diff = keycmp (&seq1.lines[0], &seq2.lines[0]);
- if (diff < 0)
- {
- if (print_unpairables_1)
- prjoin (&seq1.lines[0], &blank2);
- freeline (&seq1.lines[0]);
- seq1.count = 0;
- getseq (fp1, &seq1);
- continue;
- }
- if (diff > 0)
- {
- if (print_unpairables_2)
- prjoin (&blank1, &seq2.lines[0]);
- freeline (&seq2.lines[0]);
- seq2.count = 0;
- getseq (fp2, &seq2);
- continue;
- }
-
- /* Keep reading lines from file1 as long as they continue to
- match the current line from file2. */
- eof1 = 0;
- do
- if (!getseq (fp1, &seq1))
- {
- eof1 = 1;
- ++seq1.count;
- break;
- }
- while (!keycmp (&seq1.lines[seq1.count - 1], &seq2.lines[0]));
-
- /* Keep reading lines from file2 as long as they continue to
- match the current line from file1. */
- eof2 = 0;
- do
- if (!getseq (fp2, &seq2))
- {
- eof2 = 1;
- ++seq2.count;
- break;
- }
- while (!keycmp (&seq1.lines[0], &seq2.lines[seq2.count - 1]));
-
- if (print_pairables)
- {
- for (i = 0; i < seq1.count - 1; ++i)
- for (j = 0; j < seq2.count - 1; ++j)
- prjoin (&seq1.lines[i], &seq2.lines[j]);
- }
-
- for (i = 0; i < seq1.count - 1; ++i)
- freeline (&seq1.lines[i]);
- if (!eof1)
- {
- seq1.lines[0] = seq1.lines[seq1.count - 1];
- seq1.count = 1;
- }
- else
- seq1.count = 0;
-
- for (i = 0; i < seq2.count - 1; ++i)
- freeline (&seq2.lines[i]);
- if (!eof2)
- {
- seq2.lines[0] = seq2.lines[seq2.count - 1];
- seq2.count = 1;
- }
- else
- seq2.count = 0;
- }
-
- if (print_unpairables_1 && seq1.count)
- {
- prjoin (&seq1.lines[0], &blank2);
- freeline (&seq1.lines[0]);
- while (get_line (fp1, &line))
- {
- prjoin (&line, &blank2);
- freeline (&line);
- }
- }
-
- if (print_unpairables_2 && seq2.count)
- {
- prjoin (&blank1, &seq2.lines[0]);
- freeline (&seq2.lines[0]);
- while (get_line (fp2, &line))
- {
- prjoin (&blank1, &line);
- freeline (&line);
- }
- }
-
- delseq (&seq1);
- delseq (&seq2);
-}
-
-/* Add a field spec for field FIELD of file FILE to `outlist' and return 1,
- unless either argument is invalid; then just return 0. */
-
-static int
-add_field (file, field)
- int file;
- int field;
-{
- struct outlist *o;
-
- if (file < 1 || file > 2 || field < 1)
- return 0;
- o = (struct outlist *) xmalloc (sizeof (struct outlist));
- o->file = file;
- o->field = field;
- o->next = NULL;
-
- /* Add to the end of the list so the fields are in the right order. */
- if (outlist == NULL)
- outlist = o;
- else
- outlist_end->next = o;
- outlist_end = o;
-
- return 1;
-}
-
-/* Add the comma or blank separated field spec(s) in STR to `outlist'.
- Return the number of fields added. */
-
-static int
-add_field_list (str)
- char *str;
-{
- int added = 0;
- int file = -1, field = -1;
- int dot_found = 0;
-
- for (; *str; str++)
- {
- if (*str == ',' || ISBLANK (*str))
- {
- added += add_field (file, field);
- uni_blank.nfields = max (uni_blank.nfields, field);
- file = field = -1;
- dot_found = 0;
- }
- else if (*str == '.')
- dot_found = 1;
- else if (ISDIGIT (*str))
- {
- if (!dot_found)
- {
- if (file == -1)
- file = 0;
- file = file * 10 + *str - '0';
- }
- else
- {
- if (field == -1)
- field = 0;
- field = field * 10 + *str - '0';
- }
- }
- else
- return 0;
- }
-
- uni_blank.nfields = max (uni_blank.nfields, field);
- added += add_field (file, field);
- return added;
-}
-
-/* Create a blank line with COUNT fields separated by tabs. */
-
-void
-make_blank (blank, count)
- struct line *blank;
- int count;
-{
- int i;
- blank->nfields = count;
- blank->beg = xmalloc (blank->nfields + 1);
- blank->fields = (struct field *) xmalloc (sizeof (struct field) * count);
- for (i = 0; i < blank->nfields; i++)
- {
- blank->beg[i] = '\t';
- blank->fields[i].beg = &blank->beg[i];
- blank->fields[i].len = 0;
- }
- blank->beg[i] = '\0';
- blank->lim = &blank->beg[i];
-}
-
-char *trim();
-
-main (argc, argv)
- int argc;
- char *argv[];
-{
- char *names[2];
- FILE *fp1, *fp2;
- int i, nfiles, val;
-
- TableHead T1, T2;
-
- char *join_column1 = NULL, *join_column2 = NULL;
-
- program_name = argv[0];
- ofile = Stdout;
-
- /* Initialize this before parsing options. In parsing options,
- it may be increased. */
- uni_blank.nfields = 1;
-
- nfiles = 0;
- print_pairables = 1;
-
-for ( i = 1; i < argc; i++ ) {
- if ( argv[i][0] == '-' ) {
- switch (argv[i][1]) {
- case 'a':
- val = atoi(&argv[i][2]);
- if (val == 1)
- print_unpairables_1 = 1;
- else if (val == 2)
- print_unpairables_2 = 1;
- else {
- fprintf(stderr, "invalid file number for `-a\n");
- exit(2);
- }
- break;
-
- case 'e': empty_filler = argv[++i]; break;
-
- case '1': i++; join_column1 = argv[i]; break;
- case '2': i++; join_column2 = argv[i]; break;
-
- case 'j':
- switch ( argv[i][2] ) {
- case '1': i++; join_column1 = argv[i]; break;
- case '2': i++; join_column2 = argv[i]; break;
- default:
- i++; join_column1 = argv[i];
- join_column2 = argv[i]; break;
- };
- break;
-
- case 't': tab = argv[i][2]; break;
-
- case 'v': val = atoi(&argv[i][2]);
-
- if (val == 1)
- print_unpairables_1 = 1;
- else if (val == 2)
- print_unpairables_2 = 1;
- else {
- fprintf(stderr, "invalid file number for `-v\n");
- exit(2);
- }
- print_pairables = 0;
- break;
-
- case 'A': Numeric = 0; break;
- case 'n': Numeric = 1; break;
- case 'h': Numeric = 2; break;
- case 'r': Reverse = 1; break;
-
- case 'o' : i++;
- if ( (ofile = (!strcmp("-", argv[i]))
- ? Stdout : Open(argv[i], "w")) == NULL ) {
- FPrint(Stderr, "jointable: can't open output file: %s\n"
- , argv[i]);
- perror("jointable");
- exit(1);
- }
-
- case '?':
- usage (0);
-
- case 0:
- if (nfiles > 1)
- usage (1);
-
- names[nfiles++] = argv[i];
- break;
-
- }
- continue;
- }
- if (nfiles > 1) usage (1);
-
- names[nfiles++] = argv[i];
-}
-
- /* Now that we've seen the options, we can construct the blank line
- structure. */
- make_blank (&uni_blank, uni_blank.nfields);
-
- if (nfiles != 2)
- usage (1);
-
- fp1 = Open(names[0], "r");
- if (!fp1) {
- perror(names[0]);
- exit(2);
- }
- fp2 = Open(names[1], "r");
- if (!fp2) {
- perror(names[1]);
- exit(2);
- }
- if (fp1 == fp2) {
- fprintf(stderr, "both files cannot be standard input\n");
- exit(2);
- }
-
- if ( (T1 = table_header(fp1, 0)) == NULL ) {
- FPrint(Stderr, "jointable: can't read table header from: %s\n", names[0]);
- exit(1);
- }
- if ( (T2 = table_header(fp2, 0)) == NULL ) {
- FPrint(stderr, "jointable: can't read table header from: %s\n", names[1]);
- exit(1);
- }
-
- if ( join_column1 == NULL ) {
- FPrint(stderr, "jointable: no join column for table 1\n");
- exit(1);
- }
-
- if ( join_column2 == NULL ) {
- FPrint(stderr, "jointable: no join column for table 2\n");
- exit(1);
- }
-
- if ( !(join_field_1 = table_colnum(T1, join_column1)) ) {
- FPrint(Stderr, "jointable: can't find column: %s in file: %s\n", join_column1, names[0]);
- exit(1);
- }
- if ( !(join_field_2 = table_colnum(T2, join_column2)) ) {
- FPrint(Stderr, "jointable: can't find column: %s in file: %s\n", join_column2, names[1]);
- exit(1);
- }
-
- FPrint(ofile, "%s%c", T1->header->column[join_field_1]
- , T1->header->ncol == 1 && T2->header->ncol == 1 ? '\n' : '\t');
-
- for ( i = 1; i <= T1->header->ncol; i++ )
- /* look up column name in the other table.
- */
- if ( i != join_field_1 ) {
- int c2 = table_colnum(T2, trim(table_colval(T1->header, i)));
-
- hdrfix(ofile, table_colval(T1->header, i)
- , c2 != 0 && c2 != join_field_2 ? 1 : 0
- , i == table_ncol(T1) && T2->header->ncol == 1 ? '\n' : '\t');
- }
-
- { int lastcol = T2->header->ncol == join_field_2 ? join_field_2 - 1 : T2->header->ncol;
-
- if ( lastcol != 0 ) {
- for ( i = 1; i <= lastcol; i++ )
- if ( i != join_field_2 ) {
- int c1 = table_colnum(T1, trim(table_colval(T2->header, i)));
-
- hdrfix(ofile, table_colval(T2->header, i)
- , c1 != 0 && c1 != join_field_1 ? 2 : 0
- , i == lastcol ? '\n' : '\t');
- }
- }
- }
-
- FPrint(ofile, "%s%c", T1->dashes->column[join_field_1]
- , T1->header->ncol == 1 && T2->header->ncol == 1 ? '\n' : '\t');
- for ( i = 1; i <= table_ncol(T1); i++ )
- if ( i != join_field_1 ) FPrint(ofile, "%s%c"
- , T1->dashes->column[i]
- , i == table_ncol(T1) && T2->header->ncol == 1 ? '\n' : '\t');
- { int lastcol = T2->header->ncol == join_field_2 ? join_field_2 - 1 : T2->header->ncol;
-
- if ( lastcol != 0 ) {
- for ( i = 1; i <= lastcol; i++ )
- if ( i != join_field_2 ) FPrint(ofile, "%s%c"
- , T2->dashes->column[i]
- , i == lastcol ? '\n' : '\t');
- }
- }
-
- blank1.nfields = T1->header->ncol;
- blank2.nfields = T2->header->ncol;
-
- table_hdrfree(T1);
- table_hdrfree(T2);
-
- /* These line are moved from above so that the number of fields in a
- blank line may be set by the table headers.
- */
- /* Now that we've seen the options, we can construct the blank line
- structures. */
- make_blank(&blank1, blank1.nfields);
- make_blank(&blank2, blank2.nfields);
-
- join_field_1--;
- join_field_2--;
-
- join (fp1, fp2);
-
- if ((fp1 == stdin || fp2 == stdin) && fclose (stdin) == EOF) {
- perror("-");
- exit(2);
- }
- if (ferror (ofile) || fclose (ofile) == EOF) {
- perror("write error");
- exit(2);
- }
-
- exit (0);
-}
-
-static void
-usage (status)
- int status;
-{
- if (status != 0)
- fprintf (stderr, "jointable -? for more information.\n",
- program_name);
- else
- {
- printf ("\
-Usage: %s [OPTION]... FILE1 FILE2\n\
-",
- program_name);
- printf ("\
-For each pair of input lines with identical join fields, write a line to\n\
-standard output. The default join field is the first, delimited\n\
-by whitespace. When FILE1 or FILE2 (not both) is -, read standard input.\n\
-\n\
- -a SIDE print unpairable lines coming from file SIDE\n\
- -e EMPTY replace missing input fields with EMPTY\n\
- -j FIELD join on this FIELD for both files\n\
- -[j]SIDE FIELD join on this FIELD for file SIDE\n\
- -o FORMAT obey FORMAT while constructing output line\n\
- -t CHAR use CHAR as input and output field separator\n\
- -v SIDE like -a SIDE, but suppress joined output lines\n\
- -A ascii sort order (default)\n\
- -n numeric sort order\n\
- -h numeric sort order w/ sexagesmal format accepted\n\
-\n\
-SIDE is 1 for FILE1 or 2 for FILE2. Unless -t CHAR is given, leading blanks\n\
-separate fields and are ignored, else fields are separated by CHAR.\n\
-Any FIELD is a field number counted from 1. FORMAT is one or more\n\
-comma or blank separated specifications, each being `SIDE.FIELD'.\n\
-Default FORMAT outputs the join field, the remaining fields from\n\
-FILE1, the remaining fields from FILE2, all separated by CHAR.\n\
-");
- }
- exit (status);
-}
diff --git a/funtools/lex.calc.c b/funtools/lex.calc.c
deleted file mode 100644
index be39a61..0000000
--- a/funtools/lex.calc.c
+++ /dev/null
@@ -1,2951 +0,0 @@
-
-#line 3 "lex.calc.c"
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define yy_create_buffer calc_create_buffer
-#define yy_delete_buffer calc_delete_buffer
-#define yy_flex_debug calc_flex_debug
-#define yy_init_buffer calc_init_buffer
-#define yy_flush_buffer calc_flush_buffer
-#define yy_load_buffer_state calc_load_buffer_state
-#define yy_switch_to_buffer calc_switch_to_buffer
-#define yyin calcin
-#define yyleng calcleng
-#define yylex calclex
-#define yylineno calclineno
-#define yyout calcout
-#define yyrestart calcrestart
-#define yytext calctext
-#define yywrap calcwrap
-#define yyalloc calcalloc
-#define yyrealloc calcrealloc
-#define yyfree calcfree
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-typedef uint64_t flex_uint64_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN (yy_start) = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START (((yy_start) - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE calcrestart(calcin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#define YY_BUF_SIZE 16384
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-extern yy_size_t calcleng;
-
-extern FILE *calcin, *calcout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- #define YY_LESS_LINENO(n)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up calctext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = (yy_hold_char); \
- YY_RESTORE_YY_MORE_OFFSET \
- (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up calctext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, (calctext_ptr) )
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- yy_size_t yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via calcrestart()), so that the user can continue scanning by
- * just pointing calcin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
- ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
- : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
-
-/* yy_hold_char holds the character lost when calctext is formed. */
-static char yy_hold_char;
-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
-yy_size_t calcleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow calcwrap()'s to do buffer switches
- * instead of setting up a fresh calcin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void calcrestart (FILE *input_file );
-void calc_switch_to_buffer (YY_BUFFER_STATE new_buffer );
-YY_BUFFER_STATE calc_create_buffer (FILE *file,int size );
-void calc_delete_buffer (YY_BUFFER_STATE b );
-void calc_flush_buffer (YY_BUFFER_STATE b );
-void calcpush_buffer_state (YY_BUFFER_STATE new_buffer );
-void calcpop_buffer_state (void );
-
-static void calcensure_buffer_stack (void );
-static void calc_load_buffer_state (void );
-static void calc_init_buffer (YY_BUFFER_STATE b,FILE *file );
-
-#define YY_FLUSH_BUFFER calc_flush_buffer(YY_CURRENT_BUFFER )
-
-YY_BUFFER_STATE calc_scan_buffer (char *base,yy_size_t size );
-YY_BUFFER_STATE calc_scan_string (yyconst char *yy_str );
-YY_BUFFER_STATE calc_scan_bytes (yyconst char *bytes,yy_size_t len );
-
-void *calcalloc (yy_size_t );
-void *calcrealloc (void *,yy_size_t );
-void calcfree (void * );
-
-#define yy_new_buffer calc_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- calcensure_buffer_stack (); \
- YY_CURRENT_BUFFER_LVALUE = \
- calc_create_buffer(calcin,YY_BUF_SIZE ); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- calcensure_buffer_stack (); \
- YY_CURRENT_BUFFER_LVALUE = \
- calc_create_buffer(calcin,YY_BUF_SIZE ); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-typedef unsigned char YY_CHAR;
-
-FILE *calcin = (FILE *) 0, *calcout = (FILE *) 0;
-
-typedef int yy_state_type;
-
-extern int calclineno;
-
-int calclineno = 1;
-
-extern char calctext[];
-
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[] );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up calctext.
- */
-#define YY_DO_BEFORE_ACTION \
- (calctext_ptr) = yy_bp; \
- calcleng = (yy_size_t) (yy_cp - yy_bp); \
- (yy_hold_char) = *yy_cp; \
- *yy_cp = '\0'; \
- if ( calcleng >= YYLMAX ) \
- YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
- yy_flex_strncpy( calctext, (calctext_ptr), calcleng + 1 ); \
- (yy_c_buf_p) = yy_cp;
-
-#define YY_NUM_RULES 28
-#define YY_END_OF_BUFFER 29
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static yyconst flex_int16_t yy_accept[234] =
- { 0,
- 26, 26, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 29, 27, 26, 25, 13, 27, 6, 27,
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 26, 12, 28, 9, 8, 19, 18, 19, 15,
- 14, 23, 24, 22, 26, 0, 0, 0, 0, 0,
- 16, 6, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 26, 12, 0,
- 0, 0, 17, 22, 0, 0, 6, 0, 0, 0,
- 0, 0, 5, 0, 0, 0, 7, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 22, 4,
- 0, 0, 0, 0, 7, 0, 2, 7, 0, 0,
- 3, 20, 7, 0, 1, 0, 0, 20, 20, 0,
- 0, 0, 0, 0, 0, 20, 20, 20, 20, 0,
- 0, 0, 21, 11, 0, 20, 20, 20, 20, 20,
- 0, 0, 20, 20, 20, 20, 0, 0, 0, 0,
- 20, 11, 11, 0, 0, 0, 20, 0, 20, 20,
- 20, 20, 20, 20, 20, 0, 0, 20, 20, 20,
- 20, 0, 0, 0, 0, 10, 0, 10, 0, 20,
- 20, 20, 20, 0, 20, 20, 20, 20, 20, 20,
-
- 20, 0, 0, 20, 20, 20, 0, 0, 20, 20,
- 20, 20, 0, 20, 20, 20, 20, 20, 20, 20,
- 0, 20, 20, 20, 20, 0, 20, 20, 0, 20,
- 20, 20, 0
- } ;
-
-static yyconst flex_int32_t yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
- 1, 6, 7, 8, 9, 10, 11, 12, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14, 15, 16,
- 1, 17, 1, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 28, 29, 28, 30, 31, 32,
- 28, 33, 34, 35, 36, 37, 28, 38, 28, 28,
- 39, 1, 40, 1, 41, 1, 42, 43, 44, 45,
-
- 46, 47, 48, 49, 50, 28, 28, 51, 28, 52,
- 53, 54, 28, 55, 56, 57, 58, 59, 28, 60,
- 28, 28, 1, 1, 1, 41, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst flex_int32_t yy_meta[61] =
- { 0,
- 1, 1, 2, 1, 1, 1, 3, 1, 4, 4,
- 5, 6, 6, 7, 1, 1, 1, 1, 8, 8,
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 10, 1,
- 11, 8, 8, 8, 8, 8, 8, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
- } ;
-
-static yyconst flex_int16_t yy_base[256] =
- { 0,
- 0, 59, 0, 0, 59, 60, 62, 63, 488, 485,
- 75, 115, 480, 1005, 154, 1005, 1005, 466, 426, 47,
- 49, 108, 82, 107, 107, 109, 109, 109, 50, 108,
- 116, 65, 146, 1005, 1005, 1005, 1005, 1005, 451, 1005,
- 1005, 1005, 1005, 420, 0, 120, 118, 121, 122, 121,
- 1005, 400, 397, 129, 153, 160, 150, 148, 158, 153,
- 156, 158, 155, 171, 156, 172, 166, 95, 1005, 206,
- 190, 187, 1005, 391, 86, 383, 365, 191, 189, 188,
- 384, 202, 1005, 195, 206, 206, 1005, 208, 195, 194,
- 199, 210, 214, 228, 205, 211, 1005, 359, 218, 228,
-
- 224, 242, 234, 359, 346, 229, 238, 238, 1005, 1005,
- 247, 0, 248, 251, 1005, 245, 1005, 1005, 245, 240,
- 1005, 248, 1005, 250, 1005, 256, 258, 268, 94, 292,
- 255, 349, 260, 99, 279, 306, 270, 314, 331, 297,
- 320, 324, 1005, 329, 338, 360, 349, 334, 372, 308,
- 378, 326, 403, 296, 385, 303, 391, 395, 274, 0,
- 311, 0, 309, 361, 269, 212, 431, 389, 443, 454,
- 472, 477, 495, 510, 209, 409, 415, 531, 351, 520,
- 179, 168, 385, 539, 149, 147, 126, 93, 421, 549,
- 0, 558, 566, 435, 574, 582, 600, 605, 623, 638,
-
- 91, 448, 456, 659, 358, 1005, 62, 458, 648, 0,
- 666, 677, 481, 686, 710, 694, 737, 702, 755, 0,
- 498, 762, 0, 772, 729, 500, 780, 787, 513, 805,
- 0, 812, 1005, 838, 849, 860, 871, 882, 890, 896,
- 907, 911, 917, 926, 933, 942, 948, 954, 958, 966,
- 977, 983, 989, 993, 996
- } ;
-
-static yyconst flex_int16_t yy_def[256] =
- { 0,
- 233, 1, 234, 234, 235, 235, 236, 236, 237, 237,
- 238, 238, 233, 233, 233, 233, 233, 233, 239, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 15, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 240, 15, 233, 233, 233, 233, 233,
- 233, 239, 241, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 15, 233, 233,
- 233, 233, 233, 240, 233, 241, 241, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
-
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 242, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 243, 233, 233, 233, 233, 233, 243, 244, 233,
- 233, 233, 233, 233, 233, 244, 136, 245, 233, 233,
- 233, 233, 233, 246, 233, 244, 136, 233, 244, 247,
- 233, 233, 245, 153, 248, 233, 233, 233, 233, 249,
- 233, 246, 246, 233, 250, 251, 233, 233, 244, 136,
- 245, 153, 233, 245, 252, 233, 233, 248, 178, 253,
- 233, 233, 249, 233, 250, 250, 251, 251, 233, 244,
- 170, 244, 233, 233, 245, 153, 248, 178, 233, 248,
-
- 254, 233, 233, 253, 204, 233, 233, 233, 245, 196,
- 245, 233, 233, 248, 178, 253, 253, 233, 253, 255,
- 233, 248, 215, 248, 233, 233, 253, 253, 233, 253,
- 228, 253, 0, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233
- } ;
-
-static yyconst flex_int16_t yy_nxt[1066] =
- { 0,
- 14, 15, 16, 14, 17, 14, 14, 14, 14, 14,
- 18, 14, 14, 14, 14, 14, 14, 19, 20, 21,
- 22, 23, 24, 25, 26, 14, 27, 14, 28, 29,
- 14, 30, 14, 31, 14, 14, 14, 14, 14, 14,
- 14, 20, 21, 22, 23, 24, 25, 26, 14, 27,
- 28, 29, 14, 30, 14, 31, 14, 14, 14, 14,
- 32, 34, 34, 33, 38, 38, 68, 39, 39, 69,
- 54, 55, 65, 36, 36, 34, 42, 43, 34, 34,
- 34, 34, 42, 34, 34, 34, 34, 34, 34, 34,
- 34, 34, 34, 54, 55, 65, 68, 94, 94, 69,
-
- 134, 182, 134, 135, 180, 136, 137, 138, 135, 188,
- 136, 137, 58, 34, 34, 34, 42, 43, 34, 34,
- 34, 34, 42, 34, 34, 34, 34, 34, 34, 34,
- 34, 34, 34, 56, 58, 61, 59, 62, 63, 64,
- 66, 67, 188, 57, 60, 56, 67, 70, 58, 61,
- 186, 63, 186, 34, 34, 45, 56, 61, 59, 62,
- 63, 64, 66, 78, 67, 57, 60, 71, 56, 67,
- 58, 61, 72, 63, 46, 47, 79, 48, 80, 83,
- 49, 129, 81, 82, 84, 78, 85, 50, 86, 87,
- 71, 88, 180, 89, 90, 72, 91, 46, 47, 79,
-
- 48, 80, 83, 49, 81, 82, 84, 70, 85, 50,
- 86, 87, 92, 95, 88, 89, 93, 90, 91, 96,
- 97, 99, 155, 100, 101, 102, 103, 71, 188, 104,
- 105, 106, 72, 107, 108, 92, 95, 110, 93, 94,
- 94, 96, 97, 111, 99, 100, 113, 101, 102, 103,
- 71, 104, 105, 106, 114, 72, 107, 108, 115, 110,
- 116, 129, 117, 118, 119, 111, 120, 109, 113, 121,
- 123, 124, 186, 125, 126, 127, 131, 114, 132, 133,
- 115, 129, 145, 116, 117, 118, 130, 119, 120, 143,
- 146, 146, 121, 123, 124, 125, 126, 127, 140, 131,
-
- 140, 132, 133, 141, 142, 145, 130, 139, 157, 158,
- 163, 143, 233, 182, 233, 147, 155, 137, 137, 138,
- 151, 138, 151, 152, 129, 153, 154, 155, 148, 139,
- 163, 142, 142, 156, 149, 142, 142, 171, 171, 164,
- 168, 165, 168, 150, 138, 169, 169, 138, 159, 184,
- 144, 148, 159, 166, 98, 156, 149, 160, 233, 161,
- 146, 146, 164, 161, 165, 150, 233, 98, 233, 233,
- 159, 146, 146, 138, 159, 112, 166, 139, 233, 160,
- 233, 233, 167, 233, 233, 138, 139, 152, 181, 153,
- 154, 176, 98, 176, 177, 206, 178, 179, 180, 139,
-
- 169, 169, 158, 158, 77, 167, 158, 158, 139, 233,
- 181, 233, 172, 207, 154, 154, 155, 206, 177, 159,
- 178, 179, 77, 159, 182, 173, 197, 197, 160, 75,
- 182, 174, 190, 190, 182, 207, 77, 189, 53, 189,
- 175, 159, 190, 190, 138, 159, 195, 195, 173, 233,
- 160, 233, 233, 174, 169, 169, 138, 203, 75, 204,
- 205, 73, 175, 233, 53, 170, 170, 216, 216, 209,
- 209, 51, 191, 191, 191, 191, 191, 191, 233, 233,
- 233, 233, 192, 171, 171, 155, 233, 41, 171, 171,
- 41, 139, 214, 214, 193, 191, 191, 191, 191, 191,
-
- 191, 194, 233, 194, 192, 156, 195, 195, 155, 222,
- 222, 227, 227, 139, 156, 233, 233, 193, 233, 233,
- 233, 233, 233, 155, 230, 230, 202, 156, 202, 203,
- 233, 204, 205, 233, 233, 233, 156, 233, 233, 233,
- 198, 233, 179, 179, 180, 140, 233, 140, 233, 233,
- 157, 158, 233, 199, 233, 233, 233, 233, 233, 200,
- 190, 190, 138, 233, 233, 233, 233, 233, 201, 233,
- 233, 138, 208, 233, 208, 233, 199, 209, 209, 155,
- 233, 200, 233, 233, 233, 195, 195, 155, 233, 233,
- 201, 233, 233, 196, 196, 233, 233, 233, 233, 233,
-
- 210, 210, 210, 210, 210, 210, 233, 233, 233, 233,
- 211, 197, 197, 180, 233, 233, 197, 197, 233, 156,
- 233, 233, 212, 210, 210, 210, 210, 210, 210, 213,
- 233, 213, 211, 181, 214, 214, 180, 233, 233, 233,
- 233, 156, 181, 233, 233, 212, 233, 233, 233, 233,
- 233, 180, 233, 233, 233, 181, 233, 233, 233, 209,
- 209, 155, 233, 233, 181, 233, 233, 233, 217, 233,
- 205, 205, 233, 233, 233, 233, 233, 233, 233, 155,
- 233, 218, 233, 221, 233, 221, 233, 219, 222, 222,
- 180, 233, 233, 233, 233, 233, 220, 214, 214, 180,
-
- 233, 233, 233, 233, 218, 216, 216, 233, 226, 219,
- 226, 233, 233, 227, 227, 233, 225, 233, 220, 233,
- 233, 215, 215, 233, 233, 233, 233, 233, 223, 223,
- 223, 223, 223, 223, 233, 229, 233, 229, 224, 225,
- 230, 230, 233, 233, 233, 233, 233, 181, 216, 216,
- 233, 223, 223, 223, 223, 223, 223, 233, 233, 218,
- 224, 233, 233, 233, 233, 233, 233, 233, 233, 181,
- 233, 233, 233, 222, 222, 180, 233, 233, 233, 233,
- 233, 233, 218, 233, 233, 180, 233, 233, 233, 233,
- 233, 227, 227, 233, 233, 233, 233, 233, 228, 228,
-
- 233, 233, 233, 233, 233, 231, 231, 231, 231, 231,
- 231, 233, 233, 233, 233, 232, 230, 230, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 231, 231,
- 231, 231, 231, 231, 233, 233, 233, 232, 34, 34,
- 34, 34, 34, 34, 34, 34, 34, 34, 34, 35,
- 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 52, 52, 52, 233, 52, 52, 52,
-
- 52, 74, 233, 74, 74, 74, 74, 76, 233, 76,
- 76, 76, 76, 76, 76, 76, 76, 76, 122, 122,
- 233, 122, 128, 128, 128, 128, 128, 128, 139, 139,
- 233, 139, 139, 139, 139, 156, 156, 233, 156, 156,
- 156, 156, 162, 233, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 170, 170, 170, 181, 181, 233, 181,
- 181, 181, 181, 183, 233, 183, 185, 233, 185, 185,
- 185, 185, 185, 185, 185, 185, 185, 187, 233, 187,
- 187, 187, 187, 187, 187, 187, 187, 187, 196, 196,
- 196, 206, 206, 233, 206, 233, 206, 206, 215, 215,
-
- 215, 228, 233, 228, 13, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233
- } ;
-
-static yyconst flex_int16_t yy_chk[1066] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 5, 6, 2, 7, 8, 32, 7, 8, 32,
- 20, 21, 29, 5, 6, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 20, 21, 29, 68, 75, 75, 68,
-
- 129, 207, 129, 129, 201, 129, 129, 129, 134, 188,
- 134, 134, 23, 11, 11, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 22, 23, 25, 24, 26, 27, 28,
- 30, 31, 187, 22, 24, 46, 50, 33, 47, 48,
- 186, 49, 185, 12, 12, 15, 22, 25, 24, 26,
- 27, 28, 30, 54, 31, 22, 24, 33, 46, 50,
- 47, 48, 33, 49, 15, 15, 55, 15, 56, 59,
- 15, 182, 57, 58, 60, 54, 61, 15, 62, 63,
- 33, 64, 181, 65, 66, 33, 67, 15, 15, 55,
-
- 15, 56, 59, 15, 57, 58, 60, 70, 61, 15,
- 62, 63, 71, 78, 64, 65, 72, 66, 67, 79,
- 80, 82, 175, 84, 85, 86, 88, 70, 166, 89,
- 90, 91, 70, 92, 93, 71, 78, 95, 72, 94,
- 94, 79, 80, 96, 82, 84, 99, 85, 86, 88,
- 70, 89, 90, 91, 100, 70, 92, 93, 101, 95,
- 102, 122, 103, 106, 107, 96, 108, 94, 99, 111,
- 113, 114, 165, 116, 119, 120, 124, 100, 126, 127,
- 101, 128, 133, 102, 103, 106, 122, 107, 108, 131,
- 135, 135, 111, 113, 114, 116, 119, 120, 130, 124,
-
- 130, 126, 127, 130, 130, 133, 128, 137, 140, 140,
- 163, 131, 136, 159, 136, 136, 156, 136, 136, 136,
- 138, 150, 138, 138, 161, 138, 138, 138, 136, 137,
- 144, 141, 141, 154, 136, 142, 142, 152, 152, 145,
- 148, 145, 148, 136, 139, 148, 148, 148, 141, 161,
- 132, 136, 142, 145, 105, 154, 136, 141, 147, 141,
- 147, 147, 164, 142, 164, 136, 146, 104, 146, 146,
- 141, 146, 146, 146, 142, 98, 164, 147, 149, 141,
- 149, 149, 146, 149, 149, 149, 147, 151, 179, 151,
- 151, 155, 81, 155, 155, 205, 155, 155, 155, 147,
-
- 168, 168, 157, 157, 77, 146, 158, 158, 147, 153,
- 179, 153, 153, 183, 153, 153, 153, 205, 176, 157,
- 176, 176, 76, 158, 183, 153, 177, 177, 157, 74,
- 157, 153, 189, 189, 158, 183, 53, 167, 52, 167,
- 153, 157, 167, 167, 167, 158, 194, 194, 153, 169,
- 157, 169, 169, 153, 169, 169, 169, 202, 44, 202,
- 202, 39, 153, 170, 19, 170, 170, 203, 203, 208,
- 208, 18, 170, 170, 170, 170, 170, 170, 171, 13,
- 171, 171, 170, 171, 171, 171, 172, 10, 172, 172,
- 9, 170, 213, 213, 171, 170, 170, 170, 170, 170,
-
- 170, 173, 0, 173, 170, 172, 173, 173, 173, 221,
- 221, 226, 226, 170, 172, 0, 174, 171, 174, 174,
- 0, 174, 174, 174, 229, 229, 180, 172, 180, 180,
- 0, 180, 180, 0, 0, 0, 172, 178, 0, 178,
- 178, 0, 178, 178, 178, 184, 0, 184, 0, 0,
- 184, 184, 0, 178, 0, 190, 0, 190, 190, 178,
- 190, 190, 190, 0, 192, 0, 192, 192, 178, 192,
- 192, 192, 193, 0, 193, 0, 178, 193, 193, 193,
- 195, 178, 195, 195, 0, 195, 195, 195, 0, 0,
- 178, 196, 0, 196, 196, 0, 0, 0, 0, 0,
-
- 196, 196, 196, 196, 196, 196, 197, 0, 197, 197,
- 196, 197, 197, 197, 198, 0, 198, 198, 0, 196,
- 0, 0, 197, 196, 196, 196, 196, 196, 196, 199,
- 0, 199, 196, 198, 199, 199, 199, 0, 0, 0,
- 0, 196, 198, 0, 200, 197, 200, 200, 0, 200,
- 200, 200, 0, 0, 209, 198, 209, 209, 0, 209,
- 209, 209, 0, 0, 198, 204, 0, 204, 204, 0,
- 204, 204, 211, 0, 211, 211, 0, 211, 211, 211,
- 0, 204, 0, 212, 0, 212, 0, 204, 212, 212,
- 212, 0, 214, 0, 214, 214, 204, 214, 214, 214,
-
- 216, 0, 216, 216, 204, 216, 216, 0, 218, 204,
- 218, 0, 0, 218, 218, 0, 216, 0, 204, 215,
- 0, 215, 215, 0, 0, 0, 0, 0, 215, 215,
- 215, 215, 215, 215, 0, 225, 0, 225, 215, 216,
- 225, 225, 0, 217, 0, 217, 217, 215, 217, 217,
- 0, 215, 215, 215, 215, 215, 215, 0, 0, 217,
- 215, 219, 0, 219, 219, 0, 219, 219, 222, 215,
- 222, 222, 0, 222, 222, 222, 0, 0, 224, 0,
- 224, 224, 217, 224, 224, 224, 227, 0, 227, 227,
- 0, 227, 227, 228, 0, 228, 228, 0, 228, 228,
-
- 0, 0, 0, 0, 0, 228, 228, 228, 228, 228,
- 228, 230, 0, 230, 230, 228, 230, 230, 232, 0,
- 232, 232, 0, 232, 232, 0, 0, 0, 228, 228,
- 228, 228, 228, 228, 0, 0, 0, 228, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234, 234, 235,
- 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
- 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
- 236, 237, 237, 237, 237, 237, 237, 237, 237, 237,
- 237, 237, 238, 238, 238, 238, 238, 238, 238, 238,
- 238, 238, 238, 239, 239, 239, 0, 239, 239, 239,
-
- 239, 240, 0, 240, 240, 240, 240, 241, 0, 241,
- 241, 241, 241, 241, 241, 241, 241, 241, 242, 242,
- 0, 242, 243, 243, 243, 243, 243, 243, 244, 244,
- 0, 244, 244, 244, 244, 245, 245, 0, 245, 245,
- 245, 245, 246, 0, 246, 246, 246, 246, 246, 246,
- 246, 246, 246, 247, 247, 247, 248, 248, 0, 248,
- 248, 248, 248, 249, 0, 249, 250, 0, 250, 250,
- 250, 250, 250, 250, 250, 250, 250, 251, 0, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 252, 252,
- 252, 253, 253, 0, 253, 0, 253, 253, 254, 254,
-
- 254, 255, 0, 255, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233
- } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-extern int calc_flex_debug;
-int calc_flex_debug = 0;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#ifndef YYLMAX
-#define YYLMAX 8192
-#endif
-
-char calctext[YYLMAX];
-char *calctext_ptr;
-#line 1 "calc.l"
-#line 5 "calc.l"
-#include <ctype.h>
-#include <funtoolsP.h>
-#include <macro.h>
-#include <calc.h>
-#include <tabcalc_c.h>
-
-/* define the types of event records we have to handle */
-#define REC_CUR 1
-#define REC_PREV 2
-#define REC_NEXT 4
-
-/* misc */
-#define MAX_INCLUDE_DEPTH 100
-#define SEGINC 1024
-#define MAXCODE 4
-
-/* symbols for each column we encounter */
-typedef struct calccoltab {
- struct calccoltab *next;
- char *name;
- char *sname;
- char *cname;
- char *tdim;
- int type;
- int n;
- double tlmin;
- double tlmax;
- double binsiz;
- double tscale;
- double tzero;
- int scaled;
- int exists;
- int settype;
-} *CalcCols, CalcColRec;
-
-static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
-static int include_stack_ptr = 0;
-static Fun ifun;
-static CalcCols columns;
-static int laststart;
-
-static char *prog;
-static char *command;
-static char *autodeclare;
-static char *mbuf;
-static int mlen;
-static int n;
-static int var;
-static int rectype;
-static int args;
-static int doreplace=0;
-
-static char *code[MAXCODE];
-static char *expr;
-static char **strptr=&expr;
-static int ncode[MAXCODE];
-static int nexpr;
-static int xnl;
-static int *lenptr=&nexpr;
-
-static void setn _PRx((int newn));
-static char *_CalcMake _PRx((void));
-static int _CalcColProc _PRx((char *s, int expl));
-static int _CalcColName _PRx((char *sname));
-static CalcCols _CalcColNew _PRx((Fun fun,
- char *name, char *sname, char *cname,
- int type, int n,
- double tlmin, double tlmax, double binsiz,
- double tscale, double tzero, int scaled,
- int exists, int settype));
-static CalcCols _CalcColLookup _PRx((char *cname));
-
-int _calcerror _PRx((char *msg));
-
-
-
-
-
-#line 871 "lex.calc.c"
-
-#define INITIAL 0
-#define INCLUDE 1
-#define VAR 2
-#define COM 3
-#define XCOM 4
-#define ECOL 5
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-static int yy_init_globals (void );
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int calclex_destroy (void );
-
-int calcget_debug (void );
-
-void calcset_debug (int debug_flag );
-
-YY_EXTRA_TYPE calcget_extra (void );
-
-void calcset_extra (YY_EXTRA_TYPE user_defined );
-
-FILE *calcget_in (void );
-
-void calcset_in (FILE * in_str );
-
-FILE *calcget_out (void );
-
-void calcset_out (FILE * out_str );
-
-yy_size_t calcget_leng (void );
-
-char *calcget_text (void );
-
-int calcget_lineno (void );
-
-void calcset_lineno (int line_number );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int calcwrap (void );
-#else
-extern int calcwrap (void );
-#endif
-#endif
-
- static void yyunput (int c,char *buf_ptr );
-
-#ifndef calctext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (void );
-#else
-static int input (void );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO fwrite( calctext, calcleng, 1, calcout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- yy_size_t n; \
- for ( n = 0; n < max_size && \
- (c = getc( calcin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( calcin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = fread(buf, 1, max_size, calcin))==0 && ferror(calcin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(calcin); \
- } \
- }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int calclex (void);
-
-#define YY_DECL int calclex (void)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after calctext and calcleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- if ( calcleng > 0 ) \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
- (calctext[calcleng - 1] == '\n'); \
- YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-#line 109 "calc.l"
-
-
-#line 1064 "lex.calc.c"
-
- if ( !(yy_init) )
- {
- (yy_init) = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! (yy_start) )
- (yy_start) = 1; /* first start state */
-
- if ( ! calcin )
- calcin = stdin;
-
- if ( ! calcout )
- calcout = stdout;
-
- if ( ! YY_CURRENT_BUFFER ) {
- calcensure_buffer_stack ();
- YY_CURRENT_BUFFER_LVALUE =
- calc_create_buffer(calcin,YY_BUF_SIZE );
- }
-
- calc_load_buffer_state( );
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = (yy_c_buf_p);
-
- /* Support of calctext. */
- *yy_cp = (yy_hold_char);
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = (yy_start);
- yy_current_state += YY_AT_BOL();
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- (yy_last_accepting_state) = yy_current_state;
- (yy_last_accepting_cpos) = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 234 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 1005 );
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = (yy_last_accepting_cpos);
- yy_current_state = (yy_last_accepting_state);
- yy_act = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
-do_action: /* This label is used only to access EOF actions. */
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = (yy_hold_char);
- yy_cp = (yy_last_accepting_cpos);
- yy_current_state = (yy_last_accepting_state);
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 111 "calc.l"
-{ setn(0); var = 0; }
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 112 "calc.l"
-{ setn(1); var = 0; }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 113 "calc.l"
-{ setn(2); var = 0; }
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 114 "calc.l"
-{ setn(3); var = 0; }
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 115 "calc.l"
-{ setn(-1); var = 0; }
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 117 "calc.l"
-{
- char *s;
- if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
- _calcerror("include files are nested too deeply");
- if( !(s = (char *)FileContents(calctext+1, 0, NULL)) )
- _calcerror("can't access include file");
- else {
- include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
- BEGIN INITIAL; calc_scan_string(s); BEGIN INITIAL;
- if( s ) xfree(s);
- }
-}
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 130 "calc.l"
-{
- if( var ){ BEGIN VAR; setn(1); }
- _CalcCat(calctext, strptr, lenptr);
-}
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 134 "calc.l"
-{
- _CalcCat(calctext, strptr, lenptr);
- _CalcCat("\n", strptr, lenptr);
- if( var ){ BEGIN INITIAL; setn(-1); }
-}
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 139 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 141 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 143 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 145 "calc.l"
-{ laststart = YY_START; xnl=0; BEGIN XCOM; }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 146 "calc.l"
-{ laststart = YY_START; xnl=1; BEGIN XCOM; }
- YY_BREAK
-case 14:
-/* rule 14 can match eol */
-YY_RULE_SETUP
-#line 147 "calc.l"
-{ BEGIN laststart; if( xnl ) unput('\n'); }
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 148 "calc.l"
-{ /* ignore comments up to eol */ ; }
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 150 "calc.l"
-{
- _CalcCat(calctext, strptr, lenptr);
- laststart = YY_START; BEGIN COM;
-}
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 154 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); BEGIN laststart; }
- YY_BREAK
-case 18:
-/* rule 18 can match eol */
-YY_RULE_SETUP
-#line 155 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); }
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 156 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); }
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 158 "calc.l"
-{ _CalcColProc(calctext, 0); var=0;}
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 160 "calc.l"
-{ laststart = YY_START; BEGIN ECOL; }
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 161 "calc.l"
-{ _CalcColProc(calctext, 1); var=0; }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 162 "calc.l"
-{ ; }
- YY_BREAK
-case 24:
-/* rule 24 can match eol */
-YY_RULE_SETUP
-#line 163 "calc.l"
-{ BEGIN laststart; }
- YY_BREAK
-case 25:
-/* rule 25 can match eol */
-YY_RULE_SETUP
-#line 165 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr);}
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 167 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr);}
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 169 "calc.l"
-{ _CalcCat(calctext, strptr, lenptr); var=0;}
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(INCLUDE):
-case YY_STATE_EOF(VAR):
-case YY_STATE_EOF(COM):
-case YY_STATE_EOF(XCOM):
-case YY_STATE_EOF(ECOL):
-#line 171 "calc.l"
-{
- if ( --include_stack_ptr < 0 ){
- prog = _CalcMake();
- calc_delete_buffer(YY_CURRENT_BUFFER );
- yyterminate();
- } else {
- calc_delete_buffer(YY_CURRENT_BUFFER );
- calc_switch_to_buffer(include_stack[include_stack_ptr] );
- }
-}
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 182 "calc.l"
-ECHO;
- YY_BREAK
-#line 1331 "lex.calc.c"
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - (calctext_ptr)) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = (yy_hold_char);
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed calcin at a new source and called
- * calclex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = calcin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- (yy_c_buf_p) = (calctext_ptr) + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = (calctext_ptr) + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++(yy_c_buf_p);
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = (yy_c_buf_p);
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- (yy_did_buffer_switch_on_eof) = 0;
-
- if ( calcwrap( ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * calctext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- (yy_c_buf_p) = (calctext_ptr) + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! (yy_did_buffer_switch_on_eof) )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- (yy_c_buf_p) =
- (calctext_ptr) + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( );
-
- yy_cp = (yy_c_buf_p);
- yy_bp = (calctext_ptr) + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- (yy_c_buf_p) =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
- yy_current_state = yy_get_previous_state( );
-
- yy_cp = (yy_c_buf_p);
- yy_bp = (calctext_ptr) + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
-} /* end of calclex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (void)
-{
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = (calctext_ptr);
- register int number_to_move, i;
- int ret_val;
-
- if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( (yy_c_buf_p) - (calctext_ptr) - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) ((yy_c_buf_p) - (calctext_ptr)) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
- else
- {
- yy_size_t num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
- int yy_c_buf_p_offset =
- (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- yy_size_t new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- calcrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- if ( (yy_n_chars) == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- calcrestart(calcin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) calcrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
-
- (yy_n_chars) += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
- (calctext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
- static yy_state_type yy_get_previous_state (void)
-{
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = (yy_start);
- yy_current_state += YY_AT_BOL();
-
- for ( yy_cp = (calctext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- (yy_last_accepting_state) = yy_current_state;
- (yy_last_accepting_cpos) = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 234 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
-{
- register int yy_is_jam;
- register char *yy_cp = (yy_c_buf_p);
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- (yy_last_accepting_state) = yy_current_state;
- (yy_last_accepting_cpos) = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 234 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 233);
-
- return yy_is_jam ? 0 : yy_current_state;
-}
-
- static void yyunput (int c, register char * yy_bp )
-{
- register char *yy_cp;
-
- yy_cp = (yy_c_buf_p);
-
- /* undo effects of setting up calctext */
- *yy_cp = (yy_hold_char);
-
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register yy_size_t number_to_move = (yy_n_chars) + 2;
- register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
- register char *source =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
- while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
- (calctext_ptr) = yy_bp;
- (yy_hold_char) = *yy_cp;
- (yy_c_buf_p) = yy_cp;
-}
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
- static int yyinput (void)
-#else
- static int input (void)
-#endif
-
-{
- int c;
-
- *(yy_c_buf_p) = (yy_hold_char);
-
- if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
- /* This was really a NUL. */
- *(yy_c_buf_p) = '\0';
-
- else
- { /* need more input */
- yy_size_t offset = (yy_c_buf_p) - (calctext_ptr);
- ++(yy_c_buf_p);
-
- switch ( yy_get_next_buffer( ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- calcrestart(calcin );
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( calcwrap( ) )
- return 0;
-
- if ( ! (yy_did_buffer_switch_on_eof) )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- (yy_c_buf_p) = (calctext_ptr) + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
- *(yy_c_buf_p) = '\0'; /* preserve calctext */
- (yy_hold_char) = *++(yy_c_buf_p);
-
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
-
- return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- *
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void calcrestart (FILE * input_file )
-{
-
- if ( ! YY_CURRENT_BUFFER ){
- calcensure_buffer_stack ();
- YY_CURRENT_BUFFER_LVALUE =
- calc_create_buffer(calcin,YY_BUF_SIZE );
- }
-
- calc_init_buffer(YY_CURRENT_BUFFER,input_file );
- calc_load_buffer_state( );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- *
- */
- void calc_switch_to_buffer (YY_BUFFER_STATE new_buffer )
-{
-
- /* TODO. We should be able to replace this entire function body
- * with
- * calcpop_buffer_state();
- * calcpush_buffer_state(new_buffer);
- */
- calcensure_buffer_stack ();
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *(yy_c_buf_p) = (yy_hold_char);
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- calc_load_buffer_state( );
-
- /* We don't actually know whether we did this switch during
- * EOF (calcwrap()) processing, but the only time this flag
- * is looked at is after calcwrap() is called, so it's safe
- * to go ahead and always set it.
- */
- (yy_did_buffer_switch_on_eof) = 1;
-}
-
-static void calc_load_buffer_state (void)
-{
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- (calctext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- calcin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- (yy_hold_char) = *(yy_c_buf_p);
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE calc_create_buffer (FILE * file, int size )
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) calcalloc(sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in calc_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) calcalloc(b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in calc_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- calc_init_buffer(b,file );
-
- return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with calc_create_buffer()
- *
- */
- void calc_delete_buffer (YY_BUFFER_STATE b )
-{
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- calcfree((void *) b->yy_ch_buf );
-
- calcfree((void *) b );
-}
-
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a calcrestart() or at EOF.
- */
- static void calc_init_buffer (YY_BUFFER_STATE b, FILE * file )
-
-{
- int oerrno = errno;
-
- calc_flush_buffer(b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then calc_init_buffer was _probably_
- * called from calcrestart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
- */
- void calc_flush_buffer (YY_BUFFER_STATE b )
-{
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- calc_load_buffer_state( );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- *
- */
-void calcpush_buffer_state (YY_BUFFER_STATE new_buffer )
-{
- if (new_buffer == NULL)
- return;
-
- calcensure_buffer_stack();
-
- /* This block is copied from calc_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *(yy_c_buf_p) = (yy_hold_char);
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- (yy_buffer_stack_top)++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from calc_switch_to_buffer. */
- calc_load_buffer_state( );
- (yy_did_buffer_switch_on_eof) = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- *
- */
-void calcpop_buffer_state (void)
-{
- if (!YY_CURRENT_BUFFER)
- return;
-
- calc_delete_buffer(YY_CURRENT_BUFFER );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if ((yy_buffer_stack_top) > 0)
- --(yy_buffer_stack_top);
-
- if (YY_CURRENT_BUFFER) {
- calc_load_buffer_state( );
- (yy_did_buffer_switch_on_eof) = 1;
- }
-}
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void calcensure_buffer_stack (void)
-{
- yy_size_t num_to_alloc;
-
- if (!(yy_buffer_stack)) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1;
- (yy_buffer_stack) = (struct yy_buffer_state**)calcalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- );
- if ( ! (yy_buffer_stack) )
- YY_FATAL_ERROR( "out of dynamic memory in calcensure_buffer_stack()" );
-
- memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- (yy_buffer_stack_max) = num_to_alloc;
- (yy_buffer_stack_top) = 0;
- return;
- }
-
- if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = (yy_buffer_stack_max) + grow_size;
- (yy_buffer_stack) = (struct yy_buffer_state**)calcrealloc
- ((yy_buffer_stack),
- num_to_alloc * sizeof(struct yy_buffer_state*)
- );
- if ( ! (yy_buffer_stack) )
- YY_FATAL_ERROR( "out of dynamic memory in calcensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
- (yy_buffer_stack_max) = num_to_alloc;
- }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- *
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE calc_scan_buffer (char * base, yy_size_t size )
-{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) calcalloc(sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in calc_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- calc_switch_to_buffer(b );
-
- return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to calclex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- *
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * calc_scan_bytes() instead.
- */
-YY_BUFFER_STATE calc_scan_string (yyconst char * yystr )
-{
-
- return calc_scan_bytes(yystr,strlen(yystr) );
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to calclex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
- *
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE calc_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
-{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n, i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) calcalloc(n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in calc_scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = calc_scan_buffer(buf,n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in calc_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yy_fatal_error (yyconst char* msg )
-{
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up calctext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- calctext[calcleng] = (yy_hold_char); \
- (yy_c_buf_p) = calctext + yyless_macro_arg; \
- (yy_hold_char) = *(yy_c_buf_p); \
- *(yy_c_buf_p) = '\0'; \
- calcleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-/* Accessor methods (get/set functions) to struct members. */
-
-/** Get the current line number.
- *
- */
-int calcget_lineno (void)
-{
-
- return calclineno;
-}
-
-/** Get the input stream.
- *
- */
-FILE *calcget_in (void)
-{
- return calcin;
-}
-
-/** Get the output stream.
- *
- */
-FILE *calcget_out (void)
-{
- return calcout;
-}
-
-/** Get the length of the current token.
- *
- */
-yy_size_t calcget_leng (void)
-{
- return calcleng;
-}
-
-/** Get the current token.
- *
- */
-
-char *calcget_text (void)
-{
- return calctext;
-}
-
-/** Set the current line number.
- * @param line_number
- *
- */
-void calcset_lineno (int line_number )
-{
-
- calclineno = line_number;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- *
- * @see calc_switch_to_buffer
- */
-void calcset_in (FILE * in_str )
-{
- calcin = in_str ;
-}
-
-void calcset_out (FILE * out_str )
-{
- calcout = out_str ;
-}
-
-int calcget_debug (void)
-{
- return calc_flex_debug;
-}
-
-void calcset_debug (int bdebug )
-{
- calc_flex_debug = bdebug ;
-}
-
-static int yy_init_globals (void)
-{
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from calclex_destroy(), so don't allocate here.
- */
-
- (yy_buffer_stack) = 0;
- (yy_buffer_stack_top) = 0;
- (yy_buffer_stack_max) = 0;
- (yy_c_buf_p) = (char *) 0;
- (yy_init) = 0;
- (yy_start) = 0;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- calcin = stdin;
- calcout = stdout;
-#else
- calcin = (FILE *) 0;
- calcout = (FILE *) 0;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * calclex_init()
- */
- return 0;
-}
-
-/* calclex_destroy is for both reentrant and non-reentrant scanners. */
-int calclex_destroy (void)
-{
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- calc_delete_buffer(YY_CURRENT_BUFFER );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- calcpop_buffer_state();
- }
-
- /* Destroy the stack itself. */
- calcfree((yy_buffer_stack) );
- (yy_buffer_stack) = NULL;
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * calclex() is called, initialization will occur. */
- yy_init_globals( );
-
- return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef calctext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
-{
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
-{
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-void *calcalloc (yy_size_t size )
-{
- return (void *) malloc( size );
-}
-
-void *calcrealloc (void * ptr, yy_size_t size )
-{
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
-}
-
-void calcfree (void * ptr )
-{
- free( (char *) ptr ); /* see calcrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 182 "calc.l"
-
-
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-/* setn -- set pointer to where expression is stored */
-#ifdef YY_USE_PROTOS
-static void setn(int newn)
-#else
-static void setn(newn)
- int newn;
-#endif
-{
- if( newn >=0 ){
- n = newn;
- strptr = &code[n]; lenptr = &ncode[n];
- }
- else{
- strptr = &expr; lenptr = &nexpr;
- }
-}
-
-/*
- *
- * _CalcDatatype -- return C data type as a string
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_CalcDatatype(int type)
-#else
-static char *_CalcDatatype(type)
- int type;
-#endif
-{
- switch ( type ) {
- case 'A': return "char";
- case 'X': return "char";
- case 'B': return "unsigned char";
- case 'I': return "short";
- case 'U': return "unsigned short";
- case 'J': return "int";
- case 'K': return "long long";
- case 'V': return "unsigned int";
- case 'L': return "char";
- case 'E': return "float";
- case 'D': return "double";
- }
- _calcerror("unknown/illegal data type for new column");
- return "???";
-}
-
-/*
- *
- * _CalcColName -- see if sname is a recognized column name
- *
- */
-#ifdef YY_USE_PROTOS
-static int
-_CalcColName(char *sname)
-#else
-static int _CalcColName(sname)
- char *sname;
-#endif
-{
- if( !strcasecmp(sname, "prev") ){
- strcpy(sname, "prev");
- rectype |= REC_PREV;
- return REC_PREV;
- }
- if( !strcasecmp(sname, "cur") ){
- strcpy(sname, "cur");
- rectype |= REC_CUR;
- return REC_CUR;
- }
- if( !strcasecmp(sname, "next") ){
- strcpy(sname, "next");
- rectype |= REC_NEXT;
- return REC_NEXT;
- }
- else{
- return 0;
- }
-}
-
-/*
- *
- * _CalcCB -- macro expansion callback
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_CalcCB(char *name, void *client_data)
-#else
-static char *_CalcCB(name, client_data)
- char *name;
- void *client_data;
-#endif
-{
- CalcCols cur;
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE*2];
- char tbuf3[SZ_LINE];
- int i, got, ip;
-
- /* start at beginning of macro buffer */
- /* allocate the macro buffer */
- if( mbuf ) xfree(mbuf);
- mbuf = NULL;
- mlen = SZ_LINE;
-
- if( !strcmp(name, "MEMBERS") ){
- if( !columns ){
- _CalcCat("int dummy;\n", &mbuf, &mlen);
- return mbuf;
- }
- for(cur=columns; cur!=NULL; cur=cur->next){
- snprintf(tbuf, SZ_LINE, "%s %s", _CalcDatatype(cur->type), cur->cname);
- _CalcCat(tbuf, &mbuf, &mlen);
- if( cur->n > 1 ){
- /* if there is no tdim, just make it a simple array */
- /* (also, do the simple thing for bit-fields) */
- if( (cur->tdim == NULL) || (cur->type == 'X') ){
- switch(cur->type){
- case 'X':
- i = (cur->n+7)/8;
- break;
- default:
- i = cur->n;
- break;
- }
- snprintf(tbuf, SZ_LINE, "[%d]", i);
- }
- /* tdim exists, so use it to declare a multidimensional array */
- else{
- newdtable(",()");
- /* I hear tdim is in Fortran order, so reverse it for C order */
- for(*tbuf = '\0', ip=0, got=0; word(cur->tdim, tbuf3, &ip); got++){
- snprintf(tbuf2, SZ_LINE, "[%s]", tbuf3);
- if( *tbuf )
- strcat(tbuf2, tbuf);
- strcpy(tbuf, tbuf2);
- }
- freedtable();
- /* but if we got nothing out of it, go back to simplicity */
- if( !got )
- snprintf(tbuf, SZ_LINE, "[%d]", cur->n);
- }
- _CalcCat(tbuf, &mbuf, &mlen);
- }
- _CalcCat(";", &mbuf, &mlen);
- if( cur->next )
- _CalcCat("\n", &mbuf, &mlen);
- }
- return mbuf;
- }
- else if( !strcmp(name, "SELECT") ){
- if( !columns ){
- return "";
- }
- for(cur=columns; cur!=NULL; cur=cur->next){
- *tbuf2 = '\0';
- if( (cur->tlmin != 0.0) || (cur->tlmax != 0.0) ){
- snprintf(tbuf2, SZ_LINE, "%f:%f", cur->tlmin, cur->tlmax);
- if( cur->binsiz != 1.0 ){
- snprintf(tbuf3, SZ_LINE, ":%f", cur->binsiz);
- strncat(tbuf2, tbuf3, SZ_LINE);
- }
- if( (cur->tscale != 1.0) || (cur->tzero != 0.0) ){
- snprintf(tbuf3, SZ_LINE, ";%f", cur->tscale);
- strncat(tbuf2, tbuf3, SZ_LINE);
- snprintf(tbuf3, SZ_LINE, ":%f", cur->tzero);
- strncat(tbuf2, tbuf3, SZ_LINE);
- }
- }
- if( *tbuf2 ){
- snprintf(tbuf, SZ_LINE, "\"%s\", \"%d%c:%s\", ",
- cur->cname, cur->n, cur->type, tbuf2);
- }
- else{
- snprintf(tbuf, SZ_LINE, "\"%s\", \"%d%c\", ",
- cur->cname, cur->n, cur->type);
- }
- _CalcCat(tbuf, &mbuf, &mlen);
- if( cur->exists )
- _CalcCat("\"rw\", ", &mbuf, &mlen);
- else
- _CalcCat("\"w\", ", &mbuf, &mlen);
- snprintf(tbuf, SZ_LINE, "FUN_OFFSET(Row, %s),", cur->cname);
- _CalcCat(tbuf, &mbuf, &mlen);
- if( cur->next )
- _CalcCat("\n", &mbuf, &mlen);
- }
- return mbuf;
- }
- else if( !strcmp(name, "RECTYPE") ){
- snprintf(tbuf, SZ_LINE, "%d", rectype);
- _CalcCat(tbuf, &mbuf, &mlen);
- return mbuf;
- }
- else if( !strcmp(name, "EXPR") ){
- if( expr && *expr )
- return(expr);
- else
- return "";
- }
- else if( !strcmp(name, "COMMAND") ){
- if( command && *command )
- return(command);
- else
- return "<build command not available>";
- }
- else if( !strcmp(name, "ARGS") ){
- if( args == 1 )
- return "1";
- else
- return "2";
- }
- else if( !strcmp(name, "AUTO") ){
- if( autodeclare && *autodeclare )
- return autodeclare;
- else
- return "";
- }
- else if( !strcmp(name, "GLOBAL") ){
- if( code[0] && *code[0] )
- return(code[0]);
- else
- return "";
- }
- else if( !strcmp(name, "LOCAL") ){
- if( code[1] && *code[1] )
- return(code[1]);
- else
- return "";
- }
- else if( !strcmp(name, "BEFORE") ){
- if( code[2] && *code[2] )
- return(code[2]);
- else
- return "";
- }
- else if( !strcmp(name, "AFTER") ){
- if( code[3] && *code[3] )
- return(code[3]);
- else
- return "";
- }
- else if( !strcmp(name, "MERGE") ){
- if( doreplace )
- strncpy(tbuf, "replace", SZ_LINE);
- else
- strncpy(tbuf, "update", SZ_LINE);
- _CalcCat(tbuf, &mbuf, &mlen);
- return mbuf;
- }
- else{
- _CalcCat("$", &mbuf, &mlen);
- _CalcCat(name, &mbuf, &mlen);
- return mbuf;
- }
-}
-
-/*
- *
- * _CalcMake -- create the string containing the program by macro expansion
- *
- */
-#ifdef YY_USE_PROTOS
-static char *
-_CalcMake(void)
-#else
-static char *_CalcMake()
-#endif
-{
- char *s;
-
- /* make sure we have something */
- if( !expr || !*expr )
- expr = xstrdup(";");
- s = xstrdup(expr);
- nowhite(s, expr);
- if( s ) xfree(s);
- /* add final ';' is necessary (but not if there is any compund statement) */
- if( !strchr(expr,';') && !strchr(expr,'{') )
- _CalcCat(";", &expr, &nexpr);
- /* expand program body to add specifics of the expression */
- s = ExpandMacro(TABCALC_C, NULL, NULL, 0, _CalcCB, NULL);
- return s;
-}
-
-/* look up a column entry, add if not present */
-#ifdef YY_USE_PROTOS
-CalcCols
-_CalcColLookup(char *cname)
-#else
-CalcCols
-_CalcColLookup(cname)
- char *cname;
-#endif
-{
- CalcCols cur;
- for(cur=columns; cur!=NULL; cur=cur->next){
- if( !strcasecmp(cname, cur->cname) )
- return cur;
- }
- return NULL;
-}
-
-/* look up a symbol table entry, add if not present */
-#ifdef YY_USE_PROTOS
-CalcCols
-_CalcColNew(Fun fun, char *name, char *sname, char *cname, int type, int n,
- double tlmin, double tlmax, double binsiz,
- double tscale, double tzero, int scaled,
- int exists, int settype)
-#else
-CalcCols
-_CalcColNew(fun, name, sname,
- cname, type, n, tlmin, tlmax, binsiz,
- tscale, tzero, scaled,
- exists, settype)
- Fun fun;
- char *name, *sname, *cname;
- int type, n;
- double tlmin, tlmax, binsiz;
- double tscale, tzero;
- int scaled, exists, settype;
-#endif
-{
- CalcCols sym, cur;
- int got;
- int enter=1;
-
- if( (sym=_CalcColLookup(cname)) ){
- if( !settype ) return sym;
- enter=0;
- }
- else{
- /* allocate a new symbol record */
- if( !(sym = (CalcCols)xcalloc(1, sizeof(CalcColRec))) )
- return NULL;
- }
-
- /* fill in the blanks */
- if( sym->name ) xfree(sym->name);
- sym->name = xstrdup(name);
- if( sym->sname ) xfree(sym->sname);
- sym->sname = xstrdup(sname);
- if( sym->cname ) xfree(sym->cname);
- sym->cname = xstrdup(cname);
- sym->type = type;
- sym->n = n;
- sym->tlmin = tlmin;
- sym->tlmax = tlmax;
- sym->binsiz = binsiz;
- sym->tscale = tscale;
- sym->tzero = tzero;
- sym->scaled = scaled;
- sym->exists = exists;
- sym->settype = settype;
-
- /* get tdim value, if there is one */
- if( sym->exists && (sym->n>1) )
- sym->tdim = FunParamGets(fun, "TDIM", exists, NULL, &got);
-
- /* add to list, maintaining order */
- if( enter ){
- if( !columns ){
- columns = sym;
- }
- else{
- for(cur=columns; cur->next!=NULL; cur=cur->next)
- ;
- cur->next = sym;
- }
- }
- return sym;
-}
-
-/* process a column */
-#ifdef YY_USE_PROTOS
-static int
-_CalcColProc(char *s, int expl)
-#else
-static int _CalcColProc(s, expl)
- char *s;
- int expl;
-#endif
-{
- char *e;
- char *t;
- char name[SZ_LINE];
- char sname[SZ_LINE];
- char cname[SZ_LINE];
- char aname[SZ_LINE];
- char fname[SZ_LINE];
- int ptype;
- int poff;
- int exists;
- int dims;
- int settype=0;
- int type=0;
- int n=0;
- int scaled=0;
- double tlmin=0.0, tlmax=0.0, binsiz=1.0;
- double tscale=1.0, tzero=0.0;
-
- /* save expression */
- e = s;
-
- /* gather struct name */
- for(t=sname; *s && (*s != '-');)
- *t++ = *s++;
- *t = '\0';
- /* skip past "->" */
- if( *s && (*s == '-') ) s += 2;
-
- /* if this is not a special name, just append it and exit */
- if( !_CalcColName(sname) ){
- if( !expl ){
- _CalcCat(e, &expr, &nexpr);
- return 1;
- }
- }
-
- /* gather column name */
- for(t=cname; *s && (*s != '[') && (*s != ':');)
- *t++ = *s++;
- *t = '\0';
-
- /* explicit columns don't have the prefix */
- if( expl && *sname && !*cname ){
- strncpy(cname, sname, SZ_LINE);
- strncpy(sname, "cur", SZ_LINE);
- }
-
- /* gather array part */
- if( *s && (*s == '[') ){
- for(t=aname; *s && (*s != ':');)
- *t++ = *s++;
- *t = '\0';
- }
- else
- *aname = '\0';
- if( *aname )
- snprintf(fname, SZ_LINE, "%s->%s%s", sname, cname, aname);
- else
- snprintf(fname, SZ_LINE, "%s->%s", sname, cname);
-
- /* the expression name is the combination of sname (which we will set to
- a struct we know about) and cname (which is a struct member name) */
- snprintf(name, SZ_LINE, "%s->%s", sname, cname);
-
- /* see if this column exists or if its new */
- exists = FunColumnLookup(ifun, cname, 0, NULL, &type, NULL, NULL, &n, NULL);
-
- /* gather up specifier info */
- for(; *s; s++){
- if( *s == ':' ){
- _FunColumnType(s+1, &type, &n, &tlmin, &tlmax, &binsiz, &dims,
- &tscale, &tzero, &scaled, &ptype, &poff);
- settype = 1;
- break;
- }
- }
- if( !exists && !settype && !_CalcColLookup(cname) )
- _calcerror("new column requires a type");
- if( exists && settype )
- doreplace=1;
-
- /* add this column to the list */
- if(_CalcColNew(ifun, name, sname, cname,
- type, n, tlmin, tlmax, binsiz,
- tscale, tzero, scaled,
- exists, settype)){
- if( !expl ) _CalcCat(fname, &expr, &nexpr);
- return 1;
- }
- else{
- return _calcerror("could not enter new funcalc column");
- }
-}
-
-/*
- *
- * Semi-public Routines
- *
- *
- */
-
-/*
- *
- * _CalcCat -- add a string to the filter string buffer
- *
- */
-#ifdef YY_USE_PROTOS
-void
-_CalcCat(char *str, char **ostr, int *olen)
-#else
-void _CalcCat(str, ostr, olen)
- char *str;
- char **ostr;
- int *olen;
-#endif
-{
- int blen;
- int slen;
-
- if( (str == NULL) || (*str == '\0') )
- return;
- else
- slen = strlen(str) + 1;
-
- if( (*ostr == NULL) || (**ostr == '\0') )
- blen = 0;
- else
- blen = strlen(*ostr);
-
- while( (blen + slen) >= *olen ){
- *olen += SEGINC;
- }
- if( blen == 0 )
- *ostr = (char *)xcalloc(*olen, sizeof(char));
- else
- *ostr = (char *)xrealloc(*ostr, *olen);
- strcat(*ostr, str);
-}
-
-#ifdef YY_USE_PROTOS
-char *
-FunCalcParse(char *iname, char *oname,
- char *cmd, char *ex, char *autod, int narg)
-#else
-char *FunCalcParse(iname, oname, cmd, ex, autod, narg)
- char *iname;
- char *oname;
- char *cmd;
- char *ex;
- char *autod;
- int narg;
-#endif
-{
- int i;
-
- /* initialize global variables */
- n = 0;
- rectype = REC_CUR;
- var = 1;
- args = narg;
-
- /* save command */
- if( command ) xfree(command);
- command = xstrdup(cmd);
-
- /* save autodeclare */
- if( autodeclare ) xfree(autodeclare);
- autodeclare = xstrdup(autod);
-
- /* open the input FITS file */
- if( !(ifun = FunOpen(iname, "rc", NULL)) )
- gerror(stderr, "can't FunOpen input file (or find extension): %s\n",
- iname);
-
- /* parse expression */
- calc_scan_string(ex);
- calclex();
-
- /* done with input FITS file */
- FunClose(ifun);
- /* free up space */
- if( expr ){
- xfree(expr);
- expr = NULL;
- }
- nexpr = 0;
- for(i=0; i<MAXCODE; i++){
- if( code[i] ){
- xfree(code[i]);
- code[i] = NULL;
- }
- ncode[i] = 0;
- }
- if( mbuf ){
- xfree(mbuf);
- mbuf = NULL;
- mlen = 0;
- }
- /* return resulting program */
- return prog;
-}
-
-#ifdef YY_USE_PROTOS
-int
-_calcerror(char *msg)
-#else
-int _calcerror(msg)
- char *msg;
-#endif
-{
- if( *calctext )
- gerror(stderr, "%s while processing '%s'\n",
- msg ? msg : "filterr", calctext);
- else
- gerror(stderr, "%s\n", msg ? msg : "filterr");
- YY_FLUSH_BUFFER;
- yyterminate();
-}
-
-#ifdef YY_USE_PROTOS
-int calcwrap(void)
-#else
-int calcwrap()
-#endif
-{
- return 1;
-}
-
diff --git a/funtools/man/man1/funcalc.1 b/funtools/man/man1/funcalc.1
deleted file mode 100644
index b864865..0000000
--- a/funtools/man/man1/funcalc.1
+++ /dev/null
@@ -1,622 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcalc 1"
-.TH funcalc 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funcalc \- Funtools calculator (for binary tables)
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfuncalc\fR [\-n] [\-a argstr] [\-e expr] [\-f file] [\-l link] [\-p prog] <iname> [oname [columns]]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 7
-\& \-a argstr # user arguments to pass to the compiled program
-\& \-e expr # funcalc expression
-\& \-f file # file containing funcalc expression
-\& \-l libs # libs to add to link command
-\& \-n # output generated code instead of compiling and executing
-\& \-p prog # generate named program, no execution
-\& \-u # die if any variable is undeclared (don't auto-declare)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfuncalc\fR is a calculator program that allows arbitrary
-expressions to be constructed, compiled, and executed on columns in a
-Funtools table (\s-1FITS\s0 binary table or raw event file). It works by
-integrating user-supplied expression(s) into a template C program,
-then compiling and executing the program. \fBfuncalc\fR expressions
-are C statements, although some important simplifications (such
-as automatic declaration of variables) are supported.
-.PP
-\&\fBfuncalc\fR expressions can be specified in three ways: on the
-command line using the \fB\-e [expression]\fR switch, in a file using
-the \fB\-f [file]\fR switch, or from stdin (if neither \fB\-e\fR nor
-\&\fB\-f\fR is specified). Of course a file containing \fBfuncalc\fR
-expressions can be read from stdin.
-.PP
-Each invocation of \fBfuncalc\fR requires an input Funtools table
-file to be specified as the first command line argument. The output
-Funtools table file is the second optional argument. It is needed only
-if an output \s-1FITS\s0 file is being created (i.e., in cases where the
-\&\fBfuncalc\fR expression only prints values, no output file is
-needed). If input and output file are both specified, a third optional
-argument can specify the list of columns to activate (using
-\&\fIFunColumnActivate()\fR). Note
-that \fBfuncalc\fR determines whether or not to generate code for
-writing an output file based on the presence or absence of an
-output file argument.
-.PP
-A \fBfuncalc\fR expression executes on each row of a table and
-consists of one or more C statements that operate on the columns of
-that row (possibly using temporary variables). Within an expression,
-reference is made to a column of the \fBcurrent\fR row using the C
-struct syntax \fBcur\-\fR[colname]>, e.g. cur\->x, cur\->pha, etc.
-Local scalar variables can be defined using C declarations at very the
-beginning of the expression, or else they can be defined automatically
-by \fBfuncalc\fR (to be of type double). Thus, for example, a swap of
-columns x and y in a table can be performed using either of the
-following equivalent \fBfuncalc\fR expressions:
-.PP
-.Vb 4
-\& double temp;
-\& temp = cur->x;
-\& cur->x = cur->y;
-\& cur->y = temp;
-.Ve
-.PP
-or:
-.PP
-.Vb 3
-\& temp = cur->x;
-\& cur->x = cur->y;
-\& cur->y = temp;
-.Ve
-.PP
-When this expression is executed using a command such as:
-.PP
-.Vb 1
-\& funcalc \-f swap.expr itest.ev otest.ev
-.Ve
-.PP
-the resulting file will have values of the x and y columns swapped.
-.PP
-By default, the data type of the variable for a column is the same as
-the data type of the column as stored in the file. This can be changed
-by appending \*(L":[dtype]\*(R" to the first reference to that column. In the
-example above, to force x and y to be output as doubles, specify the
-type 'D' explicitly:
-.PP
-.Vb 3
-\& temp = cur->x:D;
-\& cur->x = cur->y:D;
-\& cur->y = temp;
-.Ve
-.PP
-Data type specifiers follow standard \s-1FITS\s0 table syntax for defining
-columns using \s-1TFORM:\s0
-.IP "\(bu" 4
-A: \s-1ASCII\s0 characters
-.IP "\(bu" 4
-B: unsigned 8-bit char
-.IP "\(bu" 4
-I: signed 16-bit int
-.IP "\(bu" 4
-U: unsigned 16-bit int (not standard \s-1FITS\s0)
-.IP "\(bu" 4
-J: signed 32-bit int
-.IP "\(bu" 4
-V: unsigned 32-bit int (not standard \s-1FITS\s0)
-.IP "\(bu" 4
-E: 32-bit float
-.IP "\(bu" 4
-D: 64-bit float
-.IP "\(bu" 4
-X: bits (treated as an array of chars)
-.PP
-Note that only the first reference to a column should contain the
-explicit data type specifier.
-.PP
-Of course, it is important to handle the data type of the columns
-correctly. One of the most frequent cause of error in \fBfuncalc\fR
-programming is the implicit use of the wrong data type for a column in
-expression. For example, the calculation:
-.PP
-.Vb 1
-\& dx = (cur->x - cur->y)/(cur->x + cur->y);
-.Ve
-.PP
-usually needs to be performed using floating point arithmetic. In
-cases where the x and y columns are integers, this can be done by
-reading the columns as doubles using an explicit type specification:
-.PP
-.Vb 1
-\& dx = (cur->x:D - cur->y:D)/(cur->x + cur->y);
-.Ve
-.PP
-Alternatively, it can be done using C type-casting in the expression:
-.PP
-.Vb 1
-\& dx = ((double)cur->x - (double)cur->y)/((double)cur->x + (double)cur->y);
-.Ve
-.PP
-In addition to accessing columns in the current row, reference also
-can be made to the \fBprevious\fR row using \fBprev\-\fR[colname]>,
-and to the \fBnext\fR row using \fBnext\-\fR[colname]>. Note that if
-\&\fBprev\-\fR[colname]> is specified in the \fBfuncalc\fR
-expression, the very first row is not processed. If
-\&\fBnext\-\fR[colname]> is specified in the \fBfuncalc\fR
-expression, the very last row is not processed. In this way,
-\&\fBprev\fR and \fBnext\fR are guaranteed always to point to valid
-rows. For example, to print out the values of the current x column
-and the previous y column, use the C fprintf function in a
-\&\fBfuncalc\fR expression:
-.PP
-.Vb 1
-\& fprintf(stdout, "%d %d\en", cur->x, prev->y);
-.Ve
-.PP
-New columns can be specified using the same \fBcur\-\fR[colname]>
-syntax by appending the column type (and optional tlmin/tlmax/binsiz
-specifiers), separated by colons. For example, cur\->avg:D will define
-a new column of type double. Type specifiers are the same those
-used above to specify new data types for existing columns.
-.PP
-For example, to create and output a new column that is the average value of the
-x and y columns, a new \*(L"avg\*(R" column can be defined:
-.PP
-.Vb 1
-\& cur->avg:D = (cur->x + cur->y)/2.0
-.Ve
-.PP
-Note that the final ';' is not required for single-line expressions.
-.PP
-As with \s-1FITS\s0 \s-1TFORM\s0 data type specification, the column data type
-specifier can be preceded by a numeric count to define an array, e.g.,
-\&\*(L"10I\*(R" means a vector of 10 short ints, \*(L"2E\*(R" means two single precision
-floats, etc. A new column only needs to be defined once in a
-\&\fBfuncalc\fR expression, after which it can be used without
-re-specifying the type. This includes reference to elements of a
-column array:
-.PP
-.Vb 2
-\& cur->avg[0]:2D = (cur->x + cur->y)/2.0;
-\& cur->avg[1] = (cur->x - cur->y)/2.0;
-.Ve
-.PP
-The 'X' (bits) data type is treated as a char array of dimension
-(numeric_count/8), i.e., 16X is processed as a 2\-byte char array. Each
-8-bit array element is accessed separately:
-.PP
-.Vb 2
-\& cur->stat[0]:16X = 1;
-\& cur->stat[1] = 2;
-.Ve
-.PP
-Here, a 16-bit column is created with the \s-1MSB\s0 is set to 1 and the \s-1LSB\s0 set to 2.
-.PP
-By default, all processed rows are written to the specified output
-file. If you want to skip writing certain rows, simply execute the C
-\&\*(L"continue\*(R" statement at the end of the \fBfuncalc\fR expression,
-since the writing of the row is performed immediately after the
-expression is executed. For example, to skip writing rows whose
-average is the same as the current x value:
-.PP
-.Vb 4
-\& cur->avg[0]:2D = (cur->x + cur->y)/2.0;
-\& cur->avg[1] = (cur->x - cur->y)/2.0;
-\& if( cur->avg[0] == cur->x )
-\& continue;
-.Ve
-.PP
-If no output file argument is specified on the \fBfuncalc\fR command
-line, no output file is opened and no rows are written. This is useful
-in expressions that simply print output results instead of generating
-a new file:
-.PP
-.Vb 5
-\& fpv = (cur->av3:D-cur->av1:D)/(cur->av1+cur->av2:D+cur->av3);
-\& fbv = cur->av2/(cur->av1+cur->av2+cur->av3);
-\& fpu = ((double)cur->au3-cur->au1)/((double)cur->au1+cur->au2+cur->au3);
-\& fbu = cur->au2/(double)(cur->au1+cur->au2+cur->au3);
-\& fprintf(stdout, "%f\et%f\et%f\et%f\en", fpv, fbv, fpu, fbu);
-.Ve
-.PP
-In the above example, we use both explicit type specification
-(for \*(L"av\*(R" columns) and type casting (for \*(L"au\*(R" columns) to ensure that
-all operations are performed in double precision.
-.PP
-When an output file is specified, the selected input table is
-processed and output rows are copied to the output file. Note that
-the output file can be specified as \*(L"stdout\*(R" in order to write the
-output rows to the standard output. If the output file argument is
-passed, an optional third argument also can be passed to specify which
-columns to process.
-.PP
-In a \s-1FITS\s0 binary table, it sometimes is desirable to copy all of the
-other \s-1FITS\s0 extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. See \fBfuntable\fR for a related example.
-.PP
-\&\fBfuncalc\fR works by integrating the user-specified expression
-into a template C program called tabcalc.c.
-The completed program then is compiled and executed. Variable
-declarations that begin the \fBfuncalc\fR expression are placed in
-the local declaration section of the template main program. All other
-lines are placed in the template main program's inner processing
-loop. Other details of program generation are handled
-automatically. For example, column specifiers are analyzed to build a
-C struct for processing rows, which is passed to
-\&\fIFunColumnSelect()\fR and used
-in \fIFunTableRowGet()\fR. If
-an unknown variable is used in the expression, resulting in a
-compilation error, the program build is retried after defining the
-unknown variable to be of type double.
-.PP
-Normally, \fBfuncalc\fR expression code is added to
-\&\fBfuncalc\fR row processing loop. It is possible to add code
-to other parts of the program by placing this code inside
-special directives of the form:
-.PP
-.Vb 3
-\& [directive name]
-\& ... code goes here ...
-\& end
-.Ve
-.PP
-The directives are:
-.IP "\(bu" 4
-\&\fBglobal\fR add code and declarations in global space, before the main routine.
-.IP "\(bu" 4
-\&\fBlocal\fR add declarations (and code) just after the local declarations in
-main
-.IP "\(bu" 4
-\&\fBbefore\fR add code just before entering the main row processing loop
-.IP "\(bu" 4
-\&\fBafter\fR add code just after exiting the main row processing loop
-.PP
-Thus, the following \fBfuncalc\fR expression will declare global
-variables and make subroutine calls just before and just after the
-main processing loop:
-.PP
-.Vb 16
-\& global
-\& double v1, v2;
-\& double init(void);
-\& double finish(double v);
-\& end
-\& before
-\& v1 = init();
-\& end
-\& ... process rows, with calculations using v1 ...
-\& after
-\& v2 = finish(v1);
-\& if( v2 < 0.0 ){
-\& fprintf(stderr, "processing failed %g -> %g\en", v1, v2);
-\& exit(1);
-\& }
-\& end
-.Ve
-.PP
-Routines such as \fIinit()\fR and \fIfinish()\fR above are passed to the generated
-program for linking using the \fB\-l [link directives ...]\fR
-switch. The string specified by this switch will be added to the link
-line used to build the program (before the funtools library). For
-example, assuming that \fIinit()\fR and \fIfinish()\fR are in the library
-libmysubs.a in the /opt/special/lib directory, use:
-.PP
-.Vb 1
-\& funcalc \-l "\-L/opt/special/lib \-lmysubs" ...
-.Ve
-.PP
-User arguments can be passed to a compiled funcalc program using a string
-argument to the \*(L"\-a\*(R" switch. The string should contain all of the
-user arguments. For example, to pass the integers 1 and 2, use:
-.PP
-.Vb 1
-\& funcalc \-a "1 2" ...
-.Ve
-.PP
-The arguments are stored in an internal array and are accessed as
-strings via the \s-1ARGV\s0(n) macro. For example, consider the following
-expression:
-.PP
-.Vb 3
-\& local
-\& int pmin, pmax;
-\& end
-.Ve
-.PP
-.Vb 4
-\& before
-\& pmin=atoi(ARGV(0));
-\& pmax=atoi(ARGV(1));
-\& end
-.Ve
-.PP
-.Vb 2
-\& if( (cur->pha >= pmin) && (cur->pha <= pmax) )
-\& fprintf(stderr, "%d %d %d\en", cur->x, cur->y, cur->pha);
-.Ve
-.PP
-This expression will print out x, y, and pha values for all rows in which
-the pha value is between the two user-input values:
-.PP
-.Vb 6
-\& funcalc \-a '1 12' \-f foo snr.ev'[cir 512 512 .1]'
-\& 512 512 6
-\& 512 512 8
-\& 512 512 5
-\& 512 512 5
-\& 512 512 8
-.Ve
-.PP
-.Vb 4
-\& funcalc \-a '5 6' \-f foo snr.ev'[cir 512 512 .1]'
-\& 512 512 6
-\& 512 512 5
-\& 512 512 5
-.Ve
-.PP
-Note that it is the user's responsibility to ensure that the correct
-number of arguments are passed. The \s-1ARGV\s0(n) macro returns a \s-1NULL\s0 if a
-requested argument is outside the limits of the actual number of args,
-usually resulting in a \s-1SEGV\s0 if processed blindly. To check the
-argument count, use the \s-1ARGC\s0 macro:
-.PP
-.Vb 4
-\& local
-\& long int seed=1;
-\& double limit=0.8;
-\& end
-.Ve
-.PP
-.Vb 5
-\& before
-\& if( ARGC >= 1 ) seed = atol(ARGV(0));
-\& if( ARGC >= 2 ) limit = atof(ARGV(1));
-\& srand48(seed);
-\& end
-.Ve
-.PP
-.Vb 1
-\& if ( drand48() > limit ) continue;
-.Ve
-.PP
-The macro \s-1WRITE_ROW\s0 expands to the \fIFunTableRowPut()\fR call that writes
-the current row. It can be used to write the row more than once. In
-addition, the macro \s-1NROW\s0 expands to the row number currently being
-processed. Use of these two macros is shown in the following example:
-.PP
-.Vb 7
-\& if( cur->pha:I == cur->pi:I ) continue;
-\& a = cur->pha;
-\& cur->pha = cur->pi;
-\& cur->pi = a;
-\& cur->AVG:E = (cur->pha+cur->pi)/2.0;
-\& cur->NR:I = NROW;
-\& if( NROW < 10 ) WRITE_ROW;
-.Ve
-.PP
-If the \fB\-p [prog]\fR switch is specified, the expression is not
-executed. Rather, the generated executable is saved with the specified
-program name for later use.
-.PP
-If the \fB\-n\fR switch is specified, the expression is not
-executed. Rather, the generated code is written to stdout. This is
-especially useful if you want to generate a skeleton file and add your
-own code, or if you need to check compilation errors. Note that the
-comment at the start of the output gives the compiler command needed
-to build the program on that platform. (The command can change from
-platform to platform because of the use of different libraries,
-compiler switches, etc.)
-.PP
-As mentioned previously, \fBfuncalc\fR will declare a scalar
-variable automatically (as a double) if that variable has been used
-but not declared. This facility is implemented using a sed script
-named funcalc.sed, which processes the
-compiler output to sense an undeclared variable error. This script
-has been seeded with the appropriate error information for gcc, and for
-cc on Solaris, DecAlpha, and \s-1SGI\s0 platforms. If you find that automatic
-declaration of scalars is not working on your platform, check this sed
-script; it might be necessary to add to or edit some of the error
-messages it senses.
-.PP
-In order to keep the lexical analysis of \fBfuncalc\fR expressions
-(reasonably) simple, we chose to accept some limitations on how
-accurately C comments, spaces, and new-lines are placed in the
-generated program. In particular, comments associated with local
-variables declared at the beginning of an expression (i.e., not in a
-\&\fBlocal...end\fR block) will usually end up in the inner loop, not
-with the local declarations:
-.PP
-.Vb 8
-\& /* this comment will end up in the wrong place (i.e, inner loop) */
-\& double a; /* also in wrong place */
-\& /* this will be in the the right place (inner loop) */
-\& if( cur->x:D == cur->y:D ) continue; /* also in right place */
-\& a = cur->x;
-\& cur->x = cur->y;
-\& cur->y = a;
-\& cur->avg:E = (cur->x+cur->y)/2.0;
-.Ve
-.PP
-Similarly, spaces and new-lines sometimes are omitted or added in a
-seemingly arbitrary manner. Of course, none of these stylistic
-blemishes affect the correctness of the generated code.
-.PP
-Because \fBfuncalc\fR must analyze the user expression using the data
-file(s) passed on the command line, the input file(s) must be opened
-and read twice: once during program generation and once during
-execution. As a result, it is not possible to use stdin for the
-input file: \fBfuncalc\fR cannot be used as a filter. We will
-consider removing this restriction at a later time.
-.PP
-Along with C comments, \fBfuncalc\fR expressions can have one-line
-internal comments that are not passed on to the generated C
-program. These internal comment start with the \fB#\fR character and
-continue up to the new\-line:
-.PP
-.Vb 7
-\& double a; # this is not passed to the generated C file
-\& # nor is this
-\& a = cur->x;
-\& cur->x = cur->y;
-\& cur->y = a;
-\& /* this comment is passed to the C file */
-\& cur->avg:E = (cur->x+cur->y)/2.0;
-.Ve
-.PP
-As previously mentioned, input columns normally are identified by
-their being used within the inner event loop. There are rare cases
-where you might want to read a column and process it outside the main
-loop. For example, qsort might use a column in its sort comparison
-routine that is not processed inside the inner loop (and therefore not
-implicitly specified as a column to be read). To ensure that such a
-column is read by the event loop, use the \fBexplicit\fR keyword.
-The arguments to this keyword specify columns that should be read into
-the input record structure even though they are not mentioned in the
-inner loop. For example:
-.PP
-.Vb 1
-\& explicit pi pha
-.Ve
-.PP
-will ensure that the pi and pha columns are read for each row,
-even if they are not processed in the inner event loop. The \fBexplicit\fR
-statement can be placed anywhere.
-.PP
-Finally, note that \fBfuncalc\fR currently works on expressions
-involving \s-1FITS\s0 binary tables and raw event files. We will consider
-adding support for image expressions at a later point, if there is
-demand for such support from the community.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funcen.1 b/funtools/man/man1/funcen.1
deleted file mode 100644
index d8c1b28..0000000
--- a/funtools/man/man1/funcen.1
+++ /dev/null
@@ -1,250 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcen 1"
-.TH funcen 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funcen \- find centroid (for binary tables)
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfuncen\fR [\-i] [\-n iter] [\-t tol] [\-v lev] <iname> <region>
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 4
-\& \-i # use image filtering (default: event filtering)
-\& \-n iter # max number of iterations (default: 0)
-\& \-t tol # pixel tolerance distance (default: 1.0)
-\& \-v [0,1,2,3] # output verbosity level (default: 0)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfuncen\fR iteratively calculates the centroid position within one
-or more regions of a Funtools table (\s-1FITS\s0 binary table or raw event
-file). Starting with an input table, an initial region specification,
-and an iteration count, the program calculates the average x and y
-position within the region and then uses this new position as the
-region center for the next iteration. Iteration terminates when the
-maximum number of iterations is reached or when the input tolerance
-distance is met for that region. A count of events in the final region
-is then output, along with the pixel position value (and, where
-available, \s-1WCS\s0 position).
-.PP
-The first argument to the program specifies the Funtools table file to
-process. Since the file must be read repeatedly, a value of \*(L"stdin\*(R"
-is not permitted when the number of iterations is non\-zero. Use
-Funtools Bracket Notation to specify \s-1FITS\s0
-extensions and filters.
-.PP
-The second required argument is the initial region descriptor. Multiple
-regions are permitted. However, compound regions (accelerators,
-variable argument regions and regions connected via boolean algebra)
-are not permitted. Points and polygons also are illegal. These
-restrictions might be lifted in a future version, if warranted.
-.PP
-The \fB\-n\fR (iteration number) switch specifies the maximum number of
-iterations to perform. The default is 0, which means that the program will
-simply count and display the number of events in the initial region(s).
-Note that when iterations is 0, the data can be input via stdin.
-.PP
-The \fB\-t\fR (tolerance) switch specifies a floating point tolerance
-value. If the distance between the current centroid position value and
-the last position values is less than this value, iteration terminates.
-The default value is 1 pixel.
-.PP
-The \fB\-v\fR (verbosity) switch specifies the verbosity level of the
-output. The default is 0, which results in a single line of output for
-each input region consisting of the following values:
-.PP
-.Vb 1
-\& counts x y [ra dec coordsys]
-.Ve
-.PP
-The last 3 \s-1WCS\s0 values are output if \s-1WCS\s0 information is available in the
-data file header. Thus, for example:
-.PP
-.Vb 2
-\& [sh] funcen \-n 0 snr.ev "cir 505 508 5"
-\& 915 505.00 508.00 345.284038 58.870920 j2000
-.Ve
-.PP
-.Vb 2
-\& [sh] funcen \-n 3 snr.ev "cir 505 508 5"
-\& 1120 504.43 509.65 345.286480 58.874587 j2000
-.Ve
-.PP
-The first example simply counts the number of events in the initial region.
-The second example iterates the centroid calculation three times to determine
-a final \*(L"best\*(R" position.
-.PP
-Higher levels of verbosity obviously imply more verbose output. At
-level 1, the output essentially contains the same information as level
-0, but with keyword formatting:
-.PP
-.Vb 5
-\& [sh] funcen \-v 1 \-n 3 snr.ev "cir 505 508 5"
-\& event_file: snr.ev
-\& initial_region: cir 505 508 5
-\& tolerance: 1.0000
-\& iterations: 1
-.Ve
-.PP
-.Vb 4
-\& events: 1120
-\& x,y(physical): 504.43 509.65
-\& ra,dec(j2000): 345.286480 58.874587
-\& final_region1: cir 504.43 509.65 5
-.Ve
-.PP
-Level 2 outputs results from intermediate calculations as well.
-.PP
-Ordinarily, region filtering is performed using analytic (event)
-filtering, i.e. that same style of filtering as is performed by
-\&\fBfundisp\fR and \fBfuntable\fR. Use the \fB\-i\fR switch to specify image
-filtering, i.e. the same style filtering as is performed by \fBfuncnts\fR.
-Thus, you can perform a quick calculation of counts in regions, using
-either the analytic or image filtering method, by specifying the
- \fB\-n 0\fR and optional \fB\-i\fR switches. These two method often
-give different results because of how boundary events are processed:
-.PP
-.Vb 2
-\& [sh] funcen snr.ev "cir 505 508 5"
-\& 915 505.00 508.00 345.284038 58.870920 j2000
-.Ve
-.PP
-.Vb 2
-\& [sh] funcen \-i snr.ev "cir 505 508 5"
-\& 798 505.00 508.00 345.284038 58.870920 j2000
-.Ve
-.PP
-See Region Boundaries for more information
-about how boundaries are calculated using these two methods.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funcnts.1 b/funtools/man/man1/funcnts.1
deleted file mode 100644
index 0af4b73..0000000
--- a/funtools/man/man1/funcnts.1
+++ /dev/null
@@ -1,806 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcnts 1"
-.TH funcnts 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funcnts \- count photons in specified regions, with bkgd subtraction
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfuncnts\fR [switches] <source_file> [source_region] [bkgd_file] [bkgd_region|bkgd_value]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 16
-\& \-e "source_exposure[;bkgd_exposure]"
-\& # source (bkgd) FITS exposure image using matching files
-\& \-w "source_exposure[;bkgd_exposure]"
-\& # source (bkgd) FITS exposure image using WCS transform
-\& \-t "source_timecorr[;bkgd_timecorr]"
-\& # source (bkgd) time correction value or header parameter name
-\& \-g # output using nice g format
-\& \-G # output using %.14g format (maximum precision)
-\& \-i "[column;]int1;int2..." # column-based intervals
-\& \-m # match individual source and bkgd regions
-\& \-p # output in pixels, even if wcs is present
-\& \-r # output inner/outer radii (and angles) for annuli (and pandas)
-\& \-s # output summed values
-\& \-v "scol[;bcol]" # src and bkgd value columns for tables
-\& \-T # output in starbase/rdb format
-\& \-z # output regions with zero area
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfuncnts\fR counts photons in the specified source regions and
-reports the results for each region. Regions are specified using the
-Spatial Region Filtering mechanism.
-Photons are also counted in the specified bkgd regions applied to the
-same data file or a different data file. (Alternatively, a constant
-background value in counts/pixel**2 can be specified.) The bkgd regions
-are either paired one-to-one with source regions or pooled and
-normalized by area, and then subtracted from the source counts in each
-region. Displayed results include the bkgd-subtracted counts in each
-region, as well as the error on the counts, the area in
-each region, and the surface brightness (cnts/area**2) calculated for
-each region.
-.PP
-The first argument to the program specifies the \s-1FITS\s0 input image, array, or
-raw event file to process. If \*(L"stdin\*(R" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify \s-1FITS\s0 extensions, image sections, and filters.
-.PP
-The optional second argument is the source region descriptor. If no
-region is specified, the entire field is used.
-.PP
-The background arguments can take one of two forms, depending on
-whether a separate background file is specified. If the source
-file is to be used for background as well, the third argument can be
-either the background region, or a constant value denoting background
-cnts/pixel. Alternatively, the third argument can be a background
-data file, in which case the fourth argument is the background region.
-If no third argument is specified, a constant value of 0 is used
-(i.e., no background).
-.PP
-In summary, the following command arguments are valid:
-.PP
-.Vb 5
-\& [sh] funcnts sfile # counts in source file
-\& [sh] funcnts sfile sregion # counts in source region
-\& [sh] funcnts sfile sregion bregion # bkgd reg. is from source file
-\& [sh] funcnts sfile sregion bvalue # bkgd reg. is constant
-\& [sh] funcnts sfile sregion bfile bregion # bkgd reg. is from separate file
-.Ve
-.PP
-\&\s-1NB:\s0 unlike other Funtools programs, source and background regions are
-specified as separate arguments on the command line, rather than being
-placed inside brackets as part of the source and background filenames.
-This is because regions in funcnts are not simply used as data
-filters, but also are used to calculate areas, exposure, etc. If you
-put the source region inside the brackets (i.e. use it simply as a
-filter) rather than specifying it as argument two, the program still
-will only count photons that pass the region filter. However, the area
-calculation will be performed on the whole field, since \fIfield()\fR is the
-default source region. This rarely is the desired behavior. On the
-other hand, with \s-1FITS\s0 binary tables, it often is useful to put a column
-filter in the filename brackets, so that only events matching the
-column filter are counted inside the region.
-.PP
-For example, to extract the counts within a radius of 22 pixels from the
-center of the \s-1FITS\s0 binary table snr.ev and subtract the background determined
-from the same image within an annulus of radii 50\-100 pixels:
-.PP
-.Vb 10
-\& [sh] funcnts snr.ev "circle(502,512,22)" "annulus(502,512,50,100)"
-\& # source
-\& # data file: snr.ev
-\& # degrees/pix: 0.00222222
-\& # background
-\& # data file: snr.ev
-\& # column units
-\& # area: arcsec**2
-\& # surf_bri: cnts/arcsec**2
-\& # surf_err: cnts/arcsec**2
-.Ve
-.PP
-.Vb 4
-\& # background-subtracted results
-\& reg net_counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source region(s)
-\& ----------------
-\& circle(502,512,22)
-.Ve
-.PP
-.Vb 3
-\& reg counts pixels
-\& ---- ------------ ---------
-\& 1 4382.000 1513
-.Ve
-.PP
-.Vb 3
-\& background region(s)
-\& --------------------
-\& annulus(502,512,50,100)
-.Ve
-.PP
-.Vb 3
-\& reg counts pixels
-\& ---- ------------ ---------
-\& all 8656.000 23572
-.Ve
-.PP
-The area units for the output columns labeled \*(L"area\*(R", \*(L"surf_bri\*(R"
-(surface brightness) and \*(L"surf_err\*(R" will be given either in
-arc-seconds (if appropriate \s-1WCS\s0 information is in the data file
-header(s)) or in pixels. If the data file has \s-1WCS\s0 info, but you do not
-want arc-second units, use the \fB\-p\fR switch to force output in
-pixels. Also, regions having zero area are not normally included in
-the primary (background\-subtracted) table, but are included in the
-secondary source and bkgd tables. If you want these regions to be
-included in the primary table, use the \fB\-z\fR switch.
-.PP
-Note that a simple sed command will extract the background-subtracted results
-for further analysis:
-.PP
-.Vb 3
-\& [sh] cat funcnts.sed
-\& 1,/---- .*/d
-\& /^$/,$d
-.Ve
-.PP
-.Vb 2
-\& [sh] sed \-f funcnts.sed funcnts.out
-\& 1 3826.403 66.465 555.597 5.972 96831.98 0.040 0.001
-.Ve
-.PP
-If separate source and background files are specified, \fBfuncnts\fR will
-attempt to normalize the the background area so that the background
-pixel size is the same as the source pixel size. This normalization
-can only take place if the appropriate \s-1WCS\s0 information is contained in
-both files (e.g. degrees/pixel values in \s-1CDELT\s0). If either
-file does not contain the requisite size information, the normalization
-is not performed. In this case, it is the user's responsibility to
-ensure that the pixel sizes are the same for the two files.
-.PP
-Normally, if more than one background region is specified, \fBfuncnts\fR
-will combine them all into a single region and use this background
-region to produce the background-subtracted results for each source
-region. The \fB\-m\fR (match multiple backgrounds) switch tells
-\&\fBfuncnts\fR to make a one to one correspondence between background and
-source regions, instead of using a single combined background region.
-For example, the default case is to combine 2 background
-regions into a single region and then apply that region to each of the
-source regions:
-.PP
-.Vb 10
-\& [sh] funcnts snr.ev "annulus(502,512,0,22,n=2)" "annulus(502,512,50,100,n=2)"
-\& # source
-\& # data file: snr.ev
-\& # degrees/pix: 0.00222222
-\& # background
-\& # data file: snr.ev
-\& # column units
-\& # area: arcsec**2
-\& # surf_bri: cnts/arcsec**2
-\& # surf_err: cnts/arcsec**2
-.Ve
-.PP
-.Vb 5
-\& # background-subtracted results
-\& reg net_counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002
-\& 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source region(s)
-\& ----------------
-\& annulus(502,512,0,22,n=2)
-.Ve
-.PP
-.Vb 4
-\& reg counts pixels
-\& ---- ------------ ---------
-\& 1 3238.000 373
-\& 2 1144.000 1140
-.Ve
-.PP
-.Vb 3
-\& background region(s)
-\& --------------------
-\& annulus(502,512,50,100,n=2)
-.Ve
-.PP
-.Vb 3
-\& reg counts pixels
-\& ---- ------------ ---------
-\& all 8656.000 23572
-.Ve
-.PP
-Note that the basic region filter rule \*(L"each photon is counted once
-and no photon is counted more than once\*(R" still applies when using The
-\&\fB\-m\fR to match background regions. That is, if two background
-regions overlap, the overlapping pixels will be counted in only one of
-them. In a worst-case scenario, if two background regions are the same
-region, the first will get all the counts and area and the second
-will get none.
-.PP
-Using the \fB\-m\fR switch causes \fBfuncnts\fR to use each of the two
-background regions independently with each of the two source regions:
-.PP
-.Vb 10
-\& [sh] funcnts \-m snr.ev "annulus(502,512,0,22,n=2)" "ann(502,512,50,100,n=2)"
-\& # source
-\& # data file: snr.ev
-\& # degrees/pix: 0.00222222
-\& # background
-\& # data file: snr.ev
-\& # column units
-\& # area: arcsec**2
-\& # surf_bri: cnts/arcsec**2
-\& # surf_err: cnts/arcsec**2
-.Ve
-.PP
-.Vb 5
-\& # background-subtracted results
-\& reg net_counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 3087.015 56.954 150.985 2.395 23872.00 0.129 0.002
-\& 2 755.959 34.295 388.041 5.672 72959.99 0.010 0.000
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source region(s)
-\& ----------------
-\& annulus(502,512,0,22,n=2)
-.Ve
-.PP
-.Vb 4
-\& reg counts pixels
-\& ---- ------------ ---------
-\& 1 3238.000 373
-\& 2 1144.000 1140
-.Ve
-.PP
-.Vb 3
-\& background region(s)
-\& --------------------
-\& ann(502,512,50,100,n=2)
-.Ve
-.PP
-.Vb 4
-\& reg counts pixels
-\& ---- ------------ ---------
-\& 1 3975.000 9820
-\& 2 4681.000 13752
-.Ve
-.PP
-Note that most floating point quantities are displayed using \*(L"f\*(R"
-format. You can change this to \*(L"g\*(R" format using the \fB\-g\fR
-switch. This can be useful when the counts in each pixel is very
-small or very large. If you want maximum precision and don't care
-about the columns lining up nicely, use \fB\-G\fR, which outputs
-all floating values as %.14g.
-.PP
-When counting photons using the annulus and panda (pie and annuli)
-shapes, it often is useful to have access to the radii (and panda
-angles) for each separate region. The \fB\-r\fR switch will add radii
-and angle columns to the output table:
-.PP
-.Vb 12
-\& [sh] funcnts \-r snr.ev "annulus(502,512,0,22,n=2)" "ann(502,512,50,100,n=2)"
-\& # source
-\& # data file: snr.ev
-\& # degrees/pix: 0.00222222
-\& # background
-\& # data file: snr.ev
-\& # column units
-\& # area: arcsec**2
-\& # surf_bri: cnts/arcsec**2
-\& # surf_err: cnts/arcsec**2
-\& # radii: arcsecs
-\& # angles: degrees
-.Ve
-.PP
-.Vb 5
-\& # background-subtracted results
-\& reg net_counts error background berror area surf_bri surf_err radius1 radius2 angle1 angle2
-\& ---- ------------ --------- ------------ --------- --------- --------- --------- --------- --------- --------- ---------
-\& 1 3101.029 56.922 136.971 1.472 23872.00 0.130 0.002 0.00 88.00 NA NA
-\& 2 725.375 34.121 418.625 4.500 72959.99 0.010 0.000 88.00 176.00 NA NA
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source region(s)
-\& ----------------
-\& annulus(502,512,0,22,n=2)
-.Ve
-.PP
-.Vb 4
-\& reg counts pixels
-\& ---- ------------ ---------
-\& 1 3238.000 373
-\& 2 1144.000 1140
-.Ve
-.PP
-.Vb 3
-\& background region(s)
-\& --------------------
-\& ann(502,512,50,100,n=2)
-.Ve
-.PP
-.Vb 3
-\& reg counts pixels
-\& ---- ------------ ---------
-\& all 8656.000 23572
-.Ve
-.PP
-Radii are given in units of pixels or arc-seconds (depending on the
-presence of \s-1WCS\s0 info), while the angle values (when present) are in
-degrees. These columns can be used to plot radial profiles. For
-example, the script \fBfuncnts.plot\fR in the funtools
-distribution) will plot a radial profile using gnuplot (version 3.7 or
-above). A simplified version of this script is shown below:
-.PP
-.Vb 1
-\& #!/bin/sh
-.Ve
-.PP
-.Vb 37
-\& if [ x"$1" = xgnuplot ]; then
-\& if [ x`which gnuplot 2>/dev/null` = x ]; then
-\& echo "ERROR: gnuplot not available"
-\& exit 1
-\& fi
-\& awk '
-\& BEGIN{HEADER=1; DATA=0; FILES=""; XLABEL="unknown"; YLABEL="unknown"}
-\& HEADER==1{
-\& if( $1 == "#" && $2 == "data" && $3 == "file:" ){
-\& if( FILES != "" ) FILES = FILES ","
-\& FILES = FILES $4
-\& }
-\& else if( $1 == "#" && $2 == "radii:" ){
-\& XLABEL = $3
-\& }
-\& else if( $1 == "#" && $2 == "surf_bri:" ){
-\& YLABEL = $3
-\& }
-\& else if( $1 == "----" ){
-\& printf "set nokey; set title \e"funcnts(%s)\e"\en", FILES
-\& printf "set xlabel \e" radius(%s)\e"\en", XLABEL
-\& printf "set ylabel \e"surf_bri(%s)\e"\en", YLABEL
-\& print "plot \e"-\e" using 3:4:6:7:8 with boxerrorbars"
-\& HEADER = 0
-\& DATA = 1
-\& next
-\& }
-\& }
-\& DATA==1{
-\& if( NF == 12 ){
-\& print $9, $10, ($9+$10)/2, $7, $8, $7-$8, $7+$8, $10-$9
-\& }
-\& else{
-\& exit
-\& }
-\& }
-\& ' | gnuplot \-persist - 1>/dev/null 2>&1
-.Ve
-.PP
-.Vb 34
-\& elif [ x"$1" = xds9 ]; then
-\& awk '
-\& BEGIN{HEADER=1; DATA=0; XLABEL="unknown"; YLABEL="unknown"}
-\& HEADER==1{
-\& if( $1 == "#" && $2 == "data" && $3 == "file:" ){
-\& if( FILES != "" ) FILES = FILES ","
-\& FILES = FILES $4
-\& }
-\& else if( $1 == "#" && $2 == "radii:" ){
-\& XLABEL = $3
-\& }
-\& else if( $1 == "#" && $2 == "surf_bri:" ){
-\& YLABEL = $3
-\& }
-\& else if( $1 == "----" ){
-\& printf "funcnts(%s) radius(%s) surf_bri(%s) 3\en", FILES, XLABEL, YLABEL
-\& HEADER = 0
-\& DATA = 1
-\& next
-\& }
-\& }
-\& DATA==1{
-\& if( NF == 12 ){
-\& print $9, $7, $8
-\& }
-\& else{
-\& exit
-\& }
-\& }
-\& '
-\& else
-\& echo "funcnts \-r ... | funcnts.plot [ds9|gnuplot]"
-\& exit 1
-\& fi
-.Ve
-.PP
-Thus, to run \fBfuncnts\fR and plot the results using gnuplot (version 3.7
-or above), use:
-.PP
-.Vb 1
-\& funcnts \-r snr.ev "annulus(502,512,0,50,n=5)" ... | funcnts.plot gnuplot
-.Ve
-.PP
-The \fB\-s\fR (sum) switch causes \fBfuncnts\fR to produce an
-additional table of summed (integrated) background subtracted values,
-along with the default table of individual values:
-.PP
-.Vb 10
-\& [sh] funcnts \-s snr.ev "annulus(502,512,0,50,n=5)" "annulus(502,512,50,100)"
-\& # source
-\& # data file: snr.ev
-\& # degrees/pix: 0.00222222
-\& # background
-\& # data file: snr.ev
-\& # column units
-\& # area: arcsec**2
-\& # surf_bri: cnts/arcsec**2
-\& # surf_err: cnts/arcsec**2
-.Ve
-.PP
-.Vb 8
-\& # summed background-subtracted results
-\& upto net_counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
-\& 2 3776.817 65.254 457.183 4.914 79679.98 0.047 0.001
-\& 3 4025.492 71.972 1031.508 11.087 179775.96 0.022 0.000
-\& 4 4185.149 80.109 1840.851 19.786 320831.94 0.013 0.000
-\& 5 4415.540 90.790 2873.460 30.885 500799.90 0.009 0.000
-.Ve
-.PP
-.Vb 8
-\& # background-subtracted results
-\& reg counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 2880.999 54.722 112.001 1.204 19520.00 0.148 0.003
-\& 2 895.818 35.423 345.182 3.710 60159.99 0.015 0.001
-\& 3 248.675 29.345 574.325 6.173 100095.98 0.002 0.000
-\& 4 159.657 32.321 809.343 8.699 141055.97 0.001 0.000
-\& 5 230.390 37.231 1032.610 11.099 179967.96 0.001 0.000
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source region(s)
-\& ----------------
-\& annulus(502,512,0,50,n=5)
-.Ve
-.PP
-.Vb 7
-\& reg counts pixels sumcnts sumpix
-\& ---- ------------ --------- ------------ ---------
-\& 1 2993.000 305 2993.000 305
-\& 2 1241.000 940 4234.000 1245
-\& 3 823.000 1564 5057.000 2809
-\& 4 969.000 2204 6026.000 5013
-\& 5 1263.000 2812 7289.000 7825
-.Ve
-.PP
-.Vb 3
-\& background region(s)
-\& --------------------
-\& annulus(502,512,50,100)
-.Ve
-.PP
-.Vb 3
-\& reg counts pixels
-\& ---- ------------ ---------
-\& all 8656.000 23572
-.Ve
-.PP
-The \fB\-t\fR and \fB\-e\fR switches can be used to apply timing and
-exposure corrections, respectively, to the data. Please note that
-these corrections are meant to be used qualitatively, since
-application of more accurate correction factors is a complex and
-mission-dependent effort. The algorithm for applying these simple
-corrections is as follows:
-.PP
-.Vb 4
-\& C = Raw Counts in Source Region
-\& Ac= Area of Source Region
-\& Tc= Exposure time for Source Data
-\& Ec= Average exposure in Source Region, from exposure map
-.Ve
-.PP
-.Vb 4
-\& B= Raw Counts in Background Region
-\& Ab= Area of Background Region
-\& Tb= (Exposure) time for Background Data
-\& Eb= Average exposure in Background Region, from exposure map
-.Ve
-.PP
-Then, Net Counts in Source region is
-.PP
-.Vb 1
-\& Net= C - B * (Ac*Tc*Ec)/(Ab*Tb*Eb)
-.Ve
-.PP
-with the standard propagation of errors for the Error on Net.
-The net rate would then be
-.PP
-.Vb 1
-\& Net Rate = Net/(Ac*Tc*Ec)
-.Ve
-.PP
-The average exposure in each region is calculated by summing up the
-pixel values in the exposure map for the given region and then
-dividing by the number of pixels in that region. Exposure maps often
-are generated at a block factor > 1 (e.g., block 4 means that each
-exposure pixel contains 4x4 pixels at full resolution) and
-\&\fBfuncnts\fR will deal with the blocking automatically. Using the
-\&\fB\-e\fR switch, you can supply both source and background exposure
-files (separated by \*(L";\*(R"), if you have separate source and background
-data files. If you do not supply a background exposure file to go with
-a separate background data file, \fBfuncnts\fR assumes that exposure
-already has been applied to the background data file. In addition, it
-assumes that the error on the pixels in the background data file is
-zero.
-.PP
-\&\s-1NB:\s0 The \fB\-e\fR switch assumes that the exposure map overlays the
-image file \fBexactly\fR, except for the block factor. Each pixel in
-the image is scaled by the block factor to access the corresponding
-pixel in the exposure map. If your exposure map does not line up
-exactly with the image, \fBdo not use\fR the \fB\-e\fR exposure
-correction. In this case, it still is possible to perform exposure
-correction \fBif\fR both the image and the exposure map have valid
-\&\s-1WCS\s0 information: use the \fB\-w\fR switch so that the transformation
-from image pixel to exposure pixel uses the \s-1WCS\s0 information. That is,
-each pixel in the image region will be transformed first from image
-coordinates to sky coordinates, then from sky coordinates to exposure
-coordinates. Please note that using \fB\-w\fR can increase the time
-required to process the exposure correction considerably.
-.PP
-A time correction can be applied to both source and
-background data using the \fB\-t\fR switch. The value for the correction can
-either be a numeric constant or the name of a header parameter in
-the source (or background) file:
-.PP
-.Vb 2
-\& [sh] funcnts \-t 23.4 ... # number for source
-\& [sh] funcnts \-t "LIVETIME;23.4" ... # param for source, numeric for bkgd
-.Ve
-.PP
-When a time correction is specified, it is applied to the net counts
-as well (see algorithm above), so that the units of surface brightness
-become cnts/area**2/sec.
-.PP
-The \fB\-i\fR (interval) switch is used to run \fBfuncnts\fR on multiple
-column-based intervals with only a single pass through the data. It is
-equivalent to running \fBfuncnts\fR several times with a different column
-filter added to the source and background data each time. For each
-interval, the full \fBfuncnts\fR output is generated, with a linefeed
-character (^L) inserted between each run. In addition, the output for
-each interval will contain the interval specification in its header.
-Intervals are very useful for generating X\-ray hardness ratios
-efficiently. Of course, they are only supported when the input data
-are contained in a table.
-.PP
-Two formats are supported for interval specification. The most general
-format is semi-colon-delimited list of filters to be used as intervals:
-.PP
-.Vb 1
-\& funcnts \-i "pha=1:5;pha=6:10;pha=11:15" snr.ev "circle(502,512,22)" ...
-.Ve
-.PP
-Conceptually, this will be equivalent to running \fBfuncnts\fR three times:
-.PP
-.Vb 3
-\& funcnts snr.ev'[pha=1:5]' "circle(502,512,22)"
-\& funcnts snr.ev'[pha=6:10]' "circle(502,512,22)"
-\& funcnts snr.ev'[pha=11:15]' "circle(502,512,22)"
-.Ve
-.PP
-However, using the \fB\-i\fR switch will require only one pass through
-the data.
-.PP
-Note that complex filters can be used to specify intervals:
-.PP
-.Vb 1
-\& funcnts \-i "pha=1:5&&pi=4;pha=6:10&&pi=5;pha=11:15&&pi=6" snr.ev ...
-.Ve
-.PP
-The program simply runs the data through each filter in turn and generates
-three \fBfuncnts\fR outputs, separated by the line-feed character.
-.PP
-In fact, although the intent is to support intervals for hardness ratios,
-the specified filters do not have to be intervals at all. Nor does one
-\&\*(L"interval\*(R" filter have to be related to another. For example:
-.PP
-.Vb 1
-\& funcnts \-i "pha=1:5;pi=6:10;energy=11:15" snr.ev "circle(502,512,22)" ...
-.Ve
-.PP
-is equivalent to running \fBfuncnts\fR three times with unrelated filter
-specifications.
-.PP
-A second interval format is supported for the simple case in which a
-single column is used to specify multiple homogeneous intervals for
-that column. In this format, a column name is specified first,
-followed by intervals:
-.PP
-.Vb 1
-\& funcnts \-i "pha;1:5;6:10;11:15" snr.ev "circle(502,512,22)" ...
-.Ve
-.PP
-This is equivalent to the first example, but requires less typing. The
-\&\fBfuncnts\fR program will simply prepend \*(L"pha=\*(R" before each of the specified
-intervals. (Note that this format does not contain the \*(L"=\*(R" character in
-the column argument.)
-.PP
-Ordinarily, when \fBfuncnts\fR is run on a \s-1FITS\s0 binary table (or a
-raw event table), one integral count is accumulated for each row
-(event) contained within a given region. The \fB\-v \*(L"scol[;bcol]\*(R"\fR
-(value column) switch will accumulate counts using the value from the
-specified column for the given event. If only a single column is
-specified, it is used for both the source and background regions. Two
-separate columns, separated by a semi\-colon, can be specified for source
-and background. The special token '$none' can be used to specify that
-a value column is to be used for one but not the other. For example,
-\&'pha;$none' will use the pha column for the source but use integral
-counts for the background, while '$none;pha' will do the converse.
-If the value column is of type logical, then the value used will be 1
-for T and 0 for F. Value columns are used, for example, to integrate
-probabilities instead of integral counts.
-.PP
-If the \fB\-T\fR (rdb table) switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces and line-feed will be inserted between
-tables.
-.PP
-Finally, note that \fBfuncnts\fR is an image program, even though it
-can be run directly on \s-1FITS\s0 binary tables. This means that image
-filtering is applied to the rows in order to ensure that the same
-results are obtained regardless of whether a table or the equivalent
-binned image is used. Because of this, however, the number of counts
-found using \fBfuncnts\fR can differ from the number of events found
-using row-filter programs such as \fBfundisp\fR or \fBfuntable\fR
-For more information about these difference, see the discussion of
-Region Boundaries.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funcone.1 b/funtools/man/man1/funcone.1
deleted file mode 100644
index d22356c..0000000
--- a/funtools/man/man1/funcone.1
+++ /dev/null
@@ -1,285 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'\-1'\(ga
-. ds D- D\h'\-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcone 1"
-.TH funcone 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funcone \- cone search of a binary table containing RA, Dec columns
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfuncone\fR <switches> <iname> <oname> <ra[hdr]> <dec[hdr]> <radius[dr'"]> [columns]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 9
-\& \-d deccol:[hdr] # Dec column name, units (def: DEC:d)
-\& \-j # join columns from list file
-\& \-J # join columns from list file, output all rows
-\& \-l listfile # read centers and radii from a list
-\& \-L listfile # read centers and radii from a list, output list rows
-\& \-n # don't use cone limits as a filter
-\& \-r racol:[hdr] # RA column name, units (def: RA:h)
-\& \-x # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols
-\& \-X # append RA_CEN, DEC_CEN, RAD_CEN, CONE_KEY cols, output all rows
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Funcone performs a cone search on the \s-1RA\s0 and Dec columns of a \s-1FITS\s0
-binary table. The distance from the center \s-1RA\s0, Dec position to the \s-1RA\s0,
-Dec in each row in the table is calculated. Rows whose distance is
-less than the specified radius are output.
-.PP
-The first argument to the program specifies the \s-1FITS\s0 file, raw event
-file, or raw array file. If \*(L"stdin\*(R" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify \s-1FITS\s0 extensions, and filters. The second
-argument is the output \s-1FITS\s0 file. If \*(L"stdout\*(R" is specified, the \s-1FITS\s0
-binary table is written to the standard output.
-.PP
-The third and fourth required arguments are the \s-1RA\s0 and Dec center
-position. By default, \s-1RA\s0 is specified in hours while Dec is specified
-in degrees. You can change the units of either of these by appending
-the character \*(L"d\*(R" (degrees), \*(L"h\*(R" (hours) or \*(L"r\*(R" (radians). Sexagesimal
-notation is supported, with colons or spaces separating hms and dms.
-(When using spaces, please ensure that the entire string is quoted.)
-.PP
-The fifth required argument is the radius of the cone search. By default,
-the radius value is given in degrees. The units can be changed by appending
-the character \*(L"d\*(R" (degrees), \*(L"r\*(R" (radians), \*(L"'\*(R" (arc minutes) or
-\&'"' (arc seconds).
-.PP
-By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional sixth argument in the form:
-.PP
-.Vb 1
-\& "column1 column1 ... columnN"
-.Ve
-.PP
-A seventh argument allows you to output selected columns from the list
-file when \fB\-j\fR switch is used. Note that the \s-1RA\s0 and Dec columns
-used in the cone calculation must not be de\-selected.
-.PP
-Also by default, the \s-1RA\s0 and Dec column names are named \*(L"\s-1RA\s0\*(R" and \*(L"Dec\*(R",
-and are given in units of hours and degrees respectively. You can
-change both the name and the units using the \-r [\s-1RA\s0] and/or \-d [Dec]
-switches. Once again, one of \*(L"h\*(R", \*(L"d\*(R", or \*(L"r\*(R" is appended to the
-column name to specify units but in this case, there must be a colon \*(L":\*(R"
-between the name and the unit specification.
-.PP
-If the \fB\-l [listfile]\fR switch is used, then one or more of the
-center \s-1RA\s0, center Dec, and radius can be taken from a list file (which
-can be a \s-1FITS\s0 table or an \s-1ASCII\s0 column text file). In this case, the
-third (center \s-1RA\s0), fourth (center Dec), and fifth (radius) command
-line arguments can either be a column name in the list file (if that
-parameter varies) or else a numeric value (if that parameter is
-static). When a column name is specified for the \s-1RA\s0, Dec, or radius,
-you can append a colon followed by \*(L"h\*(R", \*(L"d\*(R", or \*(L"r\*(R" to specify units
-(also ' and " for radius). The cone search algorithm is run once for
-each row in the list, taking \s-1RA\s0, Dec, and radius values from the
-specified columns or from static numeric values specified on the
-command line.
-.PP
-When using a list, all valid rows from each iteration are written to a
-single output file. Use the \fB\-x\fR switch to help delineate which
-line of the list file was used to produce the given output row(s).
-This switch causes the values for the center \s-1RA\s0, Dec, radius, and row
-number to be appended to the output file, in columns called \s-1RA_CEN\s0,
-\&\s-1DEC_CEN\s0, \s-1RAD_CEN\s0 and \s-1CONE_KEY\s0, respectively. Alternatively, the
-\&\fB\-j\fR (join) switch will append all columns from the list row to
-the output row (essentially a join of the list row and input row),
-along with the \s-1CONE_KEY\s0 row number. These two switches are mutually
-exclusive.
-.PP
-The \fB\-X\fR and \fB\-J\fR switches write out the same data as their
-lower case counterparts for each row satisfying a cone search. In
-addition, these switches also write out rows from the event file that
-do not satisfy any cone search. In such cases, that \s-1CONE_KEY\s0 column
-will be given a value of \-1 and the center and list position information
-will be set to zero for the given row. Thus, all rows of the input
-event file are guaranteed to be output, with rows satisfying at least
-one cone search having additional search information.
-.PP
-The \fB\-L\fR switch acts similarly to the \fB\-l\fR switch in that it
-takes centers from a list file. However, it also implicitly sets the
-\&\-j switch, so that output rows are the join of the input event row and
-the center position row. In addition, this switch also writes out all
-center position rows for which no event satisfies the cone search
-criteria of that row. The \s-1CONE_KEY\s0 column will be given a value of \-2
-for center rows that were not close to any data row and the event
-columns will be zeroed out for such rows. In this way, all centers
-rows are guaranteed to be output at least once.
-.PP
-If any of \*(L"all row\*(R" switches (\fB\-X\fR, \fB\-J\fR, or \fB\-L\fR) are
-specified, then a new column named \s-1JSTAT\s0 is added to the output table.
-The positive values in this column indicate the center position row number
-(starting from 1) in the list file that this data row successful matched
-in a cone search. A value of \-1 means that the data row did not match
-any center position. A value of \-2 means that the center position was
-not matched by any data row.
-.PP
-Given a center position and radius, the cone search algorithm
-calculates limit parameters for a box enclosing the specified cone,
-and only tests rows whose positions values lie within those limits.
-For small files, the overhead associated with this cone limit
-filtering can cause the program to run more slowly than if all events
-were tested. You can turn off cone limit filtering using the \fB\-n\fR
-switch to see if this speeds up the processing (especially useful when
-processing a large list of positions).
-.PP
-For example, the default cone search uses columns \*(L"\s-1RA\s0\*(R" and \*(L"Dec\*(R" in hours
-and degrees (respectively) and \s-1RA\s0 position in hours, Dec and radius in degrees:
-.PP
-.Vb 1
-\& funone in.fits out.fits 23.45 34.56 0.01
-.Ve
-.PP
-To specify the \s-1RA\s0 position in degrees:
-.PP
-.Vb 1
-\& funcone in.fits out.fits 23.45d 34.56 0.01
-.Ve
-.PP
-To get \s-1RA\s0 and Dec from a list but use a static value for radius (and
-also write identifying info for each row in the list):
-.PP
-.Vb 1
-\& funcone \-x \-l list.txt in.fits out.fits MYRA MYDec 0.01
-.Ve
-.PP
-User specified columns in degrees, \s-1RA\s0 position in hours (sexagesimal
-notation), Dec position in degrees (sexagesimal notation) and radius
-in arc minutes:
-.PP
-.Vb 1
-\& funcone \-r myRa:d \-d myDec in.fits out.fits 12:30:15.5 30:12 15'
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/fundisp.1 b/funtools/man/man1/fundisp.1
deleted file mode 100644
index 21d1e87..0000000
--- a/funtools/man/man1/fundisp.1
+++ /dev/null
@@ -1,589 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "fundisp 1"
-.TH fundisp 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-fundisp \- display data in a Funtools data file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfundisp\fR [\-f format] [\-l] [\-n] [\-T] <iname> [columns|bitpix=n]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 5
-\& \-f # format string for display
-\& \-l # display image as a list containing the columns X, Y, VAL
-\& \-n # don't output header
-\& \-F [c] # use specified character as column separator (def: space)
-\& \-T # output in rdb/starbase format (tab separators)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfundisp\fR displays the data in the specified
-\&\s-1FITS\s0 Extension
-and/or
-Image Section
-of a \s-1FITS\s0 file, or in a
-Section
-of a non-FITS array or raw event file.
-.PP
-The first argument to the program specifies the \s-1FITS\s0 input image, array, or
-raw event file to display. If \*(L"stdin\*(R" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify \s-1FITS\s0 extensions, image sections, and filters.
-.PP
-If the data being displayed are columns (either in a \s-1FITS\s0 binary table
-or a raw event file), the individual rows are listed. Filters can be
-added using bracket notation. Thus:
-.PP
-.Vb 13
-\& [sh] fundisp "test.ev[time-(int)time>.15]"
-\& X Y PHA PI TIME DX DY
-\& ------- ------- ------- --------- ---------------- ---------- ----------
-\& 10 8 10 8 17.1600 8.50 10.50
-\& 9 9 9 9 17.1600 9.50 9.50
-\& 10 9 10 9 18.1600 9.50 10.50
-\& 10 9 10 9 18.1700 9.50 10.50
-\& 8 10 8 10 17.1600 10.50 8.50
-\& 9 10 9 10 18.1600 10.50 9.50
-\& 9 10 9 10 18.1700 10.50 9.50
-\& 10 10 10 10 19.1600 10.50 10.50
-\& 10 10 10 10 19.1700 10.50 10.50
-\& 10 10 10 10 19.1800 10.50 10.50
-.Ve
-.PP
-[\s-1NB:\s0 The \s-1FITS\s0 binary table test file test.ev, as well as the \s-1FITS\s0
-image test.fits, are contained in the funtools funtest directory.]
-.PP
-When a table is being displayed using \fBfundisp\fR, a second optional
-argument can be used to specify the columns to display. For example:
-.PP
-.Vb 12
-\& [sh] fundisp "test.ev[time-(int)time>=.99]" "x y time"
-\& X Y TIME
-\& -------- -------- ---------------------
-\& 5 \-6 40.99000000
-\& 4 \-5 59.99000000
-\& \-1 0 154.99000000
-\& \-2 1 168.99000000
-\& \-3 2 183.99000000
-\& \-4 3 199.99000000
-\& \-5 4 216.99000000
-\& \-6 5 234.99000000
-\& \-7 6 253.99000000
-.Ve
-.PP
-The special column \fB$REGION\fR can be specified to display the
-region id of each row:
-.PP
-.Vb 12
-\& [sh $] fundisp "test.ev[time-(int)time>=.99&&annulus(0 0 0 10 n=3)]" 'x y time $REGION'
-\& X Y TIME REGION
-\& -------- -------- --------------------- ----------
-\& 5 \-6 40.99000000 3
-\& 4 \-5 59.99000000 2
-\& \-1 0 154.99000000 1
-\& \-2 1 168.99000000 1
-\& \-3 2 183.99000000 2
-\& \-4 3 199.99000000 2
-\& \-5 4 216.99000000 2
-\& \-6 5 234.99000000 3
-\& \-7 6 253.99000000 3
-.Ve
-.PP
-Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are displayed.
-.PP
-Columns can be excluded from display using a minus sign before the
-column:
-.PP
-.Vb 12
-\& [sh $] fundisp "test.ev[time-(int)time>=.99]" "\-time"
-\& X Y PHA PI DX DY
-\& -------- -------- -------- ---------- ----------- -----------
-\& 5 \-6 5 \-6 5.50 \-6.50
-\& 4 \-5 4 \-5 4.50 \-5.50
-\& \-1 0 \-1 0 \-1.50 0.50
-\& \-2 1 \-2 1 \-2.50 1.50
-\& \-3 2 \-3 2 \-3.50 2.50
-\& \-4 3 \-4 3 \-4.50 3.50
-\& \-5 4 \-5 4 \-5.50 4.50
-\& \-6 5 \-6 5 \-6.50 5.50
-\& \-7 6 \-7 6 \-7.50 6.50
-.Ve
-.PP
-All columns except the time column are displayed.
-.PP
-The special column \fB$N\fR can be specified to display the
-ordinal value of each row. Thus, continuing the previous example:
-.PP
-.Vb 12
-\& fundisp "test.ev[time-(int)time>=.99]" '\-time $n'
-\& X Y PHA PI DX DY N
-\& ------- -------- -------- ---------- ----------- ----------- ----------
-\& 5 \-6 5 \-6 5.50 \-6.50 337
-\& 4 \-5 4 \-5 4.50 \-5.50 356
-\& \-1 0 \-1 0 \-1.50 0.50 451
-\& \-2 1 \-2 1 \-2.50 1.50 465
-\& \-3 2 \-3 2 \-3.50 2.50 480
-\& \-4 3 \-4 3 \-4.50 3.50 496
-\& \-5 4 \-5 4 \-5.50 4.50 513
-\& \-6 5 \-6 5 \-6.50 5.50 531
-\& \-7 6 \-7 6 \-7.50 6.50 550
-.Ve
-.PP
-Note that the column specification is enclosed in single quotes to protect
-\&'$n' from begin expanded by the shell.
-.PP
-In general, the rules for activating and de-activating columns are:
-.IP "\(bu" 4
-If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-.IP "\(bu" 4
-If only include columns are specified, then only the specified columns
-are activated.
-.IP "\(bu" 4
-If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.
-.PP
-In addition to specifying columns names explicitly, the special
-symbols \fB+\fR and \fB\-\fR can be used to activate and
-de-activate \fBall\fR columns. This is useful if you want to
-activate the \f(CW$REGION\fR column along with all other columns. According
-to the rules, the syntax \*(L"$REGION\*(R" only activates the region column
-and de-activates the rest. Use \*(L"+ \f(CW$REGION\fR\*(R" to activate all
-columns as well as the region column.
-.PP
-If the data being displayed are image data (either in a \s-1FITS\s0 primary
-image, a \s-1FITS\s0 image extension, or an array file), an mxn pixel display
-is produced, where m and n are the dimensions of the image. By
-default, pixel values are displayed using the same data type as in the
-file. However, for integer data where the \s-1BSCALE\s0 and \s-1BZERO\s0 header parameters
-are present, the data is displayed as floats. In either case, the
-display data type can be overridden using an optional second argument
-of the form:
-.PP
-.Vb 1
-\& bitpix=n
-.Ve
-.PP
-where n is 8,16,32,\-32,\-64, for unsigned char, short, int, float and double,
-respectively.
-.PP
-Of course, running \fBfundisp\fR on anything but the smallest image
-usually results in a display whose size makes it unreadable.
-Therefore, one can uses bracket notation (see below)
-to apply section and/or blocking to the image before generating a
-display. For example:
-.PP
-.Vb 9
-\& [sh] fundisp "test.fits[2:6,2:7]" bitpix=-32
-\& 2 3 4 5 6
-\& ---------- ---------- ---------- ---------- ----------
-\& 2: 3.00 4.00 5.00 6.00 7.00
-\& 3: 4.00 5.00 6.00 7.00 8.00
-\& 4: 5.00 6.00 7.00 8.00 9.00
-\& 5: 6.00 7.00 8.00 9.00 10.00
-\& 6: 7.00 8.00 9.00 10.00 11.00
-\& 7: 8.00 9.00 10.00 11.00 12.00
-.Ve
-.PP
-Note that is is possible to display a \s-1FITS\s0 binary table as an image
-simply by passing the table through \fBfunimage\fR first:
-.PP
-.Vb 9
-\& [sh] ./funimage test.ev stdout | fundisp "stdin[2:6,2:7]" bitpix=8
-\& 2 3 4 5 6
-\& ------- ------- ------- ------- -------
-\& 2: 3 4 5 6 7
-\& 3: 4 5 6 7 8
-\& 4: 5 6 7 8 9
-\& 5: 6 7 8 9 10
-\& 6: 7 8 9 10 11
-\& 7: 8 9 10 11 12
-.Ve
-.PP
-If the \fB\-l\fR (list) switch is used, then an image is displayed as a
-list containing the columns: X, Y, \s-1VAL\s0. For example:
-.PP
-.Vb 33
-\& fundisp \-l "test1.fits[2:6,2:7]" bitpix=-32
-\& X Y VAL
-\& ---------- ---------- -----------
-\& 2 2 6.00
-\& 3 2 1.00
-\& 4 2 1.00
-\& 5 2 1.00
-\& 6 2 1.00
-\& 2 3 1.00
-\& 3 3 5.00
-\& 4 3 1.00
-\& 5 3 1.00
-\& 6 3 1.00
-\& 2 4 1.00
-\& 3 4 1.00
-\& 4 4 4.00
-\& 5 4 1.00
-\& 6 4 1.00
-\& 2 5 1.00
-\& 3 5 1.00
-\& 4 5 1.00
-\& 5 5 3.00
-\& 6 5 1.00
-\& 2 6 1.00
-\& 3 6 1.00
-\& 4 6 1.00
-\& 5 6 1.00
-\& 6 6 2.00
-\& 2 7 1.00
-\& 3 7 1.00
-\& 4 7 1.00
-\& 5 7 1.00
-\& 6 7 1.00
-.Ve
-.PP
-If the \fB\-n\fR (nohead) switch is used, then no header is output for
-tables. This is useful, for example, when fundisp output is being
-directed into gnuplot.
-.PP
-The \fBfundisp\fR program uses a default set of display formats:
-.PP
-.Vb 10
-\& datatype TFORM format
-\& -------- ----- --------
-\& double D "%21.8f"
-\& float E "%11.2f"
-\& int J "%10d"
-\& short I "%8d"
-\& byte B "%6d"
-\& string A "%12.12s"
-\& bits X "%8x"
-\& logical L "%1x"
-.Ve
-.PP
-Thus, the default display of 1 double and 2 shorts gives:
-.PP
-.Vb 1
-\& [sh] fundisp snr.ev "time x y"
-.Ve
-.PP
-.Vb 5
-\& TIME X Y
-\& --------------------- -------- --------
-\& 79494546.56818075 546 201
-\& 79488769.94469175 548 201
-\& ...
-.Ve
-.PP
-You can change the display format for individual columns or for all
-columns of a given data types by means of the \-f switch. The format
-string that accompanies \-f is a space-delimited list of keyword=format
-values. The keyword values can either be column names (in which case
-the associated format pertains only to that column) or \s-1FITS\s0 table
-\&\s-1TFORM\s0 specifiers (in which case the format pertains to all columns
-having that data type). For example, you can change the double and
-short formats for all columns like this:
-.PP
-.Vb 1
-\& [sh] fundisp \-f "D=%22.11f I=%3d" snr.ev "time x y"
-.Ve
-.PP
-.Vb 5
-\& TIME X Y
-\& ---------------------- --- ---
-\& 79494546.56818075478 546 201
-\& 79488769.94469174743 548 201
-\& ...
-.Ve
-.PP
-Alternatively, you can change the format of the time and x columns like this:
-.PP
-.Vb 1
-\& [sh] fundisp \-f "time=%22.11f x=%3d" snr.ev "time x y"
-.Ve
-.PP
-.Vb 5
-\& TIME X Y
-\& ---------------------- --- --------
-\& 79494546.56818075478 546 201
-\& 79488769.94469174743 548 201
-\& ...
-.Ve
-.PP
-Note that there is a potential conflict if a column has the same name
-as one of the \s-1TFORM\s0 specifiers. In the examples above, the the \*(L"X\*(R"
-column in the table has the same name as the X (bit) datatype. To
-resolve this conflict, the format string is processed such that
-\&\s-1TFORM\s0 datatype specifiers are checked for first, using a
-case-sensitive comparison. If the specified format value is not an
-upper case \s-1TFORM\s0 value, then a case-insensitive check is made on the
-column name. This means that, in the examples above, \*(L"X=%3d\*(R" will refer
-to the X (bit) datatype, while \*(L"x=%3d\*(R" will refer to the X column:
-.PP
-.Vb 1
-\& [sh] fundisp \-f "X=%3d" snr.ev "x y"
-.Ve
-.PP
-.Vb 5
-\& X Y
-\& -------- --------
-\& 546 201
-\& 548 201
-\& ...
-.Ve
-.PP
-.Vb 1
-\& [sh] fundisp \-f "x=%3d" snr.ev "x y"
-.Ve
-.PP
-.Vb 5
-\& X Y
-\& --- --------
-\& 546 201
-\& 548 201
-\& ...
-.Ve
-.PP
-As a rule, therefore, it is best always to specify the column name in
-lower case and \s-1TFORM\s0 data types in upper case.
-.PP
-The \fB\-f [format]\fR will change the format for a single execution
-of fundisp. You also can use the \fB\s-1FUN_FORMAT\s0\fR envronment variable
-to change the format for all invocations of fundisp. The format of this
-environment variable's value is identical to that used with
-the \fB\-f\fR switch. This global value can be overridden in
-individual cases by use of the \fB\-f [format]\fR switch.
-.PP
-Caveats: Please also note that it is the user's responsibility to
-match the format specifier to the column data type correctly. Also
-note that, in order to maintain visual alignment between names and
-columns, the column name will be truncated (on the left) if the
-format width is less than the length of the name. However, truncation
-is not performed if the output is in \s-1RDB\s0 format (using the \-T switch).
-.PP
-[An older-style format string is supported but deprecated. It
-consists of space-delimited C format statements for all data types,
-specified in the following order:
-.PP
-.Vb 1
-\& double float int short byte string bit.
-.Ve
-.PP
-This order of the list is based on the assumption that people generally
-will want to change the float formats.
-.PP
-If \*(L"\-\*(R" is entered instead of a format statement for a given data type, the
-default format is used. Also, the format string can be terminated without
-specifying all formats, and defaults will be used for the rest of the
-list. Note that you must supply a minimum field width, i.e., \*(L"%6d\*(R" and
-\&\*(L"%\-6d\*(R" are legal, \*(L"%d\*(R" is not legal.
-.PP
-By using \-f [format], you can change the double and short formats like this:
-.PP
-.Vb 1
-\& [sh] fundisp \-f "22.11f - - 3d" snr.ev "time x y"
-.Ve
-.PP
-.Vb 5
-\& TIME X Y
-\& ---------------------- --- ---
-\& 79494546.56818075478 546 201
-\& 79488769.94469174743 548 201
-\& ...
-.Ve
-.PP
-\&\s-1NB:\s0 This format is deprecated and will be removed in a future release.]
-.PP
-The \fB\-F[c]\fR switch can be used to specify a (single\-character)
-column separator (where the default is a space). Note that column
-formatting will almost certainly also add spaces to pad individual
-columns to the required width. These can be removed with a program
-such as sed, at the cost of generating unaligned columns. For example:
-.PP
-fundisp \-F',' snr.ev'[cir 512 512 .1]'
- X, Y, \s-1PHA\s0, \s-1PI\s0, \s-1TIME\s0, \s-1DX\s0, \s-1DY\s0
- 512, 512, 6, 7, 79493997.45854475, 578, 574
- 512, 512, 8, 9, 79494575.58943175, 579, 573
- 512, 512, 5, 6, 79493631.03866175, 578, 575
- 512, 512, 5, 5, 79493290.86521725, 578, 575
- 512, 512, 8, 9, 79493432.00990875, 579, 573
-.PP
-fundisp \-F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,PHA,PI,TIME,DX,DY
- 512,512,6,7,79493997.45854475,578,574
- 512,512,8,9,79494575.58943175,579,573
- 512,512,5,6,79493631.03866175,578,575
- 512,512,5,5,79493290.86521725,578,575
- 512,512,8,9,79493432.00990875,579,573
-.PP
-fundisp \-f \*(L"x=%3d y=%3d pi=%1d pha=%1d time=%20.11f dx=%3d dy=%3d\*(R" \-F',' snr.ev'[cir 512 512 .1]' | sed 's/ *, */,/g'
- X,Y,A,I,TIME,DX,DY
-\&\-\-\-,\-\-\-,\-,\-,\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-,\-\-\-,\-\-\-
-512,512,6,7,79493997.45854474604,578,574
-512,512,8,9,79494575.58943174779,579,573
-512,512,5,6,79493631.03866174817,578,575
-512,512,5,5,79493290.86521725357,578,575
-512,512,8,9,79493432.00990875065,579,573
-.PP
-If the \fB\-T\fR (rdb table) switch is used, the output will conform
-to starbase/rdb data base format: tabs will be inserted between
-columns rather than spaces. This format is not available when
-displaying image pixels (except in conjunction with the \fB\-l\fR
-switch).
-.PP
-Finally, note that \fBfundisp\fR can be used to create column filters from
-the auxiliary tables in a \s-1FITS\s0 file. For example, the following shell code
-will generate a good-time interval (\s-1GTI\s0) filter for X\-ray data files that
-contain a standard \s-1GTI\s0 extension:
-.PP
-.Vb 3
-\& #!/bin/sh
-\& sed '1,/---- .*/d
-\& /^$/,$d' | awk 'tot>0{printf "||"};{printf "time="$1":"$2; tot++}'
-.Ve
-.PP
-If this script is placed in a file called \*(L"mkgti\*(R", it can be used in a
-command such as:
-.PP
-.Vb 1
-\& fundisp foo.fits"[GTI]" | mkgti > gti.filter
-.Ve
-.PP
-The resulting filter file can then be used in various funtools programs:
-.PP
-.Vb 1
-\& funcnts foo.fits"[@gti.filter]" ...
-.Ve
-.PP
-to process only the events in the good-time intervals.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funhead.1 b/funtools/man/man1/funhead.1
deleted file mode 100644
index ed74333..0000000
--- a/funtools/man/man1/funhead.1
+++ /dev/null
@@ -1,287 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funhead 1"
-.TH funhead 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funhead \- display a header in a Funtools file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfunhead\fR [\-a] [\-s] [\-t] [\-L] <iname> [oname ename]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 4
-\& \-a # display all extension headers
-\& \-s # display 79 chars instead of 80 before the new-line
-\& \-t # prepend data type char to each line of output
-\& \-L # output in rdb/starbase list format
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfunhead\fR displays the \s-1FITS\s0 header parameters in the specified
-\&\s-1FITS\s0 Extension.
-.PP
-The first argument to the program specifies the Funtools input file
-to display. If \*(L"stdin\*(R" is specified, data are read from
-the standard input. Funtools Bracket
-Notation is used to specify particular \s-1FITS\s0 extension to process.
-Normally, the full 80 characters of each header card is output,
-followed by a new\-line.
-.PP
-If the \fB\-a\fR switch is specified, the header from each \s-1FITS\s0
-extensions in the file is displayed. Note, however, that the \fB\-a\fR
-switch does not work with \s-1FITS\s0 files input via stdin. We hope to
-remove this restriction in a future release.
-.PP
-If the \fB\-s\fR switch is specified, only 79 characters are output
-before the new\-line. This helps the display on 80 character terminals.
-.PP
-If the \fB\-t\fR switch is specified, the data type of the parameter
-is output as a one character prefix, followed by 77 characters of the
-param. The parameter data types are defined as: \s-1FUN_PAR_UNKNOWN\s0
-('u'), \s-1FUN_PAR_COMMENT\s0 ('c'), \s-1FUN_PAR_LOGICAL\s0 ('l'), \s-1FUN_PAR_INTEGER\s0
-('i'), \s-1FUN_PAR_STRING\s0 ('s'), \s-1FUN_PAR_REAL\s0 ('r'), \s-1FUN_PAR_COMPLEX\s0 ('x').
-.PP
-If the \fB\-L\fR (rdb table) switch is used, the output will conform
-to starbase/rdb data base list format.
-.PP
-For example to display the \s-1EVENTS\s0 extension (binary table):
-.PP
-.Vb 17
-\& [sh] funhead "foo.fits[EVENTS]"
-\& XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
-\& BITPIX = 8 / Binary data
-\& NAXIS = 2 / Table is a matrix
-\& NAXIS1 = 20 / Width of table in bytes
-\& NAXIS2 = 30760 / Number of entries in table
-\& PCOUNT = 0 / Random parameter count
-\& GCOUNT = 1 / Group count
-\& TFIELDS = 7 / Number of fields in each row
-\& EXTNAME = 'EVENTS ' / Table name
-\& EXTVER = 1 / Version number of table
-\& TFORM1 = '1I ' / Data type for field
-\& TTYPE1 = 'X ' / Label for field
-\& TUNIT1 = ' ' / Physical units for field
-\& TFORM2 = '1I ' / Data type for field
-\& etc. ...
-\& END
-.Ve
-.PP
-To display the third header:
-.PP
-.Vb 14
-\& [sh] funhead "foo.fits[3]"
-\& XTENSION= 'BINTABLE' / FITS 3D BINARY TABLE
-\& BITPIX = 8 / Binary data
-\& NAXIS = 2 / Table is a matrix
-\& NAXIS1 = 32 / Width of table in bytes
-\& NAXIS2 = 40 / Number of entries in table
-\& PCOUNT = 0 / Random parameter count
-\& GCOUNT = 1 / Group count
-\& TFIELDS = 7 / Number of fields in each row
-\& EXTNAME = 'TGR ' / Table name
-\& EXTVER = 1 / Version number of table
-\& TFORM1 = '1D ' / Data type for field
-\& etc. ...
-\& END
-.Ve
-.PP
-To display the primary header (i.e., extension 0):
-.PP
-.Vb 8
-\& sh> funhead "coma.fits[0]"
-\& SIMPLE = T /STANDARD FITS FORMAT
-\& BITPIX = 16 /2-BYTE TWOS-COMPL INTEGER
-\& NAXIS = 2 /NUMBER OF AXES
-\& NAXIS1 = 800 /
-\& NAXIS2 = 800 /
-\& DATATYPE= 'INTEGER*2' /SHORT INTEGER
-\& END
-.Ve
-.PP
-The funhead program also can edit (i.e. add, delete, or modify) or
-display individual headers parameters. Edit mode is signalled by the
-presence of two additional command-line arguments: output file and
-edit command file, in that order. Edit mode acts as a filter: the
-output file will contain the entire input \s-1FITS\s0 file, including other
-extensions. The edit command file can be \*(L"stdin\*(R", in which case edit
-command are read from the standard input.
-.PP
-The edit command file contains parameter comments (having '#' in the
-first column) and delete and assignment(modify or add) operations. A
-delete operation is specified by preceding the parameter name with a
-minus sign \*(L"\-\*(R". A display operation (very useful in interactive
-sessions, i.e., where the edit commands are taken from stdin) is
-specified by preceding the parameter name with a question mark \*(L"?\*(R". In
-either case, a parameter value need not be specified. An assignment
-operation is specified in the same two ways that a parameter is
-specified in a text header (but without the comment character that
-precedes header params), i.e.:
-.IP "\(bu" 4
-FITS-style comments have an equal sign \*(L"=\*(R" between the keyword and
-value and an optional slash \*(L"/\*(R" to signify a comment. The strict \s-1FITS\s0
-rules on column positions are not enforced.
-.IP "\(bu" 4
-Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed.
-.PP
-For example, the following interactive session checks for the
-existence of parameters, adds new parameters, modifies them, and
-modifies and deletes existing parameters:
-.PP
-.Vb 20
-\& sh$ ./funhead snr.ev foo.fits -
-\& # look for FOO1
-\& ? FOO1
-\& WARNING: FOO1 not found
-\& # add new foo1
-\& FOO1 = 100
-\& # add foo2
-\& FOO2 = 200
-\& # reset foo1 to a different value
-\& FOO1 \-1
-\& # delete foo2
-\& \-FOO2
-\& # change existing value
-\& EXTVER 2
-\& ? XS-SORT
-\& XS-SORT = 'EOF ' / type of event sort
-\& # delete existing value
-\& \-XS-SORT
-\& # exit
-\& ^D
-.Ve
-.PP
-See Column-based Text Files
-for more information about header parameter format.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funhist.1 b/funtools/man/man1/funhist.1
deleted file mode 100644
index 38708ee..0000000
--- a/funtools/man/man1/funhist.1
+++ /dev/null
@@ -1,370 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funhist 1"
-.TH funhist 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funhist \- create a 1D histogram of a column (from a FITS binary table or raw event file) or an image
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfunhist\fR [\-n|\-w|\-T] <iname> [column] [[lo:hi:]bins]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 3
-\& \-n # normalize bin value by the width of each bin
-\& \-w # specify bin width instead of number of bins in arg3
-\& \-T # output in rdb/starbase format (tab separators)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfunhist\fR creates a one-dimensional histogram from the specified
-columns of a \s-1FITS\s0 Extension
-binary table of a \s-1FITS\s0 file (or from a non-FITS raw event file), or
-from a \s-1FITS\s0 image or array, and writes that histogram as an \s-1ASCII\s0
-table. Alternatively, the program can perform a 1D projection of one
-of the image axes.
-.PP
-The first argument to the program is required, and specifies the
-Funtools file: \s-1FITS\s0 table or image, raw event file, or array. If
-\&\*(L"stdin\*(R" is specified, data are read from the standard input. Use
-Funtools Bracket Notation to specify \s-1FITS\s0
-extensions, and filters.
-.PP
-For a table, the second argument also is required. It specifies the
-column to use in generating the histogram. If the data file is of
-type image (or array), the column is optional: if \*(L"x\*(R" (or \*(L"X\*(R"), \*(L"y\*(R"
-(or \*(L"Y\*(R") is specified, then a projection is performed over the x
-(dim1) or y (dim2) axes, respectively. (That is, this projection will
-give the same results as a histogram performed on a table containing
-the equivalent x,y event rows.) If no column name is specified or
-\&\*(L"xy\*(R" (or \*(L"\s-1XY\s0\*(R") is specified for the image, then a histogram is
-performed on the values contained in the image pixels.
-.PP
-The argument that follows is optional and specifies the number of bins
-to use in creating the histogram and, if desired, the range of bin
-values. For image and table histograms, the range should specify the
-min and max data values. For image histograms on the x and y axes,
-the range should specify the min and max image bin values. If this
-argument is omitted, the number of output bins for a table is
-calculated either from the \s-1TLMIN/TLMAX\s0 headers values (if these exist
-in the table \s-1FITS\s0 header for the specified column) or by going through
-the data to calculate the min and max value. For an image, the number
-of output bins is calculated either from the \s-1DATAMIN/DATAMAX\s0 header
-values, or by going through the data to calculate min and max value.
-(Note that this latter calculation might fail if the image cannot be
-fit in memory.) If the data are floating point (table or image) and
-the number of bins is not specified, an arbitrary default of 128 is
-used.
-.PP
-For binary table processing, the \fB\-w\fR (bin width) switch can be used
-to specify the width of each bin rather than the number of bins. Thus:
-.PP
-.Vb 1
-\& funhist test.ev pha 1:100:5
-.Ve
-.PP
-means that 5 bins of width 20 are used in the histogram, while:
-.PP
-.Vb 1
-\& funhist \-w test.ev pha 1:100:5
-.Ve
-.PP
-means that 20 bins of width 5 are used in the histogram.
-.PP
-The data are divvied up into the specified number of bins and the
-resulting 1D histogram (or projection) is output in \s-1ASCII\s0 table
-format. For a table, the output displays the low_edge (inclusive) and
-hi_edge (exclusive) values for the data. For example, a 15\-row table
-containing a \*(L"pha\*(R" column whose values range from \-7.5 to 7.5
-can be processed thus:
-.PP
-.Vb 4
-\& [sh] funhist test.ev pha
-\& # data file: /home/eric/data/test.ev
-\& # column: pha
-\& # min,max,bins: \-7.5 7.5 15
-.Ve
-.PP
-.Vb 17
-\& bin value lo_edge hi_edge
-\& ------ --------- --------------------- ---------------------
-\& 1 22 \-7.50000000 \-6.50000000
-\& 2 21 \-6.50000000 \-5.50000000
-\& 3 20 \-5.50000000 \-4.50000000
-\& 4 19 \-4.50000000 \-3.50000000
-\& 5 18 \-3.50000000 \-2.50000000
-\& 6 17 \-2.50000000 \-1.50000000
-\& 7 16 \-1.50000000 \-0.50000000
-\& 8 30 \-0.50000000 0.50000000
-\& 9 16 0.50000000 1.50000000
-\& 10 17 1.50000000 2.50000000
-\& 11 18 2.50000000 3.50000000
-\& 12 19 3.50000000 4.50000000
-\& 13 20 4.50000000 5.50000000
-\& 14 21 5.50000000 6.50000000
-\& 15 22 6.50000000 7.50000000
-.Ve
-.PP
-.Vb 4
-\& [sh] funhist test.ev pha 1:6
-\& # data file: /home/eric/data/test.ev
-\& # column: pha
-\& # min,max,bins: 0.5 6.5 6
-.Ve
-.PP
-.Vb 8
-\& bin value lo_edge hi_edge
-\& ------ --------- --------------------- ---------------------
-\& 1 16 0.50000000 1.50000000
-\& 2 17 1.50000000 2.50000000
-\& 3 18 2.50000000 3.50000000
-\& 4 19 3.50000000 4.50000000
-\& 5 20 4.50000000 5.50000000
-\& 6 21 5.50000000 6.50000000
-.Ve
-.PP
-.Vb 4
-\& [sh] funhist test.ev pha 1:6:3
-\& # data file: /home/eric/data/test.ev
-\& # column: pha
-\& # min,max,bins: 0.5 6.5 3
-.Ve
-.PP
-.Vb 5
-\& bin value lo_edge hi_edge
-\& ------ --------- --------------------- ---------------------
-\& 1 33 0.50000000 2.50000000
-\& 2 37 2.50000000 4.50000000
-\& 3 41 4.50000000 6.50000000
-.Ve
-.PP
-For a table histogram, the \fB\-n\fR(normalize) switch can be used to
-normalize the bin value by the width of the bin (i.e., hi_edge\-lo_edge):
-.PP
-.Vb 5
-\& [sh] funhist \-n test.ev pha 1:6:3
-\& # data file: test.ev
-\& # column: pha
-\& # min,max,bins: 0.5 6.5 3
-\& # width normalization (val/(hi_edge-lo_edge)) is applied
-.Ve
-.PP
-.Vb 5
-\& bin value lo_edge hi_edge
-\& ------ --------------------- --------------------- ---------------------
-\& 1 16.50000000 0.50000000 2.50000000
-\& 2 6.16666667 2.50000000 4.50000000
-\& 3 4.10000000 4.50000000 6.50000000
-.Ve
-.PP
-This could used, for example, to produce a light curve with values
-having units of counts/second instead of counts.
-.PP
-For an image histogram, the output displays the low and high image
-values (both inclusive) used to generate the histogram. For example,
-in the following example, 184 pixels had a value of 1, 31 had a value
-of 2, while only 2 had a value of 3,4,5,6, or 7:
-.PP
-.Vb 3
-\& [sh] funhist test.fits
-\& # data file: /home/eric/data/test.fits
-\& # min,max,bins: 1 7 7
-.Ve
-.PP
-.Vb 9
-\& bin value lo_val hi_val
-\& ------ --------------------- --------------------- ---------------------
-\& 1 184.00000000 1.00000000 1.00000000
-\& 2 31.00000000 2.00000000 2.00000000
-\& 3 2.00000000 3.00000000 3.00000000
-\& 4 2.00000000 4.00000000 4.00000000
-\& 5 2.00000000 5.00000000 5.00000000
-\& 6 2.00000000 6.00000000 6.00000000
-\& 7 2.00000000 7.00000000 7.00000000
-.Ve
-.PP
-For the axis projection of an image, the output displays the low and
-high image bins (both inclusive) used to generate the projection. For
-example, in the following example, 21 counts had their X bin value of
-2, etc.:
-.PP
-.Vb 4
-\& [sh] funhist test.fits x 2:7
-\& # data file: /home/eric/data/test.fits
-\& # column: X
-\& # min,max,bins: 2 7 6
-.Ve
-.PP
-.Vb 8
-\& bin value lo_bin hi_bin
-\& ------ --------------------- --------------------- ---------------------
-\& 1 21.00000000 2.00000000 2.00000000
-\& 2 20.00000000 3.00000000 3.00000000
-\& 3 19.00000000 4.00000000 4.00000000
-\& 4 18.00000000 5.00000000 5.00000000
-\& 5 17.00000000 6.00000000 6.00000000
-\& 6 16.00000000 7.00000000 7.00000000
-.Ve
-.PP
-.Vb 4
-\& [sh] funhist test.fits x 2:7:2
-\& # data file: /home/eric/data/test.fits
-\& # column: X
-\& # min,max,bins: 2 7 2
-.Ve
-.PP
-.Vb 4
-\& bin value lo_bin hi_bin
-\& ------ --------------------- --------------------- ---------------------
-\& 1 60.00000000 2.00000000 4.00000000
-\& 2 51.00000000 5.00000000 7.00000000
-.Ve
-.PP
-You can use gnuplot or other plotting programs to graph the
-results, using a script such as:
-.PP
-.Vb 7
-\& #!/bin/sh
-\& sed \-e '1,/---- .*/d
-\& /^$/,$d' | \e
-\& awk '\e
-\& BEGIN{print "set nokey; set title \e"funhist\e"; set xlabel \e"bin\e"; set ylabel \e"counts\e"; plot \e"-\e" with boxes"} \e
-\& {print $3, $2, $4-$3}' | \e
-\& gnuplot \-persist - 1>/dev/null 2>&1
-.Ve
-.PP
-Similar plot commands are supplied in the script \fBfunhist.plot\fR:
-.PP
-.Vb 1
-\& funhist test.ev pha ... | funhist.plot gnuplot
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funimage.1 b/funtools/man/man1/funimage.1
deleted file mode 100644
index ea9db5a..0000000
--- a/funtools/man/man1/funimage.1
+++ /dev/null
@@ -1,428 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funimage 1"
-.TH funimage 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funimage \- create a FITS image from a Funtools data file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfunimage\fR [\-a] <iname> <oname> [bitpix=n]
-\&\fBfunimage\fR [\-l] <iname> <oname> <xcol:xdims> <ycol:ydims> <vcol> [bitpix=n]
-\&\fBfunimage\fR [\-p x|y] <iname> <oname> [bitpix=n]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 3
-\& \-a # append to existing output file as an image extension
-\& \-l # input is a list file containing xcol, ycol, value
-\& \-p [x|y] # project along x or y axis to create a 1D image
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfunimage\fR creates a primary \s-1FITS\s0 image from the specified
-\&\s-1FITS\s0 Extension
-and/or
-Image Section
-of a \s-1FITS\s0 file, or from an
-Image Section
-of a non-FITS array, or from a raw event file.
-.PP
-The first argument to the program specifies the \s-1FITS\s0 input image,
-array, or raw event file to process. If \*(L"stdin\*(R" is specified, data are
-read from the standard input. Use Funtools
-Bracket Notation to specify \s-1FITS\s0 extensions, image sections, and
-filters. The second argument is the output \s-1FITS\s0 file. If \*(L"stdout\*(R" is
-specified, the \s-1FITS\s0 image is written to the standard output. By
-default, the output pixel values are of the same data type as those of the
-input file (or type \*(L"int\*(R" when binning a table), but this can be
-overridden using an optional third argument of the form:
-.PP
-.Vb 1
-\& bitpix=n
-.Ve
-.PP
-where n is 8,16,32,\-32,\-64, for unsigned char, short, int, float and double,
-respectively.
-.PP
-If the input data are of type image, the appropriate section is
-extracted and blocked (based on how the
-Image Section is specified), and
-the result is written to the \s-1FITS\s0 primary image. When an integer
-image containing the \s-1BSCALE\s0 and \s-1BZERO\s0 keywords is converted to float,
-the pixel values are scaled and the scaling keywords are deleted from the
-output header. When converting integer scaled data to integer
-(possibly of a different size), the pixels are not scaled and the
-scaling keywords are retained.
-.PP
-If the input data is a binary table or raw event file, these are
-binned into an image, from which a section is extracted and blocked,
-and written to a primary \s-1FITS\s0 image. In this case, it is necessary to
-specify the two columns that will be used in the 2D binning. This can
-be done on the command line using the \fBbincols=(x,y)\fR keyword:
-.PP
-.Vb 1
-\& funcnts "foo.ev[EVENTS,bincols=(detx,dety)]"
-.Ve
-.PP
-The full form of the \fBbincols=\fR specifier is:
-.PP
-.Vb 1
-\& bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-.Ve
-.PP
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-.PP
-.Vb 2
-\& dim = (tlmax - tlmin)/binsiz (floating point data)
-\& dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-.Ve
-.PP
-Using this syntax, it is possible to bin any two columns of a binary
-table at any bin size. Note that the tlmin, tlmax, and binsiz
-specifiers can be omitted if \s-1TLMIN\s0, \s-1TLMAX\s0, and \s-1TDBIN\s0 header parameters
-(respectively) are present in the \s-1FITS\s0 binary table header for the
-column in question. Note also that if only one parameter is specified,
-it is assumed to be tlmax, and tlmin defaults to 1. If two parameters
-are specified, they are assumed to be tlmin and tlmax.
-See Binning \s-1FITS\s0 Binary Tables and Non-FITS
-Event Files for more information about binning parameters.
-.PP
-By default, a new 2D \s-1FITS\s0 image file is created and the image is written
-to the primary \s-1HDU\s0. If the \fB\-a\fR (append) switch is specified,
-the image is appended to an existing \s-1FITS\s0 file as an \s-1IMAGE\s0 extension.
-(If the output file does not exist, the switch is effectively ignored
-and the image is written to the primary \s-1HDU\s0.) This can be useful in a
-shell programming environment when processing multiple \s-1FITS\s0 images
-that you want to combine into a single final \s-1FITS\s0 file.
-.PP
-\&\fBfunimage\fR also can take input from a table containing columns of
-x, y, and value (e.g., the output from \fBfundisp \-l\fR which
-displays each image x and y and the number of counts at that
-position.) When the \fB\-l\fR (list) switch is used, the input file is
-taken to be a \s-1FITS\s0 or \s-1ASCII\s0 table containing (at least) three columns
-that specify the x and y image coordinates and the value of that
-image pixel. In this case, \fBfunimage\fR requires four extra
-arguments: xcolumn:xdims, ycolumn:ydims, vcolumn and bitpix=n. The x
-and y col:dim information takes the form:
-.PP
-.Vb 3
-\& name:dim # values range from 1 to dim
-\& name:min:max # values range from min to max
-\& name:min:max:binsiz # dimensions scaled by binsize
-.Ve
-.PP
-In particular, the min value should be used whenever the
-minimum coordinate value is something other than one. For example:
-.PP
-.Vb 1
-\& funimage \-l foo.lst foo.fits xcol:0:512 ycol:0:512 value bitpix=-32
-.Ve
-.PP
-The list feature also can be used to read unnamed columns from standard
-input: simply replace the column name with a null string. Note
-that the dimension information is still required:
-.PP
-.Vb 5
-\& funimage \-l stdin foo.fits "":0:512 "":0:512 "" bitpix=-32
-\& 240 250 1
-\& 255 256 2
-\& ...
-\& ^D
-.Ve
-.PP
-The list feature provides a simple way to generate a blank image.
-If you pass a Column-based Text File
-to funimage in which the text header contains the required image
-information, then funimage will correctly make a blank image. For
-example, consider the following text file (called foo.txt):
-.PP
-.Vb 3
-\& x:I:1:10 y:I:1:10
-\& ------ ------
-\& 0 0
-.Ve
-.PP
-This text file defines two columns, x and y, each of data type 32-bit int and
-image dimension 10. The command:
-.PP
-.Vb 1
-\& funimage foo.txt foo.fits bitpix=8
-.Ve
-.PP
-will create an empty \s-1FITS\s0 image called foo.fits containing a 10x10
-image of unsigned char:
-.PP
-.Vb 13
-\& fundisp foo.fits
-\& 1 2 3 4 5 6 7 8 9 10
-\& ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
-\& 10: 0 0 0 0 0 0 0 0 0 0
-\& 9: 0 0 0 0 0 0 0 0 0 0
-\& 8: 0 0 0 0 0 0 0 0 0 0
-\& 7: 0 0 0 0 0 0 0 0 0 0
-\& 6: 0 0 0 0 0 0 0 0 0 0
-\& 5: 0 0 0 0 0 0 0 0 0 0
-\& 4: 0 0 0 0 0 0 0 0 0 0
-\& 3: 0 0 0 0 0 0 0 0 0 0
-\& 2: 0 0 0 0 0 0 0 0 0 0
-\& 1: 1 0 0 0 0 0 0 0 0 0
-.Ve
-.PP
-Note that the text file must contain at least
-one row of data. However, in the present example, event position 0,0 is
-outside the limits of the image and will be ignored. (You can, of course,
-use real x,y values to seed the image with data.)
-.PP
-Furthermore, you can use the \s-1TEXT\s0 filter specification to obviate the need for
-an input text file altogether. The following command will create the same
-10x10 char image without an actual input file:
-.PP
-.Vb 3
-\& funimage stdin'[TEXT(x:I:10,y:I:10)]' foo.fits bitpix=8 < /dev/null
-\&or
-\& funimage /dev/null'[TEXT(x:I:10,y:I:10)]' foo.fits bitpix=8
-.Ve
-.PP
-You also can use either of these methods to generate a region mask simply
-by appending a region inside the filter brackets and specfying \fBmask=all\fR
-along with the bitpix. For example, the following command will generate a
-10x10 char mask using 3 regions:
-.PP
-.Vb 2
-\& funimage stdin'[TEXT(x:I:10,y:I:10),cir(5,5,4),point(10,1),-cir(5,5,2)]' \e
-\& foo.fits bitpix=8,mask=all < /dev/null
-.Ve
-.PP
-The resulting mask looks like this:
-.PP
-.Vb 13
-\& fundisp foo.fits
-\& 1 2 3 4 5 6 7 8 9 10
-\& ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
-\& 10: 0 0 0 0 0 0 0 0 0 0
-\& 9: 0 0 0 0 0 0 0 0 0 0
-\& 8: 0 0 1 1 1 1 1 0 0 0
-\& 7: 0 1 1 1 1 1 1 1 0 0
-\& 6: 0 1 1 0 0 0 1 1 0 0
-\& 5: 0 1 1 0 0 0 1 1 0 0
-\& 4: 0 1 1 0 0 0 1 1 0 0
-\& 3: 0 1 1 1 1 1 1 1 0 0
-\& 2: 0 0 1 1 1 1 1 0 0 0
-\& 1: 0 0 0 0 0 0 0 0 0 2
-.Ve
-.PP
-You can use \fBfunimage\fR to create 1D image projections along the x
-or y axis using the \fB\-p [x|y]\fR switch. This capability works for
-both images and tables. For example consider a \s-1FITS\s0 table named ev.fits
-containing the following rows:
-.PP
-.Vb 17
-\& X Y
-\& -------- --------
-\& 1 1
-\& 1 2
-\& 1 3
-\& 1 4
-\& 1 5
-\& 2 2
-\& 2 3
-\& 2 4
-\& 2 5
-\& 3 3
-\& 3 4
-\& 3 5
-\& 4 4
-\& 4 5
-\& 5 5
-.Ve
-.PP
-A corresponding 5x5 image, called dim2.fits, would therefore contain:
-.PP
-.Vb 7
-\& 1 2 3 4 5
-\& ---------- ---------- ---------- ---------- ----------
-\& 5: 1 1 1 1 1
-\& 4: 1 1 1 1 0
-\& 3: 1 1 1 0 0
-\& 2: 1 1 0 0 0
-\& 1: 1 0 0 0 0
-.Ve
-.PP
-A projection along the y axis can be performed on either the table or
-the image:
-.PP
-.Vb 4
-\& funimage \-p y ev.fits stdout | fundisp stdin
-\& 1 2 3 4 5
-\& ---------- ---------- ---------- ---------- ----------
-\& 1: 1 2 3 4 5
-.Ve
-.PP
-.Vb 4
-\& funimage \-p y dim2.fits stdout | fundisp stdin
-\& 1 2 3 4 5
-\& ---------- ---------- ---------- ---------- ----------
-\& 1: 1 2 3 4 5
-.Ve
-.PP
-Furthermore, you can create a 1D image projection along any column of
-a table by using the \fBbincols=[column]\fR filter specification and
-specifying a single column. For example, the following command
-projects the same 1D image along the y axis of a table as use of
-the \fB\-p y\fR switch:
-.PP
-.Vb 4
-\& funimage ev.fits'[bincols=y]' stdout | fundisp stdin
-\& 1 2 3 4 5
-\& ---------- ---------- ---------- ---------- ----------
-\& 1: 1 2 3 4 5
-.Ve
-.PP
-Examples:
-.PP
-Create a \s-1FITS\s0 image from a \s-1FITS\s0 binary table:
-.PP
-.Vb 1
-\& [sh] funimage test.ev test.fits
-.Ve
-.PP
-Display the \s-1FITS\s0 image generated from a blocked section of \s-1FITS\s0 binary table:
-.PP
-.Vb 5
-\& [sh] funimage "test.ev[2:8,3:7,2]" stdout | fundisp stdin
-\& 1 2 3
-\& --------- --------- ---------
-\& 1: 20 28 36
-\& 2: 28 36 44
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funindex.1 b/funtools/man/man1/funindex.1
deleted file mode 100644
index 8c5b794..0000000
--- a/funtools/man/man1/funindex.1
+++ /dev/null
@@ -1,179 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funindex 1"
-.TH funindex 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funindex \- create an index for a column of a FITS binary table
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfunindex\fR <switches> <iname> <key> [oname]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 7
-\& NB: these options are not compatible with Funtools processing. Please
-\& use the defaults instead.
-\& \-c # compress output using gzip"
-\& \-a # ASCII output, ignore \-c (default: FITS table)"
-\& \-f # FITS table output (default: FITS table)"
-\& \-l # long output, i.e. with key value(s) (default: long)"
-\& \-s # short output, i.e. no key value(s) (default: long)"
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The funindex script creates an index for the specified column (key) by
-running funtable \-s (sort) and then saving the column value and the
-record number for each sorted row. This index will be used automatically
- by funtools filtering of that column, provided the index file's modification
-date is later than that of the data file.
-.PP
-The first required argument is the name of the \s-1FITS\s0 binary table
-to index. Please note that text files cannot be indexed at this time.
-The second required argument is the column (key) name to index. While
-multiple keys can be specified in principle, the funtools index processing
-assume a single key and will not recognize files containing multiple keys.
-.PP
-By default, the output index file name is [root]_[key].idx, where [root]
-is the root of the input file. Funtools looks for this specific file name
-when deciding whether to use an index for faster filtering. Therefore, the
-optional third argument (output file name) should not be used for funtools
-processing.
-.PP
-For example, to create an index on column Y for a given \s-1FITS\s0 file, use:
-.PP
-.Vb 1
-\& funindex foo.fits Y
-.Ve
-.PP
-This will generate an index named foo_y.idx, which will be used by funtools
-for filters involving the Y column.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funjoin.1 b/funtools/man/man1/funjoin.1
deleted file mode 100644
index 6e7dd31..0000000
--- a/funtools/man/man1/funjoin.1
+++ /dev/null
@@ -1,326 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funjoin 1"
-.TH funjoin 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funjoin \- join two or more FITS binary tables on specified columns
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfunjoin\fR [switches] <ifile1> <ifile2> ... <ifilen> <ofile>
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 11
-\& \-a cols # columns to activate in all files
-\& \-a1 cols ... an cols # columns to activate in each file
-\& \-b 'c1:bvl,c2:bv2' # blank values for common columns in all files
-\& \-bn 'c1:bv1,c2:bv2' # blank values for columns in specific files
-\& \-j col # column to join in all files
-\& \-j1 col ... jn col # column to join in each file
-\& \-m min # min matches to output a row
-\& \-M max # max matches to output a row
-\& \-s # add 'jfiles' status column
-\& \-S col # add col as status column
-\& \-t tol # tolerance for joining numeric cols [2 files only]
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfunjoin\fR joins rows from two or more (up to 32)
-\&\s-1FITS\s0 Binary Table files, based on the values
-of specified join columns in each file. \s-1NB:\s0 the join columns must have
-an index file associated with it. These files are generated using the
-\&\fBfunindex\fR program.
-.PP
-The first argument to the program specifies the first input \s-1FITS\s0 table
-or raw event file. If \*(L"stdin\*(R" is specified, data are read from the
-standard input. Subsequent arguments specify additional event files
-and tables to join. The last argument is the output \s-1FITS\s0 file.
-.PP
-\&\s-1NB:\s0 Do \fBnot\fR use Funtools Bracket
-Notation to specify \s-1FITS\s0 extensions and row filters when running
-funjoin or you will get wrong results. Rows are accessed and joined
-using the index files directly, and this bypasses all filtering.
-.PP
-The join columns are specified using the \fB\-j col\fR switch (which
-specifies a column name to use for all files) or with \fB\-j1 col1\fR,
-\&\fB\-j2 col2\fR, ... \fB\-jn coln\fR switches (which specify a column
-name to use for each file). A join column must be specified for each file.
-If both \fB\-j col\fR and \fB\-jn coln\fR are specified for a given
-file, then the latter is used. Join columns must either be of type
-string or type numeric; it is illegal to mix numeric and string
-columns in a given join. For example, to join three files using the
-same key column for each file, use:
-.PP
-.Vb 1
-\& funjoin \-j key in1.fits in2.fits in3.fits out.fits
-.Ve
-.PP
-A different key can be specified for the third file in this way:
-.PP
-.Vb 1
-\& funjoin \-j key \-j3 otherkey in1.fits in2.fits in3.fits out.fits
-.Ve
-.PP
-The \fB\-a \*(L"cols\*(R"\fR switch (and \fB\-a1 \*(L"col1\*(R"\fR,
-\&\fB\-a2 \*(L"cols2\*(R"\fR counterparts) can be used to specify columns to
-activate (i.e. write to the output file) for each input file. By
-default, all columns are output.
-.PP
-If two or more columns from separate files have the same name, the
-second (and subsequent) columns are renamed to have an underscore
-and a numeric value appended.
-.PP
-The \fB\-m min\fR and \fB\-M max\fR switches specify the minimum
-and maximum number of joins required to write out a row. The default
-minimum is 0 joins (i.e. all rows are written out) and the default maximum
-is 63 (the maximum number of possible joins with a limit of 32 input files).
-For example, to write out only those rows in which exactly two files
-have columns that match (i.e. one join):
-.PP
-.Vb 1
-\& funjoin \-j key \-m 1 \-M 1 in1.fits in2.fits in3.fits ... out.fits
-.Ve
-.PP
-A given row can have the requisite number of joins without all of the
-files being joined (e.g. three files are being joined but only two
-have a given join key value). In this case, all of the columns of the
-non-joined file are written out, by default, using blanks (zeros or NULLs).
-The \fB\-b c1:bv1,c2:bv2\fR and
-\-b1 'c1:bv1,c2:bv2' \-b2 'c1:bv1,c2 - bv2' ...
-switches can be used to set the blank value for columns common to all
-files and/or columns in a specified file, respectively. Each blank value
-string contains a comma-separated list of column:blank_val specifiers.
-For floating point values (single or double), a case-insensitive string
-value of \*(L"nan\*(R" means that the \s-1IEEE\s0 NaN (not\-a\-number) should be
-used. Thus, for example:
-.PP
-.Vb 1
-\& funjoin \-b "AKEY:???" \-b1 "A:-1" \-b3 "G:NaN,E:-1,F:-100" ...
-.Ve
-.PP
-means that a non-joined \s-1AKEY\s0 column in any file will contain the
-string \*(L"???\*(R", the non-joined A column of file 1 will contain a value
-of \-1, the non-joined G column of file 3 will contain \s-1IEEE\s0 NaNs, while
-the non-joined E and F columns of the same file will contain values \-1
-and \-100, respectively. Of course, where common and specific blank values
-are specified for the same column, the specific blank value is used.
-.PP
-To distinguish which files are non-blank components of a given row,
-the \fB\-s\fR (status) switch can be used to add a bitmask column named
-\&\*(L"\s-1JFILES\s0\*(R" to the output file. In this column, a bit is set for each
-non-blank file composing the given row, with bit 0 corresponds to the
-first file, bit 1 to the second file, and so on. The file names
-themselves are stored in the \s-1FITS\s0 header as parameters named \s-1JFILE1\s0,
-\&\s-1JFILE2\s0, etc. The \fB\-S col\fR switch allows you to change the name
-of the status column from the default \*(L"\s-1JFILES\s0\*(R".
-.PP
-A join between rows is the Cartesian product of all rows in one file
-having a given join column value with all rows in a second file having
-the same value for its join column and so on. Thus, if file1 has 2
-rows with join column value 100, file2 has 3 rows with the same value,
-and file3 has 4 rows, then the join results in 2*3*4=24 rows being output.
-.PP
-The join algorithm directly processes the index file associated with
-the join column of each file. The smallest value of all the current
-columns is selected as a base, and this value is used to join
-equal-valued columns in the other files. In this way, the index files
-are traversed exactly once.
-.PP
-The \fB\-t tol\fR switch specifies a tolerance value for numeric
-columns. At present, a tolerance value can join only two files at a
-time. (A completely different algorithm is required to join more than
-two files using a tolerance, somethng we might consider implementing
-in the future.)
-.PP
-The following example shows many of the features of funjoin. The input files
-t1.fits, t2.fits, and t3.fits contain the following columns:
-.PP
-.Vb 11
-\& [sh] fundisp t1.fits
-\& AKEY KEY A B
-\& ----------- ------ ------ ------
-\& aaa 0 0 1
-\& bbb 1 3 4
-\& ccc 2 6 7
-\& ddd 3 9 10
-\& eee 4 12 13
-\& fff 5 15 16
-\& ggg 6 18 19
-\& hhh 7 21 22
-.Ve
-.PP
-fundisp t2.fits
- \s-1AKEY\s0 \s-1KEY\s0 C D
- \-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-
- iii 8 24 25
- ggg 6 18 19
- eee 4 12 13
- ccc 2 6 7
- aaa 0 0 1
-.PP
-fundisp t3.fits
- \s-1AKEY\s0 \s-1KEY\s0 E F G
-\&\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-
- ggg 6 18 19 100.10
- jjj 9 27 28 200.20
- aaa 0 0 1 300.30
- ddd 3 9 10 400.40
-.PP
-Given these input files, the following funjoin command:
-.PP
-.Vb 3
-\& funjoin \-s \-a1 "\-B" \-a2 "\-D" \-a3 "\-E" \-b \e
-\& "AKEY:???" \-b1 "AKEY:XXX,A:255" \-b3 "G:NaN,E:-1,F:-100" \e
-\& \-j key t1.fits t2.fits t3.fits foo.fits
-.Ve
-.PP
-will join the files on the \s-1KEY\s0 column, outputting all columns except B
-(in t1.fits), D (in t2.fits) and E (in t3.fits), and setting blank
-values for \s-1AKEY\s0 (globally, but overridden for t1.fits) and A (in file
-1) and G, E, and F (in file 3). A \s-1JFILES\s0 column will be output to
-flag which files were used in each row:
-.PP
-.Vb 12
-\& AKEY KEY A AKEY_2 KEY_2 C AKEY_3 KEY_3 F G JFILES
-\& ------------ ------ ------ ------------ ------ ------ ------------ ------ -------- ----------- --------
-\& aaa 0 0 aaa 0 0 aaa 0 1 300.30 7
-\& bbb 1 3 ??? 0 0 ??? 0 \-100 nan 1
-\& ccc 2 6 ccc 2 6 ??? 0 \-100 nan 3
-\& ddd 3 9 ??? 0 0 ddd 3 10 400.40 5
-\& eee 4 12 eee 4 12 ??? 0 \-100 nan 3
-\& fff 5 15 ??? 0 0 ??? 0 \-100 nan 1
-\& ggg 6 18 ggg 6 18 ggg 6 19 100.10 7
-\& hhh 7 21 ??? 0 0 ??? 0 \-100 nan 1
-\& XXX 0 255 iii 8 24 ??? 0 \-100 nan 2
-\& XXX 0 255 ??? 0 0 jjj 9 28 200.20 4
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funmerge.1 b/funtools/man/man1/funmerge.1
deleted file mode 100644
index 068ba2f..0000000
--- a/funtools/man/man1/funmerge.1
+++ /dev/null
@@ -1,215 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funmerge 1"
-.TH funmerge 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funmerge \- merge one or more Funtools table files
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfunmerge\fR [\-w|\-x] \-f [colname] <iname1> <iname2> ... <oname>
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 3
-\& \-f # output a column specifying file from which this event came
-\& \-w # adjust position values using WCS info
-\& \-x # adjust position values using WCS info and save old values
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfunmerge\fR merges \s-1FITS\s0 data from one or more
-\&\s-1FITS\s0 Binary Table files
-or raw event files.
-.PP
-The first argument to the program specifies the first input \s-1FITS\s0 table
-or raw event file. If \*(L"stdin\*(R" is specified, data are read from the
-standard input. Use Funtools Bracket
-Notation to specify \s-1FITS\s0 extensions and row filters. Subsequent
-arguments specify additional event files and tables to merge. (\s-1NB:\s0 Stdin
-cannot not be used for any of these additional input file arguments.)
-The last argument is the output \s-1FITS\s0 file. The columns in each input table
-must be identical.
-.PP
-If an input file begins with the '@' character, it is processed as an
-include file, i.e., as a text file containing event file names (as
-well as blank lines and/or comment lines starting with the '#' sign).
-If standard input is specified as an include file ('@stdin'), then
-file names are read from the standard input until \s-1EOF\s0 (^D). Event
-files and include files can be mixed on a command line.
-.PP
-Rows from each table are written sequentially to the output
-file. If the switch \fB\-f [colname]\fR is specified on the command
-line, an additional column is added to each row containing the number
-of the file from which that row was taken (starting from one). In
-this case, the corresponding file names are stored in the header
-parameters having the prefix \fB\s-1FUNFIL\s0\fR, i.e., \s-1FUNFIL01\s0,
-\&\s-1FUNFIL02\s0, etc.
-.PP
-Using the \fB\-w\fR switch (or \fB\-x\fR switch as described
-below), \fBfunmerge\fR also can adjust the position column values
-using the \s-1WCS\s0 information in each file. (By position columns, we mean
-the columns that the table is binned on, i.e., those columns defined
-by the \fBbincols=\fR switch, or (X,Y) by default.) To perform \s-1WCS\s0
-alignment, the \s-1WCS\s0 of the first file is taken as the base \s-1WCS\s0. Each
-position in subsequent files is adjusted by first converting it to the
-sky coordinate in its own \s-1WCS\s0 coordinate system, then by converting
-this sky position to the sky position of the base \s-1WCS\s0, and finally
-converting back to a pixel position in the base system. Note that in
-order to perform \s-1WCS\s0 alignment, the appropriate \s-1WCS\s0 and \s-1TLMIN/TLMAX\s0
-keywords must already exist in each \s-1FITS\s0 file.
-.PP
-When performing \s-1WCS\s0 alignment, you can save the original positions in
-the output file by using the \fB\-x\fR (for \*(L"xtra\*(R") switch instead
-of the \fB\-w\fR switch (i.e., using this switch also implies using
-\&\fB\-w\fR) The old positions are saved in columns having the same
-name as the original positional columns, with the added prefix \*(L"\s-1OLD_\s0\*(R".
-.PP
-Examples:
-.PP
-Merge two tables, and preserve the originating file number for
-each row in the column called \*(L"\s-1FILE\s0\*(R" (along with the corresponding
-file name in the header):
-.PP
-.Vb 1
-\& [sh] funmerge \-f "FILE" test.ev test2.ev merge.ev
-.Ve
-.PP
-Merge two tables with \s-1WCS\s0 alignment, saving the old position values in
-2 additional columns:
-.PP
-.Vb 1
-\& [sh] funmerge \-x test.ev test2.ev merge.ev
-.Ve
-.PP
-This program only works on raw event files and binary tables. We have
-not yet implemented image and array merging.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funsky.1 b/funtools/man/man1/funsky.1
deleted file mode 100644
index 45a2cac..0000000
--- a/funtools/man/man1/funsky.1
+++ /dev/null
@@ -1,385 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funsky 1"
-.TH funsky 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funsky \- convert between image and sky coordinates
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 4
-\&\fBfunsky\fR iname[ext] # RA,Dec (deg) or image pix from stdin
-\&\fBfunsky\fR iname[ext] [lname] # RA, Dec (deg) or image pix from list
-\&\fBfunsky\fR iname[ext] [col1] [col2] # named cols:units from stdin
-\&\fBfunsky\fR iname[ext] [lname] [col1] [col2] # named cols:units from list
-.Ve
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 5
-\& \-d # always use integer tlmin conversion (as ds9 does)
-\& \-r # convert x,y to RA,Dec (default: convert RA,Dec to x,y)
-\& \-o # include offset from the nominal target position (in arcsec)
-\& \-v # display input values also (default: display output only)
-\& \-T # output display in rdb format (w/header,tab delimiters)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Funsky converts input sky coordinates (\s-1RA\s0, Dec) to image coordinates (or vice
-versa) using the \s-1WCS\s0 information contained in the specified \s-1FITS\s0 file. Several
-calling sequences are supported in order to make it easy to specify
-coordinate positions in different ways.
-.PP
-The first required argument is always the input \s-1FITS\s0 file (or
-extension) containing the \s-1WCS\s0 information in an extension header. Note
-that the data from this file is not used. By default, the program
-converts input \s-1RA\s0 and Dec values to X and Y using this \s-1WCS\s0
-information. If the \s-1WCS\s0 is associated with a \s-1FITS\s0 image, then the X,Y
-values are image values. If the \s-1WCS\s0 is associated with a binary table,
-then the X, Y values are physical values. To convert X,Y to \s-1RA\s0 and
-Dec, use the \fB\-r\fR (reverse) switch.
-.PP
-If no other command arguments are supplied, then the input positions
-are read from the standard input. Each line is assumed to contain a
-single coordinate position consisting of an \s-1RA\s0 in degrees (or X in
-pixels) followed by a Dec in degrees (or Y in pixels). The usual
-delimiters are supported (spaces, commas, tabs). For example:
-.PP
-.Vb 9
-\& # read from stdin, default column names and units
-\& [sh] funsky snr.ev
-\& 22.982695 58.606523 # input RA (hrs), Dec(deg)
-\& 510.00 510.00
-\& 22.982127 58.607634 # input
-\& 512.00 510.50
-\& 22.981700 58.614301 # input
-\& 513.50 513.50
-\& ^D # end of input
-.Ve
-.PP
-If a second argument is supplied, this argument is assumed to be
-a file containing \s-1RA\s0 (X) and Dec (Y) positions. The file can either be
-an \s-1ASCII\s0 table or a \s-1FITS\s0 binary table. The order of columns is
-unimportant, if the table has a column header. In this case, the
-names of the columns must be one of \*(L"\s-1RA\s0\*(R", \*(L"\s-1DEC\s0\*(R", or \*(L"X\*(R", \*(L"Y\*(R" for sky
-to image and image to sky conversions, respectively. If the table has
-no header, then once again, \s-1RA\s0 (X) is assumed to first, followed
-by \s-1DEC\s0 (Y).
-For example:
-.PP
-.Vb 7
-\& # read from file, default column names and units
-\& [sh] cat hd.in
-\& RA DEC
-\& --------- ---------
-\& 22.982695 58.606523
-\& 22.982127 58.607634
-\& 22.981700 58.614301
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky snr.ev hd.in
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-If three arguments are supplied, then the input positions again are
-read from the standard input. Each line is assumed to contain a single
-coordinate position consisting of an \s-1RA\s0 (or X in pixels) followed by a
-Dec (or Y in pixels), with the usual delimiters supported. However,
-the second and third arguments now specify the column names and/or
-sky units using a colon-delimited syntax:
-.PP
-.Vb 1
-\& [colname]:[h|d|r]
-.Ve
-.PP
-If the colname is omitted, the names default to \*(L"\s-1RA\s0\*(R", \*(L"\s-1DEC\s0\*(R", \*(L"X\*(R", \*(L"Y\*(R",
-\&\*(L"\s-1COL1\s0\*(R", or \*(L"\s-1COL2\s0\*(R" as above. If the units are omitted, the default is degrees
-for both \s-1RA\s0 and Dec. When the \-r switch is used (convert from image
-to sky) the units are applied to the output instead of the input. The following
-examples will serve to illustrate the options:
-.PP
-.Vb 7
-\& # read from stdin, specifying column names (def. units: degrees)
-\& [sh] cat hd.in
-\& MYRA MYDEC
-\& --------- ---------
-\& 22.982695 58.606523
-\& 22.982127 58.607634
-\& 22.981700 58.614301
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky snr.ev MYRA MYDEC < hd.in
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 7
-\& # read from stdin, specifying column names and units
-\& [sh] cat dd.in
-\& MYRA MYDEC
-\& --------- ---------
-\& 344.740432 58.606523
-\& 344.731900 58.607634
-\& 344.725500 58.614301
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky snr.ev MYRA:d MYDEC:d < dd.in
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 5
-\& # read stdin, convert image to sky, specifying output sky units
-\& [sh] cat im.in
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 4
-\& [sh] cat im.in | funsky \-r snr.ev :d :d
-\& 344.740432 58.606523
-\& 344.731900 58.607634
-\& 344.725500 58.614301
-.Ve
-.PP
-Finally, four command arguments specify both and input file and column names
-and/or units:
-.PP
-.Vb 6
-\& [sh] cat dd.in
-\& MYRA MYDEC
-\& --------- ---------
-\& 344.740432 58.606523
-\& 344.731900 58.607634
-\& 344.725500 58.614301
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 5
-\& # read file, convert image to sky, specifying output sky units
-\& [sh] cat im.in
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky \-r snr.ev im.in :d :d
-\& 344.740432 58.606523
-\& 344.731900 58.607634
-\& 344.725500 58.614301
-.Ve
-.PP
-By default, the output of funsky consists only of the converted coordinate
-position(s), one per output line. This makes parsing in shell scripts easy.
-Use the \fB\-v\fR (verbose) switch to specify that the input
-coordinates should be pre-pended to each line. For example:
-.PP
-.Vb 6
-\& [sh] cat dd.in
-\& MYRA MYDEC
-\& --------- ---------
-\& 344.740432 58.606523
-\& 344.731900 58.607634
-\& 344.725500 58.614301
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky snr.ev dd.in MYRA:d MYDEC:d
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 4
-\& [sh] funsky \-v snr.ev dd.in MYRA:d MYDEC:d
-\& 344.740432 58.606523 510.00 510.00
-\& 344.731900 58.607634 512.00 510.50
-\& 344.725500 58.614301 513.50 513.50
-.Ve
-.PP
-In addition, a full starbase table can be output using the \fB\-T\fR
-(table) switch. This switch can be used with or without the \-v
-switch. If the \-T and \-v are both specified, then a descriptive header
-parameters are output before the table (mainly to remind you of the
-sky units):
-.PP
-.Vb 7
-\& # output table in non-verbose mode
-\& [sh] funsky \-T snr.ev dd.in MYRA:d MYDEC:d
-\& X Y
-\& ------------ ------------
-\& 510.00 510.00
-\& 512.00 510.50
-\& 513.50 513.50
-.Ve
-.PP
-.Vb 9
-\& # output table in verbose mode
-\& [sh] funsky \-T \-v snr.ev dd.in MYRA:d MYDEC:d
-\& # IFILE = /Users/eric/data/snr.ev
-\& # ICOL1 = MYRA
-\& # ICOL2 = MYDEC
-\& # IUNITS1 = d
-\& # IUNITS2 = d
-\& # OCOL1 = X
-\& # OCOL2 = Y
-.Ve
-.PP
-.Vb 5
-\& MYRA MYDEC X Y
-\& ------------ ------------ ------------ ------------
-\& 344.740432 58.606523 510.00 510.00
-\& 344.731900 58.607634 512.00 510.50
-\& 344.725500 58.614301 513.50 513.50
-.Ve
-.PP
-Finally, the \fB\-d\fR (ds9) switch mimicks ds9's use of integer \s-1TLMIN\s0
-and \s-1TLMAX\s0 values for all coordinate transformations. \s-1FITS\s0 conventions
-seem to call for use of floating point \s-1TLMIN\s0 and \s-1TLMAX\s0 when the data are
-floats. This convention is followed by funsky but results in a
-small discrepancy with ds9's converted values for floating point
-data. We will remedy this conflict in the future, maybe.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funtable.1 b/funtools/man/man1/funtable.1
deleted file mode 100644
index fe3b7ac..0000000
--- a/funtools/man/man1/funtable.1
+++ /dev/null
@@ -1,356 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funtable 1"
-.TH funtable 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funtable \- copy selected rows from a Funtools file to a FITS binary table
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfuntable\fR [\-a] [\-i|\-z] [\-m] [\-s cols] <iname> <oname> [columns]
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 5
-\& \-a # append to existing output file as a table extension
-\& \-i # for image data, only generate X and Y columns
-\& \-m # for tables, write a separate file for each region
-\& \-s "col1 ..." # columns on which to sort
-\& \-z # for image data, output zero-valued pixels
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBfuntable\fR selects rows from the specified
-\&\s-1FITS\s0 Extension
-(binary table only) of a \s-1FITS\s0 file, or from a non-FITS raw event
-file, and writes those rows to a \s-1FITS\s0 binary table file. It also
-will create a \s-1FITS\s0 binary table from an image or a raw array file.
-.PP
-The first argument to the program specifies the \s-1FITS\s0 file, raw event
-file, or raw array file. If \*(L"stdin\*(R" is specified, data are read from
-the standard input. Use Funtools Bracket
-Notation to specify \s-1FITS\s0 extensions, and filters. The second
-argument is the output \s-1FITS\s0 file. If \*(L"stdout\*(R" is specified, the \s-1FITS\s0
-binary table is written to the standard output. By default, all
-columns of the input file are copied to the output file. Selected
-columns can be output using an optional third argument in the form:
-.PP
-.Vb 1
-\& "column1 column1 ... columnN"
-.Ve
-.PP
-The \fBfuntable\fR program generally is used to select rows from a
-\&\s-1FITS\s0 binary table using
-Table Filters
-and/or
-Spatial Region Filters.
-For example, you can copy only selected rows (and output only selected
-columns) by executing in a command such as:
-.PP
-.Vb 13
-\& [sh] funtable "test.ev[pha==1&&pi==10]" stdout "x y pi pha" | fundisp stdin
-\& X Y PHA PI
-\& ------- ------- ------- ---------
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-\& 1 10 1 10
-.Ve
-.PP
-The special column \fB$REGION\fR can be specified to write the
-region id of each row:
-.PP
-.Vb 12
-\& [sh $] funtable "test.ev[time-(int)time>=.99&&annulus(0 0 0 10 n=3)]" stdout 'x y time $REGION' | fundisp stdin
-\& X Y TIME REGION
-\& -------- -------- --------------------- ----------
-\& 5 \-6 40.99000000 3
-\& 4 \-5 59.99000000 2
-\& \-1 0 154.99000000 1
-\& \-2 1 168.99000000 1
-\& \-3 2 183.99000000 2
-\& \-4 3 199.99000000 2
-\& \-5 4 216.99000000 2
-\& \-6 5 234.99000000 3
-\& \-7 6 253.99000000 3
-.Ve
-.PP
-Here only rows with the proper fractional time and whose position also is
-within one of the three annuli are written.
-.PP
-Columns can be excluded from display using a minus sign before the
-column:
-.PP
-.Vb 12
-\& [sh $] funtable "test.ev[time-(int)time>=.99]" stdout "\-time" | fundisp stdin
-\& X Y PHA PI DX DY
-\& -------- -------- -------- ---------- ----------- -----------
-\& 5 \-6 5 \-6 5.50 \-6.50
-\& 4 \-5 4 \-5 4.50 \-5.50
-\& \-1 0 \-1 0 \-1.50 0.50
-\& \-2 1 \-2 1 \-2.50 1.50
-\& \-3 2 \-3 2 \-3.50 2.50
-\& \-4 3 \-4 3 \-4.50 3.50
-\& \-5 4 \-5 4 \-5.50 4.50
-\& \-6 5 \-6 5 \-6.50 5.50
-\& \-7 6 \-7 6 \-7.50 6.50
-.Ve
-.PP
-All columns except the time column are written.
-.PP
-In general, the rules for activating and de-activating columns are:
-.IP "\(bu" 4
-If only exclude columns are specified, then all columns but
-the exclude columns will be activated.
-.IP "\(bu" 4
-If only include columns are specified, then only the specified columns
-are activated.
-.IP "\(bu" 4
-If a mixture of include and exclude columns are specified, then
-all but the exclude columns will be active; this last case
-is ambiguous and the rule is arbitrary.
-.PP
-In addition to specifying columns names explicitly, the special
-symbols \fI+\fR and \fI\-\fR can be used to activate and
-de-activate \fIall\fR columns. This is useful if you want to
-activate the \f(CW$REGION\fR column along with all other columns. According
-to the rules, the syntax \*(L"$REGION\*(R" only activates the region column
-and de-activates the rest. Use \*(L"+ \f(CW$REGION\fR\*(R" to activate all
-columns as well as the region column.
-.PP
-Ordinarily, only the selected table is copied to the output file. In
-a \s-1FITS\s0 binary table, it sometimes is desirable to copy all of the
-other \s-1FITS\s0 extensions to the output file as well. This can be done by
-appending a '+' sign to the name of the extension in the input file
-name. For example, the first command below copies only the \s-1EVENT\s0 table,
-while the second command copies other extensions as well:
-.PP
-.Vb 2
-\& [sh] funtable "/proj/rd/data/snr.ev[EVENTS]" events.ev
-\& [sh] funtable "/proj/rd/data/snr.ev[EVENTS+]" eventsandmore.ev
-.Ve
-.PP
-If the input file is an image or a raw array file, then
-\&\fBfuntable\fR will generate a \s-1FITS\s0 binary table from the pixel
-values in the image. Note that it is not possible to specify the
-columns to output (using command-line argument 3). Instead, there are
-two ways to create such a binary table from an image. By default, a
-3\-column table is generated, where the columns are \*(L"X\*(R", \*(L"Y\*(R", and
-\&\*(L"\s-1VALUE\s0\*(R". For each pixel in the image, a single row (event) is
-generated with the \*(L"X\*(R" and \*(L"Y\*(R" columns assigned the dim1 and dim2
-values of the image pixel, respectively and the \*(L"\s-1VALUE\s0\*(R" column
-assigned the value of the pixel. With sort of table, running
-\&\fBfunhist\fR on the \*(L"\s-1VALUE\s0\*(R" column will give the same results as
-running \fBfunhist\fR on the original image.
-.PP
-If the \fB\-i\fR (\*(L"individual\*(R" rows) switch is specified, then only
-the \*(L"X\*(R" and \*(L"Y\*(R" columns are generated. In this case, each positive
-pixel value in the image generates n rows (events), where n is equal
-to the integerized value of that pixel (plus 0.5, for floating point
-data). In effect, \fB\-i\fR approximately recreates the rows of a
-table that would have been binned into the input image. (Of course,
-this is only approximately correct, since the resulting x,y positions
-are integerized.)
-.PP
-If the \fB\-s [col1 col2 ... coln]\fR (\*(L"sort\*(R") switch is specified,
-the output rows of a binary table will be sorted using the
-specified columns as sort keys. The sort keys must be scalar columns
-and also must be part of the output file (i.e. you cannot sort on a
-column but not include it in the output). This facility uses the
-\&\fB_sort\fR program (included with funtools), which must be accessible
-via your path.
-.PP
-For binary tables, the \fB\-m\fR (\*(L"multiple files\*(R") switch will
-generate a separate file for each region in the filter specification
-i.e. each file contains only the rows from that region. Rows
-which pass the filter but are not in any region also are put in a
-separate file.
-.PP
-The separate output file names generated by the \fB\-m\fR switch are
-produced automatically from the root output file to contain the region id of
-the associated region. (Note that region ids start at 1, so that the
-file name associated with id 0 contains rows that pass the filter but
-are not in any given region.) Output file names are generated as follows:
-.IP "\(bu" 4
-A \f(CW$n\fR specification can be used anywhere in the root file name (suitably
-quoted to protect it from the shell) and will be expanded to be the id
-number of the associated region. For example:
-.Sp
-.Vb 1
-\& funtable \-m input.fits'[cir(512,512,1);cir(520,520,1)...]' 'foo.goo_$n.fits'
-.Ve
-.Sp
-will generate files named foo.goo_0.fits (for rows not in any region but
-still passing the filter), foo.goo_1.fits (rows in region id #1, the first
-region), foo.goo_2.fits (rows in region id #2), etc. Note that single quotes
-in the output root are required to protect the '$' from the shell.
-.IP "\(bu" 4
-If \f(CW$n\fR is not specified, then the region id will be placed before
-the first dot (.) in the filename. Thus:
-.Sp
-.Vb 1
-\& funtable \-m input.fits'[cir(512,512,1);cir(520,520,1)...]' foo.evt.fits
-.Ve
-.Sp
-will generate files named foo0.evt.fits (for rows not in any region but
-still passing the filter), foo1.evt.fits (rows in region id #1),
-foo2.evt.fits (rows in region id #2), etc.
-.IP "\(bu" 4
-If no dot is specified in the root output file name, then
-the region id will be appended to the filename. Thus:
-.Sp
-.Vb 1
-\& funtable \-m input.fits'[cir(512,512,1);cir(520,520,1)...]' 'foo_evt'
-.Ve
-.Sp
-will generate files named foo_evt0 (for rows not in any region but
-still passing the filter), foo_evt1 (rows in region id #1),
-foo_evt2 (rows in region id #2), etc.
-.PP
-The multiple file mechanism provide a simple way to generate
-individual source data files with a single pass through the data.
-.PP
-By default, a new \s-1FITS\s0 file is created and the binary table is written
-to the first extension. If the \fB\-a\fR (append) switch is specified,
-the table is appended to an existing \s-1FITS\s0 file as a \s-1BINTABLE\s0 extension.
-Note that the output \s-1FITS\s0 file must already exist.
-.PP
-If the \fB\-z\fR (\*(L"zero\*(R" pixel values) switch is specified and
-\&\fB\-i\fR is not specified, then pixels having a zero value will
-be output with their \*(L"\s-1VALUE\s0\*(R" column set to zero. Obviously, this
-switch does not make sense when individual events are output.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man1/funtbl.1 b/funtools/man/man1/funtbl.1
deleted file mode 100644
index fbfc03e..0000000
--- a/funtools/man/man1/funtbl.1
+++ /dev/null
@@ -1,249 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funtbl 1"
-.TH funtbl 1 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-funtbl \- extract a table from Funtools ASCII output
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-\&\fBfuntable\fR [\-c cols] [\-h] [\-n table] [\-p prog] [\-s sep] <iname>
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-[\s-1NB:\s0 This program has been deprecated in favor of the \s-1ASCII\s0 text processing
-support in funtools. You can now perform fundisp on funtools \s-1ASCII\s0 output
-files (specifying the table using bracket notation) to extract tables
-and columns.]
-.PP
-The \fBfuntbl\fR script extracts a specified table (without the
-header and comments) from a funtools \s-1ASCII\s0 output file and writes the
-result to the standard output. The first non-switch argument is the
-\&\s-1ASCII\s0 input file name (i.e. the saved output from funcnts, fundisp,
-funhist, etc.). If no filename is specified, stdin is read. The
-\&\-n switch specifies which table (starting from 1) to extract. The
-default is to extract the first table. The \-c switch is a
-space-delimited list of column numbers to output, e.g. \-c \*(L"1 3 5\*(R"
-will extract the first three odd-numbered columns. The default is to
-extract all columns. The \-s switch specifies the separator string to
-put between columns. The default is a single space. The \-h switch
-specifies that column names should be added in a header line before
-the data is output. Without the switch, no header is prepended. The
-\&\-p program switch allows you to specify an awk-like program to run
-instead of the default (which is host-specific and is determined at
-build time). The \-T switch will output the data in rdb format (i.e.,
-with a 2\-row header of column names and dashes, and with data columns
-separated by tabs). The \-help switch will print out a message
-describing program usage.
-.PP
-For example, consider the output from the following funcnts command:
-.PP
-.Vb 10
-\& [sh] funcnts \-sr snr.ev "ann 512 512 0 9 n=3"
-\& # source
-\& # data file: /proj/rd/data/snr.ev
-\& # arcsec/pixel: 8
-\& # background
-\& # constant value: 0.000000
-\& # column units
-\& # area: arcsec**2
-\& # surf_bri: cnts/arcsec**2
-\& # surf_err: cnts/arcsec**2
-.Ve
-.PP
-.Vb 6
-\& # summed background-subtracted results
-\& upto net_counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
-\& 2 625.000 25.000 0.000 0.000 6976.00 0.090 0.004
-\& 3 1442.000 37.974 0.000 0.000 15936.00 0.090 0.002
-.Ve
-.PP
-.Vb 6
-\& # background-subtracted results
-\& reg net_counts error background berror area surf_bri surf_err
-\& ---- ------------ --------- ------------ --------- --------- --------- ---------
-\& 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008
-\& 2 478.000 21.863 0.000 0.000 5376.00 0.089 0.004
-\& 3 817.000 28.583 0.000 0.000 8960.00 0.091 0.003
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source_region(s)
-\& ----------------
-\& ann 512 512 0 9 n=3
-.Ve
-.PP
-.Vb 5
-\& reg counts pixels sumcnts sumpix
-\& ---- ------------ --------- ------------ ---------
-\& 1 147.000 25 147.000 25
-\& 2 478.000 84 625.000 109
-\& 3 817.000 140 1442.000 249
-.Ve
-.PP
-There are four tables in this output. To extract the last one, you
-can execute:
-.PP
-.Vb 4
-\& [sh] funcnts \-s snr.ev "ann 512 512 0 9 n=3" | funtbl \-n 4
-\& 1 147.000 25 147.000 25
-\& 2 478.000 84 625.000 109
-\& 3 817.000 140 1442.000 249
-.Ve
-.PP
-Note that the output has been re-formatted so that only a single space
-separates each column, with no extraneous header or comment information.
-.PP
-To extract only columns 1,2, and 4 from the last example (but with a header
-prepended and tabs between columns), you can execute:
-.PP
-.Vb 5
-\& [sh] funcnts \-s snr.ev "ann 512 512 0 9 n=3" | funtbl \-c "1 2 4" \-h \-n 4 \-s "\et"
-\& #reg counts sumcnts
-\& 1 147.000 147.000
-\& 2 478.000 625.000
-\& 3 817.000 1442.000
-.Ve
-.PP
-Of course, if the output has previously been saved in a file named
-foo.out, the same result can be obtained by executing:
-.PP
-.Vb 5
-\& [sh] funtbl \-c "1 2 4" \-h \-n 4 \-s "\et" foo.out
-\& #reg counts sumcnts
-\& 1 147.000 147.000
-\& 2 478.000 625.000
-\& 3 817.000 1442.000
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funclose.3 b/funtools/man/man3/funclose.3
deleted file mode 100644
index dc8dbd2..0000000
--- a/funtools/man/man3/funclose.3
+++ /dev/null
@@ -1,160 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funclose 3"
-.TH funclose 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunClose \- close a Funtools data file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& void FunClose(Fun fun)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunClose()\fB\fR routine closes a previously-opened Funtools data
-file, freeing control structures. If a
-Funtools reference handle
-was passed to
-the \fIFunOpen()\fR call for this file,
-and if copy mode also was specified for that file, then
-\&\fIFunClose()\fR also will copy the
-remaining extensions from the input file to the output file (if the
-input file still is open). Thus, we recommend always closing the
-output Funtools file \fBbefore\fR the input file. (Alternatively,
-you can call \fIFunFlush()\fR
-explicitly).
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funcolumnactivate.3 b/funtools/man/man3/funcolumnactivate.3
deleted file mode 100644
index 2eda34b..0000000
--- a/funtools/man/man3/funcolumnactivate.3
+++ /dev/null
@@ -1,330 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcolumnactivate 3"
-.TH funcolumnactivate 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunColumnActivate \- activate Funtools columns
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& void FunColumnActivate(Fun fun, char *s, char *plist)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunColumnActivate()\fB\fR routine determines which columns (set up
-by \fIFunColumnSelect()\fR)
-ultimately will be read and/or written. By default, all columns that
-are selected using
-\&\fIFunColumnSelect()\fR
-are activated. The
-\&\fIFunColumnActivate()\fR
-routine can be used to turn off/off activation of specific columns.
-.PP
-The first argument is the Fun handle associated with this set of
-columns. The second argument is a space-delimited list of columns to
-activate or de\-activate. Columns preceded by \*(L"+\*(R" are activated and
-columns preceded by a \*(L"\-\*(R" are de\-activated. If a column is named
-without \*(L"+\*(R" or \*(L"\-\*(R", it is activated. The reserved strings \*(L"$region\*(R"
-and '$n' are used to activate a special columns containing the filter
-region value and row value, respectively, associated with
-this row. For example, if a filter containing two circular regions is
-specified as part of the Funtools file name, this column will contain
-a value of 1 or 2, depending on which region that row was in. The
-reserved strings \*(L"$x\*(R" and \*(L"$y\*(R" are used to activate the current
-binning columns. Thus, if the columns \s-1DX\s0 and \s-1DY\s0 are specified as
-binning columns:
-.PP
-.Vb 1
-\& [sh $] fundisp foo.fits[bincols=(DX,DY)]
-.Ve
-.PP
-then \*(L"$x\*(R" and \*(L"$y\*(R" will refer to these columns in a call to
-\&\fIFunColumnActivate()\fR.
-.PP
-In addition, if the activation string contains only columns to be
-activated, then the routine will de-activate all other columns.
-Similarly, if the activation string contains only
-columns to de\-activate, then the routine will activate all other columns
-before activating the list. This makes it simple to change the
-activation state of all columns without having to know all of the
-column names. For example:
-.IP "\(bu" 4
-\&\fB\*(L"pi pha time\*(R"\fR # only these three columns will be active
-.IP "\(bu" 4
-\&\fB\*(L"\-pi \-pha \-time\*(R"\fR # all but these columns will be active
-.IP "\(bu" 4
-\&\fB\*(L"pi \-pha\*(R"\fR # only pi is active, pha is not, others are not
-.IP "\(bu" 4
-\&\fB\*(L"+pi \-pha\*(R"\fR # same as above
-.IP "\(bu" 4
-\&\fB\*(L"pi \-pha \-time\*(R"\fR # only pi is active, all others are not
-.IP "\(bu" 4
-\&\fB\*(L"pi pha\*(R"\fR # pha and pi are active, all others are not
-.IP "\(bu" 4
-\&\fB\*(L"pi pha \-x \-y\*(R"\fR # pha and pi are active, all others are not
-.PP
-You can use the column activation list to reorder columns, since
-columns are output in the order specified. For example:
-.PP
-.Vb 9
-\& # default output order
-\& fundisp snr.ev'[cir 512 512 .1]'
-\& X Y PHA PI TIME DX DY
-\& -------- -------- -------- -------- --------------------- -------- --------
-\& 512 512 6 7 79493997.45854475 578 574
-\& 512 512 8 9 79494575.58943175 579 573
-\& 512 512 5 6 79493631.03866175 578 575
-\& 512 512 5 5 79493290.86521725 578 575
-\& 512 512 8 9 79493432.00990875 579 573
-.Ve
-.PP
-.Vb 9
-\& # re-order the output by specifying explicit order
-\& fundisp snr.ev'[cir 512 512 .1]' "time x y dy dx pi pha"
-\& TIME X Y DY DX PI PHA
-\& --------------------- -------- -------- -------- -------- -------- --------
-\& 79493997.45854475 512 512 574 578 7 6
-\& 79494575.58943175 512 512 573 579 9 8
-\& 79493631.03866175 512 512 575 578 6 5
-\& 79493290.86521725 512 512 575 578 5 5
-\& 79493432.00990875 512 512 573 579 9 8
-.Ve
-.PP
-A \*(L"+\*(R" sign by itself means to activate all columns, so that you can reorder
-just a few columns without specifying all of them:
-.PP
-.Vb 9
-\& # reorder 3 columns and then output the rest
-\& fundisp snr.ev'[cir 512 512 .1]' "time pi pha +"
-\& TIME PI PHA Y X DX DY
-\& --------------------- -------- -------- -------- -------- -------- --------
-\& 79493997.45854475 7 6 512 512 578 574
-\& 79494575.58943175 9 8 512 512 579 573
-\& 79493631.03866175 6 5 512 512 578 575
-\& 79493290.86521725 5 5 512 512 578 575
-\& 79493432.00990875 9 8 512 512 579 573
-.Ve
-.PP
-The column activation/deactivation is performed in the order of the
-specified column arguments. This means you can mix \*(L"+\*(R", \*(L"\-\*(R" (which
-de-activates all columns) and specific column names to reorder and
-select columns in one command. For example, consider the following:
-.PP
-.Vb 9
-\& # reorder and de-activate
-\& fundisp snr.ev'[cir 512 512 .1]' "time pi pha + \-x \-y"
-\& TIME PI PHA DX DY
-\& --------------------- -------- -------- -------- --------
-\& 79493997.45854475 7 6 578 574
-\& 79494575.58943175 9 8 579 573
-\& 79493631.03866175 6 5 578 575
-\& 79493290.86521725 5 5 578 575
-\& 79493432.00990875 9 8 579 573
-.Ve
-.PP
-We first activate \*(L"time\*(R", \*(L"pi\*(R", and \*(L"pha\*(R" so that they are output first.
-We then activate all of the other columns, and then de-activate \*(L"x\*(R" and \*(L"y\*(R".
-Note that this is different from:
-.PP
-.Vb 9
-\& # probably not what you want ...
-\& fundisp snr.ev'[cir 512 512 .1]' "time pi pha \-x \-y +"
-\& TIME PI PHA Y X DX DY
-\& --------------------- -------- -------- -------- -------- -------- --------
-\& 79493997.45854475 7 6 512 512 578 574
-\& 79494575.58943175 9 8 512 512 579 573
-\& 79493631.03866175 6 5 512 512 578 575
-\& 79493290.86521725 5 5 512 512 578 575
-\& 79493432.00990875 9 8 512 512 579 573
-.Ve
-.PP
-Here, \*(L"x\*(R" and \*(L"y\*(R" are de\-activated, but then all columns including \*(L"x\*(R" and
-\&\*(L"y\*(R" are again re\-activated.
-.PP
-Typically,
-\&\fIFunColumnActivate()\fR uses a
-list of columns that are passed into the program from the command line. For
-example, the code for funtable contains the following:
-.PP
-.Vb 1
-\& char *cols=NULL;
-.Ve
-.PP
-.Vb 3
-\& /* open the input FITS file */
-\& if( !(fun = FunOpen(argv[1], "rc", NULL)) )
-\& gerror(stderr, "could not FunOpen input file: %s\en", argv[1]);
-.Ve
-.PP
-.Vb 3
-\& /* set active flag for specified columns */
-\& if( argc >= 4 ) cols = argv[3];
-\& FunColumnActivate(fun, cols, NULL);
-.Ve
-.PP
-The \fIFunOpen()\fR call sets the
-default columns to be all columns in the input file. The
-\&\fIFunColumnActivate()\fR call
-then allows the user to control which columns ultimately will be
-activated (i.e., in this case, written to the new file). For example:
-.PP
-.Vb 1
-\& funtable test.ev foo.ev "pi pha time"
-.Ve
-.PP
-will process only the three columns mentioned, while:
-.PP
-.Vb 1
-\& funtable test.ev foo.ev "\-time"
-.Ve
-.PP
-will process all columns except \*(L"time\*(R".
-.PP
-If \fIFunColumnActivate()\fR
-is called with a null string, then the environment variable
-\&\fB\s-1FUN_COLUMNS\s0\fR will be used to provide a global value, if present.
-This is the reason why we call the routine even if no columns
-are specified on the command line (see example above), instead
-of calling it this way:
-.PP
-.Vb 4
-\& /* set active flag for specified columns */
-\& if( argc >= 4 ){
-\& FunColumnActivate(fun, argv[3], NULL);
-\& }
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funcolumnlookup.3 b/funtools/man/man3/funcolumnlookup.3
deleted file mode 100644
index 15c9c36..0000000
--- a/funtools/man/man3/funcolumnlookup.3
+++ /dev/null
@@ -1,220 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcolumnlookup 3"
-.TH funcolumnlookup 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunColumnLookup \- lookup a Funtools column
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 3
-\& int FunColumnLookup(Fun fun, char *s, int which,
-\& char **name, int *type, int *mode,
-\& int *offset, int *n, int *width)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunColumnLookup()\fB\fR routine returns information about a named
-(or indexed) column. The first argument is the Fun handle associated
-with this set of columns. The second argument is the name of the
-column to look up. If the name argument is \s-1NULL\s0, the argument that
-follows is the zero-based index into the column array of the column
-for which information should be returned. The next argument is a
-pointer to a char *, which will contain the name of the column. The
-arguments that follow are the addresses of int values into which
-the following information will be returned:
-.IP "\(bu" 4
-\&\fBtype\fR: data type of column:
-.RS 4
-.IP "\(bu" 4
-A: \s-1ASCII\s0 characters
-.IP "\(bu" 4
-B: unsigned 8-bit char
-.IP "\(bu" 4
-I: signed 16-bit int
-.IP "\(bu" 4
-U: unsigned 16-bit int (not standard \s-1FITS\s0)
-.IP "\(bu" 4
-J: signed 32-bit int
-.IP "\(bu" 4
-V: unsigned 32-bit int (not standard \s-1FITS\s0)
-.IP "\(bu" 4
-E: 32-bit float
-.IP "\(bu" 4
-D: 64-bit float
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-\&\fBmode\fR: bit flag status of column, including:
-.RS 4
-.IP "\(bu" 4
-\&\s-1COL_ACTIVE\s0 1 is column activated?
-.IP "\(bu" 4
-\&\s-1COL_IBUF\s0 2 is column in the raw input data?
-.IP "\(bu" 4
-\&\s-1COL_PTR\s0 4 is column a pointer to an array?
-.IP "\(bu" 4
-\&\s-1COL_READ\s0 010 is read mode selected?
-.IP "\(bu" 4
-\&\s-1COL_WRITE\s0 020 is write mode selected?
-.IP "\(bu" 4
-\&\s-1COL_REPLACEME\s0 040 is this column being replaced by user data?
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-\&\fBoffset\fR: byte offset in struct
-.IP "\(bu" 4
-\&\fBn\fR: number of elements (i.e. size of vector) in this column
-.IP "\(bu" 4
-\&\fBwidth\fR: size in bytes of this column
-.PP
-If the named column exists, the routine returns a positive integer,
-otherwise zero is returned. (The positive integer is the index+1 into
-the column array where this column was located.)
-.PP
-If \s-1NULL\s0 is passed as the return address of one (or more) of these
-values, no data is passed back for that information. For
-example:
-.PP
-.Vb 2
-\& if( !FunColumnLookup(fun, "phas", 0, NULL NULL, NULL, NULL, &npha, NULL) )
-\& gerror(stderr, "can't find phas column\en");
-.Ve
-.PP
-only returns information about the size of the phas vector.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funcolumnselect.3 b/funtools/man/man3/funcolumnselect.3
deleted file mode 100644
index 88158c0..0000000
--- a/funtools/man/man3/funcolumnselect.3
+++ /dev/null
@@ -1,664 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcolumnselect 3"
-.TH funcolumnselect 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunColumnSelect \- select Funtools columns
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 5
-\& int FunColumnSelect(Fun fun, int size, char *plist,
-\& char *name1, char *type1, char *mode1, int offset1,
-\& char *name2, char *type2, char *mode2, int offset2,
-\& ...,
-\& NULL)
-.Ve
-.PP
-.Vb 3
-\& int FunColumnSelectArr(Fun fun, int size, char *plist,
-\& char **names, char **types, char **modes,
-\& int *offsets, int nargs);
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunColumnSelect()\fB\fR routine is used to select the columns
-from a Funtools binary table extension or raw event file for
-processing. This routine allows you to specify how columns in a file
-are to be read into a user record structure or written from a user
-record structure to an output \s-1FITS\s0 file.
-.PP
-The first argument is the Fun handle associated with this set of
-columns. The second argument specifies the size of the user record
-structure into which columns will be read. Typically, the \fIsizeof()\fR
-macro is used to specify the size of a record structure. The third
-argument allows you to specify keyword directives for the selection
-and is described in more detail below.
-.PP
-Following the first three required arguments is a variable length list of
-column specifications. Each column specification will consist of four
-arguments:
-.IP "\(bu" 4
-\&\fBname\fR: the name of the column
-.IP "\(bu" 4
-\&\fBtype\fR: the data type of the column as it will be stored in
-the user record struct (not the data type of the input file). The
-following basic data types are recognized:
-.RS 4
-.IP "\(bu" 4
-A: \s-1ASCII\s0 characters
-.IP "\(bu" 4
-B: unsigned 8-bit char
-.IP "\(bu" 4
-I: signed 16-bit int
-.IP "\(bu" 4
-U: unsigned 16-bit int (not standard \s-1FITS\s0)
-.IP "\(bu" 4
-J: signed 32-bit int
-.IP "\(bu" 4
-V: unsigned 32-bit int (not standard \s-1FITS\s0)
-.IP "\(bu" 4
-E: 32-bit float
-.IP "\(bu" 4
-D: 64-bit float
-.RE
-.RS 4
-.Sp
-The syntax used is similar to that which defines the \s-1TFORM\s0 parameter
-in \s-1FITS\s0 binary tables. That is, a numeric repeat value can precede
-the type character, so that \*(L"10I\*(R" means a vector of 10 short ints, \*(L"E\*(R"
-means a single precision float, etc. Note that the column value from
-the input file will be converted to the specified data type as the
-data is read by
-\&\fIFunTableRowGet()\fR.
-.Sp
-[ A short digression regarding bit\-fields: Special attention is
-required when reading or writing the \s-1FITS\s0 bit-field type
-(\*(L"X\*(R"). Bit-fields almost always have a numeric repeat character
-preceding the 'X' specification. Usually this value is a multiple of 8
-so that bit-fields fit into an integral number of bytes. For all
-cases, the byte size of the bit-field B is (N+7)/8, where N is the
-numeric repeat character.
-.Sp
-A bit-field is most easily declared in the user struct as an array of
-type char of size B as defined above. In this case, bytes are simply
-moved from the file to the user space. If, instead, a short or int
-scalar or array is used, then the algorithm for reading the bit-field
-into the user space depends on the size of the data type used along
-with the value of the repeat character. That is, if the user data
-size is equal to the byte size of the bit\-field, then the data is
-simply moved (possibly with endian-based byte\-swapping) from one to
-the other. If, on the other hand, the data storage is larger than the
-bit-field size, then a data type cast conversion is performed to move
-parts of the bit-field into elements of the array. Examples will help
-make this clear:
-.IP "\(bu" 4
-If the file contains a 16X bit-field and user space specifies a 2B
-char array[2], then the bit-field is moved directly into the char array.
-.IP "\(bu" 4
-If the file contains a 16X bit-field and user space specifies a 1I
-scalar short int, then the bit-field is moved directly into the short int.
-.IP "\(bu" 4
-If the file contains a 16X bit-field and user space specifies a 1J
-scalar int, then the bit-field is type-cast to unsigned int before
-being moved (use of unsigned avoids possible sign extension).
-.IP "\(bu" 4
-If the file contains a 16X bit-field and user space specifies a 2J
-int array[2], then the bit-field is handled as 2 chars, each of which
-are type-cast to unsigned int before being moved (use of unsigned
-avoids possible sign extension).
-.IP "\(bu" 4
-If the file contains a 16X bit-field and user space specifies a 1B
-char, then the bit-field is treated as a char, i.e., truncation will
-occur.
-.IP "\(bu" 4
-If the file contains a 16X bit-field and user space specifies a 4J
-int array[4], then the results are undetermined.
-.RE
-.RS 4
-.Sp
-For all user data types larger than char, the bit-field is byte-swapped
-as necessary to convert to native format, so that bits in the
-resulting data in user space can be tested, masked, etc. in the same
-way regardless of platform.]
-.Sp
-In addition to setting data type and size, the \fBtype\fR
-specification allows a few ancillary parameters to be set, using the
-full syntax for \fBtype\fR:
-.Sp
-.Vb 1
-\& [@][n]<type>[[['B']poff]][:[tlmin[:tlmax[:binsiz]]]]
-.Ve
-.Sp
-The special character \*(L"@\*(R" can be prepended to this specification to
-indicated that the data element is a pointer in the user record,
-rather than an array stored within the record.
-.Sp
-The [n] value is an integer that specifies the
-number of elements that are in this column (default is 1). \s-1TLMIN\s0,
-\&\s-1TLMAX\s0, and \s-1BINSIZ\s0 values also can be specified for this column after
-the type, separated by colons. If only one such number is specified,
-it is assumed to be \s-1TLMAX\s0, and \s-1TLMIN\s0 and \s-1BINSIZ\s0 are set to 1.
-.Sp
-The [poff] value can be used to specify the offset into an
-array. By default, this offset value is set to zero and the data
-specified starts at the beginning of the array. The offset usually
-is specified in terms of the data type of the column. Thus an offset
-specification of [5] means a 20\-byte offset if the data type is a
-32-bit integer, and a 40\-byte offset for a double. If you want to
-specify a byte offset instead of an offset tied to the column data type,
-precede the offset value with 'B', e.g. [B6] means a 6\-bye offset,
-regardless of the column data type.
-.Sp
-The [poff] is especially useful in conjunction with the pointer @
-specification, since it allows the data element to anywhere stored
-anywhere in the allocated array. For example, a specification such as
-\&\*(L"@I[2]\*(R" specifies the third (i.e., starting from 0) element in the
-array pointed to by the pointer value. A value of \*(L"@2I[4]\*(R" specifies
-the fifth and sixth values in the array. For example, consider the
-following specification:
-.Sp
-.Vb 12
-\& typedef struct EvStruct{
-\& short x[4], *atp;
-\& } *Event, EventRec;
-\& /* set up the (hardwired) columns */
-\& FunColumnSelect( fun, sizeof(EventRec), NULL,
-\& "2i", "2I ", "w", FUN_OFFSET(Event, x),
-\& "2i2", "2I[2]", "w", FUN_OFFSET(Event, x),
-\& "at2p", "@2I", "w", FUN_OFFSET(Event, atp),
-\& "at2p4", "@2I[4]", "w", FUN_OFFSET(Event, atp),
-\& "atp9", "@I[9]", "w", FUN_OFFSET(Event, atp),
-\& "atb20", "@I[B20]", "w", FUN_OFFSET(Event, atb),
-\& NULL);
-.Ve
-.Sp
-Here we have specified the following columns:
-.IP "\(bu" 4
-2i: two short ints in an array which is stored as part the
-record
-.IP "\(bu" 4
-2i2: the 3rd and 4th elements of an array which is stored
-as part of the record
-.IP "\(bu" 4
-an array of at least 10 elements, not stored in the record but
-allocated elsewhere, and used by three different columns:
-.RS 4
-.IP "\(bu" 4
-at2p: 2 short ints which are the first 2 elements of the allocated array
-.IP "\(bu" 4
-at2p4: 2 short ints which are the 5th and 6th elements of
-the allocated array
-.IP "\(bu" 4
-atp9: a short int which is the 10th element of the allocated array
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-atb20: a short int which is at byte offset 20 of another allocated array
-.RE
-.RS 4
-.Sp
-In this way, several columns can be specified, all of which are in a
-single array. \fB\s-1NB\s0\fR: it is the programmer's responsibility to
-ensure that specification of a positive value for poff does not point
-past the end of valid data.
-.RE
-.IP "\(bu" 4
-\&\fBread/write mode\fR: \*(L"r\*(R" means that the column is read from an
-input file into user space by
-\&\fIFunTableRowGet()\fR, \*(L"w\*(R" means that
-the column is written to an output file. Both can specified at the same
-time.
-.IP "\(bu" 4
-\&\fBoffset\fR: the offset into the user data to store
-this column. Typically, the macro \s-1FUN_OFFSET\s0(recname, colname) is used
-to define the offset into a record structure.
-.PP
-When all column arguments have been specified, a final \s-1NULL\s0 argument
-must added to signal the column selection list.
-.PP
-As an alternative to the varargs
-\&\fIFunColumnSelect()\fR
-routine, a non-varargs routine called
-\&\fIFunColumnSelectArr()\fR
-also is available. The first three arguments (fun, size, plist) of this
-routine are the same as in
-\&\fIFunColumnSelect()\fR.
-Instead of a variable
-argument list, however,
-\&\fIFunColumnSelectArr()\fR
-takes 5 additional arguments. The first 4 arrays arguments contain the
-names, types, modes, and offsets, respectively, of the columns being
-selected. The final argument is the number of columns that are
-contained in these arrays. It is the user's responsibility to free
-string space allocated in these arrays.
-.PP
-Consider the following example:
-.PP
-.Vb 5
-\& typedef struct evstruct{
-\& int status;
-\& float pi, pha, *phas;
-\& double energy;
-\& } *Ev, EvRec;
-.Ve
-.PP
-.Vb 6
-\& FunColumnSelect(fun, sizeof(EvRec), NULL,
-\& "status", "J", "r", FUN_OFFSET(Ev, status),
-\& "pi", "E", "r", FUN_OFFSET(Ev, pi),
-\& "pha", "E", "r", FUN_OFFSET(Ev, pha),
-\& "phas", "@9E", "r", FUN_OFFSET(Ev, phas),
-\& NULL);
-.Ve
-.PP
-Each time a row is read into the Ev struct, the \*(L"status\*(R" column is
-converted to an int data type (regardless of its data type in the
-file) and stored in the status value of the struct. Similarly, \*(L"pi\*(R"
-and \*(L"pha\*(R", and the phas vector are all stored as floats. Note that the
-\&\*(L"@\*(R" sign indicates that the \*(L"phas\*(R" vector is a pointer to a 9 element
-array, rather than an array allocated in the struct itself. The row
-record can then be processed as required:
-.PP
-.Vb 9
-\& /* get rows -- let routine allocate the row array */
-\& while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* process all rows */
-\& for(i=0; i<got; i++){
-\& /* point to the i'th row */
-\& ev = ebuf+i;
-\& ev->pi = (ev->pi+.5);
-\& ev->pha = (ev->pi-.5);
-\& }
-.Ve
-.PP
-\&\fIFunColumnSelect()\fR
-can also be called to define \*(L"writable\*(R" columns in order to generate a \s-1FITS\s0
-Binary Table, without reference to any input columns. For
-example, the following will generate a 4\-column \s-1FITS\s0 binary table when
-\&\fIFunTableRowPut()\fR is used to
-write Ev records:
-.PP
-.Vb 5
-\& typedef struct evstruct{
-\& int status;
-\& float pi, pha
-\& double energy;
-\& } *Ev, EvRec;
-.Ve
-.PP
-.Vb 6
-\& FunColumnSelect(fun, sizeof(EvRec), NULL,
-\& "status", "J", "w", FUN_OFFSET(Ev, status),
-\& "pi", "E", "w", FUN_OFFSET(Ev, pi),
-\& "pha", "E", "w", FUN_OFFSET(Ev, pha),
-\& "energy", "D", "w", FUN_OFFSET(Ev, energy),
-\& NULL);
-.Ve
-.PP
-All columns are declared to be write\-only, so presumably the column
-data is being generated or read from some other source.
-.PP
-In addition,
-\&\fIFunColumnSelect()\fR
-can be called to define \fBboth\fR \*(L"readable\*(R" and \*(L"writable\*(R" columns.
-In this case, the \*(L"read\*(R" columns
-are associated with an input file, while the \*(L"write\*(R" columns are
-associated with the output file. Of course, columns can be specified as both
-\&\*(L"readable\*(R" and \*(L"writable\*(R", in which case they are read from input
-and (possibly modified data values are) written to the output.
-The
-\&\fIFunColumnSelect()\fR
-call itself is made by passing the input Funtools handle, and it is
-assumed that the output file has been opened using this input handle
-as its
-Funtools reference handle.
-.PP
-Consider the following example:
-.PP
-.Vb 5
-\& typedef struct evstruct{
-\& int status;
-\& float pi, pha, *phas;
-\& double energy;
-\& } *Ev, EvRec;
-.Ve
-.PP
-.Vb 7
-\& FunColumnSelect(fun, sizeof(EvRec), NULL,
-\& "status", "J", "r", FUN_OFFSET(Ev, status),
-\& "pi", "E", "rw", FUN_OFFSET(Ev, pi),
-\& "pha", "E", "rw", FUN_OFFSET(Ev, pha),
-\& "phas", "@9E", "rw", FUN_OFFSET(Ev, phas),
-\& "energy", "D", "w", FUN_OFFSET(Ev, energy),
-\& NULL);
-.Ve
-.PP
-As in the \*(L"read\*(R" example above, each time an row is read into the Ev
-struct, the \*(L"status\*(R" column is converted to an int data type
-(regardless of its data type in the file) and stored in the status
-value of the struct. Similarly, \*(L"pi\*(R" and \*(L"pha\*(R", and the phas vector
-are all stored as floats. Since the \*(L"pi\*(R", \*(L"pha\*(R", and \*(L"phas\*(R" variables
-are declared as \*(L"writable\*(R" as well as \*(L"readable\*(R", they also will be
-written to the output file. Note, however, that the \*(L"status\*(R" variable
-is declared as \*(L"readable\*(R" only, and hence it will not be written to
-an output file. Finally, the \*(L"energy\*(R" column is declared as
-\&\*(L"writable\*(R" only, meaning it will not be read from the input file. In
-this case, it can be assumed that \*(L"energy\*(R" will be calculated in the
-program before being output along with the other values.
-.PP
-In these simple cases, only the columns specified as \*(L"writable\*(R" will
-be output using
-\&\fIFunTableRowPut()\fR. However,
-it often is the case that you want to merge the user columns back in
-with the input columns, even in cases where not all of the input
-column names are explicitly read or even known. For this important
-case, the \fBmerge=[type]\fR keyword is provided in the plist string.
-.PP
-The \fBmerge=[type]\fR keyword tells Funtools to merge the columns from
-the input file with user columns on output. It is normally used when
-an input and output file are opened and the input file provides the
-Funtools reference handle
-for the output file. In this case, each time
-\&\fIFunTableRowGet()\fR is called, the
-raw input rows are saved in a special buffer. If
-\&\fIFunTableRowPut()\fR then is called
-(before another call to
-\&\fIFunTableRowGet()\fR), the contents
-of the raw input rows are merged with the user rows according to the
-value of \fBtype\fR as follows:
-.IP "\(bu" 4
-\&\fBupdate\fR: add new user columns, and update value of existing ones (maintaining the input data type)
-.IP "\(bu" 4
-\&\fBreplace\fR: add new user columns, and replace the data type
-and value of existing ones. (Note that if tlmin/tlmax values are not
-specified in the replacing column, but are specified in the original
-column being replaced, then the original tlmin/tlmax values are used
-in the replacing column.)
-.IP "\(bu" 4
-\&\fBappend\fR: only add new columns, do not \*(L"replace\*(R" or \*(L"update\*(R" existing ones
-.PP
-Consider the example above. If \fBmerge=update\fR is specified in the
-plist string, then \*(L"energy\*(R" will be added to the input columns, and
-the values of \*(L"pi\*(R", \*(L"pha\*(R", and \*(L"phas\*(R" will be taken from the user
-space (i.e., the values will be updated from the original values, if
-they were changed by the program). The data type for \*(L"pi\*(R", \*(L"pha\*(R", and
-\&\*(L"phas\*(R" will be the same as in the original file. If
-\&\fBmerge=replace\fR is specified, both the data type and value of
-these three input columns will be changed to the data type and value
-in the user structure. If \fBmerge=append\fR is specified, none of
-these three columns will be updated, and only the \*(L"energy\*(R" column will
-be added. Note that in all cases, \*(L"status\*(R" will be written from the
-input data, not from the user record, since it was specified as read\-only.
-.PP
-Standard applications will call
-\&\fIFunColumnSelect()\fR
-to define user columns. However, if this routine is not called, the
-default behavior is to transfer all input columns into user space. For
-this purpose a default record structure is defined such that each data
-element is properly aligned on a valid data type boundary. This
-mechanism is used by programs such as fundisp and funtable to process
-columns without needing to know the specific names of those columns.
-It is not anticipated that users will need such capabilities (contact
-us if you do!)
-.PP
-By default, \fIFunColumnSelect()\fR
-reads/writes rows to/from an \*(L"array of structs\*(R", where each struct contains
-the column values for a single row of the table. This means that the
-returned values for a given column are not contiguous. You can
-set up the \s-1IO\s0 to return a \*(L"struct of arrays\*(R" so that each of the
-returned columns are contiguous by specifying \fBorg=structofarrays\fR
-(abbreviation: \fBorg=soa\fR) in the plist.
-(The default case is \fBorg=arrayofstructs\fR or \fBorg=aos\fR.)
-.PP
-For example, the default setup to retrieve rows from a table would be
-to define a record structure for a single event and then call
- \fIFunColumnSelect()\fR
-as follows:
-.PP
-.Vb 6
-\& typedef struct evstruct{
-\& short region;
-\& double x, y;
-\& int pi, pha;
-\& double time;
-\& } *Ev, EvRec;
-.Ve
-.PP
-.Vb 7
-\& got = FunColumnSelect(fun, sizeof(EvRec), NULL,
-\& "x", "D:10:10", mode, FUN_OFFSET(Ev, x),
-\& "y", "D:10:10", mode, FUN_OFFSET(Ev, y),
-\& "pi", "J", mode, FUN_OFFSET(Ev, pi),
-\& "pha", "J", mode, FUN_OFFSET(Ev, pha),
-\& "time", "1D", mode, FUN_OFFSET(Ev, time),
-\& NULL);
-.Ve
-.PP
-Subsequently, each call to
-\&\fIFunTableRowGet()\fR
-will return an array of structs, one for each returned row. If instead you
-wanted to read columns into contiguous arrays, you specify \fBorg=soa\fR:
-.PP
-.Vb 6
-\& typedef struct aevstruct{
-\& short region[MAXROW];
-\& double x[MAXROW], y[MAXROW];
-\& int pi[MAXROW], pha[MAXROW];
-\& double time[MAXROW];
-\& } *AEv, AEvRec;
-.Ve
-.PP
-.Vb 7
-\& got = FunColumnSelect(fun, sizeof(AEvRec), "org=soa",
-\& "x", "D:10:10", mode, FUN_OFFSET(AEv, x),
-\& "y", "D:10:10", mode, FUN_OFFSET(AEv, y),
-\& "pi", "J", mode, FUN_OFFSET(AEv, pi),
-\& "pha", "J", mode, FUN_OFFSET(AEv, pha),
-\& "time", "1D", mode, FUN_OFFSET(AEv, time),
-\& NULL);
-.Ve
-.PP
-Note that the only modification to the call is in the plist string.
-.PP
-Of course, instead of using statically allocated arrays, you also can specify
-dynamically allocated pointers:
-.PP
-.Vb 7
-\& /* pointers to arrays of columns (used in struct of arrays) */
-\& typedef struct pevstruct{
-\& short *region;
-\& double *x, *y;
-\& int *pi, *pha;
-\& double *time;
-\& } *PEv, PEvRec;
-.Ve
-.PP
-.Vb 8
-\& got = FunColumnSelect(fun, sizeof(PEvRec), "org=structofarrays",
-\& "$region", "@I", mode, FUN_OFFSET(PEv, region),
-\& "x", "@D:10:10", mode, FUN_OFFSET(PEv, x),
-\& "y", "@D:10:10", mode, FUN_OFFSET(PEv, y),
-\& "pi", "@J", mode, FUN_OFFSET(PEv, pi),
-\& "pha", "@J", mode, FUN_OFFSET(PEv, pha),
-\& "time", "@1D", mode, FUN_OFFSET(PEv, time),
-\& NULL);
-.Ve
-.PP
-Here, the actual storage space is either allocated by the user or by the
-\&\fIFunColumnSelect()\fR call).
-.PP
-In all of the above cases, the same call is made to retrieve rows, e.g.:
-.PP
-.Vb 1
-\& buf = (void *)FunTableRowGet(fun, NULL, MAXROW, NULL, &got);
-.Ve
-.PP
-However, the individual data elements are accessed differently.
-For the default case of an \*(L"array of structs\*(R", the
-individual row records are accessed using:
-.PP
-.Vb 5
-\& for(i=0; i<got; i++){
-\& ev = (Ev)buf+i;
-\& fprintf(stdout, "%.2f\et%.2f\et%d\et%d\et%.4f\et%.4f\et%21.8f\en",
-\& ev->x, ev->y, ev->pi, ev->pha, ev->dx, ev->dy, ev->time);
-\& }
-.Ve
-.PP
-For a struct of arrays or a struct of array pointers, we have a single struct
-through which we access individual columns and rows using:
-.PP
-.Vb 6
-\& aev = (AEv)buf;
-\& for(i=0; i<got; i++){
-\& fprintf(stdout, "%.2f\et%.2f\et%d\et%d\et%.4f\et%.4f\et%21.8f\en",
-\& aev->x[i], aev->y[i], aev->pi[i], aev->pha[i],
-\& aev->dx[i], aev->dy[i], aev->time[i]);
-\& }
-.Ve
-.PP
-Support for struct of arrays in the
-\&\fIFunTableRowPut()\fR
-call is handled analogously.
-.PP
-See the evread example code
-and
-evmerge example code
-for working examples of how
-\&\fIFunColumnSelect()\fR is used.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funflush.3 b/funtools/man/man3/funflush.3
deleted file mode 100644
index 611dfc3..0000000
--- a/funtools/man/man3/funflush.3
+++ /dev/null
@@ -1,212 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funflush 3"
-.TH funflush 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunFlush \- flush data to output file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& void FunFlush(Fun fun, char *plist)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fBFunFlush\fR routine will flush data to a \s-1FITS\s0 output file. In
-particular, it can be called after all rows have been written (using
-the \fIFunTableRowPut()\fR routine)
-in order to add the null padding that is required to complete a \s-1FITS\s0
-block. It also should be called after completely writing an image using
-\&\fIFunImagePut()\fR or after writing
-the final row of an image using
-\&\fIFunTableRowPut()\fR.
-.PP
-The \fBplist\fR (i.e., parameter list) argument is a string
-containing one or more comma-delimited \fBkeyword=value\fR
-parameters. If the plist string contains the parameter
-\&\*(L"copy=remainder\*(R" and the file was opened with a reference file, which,
-in turn, was opened for extension copying (i.e. the input
-\&\fIFunOpen()\fR mode also was \*(L"c\*(R" or \*(L"C\*(R"),
-then FunFlush also will copy the remainder of the \s-1FITS\s0 extensions from
-the input reference file to the output file. This normally would be
-done only at the end of processing.
-.PP
-Note that \fIFunFlush()\fR is called
-with \*(L"copy=remainder\*(R" in the mode string by \fIFunClose()\fR. This means
-that if you close the output file before the reference input file, it
-is not necessary to call
-\&\fIFunFlush()\fR explicitly, unless you
-are writing more than one extension. See the
-evmerge example code. However, it is safe to
-call \fIFunFlush()\fR more than once
-without fear of re-writing either the padding or the copied
-extensions.
-.PP
-In addition, if \fIFunFlush()\fR is
-called on an output file with the plist set to \*(L"copy=reference\*(R" and if
-the file was opened with a reference file, the reference extension is
-written to the output file. This mechanism provides a simple way to
-copy input extensions to an output file without processing the former.
-For example, in the code fragment below, an input extension is set to
-be the reference file for a newly opened output extension. If that
-reference extension is not a binary table, it is written to the output
-file:
-.PP
-.Vb 22
-\& /* process each input extension in turn */
-\& for(ext=0; ;ext++){
-\& /* get new extension name */
-\& sprintf(tbuf, "%s[%d]", argv[1], ext);
-\& /* open input extension -- if we cannot open it, we are done */
-\& if( !(ifun=FunOpen(tbuf, "r", NULL)) )
-\& break;
-\& /* make the new extension the reference handle for the output file */
-\& FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
-\& /* if its not a binary table, just write it out */
-\& if( !(s=FunParamGets(ifun, "XTENSION", 0, NULL, &got)) ||
-\& strcmp(s, "BINTABLE")){
-\& if( s ) free(s);
-\& FunFlush(ofun, "copy=reference");
-\& FunClose(ifun);
-\& continue;
-\& }
-\& else{
-\& /* process binary table */
-\& ....
-\& }
-\& }
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funimageget.3 b/funtools/man/man3/funimageget.3
deleted file mode 100644
index 091765d..0000000
--- a/funtools/man/man3/funimageget.3
+++ /dev/null
@@ -1,332 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funimageget 3"
-.TH funimageget 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunImageGet \- get an image or image section
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& void *FunImageGet(Fun fun, void *buf, char *plist)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunImageGet()\fB\fR routine returns an binned image array of the
-specified section of a Funtools data file. If the input data are
-already of type image, the array is generated by extracting the
-specified image section and then binning it according to the specified
-bin factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-\&\fBbincols=\fR keyword (using appropriate default columns as
-necessary), after which the image section and bin factors are
-applied. In both cases, the data is automatically converted from \s-1FITS\s0
-to native format, if necessary.
-.PP
-The first argument is the Funtools handle returned by
-\&\fIFunOpen()\fR. The second \fBbuf\fR
-argument is a pointer to a data buffer to fill. If \s-1NULL\s0 is specified,
-FunImageGet will allocate a buffer of the appropriate size. Generally
-speaking, you always want Funtools to allocate the buffer because
-the image dimensions will be determined by
-Funtools image sectioning
-on the command line.
-.PP
-The third \fBplist\fR (i.e., parameter list) argument is a string
-containing one or more comma-delimited \fBkeyword=value\fR
-parameters. It can be used to specify the return data type using the
-\&\fBbitpix=\fR keyword. If no such keyword is specified in the plist
-string, the data type of the returned image is the same as the data type
-of the original input file, or is of type int for \s-1FITS\s0 binary tables.
-.PP
-If the \fBbitpix=\fR keyword is supplied in the plist string, the data
-type of the returned image will be one of the supported \s-1FITS\s0 image
-data types:
-.IP "\(bu" 4
-8 unsigned char
-.IP "\(bu" 4
-16 short
-.IP "\(bu" 4
-32 int
-.IP "\(bu" 4
-\&\-32 float
-.IP "\(bu" 4
-\&\-64 double
-.PP
-For example:
-.PP
-.Vb 4
-\& void *buf;
-\& /* extract data section into an image buffer */
-\& if( !(buf = FunImageGet(fun, NULL, NULL)) )
-\& gerror(stderr, "could not FunImageGet: %s\en", iname);
-.Ve
-.PP
-will allocate buf and retrieve the image in the file data format. In
-this case, you will have to determine the data type (using the
-\&\s-1FUN_SECT_BITPIX\s0 value in the
-\&\fIFunInfoGet()\fR
-routine)
-and then use a switch statement to process each data type:
-.PP
-.Vb 17
-\& int bitpix;
-\& void *buf;
-\& unsigned char *cbuf;
-\& short *sbuf;
-\& int *ibuf;
-\& ...
-\& buf = FunImageGet(fun, NULL, NULL);
-\& FunInfoGet(fun, FUN_SECT_BITPIX, &bitpix, 0);
-\& /* set appropriate data type buffer to point to image buffer */
-\& switch(bitpix){
-\& case 8:
-\& cbuf = (unsigned char *)buf; break;
-\& case 16:
-\& sbuf = (short *)buf; break;
-\& case 32:
-\& ibuf = (int *)buf; break;
-\& ...
-.Ve
-.PP
-See the
-imblank example code
-for more details on how to process an image when the data type is not
-specified beforehand.
-.PP
-It often is easier to specify the data type directly:
-.PP
-.Vb 4
-\& double *buf;
-\& /* extract data section into a double image buffer */
-\& if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) )
-\& gerror(stderr, "could not FunImageGet: %s\en", iname);
-.Ve
-.PP
-will extract the image while converting to type double.
-.PP
-On success, a pointer to the image buffer is returned. (This will be
-the same as the second argument, if \s-1NULL\s0 is not passed to the latter.)
-On error, \s-1NULL\s0 is returned.
-.PP
-In summary, to retrieve image or row data into a binned image, you simply
-call \fIFunOpen()\fR followed by
-\&\fIFunImageGet()\fR. Generally, you
-then will want to call
-\&\fIFunInfoGet()\fR
-to retrieve the
-axis dimensions (and data type) of the section you are processing
-(so as to take account of sectioning and blocking of the original data):
-.PP
-.Vb 4
-\& double *buf;
-\& int i, j;
-\& int dim1, dim2;
-\& ... other declarations, etc.
-.Ve
-.PP
-.Vb 3
-\& /* open the input FITS file */
-\& if( !(fun = FunOpen(argv[1], "rc", NULL)) )
-\& gerror(stderr, "could not FunOpen input file: %s\en", argv[1]);
-.Ve
-.PP
-.Vb 3
-\& /* extract and bin the data section into a double float image buffer */
-\& if( !(buf = FunImageGet(fun, NULL, "bitpix=-64")) )
-\& gerror(stderr, "could not FunImageGet: %s\en", argv[1]);
-.Ve
-.PP
-.Vb 2
-\& /* get dimension information from funtools structure */
-\& FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-.Ve
-.PP
-.Vb 4
-\& /* loop through pixels and reset values below limit to value */
-\& for(i=0; i<dim1*dim2; i++){
-\& if( buf[i] <= blimit ) buf[i] = bvalue;
-\& }
-.Ve
-.PP
-Another useful plist string value is \*(L"mask=all\*(R", which returns an
-image populated with regions id values. Image pixels within a region
-will contain the associated region id (region values start at 1), and
-otherwise will contain a 0 value. Thus, the returned image is a
-region mask which can be used to process the image data (which
-presumably is retrieved by a separate call to FunImageGet) pixel by
-pixel.
-.PP
-If a \s-1FITS\s0 binary table or a non-FITS raw event file is being binned
-into an image, it is necessary to specify the two columns that will be
-used in the 2D binning. This usually is done on the command line
-using the \fBbincols=(x,y)\fR keyword:
-.PP
-.Vb 1
-\& funcnts "foo.ev[EVENTS,bincols=(detx,dety)]"
-.Ve
-.PP
-The full form of the \fBbincols=\fR specifier is:
-.PP
-.Vb 1
-\& bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]])
-.Ve
-.PP
-where the tlmin, tlmax, and binsiz specifiers determine the image binning
-dimensions:
-.PP
-.Vb 2
-\& dim = (tlmax - tlmin)/binsiz (floating point data)
-\& dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-.Ve
-.PP
-These tlmin, tlmax, and binsiz specifiers can be omitted if \s-1TLMIN\s0,
-\&\s-1TLMAX\s0, and \s-1TDBIN\s0 header parameters (respectively) are present in the
-\&\s-1FITS\s0 binary table header for the column in question. Note that if
-only one parameter is specified, it is assumed to be tlmax, and tlmin
-defaults to 1. If two parameters are specified, they are assumed to be
-tlmin and tlmax.
-.PP
-If \fBbincols\fR is not specified on the command line, Funtools tries
-to use appropriate defaults: it looks for the environment variable
-\&\s-1FITS_BINCOLS\s0 (or \s-1FITS_BINKEY\s0). Then it looks for the Chandra
-parameters \s-1CPREF\s0 (or \s-1PREFX\s0) in the \s-1FITS\s0 binary table header. Failing
-this, it looks for columns named \*(L"X\*(R" and \*(L"Y\*(R" and if these are not
-found, it looks for columns containing the characters \*(L"X\*(R" and \*(L"Y\*(R".
-.PP
-See Binning \s-1FITS\s0 Binary Tables and
-Non-FITS Event Files for more information.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funimageput.3 b/funtools/man/man3/funimageput.3
deleted file mode 100644
index 9618944..0000000
--- a/funtools/man/man3/funimageput.3
+++ /dev/null
@@ -1,225 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funimageput 3"
-.TH funimageput 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunImagePut \- put an image to a Funtools file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 2
-\& int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix,
-\& char *plist)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunImagePut()\fB\fR routine outputs an image array to a \s-1FITS\s0
-file. The image is written either as a primary header/data unit or as
-an image extension, depending on whether other data have already been
-written to the file. That is, if the current file position is at the
-beginning of the file, a primary \s-1HDU\s0 is written. Otherwise, an
-image extension is written.
-.PP
-The first argument is the Funtools handle returned by
-\&\fIFunOpen()\fR. The second \fBbuf\fR
-argument is a pointer to a data buffer to write. The \fBdim1\fRand
-\&\fBdim2\fR arguments that follow specify the dimensions of the image,
-where dim1 corresponds to naxis1 and dim2 corresponds to naxis2. The
-\&\fBbitpix\fR argument specifies the data type of the image and can
-have the following FITS-standard values:
-.IP "\(bu" 4
-8 unsigned char
-.IP "\(bu" 4
-16 short
-.IP "\(bu" 4
-32 int
-.IP "\(bu" 4
-\&\-32 float
-.IP "\(bu" 4
-\&\-64 double
-.PP
-When \fIFunTableRowPut()\fR is first
-called for a given image, Funtools checks to see if the primary header
-has already been written (by having previously written an image or a
-binary table.) If not, this image is written to the primary \s-1HDU\s0.
-Otherwise, it is written to an image extension.
-.PP
-Thus, a simple program to generate a \s-1FITS\s0 image might look like this:
-.PP
-.Vb 16
-\& int i;
-\& int dim1=512, dim2=512;
-\& double *dbuf;
-\& Fun fun;
-\& dbuf = malloc(dim1*dim2*sizeof(double));
-\& /* open the output FITS image, preparing to copy input params */
-\& if( !(fun = FunOpen(argv[1], "w", NULL)) )
-\& gerror(stderr, "could not FunOpen output file: %s\en", argv[1]);
-\& for(i=0; i<(dim1*dim2); i++){
-\& ... fill dbuf ...
-\& }
-\& /* put the image (header will be generated automatically */
-\& if( !FunImagePut(fun, buf, dim1, dim2, \-64, NULL) )
-\& gerror(stderr, "could not FunImagePut: %s\en", argv[1]);
-\& FunClose(fun);
-\& free(dbuf);
-.Ve
-.PP
-In addition, if a
-Funtools reference handle
-was specified when this table was opened, the
-parameters from this
-Funtools reference handle
-are merged into the new image
-header. Furthermore, if a reference image was specified during
-\&\fIFunOpen()\fR, the values of
-\&\fBdim1\fR, \fBdim2\fR, and \fBbitpix\fR in the calling sequence
-can all be set to 0. In this case, default values are taken from the
-reference image section. This is useful if you are reading an image
-section in its native data format, processing it, and then writing
-that section to a new \s-1FITS\s0 file. See the
-imblank example code.
-.PP
-The data are assumed to be in the native machine format and will
-automatically be swapped to \s-1FITS\s0 big-endian format if necessary. This
-behavior can be over-ridden with the \fBconvert=[true|false]\fR
-keyword in the \fBplist\fR param list string.
-.PP
-When you are finished writing the image, you should call
-\&\fIFunFlush()\fR to write out the \s-1FITS\s0
-image padding. However, this is not necessary if you subsequently call
-\&\fIFunClose()\fR without doing any other I/O to the \s-1FITS\s0 file.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funimagerowget.3 b/funtools/man/man3/funimagerowget.3
deleted file mode 100644
index 50a0979..0000000
--- a/funtools/man/man3/funimagerowget.3
+++ /dev/null
@@ -1,215 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funimagerowget 3"
-.TH funimagerowget 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunImageRowGet \- get row(s) of an image
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 2
-\& void *FunImageRowGet(Fun fun, void *buf, int rstart, int rstop,
-\& char *plist)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunImageRowGet()\fB\fR routine returns one or more image rows
-from the specified section of a Funtools data file. If the input data
-are of type image, the array is generated by extracting the specified
-image rows and then binning them according to the specified bin
-factor. If the input data are contained in a binary table or raw
-event file, the rows are binned on the columns specified by the
-\&\fBbincols=\fR keyword (using appropriate default columns as needed),
-after which the image section and bin factors are applied.
-.PP
-The first argument is the Funtools handle returned by
-\&\fIFunOpen()\fR. The second \fBbuf\fR
-argument is a pointer to a data buffer to fill. If \s-1NULL\s0 is specified,
-\&\fIFunImageGet()\fR will allocate a buffer of the appropriate size.
-.PP
-The third and fourth arguments specify the first and last row to
-retrieve. Rows are counted starting from 1, up to the value of
-\&\s-1FUN_YMAX\s0(fun). The final \fBplist\fR (i.e., parameter list) argument
-is a string containing one or more comma-delimited
-\&\fBkeyword=value\fR parameters. It can be used to specify the return
-data type using the \fBbitpix=\fR keyword. If no such keyword is
-specified in the plist string, the data type of the image is the same
-as the data type of the original input file, or is of type int for
-\&\s-1FITS\s0 binary tables.
-.PP
-If the \fBbitpix=\fRvalue is supplied in the plist string, the data
-type of the returned image will be one of the supported \s-1FITS\s0 image
-data types:
-.IP "\(bu" 4
-8 unsigned char
-.IP "\(bu" 4
-16 short
-.IP "\(bu" 4
-32 int
-.IP "\(bu" 4
-\&\-32 float
-.IP "\(bu" 4
-\&\-64 double
-.PP
-For example:
-.PP
-.Vb 17
-\& double *drow;
-\& Fun fun;
-\& ... open files ...
-\& /* get section dimensions */
-\& FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-\& /* allocate one line's worth */
-\& drow = malloc(dim1*sizeof(double));
-\& /* retrieve and process each input row (starting at 1) */
-\& for(i=1; i <= dim2; i++){
-\& if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") )
-\& gerror(stderr, "can't FunImageRowGet: %d %s\en", i, iname);
-\& /* reverse the line */
-\& for(j=1; j<=dim1; j++){
-\& ... process drow[j-1] ...
-\& }
-\& }
-\& ...
-.Ve
-.PP
-On success, a pointer to the image buffer is returned. (This will be
-the same as the second argument, if \s-1NULL\s0 is not passed to the latter.)
-On error, \s-1NULL\s0 is returned. Note that the considerations described
-above for specifying binning columns in
-\&\fIFunImageGet()\fR also apply to
-\&\fB\f(BIFunImageRowGet()\fB\fR.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funimagerowput.3 b/funtools/man/man3/funimagerowput.3
deleted file mode 100644
index e76bc7f..0000000
--- a/funtools/man/man3/funimagerowput.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funimagerowput 3"
-.TH funimagerowput 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunImageRowPut \- put row(s) of an image
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 2
-\& void *FunImageRowPut(Fun fun, void *buf, int rstart, int rstop,
-\& int dim1, int dim2, int bitpix, char *plist)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunImageRowPut()\fB\fR routine writes one or more image rows to
-the specified \s-1FITS\s0 image file. The first argument is the Funtools
-handle returned by \fIFunOpen()\fR.
-The second \fBbuf\fR argument is a pointer to the row data buffer,
-while the third and fourth arguments specify the starting and ending
-rows to write. Valid rows values range from 1 to dim2, i.e., row is
-one\-valued.
-.PP
-The \fBdim1\fRand \fBdim2\fR arguments that follow specify the
-dimensions, where dim1 corresponds to naxis1 and dim2 corresponds to
-naxis2. The \fBbitpix\fR argument data type of the image and can
-have the following FITS-standard values:
-.IP "\(bu" 4
-8 unsigned char
-.IP "\(bu" 4
-16 short
-.IP "\(bu" 4
-32 int
-.IP "\(bu" 4
-\&\-32 float
-.IP "\(bu" 4
-\&\-64 double
-.PP
-For example:
-.PP
-.Vb 16
-\& double *drow;
-\& Fun fun, fun2;
-\& ... open files ...
-\& /* get section dimensions */
-\& FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-\& /* allocate one line's worth */
-\& drow = malloc(dim1*sizeof(double));
-\& /* retrieve and process each input row (starting at 1) */
-\& for(i=1; i <= dim2; i++){
-\& if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") )
-\& gerror(stderr, "can't FunImageRowGet: %d %s\en", i, iname);
-\& ... process drow ...
-\& if( !FunImageRowPut(fun2, drow, i, i, 64, NULL) )
-\& gerror(stderr, "can't FunImageRowPut: %d %s\en", i, oname);
-\& }
-\& ...
-.Ve
-.PP
-The data are assumed to be in the native machine format and will
-automatically be swapped to big-endian \s-1FITS\s0 format if necessary. This
-behavior can be over-ridden with the \fBconvert=[true|false]\fR
-keyword in the \fBplist\fR param list string.
-.PP
-When you are finished writing the image, you should call
-\&\fIFunFlush()\fR to write out the \s-1FITS\s0
-image padding. However, this is not necessary if you subsequently call
-\&\fIFunClose()\fR without doing any other I/O to the \s-1FITS\s0 file.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funinfoget.3 b/funtools/man/man3/funinfoget.3
deleted file mode 100644
index 6bb14c9..0000000
--- a/funtools/man/man3/funinfoget.3
+++ /dev/null
@@ -1,335 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funinfoget 3"
-.TH funinfoget 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunInfoGet \- get information from Funtools struct
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& int FunInfoGet(Fun fun, int type, char *addr, ...)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunInfoGet()\fB\fR routine returns information culled from the
-Funtools structure. The first argument is the Fun handle from which
-information is to be retrieved. This first required argument is followed
-by a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to retrieve and the
-address where the information is to be stored. The list is terminated by a 0.
-The routine returns the number of get actions performed.
-.PP
-The full list of available information is described below. Please note
-that only a few of these will be useful to most application developers.
-For imaging applications, the most important types are:
-.PP
-.Vb 3
-\& FUN_SECT_DIM1 int /* dim1 for section */
-\& FUN_SECT_DIM2 int /* dim2 for section */
-\& FUN_SECT_BITPIX int /* bitpix for section */
-.Ve
-.PP
-These would be used to determine the dimensions and data type of image
-data retrieved using the
-\&\fIFunImageGet()\fR routine. For
-example:
-.PP
-.Vb 17
-\& /* extract and bin the data section into an image buffer */
-\& buf = FunImageGet(fun, NULL, NULL);
-\& /* get required information from funtools structure.
-\& this should come after the FunImageGet() call, in case the call
-\& changed sect_bitpix */
-\& FunInfoGet(fun,
-\& FUN_SECT_BITPIX, &bitpix,
-\& FUN_SECT_DIM1, &dim1,
-\& FUN_SECT_DIM2, &dim2,
-\& 0);
-\& /* loop through pixels and reset values below limit to value */
-\& for(i=0; i<dim1*dim2; i++){
-\& switch(bitpix){
-\& case 8:
-\& if( cbuf[i] <= blimit ) cbuf[i] = bvalue;
-\& ...
-\& }
-.Ve
-.PP
-It is important to bear in mind that the call to
-\&\fIFunImageGet()\fR
-can change the value of \s-1FUN_SECT_BITPIX\s0 (e.g. if \*(L"bitpix=n\*(R" is passed
-in the param list). Therefore, a call to
-\&\fIFunInfoGet()\fR
-should be made \fBafter\fR the call to
-\&\fIFunImageGet()\fR,
-in order to retrieve the updated bitpix value.
-See the imblank example code for more
-details.
-.PP
-It also can be useful to retrieve the World Coordinate System
-information from the Funtools structure. Funtools uses the the \s-1WCS\s0
-Library developed by Doug Mink at \s-1SAO\s0, which is available
-here.
-(More information about the WCSTools project in general can be found
-here.)
-The \fIFunOpen()\fR routine initializes
-two \s-1WCS\s0 structures that can be used with this \s-1WCS\s0 Library.
-Applications can retrieve either of these two \s-1WCS\s0 structures using
-\&\fB\f(BIFunInfoGet()\fB\fR:
-.PP
-.Vb 2
-\& FUN_WCS struct WorldCoor * /* wcs structure, for image coordinates*/
-\& FUN_WCS0 struct WorldCoor * /* wcs structure, for physical coordinates */
-.Ve
-.PP
-The structure retrieved by \s-1FUN_WCS\s0 is a \s-1WCS\s0 library handle containing
-parameters suitable for use with image coordinates, regardless of whether the
-data are images or tables. For this structure, the \s-1WCS\s0 reference point
-(\s-1CRPIX\s0) has been converted to image coordinates if the underlying file
-is a table (and therefore in physical coordinates). You therefore must
-ensure that the positions being passed to a routine like pix2wcs are in
-image coordinates. The \s-1FUN_WCS0\s0 structure has not had its \s-1WCS\s0
-reference point converted to image coordinates. It therefore is useful
-when passing processing physical coordinates from a table.
-.PP
-Once a \s-1WCS\s0 structure has been retrieved, it can be used as the first
-argument to the \s-1WCS\s0 library routines. (If the structure is \s-1NULL\s0, no
-\&\s-1WCS\s0 information was contained in the file.) The two important \s-1WCS\s0 routines
-that Funtools uses are:
-.PP
-.Vb 5
-\& #include <wcs.h&gt
-\& void pix2wcs (wcs,xpix,ypix,xpos,ypos)
-\& struct WorldCoor *wcs; /* World coordinate system structure */
-\& double xpix,ypix; /* x and y coordinates in pixels */
-\& double *xpos,*ypos; /* RA and Dec in degrees (returned) */
-.Ve
-.PP
-which converts pixel coordinates to sky coordinates, and:
-.PP
-.Vb 5
-\& void wcs2pix (wcs, xpos, ypos, xpix, ypix, offscl)
-\& struct WorldCoor *wcs; /* World coordinate system structure */
-\& double xpos,ypos; /* World coordinates in degrees */
-\& double *xpix,*ypix; /* coordinates in pixels */
-\& int *offscl; /* 0 if within bounds, else off scale */
-.Ve
-.PP
-which converts sky coordinates to pixel coordinates. Again, please note
-that the wcs structure returned by \s-1FUN_WCS\s0 assumes that image coordinates
-are passed to the pix2wcs routine, while \s-1FUN_WCS0\s0 assumes that physical
-coordinates are passed.
-.PP
-Note that funtools.h file automatically includes wcs.h. An example
-program that utilizes these \s-1WCS\s0 structure to call \s-1WCS\s0 Library routines
-is twcs.c.
-.PP
-The following is the complete list of information that can be returned:
-.PP
-.Vb 52
-\& name type comment
-\& --------- -------- ---------------------------------------------
-\& FUN_FNAME char * /* file name */
-\& FUN_GIO GIO /* gio handle */
-\& FUN_HEADER FITSHead /* fitsy header struct */
-\& FUN_TYPE int /* TY_TABLE,TY_IMAGE,TY_EVENTS,TY_ARRAY */
-\& FUN_BITPIX int /* bits/pixel in file */
-\& FUN_MIN1 int /* tlmin of axis1 -- tables */
-\& FUN_MAX1 int /* tlmax of axis1 -- tables */
-\& FUN_MIN2 int /* tlmin of axis2 -- tables */
-\& FUN_MAX2 int /* tlmax of axis2 -- tables */
-\& FUN_DIM1 int /* dimension of axis1 */
-\& FUN_DIM2 int /* dimension of axis2 */
-\& FUN_ENDIAN int /* 0=little, 1=big endian */
-\& FUN_FILTER char * /* supplied filter */
-\& FUN_IFUN FITSHead /* pointer to reference header */
-\& FUN_IFUN0 FITSHead /* same as above, but no reset performed */
-\& /* image information */
-\& FUN_DTYPE int /* data type for images */
-\& FUN_DLEN int /* length of image in bytes */
-\& FUN_DPAD int /* padding to end of extension */
-\& FUN_DOBLANK int /* was blank keyword defined? */
-\& FUN_BLANK int /* value for blank */
-\& FUN_SCALED int /* was bscale/bzero defined? */
-\& FUN_BSCALE double /* bscale value */
-\& FUN_BZERO double /* bzero value */
-\& /* table information */
-\& FUN_NROWS int /* number of rows in file (naxis2) */
-\& FUN_ROWSIZE int /* size of user row struct */
-\& FUN_BINCOLS char * /* specified binning columns */
-\& FUN_OVERFLOW int /* overflow detected during binning? */
-\& /* array information */
-\& FUN_SKIP int /* bytes to skip in array header */
-\& /* section information */
-\& FUN_SECT_X0 int /* low dim1 value of section */
-\& FUN_SECT_X1 int /* hi dim1 value of section */
-\& FUN_SECT_Y0 int /* low dim2 value of section */
-\& FUN_SECT_Y1 int /* hi dim2 value of section */
-\& FUN_SECT_BLOCK int /* section block factor */
-\& FUN_SECT_BTYPE int /* 's' (sum), 'a' (average) for binning */
-\& FUN_SECT_DIM1 int /* dim1 for section */
-\& FUN_SECT_DIM2 int /* dim2 for section */
-\& FUN_SECT_BITPIX int /* bitpix for section */
-\& FUN_SECT_DTYPE int /* data type for section */
-\& FUN_RAWBUF char * /* pointer to raw row buffer */
-\& FUN_RAWSIZE int /* byte size of raw row records */
-\& /* column information */
-\& FUN_NCOL int /* number of row columns defined */
-\& FUN_COLS FunCol /* array of row columns */
-\& /* WCS information */
-\& FUN_WCS struct WorldCoor * /* wcs structure, converted for images*/
-\& FUN_WCS0 struct WorldCoor * /* wcs structure, not converted */
-.Ve
-.PP
-Row applications would not normally need any of this information.
-An example of how these values can be used in more complex programs is
-the evnext example code. In this program, the
-time value for each row is changed to be the value of the succeeding
-row. The program thus reads the time values for a batch of rows,
-changes the time values to be the value for the succeeding row, and
-then merges these changed time values back with the other columns to
-the output file. It then reads the next batch, etc.
-.PP
-This does not work for the last row read in each batch, since there
-is no succeeding row until the next batch is read. Therefore, the
-program saves that last row until it has read the next batch, then
-processes the former before starting on the new batch. In order to
-merge the last row successfully, the code uses \s-1FUN_RAWBUF\s0 to save
-and restore the raw input data associated with each batch of
-rows. Clearly, this requires some information about how funtools
-works internally. We are happy to help you write such programs as the
-need arises.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funinfoput.3 b/funtools/man/man3/funinfoput.3
deleted file mode 100644
index 986fa9c..0000000
--- a/funtools/man/man3/funinfoput.3
+++ /dev/null
@@ -1,246 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funinfoput 3"
-.TH funinfoput 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunInfoPut \- put information into a Funtools struct
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& int FunInfoPut(Fun fun, int type, char *addr, ...)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunInfoPut()\fB\fR routine puts information into a Funtools
-structure. The first argument is the Fun handle from which
-information is to be retrieved. After this first required argument
-comes a variable length list of pairs of arguments. Each pair consists
-of an integer representing the type of information to store and the
-address of the new information to store in the struct. The variable
-list is terminated by a 0. The routine returns the number of put
-actions performed.
-.PP
-The full list of available information is described above with the
-\&\fIFunInfoPut()\fR routine. Although
-use of this routine is expected to be uncommon, there is one
-important situation in which it plays an essential part: writing
-multiple extensions to a single output file.
-.PP
-For input, multiple extensions are handled by calling
-\&\fIFunOpen()\fR for each extension to be
-processed. When opening multiple inputs, it sometimes is the case that
-you will want to process them and then write them (including their
-header parameters) to a single output file. To accomplish this, you
-open successive input extensions using
-\&\fIFunOpen()\fR and then call
-\&\fB\f(BIFunInfoPut()\fB\fR to set the
-Funtools reference handle
-of the output file to that of the newly opened input extension:
-.PP
-.Vb 4
-\& /* open a new input extension */
-\& ifun=FunOpen(tbuf, "r", NULL)) )
-\& /* make the new extension the reference handle for the output file */
-\& FunInfoPut(ofun, FUN_IFUN, &ifun, 0);
-.Ve
-.PP
-Resetting \s-1FUN_IFUN\s0 has same effect as when a funtools handle is passed
-as the final argument to
-\&\fIFunOpen()\fR. The state of the output
-file is reset so that a new extension is ready to be written.
-Thus, the next I/O call on the output extension will output the
-header, as expected.
-.PP
-For example, in a binary table, after resetting \s-1FUN_IFUN\s0 you can then
-call \fIFunColumnSelect()\fR to
-select the columns for output. When you then call
-\&\fIFunImagePut()\fR or <A
-HREF=\*(L"./library.html#funtablerowput\*(R">\fIFunTableRowPut()\fR, a new
-extension will be written that contains the header parameters from the
-reference extension. Remember to call
-\&\fIFunFlush()\fR to complete output of a
-given extension.
-.PP
-A complete example of this capability is given
-in the evcol example code.
-The central algorithm is:
-.IP "\(bu" 4
-open the output file without a reference handle
-.IP "\(bu" 4
-loop: open each input extension in turn
-.RS 4
-.IP "\(bu" 4
-set the reference handle for output to the newly opened input extension
-.IP "\(bu" 4
-read the input rows or image and perform processing
-.IP "\(bu" 4
-write new rows or image to the output file
-.IP "\(bu" 4
-flush the output
-.IP "\(bu" 4
-close input extension
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-close output file
-.PP
-Note that \fIFunFlush()\fR is called
-after processing each input extension in order to ensure that the
-proper padding is written to the output file. A call to
-\&\fIFunFlush()\fR also ensures that the
-extension header is written to the output file in the case where there
-are no rows to output.
-.PP
-If you wish to output a new extension without using a
-Funtools reference handle, you can
-call \fIFunInfoPut()\fR to reset the \s-1FUN_OPS\s0 value directly. For a binary
-table, you would then call \fIFunColumnSelect()\fR to set up the columns for
-this new extension.
-.PP
-.Vb 6
-\& /* reset the operations performed on this handle */
-\& int ops=0;
-\& FunInfoPut(ofun, FUN_OPS, &ops, 0);
-\& FunColumnSelect(fun, sizeof(EvRec), NULL,
-\& "MYCOL", "J", "w", FUN_OFFSET(Ev, mycol),
-\& NULL);
-.Ve
-.PP
-Once the \s-1FUN_OPS\s0 variable has been reset, the next I/O call on the
-output extension will output the header, as expected.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funlib.3 b/funtools/man/man3/funlib.3
deleted file mode 100644
index 6b4456a..0000000
--- a/funtools/man/man3/funlib.3
+++ /dev/null
@@ -1,525 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funlib 3"
-.TH funlib 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunLib \- the Funtools Programming Interface
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-A description of the Funtools library.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBIntroduction to the Funtools Programming Interface\fR
-.PP
-To create a Funtools application, you need to include
-the funtools.h definitions file in your code:
-.PP
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-You then call Funtools subroutines and functions to access Funtools data.
-The most important routines are:
-.IP "\(bu" 4
-FunOpen: open a Funtools file
-.IP "\(bu" 4
-FunInfoGet: get info about an image or table
-.IP "\(bu" 4
-FunImageGet: retrieve image data
-.IP "\(bu" 4
-FunImageRowGet: retrieve image data by row
-.IP "\(bu" 4
-FunImagePut: output image data
-.IP "\(bu" 4
-FunImageRowPut: output image data by row
-.IP "\(bu" 4
-FunColumnSelect: select columns in a table for access
-.IP "\(bu" 4
-FunTableRowGet: retrieve rows from a table
-.IP "\(bu" 4
-FunTableRowPut: output rows to a table
-.IP "\(bu" 4
-FunClose: close a Funtools file
-.PP
-Your program must be linked against the libfuntools.a library,
-along with the math library. The following libraries also might be required
-on your system:
-.IP "\(bu" 4
-\&\-lsocket \-lnsl for socket support
-.IP "\(bu" 4
-\&\-ldl for dynamic loading
-.PP
-For example, on a Solaris system using gcc, use the following link line:
-.PP
-.Vb 1
-\& gcc \-o foo foo.c \-lfuntools \-lsocket \-lnsl \-ldl \-lm
-.Ve
-.PP
-On a Solaris system using Solaris cc, use the following link line:
-.PP
-.Vb 1
-\& gcc \-o foo foo.c \-lfuntools \-lsocket \-lnsl \-lm
-.Ve
-.PP
-On a Linux system using gcc, use the following link line:
-.PP
-.Vb 1
-\& gcc \-o foo foo.c \-lfuntools \-ldl \-lm
-.Ve
-.PP
-Once configure has built a Makefile on your platform, the required
-\&\*(L"extra\*(R" libraries (aside from \-lm, which always is required) are
-specified in that file's \s-1EXTRA_LIBS\s0 variable. For example, under
-Linux you will find:
-.PP
-.Vb 3
-\& grep EXTRA_LIBS Makefile
-\& EXTRA_LIBS = \-ldl
-\& ...
-.Ve
-.PP
-The Funtools library contains both the zlib library
-(http://www.gzip.org/zlib/) and Doug Mink's \s-1WCS\s0 library
-(http://tdc\-www.harvard.edu/software/wcstools/). It is not necessary
-to put these libraries on a Funtools link line. Include files
-necessary for using these libraries are installed in the Funtools
-include directory.
-.PP
-\&\fBFuntools Programming Tutorial\fR
-.PP
-The
-\&\fIFunOpen()\fR
-function is used to open a \s-1FITS\s0 file, an array, or a raw event file:
-.PP
-.Vb 4
-\& /* open the input FITS file for reading */
-\& ifun = FunOpen(iname, "r", NULL);
-\& /* open the output FITS file for writing, and connect it to the input file */
-\& ofun = FunOpen(iname, "w", ifun);
-.Ve
-.PP
-A new output file can inherit header parameters automatically from
-existing input file by passing the input Funtools handle as the last
-argument to the new file's
-\&\fIFunOpen()\fR
-call as shown above.
-.PP
-For image data, you then can call
-\&\fIFunImageGet()\fR
-to read an image into memory.
-.PP
-.Vb 3
-\& float buf=NULL;
-\& /* extract and bin the data section into an image buffer */
-\& buf = FunImageGet(fun, NULL, "bitpix=-32");
-.Ve
-.PP
-If the (second) buf argument to this call is \s-1NULL\s0, buffer space is allocated
-automatically. The (third) plist argument can be used to specify the
-return data type of the array. If \s-1NULL\s0 is specified, the data type of
-the input file is used.
-.PP
-To process an image buffer, you would generally make a call to
-\&\fIFunInfoGet()\fR to determine the
-dimensions of the image (which may have been changed from the original
-file dimensions due to Funtools image
-sectioning on the command line). In a \s-1FITS\s0 image, the index along
-the dim1 axis varies most rapidly, followed by the dim2 axis, etc.
-Thus, to access each pixel in an 2D image, use a double loop such as:
-.PP
-.Vb 7
-\& buf = FunImageGet(fun, NULL, "bitpix=-32");
-\& FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-\& for(i=1; i<=dim2; i++){
-\& for(j=1; j<=dim1; j++){
-\& ... process buf[((i-1)*dim1)+(j-1)] ...
-\& }
-\& }
-.Ve
-.PP
-or:
-.PP
-.Vb 5
-\& buf = FunImageGet(fun, NULL, "bitpix=-32");
-\& FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0);
-\& for(i=0; i<(dim1*dim2); i++){
-\& ... process buf[i] ...
-\& }
-.Ve
-.PP
-Finally, you can write the resulting image to disk using
-\&\fIFunImagePut()\fR:
-.PP
-.Vb 1
-\& FunImagePut(fun2, buf, dim1, dim2, \-32, NULL);
-.Ve
-.PP
-Note that Funtools automatically takes care of book-keeping tasks such as
-reading and writing \s-1FITS\s0 headers (although you can, of course, write
-your own header or add your own parameters to a header).
-.PP
-For binary tables and raw event files, a call to
-\&\fIFunOpen()\fR
-will be followed by a call to the
-\&\fIFunColumnSelect()\fR
-routine to select columns to be read from the input file and/or
-written to the output file:
-.PP
-.Vb 8
-\& typedef struct evstruct{
-\& double time;
-\& int time2;
-\& } *Ev, EvRec;
-\& FunColumnSelect(fun, sizeof(EvRec), NULL,
-\& "time", "D", "rw", FUN_OFFSET(Ev, time),
-\& "time2", "J", "w", FUN_OFFSET(Ev, time2),
-\& NULL);
-.Ve
-.PP
-Columns whose (third) mode argument contains an \*(L"r\*(R" are \*(L"readable\*(R",
-i.e., columns will be read from the input file and converted into the
-data type specified in the call's second argument. These columns
-values then are stored in the specified offset of the user record
-structure. Columns whose mode argument contains a \*(L"w\*(R" are
-\&\*(L"writable\*(R", i.e., these values will be written to the output file.
-The
-\&\fIFunColumnSelect()\fR
-routine also offers the option of automatically merging user
-columns with the original input columns when writing the output
-rows.
-.PP
-Once a set of columns has been specified, you can retrieve rows using
-\&\fIFunTableRowGet()\fR,
-and write the rows using
-\&\fIFunTableRowPut()\fR:
-.PP
-.Vb 17
-\& Ev ebuf, ev;
-\& /* get rows -- let routine allocate the array */
-\& while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* process all rows */
-\& for(i=0; i<got; i++){
-\& /* point to the i'th row */
-\& ev = ebuf+i;
-\& /* time2 is generated here */
-\& ev->time2 = (int)(ev->time+.5);
-\& /* change the input time as well */
-\& ev->time = -(ev->time/10.0);
-\& }
-\& /* write out this batch of rows with the new column */
-\& FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
-\& /* free row data */
-\& if( ebuf ) free(ebuf);
-\& }
-.Ve
-.PP
-The input rows are retrieved into an array of user structs, which
-can be accessed serially as shown above. Once again, Funtools
-automatically takes care of book-keeping tasks such as reading and writing
-\&\s-1FITS\s0 headers (although you can, of course, write your own header or
-add your own parameters to a header).
-.PP
-When all processing is done, you can call
-\&\fIFunClose()\fR
-to close the file(s):
-.PP
-.Vb 2
-\& FunClose(fun2);
-\& FunClose(fun);
-.Ve
-.PP
-These are the basics of processing \s-1FITS\s0 files (and arrays or raw event
-data) using Funtools. The routines in these examples are described in
-more detail below, along with a few other routines that support
-parameter access, data flushing, etc.
-.PP
-\&\fBCompiling and Linking\fR
-.PP
-To create a Funtools application, a software developer will include
-the funtools.h definitions file in Funtools code:
-.PP
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-The program is linked against the libfuntools.a library, along with the
-math library (and the dynamic load library, if the latter is available
-on your system):
-.PP
-.Vb 1
-\& gcc \-o foo foo.c \-lfuntools \-ldl \-lm
-.Ve
-.PP
-If gcc is used, Funtools filtering can be performed using dynamically
-loaded shared objects that are built at run\-time. Otherwise, filtering
-is performed using a slave process.
-.PP
-Funtools has been built on the following systems:
-.IP "\(bu" 4
-Sun/Solaris 5.X
-.IP "\(bu" 4
-Linux/RedHat Linux 5.X,6.X,7.X
-.IP "\(bu" 4
-Dec Alpha/OSF1 V4.X
-.IP "\(bu" 4
-WindowsNT/Cygwin 1.0
-.IP "\(bu" 4
-\&\s-1SGI/IRIX64\s0 6.5
-.PP
-\&\fBA Short Digression on Subroutine Order\fR
-.PP
-There is a natural order for all I/O access libraries. You would not
-think of reading a file without first opening it, or writing a file
-after closing it. A large part of the experiment in funtools is to use
-the idea of \*(L"natural order\*(R" as a means of making programming
-easier. We do this by maintaining the state of processing for a given
-funtools file, so that we can do things like write headers and flush
-extension padding at the right time, without you having to do it.
-.PP
-For example, if you open a new funtools file for writing using
-\&\fIFunOpen()\fR,
-then generate an array of image data and call
-\&\fIFunImagePut()\fR,
-funtools knows to write the image header automatically.
-There is no need to think about writing a standard header.
-Of course, you can add parameters to the file first by
-calling one of the
-\&\fIFunParamPut()\fR
-routines, and these parameters will automatically be added
-to the header when it is written out. There still is no
-need to write the header explicitly.
-.PP
-Maintaining state in this way means that there are certain rules of
-order which should be maintained in any funtools program. In particular,
-we strongly recommend the following ordering rules be adhered to:
-.IP "\(bu" 4
-When specifying that input extensions be copied to an output file
-via a reference handle, open the output file \fBbefore\fR reading the
-input file. (Otherwise the initial copy will not occur).
-.IP "\(bu" 4
-Always write parameters to an output file using one of the
-\&\fIFunParamPut()\fR calls
-\&\fBbefore\fR writing any data. (This is a good idea for all \s-1FITS\s0
-libraries, to avoid having to recopy data is the \s-1FITS\s0 header needs
-to be extended by adding a single parameter.)
-.IP "\(bu" 4
-If you retrieve an image, and need to know the data
-type, use the \s-1FUN_SECT_BITPIX\s0 option of
-\&\fIFunInfoGet()\fR,
-\&\fBafter\fR calling
-\&\fIFunImageGet()\fR, since
-it is possible to change the value of \s-1BITPIX\s0 from the latter.
-.IP "\(bu" 4
-When specifying that input extensions be copied to an output file
-via a reference handle, close the output file \fBbefore\fR closing
-input file, or else use
-\&\fIFunFlush()\fR
-explicitly on the output file
-\&\fBbefore\fR closing the input file. (Otherwise the final copy will
-not occur).
-.PP
-We believe that these are the natural rules that are implied in most
-\&\s-1FITS\s0 programming tasks. However, we recognize that making explicit use
-of \*(L"natural order\*(R" to decide what automatic action to take on behalf
-of the programmer is experimental. Therefore, if you find that your
-needs are not compatible with our preferred order, please let us know
-\&\*(-- it will be most illuminating for us as we evaluate this experiment.
-.PP
-\&\fBFuntools Programming Examples\fR
-.PP
-The following complete coding examples are provided to illustrate the
-simplicity of Funtools applications. They can be found in the funtest
-subdirectory of the Funtools distribution. In many cases, you should
-be able to modify one of these programs to generate your own Funtools
-program:
-.IP "\(bu" 4
-evread.c: read and write binary tables
-.IP "\(bu" 4
-evcols.c: add column and rows to binary tables
-.IP "\(bu" 4
-evmerge.c: merge new columns with existing columns
-.IP "\(bu" 4
-evnext.c: manipulate raw data pointers
-.IP "\(bu" 4
-imblank.c: blank out image values below a threshold
-.IP "\(bu" 4
-asc2fits.c: convert a specific \s-1ASCII\s0 table to \s-1FITS\s0 binary table
-.PP
-\&\fBThe Funtools Programming Reference Manual\fR
-.PP
-#include <funtools.h>
-.PP
-Fun FunOpen(char *name, char *mode, Fun ref)
-.PP
-void *FunImageGet(Fun fun, void *buf, char *plist)
-.PP
-int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix, char *plist)
-.PP
-void * FunImageRowGet(Fun fun, void *buf, int rstart, int rstop, char *plist)
-.PP
-void * FunImageRowPut(Fun fun, void *buf, int rstart, int rstop, int dim1, int dim2, int bitpix, char *plist)
-.PP
-int FunColumnSelect(Fun fun, int size, char *plist, ...)
-.PP
-void FunColumnActivate(Fun fun, char *s, char *plist)
-.PP
-int FunColumnLookup(Fun fun, char *s, int which, char **name, int *type, int *mode, int *offset, int *n, int *width)
-.PP
-void *FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist, int *nrow)
-.PP
-int FunTableRowPut(Fun fun, void *rows, int nev, int idx, char *plist)
-.PP
-int FunParamGetb(Fun fun, char *name, int n, int defval, int *got)
-.PP
-int FunParamGeti(Fun fun, char *name, int n, int defval, int *got)
-.PP
-double FunParamGetd(Fun fun, char *name, int n, double defval, int *got)
-.PP
-char *FunParamGets(Fun fun, char *name, int n, char *defval, int *got)
-.PP
-int FunParamPutb(Fun fun, char *name, int n, int value, char *comm, int append)
-.PP
-int FunParamPuti(Fun fun, char *name, int n, int value, char *comm, int append)
-.PP
-int FunParamPutd(Fun fun, char *name, int n, double value, int prec, char *comm, int append)
-.PP
-int FunParamPuts(Fun fun, char *name, int n, char *value, char *comm, int append)
-.PP
-int FunInfoGet(Fun fun, int type, ...)
-.PP
-int FunInfoPut(Fun fun, int type, ...)
-.PP
-void FunFlush(Fun fun, char *plist)
-.PP
-void FunClose(Fun fun)
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funopen.3 b/funtools/man/man3/funopen.3
deleted file mode 100644
index f185ea5..0000000
--- a/funtools/man/man3/funopen.3
+++ /dev/null
@@ -1,272 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funopen 3"
-.TH funopen 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunOpen \- open a Funtools data file
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& Fun FunOpen(char *name, char *mode, Fun ref);
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunOpen()\fB\fR routine opens a Funtools data file for reading or
-appending, or creates a new \s-1FITS\s0 file for writing. The \fBname\fR
-argument specifies the name of the Funtools data file to open. You can
-use IRAF-style bracket notation to specify
-Funtools Files, Extensions, and Filters.
-A separate call should be made each time a different \s-1FITS\s0 extension is
-accessed:
-.PP
-.Vb 7
-\& Fun fun;
-\& char *iname;
-\& ...
-\& if( !(fun = FunOpen(iname, "r", NULL)) ){
-\& fprintf(stderr, "could not FunOpen input file: %s\en", iname);
-\& exit(1);
-\& }
-.Ve
-.PP
-If \fBmode\fR is \*(L"r\*(R", the file is opened for reading, and processing
-is set up to begin at the specified extension. For reading,
-\&\fBname\fR can be \fBstdin\fR, in which case the standard input is read.
-.PP
-If \fBmode\fR is \*(L"w\*(R", the file is created if it does not exist, or
-opened and truncated for writing if it does exist. Processing starts
-at the beginning of the file. The \fBname\fR can be \fBstdout\fR,
-in which case the standard output is readied for processing.
-.PP
-If \fBmode\fR is \*(L"a\*(R", the file is created if it does not exist, or
-opened if it does exist. Processing starts at the end of the file.
-The \fBname\fR can be \fBstdout\fR, in which case the standard
-output is readied for processing.
-.PP
-When a Funtools file is opened for writing or appending, a previously
-opened Funtools reference
-handle can be specified as the third argument. This handle
-typically is associated with the input Funtools file that will be used
-to generate the data for the output data. When a reference file is
-specified in this way, the output file will inherit the (extension)
-header parameters from the input file:
-.PP
-.Vb 8
-\& Fun fun, fun2;
-\& ...
-\& /* open input file */
-\& if( !(fun = FunOpen(argv[1], "r", NULL)) )
-\& gerror(stderr, "could not FunOpen input file: %s\en", argv[1]);
-\& /* open the output FITS image, inheriting params from input */
-\& if( !(fun2 = FunOpen(argv[2], "w", fun)) )
-\& gerror(stderr, "could not FunOpen output file: %s\en", argv[2]);
-.Ve
-.PP
-Thus, in the above example, the output \s-1FITS\s0 binary table file will
-inherit all of the parameters associated with the input binary table
-extension.
-.PP
-A file opened for writing with a
-Funtools reference handle also
-inherits the selected columns (i.e. those columns chosen for
-processing using the
-\&\fIFunColumnSelect()\fR routine)
-from the reference file as its default columns. This makes it easy to
-open an output file in such a way that the columns written to the
-output file are the same as the columns read in the input file. Of
-course, column selection can easily be tailored using the
-\&\fIFunColumnSelect()\fR routine.
-In particular, it is easy to merge user-defined columns with the input
-columns to generate a new file. See the
-evmerge for a complete example.
-.PP
-In addition, when a
-Funtools reference handle
-is supplied in a \fIFunOpen()\fR call,
-it is possible also to specify that all other extensions from the
-reference file (other than the input extension being processed) should
-be copied from the reference file to the output file. This is useful,
-for example, in a case where you are processing a \s-1FITS\s0 binary table
-or image and you want to copy all of the other extensions to
-the output file as well. Copy of other extensions is controlled by
-adding a \*(L"C\*(R" or \*(L"c\*(R" to the mode string of the
-\&\fIFunOpen()\fR call of the input
-reference file. If \*(L"C\*(R" is specified, then other extensions are
-\&\fBalways\fR copied (i.e., copy is forced by the application). If
-\&\*(L"c\*(R" is used, then other extensions are copied if the user requests
-copying by adding a plus sign \*(L"+\*(R" to the extension name in the bracket
-specification. For example, the \fBfuntable\fR program utilizes
-\&\*(L"c\*(R" mode, giving users the option of copying all other extensions:
-.PP
-.Vb 6
-\& /* open input file -- allow user copy of other extensions */
-\& if( !(fun = FunOpen(argv[1], "rc", NULL)) )
-\& gerror(stderr, "could not FunOpen input file: %s\en", argv[1]);
-\& /* open the output FITS image, inheriting params from input */
-\& if( !(fun2 = FunOpen(argv[2], "w", fun)) )
-\& gerror(stderr, "could not FunOpen output file: %s\en", argv[2]);
-.Ve
-.PP
-Thus, \fBfuntable\fR supports either of these command lines:
-.PP
-.Vb 4
-\& # copy only the EVENTS extension
-\& csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
-\& # copy ALL extensions
-\& csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
-.Ve
-.PP
-Use of a Funtools reference
-handle implies that the input file is opened before the output
-file. However, it is important to note that if copy mode (\*(L"c\*(R" or \*(L"C\*(R")
-is specified for the input file, the actual input file open is delayed
-until just after the output file is opened, since the copy of prior
-extensions to the output file takes place while Funtools is seeking to
-the specified input extension. This implies that the output file
-should be opened before any I/O is done on the input file or else the
-copy will fail. Note also that the copy of subsequent extension will
-be handled automatically by
-\&\fIFunClose()\fR
-if the output file is
-closed before the input file. Alternatively, it can be done explicitly
-by \fIFunFlush()\fR, but again, this
-assumes that the input file still is open.
-.PP
-Upon success \fIFunOpen()\fR returns a
-Fun handle that is used in subsequent Funtools calls. On error, \s-1NULL\s0
-is returned.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funparamget.3 b/funtools/man/man3/funparamget.3
deleted file mode 100644
index 1609aae..0000000
--- a/funtools/man/man3/funparamget.3
+++ /dev/null
@@ -1,262 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funparamget 3"
-.TH funparamget 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunParamGet \- get a Funtools param value
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 1
-\& int FunParamGetb(Fun fun, char *name, int n, int defval, int *got)
-.Ve
-.PP
-.Vb 1
-\& int FunParamGeti(Fun fun, char *name, int n, int defval, int *got)
-.Ve
-.PP
-.Vb 1
-\& double FunParamGetd(Fun fun, char *name, int n, double defval, int *got)
-.Ve
-.PP
-.Vb 1
-\& char *FunParamGets(Fun fun, char *name, int n, char *defval, int *got)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The four routines \fB\f(BIFunParamGetb()\fB\fR, \fB\f(BIFunParamGeti()\fB\fR,
-\&\fB\f(BIFunParamGetd()\fB\fR, and \fB\f(BIFunParamGets()\fB\fR, return the value of
-a \s-1FITS\s0 header parameter as a boolean, int, double, and string,
-respectively. The string returned by \fB\f(BIFunParamGets()\fB\fR is a malloc'ed
-copy of the header value and should be freed when no longer needed.
-.PP
-The first argument is the Fun handle associated with the \s-1FITS\s0 header
-being accessed. Normally, the header is associated with the \s-1FITS\s0
-extension that you opened with \fB\f(BIFunOpen()\fB\fR. However, you can use
-\&\fIFunInfoPut()\fR to specify access of the primary header. In particular,
-if you set the \s-1FUN_PRIMARYHEADER\s0 parameter to 1, then the primary
-header is used for all parameter access until the value is reset to
-0. For example:
-.PP
-.Vb 9
-\& int val;
-\& FunParamGeti(fun, "NAXIS", 1, 0, &got); # current header
-\& val=1;
-\& FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch to ...
-\& FunParamGeti(fun, "NAXIS", 1, 0, &got); # ... primary header
-\& FunParamGeti(fun, "NAXIS", 2, 0, &got); # ... primary header
-\& val=0;
-\& FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch back to ...
-\& FunParamGeti(fun, "NAXIS", 2, 0, &got); # current header
-.Ve
-.PP
-Alternatively, you can use the \s-1FUN_PRIMARY\s0 macro to access parameters
-from the primary header on a per-parameter basis:
-.PP
-.Vb 2
-\& FunParamGeti(fun, "NAXIS1", 0, 0, &got); # current header
-\& FunParamGeti(FUN_PRIMARY(fun), "NAXIS1", 0, 0, &got); # primary header
-.Ve
-.PP
-\s-1NB - \s0 \s-1FUN_PRIMARY\s0 is deprecated.
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread\-safe. We recommend use of \fIFunInfoPut()\fR to switch between the
-extension header and the primary header.
-.PP
-For output data, access to the primary header is only possible until
-the header is written out, which usually takes place when the first
-data are written.
-.PP
-The second argument is the name of the parameter to access. The third
-\&\fBn\fR argument, if non\-zero, is an integer that will be added as a
-suffix to the parameter name. This makes it easy to use a simple loop
-to process parameters having the same root name. For example, to
-gather up all values of \s-1TLMIN\s0 and \s-1TLMAX\s0 for each column in a binary
-table, you can use:
-.PP
-.Vb 4
-\& for(i=0, got=1; got; i++){
-\& fun->cols[i]->tlmin = (int)FunParamGeti(fun, "TLMIN", i+1, 0.0, &got);
-\& fun->cols[i]->tlmax = (int)FunParamGeti(fun, "TLMAX", i+1, 0.0, &got);
-\& }
-.Ve
-.PP
-The fourth \fBdefval\fR argument is the default value to return if
-the parameter does not exist. Note that the data type of this
-parameter is different for each specific \fIFunParamGet()\fR call. The final
-\&\fBgot\fR argument will be 0 if no param was found. Otherwise the
-data type of the parameter is returned as follows: \s-1FUN_PAR_UNKNOWN\s0
-('u'), \s-1FUN_PAR_COMMENT\s0 ('c'), \s-1FUN_PAR_LOGICAL\s0 ('l'), \s-1FUN_PAR_INTEGER\s0
-('i'), \s-1FUN_PAR_STRING\s0 ('s'), \s-1FUN_PAR_REAL\s0 ('r'), \s-1FUN_PAR_COMPLEX\s0 ('x').
-.PP
-These routines return the value of the header parameter, or the
-specified default value if the header parameter does not exist. The
-returned value is a malloc'ed string and should be freed when no
-longer needed.
-.PP
-By default, \fB\f(BIFunParamGets()\fB\fR returns the string value of the
-named parameter. However, you can use \fIFunInfoPut()\fR to retrieve the
-raw 80\-character \s-1FITS\s0 card instead. In particular, if you set the
-\&\s-1FUN_RAWPARAM\s0 parameter to 1, then card images will be returned by
-\&\fIFunParamGets()\fR until the value is reset to 0.
-.PP
-Alternatively, if the \s-1FUN_RAW\s0 macro is applied to the name, then the
-80\-character raw \s-1FITS\s0 card is returned instead.
-\s-1NB - \s0 \s-1FUN_RAW\s0 is deprecated.
-It makes use of a global parameter and therefore will not not
-appropriate for threaded applications, when we make funtools
-thread\-safe. We recommend use of \fIFunInfoPut()\fR to switch between the
-extension header and the primary header.
-.PP
-Note that in addition to the behaviors described above, the
-routine \fB\f(BIFunParamGets()\fB\fR will return the 80 raw characters of the
-\&\fBnth\fR \s-1FITS\s0 card (including the comment) if \fBname\fR is specified as
-\&\s-1NULL\s0 and \fBn\fR is positive. For example, to loop through all \s-1FITS\s0
-header cards in a given extension and print out the raw card, use:
-.PP
-.Vb 9
-\& for(i=1; ;i++){
-\& if( (s = FunParamGets(fun, NULL, i, NULL, &got)) ){
-\& fprintf(stdout, "%.80s\en", s);
-\& free(s);
-\& }
-\& else{
-\& break;
-\& }
-\& }
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funparamput.3 b/funtools/man/man3/funparamput.3
deleted file mode 100644
index db90dcc..0000000
--- a/funtools/man/man3/funparamput.3
+++ /dev/null
@@ -1,256 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funparamput 3"
-.TH funparamput 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunParamPut \- put a Funtools param value
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 2
-\& int FunParamPutb(Fun fun, char *name, int n, int value, char *comm,
-\& int append)
-.Ve
-.PP
-.Vb 2
-\& int FunParamPuti(Fun fun, char *name, int n, int value, char *comm,
-\& int append)
-.Ve
-.PP
-.Vb 2
-\& int FunParamPutd(Fun fun, char *name, int n, double value, int prec,
-\& char *comm, int append)
-.Ve
-.PP
-.Vb 2
-\& int FunParamPuts(Fun fun, char *name, int n, char *value, char *comm,
-\& int append)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The four routines \fB\f(BIFunParamPutb()\fB\fR, \fB\f(BIFunParamPuti()\fB\fR,
-\&\fB\f(BIFunParamPutd()\fB\fR, and \fB\f(BIFunParamPuts()\fB\fR, will set the value
-of a \s-1FITS\s0 header parameter as a boolean, int, double, and string,
-respectively.
-.PP
-The first argument is the Fun handle associated with the \s-1FITS\s0 header
-being accessed. Normally, the header is associated with the \s-1FITS\s0
-extension that you opened with \fB\f(BIFunOpen()\fB\fR.
-However, you can use \fIFunInfoPut()\fR to specify that use of the primary
-header. In particular, if you set the \s-1FUN_PRIMARYHEADER\s0 parameter to
-1, then the primary header is used for all parameter access until the
-value is reset to 0. For example:
-.PP
-.Vb 5
-\& int val;
-\& FunParamPuti(fun, "NAXIS1", 0, 10, NULL, 1); # current header
-\& val=1;
-\& FunInfoPut(fun, FUN_PRIMARYHEADER, &val, 0); # switch to ...
-\& FunParamPuti(fun, "NAXIS1", 0, 10, NULL, 1); # primary header
-.Ve
-.PP
-(You also can use the deprecated \s-1FUN_PRIMARY\s0 macro, to access
-parameters from the primary header.)
-.PP
-The second argument is the \fBname\fR of the parameter. (
-In accordance with \s-1FITS\s0 standards, the special names \fB\s-1COMMENT\s0\fR
-and \fB\s-1HISTORY\s0\fR, as well as blank names, are output without the \*(L"= \*(R"
-value indicator in columns 9 and 10.
-.PP
-The third \fBn\fR argument, if non\-zero, is an integer that will be
-added as a suffix to the parameter name. This makes it easy to use a
-simple loop to process parameters having the same root name. For
-example, to set the values of \s-1TLMIN\s0 and \s-1TLMAX\s0 for each column in a
-binary table, you can use:
-.PP
-.Vb 4
-\& for(i=0; i<got; i++){
-\& FunParamPutd(fun, "TLMIN", i+1, tlmin[i], 7, "min column val", 1);
-\& FunParamPutd(fun, "TLMAX", i+1, tlmax[i], 7, "max column val", 1);
-\& }
-.Ve
-.PP
-The fourth \fBdefval\fR argument is the value to set. Note that the
-data type of this argument is different for each specific
-\&\fIFunParamPut()\fR call. The \fBcomm\fR argument is the comment
-string to add to this header parameter. Its value can be \s-1NULL\s0. The
-final \fBappend\fR argument determines whether the parameter is added
-to the header if it does not exist. If set to a non-zero value, the
-header parameter will be appended to the header if it does not exist.
-If set to 0, the value will only be used to change an existing parameter.
-.PP
-Note that the double precision routine \fIFunParamPutd()\fR supports an
-extra \fBprec\fR argument after the \fBvalue\fR argument, in order
-to specify the precision when converting the double value to \s-1ASCII\s0. In
-general a 20.[prec] format is used (since 20 characters are alloted to
-a floating point number in \s-1FITS\s0) as follows: if the double value being
-put to the header is less than 0.1 or greater than or equal to
-10**(20\-2\-[prec]), then \f(CW%20\fR.[prec]e format is used (i.e., scientific
-notation); otherwise \f(CW%20\fR.[prec]f format is used (i.e., numeric
-notation).
-.PP
-As a rule, parameters should be set before writing the table or image.
-It is, however, possible to update the value of an \fBexisting\fR
-parameter after writing an image or table (but not to add a new
-one). Such updating only works if the parameter already exists and if
-the output file is seekable, i.e. if it is a disk file or is stdout
-being redirected to a disk file.
-.PP
-It is possible to add a new parameter to a header after the data has
-been written, but only if space has previously been reserved. To reserve
-space, add a blank parameter whose value is the name of the parameter you
-eventually will update. Then, when writing the new parameter, specify a
-value of 2 for the append flag. The parameter writing routine will
-first look to update an existing parameter, as usual. If an existing
-parameter is not found, an appropriately-valued blank parameter will be
-searched for and replaced. For example:
-.PP
-.Vb 8
-\& /* add blank card to be used as a place holder for IPAR1 update */
-\& FunParamPuts(fun, NULL, 0, "IPAR1", "INTEGER Param", 0);
-\& ...
-\& /* write header and data */
-\& FunTableRowPut(fun, events, got, 0, NULL);
-\& ...
-\& /* update param in file after writing data -- note append = 2 here */
-\& FunParamPuti(fun, "IPAR", 1, 400, "INTEGER Param", 2);
-.Ve
-.PP
-The parameter routines return a 1 if the routine was successful and a 0 on
-failure. In general, the major reason for failure is that you did not
-set the append argument to a non-zero value and the parameter did not
-already exist in the file.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funref.3 b/funtools/man/man3/funref.3
deleted file mode 100644
index 7c6156a..0000000
--- a/funtools/man/man3/funref.3
+++ /dev/null
@@ -1,287 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funref 3"
-.TH funref 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunRef \- the Funtools Reference Handle
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-A description of how to use a Funtools reference handle to connect a
-Funtools input file to an output file.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The Funtools reference handle connects a Funtools input file to a
-Funtools output file so that parameters (or even whole extensions) can
-be copied from the one to the other. To make the connection, the Funtools
-handle of the input file is passed to the
-final argument of the
-\&\fIFunOpen()\fR call for the output file:
-.PP
-.Vb 4
-\& if( !(ifun = FunOpen(argv[1], "r", NULL)) )
-\& gerror(stderr, "could not FunOpen input file: %s\en", argv[1]);
-\& if( !(ofun = FunOpen(argv[2], "w", ifun)) )
-\& gerror(stderr, "could not FunOpen output file: %s\en", argv[2]);
-.Ve
-.PP
-It does not matter what type of input or output file (or extension) is
-opened, or whether they are the same type. When the output image or
-binary table is written using
-\&\fIFunImagePut()\fR
-or
-\&\fIFunTableRowPut()\fR
-an appropriate header will be written first, with parameters copied
-from the input extension. Of course, invalid parameters will be
-removed first, e.g., if the input is a binary table and the output is
-an image, then binary table parameters such as \s-1TFORM\s0, \s-1TUNIT\s0,
-etc. parameters will not be copied to the output.
-.PP
-Use of a reference handle also allows default values to be passed
-to
-\&\fIFunImagePut()\fR in order to
-write out an output image with the same dimensions and data type
-as the input image. To use the defaults from the input, a value
-of 0 is entered for dim1, dim2, and bitpix. For example:
-.PP
-.Vb 5
-\& fun = FunOpen(argv[1], "r", NULL);
-\& fun2 = FunOpen(argv[2], "w", fun);
-\& buf = FunImageGet(fun, NULL, NULL);
-\& ... process image data ...
-\& FunImagePut(fun2, buf, 0, 0, 0, NULL);
-.Ve
-.PP
-Of course, you often want to get information about the data type
-and dimensions of the image for processing. The above code
-is equivalent to the following:
-.PP
-.Vb 7
-\& fun = FunOpen(argv[1], "r", NULL);
-\& fun2 = FunOpen(argv[2], "w", fun);
-\& buf = FunImageGet(fun, NULL, NULL);
-\& FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2,
-\& FUN_SECT_BITPIX, &bitpix, 0);
-\& ... process image data ...
-\& FunImagePut(fun2, buf, dim1, dim2, bitpix, NULL);
-.Ve
-.PP
-It is possible to change the reference handle for a given output Funtools
-handle using the
-\&\fIFunInfoPut()\fR routine:
-.PP
-.Vb 2
-\& /* make the new extension the reference handle for the output file */
-\& FunInfoPut(fun2, FUN_IFUN, &fun, 0);
-.Ve
-.PP
-When this is done, Funtools specially resets the output file to start
-a new output extension, which is connected to the new input reference
-handle. You can use this mechanism to process multiple input extensions
-into a single output file, by successively opening the former and
-setting the reference handle for the latter. For example:
-.PP
-.Vb 18
-\& /* open a new output FITS file */
-\& if( !(fun2 = FunOpen(argv[2], "w", NULL)) )
-\& gerror(stderr, "could not FunOpen output file: %s\en", argv[2]);
-\& /* process each input extension in turn */
-\& for(ext=0; ;ext++){
-\& /* get new extension name */
-\& sprintf(tbuf, "%s[%d]", argv[1], ext);
-\& /* open it -- if we cannot open it, we are done */
-\& if( !(fun=FunOpen(tbuf, "r", NULL)) )
-\& break;
-\& /* make the new extension the reference handle for the output file */
-\& FunInfoPut(fun2, FUN_IFUN, &fun, 0);
-\& ... process ...
-\& /* flush output extension (write padding, etc.) */
-\& FunFlush(fun2, NULL);
-\& /* close the input extension */
-\& FunClose(fun);
-\& }
-.Ve
-.PP
-In this example, the output file is opened first. Then each successive
-input extension is opened, and the output reference handle is set to
-the newly opened input handle. After data processing is performed, the
-output extension is flushed and the input extension is closed, in
-preparation for the next input extension.
-.PP
-Finally, a reference handle can be used to copy other extensions from
-the input file to the output file. Copy of other extensions is
-controlled by adding a \*(L"C\*(R" or \*(L"c\*(R" to the mode string of the
-\&\fIFunOpen()\fR
-call \fBof the input reference file\fR. If \*(L"C\*(R" is specified, then
-other extensions are \fBalways\fR copied (i.e., copy is forced by the
-application). If \*(L"c\*(R" is used, then other extensions are copied if the
-user requests copying by adding a plus sign \*(L"+\*(R" to the extension name
-in the bracket specification. For example, the \fBfuntable\fR
-program utilizes user-specified \*(L"c\*(R" mode so that the second example
-below will copy all extensions:
-.PP
-.Vb 4
-\& # copy only the EVENTS extension
-\& csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
-\& # copy ALL extensions
-\& csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
-.Ve
-.PP
-When extension copy is specified in the input file, the call to
-\&\fIFunOpen()\fR
-on the input file delays the actual file open until the output file
-also is opened (or until I/O is performed on the input file, which
-ever happens first). Then, when the output file is opened, the input
-file is also opened and input extensions are copied to the output
-file, up to the specific extension being opened. Processing of input
-and output extensions then proceed.
-.PP
-When extension processing is complete, the remaining extensions need to
-be copied from input to output. This can be done explicitly, using the
-\&\fIFunFlush()\fR
-call with the \*(L"copy=remaining\*(R" plist:
-.PP
-.Vb 1
-\& FunFlush(fun, "copy=remaining");
-.Ve
-.PP
-Alternatively, this will happen automatically, if the output file
-is closed \fBbefore\fR the input file:
-.PP
-.Vb 5
-\& /* we could explicitly flush remaining extensions that need copying */
-\& /* FunFlush(fun2, "copy=remaining"); */
-\& /* but if we close output before input, end flush is done automatically */
-\& FunClose(fun2);
-\& FunClose(fun);
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funtablerowget.3 b/funtools/man/man3/funtablerowget.3
deleted file mode 100644
index 7554781..0000000
--- a/funtools/man/man3/funtablerowget.3
+++ /dev/null
@@ -1,216 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funtablerowget 3"
-.TH funtablerowget 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunTableRowGet \- get Funtools rows
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.Vb 1
-\& #include <funtools.h>
-.Ve
-.PP
-.Vb 2
-\& void *FunTableRowGet(Fun fun, void *rows, int maxrow, char *plist,
-\& int *nrow)
-.Ve
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunTableRowGet()\fB\fR routine retrieves rows from a Funtools
-binary table or raw event file, and places the values of columns
-selected by \fIFunColumnSelect()\fR
-into an array of user structs. Selected column values are
-automatically converted to the specified user data type (and to native
-data format) as necessary.
-.PP
-The first argument is the Fun handle associated with this row data.
-The second \fBrows\fR argument is the array of user structs into
-which the selected columns will be stored. If \s-1NULL\s0 is passed, the
-routine will automatically allocate space for this array. (This
-includes proper allocation of pointers within each struct, if the \*(L"@\*(R"
-pointer type is used in the selection of columns. Note that if you
-pass \s-1NULL\s0 in the second argument, you should free this space using the
-standard \fIfree()\fR system call when you are finished with the array of
-rows.) The third \fBmaxrow\fR argument specifies the maximum number
-of rows to be returned. Thus, if \fBrows\fR is allocated by the
-user, it should be at least of size maxrow*sizeof(evstruct).
-.PP
-The fourth \fBplist\fR argument is a param list string. Currently,
-the keyword/value pair \*(L"mask=transparent\*(R" is supported in the plist
-argument. If this string is passed in the call's plist argument, then
-all rows are passed back to the user (instead of just rows passing
-the filter). This is only useful when
-\&\fIFunColumnSelect()\fR also is
-used to specify \*(L"$region\*(R" as a column to return for each row. In
-such a case, rows found within a region have a returned region value
-greater than 0 (corresponding to the region id of the region in which
-they are located), rows passing the filter but not in a region have
-region value of \-1, and rows not passing any filter have region
-value of 0. Thus, using \*(L"mask=transparent\*(R" and the returned region
-value, a program can process all rows and decide on an action based
-on whether a given row passed the filter or not.
-.PP
-The final argument is a pointer to an int variable that will return
-the actual number of rows returned. The routine returns a pointer to
-the array of stored rows, or \s-1NULL\s0 if there was an error. (This pointer
-will be the same as the second argument, if the latter is non\-NULL).
-.PP
-.Vb 16
-\& /* get rows -- let routine allocate the row array */
-\& while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* process all rows */
-\& for(i=0; i<got; i++){
-\& /* point to the i'th row */
-\& ev = buf+i;
-\& /* rearrange some values. etc. */
-\& ev->energy = (ev->pi+ev->pha)/2.0;
-\& ev->pha = \-ev->pha;
-\& ev->pi = \-ev->pi;
-\& }
-\& /* write out this batch of rows */
-\& FunTableRowPut(fun2, buf, got, 0, NULL);
-\& /* free row data */
-\& if( buf ) free(buf);
-\& }
-.Ve
-.PP
-As shown above, successive calls to
-\&\fIFunTableRowGet()\fR will return the
-next set of rows from the input file until all rows have been read,
-i.e., the routine behaves like sequential Unix I/O calls such as
-\&\fIfread()\fR. See evmerge example code for a
-more complete example.
-.PP
-Note that \fIFunTableRowGet()\fR also can be called as \fIFunEventsGet()\fR, for
-backward compatibility.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man3/funtablerowput.3 b/funtools/man/man3/funtablerowput.3
deleted file mode 100644
index 533bd43..0000000
--- a/funtools/man/man3/funtablerowput.3
+++ /dev/null
@@ -1,297 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funtablerowput 3"
-.TH funtablerowput 3 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunTableRowPut \- put Funtools rows
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-int FunTableRowPut(Fun fun, void *rows, int nev, int idx, char *plist)
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The \fB\f(BIFunTableRowPut()\fB\fR routine writes rows to a \s-1FITS\s0 binary
-table, taking its input from an array of user structs that contain
-column values selected by a previous call to
-\&\fIFunColumnSelect()\fR. Selected
-column values are automatically converted from native data format to
-\&\s-1FITS\s0 data format as necessary.
-.PP
-The first argument is the Fun handle associated with this row data.
-The second \fBrows\fR argument is the array of user structs to
-output. The third \fBnrow\fR argument specifies the number number of
-rows to write. The routine will write \fBnrow\fR records, starting
-from the location specified by \fBrows\fR.
-.PP
-The fourth \fBidx\fR argument is the index of the first raw input
-row to write, in the case where rows from the user buffer are
-being merged with their raw input row counterparts (see below). Note
-that this \fBidx\fR value is has nothing to do with the
-row buffer specified in argument 1. It merely matches the row
-being written with its corresponding (hidden) raw row. Thus, if you
-read a number of rows, process them, and then write them out all at
-once starting from the first user row, the value of \fBidx\fR
-should be 0:
-.PP
-.Vb 14
-\& Ev ebuf, ev;
-\& /* get rows -- let routine allocate the row array */
-\& while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* process all rows */
-\& for(i=0; i<got; i++){
-\& /* point to the i'th row */
-\& ev = ebuf+i;
-\& ...
-\& }
-\& /* write out this batch of rows, starting with the first */
-\& FunTableRowPut(fun2, (char *)ebuf, got, 0, NULL);
-\& /* free row data */
-\& if( ebuf ) free(ebuf);
-\& }
-.Ve
-.PP
-On the other hand, if you write out the rows one at a time (possibly
-skipping rows), then, when writing the i'th row from the input
-array of rows, set \fBidx\fR to the value of i:
-.PP
-.Vb 14
-\& Ev ebuf, ev;
-\& /* get rows -- let routine allocate the row array */
-\& while( (ebuf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* process all rows */
-\& for(i=0; i<got; i++){
-\& /* point to the i'th row */
-\& ev = ebuf+i;
-\& ...
-\& /* write out the current (i.e., i'th) row */
-\& FunTableRowPut(fun2, (char *)ev, 1, i, NULL);
-\& }
-\& /* free row data */
-\& if( ebuf ) free(ebuf);
-\& }
-.Ve
-.PP
-The final argument is a param list string that is not currently used.
-The routine returns the number of rows output. This should be equal
-to the value passed in the third nrow</B argument.
-.PP
-When \fIFunTableRowPut()\fR is first
-called for a given binary table, Funtools checks to see of the primary
-header has already been written (either by writing a previous row
-table or by writing an image.) If not, a dummy primary header is
-written to the file specifying that an extension should be expected.
-After this, a binary table header is automatically written containing
-information about the columns that will populate this table. In
-addition, if a
-Funtools reference handle
-was specified when this table was opened, the parameters from this
-Funtools reference handle
-are merged into the new binary table header.
-.PP
-In a typical Funtools row loop, you read rows using
-\&\fIFunTableRowGet()\fR() and write
-rows using \fIFunTableRowPut()\fR. The columns written by
-\&\fIFunTableRowPut()\fR() are those defined as writable by a previous call to
-\&\fIFunColumnSelect()\fR. If
-that call to FunColumnSelect also specified
-\&\fBmerge=[update|replace|append]\fR, then the entire corresponding
-raw input row record will be merged with the output row according
-to the \fBmerge\fR specification (see
-\&\fIFunColumnSelect()\fR above).
-.PP
-A call to write rows can either be done once, after all rows in
-the input batch have been processed, or it can be done (slightly less
-efficiently) one row at a time (or anything in between). We do
-recommend that you write all rows associated with a given batch of
-input rows before reading new rows. This is \fBrequired\fR if
-you are merging the output rows with the raw input rows (since
-the raw rows are destroyed with each successive call to get new rows).
-.PP
-For example:
-.PP
-.Vb 13
-\& Ev buf, ev;
-\& ...
-\& /* get rows -- let routine allocate the row array */
-\& while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* point to the i'th row */
-\& ev = buf + i;
-\& .... process
-\& }
-\& /* write out this batch of rows */
-\& FunTableRowPut(fun2, buf, got, 0, NULL);
-\& /* free row data */
-\& if( buf ) free(buf);
-\& }
-.Ve
-.PP
-or
-.PP
-.Vb 16
-\& Ev buf, ev;
-\& ...
-\& /* get rows -- let routine allocate the row array */
-\& while( (buf = (Ev)FunTableRowGet(fun, NULL, MAXROW, NULL, &got)) ){
-\& /* process all rows */
-\& for(i=0; i<got; i++){
-\& /* point to the i'th row */
-\& ev = buf + i;
-\& ... process
-\& /* write out this batch of rows with the new column */
-\& if( dowrite )
-\& FunTableRowPut(fun2, buf, 1, i, NULL);
-\& }
-\& /* free row data */
-\& if( buf ) free(buf);
-\& }
-.Ve
-.PP
-Note that the difference between these calls is that the first one
-outputs \fBgot\fR rows all at once and therefore passes
-\&\fBidx=0\fR in argument four, so that merging starts at the first raw
-input row. In the second case, a check it made on each row to see
-if it needs to be output. If so, the value of \fBidx\fR is passed as
-the value of the \fBi\fR variable which points to the current row
-being processed in the batch of input rows.
-.PP
-As shown above, successive calls to
-\&\fIFunTableRowPut()\fR will write
-rows sequentially. When you are finished writing all rows in a
-table, you should call
-\&\fIFunFlush()\fR to write out the \s-1FITS\s0
-binary table padding. However, this is not necessary if you
-subsequently call \fIFunClose()\fR without doing any other I/O to the \s-1FITS\s0
-file.
-.PP
-Note that \fIFunTableRowPut()\fR also can be called as \fIFunEventsPut()\fR, for
-backward compatibility.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funcombine.7 b/funtools/man/man7/funcombine.7
deleted file mode 100644
index b2e5dc4..0000000
--- a/funtools/man/man7/funcombine.7
+++ /dev/null
@@ -1,248 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funcombine 7"
-.TH funcombine 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunCombine \- Combining Region and Table Filters
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document discusses the conventions for combining region and table
-filters, especially with regards to the comma operator.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBComma Conventions\fR
-.PP
-Filter specifications consist of a series of boolean expressions,
-separated by commas. These expressions can be table filters,
-spatial region filters, or combinations thereof. Unfortunately,
-common usage requires that the comma operator must act differently
-in different situations. Therefore, while its use is intuitive in
-most cases, commas can be a source of confusion.
-.PP
-According to long-standing usage in \s-1IRAF\s0, when a comma separates two
-table filters, it takes on the meaning of a boolean \fBand\fR. Thus:
-.PP
-.Vb 1
-\& foo.fits[pha==1,pi==2]
-.Ve
-.PP
-is equivalent to:
-.PP
-.Vb 1
-\& foo.fits[pha==1 && pi==2]
-.Ve
-.PP
-When a comma separates two spatial region filters, however, it has
-traditionally taken on the meaning of a boolean \fBor\fR. Thus:
-.PP
-.Vb 1
-\& foo.fits[circle(10,10,3),ellipse(20,20,8,5)]
-.Ve
-.PP
-is equivalent to:
-.PP
-.Vb 1
-\& foo.fits[circle(10,10,3) || ellipse(20,20,8,5)]
-.Ve
-.PP
-(except that in the former case, each region is given a unique id
-in programs such as funcnts).
-.PP
-Region and table filters can be combined:
-.PP
-.Vb 1
-\& foo.fits[circle(10,10,3),pi=1:5]
-.Ve
-.PP
-or even:
-.PP
-.Vb 1
-\& foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
-.Ve
-.PP
-In these cases, it is not obvious whether the command should utilize an
-\&\fBor\fR or \fBand\fR operator. We therefore arbitrarily chose to
-implement the following rule:
-.IP "\(bu" 4
-if both expressions contain a region, the operator used is \fBor\fR.
-.IP "\(bu" 4
-if one (or both) expression(s) does not contain a region, the operator
-used is \fBand\fR.
-.PP
-This rule handles the cases of pure regions and pure column filters properly.
-It unambiguously assigns the boolean \fBand\fR to all mixed cases. Thus:
-.PP
-.Vb 1
-\& foo.fits[circle(10,10,3),pi=1:5]
-.Ve
-.PP
-and
-.PP
-.Vb 1
-\& foo.fits[pi=1:5,circle(10,10,3)]
-.Ve
-.PP
-both are equivalent to:
-.PP
-.Vb 1
-\& foo.fits[circle(10,10,3) && pi=1:5]
-.Ve
-.PP
-[\s-1NB:\s0 This arbitrary rule \fBreplaces the previous arbitrary rule\fR
-(pre\-funtools 1.2.3) which stated:
-.IP "\(bu" 4
-if the 2nd expression contains a region, the operator used is \fBor\fR.
-.IP "\(bu" 4
-if the 2nd expression does not contain a region, the operator
-used is \fBand\fR.
-.PP
-In that scenario, the \fBor\fR operator was implied by:
-.PP
-.Vb 1
-\& pha==4,circle 5 5 1
-.Ve
-.PP
-while the \fBand\fR operator was implied by
-.PP
-.Vb 1
-\& circle 5 5 1,pha==4
-.Ve
-.PP
-Experience showed that this non-commutative treatment of the comma
-operator was confusing and led to unexpected results.]
-.PP
-The comma rule must be considered provisional: comments and complaints
-are welcome to help clarify the matter. Better still, we recommend
-that the comma operator be avoided in such cases in favor of an
-explicit boolean operator.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funds9.7 b/funtools/man/man7/funds9.7
deleted file mode 100644
index 963084a..0000000
--- a/funtools/man/man7/funds9.7
+++ /dev/null
@@ -1,216 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funds9 7"
-.TH funds9 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunDS9 \- Funtools and DS9 Image Display
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-Describes how funtools can be integrated into the ds9 Analysis menu.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-SAOImage/DS9 is an astronomical imaging and data visualization
-application used by astronomers around the world. \s-1DS9\s0 can display
-standard astronomical \s-1FITS\s0 images and binary tables, but also has
-support for displaying raw array files, shared memory files, and data
-files automatically retrieved via \s-1FTP\s0 and \s-1HTTP\s0. Standard functional
-capabilities include multiple frame buffers, colormap and region
-manipulation, and many data scaling algorithms. \s-1DS9\s0's advanced
-features include TrueColor visuals, deep frame buffers, true
-PostScript printing, and display of image mosaics. The program's
-support of image tiling, \*(L"blinking\*(R", arbitrary zoom, rotation, and pan
-is unparalleled in astronomy. It also has innovative support for
-automatic retrieval and display of standard image data such as the
-Digital Sky Survey (using servers at \s-1SAO\s0, StScI, or \s-1ESO\s0).
-.PP
-\&\s-1DS9\s0 can communicate with external programs such as Funtools using the
-\&\s-1XPA\s0
-messaging system. In addition, programs can be integrated directly
-into the \s-1DS9\s0 \s-1GUI\s0 by means of a configurable Analysis menu. By
-default, the \s-1DS9\s0 Analysis menu contains algorithms deemed essential to
-the core functions of \s-1DS9\s0, e.g., display cross-cuts of data,
-iso-intensity contours, and \s-1WCS\s0 grids. However, new programs can be
-added to \s-1DS9\s0 by creating a set-up file which can be loaded into \s-1DS9\s0
-to reconfigure the Analysis menu.
-.PP
-The basic format of the analysis set-up file is:
-.PP
-.Vb 6
-\& #
-\& # Analysis command descriptions:
-\& # menu label/description
-\& # file templates for this command
-\& # "menu" (add to menu) |"bind" (bind to key)
-\& # analysis command line
-.Ve
-.PP
-For example, the funcnts program can be specified in this way:
-.PP
-.Vb 4
-\& Funcnts (counts in source/bkgd regions; options: none)
-\& *
-\& menu
-\& funcnts $filename $regions(source,,) $regions(background,,) | $text
-.Ve
-.PP
-As shown above, \s-1DS9\s0 supports a macro facility to provide information
-as well as task support to command lines. For example, the \f(CW$regions\fR
-macro is expanded by \s-1DS9\s0 to provide the current source and/or
-background region to the analysis command. The \f(CW$text\fR macro is expanded
-to generate a text window display. It also is possible to query for
-parameters using a \f(CW$param\fR macro, plot data using a \f(CW$plot\fR macro,
-etc. See the \s-1DS9\s0 documentation for further details.
-.PP
-A set-up file called funtools.ds9 will
-load some useful Funtools applications (counts in regions, radial
-profile, X\-ray light curve and energy spectrum, 1D histogram) into the \s-1DS9\s0
-Analysis menu (version 2.1 and above). The file resides in the bin
-directory where Funtools programs are installed. It can be manually
-loaded into \s-1DS9\s0 from the \fBLoad Analysis Commands ...\fR option of
-the \fBAnalysis\fR menu. Alternatively, you can tell \s-1DS9\s0 to load
-this file automatically at start-up time by adding the pathname to the
-\&\fBEdit\fR\->\fBPreferences\fR\->\fBAnalysis Menu\fR\->Analysis
-File menu option. (\s-1NB:\s0 make sure you select
-\&\fBEdit\fR\->\fBPreferences\fR\->\fBSave Preferences\fR after setting
-the pathname.)
-.PP
-The tasks in this setup file generally process the original disk-based
-\&\s-1FITS\s0 file. Funcnts-based results (radial profile, counts in regions)
-are presented in \s-1WCS\s0 units, if present in the \s-1FITS\s0 header. For
-situations where a disk file is not available (e.g., image data
-generated and sent to \s-1DS9\s0's 'fits' \s-1XPA\s0 access point), versions of the
-radial profile and counts in regions tasks also are also offered
-utilizing \s-1DS9\s0's internal image data. Results are presented in pixels.
-Aside from the units, the results should be identical to the file-based
-results.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funenv.7 b/funtools/man/man7/funenv.7
deleted file mode 100644
index 4b29218..0000000
--- a/funtools/man/man7/funenv.7
+++ /dev/null
@@ -1,352 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funenv 7"
-.TH funenv 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunEnv \- Funtools Environment Variables
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-Describes the environment variables which can be used to tailor the overall
-Funtools environment.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The following environment variables are supported by Funtools:
-.IP "\(bu" 4
-\&\fB\s-1FITS_EXTNAME\s0\fR
-.Sp
-The \fB\s-1FITS_EXTNAME\s0\fR environment variable specifies the
-default \s-1FITS\s0 extension name when \fIFunOpen()\fR is called on a file lacking
-a primary image. Thus,
-.Sp
-.Vb 1
-\& setenv FITS_EXTNAME "NEWEV"
-.Ve
-.Sp
-will allow you to call \fIFunOpen()\fR on files without specifying \s-1NEWEV\s0 in
-the
-Funtools bracket specification.
-If no \s-1FITS_EXTNAME\s0 variable is defined and the extension name also is
-not passed in the bracket specification, then the default will be to
-look for standard X\-ray event table extension names \*(L"\s-1EVENTS\s0\*(R" or
-\&\*(L"\s-1STDEVT\s0\*(R" (we are, after all, and X\-ray astronomy group at heart!).
-.IP "\(bu" 4
-\&\fB\s-1FITS_EXTNUM\s0\fR
-.Sp
-The \fB\s-1FITS_EXTNUM\s0\fR environment variable specifies the
-default \s-1FITS\s0 extension number when \fIFunOpen()\fR is called on a file lacking
-a primary image. Thus,
-.Sp
-.Vb 1
-\& setenv FITS_EXTNUM 7
-.Ve
-.Sp
-will allow you to call \fIFunOpen()\fR on files to open the seventh
-extension without specifying the number in the
-Funtools bracket specification.
-.IP "\(bu" 4
-\&\fB\s-1FITS_BINCOLS\s0\fR and \fB\s-1EVENTS_BINCOLS\s0\fR
-.Sp
-These environment variable specifies the default binning key for
-\&\s-1FITS\s0 binary tables and raw event files, respectively. They can be
-over-ridden using the \fBbincols=[naxis1,naxis2]\fR keyword in a
-Funtools bracket specification.
-The value of each environment variable
-is a pair of comma-delimited columns, enclosed in parentheses, to use
-for binning. For example, if you want to bin on detx and dety by
-default, then use:
-.Sp
-.Vb 1
-\& setenv FITS_BINCOLS "(detx,dety)"
-.Ve
-.Sp
-in preference to adding a bincols specification to each filename:
-.Sp
-.Vb 1
-\& foo.fits[bincols=(detx,dety)]
-.Ve
-.IP "\(bu" 4
-\&\fB\s-1FITS_BITPIX\s0\fR and \fB\s-1EVENTS_BITPIX\s0\fR
-.Sp
-These environment variable specifies the default bitpix value for
-binning \s-1FITS\s0 binary tables and raw event files, respectively. They can
-be over-ridden using the \fBbitpix=[value]\fR keyword in a
-Funtools bracket specification. The value
-of each environment variable is one of the standard \s-1FITS\s0 bitpix values
-(8,16,32,\-32,\-64). For example, if you want binning routines to
-create a floating array, then use:
-.Sp
-.Vb 1
-\& setenv FITS_BITPIX \-32
-.Ve
-.Sp
-in preference to adding a bitpix specification to each filename:
-.Sp
-.Vb 1
-\& foo.fits[bitpix=-32]
-.Ve
-.IP "\(bu" 4
-\&\fB\s-1ARRAY\s0\fR
-.Sp
-The \fB\s-1ARRAY\s0\fR environment variable specifies the default
-definition of an array file for Funtools.
-It is used if there is no array specification passed in the
-\&\fB\s-1\f(BIARRAY\s0()\fB\fR directive in a
-Non-FITS Array specification.
-The value of the environment variable is a valid array specification such as:
-.Sp
-.Vb 2
-\& setenv ARRAY "s100.150"
-\& foo.arr[ARRAY()]
-.Ve
-.Sp
-This can be defined in preference to adding the specification to each filename:
-.Sp
-.Vb 1
-\& foo.arr[ARRAY(s100.150)]
-.Ve
-.IP "\(bu" 4
-\&\fB\s-1EVENTS\s0\fR
-.Sp
-The \fB\s-1EVENTS\s0\fR environment variable specifies the default
-definition of an raw event file for Funtools.
-It is used if there is no \s-1EVENTS\s0 specification passed in the
-\&\fB\s-1\f(BIEVENTS\s0()\fB\fR directive in a
-Non-FITS \s-1EVENTS\s0 specification.
-The value of the environment variable is a valid \s-1EVENTS\s0 specification such as:
-.Sp
-.Vb 2
-\& setenv EVENTS "x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024"
-\& foo.ev[EVENTS()]
-.Ve
-.Sp
-This can be defined in preference to adding the specification to each filename:
-.Sp
-.Vb 1
-\& foo.ev[EVENTS(x:J:1024,y:J:1024,pi:I,pha:I,time:D,dx:E:1024,dx:E:1024)]
-.Ve
-.PP
-The following filter-related environment variables are supported by Funtools:
-.IP "\(bu" 4
-\&\fB\s-1FILTER_PTYPE\s0\fR
-.Sp
-The \fB\s-1FILTER_PTYPE\s0\fR environment variable specifies how to
-build a filter. There are three possible methods:
-.RS 4
-.IP "\(bu" 4
-process or p
-.Sp
-The filter is compiled and linked against the funtools library (which
-must therefore be accessible in the original install directory) to produce
-a slave program. This program is fed events or image data and returns
-filter results.
-.IP "\(bu" 4
-dynamic or d (gcc only)
-.Sp
-The filter is compiled and linked against the funtools library (which
-must therefore be accessible in the original install directory) to produce
-a dynamic shared object, which is loaded into the funtools program and
-executed as a subroutine. (Extensive testing has shown that, contrary to
-expectations, this method is no faster than using a slave process.)
-.IP "\(bu" 4
-contained or c
-.Sp
-The filter and all supporting region code is compiled and linked
-without reference to the funtools library to produce a slave program
-(which is fed events or image data and returns filter results). This method
-is slower than the other two, because of the time it takes to compile the
-region filtering code. It is used by stand-alone programs such as ds9,
-which do not have access to the funtools library.
-.RE
-.RS 4
-.Sp
-By default, \fBdynamic\fR is generally used for gcc compilers and
-\&\fBprocess\fR for other compilers. However the filter building algorithm
-will check for required external files and will use \fBcontained\fR is
-these are missing.
-.RE
-.IP "\(bu" 4
-\&\fB\s-1FUN_MAXROW\s0\fR
-.Sp
-The \fB\s-1FUN_MAXROW\s0\fR environment variable is used by core
-row-processing Funtools programs (funtable, fundisp, funcnts, funhist,
-funmerge, and funcalc) to set the maximum number of rows read at once
-(i.e. it sets the third argument to the \fIFunTableRowGet()\fR call). The
-default is 8192. Note that this variable is a convention only: it will
-not be a part of a non-core Funtools program unless code is explicitly
-added, since each call to \fIFunTableRowGet()\fR specifies its own maximum
-number of rows to read. \s-1NB:\s0 if you make this value very large, you
-probably will need to increase \fB\s-1FUN_MAXBUFSIZE\s0\fR (see below) as well.
-.IP "\(bu" 4
-\&\fB\s-1FUN_MAXBUFSIZE\s0\fR
-.Sp
-The \fB\s-1FUN_MAXBUFSIZE\s0\fR environment variable is used to limit the
-max buffer size that will be allocated to hold table row data. This
-buffer size is calculated to be the row size of the table multiplied
-by the maximum number of rows read at once (see above). Since the
-row size is unlimited (and we have examples of it being larger than 5
-Mb), it is possible that the total buffer size will exceed the machine
-capabilities. We therefore set a default value of 5Mb for the max buffer
-size, and adjust maxrow so that the total size calculated is less than
-this max buffer size. (If the row size is greater than this max buffer
-size, then maxrow is set to 1.) This environment variable will change
-the max buffer size allowed.
-.IP "\(bu" 4
-\&\fB\s-1FILTER_CC\s0\fR
-.Sp
-The \fB\s-1FILTER_CC\s0\fR environment variable specifies the compiler to
-use for compiling a filter specification. You also can use the \fB\s-1CC\s0\fR
-environment variable. If neither has been set, then gcc will be used
-if available. Otherwise cc is used if available.
-.IP "\(bu" 4
-\&\fB\s-1FILTER_EXTRA\s0\fR
-.Sp
-The \fB\s-1FILTER_EXTRA\s0\fR environment variable specifies extra options
-to add to a filter compile command line. In principle, you can add libraries,
-include files, and compiler switches. This variable should be used with care.
-.IP "\(bu" 4
-\&\fB\s-1FILTER_TMPDIR\s0\fR
-.Sp
-The \fB\s-1FILTER_TMPDIR\s0\fR environment variable specifies the temporary
-directory for filter compilation intermediate files. You also can use
-the \fB\s-1TMPDIR\s0\fR and \fB\s-1TMP\s0\fR variables. By default, /tmp is used
-as the temporary directory.
-.IP "\(bu" 4
-\&\fB\s-1FILTER_KEEP\s0\fR
-.Sp
-The \fB\s-1FILTER_KEEP\s0\fR environment variable specifies whether the
-intermediate filter files (i.e. C source file and compile log file)
-should be saved after a filter is built. The default is \*(L"false\*(R", so that
-these intermediate files are deleted. This variable is useful for debugging,
-but care should be taken to reset its value to false when debugging is
-complete.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funfiles.7 b/funtools/man/man7/funfiles.7
deleted file mode 100644
index f401833..0000000
--- a/funtools/man/man7/funfiles.7
+++ /dev/null
@@ -1,802 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funfiles 7"
-.TH funfiles 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunFiles \- Funtools Data Files
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document describes the data file formats (\s-1FITS\s0, array, raw
-events) as well as the file types (gzip, socket, etc.) supported
-by Funtools.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Funtools supports \s-1FITS\s0 images and binary tables, and binary files
-containing array (homogeneous) data or event (heterogeneous) data.
-IRAF-style brackets are appended to the filename to specify various
-kinds of information needed to characterize these data:
-.PP
-.Vb 3
-\& file[ext|ind|ARRAY()|EVENTS(),section][filters]
-\& or
-\& file[ext|ind|ARRAY()|EVENTS(),section,filters]
-.Ve
-.PP
-where:
-.IP "\(bu" 4
-\&\fBfile\fR is the Funtools file name
-.IP "\(bu" 4
-\&\fBext\fR is the \s-1FITS\s0 extension name
-.IP "\(bu" 4
-\&\fBind\fR is the \s-1FITS\s0 extension number
-.IP "\(bu" 4
-\&\fB\s-1\f(BIARRAY\s0()\fB\fR is an array specification
-.IP "\(bu" 4
-\&\fB\s-1\f(BIEVENTS\s0()\fB\fR is an event specification
-.IP "\(bu" 4
-\&\fBsection\fR is the image section specification
-.IP "\(bu" 4
-\&\fBfilters\fR are spatial region and table (row) filters
-.PP
-\&\fBSupported Data Formats\fR
-.PP
-Funtools programs (and the underlying libraries) support the
-following data file formats:
-.IP "\(bu" 4
-\&\s-1FITS\s0 images (and image extensions)
-.IP "\(bu" 4
-\&\s-1FITS\s0 binary tables
-.IP "\(bu" 4
-binary files containing an array of homogeneous data
-.IP "\(bu" 4
-binary files containing events, i.e. records of heterogeneous data
-.IP "\(bu" 4
-column-based text files, which are documented here
-.IP "\(bu" 4
-non-disk files and lists of files
-.PP
-Information needed to identify and characterize
-the event or image data can be specified on the command line
-using IRAF-style bracket notation appended to the filename:
-.PP
-.Vb 5
-\& foo.fits # open FITS default extension
-\& image.fits[3] # open FITS extension #3
-\& events.fits[EVENTS] # open EVENTS extension
-\& array.file[ARRAY(s1024)] # open 1024x1024 short array
-\& events.file[EVENTS(x:1024,y:1024...)] # open non-FITS event list
-.Ve
-.PP
-Note that in many Unix shells (e.g., csh and tcsh), filenames must
-be enclosed in quotes to protect the brackets from shell processing.
-.PP
-\&\fB\s-1FITS\s0 Images and Binary Tables\fR
-.PP
-When \fIFunOpen()\fR opens a \s-1FITS\s0 file
-without a bracket specifier, the default behavior is to look for a
-valid image in the primary \s-1HDU\s0. In the absence of a primary image,
-Funtools will try to open an extension named either \fB\s-1EVENTS\s0\fR or
-\&\fB\s-1STDEVT\s0\fR, if one of these exists. This default behavior supports
-both \s-1FITS\s0 image processing and standard X\-ray event list processing
-(which, after all, is what we at \s-1SAO/HEAD\s0 do).
-.PP
-In order to open a \s-1FITS\s0 binary table or image extension explicitly, it
-is necessary to specify either the extension name or the extension
-number in brackets:
-.PP
-.Vb 3
-\& foo.fits[1] # open extension #1: the primary HDU
-\& foo.fits[3] # open extension #3 of a FITS file
-\& foo.fits[GTI] # open GTI extension of a FITS file
-.Ve
-.PP
-The ext argument specifies the name of the \s-1FITS\s0 extension (i.e. the
-value of the \s-1EXTENSION\s0 header parameter in a \s-1FITS\s0 extension), while
-the index specifies the value of the \s-1FITS\s0 \s-1EXTVER\s0 header parameter.
-Following \s-1FITS\s0 conventions, extension numbers start at 1.
-.PP
-When a \s-1FITS\s0 data file is opened for reading using
-\&\fIFunOpen()\fR, the specified extension
-is automatically located and is used to initialize the Funtools internal
-data structures.
-.PP
-\&\fBNon-FITS Raw Event Files\fR
-.PP
-In addition to \s-1FITS\s0 tables, Funtools programs and libraries can operate
-on non-FITS files containing heterogeneous event records. To specify
-such an event file, use:
-.IP "\(bu" 4
-file[\s-1EVENTS\s0(event\-spec)]
-.IP "\(bu" 4
-file[\s-1\fIEVENTS\s0()\fR]
-.PP
-where \fBevent-spec\fR is a string that specified the names, data
-types, and optional image dimensions for each element of the event
-record:
-.IP "\(bu" 4
-[name]:[n][type]:[(lodim:)hidim]
-.PP
-Data types follow standard conventions for \s-1FITS\s0 binary tables, but include
-two extra unsigned types ('U' and 'V'):
-.IP "\(bu" 4
-\&\fBB\fR \*(-- unsigned 8-bit char
-.IP "\(bu" 4
-\&\fBI\fR \*(-- signed 16-bit int
-.IP "\(bu" 4
-\&\fBJ\fR \*(-- signed 32-bit int
-.IP "\(bu" 4
-\&\fBK\fR \*(-- signed 64-bit int
-.IP "\(bu" 4
-\&\fBE\fR \*(-- 32-bit float
-.IP "\(bu" 4
-\&\fBD\fR \*(-- 64-bit float
-.IP "\(bu" 4
-\&\fBU\fR \*(-- unsigned 16-bit int
-.IP "\(bu" 4
-\&\fBV\fR \*(-- unsigned 32-bit int
-.PP
-An optional integer value \fBn\fR can be prefixed to the type to indicate
-that the element is an array of n values. For example:
-.PP
-.Vb 1
-\& foo.fits[EVENTS(x:I,y:I,status:4J)]
-.Ve
-.PP
-defines x and y as 16-bit ints and status as an array of 4 32-bit ints.
-.PP
-Furthermore, image dimensions can be attached to the event specification
-in order to tell Funtools how to bin the events into an image. They
-follow the conventions for the \s-1FITS\s0 \s-1TLMIN/TLMAX\s0 keywords. If the low
-image dimension is not specified, it defaults to 1. Thus:
-.IP "\(bu" 4
-\&\s-1RAWX:J:1:100\s0
-.IP "\(bu" 4
-\&\s-1RAWX:J:100\s0
-.PP
-both specify that the dimension of this column runs from 1 to 100.
-.PP
-\&\s-1NB:\s0 it is required that all padding be specified in the record
-definition. Thus, when writing out whole C structs instead of
-individual record elements, great care must be taken to include
-the compiler-added padding in the event definition.
-.PP
-For example, suppose a \s-1FITS\s0 binary table has the following set of column
-definitions:
-.PP
-.Vb 22
-\& TTYPE1 = 'X ' / Label for field
-\& TFORM1 = '1I ' / Data type for field
-\& TLMIN1 = 1 / Min. axis value
-\& TLMAX1 = 10 / Max. axis value
-\& TTYPE2 = 'Y ' / Label for field
-\& TFORM2 = '1I ' / Data type for field
-\& TLMIN2 = 2 / Min. axis value
-\& TLMAX2 = 11 / Max. axis value
-\& TTYPE3 = 'PHA ' / Label for field
-\& TFORM3 = '1I ' / Data type for field
-\& TTYPE4 = 'PI ' / Label for field
-\& TFORM4 = '1J ' / Data type for field
-\& TTYPE5 = 'TIME ' / Label for field
-\& TFORM5 = '1D ' / Data type for field
-\& TTYPE6 = 'DX ' / Label for field
-\& TFORM6 = '1E ' / Data type for field
-\& TLMIN6 = 1 / Min. axis value
-\& TLMAX6 = 10 / Max. axis value
-\& TTYPE7 = 'DY ' / Label for field
-\& TFORM7 = '1E ' / Data type for field
-\& TLMIN7 = 3 / Min. axis value
-\& TLMAX7 = 12 / Max. axis value
-.Ve
-.PP
-An raw event file containing these same data would have the event
-specification:
-.PP
-.Vb 1
-\& EVENTS(X:I:10,Y:I:2:11,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:3:12)
-.Ve
-.PP
-If no event specification string is included within the \s-1\fIEVENTS\s0()\fR operator,
-then the event specification is taken from the \fB\s-1EVENTS\s0\fR environment
-variable:
-.PP
-.Vb 1
-\& setenv EVENTS "X:I:10,Y:I:10,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:10"
-.Ve
-.PP
-In addition to knowing the data structure, it is necessary to know the
-\&\fIendian\fR ordering of the data, i.e., whether or not the data is
-in \fIbigendian\fR format, so that we can convert to the native
-format for this platform. This issue does not arise for \s-1FITS\s0 Binary
-Tables because all \s-1FITS\s0 files use big-endian ordering, regardless of
-platform. But for non-FITS data, big-endian data produced on a Sun
-workstation but read on a Linux \s-1PC\s0 needs to be byte\-swapped, since PCs
-use little-endian ordering. To specify an ordering, use the
-\&\fIbigendian=\fR or \fIendian=\fR keywords on the command-line
-or the \s-1EVENTS_BIGENDIAN\s0 or \s-1EVENTS_ENDIAN\s0 environment variables. The
-value of the \fIbigendian\fR variables should be \*(L"true\*(R" or \*(L"false\*(R",
-while the value of the \fIendian\fR variables should be \*(L"little\*(R" or
-\&\*(L"big\*(R".
-.PP
-For example, a \s-1PC\s0 can access data produced by a Sun using:
-.PP
-.Vb 7
-\& hrc.nepr[EVENTS(),bigendian=true]
-\&or
-\& hrc.nepr[EVENTS(),endian=big]
-\&or
-\& setenv EVENTS_BIGENDIAN true
-\&or
-\& setenv EVENTS_ENDIAN big
-.Ve
-.PP
-If none of these are specified, the data are assumed to follow the
-format for that platform and no byte-swapping is performed.
-.PP
-\&\fBNon-FITS Array Files\fR
-.PP
-In addition to \s-1FITS\s0 images, Funtools programs and libraries can operate
-on non-FITS files containing arrays of homogeneous data. To specify
-an array file, use:
-.IP "\(bu" 4
-file[\s-1ARRAY\s0(array\-spec)]
-.IP "\(bu" 4
-file[\s-1\fIARRAY\s0()\fR]
-.PP
-where array-spec is of the form:
-.IP "\(bu" 4
-[type][dim1][.dim2][:skip][endian]
-.PP
-and where [type] is:
-.IP "\(bu" 4
-b (8-bit unsigned char)
-.IP "\(bu" 4
-s (16-bit short int)
-.IP "\(bu" 4
-u (16-bit unsigned short int)
-.IP "\(bu" 4
-i (32-bit int)
-.IP "\(bu" 4
-r,f (32-bit float)
-.IP "\(bu" 4
-d (64-bit float)
-.PP
-The dim1 specification is required, but dim2 is optional and defaults
-to dim1. The skip specification is optional and defaults to 0. The
-optional endian specification can be 'l' or 'b' and defaults to the
-endian type for the current machine.
-.PP
-If no array specification is included within the \s-1\fIARRAY\s0()\fR operator,
-then the array specification is taken from the \fB\s-1ARRAY\s0\fR environment
-variable. For example:
-.PP
-.Vb 7
-\& foo.arr[ARRAY(r512)] # bitpix=-32 dim1=512 dim2=512
-\& foo.arr[ARRAY(r512.400)] # bitpix=-32 dim1=512 dim2=400
-\& foo.arr[ARRAY(r512.400]) # bitpix=-32 dim1=512 dim2=400
-\& foo.arr[ARRAY(r512.400:2880)] # bitpix=-32 dim1=512 dim2=400 skip=2880
-\& foo.arr[ARRAY(r512l)] # bitpix=-32 dim1=512 dim2=512 endian=little
-\& setenv ARRAY "r512.400:2880"
-\& foo.arr[ARRAY()] # bitpix=-32 dim1=512 dim2=400 skip=2880
-.Ve
-.PP
-\&\fBSpecifying Image Sections\fR
-.PP
-Once a data file (and possibly, a \s-1FITS\s0 extension) has been specified,
-the next (optional) part of a bracket specification can be used to
-select image \fBsection\fR information, i.e., to specify the x,y
-limits of an image section, as well as the blocking factor to apply to
-that section. This information can be added to any file specification but
-only is used by Funtools image processing routines.
-.PP
-The format of the image section specification is one of the following:
-.IP "\(bu" 4
-file[xy0:xy1,block]
-.IP "\(bu" 4
-file[x0:x1,y0:y1,block]
-.IP "\(bu" 4
-file[x0:x1,*,block]
-.IP "\(bu" 4
-file[*,y0:y1,block]
-.IP "\(bu" 4
-file[*,block]
-.PP
-where the limit values can be ints or \*(L"*\*(R" for default. A single \*(L"*\*(R"
-can be used instead of val:val, as shown. Note that blocking is
-applied to the section after it is extracted.
-.PP
-In addition to image sections specified by the lo and hi x,y limits, image
-sections using center positions can be specified:
-.IP "\(bu" 4
-file[dim1@xcen,dim2@ycen]
-.IP "\(bu" 4
-file[xdim2@xcen@ycen]
-.IP "\(bu" 4
-file[dim1@xcen,dim2@ycen,block]
-.IP "\(bu" 4
-file[dim@xcen@ycen,block]
-.PP
-Note that the (float) values for dim, dim1, dim2, xcen, ycen must be
-specified or else the expression does not make sense!
-.PP
-In all cases, block is optional and defaults to 1. An 's' or 'a' can
-be appended to signify \*(L"sum\*(R" or \*(L"average\*(R" blocking (default is \*(L"sum\*(R").
-Section specifications are given in image coordinates by default. If you
-wish to specify physical coordinates, add a 'p' as the last character
-of the section specification, before the closing bracket.
-For example:
-.IP "\(bu" 4
-file[\-8:\-7,\-8:\-7p]
-.IP "\(bu" 4
-file[\-8:\-7,\-8:\-7,2p]
-.PP
-A section can be specified in any Funtools file name. If the operation
-to be applied to that file is an imaging operation, then the
-specification will be utilized. If the operation is purely a table
-operation, then the section specification is ignored.
-.PP
-Do not be confused by:
-.PP
-.Vb 2
-\& foo.fits[2]
-\& foo.fits[*,2]
-.Ve
-.PP
-The former specifies opening the second extension of the \s-1FITS\s0 file.
-The latter specifies application of block 2 to the image section.
-.PP
-Note that the section specification must come after
-any of \s-1FITS\s0 \fBext\fR name or \fBind\fR number,
-but all sensible defaults are supported:
-.IP "\(bu" 4
-file[ext]
-.IP "\(bu" 4
-file[ext,index]
-.IP "\(bu" 4
-file[index]
-.IP "\(bu" 4
-file[ext,section]
-.IP "\(bu" 4
-file[ext,index,section]
-.IP "\(bu" 4
-file[index,section]
-.IP "\(bu" 4
-file[section]
-.PP
-\&\fBBinning \s-1FITS\s0 Binary Tables and Non-FITS Event Files\fR
-.PP
-If a \s-1FITS\s0 binary table or a non-FITS raw event file is to be binned
-into a 2D image (e.g., using the
-funimage
-program), it is necessary to specify the two columns to be used for the
-binning, as well as the dimensions of the image. Funtools first looks
-for a specifier of the form:
-.PP
-.Vb 1
-\& bincols=([xnam[:tlmin[:tlmax:[binsiz]]]],[ynam[:tlmin[:tlmax[:binsiz]]]])
-.Ve
-.PP
-in bracket syntax, and uses the column names thus specified. The tlmin, tlmax,
-and binsiz specifiers determine the image binning dimensions using:
-.PP
-.Vb 2
-\& dim = (tlmax - tlmin)/binsiz (floating point data)
-\& dim = (tlmax - tlmin)/binsiz + 1 (integer data)
-.Ve
-.PP
-These tlmin, tlmax, and binsiz specifiers can be omitted if \s-1TLMIN\s0,
-\&\s-1TLMAX\s0, and \s-1TDBIN\s0 header parameters are present in the \s-1FITS\s0 binary
-table header, respectively. If only one parameter is specified, it is
-assumed to be tlmax, and tlmin defaults to 1. If two parameters are
-specified, they are assumed to be tlmin and tlmax.
-.PP
-For example, to bin an \s-1HRC\s0 event list columns \*(L"\s-1VPOS\s0\*(R" and \*(L"\s-1UPOS\s0\*(R", use:
-.PP
-.Vb 1
-\& hrc.nepr[bincols=(VPOS,UPOS)]
-.Ve
-.PP
-or
-.PP
-.Vb 1
-\& hrc.nepr[bincols=(VPOS:49152,UPOS:4096)]
-.Ve
-.PP
-Note that you can optionally specify the dimensions of these columns
-to cover cases where neither \s-1TLMAX\s0 keywords are defined in
-the header. If either dimension is specified, then both must be specified.
-.PP
-You can set the \s-1FITS_BINCOLS\s0 or \s-1EVENTS_BINCOLS\s0 environment variable as
-an alternative to adding the \*(L"bincols=\*(R" specifier to each file name
-for \s-1FITS\s0 binary tables and raw event files, respectively. If no
-binning keywords or environment variables are specified, or if the
-specified columns are not in the binary table, the Chandra parameters
-\&\s-1CPREF\s0 (or \s-1PREFX\s0) are searched for in the \s-1FITS\s0 binary table header.
-Failing this, columns named \*(L"X\*(R" and \*(L"Y\*(R" are sought. If these are not
-found, the code looks for columns containing the characters \*(L"X\*(R" and
-\&\*(L"Y\*(R". Thus, you can bin on \*(L"\s-1DETX\s0\*(R" and \*(L"\s-1DETX\s0\*(R" columns without
-specifying them, if these are the only column names containing the \*(L"X\*(R"
-and \*(L"Y\*(R" characters.
-.PP
-Ordinarily, each event or row contributes one count to an image pixel
-during the 2D binning process. Thus, if five events all have the same
-(x,y) position, the image pixel value for that position will have a
-value of five. It is possible to specify a variable contribution
-for each event by using the vcol=[colname] filter spec:
-.PP
-.Vb 1
-\& vcol=[colname]
-.Ve
-.PP
-The vcol colname is a column containing a numeric value in each event row
-that will be used as the contribution of the given event to its image
-pixel. For example, consider an event file that has the following content:
-.PP
-.Vb 10
-\& x:e:4 y:e:4 v:e
-\& ------ ------ ----
-\& 1 1 1.0
-\& 2 2 2.0
-\& 3 3 3.0
-\& 4 4 0.0
-\& 1 1 1.0
-\& 2 2 2.0
-\& 3 3 3.0
-\& 4 4 4.0
-.Ve
-.PP
-There are two events with x,y value of (1,1) so ordinarily a 2D image will
-have a value of 2 in the (1,1) pixel. If the v column is specified as the
-value column:
-.PP
-.Vb 1
-\& foo.fits'[vcol=v]'
-.Ve
-.PP
-then each pixel will contain the additive sum of the associated (x,y)
-column values from the v column. For example, image pixel (1,1) will
-contain 1. + 1. = 2, image pixel (2,2) will contain (2 + 2) = 4, etc.
-.PP
-An important variation on the use of a value column to specify the
-contribution an event makes to an image pixel is when the value column
-contains the reciprocal of the event contribution. For this case, the
-column name should be prefixed with a / (divide sign) thus:
-.PP
-.Vb 1
-\& foo.fits'[vcol=/v]'
-.Ve
-.PP
-Each image pixel value will then be the sum of the reciprocals of the value
-column. A zero in the value column results in NaN (not a number).
-Thus, in the above example, image pixel (1.1) will contain 1/1 + 1/1 = 2,
-image pixel (2,2) will contain (1/2 + 1/2) = 1, etc. Image pixel (4,4)
-will contain (1/0 + 1/4) = NaN.
-.PP
-You can set the \s-1FITS_VCOL\s0 or \s-1EVENTS_VCOL\s0 environment variable as
-an alternative to adding the \*(L"vcol=\*(R" specifier to each file name
-for \s-1FITS\s0 binary tables and raw event files, respectively.
-.PP
-Finally, when binning events, the data type of the resulting 2D image
-must be specified. This can be done with the \*(L"bitpix=[n]\*(R" keyword in
-the bracket specification. For example:
-.PP
-.Vb 1
-\& events.fits[bincols=(VPOS,UPOS),bitpix=-32]
-.Ve
-.PP
-will create a floating point image binned on columns \s-1VPOS\s0 and \s-1UPOS\s0.
-If no bitpix keyword is specified, bitpix=32 is assumed. As with
-bincols values, you also can use the \s-1FITS_BITPIX\s0 and \s-1EVENTS_BITPIX\s0
-environment variables to set this value for \s-1FITS\s0 binary tables and
-raw event files, respectively.
-.PP
-The \fBfunimage\fR program also allows you to create a 1D image projection
-along any column of a table by using the \fBbincols=[column]\fR
-filter specification and specifying a single column.
-For example, the following command projects a 1D image along
-the chipx column of a table:
-.PP
-.Vb 1
-\& funimage ev.fits'[bincols=chipx]' im.fits
-.Ve
-.PP
-See funimage for more
-information about creating 1D and 2D images.
-.PP
-Finally, please note that Funtools supports most \s-1FITS\s0 standards.
-We will add missing support as required by the community. In general,
-however, we do not support non-standard extensions. For example, we
-sense the presence of the binary table 'variable length array'
-proposed extension and we pass it along when copying and filtering
-files, but we do not process it. We will add support for new standards
-as they become official.
-.PP
-\&\fBTable and Spatial Region Filters\fR
-.PP
-Note that, in addition extensions and image sections, Funtools bracket
-notation can be used to specify table and spatial region filters. These
-filters are always placed after the image section information. They
-can be specified in the same bracket or in a separate bracket
-immediately following:
-.IP "\(bu" 4
-file[ext|ind|\fIARRAY()\fR|\fIEVENTS()\fR,section][filters]
-.IP "\(bu" 4
-file[ext|ind|\fIARRAY()\fR|\fIEVENTS()\fR,section,filters]
-.PP
-where:
-.IP "\(bu" 4
-\&\fBfile\fR is the Funtools file name
-.IP "\(bu" 4
-\&\fB\s-1\f(BIARRAY\s0()\fB\fR is an array specification
-.IP "\(bu" 4
-\&\fB\s-1\f(BIEVENTS\s0()\fB\fR is an event list specification
-.IP "\(bu" 4
-\&\fBext\fR is the \s-1FITS\s0 extension name
-.IP "\(bu" 4
-\&\fBind\fR is the \s-1FITS\s0 extension number
-.IP "\(bu" 4
-\&\fBsection\fR is the image section to extract
-.IP "\(bu" 4
-\&\fBfilters\fR are spatial region and table (row) filters to apply
-.PP
-The topics of table and region filtering are covered in detail in:
-.IP "\(bu" 4
-Table Filtering
-.IP "\(bu" 4
-Spatial Region Filtering
-.PP
-\&\fBDisk Files and Other Supported File Types\fR
-.PP
-The specified \fBfile\fR usually is an ordinary disk file. In
-addition, gzip'ed files are supported in Funtools: gzip'ed input files
-are automatically uncompressed as they are read, and gzip'ed output
-files are compressed as they are written. \s-1NB:\s0 if a \s-1FITS\s0 binary table
-is written in gzip format, the number of rows in the table will be set
-to \-1. Such a file will work with Funtools programs but will not work
-with other \s-1FITS\s0 programs such as ds9.
-.PP
-The special keywords \*(L"stdin\*(R" and \*(L"stdout\*(R" designate Unix standard
-input and standard output, respectively. The string \*(L"\-\*(R" (hyphen) will
-be taken to mean \*(L"stdin\*(R" if the file is opened for reading and
-\&\*(L"stdout\*(R" if the file is opened for writing.
-.PP
-A file also can be an \s-1INET\s0 socket on the same or another machine using
-the syntax:
-.PP
-.Vb 1
-\& machine:port
-.Ve
-.PP
-Thus, for example:
-.PP
-.Vb 1
-\& karapet:1428
-.Ve
-.PP
-specifies that I/O should be performed to/from port 1428 on the
-machine karapet. If no machine name is specified, the default is to
-use the current machine:
-.PP
-.Vb 1
-\& :1428
-.Ve
-.PP
-This means to open port 1428 on the current machine. Socket support
-allows you to generate a distributed pipe:
-.PP
-.Vb 2
-\& on karapet: funtask1 in.fits bynars:1428
-\& on bynars: funtask2 :1428 out.fits
-.Ve
-.PP
-The socket mechanism thus supports simple parallel processing using
-\&\fBprocess decomposition\fR. Note that parallel processing using
-\&\fBdata decomposition\fR is supported via the \fBsection\fR specifier (see
-below), and the \fBrow#\fR specifier, which is part of
-Table Filtering.
-.PP
-A file also can be a pointer to shared memory using the syntax:
-.PP
-.Vb 1
-\& shm:[id|@key][:size]
-.Ve
-.PP
-A shared memory segment is specified with a \fBshm:\fR prefix,
-followed by either the shared memory id or the shared memory key
-(where the latter is prefixed by the '@' character). The size (in
-bytes) of the shared memory segment can then be appended (preceded by
-the ':' character). If the size specification is absent, the code will
-attempt to determine the length automatically.
-.PP
-If the open mode contains the string \*(L"w+\*(R", then the memory segment will be
-created if it does not exist. (It also will be released and deleted when the
-file is closed.) In the case where a memory segment is being created, the
-length of the segment is required.
-.PP
-A file also can be Unix piped command (i.e. a program to run) using the syntax:
-.PP
-.Vb 1
-\& "pipe: command arg1 ... argn"
-.Ve
-.PP
-The output from the command must be a valid \s-1FITS\s0 file. It is important
-to use quotes to protect spaces so that command arguments are passed
-correctly. A silly example is:
-.PP
-.Vb 1
-\& fundisp "pipe: funtable 'foo.fits[cir 512 512 .1]' stdout"
-.Ve
-.PP
-This seemed like a good idea at the time ...
-.PP
-\&\fBLists of Files\fR
-.PP
-Funtools also will process a list of files as a single file using the
-syntax:
-.PP
-.Vb 1
-\& "list: file1 file2 ... filen"
-.Ve
-.PP
-The files in the list are separated by whitespace. Any of the
-above file types can be used. For example, if two files, foo1.fits and
-foo2.fits, are part of the same observation, they can be processed as
-a single file (using their own filters):
-.PP
-.Vb 17
-\& fundisp "list: foo1.fits[cir(512,512,10)] foo2.fits[cir(511,511,10)]"
-\& X Y PHA PI TIME DX DY
-\& -------- -------- -------- -------- --------------------- -------- --------
-\& 512 512 6 7 79493997.45854475 578 574
-\& 512 512 8 9 79494575.58943175 579 573
-\& 512 512 5 6 79493631.03866175 578 575
-\& 512 512 5 5 79493290.86521725 578 575
-\& 512 512 8 9 79493432.00990875 579 573
-\& 511 511 5 5 79488631.09462625 580 575
-\& 511 511 10 11 79488780.60006675 580 573
-\& 511 511 4 4 79494562.35474326 580 575
-\& 511 511 6 6 79488203.01561825 580 575
-\& 511 511 6 6 79488017.99730176 580 575
-\& 511 511 4 4 79494332.45355175 580 575
-\& 511 511 9 10 79492685.94014275 581 574
-\& 511 511 5 5 79487708.71298325 580 575
-\& 511 511 8 9 79493719.00160225 581 573
-.Ve
-.PP
-Again, note that it is important to avoid spaces in the filters
-because the list separator also is whitespace. To protect whitespace
-in a filter, enclose the file specification in quotes:
-.PP
-.Vb 1
-\& fundisp "list: 'foo1.fits[cir 512 512 .1]' foo2.fits[cir(511,511,.1)]"
-.Ve
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funfilters.7 b/funtools/man/man7/funfilters.7
deleted file mode 100644
index 3c96e6d..0000000
--- a/funtools/man/man7/funfilters.7
+++ /dev/null
@@ -1,464 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funfilters 7"
-.TH funfilters 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-Funfilters \- Filtering Rows in a Table
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document contains a summary of the user interface for
-filtering rows in binary tables.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Table filtering allows a program to select rows from an table (e.g.,
-X\-ray event list) by checking each row against one or more expressions
-involving the columns in the table. When a table is filtered, only
-valid rows satisfying these expressions are passed through for processing.
-.PP
-A filter expression is specified using bracket notation appended to
-the filename of the data being processed:
-.PP
-.Vb 1
-\& foo.fits[pha==1&&pi==2]
-.Ve
-.PP
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-.PP
-.Vb 1
-\& foo.fits[@my.reg]
-.Ve
-.PP
-Filters must be placed after the extension and image section
-information, when such information is present. The correct order is:
-.IP "\(bu" 4
-file[fileinfo,sectioninfo][filters]
-.IP "\(bu" 4
-file[fileinfo,sectioninfo,filters]
-.PP
-where:
-.IP "\(bu" 4
-\&\fBfile\fR is the Funtools file name
-.IP "\(bu" 4
-\&\fBfileinfo\fR is an \s-1ARRAY\s0, \s-1EVENT\s0, \s-1FITS\s0 extension, or \s-1FITS\s0 index
-.IP "\(bu" 4
-\&\fBsectioninfo\fR is the image section to extract
-.IP "\(bu" 4
-\&\fBfilters\fR are spatial region and table (row) filters to apply
-.PP
-See Funtools Files for more information
-on file and image section specifications.
-.PP
-\&\fBFilter Expressions\fR
-.PP
-Table filtering can be performed on columns of data in a \s-1FITS\s0
-binary table or a raw event file. Table filtering is accomplished by
-means of \fBtable filter specifications\fR. An table filter
-specification consists of one or more \fBfilter expressions\fR Filter
-specifications also can contain comments and local/global processing
-directives.
-.PP
-More specifically, a filter specification consist of one or more lines
-containing:
-.PP
-.Vb 13
-\& # comment until end of line
-\& # include the following file in the table descriptor
-\& @file
-\& # each row expression can contain filters separated by operators
-\& [filter_expression] BOOLOP [filter_expression2], ...
-\& # each row expression can contain filters separated by the comma operator
-\& [filter_expression1], [filter_expression2], ...
-\& # the special row# keyword allows a range of rows to be processed
-\& row#=m:n
-\& # or a single row
-\& row#=m
-\& # regions are supported -- but are described elsewhere
-\& [spatial_region_expression]
-.Ve
-.PP
-A single filter expression consists of an arithmetic, logical, or
-other operations involving one or more column values from a
-table. Columns can be compared to other columns, to header values,
-or to numeric constants. Standard math functions can be applied to
-columns. Separate filter expressions can be combined using boolean operators.
-Standard C semantics can be used when constructing expressions, with
-the usual precedence and associativity rules holding sway:
-.PP
-.Vb 15
-\& Operator Associativity
-\& -------- -------------
-\& () left to right
-\& !! (logical not) right to left
-\& ! (bitwise not) - (unary minus) right to left
-\& * / left to right
-\& + - left to right
-\& < <= > >= left to right
-\& == != left to right
-\& & (bitwise and) left to right
-\& ^ (bitwise exclusive or) left to right
-\& | (bitwise inclusive or) left to right
-\& && (logical and) left to right
-\& || (logical or) left to right
-\& = right to left
-.Ve
-.PP
-For example, if energy and pha are columns in a table,
-then the following are valid expressions:
-.PP
-.Vb 4
-\& pha>1
-\& energy == pha
-\& (pha>1) && (energy<=2)
-\& max(pha,energy)>=2.5
-.Ve
-.PP
-Comparison values can be integers or floats. Integer comparison values can be
-specified in decimal, octal (using '0' as prefix), hex (using '0x' as prefix)
-or binary (using '0b' as prefix). Thus, the following all specify the same
-comparison test of a status mask:
-.PP
-.Vb 4
-\& (status & 15) == 8 # decimal
-\& (status & 017) == 010 # octal
-\& (status & 0xf) == 0x8 # hex
-\& (status & 0b1111) == 0b1000 # binary
-.Ve
-.PP
-The special keyword row# allows you to process a range of rows.
-When row# is specified, the filter code skips to the designated
-row and only processes the specified number of rows. The
-\&\*(L"*\*(R" character can be utilized as the high limit value to denote
-processing of the remaining rows. Thus:
-.PP
-.Vb 1
-\& row#=100:109
-.Ve
-.PP
-processes 10 rows, starting with row 100 (counting from 1),
-while:
-.PP
-.Vb 1
-\& row#=100:*
-.Ve
-.PP
-specifies that all but the first 99 rows are to be processed.
-.PP
-Spatial region filtering allows a program to select regions of an
-image or rows of a table (e.g., X\-ray events) using simple geometric
-shapes and boolean combinations of shapes. For a complete description
-of regions, see Spatial Region Filtering.
-.PP
-\&\fBSeparators Also Are Operators\fR
-.PP
-As mentioned previously, multiple filter expressions can be specified
-in a filter descriptor, separated by commas or new\-lines.
-When such a comma or new-line separator is used, the boolean \s-1AND\s0 operator
-is automatically generated in its place. Thus and expression such as:
-.PP
-.Vb 1
-\& pha==1,pi=2:4
-.Ve
-.PP
-is equivalent to:
-.PP
-.Vb 1
-\& (pha==1) && (pi>=2&&pi<=4)
-.Ve
-.PP
-[Note that the behavior of separators is different for filter expressions
-and spatial region expressions. The former uses \s-1AND\s0 as the operator, while
-the latter user \s-1OR\s0. See
-Combining Region and Table Filters
-for more information about these conventions and how they are treated
-when combined.]
-.PP
-\&\fBRange Lists\fR
-.PP
-Aside from the standard C syntax, filter expressions can make use of
-IRAF-style \fBrange lists\fR which specify a range of values. The
-syntax requires that the column name be followed by an '=' sign, which
-is followed by one or more comma-delimited range expressions of the form:
-.PP
-.Vb 4
-\& col = vv # col == vv in range
-\& col = :vv # col <= vv in range
-\& col = vv: # col >= vv in range
-\& col = vv1:vv2 # vv1 <= col <= vv2 in range
-.Ve
-.PP
-The vv's above must be numeric constants; the right hand side of a
-range list cannot contain a column name or header value.
-.PP
-Note that, unlike an ordinary comma separator, the comma separator used
-between two or more range expressions denotes \s-1OR\s0. Thus, when two or
-more range expressions are combined with a comma separator, the resulting
-expression is a shortcut for more complicated boolean logic. For example:
-.PP
-.Vb 1
-\& col = :3,6:8,10:
-.Ve
-.PP
-is equivalent to:
-.PP
-.Vb 1
-\& (col=6 && col =10)
-.Ve
-.PP
-Note also that the single-valued rangelist:
-.PP
-.Vb 1
-\& col = val
-.Ve
-.PP
-is equivalent to the C\-based filter expression:
-.PP
-.Vb 1
-\& col == val
-.Ve
-.PP
-assuming, of course, that val is a numeric constant.
-.PP
-\&\fBMath Operations and Functions\fR
-.PP
-It is permissible to specify C math functions as part of the filter syntax.
-When the filter parser recognizes a function call, it automatically
-includes the math.h and links in the C math library. Thus, it is
-possible to filter rows by expressions such as these:
-.IP "\(bu" 4
-(pi+pha)>(2+log(pi)\-pha)
-.IP "\(bu" 4
-min(pi,pha)*14>x
-.IP "\(bu" 4
-max(pi,pha)==(pi+1)
-.IP "\(bu" 4
-feq(pi,pha)
-.IP "\(bu" 4
-div(pi,pha)>0
-.PP
-The function feq(a,b) returns true (1) if the difference between a and b
-(taken as double precision values) is less than approximately 10E\-15.
-The function div(a,b) divides a by b, but returns NaN (not a number)
-if b is 0. It is a safe way to avoid floating point errors when
-dividing one column by another.
-.PP
-\&\fBInclude Files\fR
-.PP
-The special \fB@filename\fR directive specifies an include file
-containing filter expressions. This file is processed as part of
-the overall filter descriptor:
-.PP
-.Vb 1
-\& foo.fits[pha==1,@foo]
-.Ve
-.PP
-\&\fBHeader Parameters\fR
-.PP
-The filter syntax supports comparison between a column value and a
-header parameter value of a \s-1FITS\s0 binary tables (raw event files have no
-such header). The header parameters can be taken from the binary
-table header or the primary header. For example, assuming there is a
-header value \s-1MEAN_PHA\s0 in one of these headers, you can select photons
-having exactly this value using:
-.IP "\(bu" 4
-pha==MEAN_PHA
-.PP
-Table filtering is more easily described by means of examples.
-Consider data containing the following table structure:
-.IP "\(bu" 4
-double \s-1TIME\s0
-.IP "\(bu" 4
-int X
-.IP "\(bu" 4
-int Y
-.IP "\(bu" 4
-short \s-1PI\s0
-.IP "\(bu" 4
-short \s-1PHA\s0
-.IP "\(bu" 4
-int \s-1DX\s0
-.IP "\(bu" 4
-int \s-1DY\s0
-.PP
-Tables can be filtered on these columns using \s-1IRAF/QPOE\s0 range syntax or
-any valid C syntax. The following examples illustrate the possibilities:
-.IP "\(bu" 4
-pha=10
-.IP "\(bu" 4
-pha==10
-.Sp
-select rows whose pha value is exactly 10
-.IP "\(bu" 4
-pha=10:50
-.Sp
-select rows whose pha value is in the range of 10 to 50
-.IP "\(bu" 4
-pha=10:50,100
-.Sp
-select rows whose pha value is in the range of 10 to 50 or is
-equal to 100
-.IP "\(bu" 4
-pha>=10 && pha<=50
-.Sp
-select rows whose pha value is in the range of 10 to 50
-.IP "\(bu" 4
-pi=1,2&&pha>3
-.Sp
-select rows whose pha value is 1 or 2 and whose pi value is 3
-.IP "\(bu" 4
-pi=1,2 || pha>3
-.Sp
-select rows whose pha value is 1 or 2 or whose pi value is 3
-.IP "\(bu" 4
-pha==pi+1
-.Sp
-select rows whose pha value is 1 less than the pi value
-.IP "\(bu" 4
-(pha==pi+1) && (time>50000.0)
-.Sp
-select rows whose pha value is 1 less than the pi value
-and whose time value is greater than 50000
-.IP "\(bu" 4
-(pi+pha)>20
-.Sp
-select rows in which the sum of the pi and pha values is greater
-than 20
-.IP "\(bu" 4
-pi%2==1
-.Sp
-select rows in which the pi value is odd
-.PP
-Currently, integer range list limits cannot be specified in binary
-notation (use decimal, hex, or octal instead). Please contact us if
-this is a problem.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funidx.7 b/funtools/man/man7/funidx.7
deleted file mode 100644
index bf87bb8..0000000
--- a/funtools/man/man7/funidx.7
+++ /dev/null
@@ -1,327 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funidx 7"
-.TH funidx 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-Funidx \- Using Indexes to Filter Rows in a Table
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document contains a summary of the user interface for
-filtering rows in binary tables with indexes.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Funtools Table Filtering allows rows in a
-table to be selected based on the values of one or more columns in the
-row. Because the actual filter code is compiled on the fly, it is very
-efficient. However, for very large files (hundreds of Mb or larger),
-evaluating the filter expression on each row can take a long time. Therefore,
-funtools supports index files for columns, which are used automatically during
-filtering to reduce dramatically the number of row evaluations performed.
-The speed increase for indexed filtering can be an order of magnitude or
-more, depending on the size of the file.
-.PP
-The funindex program creates an
-index on one or more columns in a binary table. For example, to create an index
-for the column pi in the file huge.fits, use:
-.PP
-.Vb 1
-\& funindex huge.fits pi
-.Ve
-.PP
-This will create an index named huge_pi.idx.
-.PP
-When a filter expression is initialized for row evaluation, funtools
-looks for an index file for each column in the filter expression. If
-found, and if the file modification date of the index file is later
-than that of the data file, then the index will be used to reduce the
-number of rows that are evaluated in the filter. When
-Spatial Region Filtering is part of the
-expression, the columns associated with the region are checked for index
-files.
-.PP
-If an index file is not available for a given column, then in general,
-all rows must be checked when that column is part of a filter
-expression. This is not true, however, when a non-indexed column is
-part of an \s-1AND\s0 expression. In this case, only the rows that pass the
-other part of the \s-1AND\s0 expression need to be checked. Thus, in some cases,
-filtering speed can increase significantly even if all columns are not
-indexed.
-.PP
-Also note that certain types of filter expression syntax cannot make
-use of indices. For example, calling functions with column names as
-arguments implies that all rows must be checked against the function
-value. Once again, however, if this function is part of an \s-1AND\s0
-expression, then a significant improvement in speed still is possible
-if the other part of the \s-1AND\s0 expression is indexed.
-.PP
-For example, note below the dramatic speedup in searching a 1 Gb
-file using an \s-1AND\s0 filter, even when one of the columns (pha) has no
-index:
-.PP
-.Vb 22
-\& time fundisp \e
-\& huge.fits'[idx_activate=0,idx_debug=1,pha=2348&&cir 4000 4000 1]' \e
-\& "x y pha"
-\& x y pha
-\& ---------- ----------- ----------
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 42.36u 13.07s 6:42.89 13.7%
-.Ve
-.PP
-.Vb 26
-\& time fundisp \e
-\& huge.fits'[idx_activate=1,idx_debug=1,pha=2348&&cir 4000 4000 1]' \e
-\& "x y pha"
-\& x y pha
-\& ---------- ----------- ----------
-\& idxeq: [INDEF]
-\& idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
-\& idxand(1): INDEF [IDX_OR_SORT]
-\& idxall(1): [IDX_OR_SORT]
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 3999.48 4000.47 2348
-\& 1.55u 0.37s 1:19.80 2.4%
-.Ve
-.PP
-When all columns are indexed, the increase in speed can be even more dramatic:
-.PP
-.Vb 22
-\& time fundisp \e
-\& huge.fits'[idx_activate=0,idx_debug=1,pi=770&&cir 4000 4000 1]' \e
-\& "x y pi"
-\& x y pi
-\& ---------- ----------- ----------
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 42.60u 12.63s 7:28.63 12.3%
-.Ve
-.PP
-.Vb 27
-\& time fundisp \e
-\& huge.fits'[idx_activate=1,idx_debug=1,pi=770&&cir 4000 4000 1]' \e
-\& "x y pi"
-\& x y pi
-\& ---------- ----------- ----------
-\& idxeq: pi start=9473025,stop=9492240 => pi[ROW 9473025:9492240]
-\& idxand sort: x[ROW 8037025:8070128] y[ROW 5757665:5792352]
-\& idxor sort/merge: pi[ROW 9473025:9492240] [IDX_OR_SORT]
-\& idxmerge(5): [IDX_OR_SORT] pi[ROW]
-\& idxall(1): [IDX_OR_SORT]
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 3999.48 4000.47 770
-\& 1.67u 0.30s 0:24.76 7.9%
-.Ve
-.PP
-The miracle of indexed filtering (and indeed, of any indexing) is the
-speed of the binary search on the index, which is of order log2(n)
-instead of n. (The funtools binary search method is taken from
-http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary, to whom
-grateful acknowledgement is made.) This means that the larger the
-file, the better the performance. Conversely, it also means that for
-small files, using an index (and the overhead involved) can slow
-filtering down somewhat. Our tests indicate that on a file containing
-a few tens of thousands of rows, indexed filtering can be 10 to 20
-percent slower than non-indexed filtering. Of course, your mileage
-will vary with conditions (disk access speed, amount of available
-memory, process load, etc.)
-.PP
-Any problem encountered during index processing will result in
-indexing being turned off, and replaced by filtering all rows. You can turn
-filtering off manually by setting the idx_activate variable to 0 (in a filter
-expression) or the \s-1FILTER_IDX_ACTIVATE\s0 environment variable to 0 (in the global
-environment). Debugging output showing how the indexes are being processed can
-be displayed to stderr by setting the idx_debug variable to 1 (in a filter
-expression) or the \s-1FILTER_IDX_DEBUG\s0 environment variable to 1 (in the global
-environment).
-.PP
-Currently, indexed filtering only works with \s-1FITS\s0 binary tables and raw
-event files. It does not work with text files. This restriction might be
-removed in a future release.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funregions.7 b/funtools/man/man7/funregions.7
deleted file mode 100644
index 5c17572..0000000
--- a/funtools/man/man7/funregions.7
+++ /dev/null
@@ -1,678 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funregions 7"
-.TH funregions 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-FunRegions \- Spatial Region Filtering
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document contains a summary of the user interface for spatial
-region filtering images and tables.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Spatial region filtering allows a program to select regions of an
-image or rows of a table (e.g., X\-ray events) to process using
-simple geometric shapes and boolean combinations of shapes. When an
-image is filtered, only pixels found within these shapes are
-processed. When a table is filtered, only rows found within these
-shapes are processed.
-.PP
-Spatial region filtering for images and tables is accomplished by
-means of \fBregion specifications\fR. A region specification
-consists of one or more \fBregion expressions\fR, which are geometric
-shapes,combined according to the rules of boolean algebra. Region
-specifications also can contain comments and local/global processing
-directives.
-.PP
-Typically, region specifications are specified using bracket notation
-appended to the filename of the data being processed:
-.PP
-.Vb 1
-\& foo.fits[circle(512,512,100)]
-.Ve
-.PP
-It is also possible to put region specification inside a file and
-then pass the filename in bracket notation:
-.PP
-.Vb 1
-\& foo.fits[@my.reg]
-.Ve
-.PP
-When region filters are passed in bracket notation in this manner, the
-filtering is set up automatically when the file is opened and all
-processing occurs through the filter. Programs also can use the filter
-library \s-1API\s0 to open filters explicitly.
-.PP
-\&\fBRegion Expressions\fR
-.PP
-More specifically, region specifications consist of one or more lines
-containing:
-.PP
-.Vb 9
-\& # comment until end of line
-\& global keyword=value keyword=value ... # set global value(s)
-\& # include the following file in the region descriptor
-\& @file
-\& # use the FITS image as a mask (cannot be used with other regions)
-\& @fitsimage
-\& # each region expression contains shapes separated by operators
-\& [region_expression1], [region_expression2], ...
-\& [region_expression], [region_expression], ...
-.Ve
-.PP
-A single region expression consists of:
-.PP
-.Vb 2
-\& # parens and commas are optional, as is the + sign
-\& [+-]shape(num , num , ...) OP1 shape num num num OP2 shape ...
-.Ve
-.PP
-e.g.:
-.PP
-.Vb 3
-\& ([+-]shape(num , num , ...) && shape num num || shape(num, num)
-\& # a comment can come after a region -- reserved for local properties
-\& [+-]shape(num , num , ...) # local properties go here, e.g. color=red
-.Ve
-.PP
-Thus, a region descriptor consists of one or more region
-expressions or \fBregions\fR, separated by comas, new\-lines, or
-semi\-colons. Each \fBregion\fR consists of one or more geometric
-shapes combined using standard boolean operation. Several types
-of shapes are supported, including:
-.PP
-.Vb 11
-\& shape: arguments:
-\& ----- ----------------------------------------
-\& ANNULUS xcenter ycenter inner_radius outer_radius
-\& BOX xcenter ycenter xwidth yheight (angle)
-\& CIRCLE xcenter ycenter radius
-\& ELLIPSE xcenter ycenter xwidth yheight (angle)
-\& FIELD none
-\& LINE x1 y1 x2 y2
-\& PIE xcenter ycenter angle1 angle2
-\& POINT x1 y1
-\& POLYGON x1 y1 x2 y2 ... xn yn
-.Ve
-.PP
-In addition, the following regions accept \fBaccelerator\fR syntax:
-.PP
-.Vb 13
-\& shape arguments
-\& ----- ------------------------------------------
-\& ANNULUS xcenter ycenter radius1 radius2 ... radiusn
-\& ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
-\& BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
-\& BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
-\& CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
-\& CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
-\& ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
-\& ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
-\& PIE xcenter ycenter angle1 angle2 (angle3) (angle4) (angle5) ...
-\& PIE xcenter ycenter angle1 angle2 (n=[number])
-\& POINT x1 y1 x2 y2 ... xn yn
-.Ve
-.PP
-Note that the circle accelerators are simply aliases for the annulus
-accelerators. See region geometry
-for more information about accelerators.
-.PP
-Finally, the following are combinations of pie with different shapes
-(called \*(L"panda\*(R" for \*(L"Pie \s-1AND\s0 Annulus\*(R") allow for easy specification of
-radial sections:
-.PP
-.Vb 6
-\& shape: arguments:
-\& ----- ---------
-\& PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
-\& CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
-\& BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # box
-\& EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # ellipse
-.Ve
-.PP
-The panda and cpanda specify combinations of annulus and circle with pie,
-respectively and give identical results. The bpanda combines box and pie,
-while epanda combines ellipse and pie.
-See region geometry
-for more information about pandas.
-.PP
-The following \*(L"shapes\*(R" are ignored by funtools (generated by ds9):
-.PP
-.Vb 8
-\& shape: arguments:
-\& ----- ---------
-\& PROJECTION x1 y1 x2 y2 width # NB: ignored by funtools
-\& RULER x1 y1 x2 y2 # NB: ignored by funtools
-\& TEXT x y # NB: ignored by funtools
-\& GRID # NB: ignored by funtools
-\& TILE # NB: ignored by funtools
-\& COMPASS # NB: ignored by funtools
-.Ve
-.PP
-All arguments to regions are real values; integer values are
-automatically converted to real where necessary. All angles are in
-degrees and run from the positive image x\-axis to the positive image
-y\-axis. If a rotation angle is part of the associated \s-1WCS\s0 header, that
-angle is added implicitly as well.
-.PP
-Note that 3\-letter abbreviations are supported for all shapes, so that
-you can specify \*(L"circle\*(R" or \*(L"cir\*(R".
-.PP
-\&\fBColumns Used in Region Filtering\fR
-.PP
-By default, the x,y values in a region expression refer to the two
-\&\*(L"image binning\*(R" columns, i.e. the columns that would be used to
-bin the data into an image. For images, these are just the 2 dimensions
-of the image. For tables, these usually default to x and y but
-can be changed as required. For example, in Funtools, new binning
-columns are specified using a bincols=(col1,col2) statement within
-the bracket string on the command line.
-.PP
-Alternate columns for region filtering can be specified by the syntax:
-.PP
-.Vb 1
-\& (col1,col2)=region(...)
-.Ve
-.PP
-e.g.:
-.PP
-.Vb 3
-\& (X,Y)=annulus(x,y,ri,ro)
-\& (PHA,PI)=circle(x,y,r)
-\& (DX,DY)=ellipse(x,y,a,b[,angle])
-.Ve
-.PP
-\&\fBRegion Algebra\fR
-.PP
-(See also Region Algebra for more complete
-information.)
-.PP
-Region shapes can be combined together using Boolean operators:
-.PP
-.Vb 6
-\& Symbol Operation Use
-\& -------- --------- -----------------------------------
-\& ! not Exclude this shape from this region
-\& & or && and Include only the overlap of these shapes
-\& | or || inclusive or Include all of both shapes
-\& ^ exclusive or Include both shapes except their overlap
-.Ve
-.PP
-Note that the !region syntax must be combined with another region in order
-that we be able to assign a region id properly. That is,
-.PP
-.Vb 1
-\& !circle(512,512,10)
-.Ve
-.PP
-is not a legal region because there is no valid region id to work with.
-To get the full field without a circle, combine the above with \fIfield()\fR,
-as in:
-.PP
-.Vb 1
-\& field() && !circle(512,512,10)
-.Ve
-.PP
-\&\fB Region Separators Also Are Operators\fR
-.PP
-As mentioned previously, multiple region expressions can be specified
-in a region descriptor, separated by commas, new\-lines, or
-semi\-colons. When such a separator is used, the boolean \s-1OR\s0 operator
-is automatically generated in its place but, unlike explicit use of
-the \s-1OR\s0 operator, the region \s-1ID\s0 is incremented (starting from 1).
-.PP
-For example, the two shapes specified in this example are given the
-same region value:
-.PP
-.Vb 1
-\& foo.fits[circle(512,512,10)||circle(400,400,20)]
-.Ve
-.PP
-On the other hand, the two shapes defined in the following example are
-given different region values:
-.PP
-.Vb 1
-\& foo.fits[circle(512,512,10),circle(400,400,20)]
-.Ve
-.PP
-Of course these two examples will both mask the same table rows or
-pixels. However, in programs that distinguish region id's (such as
-funcnts ), they will act
-differently. The explicit \s-1OR\s0 operator will result in one region
-expression consisting of two shapes having the same region id and
-funcnts will report a single region. The comma operator will cause
-funcnts to report two region expressions, each with one shape, in
-its output.
-.PP
-In general, commas are used to separate region expressions entered
-in bracket notation on the command line:
-.PP
-.Vb 2
-\& # regions are added to the filename in bracket notation
-\& foo.fits[circle(512,512,100),circle(400,400,20)]
-.Ve
-.PP
-New-lines are used to separate region
-expressions in a file:
-.PP
-.Vb 4
-\& # regions usually are separated by new-lines in a file
-\& # use @filename to include this file on the command line
-\& circle(512,512,100)
-\& circle(400,400,20)
-.Ve
-.PP
-Semi-colons are provided for backward compatibility with the original
-\&\s-1IRAF/PROS\s0 implementation and can be used in either case.
-.PP
-If a pixel is covered by two different regions expressions, it is
-given the mask value of the \fBfirst\fR region that contains that
-pixel. That is, successive regions \fBdo not\fR overwrite previous
-regions in the mask, as was the case with the original \s-1PROS\s0 regions.
-In this way, an individual pixel is covered by one and only one
-region. This means that one must sometimes be careful about the order
-in which regions are defined. If region N is fully contained within
-region M, then N should be defined \fBbefore\fR M, or else it will be
-\&\*(L"covered up\*(R" by the latter.
-.PP
-\&\fBRegion Exclusion\fR
-.PP
-Shapes also can be globally excluded from all the region specifiers in
-a region descriptor by using a minus sign before a region:
-.PP
-.Vb 4
-\& operator arguments:
-\& -------- -----------
-\& - Globally exclude the region expression following '-' sign
-\& from ALL regions specified in this file
-.Ve
-.PP
-The global exclude region can be used by itself; in such a case, \fIfield()\fR is
-implied.
-.PP
-A global exclude differs from the local exclude (i.e. a shape prefixed
-by the logical not \*(L"!\*(R" symbol) in that global excludes are logically
-performed last, so that no region will contain pixels from a globally
-excluded shape. A local exclude is used in a boolean expression with
-an include shape, and only excludes pixels from that include shape.
-Global excludes cannot be used in boolean expressions.
-.PP
-\&\fBInclude Files\fR
-.PP
-The \fB@filename\fR directive specifies an include file
-containing region expressions. This file is processed as part of
-the overall region descriptor:
-.PP
-.Vb 1
-\& foo.fits[circle(512,512,10),@foo]
-.Ve
-.PP
-A filter include file simply includes text without changing the state
-of the filter. It therefore can be used in expression. That is, if the
-file foo1 contains \*(L"pi==1\*(R" and foo2 contains \*(L"pha==2\*(R" then
-the following expressions are equivalent:
-.PP
-.Vb 3
-\& "[@foo1&&@foo2]" is equivalent to "[pi==1&&pha==2]"
-\& "[pha==1||@foo2]" is equivalent to "[pi==1||pha==2]"
-\& "[@foo1,@foo2]" is equivalent to "[pi==1,pha==2]"
-.Ve
-.PP
-Be careful that you specify evaluation order properly using
-parenthesis, especially if the include file contains multiple
-filter statements. For example, consider a file containing two
-regions such as:
-.PP
-.Vb 2
-\& circle 512 512 10
-\& circle 520 520 10
-.Ve
-.PP
-If you want to include only events (or pixels) that are in these regions
-and have a pi value of 4, then the correct syntax is:
-.PP
-.Vb 1
-\& pi==4&&(@foo)
-.Ve
-.PP
-since this is equivalent to:
-.PP
-.Vb 1
-\& pi==4 && (circle 512 512 10 || circle 520 520 10)
-.Ve
-.PP
-If you leave out the parenthesis, you are filtering this statement:
-.PP
-.Vb 1
-\& pi==4 && circle 512 512 10 || circle 520 520 10)
-.Ve
-.PP
-which is equivalent to:
-.PP
-.Vb 1
-\& (pi==4 && circle 512 512 10) || circle 520 520 10)
-.Ve
-.PP
-The latter syntax only applies the pi test to the first region.
-.PP
-For image-style filtering, the \fB@filename\fR can specify an 8-bit
-or 16-bit \s-1FITS\s0 image. In this case, the pixel values in the mask image
-are used as the region mask. The valid pixels in the mask must have
-positive values. Zero values are excluded from the mask and negative
-values are not allowed. Moreover, the region id value is taken as
-the image pixel value and the total number of regions is taken to be
-the highest pixel value. The dimensions of the image mask must be less
-than or equal to the image dimensions of the data. The mask will be
-replicated as needed to match the size of the image. (Thus, best
-results are obtained when the data dimensions are an even multiple of
-the mask dimensions.)
-.PP
-An image mask can be used in any image filtering operation, regardless
-of whether the data is of type image or table. For example, the
-funcnts )
-program performs image filtering on images or tables, and so
-\&\s-1FITS\s0 image masks are valid input for either type of data in this
-program.. An image mask cannot be used in a program such as
-fundisp )
-when the input data is a table, because fundisp displays
-rows of a table and processes these rows using event-style filtering.
-.PP
-\&\fBGlobal and Local Properties of Regions\fR
-.PP
-The ds9 image display program describes a host of properties such as
-color, font, fix/free state, etc. Such properties can be specified
-globally (for all regions) or locally (for an individual region).
-The \fBglobal\fR keyword specifies properties and qualifiers for all
-regions, while local properties are specified in comments on the same
-line as the region:
-.PP
-.Vb 4
-\& global color=red
-\& circle(10,10,2)
-\& circle(20,20,3) # color=blue
-\& circle(30,30,4)
-.Ve
-.PP
-The first and third circles will be red, which the second circle will
-be blue. Note that funtools currently ignores region properties, as
-they are used in display only.
-.PP
-\&\fB Coordinate Systems\fR
-.PP
-For each region, it is important to specify the coordinate system
-used to interpret the region, i.e., to set the context in which position and
-size values are interpreted. For this purpose, the following keywords
-are recognized:
-.PP
-.Vb 12
-\& name description
-\& ---- ------------------------------------------
-\& PHYSICAL pixel coords of original file using LTM/LTV
-\& IMAGE pixel coords of current file
-\& FK4, B1950 sky coordinate systems
-\& FK5, J2000 sky coordinate systems
-\& GALACTIC sky coordinate systems
-\& ECLIPTIC sky coordinate systems
-\& ICRS currently same as J2000
-\& LINEAR linear wcs as defined in file
-\& AMPLIFIER mosaic coords of original file using ATM/ATV
-\& DETECTOR mosaic coords of original file using DTM/DTV
-.Ve
-.PP
-\&\fBSpecifying Positions, Sizes, and Angles\fR
-.PP
-The arguments to region shapes can be floats or integers describing
-positions and sizes. They can be specified as pure numbers or using
-explicit formatting directives:
-.PP
-.Vb 11
-\& position arguments description
-\& ------------------ ------------------------------
-\& [num] context-dependent (see below)
-\& [num]d degrees
-\& [num]r radians
-\& [num]p physical pixels
-\& [num]i image pixels
-\& [num]:[num]:[num] hms for 'odd' position arguments
-\& [num]:[num]:[num] dms for 'even' position arguments
-\& [num]h[num]m[num]s explicit hms
-\& [num]d[num]m[num]s explicit dms
-.Ve
-.PP
-.Vb 9
-\& size arguments description
-\& -------------- -----------
-\& [num] context-dependent (see below)
-\& [num]" arc seconds
-\& [num]' arc minutes
-\& [num]d degrees
-\& [num]r radians
-\& [num]p physical pixels
-\& [num]i image pixels
-.Ve
-.PP
-When a \*(L"pure number\*(R" (i.e. one without a format directive such as 'd'
-for 'degrees') is specified, its interpretation depends on the context
-defined by the 'coordsys' keyword. In general, the rule is:
-.PP
-All pure numbers have implied units corresponding to the current
-coordinate system.
-.PP
-If no such system is explicitly specified, the default system is
-implicitly assumed to be \s-1PHYSICAL\s0.
-.PP
-In practice this means that for \s-1IMAGE\s0 and \s-1PHYSICAL\s0 systems, pure
-numbers are pixels. Otherwise, for all systems other than linear,
-pure numbers are degrees. For \s-1LINEAR\s0 systems, pure numbers are in the
-units of the linear system. This rule covers both positions and
-sizes.
-.PP
-The input values to each shape can be specified in several coordinate
-systems including:
-.PP
-.Vb 12
-\& name description
-\& ---- ----------------------------
-\& IMAGE pixel coords of current file
-\& LINEAR linear wcs as defined in file
-\& FK4, B1950 various sky coordinate systems
-\& FK5, J2000
-\& GALACTIC
-\& ECLIPTIC
-\& ICRS
-\& PHYSICAL pixel coords of original file using LTM/LTV
-\& AMPLIFIER mosaic coords of original file using ATM/ATV
-\& DETECTOR mosaic coords of original file using DTM/DTV
-.Ve
-.PP
-If no coordinate system is specified, \s-1PHYSICAL\s0 is assumed. \s-1PHYSICAL\s0 or
-a World Coordinate System such as J2000 is preferred and most general.
-The coordinate system specifier should appear at the beginning of the
-region description, on a separate line (in a file), or followed by a
-new-line or semicolon; e.g.,
-.PP
-.Vb 2
-\& global coordsys physical
-\& circle 6500 9320 200
-.Ve
-.PP
-The use of celestial input units automatically implies \s-1WORLD\s0
-coordinates of the reference image. Thus, if the world coordinate
-system of the reference image is J2000, then
-.PP
-.Vb 1
-\& circle 10:10:0 20:22:0 3'
-.Ve
-.PP
-is equivalent to:
-.PP
-.Vb 1
-\& circle 10:10:0 20:22:0 3' # j2000
-.Ve
-.PP
-Note that by using units as described above, you may mix coordinate
-systems within a region specifier; e.g.,
-.PP
-.Vb 1
-\& circle 6500 9320 3' # physical
-.Ve
-.PP
-Note that, for regions which accept a rotation angle:
-.PP
-ellipse (x, y, r1, r2, angle)
-box(x, y, w, h, angle)
-.PP
-the angle is relative to the specified coordinate system. In
-particular, if the region is specified in \s-1WCS\s0 coordinates, the angle
-is related to the \s-1WCS\s0 system, not x/y image coordinate axis. For \s-1WCS\s0
-systems with no rotation, this obviously is not an issue. However,
-some images do define an implicit rotation (e.g., by using a non-zero
-\&\s-1CROTA\s0 value in the \s-1WCS\s0 parameters) and for these images, the angle
-will be relative to the \s-1WCS\s0 axes. In such case, a region specification
-such as:
-.PP
-fk4;ellipse(22:59:43.985, +58:45:26.92,320\*(L", 160\*(R", 30)
-.PP
-will not, in general, be the same region specified as:
-.PP
-physical;ellipse(465, 578, 40, 20, 30)
-.PP
-even when positions and sizes match. The angle is relative to \s-1WCS\s0 axes
-in the first case, and relative to physical x,y axes in the second.
-.PP
-More detailed descriptions are available for:
-Region Geometry,
-Region Algebra,
-Region Coordinates, and
-Region Boundaries.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funtext.7 b/funtools/man/man7/funtext.7
deleted file mode 100644
index b24b317..0000000
--- a/funtools/man/man7/funtext.7
+++ /dev/null
@@ -1,713 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funtext 7"
-.TH funtext 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-Funtext \- Support for Column\-based Text Files
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document contains a summary of the options for processing column-based
-text files.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Funtools will automatically sense and process \*(L"standard\*(R"
-column-based text files as if they were \s-1FITS\s0 binary tables without any
-change in Funtools syntax. In particular, you can filter text files
-using the same syntax as \s-1FITS\s0 binary tables:
-.PP
-.Vb 3
-\& fundisp foo.txt'[cir 512 512 .1]'
-\& fundisp \-T foo.txt > foo.rdb
-\& funtable foo.txt'[pha=1:10,cir 512 512 10]' foo.fits
-.Ve
-.PP
-The first example displays a filtered selection of a text file. The
-second example converts a text file to an \s-1RDB\s0 file. The third example
-converts a filtered selection of a text file to a \s-1FITS\s0 binary table.
-.PP
-Text files can also be used in Funtools image programs. In this case,
-you must provide binning parameters (as with raw event files), using
-the bincols keyword specifier:
-.PP
-.Vb 1
-\& bincols=([xname[:tlmin[:tlmax:[binsiz]]]],[yname[:tlmin[:tlmax[:binsiz]]]
-.Ve
-.PP
-For example:
-.PP
-.Vb 1
-\& funcnts foo'[bincols=(x:1024,y:1024)]' "ann 512 512 0 10 n=10"
-.Ve
-.PP
-\&\fBStandard Text Files\fR
-.PP
-Standard text files have the following characteristics:
-.IP "\(bu" 4
-Optional comment lines start with #
-.IP "\(bu" 4
-Optional blank lines are considered comments
-.IP "\(bu" 4
-An optional table header consists of the following (in order):
-.RS 4
-.IP "\(bu" 4
-a single line of alpha-numeric column names
-.IP "\(bu" 4
-an optional line of unit strings containing the same number of cols
-.IP "\(bu" 4
-an optional line of dashes containing the same number of cols
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Data lines follow the optional header and (for the present) consist of
- the same number of columns as the header.
-.IP "\(bu" 4
-Standard delimiters such as space, tab, comma, semi\-colon, and bar.
-.PP
-Examples:
-.PP
-.Vb 5
-\& # rdb file
-\& foo1 foo2 foo3 foos
-\& ---- ---- ---- ----
-\& 1 2.2 3 xxxx
-\& 10 20.2 30 yyyy
-.Ve
-.PP
-.Vb 5
-\& # multiple consecutive whitespace and dashes
-\& foo1 foo2 foo3 foos
-\& --- ---- ---- ----
-\& 1 2.2 3 xxxx
-\& 10 20.2 30 yyyy
-.Ve
-.PP
-.Vb 2
-\& # comma delims and blank lines
-\& foo1,foo2,foo3,foos
-.Ve
-.PP
-.Vb 2
-\& 1,2.2,3,xxxx
-\& 10,20.2,30,yyyy
-.Ve
-.PP
-.Vb 4
-\& # bar delims with null values
-\& foo1|foo2|foo3|foos
-\& 1||3|xxxx
-\& 10|20.2||yyyy
-.Ve
-.PP
-.Vb 3
-\& # header-less data
-\& 1 2.2 3 xxxx
-\& 10 20.2 30 yyyy
-.Ve
-.PP
-The default set of token delimiters consists of spaces, tabs, commas,
-semi\-colons, and vertical bars. Several parsers are used
-simultaneously to analyze a line of text in different ways. One way
-of analyzing a line is to allow a combination of spaces, tabs, and
-commas to be squashed into a single delimiter (no null values between
-consecutive delimiters). Another way is to allow tab, semi\-colon, and
-vertical bar delimiters to support null values, i.e. two consecutive
-delimiters implies a null value (e.g. \s-1RDB\s0 file). A successful parser
-is one which returns a consistent number of columns for all rows, with
-each column having a consistent data type. More than one parser can
-be successful. For now, it is assumed that successful parsers all
-return the same tokens for a given line. (Theoretically, there are
-pathological cases, which will be taken care of as needed). Bad parsers
-are discarded on the fly.
-.PP
-If the header does not exist, then names \*(L"col1\*(R", \*(L"col2\*(R", etc. are
-assigned to the columns to allow filtering. Furthermore, data types
-for each column are determined by the data types found in the columns
-of the first data line, and can be one of the following: string, int,
-and double. Thus, all of the above examples return the following
-display:
-.PP
-.Vb 4
-\& fundisp foo'[foo1>5]'
-\& FOO1 FOO2 FOO3 FOOS
-\& ---------- --------------------- ---------- ------------
-\& 10 20.20000000 30 yyyy
-.Ve
-.PP
-\&\fBComments Convert to Header Params\fR
-.PP
-Comments which precede data rows are converted into header parameters and
-will be written out as such using funimage or funhead. Two styles of comments
-are recognized:
-.PP
-1. FITS-style comments have an equal sign \*(L"=\*(R" between the keyword and
-value and an optional slash \*(L"/\*(R" to signify a comment. The strict \s-1FITS\s0
-rules on column positions are not enforced. In addition, strings only
-need to be quoted if they contain whitespace. For example, the following
-are valid FITS-style comments:
-.PP
-.Vb 5
-\& # fits0 = 100
-\& # fits1 = /usr/local/bin
-\& # fits2 = "/usr/local/bin /opt/local/bin"
-\& # fits3c = /usr/local/bin /opt/local/bin /usr/bin
-\& # fits4c = "/usr/local/bin /opt/local/bin" / path dir
-.Ve
-.PP
-Note that the fits3c comment is not quoted and therefore its value is the
-single token \*(L"/usr/local/bin\*(R" and the comment is \*(L"opt/local/bin /usr/bin\*(R".
-This is different from the quoted comment in fits4c.
-.PP
-2. Free-form comments can have an optional colon separator between the
-keyword and value. In the absence of quote, all tokens after the
-keyword are part of the value, i.e. no comment is allowed. If a string
-is quoted, then slash \*(L"/\*(R" after the string will signify a comment.
-For example:
-.PP
-.Vb 4
-\& # com1 /usr/local/bin
-\& # com2 "/usr/local/bin /opt/local/bin"
-\& # com3 /usr/local/bin /opt/local/bin /usr/bin
-\& # com4c "/usr/local/bin /opt/local/bin" / path dir
-.Ve
-.PP
-.Vb 4
-\& # com11: /usr/local/bin
-\& # com12: "/usr/local/bin /opt/local/bin"
-\& # com13: /usr/local/bin /opt/local/bin /usr/bin
-\& # com14c: "/usr/local/bin /opt/local/bin" / path dir
-.Ve
-.PP
-Note that com3 and com13 are not quoted, so the whole string is part of
-the value, while comz4c and com14c are quoted and have comments following
-the values.
-.PP
-Some text files have column name and data type information in the header.
-You can specify the format of column information contained in the
-header using the \*(L"hcolfmt=\*(R" specification. See below for a detailed
-description.
-.PP
-\&\fBMultiple Tables in a Single File\fR
-.PP
-Multiple tables are supported in a single file. If an RDB-style file
-is sensed, then a ^L (vertical tab) will signify end of
-table. Otherwise, an end of table is sensed when a new header (i.e.,
-all alphanumeric columns) is found. (Note that this heuristic does not
-work for single column tables where the column type is \s-1ASCII\s0 and the
-table that follows also has only one column.) You also can specify
-characters that signal an end of table condition using the \fBeot=\fR
-keyword. See below for details.
-.PP
-You can access the nth table (starting from 1) in a multi-table file
-by enclosing the table number in brackets, as with a \s-1FITS\s0 extension:
-.PP
-.Vb 1
-\& fundisp foo'[2]'
-.Ve
-.PP
-The above example will display the second table in the file.
-(Index values start at 1 in oder to maintain logical compatibility
-with \s-1FITS\s0 files, where extension numbers also start at 1).
-.PP
-\&\fB\s-1\f(BITEXT\s0()\fB Specifier\fR
-.PP
-As with \s-1\fIARRAY\s0()\fR and \s-1\fIEVENTS\s0()\fR specifiers for raw image arrays and raw
-event lists respectively, you can use \s-1\fITEXT\s0()\fR on text files to pass
-key=value options to the parsers. An empty set of keywords is
-equivalent to not having \s-1\fITEXT\s0()\fR at all, that is:
-.PP
-.Vb 2
-\& fundisp foo
-\& fundisp foo'[TEXT()]'
-.Ve
-.PP
-are equivalent. A multi-table index number is placed before the \s-1\fITEXT\s0()\fR
-specifier as the first token, when indexing into a multi\-table:
-.PP
-.Vb 1
-\& fundisp foo'[2,TEXT(...)]'
-.Ve
-.PP
-The filter specification is placed after the \s-1\fITEXT\s0()\fR specifier, separated
-by a comma, or in an entirely separate bracket:
-.PP
-.Vb 2
-\& fundisp foo'[TEXT(...),circle 512 512 .1]'
-\& fundisp foo'[2,TEXT(...)][circle 512 512 .1]'
-.Ve
-.PP
-\&\fB\f(BIText()\fB Keyword Options\fR
-.PP
-The following is a list of keywords that can be used within the \s-1\fITEXT\s0()\fR
-specifier (the first three are the most important):
-.IP "\(bu" 4
-delims=\*(L"[delims]\*(R"
-.Sp
-Specify token delimiters for this file. Only a single parser having these
-delimiters will be used to process the file.
-.Sp
-.Vb 2
-\& fundisp foo.fits'[TEXT(delims="!")]'
-\& fundisp foo.fits'[TEXT(delims="\et%")]'
-.Ve
-.IP "\(bu" 4
-comchars=\*(L"[comchars]\*(R"
-.Sp
-Specify comment characters. You must include \*(L"\en\*(R" to allow blank lines.
-These comment characters will be used for all standard parsers (unless delims
-are also specified).
-.Sp
-.Vb 1
-\& fundisp foo.fits'[TEXT(comchars="!\en")]'
-.Ve
-.IP "\(bu" 4
-cols=\*(L"[name1:type1 ...]\*(R"
-.Sp
-Specify names and data type of columns. This overrides header
-names and/or data types in the first data row or default names and
-data types for header-less tables.
-.Sp
-.Vb 1
-\& fundisp foo.fits'[TEXT(cols="x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e")]'
-.Ve
-.Sp
-If the column specifier is the only keyword, then the cols= is not
-required (in analogy with \s-1\fIEVENTS\s0()\fR):
-.Sp
-.Vb 1
-\& fundisp foo.fits'[TEXT(x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e)]'
-.Ve
-.Sp
-Of course, an index is allowed in this case:
-.Sp
-.Vb 1
-\& fundisp foo.fits'[2,TEXT(x:I,y:I,pha:I,pi:I,time:D,dx:E,dy:e)]'
-.Ve
-.IP "\(bu" 4
-eot=\*(L"[eot delim]\*(R"
-.Sp
-Specify end of table string specifier for multi-table files. \s-1RDB\s0
-files support ^L. The end of table specifier is a string and the whole
-string must be found alone on a line to signify \s-1EOT\s0. For example:
-.Sp
-.Vb 1
-\& fundisp foo.fits'[TEXT(eot="END")]'
-.Ve
-.Sp
-will end the table when a line contains \*(L"\s-1END\s0\*(R" is found. Multiple lines
-are supported, so that:
-.Sp
-.Vb 1
-\& fundisp foo.fits'[TEXT(eot="END\enGAME")]'
-.Ve
-.Sp
-will end the table when a line contains \*(L"\s-1END\s0\*(R" followed by a line
-containing \*(L"\s-1GAME\s0\*(R".
-.Sp
-In the absence of an \s-1EOT\s0 delimiter, a new table will be sensed when a new
-header (all alphanumeric columns) is found.
-.IP "\(bu" 4
-null1=\*(L"[datatype]\*(R"
-.Sp
-Specify data type of a single null value in row 1.
-Since column data types are determined by the first row, a null value
-in that row will result in an error and a request to specify names and
-data types using cols=. If you only have a one null in row 1, you don't
-need to specify all names and columns. Instead, use null1=\*(L"type\*(R" to
-specify its data type.
-.IP "\(bu" 4
-alen=[n]
-.Sp
-Specify size in bytes for \s-1ASCII\s0 type columns.
-\&\s-1FITS\s0 binary tables only support fixed length \s-1ASCII\s0 columns, so a
-size value must be specified. The default is 16 bytes.
-.IP "\(bu" 4
-nullvalues=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Specify whether to expect null values.
-Give the parsers a hint as to whether null values should be allowed. The
-default is to try to determine this from the data.
-.IP "\(bu" 4
-whitespace=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Specify whether surrounding white space should be kept as part of
-string tokens. By default surrounding white space is removed from
-tokens.
-.IP "\(bu" 4
-header=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Specify whether to require a header. This is needed by tables
-containing all string columns (and with no row containing dashes), in
-order to be able to tell whether the first row is a header or part of
-the data. The default is false, meaning that the first row will be
-data. If a row dashes are present, the previous row is considered the
-column name row.
-.IP "\(bu" 4
-units=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Specify whether to require a units line.
-Give the parsers a hint as to whether a row specifying units should be
-allowed. The default is to try to determine this from the data.
-.IP "\(bu" 4
-i2f=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Specify whether to allow int to float conversions.
-If a column in row 1 contains an integer value, the data type for that
-column will be set to int. If a subsequent row contains a float in
-that same column, an error will be signaled. This flag specifies that,
-instead of an error, the float should be silently truncated to
-int. Usually, you will want an error to be signaled, so that you can
-specify the data type using cols= (or by changing the value of
-the column in row 1).
-.IP "\(bu" 4
-comeot=[\*(L"true\*(R"|\*(L"false\*(R"|0|1|2]
-.Sp
-Specify whether comment signifies end of table.
-If comeot is 0 or false, then comments do not signify end of table and
-can be interspersed with data rows. If the value is true or 1 (the
-default for standard parsers), then non-blank lines (e.g. lines
-beginning with '#') signify end of table but blanks are allowed
-between rows. If the value is 2, then all comments, including blank
-lines, signify end of table.
-.IP "\(bu" 4
-lazyeot=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Specify whether \*(L"lazy\*(R" end of table should be permitted (default is
-true for standard formats, except rdb format where explicit ^L is required
-between tables). A lazy \s-1EOT\s0 can occur when a new table starts directly
-after an old one, with no special \s-1EOT\s0 delimiter. A check for this \s-1EOT\s0
-condition is begun when a given row contains all string tokens. If, in
-addition, there is a mismatch between the number of tokens in the
-previous row and this row, or a mismatch between the number of string
-tokens in the prev row and this row, a new table is assumed to have
-been started. For example:
-.Sp
-.Vb 4
-\& ival1 sval3
-\& ----- -----
-\& 1 two
-\& 3 four
-.Ve
-.Sp
-.Vb 4
-\& jval1 jval2 tval3
-\& ----- ----- ------
-\& 10 20 thirty
-\& 40 50 sixty
-.Ve
-.Sp
-Here the line \*(L"jval1 ...\*(R" contains all string tokens. In addition,
-the number of tokens in this line (3) differs from the number of
-tokens in the previous line (2). Therefore a new table is assumed
-to have started. Similarly:
-.Sp
-.Vb 4
-\& ival1 ival2 sval3
-\& ----- ----- -----
-\& 1 2 three
-\& 4 5 six
-.Ve
-.Sp
-.Vb 4
-\& jval1 jval2 tval3
-\& ----- ----- ------
-\& 10 20 thirty
-\& 40 50 sixty
-.Ve
-.Sp
-Again, the line \*(L"jval1 ...\*(R" contains all string tokens. The number of
-string tokens in the previous row (1) differs from the number of
-tokens in the current \fIrow\fR\|(3). We therefore assume a new table as been
-started. This lazy \s-1EOT\s0 test is not performed if lazyeot is explicitly
-set to false.
-.IP "\(bu" 4
-hcolfmt=[header column format]
-.Sp
-Some text files have column name and data type information in the header.
-For example, VizieR catalogs have headers containing both column names
-and data types:
-.Sp
-.Vb 3
-\& #Column e_Kmag (F6.3) ?(k_msigcom) K total magnitude uncertainty (4) [ucd=ERROR]
-\& #Column Rflg (A3) (rd_flg) Source of JHK default mag (6) [ucd=REFER_CODE]
-\& #Column Xflg (I1) [0,2] (gal_contam) Extended source contamination (10) [ucd=CODE_MISC]
-.Ve
-.Sp
-while Sextractor files have headers containing column names alone:
-.Sp
-.Vb 4
-\& # 1 X_IMAGE Object position along x [pixel]
-\& # 2 Y_IMAGE Object position along y [pixel]
-\& # 3 ALPHA_J2000 Right ascension of barycenter (J2000) [deg]
-\& # 4 DELTA_J2000 Declination of barycenter (J2000) [deg]
-.Ve
-.Sp
-The hcolfmt specification allows you to describe which header lines
-contain column name and data type information. It consists of a string
-defining the format of the column line, using \*(L"$col\*(R" (or \*(L"$name\*(R") to
-specify placement of the column name, \*(L"$fmt\*(R" to specify placement of the
-data format, and \*(L"$skip\*(R" to specify tokens to ignore. You also can
-specify tokens explicitly (or, for those users familiar with how
-sscanf works, you can specify scanf skip specifiers using \*(L"%*\*(R").
-For example, the VizieR hcolfmt above might be specified in several ways:
-.Sp
-.Vb 3
-\& Column $col ($fmt) # explicit specification of "Column" string
-\& $skip $col ($fmt) # skip one token
-\& %*s $col ($fmt) # skip one string (using scanf format)
-.Ve
-.Sp
-while the Sextractor format might be specified using:
-.Sp
-.Vb 2
-\& $skip $col # skip one token
-\& %*d $col # skip one int (using scanf format)
-.Ve
-.Sp
-You must ensure that the hcolfmt statement only senses actual column
-definitions, with no false positives or negatives. For example, the
-first Sextractor specification, \*(L"$skip \f(CW$col\fR\*(R", will consider any header
-line containing two tokens to be a column name specifier, while the
-second one, \*(L"%*d \f(CW$col\fR\*(R", requires an integer to be the first token. In
-general, it is preferable to specify formats as explicitly as
-possible.
-.Sp
-Note that the VizieR-style header info is sensed automatically by the
-funtools standard VizieR-like parser, using the hcolfmt \*(L"Column \f(CW$col\fR
-($fmt)\*(R". There is no need for explicit use of hcolfmt in this case.
-.IP "\(bu" 4
-debug=[\*(L"true\*(R"|\*(L"false\*(R"]
-.Sp
-Display debugging information during parsing.
-.PP
-\&\fBEnvironment Variables\fR
-.PP
-Environment variables are defined to allow many of these \s-1\fITEXT\s0()\fR values to be
-set without having to include them in \s-1\fITEXT\s0()\fR every time a file is processed:
-.PP
-.Vb 10
-\& keyword environment variable
-\& ------- --------------------
-\& delims TEXT_DELIMS
-\& comchars TEXT_COMCHARS
-\& cols TEXT_COLUMNS
-\& eot TEXT_EOT
-\& null1 TEXT_NULL1
-\& alen TEXT_ALEN
-\& bincols TEXT_BINCOLS
-\& hcolfmt TEXT_HCOLFMT
-.Ve
-.PP
-\&\fBRestrictions and Problems\fR
-.PP
-As with raw event files, the '+' (copy extensions) specifier is not
-supported for programs such as funtable.
-.PP
-String to int and int to string data conversions are allowed by the
-text parsers. This is done more by force of circumstance than by
-conviction: these transitions often happens with VizieR catalogs,
-which we want to support fully. One consequence of allowing these
-transitions is that the text parsers can get confused by columns which
-contain a valid integer in the first row and then switch to a
-string. Consider the following table:
-.PP
-.Vb 4
-\& xxx yyy zzz
-\& ---- ---- ----
-\& 111 aaa bbb
-\& ccc 222 ddd
-.Ve
-.PP
-The xxx column has an integer value in row one a string in row two,
-while the yyy column has the reverse. The parser will erroneously
-treat the first column as having data type int:
-.PP
-.Vb 5
-\& fundisp foo.tab
-\& XXX YYY ZZZ
-\& ---------- ------------ ------------
-\& 111 'aaa' 'bbb'
-\& 1667457792 '222' 'ddd'
-.Ve
-.PP
-while the second column is processed correctly. This situation can be avoided
-in any number of ways, all of which force the data type of the first column
-to be a string. For example, you can edit the file and explicitly quote the
-first row of the column:
-.PP
-.Vb 4
-\& xxx yyy zzz
-\& ---- ---- ----
-\& "111" aaa bbb
-\& ccc 222 ddd
-.Ve
-.PP
-.Vb 5
-\& [sh] fundisp foo.tab
-\& XXX YYY ZZZ
-\& ------------ ------------ ------------
-\& '111' 'aaa' 'bbb'
-\& 'ccc' '222' 'ddd'
-.Ve
-.PP
-You can edit the file and explicitly set the data type of the first column:
-.PP
-.Vb 4
-\& xxx:3A yyy zzz
-\& ------ ---- ----
-\& 111 aaa bbb
-\& ccc 222 ddd
-.Ve
-.PP
-.Vb 5
-\& [sh] fundisp foo.tab
-\& XXX YYY ZZZ
-\& ------------ ------------ ------------
-\& '111' 'aaa' 'bbb'
-\& 'ccc' '222' 'ddd'
-.Ve
-.PP
-You also can explicitly set the column names and data types of all columns,
-without editing the file:
-.PP
-.Vb 5
-\& [sh] fundisp foo.tab'[TEXT(xxx:3A,yyy:3A,zzz:3a)]'
-\& XXX YYY ZZZ
-\& ------------ ------------ ------------
-\& '111' 'aaa' 'bbb'
-\& 'ccc' '222' 'ddd'
-.Ve
-.PP
-The issue of data type transitions (which to allow and which to disallow)
-is still under discussion.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/funtools.7 b/funtools/man/man7/funtools.7
deleted file mode 100644
index 6d188be..0000000
--- a/funtools/man/man7/funtools.7
+++ /dev/null
@@ -1,379 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funtools 7"
-.TH funtools 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-Funtools \- FITS Users Need Tools
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document is the Table of Contents for Funtools.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-Funtools, is a \*(L"minimal buy\-in\*(R" \s-1FITS\s0 library and utility package developed
-at the the High Energy Astrophysics Division of \s-1SAO\s0. The Funtools
-library provides simplified access to a wide array of file types:
-standard astronomical \s-1FITS\s0 images and binary tables, raw arrays and
-binary event lists, and even tables of \s-1ASCII\s0 column data. A
-sophisticated region filtering library (compatible with ds9) filters
-images and tables using boolean operations between geometric shapes,
-support world coordinates, etc. Funtools also supports advanced
-capabilities such as optimized data searching using index files.
-.PP
-The main goal of the Funtools project has been to develop a minimal buy-in
-\&\s-1FITS\s0 library for researchers who are occasional (but serious) coders. In
-this case, \*(L"minimal buy\-in\*(R" means \*(L"easy to learn, easy to use, and easy to
-re-learn next month\*(R". We have tried to achieve this goal by emphasizing two
-essential capabilities. The first is the ability to develop \s-1FITS\s0 programs
-without knowing much about \s-1FITS\s0, i.e., without having to deal with the
-arcane rules for generating a properly formatted \s-1FITS\s0 file. The second is
-to support the use of already-familiar C/Unix facilities, especially C
-structs and Unix stdio. Taken together, these two capabilities should allow
-researchers to leverage their existing programming expertise while
-minimizing the need to learn new and complex coding rules.
-.PP
-Choose from the following topics:
-.IP "\(bu" 4
-Funtools User Programs
-.RS 4
-.IP "\(bu" 4
-funcalc: Funtools calculator (for binary tables)
-[\fIfuncalc\fR\|(1)]
-.IP "\(bu" 4
-funcen: find centroid (for binary tables)
-[\fIfuncen\fR\|(1)]
-.IP "\(bu" 4
-funcnts: count photons in specified regions
-[\fIfuncnts\fR\|(1)]
-.IP "\(bu" 4
-funcone: cone search on \s-1RA\s0, Dec columns
-[\fIfuncone\fR\|(1)]
-.IP "\(bu" 4
-fundisp: display data in a Funtools data file
-[\fIfundisp\fR\|(1)]
-.IP "\(bu" 4
-funhead: display a header in a Funtools file
-[\fIfunhead\fR\|(1)]
-.IP "\(bu" 4
-funhist: create a 1D histogram of a column
-[\fIfunhist\fR\|(1)]
-.IP "\(bu" 4
-funimage: create a \s-1FITS\s0 image from a Funtools data file
-[\fIfunimage\fR\|(1)]
-.IP "\(bu" 4
-funindex: create an index on a column in a binary table
-[\fIfunindex\fR\|(1)]
-.IP "\(bu" 4
-funjoin: join two or more \s-1FITS\s0 binary tables on specified columns
-[\fIfunjoin\fR\|(1)]
-.IP "\(bu" 4
-funmerge: merge one or more Funtools table files
-[\fIfunmerge\fR\|(1)]
-.IP "\(bu" 4
-funsky: convert between image and sky coordinates, using \s-1WCS\s0 info from a \s-1FITS\s0 header
-[\fIfunsky\fR\|(1)]
-.IP "\(bu" 4
-funtable: copy selected rows from a Funtools file to a \s-1FITS\s0 binary table
-[\fIfuntable\fR\|(1)]
-.IP "\(bu" 4
-funtbl: extract a table from
-Funtools \s-1ASCII\s0 output
-[\fIfuntbl\fR\|(1)]
-.IP "\(bu" 4
-funtools and ds9 image display
-[funds9(7)]
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Funtools Programming
-.RS 4
-.IP "\(bu" 4
-Funtools Programming Summary
-[\fIfunlib\fR\|(3)]
-.IP "\(bu" 4
-Funtools Programming Tutorial
-[\fIfunlib\fR\|(3)]
-.IP "\(bu" 4
-A Short Digression on Subroutine Order
-[\fIfunlib\fR\|(3)]
-.IP "\(bu" 4
-Compiling and Linking
-[\fIfunlib\fR\|(3)]
-.IP "\(bu" 4
-The Funtools Reference Handle
-[\fIfunlib\fR\|(3)]
-.IP "\(bu" 4
-The Funtools Programming Reference Manual
-.RS 4
-.IP "\(bu" 4
-FunOpen: open a Funtools file
-[\fIfunopen\fR\|(3)]
-.IP "\(bu" 4
-FunImageGet: retrieve image data
-[\fIfunimageget\fR\|(3)]
-.IP "\(bu" 4
-FunImagePut: output image data
-[\fIfunimageput\fR\|(3)]
-.IP "\(bu" 4
-FunImageRowGet: retrieve image data by row
-[\fIfunimagerowget\fR\|(3)]
-.IP "\(bu" 4
-FunImageRowPut: output image data by row
-[\fIfunimagerowput\fR\|(3)]
-.IP "\(bu" 4
-FunTableRowGet: retrieve rows from a table
-[\fIfuntablerowget\fR\|(3)]
-.IP "\(bu" 4
-FunTableRowPut: output rows to a table
-[\fIfuntablerowput\fR\|(3)]
-.IP "\(bu" 4
-FunColumnSelect: select columns in a table for access
-[\fIfuncolumnselect\fR\|(3)]
-.IP "\(bu" 4
-FunColumnActivate: activate columns in a table for read/write
-[\fIfuncolumnactivate\fR\|(3)]
-.IP "\(bu" 4
-FunColumnLookup: lookup info about the columns in a table
-[\fIfuncolumnlookup\fR\|(3)]
-.IP "\(bu" 4
-FunInfoGet: get info about an image or table
-[\fIfuninfoget\fR\|(3)]
-.IP "\(bu" 4
-FunInfoPut: put info about an image or table
-[\fIfuninfoput\fR\|(3)]
-.IP "\(bu" 4
-FunParamGet: get header param
-[\fIfunparamget\fR\|(3)]
-.IP "\(bu" 4
-FunParamPut: put header param
-[\fIfunparamput\fR\|(3)]
-.IP "\(bu" 4
-FunFlush: flush I/O in a Funtools file
-[\fIfunflush\fR\|(3)]
-.IP "\(bu" 4
-FunClose: close a Funtools file
-[\fIfunclose\fR\|(3)]
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Funtools Programming Examples
-[\fIfunlib\fR\|(3)]
-.RS 4
-.IP "\(bu" 4
-evmerge: merge new columns with existing columns
-.IP "\(bu" 4
-evcols: add column and rows to binary tables
-.IP "\(bu" 4
-imblank: blank out image values below a threshold
-.RE
-.RS 4
-.RE
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Funtools Data Files
-[funfiles(7)]
-.RS 4
-.IP "\(bu" 4
-Supported Data Formats
-.RS 4
-.IP "\(bu" 4
-\&\s-1FITS\s0 File and Extensions
-.IP "\(bu" 4
-Non-FITS Raw Event Files
-.IP "\(bu" 4
-Non-FITS Array Files
-.IP "\(bu" 4
-Column-based Text (\s-1ASCII\s0) Files
-.IP "\(bu" 4
-Database Views of Tables
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Image Sections and Blocking
-.IP "\(bu" 4
-Binning \s-1FITS\s0 Binary Tables and Non-FITS Event Files
-.IP "\(bu" 4
-Disk Files and Other Supported File Types
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Funtools Data Filtering
-.RS 4
-.IP "\(bu" 4
-Table Filtering
-[funfilters(7)]
-.IP "\(bu" 4
-Fast Table Filtering using Indexes
-[funidx(7)]
-.IP "\(bu" 4
-Spatial Region Filtering
-[funregions(7)]
-.RS 4
-.IP "\(bu" 4
-Region Geometry
-[reggeometry(7)]
-.IP "\(bu" 4
-Region Algebra
-[regalgebra(7)]
-.IP "\(bu" 4
-Region Coordinates
-[regcoords(7)]
-.IP "\(bu" 4
-Region Boundaries
-[regbounds(7)]
-.IP "\(bu" 4
-Differences Between Funtools and \s-1IRAF\s0 Regions
-[regdiff(7)]
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Combining Table and Region Filters
-[funcombine(7)]
-.RE
-.RS 4
-.RE
-.IP "\(bu" 4
-Miscellaneous
-.RS 4
-.IP "\(bu" 4
-Funtools Environment Variables
-[funenv(7)]
-.IP "\(bu" 4
-Funtools ChangeLog
-.RE
-.RS 4
-.RE
diff --git a/funtools/man/man7/funview.7 b/funtools/man/man7/funview.7
deleted file mode 100644
index 06a0d56..0000000
--- a/funtools/man/man7/funview.7
+++ /dev/null
@@ -1,523 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "funview 7"
-.TH funview 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-Funview \- Database View Support for Tables
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document contains a summary of the options for utilizing
-database-inspired Views of tables.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBDatabase Views\fR
-.PP
-In database parlance, a \fBView\fR defines a \*(L"virtual table\*(R", i.e.,
-a description of row and/or column selection filters (but with no
-permanent storage space allocated). When used in place of a table, a
-View selects the specified rows and/or columns from one or more real
-tables. Views enable you to see complicated data tables in a more
-convenient format. They also can be used as a security mechanism, by
-restricting user access to specific columns and/or rows. [See:
-.PP
-http://www.cs.unibo.it/~ciaccia/COURSES/RESOURCES/SQLTutorial/sqlch5.htm
-.PP
-for a good discussion of \s-1SQL\s0 Views.]
-.PP
-Funtools supports an expanded notion of Views for all tabular data
-(\s-1FITS\s0 tables, raw binary tables, and \s-1ASCII\s0 column files). Funtools
-Views allow you to pre-set values for the filter specification, the
-columns to activate, and display format (though the latter is for
-fundisp only). Setting the filter and column activation values
-provides functionality equivalent to that of a classical database
-View, while the ability to set the format is similar to classical
-report writing capabilities.
-.PP
-\&\fBFuntools View Attributes\fR
-.PP
-A Funtools View is a text file containing one or more of the following
-columns:
-.PP
-.Vb 7
-\& column description
-\& ------ -----------------------------
-\& view name of view
-\& file data file name or template
-\& filter filter specification
-\& columns columns to activate
-\& format fundisp format specification
-.Ve
-.PP
-All of the attribute columns are optional, including
-the \fBview\fR name itself. This means that a View can be named or
-unnamed. Unnamed Views can refer to a specific file or a template of
-files (obviously if neither the view or the file column is specified,
-the input View specification will never be used). You can specify any
-combination of filter, column, and format parameters. (It also is
-possible to apply file-specific View to other files; see the discussion
-on \fBView Lists\fR below). Each column has a size limit of 1024 characters.
-.PP
-For example, consider the following View file:
-.PP
-.Vb 13
-\& view file format columns filter
-\& ---- ---------------------- ------ ------------ -------
-\& x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
-\& x2 ${HOME}/data/snr.ev x y pi pha cir 512 512 .1
-\& x1 ${HOME}/data/snr.ev cir 512 512 .1
-\& x1a ${HOME}/data/snr.ev x y pi pha
-\& x0 ${HOME}/data/snr.ev
-\& xf I=%4d
-\& xc x y pi pha
-\& xr cir 512 512 .1
-\& *.ev x y pi pha
-\& *.fit x y dx dy cir 400 400 3
-\& *.fits I=%3d x y dx dy cir 400 400 3
-.Ve
-.PP
-This database example is in rdb format, i.e. using tab delimiters and
-permitting null values. Any valid \s-1ASCII\s0 table format is acceptable,
-but if you use a format that does not permit null values, it will be
-necessary to quote the null strings.
-.PP
-The first five entries (x3, x2, x1, x1a, x0) are named entries defining
-default values specifically for the snr.ev data file. Typically, you
-would use these Views by specifying View name, and the corresponding
-file, filter, column, and format values would be used. Note that the x0
-View is essentially an alias for the pathname of this file.
-.PP
-The next three entries define defaults that can be applied to any
-file. You typically would use these View names in conjunction with
-a specific file name (see \fBView Lists\fR below) so that the associated
-parameter(s) were applied to that file.
-.PP
-The last three entry in the database define unnamed Views that
-pertains to all files ending with the specified templates. In these
-cases, any View that specifies a file name matching the file template
-would be processed with the associated parameter attributes.
-.PP
-\&\fBInvoking a Funtools View (in Place of an Input File)\fR
-.PP
-To use a Funtools View, you simply pre-pend the \*(L"v:\*(R" prefix to a View name or
-a file name where an input file name usually is specified. For example:
-.PP
-.Vb 1
-\& fundisp v:x3
-.Ve
-.PP
-specifies that the View named x3 (with its file name and associated
-parameters) is processed as the input file to fundisp. Using the
-example database, above, this is equivalent to:
-.PP
-.Vb 1
-\& fundisp \-f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-.Ve
-.PP
-That is, the format is used with fundisp's \-f (format) switch, while the
-filename and extension are composed of the x3 View's filename and
-region filter.
-.PP
-Similarly, executing a command such as:
-.PP
-.Vb 1
-\& fundisp v:foo.fit
-.Ve
-.PP
-will match the unnamed View associated with the template \*(L"*.fit\*(R".
-This is equivalent to executing:
-.PP
-.Vb 1
-\& fundisp foo.fit'[cir 400 400 3]' "x y dx dy"
-.Ve
-.PP
-Of course, if you omit the \*(L"v:\*(R" prefix, then no View processing takes place:
-.PP
-.Vb 2
-\& fundisp foo.fit # process foo.fit without any View parameters
-\& fundisp x3 # error (assuming there is no file named x3)
-.Ve
-.PP
-\&\fBBasic View Matching Rules\fR
-.PP
-When a \*(L"v:\*(R" prefix is recognized, Funtools searches for a View database
-file in the following order:
-.PP
-.Vb 5
-\& location description
-\& ------------ ------------------------------------
-\& FUN_VIEWFILE environment variable (any file name)
-\& ./.funtools.vu hidden file, default name
-\& $HOME/.funtools.vu hidden file, default name
-.Ve
-.PP
-The first View database file located is used to construct a new
-filename, as well as an activation column specification and a format
-specification. The following rules are used:
-.PP
-1. An attempt is made to match the input name (i.e., the part of the
-input View after the \*(L"v:\*(R" prefix) against the \fBview\fR column value
-(if present) of each row in the database. If a match is found, the
-values of all non-blank columns are saved for later use. Also note
-that the first match terminates the search: i.e., the order of the
-database rows matters.
-.PP
-2. If no \fBview\fR match is made, an attempt is made to match the input
-name against the \fBfile\fR column value (if present). Matching is
-performed on the full pathname of both the input name and the
-database file name, and on the non-directory (root) part of these
-files. This means that the root specification:
-.PP
-.Vb 1
-\& fundisp v:snr.ev
-.Ve
-.PP
-will match a row in the database that has a full pathname in the file,
-allowing you to use a \fBfile\fR\-matched View without having to
-specify the full pathname. In this example, the \*(L"v:snr.ev\*(R" View
-specification will match the first row (v:x3) in the database:
-.PP
-.Vb 1
-\& x3 ${HOME}/data/snr.ev I=%4d x y pi pha cir 512 512 .1
-.Ve
-.PP
-even though the row contains a fully qualified pathname as the file
-value. Once again, values of all non-blank columns are saved, and the
-first match terminates the search.
-.PP
-3. If neither a \fBview\fR or a \fBview\fR match has been found,
-then a simple template match is attempted against the \fBview\fR
-values. Template matching supports a simplified version of file
-globbing (not a regular expression), with support for a single \*(L"*\*(R"
-(all characters), \*(L"?\*(R" (single character), or \*(L"[...]\*(R" (range) specification.
-.PP
-4. If no template match was found on the \fBview\fR column, then a
-simple template match is attempted against the \fBfile\fR columns.
-.PP
-5. If no match is found, then the filename (minus the \*(L"v:\*(R" prefix) is
-returned.
-.PP
-More on View Matching Rules - Single vs. Multiple Matches
-.PP
-The matching rules described above stop after the first match,
-regardless of whether that match provides values for all three
-parameters (filter, columns, and format). In cases where a \fBview\fR
-or \fBfile\fR match does not provide all three values, it is possible
-that a template match might do so. With regard to the example View
-database above, the x1 View provides only a filter, while omitting
-both the format and columns values. But note that the final rows in
-the database could provide the values via a template match on the
-filename. This sort of multiple matching is especially valuable in
-order to provide \*(L"global\*(R" values to several Views.
-.PP
-Obviously, multiple matching might not be wanted in every
-case. Therefore, we support both multiple matching and single matching
-according to the value of the \s-1FUN_VIEWMATCH\s0 environment variable. If
-the \s-1FUN_VIEWMATCH\s0 environment variable exists and if its value begins
-with \*(L"s\*(R", then a single match is used and missing parameters are not
-filled in with subsequent template matches on the file name. That is,
-matching rules above are followed exactly as explained above. If the
-value of this environment variable begins with \*(L"m\*(R" (or does not exist),
-then multiple matches are used to try to fill in missing parameters.
-In this case, template matching always takes place and missing values are
-taken from these template matches.
-.PP
-Thus, in the example above, the View specification:
-.PP
-.Vb 1
-\& fundisp v:x1
-.Ve
-.PP
-will take the file name and filter value from the x1 View:
-.PP
-.Vb 1
-\& x1 ${HOME}/data/snr.ev cir 512 512 .1
-.Ve
-.PP
-The column value then will be taken from the \*(L"*.ev\*(R" file template match
-against the x1 file name:
-.PP
-.Vb 1
-\& *.ev x y pi pha
-.Ve
-.PP
-Note once again that order is important: missing values are taken in the
-order in which the template matches are processed.
-.PP
-View Lists - Applying a View to Any File
-.PP
-It is possible to apply a named View, or even several Views, to any
-data file by appending a \fBviewlist\fR immediately after the standard \*(L"v:\*(R"
-prefix. A viewlist takes the form:
-.PP
-.Vb 1
-\& :v1,v2,...vn:
-.Ve
-.PP
-where v1, v2, etc. are named Views. The two \*(L":\*(R" colon characters surrounding
-the list are required. Thus, the syntax for applying a viewlist to a file is:
-.PP
-.Vb 1
-\& v::view1,view2,...viewn:filename
-.Ve
-.PP
-Note that the name after the last \*(L":\*(R" is assumed to be a file; it is
-not permissible (or sensible) to use a View name.
-.PP
-For example, the View specification:
-.PP
-.Vb 1
-\& fundisp v::x2:foo
-.Ve
-.PP
-applies the x2 View to the file foo (even if there is a View named foo)
-and (in using our example database) is equivalent to:
-.PP
-.Vb 1
-\& ./fundisp foo'[cir 512 512 .1] "x y pi pha"
-.Ve
-.PP
-The same command can be effected using a list of Views:
-.PP
-.Vb 1
-\& fundisp v::x1,x1a:foo
-.Ve
-.PP
-What happens if a viewlist is used and the file also matches a
-template? Consider, for example, this View specification:
-.PP
-.Vb 1
-\& fundisp v::x2:foo.fit
-.Ve
-.PP
-Here, the x2 View will supply filter and column values, while the
-template *.fit can also supply (different) filter and column
-values. In this case, the explicitly specified Views of the viewlist
-trump the matched view values.
-.PP
-On the other hand, if a file template match can supply a View value
-that is not supplied by the viewlist, then that value will be taken
-from the file template match. For example:
-.PP
-.Vb 1
-\& fundisp v::x2:foo.fits
-.Ve
-.PP
-does not explicitly supply a format value, but the file match on *.fits
-can and does. You can avoid supplying missing values using file template
-matching by replacing the first \*(L":\*(R" with a \*(L"\-\*(R" in a viewlist
-specification:
-.PP
-.Vb 1
-\& fundisp v:-x2:foo.fits
-.Ve
-.PP
-The use of \*(L":+\*(R" to explicitly allow file template matching is also
-supported, but is the same as the default case. Note that the nuances
-of viewlist support are subject to change as our experience and
-understanding grow.
-.PP
-\&\fBOverriding Values Associated with a View\fR
-.PP
-To override values associated with a View, simply supply the override
-values in the correct place on the command line. Thus, given
-the example database described above, the command:
-.PP
-.Vb 1
-\& fundisp v:x3
-.Ve
-.PP
-specifies that the View named x3, along with its file name and
-associated parameters, be processed as the input file to fundisp in
-this way:
-.PP
-.Vb 1
-\& fundisp \-f "I=%4d" ${HOME}/data/snr.ev'[cir 512 512 .1]' "x y pi pha"
-.Ve
-.PP
-To override one or more of these values, simply specify a new value
-for the format, filter, or columns. For example, if your input View file
-contains a filter, then the View will use that filter as an override
-of the View filter:
-.PP
-.Vb 1
-\& fundisp v:x3'[cir 400 400 3]'
-.Ve
-.PP
-will use the columns and format of the x3 View but not the x3 filter. Further
-examples are:
-.PP
-.Vb 2
-\& fundisp v:x3 "x y dx dy" # activate a different set of columns
-\& fundisp \-f "I=%3d" v:x3 # use a different format statement
-.Ve
-.PP
-Note that extension names, extension index values, and other
-non-filter specifications \fBdo not\fR override the View
-filter. Thus:
-.PP
-.Vb 1
-\& fundisp v:foo.fit[3]
-.Ve
-.PP
-will still use the filter associated with the .fit template (see above), since
-the \*(L"3\*(R" is an extension index, not a filter.
-.PP
-\&\fBEnvironment Variables\fR
-.PP
-The following environment variables are used by Funtools Views:
-.IP "\(bu" 4
-\&\fB\s-1FUN_VIEWNAME\s0\fR
-.Sp
-The \fB\s-1FUN_VIEWNAME\s0\fR environment variable specifies the
-name and location of the View database file. If not present, the
-files ./.funtools.vu and \f(CW$HOME\fR/.funtools.vu are searched for, in
-that order.
-.IP "\(bu" 4
-\&\fB\s-1FUN_VIEWMATCH\s0\fR
-.Sp
-The \fB\s-1FUN_VIEWMATCH\s0\fR environment variable specifies whether a
-single match or multiple match algorithm is used to locate parameter
-values. If the value of this environment variable begins with \*(L"s\*(R",
-then a single match is used and missing parameters are not filled in
-with subsequent template matches on the file name. If the value begins
-with \*(L"m\*(R", then multiple matches are used to try to fill in missing
-parameters. The default is to use multiple matches.
-.PP
-\&\fBRestrictions and Problems\fR
-.PP
-Support for overriding a filter (while not overriding extension names,
-extension indexes, etc.) requires that we can sense the presence of a
-filter in a bracket specification. It is unclear yet whether our
-algorithm is perfect.
-.PP
-Go to Funtools Help Index
-.PP
-Last updated: August 3, 2007
diff --git a/funtools/man/man7/regalgebra.7 b/funtools/man/man7/regalgebra.7
deleted file mode 100644
index 93cb985..0000000
--- a/funtools/man/man7/regalgebra.7
+++ /dev/null
@@ -1,400 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "regalgebra 7"
-.TH regalgebra 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-RegAlgebra \- Boolean Algebra on Spatial Regions
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document describes the boolean arithmetic defined for
-region expressions.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-When defining a region, several shapes can be combined using boolean
-operations. The boolean operators are (in order of precedence):
-.PP
-.Vb 6
-\& Symbol Operator Associativity
-\& ------ -------- -------------
-\& ! not right to left
-\& & and left to right
-\& ^ exclusive or left to right
-\& | inclusive or left to right
-.Ve
-.PP
-For example, to create a mask consisting of a large circle with a
-smaller box removed, one can use the \fBand\fR and \fBnot\fR
-operators:
-.PP
-.Vb 1
-\& CIRCLE(11,11,15) & !BOX(11,11,3,6)
-.Ve
-.PP
-and the resulting mask is:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 1:1111111111111111111111..................
-\& 2:1111111111111111111111..................
-\& 3:11111111111111111111111.................
-\& 4:111111111111111111111111................
-\& 5:111111111111111111111111................
-\& 6:1111111111111111111111111...............
-\& 7:1111111111111111111111111...............
-\& 8:1111111111111111111111111...............
-\& 9:111111111...1111111111111...............
-\& 10:111111111...1111111111111...............
-\& 11:111111111...1111111111111...............
-\& 12:111111111...1111111111111...............
-\& 13:111111111...1111111111111...............
-\& 14:111111111...1111111111111...............
-\& 15:1111111111111111111111111...............
-\& 16:1111111111111111111111111...............
-\& 17:111111111111111111111111................
-\& 18:111111111111111111111111................
-\& 19:11111111111111111111111.................
-\& 20:1111111111111111111111..................
-\& 21:1111111111111111111111..................
-\& 22:111111111111111111111...................
-\& 23:..11111111111111111.....................
-\& 24:...111111111111111......................
-\& 25:.....11111111111........................
-\& 26:........................................
-\& 27:........................................
-\& 28:........................................
-\& 29:........................................
-\& 30:........................................
-\& 31:........................................
-\& 32:........................................
-\& 33:........................................
-\& 34:........................................
-\& 35:........................................
-\& 36:........................................
-\& 37:........................................
-\& 38:........................................
-\& 39:........................................
-\& 40:........................................
-.Ve
-.PP
-A three-quarter circle can be defined as:
-.PP
-.Vb 1
-\& CIRCLE(20,20,10) & !PIE(20,20,270,360)
-.Ve
-.PP
-and looks as follows:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 1:........................................
-\& 2:........................................
-\& 3:........................................
-\& 4:........................................
-\& 5:........................................
-\& 6:........................................
-\& 7:........................................
-\& 8:........................................
-\& 9:........................................
-\& 10:........................................
-\& 11:...............111111111................
-\& 12:..............11111111111...............
-\& 13:............111111111111111.............
-\& 14:............111111111111111.............
-\& 15:...........11111111111111111............
-\& 16:..........1111111111111111111...........
-\& 17:..........1111111111111111111...........
-\& 18:..........1111111111111111111...........
-\& 19:..........1111111111111111111...........
-\& 20:..........1111111111111111111...........
-\& 21:..........1111111111....................
-\& 22:..........1111111111....................
-\& 23:..........1111111111....................
-\& 24:..........1111111111....................
-\& 25:...........111111111....................
-\& 26:............11111111....................
-\& 27:............11111111....................
-\& 28:..............111111....................
-\& 29:...............11111....................
-\& 30:........................................
-\& 31:........................................
-\& 32:........................................
-\& 33:........................................
-\& 34:........................................
-\& 35:........................................
-\& 36:........................................
-\& 37:........................................
-\& 38:........................................
-\& 39:........................................
-\& 40:........................................
-.Ve
-.PP
-Two non-intersecting ellipses can be made into the same region:
-.PP
-.Vb 1
-\& ELL(20,20,10,20,90) | ELL(1,1,20,10,0)
-.Ve
-.PP
-and looks as follows:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 1:11111111111111111111....................
-\& 2:11111111111111111111....................
-\& 3:11111111111111111111....................
-\& 4:11111111111111111111....................
-\& 5:1111111111111111111.....................
-\& 6:111111111111111111......................
-\& 7:1111111111111111........................
-\& 8:111111111111111.........................
-\& 9:111111111111............................
-\& 10:111111111...............................
-\& 11:...........11111111111111111............
-\& 12:........111111111111111111111111........
-\& 13:.....11111111111111111111111111111......
-\& 14:....11111111111111111111111111111111....
-\& 15:..11111111111111111111111111111111111...
-\& 16:.1111111111111111111111111111111111111..
-\& 17:111111111111111111111111111111111111111.
-\& 18:111111111111111111111111111111111111111.
-\& 19:111111111111111111111111111111111111111.
-\& 20:111111111111111111111111111111111111111.
-\& 21:111111111111111111111111111111111111111.
-\& 22:111111111111111111111111111111111111111.
-\& 23:111111111111111111111111111111111111111.
-\& 24:.1111111111111111111111111111111111111..
-\& 25:..11111111111111111111111111111111111...
-\& 26:...11111111111111111111111111111111.....
-\& 27:.....11111111111111111111111111111......
-\& 28:.......111111111111111111111111.........
-\& 29:...........11111111111111111............
-\& 30:........................................
-\& 31:........................................
-\& 32:........................................
-\& 33:........................................
-\& 34:........................................
-\& 35:........................................
-\& 36:........................................
-\& 37:........................................
-\& 38:........................................
-\& 39:........................................
-\& 40:........................................
-.Ve
-.PP
-You can use several boolean operations in a single region expression,
-to create arbitrarily complex regions. With the important exception
-below, you can apply the operators in any order, using parentheses if
-necessary to override the natural precedences of the operators.
-.PP
-\&\s-1NB:\s0 Using a panda shape is always much more efficient than explicitly
-specifying \*(L"pie & annulus\*(R", due to the ability of panda to place a
-limit on the number of pixels checked in the pie shape. If you are
-going to specify the intersection of pie and annulus, use panda
-instead.
-.PP
-As described in \*(L"help regreometry\*(R", the \fB\s-1PIE\s0\fR slice goes to the
-edge of the field. To limit its scope, \fB\s-1PIE\s0\fR usually is is
-combined with other shapes, such as circles and annuli, using boolean
-operations. In this context, it is worth noting that that there is a
-difference between \fB\-PIE\fR and \fB&!PIE\fR. The former is a
-global exclude of all pixels in the \fB\s-1PIE\s0\fR slice, while the latter
-is a local excludes of pixels affecting only the region(s) with which
-the \fB\s-1PIE\s0\fR is combined. For example, the following region uses
-\&\fB&!PIE\fR as a local exclude of a single circle. Two other circles
-are also defined and are unaffected by the local exclude:
-.PP
-.Vb 3
-\& CIRCLE(1,8,1)
-\& CIRCLE(8,8,7)&!PIE(8,8,60,120)&!PIE(8,8,240,300)
-\& CIRCLE(15,8,2)
-.Ve
-.PP
-.Vb 17
-\& 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
-\& - - - - - - - - - - - - - - -
-\& 15: . . . . . . . . . . . . . . .
-\& 14: . . . . 2 2 2 2 2 2 2 . . . .
-\& 13: . . . 2 2 2 2 2 2 2 2 2 . . .
-\& 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 10: . . . . 2 2 2 2 2 2 2 . . . .
-\& 9: . . . . . . 2 2 2 . . . . 3 3
-\& 8: 1 . . . . . . . . . . . . 3 3
-\& 7: . . . . . . 2 2 2 . . . . 3 3
-\& 6: . . . . 2 2 2 2 2 2 2 . . . .
-\& 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 3: . . . 2 2 2 2 2 2 2 2 2 . . .
-\& 2: . . . . 2 2 2 2 2 2 2 . . . .
-\& 1: . . . . . . . . . . . . . . .
-.Ve
-.PP
-Note that the two other regions are not affected by the \fB&!PIE\fR,
-which only affects the circle with which it is combined.
-.PP
-On the other hand, a \fB\-PIE\fR is an global exclude that does
-affect other regions with which it overlaps:
-.PP
-.Vb 5
-\& CIRCLE(1,8,1)
-\& CIRCLE(8,8,7)
-\& \-PIE(8,8,60,120)
-\& \-PIE(8,8,240,300)
-\& CIRCLE(15,8,2)
-.Ve
-.PP
-.Vb 17
-\& 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
-\& - - - - - - - - - - - - - - -
-\& 15: . . . . . . . . . . . . . . .
-\& 14: . . . . 2 2 2 2 2 2 2 . . . .
-\& 13: . . . 2 2 2 2 2 2 2 2 2 . . .
-\& 12: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 11: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 10: . . . . 2 2 2 2 2 2 2 . . . .
-\& 9: . . . . . . 2 2 2 . . . . . .
-\& 8: . . . . . . . . . . . . . . .
-\& 7: . . . . . . 2 2 2 . . . . . .
-\& 6: . . . . 2 2 2 2 2 2 2 . . . .
-\& 5: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 4: . . 2 2 2 2 2 2 2 2 2 2 2 . .
-\& 3: . . . 2 2 2 2 2 2 2 2 2 . . .
-\& 2: . . . . 2 2 2 2 2 2 2 . . . .
-\& 1: . . . . . . . . . . . . . . .
-.Ve
-.PP
-The two smaller circles are entirely contained within the two exclude
-\&\fB\s-1PIE\s0\fR slices and therefore are excluded from the region.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/regbounds.7 b/funtools/man/man7/regbounds.7
deleted file mode 100644
index 40a1648..0000000
--- a/funtools/man/man7/regbounds.7
+++ /dev/null
@@ -1,305 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "regbounds 7"
-.TH regbounds 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-RegBounds \- Region Boundaries
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-Describes how spatial region boundaries are handled.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-The golden rule for spatial region filtering was first enunciated by
-Leon VanSpeybroeck in 1986:
-.PP
-Each photon will be counted once, and no photon will be counted
-more than once.
-.PP
-This means that we must be careful about boundary
-conditions. For example, if a circle is contained in an annulus such
-that the inner radius of the annulus is the same as the radius of the
-circle, then photons on that boundary must always be assigned to one
-or the other region. That is, the number of photons in both regions
-must equal the sum of the number of photons in each region taken
-separately.
-.PP
-With this in mind, the rules for determining whether a boundary image
-pixel or table row are assigned to a region are defined below.
-.PP
-\&\fBImage boundaries - radially-symmetric shapes (circle, annuli, ellipse)\fR
-.PP
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies non-radially-symmetric shapes. When a
-pixel center is exactly on the boundary, the pixel assignment rule is:
-.IP "\(bu" 4
-the outer boundary of a symmetric shape does not include such pixels
-.IP "\(bu" 4
-the inner boundary of a symmetric shape (annulus) includes such pixels
-.PP
-In this way, an annulus with radius from 0 to 1, centered exactly on a
-pixel, includes the pixel on which it is centered, but none of its
-neighbors.
-.PP
-These rules ensure that when defining concentric shapes, no pixels are
-omitted between concentric regions and no pixels are claimed by two
-regions. When applied to small symmetric shapes, the shape is less
-likely to be skewed, as would happen with non-radially-symmetric
-rules. These rules differ from the rules for box-like shapes, which
-are more likely to be positioned adjacent to one another.
-.PP
-\&\fBImage Boundaries: non-radially symmetric shapes (polygons, boxes)\fR
-.PP
-For image filtering, pixels whose center is inside the boundary are
-included. This also applies radially-symmetric shapes. When a pixel
-center is exactly on the boundary of a non-radially symmetric region,
-the pixel is included in the right or upper region, but not the left
-or lower region. This ensures that geometrically adjoining regions
-touch but don't overlap.
-.PP
-\&\fBRow Boundaries are Analytic\fR
-.PP
-When filtering table rows, the boundary rules are the same as for
-images, except that the calculation is not done on the center of a
-pixel, (since table rows, especially X\-ray events rows, often have
-discrete, floating point positions) but are calculated exactly. That
-is, an row is inside the boundary without regard to its integerized
-pixel value. For rows that are exactly on a region boundary, the
-above rules are applied to ensure that all rows are counted once and
-no row is counted more than once.
-.PP
-Because row boundaries are calculated differently from image boundaries,
-certain programs will give different results when filtering the same
-region file. In particular, fundisp/funtable (which utilize analytic
-row filtering) perform differently from funcnts (which performs image
-filtering, even on tables).
-.PP
-\&\fBImage Boundaries vs. Row Boundaries: Practical Considerations\fR
-.PP
-You will sometimes notice a discrepancy between running funcnts on an
-binary table file and running fundisp on the same file with the same filter.
-For example, consider the following:
-.PP
-.Vb 2
-\& fundisp test1.fits"[box(4219,3887,6,6,0)]" | wc
-\& 8893 320148 3752846
-.Ve
-.PP
-Since fundisp has a 2\-line header, there are actually 8891 photons
-that pass the filter. But then run funtable and select only the
-rows that pass this filter, placing them in a new file:
-.PP
-.Vb 1
-\& ./funtable test1.fits"[box(4219,3887,6,6,0)]" test2.fits
-.Ve
-.PP
-Now run funcnts using the original filter on the derived file:
-.PP
-.Vb 1
-\& ./funcnts test2.fits "physical; box(4219,3887,6,6,0)"
-.Ve
-.PP
-.Vb 1
-\& [... lot of processed output ...]
-.Ve
-.PP
-.Vb 4
-\& # the following source and background components were used:
-\& source region(s)
-\& ----------------
-\& physical; box(4219,3887,6,6,0)
-.Ve
-.PP
-.Vb 3
-\& reg counts pixels
-\& ---- ------------ ---------
-\& 1 7847.000 36
-.Ve
-.PP
-There are 1044 rows (events) that pass the row filter in fundisp (or
-funtable) but fail to make it through funcnts. Why?
-.PP
-The reason can be traced to how analytic row filtering (fundisp, funtable)
-differs from integerized pixel filtering(funcnts, funimage). Consider the
-region:
-.PP
-.Vb 1
-\& box(4219,3887,6,6,0)
-.Ve
-.PP
-Analytically (i.e., using row filtering), positions will pass this
-filter successfully if:
-.PP
-.Vb 2
-\& 4216 <= x <= 4222
-\& 3884 <= y <= 3890
-.Ve
-.PP
-For example, photons with position values of x=4216.4 or y=3884.08 will pass.
-.PP
-Integerized image filtering is different in that the pixels that will
-pass this filter have centers at:
-.PP
-.Vb 2
-\& x = 4217, 4218, 4219, 4220, 4221, 4222
-\& y = 3885, 3886, 3887, 3888, 3889, 3890
-.Ve
-.PP
-Note that there are 6 pixels in each direction, as specified by the region.
-That means that positions will pass the filter successfully if:
-.PP
-.Vb 2
-\& 4217 <= (int)x <= 4222
-\& 3885 <= (int)y <= 3890
-.Ve
-.PP
-Photons with position values of x=4216.4 or y=3884.08 will \s-1NOT\s0 pass.
-.PP
-Note that the position values are integerized, in effect, binned into
-image values. This means that x=4222.4 will pass this filter, but not
-the analytic filter above. We do this to maintain the design goal that
-either all counts in a pixel are included in an integerized filter, or
-else none are included.
-.PP
-[It could be argued that the correct photon limits for floating point
-row data really should be:
-.PP
-.Vb 2
-\& 4216.5 <= x <= 4222.5
-\& 3884.5 <= y <= 3890.5
-.Ve
-.PP
-since each pixel extends for .5 on either side of the center. We chose
-to the maintain integerized algorithm for all image-style filtering so
-that funcnts would give the exact same results regardless of whether
-a table or a derived non-blocked binned image is used.]
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/regcoords.7 b/funtools/man/man7/regcoords.7
deleted file mode 100644
index fd7615e..0000000
--- a/funtools/man/man7/regcoords.7
+++ /dev/null
@@ -1,345 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "regcoords 7"
-.TH regcoords 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-RegCoords \- Spatial Region Coordinates
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document describes the specification of coordinate systems, and the
-interpretation of coordinate values, for spatial region filtering.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBPixel coordinate systems\fR
-.PP
-The default coordinate system for regions is \s-1PHYSICAL\s0, which means
-that region position and size values are taken from the original
-data. (Note that this is a change from the original \s-1IRAF/PROS\s0
-implementation, in which the \s-1IMAGE\s0 coordinate system was the default.)
-\&\s-1PHYSICAL\s0 coordinates always refer to pixel positions on the original
-image (using \s-1IRAF\s0 \s-1LTM\s0 and \s-1LTV\s0 keywords). With \s-1PHYSICAL\s0 coordinates,
-if a set of coordinates specifies the position of an object in an
-original \s-1FITS\s0 file, the same coordinates will specify the same object
-in any \s-1FITS\s0 derived from the original. Physical coordinates are
-invariant with blocking of \s-1FITS\s0 files or taking sections of images,
-even when a blocked section is written to a new file.
-.PP
-Thus, although a value in pixels refers, by default, to the \s-1PHYSICAL\s0
-coordinate system, you may specify that position values refer to the
-image coordinate system using the \fBglobal\fR or \fBlocal\fR
-properties commands:
-.PP
-.Vb 2
-\& global coordsys image
-\& circle 512 512 100
-.Ve
-.PP
-The \fBglobal\fR command changes the coordinate system for all
-regions that follow, while the \fBlocal\fR command changes the
-coordinate system only for the region immediately following:
-.PP
-.Vb 3
-\& local coordsys image
-\& circle 512 512 100
-\& circle 1024 1024 200
-.Ve
-.PP
-This changes the coordinate system only for the region that follows.
-In the above example, the second region uses the global coordinate
-system (\s-1PHYSICAL\s0 by default).
-.PP
-\&\fBWorld Coordinate Systems\fR
-.PP
-If World Coordinate System information is contained in the data file
-being filtered, it also is possible to define regions using a sky
-coordinate system. Supported systems include:
-.PP
-.Vb 10
-\& name description
-\& ---- -----------
-\& PHYSICAL pixel coords of original file using LTM/LTV
-\& IMAGE pixel coords of current file
-\& FK4, B1950 sky coordinate systems
-\& FK5, J2000 sky coordinate systems
-\& GALACTIC sky coordinate systems
-\& ECLIPTIC sky coordinate systems
-\& ICRS currently same as J2000
-\& LINEAR linear wcs as defined in file
-.Ve
-.PP
-In addition, two mosaic coordinate systems have been defined that
-utilize the (evolving) \s-1IRAF\s0 mosaic keywords:
-.PP
-.Vb 4
-\& name description
-\& ---- -----------
-\& AMPLIFIER mosaic coords of original file using ATM/ATV
-\& DETECTOR mosaic coords of original file using DTM/DTV
-.Ve
-.PP
-Again, to use one of these coordinate systems, the \fBglobal\fR or
-\&\fBlocal\fR properties commands are used:
-.PP
-.Vb 1
-\& global coordsys galactic
-.Ve
-.PP
-\&\fB\s-1WCS\s0 Positions and Sizes\fR
-.PP
-In addition to pixels, positional values in a WCS-enabled region can
-be specified using sexagesimal or degrees format:
-.PP
-.Vb 11
-\& position arguments description
-\& ------------------ -----------
-\& [num] context-dependent (see below)
-\& [num]d degrees
-\& [num]r radians
-\& [num]p physical pixels
-\& [num]i image pixels
-\& [num]:[num]:[num] hms for 'odd' position arguments
-\& [num]:[num]:[num] dms for 'even' position arguments
-\& [num]h[num]m[num]s explicit hms
-\& [num]d[num]m[num]s explicit dms
-.Ve
-.PP
-If ':' is used as sexagesimal separator, the value is considered to be
-specifying hours/minutes/seconds if it is the first argument of a
-positional pair, and degrees/minutes/seconds for the second argument
-of a pair (except for galactic coordinates, which always use degrees):
-.PP
-.Vb 7
-\& argument description
-\& ----------- -----------
-\& 10:20:30.0 10 hours, 20 minutes, 30 seconds for 1st positional argument
-\& 10 degrees, 20 minutes, 30 seconds for 2nd positional argument
-\& 10h20m30.0 10 hours, 20 minutes, 30 seconds
-\& 10d20m30.0 10 degrees, 20 minutes, 30 seconds
-\& 10.20d 10.2 degrees
-.Ve
-.PP
-Similarly, the units of size values are defined by the formating
-character(s) attached to a number:
-.PP
-.Vb 9
-\& size arguments description
-\& -------------- -----------
-\& [num] context-dependent (see below)
-\& [num]" arc seconds
-\& [num]' arc minutes
-\& [num]d degrees
-\& [num]r radians
-\& [num]p physical pixels
-\& [num]i image pixels
-.Ve
-.PP
-For example:
-.PP
-.Vb 8
-\& argument description
-\& ----------- -----------
-\& 10 ten pixels
-\& 10' ten minutes of arc
-\& 10" ten seconds of arc
-\& 10d ten degrees
-\& 10p ten pixels
-\& 0.5r half of a radian
-.Ve
-.PP
-An example of using sky coordinate systems follows:
-.PP
-.Vb 4
-\& global coordsys B1950
-\& \-box 175.54d 20.01156d 10' 10'
-\& local coordsys J2000
-\& pie 179.57d 22.4d 0 360 n=4 && annulus 179.57d 22.4d 3' 24' n=5
-.Ve
-.PP
-At the \s-1FK4\s0 1950 coordinates 175.54d \s-1RA\s0, 20.01156d \s-1DEC\s0 exclude a 10
-minute by 10 minute box. Then at the \s-1FK5\s0 2000 coordinates 179.57d \s-1RA\s0
-22.4d \s-1DEC\s0 draw a radial profile regions pattern with 4 quadrants and 5
-annuli ranging from 3 minutes to 24 minutes in diameter. In this
-example, the default coordinate system is overridden by the commands
-in the regions spec.
-.PP
-\&\fB\s-1NB:\s0 The Meaning of Pure Numbers Are Context Sensitive\fR
-.PP
-When a \*(L"pure number\*(R" (i.e. one without a format directive such as 'd'
-for 'degrees') is specified as a position or size, its interpretation
-depends on the context defined by the 'coordsys' keyword. In general,
-the rule is:
-.PP
-All pure numbers have implied units corresponding to the current
-coordinate system.
-.PP
-If no coordinate system is explicitly specified, the default system is
-implicitly assumed to be \s-1PHYSICAL\s0. In practice this means that for
-\&\s-1IMAGE\s0 and \s-1PHYSICAL\s0 systems, pure numbers are pixels. Otherwise,
-for all systems other than \s-1LINEAR\s0, pure numbers are degrees. For
-\&\s-1LINEAR\s0 systems, pure numbers are in the units of the linear system.
-This rule covers both positions and sizes.
-.PP
-As a corollary, when a sky-formatted number is used with the \s-1IMAGE\s0
-or \s-1PHYSICAL\s0 coordinate system (which includes the default case of no
-coordsys being specified), the formatted number is assumed to be in
-the units of the \s-1WCS\s0 contained in the current file. If no sky \s-1WCS\s0 is
-specified, an error results.
-.PP
-Examples:
-.PP
-.Vb 2
-\& circle(512,512,10)
-\& ellipse 202.44382d 47.181656d 0.01d 0.02d
-.Ve
-.PP
-In the absence of a specified coordinate system, the circle uses the
-default \s-1PHYSICAL\s0 units of pixels, while the ellipse explicitly uses degrees,
-presumably to go with the \s-1WCS\s0 in the current file.
-.PP
-.Vb 5
-\& global coordsys=fk5
-\& global color=green font="system 10 normal"
-\& circle 202.44382 47.181656 0.01
-\& circle 202.44382 47.181656 10p
-\& ellipse(512p,512p,10p,15p,20)
-.Ve
-.PP
-Here, the circles use the \s-1FK5\s0 units of degrees (except for the
-explicit use of pixels in the second radius), while the ellipse
-explicitly specifies pixels. The ellipse angle is in degrees.
-.PP
-Note that Chandra data format appears to use \*(L"coordsys=physical\*(R"
-implicitly. Therefore, for most Chandra applications, valid regions
-can be generated safely by asking ds9 to save/display regions in
-pixels using the \s-1PHYSICAL\s0 coordsys.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/regdiff.7 b/funtools/man/man7/regdiff.7
deleted file mode 100644
index c9f6f6a..0000000
--- a/funtools/man/man7/regdiff.7
+++ /dev/null
@@ -1,181 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "regdiff 7"
-.TH regdiff 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-RegDiff \- Differences Between Funtools and IRAF Regions
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-Describes the differences between Funtools/ds9 regions and the old \s-1IRAF/PROS\s0
-regions.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-We have tried to make Funtools regions compatible with their
-predecessor, \s-1IRAF/PROS\s0 regions. For simple regions and simple boolean
-algebra between regions, there should be no difference between the two
-implementations. The following is a list of differences and
-incompatibilities between the two:
-.IP "\(bu" 4
-If a pixel is covered by two different regions expressions,
-Funtools assigns the mask value of the \fBfirst\fR region that
-contains that pixel. That is, successive regions \fBdo not\fR
-overwrite previous regions in the mask, as was the case with the
-original \s-1PROS\s0 regions. This means that one must define overlapping
-regions in the reverse order in which they were defined in \s-1PROS\s0. If
-region N is fully contained within region M, then N should be defined
-\&\fBbefore\fR M, or else it will be \*(L"covered up\*(R" by the latter. This
-change is necessitated by the use of optimized filter compilation, i.e.,
-Funtools only tests individual regions until a proper match is made.
-.IP "\(bu" 4
-The \fB\s-1PANDA\s0\fR region has replaced the old \s-1PROS\s0 syntax in which
-a \fB\s-1PIE\s0\fR accelerator was combined with an \fB\s-1ANNULUS\s0\fR accelerator
-using \fB\s-1AND\s0\fR. That is,
-.Sp
-.Vb 1
-\& ANNULUS(20,20,0,15,n=4) & PIE(20,20,0,360,n=3)
-.Ve
-.Sp
-has been replaced by:
-.Sp
-.Vb 1
-\& PANDA(20,20,0,360,3,0,15,4)
-.Ve
-.Sp
-The \s-1PROS\s0 syntax was inconsistent with the meaning of the \fB\s-1AND\s0\fR operator.
-.IP "\(bu" 4
-The meaning of pure numbers (i.e., without format specifiers) in
-regions has been clarified, as has the syntax for specifying coordinate
-systems. See the general discussion on
-Spatial Region Filtering
-for more information.
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/man/man7/reggeometry.7 b/funtools/man/man7/reggeometry.7
deleted file mode 100644
index 8eb15e7..0000000
--- a/funtools/man/man7/reggeometry.7
+++ /dev/null
@@ -1,1271 +0,0 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "reggeometry 7"
-.TH reggeometry 7 "April 14, 2011" "version 1.4.5" "SAORD Documentation"
-.SH "NAME"
-RegGeometry \- Geometric Shapes in Spatial Region Filtering
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-This document describes the geometry of regions available for spatial
-filtering in \s-1IRAF/PROS\s0 analysis.
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\fBGeometric shapes\fR
-.PP
-Several geometric shapes are used to describe regions. The valid
-shapes are:
-.PP
-.Vb 11
-\& shape: arguments:
-\& ----- ----------------------------------------
-\& ANNULUS xcenter ycenter inner_radius outer_radius
-\& BOX xcenter ycenter xwidth yheight (angle)
-\& CIRCLE xcenter ycenter radius
-\& ELLIPSE xcenter ycenter xwidth yheight (angle)
-\& FIELD none
-\& LINE x1 y1 x2 y2
-\& PIE xcenter ycenter angle1 angle2
-\& POINT x1 y1
-\& POLYGON x1 y1 x2 y2 ... xn yn
-.Ve
-.PP
-All arguments are real values; integer values are automatically
-converted to real where necessary. All angles are in degrees and
-specify angles that run counter-clockwise from the positive y\-axis.
-.PP
-Shapes can be specified using \*(L"command\*(R" syntax:
-.PP
-.Vb 1
-\& [shape] arg1 arg2 ...
-.Ve
-.PP
-or using \*(L"routine\*(R" syntax:
-.PP
-.Vb 1
-\& [shape](arg1, arg2, ...)
-.Ve
-.PP
-or by any combination of the these. (Of course, the parentheses must
-balance and there cannot be more commas than necessary.) The shape
-keywords are case\-insensitive. Furthermore, any shape can be
-specified by a three-character unique abbreviation. For example, one
-can specify three circular regions as:
-.PP
-.Vb 1
-\& "foo.fits[CIRCLE 512 512 50;CIR(128 128, 10);cir(650,650,20)]"
-.Ve
-.PP
-(Quotes generally are required to protect the region descriptor
-from being processed by the Unix shell.)
-.PP
-The \fBannulus\fR shape specifies annuli, centered at xcenter,
-ycenter, with inner and outer radii (r1, r2). For example,
-.PP
-.Vb 1
-\& ANNULUS 25 25 5 10
-.Ve
-.PP
-specifies an annulus centered at 25.0 25.0 with an inner radius of 5.0 and
-an outer radius of 10. Assuming (as will be done for all examples in this
-document, unless otherwise noted) this shape is used in a mask of size 40x40,
-it will look like this:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:....................111111111...........
-\& 33:...................11111111111..........
-\& 32:.................111111111111111........
-\& 31:.................111111111111111........
-\& 30:................11111111111111111.......
-\& 29:...............1111111.....1111111......
-\& 28:...............111111.......111111......
-\& 27:...............11111.........11111......
-\& 26:...............11111.........11111......
-\& 25:...............11111.........11111......
-\& 24:...............11111.........11111......
-\& 23:...............11111.........11111......
-\& 22:...............111111.......111111......
-\& 21:...............1111111.....1111111......
-\& 20:................11111111111111111.......
-\& 19:.................111111111111111........
-\& 18:.................111111111111111........
-\& 17:...................11111111111..........
-\& 16:....................111111111...........
-\& 15:........................................
-\& 14:........................................
-\& 13:........................................
-\& 12:........................................
-\& 11:........................................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:........................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-The \fBbox\fR shape specifies an orthogonally oriented box,
-centered at xcenter, ycenter, of size xwidth, yheight. It requires four
-arguments and accepts an optional fifth argument to specify a rotation angle.
-When the rotation angle is specified (in degrees), the box is rotated by
-an angle that runs counter-clockwise from the positive y\-axis.
-.PP
-The \fBbox\fR shape specifies a rotated box, centered at
-xcenter, ycenter, of size xwidth, yheight. The box is rotated by an angle
-specified in degrees that runs counter-clockwise from the positive y\-axis.
-If the angle argument is omitted, it defaults to 0.
-.PP
-The \fBcircle\fR shape specifies a circle, centered at xcenter,
-ycenter, of radius r. It requires three arguments.
-.PP
-The \fBellipse\fR shape specifies an ellipse, centered at
-xcenter, ycenter, with y\-axis width a and the y\-axis length b defined such
-that:
-.PP
-.Vb 1
-\& x**2/a**2 + y**2/b**2 = 1
-.Ve
-.PP
-Note that a can be less than, equal to, or greater than b. The ellipse
-is rotated the specified number of degrees. The rotation is done according
-to astronomical convention, counter-clockwise from the positive y\-axis.
-An ellipse defined by:
-.PP
-.Vb 1
-\& ELLIPSE 20 20 5 10 45
-.Ve
-.PP
-will look like this:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:........................................
-\& 33:........................................
-\& 32:........................................
-\& 31:........................................
-\& 30:........................................
-\& 29:........................................
-\& 28:........................................
-\& 27:............111111......................
-\& 26:............11111111....................
-\& 25:............111111111...................
-\& 24:............11111111111.................
-\& 23:............111111111111................
-\& 22:............111111111111................
-\& 21:.............111111111111...............
-\& 20:.............1111111111111..............
-\& 19:..............111111111111..............
-\& 18:...............111111111111.............
-\& 17:...............111111111111.............
-\& 16:................11111111111.............
-\& 15:..................111111111.............
-\& 14:...................11111111.............
-\& 13:.....................111111.............
-\& 12:........................................
-\& 11:........................................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:........................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-The \fBfield\fR shape specifies the entire field as a
-region. It is not usually specified explicitly, but is used implicitly in the
-case where no regions are specified, that is, in cases where either a null
-string or some abbreviation of the string \*(L"none\*(R" is input.
-\&\fBField\fR takes no arguments.
-.PP
-The \fBpie\fR shape specifies an angular wedge of the entire field,
-centered at xcenter, ycenter. The wedge runs between the two specified angles.
-The angles are given in degrees, running counter-clockwise from the positive
-x\-axis. For example,
-.PP
-.Vb 1
-\& PIE 20 20 90 180
-.Ve
-.PP
-defines a region from 90 degrees to 180 degrees, i.e., quadrant 2 of the
-Cartesian plane. The display of such a region looks like this:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:11111111111111111111....................
-\& 39:11111111111111111111....................
-\& 38:11111111111111111111....................
-\& 37:11111111111111111111....................
-\& 36:11111111111111111111....................
-\& 35:11111111111111111111....................
-\& 34:11111111111111111111....................
-\& 33:11111111111111111111....................
-\& 32:11111111111111111111....................
-\& 31:11111111111111111111....................
-\& 30:11111111111111111111....................
-\& 29:11111111111111111111....................
-\& 28:11111111111111111111....................
-\& 27:11111111111111111111....................
-\& 26:11111111111111111111....................
-\& 25:11111111111111111111....................
-\& 24:11111111111111111111....................
-\& 23:11111111111111111111....................
-\& 22:11111111111111111111....................
-\& 21:11111111111111111111....................
-\& 20:........................................
-\& 19:........................................
-\& 18:........................................
-\& 17:........................................
-\& 16:........................................
-\& 15:........................................
-\& 14:........................................
-\& 13:........................................
-\& 12:........................................
-\& 11:........................................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:........................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-The pie slice specified is always a counter-clockwise sweep between
-the angles, starting at the first angle and ending at the second. Thus:
-.PP
-.Vb 1
-\& PIE 10 15 30 60
-.Ve
-.PP
-describes a 30 degree sweep from 2 o'clock to 1 o'clock, while:
-.PP
-.Vb 1
-\& PIE 10 15 60 30
-.Ve
-.PP
-describes a 330 degree counter-clockwise sweep from 1 o'clock to 2 o'clock
-passing through 12 o'clock (0 degrees). Note in both of these examples that
-the center of the slice can be anywhere on the plane. The second mask looks
-like this:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:111111111111111111111111................
-\& 39:11111111111111111111111.................
-\& 38:11111111111111111111111.................
-\& 37:1111111111111111111111..................
-\& 36:1111111111111111111111..................
-\& 35:111111111111111111111...................
-\& 34:11111111111111111111....................
-\& 33:11111111111111111111....................
-\& 32:1111111111111111111....................1
-\& 31:1111111111111111111..................111
-\& 30:111111111111111111.................11111
-\& 29:111111111111111111................111111
-\& 28:11111111111111111...............11111111
-\& 27:1111111111111111..............1111111111
-\& 26:1111111111111111.............11111111111
-\& 25:111111111111111............1111111111111
-\& 24:111111111111111..........111111111111111
-\& 23:11111111111111.........11111111111111111
-\& 22:11111111111111........111111111111111111
-\& 21:1111111111111.......11111111111111111111
-\& 20:111111111111......1111111111111111111111
-\& 19:111111111111....111111111111111111111111
-\& 18:11111111111....1111111111111111111111111
-\& 17:11111111111..111111111111111111111111111
-\& 16:1111111111.11111111111111111111111111111
-\& 15:1111111111111111111111111111111111111111
-\& 14:1111111111111111111111111111111111111111
-\& 13:1111111111111111111111111111111111111111
-\& 12:1111111111111111111111111111111111111111
-\& 11:1111111111111111111111111111111111111111
-\& 10:1111111111111111111111111111111111111111
-\& 9:1111111111111111111111111111111111111111
-\& 8:1111111111111111111111111111111111111111
-\& 7:1111111111111111111111111111111111111111
-\& 6:1111111111111111111111111111111111111111
-\& 5:1111111111111111111111111111111111111111
-\& 4:1111111111111111111111111111111111111111
-\& 3:1111111111111111111111111111111111111111
-\& 2:1111111111111111111111111111111111111111
-\& 1:1111111111111111111111111111111111111111
-.Ve
-.PP
-The pie slice goes to the edge of the field. To limit its scope, pie
-usually is is combined with other shapes, such as circles and annuli,
-using boolean operations. (See below and in \*(L"help regalgebra\*(R").
-.PP
-Pie Performance Notes:
-.PP
-Pie region processing time is proportional to the size of the image,
-and not the size of the region. This is because the pie shape is the
-only infinite length shape, and we essentially must check all y rows
-for inclusion (unlike other regions, where the y limits can be
-calculated beforehand). Thus, pie can run very slowly on large images.
-In particular, it will run \s-1MUCH\s0 more slowly than the panda shape in
-image-based region operations (such as funcnts). We recommend use of
-panda over pie where ever possible.
-.PP
-If you must use pie, always try to put it last in a boolean &&
-expression. The reason for this is that the filter code is optimized
-to exit as soon as the result is know. Since pie is the slowest
-region, it is better to avoid executing it if another region can decide
-the result. Consider, for example, the difference in time required to
-process a Chandra \s-1ACIS\s0 file when a pie and circle are combined in
-two different orders:
-.PP
-.Vb 2
-\& time ./funcnts nacis.fits "circle 4096 4096 100 && pie 4096 4096 10 78"
-\&2.87u 0.38s 0:35.08 9.2%
-.Ve
-.PP
-.Vb 2
-\& time ./funcnts nacis.fits "pie 4096 4096 10 78 && circle 4096 4096 100 "
-\&89.73u 0.36s 1:03.50 141.8%
-.Ve
-.PP
-Black-magic performance note:
-.PP
-Panda region processing uses a \fBquick test\fR pie region instead of
-the normal pie region when combining its annulus and pie shapes. This
-\&\fBqtpie\fR shape differs from the normal pie in that it utilizes the
-y limits from the previous region with which it is combined. In a
-panda shape, which is a series of annuli combined with pies, the
-processing time is thus reduced to that of the annuli.
-.PP
-You can use the qtpie shape instead of pie in cases where you are
-combining pie with another shape using the && operator. This will
-cause the pie limits to be set using limits from the other shape, and
-will speed up the processing considerably. For example, the above
-execution of funcnts can be improved considerably using this technique:
-.PP
-.Vb 2
-\& time ./funcnts nacis.fits "circle 4096 4096 100 && qtpie 4096 4096 10 78"
-\&4.66u 0.33s 0:05.87 85.0%
-.Ve
-.PP
-We emphasize that this is a quasi-documented feature and might change in
-the future. The qtpie shape is not recognized by ds9 or other programs.
-.PP
-The \fBline\fR shape allows single pixels in a line between (x1,y1) and
-(x2,y2) to be included or excluded. For example:
-.PP
-.Vb 1
-\& LINE (5,6, 24,25)
-.Ve
-.PP
-displays as:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:........................................
-\& 33:........................................
-\& 32:........................................
-\& 31:........................................
-\& 30:........................................
-\& 29:........................................
-\& 28:........................................
-\& 27:........................................
-\& 26:........................................
-\& 25:.......................1................
-\& 24:......................1.................
-\& 23:.....................1..................
-\& 22:....................1...................
-\& 21:...................1....................
-\& 20:..................1.....................
-\& 19:.................1......................
-\& 18:................1.......................
-\& 17:...............1........................
-\& 16:..............1.........................
-\& 15:.............1..........................
-\& 14:............1...........................
-\& 13:...........1............................
-\& 12:..........1.............................
-\& 11:.........1..............................
-\& 10:........1...............................
-\& 9:.......1................................
-\& 8:......1.................................
-\& 7:.....1..................................
-\& 6:....1...................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-The \fBpoint\fR shape allows single pixels to be included or
-excluded. Although the (x,y) values are real numbers, they are truncated
-to integer and the corresponding pixel is included or excluded, as specified.
-.PP
-Several points can be put in one region declaration; unlike the
-original \s-1IRAF\s0 implementation, each now is given a different region mask value.
-This makes it easier, for example, for funcnts to determine the number of
-photons in the individual pixels. For example,
-.PP
-.Vb 1
-\& POINT (5,6, 10,11, 20,20, 35,30)
-.Ve
-.PP
-will give the different region mask values to all four points, as shown below:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:........................................
-\& 33:........................................
-\& 32:........................................
-\& 31:........................................
-\& 30:..................................4.....
-\& 29:........................................
-\& 28:........................................
-\& 27:........................................
-\& 26:........................................
-\& 25:........................................
-\& 24:........................................
-\& 23:........................................
-\& 22:........................................
-\& 21:........................................
-\& 20:...................3....................
-\& 19:........................................
-\& 18:........................................
-\& 17:........................................
-\& 16:........................................
-\& 15:........................................
-\& 14:........................................
-\& 13:........................................
-\& 12:........................................
-\& 11:.........2..............................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:....1...................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-The \fBpolygon\fR shape specifies a polygon with vertices
-(x1, y1) ... (xn, yn). The polygon is closed automatically: one should
-not specify the last vertex to be the same as the first. Any number of
-vertices are allowed. For example, the following polygon defines a
-right triangle as shown below:
-.PP
-.Vb 1
-\& POLYGON (10,10, 10,30, 30,30)
-.Ve
-.PP
-looks like this:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:........................................
-\& 33:........................................
-\& 32:........................................
-\& 31:........................................
-\& 30:..........11111111111111111111..........
-\& 29:..........1111111111111111111...........
-\& 28:..........111111111111111111............
-\& 27:..........11111111111111111.............
-\& 26:..........1111111111111111..............
-\& 25:..........111111111111111...............
-\& 24:..........11111111111111................
-\& 23:..........1111111111111.................
-\& 22:..........111111111111..................
-\& 21:..........11111111111...................
-\& 20:..........1111111111....................
-\& 19:..........111111111.....................
-\& 18:..........11111111......................
-\& 17:..........1111111.......................
-\& 16:..........111111........................
-\& 15:..........11111.........................
-\& 14:..........1111..........................
-\& 13:..........111...........................
-\& 12:..........11............................
-\& 11:..........1.............................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:........................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-Note that polygons can get twisted upon themselves if edge lines
-cross. Thus:
-.PP
-.Vb 1
-\& POL (10,10, 20,20, 20,10, 10,20)
-.Ve
-.PP
-will produce an area which is two triangles, like butterfly wings, as shown
-below:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:........................................
-\& 33:........................................
-\& 32:........................................
-\& 31:........................................
-\& 30:........................................
-\& 29:........................................
-\& 28:........................................
-\& 27:........................................
-\& 26:........................................
-\& 25:........................................
-\& 24:........................................
-\& 23:........................................
-\& 22:........................................
-\& 21:........................................
-\& 20:........................................
-\& 19:..........1........1....................
-\& 18:..........11......11....................
-\& 17:..........111....111....................
-\& 16:..........1111..1111....................
-\& 15:..........1111111111....................
-\& 14:..........1111..1111....................
-\& 13:..........111....111....................
-\& 12:..........11......11....................
-\& 11:..........1........1....................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:........................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-The following are combinations of pie with different shapes
-(called \*(L"panda\*(R" for \*(L"Pie \s-1AND\s0 Annulus\*(R") allow for easy specification of
-radial sections:
-.PP
-.Vb 6
-\& shape: arguments:
-\& ----- ---------
-\& PANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
-\& CPANDA xcen ycen ang1 ang2 nang irad orad nrad # circular
-\& BPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # box
-\& EPANDA xcen ycen ang1 ang2 nang xwlo yhlo xwhi yhhi nrad (ang) # ellipse
-.Ve
-.PP
-The \fBpanda\fR (\fBP\fRies \fB\s-1AND\s0\fR \fBA\fRnnuli) shape can be
-used to create combinations of pie and annuli markers. It is analogous
-to a Cartesian product on those shapes, i.e., the result is several
-shapes generated by performing a boolean \s-1AND\s0 between pies and
-annuli. Thus, the panda and cpanda specify combinations of annulus and
-circle with pie, respectively and give identical results. The bpanda
-combines box and pie, while epanda combines ellipse and pie.
-.PP
-Consider the example shown below:
-.PP
-.Vb 1
-\& PANDA(20,20, 0,360,3, 0,15,4)
-.Ve
-.PP
-Here, 3 pie slices centered at 20, 20 are combined with 4 annuli, also
-centered at 20, 20. The result is a mask with 12 regions (displayed in
-base 16 to save characters):
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:..............44444444444...............
-\& 33:............444444444444444.............
-\& 32:...........88444444444444444............
-\& 31:.........888844443333344444444..........
-\& 30:........88888833333333333444444.........
-\& 29:........88888733333333333344444.........
-\& 28:.......8888877733333333333344444........
-\& 27:......888887777332222233333344444.......
-\& 26:......888877777622222222333334444.......
-\& 25:.....88887777766622222222333334444......
-\& 24:.....88887777666622222222233334444......
-\& 23:.....88887777666651111222233334444......
-\& 22:.....88877776666551111122223333444......
-\& 21:.....88877776666555111122223333444......
-\& 20:.....888777766665559999aaaabbbbccc......
-\& 19:.....888777766665559999aaaabbbbccc......
-\& 18:.....888777766665599999aaaabbbbccc......
-\& 17:.....88887777666659999aaaabbbbcccc......
-\& 16:.....888877776666aaaaaaaaabbbbcccc......
-\& 15:.....888877777666aaaaaaaabbbbbcccc......
-\& 14:......8888777776aaaaaaaabbbbbcccc.......
-\& 13:......888887777bbaaaaabbbbbbccccc.......
-\& 12:.......88888777bbbbbbbbbbbbccccc........
-\& 11:........888887bbbbbbbbbbbbccccc.........
-\& 10:........888888bbbbbbbbbbbcccccc.........
-\& 9:.........8888ccccbbbbbcccccccc..........
-\& 8:...........88ccccccccccccccc............
-\& 7:............ccccccccccccccc.............
-\& 6:..............ccccccccccc...............
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-Several regions with different mask values can be combined in the
-same mask. This supports comparing data from the different regions.
-(For information on how to combine different shapes into a single
-region, see \*(L"help regalgebra\*(R".) For example, consider the following
-set of regions:
-.PP
-.Vb 3
-\& ANNULUS 25 25 5 10
-\& ELLIPSE 20 20 5 10 315
-\& BOX 15 15 5 10
-.Ve
-.PP
-The resulting mask will look as follows:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........................................
-\& 35:........................................
-\& 34:....................111111111...........
-\& 33:...................11111111111..........
-\& 32:.................111111111111111........
-\& 31:.................111111111111111........
-\& 30:................11111111111111111.......
-\& 29:...............1111111.....1111111......
-\& 28:...............111111.......111111......
-\& 27:...............11111.222222..11111......
-\& 26:...............111112222222..11111......
-\& 25:...............111112222222..11111......
-\& 24:...............111112222222..11111......
-\& 23:...............111112222222..11111......
-\& 22:...............111111222222.111111......
-\& 21:..............211111112222.1111111......
-\& 20:............322211111111111111111.......
-\& 19:............32222111111111111111........
-\& 18:............22222111111111111111........
-\& 17:............222222211111111111..........
-\& 16:............22222222111111111...........
-\& 15:............222222222...................
-\& 14:............22222222....................
-\& 13:............222222......................
-\& 12:............33333.......................
-\& 11:............33333.......................
-\& 10:........................................
-\& 9:........................................
-\& 8:........................................
-\& 7:........................................
-\& 6:........................................
-\& 5:........................................
-\& 4:........................................
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-Note that when a pixel is in 2 or more regions, it is arbitrarily
-assigned to a one of the regions in question (often based on how a
-give C compiler optimizes boolean expressions).
-.PP
-\&\fBRegion accelerators\fR
-.PP
-Two types of \efBaccelerators, to simplify region specification,
-are provided as natural extensions to the ways shapes are described.
-These are: extended lists of parameters, specifying multiple regions,
-valid for annulus, box, circle, ellipse, pie, and points; and
-\&\fBn=\fR, valid for annulus, box, circle, ellipse, and pie (not
-point). In both cases, one specification is used to define several
-different regions, that is, to define shapes with different mask
-values in the region mask.
-.PP
-The following regions accept \fBaccelerator\fR syntax:
-.PP
-.Vb 13
-\& shape arguments
-\& ----- ------------------------------------------
-\& ANNULUS xcenter ycenter radius1 radius2 ... radiusn
-\& ANNULUS xcenter ycenter inner_radius outer_radius n=[number]
-\& BOX xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
-\& BOX xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
-\& CIRCLE xcenter ycenter r1 r2 ... rn # same as annulus
-\& CIRCLE xcenter ycenter rinner router n=[number] # same as annulus
-\& ELLIPSE xcenter ycenter xw1 yh1 xw2 yh2 ... xwn yhn (angle)
-\& ELLIPSE xcenter ycenter xwlo yhlo xwhi yhhi n=[number] (angle)
-\& PIE xcenter ycenter angle1 angle2 (angle3) (angle4) (angle5) ...
-\& PIE xcenter ycenter angle1 angle2 (n=[number])
-\& POINT x1 y1 x2 y2 ... xn yn
-.Ve
-.PP
-Note that the circle accelerators are simply aliases for the annulus
-accelerators.
-.PP
-For example, several annuli at the same center can be specified in one
-region expression by specifying more than two radii. If \fBN\fR
-radii are specified, then \fBN\fR\-1 annuli result, with the outer
-radius of each preceding annulus being the inner radius of the
-succeeding annulus. Each annulus is considered a separate region, and
-is given a separate mask value. For example,
-.PP
-.Vb 1
-\& ANNULUS 20 20 0 2 5 10 15 20
-.Ve
-.PP
-specifies five different annuli centered at 20 20, and is equivalent to:
-.PP
-.Vb 5
-\& ANNULUS 20.0 20.0 0 2
-\& ANNULUS 20.0 20.0 2 5
-\& ANNULUS 20.0 20.0 5 10
-\& ANNULUS 20.0 20.0 10 15
-\& ANNULUS 20.0 20.0 15 20
-.Ve
-.PP
-The mask is shown below:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:.............5555555555555..............
-\& 38:...........55555555555555555............
-\& 37:.........555555555555555555555..........
-\& 36:........55555555555555555555555.........
-\& 35:......555555555555555555555555555.......
-\& 34:.....55555555544444444444555555555......
-\& 33:....5555555544444444444444455555555.....
-\& 32:....5555555444444444444444445555555.....
-\& 31:...555555444444444444444444444555555....
-\& 30:..55555544444444444444444444444555555...
-\& 29:..55555544444443333333334444444555555...
-\& 28:.5555554444444333333333334444444555555..
-\& 27:.5555544444433333333333333344444455555..
-\& 26:555555444444333333333333333444444555555.
-\& 25:555554444443333333333333333344444455555.
-\& 24:555554444433333332222233333334444455555.
-\& 23:555554444433333322222223333334444455555.
-\& 22:555554444433333222222222333334444455555.
-\& 21:555554444433333222111222333334444455555.
-\& 20:555554444433333222111222333334444455555.
-\& 19:555554444433333222111222333334444455555.
-\& 18:555554444433333222222222333334444455555.
-\& 17:555554444433333322222223333334444455555.
-\& 16:555554444433333332222233333334444455555.
-\& 15:555554444443333333333333333344444455555.
-\& 14:555555444444333333333333333444444555555.
-\& 13:.5555544444433333333333333344444455555..
-\& 12:.5555554444444333333333334444444555555..
-\& 11:..55555544444443333333334444444555555...
-\& 10:..55555544444444444444444444444555555...
-\& 9:...555555444444444444444444444555555....
-\& 8:....5555555444444444444444445555555.....
-\& 7:....5555555544444444444444455555555.....
-\& 6:.....55555555544444444444555555555......
-\& 5:......555555555555555555555555555.......
-\& 4:........55555555555555555555555.........
-\& 3:.........555555555555555555555..........
-\& 2:...........55555555555555555............
-\& 1:.............5555555555555..............
-.Ve
-.PP
-For boxes and ellipses, if an odd number of arguments is specified,
-then the last argument is assumed to be an angle. Otherwise, the
-angle is assumed to be zero. For example:
-.PP
-.Vb 1
-\& ellipse 20 20 3 5 6 10 9 15 12 20 45
-.Ve
-.PP
-specifies an 3 ellipses at a 45 degree angle:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:........................................
-\& 38:........................................
-\& 37:........................................
-\& 36:........33333333........................
-\& 35:......333333333333......................
-\& 34:.....3333333333333333...................
-\& 33:....333333333333333333..................
-\& 32:....33333332222233333333................
-\& 31:...3333332222222222333333...............
-\& 30:...33333222222222222233333..............
-\& 29:...333332222222222222223333.............
-\& 28:...3333222222211112222223333............
-\& 27:...33332222211111111222223333...........
-\& 26:...333322222111111111122223333..........
-\& 25:...3333222211111111111122223333.........
-\& 24:....3332222111111..1111122223333........
-\& 23:....333322211111.....11112222333........
-\& 22:....33332222111.......11112223333.......
-\& 21:.....33322221111.......11122223333......
-\& 20:.....33332221111.......11112223333......
-\& 19:.....33332222111.......11112222333......
-\& 18:......33332221111.......11122223333.....
-\& 17:.......33322221111.....111112223333.....
-\& 16:.......3333222211111..1111112222333.....
-\& 15:........3333222211111111111122223333....
-\& 14:.........333322221111111111222223333....
-\& 13:..........33332222211111111222223333....
-\& 12:...........3333222222111122222223333....
-\& 11:............333322222222222222233333....
-\& 10:.............33333222222222222233333....
-\& 9:..............3333332222222222333333....
-\& 8:...............33333333222223333333.....
-\& 7:.................333333333333333333.....
-\& 6:..................3333333333333333......
-\& 5:.....................333333333333.......
-\& 4:.......................33333333.........
-\& 3:........................................
-\& 2:........................................
-\& 1:........................................
-.Ve
-.PP
-Note in the above example that the lower limit is not part of the
-region for boxes, circles, and ellipses. This makes circles and annuli
-equivalent, i.e.:
-.PP
-.Vb 2
-\& circle 20 20 5 10 15 20
-\& annulus 20 20 5 10 15 20
-.Ve
-.PP
-both give the following region mask:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........................................
-\& 39:.............3333333333333..............
-\& 38:...........33333333333333333............
-\& 37:.........333333333333333333333..........
-\& 36:........33333333333333333333333.........
-\& 35:......333333333333333333333333333.......
-\& 34:.....33333333322222222222333333333......
-\& 33:....3333333322222222222222233333333.....
-\& 32:....3333333222222222222222223333333.....
-\& 31:...333333222222222222222222222333333....
-\& 30:..33333322222222222222222222222333333...
-\& 29:..33333322222221111111112222222333333...
-\& 28:.3333332222222111111111112222222333333..
-\& 27:.3333322222211111111111111122222233333..
-\& 26:333333222222111111111111111222222333333.
-\& 25:333332222221111111111111111122222233333.
-\& 24:33333222221111111.....11111112222233333.
-\& 23:3333322222111111.......1111112222233333.
-\& 22:333332222211111.........111112222233333.
-\& 21:333332222211111.........111112222233333.
-\& 20:333332222211111.........111112222233333.
-\& 19:333332222211111.........111112222233333.
-\& 18:333332222211111.........111112222233333.
-\& 17:3333322222111111.......1111112222233333.
-\& 16:33333222221111111.....11111112222233333.
-\& 15:333332222221111111111111111122222233333.
-\& 14:333333222222111111111111111222222333333.
-\& 13:.3333322222211111111111111122222233333..
-\& 12:.3333332222222111111111112222222333333..
-\& 11:..33333322222221111111112222222333333...
-\& 10:..33333322222222222222222222222333333...
-\& 9:...333333222222222222222222222333333....
-\& 8:....3333333222222222222222223333333.....
-\& 7:....3333333322222222222222233333333.....
-\& 6:.....33333333322222222222333333333......
-\& 5:......333333333333333333333333333.......
-\& 4:........33333333333333333333333.........
-\& 3:.........333333333333333333333..........
-\& 2:...........33333333333333333............
-\& 1:.............3333333333333..............
-.Ve
-.PP
-As a final example, specifying several angles in one pie slice
-expression is equivalent to specifying several separate slices with
-the same center. As with the annulus, if \fBN\fR angles are
-specified, then \fBN\fR\-1 slices result, with the ending angle of
-each preceding slice being the starting angle of the succeeding slice.
-Each slice is considered a separate region, and is given a separate
-mask value. For example,
-.PP
-.Vb 1
-\& PIE 12 12 315 45 115 270
-.Ve
-.PP
-specifies three regions as shown below:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:2222222222222222222222222222222222222222
-\& 39:2222222222222222222222222222222222222221
-\& 38:2222222222222222222222222222222222222211
-\& 37:2222222222222222222222222222222222222111
-\& 36:2222222222222222222222222222222222221111
-\& 35:3222222222222222222222222222222222211111
-\& 34:3222222222222222222222222222222222111111
-\& 33:3322222222222222222222222222222221111111
-\& 32:3322222222222222222222222222222211111111
-\& 31:3332222222222222222222222222222111111111
-\& 30:3332222222222222222222222222221111111111
-\& 29:3333222222222222222222222222211111111111
-\& 28:3333222222222222222222222222111111111111
-\& 27:3333322222222222222222222221111111111111
-\& 26:3333322222222222222222222211111111111111
-\& 25:3333322222222222222222222111111111111111
-\& 24:3333332222222222222222221111111111111111
-\& 23:3333332222222222222222211111111111111111
-\& 22:3333333222222222222222111111111111111111
-\& 21:3333333222222222222221111111111111111111
-\& 20:3333333322222222222211111111111111111111
-\& 19:3333333322222222222111111111111111111111
-\& 18:3333333332222222221111111111111111111111
-\& 17:3333333332222222211111111111111111111111
-\& 16:3333333333222222111111111111111111111111
-\& 15:3333333333222221111111111111111111111111
-\& 14:3333333333322211111111111111111111111111
-\& 13:3333333333322111111111111111111111111111
-\& 12:33333333333.1111111111111111111111111111
-\& 11:3333333333331111111111111111111111111111
-\& 10:333333333333.111111111111111111111111111
-\& 9:333333333333..11111111111111111111111111
-\& 8:333333333333...1111111111111111111111111
-\& 7:333333333333....111111111111111111111111
-\& 6:333333333333.....11111111111111111111111
-\& 5:333333333333......1111111111111111111111
-\& 4:333333333333.......111111111111111111111
-\& 3:333333333333........11111111111111111111
-\& 2:333333333333.........1111111111111111111
-\& 1:333333333333..........111111111111111111
-.Ve
-.PP
-The annulus, box, circle, ellipse, and pie shapes also accept an
-\&\fBn=[int]\fR syntax for specifying multiple regions. The
-\&\fBn=[int]\fRsyntax interprets the previous (shape\-dependent)
-arguments as lower and upper limits for the region and creates n
-shapes with evenly spaced boundaries. For example, if \fBn=[int]\fR
-is specified in an annulus, the two immediately preceding radii
-(\fBrn\fR and \fBrm\fR) are divided into \fBint\fR annuli, such
-that the inner radius of the first is \fBrn\fR and the outer radius
-of the last is \fBrm\fR. For example,
-.PP
-.Vb 1
-\& ANNULUS 20 20 5 20 n=3
-.Ve
-.PP
-is equivalent to:
-.PP
-.Vb 1
-\& ANNULUS 20 20 5 10 15 20
-.Ve
-.PP
-If this syntax is used with an ellipse or box, then the two preceding
-pairs of values are taken to be lower and upper limits for a set of
-ellipses or boxes. A circle uses the two preceding arguments for upper
-and lower radii. For pie, the two preceding angles are divided into n
-wedges such that the starting angle of the first is the lower bound
-and the ending angle of the last is the upper bound. In all cases,
-the \fBn=[int]\fR syntax allows any single alphabetic character
-before the \*(L"=\*(R", i.e, i=3, z=3, etc. are all equivalent.
-.PP
-Also note that for boxes and ellipses, the optional angle argument is
-always specified after the \fBn=[int]\fR syntax. For example:
-.PP
-.Vb 1
-\& ellipse 20 20 4 6 16 24 n=3 45
-.Ve
-.PP
-specifies 3 elliptical regions at an angle of 45 degrees:
-.PP
-.Vb 42
-\& 1234567890123456789012345678901234567890
-\& ----------------------------------------
-\& 40:........33333333........................
-\& 39:.....33333333333333.....................
-\& 38:....33333333333333333...................
-\& 37:...33333333333333333333.................
-\& 36:..33333333333333333333333...............
-\& 35:.3333333333222223333333333..............
-\& 34:3333333322222222222233333333............
-\& 33:33333332222222222222223333333...........
-\& 32:333333222222222222222222333333..........
-\& 31:3333322222222222222222222333333.........
-\& 30:33333222222222111122222222333333........
-\& 29:333332222222111111112222222333333.......
-\& 28:3333222222211111111111222222333333......
-\& 27:3333222222111111111111112222233333......
-\& 26:33332222221111111111111112222233333.....
-\& 25:33332222211111111.111111112222233333....
-\& 24:333322222111111......111111222223333....
-\& 23:333322222111111.......111112222233333...
-\& 22:33333222221111.........11111222223333...
-\& 21:333332222211111.........11112222233333..
-\& 20:.33332222211111.........11111222223333..
-\& 19:.33333222221111.........111112222233333.
-\& 18:..33332222211111.........11112222233333.
-\& 17:..333332222211111.......111111222233333.
-\& 16:...333322222111111......111111222223333.
-\& 15:...333332222211111111.111111112222233333
-\& 14:....333332222211111111111111122222233333
-\& 13:.....33333222221111111111111122222233333
-\& 12:.....33333322222211111111111222222233333
-\& 11:......3333332222222111111112222222333333
-\& 10:.......333333222222221111222222222333333
-\& 9:........33333322222222222222222222333333
-\& 8:.........333333222222222222222222333333.
-\& 7:..........33333332222222222222223333333.
-\& 6:...........3333333322222222222233333333.
-\& 5:.............3333333333222223333333333..
-\& 4:..............33333333333333333333333...
-\& 3:................33333333333333333333....
-\& 2:..................33333333333333333.....
-\& 1:....................33333333333333......
-.Ve
-.PP
-Both the variable argument syntax and the \fBn=[int]\fR syntax must
-occur alone in a region descriptor (aside from the optional angle for
-boxes and ellipses). They cannot be combined. Thus, it is not valid
-to precede or follow an \fBn=[int]\fR accelerator with more angles or
-radii, as in this example:
-.PP
-.Vb 3
-\& # INVALID -- one too many angles before a=5 ...
-\& # and no angles are allowed after a=5
-\& PIE 12 12 10 25 50 a=5 85 135
-.Ve
-.PP
-Instead, use three separate specifications, such as:
-.PP
-.Vb 3
-\& PIE 12 12 10 25
-\& PIE 12 12 25 50 a=5
-\& PIE 12 12 85 135
-.Ve
-.PP
-The original (\s-1IRAF\s0) implementation of region filtering permitted this
-looser syntax, but we found it caused more confusion than it was worth
-and therefore removed it.
-.PP
-\&\s-1NB:\s0 Accelerators may be combined with other shapes in a boolean
-expression in any order. (This is a change starting with funtools
-v1.1.1. Prior to this release, the accelerator shape had to be
-specified last). The actual region mask id values returned depend on the
-order in which the shapes are specified, although the total number of
-pixels or rows that pass the filter will be consistent. For this
-reason, use of accelerators in boolean expressions is discouraged in
-programs such as funcnts, where region mask id values are used
-to count events or image pixels.
-.PP
-[All region masks displayed in this document were generated using the
-\&\fBfundisp\fR routine and the undocumented \*(L"mask=all\*(R" argument (with
-spaced removed using sed ):
-.PP
-.Vb 2
-\& fundisp "funtools/funtest/test40.fits[ANNULUS 25 25 5 10]" mask=all |\e
-\& sed 's/ //g'
-.Ve
-.PP
-Note that you must supply an image of the appropriate size \*(-- in this case,
-a \s-1FITS\s0 image of dimension 40x40 is used.]
-.SH "SEE ALSO"
-.IX Header "SEE ALSO"
-See funtools(7) for a list of Funtools help pages
diff --git a/funtools/mkconfigure b/funtools/mkconfigure
deleted file mode 100755
index b022ade..0000000
--- a/funtools/mkconfigure
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-# directories needing configure files
-DIRS=". wcs filter fitsy util"
-
-# is autoconf installed?
-hash autoconf 1>/dev/null 2>&1
-if [ $? = 0 ]; then
- echo "autoconf installed ... generating configure files ..."
- HAS_AUTOCONF=true
-else
- echo "autoconf not installed ... copying failsafe configure files ..."
- HAS_AUTOCONF=false
-fi
-
-# recreate configure files
-for d in $DIRS; do
- if [ x${HAS_AUTOCONF} = xtrue ]; then
- (cd $d && autoconf)
- else
- (cd $d && cp -p configure-failsafe configure)
- fi
-done
diff --git a/funtools/mkfunmainlib b/funtools/mkfunmainlib
deleted file mode 100755
index 3cbc6bd..0000000
--- a/funtools/mkfunmainlib
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-if [ x"$1" = x"-tcl" ]; then
- DOTCL=1
-else
- DOTCL=0
-fi
-
-awk '
-BEGIN{
- dotcl='$DOTCL'
- if( dotcl == 0 ){
- printf("#include <mainlib.h>\n\n")
- }
- else{
- printf("#include <tclmainlib.h>\n\n")
- }
- printf("\n");
- j = 0
-}
-{
- for(i=1; i<=NF; i++){
- name[j] = $i
- printf("int %s_main _PRx((int argc, char **argv));\n", $i)
- j++
- }
-}
-END{
- if( dotcl == 0 ){
- printf("\n")
- printf("void *funtoolsMainLibInit(void)\n")
- printf("{\n")
- printf(" MainLib ml;\n")
- printf(" if( !(ml=MainLibNew()) )\n");
- printf(" return NULL;\n");
- for(i=0; i<j; i++){
- printf(" if( !MainLibAdd(ml, \"funtools\", \"%s\", %s_main, MAINLIB_ARGV) )\n", name[i], name[i])
- printf(" return NULL;\n");
- }
- printf(" return ml;\n");
- printf("}\n")
- printf("\n")
- }
- else{
- printf("\n")
- printf("#include <tcl.h>\n")
- printf("\n")
- printf("int Tclfun_Init (void *vinterp)\n")
- printf("{\n")
- printf(" Tcl_Interp *interp = (Tcl_Interp *)vinterp;\n")
- printf("\n")
- for(i=0; i<j; i++){
- printf(" Tcl_CreateObjCommand(interp, \"%s\", MainLibProcess_Tcl,\n", name[i])
- printf(" (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);\n")
- }
- printf(" Tcl_CreateObjCommand(interp, \"mainlib\", MainLibProcess_Tcl,\n")
- printf(" (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);\n")
- printf(" Tcl_CreateObjCommand(interp, \"mainlibcleanup\", MainLibProcessCleanup_Tcl,\n")
- printf(" (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);\n")
- printf(" Tcl_CreateObjCommand(interp, \"mainlibload\", MainLibLoad_Tcl,\n")
- printf(" (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);\n")
- printf(" Tcl_PkgProvide(interp, \"tclfun\", \"1.0\");\n")
- printf(" return(TCL_OK);\n")
- printf("}\n")
- printf("\n")
- }
-}
-'
diff --git a/funtools/mklib b/funtools/mklib
deleted file mode 100755
index c900b3e..0000000
--- a/funtools/mklib
+++ /dev/null
@@ -1,880 +0,0 @@
-#!/bin/sh
-
-# Make a shared library.
-# This script should be useful for projects other than Mesa.
-# Improvements/fixes are welcome.
-
-
-# Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-#
-# Option defaults
-#
-LIBNAME=""
-MAJOR=1
-MINOR=0
-PATCH=""
-DEPS=""
-LINK=""
-LDFLAGS=""
-CPLUSPLUS=0
-STATIC=0
-DLOPEN=0
-INSTALLDIR="."
-ARCH="auto"
-ARCHOPT=""
-NOPREFIX=0
-EXPORTS=""
-
-
-#
-# Parse arguments
-#
-while true
-do
- case $1 in
- '-h' | '--help')
- echo 'Usage: mklib [options] objects'
- echo 'Create a shared library from object files.'
- echo ' -o LIBRARY specifies the name of the resulting library, without'
- echo ' the leading "lib" or any suffix.'
- echo ' (eg: "-o GL" might result in "libGL.so" being made)'
- echo ' -major N specifies major version number (default is 1)'
- echo ' -minor N specifies minor version number (default is 0)'
- echo ' -patch N specifies patch version number (default is 0)'
- echo ' -lLIBRARY specifies a dependency on LIBRARY'
- echo ' -LDIR search in DIR for library dependencies'
- echo ' -linker L explicity specify the linker program to use (eg: gcc, g++)'
- echo ' Not observed on all systems at this time.'
- echo ' -ldflags OPT specify any additional linker flags in OPT'
- echo ' -cplusplus link with C++ runtime'
- echo ' -static make a static library (default is dynamic/shared)'
- echo ' -dlopen make a shared library suitable for dynamic loading'
- echo ' -install DIR put resulting library file(s) in DIR'
- echo ' -arch ARCH override using `uname` to determine host system'
- echo ' -archopt OPT specify an extra achitecture-specific option OPT'
- echo ' -altopts OPTS alternate options to override all others'
- echo " -noprefix don't prefix library name with 'lib' nor add any suffix"
- echo ' -exports FILE only export the symbols listed in FILE'
- echo ' -h, --help display this information and exit'
- exit 1
- ;;
- '-o')
- shift 1;
- LIBNAME=$1
- ;;
- '-major')
- shift 1;
- MAJOR=$1
- ;;
- '-minor')
- shift 1;
- MINOR=$1
- ;;
- '-patch')
- shift 1;
- PATCH=$1
- ;;
- '-linker')
- shift 1;
- LINK=$1
- ;;
- '-ldflags')
- shift 1;
- LDFLAGS=$1
- ;;
- -l*)
- DEPS="$DEPS $1"
- ;;
- -L*)
- DEPS="$DEPS $1"
- ;;
- -pthread)
- # this is a special case (see bugzilla 10876)
- DEPS="$DEPS $1"
- ;;
- -Wl*)
- # Another special case for DragonFly
- DEPS="$DEPS $1"
- ;;
- -Wl*)
- DEPS="$DEPS $1"
- ;;
- '-pthread')
- DEPS="$DEPS -pthread"
- ;;
- '-cplusplus')
- CPLUSPLUS=1
- ;;
- '-static')
- STATIC=1
- ;;
- '-dlopen')
- DLOPEN=1
- ;;
- '-install')
- shift 1;
- INSTALLDIR=$1
- ;;
- '-arch')
- shift 1;
- ARCH=$1
- ;;
- '-archopt')
- shift 1;
- ARCHOPT=$1
- ;;
- '-altopts')
- shift 1;
- ALTOPTS=$1
- ;;
- '-noprefix')
- NOPREFIX=1
- ;;
- '-exports')
- shift 1;
- EXPORTS=$1
- ;;
- -*)
- echo "mklib: Unknown option: " $1 ;
- exit 1
- ;;
- *)
- # This should be the first object file, stop parsing
- break
- esac
- shift 1
-done
-OBJECTS=$@
-
-
-if [ ${ARCH} = "auto" ] ; then
- ARCH=`uname`
-fi
-
-
-#
-# Error checking
-#
-if [ "x${LIBNAME}" = "x" ] ; then
- echo "mklib: Error: no library name specified"
- exit 1
-fi
-if [ "x${OBJECTS}" = "x" ] ; then
- echo "mklib: Error: no object files specified"
- exit 1
-fi
-
-
-#
-# Debugging info
-#
-if [ ] ; then
- echo "-----------------"
- echo ARCH is $ARCH
- echo LIBNAME is $LIBNAME
- echo MAJOR is $MAJOR
- echo MINOR is $MINOR
- echo PATCH is $PATCH
- echo DEPS are $DEPS
- echo "EXPORTS in" $EXPORTS
- echo "-----------------"
-fi
-
-
-#
-# OK, make the library now
-#
-case $ARCH in
-
- 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*)
- # we assume gcc
-
- if [ "x$LINK" = "x" ] ; then
- # -linker was not specified so set default link command now
- if [ $CPLUSPLUS = 1 ] ; then
- LINK=g++
- else
- LINK=gcc
- fi
- fi
-
- if [ $NOPREFIX = 1 ] ; then
- # No "lib" or ".so" part
- echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
- case $ARCH in 'Linux' | 'GNU' | GNU/*)
- OPTS="-Xlinker -Bsymbolic -shared"
- ;;
- *)
- OPTS="-shared"
- ;;
- esac
-
- # Check if objects are 32-bit and we're running in 64-bit
- # environment. If so, pass -m32 flag to linker.
- set ${OBJECTS}
- ABI32=`file $1 | grep 32-bit`
- if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
- OPTS="-m32 ${OPTS}"
- fi
-
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
-
- rm -f ${LIBNAME}
- # make lib
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
- # finish up
- FINAL_LIBS="${LIBNAME}"
- elif [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a" # prefix with "lib", suffix with ".a"
- echo "mklib: Making" $ARCH "static library: " ${LIBNAME}
- LINK="ar"
- OPTS="-ru"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- rm -f ${LIBNAME}
- # make lib
- ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
- ranlib ${LIBNAME}
- # finish up
- FINAL_LIBS=${LIBNAME}
- else
- LIBNAME="lib${LIBNAME}" # prefix with "lib"
- case $ARCH in 'Linux' | 'GNU' | GNU/*)
- OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
- ;;
- *)
- OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
- ;;
- esac
- if [ $EXPORTS ] ; then
- #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
- # Make the 'exptmp' file for --version-script option
- echo "{" > exptmp
- echo "global:" >> exptmp
- sed 's/$/;/' ${EXPORTS} >> exptmp
- echo "local:" >> exptmp
- echo "*;" >> exptmp
- echo "};" >> exptmp
- OPTS="${OPTS} -Xlinker --version-script=exptmp"
- # exptmp is removed below
- fi
-
- # Check if objects are 32-bit and we're running in 64-bit
- # environment. If so, pass -m32 flag to linker.
- set ${OBJECTS}
- ABI32=`file $1 | grep 32-bit`
- if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
- OPTS="-m32 ${OPTS}"
- fi
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
-
- if [ x${PATCH} = "x" ] ; then
- VERSION="${MAJOR}.${MINOR}"
- else
- VERSION="${MAJOR}.${MINOR}.${PATCH}"
- fi
-
- echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION}
-
- # rm any old libs
- rm -f ${LIBNAME}.so.${VERSION}
- rm -f ${LIBNAME}.so.${MAJOR}
- rm -f ${LIBNAME}.so
-
- # make lib
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
- # make usual symlinks
- ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
- ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
- # finish up
- FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
-# rm -f exptmp
- fi
- ;;
-
- 'SunOS')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making SunOS static library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar -ruv ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- if [ $NOPREFIX = 0 ] ; then
- LIBNAME="lib${LIBNAME}.so"
- fi
- echo "mklib: Making SunOS shared library: " ${LIBNAME}
-
- if [ "x$LINK" = "x" ] ; then
- # -linker was not specified, choose default linker now
- if [ $CPLUSPLUS = 1 ] ; then
- # determine linker and options for C++ code
- if [ `which c++` ] ; then
- # use Sun c++
- LINK="c++"
- elif [ `type g++` ] ; then
- # use g++
- LINK="g++"
- else
- echo "mklib: warning: can't find C++ comiler, trying CC."
- LINK="CC"
- fi
- else
- # use native Sun linker for C code
- LINK="ld"
- fi
- fi
-
- # linker options
- if [ ${LINK} = "ld" -o ${LINK} = "cc" -o ${LINK} = "CC" ] ; then
- # SunOS tools, -G to make shared libs
- OPTS="-G"
- else
- # gcc linker
- # Check if objects are 32-bit and we're running in 64-bit
- # environment. If so, pass -m32 flag to linker.
- set ${OBJECTS}
- ABI32=`file $1 | grep 32-bit`
- if [ "${ABI32}" ] ; then
- OPTS="-m32 -shared -Wl,-Bdynamic"
- else
- OPTS="-m64 -shared -Wl,-Bdynamic"
- fi
- fi
-
- # Check if objects are SPARC v9
- # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
- set ${OBJECTS}
- SPARCV9=`file $1 | grep SPARCV9`
- if [ "${SPARCV9}" ] ; then
- OPTS="${OPTS} -xarch=v9"
- fi
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- # for debug:
- #echo "mklib: linker is" ${LINK} ${OPTS}
- if [ $NOPREFIX = 1 ] ; then
- rm -f ${LIBNAME}
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
- else
- rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
- ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
- fi
- FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
- fi
- ;;
-
- 'FreeBSD')
- # we assume gcc
-
- if [ "x$LINK" = "x" ] ; then
- # -linker was not specified so set default link command now
- if [ $CPLUSPLUS = 1 ] ; then
- LINK=g++
- else
- LINK=gcc
- fi
- fi
-
- if [ $NOPREFIX = 1 ] ; then
- # No "lib" or ".so" part
- echo "mklib: Making FreeBSD shared library: " ${LIBNAME}
- OPTS="-shared"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- rm -f ${LIBNAME}
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
- FINAL_LIBS=${LIBNAME}
- elif [ $STATIC = 1 ] ; then
- STLIB="lib${LIBNAME}.a"
- echo "mklib: Making FreeBSD static library: " ${STLIB}
- rm -f ${STLIB}
- ar cq ${STLIB} ${OBJECTS}
- ranlib ${STLIB}
- FINAL_LIBS=${STLIB}
- else
- SHLIB="lib${LIBNAME}.so.${MAJOR}"
- OPTS="-shared -Wl,-soname,${SHLIB}"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- echo "mklib: Making FreeBSD shared library: " ${SHLIB}
- rm -f ${SHLIB}
- ${LINK} ${OPTS} ${LDFLAGS} -o ${SHLIB} ${OBJECTS} ${DEPS}
- ln -sf ${SHLIB} "lib${LIBNAME}.so"
- FINAL_LIBS="${SHLIB} lib${LIBNAME}.so"
- fi
- ;;
-
- 'NetBSD')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}_pic.a"
- echo "mklib: Making NetBSD PIC static library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar cq ${LIBNAME} ${OBJECTS}
- ranlib ${LIBNAME}
- FINAL_LIBS=${LIBNAME}
- else
- LIBNAME="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
- echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ld -x -Bshareable -Bforcearchive -o ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- fi
- ;;
-
- 'IRIX' | 'IRIX64')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- rm -f ${LIBNAME}
- ar rc ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
-
- # examine first object to determine ABI
- set ${OBJECTS}
- ABI_O32=`file $1 | grep 'ELF 32-bit'`
- ABI_N32=`file $1 | grep 'ELF N32'`
- ABI_N64=`file $1 | grep 'ELF 64-bit'`
- if [ "${ABI_O32}" ] ; then
- OPTS="-32 -shared -all"
- ABI="o32-bit"
- elif [ "${ABI_N32}" ] ; then
- OPTS="-n32 -shared -all"
- ABI="n32-bit"
- elif [ "${ABI_N64}" ] ; then
- OPTS="-64 -shared -all"
- ABI="64-bit"
- else
- echo "Error: Unexpected IRIX ABI!"
- exit 1
- fi
-
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
-
- if [ $CPLUSPLUS = 1 ] ; then
- LINK="CC"
- else
- LINK="ld"
- fi
-
- echo "mklib: Making IRIX " ${ABI} " shared library: " ${LIBNAME}
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
- FINAL_LIBS=${LIBNAME}
- fi
- ;;
-
- 'linux-cygwin')
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making linux-cygwin library: " ${LIBNAME}
- rm -f ${LIBNAME}
- gnuwin32ar ruv ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- ;;
-
- 'HP-UX')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making HP-UX static library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar -ruv ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- # HP uses a .2 for their current GL/GLU libraries
- if [ ${LIBNAME} = "GL" -o ${LIBNAME} = "GLU" ] ; then
- MAJOR=2
- fi
- RUNLIB="lib${LIBNAME}.${MAJOR}"
- DEVLIB="lib${LIBNAME}.sl"
- echo "mklib: Making HP-UX shared library: " ${RUNLIB} ${DEVLIB}
- ld -b -o ${RUNLIB} +b ${RUNLIB} ${OBJECTS} ${DEPS}
- ln -s ${RUNLIB} ${DEVLIB}
- FINAL_LIBS="${RUNLIB} ${DEVLIB}"
- fi
- ;;
-
- 'AIX' )
- # examine first object to determine ABI
- set ${OBJECTS}
- ABI_64=`file $1 | grep '64-bit'`
- if [ "${ABI_64}" ] ; then
- X64="-X64"
- Q64="-q64"
- OFILE=shr_64.o
- else
- OFILE=shr.o #Want to be consistent with the IBM libGL.a
- fi
-
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making AIX static library: " ${LIBNAME}
- ar -ruv ${X64} ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- EXPFILE="lib${LIBNAME}.exp"
- LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries
- OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry ${Q64}"
- rm -f ${EXPFILE} ${OFILE}
- NM="/bin/nm -eC ${X64}"
- echo "#! /usr/lib/${LIBNAME}" > ${EXPFILE}
- ${NM} ${OBJECTS} | awk '{
- if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
- && ( substr($1,1,1) != ".")) {
- if (substr ($1, 1, 7) != "__sinit" &&
- substr ($1, 1, 7) != "__sterm") {
- if (substr ($1, 1, 5) == "__tf1")
- print (substr ($1, 7))
- else if (substr ($1, 1, 5) == "__tf9")
- print (substr ($1, 15))
- else
- print $1
- }
- }
- }' | sort -u >> ${EXPFILE}
-
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
-
- # On AIX a shared library is linked differently when
- # you want to dlopen the file
- if [ $DLOPEN = "1" ] ; then
- cc -G ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
- else
- cc ${OPTS} ${LDFLAGS} -o ${OFILE} ${OBJECTS} ${DEPS}
- ar ${X64} -r ${LIBNAME} ${OFILE}
- fi
-
- FINAL_LIBS="${LIBNAME}"
- fi
- ;;
-
- 'OpenSTEP')
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making OpenSTEP static library: " ${LIBNAME}
- libtool -static -o ${LIBNAME} - ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- ;;
-
- 'OSF1')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making OSF/1 static library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar -ruv ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- VERSION="${MAJOR}.${MINOR}"
- LIBNAME="lib${LIBNAME}.so"
- echo "mklib: Making OSF/1 shared library: " ${LIBNAME}
- if [ "x$LINK" = "x" ] ; then
- if [ $CPLUSPLUS = 1 ] ; then
- LINK=cxx
- else
- LINK=cc
- fi
- fi
- rm -f ${LIBNAME}.${VERSION}
- ${LINK} -o ${LIBNAME}.${VERSION} -shared -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS}
- ln -sf ${LIBNAME}.${VERSION} ${LIBNAME}
- FINAL_LIBS="${LIBNAME} ${LIBNAME}.${VERSION}"
- fi
- ;;
-
- 'Darwin')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making Darwin static library: " ${LIBNAME}
- LINK="ar"
- OPTS="-ruvs"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- # On Darwin a .bundle is used for a library that you want to dlopen
- if [ $DLOPEN = "1" ] ; then
- LIBSUFFIX="bundle"
- OPTS="${ARCHOPT} -bundle -multiply_defined suppress"
- else
- LIBSUFFIX="dylib"
- OPTS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}"
- fi
-
- if [ ${EXPORTS} ] ; then
- OPTS="${OPTS} -exported_symbols_list ${EXPORTS}"
- fi
-
- LINKNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}"
- LINKNAME2="lib${LIBNAME}.${LIBSUFFIX}"
- LIBNAME="lib${LIBNAME}.${MAJOR}.${MINOR}.${LIBSUFFIX}"
-
- # examine first object to determine ABI
- set ${OBJECTS}
- ABI_PPC=`file $1 | grep ' ppc'`
- ABI_I386=`file $1 | grep ' i386'`
- ABI_PPC64=`file $1 | grep ' ppc64'`
- ABI_X86_64=`file $1 | grep ' x86_64'`
- if [ "${ABI_PPC}" ] ; then
- OPTS="${OPTS} -arch ppc"
- fi
- if [ "${ABI_I386}" ] ; then
- OPTS="${OPTS} -arch i386"
- fi
- if [ "${ABI_PPC64}" ] ; then
- OPTS="${OPTS} -arch ppc64"
- fi
- if [ "${ABI_X86_64}" ] ; then
- OPTS="${OPTS} -arch x86_64"
- fi
-
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
-
- # XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk
- # to OPTS here?
-
- # determine linker
- if [ $CPLUSPLUS = 1 ] ; then
- LINK="g++"
- else
- LINK="cc"
- fi
-
- echo "mklib: Making Darwin shared library: " ${LIBNAME}
-
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
- ln -s ${LIBNAME} ${LINKNAME}
- ln -s ${LIBNAME} ${LINKNAME2}
- FINAL_LIBS="${LIBNAME} ${LINKNAME} ${LINKNAME2}"
- fi
- ;;
-
- 'LynxOS')
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making LynxOS static library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar ru ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- ;;
-
- 'BeOS')
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making BeOS static library: " ${LIBNAME}
- ar -cru "${LIBNAME}" ${OBJECTS}
- else
- LIBNAME="lib${LIBNAME}.so"
- echo "mklib: Making BeOS shared library: " ${LIBNAME}
- gcc -nostart -Xlinker "-soname=${LIBNAME}" -L/Be/develop/lib/x86 -lbe ${DEPS} ${OBJECTS} -o "${LIBNAME}"
- mimeset -f "${LIBNAME}"
- # XXX remove the Mesa3D stuff here since mklib isn't mesa-specific.
- setversion "${LIBNAME}" -app ${MAJOR} ${MINOR} ${PATCH} -short "Powered by Mesa3D!" -long "Powered by Mesa3D!"
- fi
- FINAL_LIBS=${LIBNAME}
- ;;
-
- 'QNX')
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making QNX library: " ${LIBNAME}
- wlib ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- ;;
-
- 'MorphOS')
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making MorphOS library: " ${LIBNAME}
- ppc-morphos-ar rc ${LIBNAME} ${OBJECTS}
- FINAL_LIBS="${LIBNAME}"
- ;;
-
- 'icc' | 'icc-istatic')
- # Intel C compiler
- # This should get merged into the Linux code, above, since this isn't
- # really a different architecture.
- LIBNAME="lib${LIBNAME}" # prefix with "lib"
-
- if [ $STATIC = 1 ] ; then
- echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a
- LINK="ar"
- OPTS="-ruv"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- # make lib
- ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
- # finish up
- FINAL_LIBS="${LIBNAME}.a"
- else
- if [ $ARCH = icc-istatic ] ; then
- OPTS="-shared -i-static -cxxlib-icc"
- else
- OPTS="-shared"
- fi
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- VERSION="${MAJOR}.${MINOR}.${PATCH}"
- echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION}
-
- if [ $CPLUSPLUS = 1 ] ; then
- LINK="icpc"
- else
- LINK="icc"
- fi
- # rm any old libs
- rm -f ${LIBNAME}.so.${VERSION}
- rm -f ${LIBNAME}.so.${MAJOR}
- rm -f ${LIBNAME}.so
- # make lib
- ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
- # make usual symlinks
- ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
- ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
- # finish up
- FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
- fi
- ;;
-
- 'aix-gcc')
- # AIX with gcc
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making AIX GCC static library: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar ru ${LIBNAME} ${OBJECTS}
- FINAL_LIBS=${LIBNAME}
- else
- LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
- echo "mklib: Making AIX GCC shared library: " ${LIBNAME}
- # remove old lib
- rm -f ${LIBNAME}
- # make the lib
- gcc -shared -Wl,-G ${OBJECTS} ${DEPS} -o ${LIBNAME}
- # NOTE: the application linking with this library must specify
- # the -Wl,-brtl flags to gcc
- FINAL_LIBS=${LIBNAME}
- fi
- ;;
-
- 'ultrix')
- # XXX untested
- if [ $STATIC = 0 ] ; then
- echo "mklib: Warning shared libs not supported on Ultrix"
- fi
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making static library for Ultrix: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar ru ${LIBNAME} ${OBJECTS}
- FINAL_LIBS="${LIBNAME}"
- ;;
-
- CYGWIN*)
- # GCC-based environment
- CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
- LIBNAME="lib${LIBNAME}" # prefix with "lib"
-
- if [ $STATIC = 1 ] ; then
- echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
- LINK="ar"
- OPTS="-ru"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- # make lib
- ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
- ranlib ${LIBNAME}.a
- # finish up
- FINAL_LIBS=${LIBNAME}.a
- else
- OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
- if [ "${ALTOPTS}" ] ; then
- OPTS=${ALTOPTS}
- fi
- echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
-
- if [ $CPLUSPLUS = 1 ] ; then
- LINK="g++"
- else
- LINK="gcc"
- fi
-
- # rm any old libs
- rm -f ${LIBNAME}-${MAJOR}.dll
- rm -f ${LIBNAME}.dll.a
- rm -f ${LIBNAME}.a
-
- # make lib
- ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS}
- # make usual symlinks
- ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a
- # finish up
- FINAL_LIBS="${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a"
- # special case for installing in bin
- FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
- fi
- ;;
-
- 'example')
- # If you're adding support for a new architecture, you can
- # start with this:
- if [ $STATIC = 1 ] ; then
- LIBNAME="lib${LIBNAME}.a"
- echo "mklib: Making static library for example arch: " ${LIBNAME}
- rm -f ${LIBNAME}
- ar rv ${LIBNAME} ${OBJECTS}
- FINAL_LIBS="${LIBNAME}"
- else
- LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
- echo "mklib: Making shared library for example arch: " ${LIBNAME}
- ld -o ${LIBNAME} ${OBJECTS} ${DEPS}
- FINAL_LIBS="${LIBNAME}"
- fi
- ;;
-
- *)
- echo "mklib: ERROR: Don't know how to make a static/shared library for" ${ARCH}
- echo "mklib: Please add necessary commands to mklib script."
- ;;
-esac
-
-
-#
-# Put library files into installation directory if specified.
-#
-if [ ${INSTALLDIR} != "." ] ; then
- echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
- mv ${FINAL_LIBS} ${INSTALLDIR}/
-fi
diff --git a/funtools/notes/ds9.notes b/funtools/notes/ds9.notes
deleted file mode 100644
index 2d947d5..0000000
--- a/funtools/notes/ds9.notes
+++ /dev/null
@@ -1,90 +0,0 @@
- Extensions to Analysis specification syntax
- to support mainlib (internal) analysis
-
-# add user-specified name/value pair for analysis macro expansion
-set LIB $HOME/lib
-
-# xtype: for backward compatibility, default has type=external,
-# i.e. execute current sh -c "cmd"
-menu
-menu xtype=external
-
-# internal uses mainlib, requires package name and (maybe) shared object name
-menu xtype=internal package=funtools source=static
-menu xtype=internal package=funtools source=$LIB/libfuntoolsMainLib.dylib
-
-bind x xtype=internal package=funtools source=static
-bind x xtype=internal package=funtools source=$LIB/libfuntoolsMainLib.dylib
-
-Notes:
-
-1. set name val
-
-Add user-specified name and value to the macro expansion. Not
-specific to internal processing but will help with shared object pathnames.
-
-2. xtype=internal
-
-Execute a mainlib action by performing macro subsititution, generating
-an in-memory FITS file if necessary, and then calling:
-
- set result [mainlib "command"]
-
-Question: what triggers generation of in-memory FITS? Is it $file or a new
-keyword?
-
-3. source=static package=<name>
-
-Valid for xtype=internal only.
-
-Assumes that a routine named <name>MainLibInit() is linked into
-ds9. The name and entry point will have to be pre-loaded into a table
-so that the entry point for the routine can be looked up and
-executed. Calling sequence:
-
- int nameMainLibInit(void)
-
-returns 1 on success, 0 on failure.
-
-4. source=<shared object> package=<name>
-
-Valid for xtype=internal only.
-
-ds9 must call:
-
- int MainLibLoad(char *name, char *source, void **dl, char **ermsg)
-
-or the Tcl equivalent:
-
- set dl [mainlibload name source]
-
-to load shared object and call the init routine. This can be done either
-when processing the analysis specification or just before executing
-the command for the first time. The returned dl is the handle from
-dlopen and can be used with dlclose(), if desired.
-
-5. ds9 will link libfuntools.a into the executable, as usual.
-To access the mainlib support, we can either:
-
-a. link libfuntoolsMainLib.a into the executable and use source=static
-in the analysis menu. In this case, the static library is created using:
-
- make mainlib
-
-and requires --enable-mainlib=yes on the configure command line.
-
-b. we can load libfuntoolsMainLib.[so,dylib] and use source=<shobj>
-in the analysis menu. In this case, the dynamic library is created using:
-
- make shmainlib
-
-and requires --enable-mainlib=shared on the configure command line.
-
-Probably the static method is preferable so that funtools is part of a
-single execuable?
-
-6. The LD_LIBRARY_PATH is critical for loading shared libraries. How
-will we deal with this? One possibility is to add an argument to MainLibLoad()
-to specify a directory which gets added to LD_LIBRARY_PATH before the call
-to dlopen()???
-
diff --git a/funtools/notes/index.notes b/funtools/notes/index.notes
deleted file mode 100644
index 838633d..0000000
--- a/funtools/notes/index.notes
+++ /dev/null
@@ -1,30 +0,0 @@
-bynars: setenv B /pool7/eric/big.fits
-bynars: setenv BX /pool7/eric/big_chipx.ind
-
-# funtable filters 1 column
-bynars: time funtable big.fits'[chipx=78]' foo.fits
-9.74u 6.71s 1:05.59 25.0%
-bynars: time funtable big.fits'[chipx=78]' foo.fits
-8.99u 9.82s 1:02.83 29.9%
-bynars: time funtable big.fits'[chipx=78]' foo.fits
-9.09u 7.40s 1:06.21 24.9%
-
-# experimental index program filters 1 column
-bynars: time ./foo $B /pool7/eric/foo2.fits $BX chipx 78
-1.21u 1.57s 0:04.80 57.9%
-bynars: time ./foo $B /pool7/eric/foo2.fits $BX chipx 78
-1.24u 1.34s 0:02.71 95.2%
-bynars: time ./foo $B /pool7/eric/foo2.fits $BX chipx 78
-1.20u 1.42s 0:02.73 95.9%
-
-# funtable filters 2 columns
-bynars: time funtable big.fits'[chipx=78&&chipy=152]' foo.fits
-11.04u 6.96s 1:08.03 26.4%
-bynars: time funtable big.fits'[chipx=78&&chipy=152]' foo.fits
-11.18u 6.11s 1:07.29 25.6%
-
-# experimental index program filters 2 columns
-bynars: time ./foo $B /pool7/eric/foo2.fits $BX chipx 78 $BY chipy 152
-1.07u 1.00s 0:02.73 75.8%
-bynars: time ./foo $B /pool7/eric/foo2.fits $BX chipx 78 $BY chipy 152
-1.07u 0.89s 0:02.01 97.5%
diff --git a/funtools/notes/mainlib.notes b/funtools/notes/mainlib.notes
deleted file mode 100644
index a1e6c2b..0000000
--- a/funtools/notes/mainlib.notes
+++ /dev/null
@@ -1,68 +0,0 @@
-As see on Linux when running:
-
- saoconfig shmainlib
- make
- make shmainlib
- setenv LD_LIBRARY_PATH .
- gcc -g -o tmain -I. -I./util tmain.c libfuntoolsMainLib.a libfuntools.a -ldl -lm
-or
- gcc -g -o tmain -I. -I./util tmain.c libfuntools.a -ldl -lm
- ./tmain -s libfuntoolsMainLib.so $S "fundisp foo[cir(512,512,.1)]"
-
-gives:
-...
-0xb7ef80f4 0xb7ef80f4
-0xb7ef80f4
-0xb7ef80f4 0xb7ef80f4
-executing: fundisp "buf:0xb7f3e008:648000[cir(512,512,.1)]"
-0x8062650
-0x8062650 0x8062650
-
-The hex numbers are the address of the mainlibhead list header for
-mainlib records. How can this address change?
-
-We link tmain against either libutil.a or libfuntools.a to get the
-MainLibLoad() routine. When this routine is called, it loads the
-libfuntoolsMainLib.so library, and, using that library calls
-funtoolsMainLibInit(). This routine makes a bunch of MainLibNew()
-and uses mainlibhead in the static executable as the list head.
-
-Apparently, because we add -L. -lfuntools to the mklib command line:
-
- ./mklib -o $(PACKAGE)MainLib -L. -lfuntools $(PACKAGE)tmp/*.o; \
-
-libfuntools.so is loaded as well. This has the mainlib.o module in it,
-and of course, a new copy of mainlibhead.
-
-So, when MainLibProcess() is subsequently called, it probably comes
-from the shared object, not the statically linked executable. At any
-rate, it uses the mainllibhead from the shared object, which is NULL,
-and therefore does not see that fundisp has been defined.
-
-If we don't add -L. -lfuntools to the mklib command line:
-
- ./mklib -o $(PACKAGE)MainLib $(PACKAGE)tmp/*.o; \
-
-and remake the libfuntoolsMainLib.so file, we get an error when we try to run:
-
- make shmainlib
- mklib: Making Linux shared library: libfuntoolsMainLib.so.1.0
- ./tmain -s libfuntoolsMainLib.so $S "fundisp foo[cir(512,512,.1)]"
- can't load shared object libfuntoolsMainLib.so (./libfuntoolsMainLib.so: undefined symbol: SAOdtype)
-
-This is because the statically linked program does not call SAOdtype
-and therefore does not have it linked in. It must come from a loaded
-shared object.
-
-So we have to load a shared object to get funtools entry points, but we
-don't want a second copy of mainlibhead ...
-
-Even if we separate MainLibLoad from mainlib.c and don't explicitly
-load mainlib.c, we still get the wrong mainlibhead:
-
- nm tmain | egrep mainlib
- 08062650 b mainlibhead
- 08062654 b mainlibinit
- 08062658 b mainlib_path
- 080625f0 d mainlibundef
-
diff --git a/funtools/notes/mingw.notes b/funtools/notes/mingw.notes
deleted file mode 100644
index 75ec185..0000000
--- a/funtools/notes/mingw.notes
+++ /dev/null
@@ -1,12 +0,0 @@
-Since the gcc.exe install directory, C:\mingw\bin, is not in the
-Windows PATH, the FILTER_CC variable must be set. You have to use a
-Windows pathname, not a Posix pathname, because the Windows system()
-routine passes the string to the DOS shell.
-
- export FILTER_CC="C:\mingw\bin\gcc.exe"
-
-
-
-
-
-
diff --git a/funtools/notes/tcl.notes b/funtools/notes/tcl.notes
deleted file mode 100644
index 5662f2e..0000000
--- a/funtools/notes/tcl.notes
+++ /dev/null
@@ -1,10 +0,0 @@
-
-http://www.equi4.com/starkit.html
-
-"A Starkit is a wrapping mechanism for delivering an application in a
-self-contained, installation-free, and portable way. The name comes
-from being based on a StandAlone Runtime, called Tclkit."
-
-http://www.equi4.com/tkstarted.html
-
-http://www.equi4.com/papers/skpaper1.html
diff --git a/funtools/notes/text.notes b/funtools/notes/text.notes
deleted file mode 100644
index 48960ef..0000000
--- a/funtools/notes/text.notes
+++ /dev/null
@@ -1,29 +0,0 @@
-# keywords:
-foo 100
-foo : 100
-foo: 100
-foo = 100
-foo= 100
-
-# strings:
-foo /usr/local/bin
-foo: '/usr/local/bin /opt/local/bin'
-foo = "/usr/local/bin /opt/local/bin"
-
-# comments:
-foo foo1 /comment
-foo 'foo1 foo2 foo3' / comment
-foo /usr/local/bin / path dir
-foo "/usr/local/bin /opt/local/bin" / path dir
-foo "/usr/local/bin /opt/local/bin"/path dir
-
-# put it all together:
-http_ ref http://hea-www.cfa.harvard.edu / base URL
-http_ ref: http://hea-www.cfa.harvard.edu / base URL
-mypaths = "/usr/local/bin /opt/local/bin" / paths to use
-
-text support for funtools
-
-1. add "allowtypechange" option and die if data type for a column
-goes from int to float.
-
diff --git a/funtools/notes/view.notes b/funtools/notes/view.notes
deleted file mode 100644
index bd9db20..0000000
--- a/funtools/notes/view.notes
+++ /dev/null
@@ -1,261 +0,0 @@
-Views:
-
-We can implement views as pseudo files that actually refer to a row in a
-data base containing column, filter, and format specifiers for that view.
-
-To create a view:
-
- funview -p "format" -r "filter" -c "columns" view file
-
-This will make an entry into a data base having the form:
-
- view file columns filter format
- ---- ----------- ----------- ----------- --------------
-
-Data base name will be the first one found:
-
-1. getenv("FUN_VIEWBASE")
-2. ./.funtools.vu
-3. ~/.funtools.vu
-
-For example:
-
- funview -p "I=%3d" -r "cir 512 512 .1" -c "x y pha pi" myview snr.ev
-
-adds to database:
-
- view file columns filter format
- ---- ----------- ----------- ----------- --------------
- myview snr.ev x y pha pi cir 512 512 .1 I=%.3d
-
-Also:
-
- funview -d view # delete view from database
- funview -l # list views
-
-Of course, you can edit the database file directly (but does this avoid
-some needed checking?) ... and we might also have a GUI ...
-
-You then use the view id instead of a file in any funtools program,
-prefixed by v:, i.e.
-
- fundisp v:myview
- funtable v:myview foo.fits
-
-The first command will run fundisp on the associated file, but using
-the specified filter, column, and format spec. The second runs funtable,
-which has no need of the print format but still utilizes the filter
-and column specifiers.
-
-You can override any of the three view specifiers explicitly:
-
- fundisp v:myview'[cir 400 400 1]'
-
-uses the view format and column spec, but overrides the filter, while:
-
- fundisp -f "I=%5d" v:myview'[cir 400 400 1]' "x y time"
-
-overrides everything but the file name ... probably useless but at
-least consistent.
-
-The syntax of a view should support templates, so that the view filter,
-columns, and format parameters can be used with multiple files.
-
-For example:
-
- funview -p "I=%3d" -r "cir 512 512 .1" -c "x y pha pi" myview "*.ev"
-
-adds to data base:
-
- view file columns filter format
- ---- ----------- ----------- ----------- --------------
- myview *.ev x y pha pi cir 512 512 .1 I=%.3d
-
-You then explicitly use a template view for a file that matches the template
-by specifying the actual filename instead of the view:
-
- fundisp v:foo.ev
-
-Since foo.ev matches the *.ev template, this will use the myview
-columns, filter, and format on the foo.ev data file.
-
-Note possible conflict if a file name matches a view but ... we can
-avoid this to some extent by not allowing view names to contain ".",
-":", "/" (same sort of restriction in xpa).
-
-A view GUI can have a selectable option to tell funtools programs
-always to assume a file is a view, even if v: is not prepended. This means
-that, if you start the GUI and select the "auto view" switch, then:
-
- fundisp v:myview
-and
- fundisp myview
-
-will be handled identically. Without the GUI running, the v: prefix will
-be required.
-
-There should be a way to specify which view to use for a given file:
-
- fundisp v(fi3):foo.fits
-
-means use view fi3 on file foo.fits
-
- fundisp v(reg1,col2):foo.fits
-
-means use views reg1 and col2 (in that order) on file foo.fits.
-
-Wild idea: we can implement a join of files as a view (just like the
-big boy databases). I think we get this for free if FunOpen just
-opens a pipe: pseudo file (which is implemented and might actually
-work) instead of a disk file.
-
-Example: we define a view called "myjoin" to be:
-
- view file ...
- ---- ----------- ...
- myjoin "funjoin -j1 key -j2 key2 cat1.fits cat2.fits" ...
-
-where the implied output arg is stdout and then we can execute:
-
- fundisp v:myjoin
-
-and get the joined result. View filters and columns would be applied to the
-output and it all just might work ...
-
-Good points:
-
-Explicit specification of a pseudo-file "v:[viewid]" is unambiguous
-and alleviates the need to rely on a separate process to prevent
-accident use of a view. If you don't want to use the view, just don't
-specify it.
-
-Easy flexibility for overriding view parameters.
-
-Support for file templates allows default setups of filter, column,
-and formats (can even use "*" as the file for a global setup).
-
-Uses standard funtools file type paradigm (socket:, pipe:, shm: etc).
-
-If we can implement arbitrary commands as a view file type via pipe:
-(particularly funjoin), then our views will be similar (superset?) to
-SQL views (see below).
-
-Bad points:
-
-The original idea of changing getenv would have made extensions to the
-list of view parameters automatic. We now have to implement each
-access of a view parameter explicitly, as opposed to having getenv do
-it automatically. Actually, this is a two-edged sword: it also could
-be a bad thing that each and every getenv would look for a global value.
-
-Design:
-
-I. FunOpen("v:id", ....)
-
-To process a view file spec inside FunOpen():
-
-1. Look for view file, either in default (~/.funtools.views) or
-pointed to by FUN_VIEWFILE. If it does not exist, return ERROR.
-
-2. If filespec contains a directory character ("/") go to 4.
-
-3. ID or simple file: Strip off and save filter spec. Look for ID
-name. If not found, go to 4. If found, replace input name with FILE
-name. If no filter spec is specified, use FILTER, otherwise use
-(override) filter spec. Save column spec for later use by
-FunColumnActivate.
-
-4. Pathname or Simple file: Try to match file spec again template
-FILEs. If found, replace input name with FILE name. If no filter spec
-is specified, use FILTER, otherwise use (override) filter spec. Save
-column spec for later use by FunColumnActivate.
-
-II. FunColumnActivate(fun, columns, plist)
-
-1. If columns != NULL, use columns (might be override).
-
-2. If columns == NULL and fun->view_columns, use it.
-
-3. If columns == NULL and !fun->view_columns, just return.
-
------------------------------------------------------------------------------
-
- Views in SQL
-
-See: http://www.cs.unibo.it/~ciaccia/COURSES/RESOURCES/SQLTutorial/sqlch5.htm
-
-5.2 VIEWS. (Virtual Tables and Data Security)
-
-A View, as we will see, is a definition for a "virtual table" (virtual
-because there is no permanent allocation of storage space) which is
-assembled at reference time from selected rows and/or columns of one
-or more real tables.
-
-A view may be queried in exactly the same way as a real table.
-
-Views are useful for two main reasons:
-
-1) they enable users to see data, from a generalised database design, in the form most convenient for their needs.
-
-2) they may be employed as a security mechanism for restricting user access to specific tables columns and/or rows.
-
-The statement used to create a view has the following general form:
-
-CREATE VIEW view-name [( column-list )]
-
-AS SELECT column-list
-
-FROM table-list
-
-WHERE conditional-expression ;
-
-You can display the specification of the views you have created using
-the help statement whose general syntax is as follows:
-
-help view view_name {,view_name}
-
-When a view is no longer required it may be dropped from the database
-with the DROP statement:
-
-DROP VIEW table-name ;
-
-5.2.1 Views Designed to Simplify Queries.
-
-As we noted with Example 4.5.4, there are no direct flights from
-Heathrow (HROW) to Brussels (BRUS). To simplify the query required to
-list the departure times of interconnecting flights we will specify a
-view called Brussels-Link.
-
-CREATE VIEW Brussels_Link
-
-AS SELECT DISTINCT B.FlightNo,B.FromAirport,
-
-B.DepTime, B.ArrTime
-
-FROM Flight A, Flight B
-
-WHERE A.FromAirport = 'HROW'
-
-AND A.ToAirport = B.FromAirport
-
-AND B.ToAirport = 'BRUS' ;
-
-Example 5.2.1 - List the FlightNo's, Airport's, Departure and Arrival
-times for flights from 1500 which link Heathrow with Brussels.
-
-SELECT FromAirport, FlightNo, DepTime, ArrTime
-
-FROM Brussels_Link
-
-WHERE DepTime >= '15:00';
-
-Result:
-
-fromai flightn deptime arrtime
-
-BIRM BD655 15:00 17:05
-BIRM BD657 17:30 19:35
-BIRM BD659 18:25 20:30
-
-
-
diff --git a/funtools/ofuntools.h b/funtools/ofuntools.h
deleted file mode 100644
index 7488821..0000000
--- a/funtools/ofuntools.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * funtools.h
- *
- */
-
-#ifndef __funtools_h
-#define __funtools_h
-
-/* avoid use of system -- its not secure */
-/* but funtools cannot use launch for the Cygwin platform because the stdfiles
- support is missing in the Cygwin implementation of launch */
-#ifndef USE_LAUNCH
-#define USE_LAUNCH 1
-#endif
-#if HAVE_CYGWIN
-#undef USE_LAUNCH
-#endif
-
-#define FUN_MAJOR_VERSION 1
-#define FUN_MINOR_VERSION 4
-#define FUN_PATCH_LEVEL 6
-#define FUN_VERSION "1.4.6"
-
-#ifndef FUNTOOLS_PRIVATE
-#include "prsetup.h"
-#define USE_XFILEIO 1
-#include "fitsy.h"
-#undef USE_XFILEIO
-#include "wcs.h"
-typedef void *Fun;
-#endif
-
-/* types of data "files" we know about */
-#define FUN_UNKNOWN 0
-#define FUN_IMAGE 1
-#define FUN_TABLE 2
-#define FUN_ARRAY 3
-#define FUN_EVENTS 4
-
-/* param types: these more or less match FITSType in fitsy.h */
-#define FUN_PAR_UNKNOWN 'u'
-#define FUN_PAR_COMMENT 'c'
-#define FUN_PAR_LOGICAL 'l'
-#define FUN_PAR_INTEGER 'i'
-#define FUN_PAR_STRING 's'
-#define FUN_PAR_VALUE 'v'
-#define FUN_PAR_REAL 'r'
-#define FUN_PAR_COMPLEX 'x'
-
-/* column modes and status */
-#define COL_ACTIVE 1
-#define COL_IBUF 2
-#define COL_PTR 4
-#define COL_READ 010
-#define COL_WRITE 020
-#define COL_REPLACEME 040
-
-/* operations we keep track of */
-#define OP_WRHEAD 1
-#define OP_WRIMAGE 2
-#define OP_WRTABLE 3
-#define OP_RDIMAGE 4
-#define OP_RDTABLE 5
-
-/* to determine the byte offset of a field within a structure type */
-#define FUN_OFFSET(p_type,field) \
- ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-/* library declarations */
-_PRbeg
-
-/* funopen.c */
-Fun FunOpen _PRx((char *fname, char *mode, Fun copy));
-void FunFlush _PRx((Fun fun, char *plist));
-void FunClose _PRx((Fun fun));
-
-/* funim.c */
-void *FunImageGet _PRx((Fun fun, void *buf, char *plist));
-void *FunImageRowGet _PRx((Fun fun, void *buf,
- int ystart, int ystop, char *plist));
-int FunImagePut _PRx((Fun fun, void *buf,
- int dim1, int dim2, int bitpix, char *plist));
-int FunImageRowPut _PRx((Fun fun, void *buf, int rstart, int rstop,
- int dim1, int dim2, int bitpix, char *plist));
-
-/* funtab.c */
-void *FunTableRowGet _PRx((Fun fun, void *rows, int maxrow,
- char *plist, int *nrow));
-int FunTableRowPut _PRx((Fun fun, void *rows, int nrow,
- int idx, char *plist));
-off_t FunTableRowSeek _PRx((Fun fun, int nrow, char *plist));
-
-/* funcol.c */
-void FunColumnActivate _PRx((Fun fun, char *s, char *plist));
-int FunColumnSelectArr _PRx((Fun fun, size_t size, char *mode,
- char **names, char **types, char **modes,
- int *offsets, int nargs));
-#ifdef __STDC__
-int FunColumnSelect(Fun fun, size_t size, char *plist, ...);
-#else
-int FunColumnSelect();
-#endif
-int FunColumnLookup _PRx((Fun fun, char *s, int which, char **name,
- int *type, int *plist, int *offset, int *n,
- int *width));
-int FunColumnLookup2 _PRx((Fun fun, char *s, int which,
- double *tlmin, double *tlmax,
- double *binsize, double *tscale, double *tzero));
-/* funinfo.c */
-#ifdef __STDC__
-int FunInfoGet(Fun fun, ...);
-int FunInfoPut(Fun fun, ...);
-#else
-int FunInfoGet();
-int FunInfoPut();
-#endif
-/* funparam.c */
-Fun FUN_PRIMARY _PRx((Fun fun));
-char *FUN_RAW _PRx((char *name));
-int FunParamGetb _PRx((Fun fun, char *name, int n, int defval, int *got));
-int FunParamGeti _PRx((Fun fun, char *name, int n, int defval, int *got));
-longlong FunParamGetl _PRx((Fun fun, char *name, int n, longlong defval, int *got));
-double FunParamGetd _PRx((Fun fun, char *name, int n, double defval, int *got));
-char *FunParamGets _PRx((Fun fun, char *name, int n, char *defval, int *got));
-int FunParamPutb _PRx((Fun fun, char *name, int n, int value, char *comm,
- int append));
-int FunParamPuti _PRx((Fun fun, char *name, int n, int value, char *comm,
- int append));
-int FunParamPutl _PRx((Fun fun, char *name, int n, longlong value, char *comm,
- int append));
-int FunParamPutd _PRx((Fun fun, char *name, int n, double value,
- int prec, char *comm, int append));
-int FunParamPuts _PRx((Fun fun, char *name, int n, char *value,
- char *comm, int append));
-
-/* funcalc.l */
-char *FunCalcParse _PRx((char *iname, char *oname,
- char *cmd, char *expr, char *autod, int args));
-
-/* funwcs.c */
-struct WorldCoor *_FunWCS _PRx((Fun fun, int doimage));
-
-/* funutil.c */
-int _FunKeyword _PRx((char *buf, char *key, char *env, char *vbuf, int vlen));
-
-/* funtoolsmainlib.c */
-void FuntoolsMainLibInit _PRx((void));
-
-_PRend
-
-/* for backward compatibility */
-#define FunEventsGet FunTableRowGet
-#define FunEventsPut FunTableRowPut
-
-/* the following define for user access to fun record via FunInfo() */
-/* file information */
-#define FUN_FNAME 1
-#define FUN_GIO 2
-#define FUN_HEADER 3
-#define FUN_TYPE 4
-#define FUN_BITPIX 5
-#define FUN_MIN1 6
-#define FUN_MAX1 7
-#define FUN_MIN2 8
-#define FUN_MAX2 9
-#define FUN_DIM1 10
-#define FUN_DIM2 11
-#define FUN_ENDIAN 12
-#define FUN_FILTER 13
-#define FUN_OPS 14
-/* image information */
-#define FUN_DTYPE 15
-#define FUN_DLEN 16
-#define FUN_DPAD 17
-#define FUN_DOBLANK 18
-#define FUN_BLANK 19
-#define FUN_SCALED 20
-#define FUN_BSCALE 21
-#define FUN_BZERO 22
-/* table information */
-#define FUN_BINCOLS 23
-#define FUN_ROWSIZE 24
-/* for backward compatiblity */
-#define FUN_EVSIZE 24
-#define FUN_OVERFLOW 25
-/* array information */
-#define FUN_SKIP 26
-/* reference file */
-#define FUN_IFUN 27
-#define FUN_BFUN 28
-/* section information */
-#define FUN_SECT_X0 29
-#define FUN_SECT_X1 30
-#define FUN_SECT_Y0 31
-#define FUN_SECT_Y1 32
-#define FUN_SECT_BLOCK 33
-#define FUN_SECT_BTYPE 34
-#define FUN_SECT_DIM1 35
-#define FUN_SECT_DIM2 36
-#define FUN_SECT_BITPIX 37
-#define FUN_SECT_DTYPE 38
-/* convenient ways to get to data in binned images and tables */
-#define FUN_RAWBUF 39
-#define FUN_RAWSIZE 40
-/* specified columns */
-#define FUN_NCOL 41
-#define FUN_COLS 42
-/* hacks: ifun without the reset */
-#define FUN_IFUN0 43
-/* list information */
-#define FUN_LTYPE 44
-#define FUN_LMEM 45
-#define FUN_HEAD 46
-#define FUN_CURRENT 47
-#define FUN_MARK 48
-#define FUN_NEXT 49
-/* WCS */
-#define FUN_WCS 50
-#define FUN_WCS0 51
-/* binning offsets */
-#define FUN_BINOFFS 52
-/* param modes */
-#define FUN_RAWPARAM 53
-#define FUN_PRIMARYHEADER 54
-/* late additions */
-#define FUN_NROWS 55
-#define FUN_THEADER 56
-#define FUN_VCOLS 57
-#define FUN_VFMT 58
-#define FUN_ROW 59
-#define FUN_DIMS 60
-#define FUN_SECT_DIMS 61
-
-#endif /* __funtools.h */
-
diff --git a/funtools/pkgIndex.tcl b/funtools/pkgIndex.tcl
deleted file mode 100644
index 7847ec6..0000000
--- a/funtools/pkgIndex.tcl
+++ /dev/null
@@ -1,11 +0,0 @@
-# Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex -direct" command
-# and sourced either when an application starts up or
-# by a "package unknown" script. It invokes the
-# "package ifneeded" command to set up package-related
-# information so that packages will be loaded automatically
-# in response to "package require" commands. When this
-# script is sourced, the variable $dir must contain the
-# full path name of this file's directory.
-
-package ifneeded tclfun 1.0 [list load [file join $dir libtclfun.so]]
diff --git a/funtools/saoconfig b/funtools/saoconfig
deleted file mode 100755
index 0e4b404..0000000
--- a/funtools/saoconfig
+++ /dev/null
@@ -1,235 +0,0 @@
-#!/bin/sh
-set -x
-rm -rf ./config.cache
-
-if [ x"$1" = x ]; then
- name=`uname -n`
-else
- if [ x"$1" = x"--" ]; then
- name=`uname -n`
- else
- name="$1"
- fi
- shift
-fi
-
-if [ x"$CFLAGS" = x ]; then
- CFLAGS="-g"
- export CFLAGS
-fi
-if [ x"$LDFLAGS" = x ]; then
- LDFLAGS="-g"
- export LDFLAGS
-fi
-
-GCCFLAGS="-W -Wall -Wno-implicit-int"
-STRICTFLAGS="-pedantic -Wall -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wredundant-decls -Wnested-externs -Wconversion -Wno-implicit-int"
-
-CF="--config-cache"
-BIT64="-m64 -mcpu=v9"
-LARGEFILE="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
-LARGEFILE64="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
-
-# handle saord builds specially
-if [ x$name = xsaord ]; then
- SAORDPREFIX=/soft/saord
- SAORDCC="gcc"
- SAORDCFLAGS="-O2"
- platform=`uname`
- case $platform in
- Darwin)
- USEDL="no"
- ;;
- SunOS)
- SAORDCC="cc"
- SAORDCFLAGS="-g"
- ;;
- *)
- USEDL="yes"
- ;;
- esac
-fi
-
-echo "configure for: " $name
-
-case $name in
- cc)
- ./configure $CF \
- CC=cc CFLAGS="$CFLAGS" $*
- ;;
-
- gcc)
- ./configure $CF \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" $*
- ;;
-
- strict)
- ./configure $CF \
- CC=gcc CFLAGS="$CFLAGS $STRICTFLAGS" $*
- ;;
-
-# large file support
- large)
- ./configure $CF \
- --without-tcl \
- --with-filter-cc=gcc \
- --prefix=${HOME} \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS $LARGEFILE" \
- $*
- ;;
-
-# Solaris 64bit support
- 64bit)
- ./configure $CF \
- --without-tcl \
- --with-filter-cc=gcc \
- --with-filter-cflags="$BIT64" \
- --prefix=${HOME} \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS $BIT64 LARGEFILE64" \
- LDFLAGS="-g $BIT64 -L/usr/lib/sparcv9" $*
- ;;
-
-# Solaris 64bit and largefile support
- large64)
- ./configure $CF \
- --without-tcl \
- --with-filter-cc=gcc \
- --with-filter-cflags="$BIT64" \
- --prefix=${HOME} \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS $BIT64 $LARGEFILE" \
- LDFLAGS="-g $BIT64 -L/usr/lib/sparcv9" $*
- ;;
-
- opt)
- ./configure $CF \
- --prefix=${HOME} \
- --enable-dl=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS -O2" \
- $*
- ;;
-
- dl)
- ./configure $CF \
- --enable-dl=yes CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" $*
- ;;
-
- shared)
- ./configure $CF \
- --enable-shared=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- shlib)
- ./configure $CF \
- --enable-shared=link \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- shdl)
- ./configure $CF \
- --enable-shared=link \
- --enable-dl=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- mainlib)
- ./configure $CF \
- --enable-mainlib=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- shmainlib)
- ./configure $CF \
- --enable-shared=yes \
- --enable-mainlib=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- noansi)
- ./configure $CF \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS -DNO_ANSI_FUNC" $*
- ;;
-
- saord*)
- ./configure $CF \
- --prefix=$SAORDPREFIX \
- --enable-dl="$USEDL" \
- --with-filter-cflags="$SAORDCFLAGS" \
- CC=$SAORDCC CFLAGS="$CFLAGS $SAORDCFLAGS" \
- $*
- ;;
-
- bokhara*)
- ./configure $CF \
- --prefix=$HOME \
- --enable-dl=yes \
- --with-filter-cflags="-O2" \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- cfa208*|moscow*)
- ./configure $CF \
- --prefix=${HOME} \
- --enable-dl=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" \
- $*
- ;;
-
- akela*|baba*)
- ./configure $CF \
- --with-filter-cflags="-O2" \
- --prefix=${HOME} \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" $*
- ;;
-
- ds9*)
- ./configure $CF \
- --prefix=${HOME} \
- --enable-dl=yes \
- --enable-fpu-double=yes \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" $*
- ;;
-
- jove*|JOVE*)
- ./configure $CF \
- --prefix=${HOME} \
- CC=icc CFLAGS="$CFLAGS" $*
- ;;
-
- apple*|APPLE*)
- ./configure $CF \
- --prefix=${HOME} $*
- ;;
-
- mred)
- ./configure $CF \
- --prefix=${HOME}/pub/usr/local \
- CC=cc CFLAGS="$CFLAGS" $*
- ;;
-
- mocha*|Mocha*|luwak*|*Luwak*|decaf*|Decaf*|barista*|Barista*|knomad*|Knomad*)
- ./configure $CF \
- --with-filter-cc=gcc \
- --prefix=/usr/local \
- --with-filter-cflags="-O2" \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS $LARGEFILE -O2" \
- $*
- ;;
-
- voyager*|VOYAGER*)
- ./configure $CF \
- --enable-posix_spawn --prefix=${HOME} \
- CC=gcc CFLAGS="$CFLAGS $GCCFLAGS" $*
- ;;
-
- *)
- ./configure $CF $*
- ;;
-
-esac
diff --git a/funtools/scan.c b/funtools/scan.c
deleted file mode 100644
index f6f2227..0000000
--- a/funtools/scan.c
+++ /dev/null
@@ -1,231 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <funtoolsP.h>
-
-static char macrobuf[SZ_LINE];
-
-typedef struct hcstruct{
- int args;
- int eflag;
- int clen;
- int maxlen;
- char *fmt;
- char *expr;
- char mbuf[SZ_LINE];
- char tbuf[SZ_LINE];
-} *HC, HCRec;
-
-static char *_HeadColumnCB(char *name, void *client_data)
-{
- HC hc = (HC)client_data;
-
- /* macro replacement */
- if( !strcmp(name, "name") || !strcmp(name, "col") ){
- if( strchr(hc->mbuf, 'n') ){
- hc->eflag = 1;
- gerror(stderr,
- "$%s can only be specified once in headcol format\n", name);
- return NULL;
- }
- strncpy(macrobuf, "%s", SZ_LINE);
- strncat(hc->mbuf, "n", SZ_LINE);
- hc->args++;
- return macrobuf;
- }
- else if( !strcmp(name, "format") || !strcmp(name, "fmt") ){
- if( strchr(hc->mbuf, 'f') ){
- hc->eflag = 1;
- gerror(stderr,
- "$%s can only be specified once in headcol format\n", name);
- return NULL;
- }
- strncpy(macrobuf, "%[a-zA-Z0-9.]", SZ_LINE);
- strncat(hc->mbuf, "f", SZ_LINE);
- hc->args++;
- return macrobuf;
- }
- else if( !strcmp(name, "skip") ){
- strncpy(macrobuf, "%*s", SZ_LINE);
- return macrobuf;
- }
- else if( !strcmp(name, "skipi") ){
- strncpy(macrobuf, "%*d", SZ_LINE);
- return macrobuf;
- }
- else if( !strcmp(name, "skipf") ){
- strncpy(macrobuf, "%*f", SZ_LINE);
- return macrobuf;
- }
- else{
- return NULL;
- }
-}
-
-void HeadColumnFree(HC hc)
-{
- /* sanity check */
- if( !hc ) return;
- if( hc->fmt ) xfree(hc->fmt);
- xfree(hc);
-}
-
-HC HeadColumnNew(char *s)
-{
- HC hc=NULL;
-
- /* sanity check */
- if( !s ) return NULL;
- /* allocate record */
- if( !(hc=xcalloc(1, sizeof(HCRec))) ) return NULL;
- /* expand format specification to make a scanf format */
- if( !(hc->fmt = ExpandMacro(s, NULL, NULL, 0, _HeadColumnCB, hc)) ||
- hc->eflag ){
- HeadColumnFree(hc);
- return NULL;
- }
- fprintf(stderr, "format: %s mbuf=%s args=%d\n", hc->fmt, hc->mbuf, hc->args);
- return hc;
-}
-
-char *HeadColumnProcess(HC hc, char *s)
-{
- int got;
- int len;
- char tbuf[SZ_LINE];
- char tbuf1[SZ_LINE];
- char tbuf2[SZ_LINE];
-
- /* sanity check */
- if( !hc || !*hc->mbuf || !hc->fmt || !s ) return NULL;
-
- /* clear buffers */
- *tbuf = '\0';
- *tbuf1 = '\0';
- *tbuf2 = '\0';
-
- if( !strcmp(hc->mbuf, "n") ){
- if( (got = sscanf(s, hc->fmt, tbuf1)) != hc->args ) return NULL;
- strncpy(tbuf, tbuf1, SZ_LINE);
- }
- else if( !strcmp(hc->mbuf, "f") ){
- if( (got = sscanf(s, hc->fmt, tbuf1)) != hc->args ) return NULL;
- strncpy(tbuf, tbuf1, SZ_LINE);
- }
- else if( !strcmp(hc->mbuf, "nf") ){
- if( (got = sscanf(s, hc->fmt, tbuf1, tbuf2)) != hc->args ) return NULL;
- switch(*tbuf2){
- case 'I':
- snprintf(tbuf, SZ_LINE, "%s:J", tbuf1);
- break;
- case 'F':
- snprintf(tbuf, SZ_LINE, "%s:D", tbuf1);
- break;
- case 'A':
- snprintf(tbuf, SZ_LINE, "%s:%s", tbuf1, tbuf2);
- break;
- default:
- snprintf(tbuf, SZ_LINE, "%s:%s", tbuf1, tbuf2);
- break;
- }
- }
- else if( !strcmp(hc->mbuf, "fn") ){
- if( (got = sscanf(s, hc->fmt, tbuf1, tbuf2)) != hc->args ) return NULL;
- switch(*tbuf2){
- case 'I':
- snprintf(tbuf, SZ_LINE, "%s:J", tbuf2);
- break;
- case 'F':
- snprintf(tbuf, SZ_LINE, "%s:D", tbuf2);
- break;
- case 'A':
- snprintf(tbuf, SZ_LINE, "%s:%s", tbuf2, tbuf1);
- break;
- default:
- snprintf(tbuf, SZ_LINE, "%s:%s", tbuf2, tbuf1);
- break;
- }
- }
- else{
- *tbuf = '\0';
- }
-
- /* add to expression */
- if( hc->tbuf ){
- len = strlen(tbuf);
- if( (len + hc->clen + 1) >= hc->maxlen ){
- while( (len + hc->clen +1) > hc->maxlen ){
- hc->maxlen += SZ_LINE;
- }
- if( hc->clen == 0 )
- hc->expr = (char *)xcalloc(hc->maxlen, sizeof(char));
- else
- hc->expr = (char *)xrealloc(hc->expr, hc->maxlen);
- }
- if( *hc->expr ) strncat(hc->expr, ",", SZ_LINE-1);
- strncat(hc->expr, tbuf, SZ_LINE-1);
- }
-
- /* return what we just got */
- return hc->tbuf;
-}
-
-char *HeadColumnExpr(HC hc)
-{
- /* sanity check */
- if( !hc ) return NULL;
- /* return current expression */
- return hc->expr;
-}
-
-int main(int argc, char **argv)
-{
- int i;
- char *fptr=NULL;
- char *expr=NULL;
- char *lptr;
- char lbuf[SZ_LINE];
- HC hc;
-
- if( argc >= 2 ){
- fptr = argv[1];
- }
- else{
- fptr = "Column $name ($format)";
- }
-
- /* initialize columnheader priocessing */
- if( !(hc = HeadColumnNew(fptr)) ){
- gerror(stderr, "can't init headcolumn\n");
- return 1;
- }
-
- /* read comment lines and look for column specifications */
- if( argc > 2 ){
- for(i=2; i<argc; i++){
- strncpy(lbuf, argv[i], SZ_LINE);
- lptr = lbuf;
- if( *lptr == '#' ) lptr++;
- if( HeadColumnProcess(hc, lptr) ){
- fprintf(stderr, "+");
- }
- }
- }
- else{
- while( fgets(lbuf, SZ_LINE, stdin) ){
- lptr = lbuf;
- if( *lptr == '#' ) lptr++;
- if( HeadColumnProcess(hc, lptr) ){
- fprintf(stderr, "+");
- }
- }
- }
-
- /* display result -- the column specification */
- if( HeadColumnExpr(hc) ){
- fprintf(stderr, "\n%s\n", HeadColumnExpr(hc));
- }
-
- /* clean up */
- HeadColumnFree(hc);
- return 0;
-}
diff --git a/funtools/search.c b/funtools/search.c
deleted file mode 100644
index 68c01b4..0000000
--- a/funtools/search.c
+++ /dev/null
@@ -1,1107 +0,0 @@
-/* search.c
- */
-/* Starbase Data Tables - An Ascii Database for UNIX
-
- copyright 1991, 1993, 1995, 1999, 2003 John B. Roll jr.
- */
-
-extern int N;
-
-#include <math.h>
-#include <ctype.h>
-#include <except.h>
-
-#include <table.h>
-#include <tablesearch.h>
-#include <filelist.h>
-
-double slaDsep();
-void radecbox();
-
-exception ex_search = "search";
-
-typedef void *(*vvector)();
-
-TableSearch table_search();
-TableSearch table_searchsetup();
-char *table_searchcheckindexpattern();
-Range *table_srange2();
-
-typedef struct Axis {
- int type;
- int once;
- int c1;
- int c2;
- char *value;
- double lo;
- double hi;
- double wp;
- Range *R;
- int method;
- TableSearch search;
- struct Axis *pair;
-} Axis;
-
-char *table_searchcheckindexpattern();
-
-
-void table_searchpairs(table, axes, naxes, filecache)
- char *table;
- Axis **axes;
- int naxes;
- void *filecache;
-{
- char *here;
- char directo[1024];
- int i, j;
-
- TableSearch search = table_searchsetup(table);
- int Numeric;
- int Method;
-
- strcpy(directo, table);
- if ( (here = strrchr(directo, '/')) ) {
- *here = '\0';
- here++;
- } else {
- strcpy(directo, ".");
- here = table;
- }
-
- for ( i = 0; i < naxes; i++ ) {
- for ( j = 0; j < naxes; j++ ) {
- char *name;
- char *col1;
- char *col2;
- filelist list;
- int len;
- char pattern[1024];
-
- if ( i == j ) continue;
- if ( axes[i]->search != NULL ) continue;
- if ( axes[j]->search != NULL ) continue;
-
- col1 = table_colnam(search->THead, axes[i]->c2);
- col2 = table_colnam(search->THead, axes[j]->c2);
-
- sprintf(pattern, "%s.%s.%s[-.:][sbhir]", here, col1, col2);
-
- if ( (name = table_searchcheckindexpattern(search, directo, pattern)) ) {
- table_searchsetupindex(search, name, col1);
- table_searchsetupcache(search, NULL);
-
- axes[i]->search = search;
- axes[j]->search = search;
- axes[i]->search->Index = name;
- axes[i]->search->Tcolumn = table_colnum(search->THead, col1);
- axes[i]->search->Indxcol = table_colnum(search->IHead, col1);
- axes[i]->search->Tcolum2 = table_colnum(search->THead, col2);
- axes[i]->search->Indxco2 = table_colnum(search->IHead, col2);
- axes[i]->type = 'S';
- axes[j]->type = '4';
- axes[j]->pair = axes[i];
-
- search = table_searchsetup(table); /* Leak one search descriptor */
- }
- } }
-}
-
-
-typedef struct CsysDef {
- void (*setup)();
- int (*filte)();
- int nrange;
- double *range;
- int naxes;
- Axis *axis;
- char *data;
-} CsysDef;
-
-typedef struct CsysType {
- char option;
- char *name;
- int (*filte)();
- void (*setup)();
- char *(*parse)();
-} CsysType;
-
-typedef struct RCache {
- struct _CNode cache;
-} *RCache;
-
-typedef struct JoinData {
- CsysDef *csys;
- int nsys;
- Range *r;
- File ofile;
- int print;
- int setcnt;
- RCache cache;
- int posit;
- TableHead T1;
- TableRow R1;
-} JoinData;
-
-rowcmp(a, b)
- CNode a;
- CNode b;
-{
- return a->hash == b->hash;
-}
-
-char *cartparse(csys, option)
- CsysDef *csys;
- char *option;
-{
- int i;
-
- if ( *option )
- csys->naxes = atoi(option);
- else csys->naxes = 1;
- csys->nrange = 1;
-
- if ( !csys->naxes )
- except(ex_search, "error in Cartesian coordinate system option");
-
- Malloc(csys->axis, sizeof(Axis) * csys->naxes);
-
- for ( i = 0; i < csys->naxes; i++ ) {
- csys->axis[i].type = '2';
- csys->axis[i].once = 0;
- csys->axis[i].method = TSEARCH_SEXAGAS;
- }
- return "C";
-}
-
-void cartsetup(csys, row)
- CsysDef *csys;
- TableRow row;
-{
- int i;
-
- for ( i = 0; i < csys->naxes; i++ ) {
- csys->axis[i].lo = table_colvald(row, csys->axis[i].c1) - csys->range[0];
- csys->axis[i].hi = table_colvald(row, csys->axis[i].c1) + csys->range[0];
- }
-}
-
-cartfilte(csys, row1, row2)
- CsysDef *csys;
- TableRow row1;
- TableRow row2;
-{
- int i;
- double square = 0.0;
-
- for ( i = 0; i < csys->naxes; i++ ) {
- double d = table_colvald(row1, csys->axis[i].c1)
- - table_colvald(row2, csys->axis[i].c2);
-
- square += d * d;
- }
-
- if ( sqrt(square) <= csys->range[0] ) return 1;
- else return 0;
-}
-
-char *sphrparse(csys, option)
- CsysDef *csys;
- char *option;
-{
- int i;
-
- if ( *option == '1' || *option == '2' ) {
- csys->naxes = *option++ - '0';
- } else
- csys->naxes = 2;
-
- if ( csys->naxes == 1 )
- csys->filte = NULL;
-
- csys->nrange = 1;
-
- Malloc(csys->axis, sizeof(Axis) * csys->naxes);
-
- for ( i = 0; i < csys->naxes; i++ ) {
- csys->axis[i].type = '2';
- csys->axis[i].once = 0;
- csys->axis[i].method = TSEARCH_SEXAGAS;
- }
-
- /* Parse units options. Set up wrap values.
- */
- NewString(csys->data, "hdd");
- for ( i = 0; i < 3 && option[i]; i++ )
- csys->data[i] = option[i];
-
- for ( i = 0; i < csys->naxes; i++ ) {
- switch ( csys->data[i] ) {
- case 'h': csys->axis[i].wp = 24.0; break;
- case 'd': csys->axis[i].wp = 360.0; break;
- case 'r': csys->axis[i].wp = X_2PI; break;
- default:
- except(ex_search, "bad units option to spherical system\n");
- }
- }
-
- return "C";
-}
-
-void sphrsetup(csys, row)
- CsysDef *csys;
- TableRow row;
-{
- double ra, dec;
- double width;
- double r0, r1, d0, d1;
-
- if ( csys->naxes == 1 ) {
- csys->axis[0].lo = table_colvald(row, csys->axis[0].c1) -
- csys->range[0];
- if ( csys->axis[0].lo < 0 ) csys->axis[0].lo += csys->axis[0].wp;
-
- csys->axis[0].hi = table_colvald(row, csys->axis[0].c1) +
- csys->range[0];
- if ( csys->axis[0].hi > csys->axis[0].wp )
- csys->axis[0].hi -= csys->axis[0].wp;
-
- return;
- }
-
-
- /* Input units conversion.
- */
- switch ( csys->data[0] ) {
- case 'h': ra = table_colvald(row, csys->axis[0].c1); break;
- case 'd': ra = d2h(table_colvald(row, csys->axis[0].c1)); break;
- case 'r': ra = r2h(table_colvald(row, csys->axis[0].c1)); break;
- }
- switch ( csys->data[1] ) {
- case 'h': dec = h2d(table_colvald(row, csys->axis[1].c1)); break;
- case 'd': dec = table_colvald(row, csys->axis[1].c1); break;
- case 'r': dec = r2d(table_colvald(row, csys->axis[1].c1)); break;
- }
- switch ( csys->data[2] ) {
- case 'h': width = h2d(csys->range[0]); break;
- case 'd': width = csys->range[0]; break;
- case 'r': width = r2d(csys->range[0]); break;
- }
-
- radecbox(ra, dec, width * 2, &r0, &r1, &d0, &d1);
-
- /* Output units conversion
- */
- switch ( csys->data[0] ) {
- case 'h': csys->axis[0].lo = r0;
- csys->axis[0].hi = r1;
- break;
- case 'd': csys->axis[0].lo = h2d(r0);
- csys->axis[0].hi = h2d(r1);
- break;
- case 'r': csys->axis[0].lo = h2r(r0);
- csys->axis[0].hi = h2r(r1);
- break;
- }
- switch ( csys->data[1] ) {
- case 'h': csys->axis[1].lo = d2h(d0);
- csys->axis[1].hi = d2h(d1);
- break;
- case 'd': csys->axis[1].lo = d0;
- csys->axis[1].hi = d1;
- break;
- case 'r': csys->axis[1].lo = d2r(d0);
- csys->axis[1].hi = d2r(d1);
- break;
- }
-}
-
-int sphrfilte(csys, row1, row2)
- CsysDef *csys;
- TableRow row1;
- TableRow row2;
-{
- double r1, r2, d1, d2;
- double radius;
-
- switch ( csys->data[0] ) {
- case 'h': r1 = h2r(table_colvald(row1, csys->axis[0].c1));
- r2 = h2r(table_colvald(row2, csys->axis[0].c2));
- break;
- case 'd': r1 = d2r(table_colvald(row1, csys->axis[0].c1));
- r2 = d2r(table_colvald(row2, csys->axis[0].c2));
- break;
- case 'r': r1 = table_colvald(row1, csys->axis[0].c1);
- r2 = table_colvald(row2, csys->axis[0].c2);
- break;
- }
- switch ( csys->data[1] ) {
- case 'h': d1 = h2r(table_colvald(row1, csys->axis[1].c1));
- d2 = h2r(table_colvald(row2, csys->axis[1].c2));
- break;
- case 'd': d1 = d2r(table_colvald(row1, csys->axis[1].c1));
- d2 = d2r(table_colvald(row2, csys->axis[1].c2));
- break;
- case 'r': d1 = table_colvald(row1, csys->axis[1].c1);
- d2 = table_colvald(row2, csys->axis[1].c2);
- break;
- }
- switch ( csys->data[2] ) {
- case 'h': radius = h2r(csys->range[0]); break;
- case 'd': radius = d2r(csys->range[0]); break;
- case 'r': radius = csys->range[0]; break;
- }
-
- if ( slaDsep(r1, d1, r2, d2) <= radius ) return 1;
- else return 0;
-}
-
-char *singparse(csys, option)
- CsysDef *csys;
- char *option;
-{
-
- csys->naxes = 1;
- csys->nrange = 0;
-
- Malloc(csys->axis, sizeof(Axis) * csys->naxes);
-
- csys->axis[0].type = '1';
- csys->axis[0].once = 0;
- csys->axis[0].method = TSEARCH_ASCII;
- return "C";
-}
-
-void singsetup(csys, row)
- CsysDef *csys;
- TableRow row;
-{
- csys->axis[0].value = table_colval(row, csys->axis[0].c1);
-}
-
-
-char *rangparse(csys, option)
- CsysDef *csys;
- char *option;
-{
-
- csys->naxes = 1;
- csys->nrange = 0;
-
- Malloc(csys->axis, sizeof(Axis) * 3);
-
- if ( *option == ':' ) {
- double wrap = SAOstrtod(&option[1], NULL);
-
- csys->axis[0].wp = wrap;
- }
-
- csys->axis[0].type = '2';
- csys->axis[0].once = 0;
- csys->axis[0].method = TSEARCH_SEXAGAS;
- return "211";
-}
-
-void rangsetup(csys, row)
- CsysDef *csys;
- TableRow row;
-{
- csys->naxes = 1;
-
- csys->axis[0].lo = table_colvald(row, csys->axis[1].c1);
- csys->axis[0].hi = table_colvald(row, csys->axis[2].c1);
-}
-
-char *valuparse(csys, option)
- CsysDef *csys;
- char *option;
-{
- csys->naxes = 1;
- csys->nrange = 0;
-
- Malloc(csys->axis, sizeof(Axis) * (csys->naxes + 0));
- csys->axis[0].type = '1';
- csys->axis[0].once = 1;
- csys->axis[0].method = TSEARCH_ASCII;
-
- return "2V";
-}
-
-void valusetup(csys, row)
- CsysDef *csys;
- TableRow row;
-{
- TableRow X = table_rowloc(NULL, 0, 0);
-
- csys->axis[0].R = range_union(table_svalue(csys->axis[0].search
- , csys->axis[0].value
- , (vvector) range_add, NULL, X));
-
- table_rowfree(X);
- csys->setup = NULL;
-}
-
-char *limtparse(csys, option)
- CsysDef *csys;
- char *option;
-{
- csys->naxes = 1;
- csys->nrange = 2;
-
- Malloc(csys->axis, sizeof(Axis) * csys->naxes);
- csys->axis[0].type = '2';
- csys->axis[0].once = 1;
- csys->axis[0].method = TSEARCH_SEXAGAS;
-
- return "2";
-}
-
-
-void limtsetup(csys, row)
- CsysDef *csys;
- TableRow row;
-{
- csys->axis[0].lo = csys->range[0];
- csys->axis[0].hi = csys->range[1];
-
- csys->setup = NULL;
- csys->naxes = 0;
-}
-
-
-CsysType CsysTypes[] = {
- { 'C' , "cartesian", cartfilte, cartsetup, cartparse }
- , { 'S', "spherical", sphrfilte, sphrsetup, sphrparse }
- , { 'V', "col value", NULL, NULL , valuparse }
- , { 'Z', "col range", NULL, rangsetup, rangparse }
- , { 'R', "col limit", NULL, limtsetup, limtparse }
- , { '\0', NULL, NULL, NULL, NULL }
- , { '\0', "singleaxs", NULL, singsetup, singparse }
-#define N_CsysTypes 6
-};
-
-
-void *joinem(data, start, end, row, table, file)
- void *data;
- off_t start;
- off_t end;
- TableRow row;
- TableHead table;
- File file;
-{
- JoinData *d = (JoinData *) data;
- int i;
-
- struct _CNode node;
-
- node.hash = start;
-
- /* If the row won't pass the filter - bail.
- */
- for ( i = 0; i < d->nsys; i++ ) {
- if ( ! d->csys[i].filte) { continue; }
- if ( !(*d->csys[i].filte)(&d->csys[i], d->R1, row) ) {
- return data;
- }
- }
-
- if ( !d->print ) {
- d->r = range_add(d->r, start, end);
- return data;
- }
-
- if ( d->posit ) {
- fprintf(d->ofile, OffFormat " %d\n", start, end-start);
- return data;
- }
-
- if ( d->setcnt ) {
- if ( cache_hashe(d->cache, &node, NULL) != NULL )
- return data;
-
- cache_cache(d->cache, &node);
- fprintf(d->ofile, "%d\t", d->setcnt);
- }
-
- if ( d->T1 )
- table_rowput(d->ofile, d->T1, d->R1, NULL, NULL, 0);
-
- table_rowput(d->ofile, table, row, NULL, NULL, 0);
- return data;
-}
-
-char *trim();
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int n, i, j, k;
- int nsys = 0;
- int asys = 0;
-
- Axis **axes;
- int naxes = 0;
-
- int *lcol = NULL;
- int ncol = 0;
-
- CsysDef *csys = NULL;
-
- File ifile = Stdin;
- File ofile = Stdout;
- void *obuff;
-
- File F1, F2 = NULL;
- TableHead T1 = NULL, T2;
- char *file1 = "-";
- char *file2 = NULL;
-
- TableRow row, row1 = NULL, X;
-
- JoinData jdata;
-
- char *zeval = "0.0";
- char *args = NULL;
-
- int header = 1;
- int invert = 0;
- int joiner = 0;
- int count = 0;
- int setcnt = 0;
- int posit = 0;
-
- off_t Start, End;
-
- if ( argc < 2 ) {
- FPrint(Stderr
- , "usage: search table [-p] [-s] [-j] [-i keytable] [-m[bhisr]]\n");
- FPrint(Stderr, " [Column]\n");
- FPrint(Stderr, " [-R Column <Min> <Max>]\n");
- FPrint(Stderr, " [-S[uuu] Column Column Range]\n");
- FPrint(Stderr, " [-C[n] Column [... Column<n>] Range]\n");
- FPrint(Stderr, " [-Z[wrap] Column Column]\n");
- exit(1);
- }
-
- /* Look ahead for file option.
- */
- for ( i = 1; i < argc - 1 ; i++ ) {
- if ( argv[i][0] == '-' && argv[i][1] == 'i' ) {
- if ( (ifile = (!strcmp("-", argv[i+1]))
- ? Stdin
- : Open(argv[i+1], "r")) == NULL ) {
- except(ex_search
- , "search: can't open input file: %s : %s"
- , argv[i+1], exc_oserror());
- } else {
- for ( ; i < argc - 2; i++ )
- argv[i] = argv[i+2]; /* Ooch these over */
- argc -= 2;
- break;
- }
- }
- }
-
- F1 = ifile;
-
- for ( n = 1; n < argc; n++ ) {
- char *arg;
-
- if ( argv[n][0] == '-' ) {
- switch ( argv[n][1] ) {
- case 'c' : count = 1; continue;
- case 'h' : header = 0; continue;
- case 'I' : invert = 1; continue;
- case 'p' : posit = 1; continue;
- case 'j' : joiner = 1; continue;
- case 's' : setcnt = 1; continue;
- case 'o' :
- if ( (ofile = (!strcmp("-", argv[n+1]))
- ? Stdout : Open(argv[n+1], "w")) == NULL ) {
- except(ex_search
- , "can't open output file: %s : %s"
- , argv[n+1], exc_oserror());
- }
- n++;
- continue;
- default:
-
- for ( i = 0; CsysTypes[i].name != NULL; i++ ) {
- if ( CsysTypes[i].option == argv[n][1] )
- break;
- }
-
- if ( CsysTypes[i].name == NULL )
- except(ex_search
- , "search: unknown option: %c", argv[n][1]);
-
- arg = &argv[n][2];
- n++;
- break;
- }
- } else {
- if ( F2 ) {
- i = N_CsysTypes;
- arg = NULL;
- } else {
- if ( (F2 = Open(argv[n], "r")) == NULL )
- except(ex_search, "can't open table: %s : %s", argv[n]
- , exc_oserror());
- if ( (T2 = table_header(F2, 0)) == NULL )
- except(ex_search, "can't read table header from: %s\n"
- , argv[n]);
- file2 = argv[n];
-
- if ( (Start = Seek(F2, 0, SEEK_CUR)) == -1 ) {
- perror("search:");
- exit(1);
- }
- End = Seek(F2, 0 , SEEK_END);
- Seek(F2, Start, SEEK_SET);
-
- continue;
- }
- }
-
- if ( file2 == NULL ) except(ex_search, "no table to search");
-
- if ( nsys >= asys ) {
- asys *= 2;
- asys += 4;
- ReAlloc(csys, asys * sizeof(CsysDef));
- }
-
- csys[nsys].setup = CsysTypes[i].setup;
- csys[nsys].filte = CsysTypes[i].filte;
-
- args = CsysTypes[i].parse(&csys[nsys], arg);
-
- if ( csys[nsys].nrange )
- Malloc(csys[nsys].range, sizeof(double) * csys[nsys].nrange);
-
- for ( i = 0; i < csys[nsys].naxes || (*args && *args != 'C')
- ; n++, i++ ) {
- char *c1;
- char *c2;
- char *nchr;
-
- if ( n >= argc )
- except(ex_search
- , "not enough columns for this coordinate system");
-
- c1 = argv[n];
-
- if ( *args != 'V' && (nchr = strchr(c1, '.')) )
- *nchr++ = '\0';
- else nchr = NULL;
-
- if ( *args == 'C' && (c2 = strchr(c1, ':')) )
- *c2++ = '\0';
- else c2 = c1;
-
- if ( *args == 'C' || *args == '1' ) {
- if ( T1 == NULL && (T1 = table_header(F1, TABLE_PARSE)) == NULL )
- except(ex_search
- , "can't read table header from: %s\n", file1);
-
- if ( !(csys[nsys].axis[i].c1 = table_colnum(T1, c1)) )
- except(ex_search, "no column %s in keytable", c1);
- }
-
- if ( *args == 'C' || *args == '2' ) {
- if ( !(csys[nsys].axis[i].c2 = table_colnum(T2, c2)) )
- except(ex_search, "no column %s in table %s\n", c2, file2);
-
- }
-
- if ( *args == 'V' ) {
- csys[nsys].axis[i-1].value = argv[n];
- csys[nsys].axis[i-1].hi = SAOstrtod(argv[n], NULL);
- csys[nsys].axis[i-1].lo = SAOstrtod(argv[n], NULL);
- } else {
- csys[nsys].axis[i].value = NULL;
- csys[nsys].axis[i].R = NULL;
- }
-
- if ( *args != 'C' ) args++;
- }
-
- for ( i = 0; i < csys[nsys].nrange; i++, n++ ) {
- char *here = NULL;
-
- if ( n >= argc )
- except(ex_search
- , "not enough ranges given for this coordinate system.\n");
-
- csys[nsys].range[i] = SAOstrtod(argv[n], &here);
- if ( *here )
- except(ex_search, "this doesn't look like a range: %s"
- , argv[n]);
- }
-
- naxes += csys[nsys].naxes;
- nsys++;
- n--;
- }
-
- Malloc(axes, naxes * sizeof(Axis *));
-
- for ( i = k = 0; i < nsys; i++ ) {
- for ( j = 0; j < csys[i].naxes; j++, k++ ) {
- axes[k] = &csys[i].axis[j];
- axes[k]->search = NULL;
- }
- }
-
- table_searchpairs(file2, axes, naxes, NULL);
-
- for ( k = 0; k < naxes; k++ ) {
- if ( axes[k]->search == NULL ) {
- if ( (axes[k]->search
- = table_search(file2, table_colnam(T2, axes[k]->c2)
- , axes[k]->method, NULL)) == NULL ) {
-
- except(ex_search
- , "can't access index for: %s column: %s\n", file2
- , table_colnam(T2, axes[k]->c2));
- }
- }
- }
-
- row = table_rowloc(NULL, 0, 0);
- X = table_rowloc(NULL, 0, 0);
-
-
- if ( posit ) {
- fprintf(ofile, "Offset Length\n");
- fprintf(ofile, "------ ------\n");
- } else
- if ( T1 && joiner ) {
- if ( header )
- table_hdrput(ofile, T1, TBLHDR_VALUES | TBLHDR_TEXT
- , NULL, NULL, 0);
- table_ors(T1, '\t');
-
- if ( header ) {
- /* rename cols and generate the headline
- */
- Malloc(lcol, (T1->header->ncol + T2->header->ncol)
- * sizeof(int));
-
- if ( setcnt ) fprintf(ofile, "SetNumber\t");
-
- for ( j = 1; j <= T1->header->ncol; j++ )
- /* look up column name in the other table.
- */
- lcol[ncol++] = hdrfix(ofile, table_colval(T1->header, j)
- , table_colnum(T2
- , trim(table_colval(T1->header, j))) ? 1 : 0
- , '\t');
-
- for ( j = 1; j <= T2->header->ncol; j++ )
- lcol[ncol++] = hdrfix(ofile, table_colval(T2->header, j)
- , table_colnum(T1
- , trim(table_colval(T2->header, j))) ? 2 : 0
- , j == T2->header->ncol ? '\n' : '\t');
-
- if ( setcnt ) fprintf(ofile, "---------\t");
-
- /* Output dashline
- */
- for ( i = 0; i < ncol; i++ ) {
- table_dashes(ofile , lcol[i] , (i == ncol - 1) ? '\n'
- : '\t');
- }
- }
- } else {
- table_hdrput(ofile, T2, TBLHDR_VALUES | TBLHDR_TEXT, NULL, NULL, 0);
- if ( setcnt ) fprintf(ofile, "SetNumber\t");
- table_hdrput(ofile, T2, TBLHDR_HEADLINE, NULL, NULL, 0);
- if ( setcnt ) fprintf(ofile, "---------\t");
- table_hdrput(ofile, T2, TBLHDR_DASHLINE, NULL, NULL, 0);
- }
-
-
- {
- Range *U = NULL; /* Union of all keytable rows */
-
- jdata.ofile = ofile;
-
- jdata.csys = csys;
- jdata.nsys = nsys;
-
- jdata.T1 = joiner ? T1 : NULL;
- jdata.r = NULL;
- jdata.print = joiner;
- jdata.setcnt= setcnt;
- jdata.posit = posit;
- if ( setcnt && jdata.print == 0 ) jdata.print = 1;
-
- if ( setcnt ) {
- jdata.cache = (RCache) cache_init(sizeof(struct RCache), 7967, 0
- , NULL, NULL, rowcmp);
- } else {
- jdata.cache = NULL;
- }
-
- /* For each row in the input.
- */
- while ( T1 == NULL
- || (row1 = table_rowget(F1, T1, row, NULL, NULL, 0)) ) {
- Range *R = NULL; /* Intersection of all axes */
- Range *r; /* Search of one axis */
-
- if ( count != 0 ) { progress(count); count++; }
-
- jdata.R1 = row1;
-
-
- /* Call the setup function on each csys
- */
- for ( i = 0; i < nsys; i++ ) {
- if ( csys[i].setup ) csys[i].setup(&csys[i], row1);
- }
-
- /* Build the range set
- */
- for ( i = 0; i < naxes; i++ ) {
- switch ( axes[i]->type ) {
- case 'R': {
- r = range_copy(axes[i]->R);
- break;
- }
- case '1': {
- r = table_svalue(axes[i]->search
- , axes[i]->value
- , (vvector) range_add, NULL, X);
- break;
- }
- case '2': {
- double hi = axes[i]->hi;
- double lo = axes[i]->lo;
- double wp = axes[i]->wp ? axes[i]->wp
- : 0.0 ;
-
- char hival[64];
- char loval[64];
- char wpval[64];
-
- sprintf(hival, "%.21g", hi);
- sprintf(loval, "%.21g", lo);
- sprintf(wpval, "%.21g", wp);
-
- if ( lo > hi ) {
- r = table_srange(axes[i]->search
- , loval, wpval, (vvector) range_add, NULL, X);
- r = table_srange(axes[i]->search
- , zeval, hival, (vvector) range_add, r, X);
- } else {
- r = table_srange(axes[i]->search
- , loval, hival, (vvector) range_add, NULL, X);
- }
- break;
- }
- case '4': {
- double hi1 = axes[i]->pair->hi;
- double lo1 = axes[i]->pair->lo;
- double wp1 = axes[i]->pair->wp ? axes[i]->pair->wp : 0.0 ;
-
- double hi2 = axes[i]->hi;
- double lo2 = axes[i]->lo;
- double wp2 = axes[i]->wp ? axes[i]->wp : 0.0 ;
-
- char hival1[64];
- char loval1[64];
- char wpval1[64];
-
- char hival2[64];
- char loval2[64];
- char wpval2[64];
-
- sprintf(hival1, "%.21g", hi1);
- sprintf(loval1, "%.21g", lo1);
- sprintf(wpval1, "%.21g", wp1);
-
- sprintf(hival2, "%.21g", hi2);
- sprintf(loval2, "%.21g", lo2);
- sprintf(wpval2, "%.21g", wp2);
-
- if ( lo1 > hi1 ) {
- if ( lo2 > hi2 ) {
- r = table_srange2(axes[i]->pair->search
- , loval1, wpval1
- , loval2, wpval2
- , (vvector) range_add, NULL, X);
- r = table_srange2(axes[i]->pair->search
- , loval1, wpval1
- , wpval2, hival2
- , (vvector) range_add, NULL, X);
- r = table_srange2(axes[i]->pair->search
- , wpval1, hival1
- , loval2, wpval2
- , (vvector) range_add, r, X);
- r = table_srange2(axes[i]->pair->search
- , wpval1, hival1
- , wpval2, hival2
- , (vvector) range_add, r, X);
- } else {
- r = table_srange2(axes[i]->pair->search
- , wpval1, hival1
- , loval2, hival2
- , (vvector) range_add, r, X);
- r = table_srange2(axes[i]->pair->search
- , wpval1, hival1
- , loval2, hival2
- , (vvector) range_add, r, X);
- }
- } else {
- if ( lo2 > hi2 ) {
- r = table_srange2(axes[i]->pair->search
- , loval1, hival1
- , loval2, wpval2
- , (vvector) range_add, r, X);
- r = table_srange2(axes[i]->pair->search
- , loval1, hival1
- , wpval2, hival2
- , (vvector) range_add, r, X);
- } else {
- r = table_srange2(axes[i]->pair->search
- , loval1, hival1
- , loval2, hival2
- , (vvector) range_add, NULL, X);
- }
- }
- break;
- }
- case 'S': { continue; }
- default: {
- fprintf(stderr, "search error unknown axis type %c\n",
- axes[i]->type);
- exit(1);
- }
- }
- r = range_union(r);
-
- if ( axes[i]->once ) {
- range_copy(r);
- axes[i]->type = 'R';
- }
-
- if ( R != NULL ) R = range_inter(R, r);
- else R = r;
-
- if ( R == NULL ) break;
- }
-
- /* Filter/Output the Range.
- */
- if ( R != NULL ) {
- table_rangerows(F2, T2, X, R, joinem, &jdata);
- Free(R);
-
- if ( !joiner ) {
- U = range_union(range_cat(U, jdata.r));
- jdata.r = NULL;
- }
- if ( jdata.setcnt ) jdata.setcnt++;
- }
-
- if ( T1 == NULL ) break;
- }
-
- if ( invert ) {
- U = range_invrt(U, Start, End);
- }
-
- if ( U ) {
- jdata.print = 1;
- jdata.nsys = 0;
- table_rangerows(F2, T2, X, U, joinem, &jdata);
- }
- }
- exit(0);
-}
-
-
-void radecbox(ra, dec, width, r1, r2, d1, d2)
- double ra;
- double dec;
- double width;
- double *r1, *r2, *d1, *d2;
-{
- double cosdec;
-
- *d1 = dec - width / 2.0;
- if ( *d1 <= -90.0 ) {
- *d1 = -90.0;
- *d2 = dec + width / 2.0;
- *r1 = 0.0;
- *r2 = 24.0;
- } else {
- *d2 = dec + width / 2.0;
- if ( *d2 >= 90.0 ) {
- *d1 = dec - width / 2.0;
- *d2 = 90.0;
- *r1 = 0.0;
- *r2 = 24.0;
- } else {
- if ( dec > 0.0 ) cosdec = Abs(cos(d2r(*d1)));
- else cosdec = Abs(cos(d2r(*d2)));
-
- *r1 = ra - d2h(width) / 2 / cosdec;
- *r2 = ra + d2h(width) / 2 / cosdec;
-
- if ( *r1 < 0.0 ) *r1 += 24;
- if ( *r2 > 24.0 ) *r2 -= 24;
- }
- }
-}
-
-
-void slaDcs2c ( double a, double b, double v[3] )
-{
- double cosb;
-
- cosb = cos ( b );
- v[0] = cos ( a ) * cosb;
- v[1] = sin ( a ) * cosb;
- v[2] = sin ( b );
-}
-
-double slaDsep ( double a1, double b1, double a2, double b2 )
-{
- int i;
- double d, v1[3], v2[3], s2, c2;
-
- slaDcs2c ( a1, b1, v1 );
- slaDcs2c ( a2, b2, v2 );
-
- s2 = 0.0;
- for ( i = 0; i < 3; i++ ) {
- d = v1[i] - v2[i];
- s2 += d * d;
- }
- s2 /= 4.0;
-
- c2 = 1.0 - s2;
- return 2.0 * atan2 ( sqrt ( s2 ), sqrt ( Max ( 0.0, c2 )));
-}
-
-
-progress(count)
- int count;
-{
- if ( (count % 1000) == 0 ) {
- if ( (count % 100000) == 0 ) {
- FPrint(Stderr, "=");
- } else {
- if ( (count % 10000) == 0 ) {
- FPrint(Stderr, "+");
- } else {
- FPrint(Stderr, "*");
- }
- }
-
- Flush(Stderr);
- }
-}
diff --git a/funtools/tabcalc.c b/funtools/tabcalc.c
deleted file mode 100644
index c3e0b4d..0000000
--- a/funtools/tabcalc.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- *
- * This program was generated automatically by the funcalc program,
- * by running the tabcalc.c template through the funcalc.l lexical analyzer.
- * On this system, it was (or can be) built a command such as:
- *
- * $COMMAND
- *
- */
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <funtools.h>
-#include <word.h>
-#include <NaN.h>
-
-extern char *optarg;
-extern int optind;
-
-/* define the types of event records we have to handle */
-#define REC_CUR 1
-#define REC_PREV 2
-#define REC_NEXT 4
-
-#define ARGC __nxarg
-#define ARGV(n) ((__xargs && (n>=0) && (n<__nxarg)) ? __xargs[n] : NULL)
-
-#define I __i
-#define NROW __nrow
-#define WRITE_ROW FunTableRowPut(ofun, (char *)cur, 1, __i, NULL)
-
-/* default number of rows to read at a time */
-#define MAXROW 8192
-int __maxrow=MAXROW;
-
-/* floating check for equality */
-#ifndef feq
-#define feq(x,y) (fabs((double)x-(double)y)<=(double)1.0E-15)
-/* avoid divide by zero */
-#ifndef div
-#define div(a,b) (feq(b,0)?(getnand()):(a/b))
-#endif
-#endif
-
-typedef struct rowstruct{
-$MEMBERS
-int __ncol;
-} *Row, RowRec;
-
-/* global definitions and init calls go here */
-$GLOBAL
-
-/* main program */
-int main (int argc, char **argv)
-{
- int __c, __i;
- int __get, __got, __total, __rectype, __args;
- int __saved=0;
- int __del=0;
- int __nxarg=0;
- int __ip=0;
- int __nrow=-1;
- int __rawsize=0;
- char *__s;
- char *__cols=NULL;
- char *__argstr=NULL;
- char *__rawsave=NULL;
- char *__rawbuf=NULL;
- char **__xargs=NULL;
- char __tbuf[SZ_LINE];
- Row __rowbuf, __rowrptr, __rowsptr, __roweptr;
- Row cur, prev, next;
- Fun fun, ofun;
- off_t __opos;
- $AUTO
-
- /* local definitions, followed by init calls, go here */
- $LOCAL
-
- /* exit on gio errors */
- if( !getenv("GERROR") )
- setgerror(2);
-
- /* avoid shared library problems by using "process" type for filtering */
- putenv("FILTER_PTYPE=process");
-
- /* process switch arguments */
- while ((__c = getopt(argc, argv, "a:d")) != -1){
- switch(__c){
- case 'a':
- __argstr = xstrdup(optarg);
- break;
- case 'd':
- __del = 1;
- break;
- }
- }
-
- /* check for required arguments */
- __args = argc - optind;
- /* make sure we have minimal arguments */
- if( __args < $ARGS ){
- if( $ARGS == 1 )
- fprintf(stderr, "usage: %s iname\n", argv[0]);
- else
- fprintf(stderr, "usage: %s iname oname [cols]\n", argv[0]);
- goto error;
- }
-
- /* set passed arguments in __xargs array */
- if( __argstr && *__argstr ){
- __xargs = calloc(SZ_LINE, sizeof(char *));
- while( word(__argstr, __tbuf, &__ip) ){
- if( __nxarg >= SZ_LINE ){
- gerror(stderr, "too many args passed via -a\n");
- goto error;
- }
- __xargs[__nxarg++] = xstrdup(__tbuf);
- }
- }
-
- /* set rectype: determine whether we need prev,next records */
- __rectype=$RECTYPE;
-
- /* get maxrow,if user-specified */
- if( (__s=(char *)getenv("FUN_MAXROW")) != NULL )
- __maxrow = atoi(__s);
- /* make sure max row is large enough to handle prev, next */
- if( __rectype & (REC_PREV|REC_NEXT) )
- __maxrow = MAX(3,__maxrow);
- else
- __maxrow = MAX(1,__maxrow);
- /* this is what we read each time */
- __get = __maxrow;
-
- /* open input file */
- if( !(fun = FunOpen(argv[optind+0], "rc", NULL)) ){
- gerror(stderr, "could not FunOpen input file: %s\n", argv[optind+0]);
- goto error;
- }
-
- /* open the output FITS image, inheriting params from input */
- if( $ARGS > 1 ){
- if( !(ofun = FunOpen(argv[optind+1], "w", fun)) ){
- gerror(stderr, "could not FunOpen output file: %s\n", argv[optind+1]);
- goto error;
- }
- }
-
- /* select columns */
- FunColumnSelect(fun, sizeof(RowRec), "merge=$MERGE",
- $SELECT
- "$N", "1J", "r", FUN_OFFSET(Row, __ncol),
- NULL);
-
- /* activate specified columns -- these will be written to the output file */
- if( __args >= 3 ) __cols = argv[optind+2];
- FunColumnActivate(fun, __cols, NULL);
-
- /* allocate space for __rowbuf -- we will manage this buffer ourselves */
- /* NB: we need 2 extra rows for prev and next */
- __rowbuf = (Row)xcalloc(__maxrow+2, sizeof(RowRec));
-
- /* get size of raw data record and allocate a raw record */
- FunInfoGet(fun, FUN_RAWSIZE, &__rawsize, 0);
- __rawsave = (char *)xcalloc(1, __rawsize);
-
- /* no record read yet */
- __total = 0;
-
- /* any user-defined calls before we enter the row loop go here */
- $BEFORE
-
- /* main loop -- get rows and process */
- while( 1 ){
- if( !(__rectype & (REC_PREV|REC_NEXT)) ){
- /* offset of next record to process */
- __rowsptr = __rowbuf;
- __rowrptr = __rowbuf;
- }
- /* need prev record */
- else if( __rectype & REC_PREV ){
- /* no records yet: read new batch of records into start of __rowbuf */
- if( __total == 0 ){
- __rowsptr = __rowbuf+1;
- __rowrptr = __rowbuf;
- }
- /* read last processed record into start of __rowbuf, process others */
- else{
- if( __rectype & REC_NEXT ){
- memcpy(__rowbuf, __rowrptr+(__got-2), sizeof(RowRec)*2);
- __rowsptr = __rowbuf+1;
- __rowrptr = __rowbuf+2;
- /* save raw data for this unprocessed record */
- FunInfoGet(fun, FUN_RAWBUF, &__rawbuf, 0);
- memcpy(__rawsave, __rawbuf+((__got-1)*__rawsize), __rawsize);
- }
- else{
- memcpy(__rowbuf, __rowrptr+(__got-1), sizeof(RowRec));
- __rowsptr = __rowbuf+1;
- __rowrptr = __rowbuf+1;
- }
- }
- }
- /* if we did not process last record, seek to it now and start there */
- else if( __rectype & REC_NEXT ){
- /* no records yet: read new batch of records into start of __rowbuf */
- if( __total == 0 ){
- __rowsptr = __rowbuf;
- __rowrptr = __rowbuf;
- }
- /* read last processed record into first new record, process others */
- else{
- memcpy(__rowbuf, __rowrptr+(__got-1), sizeof(RowRec));
- __rowsptr = __rowbuf;
- __rowrptr = __rowbuf+1;
- /* save raw data for this unprocessed record */
- FunInfoGet(fun, FUN_RAWBUF, &__rawbuf, 0);
- memcpy(__rawsave, __rawbuf+((__got-1)*__rawsize), __rawsize);
- }
- }
-
- /* read new rows */
- if( !FunTableRowGet(fun, __rowrptr, __get, NULL, &__got) || !__got )
- break;
-
- /* last record to process */
- __roweptr = __rowrptr + __got;
- /* if we need access to next record, don't process the last one we read */
- if( __rectype & REC_NEXT ){
- __roweptr--;
- }
-
- /* make sure there are rows to process */
- if( (__roweptr-__rowsptr) <= 0 ) break;
-
- /* process all rows */
- for(cur=__rowsptr, __i=__rowsptr-__rowrptr; cur<__roweptr; cur++, __i++){
- /* save raw buffer and switch rawbuf from previous */
- if( __i == -1 ){
- FunInfoGet(fun, FUN_RAWBUF, &__rawbuf, 0);
- FunInfoPut(fun, FUN_RAWBUF, &__rawsave, 0);
- __i = 0;
- __saved = 1;
- }
- /* restore raw buffer */
- else if( __saved ){
- FunInfoPut(fun, FUN_RAWBUF, &__rawbuf, 0);
- __i = 0;
- __saved = 0;
- }
- /* finished another row */
- NROW++;
- /* set up pointer to prev and next as needed */
- if( __rectype & REC_PREV ) prev = cur - 1;
- if( __rectype & REC_NEXT ) next = cur + 1;
- /* execute the expression */
- $EXPR
- /* write out this row with the new column */
- if( $ARGS > 1 ) WRITE_ROW;
- }
- /* update total */
- __total += __got;
- }
-
- /* any user-defined calls after we finish the row loop go here */
- $AFTER
-
- /* free row data */
- if( __rowbuf ) xfree(__rowbuf);
- if( __rawsave ) xfree(__rawsave);
-
- /* free arg strings */
- if( __xargs ){
- for(__i=0; __i<__nxarg; __i++){
- if( __xargs[__i] ) xfree(__xargs[__i]);
- }
- xfree(__xargs);
- }
-
- /* clean up -- close output before input to perform flush automatically */
- if( $ARGS > 1 )
- FunClose(ofun);
- FunClose(fun);
-
- /* delete program if necessary */
- if( __del ) unlink(argv[0]);
- return(0);
-
-error:
- /* delete program if necessary */
- if( __del ) unlink(argv[0]);
- return(1);
-}
diff --git a/funtools/tabcalc_c.h b/funtools/tabcalc_c.h
deleted file mode 100644
index 621562c..0000000
--- a/funtools/tabcalc_c.h
+++ /dev/null
@@ -1 +0,0 @@
-static char *TABCALC_C="\n/*\n *\n * This program was generated automatically by the funcalc program,\n * by running the tabcalc.c template through the funcalc.l lexical analyzer.\n * On this system, it was (or can be) built a command such as:\n *\n * $COMMAND\n *\n */\n#include <stdio.h>\n#include <unistd.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <funtools.h>\n#include <word.h>\n#include <NaN.h>\n\nextern char *optarg;\nextern int optind;\n\n/* define the types of event records we have to handle */\n#define REC_CUR 1\n#define REC_PREV 2\n#define REC_NEXT 4\n\n#define ARGC __nxarg\n#define ARGV(n) ((__xargs && (n>=0) && (n<__nxarg)) ? __xargs[n] : NULL)\n\n#define I __i\n#define NROW __nrow\n#define WRITE_ROW FunTableRowPut(ofun, (char *)cur, 1, __i, NULL)\n\n/* default number of rows to read at a time */\n#define MAXROW 8192\nint __maxrow=MAXROW;\n\n/* floating check for equality */\n#ifndef feq\n#define feq(x,y) (fabs((double)x-(double)y)<=(double)1.0E-15)\n/* avoid divide by zero */\n#ifndef div\n#define div(a,b) (feq(b,0)?(getnand()):(a/b))\n#endif\n#endif\n\ntypedef struct rowstruct{\n$MEMBERS\nint __ncol;\n} *Row, RowRec;\n\n/* global definitions and init calls go here */\n$GLOBAL\n\n/* main program */\nint main (int argc, char **argv)\n{\n int __c, __i;\n int __get, __got, __total, __rectype, __args;\n int __saved=0;\n int __del=0;\n int __nxarg=0;\n int __ip=0;\n int __nrow=-1;\n int __rawsize=0;\n char *__s;\n char *__cols=NULL;\n char *__argstr=NULL;\n char *__rawsave=NULL;\n char *__rawbuf=NULL;\n char **__xargs=NULL;\n char __tbuf[SZ_LINE];\n Row __rowbuf, __rowrptr, __rowsptr, __roweptr;\n Row cur, prev, next;\n Fun fun, ofun;\n off_t __opos;\n $AUTO\n \n /* local definitions, followed by init calls, go here */\n $LOCAL\n\n /* exit on gio errors */\n if( !getenv(\"GERROR\") )\n setgerror(2);\n\n /* avoid shared library problems by using \"process\" type for filtering */\n putenv(\"FILTER_PTYPE=process\");\n\n /* process switch arguments */\n while ((__c = getopt(argc, argv, \"a:d\")) != -1){\n switch(__c){\n case 'a':\n __argstr = xstrdup(optarg);\n break;\n case 'd':\n __del = 1;\n break;\n }\n }\n\n /* check for required arguments */\n __args = argc - optind;\n /* make sure we have minimal arguments */\n if( __args < $ARGS ){\n if( $ARGS == 1 )\n fprintf(stderr, \"usage: %s iname\\n\", argv[0]);\n else\n fprintf(stderr, \"usage: %s iname oname [cols]\\n\", argv[0]);\n goto error;\n }\n\n /* set passed arguments in __xargs array */\n if( __argstr && *__argstr ){\n __xargs = calloc(SZ_LINE, sizeof(char *));\n while( word(__argstr, __tbuf, &__ip) ){\n if( __nxarg >= SZ_LINE ){\n gerror(stderr, \"too many args passed via -a\\n\");\n goto error;\n }\n __xargs[__nxarg++] = xstrdup(__tbuf);\n }\n }\n\n /* set rectype: determine whether we need prev,next records */\n __rectype=$RECTYPE;\n\n /* get maxrow,if user-specified */\n if( (__s=(char *)getenv(\"FUN_MAXROW\")) != NULL )\n __maxrow = atoi(__s);\n /* make sure max row is large enough to handle prev, next */\n if( __rectype & (REC_PREV|REC_NEXT) )\n __maxrow = MAX(3,__maxrow);\n else\n __maxrow = MAX(1,__maxrow);\n /* this is what we read each time */\n __get = __maxrow;\n\n /* open input file */\n if( !(fun = FunOpen(argv[optind+0], \"rc\", NULL)) ){\n gerror(stderr, \"could not FunOpen input file: %s\\n\", argv[optind+0]);\n goto error;\n }\n\n /* open the output FITS image, inheriting params from input */\n if( $ARGS > 1 ){\n if( !(ofun = FunOpen(argv[optind+1], \"w\", fun)) ){\n gerror(stderr, \"could not FunOpen output file: %s\\n\", argv[optind+1]);\n goto error;\n }\n }\n\n /* select columns */\n FunColumnSelect(fun, sizeof(RowRec), \"merge=$MERGE\", \n $SELECT\n \"$N\", \"1J\", \"r\", FUN_OFFSET(Row, __ncol),\n NULL);\n\n /* activate specified columns -- these will be written to the output file */\n if( __args >= 3 ) __cols = argv[optind+2];\n FunColumnActivate(fun, __cols, NULL);\n\n /* allocate space for __rowbuf -- we will manage this buffer ourselves */\n /* NB: we need 2 extra rows for prev and next */\n __rowbuf = (Row)xcalloc(__maxrow+2, sizeof(RowRec));\n\n /* get size of raw data record and allocate a raw record */\n FunInfoGet(fun, FUN_RAWSIZE, &__rawsize, 0);\n __rawsave = (char *)xcalloc(1, __rawsize);\n\n /* no record read yet */\n __total = 0;\n\n /* any user-defined calls before we enter the row loop go here */\n $BEFORE\n\n /* main loop -- get rows and process */\n while( 1 ){\n if( !(__rectype & (REC_PREV|REC_NEXT)) ){\n /* offset of next record to process */\n __rowsptr = __rowbuf;\n __rowrptr = __rowbuf;\n }\n /* need prev record */\n else if( __rectype & REC_PREV ){\n /* no records yet: read new batch of records into start of __rowbuf */\n if( __total == 0 ){\n __rowsptr = __rowbuf+1;\n __rowrptr = __rowbuf;\n }\n /* read last processed record into start of __rowbuf, process others */\n else{\n if( __rectype & REC_NEXT ){\n memcpy(__rowbuf, __rowrptr+(__got-2), sizeof(RowRec)*2);\n __rowsptr = __rowbuf+1;\n __rowrptr = __rowbuf+2;\n /* save raw data for this unprocessed record */\n FunInfoGet(fun, FUN_RAWBUF, &__rawbuf, 0);\n memcpy(__rawsave, __rawbuf+((__got-1)*__rawsize), __rawsize);\n }\n else{\n memcpy(__rowbuf, __rowrptr+(__got-1), sizeof(RowRec));\n __rowsptr = __rowbuf+1;\n __rowrptr = __rowbuf+1;\n }\n }\n }\n /* if we did not process last record, seek to it now and start there */\n else if( __rectype & REC_NEXT ){\n /* no records yet: read new batch of records into start of __rowbuf */\n if( __total == 0 ){\n __rowsptr = __rowbuf;\n __rowrptr = __rowbuf;\n }\n /* read last processed record into first new record, process others */\n else{\n memcpy(__rowbuf, __rowrptr+(__got-1), sizeof(RowRec));\n __rowsptr = __rowbuf;\n __rowrptr = __rowbuf+1;\n /* save raw data for this unprocessed record */\n FunInfoGet(fun, FUN_RAWBUF, &__rawbuf, 0);\n memcpy(__rawsave, __rawbuf+((__got-1)*__rawsize), __rawsize);\n }\n }\n\n /* read new rows */\n if( !FunTableRowGet(fun, __rowrptr, __get, NULL, &__got) || !__got )\n break;\n\n /* last record to process */\n __roweptr = __rowrptr + __got;\n /* if we need access to next record, don't process the last one we read */\n if( __rectype & REC_NEXT ){\n __roweptr--;\n }\n\n /* make sure there are rows to process */\n if( (__roweptr-__rowsptr) <= 0 ) break;\n\n /* process all rows */\n for(cur=__rowsptr, __i=__rowsptr-__rowrptr; cur<__roweptr; cur++, __i++){\n /* save raw buffer and switch rawbuf from previous */\n if( __i == -1 ){\n FunInfoGet(fun, FUN_RAWBUF, &__rawbuf, 0);\n FunInfoPut(fun, FUN_RAWBUF, &__rawsave, 0);\n __i = 0;\n __saved = 1;\n }\n /* restore raw buffer */\n else if( __saved ){\n FunInfoPut(fun, FUN_RAWBUF, &__rawbuf, 0);\n __i = 0;\n __saved = 0;\n }\n /* finished another row */\n NROW++;\n /* set up pointer to prev and next as needed */\n if( __rectype & REC_PREV ) prev = cur - 1;\n if( __rectype & REC_NEXT ) next = cur + 1;\n /* execute the expression */\n $EXPR\n /* write out this row with the new column */\n if( $ARGS > 1 ) WRITE_ROW;\n }\n /* update total */\n __total += __got;\n }\n\n /* any user-defined calls after we finish the row loop go here */\n $AFTER\n\n /* free row data */\n if( __rowbuf ) xfree(__rowbuf);\n if( __rawsave ) xfree(__rawsave);\n\n /* free arg strings */\n if( __xargs ){\n for(__i=0; __i<__nxarg; __i++){\n if( __xargs[__i] ) xfree(__xargs[__i]);\n }\n xfree(__xargs);\n }\n\n /* clean up -- close output before input to perform flush automatically */\n if( $ARGS > 1 )\n FunClose(ofun);\n FunClose(fun);\n\n /* delete program if necessary */\n if( __del ) unlink(argv[0]);\n return(0);\n\nerror:\n /* delete program if necessary */\n if( __del ) unlink(argv[0]);\n return(1);\n}\n";
diff --git a/funtools/tcl.m4 b/funtools/tcl.m4
deleted file mode 100644
index 8125361..0000000
--- a/funtools/tcl.m4
+++ /dev/null
@@ -1,2464 +0,0 @@
-#------------------------------------------------------------------------
-# SC_PATH_TCLCONFIG --
-#
-# Locate the tclConfig.sh file and perform a sanity check on
-# the Tcl compile flags
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --with-tcl=...
-#
-# Defines the following vars:
-# TCL_BIN_DIR Full path to the directory containing
-# the tclConfig.sh file
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_TCLCONFIG, [
- #
- # Ok, lets find the tcl configuration
- # First, look for one uninstalled.
- # the alternative search directory is invoked by --with-tcl
- #
-
- if test x"${no_tcl}" = x ; then
- # we reset no_tcl in case something fails here
- no_tcl=true
- AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
- AC_MSG_CHECKING([for Tcl configuration])
- if test x"${withval}" != xno ; then
- AC_CACHE_VAL(ac_cv_c_tclconfig,[
-
- # First check to see if --with-tcl was specified.
- if test x"${with_tclconfig}" != x ; then
- if test -f "${with_tclconfig}/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
- else
- AC_MSG_RESULT([${with_tclconfig} directory doesn't contain tclConfig.sh])
- fi
- fi
-
- # then check for a private Tcl installation
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ../tcl \
- `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../tcl \
- `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../../tcl \
- `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
-
- # check in a few common install locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in `ls -d ${libdir} 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` \
- `ls -d /usr/contrib/lib 2>/dev/null` \
- `ls -d /usr/lib 2>/dev/null` \
- ; do
- if test -f "$i/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i; pwd)`
- break
- fi
- done
- fi
-
- # check in a few other private locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ${srcdir}/../tcl \
- `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
- ])
- else
- AC_MSG_RESULT(skipping Tcl configuration)
- ac_cv_c_tclconfig="none"
- fi
-
- if test x"${ac_cv_c_tclconfig}" = x ; then
- TCL_BIN_DIR="# no Tcl configs found"
- AC_MSG_RESULT(can't find Tcl configuration definitions)
-# no Tcl is OK egm 03/25/03
-# AC_MSG_WARN(Can't find Tcl configuration definitions)
-# exit 0
- elif test x"${ac_cv_c_tclconfig}" = xnone ; then
- TCL_BIN_DIR=""
- else
- no_tcl=
- TCL_BIN_DIR=${ac_cv_c_tclconfig}
- AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
- fi
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_PATH_TKCONFIG --
-#
-# Locate the tkConfig.sh file
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --with-tk=...
-#
-# Defines the following vars:
-# TK_BIN_DIR Full path to the directory containing
-# the tkConfig.sh file
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_TKCONFIG, [
- #
- # Ok, lets find the tk configuration
- # First, look for one uninstalled.
- # the alternative search directory is invoked by --with-tk
- #
-
- if test x"${no_tk}" = x ; then
- # we reset no_tk in case something fails here
- no_tk=true
- AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
- AC_MSG_CHECKING([for Tk configuration])
- AC_CACHE_VAL(ac_cv_c_tkconfig,[
-
- # First check to see if --with-tkconfig was specified.
- if test x"${with_tkconfig}" != x ; then
- if test -f "${with_tkconfig}/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
- else
- AC_MSG_RESULT([${with_tkconfig} directory doesn't contain tkConfig.sh])
- fi
- fi
-
- # then check for a private Tk library
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in \
- ../tk \
- `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../tk \
- `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../../tk \
- `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
- # check in a few common install locations
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in `ls -d ${libdir} 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` \
- `ls -d /usr/contrib/lib 2>/dev/null` \
- `ls -d /usr/lib 2>/dev/null` \
- ; do
- if test -f "$i/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i; pwd)`
- break
- fi
- done
- fi
- # check in a few other private locations
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in \
- ${srcdir}/../tk \
- `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
- ])
- if test x"${ac_cv_c_tkconfig}" = x ; then
- TK_BIN_DIR="# no Tk configs found"
- AC_MSG_RESULT(can't find Tk configuration definitions)
-# no Tk is OK egm 03/25/03
-# AC_MSG_WARN(Can't find Tk configuration definitions)
-# exit 0
- else
- no_tk=
- TK_BIN_DIR=${ac_cv_c_tkconfig}
- AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
- fi
- fi
-
-])
-
-#------------------------------------------------------------------------
-# SC_LOAD_TCLCONFIG --
-#
-# Load the tclConfig.sh file
-#
-# Arguments:
-#
-# Requires the following vars to be set:
-# TCL_BIN_DIR
-#
-# Results:
-#
-# Subst the following vars:
-# TCL_BIN_DIR
-# TCL_SRC_DIR
-# TCL_LIB_FILE
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_LOAD_TCLCONFIG, [
- AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
-
- if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
- AC_MSG_RESULT([loading])
- . $TCL_BIN_DIR/tclConfig.sh
- else
- AC_MSG_RESULT([file not found])
- fi
-
- #
- # If the TCL_BIN_DIR is the build directory (not the install directory),
- # then set the common variable name to the value of the build variables.
- # For example, the variable TCL_LIB_SPEC will be set to the value
- # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
- # instead of TCL_BUILD_LIB_SPEC since it will work with both an
- # installed and uninstalled version of Tcl.
- #
-
- if test -f $TCL_BIN_DIR/Makefile ; then
- TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
- TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
- TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
- fi
-
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
- eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
- eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
- eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
- AC_SUBST(TCL_VERSION)
- AC_SUBST(TCL_BIN_DIR)
- AC_SUBST(TCL_SRC_DIR)
-
- AC_SUBST(TCL_LIB_FILE)
- AC_SUBST(TCL_LIB_FLAG)
- AC_SUBST(TCL_LIB_SPEC)
-
- AC_SUBST(TCL_STUB_LIB_FILE)
- AC_SUBST(TCL_STUB_LIB_FLAG)
- AC_SUBST(TCL_STUB_LIB_SPEC)
-])
-
-#------------------------------------------------------------------------
-# SC_LOAD_TKCONFIG --
-#
-# Load the tkConfig.sh file
-#
-# Arguments:
-#
-# Requires the following vars to be set:
-# TK_BIN_DIR
-#
-# Results:
-#
-# Sets the following vars that should be in tkConfig.sh:
-# TK_BIN_DIR
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_LOAD_TKCONFIG, [
- AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
-
- if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
- AC_MSG_RESULT([loading])
- . $TK_BIN_DIR/tkConfig.sh
- else
- AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
- fi
-
- AC_SUBST(TK_VERSION)
- AC_SUBST(TK_BIN_DIR)
- AC_SUBST(TK_SRC_DIR)
- AC_SUBST(TK_LIB_FILE)
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_SHARED --
-#
-# Allows the building of shared libraries
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-shared=yes|no
-#
-# Defines the following vars:
-# STATIC_BUILD Used for building import/export libraries
-# on Windows.
-#
-# Sets the following vars:
-# SHARED_BUILD Value of 1 or 0
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_SHARED, [
- AC_MSG_CHECKING([how to build libraries])
- AC_ARG_ENABLE(shared,
- [ --enable-shared build and link with shared libraries [--enable-shared]],
- [tcl_ok=$enableval], [tcl_ok=yes])
-
- if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- tcl_ok=$enableval
- else
- tcl_ok=yes
- fi
-
- if test "$tcl_ok" = "yes" ; then
- AC_MSG_RESULT([shared])
- SHARED_BUILD=1
- else
- AC_MSG_RESULT([static])
- SHARED_BUILD=0
- AC_DEFINE(STATIC_BUILD)
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_FRAMEWORK --
-#
-# Allows the building of shared libraries into frameworks
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-framework=yes|no
-#
-# Sets the following vars:
-# FRAMEWORK_BUILD Value of 1 or 0
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_FRAMEWORK, [
- AC_MSG_CHECKING([how to package libraries])
- AC_ARG_ENABLE(framework,
- [ --enable-framework package shared libraries in frameworks [--disable-framework]],
- [tcl_ok=$enableval], [tcl_ok=no])
-
- if test "${enable_framework+set}" = set; then
- enableval="$enable_framework"
- tcl_ok=$enableval
- else
- tcl_ok=no
- fi
-
- if test "$tcl_ok" = "yes" ; then
- AC_MSG_RESULT([framework])
- FRAMEWORK_BUILD=1
- if test "${SHARED_BUILD}" = "0" ; then
- AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes")
- FRAMEWORK_BUILD=0
- fi
- else
- AC_MSG_RESULT([standard shared library])
- FRAMEWORK_BUILD=0
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_THREADS --
-#
-# Specify if thread support should be enabled
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-threads
-#
-# Sets the following vars:
-# THREADS_LIBS Thread library(s)
-#
-# Defines the following vars:
-# TCL_THREADS
-# _REENTRANT
-# _THREAD_SAFE
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_THREADS, [
- AC_MSG_CHECKING(for building with threads)
- AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
- [tcl_ok=$enableval], [tcl_ok=no])
-
- if test "$tcl_ok" = "yes"; then
- AC_MSG_RESULT(yes)
- TCL_THREADS=1
- AC_DEFINE(TCL_THREADS)
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- AC_DEFINE(USE_THREAD_ALLOC)
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_THREAD_SAFE)
- AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "no"; then
- # Check a little harder for __pthread_mutex_init in the same
- # library, as some systems hide it there until pthread.h is
- # defined. We could alternatively do an AC_TRY_COMPILE with
- # pthread.h, but that will work with libpthread really doesn't
- # exist, like AIX 4.2. [Bug: 4359]
- AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- fi
-
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthread"
- else
- AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthreads"
- else
- AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "no"; then
- AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -pthread"
- else
- TCL_THREADS=0
- AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
- fi
- fi
- fi
- fi
-
- # Does the pthread-implementation provide
- # 'pthread_attr_setstacksize' ?
-
- ac_saved_libs=$LIBS
- LIBS="$LIBS $THREADS_LIBS"
- AC_CHECK_FUNCS(pthread_attr_setstacksize)
- LIBS=$ac_saved_libs
- AC_CHECK_FUNCS(readdir_r)
- else
- TCL_THREADS=0
- AC_MSG_RESULT([no (default)])
- fi
- AC_SUBST(TCL_THREADS)
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_SYMBOLS --
-#
-# Specify if debugging symbols should be used.
-# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
-# can also be enabled.
-#
-# Arguments:
-# none
-#
-# Requires the following vars to be set in the Makefile:
-# CFLAGS_DEBUG
-# CFLAGS_OPTIMIZE
-# LDFLAGS_DEBUG
-# LDFLAGS_OPTIMIZE
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-symbols
-#
-# Defines the following vars:
-# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
-# Sets to $(CFLAGS_OPTIMIZE) if false
-# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
-# Sets to $(LDFLAGS_OPTIMIZE) if false
-# DBGX Debug library extension
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_SYMBOLS, [
- AC_MSG_CHECKING([for build with symbols])
- AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
-# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
- if test "$tcl_ok" = "no"; then
- CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
- LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
- AC_MSG_RESULT([no])
- else
- CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
- LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
- if test "$tcl_ok" = "yes"; then
- AC_MSG_RESULT([yes (standard debugging)])
- fi
- fi
- AC_SUBST(CFLAGS_DEFAULT)
- AC_SUBST(LDFLAGS_DEFAULT)
-
- if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
- AC_DEFINE(TCL_MEM_DEBUG)
- fi
-
- if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- AC_DEFINE(TCL_COMPILE_DEBUG)
- AC_DEFINE(TCL_COMPILE_STATS)
- fi
-
- if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
- if test "$tcl_ok" = "all"; then
- AC_MSG_RESULT([enabled symbols mem compile debugging])
- else
- AC_MSG_RESULT([enabled $tcl_ok debugging])
- fi
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_LANGINFO --
-#
-# Allows use of modern nl_langinfo check for better l10n.
-# This is only relevant for Unix.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-langinfo=yes|no (default is yes)
-#
-# Defines the following vars:
-# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_LANGINFO, [
- AC_ARG_ENABLE(langinfo,
- [ --enable-langinfo use nl_langinfo if possible to determine
- encoding at startup, otherwise use old heuristic],
- [langinfo_ok=$enableval], [langinfo_ok=yes])
-
- HAVE_LANGINFO=0
- if test "$langinfo_ok" = "yes"; then
- if test "$langinfo_ok" = "yes"; then
- AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
- fi
- fi
- AC_MSG_CHECKING([whether to use nl_langinfo])
- if test "$langinfo_ok" = "yes"; then
- AC_TRY_COMPILE([#include <langinfo.h>],
- [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no])
- if test "$langinfo_ok" = "no"; then
- langinfo_ok="no (could not compile with nl_langinfo)";
- fi
- if test "$langinfo_ok" = "yes"; then
- AC_DEFINE(HAVE_LANGINFO)
- fi
- fi
- AC_MSG_RESULT([$langinfo_ok])
-])
-
-#--------------------------------------------------------------------
-# SC_CONFIG_MANPAGES
-#
-# Decide whether to use symlinks for linking the manpages and
-# whether to compress the manpages after installation.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-man-symlinks
-# --enable-man-compression=PROG
-#
-# Defines the following variable:
-#
-# MKLINKS_FLAGS - The apropriate flags for mkLinks
-# according to the user's selection.
-#
-#--------------------------------------------------------------------
-AC_DEFUN(SC_CONFIG_MANPAGES, [
-
- AC_MSG_CHECKING([whether to use symlinks for manpages])
- AC_ARG_ENABLE(man-symlinks,
- [ --enable-man-symlinks use symlinks for the manpages],
- test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --symlinks",
- enableval="no")
- AC_MSG_RESULT([$enableval])
-
- AC_MSG_CHECKING([compression for manpages])
- AC_ARG_ENABLE(man-compression,
- [ --enable-man-compression=PROG
- compress the manpages with PROG],
- test "$enableval" = "yes" && echo && AC_MSG_ERROR([missing argument to --enable-man-compression])
- test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --compress $enableval",
- enableval="no")
- AC_MSG_RESULT([$enableval])
-
- AC_SUBST(MKLINKS_FLAGS)
-])
-
-#--------------------------------------------------------------------
-# SC_CONFIG_CFLAGS
-#
-# Try to determine the proper flags to pass to the compiler
-# for building shared libraries and other such nonsense.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines and substitutes the following vars:
-#
-# DL_OBJS - Name of the object file that implements dynamic
-# loading for Tcl on this system.
-# DL_LIBS - Library file(s) to include in tclsh and other base
-# applications in order for the "load" command to work.
-# LDFLAGS - Flags to pass to the compiler when linking object
-# files into an executable application binary such
-# as tclsh.
-# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
-# that tell the run-time dynamic linker where to look
-# for shared libraries such as libtcl.so. Depends on
-# the variable LIB_RUNTIME_DIR in the Makefile. Could
-# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
-# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
-# that tell the run-time dynamic linker where to look
-# for shared libraries such as libtcl.so. Depends on
-# the variable LIB_RUNTIME_DIR in the Makefile.
-# MAKE_LIB - Command to execute to build the a library;
-# differs when building shared or static.
-# MAKE_STUB_LIB -
-# Command to execute to build a stub library.
-# INSTALL_LIB - Command to execute to install a library;
-# differs when building shared or static.
-# INSTALL_STUB_LIB -
-# Command to execute to install a stub library.
-# STLIB_LD - Base command to use for combining object files
-# into a static library.
-# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
-# of a shared library (may request position-independent
-# code, among other things).
-# SHLIB_LD - Base command to use for combining object files
-# into a shared library.
-# SHLIB_LD_FLAGS -Flags to pass when building a shared library. This
-# differes from the SHLIB_CFLAGS as it is not used
-# when building object files or executables.
-# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
-# creating shared libraries. This symbol typically
-# goes at the end of the "ld" commands that build
-# shared libraries. The value of the symbol is
-# "${LIBS}" if all of the dependent libraries should
-# be specified when creating a shared library. If
-# dependent libraries should not be specified (as on
-# SunOS 4.x, where they cause the link to fail, or in
-# general if Tcl and Tk aren't themselves shared
-# libraries), then this symbol has an empty string
-# as its value.
-# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
-# extensions. An empty string means we don't know how
-# to use shared libraries on this platform.
-# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
-# TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
-# tclConfig.sh, since they are only used for the build
-# of Tcl and Tk.
-# Examples: MacOS X records the library version and
-# compatibility version in the shared library. But
-# of course the Tcl version of this is only used for Tcl.
-# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
-# in a static or shared library name, using the $VERSION variable
-# to put the version in the right place. This is used
-# by platforms that need non-standard library names.
-# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
-# to have a version after the .so, and ${VERSION}.a
-# on AIX, since a shared library needs to have
-# a .a extension whereas shared objects for loadable
-# extensions have a .so extension. Defaults to
-# ${VERSION}${SHLIB_SUFFIX}.
-# TCL_NEEDS_EXP_FILE -
-# 1 means that an export file is needed to link to a
-# shared library.
-# TCL_EXP_FILE - The name of the installed export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
-# TCL_BUILD_EXP_FILE -
-# The name of the built export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
-# CFLAGS_DEBUG -
-# Flags used when running the compiler in debug mode
-# CFLAGS_OPTIMIZE -
-# Flags used when running the compiler in optimize mode
-# EXTRA_CFLAGS
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_CONFIG_CFLAGS, [
-
- # Step 0.a: Enable 64 bit support?
-
- AC_MSG_CHECKING([if 64bit support is requested])
- AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
-
- if test "$enableval" = "yes"; then
- do64bit=yes
- else
- do64bit=no
- fi
- AC_MSG_RESULT($do64bit)
-
- # Step 0.b: Enable Solaris 64 bit VIS support?
-
- AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
- AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
-
- if test "$enableval" = "yes"; then
- # Force 64bit on with VIS
- do64bit=yes
- do64bitVIS=yes
- else
- do64bitVIS=no
- fi
- AC_MSG_RESULT($do64bitVIS)
-
- # Step 1: set the variable "system" to hold the name and version number
- # for the system. This can usually be done via the "uname" command, but
- # there are a few systems, like Next, where this doesn't work.
-
- AC_MSG_CHECKING([system version (for dynamic loading)])
- if test -f /usr/lib/NextStep/software_version; then
- system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
- else
- system=`uname -s`-`uname -r`
- if test "$?" -ne 0 ; then
- AC_MSG_RESULT([unknown (can't find uname command)])
- system=unknown
- else
- # Special check for weird MP-RAS system (uname returns weird
- # results, and the version is kept in special file).
-
- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
- fi
- if test "`uname -s`" = "AIX" ; then
- system=AIX-`uname -v`.`uname -r`
- fi
- AC_MSG_RESULT($system)
- fi
- fi
-
- # Step 2: check for existence of -ldl library. This is needed because
- # Linux can use either -ldl or -ldld for dynamic loading.
-
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
-
- # Require ranlib early so we can override it in special cases below.
-
- AC_REQUIRE([AC_PROG_RANLIB])
-
- # Step 3: set configuration options based on system name and version.
-
- do64bit_ok=no
- EXTRA_CFLAGS=""
- TCL_EXPORT_FILE_SUFFIX=""
- UNSHARED_LIB_SUFFIX=""
- TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
- ECHO_VERSION='`echo ${VERSION}`'
- TCL_LIB_VERSIONS_OK=ok
- CFLAGS_DEBUG=-g
- CFLAGS_OPTIMIZE=-O
- if test "$GCC" = "yes" ; then
- CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
- else
- CFLAGS_WARNING=""
- fi
- TCL_NEEDS_EXP_FILE=0
- TCL_BUILD_EXP_FILE=""
- TCL_EXP_FILE=""
-dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
-dnl AC_CHECK_TOOL(AR, ar)
- AC_CHECK_PROG(AR, ar, ar)
- if test "${AR}" = "" ; then
- AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
- fi
- STLIB_LD='${AR} cr'
- LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
- PLAT_OBJS=""
- case $system in
- AIX-5.*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
- # AIX requires the _r compiler when gcc isn't being used
- if test "${CC}" != "cc_r" ; then
- CC=${CC}_r
- fi
- AC_MSG_RESULT(Using $CC for compiling with threads)
- fi
- LIBS="$LIBS -lc"
- # AIX-5 uses ELF style dynamic libraries
- SHLIB_CFLAGS=""
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- if test "`uname -m`" = "ia64" ; then
- # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
- SHLIB_LD="/usr/ccs/bin/ld -G -z text"
- # AIX-5 has dl* in libc.so
- DL_LIBS=""
- if test "$GCC" = "yes" ; then
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- else
- CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
- fi
- LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- else
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
- fi
-
- # Note: need the LIBS below, otherwise Tk won't find Tcl's
- # symbols when dynamically loaded into tclsh.
-
- DL_OBJS="tclLoadDl.o"
- LDFLAGS=""
-
- LD_LIBRARY_PATH_VAR="LIBPATH"
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- else
- do64bit_ok=yes
- EXTRA_CFLAGS="-q64"
- LDFLAGS="-q64"
- RANLIB="${RANLIB} -X64"
- AR="${AR} -X64"
- SHLIB_LD_FLAGS="-b64"
- fi
- fi
- ;;
- AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
- # AIX requires the _r compiler when gcc isn't being used
- if test "${CC}" != "cc_r" ; then
- CC=${CC}_r
- fi
- AC_MSG_RESULT(Using $CC for compiling with threads)
- fi
- LIBS="$LIBS -lc"
- SHLIB_CFLAGS=""
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- LD_LIBRARY_PATH_VAR="LIBPATH"
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
-
- # AIX v<=4.1 has some different flags than 4.2+
- if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
- # upgrade to 2.5x egm 3/25/03
- AC_LIBOBJ(tclLoadAix.o)
- HAVE_COMPAT=true
- DL_LIBS="-lld"
- fi
-
- # On AIX <=v4 systems, libbsd.a has to be linked in to support
- # non-blocking file IO. This library has to be linked in after
- # the MATH_LIBS or it breaks the pow() function. The way to
- # insure proper sequencing, is to add it to the tail of MATH_LIBS.
- # This library also supplies gettimeofday.
- #
- # AIX does not have a timezone field in struct tm. When the AIX
- # bsd library is used, the timezone global and the gettimeofday
- # methods are to be avoided for timezone deduction instead, we
- # deduce the timezone by comparing the localtime result on a
- # known GMT value.
-
- AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
- if test $libbsd = yes; then
- MATH_LIBS="$MATH_LIBS -lbsd"
- AC_DEFINE(USE_DELTA_FOR_TZ)
- fi
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- else
- do64bit_ok=yes
- EXTRA_CFLAGS="-q64"
- LDFLAGS="-q64"
- RANLIB="${RANLIB} -X64"
- AR="${AR} -X64"
- SHLIB_LD_FLAGS="-b64"
- fi
- fi
- ;;
- BSD/OS-2.1*|BSD/OS-3*)
- SHLIB_CFLAGS=""
- SHLIB_LD="shlicc -r"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- BSD/OS-4.*)
- SHLIB_CFLAGS="-export-dynamic -fPIC"
- SHLIB_LD="cc -shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="-export-dynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- dgux*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- HP-UX-*.11.*)
- # Use updated header definitions where possible
- AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
- AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
- LIBS="$LIBS -lxnet" # Use the XOPEN network library
-
- SHLIB_SUFFIX=".sl"
- AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
- SHLIB_CFLAGS="+z"
- SHLIB_LD="ld -b"
- SHLIB_LD_LIBS='${LIBS}'
- DL_OBJS="tclLoadShl.o"
- DL_LIBS="-ldld"
- LDFLAGS="-Wl,-E"
- CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
- LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
- LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
-
- # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
- #EXTRA_CFLAGS="+DAportable"
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- hpux_arch=`gcc -dumpmachine`
- case $hpux_arch in
- hppa64*)
- # 64-bit gcc in use. Fix flags for GNU ld.
- do64bit_ok=yes
- SHLIB_LD="gcc -shared"
- SHLIB_LD_LIBS=""
- LD_SEARCH_FLAGS=''
- CC_SEARCH_FLAGS=''
- ;;
- *)
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- ;;
- esac
- else
- do64bit_ok=yes
- if test "`uname -m`" = "ia64" ; then
- EXTRA_CFLAGS="+DD64"
- LDFLAGS="+DD64 $LDFLAGS"
- else
- EXTRA_CFLAGS="+DA2.0W"
- LDFLAGS="+DA2.0W $LDFLAGS"
- fi
- fi
- fi
- ;;
- HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
- SHLIB_SUFFIX=".sl"
- AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
- SHLIB_CFLAGS="+z"
- SHLIB_LD="ld -b"
- SHLIB_LD_LIBS=""
- DL_OBJS="tclLoadShl.o"
- DL_LIBS="-ldld"
- LDFLAGS="-Wl,-E"
- CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
- LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
- LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- ;;
- IRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_LD_LIBS='${LIBS}'
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="-Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- ;;
- IRIX-5.*)
- SHLIB_CFLAGS=""
- SHLIB_LD="ld -shared -rdata_shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- EXTRA_CFLAGS=""
- LDFLAGS=""
- ;;
- IRIX-6.*|IRIX64-6.5*)
- SHLIB_CFLAGS=""
- SHLIB_LD="ld -n32 -shared -rdata_shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- if test "$GCC" = "yes" ; then
- EXTRA_CFLAGS="-mabi=n32"
- LDFLAGS="-mabi=n32"
- else
- case $system in
- IRIX-6.3)
- # Use to build 6.2 compatible binaries on 6.3.
- EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
- ;;
- *)
- EXTRA_CFLAGS="-n32"
- ;;
- esac
- LDFLAGS="-n32"
- fi
- ;;
- IRIX64-6.*)
- SHLIB_CFLAGS=""
- SHLIB_LD="ld -n32 -shared -rdata_shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
-
- # Check to enable 64-bit flags for compiler/linker
-
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN([64bit mode not supported by gcc])
- else
- do64bit_ok=yes
- SHLIB_LD="ld -64 -shared -rdata_shared"
- EXTRA_CFLAGS="-64"
- LDFLAGS="-64"
- fi
- fi
- ;;
- Linux*)
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
-
- # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
- # when you inline the string and math operations. Turn this off to
- # get rid of the warnings.
-
- CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
-
- if test "$have_dl" = yes; then
- SHLIB_LD="${CC} -shared"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="-rdynamic"
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS="tclLoadDld.o"
- DL_LIBS="-ldld"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- EXTRA_CFLAGS="-mieee"
- fi
-
- # The combo of gcc + glibc has a bug related
- # to inlining of functions like strtod(). The
- # -fno-builtin flag should address this problem
- # but it does not work. The -fno-inline flag
- # is kind of overkill but it works.
- # Disable inlining only when one of the
- # files in compat/*.c is being linked in.
- if test x"${HAVE_COMPAT}" = "xtrue" ; then
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline"
- fi
-
- # XIM peeking works under XFree86.
- AC_DEFINE(PEEK_XCLOSEIM)
-
- ;;
- GNU*)
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
-
- if test "$have_dl" = yes; then
- SHLIB_LD="${CC} -shared"
- DL_OBJS=""
- DL_LIBS="-ldl"
- LDFLAGS="-rdynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS=""
- DL_LIBS="-ldld"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- EXTRA_CFLAGS="-mieee"
- fi
- ;;
- MP-RAS-02*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- MP-RAS-*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="-Wl,-Bexport"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*)
- # Not available on all versions: check for include file.
- AC_CHECK_HEADER(dlfcn.h, [
- # NetBSD/SPARC needs -fPIC, -fpic will not do.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- AC_MSG_CHECKING(for ELF)
- AC_EGREP_CPP(yes, [
-#ifdef __ELF__
- yes
-#endif
- ],
- AC_MSG_RESULT(yes)
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so',
- AC_MSG_RESULT(no)
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- )
- ], [
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- ])
-
- # FreeBSD doesn't handle version numbers with dots.
-
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- FreeBSD-*)
- # FreeBSD 3.* and greater have ELF.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS="-export-dynamic"
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- if test "${TCL_THREADS}" = "1" ; then
- # The -pthread needs to go in the CFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- EXTRA_CFLAGS="-pthread"
- LDFLAGS="$LDFLAGS -pthread"
- fi
- case $system in
- FreeBSD-3.*)
- # FreeBSD-3 doesn't handle version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- esac
- ;;
- Rhapsody-*|Darwin-*)
- SHLIB_CFLAGS="-fno-common"
- SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
- TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000"
- TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".dylib"
- DL_OBJS="tclLoadDyld.o"
- PLAT_OBJS="tclMacOSXBundle.o"
- DL_LIBS=""
- LDFLAGS="-prebind"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- CFLAGS_OPTIMIZE="-Os"
- LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
- # for compatibility with autoconf vers 2.13 :
- HACK=""
- EXTRA_CFLAGS="-DMA${HACK}C_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\\\"utf-8\\\""
- LIBS="$LIBS -framework CoreFoundation"
- ;;
- NEXTSTEP-*)
- SHLIB_CFLAGS=""
- SHLIB_LD="cc -nostdlib -r"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadNext.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OS/390-*)
- CFLAGS_OPTIMIZE="" # Optimizer is buggy
- AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
- ;;
- OSF1-1.0|OSF1-1.1|OSF1-1.2)
- # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
- SHLIB_CFLAGS=""
- # Hack: make package name same as library name
- SHLIB_LD='ld -R -export $@:'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadOSF.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OSF1-1.*)
- # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
- SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD="ld -shared"
- else
- SHLIB_LD="ld -non_shared"
- fi
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OSF1-V*)
- # Digital OSF/1
- SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD='ld -shared -expect_unresolved "*"'
- else
- SHLIB_LD='ld -non_shared -expect_unresolved "*"'
- fi
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- if test "$GCC" != "yes" ; then
- EXTRA_CFLAGS="-DHAVE_TZSET -std1"
- fi
- # see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = "1" ; then
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
- LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = "yes" ; then
- LIBS="$LIBS -lpthread -lmach -lexc"
- else
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
- LDFLAGS="-pthread"
- fi
- fi
-
- ;;
- QNX-6*)
- # QNX RTP
- # This may work for all QNX, but it was only reported for v6.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- # dlopen is in -lc on QNX
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- RISCos-*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="-Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- ;;
- SCO_SV-3.2*)
- # Note, dlopen is available only on SCO 3.2.5 and greater. However,
- # this test works, since "uname -s" was non-standard in 3.2.4 and
- # below.
- if test "$GCC" = "yes" ; then
- SHLIB_CFLAGS="-fPIC -melf"
- LDFLAGS="-melf -Wl,-Bexport"
- else
- SHLIB_CFLAGS="-Kpic -belf"
- LDFLAGS="-belf -Wl,-Bexport"
- fi
- SHLIB_LD="ld -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- SINIX*5.4*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- SunOS-4*)
- SHLIB_CFLAGS="-PIC"
- SHLIB_LD="ld"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
-
- # SunOS can't handle version numbers with dots in them in library
- # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
- # requires an extra version number at the end of .so file names.
- # So, the library has to have a name like libtcl75.so.1.0
-
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- SunOS-5.[[0-6]]*)
-
- # Note: If _REENTRANT isn't defined, then Solaris
- # won't define thread-safe library routines.
-
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
-
- SHLIB_CFLAGS="-KPIC"
-
- # Note: need the LIBS below, otherwise Tk won't find Tcl's
- # symbols when dynamically loaded into tclsh.
-
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- SHLIB_LD="/usr/ccs/bin/ld -G -z text"
- CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
- ;;
- SunOS-5*)
-
- # Note: If _REENTRANT isn't defined, then Solaris
- # won't define thread-safe library routines.
-
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
-
- SHLIB_CFLAGS="-KPIC"
- LDFLAGS=""
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- arch=`isainfo`
- if test "$arch" = "sparcv9 sparc" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- else
- do64bit_ok=yes
- if test "$do64bitVIS" = "yes" ; then
- EXTRA_CFLAGS="-xarch=v9a"
- LDFLAGS="-xarch=v9a"
- else
- EXTRA_CFLAGS="-xarch=v9"
- LDFLAGS="-xarch=v9"
- fi
- fi
- else
- AC_MSG_WARN("64bit mode only supported sparcv9 system")
- fi
- fi
-
- # Note: need the LIBS below, otherwise Tk won't find Tcl's
- # symbols when dynamically loaded into tclsh.
-
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- SHLIB_LD="/usr/ccs/bin/ld -G -z text"
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- fi
- ;;
- ULTRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_LD_LIBS='${LIBS}'
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="-Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$GCC" != "yes" ; then
- EXTRA_CFLAGS="-DHAVE_TZSET -std1"
- fi
- ;;
- UNIX_SV* | UnixWare-5*)
- SHLIB_CFLAGS="-KPIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
- # that don't grok the -Bexport option. Test that it does.
- hold_ldflags=$LDFLAGS
- AC_MSG_CHECKING(for ld accepts -Bexport flag)
- LDFLAGS="${LDFLAGS} -Wl,-Bexport"
- AC_TRY_LINK(, [int i;], found=yes, found=no)
- LDFLAGS=$hold_ldflags
- AC_MSG_RESULT($found)
- if test $found = yes; then
- LDFLAGS="-Wl,-Bexport"
- else
- LDFLAGS=""
- fi
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- esac
-
- if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
- AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
- fi
-
- # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
- # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
- # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
- # to determine which of several header files defines the a.out file
- # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
- # support only a file format that is more or less version-7-compatible.
- # In particular,
- # - a.out files must begin with `struct exec'.
- # - the N_TXTOFF on the `struct exec' must compute the seek address
- # of the text segment
- # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
- # and a_entry fields.
- # The following compilation should succeed if and only if either sys/exec.h
- # or a.out.h is usable for the purpose.
- #
- # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
- # `struct exec' includes a second header that contains information that
- # duplicates the v7 fields that are needed.
-
- if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
- AC_MSG_CHECKING(sys/exec.h)
- AC_TRY_COMPILE([#include <sys/exec.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_ok=usable, tcl_ok=unusable)
- AC_MSG_RESULT($tcl_ok)
- if test $tcl_ok = usable; then
- AC_DEFINE(USE_SYS_EXEC_H)
- else
- AC_MSG_CHECKING(a.out.h)
- AC_TRY_COMPILE([#include <a.out.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_ok=usable, tcl_ok=unusable)
- AC_MSG_RESULT($tcl_ok)
- if test $tcl_ok = usable; then
- AC_DEFINE(USE_A_OUT_H)
- else
- AC_MSG_CHECKING(sys/exec_aout.h)
- AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_midmag == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_ok=usable, tcl_ok=unusable)
- AC_MSG_RESULT($tcl_ok)
- if test $tcl_ok = usable; then
- AC_DEFINE(USE_SYS_EXEC_AOUT_H)
- else
- DL_OBJS=""
- fi
- fi
- fi
- fi
-
- # Step 5: disable dynamic loading if requested via a command-line switch.
-
- AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
- [tcl_ok=$enableval], [tcl_ok=yes])
- if test "$tcl_ok" = "no"; then
- DL_OBJS=""
- fi
-
- if test "x$DL_OBJS" != "x" ; then
- BUILD_DLTEST="\$(DLTEST_TARGETS)"
- else
- echo "Can't figure out how to do dynamic loading or shared libraries"
- echo "on this system."
- SHLIB_CFLAGS=""
- SHLIB_LD=""
- SHLIB_SUFFIX=""
- DL_OBJS="tclLoadNone.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- BUILD_DLTEST=""
- fi
-
- # If we're running gcc, then change the C flags for compiling shared
- # libraries to the right flags for gcc, instead of those for the
- # standard manufacturer compiler.
-
- if test "$DL_OBJS" != "tclLoadNone.o" ; then
- if test "$GCC" = "yes" ; then
- case $system in
- AIX-*)
- ;;
- BSD/OS*)
- ;;
- IRIX*)
- ;;
- NetBSD-*|FreeBSD-*|OpenBSD-*)
- ;;
- Rhapsody-*|Darwin-*)
- ;;
- RISCos-*)
- ;;
- SCO_SV-3.2*)
- ;;
- ULTRIX-4.*)
- ;;
- *)
- SHLIB_CFLAGS="-fPIC"
- ;;
- esac
- fi
- fi
-
- if test "$SHARED_LIB_SUFFIX" = "" ; then
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
- fi
- if test "$UNSHARED_LIB_SUFFIX" = "" ; then
- UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- fi
-
- if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
- LIB_SUFFIX=${SHARED_LIB_SUFFIX}
- MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
- LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
-
- if test "$RANLIB" = "" ; then
- MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
- MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
- fi
-
-dnl Not at all clear what this was doing in Tcl's configure.in
-dnl or why it was needed was needed. In any event, this sort of
-dnl things needs to be done in the big loop above.
-dnl REMOVE THIS BLOCK LATER! (mdejong)
-dnl case $system in
-dnl BSD/OS*)
-dnl ;;
-dnl AIX-[[1-4]].*)
-dnl ;;
-dnl *)
-dnl SHLIB_LD_LIBS=""
-dnl ;;
-dnl esac
- fi
-
-
- # Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = "" ; then
- MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
- else
- MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
- fi
-
-
- AC_SUBST(DL_LIBS)
-
- AC_SUBST(DL_OBJS)
- AC_SUBST(PLAT_OBJS)
- AC_SUBST(CFLAGS)
- AC_SUBST(CFLAGS_DEBUG)
- AC_SUBST(CFLAGS_OPTIMIZE)
- AC_SUBST(CFLAGS_WARNING)
- AC_SUBST(EXTRA_CFLAGS)
-
- AC_SUBST(LDFLAGS)
- AC_SUBST(LDFLAGS_DEBUG)
- AC_SUBST(LDFLAGS_OPTIMIZE)
- AC_SUBST(CC_SEARCH_FLAGS)
- AC_SUBST(LD_SEARCH_FLAGS)
-
- AC_SUBST(STLIB_LD)
- AC_SUBST(SHLIB_LD)
- AC_SUBST(TCL_SHLIB_LD_EXTRAS)
- AC_SUBST(TK_SHLIB_LD_EXTRAS)
- AC_SUBST(SHLIB_LD_FLAGS)
- AC_SUBST(SHLIB_LD_LIBS)
- AC_SUBST(SHLIB_CFLAGS)
- AC_SUBST(SHLIB_SUFFIX)
-
- AC_SUBST(MAKE_LIB)
- AC_SUBST(MAKE_STUB_LIB)
- AC_SUBST(INSTALL_LIB)
- AC_SUBST(INSTALL_STUB_LIB)
- AC_SUBST(RANLIB)
-])
-
-#--------------------------------------------------------------------
-# SC_SERIAL_PORT
-#
-# Determine which interface to use to talk to the serial port.
-# Note that #include lines must begin in leftmost column for
-# some compilers to recognize them as preprocessor directives,
-# and some build environments have stdin not pointing at a
-# pseudo-terminal (usually /dev/null instead.)
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines only one of the following vars:
-# HAVE_SYS_MODEM_H
-# USE_TERMIOS
-# USE_TERMIO
-# USE_SGTTY
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_SERIAL_PORT, [
- AC_CHECK_HEADERS(sys/modem.h)
- AC_MSG_CHECKING([termios vs. termio vs. sgtty])
- AC_CACHE_VAL(tcl_cv_api_serial, [
- AC_TRY_RUN([
-#include <termios.h>
-
-int main() {
- struct termios t;
- if (tcgetattr(0, &t) == 0) {
- cfsetospeed(&t, 0);
- t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- if test $tcl_cv_api_serial = no ; then
- AC_TRY_RUN([
-#include <termio.h>
-
-int main() {
- struct termio t;
- if (ioctl(0, TCGETA, &t) == 0) {
- t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no ; then
- AC_TRY_RUN([
-#include <sgtty.h>
-
-int main() {
- struct sgttyb t;
- if (ioctl(0, TIOCGETP, &t) == 0) {
- t.sg_ospeed = 0;
- t.sg_flags |= ODDP | EVENP | RAW;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no ; then
- AC_TRY_RUN([
-#include <termios.h>
-#include <errno.h>
-
-int main() {
- struct termios t;
- if (tcgetattr(0, &t) == 0
- || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
- cfsetospeed(&t, 0);
- t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no; then
- AC_TRY_RUN([
-#include <termio.h>
-#include <errno.h>
-
-int main() {
- struct termio t;
- if (ioctl(0, TCGETA, &t) == 0
- || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
- t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
- }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no; then
- AC_TRY_RUN([
-#include <sgtty.h>
-#include <errno.h>
-
-int main() {
- struct sgttyb t;
- if (ioctl(0, TIOCGETP, &t) == 0
- || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
- t.sg_ospeed = 0;
- t.sg_flags |= ODDP | EVENP | RAW;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
- fi])
- case $tcl_cv_api_serial in
- termios) AC_DEFINE(USE_TERMIOS);;
- termio) AC_DEFINE(USE_TERMIO);;
- sgtty) AC_DEFINE(USE_SGTTY);;
- esac
- AC_MSG_RESULT($tcl_cv_api_serial)
-])
-
-#--------------------------------------------------------------------
-# SC_MISSING_POSIX_HEADERS
-#
-# Supply substitutes for missing POSIX header files. Special
-# notes:
-# - stdlib.h doesn't define strtol, strtoul, or
-# strtod insome versions of SunOS
-# - some versions of string.h don't declare procedures such
-# as strstr
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines some of the following vars:
-# NO_DIRENT_H
-# NO_ERRNO_H
-# NO_VALUES_H
-# NO_LIMITS_H
-# NO_STDLIB_H
-# NO_STRING_H
-# NO_SYS_WAIT_H
-# NO_DLFCN_H
-# HAVE_UNISTD_H
-# HAVE_SYS_PARAM_H
-#
-# HAVE_STRING_H ?
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
- AC_MSG_CHECKING(dirent.h)
- AC_TRY_LINK([#include <sys/types.h>
-#include <dirent.h>], [
-#ifndef _POSIX_SOURCE
-# ifdef __Lynx__
- /*
- * Generate compilation error to make the test fail: Lynx headers
- * are only valid if really in the POSIX environment.
- */
-
- missing_procedure();
-# endif
-#endif
-DIR *d;
-struct dirent *entryPtr;
-char *p;
-d = opendir("foobar");
-entryPtr = readdir(d);
-p = entryPtr->d_name;
-closedir(d);
-], tcl_ok=yes, tcl_ok=no)
-
- if test $tcl_ok = no; then
- AC_DEFINE(NO_DIRENT_H)
- fi
-
- AC_MSG_RESULT($tcl_ok)
- AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
- AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
- AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
- AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)])
- AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
- AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
- AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
- AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STDLIB_H)
- fi
- AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
- AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
- AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
-
- # See also memmove check below for a place where NO_STRING_H can be
- # set and why.
-
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STRING_H)
- fi
-
- AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
- AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
-
- # OS/390 lacks sys/param.h (and doesn't need it, by chance).
-
- AC_HAVE_HEADERS(unistd.h sys/param.h)
-
-])
-
-#--------------------------------------------------------------------
-# SC_PATH_X
-#
-# Locate the X11 header files and the X11 library archive. Try
-# the ac_path_x macro first, but if it doesn't find the X stuff
-# (e.g. because there's no xmkmf program) then check through
-# a list of possible directories. Under some conditions the
-# autoconf macro will return an include directory that contains
-# no include files, so double-check its result just to be safe.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Sets the the following vars:
-# XINCLUDES
-# XLIBSW
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_X, [
- AC_PATH_X
- not_really_there=""
- if test "$no_x" = ""; then
- if test "$x_includes" = ""; then
- AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
- else
- if test ! -r $x_includes/X11/Intrinsic.h; then
- not_really_there="yes"
- fi
- fi
- fi
- if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- AC_MSG_CHECKING(for X11 header files)
- found_xincludes="no"
- AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
- if test "$found_xincludes" = "no"; then
- dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
- for i in $dirs ; do
- if test -r $i/X11/Intrinsic.h; then
- AC_MSG_RESULT($i)
- XINCLUDES=" -I$i"
- found_xincludes="yes"
- break
- fi
- done
- fi
- else
- if test "$x_includes" != ""; then
- XINCLUDES="-I$x_includes"
- found_xincludes="yes"
- fi
- fi
- if test found_xincludes = "no"; then
- AC_MSG_RESULT(couldn't find any!)
- fi
-
- if test "$no_x" = yes; then
- AC_MSG_CHECKING(for X11 libraries)
- XLIBSW=nope
- dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
- for i in $dirs ; do
- if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
- AC_MSG_RESULT($i)
- XLIBSW="-L$i -lX11"
- x_libraries="$i"
- break
- fi
- done
- else
- if test "$x_libraries" = ""; then
- XLIBSW=-lX11
- else
- XLIBSW="-L$x_libraries -lX11"
- fi
- fi
- if test "$XLIBSW" = nope ; then
- AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
- fi
- if test "$XLIBSW" = nope ; then
- AC_MSG_RESULT(couldn't find any! Using -lX11.)
- XLIBSW=-lX11
- fi
-])
-#--------------------------------------------------------------------
-# SC_BLOCKING_STYLE
-#
-# The statements below check for systems where POSIX-style
-# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
-# On these systems (mostly older ones), use the old BSD-style
-# FIONBIO approach instead.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines some of the following vars:
-# HAVE_SYS_IOCTL_H
-# HAVE_SYS_FILIO_H
-# USE_FIONBIO
-# O_NONBLOCK
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_BLOCKING_STYLE, [
- AC_CHECK_HEADERS(sys/ioctl.h)
- AC_CHECK_HEADERS(sys/filio.h)
- AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
- if test -f /usr/lib/NextStep/software_version; then
- system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
- else
- system=`uname -s`-`uname -r`
- if test "$?" -ne 0 ; then
- system=unknown
- else
- # Special check for weird MP-RAS system (uname returns weird
- # results, and the version is kept in special file).
-
- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
- fi
- if test "`uname -s`" = "AIX" ; then
- system=AIX-`uname -v`.`uname -r`
- fi
- fi
- fi
- case $system in
- # There used to be code here to use FIONBIO under AIX. However, it
- # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
- # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
- # code (JO, 5/31/97).
-
- OSF*)
- AC_DEFINE(USE_FIONBIO)
- AC_MSG_RESULT(FIONBIO)
- ;;
- SunOS-4*)
- AC_DEFINE(USE_FIONBIO)
- AC_MSG_RESULT(FIONBIO)
- ;;
- ULTRIX-4.*)
- AC_DEFINE(USE_FIONBIO)
- AC_MSG_RESULT(FIONBIO)
- ;;
- *)
- AC_MSG_RESULT(O_NONBLOCK)
- ;;
- esac
-])
-
-#--------------------------------------------------------------------
-# SC_TIME_HANLDER
-#
-# Checks how the system deals with time.h, what time structures
-# are used on the system, and what fields the structures have.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines some of the following vars:
-# USE_DELTA_FOR_TZ
-# HAVE_TM_GMTOFF
-# HAVE_TM_TZADJ
-# HAVE_TIMEZONE_VAR
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TIME_HANDLER, [
- AC_CHECK_HEADERS(sys/time.h)
- AC_HEADER_TIME
- AC_STRUCT_TIMEZONE
-
- AC_CHECK_FUNCS(gmtime_r localtime_r)
-
- AC_MSG_CHECKING([tm_tzadj in struct tm])
- AC_CACHE_VAL(tcl_cv_member_tm_tzadj,
- AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
- tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
- AC_MSG_RESULT($tcl_cv_member_tm_tzadj)
- if test $tcl_cv_member_tm_tzadj = yes ; then
- AC_DEFINE(HAVE_TM_TZADJ)
- fi
-
- AC_MSG_CHECKING([tm_gmtoff in struct tm])
- AC_CACHE_VAL(tcl_cv_member_tm_gmtoff,
- AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
- tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
- AC_MSG_RESULT($tcl_cv_member_tm_gmtoff)
- if test $tcl_cv_member_tm_gmtoff = yes ; then
- AC_DEFINE(HAVE_TM_GMTOFF)
- fi
-
- #
- # Its important to include time.h in this check, as some systems
- # (like convex) have timezone functions, etc.
- #
- AC_MSG_CHECKING([long timezone variable])
- AC_CACHE_VAL(tcl_cv_var_timezone,
- AC_TRY_COMPILE([#include <time.h>],
- [extern long timezone;
- timezone += 1;
- exit (0);],
- tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
- AC_MSG_RESULT($tcl_cv_timezone_long)
- if test $tcl_cv_timezone_long = yes ; then
- AC_DEFINE(HAVE_TIMEZONE_VAR)
- else
- #
- # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
- #
- AC_MSG_CHECKING([time_t timezone variable])
- AC_CACHE_VAL(tcl_cv_timezone_time,
- AC_TRY_COMPILE([#include <time.h>],
- [extern time_t timezone;
- timezone += 1;
- exit (0);],
- tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
- AC_MSG_RESULT($tcl_cv_timezone_time)
- if test $tcl_cv_timezone_time = yes ; then
- AC_DEFINE(HAVE_TIMEZONE_VAR)
- fi
- fi
-])
-
-#--------------------------------------------------------------------
-# SC_BUGGY_STRTOD
-#
-# Under Solaris 2.4, strtod returns the wrong value for the
-# terminating character under some conditions. Check for this
-# and if the problem exists use a substitute procedure
-# "fixstrtod" (provided by Tcl) that corrects the error.
-# Also, on Compaq's Tru64 Unix 5.0,
-# strtod(" ") returns 0.0 instead of a failure to convert.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Might defines some of the following vars:
-# strtod (=fixstrtod)
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_BUGGY_STRTOD, [
- AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
- if test "$tcl_strtod" = 1; then
- AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
- AC_CACHE_VAL(tcl_cv_strtod_buggy,[
- AC_TRY_RUN([
- extern double strtod();
- int main() {
- char *infString="Inf", *nanString="NaN", *spaceString=" ";
- char *term;
- double value;
- value = strtod(infString, &term);
- if ((term != infString) && (term[-1] == 0)) {
- exit(1);
- }
- value = strtod(nanString, &term);
- if ((term != nanString) && (term[-1] == 0)) {
- exit(1);
- }
- value = strtod(spaceString, &term);
- if (term == (spaceString+1)) {
- exit(1);
- }
- exit(0);
- }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)])
- if test "$tcl_cv_strtod_buggy" = 1; then
- AC_MSG_RESULT(ok)
- else
- AC_MSG_RESULT(buggy)
- # upgrade to 2.5x egm 3/25/03
- AC_LIBOBJ(fixstrtod.o)
- HAVE_COMPAT=true
- AC_DEFINE(strtod, fixstrtod)
- fi
- fi
-])
-
-#--------------------------------------------------------------------
-# SC_TCL_LINK_LIBS
-#
-# Search for the libraries needed to link the Tcl shell.
-# Things like the math library (-lm) and socket stuff (-lsocket vs.
-# -lnsl) are dealt with here.
-#
-# Arguments:
-# Requires the following vars to be set in the Makefile:
-# DL_LIBS
-# LIBS
-# MATH_LIBS
-#
-# Results:
-#
-# Subst's the following var:
-# TCL_LIBS
-# MATH_LIBS
-#
-# Might append to the following vars:
-# LIBS
-#
-# Might define the following vars:
-# HAVE_NET_ERRNO_H
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TCL_LINK_LIBS, [
- #--------------------------------------------------------------------
- # On a few very rare systems, all of the libm.a stuff is
- # already in libc.a. Set compiler flags accordingly.
- # Also, Linux requires the "ieee" library for math to work
- # right (and it must appear before "-lm").
- #--------------------------------------------------------------------
-
- AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
- AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
-
- #--------------------------------------------------------------------
- # Interactive UNIX requires -linet instead of -lsocket, plus it
- # needs net/errno.h to define the socket-related error codes.
- #--------------------------------------------------------------------
-
- AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
- AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
-
- #--------------------------------------------------------------------
- # Check for the existence of the -lsocket and -lnsl libraries.
- # The order here is important, so that they end up in the right
- # order in the command line generated by make. Here are some
- # special considerations:
- # 1. Use "connect" and "accept" to check for -lsocket, and
- # "gethostbyname" to check for -lnsl.
- # 2. Use each function name only once: can't redo a check because
- # autoconf caches the results of the last check and won't redo it.
- # 3. Use -lnsl and -lsocket only if they supply procedures that
- # aren't already present in the normal libraries. This is because
- # IRIX 5.2 has libraries, but they aren't needed and they're
- # bogus: they goof up name resolution if used.
- # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
- # To get around this problem, check for both libraries together
- # if -lsocket doesn't work by itself.
- #--------------------------------------------------------------------
-
- tcl_checkBoth=0
- AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
- if test "$tcl_checkSocket" = 1; then
- AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
- LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
- fi
- if test "$tcl_checkBoth" = 1; then
- tk_oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
- fi
- AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
- [LIBS="$LIBS -lnsl"])])
-
- # Don't perform the eval of the libraries here because DL_LIBS
- # won't be set until we call SC_CONFIG_CFLAGS
-
- TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
- AC_SUBST(TCL_LIBS)
- AC_SUBST(MATH_LIBS)
-])
-
-#--------------------------------------------------------------------
-# SC_TCL_EARLY_FLAGS
-#
-# Check for what flags are needed to be passed so the correct OS
-# features are available.
-#
-# Arguments:
-# None
-#
-# Results:
-#
-# Might define the following vars:
-# _ISOC99_SOURCE
-# _LARGEFILE64_SOURCE
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TCL_EARLY_FLAG,[
- AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
- AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
- AC_TRY_COMPILE([[#define ]$1[ 1
-]$2], $3,
- [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
- [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
- if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
- AC_DEFINE($1)
- tcl_flags="$tcl_flags $1"
- fi])
-
-AC_DEFUN(SC_TCL_EARLY_FLAGS,[
- AC_MSG_CHECKING([for required early compiler flags])
- tcl_flags=""
- SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
- [char *p = (char *)strtoll; char *q = (char *)strtoull;])
- SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
- [struct stat64 buf; int i = stat64("/", &buf);])
- if test "x${tcl_flags}" = "x" ; then
- AC_MSG_RESULT(none)
- else
- AC_MSG_RESULT(${tcl_flags})
- fi])
-
-#--------------------------------------------------------------------
-# SC_TCL_64BIT_FLAGS
-#
-# Check for what is defined in the way of 64-bit features.
-#
-# Arguments:
-# None
-#
-# Results:
-#
-# Might define the following vars:
-# TCL_WIDE_INT_IS_LONG
-# TCL_WIDE_INT_TYPE
-# HAVE_STRUCT_DIRENT64
-# HAVE_STRUCT_STAT64
-# HAVE_TYPE_OFF64_T
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TCL_64BIT_FLAGS, [
- AC_MSG_CHECKING([for 64-bit integer type])
- AC_CACHE_VAL(tcl_cv_type_64bit,[
- tcl_cv_type_64bit=none
- # See if the compiler knows natively about __int64
- AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
- tcl_type_64bit=__int64, tcl_type_64bit="long long")
- # See if we should use long anyway Note that we substitute in the
- # type that is our current guess for a 64-bit type inside this check
- # program, so it should be modified only carefully...
- AC_TRY_RUN([#include <unistd.h>
- int main() {exit(!(sizeof(]${tcl_type_64bit}[) > sizeof(long)));}
- ], tcl_cv_type_64bit=${tcl_type_64bit},:,:)])
- if test "${tcl_cv_type_64bit}" = none ; then
- AC_DEFINE(TCL_WIDE_INT_IS_LONG)
- AC_MSG_RESULT(using long)
- else
- AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
- AC_MSG_RESULT(${tcl_cv_type_64bit})
-
- # Now check for auxiliary declarations
- AC_MSG_CHECKING([for struct dirent64])
- AC_CACHE_VAL(tcl_cv_struct_dirent64,[
- AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/dirent.h>],[struct dirent64 p;],
- tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
- if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
- AC_DEFINE(HAVE_STRUCT_DIRENT64)
- fi
- AC_MSG_RESULT(${tcl_cv_struct_dirent64})
-
- AC_MSG_CHECKING([for struct stat64])
- AC_CACHE_VAL(tcl_cv_struct_stat64,[
- AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
-],
- tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
- if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
- AC_DEFINE(HAVE_STRUCT_STAT64)
- fi
- AC_MSG_RESULT(${tcl_cv_struct_stat64})
-
- AC_MSG_CHECKING([for off64_t])
- AC_CACHE_VAL(tcl_cv_type_off64_t,[
- AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
-],
- tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
- if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
- AC_DEFINE(HAVE_TYPE_OFF64_T)
- fi
- AC_MSG_RESULT(${tcl_cv_type_off64_t})
- fi])
diff --git a/funtools/test.tcl b/funtools/test.tcl
deleted file mode 100644
index 4c944bf..0000000
--- a/funtools/test.tcl
+++ /dev/null
@@ -1,13 +0,0 @@
-lappend auto_path .
-
-package require tclfun 1.0
-
-# xx "cir(512,512,.1)"
-# xx "cir(512,512,.1)&&pha==5"
-# no spaces or else the quoting is a nightmare
-proc xx { reg } {
- set buf [fundisp "/home/eric/data/snr.ev\[$reg\]"]
- puts "and the answer is ..."
- puts $buf
-}
-
diff --git a/funtools/tfunjoin b/funtools/tfunjoin
deleted file mode 100755
index e352f67..0000000
--- a/funtools/tfunjoin
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-cat > foo1.txt <<EOF
-val
----
-1.0
-1.5
-2.0
-2.5
-3.0
-3.5
-4.0
-EOF
-
-cat > foo2.txt <<EOF
-val
----
-1.5
-2.5
-3.5
-EOF
-
-funtable foo1.txt foo1.fits
-(funindex foo1.fits val) > /dev/null
-
-funtable foo2.txt foo2.fits
-(funindex foo2.fits val) > /dev/null
-
-if [ x$1 = x ]; then
- TOL=-1
-else
- TOL=$1
-fi
-
-echo "./funjoin -t $TOL -j val foo1.fits foo2.fits stdout | fundisp stdin"
-./funjoin -t $TOL -j val foo1.fits foo2.fits foo.fits
-fundisp foo.fits
diff --git a/funtools/tmain.c b/funtools/tmain.c
deleted file mode 100644
index d0e41cb..0000000
--- a/funtools/tmain.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- *
- * tmain -- call a funtools main program as a subroutine
- *
- * saoconfig shmainlib
- * make
- * make shmainlib
- * gcc -g -o tmain -I. -I./util tmain.c libfuntools.a -ldl -lm
- *
- * gcc -g -o tmain -I. -I./util tmain.c libfuntoolsMainLib.a libfuntools.a
- * -ldl -lnsl -lsocket -lm
- *
- * gcc -g -o tmain -I. -I./util tmain.c libfuntoolsMainLib.a libtclfun.a \
- * libfuntools.a /proj/rd/lib/libtcl8.4.so -ldl -lnsl -lsocket -lm
- *
- * ./tmain -s libfuntoolsMainLib.dylib $S "fundisp foo[circle(512,512,.1)]"
- * or
- * ./tmain -s libfuntoolsMainLib.so $S "fundisp foo[circle(512,512,.1)]"
- * or
- * ./tmain $S 'fundisp xxx[cir(512,512,.1)] | awk "NR>2{print $5}"'
- *
- */
-
-#define DYNAMIC 0
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <sys/mman.h>
-#include <mainlib.h>
-#include <file.h>
-
-#define HAVE_TCL 0
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int ip;
- int len;
- int got;
- int args;
- int prot;
- int flags;
- int domem=0;
- char *buf=NULL;
- char *buf2=NULL;
- char *shobj=NULL;
- char mode[SZ_LINE];
- char tbuf[SZ_LINE];
- char cmd[SZ_LINE];
- char file[SZ_LINE];
- char *ermsg;
- char *extn;
- char *iname;
- char *ibuf;
- char *s;
- void *dl=NULL;
- struct stat statbuf;
- MainLib ml=NULL, ml2=NULL;
- FILE *fp=NULL;
- FILE *ifp=NULL, *ofp=NULL, *efp=NULL;
-
- /* initialize */
- *mode = '\0';
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "mi:e:o:s:t")) != -1){
- switch(c){
- case 'i':
- if( !strcmp(optarg, "stdin") ){
- ifp = stdin;
- }
- else{
- if( !(ifp=fopen(optarg, "r")) ){
- fprintf(stderr, "can't open '%s' for reading\n", optarg);
- exit(1);
- }
- }
- snprintf(tbuf, SZ_LINE, "stdin=%d", fileno(ifp));
- if( *mode ) strncat(mode, ",", SZ_LINE);
- strncat(mode, tbuf, SZ_LINE);
- break;
- case 'e':
- if( !(efp=fopen(optarg, "w")) ){
- fprintf(stderr, "can't open '%s' for writing\n", optarg);
- exit(1);
- }
- snprintf(tbuf, SZ_LINE, "stderr=%d", fileno(efp));
- if( *mode ) strncat(mode, ",", SZ_LINE);
- strncat(mode, tbuf, SZ_LINE);
- break;
- case 'm':
- domem=1;
- break;
- case 'o':
- if( !strcmp(optarg, "stdout") ){
- ofp = stdout;
- }
- else{
- if( !(ofp=fopen(optarg, "w")) ){
- fprintf(stderr, "can't open '%s' for writing\n", optarg);
- exit(1);
- }
- }
- snprintf(tbuf, SZ_LINE, "stdout=%d", fileno(ofp));
- if( *mode ) strncat(mode, ",", SZ_LINE);
- strncat(mode, tbuf, SZ_LINE);
- break;
- case 's':
- shobj=optarg;
- break;
- case 't':
- if( *mode ) strncat(mode, ",", SZ_LINE);
- strncat(mode, "tcl=0", SZ_LINE);
- break;
- }
- }
-
- /* process required args */
- args = argc - optind;
- if( args < 2 ){
- fprintf(stderr, "usage: %s file cmd\n", argv[0]);
- exit(1);
- }
- iname = argv[optind+0];
- ibuf = argv[optind+1];
-
- /* read input file into memory */
- if( domem ){
- if( !(fp = fopen(iname, "r")) ){
- fprintf(stderr, "can't open input file: %s\n", iname);
- exit(1);
- }
- fstat(fileno(fp), &statbuf);
- len = statbuf.st_size;
- prot = PROT_READ;
- flags = MAP_PRIVATE;
- s = mmap(NULL, len, prot, flags, fileno(fp), 0);
- fclose(fp);
- if( !s ){
- fprintf(stderr, "can't mmap input file: %s\n", iname);
- exit(1);
- }
- }
- else{
- s = (char *)FileContents(iname, 0, &len);
- if( !s ){
- fprintf(stderr, "can't access input file: %s\n", iname);
- exit(1);
- }
- }
-
-#if DYNAMIC!=1
- /* init routine is statically linked */
- ml = (MainLib)funtoolsMainLibInit();
-#endif
-
-#if DYNAMIC!=0
- /* load shared object and execute init routine */
- switch( MainLibLoad("funtools", shobj, (void **)&ml2, &ermsg) ){
- case -1:
- fprintf(stderr, "can't load shared object %s (%s)\n", shobj, ermsg);
- exit(1);
- case -2:
- fprintf(stderr, "can't init %s (%s)\n", "funtools", ermsg);
- exit(1);
- case -3:
- fprintf(stderr, "invalid call to MainLibLoad (%s)\n", ermsg);
- exit(1);
- }
- /* this is not always an error ( if we have the it linked statically) */
- if( !ml2->mainlibprocess ){
- fprintf(stderr, "no MainLibProcess routine found\n");
- exit(1);
- }
-#endif
-
-#if HAVE_TCL
- /* initialize Tcl support */
- MainLibInit_Tcl(ml);
-#endif
-
- /* parse command, file containing possible extension, and extra args */
- ip = 0;
- *cmd = '\0';
- *file = '\0';
- if( !word(ibuf, cmd, &ip) ){
- fprintf(stderr, "requires a command (and usually a file)\n");
- exit(1);
- }
-
- /* make up command containing memory-based buffer pointer as a filename */
- if( word(ibuf, file, &ip) && *file ){
- strncat(cmd, " ", SZ_LINE-1);
- /* internal buffer pointer is passed as filename */
- /* snprintf(tbuf, SZ_LINE, "\"buf:0x%p:%d", s, len); */
- snprintf(tbuf, SZ_LINE, "\"buf:%#lx:%d", (long)s, len);
- strncat(cmd, tbuf, SZ_LINE-1);
- /* buffer pointer gets extension appended */
- if( (extn = FileExtension(file)) && *extn ) strncat(cmd, extn, SZ_LINE-1);
- strncat(cmd, "\"", SZ_LINE-1);
- /* extra arguments */
- strncat(cmd, " ", SZ_LINE-1);
- strncat(cmd, &ibuf[ip], SZ_LINE-1);
- }
-
- /* call main as library routine */
- fprintf(stderr, "executing: %s\n", cmd);
-
-#if DYNAMIC == 1
- got = ml2->mainlibprocess(ml2, cmd, &buf, mode);
-#elif DYNAMIC == 2
- got = MainLibProcess(ml, cmd, &buf, mode);
- got = ml2->mainlibprocess(ml2, cmd, &buf2, mode);
-#else
- got = MainLibProcess(ml, cmd, &buf, mode);
-#endif
-
- /* handle result */
- if( got < 0 ){
- fprintf(stderr, "could not process cmd '%s'\n", cmd);
- exit(1);
- }
- else if( got == 0 ){
- fprintf(stderr, "no output from cmd '%s'\n", cmd);
- }
- else if( got > 1 ){
- fprintf(stderr, "%s", buf);
- if( buf2 ){
- fprintf(stderr, "\n");
- fprintf(stderr, "%s", buf2);
- }
- }
-
- /* clean up */
- if( extn ) xfree(extn);
- if( buf ) xfree(buf);
- if( s ){
- if( domem ){
- munmap(s, len);
- }
- else{
- xfree(s);
- }
- }
-
- /* close files */
- if( ifp ) fclose(ifp);
- if( ofp && (ofp != stdout) ) fclose(ofp);
-
- /* close mainlib lists */
- if( ml ) MainLibFree(ml);
- if( ml2 ) MainLibFree(ml2);
-
- /* success */
- return 0;
-}
diff --git a/funtools/tmain.tcl b/funtools/tmain.tcl
deleted file mode 100644
index 3636d44..0000000
--- a/funtools/tmain.tcl
+++ /dev/null
@@ -1 +0,0 @@
-while {[gets stdin line] >=0} { puts [lindex $line 2] }
diff --git a/funtools/tperl.c b/funtools/tperl.c
deleted file mode 100644
index 485fafe..0000000
--- a/funtools/tperl.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- http://search.cpan.org/~nwclark/perl-5.8.7/pod/perlembed.pod
- gcc -o tperl tperl.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
- */
-
-#include <EXTERN.h> /* from the Perl distribution */
-#include <perl.h> /* from the Perl distribution */
-
-static PerlInterpreter *my_perl; /*** The Perl interpreter ***/
-
-int main(int argc, char **argv, char **env)
-{
- STRLEN n_a;
- char *embedding[] = { "", "-e", "0" };
-
- PERL_SYS_INIT3(&argc,&argv,&env);
- my_perl = perl_alloc();
- perl_construct( my_perl );
-
- perl_parse(my_perl, NULL, 3, embedding, NULL);
- PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
- perl_run(my_perl);
-
- /** Treat $a as an integer **/
- eval_pv("$a = 3; $a **= 2", TRUE);
- printf("a = %d\n", SvIV(get_sv("a", FALSE)));
-
- /** Treat $a as a float **/
- eval_pv("$a = 3.14; $a **= 2", TRUE);
- printf("a = %f\n", SvNV(get_sv("a", FALSE)));
-
- /** Treat $a as a string **/
- eval_pv("$a = 'rekcaH lreP rehtonA tsuJ'; $a = reverse($a);", TRUE);
- printf("a = %s\n", SvPV(get_sv("a", FALSE), n_a));
-
- perl_destruct(my_perl);
- perl_free(my_perl);
- PERL_SYS_TERM();
-}
diff --git a/funtools/txt/bar.txt b/funtools/txt/bar.txt
deleted file mode 100644
index 33a7465..0000000
--- a/funtools/txt/bar.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-bval:b|ival:i|jval:j|eval:e|dval:d|hval:8x|aval:14a
-1|2|3|4.0|5.0|0x6|seven
-8|9|10|11.0|12.0|0xc|fourteen
-15|16|17|18.0|19.0|0x14|"twenty one"
-22|23|24|25.0|26.0|0x1b|"twenty eight"
-29|30|31|32.0|33.0|0x22|"thirty five"
-36|37|38|39.0|40.0|0x29|"forty two"
-43|44|45|46.0|47.0|0x30|"forty nine"
-50|51|52|53.0|54.0|0x37|"fifty six"
-57|58|59|60.0|61.0|0x3d|"sixty three"
-64|65|66|67.0|68.0|0x45|seventy
-
-bneg:b|ineg:i|jneg:j|eneg:e|dneg:d|hneg:8x|aneg:20a
--1|-2|-3|-4.0|-5.0|0x6|"-seven"
--8|-9|-10|-11.0|-12.0|0xc|"-fourteen"
--15|-16|-17|-18.0|-19.0|0x14|"-twenty one"
--22|-23|-24|-25.0|-26.0|0x1b|"-twenty eight"
--29|-30|-31|-32.0|-33.0|0x22|"-thirty five"
--36|-37|-38|-39.0|-40.0|0x29|"-forty two"
--43|-44|-45|-46.0|-47.0|0x30|"-forty nine"
--50|-51|-52|-53.0|-54.0|0x37|"-fifty six"
--57|-58|-59|-60.0|-61.0|0x3d|"-sixty three"
--64|-65|-66|-67.0|-68.0|0x45|"-seventy"
diff --git a/funtools/txt/blank.txt b/funtools/txt/blank.txt
deleted file mode 100644
index 75c203c..0000000
--- a/funtools/txt/blank.txt
+++ /dev/null
@@ -1 +0,0 @@
-xxx:i yyy:e zzz:20a
diff --git a/funtools/txt/blank2.txt b/funtools/txt/blank2.txt
deleted file mode 100644
index a693729..0000000
--- a/funtools/txt/blank2.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-xxx:i yyy:e zzz:20a
------ ----- -------
diff --git a/funtools/txt/comma.txt b/funtools/txt/comma.txt
deleted file mode 100644
index 2243a6f..0000000
--- a/funtools/txt/comma.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- ------------
-1, 2, 3, 4.0, 5.0, 0x6, seven
-8, 9, 10, 11.0, 12.0, 0xc, fourteen
-15, 16, 17, 18.0, 19.0, 0x14, "twenty one"
-22, 23, 24, 25.0, 26.0, 0x1b, "twenty eight"
-29, 30, 31, 32.0, 33.0, 0x22, "thirty five"
-36, 37, 38, 39.0, 40.0, 0x29, "forty two"
-43, 44, 45, 46.0, 47.0, 0x30, "forty nine"
-50, 51, 52, 53.0, 54.0, 0x37, "fifty six"
-57, 58, 59, 60.0, 61.0, 0x3d, "sixty three"
-64, 65, 66, 67.0, 68.0, 0x45, seventy
-
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:14a
--1, -2, -3, -4.0, -5.0, 0x6, "-seven"
--8, -9, -10, -11.0, -12.0, 0xc, "-fourteen"
--15, -16, -17, -18.0, -19.0, 0x14, "-twenty one"
--22, -23, -24, -25.0, -26.0, 0x1b, "-twenty eight"
--29, -30, -31, -32.0, -33.0, 0x22, "-thirty five"
--36, -37, -38, -39.0, -40.0, 0x29, "-forty two"
--43, -44, -45, -46.0, -47.0, 0x30, "-forty nine"
--50, -51, -52, -53.0, -54.0, 0x37, "-fifty six"
--57, -58, -59, -60.0, -61.0, 0x3d, "-sixty three"
--64, -65, -66, -67.0, -68.0, 0x45, "-seventy"
diff --git a/funtools/txt/comma2.txt b/funtools/txt/comma2.txt
deleted file mode 100644
index bcf2516..0000000
--- a/funtools/txt/comma2.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-"b val:b","i val:i","j val:j","e val:e","d val:d","h val:8x","a val:14a"
-------,------,------,------,------,-------,------------
-1,2,3,4.0,5.0,0x6,seven
-8,9,10,11.0,12.0,0xc,fourteen
-15,16,17,18.0,19.0,0x14,"twenty one"
-22,23,24,25.0,26.0,0x1b,"twenty eight"
-29,30,31,32.0,33.0,0x22,"thirty five"
-36,37,38,39.0,40.0,0x29,"forty two"
-43,44,45,46.0,47.0,0x30,"forty nine"
-50,51,52,53.0,54.0,0x37,"fifty six"
-57,58,59,60.0,61.0,0x3d,"sixty three"
-64,65,66,67.0,68.0,0x45,seventy
-
-"b neg:b","i neg:i","j neg:j","e neg:e","d neg:d","h neg:8x","a neg:14a"
--1,-2,-3,-4.0,-5.0,0x6,"-seven"
--8,-9,-10,-11.0,-12.0,0xc,"-fourteen"
--15,-16,-17,-18.0,-19.0,0x14,"-twenty one"
--22,-23,-24,-25.0,-26.0,0x1b,"-twenty eight"
--29,-30,-31,-32.0,-33.0,0x22,"-thirty five"
--36,-37,-38,-39.0,-40.0,0x29,"-forty two"
--43,-44,-45,-46.0,-47.0,0x30,"-forty nine"
--50,-51,-52,-53.0,-54.0,0x37,"-fifty six"
--57,-58,-59,-60.0,-61.0,0x3d,"-sixty three"
--64,-65,-66,-67.0,-68.0,0x45,"-seventy"
diff --git a/funtools/txt/comma3.txt b/funtools/txt/comma3.txt
deleted file mode 100644
index 5ecf2bd..0000000
--- a/funtools/txt/comma3.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- ------------
-1, 2, 3, 4.0, 5.0, 0x6, seven
-
-8, 9, 10, 11.0, 12.0, 0xc, fourteen
-
-15, 16, 17, 18.0, 19.0, 0x14, "twenty one"
-
-22, 23, 24, 25.0, 26.0, 0x1b, "twenty eight"
-
-29, 30, 31, 32.0, 33.0, 0x22, "thirty five"
-
-36, 37, 38, 39.0, 40.0, 0x29, "forty two"
-
-43, 44, 45, 46.0, 47.0, 0x30, "forty nine"
-
-50, 51, 52, 53.0, 54.0, 0x37, "fifty six"
-
-57, 58, 59, 60.0, 61.0, 0x3d, "sixty three"
-
-64, 65, 66, 67.0, 68.0, 0x45, seventy
-
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:14a
--1, -2, -3, -4.0, -5.0, 0x6, "-seven"
--8, -9, -10, -11.0, -12.0, 0xc, "-fourteen"
--15, -16, -17, -18.0, -19.0, 0x14, "-twenty one"
--22, -23, -24, -25.0, -26.0, 0x1b, "-twenty eight"
--29, -30, -31, -32.0, -33.0, 0x22, "-thirty five"
--36, -37, -38, -39.0, -40.0, 0x29, "-forty two"
--43, -44, -45, -46.0, -47.0, 0x30, "-forty nine"
--50, -51, -52, -53.0, -54.0, 0x37, "-fifty six"
--57, -58, -59, -60.0, -61.0, 0x3d, "-sixty three"
--64, -65, -66, -67.0, -68.0, 0x45, "-seventy"
diff --git a/funtools/txt/crcomma.txt b/funtools/txt/crcomma.txt
deleted file mode 100644
index 27a73e6..0000000
--- a/funtools/txt/crcomma.txt
+++ /dev/null
@@ -1 +0,0 @@
-NAME,ID,RA,DEC,Z,SOFT,HARD,14um_z_corrected,2-7keVX-ray_flux(erg/s/cm^2),2-10kevX-ray_flux(erg/s/cm^2),LX_2-10kev_erg/s,R_FLUX,R_MAG,RADIO,IRAC3.6,IRAC4.5,IRAC5.8,IRAC8.0,3.6(uJy),4.5(uJy),5.8(uJy),8.0(uJy),14um_z_corrected,24um_flux(uJy),F_RAT,BW_FLUX,BW_MAG,MPLATE,TYPE,class,"H-alpha FWHM","O III FWHM","O III ratio","O II FWHM" 'NDWFS_J1424455p331437',0.0,216.18964,33.243813,0.2679,4,23,1149.4,7.88E-14,1.05E-13,43.195,0.0,18.394,0.0,0.0,0.0,0.0,0.0,3.2164,9.1273,76.217,0.94249,1149.4,1814.7,0.0,0.0,20.449,0.0,'none',-1,'NA','NA','NA','NA' 'NDWFS_J1424479p324935',0,216.19969,32.826523,0.21027,20,8,,2.74E-14,3.65E-14,42.526,0,18.342,0,0,0,0,0,16.879,25.135,-54.52,13.985,,,0,0,19.259,0,'none',-1,,,, 'NDWFS_J1425059p350926',1.0129,216.27473,35.157372,0.19237,5,7,481.84,2.40E-14,3.19E-14,42.391,114.29,18.55,0,15.423,15.096,15.221,13.414,179.23,163.47,95.539,280.02,481.84,636.8,-1.42,26.99,20.322,50093,'Int',6,,,, 'NDWFS_J1426203p353707',1.0044,216.58495,35.618736,0.25521,90,27,,9.25E-14,1.23E-13,43.223,302.27,17.494,0,14.226,14.023,14.116,13.692,496.34,416.16,255.39,198.57,,,-0.86,37.222,19.973,9.50E+05,'diffellR',-1,,,, 'NDWFS_J1426251p331709',1.0104,216.60477,33.285892,0.24457,25,7,730.8,2.40E-14,3.19E-14,42.599,110.56,18.586,0,15.212,14.885,14.859,12.872,209.68,193.3,136.71,436.54,730.8,917.1,-0.98,32.33,20.126,1.91E+05,'ellB',2,,,, 'NDWFS_J1428060p343014',1.005,217.02538,34.503929,0.15892,26,15,552.29,5.14E-14,6.84E-14,42.556,384.06,17.234,0,14.374,14.343,14.173,12.723,442.42,319.63,242.21,456.83,552.29,635,-1.41,95.763,18.947,50093,'Spr',5,,,, 'NDWFS_J1428240p325052',0,217.10034,32.847771,0.13064,54,18,373.56,6.17E-14,8.21E-14,42.465,0,18.792,0,0,0,0,0,114.45,96.733,108.92,297.69,373.56,446.3,0,0,19.913,0,'none',-1,,,, 'NDWFS_J1428561p353042',1.0146,217.23398,35.511711,0.23343,15,7,471.55,2.40E-14,3.19E-14,42.559,75.093,19.006,0,15.539,15.224,14.754,13.902,164.64,148.85,148.93,178.49,471.55,665,-0.98,17.881,20.769,80189,'ellB',2,,,, 'NDWFS_J1429099p353615',1.0049,217.29156,35.604321,0.22928,20,6,1613.5,2.06E-14,2.74E-14,42.476,218.57,17.846,0,14.353,14.172,13.8,12.05,481.5,384.87,361.49,935.31,1613.5,2068.2,-1.37,46.86,19.723,20096,'ellB',2,,,, 'NDWFS_J1431023p341957',1.0038,217.75961,34.332695,0.1747,82,17,1696.2,5.83E-14,7.75E-14,42.693,222.64,17.826,0,14.013,13.678,13.178,11.863,656.48,610.76,638.21,1142,1696.2,2149.8,-0.79,61.773,19.423,1.40E+05,'diffellB',-1,,,, 'NDWFS_J1431116p325353',1.0068,217.79836,32.898285,0.27263,1,4,610.05,1.37E-14,1.82E-14,42.451,149.14,18.261,0,14.749,14.452,14.383,13.418,326.63,290.36,204.23,274.53,610.05,800.9,-1.92,18.416,20.737,9.30E+05,'ellR',1,,,, 'NDWFS_J1431226p350634',1.009,217.84444,35.109573,0.2771,12,4,355.04,1.37E-14,1.82E-14,42.465,129.18,18.417,0,15.061,14.893,14.786,14.35,75.309,100.16,78.196,143.32,355.04,473.4,-1.35,13.577,21.068,9.90E+05,'dwarfR',8,,,, 'NDWFS_J1431407p330317',1.0023,217.91966,33.054733,0.19293,21,36,5106.9,1.23E-13,1.64E-13,43.105,646.25,16.669,0.51,13.384,12.821,12.301,10.837,1126.9,1305.3,1418.4,2776,5106.9,6892.9,-1.5,165.35,18.354,1.00E+05,'Spr',5,,,, 'NDWFS_J1431435p330133',1.004,217.93163,33.025944,0.14115,77,22,4127,7.54E-14,1.00E-13,42.619,230.36,17.789,0,14.107,13.659,13.077,11.239,611.14,625.75,712.96,2016.7,4127,6075.7,-0.81,107.25,18.824,2.72E+05,'Int',6,9.8,11.9,3.2,6.1 'NDWFS_J1432170p345227',1.0029,218.07112,34.87442,0.1723,25,13,3085.4,4.46E-14,5.93E-14,42.564,356.78,17.314,0.22,13.699,13.352,12.998,11.441,881.18,820.68,754.22,1698.3,3085.4,4230.6,-1.41,63.797,19.388,2.90E+05,'ellB',2,,,, 'NDWFS_J1434244p341719',1.0039,218.60191,34.288857,0.19535,19,24,2659.5,8.23E-14,1.09E-13,42.939,140.48,18.326,0.83,14.048,13.458,12.91,11.725,652.13,755.84,824.61,1323.2,2659.5,3674.5,-0.96,25.445,20.386,5.01E+05,'none',-1,,,, 'NDWFS_J1435253p330520',1.0047,218.85555,33.089046,0.199,16,7,750.8,2.40E-14,3.19E-14,42.42,304.79,17.485,0,14.309,14.075,13.962,12.668,481.77,407.07,293.28,506.23,750.8,934.1,-1.56,57.544,19.5,50093,'ellB',2,,,, 'NDWFS_J1436087p350613',0,219.03656,35.103832,0.28342,181,62,,2.13E-13,2.83E-13,43.675,0,20.914,1.66,0,0,0,0,115.96,78.32,78.873,23.548,,,0,0,22.435,0,'none',-1,,,, 'NDWFS_J1436562p340808',1.0356,219.23451,34.135609,0.23673,1,6,,2.06E-14,2.74E-14,42.504,39.337,19.708,0,16.256,15.849,15.755,14.698,84.756,83.852,59.138,85.24,,,-1.19,5.3506,22.079,7.20E+05,'ellR',1,,,, 'NDWFS_J1437079p344001',1.0106,219.28293,34.666958,0.19091,0,7,648.75,2.40E-14,3.19E-14,42.384,129.66,18.413,0,15.238,15.017,14.915,13.449,207.81,177.92,136.15,270.13,648.75,941,-1.71,19.751,20.661,6.20E+05,'diffellR',-1,,,, 'NDWFS_J1437188p333857',1.0042,219.32835,33.64933,0.19236,1,10,2274.7,3.43E-14,4.56E-14,42.546,186.72,18.017,0,14.147,13.833,13.679,11.322,593.43,533.04,410.2,1914.3,2274.7,2551.5,-1.67,31.246,20.163,3.60E+05,'none',-1,,,, 'NDWFS_J1438268p352837',1.0115,219.61182,35.477074,0.25777,9,6,1433,2.06E-14,2.74E-14,42.578,27.848,20.083,0,15.314,14.738,14.125,12.791,202.81,233.87,267.8,493.36,1433,1998.9,-0.71,4.0776,22.374,7.10E+05,'ellR',1,,,, \ No newline at end of file
diff --git a/funtools/txt/crnl b/funtools/txt/crnl
deleted file mode 100755
index 0178cad..0000000
--- a/funtools/txt/crnl
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-case $# in
- 0)
- tr '\015' '\012'
- break;;
-
- 1)
- tr '\015' '\012' < $1
- break;;
-
- 2)
- tr '\015' '\012' < $1 > $2
- break;;
-
- *)
- echo "args: 0 (stdin/stdout), 1 (ifile/stdout), or 2 (ifile/ofile)"
- exit 1;;
-esac
-
diff --git a/funtools/txt/crspace.txt b/funtools/txt/crspace.txt
deleted file mode 100644
index d7f05ec..0000000
--- a/funtools/txt/crspace.txt
+++ /dev/null
@@ -1 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a ------ ------ ------ ------ ------ ------- -------------- 1 2 3 4.0 5.0 0x6 seven 8 9 10 11.0 12.0 0xc fourteen 15 16 17 18.0 19.0 0x14 "twenty one" 22 23 24 25.0 26.0 0x1b "twenty eight" 29 30 31 32.0 33.0 0x22 "thirty five" 36 37 38 39.0 40.0 0x29 "forty two" 43 44 45 46.0 47.0 0x30 "forty nine" 50 51 52 53.0 54.0 0x37 "fifty six" 57 58 59 60.0 61.0 0x3d "sixty three" 64 65 66 67.0 68.0 0x45 seventy bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a -1 -2 -3 -4.0 -5.0 0x6 "-seven" -8 -9 -10 -11.0 -12.0 0xc "-fourteen" -15 -16 -17 -18.0 -19.0 0x14 "-twenty one" -22 -23 -24 -25.0 -26.0 0x1b "-twenty eight" -29 -30 -31 -32.0 -33.0 0x22 "-thirty five" -36 -37 -38 -39.0 -40.0 0x29 "-forty two" -43 -44 -45 -46.0 -47.0 0x30 "-forty nine" -50 -51 -52 -53.0 -54.0 0x37 "-fifty six" -57 -58 -59 -60.0 -61.0 0x3d "-sixty three" -64 -65 -66 -67.0 -68.0 0x45 "-seventy" \ No newline at end of file
diff --git a/funtools/txt/crtab.txt b/funtools/txt/crtab.txt
deleted file mode 100644
index 4d9da2b..0000000
--- a/funtools/txt/crtab.txt
+++ /dev/null
@@ -1 +0,0 @@
-NAME ID RA DEC Z SOFT HARD 14um_z_corrected 2-7keVX-ray_flux(erg/s/cm^2) 2-10kevX-ray_flux(erg/s/cm^2) LX_2-10kev_erg/s R_FLUX R_MAG RADIO IRAC3.6 IRAC4.5 IRAC5.8 IRAC8.0 3.6(uJy) 4.5(uJy) 5.8(uJy) 8.0(uJy) 14um_z_corrected 24um_flux(uJy) F_RAT BW_FLUX BW_MAG MPLATE TYPE class 'H-alpha FWHM' 'O III FWHM' 'O III ratio' 'O II FWHM' 'NDWFS_J1424455p331437' 0.0 216.18964 33.243813 0.2679 4 23 1149.4 7.88E-14 1.05E-13 43.195 0.0 18.394 0.0 0.0 0.0 0.0 0.0 3.2164 9.1273 76.217 0.94249 1149.4 1814.7 0.0 0.0 20.449 0.0 'none' -1 'NA' 'NA' 'NA' 'NA' 'NDWFS_J1424479p324935' 0 216.19969 32.826523 0.21027 20 8 2.74E-14 3.65E-14 42.526 0 18.342 0 0 0 0 0 16.879 25.135 -54.52 13.985 0 0 19.259 0 'none' -1 'NDWFS_J1425059p350926' 1.0129 216.27473 35.157372 0.19237 5 7 481.84 2.40E-14 3.19E-14 42.391 114.29 18.55 0 15.423 15.096 15.221 13.414 179.23 163.47 95.539 280.02 481.84 636.8 -1.42 26.99 20.322 50093 'Int' 6 'NDWFS_J1426203p353707' 1.0044 216.58495 35.618736 0.25521 90 27 9.25E-14 1.23E-13 43.223 302.27 17.494 0 14.226 14.023 14.116 13.692 496.34 416.16 255.39 198.57 -0.86 37.222 19.973 9.50E+05 'diffellR' -1 'NDWFS_J1426251p331709' 1.0104 216.60477 33.285892 0.24457 25 7 730.8 2.40E-14 3.19E-14 42.599 110.56 18.586 0 15.212 14.885 14.859 12.872 209.68 193.3 136.71 436.54 730.8 917.1 -0.98 32.33 20.126 1.91E+05 'ellB' 2 'NDWFS_J1428060p343014' 1.005 217.02538 34.503929 0.15892 26 15 552.29 5.14E-14 6.84E-14 42.556 384.06 17.234 0 14.374 14.343 14.173 12.723 442.42 319.63 242.21 456.83 552.29 635 -1.41 95.763 18.947 50093 'Spr' 5 'NDWFS_J1428240p325052' 0 217.10034 32.847771 0.13064 54 18 373.56 6.17E-14 8.21E-14 42.465 0 18.792 0 0 0 0 0 114.45 96.733 108.92 297.69 373.56 446.3 0 0 19.913 0 'none' -1 'NDWFS_J1428561p353042' 1.0146 217.23398 35.511711 0.23343 15 7 471.55 2.40E-14 3.19E-14 42.559 75.093 19.006 0 15.539 15.224 14.754 13.902 164.64 148.85 148.93 178.49 471.55 665 -0.98 17.881 20.769 80189 'ellB' 2 'NDWFS_J1429099p353615' 1.0049 217.29156 35.604321 0.22928 20 6 1613.5 2.06E-14 2.74E-14 42.476 218.57 17.846 0 14.353 14.172 13.8 12.05 481.5 384.87 361.49 935.31 1613.5 2068.2 -1.37 46.86 19.723 20096 'ellB' 2 'NDWFS_J1431023p341957' 1.0038 217.75961 34.332695 0.1747 82 17 1696.2 5.83E-14 7.75E-14 42.693 222.64 17.826 0 14.013 13.678 13.178 11.863 656.48 610.76 638.21 1142 1696.2 2149.8 -0.79 61.773 19.423 1.40E+05 'diffellB' -1 'NDWFS_J1431116p325353' 1.0068 217.79836 32.898285 0.27263 1 4 610.05 1.37E-14 1.82E-14 42.451 149.14 18.261 0 14.749 14.452 14.383 13.418 326.63 290.36 204.23 274.53 610.05 800.9 -1.92 18.416 20.737 9.30E+05 'ellR' 1 'NDWFS_J1431226p350634' 1.009 217.84444 35.109573 0.2771 12 4 355.04 1.37E-14 1.82E-14 42.465 129.18 18.417 0 15.061 14.893 14.786 14.35 75.309 100.16 78.196 143.32 355.04 473.4 -1.35 13.577 21.068 9.90E+05 'dwarfR' 8 'NDWFS_J1431407p330317' 1.0023 217.91966 33.054733 0.19293 21 36 5106.9 1.23E-13 1.64E-13 43.105 646.25 16.669 0.51 13.384 12.821 12.301 10.837 1126.9 1305.3 1418.4 2776 5106.9 6892.9 -1.5 165.35 18.354 1.00E+05 'Spr' 5 'NDWFS_J1431435p330133' 1.004 217.93163 33.025944 0.14115 77 22 4127 7.54E-14 1.00E-13 42.619 230.36 17.789 0 14.107 13.659 13.077 11.239 611.14 625.75 712.96 2016.7 4127 6075.7 -0.81 107.25 18.824 2.72E+05 'Int' 6 9.8 11.9 3.2 6.1 'NDWFS_J1432170p345227' 1.0029 218.07112 34.87442 0.1723 25 13 3085.4 4.46E-14 5.93E-14 42.564 356.78 17.314 0.22 13.699 13.352 12.998 11.441 881.18 820.68 754.22 1698.3 3085.4 4230.6 -1.41 63.797 19.388 2.90E+05 'ellB' 2 'NDWFS_J1434244p341719' 1.0039 218.60191 34.288857 0.19535 19 24 2659.5 8.23E-14 1.09E-13 42.939 140.48 18.326 0.83 14.048 13.458 12.91 11.725 652.13 755.84 824.61 1323.2 2659.5 3674.5 -0.96 25.445 20.386 5.01E+05 'none' -1 'NDWFS_J1435253p330520' 1.0047 218.85555 33.089046 0.199 16 7 750.8 2.40E-14 3.19E-14 42.42 304.79 17.485 0 14.309 14.075 13.962 12.668 481.77 407.07 293.28 506.23 750.8 934.1 -1.56 57.544 19.5 50093 'ellB' 2 'NDWFS_J1436087p350613' 0 219.03656 35.103832 0.28342 181 62 2.13E-13 2.83E-13 43.675 0 20.914 1.66 0 0 0 0 115.96 78.32 78.873 23.548 0 0 22.435 0 'none' -1 'NDWFS_J1436562p340808' 1.0356 219.23451 34.135609 0.23673 1 6 2.06E-14 2.74E-14 42.504 39.337 19.708 0 16.256 15.849 15.755 14.698 84.756 83.852 59.138 85.24 -1.19 5.3506 22.079 7.20E+05 'ellR' 1 'NDWFS_J1437079p344001' 1.0106 219.28293 34.666958 0.19091 0 7 648.75 2.40E-14 3.19E-14 42.384 129.66 18.413 0 15.238 15.017 14.915 13.449 207.81 177.92 136.15 270.13 648.75 941 -1.71 19.751 20.661 6.20E+05 'diffellR' -1 'NDWFS_J1437188p333857' 1.0042 219.32835 33.64933 0.19236 1 10 2274.7 3.43E-14 4.56E-14 42.546 186.72 18.017 0 14.147 13.833 13.679 11.322 593.43 533.04 410.2 1914.3 2274.7 2551.5 -1.67 31.246 20.163 3.60E+05 'none' -1 'NDWFS_J1438268p352837' 1.0115 219.61182 35.477074 0.25777 9 6 1433 2.06E-14 2.74E-14 42.578 27.848 20.083 0 15.314 14.738 14.125 12.791 202.81 233.87 267.8 493.36 1433 1998.9 -0.71 4.0776 22.374 7.10E+05 'ellR' 1 \ No newline at end of file
diff --git a/funtools/txt/eot.txt b/funtools/txt/eot.txt
deleted file mode 100644
index 16d8b8a..0000000
--- a/funtools/txt/eot.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- --------------
-1 2 3 4.0 5.0 0x6 seven
-8 9 10 11.0 12.0 0xc fourteen
-15 16 17 18.0 19.0 0x14 "twenty one"
-22 23 24 25.0 26.0 0x1b "twenty eight"
-29 30 31 32.0 33.0 0x22 "thirty five"
-36 37 38 39.0 40.0 0x29 "forty two"
-43 44 45 46.0 47.0 0x30 "forty nine"
-50 51 52 53.0 54.0 0x37 "fifty six"
-57 58 59 60.0 61.0 0x3d "sixty three"
-64 65 66 67.0 68.0 0x45 seventy
-EOT
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a
------- ------ ------ ------ ------ ------- ------------
--1 -2 -3 -4.0 -5.0 0x6 "-seven"
--8 -9 -10 -11.0 -12.0 0xc "-fourteen"
--15 -16 -17 -18.0 -19.0 0x14 "-twenty one"
--22 -23 -24 -25.0 -26.0 0x1b "-twenty eight"
--29 -30 -31 -32.0 -33.0 0x22 "-thirty five"
--36 -37 -38 -39.0 -40.0 0x29 "-forty two"
--43 -44 -45 -46.0 -47.0 0x30 "-forty nine"
--50 -51 -52 -53.0 -54.0 0x37 "-fifty six"
--57 -58 -59 -60.0 -61.0 0x3d "-sixty three"
--64 -65 -66 -67.0 -68.0 0x45 "-seventy"
diff --git a/funtools/txt/eot2.txt b/funtools/txt/eot2.txt
deleted file mode 100644
index ca025df..0000000
--- a/funtools/txt/eot2.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- --------------
-1 2 3 4.0 5.0 0x6 seven
-8 9 10 11.0 12.0 0xc fourteen
-15 16 17 18.0 19.0 0x14 "twenty one"
-22 23 24 25.0 26.0 0x1b "twenty eight"
-29 30 31 32.0 33.0 0x22 "thirty five"
-36 37 38 39.0 40.0 0x29 "forty two"
-43 44 45 46.0 47.0 0x30 "forty nine"
-50 51 52 53.0 54.0 0x37 "fifty six"
-57 58 59 60.0 61.0 0x3d "sixty three"
-64 65 66 67.0 68.0 0x45 seventy
-EOT
-HERE
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a
------- ------ ------ ------ ------ ------- ------------
--1 -2 -3 -4.0 -5.0 0x6 "-seven"
--8 -9 -10 -11.0 -12.0 0xc "-fourteen"
--15 -16 -17 -18.0 -19.0 0x14 "-twenty one"
--22 -23 -24 -25.0 -26.0 0x1b "-twenty eight"
--29 -30 -31 -32.0 -33.0 0x22 "-thirty five"
--36 -37 -38 -39.0 -40.0 0x29 "-forty two"
--43 -44 -45 -46.0 -47.0 0x30 "-forty nine"
--50 -51 -52 -53.0 -54.0 0x37 "-fifty six"
--57 -58 -59 -60.0 -61.0 0x3d "-sixty three"
--64 -65 -66 -67.0 -68.0 0x45 "-seventy"
diff --git a/funtools/txt/foo1 b/funtools/txt/foo1
deleted file mode 100644
index 6bb724b..0000000
--- a/funtools/txt/foo1
+++ /dev/null
@@ -1,12 +0,0 @@
- BVAL IVAL JVAL EVAL DVAL HVAL AVAL
------- -------- ---------- ----------- --------------------- ---------- ------------
- 1 2 3 4.00 5.00000000 0x6 'seven'
- 8 9 10 11.00 12.00000000 0xc 'fourteen'
- 15 16 17 18.00 19.00000000 0x14 'twenty one'
- 22 23 24 25.00 26.00000000 0x1b 'twenty eig'
- 29 30 31 32.00 33.00000000 0x22 'thirty fiv'
- 36 37 38 39.00 40.00000000 0x29 'forty two'
- 43 44 45 46.00 47.00000000 0x30 'forty nine'
- 50 51 52 53.00 54.00000000 0x37 'fifty six'
- 57 58 59 60.00 61.00000000 0x3d 'sixty thre'
- 64 65 66 67.00 68.00000000 0x45 'seventy'
diff --git a/funtools/txt/foo2 b/funtools/txt/foo2
deleted file mode 100644
index 6bb724b..0000000
--- a/funtools/txt/foo2
+++ /dev/null
@@ -1,12 +0,0 @@
- BVAL IVAL JVAL EVAL DVAL HVAL AVAL
------- -------- ---------- ----------- --------------------- ---------- ------------
- 1 2 3 4.00 5.00000000 0x6 'seven'
- 8 9 10 11.00 12.00000000 0xc 'fourteen'
- 15 16 17 18.00 19.00000000 0x14 'twenty one'
- 22 23 24 25.00 26.00000000 0x1b 'twenty eig'
- 29 30 31 32.00 33.00000000 0x22 'thirty fiv'
- 36 37 38 39.00 40.00000000 0x29 'forty two'
- 43 44 45 46.00 47.00000000 0x30 'forty nine'
- 50 51 52 53.00 54.00000000 0x37 'fifty six'
- 57 58 59 60.00 61.00000000 0x3d 'sixty thre'
- 64 65 66 67.00 68.00000000 0x45 'seventy'
diff --git a/funtools/txt/headone.txt b/funtools/txt/headone.txt
deleted file mode 100644
index c007677..0000000
--- a/funtools/txt/headone.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-COL1 COL2 COL3 COL4 COL5 COL6 COL7
-1 2 3 4.0 5.0 0x6 seven
diff --git a/funtools/txt/int64.fits b/funtools/txt/int64.fits
deleted file mode 100644
index 64778b4..0000000
--- a/funtools/txt/int64.fits
+++ /dev/null
Binary files differ
diff --git a/funtools/txt/int64.tab b/funtools/txt/int64.tab
deleted file mode 100644
index e055391..0000000
--- a/funtools/txt/int64.tab
+++ /dev/null
@@ -1,17 +0,0 @@
- Row Value:K
----------- ----------------------
- 1 -9223372036854775808
- 2 -9223372036854775807
- 3 -9223372036854775806
- 4 -9223372036854775805
- 5 -9223372036854775804
- 6 -2
- 7 -1
- 8 0
- 9 1
- 10 2
- 11 9223372036854775803
- 12 9223372036854775804
- 13 9223372036854775805
- 14 9223372036854775806
- 15 9223372036854775807
diff --git a/funtools/txt/int64_Value.idx b/funtools/txt/int64_Value.idx
deleted file mode 100644
index 9ebdd77..0000000
--- a/funtools/txt/int64_Value.idx
+++ /dev/null
Binary files differ
diff --git a/funtools/txt/nlcomma.txt b/funtools/txt/nlcomma.txt
deleted file mode 100644
index ef92193..0000000
--- a/funtools/txt/nlcomma.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-NAME,ID,RA,DEC,Z,SOFT,HARD,14um_z_corrected,2-7keVX-ray_flux(erg/s/cm^2),2-10kevX-ray_flux(erg/s/cm^2),LX_2-10kev_erg/s,R_FLUX,R_MAG,RADIO,IRAC3.6,IRAC4.5,IRAC5.8,IRAC8.0,3.6(uJy),4.5(uJy),5.8(uJy),8.0(uJy),14um_z_corrected,24um_flux(uJy),F_RAT,BW_FLUX,BW_MAG,MPLATE,TYPE,class,"H-alpha FWHM","O III FWHM","O III ratio","O II FWHM"
-'NDWFS_J1424455p331437',0.0,216.18964,33.243813,0.2679,4,23,1149.4,7.88E-14,1.05E-13,43.195,0.0,18.394,0.0,0.0,0.0,0.0,0.0,3.2164,9.1273,76.217,0.94249,1149.4,1814.7,0.0,0.0,20.449,0.0,'none',-1,'NA','NA','NA','NA'
-'NDWFS_J1424479p324935',0,216.19969,32.826523,0.21027,20,8,,2.74E-14,3.65E-14,42.526,0,18.342,0,0,0,0,0,16.879,25.135,-54.52,13.985,,,0,0,19.259,0,'none',-1,,,,
-'NDWFS_J1425059p350926',1.0129,216.27473,35.157372,0.19237,5,7,481.84,2.40E-14,3.19E-14,42.391,114.29,18.55,0,15.423,15.096,15.221,13.414,179.23,163.47,95.539,280.02,481.84,636.8,-1.42,26.99,20.322,50093,'Int',6,,,,
-'NDWFS_J1426203p353707',1.0044,216.58495,35.618736,0.25521,90,27,,9.25E-14,1.23E-13,43.223,302.27,17.494,0,14.226,14.023,14.116,13.692,496.34,416.16,255.39,198.57,,,-0.86,37.222,19.973,9.50E+05,'diffellR',-1,,,,
-'NDWFS_J1426251p331709',1.0104,216.60477,33.285892,0.24457,25,7,730.8,2.40E-14,3.19E-14,42.599,110.56,18.586,0,15.212,14.885,14.859,12.872,209.68,193.3,136.71,436.54,730.8,917.1,-0.98,32.33,20.126,1.91E+05,'ellB',2,,,,
-'NDWFS_J1428060p343014',1.005,217.02538,34.503929,0.15892,26,15,552.29,5.14E-14,6.84E-14,42.556,384.06,17.234,0,14.374,14.343,14.173,12.723,442.42,319.63,242.21,456.83,552.29,635,-1.41,95.763,18.947,50093,'Spr',5,,,,
-'NDWFS_J1428240p325052',0,217.10034,32.847771,0.13064,54,18,373.56,6.17E-14,8.21E-14,42.465,0,18.792,0,0,0,0,0,114.45,96.733,108.92,297.69,373.56,446.3,0,0,19.913,0,'none',-1,,,,
-'NDWFS_J1428561p353042',1.0146,217.23398,35.511711,0.23343,15,7,471.55,2.40E-14,3.19E-14,42.559,75.093,19.006,0,15.539,15.224,14.754,13.902,164.64,148.85,148.93,178.49,471.55,665,-0.98,17.881,20.769,80189,'ellB',2,,,,
-'NDWFS_J1429099p353615',1.0049,217.29156,35.604321,0.22928,20,6,1613.5,2.06E-14,2.74E-14,42.476,218.57,17.846,0,14.353,14.172,13.8,12.05,481.5,384.87,361.49,935.31,1613.5,2068.2,-1.37,46.86,19.723,20096,'ellB',2,,,,
-'NDWFS_J1431023p341957',1.0038,217.75961,34.332695,0.1747,82,17,1696.2,5.83E-14,7.75E-14,42.693,222.64,17.826,0,14.013,13.678,13.178,11.863,656.48,610.76,638.21,1142,1696.2,2149.8,-0.79,61.773,19.423,1.40E+05,'diffellB',-1,,,,
-'NDWFS_J1431116p325353',1.0068,217.79836,32.898285,0.27263,1,4,610.05,1.37E-14,1.82E-14,42.451,149.14,18.261,0,14.749,14.452,14.383,13.418,326.63,290.36,204.23,274.53,610.05,800.9,-1.92,18.416,20.737,9.30E+05,'ellR',1,,,,
-'NDWFS_J1431226p350634',1.009,217.84444,35.109573,0.2771,12,4,355.04,1.37E-14,1.82E-14,42.465,129.18,18.417,0,15.061,14.893,14.786,14.35,75.309,100.16,78.196,143.32,355.04,473.4,-1.35,13.577,21.068,9.90E+05,'dwarfR',8,,,,
-'NDWFS_J1431407p330317',1.0023,217.91966,33.054733,0.19293,21,36,5106.9,1.23E-13,1.64E-13,43.105,646.25,16.669,0.51,13.384,12.821,12.301,10.837,1126.9,1305.3,1418.4,2776,5106.9,6892.9,-1.5,165.35,18.354,1.00E+05,'Spr',5,,,,
-'NDWFS_J1431435p330133',1.004,217.93163,33.025944,0.14115,77,22,4127,7.54E-14,1.00E-13,42.619,230.36,17.789,0,14.107,13.659,13.077,11.239,611.14,625.75,712.96,2016.7,4127,6075.7,-0.81,107.25,18.824,2.72E+05,'Int',6,9.8,11.9,3.2,6.1
-'NDWFS_J1432170p345227',1.0029,218.07112,34.87442,0.1723,25,13,3085.4,4.46E-14,5.93E-14,42.564,356.78,17.314,0.22,13.699,13.352,12.998,11.441,881.18,820.68,754.22,1698.3,3085.4,4230.6,-1.41,63.797,19.388,2.90E+05,'ellB',2,,,,
-'NDWFS_J1434244p341719',1.0039,218.60191,34.288857,0.19535,19,24,2659.5,8.23E-14,1.09E-13,42.939,140.48,18.326,0.83,14.048,13.458,12.91,11.725,652.13,755.84,824.61,1323.2,2659.5,3674.5,-0.96,25.445,20.386,5.01E+05,'none',-1,,,,
-'NDWFS_J1435253p330520',1.0047,218.85555,33.089046,0.199,16,7,750.8,2.40E-14,3.19E-14,42.42,304.79,17.485,0,14.309,14.075,13.962,12.668,481.77,407.07,293.28,506.23,750.8,934.1,-1.56,57.544,19.5,50093,'ellB',2,,,,
-'NDWFS_J1436087p350613',0,219.03656,35.103832,0.28342,181,62,,2.13E-13,2.83E-13,43.675,0,20.914,1.66,0,0,0,0,115.96,78.32,78.873,23.548,,,0,0,22.435,0,'none',-1,,,,
-'NDWFS_J1436562p340808',1.0356,219.23451,34.135609,0.23673,1,6,,2.06E-14,2.74E-14,42.504,39.337,19.708,0,16.256,15.849,15.755,14.698,84.756,83.852,59.138,85.24,,,-1.19,5.3506,22.079,7.20E+05,'ellR',1,,,,
-'NDWFS_J1437079p344001',1.0106,219.28293,34.666958,0.19091,0,7,648.75,2.40E-14,3.19E-14,42.384,129.66,18.413,0,15.238,15.017,14.915,13.449,207.81,177.92,136.15,270.13,648.75,941,-1.71,19.751,20.661,6.20E+05,'diffellR',-1,,,,
-'NDWFS_J1437188p333857',1.0042,219.32835,33.64933,0.19236,1,10,2274.7,3.43E-14,4.56E-14,42.546,186.72,18.017,0,14.147,13.833,13.679,11.322,593.43,533.04,410.2,1914.3,2274.7,2551.5,-1.67,31.246,20.163,3.60E+05,'none',-1,,,,
-'NDWFS_J1438268p352837',1.0115,219.61182,35.477074,0.25777,9,6,1433,2.06E-14,2.74E-14,42.578,27.848,20.083,0,15.314,14.738,14.125,12.791,202.81,233.87,267.8,493.36,1433,1998.9,-0.71,4.0776,22.374,7.10E+05,'ellR',1,,,,
diff --git a/funtools/txt/nlcr b/funtools/txt/nlcr
deleted file mode 100755
index a623bbd..0000000
--- a/funtools/txt/nlcr
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-case $# in
- 0)
- tr '\012' '\015'
- break;;
-
- 1)
- tr '\012' '\015' < $1
- break;;
-
- 2)
- tr '\012' '\015' < $1 > $2
- break;;
-
- *)
- echo "args: 0 (stdin/stdout), 1 (ifile/stdout), or 2 (ifile/ofile)"
- exit 1;;
-esac
-
diff --git a/funtools/txt/nltab.txt b/funtools/txt/nltab.txt
deleted file mode 100644
index ea3bd02..0000000
--- a/funtools/txt/nltab.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-NAME ID RA DEC Z SOFT HARD 14um_z_corrected 2-7keVX-ray_flux(erg/s/cm^2) 2-10kevX-ray_flux(erg/s/cm^2) LX_2-10kev_erg/s R_FLUX R_MAG RADIO IRAC3.6 IRAC4.5 IRAC5.8 IRAC8.0 3.6(uJy) 4.5(uJy) 5.8(uJy) 8.0(uJy) 14um_z_corrected 24um_flux(uJy) F_RAT BW_FLUX BW_MAG MPLATE TYPE class 'H-alpha FWHM' 'O III FWHM' 'O III ratio' 'O II FWHM'
-'NDWFS_J1424455p331437' 0.0 216.18964 33.243813 0.2679 4 23 1149.4 7.88E-14 1.05E-13 43.195 0.0 18.394 0.0 0.0 0.0 0.0 0.0 3.2164 9.1273 76.217 0.94249 1149.4 1814.7 0.0 0.0 20.449 0.0 'none' -1 'NA' 'NA' 'NA' 'NA'
-'NDWFS_J1424479p324935' 0 216.19969 32.826523 0.21027 20 8 2.74E-14 3.65E-14 42.526 0 18.342 0 0 0 0 0 16.879 25.135 -54.52 13.985 0 0 19.259 0 'none' -1
-'NDWFS_J1425059p350926' 1.0129 216.27473 35.157372 0.19237 5 7 481.84 2.40E-14 3.19E-14 42.391 114.29 18.55 0 15.423 15.096 15.221 13.414 179.23 163.47 95.539 280.02 481.84 636.8 -1.42 26.99 20.322 50093 'Int' 6
-'NDWFS_J1426203p353707' 1.0044 216.58495 35.618736 0.25521 90 27 9.25E-14 1.23E-13 43.223 302.27 17.494 0 14.226 14.023 14.116 13.692 496.34 416.16 255.39 198.57 -0.86 37.222 19.973 9.50E+05 'diffellR' -1
-'NDWFS_J1426251p331709' 1.0104 216.60477 33.285892 0.24457 25 7 730.8 2.40E-14 3.19E-14 42.599 110.56 18.586 0 15.212 14.885 14.859 12.872 209.68 193.3 136.71 436.54 730.8 917.1 -0.98 32.33 20.126 1.91E+05 'ellB' 2
-'NDWFS_J1428060p343014' 1.005 217.02538 34.503929 0.15892 26 15 552.29 5.14E-14 6.84E-14 42.556 384.06 17.234 0 14.374 14.343 14.173 12.723 442.42 319.63 242.21 456.83 552.29 635 -1.41 95.763 18.947 50093 'Spr' 5
-'NDWFS_J1428240p325052' 0 217.10034 32.847771 0.13064 54 18 373.56 6.17E-14 8.21E-14 42.465 0 18.792 0 0 0 0 0 114.45 96.733 108.92 297.69 373.56 446.3 0 0 19.913 0 'none' -1
-'NDWFS_J1428561p353042' 1.0146 217.23398 35.511711 0.23343 15 7 471.55 2.40E-14 3.19E-14 42.559 75.093 19.006 0 15.539 15.224 14.754 13.902 164.64 148.85 148.93 178.49 471.55 665 -0.98 17.881 20.769 80189 'ellB' 2
-'NDWFS_J1429099p353615' 1.0049 217.29156 35.604321 0.22928 20 6 1613.5 2.06E-14 2.74E-14 42.476 218.57 17.846 0 14.353 14.172 13.8 12.05 481.5 384.87 361.49 935.31 1613.5 2068.2 -1.37 46.86 19.723 20096 'ellB' 2
-'NDWFS_J1431023p341957' 1.0038 217.75961 34.332695 0.1747 82 17 1696.2 5.83E-14 7.75E-14 42.693 222.64 17.826 0 14.013 13.678 13.178 11.863 656.48 610.76 638.21 1142 1696.2 2149.8 -0.79 61.773 19.423 1.40E+05 'diffellB' -1
-'NDWFS_J1431116p325353' 1.0068 217.79836 32.898285 0.27263 1 4 610.05 1.37E-14 1.82E-14 42.451 149.14 18.261 0 14.749 14.452 14.383 13.418 326.63 290.36 204.23 274.53 610.05 800.9 -1.92 18.416 20.737 9.30E+05 'ellR' 1
-'NDWFS_J1431226p350634' 1.009 217.84444 35.109573 0.2771 12 4 355.04 1.37E-14 1.82E-14 42.465 129.18 18.417 0 15.061 14.893 14.786 14.35 75.309 100.16 78.196 143.32 355.04 473.4 -1.35 13.577 21.068 9.90E+05 'dwarfR' 8
-'NDWFS_J1431407p330317' 1.0023 217.91966 33.054733 0.19293 21 36 5106.9 1.23E-13 1.64E-13 43.105 646.25 16.669 0.51 13.384 12.821 12.301 10.837 1126.9 1305.3 1418.4 2776 5106.9 6892.9 -1.5 165.35 18.354 1.00E+05 'Spr' 5
-'NDWFS_J1431435p330133' 1.004 217.93163 33.025944 0.14115 77 22 4127 7.54E-14 1.00E-13 42.619 230.36 17.789 0 14.107 13.659 13.077 11.239 611.14 625.75 712.96 2016.7 4127 6075.7 -0.81 107.25 18.824 2.72E+05 'Int' 6 9.8 11.9 3.2 6.1
-'NDWFS_J1432170p345227' 1.0029 218.07112 34.87442 0.1723 25 13 3085.4 4.46E-14 5.93E-14 42.564 356.78 17.314 0.22 13.699 13.352 12.998 11.441 881.18 820.68 754.22 1698.3 3085.4 4230.6 -1.41 63.797 19.388 2.90E+05 'ellB' 2
-'NDWFS_J1434244p341719' 1.0039 218.60191 34.288857 0.19535 19 24 2659.5 8.23E-14 1.09E-13 42.939 140.48 18.326 0.83 14.048 13.458 12.91 11.725 652.13 755.84 824.61 1323.2 2659.5 3674.5 -0.96 25.445 20.386 5.01E+05 'none' -1
-'NDWFS_J1435253p330520' 1.0047 218.85555 33.089046 0.199 16 7 750.8 2.40E-14 3.19E-14 42.42 304.79 17.485 0 14.309 14.075 13.962 12.668 481.77 407.07 293.28 506.23 750.8 934.1 -1.56 57.544 19.5 50093 'ellB' 2
-'NDWFS_J1436087p350613' 0 219.03656 35.103832 0.28342 181 62 2.13E-13 2.83E-13 43.675 0 20.914 1.66 0 0 0 0 115.96 78.32 78.873 23.548 0 0 22.435 0 'none' -1
-'NDWFS_J1436562p340808' 1.0356 219.23451 34.135609 0.23673 1 6 2.06E-14 2.74E-14 42.504 39.337 19.708 0 16.256 15.849 15.755 14.698 84.756 83.852 59.138 85.24 -1.19 5.3506 22.079 7.20E+05 'ellR' 1
-'NDWFS_J1437079p344001' 1.0106 219.28293 34.666958 0.19091 0 7 648.75 2.40E-14 3.19E-14 42.384 129.66 18.413 0 15.238 15.017 14.915 13.449 207.81 177.92 136.15 270.13 648.75 941 -1.71 19.751 20.661 6.20E+05 'diffellR' -1
-'NDWFS_J1437188p333857' 1.0042 219.32835 33.64933 0.19236 1 10 2274.7 3.43E-14 4.56E-14 42.546 186.72 18.017 0 14.147 13.833 13.679 11.322 593.43 533.04 410.2 1914.3 2274.7 2551.5 -1.67 31.246 20.163 3.60E+05 'none' -1
-'NDWFS_J1438268p352837' 1.0115 219.61182 35.477074 0.25777 9 6 1433 2.06E-14 2.74E-14 42.578 27.848 20.083 0 15.314 14.738 14.125 12.791 202.81 233.87 267.8 493.36 1433 1998.9 -0.71 4.0776 22.374 7.10E+05 'ellR' 1
diff --git a/funtools/txt/null.tab b/funtools/txt/null.tab
deleted file mode 100644
index 9ffae91..0000000
--- a/funtools/txt/null.tab
+++ /dev/null
@@ -1,6 +0,0 @@
-xxx yyy zzz
---- --- ---
-1 '' 2
-3 x 4
-5 'y z' 6
-7 "this is a very long long long long line" 8
diff --git a/funtools/txt/one.txt b/funtools/txt/one.txt
deleted file mode 100644
index 45b9f81..0000000
--- a/funtools/txt/one.txt
+++ /dev/null
@@ -1 +0,0 @@
-1 2 3 4.0 5.0 0x6 seven
diff --git a/funtools/txt/rdb.txt b/funtools/txt/rdb.txt
deleted file mode 100644
index e1c46c9..0000000
--- a/funtools/txt/rdb.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- ------------
-1 2 3 4.0 5.0 0x6 seven
-8 9 10 11.0 12.0 0xc fourteen
-15 16 17 18.0 19.0 0x14 twenty one
-22 23 24 25.0 26.0 0x1b twenty eight
-29 30 31 32.0 33.0 0x22 thirty five
-36 37 38 39.0 40.0 0x29 forty two
-43 44 45 46.0 47.0 0x30 forty nine
-50 51 52 53.0 54.0 0x37 fifty six
-57 58 59 60.0 61.0 0x3d sixty three
-64 65 66 67.0 68.0 0x45 seventy
-
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a
------- ------ ------ ------ ------ ------- ------------
--1 -2 -3 -4.0 -5.0 0x6 -seven
--8 -9 -10 -11.0 -12.0 0xc -fourteen
--15 -16 -17 -18.0 -19.0 0x14 -twenty one
--22 -23 -24 -25.0 -26.0 0x1b -twenty eight
--29 -30 -31 -32.0 -33.0 0x22 -thirty five
--36 -37 -38 -39.0 -40.0 0x29 -forty two
--43 -44 -45 -46.0 -47.0 0x30 -forty nine
--50 -51 -52 -53.0 -54.0 0x37 -fifty six
--57 -58 -59 -60.0 -61.0 0x3d -sixty three
--64 -65 -66 -67.0 -68.0 0x45 -seventy
-
diff --git a/funtools/txt/sex.tab b/funtools/txt/sex.tab
deleted file mode 100644
index a0764fe..0000000
--- a/funtools/txt/sex.tab
+++ /dev/null
@@ -1,244 +0,0 @@
-# 1 X_IMAGE Object position along x [pixel]
-# 2 Y_IMAGE Object position along y [pixel]
-# 3 ALPHA_J2000 Right ascension of barycenter (J2000) [deg]
-# 4 DELTA_J2000 Declination of barycenter (J2000) [deg]
-# 5 NUMBER Running object number
-# 6 FWHM_IMAGE FWHM assuming a gaussian core [pixel]
-# 7 KRON_RADIUS Kron apertures in units of A or B
-# 8 BACKGROUND Background at centroid position [count]
-# 9 THRESHOLD Detection threshold above background [count]
-# 10 MAG_APER Fixed aperture magnitude vector [mag]
-# 12 MAGERR_APER RMS error vector for fixed aperture mag. [mag]
-# 14 FLAGS Extraction flags
-# 15 CLASS_STAR S/G classifier output
- 417.606 5.610 86.2409442 +9.1805418 1 4.92 16.11 0.01461472 2.777767 -5.0442 -5.6513 0.1156 0.1136 16 0.50
- 1555.502 2274.494 86.0558280 +9.0888484 2 2.92 0.00 -0.001083753 1.349678 -2.7527 99.0000 0.2435 99.0000 0 0.42
- 1120.991 2274.215 86.0558368 +9.1238525 3 3.78 0.00 0.00131159 1.350098 -3.4875 -0.8891 0.1470 3.5851 0 0.35
- 1065.810 2273.914 86.0558596 +9.1282978 4 4.41 14.64 0.001402345 1.352388 -3.7688 -1.3374 0.1172 2.3360 0 0.39
- 1809.481 2272.522 86.0559970 +9.0683881 5 2.92 0.00 -0.0002676375 1.379212 -1.5604 -2.9665 0.7754 0.5271 0 0.45
- 1759.500 2270.627 86.0561500 +9.0724145 6 4.13 18.35 -0.001215857 1.371105 -3.5852 -4.0474 0.1421 0.1997 0 0.40
- 1686.984 2270.473 86.0561602 +9.0782564 7 3.69 18.60 -0.001898551 1.360662 -3.5719 -2.6531 0.1432 0.7072 0 0.41
- 1097.775 2270.041 86.0561766 +9.1257228 8 3.13 0.00 0.002130024 1.348582 -3.0514 99.0000 0.2290 99.0000 0 0.44
- 1181.751 2269.005 86.0562639 +9.1189578 9 3.18 0.00 -0.0006777194 1.344146 -2.9147 -3.9003 0.2348 0.2342 0 0.40
- 757.469 2269.500 86.0562099 +9.1531378 10 2.92 0.00 -0.004457484 1.365236 -3.0093 -1.7202 0.2048 1.6254 0 0.36
- 1356.480 2268.511 86.0563097 +9.1048817 11 0.28 0.00 -0.0007119596 1.341156 -3.2828 -3.7973 0.1710 0.2486 0 0.35
- 1277.496 2268.501 86.0563080 +9.1112447 12 2.92 0.00 -0.001383779 1.341822 -1.6091 99.0000 0.7188 99.0000 0 0.39
- 443.484 2268.506 86.0562809 +9.1784324 13 2.92 0.00 -0.001271929 1.408775 -2.5158 99.0000 0.3102 99.0000 0 0.44
- 1706.203 2266.623 86.0564749 +9.0767082 14 5.88 17.91 -0.001858544 1.360065 -4.0003 -3.4137 0.1072 0.3765 3 0.43
- 1707.445 2262.242 86.0568324 +9.0766083 15 4.77 16.15 -0.03328053 1.356008 -4.6867 -5.0412 0.0671 0.0900 2 0.37
- 1998.000 2260.169 86.0570107 +9.0532014 16 3.91 15.13 -0.001679833 1.419199 -3.5345 -2.7499 0.1530 0.7109 0 0.36
- 1880.116 2259.258 86.0570813 +9.0626981 17 6.87 0.00 0.06426886 1.343341 -3.8464 -3.5454 0.1176 0.3287 0 0.36
- 1738.510 2260.480 86.0569771 +9.0741058 18 2.92 0.00 0.0134547 1.360007 -2.4749 1.5004 0.3391 33.4763 0 0.35
- 1898.209 2256.438 86.0573119 +9.0612407 19 4.61 0.00 0.04091522 1.329685 -3.4767 99.0000 0.1517 99.0000 0 0.37
- 1453.608 2255.169 86.0574013 +9.0970575 20 3.15 0.00 0.01938976 1.331562 -3.6842 -3.6818 0.1263 0.2772 0 0.37
- 1131.499 2254.552 86.0574414 +9.1230066 21 2.91 0.00 -0.0006867351 1.337131 -1.1901 -3.6843 1.0391 0.2711 0 0.44
- 1021.498 2254.502 86.0574421 +9.1318682 22 2.92 0.00 -0.004463369 1.342265 -3.4132 -4.4914 0.1538 0.1355 0 0.36
- 1034.005 2253.453 86.0575280 +9.1308606 23 3.73 19.25 -0.0009154833 1.341148 -3.5286 -4.5803 0.1442 0.1242 0 0.37
- 425.330 2253.110 86.0575367 +9.1798954 24 4.23 0.00 0.05297953 1.431808 -3.8102 -2.5710 0.1275 0.8269 0 0.37
- 946.969 2252.756 86.0575822 +9.1378723 25 3.18 0.00 0.02340364 1.343296 -3.1560 -1.5699 0.2014 1.9203 0 0.37
- 611.518 2252.541 86.0575891 +9.1648962 26 2.91 0.00 -0.0007925122 1.374267 99.0000 -3.6638 99.0000 0.2884 0 0.46
- 517.469 2252.484 86.0575907 +9.1724727 27 2.91 0.00 0.01012044 1.373492 -3.0802 -3.1254 0.2107 0.4800 0 0.40
- 495.249 2251.261 86.0576899 +9.1742627 28 3.24 0.00 0.009159388 1.377206 -2.9198 -2.0218 0.2573 1.3082 0 0.37
- 70.641 2204.899 86.0614601 +9.2084705 29 7.28 23.84 -0.1756882 2.002886 -4.6583 -6.2101 0.1017 0.0503 2 0.47
- 74.985 2216.002 86.0605541 +9.2081203 30 11.72 21.75 -0.0004195133 1.993456 -4.8931 -6.3620 0.0925 0.0484 2 0.39
- 79.713 2222.928 86.0599890 +9.2077391 31 9.18 22.07 0.0002887169 1.983248 -4.7628 -5.8839 0.0995 0.0657 2 0.38
- 1840.456 2162.061 86.0650092 +9.0658960 32 6.64 9.39 0.02589344 1.281253 -8.9806 -9.6766 0.0084 0.0055 0 0.65
- 1203.978 2153.307 86.0657043 +9.1171707 33 8.06 12.56 0.0174063 1.263368 -5.7332 -6.4382 0.0374 0.0294 0 0.57
- 2165.254 2152.936 86.0657633 +9.0397308 34 5.94 15.45 0.06120189 1.876978 -5.2789 -5.7346 0.0697 0.0723 0 0.51
- 1297.620 2129.486 86.0676507 +9.1096276 35 5.99 10.07 0.08587747 1.24545 -7.7253 -8.2973 0.0142 0.0104 0 0.64
- 1198.316 2107.166 86.0694689 +9.1176282 36 4.76 20.03 0.06068096 1.236824 -3.7671 -4.4567 0.1102 0.1235 0 0.35
- 1925.299 2095.943 86.0704055 +9.0590630 37 5.17 11.66 0.04331389 1.281984 -5.8188 -6.2212 0.0360 0.0346 0 0.63
- 2186.007 2068.653 86.0726390 +9.0380613 38 5.09 12.59 0.05365217 1.841244 -5.6213 -6.1018 0.0581 0.0552 0 0.60
- 53.229 2053.718 86.0737976 +9.2098776 39 6.34 16.19 0.04250048 2.066788 -5.1222 -5.6511 0.0830 0.0881 0 0.39
- 1796.513 2023.031 86.0763499 +9.0694400 40 5.20 17.36 0.005959106 1.188932 -4.6341 -5.2155 0.0629 0.0634 0 0.36
- 504.208 2016.598 86.0768394 +9.1735479 41 3.44 24.53 0.03746626 1.217983 -3.7911 -4.4643 0.1068 0.1201 0 0.35
- 1974.799 2005.284 86.0778025 +9.0550778 42 5.20 13.22 0.008647696 1.199798 -5.0314 -5.5484 0.0507 0.0508 0 0.45
- 2034.050 1980.921 86.0797915 +9.0503052 43 4.52 12.68 0.04279175 1.204969 -5.2351 -5.6203 0.0452 0.0491 0 0.54
- 1909.803 1958.317 86.0816322 +9.0603150 44 4.91 9.68 0.01529977 1.154295 -7.7483 -8.2325 0.0129 0.0099 0 0.64
- 1261.428 1959.510 86.0815179 +9.1125479 45 5.98 16.10 0.04229179 1.176073 -4.6157 -5.1884 0.0625 0.0646 0 0.35
- 1715.506 1953.498 86.0820203 +9.0759676 46 2.92 0.00 0.01740203 1.171608 -3.6761 -4.2268 0.1094 0.1403 0 0.35
- 1133.214 1937.115 86.0833417 +9.1228773 47 5.17 21.08 -0.001087305 1.173587 -3.9192 -4.6495 0.0927 0.0966 0 0.35
- 1026.489 1925.022 86.0843257 +9.1314754 48 6.51 13.72 -0.01888023 1.176222 -4.7707 -5.2629 0.0570 0.0607 0 0.36
- 1774.336 1907.117 86.0858055 +9.0712295 49 4.78 20.33 -0.008728635 1.169961 -3.8495 -4.1994 0.0955 0.1416 0 0.35
- 219.008 1904.503 86.0859796 +9.1965264 50 3.74 23.64 0.04701228 1.452893 -3.9944 -4.5847 0.1128 0.1318 0 0.35
- 1861.687 1878.432 86.0881478 +9.0641933 51 4.83 9.99 0.0004376079 1.169409 -7.2183 -7.6727 0.0167 0.0134 0 0.64
- 1366.198 1845.596 86.0908145 +9.1041105 52 3.45 25.61 -0.0001615704 1.181357 -3.8592 -4.5538 0.0997 0.1051 0 0.35
- 1081.965 1825.014 86.0924870 +9.1270086 53 7.95 17.98 0.04620314 1.181799 -4.7883 -5.8192 0.0581 0.0412 0 0.35
- 718.991 1807.955 86.0938704 +9.1562502 54 4.52 22.68 0.007227281 1.190993 -3.9798 -4.7308 0.0915 0.0928 0 0.35
- 1918.422 1803.785 86.0942387 +9.0596244 55 3.41 0.00 -0.00801036 1.174209 -3.5744 -3.9517 0.1162 0.1760 0 0.35
- 493.056 1798.908 86.0946034 +9.1744517 56 7.33 13.74 0.006755965 1.197488 -5.1862 -5.9196 0.0467 0.0385 0 0.40
- 1659.978 1798.975 86.0946251 +9.0804447 57 4.73 17.32 -0.01416276 1.181713 -4.4094 -4.9953 0.0688 0.0739 0 0.36
- 1960.558 1788.214 86.0955099 +9.0562303 58 8.08 0.00 0.09417804 1.181917 -4.2028 -5.1231 0.0837 0.0698 0 0.35
- 1907.732 1772.061 86.0968264 +9.0604863 59 4.82 10.47 0.01929666 1.178105 -7.1697 -7.6136 0.0171 0.0139 0 0.64
- 515.479 1772.130 86.0967891 +9.1726459 60 7.33 12.37 0.009475615 1.198133 -5.7904 -6.5187 0.0351 0.0263 0 0.56
- 1044.021 1774.983 86.0965683 +9.1300666 61 5.78 21.38 -0.003932176 1.190817 -4.0635 -4.7341 0.0863 0.0919 0 0.35
- 1178.788 1761.787 86.0976481 +9.1192101 62 5.50 11.55 0.01975583 1.192413 -5.2813 -5.7132 0.0438 0.0449 0 0.42
- 1073.780 1749.367 86.0986591 +9.1276698 63 4.35 19.07 0.00084054 1.194298 -4.0751 -4.5106 0.0861 0.1121 0 0.35
- 190.814 1720.184 86.1010209 +9.1988021 64 8.99 11.11 0.03637921 1.528868 -6.9819 -7.8013 0.0256 0.0166 0 0.64
- 1026.254 1720.758 86.1009923 +9.1314991 65 5.68 12.90 -0.0002261359 1.200042 -4.9792 -5.4206 0.0522 0.0555 0 0.45
- 316.189 1696.027 86.1029951 +9.1887024 66 7.59 12.24 0.007263345 1.373718 -6.0409 -6.8085 0.0353 0.0255 0 0.62
- 1305.641 1696.752 86.1029570 +9.1089923 67 4.18 20.34 0.06193797 1.199862 -3.9596 -4.5999 0.0942 0.1062 0 0.35
- 1124.682 1688.637 86.1036153 +9.1235704 68 5.60 22.60 -0.01343902 1.204108 -3.9544 -4.8056 0.0946 0.0879 0 0.35
- 2208.124 1681.243 86.1042414 +9.0362888 69 5.45 12.12 -0.03182945 1.71442 -5.6350 -6.1072 0.0526 0.0501 0 0.61
- 544.529 1677.985 86.1044722 +9.1703077 70 4.97 21.44 0.02208511 1.204635 -3.9025 -4.5577 0.0988 0.1100 0 0.35
- 82.639 1646.665 86.1070186 +9.2075181 71 4.88 22.31 -0.01353547 1.853124 -4.3679 -5.6383 0.1131 0.0747 0 0.37
- 93.935 1642.001 86.1073994 +9.2066083 72 3.92 21.08 0.0123501 1.814336 -4.4639 -5.3228 0.1060 0.0942 0 0.39
- 709.364 1640.125 86.1075651 +9.1570294 73 7.56 16.83 0.01033209 1.210666 -4.3232 -4.8131 0.0764 0.0895 0 0.35
- 1452.399 1625.961 86.1087357 +9.0971708 74 5.16 14.61 -0.003818109 1.202938 -5.2677 -5.7902 0.0443 0.0422 0 0.48
- 656.720 1611.675 86.1098856 +9.1612709 75 6.15 8.75 0.04118158 1.216058 -9.6827 -10.3079 0.0056 0.0039 0 0.70
- 1996.038 1609.204 86.1101136 +9.0533758 76 4.70 8.46 0.06663497 1.221484 -9.8591 -10.2925 0.0050 0.0039 0 0.66
- 1197.560 1590.149 86.1116525 +9.1177014 77 5.22 9.35 0.07748885 1.210629 -8.7120 -9.2162 0.0087 0.0065 0 0.65
- 179.611 1555.921 86.1144261 +9.1997078 78 7.69 16.06 0.01942348 1.57232 -5.1944 -5.9999 0.0622 0.0489 0 0.38
- 1219.322 1527.461 86.1167677 +9.1159493 79 5.30 10.53 0.02036445 1.218474 -6.4792 -6.9510 0.0248 0.0207 0 0.64
- 22.207 1515.531 86.1177195 +9.2123890 80 5.40 10.21 -0.009332203 2.069416 -7.3837 -7.7228 0.0264 0.0233 0 0.64
- 563.926 1497.183 86.1192265 +9.1687485 81 6.57 11.92 0.01421688 1.235402 -5.2617 -5.8849 0.0464 0.0411 0 0.43
- 999.514 1481.459 86.1205172 +9.1336579 82 5.65 15.15 0.02366936 1.225796 -4.5571 -5.0719 0.0666 0.0738 0 0.35
- 973.428 1473.741 86.1211465 +9.1357595 83 5.17 11.50 0.02553258 1.227484 -5.8506 -6.2854 0.0340 0.0314 0 0.60
- 1834.306 1469.728 86.1214887 +9.0664074 84 5.55 16.39 0.02789751 1.222035 -4.2517 -4.5959 0.0796 0.1079 0 0.35
- 1820.005 1447.854 86.1232729 +9.0675599 85 4.74 10.60 0.04772974 1.222622 -6.8700 -7.3100 0.0203 0.0171 0 0.64
- 967.012 1438.487 86.1240230 +9.1362770 86 5.52 18.00 0.0290238 1.231963 -3.9665 -4.6414 0.0945 0.1040 0 0.35
- 857.888 1432.745 86.1244897 +9.1450680 87 5.65 12.18 -0.003475794 1.238732 -5.7575 -6.3139 0.0359 0.0308 0 0.60
- 2124.012 1431.515 86.1246109 +9.0430694 88 3.75 22.53 0.003370641 1.38413 -3.8027 -4.4643 0.1198 0.1373 0 0.36
- 1473.838 1429.838 86.1247370 +9.0954473 89 3.93 20.22 0.02544585 1.223177 -3.6887 -3.9967 0.1110 0.1784 0 0.35
- 2146.978 1417.027 86.1257931 +9.0412196 90 3.59 19.47 -0.007954591 1.47055 -4.1453 -4.7218 0.1004 0.1163 0 0.35
- 1922.407 1410.796 86.1262977 +9.0593110 91 4.66 12.97 0.004727704 1.221279 -4.7241 -5.0228 0.0610 0.0773 0 0.40
- 453.110 1409.125 86.1264104 +9.1776773 92 4.95 20.51 0.01873171 1.24887 -3.9416 -4.4654 0.0980 0.1222 0 0.35
- 587.749 1400.314 86.1271317 +9.1668310 93 6.12 9.45 0.04138099 1.24633 -8.0649 -8.6785 0.0122 0.0086 0 0.65
- 1911.476 1385.132 86.1283912 +9.0601920 94 5.86 18.72 0.01064248 1.222503 -4.0526 -4.3003 0.0891 0.1364 0 0.35
- 23.536 1375.496 86.1291482 +9.2122843 95 2.91 0.00 0.03009493 2.140594 -3.5408 -2.3448 0.2229 1.4505 0 0.54
- 1964.754 1363.510 86.1301559 +9.0559002 96 4.74 13.87 0.003441798 1.227674 -5.2088 -5.6306 0.0466 0.0483 0 0.43
- 1735.275 1344.344 86.1317160 +9.0743873 97 4.75 10.12 0.02552313 1.228588 -6.9833 -7.4367 0.0195 0.0159 0 0.64
- 732.638 1321.155 86.1335933 +9.1551599 98 5.54 8.75 0.03291955 1.245566 -9.6470 -10.2072 0.0058 0.0042 0 0.67
- 293.663 1323.810 86.1333703 +9.1905237 99 7.31 16.45 0.01005584 1.442045 -5.1142 -5.8414 0.0593 0.0495 0 0.37
- 144.513 1306.791 86.1347571 +9.2025394 100 5.05 20.24 0.03890681 1.710922 -4.2347 -4.5451 0.1145 0.1668 0 0.36
- 2189.222 1303.606 86.1350457 +9.0378180 101 3.43 0.00 -0.0144296 1.677403 -4.0107 -4.6603 0.1246 0.1426 0 0.36
- 2164.604 1297.969 86.1355052 +9.0398013 102 5.69 11.48 -0.01968674 1.544091 -5.3390 -5.8638 0.0562 0.0528 0 0.40
- 701.655 1295.966 86.1356482 +9.1576562 103 5.81 18.83 0.06224322 1.248528 -4.0488 -4.0272 0.0934 0.1827 0 0.35
- 1266.992 1282.254 86.1367749 +9.1121129 104 7.07 19.34 0.09395044 1.232579 -4.6149 -5.4515 0.0677 0.0571 0 0.35
- 1363.997 1275.312 86.1373426 +9.1042983 105 4.24 22.64 0.03072432 1.231731 -3.8302 -4.4840 0.1043 0.1185 0 0.35
- 1777.096 1267.382 86.1379951 +9.0710193 106 6.23 18.79 -0.007995656 1.230483 -4.1806 -4.8998 0.0823 0.0829 0 0.35
- 1064.503 1256.994 86.1388332 +9.1284257 107 2.92 0.00 -0.02702625 1.24495 -3.8269 -4.2128 0.1053 0.1495 0 0.35
- 605.977 1249.512 86.1394376 +9.1653647 108 3.76 23.99 0.0007225897 1.259458 -3.8457 -4.4376 0.1049 0.1257 0 0.35
- 129.378 1229.679 86.1410500 +9.2037597 109 6.02 15.70 0.01454219 1.776825 -5.0671 -5.7054 0.0737 0.0686 0 0.40
- 991.007 1223.475 86.1415672 +9.1343470 110 3.96 19.39 -0.01063266 1.250278 -4.1002 -4.4501 0.0889 0.1241 0 0.35
- 2152.545 1220.110 86.1418563 +9.0407738 111 5.01 14.31 0.009874775 1.490149 -5.5089 -6.0353 0.0492 0.0455 0 0.57
- 682.021 1217.556 86.1420462 +9.1592389 112 5.66 12.62 0.03916539 1.253801 -5.7616 -6.2843 0.0364 0.0321 0 0.59
- 2292.447 1213.504 86.1423969 +9.0295035 113 2.91 0.00 0.001424114 2.168964 -3.5807 -3.0237 0.2268 0.8588 0 0.59
- 1442.438 1196.731 86.1437548 +9.0979801 114 4.80 11.07 -0.01767025 1.232501 -5.5496 -5.9477 0.0394 0.0390 0 0.60
- 862.303 1198.142 86.1436326 +9.1447157 115 4.38 22.76 -0.02585934 1.254541 -3.9597 -4.5683 0.0972 0.1105 0 0.35
- 894.860 1195.890 86.1438168 +9.1420929 116 4.45 22.33 0.007419226 1.254409 -3.9273 -4.5147 0.0995 0.1178 0 0.35
- 1064.216 1179.575 86.1451500 +9.1284498 117 5.29 12.06 -0.01046386 1.249611 -6.0157 -6.5383 0.0319 0.0270 0 0.62
- 1183.254 1170.463 86.1458949 +9.1188603 118 15.85 0.00 0.1976199 1.243384 -4.6271 -6.0127 0.0725 0.0403 0 0.35
- 797.361 1160.733 86.1466844 +9.1499478 119 5.53 13.57 -0.00115279 1.256737 -5.2732 -5.8803 0.0467 0.0413 0 0.50
- 1191.938 1157.334 86.1469662 +9.1181608 120 11.62 0.00 0.1622578 1.243799 -4.2097 -5.7454 0.0902 0.0482 0 0.35
- 639.581 1149.057 86.1476353 +9.1626587 121 5.41 15.60 -0.02144875 1.263906 -4.5457 -5.1697 0.0691 0.0687 0 0.36
- 181.835 1122.566 86.1497921 +9.1995350 122 7.76 0.00 0.09506787 1.663995 -4.5546 -5.4731 0.0960 0.0774 0 0.35
- 101.073 1092.072 86.1522798 +9.2060415 123 7.85 13.14 0.07972124 1.88576 -5.6263 -6.2743 0.0599 0.0510 0 0.51
- 218.287 1087.861 86.1526247 +9.1965988 124 7.07 10.41 0.05566718 1.586464 -7.5964 -8.2767 0.0197 0.0135 0 0.65
- 1032.050 1087.998 86.1526218 +9.1310421 125 6.43 12.47 0.02814013 1.254642 -4.9903 -5.4303 0.0539 0.0582 0 0.40
- 31.605 1079.791 86.1532814 +9.2116380 126 3.02 22.28 -0.1210888 2.113574 -4.7057 -6.0453 0.1086 0.0636 3 0.44
- 26.437 1077.558 86.1534637 +9.2120544 127 8.18 17.88 -0.09014083 2.123611 -4.9394 -5.7916 0.0905 0.0758 2 0.42
- 197.445 1072.558 86.1538734 +9.1982780 128 6.72 15.52 0.03648683 1.63675 -5.5043 -6.1689 0.0549 0.0460 0 0.50
- 2197.312 1059.070 86.1549933 +9.0371691 129 6.34 15.00 0.001555798 1.722689 -4.7577 -5.1845 0.0835 0.0980 0 0.42
- 1431.764 1038.141 86.1566935 +9.0988416 130 4.84 10.61 0.03995792 1.243892 -6.8381 -7.2746 0.0212 0.0177 0 0.64
- 294.864 1034.462 86.1569833 +9.1904303 131 5.66 17.37 -0.01020942 1.489068 -4.7274 -5.3962 0.0752 0.0695 0 0.36
- 1827.593 998.345 86.1599436 +9.0669541 132 4.82 9.82 0.04892986 1.242543 -8.0231 -8.4609 0.0121 0.0095 0 0.64
- 494.276 990.836 86.1605451 +9.1743660 133 5.71 14.69 0.04103638 1.264681 -5.3043 -5.8375 0.0465 0.0438 0 0.48
- 520.158 972.022 86.1620807 +9.1722812 134 5.66 10.09 0.01273697 1.265727 -7.1966 -7.7650 0.0183 0.0138 0 0.64
- 976.112 972.742 86.1620255 +9.1355495 135 5.36 12.10 0.03003768 1.269576 -6.3688 -6.9205 0.0274 0.0220 0 0.64
- 393.177 976.074 86.1617490 +9.1825107 136 4.63 19.10 0.01517049 1.350001 -4.1132 -4.5373 0.0939 0.1258 0 0.35
- 789.384 970.964 86.1621691 +9.1505923 137 5.31 12.59 0.02578528 1.266088 -5.8113 -6.3070 0.0358 0.0318 0 0.61
- 1347.750 964.424 86.1627071 +9.1056104 138 4.83 9.45 0.04856484 1.246616 -7.9760 -8.4252 0.0125 0.0097 0 0.64
- 654.996 963.000 86.1628179 +9.1614186 139 4.10 21.00 -0.001648318 1.275878 -3.8659 -3.8747 0.1036 0.2086 0 0.35
- 1714.302 935.707 86.1650527 +9.0760813 140 5.14 20.16 -2.718321e-05 1.249393 -3.9776 -4.3190 0.0950 0.1381 0 0.35
- 1137.781 933.049 86.1652654 +9.1225257 141 5.32 10.89 -0.008276273 1.259455 -5.2424 -5.6968 0.0469 0.0474 0 0.45
- 1425.701 927.448 86.1657245 +9.0993310 142 4.71 12.90 0.02210981 1.247789 -4.8210 -5.1263 0.0579 0.0727 0 0.36
- 708.315 909.055 86.1672202 +9.1571237 143 5.38 9.76 0.04569134 1.271981 -7.8515 -8.3840 0.0136 0.0101 0 0.64
- 1018.626 903.484 86.1676769 +9.1321250 144 5.07 10.45 0.004811816 1.273277 -6.6833 -7.1464 0.0235 0.0194 0 0.64
- 127.517 902.156 86.1677793 +9.2039128 145 6.46 16.61 0.0919533 1.836803 -5.5693 -6.2140 0.0600 0.0513 0 0.57
- 264.165 888.019 86.1689339 +9.1929045 146 4.68 22.06 -0.02063698 1.547605 -4.3029 -4.9073 0.0972 0.1059 0 0.35
- 616.631 863.563 86.1709318 +9.1645100 147 6.56 13.59 0.02714386 1.281234 -4.7732 -5.2554 0.0625 0.0678 0 0.35
- 1636.412 843.129 86.1726050 +9.0823567 148 4.80 12.75 -0.0120033 1.250943 -5.3207 -5.7454 0.0448 0.0456 0 0.52
- 1946.981 839.784 86.1728796 +9.0573373 149 5.03 20.09 0.01630508 1.248056 -3.9466 -4.4049 0.0959 0.1287 0 0.35
- 1994.988 815.023 86.1748997 +9.0534700 150 4.59 11.75 0.03552827 1.254719 -5.8395 -6.2066 0.0343 0.0340 0 0.63
- 1736.569 807.380 86.1755219 +9.0742882 151 4.56 10.38 0.006303746 1.256743 -7.0896 -7.4998 0.0189 0.0157 0 0.64
- 871.277 795.896 86.1764547 +9.1439961 152 5.15 12.80 0.03029977 1.282376 -5.7315 -6.2645 0.0375 0.0331 0 0.56
- 634.999 798.498 86.1762413 +9.1630306 153 2.92 0.00 -0.009621313 1.28485 -3.8949 -4.4906 0.1040 0.1218 0 0.35
- 1423.565 792.178 86.1767607 +9.0995038 154 4.16 21.08 0.02764784 1.253158 -4.0668 -4.7960 0.0915 0.0935 0 0.36
- 45.500 789.053 86.1770094 +9.2105207 155 3.62 0.00 0.03502592 2.147006 -3.8772 -4.7385 0.1806 0.1792 0 0.57
- 1662.020 781.260 86.1776525 +9.0802940 156 4.60 15.07 -0.02068329 1.253043 -4.4256 -4.9075 0.0719 0.0840 0 0.35
- 1091.838 763.379 86.1791089 +9.1262278 157 5.00 8.32 0.02919684 1.282931 -10.1171 -10.5885 0.0048 0.0036 2 0.70
- 82.964 767.894 86.1787363 +9.2075027 158 8.05 12.81 0.09825258 1.992758 -6.1711 -6.7959 0.0480 0.0388 0 0.63
- 120.788 764.034 86.1790515 +9.2044556 159 7.47 11.20 0.02928095 1.855875 -6.5944 -7.2582 0.0366 0.0272 0 0.64
- 1339.987 765.813 86.1789114 +9.1062370 160 3.56 19.15 0.03516143 1.261292 -4.0093 -4.2020 0.0937 0.1575 0 0.36
- 2212.771 763.539 86.1791005 +9.0359257 161 5.70 17.66 -0.03742005 1.839378 -4.4878 -4.9528 0.1019 0.1242 0 0.36
- 1819.214 753.984 86.1798784 +9.0676305 162 5.14 13.68 0.005377046 1.256451 -4.5880 -5.0085 0.0665 0.0792 0 0.36
- 978.782 733.715 86.1815289 +9.1353358 163 5.20 10.09 0.02435874 1.290131 -6.9220 -7.3969 0.0212 0.0171 0 0.64
- 229.889 706.022 86.1837862 +9.1956666 164 7.41 9.36 0.09204663 1.587287 -9.2592 -9.9655 0.0089 0.0060 0 0.68
- 2221.799 704.369 86.1839271 +9.0351986 165 5.55 10.73 -0.02896945 1.883985 -6.7894 -7.2748 0.0338 0.0270 0 0.65
- 592.903 704.379 86.1839214 +9.1664223 166 8.92 15.12 0.03525537 1.296754 -5.2403 -6.0956 0.0501 0.0376 0 0.42
- 33.146 682.131 86.1857355 +9.2115163 167 4.46 20.61 -0.1862383 2.180247 -4.5565 -5.8792 0.1180 0.0739 0 0.44
- 1248.969 639.044 86.1892541 +9.1135697 168 3.66 19.75 0.02634734 1.288149 -3.9730 -4.4172 0.0985 0.1304 0 0.35
- 1212.368 632.549 86.1897839 +9.1165183 169 4.99 13.24 -0.007830339 1.292437 -5.6277 -6.1174 0.0399 0.0366 0 0.62
- 830.497 632.416 86.1897941 +9.1472818 170 5.12 17.29 0.03028828 1.294156 -4.6745 -5.3287 0.0661 0.0642 0 0.36
- 1455.832 624.693 86.1904253 +9.0969049 171 5.15 15.22 0.06640774 1.267595 -4.8384 -5.2728 0.0592 0.0674 0 0.38
- 1445.620 609.995 86.1916244 +9.0977276 172 7.28 17.83 0.09625255 1.27028 -4.9110 -5.8545 0.0595 0.0443 0 0.36
- 177.107 602.567 86.1922290 +9.1999189 173 5.37 21.49 0.001910119 1.721305 -4.5619 -5.3650 0.0939 0.0832 0 0.35
- 1817.307 597.559 86.1926394 +9.0677846 174 4.85 12.10 -0.00594943 1.268593 -5.5628 -5.9715 0.0402 0.0396 0 0.58
- 1667.864 591.065 86.1931690 +9.0798237 175 4.60 12.74 -0.01115637 1.26816 -5.5101 -5.9768 0.0407 0.0394 0 0.61
- 1378.349 590.241 86.1932360 +9.1031470 176 4.88 13.40 0.02324863 1.277266 -5.2756 -5.7303 0.0474 0.0472 0 0.50
- 1076.247 581.800 86.1939245 +9.1274842 177 5.66 12.51 -0.01207212 1.300551 -4.8040 -5.1811 0.0614 0.0716 0 0.36
- 1844.508 581.486 86.1939506 +9.0655933 178 0.75 0.00 -0.003495475 1.267821 -2.5016 -2.4268 0.2891 0.7555 0 0.54
- 1595.319 552.139 86.1963447 +9.0856679 179 6.89 17.71 0.0273231 1.260863 -4.2033 -4.4919 0.0837 0.1221 0 0.35
- 818.514 504.701 86.2002154 +9.1482472 180 5.41 13.14 0.0156024 1.294929 -4.7102 -5.1489 0.0657 0.0735 0 0.36
- 1268.481 503.489 86.2003139 +9.1119979 181 5.35 14.26 -0.008285162 1.29202 -4.6286 -5.0940 0.0664 0.0759 0 0.35
- 1734.363 502.167 86.2004215 +9.0744666 182 4.95 15.03 0.01896482 1.266682 -4.5575 -4.9009 0.0685 0.0885 0 0.36
- 1357.704 500.623 86.2005478 +9.1048101 183 5.67 14.58 -0.04778919 1.279114 -4.4149 -4.8885 0.0744 0.0874 0 0.36
- 1900.167 479.031 86.2023088 +9.0611094 184 4.85 12.23 0.01388338 1.247547 -5.5807 -6.0057 0.0390 0.0383 0 0.56
- 225.398 470.480 86.2030086 +9.1960286 185 7.87 22.03 0.1145277 1.639661 -4.5355 -5.5080 0.0961 0.0736 0 0.35
- 1516.144 464.883 86.2034635 +9.0920462 186 10.78 15.58 0.05072638 1.271921 -5.3209 -6.5738 0.0483 0.0274 0 0.36
- 1238.097 449.064 86.2047545 +9.1144456 187 4.86 9.74 0.03109989 1.311229 -7.7110 -8.1629 0.0147 0.0117 0 0.64
- 2308.260 444.727 86.2051064 +9.0282336 188 6.81 10.91 0.006362674 1.776166 -5.3498 -5.7371 0.0701 0.0701 24 0.62
- 1128.729 437.430 86.2057039 +9.1232562 189 4.97 9.40 0.05125002 1.322165 -8.7365 -9.2220 0.0094 0.0070 0 0.65
- 1548.271 437.878 86.2056666 +9.0894580 190 5.06 13.93 7.578218e-05 1.286519 -5.2266 -5.7009 0.0486 0.0484 0 0.51
- 1623.507 418.500 86.2072474 +9.0833969 191 2.92 0.00 -0.04009676 1.304367 -2.5386 -3.5515 0.2815 0.2761 0 0.48
- 1182.792 415.417 86.2075000 +9.1189009 192 3.24 0.00 0.0255399 1.34279 -3.8632 -4.4057 0.1119 0.1390 0 0.36
- 1028.000 379.490 86.2104318 +9.1313708 193 2.92 0.00 -0.04681851 1.377277 -3.9147 -4.8773 0.1073 0.0934 0 0.35
- 1366.666 359.188 86.2120871 +9.1040878 194 4.85 9.18 0.07333304 1.376761 -9.0017 -9.4635 0.0086 0.0066 0 0.65
- 875.054 346.451 86.2131281 +9.1436920 195 5.98 20.30 0.03870688 1.407853 -4.5273 -5.4983 0.0804 0.0614 0 0.35
- 826.472 337.570 86.2138529 +9.1476058 196 5.92 13.10 0.06208292 1.414435 -5.7806 -6.3499 0.0408 0.0350 0 0.57
- 1347.394 336.202 86.2139625 +9.1056403 197 4.89 13.79 0.07728139 1.403806 -5.6177 -6.1045 0.0440 0.0412 0 0.60
- 500.995 338.503 86.2137780 +9.1738262 198 2.92 0.00 0.01600203 1.462032 -4.0464 -5.0400 0.1096 0.0896 0 0.35
- 718.686 333.454 86.2141892 +9.1562890 199 6.39 19.63 0.053315 1.418846 -4.5198 -5.4106 0.0826 0.0667 0 0.35
- 1335.759 330.413 86.2144349 +9.1065776 200 7.58 15.68 0.03807464 1.409902 -4.4852 -4.8762 0.0817 0.1005 0 0.35
- 2282.996 307.506 86.2162997 +9.0302684 201 3.75 0.00 0.07577261 1.81354 -3.9820 99.0000 0.1434 99.0000 0 0.35
- 2290.521 297.506 86.2171154 +9.0296621 202 2.92 0.00 0.004445519 1.834932 -2.8400 99.0000 0.3436 99.0000 0 0.50
- 938.369 257.085 86.2204197 +9.1385910 203 5.07 13.38 0.02405079 1.44078 -5.2671 -5.7164 0.0534 0.0542 0 0.47
- 437.336 255.088 86.2205853 +9.1789542 204 6.12 14.40 0.008740189 1.563885 -5.5905 -6.2888 0.0501 0.0398 0 0.54
- 2265.002 253.005 86.2207455 +9.0317177 205 4.11 19.68 -0.0211753 1.738698 -4.1806 -4.3993 0.1182 0.1959 0 0.37
- 658.097 245.630 86.2213559 +9.1611696 206 4.74 21.46 -0.003697118 1.438926 -4.3037 -5.0622 0.0916 0.0867 0 0.35
- 1556.348 235.461 86.2221806 +9.0888066 207 4.91 11.60 0.04050834 1.440981 -6.1323 -6.5904 0.0347 0.0306 0 0.64
- 1172.185 230.242 86.2226086 +9.1197546 208 5.13 11.54 0.01286937 1.44271 -5.6558 -6.1042 0.0442 0.0418 0 0.60
- 556.085 223.943 86.2231262 +9.1693876 209 5.16 16.83 0.05480453 1.474708 -5.0041 -5.6069 0.0632 0.0608 0 0.42
- 2180.446 207.787 86.2244345 +9.0385293 210 4.71 20.87 0.0364593 1.663865 -4.2277 -4.6656 0.1109 0.1468 0 0.37
- 2274.257 207.672 86.2244433 +9.0309719 211 4.52 19.59 0.002831855 1.722341 -4.6349 -5.3117 0.0919 0.0931 2 0.41
- 785.989 196.705 86.2253474 +9.1508664 212 5.18 14.45 0.02221823 1.512377 -5.0527 -5.5595 0.0636 0.0639 0 0.41
- 678.326 195.616 86.2254370 +9.1595397 213 6.00 11.85 0.02047626 1.50774 -6.5083 -7.1177 0.0307 0.0236 0 0.64
- 2276.508 193.511 86.2255984 +9.0307905 214 2.92 0.00 -0.1277841 1.710826 -4.0987 -5.4293 0.1180 0.0791 0 0.44
- 912.373 179.775 86.2267281 +9.1406848 215 6.02 20.55 0.06756821 1.573579 -4.3360 -4.6039 0.0997 0.1451 0 0.35
- 893.633 177.188 86.2269393 +9.1421944 216 5.34 18.55 0.07249179 1.581002 -4.7398 -5.3801 0.0788 0.0770 0 0.36
- 2173.124 176.750 86.2269664 +9.0391189 217 5.97 17.56 0.103289 1.719203 -4.3713 -4.9756 0.1085 0.1209 0 0.36
- 2279.836 175.173 86.2270942 +9.0305222 218 3.89 16.23 -0.03651086 1.684787 -3.8608 -4.1377 0.1414 0.2261 0 0.36
- 2250.481 173.538 86.2272279 +9.0328870 219 2.91 0.00 -0.02527897 1.684913 -2.7766 -3.7362 0.3338 0.3476 0 0.53
- 116.407 165.926 86.2278636 +9.2048077 220 5.32 23.18 0.05275828 2.12013 -4.5384 -5.1069 0.1214 0.1381 0 0.39
- 1875.704 154.102 86.2288159 +9.0630788 221 6.07 20.62 0.007980618 1.6444 -4.4520 -5.4864 0.0965 0.0725 0 0.36
- 160.480 153.011 86.2289173 +9.2012571 222 3.51 23.91 0.06577626 2.068247 -4.3920 -5.2920 0.1265 0.1109 0 0.37
- 1064.695 148.051 86.2293155 +9.1284135 223 5.43 17.71 0.04264953 1.688387 -4.8210 -5.3706 0.0809 0.0831 0 0.36
- 2270.523 141.499 86.2298411 +9.0312722 224 2.92 0.00 -0.04948388 1.635946 -3.7100 -4.9366 0.1469 0.1152 0 0.42
- 1532.796 120.286 86.2315772 +9.0907032 225 4.77 14.91 0.03374222 1.817609 -5.0230 -5.5289 0.0777 0.0804 0 0.41
- 2000.583 110.621 86.2323621 +9.0530182 226 5.08 11.67 0.07245546 1.933573 -6.6049 -7.0790 0.0374 0.0317 0 0.64
- 1666.566 107.870 86.2325891 +9.0799265 227 5.07 15.28 0.03791413 1.86472 -5.3885 -5.8936 0.0654 0.0644 0 0.56
- 2080.408 98.360 86.2333615 +9.0465875 228 6.22 15.32 0.07224137 2.075971 -5.0080 -5.2064 0.0883 0.1214 0 0.45
- 1390.531 84.906 86.2344650 +9.1021637 229 4.81 12.53 -0.002741659 2.01028 -5.4542 -5.8513 0.0680 0.0711 0 0.55
- 1309.777 48.187 86.2374615 +9.1086689 230 3.45 23.67 0.0150502 2.259328 -4.4693 -4.1598 0.1306 0.3208 0 0.48
- 1685.163 36.468 86.2384141 +9.0784277 231 7.19 10.08 0.1331511 2.245411 -7.6590 -8.2576 0.0275 0.0196 0 0.65
diff --git a/funtools/txt/space.txt b/funtools/txt/space.txt
deleted file mode 100644
index 38ac8ec..0000000
--- a/funtools/txt/space.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- --------------
-1 2 3 4.0 5.0 0x6 seven
-8 9 10 11.0 12.0 0xc fourteen
-15 16 17 18.0 19.0 0x14 "twenty one"
-22 23 24 25.0 26.0 0x1b "twenty eight"
-29 30 31 32.0 33.0 0x22 "thirty five"
-36 37 38 39.0 40.0 0x29 "forty two"
-43 44 45 46.0 47.0 0x30 "forty nine"
-50 51 52 53.0 54.0 0x37 "fifty six"
-57 58 59 60.0 61.0 0x3d "sixty three"
-64 65 66 67.0 68.0 0x45 seventy
-
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a
--1 -2 -3 -4.0 -5.0 0x6 "-seven"
--8 -9 -10 -11.0 -12.0 0xc "-fourteen"
--15 -16 -17 -18.0 -19.0 0x14 "-twenty one"
--22 -23 -24 -25.0 -26.0 0x1b "-twenty eight"
--29 -30 -31 -32.0 -33.0 0x22 "-thirty five"
--36 -37 -38 -39.0 -40.0 0x29 "-forty two"
--43 -44 -45 -46.0 -47.0 0x30 "-forty nine"
--50 -51 -52 -53.0 -54.0 0x37 "-fifty six"
--57 -58 -59 -60.0 -61.0 0x3d "-sixty three"
--64 -65 -66 -67.0 -68.0 0x45 "-seventy"
diff --git a/funtools/txt/sptab.txt b/funtools/txt/sptab.txt
deleted file mode 100644
index ef96f67..0000000
--- a/funtools/txt/sptab.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- --------------
-1 2 3 4.0 5.0 0x6 seven
-8 9 10 11.0 12.0 0xc fourteen
-15 16 17 18.0 19.0 0x14 "twenty one"
-22 23 24 25.0 26.0 0x1b "twenty eight"
-29 30 31 32.0 33.0 0x22 "thirty five"
-36 37 38 39.0 40.0 0x29 "forty two"
-43 44 45 46.0 47.0 0x30 "forty nine"
-50 51 52 53.0 54.0 0x37 "fifty six"
-57 58 59 60.0 61.0 0x3d "sixty three"
-64 65 66 67.0 68.0 0x45 seventy
-
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a
--1 -2 -3 -4.0 -5.0 0x6 "-seven"
--8 -9 -10 -11.0 -12.0 0xc "-fourteen"
--15 -16 -17 -18.0 -19.0 0x14 "-twenty one"
--22 -23 -24 -25.0 -26.0 0x1b "-twenty eight"
--29 -30 -31 -32.0 -33.0 0x22 "-thirty five"
--36 -37 -38 -39.0 -40.0 0x29 "-forty two"
--43 -44 -45 -46.0 -47.0 0x30 "-forty nine"
--50 -51 -52 -53.0 -54.0 0x37 "-fifty six"
--57 -58 -59 -60.0 -61.0 0x3d "-sixty three"
--64 -65 -66 -67.0 -68.0 0x45 "-seventy"
diff --git a/funtools/txt/tab.txt b/funtools/txt/tab.txt
deleted file mode 100644
index a7d8400..0000000
--- a/funtools/txt/tab.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-bval:b ival:i jval:j eval:e dval:d hval:8x aval:14a
------- ------ ------ ------ ------ ------- ------------
-1 2 3 4.0 5.0 0x6 seven
-8 9 10 11.0 12.0 0xc fourteen
-15 16 17 18.0 19.0 0x14 twenty one
-22 23 24 25.0 26.0 0x1b twenty eight
-29 30 31 32.0 33.0 0x22 thirty five
-36 37 38 39.0 40.0 0x29 forty two
-43 44 45 46.0 47.0 0x30 forty nine
-50 51 52 53.0 54.0 0x37 fifty six
-57 58 59 60.0 61.0 0x3d sixty three
-64 65 66 67.0 68.0 0x45 seventy
-
-bneg:b ineg:i jneg:j eneg:e dneg:d hneg:8x aneg:20a
------- ------ ------ ------ ------ ------- ------------
--1 -2 -3 -4.0 -5.0 0x6 -seven
--8 -9 -10 -11.0 -12.0 0xc -fourteen
--15 -16 -17 -18.0 -19.0 0x14 -twenty one
--22 -23 -24 -25.0 -26.0 0x1b -twenty eight
--29 -30 -31 -32.0 -33.0 0x22 -thirty five
--36 -37 -38 -39.0 -40.0 0x29 -forty two
--43 -44 -45 -46.0 -47.0 0x30 -forty nine
--50 -51 -52 -53.0 -54.0 0x37 -fifty six
--57 -58 -59 -60.0 -61.0 0x3d -sixty three
--64 -65 -66 -67.0 -68.0 0x45 -seventy
-
diff --git a/funtools/txt/test.fits b/funtools/txt/test.fits
deleted file mode 100644
index 45e2000..0000000
--- a/funtools/txt/test.fits
+++ /dev/null
Binary files differ
diff --git a/funtools/txt/vis.tab b/funtools/txt/vis.tab
deleted file mode 100644
index 68f06f3..0000000
--- a/funtools/txt/vis.tab
+++ /dev/null
@@ -1,175 +0,0 @@
-#
-# VizieR Astronomical Server: vizier.cfa.harvard.edu 2005-12-05T19:15:01
-# Explanations and Statistics of UCDs: See LINK below
-# In case of problem, please report to: question@simbad.u-strasbg.fr
-# (link)
-#
-#Coosys J2000: eq_FK5 2000
-#INFO -ref=Vxml24078
-#INFO -c=010.684700+41.268872,bm=15.014000/15.011
-
-#RESOURCE=2246
-#Name: II/246
-#Title: 2MASS All-Sky Catalog of Point Sources (Cutri+ 2003)
-#Table II_246_out:
-#Name: II/246/out
-#Title: The Point Source catalogue of 470,992,970 sources. \inputViz{2mass.intro.htx}
-#Column _RAJ2000 (F9.5) Right ascension (FK5) Equinox=J2000. (computed by VizieR, not part of the original data) [ucd=POS_EQ_RA_MAIN]
-#Column _DEJ2000 (F9.5) Declination (FK5) Equinox=J2000. (computed by VizieR, not part of the original data) [ucd=POS_EQ_DEC_MAIN]
-#Column RAJ2000 (F10.6) (ra) Right ascension (J2000) (link) [ucd=POS_EQ_RA_MAIN]
-#Column DEJ2000 (F10.6) (dec) Declination (J2000) (dec) [ucd=POS_EQ_DEC_MAIN]
-#Column Jmag (F6.3) ?(j_m) J selected default magnitude (2) [ucd=PHOT_JHN_J]
-#Column e_Jmag (F6.3) ?(j_msigcom) J total magnitude uncertainty (4) [ucd=ERROR]
-#Column Hmag (F6.3) ?(h_m) H selected default magnitude (2) [ucd=PHOT_JHN_H]
-#Column e_Hmag (F6.3) ?(h_msigcom) H total magnitude uncertainty (4) [ucd=ERROR]
-#Column Kmag (F6.3) ?(k_m) K selected default magnitude (2) [ucd=PHOT_JHN_K]
-#Column e_Kmag (F6.3) ?(k_msigcom) K total magnitude uncertainty (4) [ucd=ERROR]
-#Column Qflg (A3) (ph_qual) JHK Photometric quality flag (5) [ucd=CODE_QUALITY]
-#Column Rflg (A3) (rd_flg) Source of JHK default mag (6) [ucd=REFER_CODE]
-#Column Bflg (A3) (bl_flg) JHK components fit to source (7) [ucd=CODE_MISC]
-#Column Cflg (A3) (cc_flg) Artifact contamination, confusion (8) [ucd=CODE_MISC]
-#Column Xflg (I1) [0,2] (gal_contam) Extended source contamination (10) [ucd=CODE_MISC]
-#Column Aflg (I1) [0,1] (mp_flg) Association with asteroid or comet (11) [ucd=CODE_MISC]
-#Column Opt (A3) Show the nearby Optical Sources from USNO and GSC Catalogues (link) [ucd=DATA_LINK]
-
-_RAJ2000 _DEJ2000 RAJ2000 DEJ2000 Jmag e_Jmag Hmag e_Hmag Kmag e_Kmag Qflg Rflg Bflg Cflg Xflg Aflg Opt
--------- -------- ------- ------- ---- ------ ---- ------ ---- ------ ---- ---- ---- ---- ---- ---- ---
-010.54509 +41.15963 010.545093 +41.159626 16.684 0.197 15.576 0.171 15.322 0.188 CCC 222 111 000 2 0 Opt
-010.54364 +41.16377 010.543643 +41.163773 14.868 0.040 14.642 0.080 14.433 0.087 AAA 222 111 000 2 0 Opt
-010.53822 +41.18528 010.538223 +41.185280 11.995 0.021 11.347 0.021 11.138 0.018 AAA 222 111 000 2 0 Opt
-010.52436 +41.18093 010.524356 +41.180927 16.409 0.153 15.494 0.164 15.015 0.168 BCC 222 111 000 2 0 Opt
-010.55490 +41.18065 010.554903 +41.180649 15.342 0.062 14.625 0.091 14.605 0.110 AAB 222 111 000 2 0 Opt
-010.53545 +41.16238 010.535452 +41.162376 16.669 0.185 15.724 15.542 CUU 200 100 000 2 0 Opt
-010.52946 +41.16958 010.529455 +41.169575 15.981 0.094 15.473 0.144 15.283 0.184 ABC 222 111 000 2 0 Opt
-010.53276 +41.17677 010.532765 +41.176773 16.240 15.581 0.183 15.252 0.189 UCC 022 011 000 2 0 Opt
-010.55274 +41.17067 010.552741 +41.170673 16.477 0.164 15.021 15.093 0.170 CUC 202 101 000 2 0 Opt
-010.54638 +41.16917 010.546383 +41.169170 16.628 0.172 15.471 15.327 CUU 200 100 000 2 0 Opt
-010.56162 +41.17988 010.561618 +41.179882 16.687 0.184 15.731 14.936 CUU 200 100 000 2 0 Opt
-010.55008 +41.16200 010.550079 +41.161999 16.155 0.116 15.178 15.221 0.178 BUC 202 101 000 2 0 Opt
-010.56242 +41.17719 010.562420 +41.177189 16.631 0.188 15.659 15.283 CUU 200 100 000 2 0 Opt
-010.56058 +41.14579 010.560584 +41.145786 16.642 0.179 15.158 15.190 CUU 200 100 000 2 0 Opt
-010.55858 +41.17490 010.558583 +41.174900 16.589 0.158 15.757 15.527 0.244 CUD 202 101 000 2 0 Opt
-010.58303 +41.18126 010.583032 +41.181255 16.818 0.210 16.028 0.283 15.422 0.226 CDD 222 111 000 2 0 Opt
-010.58087 +41.17760 010.580874 +41.177601 16.700 0.194 15.548 0.162 14.835 CCU 220 110 000 2 0 Opt
-010.58103 +41.14701 010.581025 +41.147011 16.386 0.141 15.611 0.171 15.188 0.175 BCC 222 111 000 2 0 Opt
-010.58578 +41.18507 010.585785 +41.185066 16.647 0.193 15.500 15.656 CUU 200 100 000 2 0 Opt
-010.57963 +41.16915 010.579626 +41.169151 16.412 0.170 15.119 14.933 CUU 200 100 000 2 0 Opt
-010.58666 +41.16464 010.586661 +41.164639 16.586 0.175 15.602 0.195 14.518 CCU 220 110 000 2 0 Opt
-010.59082 +41.18460 010.590820 +41.184601 16.831 0.226 15.791 0.198 15.355 0.206 DCC 222 111 000 2 0 Opt
-010.57550 +41.17313 010.575498 +41.173134 16.956 0.249 15.964 0.212 15.207 0.188 DCC 222 111 000 2 0 Opt
-010.57648 +41.15651 010.576483 +41.156509 16.562 0.160 15.601 15.021 CUU 200 100 000 2 0 Opt
-010.57572 +41.18071 010.575720 +41.180710 16.694 0.185 15.159 15.053 CUU 200 100 000 2 0 Opt
-010.56644 +41.16771 010.566437 +41.167706 16.339 0.145 14.934 15.386 0.204 BUC 202 101 s0s 2 0 Opt
-010.56733 +41.16696 010.567331 +41.166962 15.696 15.354 0.154 14.556 UBU 020 010 000 2 0 Opt
-010.57023 +41.18409 010.570234 +41.184086 16.740 0.187 15.719 0.182 15.535 0.243 CCD 222 111 000 2 0 Opt
-010.57440 +41.14559 010.574403 +41.145592 16.626 0.177 15.820 0.211 14.676 CCU 220 110 000 2 0 Opt
-010.57311 +41.17211 010.573111 +41.172108 16.415 0.144 15.611 0.165 15.221 0.192 BCC 222 111 000 2 0 Opt
-010.57389 +41.15790 010.573885 +41.157902 16.563 0.169 14.821 14.877 CUU 266 200 c00 2 0 Opt
-010.59139 +41.17261 010.591390 +41.172607 15.888 15.589 0.191 15.265 0.205 UCC 022 011 000 2 0 Opt
-010.58689 +41.18258 010.586889 +41.182583 14.456 0.034 13.888 0.050 13.659 0.050 AAA 222 111 000 2 0 Opt
-010.61103 +41.15166 010.611032 +41.151657 16.392 0.137 15.557 0.156 15.281 0.198 BCC 222 111 000 2 0 Opt
-010.61116 +41.15787 010.611155 +41.157875 15.874 15.338 0.149 14.335 UBU 626 020 0c0 2 0 Opt
-010.60937 +41.16224 010.609366 +41.162239 15.713 0.080 14.904 0.097 14.944 0.142 AAB 222 111 000 2 0 Opt
-010.60952 +41.16800 010.609521 +41.168003 16.656 0.179 15.094 15.255 CUU 200 100 s00 2 0 Opt
-010.61217 +41.17859 010.612169 +41.178593 15.524 15.277 0.156 14.198 UCU 020 010 000 2 0 Opt
-010.59329 +41.18364 010.593289 +41.183640 16.639 0.179 15.730 0.187 15.391 0.212 CCC 222 112 00c 2 0 Opt
-010.61237 +41.18557 010.612369 +41.185570 16.019 0.107 15.236 0.126 15.178 0.176 ABC 222 111 000 2 0 Opt
-010.60284 +41.18242 010.602835 +41.182419 16.409 0.149 15.739 0.191 15.536 0.225 BCD 222 111 000 2 0 Opt
-010.61815 +41.18667 010.618154 +41.186672 16.553 0.172 15.394 15.462 0.226 CUD 202 101 000 2 0 Opt
-010.62049 +41.17094 010.620493 +41.170940 16.624 0.176 15.402 15.238 0.187 CUC 202 101 c00 2 0 Opt
-010.61684 +41.17865 010.616845 +41.178650 16.383 0.146 14.827 14.393 BUU 200 100 000 2 0 Opt
-010.61708 +41.15820 010.617084 +41.158199 15.908 0.089 15.196 0.125 14.829 0.133 ABB 222 111 000 2 0 Opt
-010.61506 +41.16751 010.615057 +41.167511 15.215 0.073 14.663 0.103 14.266 0.107 AAA 222 111 sss 2 0 Opt
-010.60876 +41.14656 010.608756 +41.146564 16.678 0.171 15.560 15.438 CUU 200 100 000 2 0 Opt
-010.59489 +41.17002 010.594893 +41.170017 14.762 0.036 14.138 0.043 13.921 0.057 AAA 222 111 000 2 0 Opt
-010.59882 +41.17178 010.598823 +41.171776 17.055 0.265 15.922 0.228 15.558 0.250 DDD 222 111 000 2 0 Opt
-010.59424 +41.17420 010.594243 +41.174198 13.665 0.029 13.457 0.039 13.384 0.043 AAA 222 111 000 2 0 Opt
-010.59544 +41.16003 010.595444 +41.160027 14.745 0.041 14.110 0.045 14.004 0.070 AAA 222 111 000 2 0 Opt
-010.59869 +41.16370 010.598691 +41.163696 16.050 0.102 15.375 0.144 14.961 0.147 ABB 222 111 000 2 0 Opt
-010.59421 +41.14965 010.594213 +41.149654 16.448 0.146 15.746 15.075 0.163 BUC 202 101 000 2 0 Opt
-010.60056 +41.17624 010.600557 +41.176243 16.910 0.224 15.835 0.201 15.437 0.218 DCD 222 111 000 2 0 Opt
-010.60251 +41.15812 010.602506 +41.158123 15.099 0.053 14.679 0.081 14.615 0.115 AAB 222 111 000 2 0 Opt
-010.59348 +41.17194 010.593483 +41.171944 16.394 0.145 15.240 0.114 15.224 BBU 220 110 c00 2 0 Opt
-010.60229 +41.15254 010.602289 +41.152542 16.687 0.171 16.233 0.284 15.604 0.261 CDD 222 111 000 2 0 Opt
-010.67585 +41.17131 010.675847 +41.171310 16.646 0.175 15.360 14.803 CUU 200 100 000 2 0 Opt
-010.66944 +41.17592 010.669444 +41.175919 15.635 0.082 14.806 0.085 14.602 0.101 AAA 222 111 000 2 0 Opt
-010.68256 +41.16169 010.682557 +41.161694 16.976 0.229 16.063 0.203 15.314 0.172 DCC 222 111 000 2 0 Opt
-010.66984 +41.16808 010.669836 +41.168076 13.777 0.026 13.555 0.031 13.495 0.039 AAA 222 111 000 2 0 Opt
-010.67375 +41.17490 010.673752 +41.174904 16.288 15.548 0.135 14.846 UBU 020 010 000 2 0 Opt
-010.67067 +41.17001 010.670671 +41.170013 16.478 0.149 15.063 14.829 BUU 266 200 c00 2 0 Opt
-010.67045 +41.18485 010.670450 +41.184849 16.134 15.324 0.132 15.448 0.212 UBC 022 011 000 2 0 Opt
-010.67242 +41.17072 010.672416 +41.170719 16.546 0.164 14.956 14.858 CUU 266 200 c00 2 0 Opt
-010.67254 +41.16475 010.672540 +41.164749 16.877 0.207 15.729 0.146 15.473 0.192 CBC 222 111 000 2 0 Opt
-010.68609 +41.18658 010.686087 +41.186577 16.888 0.218 15.577 0.147 15.288 0.175 DBC 222 111 000 2 0 Opt
-010.68445 +41.18332 010.684455 +41.183315 16.549 0.165 15.737 0.169 14.829 CCU 220 110 000 2 0 Opt
-010.67081 +41.18179 010.670807 +41.181793 16.647 0.171 15.882 0.193 14.797 CCU 220 110 000 2 0 Opt
-010.68639 +41.17711 010.686386 +41.177113 16.402 0.169 15.428 0.139 15.087 0.159 CBC 222 111 ppp 2 0 Opt
-010.64602 +41.18240 010.646018 +41.182396 15.841 15.166 15.126 0.164 UUC 002 001 000 2 0 Opt
-010.63864 +41.15640 010.638635 +41.156399 17.227 0.295 16.074 0.217 15.646 0.240 DCD 222 111 000 2 0 Opt
-010.63670 +41.17493 010.636697 +41.174934 14.394 0.039 13.920 0.054 13.832 0.069 AAA 222 111 000 2 0 Opt
-010.63767 +41.18114 010.637667 +41.181141 16.109 0.122 15.676 0.205 15.077 0.181 BCC 222 111 000 2 0 Opt
-010.66727 +41.18747 010.667272 +41.187473 16.379 0.145 15.537 0.151 15.392 0.200 BBC 222 111 000 2 0 Opt
-010.63519 +41.15953 010.635191 +41.159531 16.550 0.160 15.312 15.343 0.202 CUC 202 101 000 2 0 Opt
-010.63933 +41.17542 010.639332 +41.175423 15.800 0.089 15.004 0.112 14.926 0.150 ABB 222 111 000 2 0 Opt
-010.64072 +41.14611 010.640720 +41.146111 17.102 0.262 15.659 0.152 14.941 DBU 220 110 000 2 0 Opt
-010.64101 +41.18654 010.641014 +41.186539 16.621 0.173 15.634 0.180 15.285 0.195 CCC 222 111 000 2 0 Opt
-010.63596 +41.16357 010.635960 +41.163570 15.788 0.094 15.305 0.143 14.835 0.128 ABB 222 111 000 2 0 Opt
-010.63507 +41.17279 010.635075 +41.172787 15.597 15.593 0.156 14.443 UCU 020 010 0c0 2 0 Opt
-010.62959 +41.18411 010.629592 +41.184109 16.521 0.183 15.718 0.220 15.079 0.181 CDC 222 111 000 2 0 Opt
-010.62715 +41.18405 010.627145 +41.184052 16.645 0.177 16.082 15.168 CUU 200 100 000 2 0 Opt
-010.62778 +41.17092 010.627778 +41.170925 13.865 0.043 13.214 0.043 13.084 0.038 AAA 222 112 ccc 2 0 Opt
-010.62825 +41.16944 010.628250 +41.169437 10.467 0.021 10.358 0.024 10.336 0.018 AAA 222 112 00c 2 0 Opt
-010.62968 +41.16703 010.629682 +41.167027 15.229 15.709 0.181 14.417 UCU 020 010 0c0 2 0 Opt
-010.63403 +41.17441 010.634028 +41.174408 14.163 0.041 13.490 0.057 13.264 0.052 AAA 222 111 000 2 0 Opt
-010.62989 +41.14761 010.629891 +41.147606 15.270 0.070 14.584 0.076 14.390 0.087 AAA 222 111 p00 2 0 Opt
-010.63063 +41.17864 010.630631 +41.178642 17.015 0.265 16.114 0.290 15.216 0.192 DDC 222 111 000 2 0 Opt
-010.63154 +41.18418 010.631537 +41.184177 15.711 15.598 0.197 14.429 UCU 020 010 000 2 0 Opt
-010.63343 +41.15279 010.633431 +41.152794 16.840 0.199 15.982 0.250 15.440 0.210 CDC 222 111 000 2 0 Opt
-010.64167 +41.14695 010.641674 +41.146950 16.049 15.566 0.178 14.379 UCU 020 010 000 2 0 Opt
-010.63895 +41.18397 010.638946 +41.183971 16.488 0.148 15.504 0.167 14.892 0.138 BCB 222 112 00c 2 0 Opt
-010.64334 +41.16204 010.643343 +41.162041 16.582 0.167 15.670 15.414 CUU 200 100 000 2 0 Opt
-010.64408 +41.18305 010.644076 +41.183052 16.386 0.151 15.429 0.139 15.009 0.153 BBB 222 111 000 2 0 Opt
-010.66395 +41.17612 010.663945 +41.176121 16.718 16.061 0.216 15.266 0.182 UCC 022 011 000 2 0 Opt
-010.64452 +41.14719 010.644518 +41.147194 16.212 0.114 15.218 0.102 14.753 0.119 BAB 222 111 000 2 0 Opt
-010.66629 +41.17622 010.666292 +41.176216 16.891 0.227 16.106 0.221 15.797 0.278 DDD 222 111 000 2 0 Opt
-010.65835 +41.18082 010.658351 +41.180824 16.517 0.176 14.949 14.743 CUU 200 100 000 2 0 Opt
-010.66354 +41.18472 010.663540 +41.184723 15.870 14.794 15.277 0.182 UUC 662 002 00c 2 0 Opt
-010.65841 +41.17944 010.658408 +41.179443 16.573 0.182 15.983 0.196 15.709 0.270 CCD 222 111 000 2 0 Opt
-010.66041 +41.18488 010.660406 +41.184883 16.721 15.786 0.181 15.110 UCU 020 010 000 2 0 Opt
-010.66311 +41.17966 010.663114 +41.179661 16.559 0.173 16.131 0.241 15.558 0.214 CDC 222 111 000 2 0 Opt
-010.66215 +41.15103 010.662146 +41.151031 16.486 15.957 15.278 0.179 UUC 002 001 000 2 0 Opt
-010.65242 +41.18138 010.652420 +41.181381 16.491 0.160 15.376 15.174 CUU 200 100 000 2 0 Opt
-010.65071 +41.18346 010.650708 +41.183460 16.614 0.194 15.752 0.180 15.126 0.158 CCC 222 111 000 2 0 Opt
-010.64679 +41.17964 010.646786 +41.179642 16.501 0.166 15.854 0.178 15.021 CCU 220 110 000 2 0 Opt
-010.64858 +41.18153 010.648577 +41.181526 16.904 0.228 15.867 0.178 15.199 0.167 DCC 222 111 000 2 0 Opt
-010.65045 +41.17049 010.650449 +41.170490 17.283 15.608 0.169 16.092 UCU 020 010 000 2 0 Opt
-010.65065 +41.17946 010.650654 +41.179459 15.827 0.080 15.187 0.092 15.073 0.140 AAB 222 111 000 2 0 Opt
-010.66665 +41.17398 010.666652 +41.173981 16.505 0.163 15.135 15.353 0.188 CUC 202 101 000 2 0 Opt
-010.66641 +41.16632 010.666413 +41.166321 16.593 0.180 15.723 15.035 CUU 200 100 000 2 0 Opt
-010.65186 +41.14590 010.651864 +41.145901 13.750 0.031 13.425 0.039 13.385 0.042 AAA 222 111 000 2 0 Opt
-010.65215 +41.18666 010.652154 +41.186661 15.714 15.641 0.174 14.368 UCU 020 020 0c0 2 0 Opt
-010.71137 +41.17589 010.711372 +41.175888 16.053 0.109 15.776 0.159 15.063 ACU 220 110 cc0 2 0 Opt
-010.71226 +41.17959 010.712260 +41.179588 16.386 0.147 15.713 15.736 BUU 200 100 c00 2 0 Opt
-010.71386 +41.16712 010.713855 +41.167122 16.911 0.213 15.800 0.161 15.662 0.214 CCD 222 111 000 2 0 Opt
-010.69904 +41.18055 010.699043 +41.180546 13.648 0.027 13.367 0.025 13.372 0.037 AAA 222 111 000 2 0 Opt
-010.69988 +41.16739 010.699881 +41.167389 16.905 0.209 15.721 0.162 14.729 CCU 220 110 000 2 0 Opt
-010.69005 +41.18517 010.690045 +41.185169 16.627 0.174 15.680 0.157 15.552 0.223 CCD 222 111 000 2 0 Opt
-010.69197 +41.15914 010.691975 +41.159142 16.755 0.188 15.677 0.157 15.427 0.198 CCC 222 111 000 2 0 Opt
-010.69296 +41.16989 010.692956 +41.169888 14.515 0.034 14.139 0.045 14.104 0.064 AAA 222 111 000 2 0 Opt
-010.69670 +41.17238 010.696697 +41.172382 16.530 0.158 14.983 15.145 0.174 CUC 202 101 000 2 0 Opt
-010.69969 +41.17760 010.699687 +41.177605 16.430 15.728 0.161 15.298 0.177 UCC 022 011 000 2 0 Opt
-010.69779 +41.15221 010.697790 +41.152210 17.138 0.247 16.098 0.218 15.574 0.206 DDC 222 111 000 2 0 Opt
-010.69915 +41.18715 010.699150 +41.187153 15.035 0.056 14.354 0.064 14.181 0.073 AAA 222 111 000 2 0 Opt
-010.69918 +41.18314 010.699178 +41.183144 17.027 0.242 15.803 0.174 15.078 DCU 220 110 c00 2 0 Opt
-010.71422 +41.17726 010.714217 +41.177265 12.956 0.023 12.620 0.023 12.520 0.022 AAA 222 111 000 2 0 Opt
-010.72826 +41.18444 010.728262 +41.184441 16.329 14.995 15.132 0.157 UUC 002 001 000 2 0 Opt
-010.73545 +41.18071 010.735452 +41.180710 16.355 0.124 15.808 0.169 14.905 BCU 220 110 000 2 0 Opt
-010.73166 +41.15613 010.731660 +41.156132 16.654 15.679 0.149 15.241 0.159 UBC 022 011 000 2 0 Opt
-010.74440 +41.17477 010.744402 +41.174767 16.636 0.174 15.146 14.868 CUU 200 100 000 2 0 Opt
-010.72198 +41.15588 010.721983 +41.155884 16.283 15.794 0.168 15.121 UCU 020 010 000 2 0 Opt
-010.74480 +41.14798 010.744797 +41.147976 15.718 0.084 14.972 0.092 14.857 0.117 AAB 222 111 000 2 0 Opt
-010.74554 +41.15245 010.745536 +41.152454 15.750 0.081 15.214 0.109 14.941 0.124 ABB 222 111 000 2 0 Opt
-010.74972 +41.18617 010.749715 +41.186165 15.863 14.854 15.276 0.172 UUC 002 001 000 2 0 Opt
-010.72157 +41.15815 010.721566 +41.158146 16.937 0.227 16.050 0.221 15.316 0.178 DDC 222 111 000 2 0 Opt
-010.76396 +41.17142 010.763956 +41.171425 13.557 0.029 13.045 0.031 12.980 0.032 AAA 222 111 000 2 0 Opt
-010.75677 +41.18131 010.756774 +41.181313 12.446 0.023 12.093 0.022 12.064 0.022 AAA 222 111 000 2 0 Opt
diff --git a/funtools/util/Makefile.in b/funtools/util/Makefile.in
deleted file mode 100644
index 5e3475d..0000000
--- a/funtools/util/Makefile.in
+++ /dev/null
@@ -1,276 +0,0 @@
-#
-# This file is a Makefile for Util. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-# Current version; used in various names.
-PACKAGE = @PACKAGE_NAME@
-VERSION = @PACKAGE_VERSION@
-
-DISTNAME = util-${VERSION}
-DISTDIR = ../export/${DISTNAME}
-FTPDIR = ../ftp
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# Directory in which to install the .a, .so, and .o files:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the programs:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the include files:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
-
-# extra includes for compiling
-INCLUDES =
-
-# extra libs
-EXTRA_LIBS = @EXTRA_LIBS@
-
-# zlib directory
-ZDIR = ./zlib-1.2.3
-ZOBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-# zlib 1.1.4
-# ZOBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
-# zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
-
-# the full set of libraries for linking
-LIBS = -lm
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = ./install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-OBJPATH = \"$(LIB_INSTALL_DIR):.\"
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = -I. ${CFLAGS} ${CPPFLAGS} @USE_DL@ ${INCLUDES} ${AC_FLAGS}
-
-DEPEND_SWITCHES = -I. ${CFLAGS} ${INCLUDES} ${AC_FLAGS}
-
-SRCS = file.c find.c gio.c xlaunch.c \
- macro.c mainlib.c mkrtemp.c nan.c parse.c \
- strtod.c swap.c word.c winprocess.c xalloc.c zprocess.c
-
-OBJS = file.o find.o gio.o xlaunch.o \
- macro.o mainlib.o mkrtemp.o nan.o parse.o \
- strtod.o swap.o word.o winprocess.o xalloc.o zprocess.o \
- $(EXTRA_OBJS)
-
-
-# these are all the modules going into the "normal" filt library
-LIBOBJS = ${OBJS}
-
-# the default library for this package
-DEFLIB = @DEFLIB@
-# the actual library we are building (if this is a subpackage)
-LIB = @LIB@
-
-TESTPROGS = tparse tlaunch tlaunch2
-
-PROGS =
-#PROGS = gcat
-
-all: $(LIB) $(PROGS)
-
-testall: $(TESTPROGS)
-
-All: all testall
-
-install: install-binaries
-
-$(LIB): $(LIBOBJS)
- ar cruv $(LIB) $(LIBOBJS)
- $(RANLIB) $(LIB)
-
-libutil: $(LIBOBJS)
- ar cruv libutil.a $(LIBOBJS)
- $(RANLIB) libutil.a
-
-# these are the zlib routines:
-adler32.o: $(ZDIR)/adler32.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/adler32.c
-compress.o: $(ZDIR)/compress.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/compress.c
-crc32.o: $(ZDIR)/crc32.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/crc32.c
-gzio.o: $(ZDIR)/gzio.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/gzio.c
-uncompr.o: $(ZDIR)/uncompr.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/uncompr.c
-deflate.o: $(ZDIR)/deflate.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/deflate.c
-trees.o: $(ZDIR)/trees.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/trees.c
-zutil.o: $(ZDIR)/zutil.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/zutil.c
-inflate.o: $(ZDIR)/inflate.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/inflate.c
-infblock.o: $(ZDIR)/infblock.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/infblock.c
-inftrees.o: $(ZDIR)/inftrees.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/inftrees.c
-infback.o: $(ZDIR)/infback.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/infback.c
-inffast.o: $(ZDIR)/inffast.c
- $(CC) -I$(ZDIR) -c $(CFLAGS) $(ZDIR)/inffast.c
-
-gio.o: gio.c gio.h
- $(CC) -c $(CC_SWITCHES) -I$(ZDIR) gio.c
-
-gcat.o: gcat.c gio.h
-
-gcat: gcat.o $(LIB)
- $(CC) $(LDFLAGS) gcat.o -o gcat $(LIB) $(LIBS) $(EXTRA_LIBS)
-
-tparse.o: tparse.c
-
-tparse: tparse.o parse.o $(LIB)
- $(CC) $(LDFLAGS) tparse.o parse.o -o tparse $(LIB) $(LIBS) \
- $(EXTRA_LIBS)
-
-tlaunch.o: tlaunch.c
-
-tlaunch: tlaunch.o xlaunch.o $(LIB)
- $(CC) $(LDFLAGS) tlaunch.o xlaunch.o -o tlaunch $(LIB) $(LIBS) \
- $(EXTRA_LIBS)
-
-tlaunch2.o: tlaunch2.c
-
-tlaunch2: tlaunch2.o
- $(CC) $(LDFLAGS) tlaunch2.o -o tlaunch2
-
-install-binaries: $(LIB) $(PROGS)
- @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @for i in $(PROGS) ; \
- do \
- echo "Installing $$i$(EXE)" ; \
- $(INSTALL_PROGRAM) $$i$(EXE) $(BIN_INSTALL_DIR)/$$i$(EXE) ; \
- done;
- @if [ "$(LIB)" = "$(DEFLIB)" ] ; then \
- XLIB=`basename $(LIB)`; \
- echo "Installing $$XLIB"; \
- $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \
- (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \
- chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \
- fi;
- @for i in imregions.o evregions.o ; \
- do \
- if [ -f $$i ] ; then \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(LIB_INSTALL_DIR)/$$i ; \
- fi; \
- done;
- @for i in NaN.h conf.h file.h find.h gio.h xlaunch.h longlong.h \
- macro.h mainlib.h tclmainlib.h mkrtemp.h parse.h prsetup.h \
- xalloc.h strtod.h swap.h word.h xport.h winprocess.h xfileio.h \
- zprocess.h; \
- do \
- if [ -f $$i ] ; then \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/$$i ; \
- fi; \
- done;
-
-Makefile: Makefile.in
- $(SHELL) config.status
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak \
- config.info config.log \
- doc/*~
- $(RM) -r autom4te.cache
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-.c.o:
- $(CC) -c $(CC_SWITCHES) $<
-
-configure: configure.in
- autoconf configure.in
-
-pure: tlaunch.pure
-
-tlaunch.pure: tlaunch.o xlaunch.o $(LIB)
- purift $(CC) $(LDFLAGS) tlaunch.o xlaunch.o -o tlaunch \
- $(LIB) $(LIBS) $(EXTRA_LIBS)
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/util/NaN.h.in b/funtools/util/NaN.h.in
deleted file mode 100644
index 7b331c1..0000000
--- a/funtools/util/NaN.h.in
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * NaN.h -- include file to deal with IEEE NaN values
- *
- * Idea taken from fitsio2.h in the cfitsio package by William Pence (HEASARC),
- * to whom grateful acknowledgement is made.
- *
- * These functions tests whether the float value is a reserved IEEE
- * value such as a Not-a-Number (NaN), or underflow, overflow, or
- * infinity. The functions returns 1 if the value is a NaN, overflow
- * or infinity; otherwise it returns 0.
- *
- * isnanf tests floats, isnand tests doubles.
- *
- */
-#ifndef __nan_h
-#define __nan_h
-
-#include "prsetup.h"
-
-#define _BIG_ENDIAN @BIGENDIAN@
-
-#if _BIG_ENDIAN
-
-#define FNANOFF 0
-#define DNANOFF 0
-
-#else
-
-#define FNANOFF 1
-#define DNANOFF 3
-
-#endif
-
-#define FNANMASK 0x7F80 /* mask bits 1 - 8; all set on NaNs */
- /* all 0 on underflow or 0. */
-
-#define DNANMASK 0x7FF0 /* mask bits 1 - 11; all set on NaNs */
- /* all 0 on underflow or 0. */
-
-#ifndef isnanf
-typedef union {
- float f;
- short x[2];
-} uffu;
-
-#define isnanf(X) ((((uffu*)&X)->x[FNANOFF] & FNANMASK) == FNANMASK)
-#endif
-
-#ifndef isnand
-typedef union {
- double d;
- short x[4];
-} uddu;
-
-#define isnand(X) ((((uddu*)&X)->x[DNANOFF] & DNANMASK) == DNANMASK)
-#endif
-
-_PRbeg
-
-float getnanf _PRx((void));
-double getnand _PRx((void));
-
-_PRend
-
-#endif
diff --git a/funtools/util/ac_c_long_long.m4 b/funtools/util/ac_c_long_long.m4
deleted file mode 100644
index fb6df1e..0000000
--- a/funtools/util/ac_c_long_long.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-##### http://autoconf-archive.cryp.to/ac_c_long_long.html
-#
-# SYNOPSIS
-#
-# AC_C_LONG_LONG
-#
-# DESCRIPTION
-#
-# Provides a test for the existance of the long long int type and
-# defines HAVE_LONG_LONG if it is found.
-#
-# LAST MODIFICATION
-#
-# 2006-10-30
-#
-# COPYLEFT
-#
-# Copyright (c) 2006 Caolan McNamara <caolan@skynet.ie>
-#
-# Copying and distribution of this file, with or without
-# modification, are permitted in any medium without royalty provided
-# the copyright notice and this notice are preserved.
-
-AC_DEFUN([AC_C_LONG_LONG],
-[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
-[if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- AC_TRY_COMPILE(,[long long int i;],
- ac_cv_c_long_long=yes,
- ac_cv_c_long_long=no)
- fi])
- if test $ac_cv_c_long_long = yes; then
- AC_DEFINE(HAVE_LONG_LONG, 1, [compiler understands long long])
- fi
-])
diff --git a/funtools/util/aclocal.m4 b/funtools/util/aclocal.m4
deleted file mode 100644
index b4ee113..0000000
--- a/funtools/util/aclocal.m4
+++ /dev/null
@@ -1,2 +0,0 @@
-builtin(include,tcl.m4)
-builtin(include,ac_c_long_long.m4)
diff --git a/funtools/util/conf.h.in b/funtools/util/conf.h.in
deleted file mode 100644
index 2ff8953..0000000
--- a/funtools/util/conf.h.in
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Define as 1 if this compiler supports long long. */
-#undef HAVE_LONG_LONG
-
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have setjmp.h */
-#undef HAVE_SETJMP_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have ftello */
-#undef HAVE_FTELLO
-
-/* Define as 1 if you have fseeko */
-#undef HAVE_FSEEKO
-
-/* Define as 1 if you have setenv */
-#undef HAVE_SETENV
-
-/* Define as 1 if you have posix_spawn */
-#undef HAVE_POSIX_SPAWN
-
-/* Define as 1 if you have crt_externs.h */
-#undef HAVE_CRT_EXTERNS_H
-
-/* Define as 1 if you have NSGetEvniron */
-#undef HAVE__NSGETENVIRON
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
diff --git a/funtools/util/config.guess b/funtools/util/config.guess
deleted file mode 100644
index 44290b8..0000000
--- a/funtools/util/config.guess
+++ /dev/null
@@ -1,1435 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-23'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches to <config-patches@gnu.org>.
-
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
- echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine=${arch}${endian}-unknown
- ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
- earm*)
- expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
- ;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
- x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
-esac
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/util/config.sub b/funtools/util/config.sub
deleted file mode 100644
index bc855a2..0000000
--- a/funtools/util/config.sub
+++ /dev/null
@@ -1,1807 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-22'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- moxiebox)
- basic_machine=moxie-unknown
- os=-moxiebox
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
- ;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/util/configure-failsafe b/funtools/util/configure-failsafe
deleted file mode 100755
index 856a4e1..0000000
--- a/funtools/util/configure-failsafe
+++ /dev/null
@@ -1,7191 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for util 1.0.
-#
-# Report bugs to <saord@cfa.harvard.edu>.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME='util'
-PACKAGE_TARNAME='util'
-PACKAGE_VERSION='1.0'
-PACKAGE_STRING='util 1.0'
-PACKAGE_BUGREPORT='saord@cfa.harvard.edu'
-
-ac_unique_file="./xalloc.h"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP BIGENDIAN LIB DEFLIB DOSHARED LLIB USE_DL EXTRA_LIBS EXTRA_OBJS LIBOBJS LTLIBOBJS'
-ac_subst_files=''
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-ac_prev=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures util 1.0 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
- cat <<_ACEOF
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of util 1.0:";;
- esac
- cat <<\_ACEOF
-
-Optional Features:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-shared build shared libraries
- --enable-dl allow use of dynamic loading if available
- --enable-posix_spawn use posix_spawn() if available
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-altlib=LIB library name
- --with-tcl directory containing tcl configuration (tclConfig.sh)
- --with-zlib=LIB library name
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <saord@cfa.harvard.edu>.
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
- else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
- done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
- cat <<\_ACEOF
-util configure 1.0
-generated by GNU Autoconf 2.59
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by util $as_me 1.0, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-{
- (set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
- *)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-}
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- sed "/^$/d" confdefs.h | sort
- echo
- fi
- test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
- ' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
- esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ac_config_headers="$ac_config_headers conf.h"
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f $ac_dir/shtool; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
- { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
- ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
- { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
- ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-
-#
-# checks that we use in most projects
-#
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CC" && break
-done
-
- CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-
-echo "$as_me:$LINENO: checking for long long int" >&5
-echo $ECHO_N "checking for long long int... $ECHO_C" >&6
-if test "${ac_cv_c_long_long+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$GCC" = yes; then
- ac_cv_c_long_long=yes
- else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-long long int i;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_long_long=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_long_long=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5
-echo "${ECHO_T}$ac_cv_c_long_long" >&6
- if test $ac_cv_c_long_long = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_LONG 1
-_ACEOF
-
- fi
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- RANLIB=$ac_ct_RANLIB
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in malloc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in getopt.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in values.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in setjmp.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/un.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/mman.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/ipc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in crt_externs.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
-
-for ac_header in sys/shm.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
- ;;
-esac
-
-echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
-if test "${ac_cv_type_socklen_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/socket.h>
-
-int
-main ()
-{
-if ((socklen_t *) 0)
- return 0;
-if (sizeof (socklen_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_socklen_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_socklen_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
-if test $ac_cv_type_socklen_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SOCKLEN_T 1
-_ACEOF
-
-
-fi
-
-
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- }
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_const=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_const=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-
-fi
-
-
-
-
-
-
-
-
-for ac_func in strchr memcpy snprintf ftello fseeko setenv
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
-if test "${ac_cv_func_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define connect to an innocuous variant, in case <limits.h> declares connect.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define connect innocuous_connect
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef connect
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != connect;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
-
-if test $ac_cv_func_connect = no; then
- echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-int
-main ()
-{
-connect ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_socket_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_socket_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-if test $ac_cv_lib_socket_connect = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lsocket"
-fi
-
-fi
-echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-if test "${ac_cv_func_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define gethostbyname innocuous_gethostbyname
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef gethostbyname
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != gethostbyname;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
-
-if test $ac_cv_func_gethostbyname = no; then
- echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-int
-main ()
-{
-gethostbyname ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_nsl_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lnsl"
-fi
-
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
-if test "${ac_cv_c_bigendian+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # See if sys/param.h defines the BYTE_ORDER macro.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/param.h>
-
-int
-main ()
-{
-#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
- bogus endian macros
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- # It does; now see whether it defined to BIG_ENDIAN or not.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/param.h>
-
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_bigendian=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_bigendian=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-# It does not; compile a test program.
-if test "$cross_compiling" = yes; then
- # try to guess the endianness by grepping values into an object file
- ac_cv_c_bigendian=unknown
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
-int
-main ()
-{
- _ascii (); _ebcdic ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
- ac_cv_c_bigendian=yes
-fi
-if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
- if test "$ac_cv_c_bigendian" = unknown; then
- ac_cv_c_bigendian=no
- else
- # finding both strings is unlikely to happen, but who knows?
- ac_cv_c_bigendian=unknown
- fi
-fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-int
-main ()
-{
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long l;
- char c[sizeof (long)];
- } u;
- u.l = 1;
- exit (u.c[sizeof (long) - 1] == 1);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_bigendian=no
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_bigendian=yes
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-echo "${ECHO_T}$ac_cv_c_bigendian" >&6
-case $ac_cv_c_bigendian in
- yes)
- BIGENDIAN=1 ;;
- no)
- BIGENDIAN=0 ;;
- *)
- BIGENDIAN=1 ;;
-esac
-
-
-
-DEFLIB="libutil.a"
-echo "$as_me:$LINENO: checking for alternate target library" >&5
-echo $ECHO_N "checking for alternate target library... $ECHO_C" >&6
-
-# Check whether --with-altlib or --without-altlib was given.
-if test "${with_altlib+set}" = set; then
- withval="$with_altlib"
- alt_lib=yes LIB=$withval
-else
- alt_lib=no LIB=$DEFLIB
-fi;
-echo "$as_me:$LINENO: result: $alt_lib ($LIB)" >&5
-echo "${ECHO_T}$alt_lib ($LIB)" >&6
-
-
-
-echo "$as_me:$LINENO: checking for shared library build" >&5
-echo $ECHO_N "checking for shared library build... $ECHO_C" >&6
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
-
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-
-# Check whether --enable-dl or --disable-dl was given.
-if test "${enable_dl+set}" = set; then
- enableval="$enable_dl"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-echo "$as_me:$LINENO: checking for dynamic loading (with gcc) " >&5
-echo $ECHO_N "checking for dynamic loading (with gcc) ... $ECHO_C" >&6
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- echo "$as_me:$LINENO: checking for dlopen in -lc" >&5
-echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6
-if test $ac_cv_lib_c_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-echo "$as_me:$LINENO: result: $using_dl ($CC)" >&5
-echo "${ECHO_T}$using_dl ($CC)" >&6
-fi
-
-
-echo "$as_me:$LINENO: checking for request to use posix_spawn" >&5
-echo $ECHO_N "checking for request to use posix_spawn... $ECHO_C" >&6
-# Check whether --enable-posix_spawn or --disable-posix_spawn was given.
-if test "${enable_posix_spawn+set}" = set; then
- enableval="$enable_posix_spawn"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-if test "$fun_ok" = "yes"; then
-
-
-for ac_func in posix_spawn _NSGetEnviron
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_header in crt_externs.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to saord@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-fi
-
-
- #
- # Ok, lets find the tcl configuration
- # First, look for one uninstalled.
- # the alternative search directory is invoked by --with-tcl
- #
-
- if test x"${no_tcl}" = x ; then
- # we reset no_tcl in case something fails here
- no_tcl=true
-
-# Check whether --with-tcl or --without-tcl was given.
-if test "${with_tcl+set}" = set; then
- withval="$with_tcl"
- with_tclconfig=${withval}
-fi;
- echo "$as_me:$LINENO: checking for Tcl configuration" >&5
-echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
- if test x"${withval}" != xno ; then
- if test "${ac_cv_c_tclconfig+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-
- # First check to see if --with-tcl was specified.
- if test x"${with_tclconfig}" != x ; then
- if test -f "${with_tclconfig}/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
- else
- echo "$as_me:$LINENO: result: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
-echo "${ECHO_T}${with_tclconfig} directory doesn't contain tclConfig.sh" >&6
- fi
- fi
-
- # then check for a private Tcl installation
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ../tcl \
- `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
- ../../tcl \
- `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
- ../../../tcl \
- `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
-
- # check in a few common install locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in `ls -d ${libdir} 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` \
- `ls -d /usr/contrib/lib 2>/dev/null` \
- `ls -d /usr/lib 2>/dev/null` \
- ; do
- if test -f "$i/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i; pwd)`
- break
- fi
- done
- fi
-
- # check in a few other private locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ${srcdir}/../tcl \
- `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
-
-fi
-
- else
- echo "$as_me:$LINENO: result: skipping Tcl configuration" >&5
-echo "${ECHO_T}skipping Tcl configuration" >&6
- ac_cv_c_tclconfig="none"
- fi
-
- if test x"${ac_cv_c_tclconfig}" = x ; then
- TCL_BIN_DIR="# no Tcl configs found"
- echo "$as_me:$LINENO: result: can't find Tcl configuration definitions" >&5
-echo "${ECHO_T}can't find Tcl configuration definitions" >&6
-# no Tcl is OK egm 03/25/03
-# AC_MSG_WARN(Can't find Tcl configuration definitions)
-# exit 0
- elif test x"${ac_cv_c_tclconfig}" = xnone ; then
- TCL_BIN_DIR=""
- else
- no_tcl=
- TCL_BIN_DIR=${ac_cv_c_tclconfig}
- echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
-echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6
- fi
- fi
-
-if test x"${no_tcl}" = x ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TCL 1
-_ACEOF
-
-fi
-
-echo "$as_me:$LINENO: checking for external zlib" >&5
-echo $ECHO_N "checking for external zlib... $ECHO_C" >&6
-
-# Check whether --with-zlib or --without-zlib was given.
-if test "${with_zlib+set}" = set; then
- withval="$with_zlib"
- zlib=yes EXTRA_LIBS="$EXTRA_LIBS $withval" EXTRA_OBJS=""
-else
- zlib=no EXTRA_OBJS='$(ZOBJS)'
-fi;
-echo "$as_me:$LINENO: result: $zlib" >&5
-echo "${ECHO_T}$zlib" >&6
-
-echo "$as_me:$LINENO: checking $host_os configuration" >&5
-echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CYGWIN
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging Cygwin" >&5
-echo "${ECHO_T}flagging Cygwin" >&6
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MINGW32
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging MinGW" >&5
-echo "${ECHO_T}flagging MinGW" >&6
- ;;
- *osf*|*Osf*)
- echo "$as_me:$LINENO: checking for snprintf in -ldb" >&5
-echo $ECHO_N "checking for snprintf in -ldb... $ECHO_C" >&6
-if test "${ac_cv_lib_db_snprintf+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldb $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char snprintf ();
-int
-main ()
-{
-snprintf ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_db_snprintf=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_db_snprintf=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_db_snprintf" >&5
-echo "${ECHO_T}$ac_cv_lib_db_snprintf" >&6
-if test $ac_cv_lib_db_snprintf = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -ldb"
-fi
-
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fno-common, -fPIC to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common, -fPIC to CFLAGS" >&6
- else
- echo "$as_me:$LINENO: result: adding -fno-common to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common to CFLAGS" >&6
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fPIC to gcc" >&5
-echo "${ECHO_T}adding -fPIC to gcc" >&6
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- ;;
-esac
-
-
-
-
- ac_config_files="$ac_config_files Makefile NaN.h"
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by util $as_me 1.0, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-util config.status 1.0
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-
-
-
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "NaN.h" ) CONFIG_FILES="$CONFIG_FILES NaN.h" ;;
- "conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@BIGENDIAN@,$BIGENDIAN,;t t
-s,@LIB@,$LIB,;t t
-s,@DEFLIB@,$DEFLIB,;t t
-s,@DOSHARED@,$DOSHARED,;t t
-s,@LLIB@,$LLIB,;t t
-s,@USE_DL@,$USE_DL,;t t
-s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t
-s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- # Do quote $f, to prevent DOS paths from being IFS'd.
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
- rm -f conftest.defines
- mv conftest.tail conftest.defines
-done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
-
-cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
- if test x"$ac_file" != x-; then
- if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
- { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
- else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- rm -f $ac_file
- mv $tmp/config.h $ac_file
- fi
- else
- cat $tmp/config.h
- rm -f $tmp/config.h
- fi
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-
diff --git a/funtools/util/configure.ac b/funtools/util/configure.ac
deleted file mode 100644
index 6745cdb..0000000
--- a/funtools/util/configure.ac
+++ /dev/null
@@ -1,196 +0,0 @@
-# This file is an input file used by the GNU "autoconf" program to
-# generate the file "configure", which is run during XPA installation
-# to configure the system for the local environment.
-AC_INIT(util, 1.0, saord@cfa.harvard.edu, util)
-
-AC_CONFIG_HEADERS([conf.h])
-AC_CONFIG_SRCDIR(./xalloc.h)
-AC_CANONICAL_HOST
-
-#
-# checks that we use in most projects
-#
-AC_PROG_CC
-
-AC_EXEEXT
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-AC_C_LONG_LONG
-
-AC_PROG_RANLIB
-
-AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(getopt.h)
-AC_CHECK_HEADERS(values.h)
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_HEADERS(setjmp.h)
-AC_CHECK_HEADERS(sys/un.h)
-AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_HEADERS(sys/ipc.h)
-AC_CHECK_HEADERS(crt_externs.h)
-
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
- AC_CHECK_HEADERS(sys/shm.h)
- ;;
-esac
-
-AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])
-
-AC_C_CONST
-
-AC_CHECK_FUNCS(strchr memcpy snprintf ftello fseeko setenv)
-
-AC_CHECK_FUNC(connect)
-if test $ac_cv_func_connect = no; then
- AC_CHECK_LIB(socket, connect, EXTRA_LIBS="$EXTRA_LIBS -lsocket")
-fi
-AC_CHECK_FUNC(gethostbyname)
-if test $ac_cv_func_gethostbyname = no; then
- AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-AC_C_BIGENDIAN([BIGENDIAN=1], [BIGENDIAN=0], [BIGENDIAN=1])
-AC_SUBST(BIGENDIAN)
-
-DEFLIB="libutil.a"
-AC_MSG_CHECKING(for alternate target library)
-AC_ARG_WITH(altlib, [ --with-altlib=LIB library name],
- alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB)
-AC_MSG_RESULT($alt_lib ($LIB))
-AC_SUBST(LIB)
-AC_SUBST(DEFLIB)
-
-AC_MSG_CHECKING(for shared library build)
-AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
- AC_SUBST(DOSHARED)
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-AC_SUBST(LLIB)
-AC_MSG_RESULT($fun_ok)
-
-AC_ARG_ENABLE(dl, [ --enable-dl allow use of dynamic loading if available],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-AC_MSG_CHECKING([for dynamic loading (with gcc) ])
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-AC_MSG_RESULT([$using_dl ($CC)])
-fi
-AC_SUBST(USE_DL)
-
-AC_MSG_CHECKING(for request to use posix_spawn)
-AC_ARG_ENABLE(posix_spawn, [ --enable-posix_spawn use posix_spawn() if available],
- [fun_ok=$enableval], [fun_ok=no])
-AC_MSG_RESULT($fun_ok)
-if test "$fun_ok" = "yes"; then
- AC_CHECK_FUNCS(posix_spawn _NSGetEnviron)
- AC_CHECK_HEADERS(crt_externs.h)
-fi
-
-SC_PATH_TCLCONFIG
-if test x"${no_tcl}" = x ; then
- AC_DEFINE([HAVE_TCL], [1], [Define if tcl is used.])
-fi
-
-AC_MSG_CHECKING(for external zlib)
-AC_ARG_WITH(zlib, [ --with-zlib=LIB library name],
- zlib=yes EXTRA_LIBS="$EXTRA_LIBS $withval" EXTRA_OBJS="", zlib=no EXTRA_OBJS='$(ZOBJS)')
-AC_MSG_RESULT($zlib)
-
-AC_MSG_CHECKING([$host_os configuration])
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
- AC_DEFINE([HAVE_CYGWIN])
- AC_MSG_RESULT(flagging Cygwin)
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
- AC_DEFINE([HAVE_MINGW32])
- AC_MSG_RESULT(flagging MinGW)
- ;;
- *osf*|*Osf*)
- AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT([adding -fno-common, -fPIC to CFLAGS])
- else
- AC_MSG_RESULT([adding -fno-common to CFLAGS])
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT(adding -fPIC to gcc)
- else
- AC_MSG_RESULT(none)
- fi
- else
- AC_MSG_RESULT(none)
- fi
- ;;
-esac
-
-AC_SUBST(EXTRA_LIBS)
-AC_SUBST(EXTRA_OBJS)
-
-AC_CONFIG_FILES(Makefile NaN.h)
-
-AC_OUTPUT
diff --git a/funtools/util/file.c b/funtools/util/file.c
deleted file mode 100644
index 06d83a6..0000000
--- a/funtools/util/file.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * file.c -- routines to grab file contents, get file size, etc.
- *
- */
-
-#include <file.h>
-
-#define BUFSIZE 8192
-#define DIR_SEPARATOR '/'
-
-/*
- * FileExists -- determine if a string is a file
- *
- * This should get re-implemented on slower systems that have
- * a system to call to check for a file's existance.
- *
- */
-#ifdef ANSI_FUNC
-int
-FileExists(char *filename)
-#else
-int FileExists(filename)
- char *filename;
-#endif
-{
- FILE *fp;
-
- if((fp = fopen(filename,"r")) == NULL){
- return(0);
- }
- else{
- fclose(fp);
- return(1);
- }
-}
-
-/*
- *
- * IsFile -- parse a string and determine if it contains a file name
- *
- * We skip white space, etc and return the actual file name
- *
- */
-#ifdef ANSI_FUNC
-int
-IsFile(char *s, char *filename, int len)
-#else
-int IsFile(s, filename, len)
- char *s;
- char *filename;
- int len;
-#endif
-{
- int i;
-
- /* skip white space */
- while( *s && isspace((int)*s) )
- s++;
- /* grab the file name up to a max, null, or CR */
- for(i=0; i<len && *s && *s != '\n'; i++, s++)
- filename[i] = *s;
- /* null terminate */
- filename[i] = '\0';
- /* try to open as a file */
- return(FileExists(filename));
-}
-
-/*
- * IsFits -- determine if a string is a FITS file
- *
- */
-#ifdef ANSI_FUNC
-int
-IsFits(char *filename)
-#else
-int IsFits(filename)
- char *filename;
-#endif
-{
- int got = 0;
- char tbuf[10];
- FILE *fp=NULL;
-
- tbuf[9] = '\0';
- if( !(fp = fopen(filename,"r")) )
- goto done;
- if( fread(tbuf, sizeof(char), 9, fp) != 9 )
- goto done;
- if( !strcmp(tbuf, "SIMPLE =") )
- got = 1;
-
-done:
- if( fp) fclose(fp);
- return(got);
-}
-
-/*
- *
- * FileNameFromPath -- return file name, given a path
- *
- */
-#ifdef ANSI_FUNC
-char *
-FileNameFromPath(char *s)
-#else
-char *FileNameFromPath(s)
- char *s;
-#endif
-{
- char *idx;
-
- idx = strrchr(s, DIR_SEPARATOR);
- if( idx != NULL )
- return(++idx);
- else
- return(s);
-}
-
-/*
- *
- * FileContents -- return contents of a file
- *
- */
-#ifdef ANSI_FUNC
-char *
-FileContents(char *path, int isize, int *osize)
-#else
-char *FileContents(path, isize, osize)
- char *path;
- int isize;
- int *osize;
-#endif
-{
- FILE *fd;
- char *npath;
- char *tbuf;
- struct stat buf;
- int get;
- int got;
-
- /* start pessimisticly */
- if( osize != NULL )
- *osize = 0;
-
- /* expand environment variables */
- npath = (char *)ExpandMacro(path, NULL, NULL, 0, NULL, NULL);
-
- /* make sure the file exists */
- if( stat(npath, &buf) <0 ){
- free(npath);
- return(NULL);
- }
-
- /* open the file */
- if( (fd=fopen(npath, "r")) == NULL ){
- free(npath);
- return(NULL);
- }
-
- /* use may have specified amount of data to get */
- if( isize >0 )
- get = isize;
- else
- get = buf.st_size;
-
- /* get contents */
- tbuf = (char *)malloc(get+1);
- got = fread(tbuf, sizeof(char), get, fd);
- fclose(fd);
- tbuf[got] = '\0';
-
- /* user may want to know how much was read */
- if( osize != NULL )
- *osize = got;
-
- free(npath);
- return(tbuf);
-}
-
-/*
- *
- * FileSize -- return the size of a file
- *
- */
-#ifdef ANSI_FUNC
-int
-FileSize(char *path)
-#else
-int FileSize(path)
- char *path;
-#endif
-{
- char *npath;
- struct stat buf;
-
- /* expand environment variables */
- npath = (char *)ExpandMacro(path, NULL, NULL, 0, NULL, NULL);
- /* make sure the file exists */
- if( stat(npath, &buf) <0 ){
- free(npath);
- return(-1);
- }
- else{
- free(npath);
- return(buf.st_size);
- }
-}
-
-/*
- *
- * FileCopy -- copy a file to another file
- *
- */
-#ifdef ANSI_FUNC
-int
-FileCopy(char *iname, char *oname)
-#else
-int FileCopy(iname, oname)
- char *iname;
- char *oname;
-#endif
-{
- FILE *ifd;
- FILE *ofd;
- char *ipath;
- char *opath;
- char tbuf[BUFSIZE];
- int got;
-
- ipath = (char *)ExpandMacro(iname, NULL, NULL, 0, NULL, NULL);
- opath = (char *)ExpandMacro(oname, NULL, NULL, 0, NULL, NULL);
- if( (ifd=fopen(ipath, "r")) == NULL )
- return(0);
- if( (ofd=fopen(opath, "w")) == NULL )
- return(0);
- while( (got = fread(tbuf, sizeof(char), BUFSIZE, ifd)) != 0 ){
- fwrite(tbuf, sizeof(char), got, ofd);
- }
- fclose(ifd);
- fclose(ofd);
- free(ipath);
- free(opath);
- return(1);
-}
-
-/*
- *
- * FileRoot -- strip the [...] extension from a file name and return root
- *
- */
-#ifdef ANSI_FUNC
-char *
-FileRoot(char *fname)
-#else
-char *FileRoot(fname)
- char *fname;
-#endif
-{
- int i;
- int len;
- char *file;
-
- len = strlen(fname)+1;
- file = (char *)malloc(len);
- for(i=0; (fname[i]!='\0') && (fname[i]!='['); i++)
- file[i] = fname[i];
- file[i] = '\0';
- return(file);
-}
-
-/*
- *
- * FileExtension -- extract the [...] extension from a file name
- *
- */
-#ifdef ANSI_FUNC
-char *
-FileExtension(char *fname)
-#else
-char *FileExtension(fname)
- char *fname;
-#endif
-{
- int i;
- int len;
- char *s;
- char *extn;
-
- /* look for opening bracket */
- if( (s=strchr(fname, '[')) == NULL ){
- return(NULL);
- }
- /* grab extension(s) */
- else{
- len = strlen(s);
- extn = (char *)malloc(len+1);
- strcpy(extn, s);
- for(i=len-1; i>=0; i--){
- if( extn[i] == ']' ){
- extn[i+1] = '\0';
- break;
- }
- }
- return(extn);
- }
-}
-
-/*
- *
- * GenerateArraySpecification -- generate an array specification of the
- * form [xdim=x,ydim=y,...] from various valid inputs
- *
- */
-#ifdef ANSI_FUNC
-int
-GenerateArraySpecification(char *ispec, char *ospec, int olen)
-#else
-int GenerateArraySpecification(ispec, ospec, olen)
- char *ispec;
- char *ospec;
- int olen;
-#endif
-{
- int got;
- int size;
- int dsize;
- int bitpix;
- char s1[SZ_LINE];
- char s2[SZ_LINE];
- char s3[SZ_LINE];
- char s4[SZ_LINE];
- char s5[SZ_LINE];
-
- if( (ispec == NULL) || (*ispec == '\0') )
- return(0);
-
- got = sscanf(ispec, "%s %s %s %s %s", s1, s2, s3, s4, s5);
- switch(got){
- case 0:
- *ospec = '\0';
- return(0);
- case 1:
- snprintf(ospec, olen, "%s", s1);
- return(1);
- case 2:
- /* make a guess at the data type by looking at the file size ...
- we probably should not work this hard!! */
- size = FileSize(s1);
- if( size > 0 ){
- dsize = atoi(s2)*atoi(s2);
- bitpix = (size/dsize)*8;
- snprintf(ospec, olen,
- "%s[xdim=%s,ydim=%s,bitpix=%d]", s1, s2, s2, bitpix);
- return(2);
- }
- else {
- *ospec = '\0';
- return(0);
- }
- case 3:
- snprintf(ospec, olen, "%s[xdim=%s,ydim=%s,bitpix=%s]", s1, s2, s2, s3);
- return(3);
- case 4:
- snprintf(ospec, olen, "%s[xdim=%s,ydim=%s,bitpix=%s]", s1, s2, s3, s4);
- return(4);
- case 5:
- snprintf(ospec, olen, "%s[xdim=%s,ydim=%s,bitpix=%s,skip=%s]",
- s1, s2, s3, s4, s5);
- return(5);
- default:
- return(0);
- }
-}
-
-/*
- *
- * GenerateArraySpec2 -- generate an array specification from separate name
- * and spec strings
- *
- */
-#ifdef ANSI_FUNC
-int
-GenerateArraySpec2(char *iname, char *ispec, char *ospec, int olen)
-#else
-int GenerateArraySpec2(iname, ispec, ospec, olen)
- char *iname;
- char *ispec;
- char *ospec;
- int olen;
-#endif
-{
-
- char *buf;
- int len;
- int got=0;
-
- len = strlen(iname)+strlen(ispec)+2;
- buf = (char *)malloc(len);
- snprintf(buf, len, "%s %s", iname, ispec);
- if( *buf ){
- got = GenerateArraySpecification(buf, ospec, olen);
- free(buf);
- }
- return(got);
-}
-
-/*
- *
- * GetNextFileName -- return next file name, given a list
- *
- */
-#ifdef ANSI_FUNC
-int
-GetNextFileName(char *filenames, int *ip, char *filename, int len)
-#else
-int GetNextFileName(filenames, ip, filename, len)
- char *filenames;
- int *ip;
- char *filename;
- int len;
-#endif
-{
- int i;
- int j;
-
- /* start with a clean slate */
- *filename = '\0';
- i = *ip;
- /* make sure there is a string */
- if( filenames == NULL || filenames[i] == '\0' )
- return(0);
- /* skip white space */
- while((isspace((int)filenames[i]) || (filenames[i] == ':')))
- i++;
- /* copy string up to a terminator */
- j = 0;
- while(filenames[i] && !isspace((int)filenames[i]) && filenames[i]!= ':'){
- if( j < len ) filename[j++] = filenames[i++];
- }
- /* null terminate */
- filename[j] = '\0';
- /* update the filenames pointer */
- *ip = i;
- /* return the news */
- if( *filename )
- return(1);
- else
- return(0);
-}
-
-/*
- *
- * ParseArraySpec -- parse the special array spec
- *
- * Generally used in syntax such as:
- *
- * foo.arr[aa=<spec>]
- *
- * where spec is of the form:
- *
- * <type><xdim>[.<ydim>][:<skip>][<endian>]
- *
- * where type is:
- * b (8-bit unsigned char)
- * s (16-bit short int)
- * u (16-bit unsigned short int)
- * i (32-bit int)
- * r,f (32-bit float)
- * d (64-bit float)
- *
- * xdim is required, ydim is optional and defaults to xdim
- * skip is optional
- * endian is optional and can be 'l' or 'b'
- *
- *
- * e.g.:
- *
- * r512 bitpix=-32 xdim=512 ydim=512
- * r512.400 bitpix=-32 xdim=512 ydim=400
- * r512.400 bitpix=-32 xdim=512 ydim=400
- * r512.400:2880 bitpix=-32 xdim=512 ydim=400 skip=2880
- * r512l bitpix=-32 xdim=512 ydim=512 endian=little
- *
- */
-#ifdef ANSI_FUNC
-int
-ParseArraySpec(char *tbuf, int *xdim, int *ydim, int *bitpix,
- int *skip, int *bigendian)
-#else
-int ParseArraySpec(tbuf, xdim, ydim, bitpix, skip, bigendian)
- char *tbuf;
- int *xdim;
- int *ydim;
- int *bitpix;
- int *skip;
- int *bigendian;
-#endif
-{
- int txdim=0;
- int tydim=0;
- int tbitpix=0;
- int tskip=-1;
- int tbigendian=0;
- int isarr=0;
- long lval;
- char *tptr;
- char *tptr2;
- tptr = tbuf;
-
- /* get type and use it to set bitpix */
- switch(*tptr){
- case 'b':
- case 'B':
- tbitpix = 8;
- isarr |= 4;
- break;
- case 's':
- case 'S':
- tbitpix = 16;
- isarr |= 4;
- break;
- case 'u':
- case 'U':
- tbitpix = -16;
- isarr |= 4;
- break;
- case 'i':
- case 'I':
- tbitpix = 32;
- isarr |= 4;
- break;
- case 'r':
- case 'R':
- case 'f':
- case 'F':
- tbitpix = -32;
- isarr |= 4;
- break;
- case 'd':
- case 'D':
- tbitpix = -64;
- isarr |= 4;
- break;
- default:
- return(0);
- }
- tptr++;
-
- /* check for the required xdim value */
- lval = strtol(tptr, &tptr2, 10);
- if( (tptr == tptr2) || (lval <=0) )
- return(0);
- else{
- txdim = lval;
- /* seed the y value as well, in case we don't get one */
- tydim = txdim;
- isarr |= 3;
- }
- /* update pointer */
- tptr = tptr2;
-
- /* there are 2 possible delims here */
- switch( *tptr ){
- case '.':
- /* now check for the optional ydim value */
- tptr++;
- lval = strtol(tptr, &tptr2, 10);
- if( tptr == tptr2 )
- tydim = txdim;
- else{
- if( lval <=0 )
- return(0);
- else
- tydim = lval;
- }
- /* update pointer */
- tptr = tptr2;
- /* look for skip after this */
- if( *tptr != ':' )
- break;
- case ':':
- /* check for the optional skip value */
- tptr++;
- lval = strtol(tptr, &tptr2, 10);
- if( (tptr != tptr2) && (lval >0) ){
- tskip = lval;
- isarr |= 8;
- }
- /* update pointer */
- tptr = tptr2;
- break;
- }
-
- switch(*tptr){
- case 'l':
- case 'L':
- tbigendian = 0;
- isarr |= 16;
- break;
- case 'b':
- case 'B':
- tbigendian = 1;
- isarr |= 16;
- break;
- }
-
- /* make sure required values were set */
- if( (isarr&7) != 7 )
- return(0);
-
- /* fill in required values */
- *xdim = txdim;
- *ydim = tydim;
- *bitpix = tbitpix;
-
- /* see if optional values were set */
- if( isarr & 8 )
- *skip = tskip;
- if( isarr & 16 )
- *bigendian = tbigendian;
-
- /* success */
- return(1);
-}
diff --git a/funtools/util/file.h b/funtools/util/file.h
deleted file mode 100644
index 325b641..0000000
--- a/funtools/util/file.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * file.h -- declarations for file parsing
- *
- */
-
-#ifndef __file_h
-#define __file_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "prsetup.h"
-#include "macro.h"
-#include "xalloc.h"
-
-_PRbeg
-int FileExists _PRx((char *filename));
-int IsFile _PRx((char *s, char *filename, int len));
-int IsFits _PRx((char *filename));
-char *FileNameFromPath _PRx((char *s));
-char *FileContents _PRx((char *path, int isize, int *osize));
-int FileSize _PRx((char *path));
-int FileCopy _PRx((char *iname, char *oname));
-char *FileRoot _PRx((char *fname));
-char *FileExtension _PRx((char *fname));
-int GenerateArraySpecification _PRx((char *ispec, char *ospec, int olen));
-int GenerateArraySpec2 _PRx((char *iname, char *ispec, char *ospec, int olen));
-int GetNextFileName _PRx((char *filenames, int *ip, char *filename, int len));
-int ParseArraySpec _PRx((char *tbuf, int *xdim, int *ydim, int *bitpix,
- int *skip, int *bigendian));
-
-_PRend
-
-#endif
diff --git a/funtools/util/find.c b/funtools/util/find.c
deleted file mode 100644
index cf4d9ca..0000000
--- a/funtools/util/find.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * Find.c -- find files via the path environment variable
- * (and related routines)
- *
- */
-#include <find.h>
-
-/*
- *
- * private routines
- *
- */
-
-#define MAXBUFSIZE 8192
-
-#ifndef HAVE_UNISTD_H
-#define F_OK 0 /* does file exist */
-#define X_OK 1 /* is it executable by caller */
-#define W_OK 2 /* is it writable by caller */
-#define R_OK 4 /* is it readable by caller */
-#endif
-
-/* not part of unistd.h but we need to differentiate directories */
-#ifdef D_OK
-#undef D_OK
-#endif
-#define D_OK 256 /* is it a directory */
-
-#ifdef ANSI_FUNC
-static int
-amparse (char *mode)
-#else
-static int amparse(mode)
- char *mode;
-#endif
-{
- int xmode = 0;
-
- xmode |= ( strpbrk(mode, "r") != NULL ? R_OK : 0 );
- xmode |= ( strpbrk(mode, "w") != NULL ? W_OK : 0 );
- xmode |= ( strpbrk(mode, "x") != NULL ? X_OK : 0 );
- xmode |= ( strpbrk(mode, "f") != NULL ? F_OK : 0 );
- xmode |= ( strpbrk(mode, "d") != NULL ? D_OK : 0 );
-
- return xmode;
-}
-
-#ifdef ANSI_FUNC
-static char *
-findpath (char *name, char *mode, char *path)
-#else
-static char *findpath(name, mode, path)
- char *name;
- char *mode;
- char *path;
-#endif
-{
- char pathbuff[MAXBUFSIZE];
- char namebuff[MAXBUFSIZE];
- char tempbuff[MAXBUFSIZE];
- char backmode[MAXBUFSIZE];
- char *here, *found;
- int len;
- int mark = 0;
- int skip = strpbrk(mode, ">") != NULL;
- int pick = strpbrk(mode, "<") != NULL;
-
- if ( skip && pick ) return NULL;
-
- if ( (path==NULL) || ( name[0] == '.' && name[1] == '/' ) || name[0] == '/' )
- return Access(name, mode);
-
- strncpy(pathbuff, path, MAXBUFSIZE-1);
- pathbuff[MAXBUFSIZE-1] = '\0';
- path = pathbuff;
-
- if ( (here = strpbrk(pathbuff, ":;")) ) {
- mark = *here;
- *here++ = '\0';
- }
- while ( path ) {
- /* if there is an environment variable ... */
- if ( strchr(path, '$') ) {
- /* exand it */
- ExpandEnv(path, tempbuff, MAXBUFSIZE);
- /* make sure we could expand it (otherwise we get an infinite loop) */
- if( !strchr(tempbuff, '$') ){
- if ( (found = findpath(name, mode, tempbuff)) )
- return found;
- }
- } else {
- if ( !skip ) {
- if ( !strcmp(".", path) ) path[0] = '\0';
-
- strncpy(namebuff, path, MAXBUFSIZE-1);
- namebuff[MAXBUFSIZE-1] = '\0';
- len = strlen(namebuff);
- if ( namebuff[0] && namebuff[len-1] != '/' ){
- if( (len+1) <= (MAXBUFSIZE-1) ){
- strcat(namebuff, "/");
- len++;
- }
- /* filename is too large, so we can't find it */
- else
- return NULL;
- }
- if( len+strlen(name) <= MAXBUFSIZE-1 )
- strcat(namebuff, name);
- /* filename is too large, so we can't find it */
- else
- return NULL;
-
- if ( (found = Access(namebuff, mode)) )
- return found;
- }
- }
-
- if ( mark == ';' ) {
- if ( skip ) {
- skip = 0;
- /* Knock down the skip mode to select all
- * directories in path after the first ";"
- */
- strncpy(backmode, mode, MAXBUFSIZE-1);
- backmode[MAXBUFSIZE-1] = '\0';
- mode = backmode;
- }
- if ( pick ) return NULL;
- }
-
- path = here;
- if ( here && (here = strpbrk(here, ":;")) ) {
- mark = *here;
- *here++ = '\0';
- }
- }
-
- return NULL;
-}
-
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *
- * ResolvePath -- resolve the path to remove . and .. entries
- *
- */
-#ifdef ANSI_FUNC
-char *
-ResolvePath (char *ibuf, char *obuf, int maxlen)
-#else
-char *ResolvePath(ibuf, obuf, maxlen)
- char *ibuf;
- char *obuf;
- int maxlen;
-#endif
-{
- char path[MAXBUFSIZE];
- char *part[MAXBUFSIZE];
- char *tbuf;
- int i, j;
- int len;
- int npart=0;
-
- /* if we have no path separators, we really don't have much to do! */
- if( strchr(ibuf, '/') == NULL ){
- strncpy(obuf, ibuf, maxlen-1);
- obuf[maxlen-1] = '\0';
- return(obuf);
- }
-
- /* if its just "/" or "/.", its easy */
- if( !strcmp(ibuf, "/") || !strcmp(ibuf, "/.") ){
- strncpy(obuf, "/", maxlen-1);
- obuf[maxlen-1] = '\0';
- return(obuf);
- }
-
- /* if we have a relative path to deal with, get current directory */
- if( (*ibuf == '.') || ( (strchr(ibuf, '/') != NULL) && (*ibuf != '/') ) ){
- getcwd(path, MAXBUFSIZE);
- }
- else{
- *path = '\0';
- }
-
- /* construct the total string we have to deal with */
- len = strlen(path) + strlen(ibuf) + 1;
- tbuf = (char *)xmalloc(len+1);
- if( *path ){
- strcpy(tbuf, path);
- strcat(tbuf, "/");
- strcat(tbuf, ibuf);
- }
- else{
- strcpy(tbuf, ibuf);
- }
-
- /* construct the parts array from this string, removing / characters
- and null-terminating each part */
- for(i=0; i<len; i++){
- if( tbuf[i] == '/' ){
- tbuf[i] = '\0';
- /* skip adjacent slashes */
- if( tbuf[i+1] == '/' ) continue;
- part[npart] = &tbuf[i+1];
- npart++;
- }
- }
-
- /* loop through the parts array and resolve the . and .. entries */
- for(i=0; i<npart; i++){
- /* for ".", just remove it */
- if( !strcmp(part[i], ".") ){
- part[i] = NULL;
- }
- /* for "..", also remove the previous part -- if possible */
- else if( !strcmp(part[i], "..") ){
- part[i] = NULL;
- for(j=i-1; j>=0; j--){
- if( part[j] ){
- part[j] = NULL;
- break;
- }
- }
- }
- }
-
- /* construct a new string from the remaining parts */
- *obuf = '\0';
- len = 0;
- for(i=0; i<npart; i++){
- if( part[i] != NULL ){
- if( len+(int)strlen(part[i])+1 <= maxlen-1 ){
- strcat(obuf, "/");
- strcat(obuf, part[i]);
- len += strlen(part[i])+1;
- }
- else{
- break;
- }
- }
- }
-
- /* free up buffer space */
- if( tbuf ) free(tbuf);
-
- /* return the string */
- return(obuf);
-}
-
-#ifdef ANSI_FUNC
-void
-ExpandEnv (char *name, char *envname, int maxlen)
-#else
-void ExpandEnv(name, envname, maxlen)
- char *name;
- char *envname;
- int maxlen;
-#endif
-{
- char brace[2];
- char tbuf[MAXBUFSIZE];
- char *fullname=NULL;
- char *mip;
- char *ip;
- char *s;
- int len;
- int i=0, j=0;
-
- /* allocate temp working buffer (so dest can be same as source) */
- if( !(fullname=(char *)xcalloc(maxlen, sizeof(char))) ) return;
-
- /* process each character */
- for(ip=name; *ip; ip++){
- /* if its not beginning of an env, just store and loop */
- if( *ip != '$' ){
- fullname[i++] = *ip;
- fullname[i] = '\0';
- }
- else{
- mip = ip;
- /* skip past '$' */
- ip++;
- /* skip past brace, if necessary */
- if( *ip == '{' ){
- brace[0] = '{';
- ip++;
- }
- else if( *ip == '(' ){
- brace[0] = '(';
- ip++;
- }
- else
- brace[0] = '\0';
- /* get variable up to next white space */
- for(*tbuf='\0', j=0;
- (!isspace((int)*ip)) && (*ip != '"') && (*ip != '\'') && (*ip);
- ip++){
- /* look for trailing brace, if necessary */
- if( *brace && *ip == (*brace == '(' ? ')' : '}') ){
- ip++;
- break;
- }
- /* a "/" will end the environment variable as well */
- if( *ip == '/' ){
- break;
- }
- tbuf[j++] = *ip;
- tbuf[j] = '\0';
- }
- /* back up so we can process the white space in the outer loop */
- ip--;
- if( (s = (char *)getenv(tbuf)) != NULL ){
- i += strlen(s);
- if( i <= maxlen )
- strcat(fullname, s);
- }
- /* if we don't recognize this macro, put it back onto the string */
- else{
- len = ip - mip + 1;
- i += len;
- if( i <= maxlen )
- strncat(fullname, mip, len);
- }
- }
- }
-
- /* transfer to output buffer */
- strncpy(envname, fullname, maxlen);
-
- /* free up temp space */
- if( fullname ) xfree(fullname);
-}
-
-#ifdef ANSI_FUNC
-char *
-Access (char *name, char *mode)
-#else
-char *Access (name, mode)
- char *name;
- char *mode;
-#endif
-{
- struct stat info;
- char fullname[MAXBUFSIZE];
- char AccessName[MAXBUFSIZE];
-
-
- ExpandEnv(name, fullname, MAXBUFSIZE);
- if ( stat(fullname, &info) !=0 ) return NULL;
-
-#if HAVE_MINGW32==0 && HAVE_CYGWIN==0
- if ( mode ) {
- int m = amparse(mode);
-
- /* distinguish between directories and files */
- if ( (m & D_OK) && !(info.st_mode & S_IFDIR) ) return NULL;
- if ( !(m & D_OK) && (info.st_mode & S_IFDIR) ) return NULL;
-
- if ( getuid() == info.st_uid ) {
- if ( m & R_OK && !(info.st_mode & S_IRUSR) ) return NULL;
- if ( m & W_OK && !(info.st_mode & S_IWUSR) ) return NULL;
- if ( m & X_OK && !(info.st_mode & S_IXUSR) ) return NULL;
- } else
- if ( getgid() == info.st_gid ) {
- if ( m & R_OK && !(info.st_mode & S_IRGRP) ) return NULL;
- if ( m & W_OK && !(info.st_mode & S_IWGRP) ) return NULL;
- if ( m & X_OK && !(info.st_mode & S_IXGRP) ) return NULL;
- } else {
- if ( m & R_OK && !(info.st_mode & S_IROTH) ) return NULL;
- if ( m & W_OK && !(info.st_mode & S_IWOTH) ) return NULL;
- if ( m & X_OK && !(info.st_mode & S_IXOTH) ) return NULL;
- }
- }
-#endif
-
- ResolvePath(fullname, AccessName, MAXBUFSIZE);
- return(xstrdup(AccessName));
-}
-
-#ifdef ANSI_FUNC
-char *
-Find (char *name, char *mode, char *exten, char *path)
-#else
-char *Find (name, mode, exten, path)
- char *name;
- char *mode;
- char *exten;
- char *path;
-#endif
-{
- char extenbuff[MAXBUFSIZE];
- char namebuff[MAXBUFSIZE];
- char *here, *found;
- int len;
-
- /* sanity check */
- if( !name || !*name )
- return NULL;
-
- /* if its a WWW file, we just say 'yes' */
- if( !strncmp(name, "ftp://", 6) ||
- !strncmp(name, "http://", 7) ){
- return(xstrdup(name));
- }
-
- if ( exten == NULL )
- return findpath(name, mode, path);
-
- strncpy(extenbuff, exten, MAXBUFSIZE-1);
- extenbuff[MAXBUFSIZE-1] = '\0';
- exten = extenbuff;
-
- if ( (here = strpbrk(extenbuff, ":;")) ) *here++ = '\0';
-
- while ( exten ) {
- if ( exten[0] == '$' ) {
- if ( (exten = (char *)getenv(&exten[1])) )
- if ( (found = Find(name, mode, exten, path)) )
- return found;
- } else {
- char *e = strstr(name, exten);
-
- strncpy(namebuff, name, MAXBUFSIZE-1);
- namebuff[MAXBUFSIZE-1] = '\0';
- len = strlen(namebuff);
- if ( (e==NULL) || ( e && *(e + len)) ){
- if( len+strlen(exten) <= MAXBUFSIZE-1 )
- strcat(namebuff, exten);
- /* filename is too large, so we can't find it */
- else
- return NULL;
- }
-
- if ( (found = findpath(namebuff, mode, path)) )
- return found;
-
- }
-
- exten = here;
- if ( here && (here = strpbrk(here, ":;")) ) *here++ = '\0';
- }
-
- return NULL;
-}
diff --git a/funtools/util/find.h b/funtools/util/find.h
deleted file mode 100644
index d7d4dbd..0000000
--- a/funtools/util/find.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * find.h -- declarations for find finding
- *
- */
-
-#ifndef __find_h
-#define __find_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "xalloc.h"
-#include "prsetup.h"
-
-_PRbeg
-
-char *ResolvePath _PRx((char *ibuf, char *obuf, int maxlen));
-void ExpandEnv _PRx((char *name, char *fullname, int maxlen));
-char *Access _PRx((char *name, char *mode));
-char *Find _PRx((char *name, char *mode, char *extn, char *path));
-
-_PRend
-
-#endif
diff --git a/funtools/util/gcat.c b/funtools/util/gcat.c
deleted file mode 100644
index 3b26332..0000000
--- a/funtools/util/gcat.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * gcat -- cat-like program using gio with byte-swapping support
- *
- */
-
-#include <gio.h>
-
-#define BUFSIZE 4096
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-static void swap2(char *to, char *from, size_t nbytes)
-#else
-static void swap2(to, from, nbytes)
- char *to;
- char *from;
- size_t nbytes;
-#endif
-{
- char c;
- size_t i;
- for(i=0; i < nbytes; i += 2, (to += 2), (from += 2)){
- c = *from;
- *(to) = *(from+1);
- *(to+1) = c;
- }
-}
-
-#ifdef ANSI_FUNC
-static void swap4(char *to, char *from, size_t nbytes)
-#else
-static void swap4(to, from, nbytes)
- char *to;
- char *from;
- size_t nbytes;
-#endif
-{
- char c;
- size_t i;
- for(i=0; i < nbytes; i += 4, (to += 4), (from += 4)){
- c = *from;
- *to = *(from+3);
- *(to+3) = c;
- c = *(from+1);
- *(to+1) = *(from+2);
- *(to+2) = c;
- }
-}
-
-#ifdef ANSI_FUNC
-static void swap8(char *to, char *from, size_t nbytes)
-#else
-static void swap8(to, from, nbytes)
- char *to;
- char *from;
- size_t nbytes;
-#endif
-{
- char c;
- size_t i;
- for(i=0; i < nbytes; i += 8, (to += 8), (from += 8)){
- c = *(from+0);
- *(to+0) = *(from+7);
- *(to+7) = c;
- c = *(from+1);
- *(to+1) = *(from+6);
- *(to+6) = c;
- c = *(from+2);
- *(to+2) = *(from+5);
- *(to+5) = c;
- c = *(from+3);
- *(to+3) = *(from+4);
- *(to+4) = c;
- }
-}
-
-
-#ifdef ANSI_FUNC
-static void usage(char *s)
-#else
-static void usage(s)
- char *s;
-#endif
-{
- fprintf(stderr,
- "usage: %s <switches> [iname [oname]]\n", s);
- fprintf(stderr, "optional switches:\n");
- fprintf(stderr, " -b bufsize # number of records to read at once (def: %d)\n", BUFSIZE);
- fprintf(stderr, " -e elsize # size of an individual record (def: 1)\n");
- fprintf(stderr, " -s elsize # swap bytes in a record of this size (def: no swapping)\n");
- fprintf(stderr, " -v # verbose messages as data is transferred\n");
- fprintf(stderr, "examples:\n");
- fprintf(stderr, "# copy named files\n");
- fprintf(stderr, "%s foo foo2\n", s);
- fprintf(stderr, "# or copy file to socket 1234 on this host\n");
- fprintf(stderr, "%s foo '$host:1234'\n", s);
- fprintf(stderr, "# or copy from a socket on this host to another host\n");
- fprintf(stderr, "%s '$host:1234' 'remotehost:2345'\n", s);
- exit(0);
-}
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-int main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int got;
- int args;
- int ntot=0;
- int doswap=0;
- int elsize=1;
- int verbose=0;
- int bufsize=BUFSIZE;
- char *ibuf=NULL;
- char *obuf=NULL;
- char *iname=NULL;
- char *oname=NULL;
- GIO igio;
- GIO ogio;
-
- /* exit on gio errors */
- setgerror(2);
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "b:e:hs:v")) != -1){
- switch(c){
- case 'h':
- usage(argv[0]);
- return 0;
- case 'b':
- bufsize = atoi(optarg);
- break;
- case 'e':
- elsize = atoi(optarg);
- break;
- case 's':
- elsize = atoi(optarg);
- switch(elsize){
- case 1:
- doswap = 0;
- break;
- case 2:
- case 4:
- case 8:
- doswap = 1;
- break;
- default:
- gerror(stderr, "ERROR: invalid swap size argument: %d\n", elsize);
- break;
- }
- break;
- case 'v':
- verbose++;
- break;
- }
- }
-
- /* process remaining command line arguments(i.e. file names) */
- args = argc - optind;
- switch(args){
- case 0:
- iname = "stdin";
- oname = "stdout";
- break;
- case 1:
- iname = argv[optind+0];
- oname = "stdout";
- break;
- case 2:
- iname = argv[optind+0];
- oname = argv[optind+1];
- break;
- default:
- usage(argv[0]);
- exit(1);
- }
-
- /* sanity checks */
- if( bufsize <= 0 ) gerror(stderr, "bufsize must be positive\n", bufsize);
- if( elsize <= 0 ) gerror(stderr, "elsize must be positive\n", elsize);
-
- /* allocate space */
- ibuf = xcalloc(elsize, bufsize);
- if( doswap )
- obuf = xcalloc(elsize, bufsize);
- else
- obuf = ibuf;
-
- /* open the input and output files */
- if( !(igio = gopen(iname, "r")) )
- gerror(stderr, "can't gopen input file: %s\n", iname);
- if( !(ogio = gopen(oname, "w")) )
- gerror(stderr, "can't gopen output file: %s\n", oname);
-
- /* read/write all bytes */
- while( 1 ){
- /* read next buffer's worth */
- got = gread(igio, ibuf, elsize, bufsize);
- if( !got )
- break;
- else if( got < 0 ){
- gerror(stderr, "error reading input file\n");
- break;
- }
- /* swap bytes, if necessary */
- if( doswap ){
- switch(elsize){
- case 2:
- swap2(obuf, ibuf, elsize*got);
- break;
- case 4:
- swap4(obuf, ibuf, elsize*got);
- break;
- case 8:
- swap8(obuf, ibuf, elsize*got);
- break;
- default:
- gerror(stderr, "invalid swap size: %d\n", elsize);
- break;
- }
-
- }
- /* verbose display */
- if( verbose >= 2 ){
- if( doswap ){
- fprintf(stderr, "transferring %d swapped %d-byte records\n",
- got, elsize);
- }
- else if( elsize > 1 ){
- fprintf(stderr, "transferring %d %d-byte records\n",
- got, elsize);
- }
- else{
- fprintf(stderr, "transferring %d bytes\n", got);
- }
- }
- /* write buffer's worth */
- if( gwrite(ogio, obuf, elsize, got) != (unsigned int)got ){
- gerror(stderr, "error writing output file\n");
- }
- ntot += got;
- }
-
- /* verbose display */
- if( verbose ){
- if( doswap ){
- fprintf(stderr, "transfer from %s to %s: %d swapped %d-byte records\n",
- iname, oname, ntot, elsize);
- }
- else if( elsize > 1 ){
- fprintf(stderr, "transfer from %s to %s: %d %d-byte records\n",
- iname, oname, ntot, elsize);
- }
- else{
- fprintf(stderr, "transfer from %s to %s: %d bytes\n",
- iname, oname, ntot);
- }
- }
-
- /* close files */
- gclose(igio);
- gclose(ogio);
-
- /* clean up */
- if( ibuf ) xfree(ibuf );
- if( doswap && obuf ) xfree(obuf);
- return 0;
-}
diff --git a/funtools/util/gio.c b/funtools/util/gio.c
deleted file mode 100644
index b3dd109..0000000
--- a/funtools/util/gio.c
+++ /dev/null
@@ -1,2314 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * GIO -- generalized I/O to disk files, streams, and memory
- *
- */
-
-#include <gio.h>
-#include <find.h>
-#include <word.h>
-#include <zlib.h>
-
-/*
- *
- * Private Routines
- *
- */
-
-#define GBUFSZ 32768
-static char _gtbuf[GBUFSZ];
-
-static char _gerrors[GBUFSZ];
-static int _gerror = -1;
-
-static char _gwarnings[GBUFSZ];
-static int _gwarning = -1;
-
-static int _gcrnl = 1;
-
-/*
- *
- * gext -- return extension from a file (without bracket extension)
- *
- */
-#ifdef ANSI_FUNC
-static char *
-gext(char *fname)
-#else
-static char *gext(fname)
- char *fname;
-#endif
-{
- char *s, *t=NULL;
- char *file;
-
- if( !fname || !*fname )
- return(NULL);
- /* make a working copy */
- file = xstrdup(fname);
- /* remove the bracket extension */
- if( (s=strchr(file, '[')) ){
- *s = '\0';
- }
- /* look for a file extension */
- if( (s = strrchr(file, '.')) ){
- strncpy(_gtbuf, s, GBUFSZ-2);
- _gtbuf[GBUFSZ-1] = '\0';
- t = _gtbuf;
- }
- /* free working copy */
- if( file ) xfree(file);
- /* return extension */
- return(t);
-}
-
-
-/*
- *
- * gnew -- create a new GIO structure
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gnew (void)
-#else
-static GIO gnew()
-#endif
-{
- GIO gio;
- gio = (GIO)xcalloc(1, sizeof(GFile));
- gio->ifd = -1;
- gio->ofd = -1;
- return(gio);
-}
-
-/*
- *
- * gfree -- destroy a GIO structure
- *
- */
-#ifdef ANSI_FUNC
-static void
-gfree (GIO gio)
-#else
-static void gfree(gio)
- GIO gio;
-#endif
-{
- if( gio == NULL )
- return;
- if( gio->name )
- xfree(gio->name);
- if( gio->mode )
- xfree(gio->mode);
- if( gio->crbuf )
- xfree(gio->crbuf);
- xfree((void *)gio);
-}
-
-
-/*
- *
- * gmemseek -- memory "seek" of data
- *
- */
-#ifdef ANSI_FUNC
-static off_t
-gmemseek (GIO gio, off_t offset, int whence)
-#else
-static off_t gmemseek(gio, offset, whence)
- GIO gio;
- off_t offset;
- int whence;
-#endif
-{
- int offset2;
-
- switch(whence){
- case 0:
- offset2 = offset;
- break;
- case 1:
- offset2 = gio->cur + offset;
- break;
- case 2:
- offset2 = gio->len + offset;
- break;
- default:
- return(-1);
- }
- if( offset2 >= gio->len ){
- if( gio->extend ){
- gio->len = offset2 + 1;
- gio->buf = (char *)xrealloc(gio->buf, gio->len);
- gio->cur = offset2;
- return(0);
- }
- else{
- return(-1);
- }
- } else {
- gio->cur = offset2;
- return(0);
- }
-}
-
-/*
- *
- * gmemread -- memory "read" of data
- *
- */
-#ifdef ANSI_FUNC
-static void *
-gmemread (GIO gio, void *buf, size_t size, size_t n, size_t *got)
-#else
-static void *gmemread(gio, buf, size, n, got)
- GIO gio;
- void *buf;
- size_t size;
- size_t n;
- size_t *got;
-#endif
-{
- char *obuf;
-
- /* sanity checks */
- if( (gio==NULL) || (gio->buf == NULL) )
- return((void *)NULL);
- if( !strchr(gio->mode, 'r') && !strstr(gio->mode, "w+") ){
- gerror(stderr,
- "illegal read operation on write-only data (%s)\n", gio->name);
- return((void *)NULL);
- }
- /* see how much we can grab to "EOF" */
- if( size <= 0 ) size = 1;
- *got = MIN(size*n, ((gio->len - gio->cur)/size)*size);
- /* copy bytes, if a buffer was supplied */
- if( buf ){
- obuf = buf;
- memmove(obuf, &(gio->buf[gio->cur]), *got);
- }
- else{
- obuf = &(gio->buf[gio->cur]);
- }
- /* bump position pointer */
- gio->cur += *got;
- /* convert got to elements */
- *got /= size;
- /* return buffer */
- return(obuf);
-}
-
-/*
- *
- * gmemwrite -- memory "write" of data
- *
- */
-#ifdef ANSI_FUNC
-static int
-gmemwrite (GIO gio, char *buf, size_t size, size_t n)
-#else
-static int gmemwrite(gio, buf, size, n)
- GIO gio;
- char *buf;
- size_t size;
- size_t n;
-#endif
-{
- size_t n2;
- int len;
-
- /* sanity checks */
- if( (gio==NULL) || (gio->buf == NULL) )
- return(0);
- if( !strchr(gio->mode, 'w') && !strstr(gio->mode, "r+") ){
- gerror(stderr,
- "illegal write operation on read-only data (%s)\n", gio->name);
- return(0);
- }
- len = size*n;
- /* make sure we have enough space */
- if( gio->cur + len >= gio->len ){
- if( gio->extend ){
- gio->len += MAX(len, GIO_BUFINC);
- if( (gio->buf = (char *)xrealloc(gio->buf, gio->len)) != NULL )
- n2 = len;
- /* could not grab space -- try just a bit to recover */
- else{
- gerror(stderr, "could not realloc space for memory write\n");
- n2 = 0;
- }
- }
- else{
- n2 = gio->len - gio->cur;
- }
- }
- else
- n2 = len;
- /* copy bytes */
- memmove(&(gio->buf[gio->cur]), buf, n2);
- /* bump pointer */
- gio->cur += n2;
- return(n/size);
-}
-
-#if HAVE_MINGW32==0
-/*
- *
- * gexec -- open a connected subprocess with bidirectional
- * IPC channels, implemented with pipes for this version
- *
- */
-#ifdef ANSI_FUNC
-static int
-gexec(GIO gio, char *cmd, char *mode)
-#else
-static int gexec(gio, cmd, mode)
- GIO gio;
- char *cmd;
- char *mode;
-#endif
-{
- int pin[2], pout[2];
- int maxforks = 3;
- char *argv[4096];
-
- /* start out pessimisticaly */
- gio->ifd = -1;
- gio->ofd = -1;
-
- /* open pipes */
- pipe(pin);
- if( pipe(pout) != 0){
- return(-1);
- }
-
- /* Create child process. The child inherits the open stdio files.
- * The fork can fail if swap space is full or if we have too many processes.
- */
- while ((gio->pid = fork()) == -1) {
- if (--maxforks == 0) {
- close(pin[0]); close(pin[1]);
- close(pout[0]); close(pout[1]);
- return(-1);
- }
- sleep (2);
- }
- if(gio->pid == 0) {
- /* New child process. Make child think the pipe is its stdin/out.
- */
- close(pin[0]);
- close(pout[1]);
- close(0); dup (pout[0]); close(pout[0]);
- close(1); dup (pin[1]); close(pin[1]);
-
- /* run through shell so that we expand shell meta characters */
- argv[0] = "sh";
- argv[1] = "-c";
- argv[2] = cmd;
- argv[3] = NULL;
-
- /* Exec the new process. Will not return if successful. */
- execvp(argv[0], (void *)argv);
-
- /* If we get here the new process could not be executed for some
- * reason. Shutdown, calling _exit to avoid flushing parent's
- * io buffers.
- */
- _exit(1);
- } else {
- /* Existing, parent process. */
- close(pin[1]);
- close(pout[0]);
- if( strchr(mode, 'r') )
- gio->ifd = pin[0];
- else{
- close(pin[0]);
- }
- if( strchr(mode, 'w') )
- gio->ofd = pout[1];
- else{
- close(pout[1]);
- }
- }
- /* clean up and return */
- return(0);
-}
-
-/*
- *
- * gopenpipe -- open a command pipe
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopenpipe (char *name, char *mode)
-#else
-static GIO gopenpipe(name, mode)
- char *name;
- char *mode;
-#endif
-{
- GIO gio;
- char *s;
-
- /* allocate the new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* skip past prefix */
- s = name;
- if( !strncasecmp(s, "pipe:", 5) ) s += 5;
- while( isspace((int)*s) ) s++;
-
- /* start the piped process */
- if( gexec(gio, s, mode) != 0 ){
- gclose(gio);
- return(NULL);
- }
-
- /* fill in the record */
- gio->name = xstrdup(s);
- gio->mode = xstrdup(mode);
- gio->type = GIO_PIPE;
- gio->extend = 0;
- return(gio);
-}
-#endif
-
-/*
- *
- * giohostip -- convert ascii host into ip number
- *
- */
-#ifdef ANSI_FUNC
-static unsigned int
-giohostip (char *xhost)
-#else
-static unsigned int giohostip(xhost)
- char *xhost;
-#endif
-{
- struct hostent *hostent;
- unsigned int ip;
- char temp[SZ_LINE];
-
- /* null input means current host */
- if( (xhost == NULL) || (*xhost == '\0') || !strncmp(xhost, "$host", 5) ){
- gethostname(temp, SZ_LINE);
- } else {
- strcpy(temp, xhost);
- }
-
- /* special check */
- if( !strcmp(temp, "$localhost") ){
- return(0x7F000001);
- }
-
- /*
- * Try looking by address (i.e., host is something like "128.84.253.1").
- * Do this first because it's much faster (no trip to the DNS)
- */
- if( (int)(ip = inet_addr(temp)) != -1 ){
- return(ntohl(ip));
- }
-
- /*
- * Try looking it up by name. If successful, the IP address is in
- * hostent->h_addr_list[0]
- */
- if( (hostent = gethostbyname(temp)) != NULL ){
- memcpy(&ip, hostent->h_addr_list[0], (size_t)hostent->h_length);
- return(ntohl(ip));
- }
-
- /* could not convert */
- return(0);
-}
-
-/*
- *
- * gioparseipport -- parse ascii string into a host and port
- *
- */
-#ifdef ANSI_FUNC
-static int
-gioparseipport (char *host, unsigned int *ip, unsigned short *port)
-#else
-static int gioparseipport(host, ip, port)
- char *host;
- unsigned int *ip;
- unsigned short *port;
-#endif
-{
- char *s1, *p1, *p2;
- int got;
-
- /* start out pessimistically */
- *ip = 0;
- *port = 0;
-
- /* make sure we have something to work with */
- if( !host || !*host )
- return(0);
-
- /* we null out ':' (so that what comes before is the host name) and
- bump past it to point to the port */
- s1 = xstrdup(host);
- if( !(p1 = (char *)strchr(s1, ':')) ){
- got = 0;
- goto done;
- }
- *p1 = '\0';
- p1++;
-
- /* get port */
- p2 = NULL;
- *port = (unsigned short)strtol(p1, &p2, 0);
- /* check for bad port number -- we lose */
- if( *port <=0 || (p1 == p2) ){
- *port = 0;
- got = 0;
- goto done;
- }
-
- /* convert ip string (might be null) to an ip address */
- if( (*ip = giohostip(s1)) == 0 ){
- *port = 0;
- got = 0;
- }
- else{
- got = 1;
- }
-
-done:
- xfree(s1);
- return(got);
-}
-
-/*
- *
- * gopensocket -- open a socket for reading and/or writing
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopensocket (char *name, char *mode)
-#else
-static GIO gopensocket(name, mode)
- char *name;
- char *mode;
-#endif
-{
- char *s;
- char tbuf[SZ_LINE];
- int fd=-1;
- int fd2=-1;
- int status;
- int tries;
- int reuse_addr=1;
- int doaccept=-1;
- unsigned int ip;
- unsigned short port;
- socklen_t slen;
- struct sockaddr_in sock_in;
- struct timeval tv;
- fd_set readfds;
- GIO gio;
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* skip past prefix */
- s = name;
- if( !strncasecmp(s, "socket:", 7) ) s += 7;
- while( isspace((int)*s) ) s++;
-
- /* if $host is the socket, we might also be specifying whether we
- connect ($host_c[onnect]) or accept ($host_a[ccept]). This allows
- either end to initiate the connection */
- if( !strncasecmp(s, "$host_a", 7) ){
- doaccept = 1;
- s = strchr(s,':');
- }
- else if( !strncasecmp(s, "$host_c", 7) ){
- doaccept = 0;
- s = strchr(s,':');
- }
- while( isspace((int)*s) ) s++;
-
- /* get host and port number */
- if( !gioparseipport(s, &ip, &port) )
- goto error;
-
- if( doaccept < 0 ){
- /* see whether we accept or connect */
- if( ip != giohostip(NULL) ){
- doaccept = 0;
- }
- else{
- if( strchr(mode, 'w') ){
- doaccept = 0;
- }
- else{
- doaccept = 1;
- }
- }
- }
-
- /* open socket for reading, i.e., reading 'stdin' from another host */
- if( doaccept ){
- /* set up listening socket, which will accept connection */
- if( (fd = socket(AF_INET, SOCK_STREAM, 0)) < 0 )
- goto error;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuse_addr, sizeof(reuse_addr));
- memset((char *)&sock_in, 0, sizeof(sock_in));
- sock_in.sin_family = AF_INET;
- sock_in.sin_addr.s_addr = htonl(INADDR_ANY);
- sock_in.sin_port = htons(port);
- /* bind to a port */
- if( bind(fd, (struct sockaddr *)&sock_in, sizeof(sock_in)) < 0 )
- goto error;
- /* listen for connections */
- if( listen(fd, 5) < 0 )
- goto error;
- /* use select() to wait for a connect, so that we can timeout */
- FD_ZERO(&readfds);
- FD_SET(fd, &readfds);
- tv.tv_sec = GIO_TIMEOUT;
- tv.tv_usec = 0;
- if( select(fd+1, &readfds, NULL, NULL, &tv) <=0)
- goto error;
- /* accept connection -- the goal of our striving */
- slen = sizeof(struct sockaddr_in);
- if((fd2=accept(fd, (struct sockaddr *)&sock_in, &slen)) <0)
- goto error;
- /* done with the listening socket */
- close(fd);
- /* make sure we close on exec */
- xfcntl(fd2, F_SETFD, FD_CLOEXEC);
- setsockopt(fd2, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuse_addr, sizeof(reuse_addr));
- /* make sure the right fd is set properly */
- if( strchr(mode, 'r') ) gio->ifd = fd2;
- if( strchr(mode, 'w') ) gio->ofd = fd2;
- }
- /* open socket for writing, i.e., writing to 'stdout' on another host */
- else{
- tries = GIO_RETRIES;
- /* if we opened a socket for reading, use the next port for writing */
- if( gio->ifd >=0 )
- port++;
-again:
- if( (fd2 = socket(AF_INET, SOCK_STREAM, 0)) < 0 ){
- gerror(stderr, "can't open socket (%s)\n", name);
- gfree(gio);
- return(NULL);
- }
- memset((char *)&sock_in, 0, sizeof(sock_in));
- sock_in.sin_family = AF_INET;
- sock_in.sin_addr.s_addr = htonl(ip);
- sock_in.sin_port = htons(port);
- /* try connecting to the specified socket */
- status=connect(fd2, (struct sockaddr *)&sock_in, sizeof(sock_in));
- /* handle error */
- if( status != 0 ){
- close(fd2);
- /* if the other process is not ready, we can wait a bit */
- if( (errno == ECONNREFUSED) && (--tries >0) ){
- gsleep(10);
- goto again;
- }
- else{
- goto error;
- }
- }
- /* make sure we close on exec */
- xfcntl(fd2, F_SETFD, FD_CLOEXEC);
- setsockopt(fd2, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuse_addr, sizeof(reuse_addr));
- /* make sure the right fd is set properly */
- if( strchr(mode, 'r') ) gio->ifd = fd2;
- if( strchr(mode, 'w') ) gio->ofd = fd2;
- }
-
- /* fill in the record */
- gio->name = xstrdup(s);
- gio->mode = xstrdup(mode);
- gio->type = GIO_SOCKET;
- gio->extend = 0;
- /* return the good news */
- return(gio);
-
-error:
- snprintf(tbuf, SZ_LINE-1, "in %s: %s\n", name, strerror(errno));
- gerror(stderr, tbuf);
- if( fd >=0 ) close(fd);
- return(NULL);
-}
-
-/*
- *
- * gopenstdio -- open stdin or stdout
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopenstdio (char *name, char *mode)
-#else
-static GIO gopenstdio(name, mode)
- char *name;
- char *mode;
-#endif
-{
- GIO gio;
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- if( !strncasecmp(name, "stdout", 6) ||
- (!strncmp(name, "-", 1) && strchr(mode, 'w')) ){
- if( strchr(mode, 'r') ){
- gerror(stderr, "can't open STDOUT for reading\n");
- gfree(gio);
- return(NULL);
- }
- else{
- /* fill in the record */
- gio->name = xstrdup("stdout");
- gio->mode = xstrdup(mode);
- gio->type = GIO_STREAM;
- gio->extend = 0;
- gio->fp = stdout;
- }
- }
- /* look for stdin */
- else if( !strncasecmp(name, "stdin", 5) ||
- (!strncmp(name, "-", 1) && strchr(mode, 'r')) ){
- if( strchr(mode, 'w') ){
- gerror(stderr, "can't open STDIN for writing\n");
- gfree(gio);
- return(NULL);
- }
- else{
- /* fill in the record */
- gio->name = xstrdup("stdin");
- gio->mode = xstrdup(mode);
- gio->type = GIO_STREAM;
- gio->extend = 0;
- gio->fp = stdin;
- }
- }
- else{
- gerror(stderr, "invalid stdout specification (%s)\n", name);
- gfree(gio);
- return(NULL);
- }
- /* return the good news */
- return(gio);
-}
-
-#ifdef HAVE_SYS_SHM_H
-/*
- *
- * gopenshm -- open shared memory for reading or writing
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopenshm (char *name, char *mode)
-#else
-static GIO gopenshm(name, mode)
- char *name;
- char *mode;
-#endif
-{
- GIO gio;
- int shmid=-1;
- int shmkey=-1;
- int shmflg=0;
- int shmlen=0;
- int smode=0;
- char *shmaddr=NULL;
- char *shmbuf;
- char *s, *t;
- struct shmid_ds buf;
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* skip past prefix */
- s = name;
- if( !strncasecmp(s, "shm:", 4) ) s += 4;
- while( isspace((int)*s) ) s++;
-
- /* fill in the record */
- gio->name = xstrdup(s);
- gio->mode = xstrdup(mode);
- gio->type = GIO_SHM;
- gio->extend = 0;
-
- /* parse the shared memory specification */
- if( !s || !*s ){
- gerror(stderr, "missing shared memory specification\n");
- goto error;
- }
- /* @ => shmkey, otherwise shmid */
- if( *s == '@' ){
- s++;
- if( !strncasecmp(s, "IPC_PRIVATE", 11) ){
- shmkey = IPC_PRIVATE;
- s += 11;
- }
- else{
- shmkey = strtol(s, &t, 0);
- s = t;
- }
- }
- else{
- shmid = strtol(s, &t, 0);
- s = t;
- }
-
- /* get length parameter, if necessary */
- if( *s == ':' ){
- s++;
- shmlen = strtol(s, &t, 0);
- s = t;
- }
-
- /* convert key to id, if necessary */
- if( shmid == -1 ){
- if( shmkey != -1 ){
- /* create if segment des not exist */
- if( strstr(mode, "w+") ){
- smode = 0664|IPC_CREAT;
- }
- /* open for reading and/or writing */
- else{
- if( strchr(mode, 'w') )
- smode |= 0600;
- if( strchr(mode, 'r') )
- smode |= 0400;
- }
- /* get shared memory area identifier */
- shmid = shmget(shmkey, shmlen, smode);
- }
- else{
- gerror(stderr, "invalid shared memory key (%s)\n", name);
- goto error;
- }
- /* at this point, we better have one */
- if( shmid == -1 ){
- gerror(stderr, "invalid shared memory id (%s)\n", name);
- goto error;
- }
- }
-
- /* get (optional) max len we are allowed to access (def: whole segment) */
- if( shmctl(shmid, IPC_STAT, &buf) == 0 ){
- if( (shmlen <= 0) || ((size_t)shmlen > buf.shm_segsz) ){
- shmlen = buf.shm_segsz;
- }
- }
- else{
- gerror(stderr, "can't determine memory mapping length (%s)\n", name);
- goto error;
- }
-
- /* finally ... map shared memory containing data */
- shmbuf = (char *)shmat(shmid, shmaddr, shmflg);
- if( shmbuf == (char *)-1){
- gerror(stderr, "can't map shared memory image (%s)\n", name);
- goto error;
- }
-
- /* set the access parameters */
- gio->buf = shmbuf;
- gio->len = shmlen;
- gio->cur = 0;
- gio->shmid = shmid;
- /* return the good news */
- return(gio);
-
-error:
- gfree(gio);
- return(NULL);
-}
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-/*
- *
- * gopenmmap -- open memory mapped file for reading or writing
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopenmmap (char *name, char *mode)
-#else
-static GIO gopenmmap(name, mode)
- char *name;
- char *mode;
-#endif
-{
- GIO gio;
- int prot;
- int flags;
- int len;
- char *buf;
- char *s;
- struct stat statbuf;
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* skip past prefix */
- s = name;
- if( !strncasecmp(s, "mmap:", 5) ) s += 5;
- while( isspace((int)*s) ) s++;
-
- /* fill in the record */
- gio->name = xstrdup(s);
- gio->mode = xstrdup(mode);
- gio->type = GIO_MMAP;
-
- /* open the file */
- gio->fp = fopen(s, gio->mode);
- if( gio->fp == NULL ){
- gerror(stderr, "can't open data file (%s)\n", s);
- goto error;
- }
- fstat(fileno(gio->fp), &statbuf);
- len = statbuf.st_size;
- prot = 0;
- if( strchr(mode, 'r') ) prot |= PROT_READ;
- if( strchr(mode, 'w') ) prot |= PROT_WRITE;
- flags = MAP_PRIVATE;
- buf = mmap(NULL, len, prot, flags, fileno(gio->fp), 0);
- fclose(gio->fp);
- if( buf == NULL ){
- gerror(stderr, "can't mmap data file (%s)\n", s);
- goto error;
- }
- gio->buf = (void *)buf;
- gio->len = len;
- gio->cur = 0;
- if( strchr(mode, 'w') )
- gio->extend = 1;
- else
- gio->extend = 0;
- /* return the good news */
- return(gio);
-
-error:
- gfree(gio);
- return(NULL);
-}
-#endif
-
-/*
- *
- * gopengzip -- open gzip'ed for reading or writing
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopengzip (char *name, char *mode)
-#else
-static GIO gopengzip(name, mode)
- char *name;
- char *mode;
-#endif
-{
- GIO gio;
- char *s;
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* skip past prefix */
- s = name;
- if( !strncasecmp(s, "gzip:", 5) ) s += 5;
- while( isspace((int)*s) ) s++;
-
- /* fill in the record */
- gio->name = xstrdup(s);
- gio->mode = xstrdup(mode);
- gio->type = GIO_GZIP;
- gio->extend = 1;
-
- /* open stdin specially */
- if( !strncasecmp(name, "stdin", 5) ||
- (!strncmp(name, "-", 1) && strchr(mode, 'r')) ){
- gio->gz = (void *)gzdopen(dup(fileno(stdin)), gio->mode);
- }
- /* open stdout specially */
- else if( !strncasecmp(name, "stdout", 6) ||
- (!strncmp(name, "-", 1) && strchr(mode, 'w')) ){
- gio->gz = (void *)gzdopen(dup(fileno(stdout)), gio->mode);
- }
- /* open the file */
- else{
- gio->gz = (void *)gzopen(s, gio->mode);
- }
- if( gio->gz == NULL ){
- gerror(stderr, "can't open gzip'ed data file (%s)\n", s);
- goto error;
- }
- else{
- return(gio);
- }
-
-error:
- gfree(gio);
- return(NULL);
-}
-
-
-#ifdef ANSI_FUNC
-static void *
-_ggets (GIO gio, char *obuf, int len)
-#else
-static void *_ggets(gio, obuf, len)
- GIO gio;
- char *obuf;
- int len;
-#endif
-{
- int i, j, l;
- char *s=NULL;
- char *t=NULL;
-
- /* existence of crbuf => we already determined that the data uses cr
- instead of newline for end of line */
- if( gio->crbuf ){
- /* make sure we have a large enough buffer */
- if( len > gio->crlen ){
- gio->crbuf = xrealloc(gio->crbuf, len);
- gio->crlen = len;
- }
- /* grab from existing buffer, reading from file when necessary */
- for(i=0, j=0; i<(len-1);){
- /* did we reach the end of the cr buffer? */
- if( gio->crbuf[j] == '\0' ){
- /* yes, try to get more */
- if( !(s=fgets(gio->crbuf, gio->crlen, gio->fp)) ) break;
- /* reset cr buffer pointer to beginning */
- j = 0;
- /* continue processing at beginning of buffer */
- continue;
- }
- /* transfer character from cr buffer to output */
- obuf[i] = gio->crbuf[j];
- /* look for CR as end of line */
- if( obuf[i] == '\r' ){
- /* change it to a new-line */
- obuf[i++] = '\n';
- /* shift rest of start of cr buffer */
- memmove(gio->crbuf, &(gio->crbuf[j+1]), strlen(&(gio->crbuf[j+1]))+1);
- /* bump cr bbuf pointer */
- j++;
- break;
- }
- else{
- /* bump pointers to both buffers */
- i++; j++;
- }
- }
- obuf[i] = '\0';
- return((void *)obuf);
- }
- /* hopefully we have a nice, new-line delimited file */
- else{
- /* get next line, the usual way */
- s = fgets(obuf, len, gio->fp);
- /* return if we don't want t check, have no data, or already checked */
- if( !_gcrnl || !s || gio->crlen ) return s;
- /* if we did not get a new-line at the end, we either have a very long
- line, or we have a cr-delimited file */
- l = strlen(s);
- /* look for standard new-line */
- if( s[l-1] == '\n' ){
- /* found one -- flag that we have checked this file and return */
- gio->crlen=len;
- return s;
- }
- /* look for cr */
- if( !(t=strchr(s, '\r')) ){
- /* no new-line and no cr -- we'll have to check the next line as well */
- return s;
- }
- /* its cr-delimited */
- gio->crbuf = xmalloc(len);
- gio->crlen=len;
- /* copy everything after the cr to a save buffer */
- memmove(gio->crbuf, t+1, (s+l)-t);
- /* change cr to new-line */
- *t = '\n';
- /* null terminate */
- *(t+1) = '\0';
- return (void *)obuf;
- }
-}
-
-/*
- *
- * gopenfile -- open ordinary file for reading or writing
- *
- */
-#ifdef ANSI_FUNC
-static GIO
-gopenfile (char *name, char *mode)
-#else
-static GIO gopenfile(name, mode)
- char *name;
- char *mode;
-#endif
-{
- char *s;
- GIO gio;
-
-#if HAVE_MINGW32
- /* binary mode for mingw */
- _fmode = _O_BINARY;
-#endif
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* skip past prefix */
- s = name;
- if( !strncasecmp(s, "file:", 5) ) s += 5;
- if( !strncasecmp(s, "unfile:", 7) ){
- gio->unbuffered = 1;
- s += 7;
- }
- while( isspace((int)*s) ) s++;
-
- /* fill in the record */
- gio->name = xstrdup(s);
- gio->type = GIO_DISK;
- gio->extend = 1;
- gio->mode = xstrdup(mode);
-
- /* open the file */
- gio->fp = fopen(s, gio->mode);
- if( gio->fp == NULL ){
- gerror(stderr, "can't open data file (%s)\n", s);
- goto error;
- }
- else{
- return(gio);
- }
-
-error:
- gfree(gio);
- return(NULL);
-}
-
-/*
- *
- * Public Routines
- *
- */
-
-/*
- *
- * gopen -- open a file or a stream
- *
- */
-#ifdef ANSI_FUNC
-GIO
-gopen (char *fname, char *mode)
-#else
-GIO gopen(fname, mode)
- char *fname;
- char *mode;
-#endif
-{
- GIO gio;
- unsigned int ip;
- unsigned short port;
- off_t len=0;
- char name[SZ_LINE];
- char *buf=NULL;
- char *tname=NULL;
- char *s, *t;
-
- /* make sure we have a valid fname */
- if( (fname==NULL) || (*fname=='\0') )
- return(NULL);
-
- /* escape clause so that we can NOT convert cr to nl in ggets */
- if( (s=getenv("GCRNL")) ){
- if( istrue(s) )
- _gcrnl = 1;
- else if( isfalse(s) )
- _gcrnl = 0;
- }
-
- /* make a temp file name */
- tname = xstrdup(fname);
- /* remove the bracket extension for everything except pipes */
- if( strncasecmp(tname, "pipe:", 5) ){
- if( (s=strchr(tname, '[')) ) *s = '\0';
- }
-
- /* expand environment variables to get working filename */
- ExpandEnv (tname, name, SZ_LINE-1);
-
- /* look for an explicit file */
- if( !strncasecmp(name, "file:", 5) ||
- !strncasecmp(name, "unfile:", 7) || strchr(mode, 'u') )
- gio = gopenfile(name, mode);
- /* look for stdio */
- else if( (!strncasecmp(name, "stdin", 5) ||
- !strncasecmp(name, "stdout", 6)) &&
- !(gext(name) && !strcmp(gext(name),".gz")) )
- gio = gopenstdio(name, mode);
- else if( (*name == '-') && ((*(name+1) == '\0') || (*(name+1) == '[')) )
- gio = gopenstdio(name, mode);
-#if HAVE_MINGW32==0
- /* look for command pipe */
- else if( !strncasecmp(name, "pipe:", 5) || strchr(mode, 'p') )
- gio = gopenpipe(name, mode);
-#endif
-#ifdef HAVE_SYS_MMAN_H
- /* look for a mapped file */
- else if( !strncasecmp(name, "mmap:", 5) || strchr(mode, 'm') )
- gio = gopenmmap(name, mode);
-#endif
-#ifdef HAVE_SYS_SHM_H
- /* look for shared memory segment */
- else if( !strncasecmp(name, "shm:", 4) || strchr(mode, 's') )
- gio = gopenshm(name, mode);
-#endif
- /* look for data in memory (ordinary buffer) */
- else if( !strncasecmp(name, "mem:", 4) ||
- !strncasecmp(name, "buf:", 4) || strchr(mode, 'b') ){
- s = name;
- if( !strncasecmp(name, "mem:", 4) || !strncasecmp(name, "buf:", 4) )
- s += 4;
- buf = (char *)strtoul(s, &t, 0);
- if( *t != ':' ){
- gerror(stderr, "illegal memory buffer specification (%s)\n", name);
- gio = NULL;
- }
- else{
- len = (off_t)strtoul(++t, NULL, 0);
- gio = gmemopen(buf, len, mode);
- }
- }
- /* look for a socket, in the form machine:port */
- else if( gioparseipport(name, &ip, &port) )
- gio = gopensocket(name, mode);
- /* look for gzip'ed file */
- else if( !strncasecmp(name, "gzip:", 5) ||
- (gext(name) && !strcmp(gext(name),".gz")) )
- gio = gopengzip(name, mode);
- /* if all else fails, its an ordinary file */
- else
- gio = gopenfile(name, mode);
-
- /* free working space */
- if( tname ) xfree(tname);
-
- /* return results */
- return(gio);
-}
-
-/*
- *
- * gmemopen -- open memory for reading or writing
- *
- */
-#ifdef ANSI_FUNC
-GIO
-gmemopen (char *buf, off_t len, char *mode)
-#else
-GIO gmemopen(buf, len, mode)
- char *buf;
- off_t len;
- char *mode;
-#endif
-{
- GIO gio;
-
- /* allocate a new struct */
- if( (gio = gnew()) == NULL )
- return(NULL);
-
- /* fill in the record */
- gio->name = xstrdup("MEMORY");
- gio->mode = xstrdup(mode);
- gio->type = GIO_MEMORY;
-
- /* process open type */
- if( strchr(mode, 'w') ){
- if( (buf!=NULL) && (len>0) ){
- gio->buf = (void *)buf;
- gio->len = len;
- }
- else{
- gio->buf = (char *)xmalloc(GIO_BUFINC);
- gio->len = GIO_BUFINC;
- }
- gio->cur = 0;
- gio->extend = 1;
- } else {
- gio->buf = (void *)buf;
- gio->len = len;
- gio->cur = 0;
- gio->extend = 0;
- }
-
- /* return the news */
- return(gio);
-}
-
-/*
- *
- * _gread -- read bytes from a data I/O structure
- *
- */
-#ifdef ANSI_FUNC
-void *
-_gread (GIO gio, char *buf, size_t size, size_t n, size_t *got)
-#else
-void *_gread(gio, buf, size, n, got)
- GIO gio;
- char *buf;
- size_t size;
- size_t n;
- size_t *got;
-#endif
-{
- char *obuf;
- char *tptr;
- int get;
- int tgot;
-
- /* got nothing yet */
- *got = 0;
-
- /* sanity checks */
- if( gio==NULL )
- return(NULL);
- if( !strchr(gio->mode, 'r') && !strstr(gio->mode, "w+") ){
- gerror(stderr,
- "illegal read operation on write-only data (%s)\n", gio->name);
- return(NULL);
- }
-
- /* try to read */
- switch(gio->type){
- case GIO_DISK:
- if( buf )
- obuf = buf;
- else
- obuf = (char *)xmalloc(size*n);
- if( gio->unbuffered ){
- for(tptr=obuf, get=size*n; get>0; get -= tgot){
- tgot = read(fileno(gio->fp), tptr, get);
- if( tgot <0 ) {
- *got = tgot;
- break;
- }
- if( tgot == 0 ){
- break;
- }
- else{
- *got += tgot;
- tptr += tgot;
- }
- }
- if( *got >0 )
- *got /= size;
- }
- else{
- *got = fread(obuf, size, n, gio->fp);
- }
- if( *got <= 0 ){
- if( !buf )
- xfree(obuf);
- obuf = NULL;
- }
- return(obuf);
- case GIO_STREAM:
- if( buf )
- obuf = buf;
- else
- obuf = (char *)xmalloc(size*n);
- *got = fread(obuf, size, n, gio->fp);
- if( *got <= 0 ){
- if( !buf )
- xfree(obuf);
- obuf = NULL;
- }
- return(obuf);
- case GIO_MEMORY:
- return(gmemread(gio, buf, size, n, got));
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- return(gmemread(gio, buf, size, n, got));
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- return(gmemread(gio, buf, size, n, got));
-#endif
- case GIO_PIPE:
- if( buf )
- obuf = buf;
- else
- obuf = (char *)xmalloc(size*n);
- if( gio->ifd >=0 ){
- for(tptr=obuf, get=size*n; get>0; get -= tgot){
- tgot = read(gio->ifd, tptr, get);
- if( tgot <0 ) {
- *got = tgot;
- break;
- }
- else if( tgot ==0 ) {
- break;
- }
- else{
- *got += tgot;
- tptr += tgot;
- }
- }
- if( *got > 0 )
- *got /= size;
- }
- if( *got <= 0 ){
- if( !buf )
- xfree(obuf);
- obuf = NULL;
- }
- else{
- gio->cur += *got;
- }
- return(obuf);
- case GIO_SOCKET:
- if( buf )
- obuf = buf;
- else
- obuf = (char *)xmalloc(size*n);
- if( gio->ifd >=0 ){
- for(tptr=obuf, get=size*n; get>0; get -= tgot){
- tgot = recv(gio->ifd, tptr, get, 0);
- if( tgot <0 ) {
- *got = tgot;
- break;
- }
- else if( tgot == 0 ) {
- break;
- }
- else{
- *got += tgot;
- tptr += tgot;
- }
- }
- if( *got > 0 )
- *got /= size;
- }
- if( *got <= 0 ){
- if( !buf )
- xfree(obuf);
- obuf = NULL;
- }
- else{
- gio->cur += *got;
- }
- return(obuf);
- case GIO_GZIP:
- if( buf )
- obuf = buf;
- else
- obuf = (char *)xmalloc(size*n);
- *got = gzread(gio->gz, obuf, size * n);
- if( *got <= 0 ){
- if( !buf )
- xfree(obuf);
- obuf = NULL;
- }
- if( *got >0 )
- *got /= size;
- return(obuf);
- default:
- return(NULL);
- }
-}
-
-/*
- *
- * gread -- read bytes from a data I/O structure
- *
- */
-#ifdef ANSI_FUNC
-size_t
-gread (GIO gio, char *buf, size_t size, size_t n)
-#else
-size_t gread(gio, buf, size, n)
- GIO gio;
- char *buf;
- size_t size;
- size_t n;
-#endif
-{
- size_t got;
- if( buf == NULL )
- return(0);
- _gread(gio, buf, size, n, &got);
- return (got);
-}
-
-/*
- *
- * gwrite -- write bytes to a structure
- *
- */
-#ifdef ANSI_FUNC
-size_t
-gwrite (GIO gio, char *buf, size_t size, size_t n)
-#else
-size_t gwrite(gio, buf, size, n)
- GIO gio;
- char *buf;
- size_t size;
- size_t n;
-#endif
-{
- int got=0;
-
- /* sanity checks */
- if( gio==NULL )
- return(0);
- if( !strchr(gio->mode, 'w') && !strchr(gio->mode, 'a') &&
- !strstr(gio->mode, "r+") ){
- gerror(stderr,
- "illegal write operation on read-only data (%s)\n", gio->name);
- return(0);
- }
-
- switch(gio->type){
- case GIO_DISK:
- if( gio->unbuffered ){
- got = write(fileno(gio->fp), buf, size*n);
- if( got > 0 ) got /= size;
- }
- else{
- got = fwrite(buf, size, n, gio->fp);
- }
- break;
- case GIO_STREAM:
- got = fwrite(buf, size, n, gio->fp);
- break;
- case GIO_MEMORY:
- got = gmemwrite(gio, buf, size, n);
- break;
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- got = gmemwrite(gio, buf, size, n);
- break;
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- got = gmemwrite(gio, buf, size, n);
- break;
-#endif
- case GIO_PIPE:
- if( gio->ofd >= 0 ){
- got = write(gio->ofd, buf, size * n);
- if( got > 0 ){
- gio->cur += got;
- got /= size;
- }
- }
- break;
- case GIO_SOCKET:
- if( gio->ofd >= 0 ){
- got = send(gio->ofd, buf, size * n, 0);
- if( got > 0 ){
- gio->cur += got;
- got /= size;
- }
- }
- break;
- case GIO_GZIP:
- got = gzwrite(gio->gz, buf, size*n);
- if( got >=0 ) got /= size;
- break;
- default:
- break;
- }
- return(got);
-}
-
-#ifdef ANSI_FUNC
-void *
-ggets (GIO gio, char *buf, int len)
-#else
-void *ggets(gio, buf, len)
- GIO gio;
- char *buf;
- int len;
-#endif
-{
- int i=0;
- int got;
- char *obuf=NULL;
-
- /* sanity checks */
- if( !gio )
- return NULL;
- if( !strchr(gio->mode, 'r') && !strstr(gio->mode, "w+") ){
- gerror(stderr,
- "illegal read operation on write-only data (%s)\n", gio->name);
- return NULL;
- }
-
- /* allocate buffer, if necessary */
- if( buf )
- obuf = buf;
- else
- obuf = (char *)xmalloc(len);
-
- /* start out clean */
- *obuf = '\0';
-
- switch(gio->type){
- case GIO_STREAM:
- _ggets(gio, obuf, len);
- if( !obuf || !*obuf ){
- if( !buf ) xfree(obuf);
- obuf = NULL;
- }
- return obuf;
- case GIO_DISK:
- if( !gio->unbuffered ){
- _ggets(gio, obuf, len);
- if( !obuf || !*obuf ){
- if( !buf ) xfree(obuf);
- obuf = NULL;
- }
- return obuf;
- }
- default:
- /* grab characters up to a new-line or max len */
- while( i < (len-1) ){
- got = gread(gio, &(obuf[i]), sizeof(char), 1);
- if( got < 0 ){
- i = 0;
- break;
- }
- else if( got == 0 )
- break;
- else if( obuf[i] == '\n' ){
- i++;
- break;
- }
- else if( (obuf[i] == '\r') && _gcrnl ){
- obuf[i] = '\n';
- i++;
- break;
- }
- else{
- i++;
- }
- }
- obuf[i] = '\0';
- if( i == 0 ){
- if( !buf ) xfree(obuf);
- obuf = NULL;
- }
- return((void *)obuf);
- }
-}
-
-#ifdef __STDC__
-int
-gprintf(GIO gio, char *format, ...)
-{
- int got;
- va_list args;
- va_start(args, format);
-#else
-int gprintf(va_alist) va_dcl
-{
- GIO gio
- char *format;
- int got;
- va_list args;
-
- va_start(args);
- gio = va_arg(args, GIO);
- format = va_arg(args, char *);
-#endif
- got = vsnprintf(_gtbuf, GBUFSZ, format, args);
- if( got > GBUFSZ ){
- gerror(stderr, "gprintf string too long (%d > %d)\n", got, GBUFSZ);
- return -1;
- }
- else{
- return gwrite(gio, _gtbuf, sizeof(char), strlen(_gtbuf));
- }
-}
-
-/*
- *
- * gflush -- flush I/O
- *
- */
-#ifdef ANSI_FUNC
-int
-gflush (GIO gio)
-#else
-int gflush(gio)
- GIO gio;
-#endif
-{
- /* sanity checks */
- if( gio==NULL )
- return(-1);
-
- switch(gio->type){
- case GIO_DISK:
- if( gio->unbuffered )
- return(0);
- else
- return(fflush(gio->fp));
- case GIO_STREAM:
- return(fflush(gio->fp));
- case GIO_MEMORY:
- return(0);
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- return(0);
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- return(0);
-#endif
- case GIO_PIPE:
- return(0);
- case GIO_SOCKET:
- return(0);
- case GIO_GZIP:
- return(0);
- default:
- return(-1);
- }
-}
-
-/*
- *
- * gseek -- set current pointer position in a "file"
- *
- */
-#ifdef ANSI_FUNC
-off_t
-gseek (GIO gio, off_t offset, int whence)
-#else
-off_t gseek(gio, offset, whence)
- GIO gio;
- off_t offset;
- int whence;
-#endif
-{
- off_t opos;
- /* sanity checks */
- if( gio==NULL )
- return(-1);
-
- switch(gio->type){
- case GIO_DISK:
- if( gio->unbuffered )
- return(lseek(fileno(gio->fp), offset, whence));
- else{
-#if USE_FSEEKO
- opos = ftello(gio->fp);
- if( fseeko(gio->fp, offset, whence) == 0 ){
- return(opos);
- }
- else{
- return(-1);
- }
-#else
- opos = ftell(gio->fp);
- if( fseek(gio->fp, (long)offset, whence) == 0 ){
- return(opos);
- }
- else{
- return(-1);
- }
-#endif
- }
- case GIO_STREAM:
- if( whence == SEEK_CUR )
- return( gskip(gio, offset) );
- else{
-#if USE_FSEEKO
- opos = ftello(gio->fp);
- if( fseeko(gio->fp, offset, whence) == 0 ){
- return(opos);
- }
- else{
- return(-1);
- }
-#else
- opos = ftell(gio->fp);
- if( fseek(gio->fp, (long)offset, whence) == 0 ){
- return(opos);
- }
- else{
- return(-1);
- }
-#endif
- }
- case GIO_MEMORY:
- return(gmemseek(gio, offset, whence));
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- return(gmemseek(gio, offset, whence));
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- return(gmemseek(gio, offset, whence));
-#endif
- case GIO_PIPE:
- if( whence == SEEK_CUR )
- return( gskip(gio, offset) );
- else
- return(-1);
- case GIO_SOCKET:
- if( whence == SEEK_CUR )
- return( gskip(gio, offset) );
- else
- return(-1);
- case GIO_GZIP:
- return(gzseek(gio->gz, offset, whence));
- default:
- return(-1);
- }
-}
-
-/*
- *
- * gtell -- return current pointer position in a "file"
- *
- */
-#ifdef ANSI_FUNC
-off_t
-gtell (GIO gio)
-#else
-off_t gtell(gio)
- GIO gio;
-#endif
-{
-#if USE_FTELLO
- off_t lval;
-#else
- long lval;
-#endif
- /* sanity checks */
- if( gio==NULL )
- return((off_t)-1);
-
- switch(gio->type){
- case GIO_DISK:
- if( gio->unbuffered )
- return(lseek(fileno(gio->fp), 0, SEEK_CUR));
- else
-#if USE_FTELLO
- return(ftello(gio->fp));
-#else
- return(ftell(gio->fp));
-#endif
- case GIO_STREAM:
-#if USE_FTELLO
- lval = ftello(gio->fp);
-#else
- lval = ftell(gio->fp);
-#endif
- if( lval >=0 )
- return lval;
- else
- return gio->cur;
- case GIO_MEMORY:
- return(gio->cur);
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- return(gio->cur);
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- return(gio->cur);
-#endif
- case GIO_PIPE:
- return(gio->cur);
- case GIO_SOCKET:
- return(gio->cur);
- case GIO_GZIP:
- return(gztell(gio->gz));
- default:
- return((off_t)-1);
- }
-}
-
-/*
- *
- * gskip - skip reading bytes to a file position
- *
- */
-#ifdef ANSI_FUNC
-int
-gskip (GIO gio, off_t n)
-#else
-int gskip(gio, n)
- GIO gio;
- off_t n;
-#endif
-{
- char buf[1];
-
- /* sanity checks */
- if( !gio )
- return(-1);
-
- /* nothing to do */
- if( !n )
- return 0;
-
- switch(gio->type){
- case GIO_DISK:
- if( gio->unbuffered )
- return(lseek(fileno(gio->fp), n, SEEK_CUR));
- else
-#if USE_FSEEKO
- return(fseeko(gio->fp, n, SEEK_CUR));
-#else
- return(fseek(gio->fp, (long)n, SEEK_CUR));
-#endif
- case GIO_STREAM:
- /* for stdin, read the bytes */
- if( gio->fp == stdin ){
- if( n < 0 )
- return(-1);
- while( n-- ){
- if( fread(buf, sizeof(char), 1, gio->fp) != 1 )
- return(0);
- }
- return(0);
- }
- /* who knows what will happen here */
- else{
-#if USE_FSEEKO
- return(fseeko(gio->fp, n, SEEK_CUR));
-#else
- return(fseek(gio->fp, (long)n, SEEK_CUR));
-#endif
- }
- case GIO_MEMORY:
- if( (gio->cur + n >= gio->len) || (gio->cur + n <0) ){
- return(-1);
- }
- else{
- gio->cur += n;
- return(0);
- }
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- if( (gio->cur + n >= gio->len) || (gio->cur + n <0) ){
- return(-1);
- }
- else{
- gio->cur += n;
- return(0);
- }
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- if( (gio->cur + n >= gio->len) || (gio->cur + n <0) ){
- return(-1);
- }
- else{
- gio->cur += n;
- return(0);
- }
-#endif
- case GIO_PIPE:
- if( n < 0 )
- return(-1);
- if( gio->ifd >= 0 ){
- while( n-- ){
- if( read(gio->ifd, buf, 1) != 1 )
- return(0);
- gio->cur++;
- }
- return(0);
- }
- else{
- return(-1);
- }
- case GIO_SOCKET:
- if( n < 0 )
- return(-1);
- if( gio->ifd >= 0 ){
- while( n-- ){
- if( recv(gio->ifd, buf, 1, 0) != 1 )
- return(0);
- gio->cur++;
- }
- return(0);
- }
- else{
- return(-1);
- }
- case GIO_GZIP:
- return(gzseek(gio->gz, (z_off_t)n, SEEK_CUR));
- default:
- return(-1);
- }
-}
-
-/*
- *
- * ginfo -- return information about a "file"
- *
- */
-#ifdef ANSI_FUNC
-int
-ginfo (GIO gio, char **name, int *type, off_t *cur, char **buf, int *len)
-#else
-int ginfo(gio, name, type, cur, buf, len)
- GIO gio;
- char **name;
- int *type;
- off_t *cur;
- char **buf;
- int *len;
-#endif
-{
- if( gio==NULL )
- return(-1);
- if( name )
- *name = gio->name;
- if( type )
- *type = gio->type;
- if( cur )
- *cur = gtell(gio);
- if( buf )
- *buf = gio->buf;
- if( len )
- *len = gio->len;
- return(0);
-}
-
-/*
- *
- * gfreebuf -- free allocated data buffers
- *
- */
-#ifdef ANSI_FUNC
-void
-gfreebuf (GIO gio, void *buf)
-#else
-void gfreebuf(gio, buf)
- GIO gio;
- void *buf;
-#endif
-{
- if( gio==NULL )
- return;
-
- switch(gio->type){
- case GIO_DISK:
- if( buf )
- xfree(buf);
- break;
- case GIO_STREAM:
- if( buf )
- xfree(buf);
- break;
- case GIO_MEMORY:
- break;
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- break;
-#endif
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- break;
-#endif
- case GIO_PIPE:
- if( buf )
- xfree(buf);
- break;
- case GIO_SOCKET:
- if( buf )
- xfree(buf);
- break;
- case GIO_GZIP:
- if( buf )
- xfree(buf);
- break;
- default:
- break;
- }
-}
-
-/*
- *
- * gclose -- close an I/O structure
- *
- */
-#ifdef ANSI_FUNC
-void
-gclose (GIO gio)
-#else
-void gclose(gio)
- GIO gio;
-#endif
-{
- int status;
-
- /* sanity checks */
- if( gio==NULL )
- return;
-
- switch(gio->type){
- case GIO_DISK:
- if( gio->unbuffered ){
- fclose(gio->fp);
- }
- else{
- fflush(gio->fp);
- fclose(gio->fp);
- }
- break;
- case GIO_STREAM:
- fflush(gio->fp);
- /* close stream, but don't close a stdio stream */
- if( (gio->fp != stdin) && (gio->fp != stdout) && (gio->fp != stderr) )
- fclose(gio->fp);
- break;
-#ifdef HAVE_SYS_MMAN_H
- case GIO_MMAP:
- munmap(gio->buf, gio->len);
- break;
-#endif
- case GIO_MEMORY:
- break;
-#ifdef HAVE_SYS_SHM_H
- case GIO_SHM:
- /* unmap shared memory segment */
- shmdt(gio->buf);
- /* in write+ mode, we try to destroy the shared memory as well */
- if( strstr(gio->mode, "w+") ) shmctl(gio->shmid, IPC_RMID, NULL);
- break;
-#endif
- case GIO_PIPE:
- if( gio->ifd >=0 )
- close(gio->ifd);
- if( gio->ofd >=0 )
- close(gio->ofd);
-#if HAVE_MINGW32==0
- if( gio->pid )
- waitpid(gio->pid, &status, 0);
-#endif
- break;
- case GIO_SOCKET:
- if( gio->ifd >=0 )
- close(gio->ifd);
- else if( gio->ofd >=0 )
- close(gio->ofd);
- break;
- case GIO_GZIP:
- gzclose(gio->gz);
- break;
- default:
- break;
- }
- gfree(gio);
-}
-
-/*
- *
- * gerrorstring -- return last exception string
- *
- */
-#ifdef ANSI_FUNC
-char *
-gerrorstring(void)
-#else
-char *gerrorstring()
-#endif
-{
- return(_gerrors);
-}
-
-/*
- *
- * setgerror -- set the error flag
- *
- */
-#ifdef ANSI_FUNC
-int
-setgerror(int flag)
-#else
-int setgerror(flag)
- int flag;
-#endif
-{
- int oflag;
- oflag = _gerror;
- _gerror = flag;
- return oflag;
-}
-
-/*
- *
- * gerror - error message handler
- * actions based on value of error flag:
- *
- * flag action
- * ---- ------
- * 0 store error message in _gerrors string
- * 1 store, print error message and continue
- * 2 print error message and exit
- *
- */
-#ifdef __STDC__
-void gerror(FILE *fd, char *format, ...)
-{
- char tbuf[SZ_LINE];
- va_list args;
- va_start(args, format);
-#else
-void gerror(va_alist) va_dcl
-{
- FILE *fd;
- char *format;
- char tbuf[SZ_LINE];
- va_list args;
-
- va_start(args);
- fd = va_arg(args, FILE *);
- format = va_arg(args, char *);
-#endif
- /* initialize level, if not already done */
- if( _gerror == -1 ){
- char *s;
- if( (s=getenv("GERROR")) )
- _gerror = atoi(s);
- else
- _gerror = 2;
- }
- snprintf(tbuf, SZ_LINE-1, "ERROR: %s", format);
- vsnprintf(_gerrors, SZ_LINE-1, tbuf, args);
- /* if the error flag is positive, we output immediately */
- if( (fd != NULL) && _gerror ){
- fputs(_gerrors, fd);
- fflush(fd);
- }
- /* if the error flag is set high, we exit */
- if( _gerror >= 2 )
- exit(_gerror);
-}
-
-/*
- *
- * gwarningstring -- return last exception string
- *
- */
-#ifdef ANSI_FUNC
-char *
-gwarningstring(void)
-#else
-char *gwarningstring()
-#endif
-{
- return(_gwarnings);
-}
-
-/*
- *
- * setgwarning -- set the warning flag
- *
- */
-#ifdef ANSI_FUNC
-int
-setgwarning(int flag)
-#else
-int setgwarning(flag)
- int flag;
-#endif
-{
- int oflag;
- oflag = _gwarning;
- _gwarning = flag;
- return oflag;
-}
-
-#ifdef __STDC__
-void gwarning(FILE *fd, char *format, ...)
-{
- char tbuf[SZ_LINE];
- va_list args;
- va_start(args, format);
-#else
-void gwarning(va_alist) va_dcl
-{
- FILE *fd;
- char *format;
- char tbuf[SZ_LINE];
- va_list args;
-
- va_start(args);
- fd = va_arg(args, FILE *);
- format = va_arg(args, char *);
-#endif
- /* initialize level, if not already done */
- if( _gwarning == -1 ){
- char *s;
- if( (s=getenv("GWARNING")) )
- _gwarning = atoi(s);
- else
- _gwarning = 1;
- }
- snprintf(tbuf, SZ_LINE-1, "WARNING: %s", format);
- vsnprintf(_gwarnings, SZ_LINE-1, tbuf, args);
- /* if the warning flag is positive, we output immediately */
- if( (fd != NULL) && _gwarning ){
- fputs(_gwarnings, fd);
- fflush(fd);
- }
-}
-
-#ifdef ANSI_FUNC
-void
-gsleep (int msec)
-#else
-void gsleep(msec)
- int msec;
-#endif
-{
- struct timeval tv;
- if( msec > 0 ){
- tv.tv_sec = msec / 1000;
- tv.tv_usec = (msec % 1000) * 1000;
- select(1, NULL, NULL, NULL, &tv);
- }
-}
diff --git a/funtools/util/gio.h b/funtools/util/gio.h
deleted file mode 100644
index 1331550..0000000
--- a/funtools/util/gio.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * GIO.H -- include file for gio.c
- *
- */
-
-#ifndef _gio_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include "xport.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_SHM_H
-#include <sys/shm.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include "prsetup.h"
-#include "xalloc.h"
-
-/* use ftello/fseeko (assuming its available) if we are using 64-bit offsets */
-#if _FILE_OFFSET_BITS == 64
-
-#ifdef USE_FTELLO
-#undef USE_FTELLO
-#endif
-#if HAVE_FTELLO
-#define USE_FTELLO 1
-#endif
-
-#ifdef USE_FSEEKO
-#undef USE_FSEEKO
-#endif
-#if HAVE_FSEEKO
-#define USE_FSEEKO 1
-#endif
-
-#endif
-
-/* make sure socklen_t is available, since some systems don't use it */
-#ifndef HAVE_SOCKLEN_T
-#define socklen_t int
-#endif
-
-/* define the types of "file" we can open */
-#define GIO_DISK 1
-#define GIO_STREAM 2
-#define GIO_MEMORY 4
-#define GIO_MMAP 8
-#define GIO_SHM 16
-#define GIO_PIPE 32
-#define GIO_SOCKET 64
-#define GIO_GZIP 128
-
-/* define the size of the memory buffer increment we allocate */
-#define GIO_BUFINC 81920
-
-/* define socket parameters */
-#define GIO_RETRIES 6000
-#define GIO_MAXLISTEN 1000
-#define GIO_TIMEOUT 60
-
-typedef struct {
- int type;
- char *name;
- char *mode;
- /* memory types */
- char *buf;
- off_t len;
- off_t cur;
- int extend;
- /* disk files and streams */
- FILE *fp;
- int unbuffered;
- /* gzip */
- void *gz;
- /* shared memory */
- int shmid;
- /* command pipes and sockets */
- int pid;
- int ifd;
- int ofd;
- /* cr-delimited files */
- char *crbuf;
- int crlen;
-} *GIO, GIORec, GFile;
-
-_PRbeg
-
-GIO gopen _PRx((char *name, char *mode));
-GIO gmemopen _PRx((char *buf, off_t len, char *mode));
-void *_gread _PRx((GIO gio, char *buf, size_t size, size_t n, size_t *got));
-size_t gread _PRx((GIO gio, char *buf, size_t size, size_t n));
-size_t gwrite _PRx((GIO gio, char *buf, size_t size, size_t n));
-void *ggets _PRx((GIO gio, char *buf, int len));
-int gflush _PRx((GIO gio));
-
-off_t gseek _PRx((GIO gio, off_t offset, int whence));
-off_t gtell _PRx((GIO gio));
-int gskip _PRx((GIO gio, off_t n));
-int ginfo _PRx((GIO gio,
- char **name, int *type, off_t *cur, char **buf, int *len));
-void gfreebuf _PRx((GIO gio, void *buf));
-void gclose _PRx((GIO gio));
-int setgerror _PRx((int flag));
-char *gerrorstring _PRx((void));
-#ifdef __STDC__
-int gprintf(GIO gio, char *format, ...);
-void gerror(FILE *fd, char *format, ...);
-void gwarning(FILE *fd, char *format, ...);
-#else
-int gprintf();
-void gerror();
-void gwarning();
-#endif
-int setgwarning _PRx((int flag));
-char *gwarningstring _PRx((void));
-void gsleep _PRx((int millisec));
-
-#if USE_FTELLO
-off_t ftello _PRx((FILE *stream));
-#endif
-#if USE_FSEEKO
-int fseeko _PRx((FILE *stream, off_t offset, int whence));
-#endif
-
-_PRend
-
-#define _gio_h
-
-#endif
diff --git a/funtools/util/install-sh b/funtools/util/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/util/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/util/iraf_zprocess.c b/funtools/util/iraf_zprocess.c
deleted file mode 100644
index a9fd96e..0000000
--- a/funtools/util/iraf_zprocess.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * zprocess.c -- routines to start up and communicate with a slave process
- *
- * based on zfiopr.c from NOAO IRAF system
- *
- */
-
-#include <zprocess.h>
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-static int pr_debug = 0;
-
-/*
- *
- * Process table management code
- *
- */
-
-#define MAXPROCS 512
-
-static struct proctable {
- int pr_pid; /* process id */
- int pr_active; /* if YES, process is still active */
- int pr_inchan; /* input IPC channel */
- int pr_outchan; /* output IPC channel */
- int pr_exit_status; /* process exit_status */
-} prtable[MAXPROCS];
-
-/* PR_FINDPID -- Search the process table for a process. NULL is returned if
- * the process cannot be found, otherwise a pointer to the table entry is
- * returned.
- */
-#ifdef ANSI_FUNC
-static struct proctable *pr_findpid(int pid)
-#else
-static struct proctable *pr_findpid(pid)
- int pid;
-#endif
-{
- register int pr;
-
- for (pr=0; pr<MAXPROCS; pr++){
- if (prtable[pr].pr_pid == pid)
- return (&prtable[pr]);
- }
- return (NULL);
-}
-
-/* PR_ENTER -- Make a new entry in the process table. Something is very wrong
- * if the table overflows.
- */
-#ifdef ANSI_FUNC
-static int
-pr_enter(int pid, int inchan, int outchan)
-#else
-static int pr_enter(pid, inchan, outchan)
- int pid;
- int inchan, outchan;
-#endif
-{
- int pr;
-
- for (pr=0; pr<MAXPROCS; pr++){
- if (prtable[pr].pr_pid == 0){
- prtable[pr].pr_pid = pid;
- prtable[pr].pr_active = 1;
- prtable[pr].pr_inchan = inchan;
- prtable[pr].pr_outchan = outchan;
- return(1);
- }
- }
- return(0);
-}
-
-/* PR_GETCHAN -- Get the codes for the IPC channels assigned to a process.
- */
-#ifdef ANSI_FUNC
-static int pr_getchan (int pid, int *inchan, int *outchan)
-#else
-static int pr_getchan (pid, inchan, outchan)
- int pid;
- int *inchan, *outchan;
-#endif
-{
- register struct proctable *pr;
-
- /* Lookup process in table. Return an error if there is no entry.
- */
- if ((pr = pr_findpid(pid)) == NULL)
- return(-1);
- else {
- *inchan = pr->pr_inchan;
- *outchan = pr->pr_outchan;
- return (pid);
- }
-}
-
-/* PR_RELEASE -- Release the table entry for the process. Used when a process
- * is killed and we do not wish to wait for process termination.
- */
-#ifdef ANSI_FUNC
-static void
-pr_release (int pid)
-#else
-static void pr_release (pid)
- int pid;
-#endif
-{
- register struct proctable *pr;
-
- if ((pr = pr_findpid (pid)) != NULL){
- pr->pr_pid = 0;
- pr->pr_active = 0;
- pr->pr_inchan = 0;
- pr->pr_outchan = 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: PRSleep
- *
- * Purpose: sleep for specified milliseconds
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static void
-PRSleep (int msec)
-#else
-static void PRSleep(msec)
- int msec;
-#endif
-{
- struct timeval tv;
-
- if( msec > 0 ){
- tv.tv_sec = msec / 1000;
- tv.tv_usec = (msec % 1000) * 1000;
- select(1, NULL, NULL, NULL, &tv);
- }
-}
-
-/*
- *
- * Public Routines
- *
- *
- */
-
-/*
- *
- * ProcessOpen --
- * Open a connected subprocess. Spawn process and open bidirectional
- * IPC channels, implemented with pipes for this version of Berkeley UNIX.
- *
- */
-#ifdef ANSI_FUNC
-int
-ProcessOpen(char *osfn, char **argv, int *inchan, int *outchan, int *pid)
-#else
-int ProcessOpen(osfn, argv, inchan, outchan, pid)
- char *osfn; /* name of executable file */
- char **argv; /* argument list */
- int *inchan, *outchan; /* IPC channels (parent reads inchan) */
- int *pid; /* returned process id */
-#endif
-{
- int pin[2], pout[2];
- int maxforks = 3;
- char **targv;
- char *args[2];
- char *prog=NULL;
- static char *path;
-
- if (pr_debug)
- fprintf (stderr, "ProcessOpen: '%s'", (char *)osfn);
-
- if( path == NULL ){
- path = (char *)getenv("PATH");
- }
-
- /* Check that the process file exists and is executable.
- */
- if( (prog = Find(osfn, "x", NULL, path)) == NULL ){
- *pid = 0;
- return(0);
- }
-
- /* open pipes */
- pipe(pin);
- if( pipe(pout) != 0){
- *pid = 0;
- return(0);
- }
-
- /* Create child process. The child inherits the open stdio files.
- * The fork can fail if swap space is full or if we have too many processes.
- */
- while ((*pid = fork()) == -1) {
- if (--maxforks == 0) {
- close (pin[0]); close (pin[1]);
- close (pout[0]); close (pout[1]);
- *pid = 0;
- return(0);
- }
- sleep (2);
- }
-
- if (*pid == 0) {
-
- /* New child process. Make child think the pipe is its stdin/out.
- */
- close (pin[0]);
- close (pout[1]);
- close (0); dup (pout[0]); close (pout[0]);
- close (1); dup (pin[1]); close (pin[1]);
-
-#ifdef IRAF_ONLY
- /* Disable SIGINT so that child process does not die when the
- * parent process is interrupted. The child should get an EOF
- * on reading or writing and clean itself up.
- */
- signal (SIGINT, SIG_IGN);
-#endif
-
- /* Exec the new process. Will not return if successful.
- */
- if( argv != NULL ){
- targv = argv;
- }
- else {
- targv = args;
- args[0] = prog;
- args[1] = NULL;
- }
- execv(prog, (void *)targv);
-
- /* If we get here the new process could not be executed for some
- * reason. Shutdown, calling _exit to avoid flushing parent's
- * io buffers.
- */
- _exit (1);
-
- } else {
-
- /* Existing, parent process. */
- close (pin[1]);
- close (pout[0]);
- *inchan = pin[0];
- *outchan = pout[1];
-
- /* Save pid in parent's process table. Entry cleared when
- * CloseProcess is called to wait for process to terminate. Also save
- * channel numbers in process table since only the pid is passed
- * when the process is closed.
- */
- pr_enter (*pid, pin[0], pout[1]);
-
- if (pr_debug)
- fprintf (stderr, " [%d]\n", *pid);
-
- /* clean up and return */
- if( prog ) free(prog);
- return(1);
-
- }
- return(1);
-}
-
-
-/*
- *
- * ProcessClose -- Close a connected subprocess and
- * wait for subprocess to terminate.
- *
- */
-#ifdef ANSI_FUNC
-int
-ProcessClose(int pid, int *exit_status)
-#else
-int ProcessClose(pid, exit_status)
- int pid;
- int *exit_status;
-#endif
-{
- int inchan, outchan;
- int tries=0;
-
- if (pr_getchan (pid, &inchan, &outchan) == -1)
- *exit_status = 0;
- else {
- close (outchan);
- close (inchan);
- pr_release(pid);
-retry:
- if( (waitpid(pid, exit_status, WNOHANG)==0) && (tries<10) ){
- PRSleep(10);
- tries++;
- goto retry;
- }
- }
-
- if (pr_debug)
- fprintf (stderr, "[%d] terminated, exit code %d\n",
- pid, *exit_status);
- return(*exit_status);
-}
-
-
-/*
- *
- * ProcessRead -- Read next record from an IPC channel.
- *
- * Since UNIX pipes are byte streams we must take special measures to
- * transmit data through a pipe in records.
- * Each block of data is preceded by a header of sizeof(int) consisting
- * containing the number of bytes in the block.
- * To read a block we must read the count and then issue successive read
- * requests until the entire block has been read.
- *
-*/
-#ifdef ANSI_FUNC
-void *
-ProcessRead(int fd, void *buf, int maxbytes, int *got)
-#else
-void *ProcessRead(fd, buf, maxbytes, got)
- int fd;
- void *buf;
- int maxbytes;
- int *got;
-#endif
-{
- register char *op;
- register int nbytes;
- char *obuf;
- int record_length, status;
- int temp;
-
- /* no data read as yet */
- *got = 0;
-
- if (pr_debug)
- fprintf (stderr,
- "[%d] initiate read for %d bytes from IPC channel %d\n",
- (int)getpid(), maxbytes, fd);
-
- /* Get byte count of record.
- */
- if (read (fd, &temp, sizeof(int)) != sizeof(int))
- return NULL;
-
- record_length = temp;
- if( maxbytes >= 0 )
- nbytes = min(record_length, maxbytes);
- else
- nbytes = record_length;
-
- /* allocate output buffer, if necessary */
- if( buf )
- obuf = buf;
- else{
- obuf = (char *)malloc(nbytes);
- if( !obuf )
- return NULL;
- }
- op = (char *)obuf;
-
- /* Now read exactly nbytes of data from channel into user buffer.
- * Return actual byte count if EOF is seen. If an error is seen, return.
- * If necessary multiple read requests are issued to read the
- * entire record.
- */
- while (nbytes > 0)
- switch (status = read (fd, op, nbytes)) {
- case -1:
- if( !buf ) free(obuf);
- *got = 0;
- return NULL;
- case 0:
- return(obuf);
- default:
- nbytes -= status;
- *got += status;
- op += status;
- }
-
- if (pr_debug) {
- fprintf (stderr, "[%d] read %d bytes from IPC channel %d:\n",
- (int)getpid(), (int)(op - (char *)buf), fd);
- }
-
- /* If the record is larger than maxbytes, we must read and discard
- * the additional bytes. The method used is inefficient but it is
- * unlikely that we will be called to read less than a full record.
- */
- if( maxbytes >= 0 ){
- for (nbytes = maxbytes; nbytes < record_length; nbytes++)
- if (read (fd, &temp, 1) <= 0)
- break;
- }
-
- return(obuf);
-}
-
-/*
- *
- * ProcessWrite -- Write to an IPC channel.
- * Write the IPC block header followed by the data block.
- *
-*/
-#ifdef ANSI_FUNC
-int
-ProcessWrite(int fd, void *buf, int nbytes)
-#else
-int ProcessWrite(fd, buf, nbytes)
- int fd;
- void *buf;
- int nbytes;
-#endif
-{
- int got;
-
- /* write byte count */
- write(fd, &nbytes, sizeof(int));
-
- /* write data block */
- got = write(fd, buf, nbytes);
-
- if (pr_debug) {
- fprintf (stderr, "[%d] wrote %d bytes to IPC channel %d:\n",
- (int)getpid(), (int)nbytes, fd);
- }
-
- return(got);
-}
-
-/*
- * ProcessGetChan -- Get the codes for the IPC channels assigned to a process.
- */
-#ifdef ANSI_FUNC
-int
-ProcessGetChan (int pid, int *inchan, int *outchan)
-#else
-int ProcessGetChan (pid, inchan, outchan)
- int pid;
- int *inchan, *outchan;
-#endif
-{
- return pr_getchan(pid, inchan, outchan);
-}
diff --git a/funtools/util/longlong.h b/funtools/util/longlong.h
deleted file mode 100644
index 0a0afc1..0000000
--- a/funtools/util/longlong.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef LONGLONG_H
-#define LONGLONG_H
-
-#if HAVE_LONG_LONG
-typedef long long longlong;
-#else
-typedef long longlong;
-#endif
-
-#endif
-
-
diff --git a/funtools/util/macro.c b/funtools/util/macro.c
deleted file mode 100644
index a96b3cc..0000000
--- a/funtools/util/macro.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * macro.c -- macro expansion routines
- *
- */
-
-#include <macro.h>
-
-/* SAOMOD_CTYPE -- work around Slackware/RedHat incompatibility */
-#ifdef linux
-#ifdef isalnum
-#undef isalnum
-#define isalnum(c) (isalpha(c)||isdigit(c))
-#endif
-#endif
-
-#define BUFINC 5000
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-/*
- *
- * AddString -- add a string to a buffer
- *
- */
-#ifdef ANSI_FUNC
-static void
-AddString(char **buf, int *blen, int *maxlen, char *str)
-#else
-static void AddString(buf, blen, maxlen, str)
- char **buf;
- int *blen;
- int *maxlen;
- char *str;
-#endif
-{
- int slen;
-
- if( !str || !*str ) return;
- slen = strlen(str) + 1;
- while( (*blen + slen) >= *maxlen ){
- *maxlen += BUFINC;
- *buf = (char *)realloc(*buf, *maxlen);
- }
- strcat(*buf, str);
- *blen += slen;
-}
-
-/*
- *
- * AddChar -- add a single char to a buffer
- *
- */
-#ifdef ANSI_FUNC
-static void
-AddChar(char **buf, int *blen, int *maxlen, int c)
-#else
-static void AddChar(buf, blen, maxlen, c)
- char **buf;
- int *blen;
- int *maxlen;
- int c;
-#endif
-{
- char tbuf[2];
-
- tbuf[0] = (char)c;
- tbuf[1] = '\0';
- AddString(buf, blen, maxlen, tbuf);
-}
-
-/*
- *
- * LookupKeywords -- lookup a name in a list fo keywords and
- * return the associated value.
- * (Should use quarks ...)
- *
- */
-#ifdef ANSI_FUNC
-static char *
-LookupKeywords(char *name, char **keyword, char **value, int nkey)
-#else
-static char *LookupKeywords(name, keyword, value, nkey)
- char *name;
- char **keyword;
- char **value;
- int nkey;
-#endif
-{
- int i;
- for(i=0; i<nkey; i++){
- if( keyword[i] && !strcmp(name, keyword[i]) )
- return(value[i]);
- }
- return(NULL);
-}
-
-/*
- *
- * Public Routines
- *
- *
- */
-
-/*
- *
- * ExpandMacro -- expand a macro using a client's callback
- * returns: expanded macro as an allocated string
- *
- */
-#ifdef ANSI_FUNC
-char *
-ExpandMacro(char *icmd, char **keyword, char **value, int nkey,
- MacroCall client_callback, void *client_data)
-#else
-char *ExpandMacro(icmd, keyword, value, nkey, client_callback, client_data)
- char *icmd;
- char **keyword;
- char **value;
- int nkey;
- MacroCall client_callback;
- void *client_data;
-#endif
-{
- int i, j;
- int maxlen;
- char brace;
- char *result;
- char tbuf[1000];
- char tbuf1[1000];
- char *s;
- char *ip;
- char *mip;
-
- /* make a new string using the command as a base, but substituting
- for "$" values as needed */
- result = (char *)malloc(BUFINC+1);
- maxlen = BUFINC;
- *result = '\0';
- for(i=0, ip=icmd; *ip; ip++){
- if( *ip != '$' ){
- AddChar(&result, &i, &maxlen, (int)*ip);
- }
- else{
- /* save beginning of macro */
- mip = ip;
- /* skip past '$' */
- ip++;
- /* check for brace mode */
- if( *ip == '{' ){
- brace = '{';
- ip++;
- }
- else if( *ip == '(' ){
- brace = '(';
- ip++;
- }
- else
- brace = '\0';
- /* get variable up to next non-alpha character or close brace */
- for(*tbuf='\0', j=0; *ip; ip++ ){
- /* if we are in brace mode, look for trailing brace */
- if( brace && *ip == (brace == '(' ? ')' : '}') ){
- ip++;
- break;
- }
- /* else look for a non-alpha character */
- else if( !isalnum((int)*ip) && *ip != '_'){
- break;
- }
- else{
- tbuf[j++] = *ip;
- tbuf[j] = '\0';
- }
- }
- /* back up so the outer loop adds this delimiting char to the output */
- ip--;
- /* search for keyword from the list */
- if( (nkey > 0) &&
- (s=LookupKeywords(tbuf, keyword, value, nkey)) != NULL ){
- AddString(&result, &i, &maxlen, s);
- }
- /* execute the client routine to expand macros */
- else if( (client_callback != NULL) &&
- ((s=(*client_callback)(tbuf, client_data)) != NULL) ){
- AddString(&result, &i, &maxlen, s);
- }
- /* look for an environment variable */
- else if( (s = (char *)getenv(tbuf)) != NULL ){
- AddString(&result, &i, &maxlen, s);
- }
- /* if we don't recognize this macro, put it back onto the string */
- else{
- int len;
- len = ip - mip + 1;
- strncpy(tbuf1, mip, len);
- tbuf1[len] = '\0';
- AddString(&result, &i, &maxlen, tbuf1);
- }
- }
- }
- /* null terminate and save the string */
- result[i] = '\0';
- result = (char *)realloc(result, i+1);
- return(result);
-}
-
diff --git a/funtools/util/macro.h b/funtools/util/macro.h
deleted file mode 100644
index 32c141f..0000000
--- a/funtools/util/macro.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * macro.h - include file for the macro expander
- *
- */
-
-#ifndef __macro_h
-#define __macro_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include "prsetup.h"
-
-typedef char *(*MacroCall)(
-#ifdef ANSI_FUNC
- char *s,
- void *client_data
-#endif
-);
-
-_PRbeg
-char *ExpandMacro _PRx((char *icmd, char **keyword, char **value, int nkey,
- MacroCall client_callback, void *client_data));
-_PRend
-
-#endif /* __macro.h */
diff --git a/funtools/util/mainlib.c b/funtools/util/mainlib.c
deleted file mode 100644
index fd3da89..0000000
--- a/funtools/util/mainlib.c
+++ /dev/null
@@ -1,790 +0,0 @@
-/*
- * Copyright (c) 2004 Smithsonian Astrophysical Observatory
- */
-
-/*
- * mainlib.c -- support for main routines called as library subroutines
- *
- */
-
-#include <mainlib.h>
-
-extern char *optarg;
-extern int optind;
-
-/*
- *
- * private routines
- *
- */
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: Pipe2Buf
- *
- * Purpose: read pipe til EOF and fill buffer with results
- *
- * Results: number of bytes read (and buffer in passed argument)
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static int
-Pipe2Buf(int fd, char **buf)
-#else
-static int Pipe2Buf(fd, buf)
- int fd;
- char **buf;
-#endif
-{
- int got;
- int clen=0;
- int blen=0;
-
- /* initial buffer size */
- blen = SZ_LINE*10;
- *buf = xmalloc(blen);
-
- /* read til EOF and fill buffer */
- while( 1 ){
- /* reallocate as needed */
- if( (clen + SZ_LINE) >= blen ){
- blen += SZ_LINE*10;
- *buf = xrealloc(*buf, blen);
- }
- /* read */
- got=read(fd, *buf+clen, SZ_LINE);
- /* got data */
- if( got > 0 ){
- clen += got;
- continue;
- }
- /* EOF */
- else if( got == 0 ){
- /* reallocate to actual size, but null terminate as a courtesy */
- blen = clen+1;
- *buf = xrealloc(*buf, blen);
- *(*buf+clen) = '\0';
- break;
- }
- /* error */
- else{
- xfree(*buf);
- blen = -1;
- break;
- }
- }
- /* return the news */
- return blen;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Routine: MainLibListAdd
- *
- * Purpose: add a member of an mainlib list
- *
- * Results: 1 on success, 0 for failure
- *
- *---------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static void
-MainLibListAdd (MainLib ml, MainLibEntry mle)
-#else
-static void MainLibListAdd(ml, mle)
- MainLib ml;
- MainLibEntry mle;
-#endif
-{
- MainLibEntry cur;
-
- if( ml->head == NULL ){
- ml->head = mle;
- }
- else{
- for(cur=ml->head; cur->next!=NULL; cur=cur->next)
- ;
- cur->next = mle;
- }
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Routine: MainLibListDel
- *
- * Purpose: remove a member of an mainlib list
- *
- * Results: 1 on success, 0 for failure
- *
- *---------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static void
-MainLibListDel (MainLib ml, MainLibEntry mle)
-#else
-static void MainLibListDel(ml, mle)
- MainLib ml;
- MainLibEntry mle;
-#endif
-{
- MainLibEntry cur;
-
- /* remove from list of mainlibs */
- if( ml->head ){
- if( ml->head == mle ){
- ml->head = mle->next;
- }
- else{
- for(cur=ml->head; cur!=NULL; cur=cur->next){
- if( cur->next == mle ){
- cur->next = mle->next;
- break;
- }
- }
- }
- }
-}
-
-/*
- *
- * semi-public routines
- *
- */
-
-/*
- *---------------------------------------------------------------------------
- *
- * Routine: MainLibLookup
- *
- * Purpose: lookup a mainlib procedure
- *
- * Results: MainLibEntry record on success, NULL on failure
- *
- *---------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-MainLibEntry
-MainLibLookup (MainLib ml, char *xclass, char *name)
-#else
-MainLibEntry MainLibLookup(ml, xclass, name)
- MainLib ml;
- char *xclass;
- char *name;
-#endif
-{
- MainLibEntry cur;
-
- if( !ml || (!xclass && !name) ) return NULL;
-
- for(cur=ml->head; cur!=NULL; cur=cur->next){
- if( (!xclass || !strcmp(xclass, cur->xclass)) &&
- (!name || !strcmp(name, cur->name)) ){
- return cur;
- }
- }
- return NULL;
-}
-
-/*
- *
- * public routines
- *
- */
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibNew
- *
- * Purpose: create mainlib struct
- *
- * Returns: mainlib list handle or NULL
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-MainLib
-MainLibNew (void)
-#else
-MainLib MainLibNew()
-#endif
-{
- MainLib ml;
-
- /* allocate struct */
- if( !(ml = (MainLib)xcalloc(1, sizeof(MainLibRec))) )
- return NULL;
- return ml;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibAdd
- *
- * Purpose: add a mainlib name to allow external processes to be called
- * as subroutines
- *
- * Returns: mainlib handle associated with this name or NULL
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-MainLibEntry
-MainLibAdd (MainLib ml, char *xclass, char *name, MainLibProc proc, int type)
-#else
-MainLibEntry MainLibAdd(ml, xclass, name, proc, type)
- MainLib ml;
- char *xclass;
- char *name;
- MainLibProc proc;
- int type;
-#endif
-{
- MainLibEntry mle;
-
- /* sanity check */
- if( !ml ) return NULL;
-
- /* allocate struct */
- if( !(mle = (MainLibEntry)xcalloc(1, sizeof(MainLibEntryRec))) ) return NULL;
- /* fill in the blanks */
- mle->xclass = xstrdup(xclass);
- mle->name = xstrdup(name);
- mle->proc = proc;
- mle->type = type;
- /* add to list */
- MainLibListAdd(ml, mle);
- return mle;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibProcess
- *
- * Purpose: call external processes as subroutines
- *
- * Results: number of bytes in return buffer (buffer in passed argument)
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int MainLibProcess(MainLib ml, char *cmd, char **buf, char *mode)
-#else
-int MainLibProcess(ml, cmd, buf, mode)
- MainLib ml;
- char *cmd;
- char **buf;
- char *mode;
-#endif
-{
- int i, j;
- int got;
- int ncmd=0;
- int ip=0;
- int ifd=-1;
- int ofd=-1;
- int efd=-1;
- int fillbuf=1;
- int debug=0;
- int use_ifd=0;
- int use_ofd=0;
- int use_efd=0;
-#if HAVE_TCL
- int use_tcl=0;
-#endif
- int nargs[MAINLIB_CMDS+1];
- int pipes[MAINLIB_CMDS+1][2];
- char *c, *s, *t;
- char *undef=NULL;
- char tbuf[SZ_LINE];
- char ibuf[SZ_LINE];
- char ibuf2[SZ_LINE];
- char *args[(MAINLIB_CMDS+1)*MAINLIB_ARGS];
- char *cmds[MAINLIB_CMDS+1];
-#if HAVE_TCL
- void *tcl=NULL;
-#endif
- MainLibEntry mles[MAINLIB_CMDS+1];
- static int mainlibinit=0;
- static int mainlib_debug=0;
- static char *mainlib_path=NULL;
-
- /* sanity check */
- if( !ml ){
- gerror(stderr, "invalid or missing command list for mainlib\n");
- got = -1;
- goto done;
- }
-
- /* initialization */
- if( !mainlibinit ){
- if( (s = (char *)getenv("MAINLIB_DEBUG")) )
- mainlib_debug = istrue(s);
- mainlib_path = (char *)getenv("PATH");
- mainlibinit = 1;
- }
-
- /* clear arrays */
- memset(cmds, 0, sizeof(char *)*(MAINLIB_CMDS+1));
- memset(mles, 0, sizeof(MainLibEntry)*(MAINLIB_CMDS+1));
- memset(args, 0, sizeof(char *)*(MAINLIB_CMDS+1)*MAINLIB_ARGS);
-
- /* separate commands */
- c = xstrdup(cmd);
- for(s=c; (t=strchr(s, '|'))!=NULL; s=t+1){
- if( ncmd >= MAINLIB_CMDS ){
- gerror(stderr, "max cmds exceeded (%d) for mainlib\n", ncmd);
- got = -1;
- goto done;
- }
- *t = '\0';
- cmds[++ncmd] = xstrdup(s);
- }
- /* get last command */
- cmds[++ncmd] = xstrdup(s);
- if( c ) xfree(c);
-
- /* seed the debug flag (override with switch) */
- debug = mainlib_debug;
-
- /* check mode string */
- if( (t = xstrdup(mode)) ){
- if( keyword(t, "stdin", tbuf, SZ_LINE) ) ifd = atoi(tbuf);
- if( keyword(t, "stdout", tbuf, SZ_LINE) ) ofd = atoi(tbuf);
- if( keyword(t, "stderr", tbuf, SZ_LINE) ) efd = atoi(tbuf);
- if( keyword(t, "undef", tbuf, SZ_LINE) ) undef = xstrdup(tbuf);
- if( keyword(t, "fillbuf", tbuf, SZ_LINE) ) fillbuf = istrue(tbuf);
- if( keyword(t, "debug", tbuf, SZ_LINE) ) debug = istrue(tbuf);
-#if HAVE_TCL
- if( keyword(t, "tcl", tbuf, SZ_LINE) ){
- sscanf(tbuf, "%p", &tcl);
- use_tcl=1;
- }
-#endif
- xfree(t);
- }
- /* make sure unef is defined */
- if( !undef ){
- undef = xstrdup("extn");
- }
-
- /* pipe for top level */
- pipe(pipes[0]);
-
- /* package up arguments for each command */
- for(i=1; i<=ncmd; i++){
- if( pipe(pipes[i]) < 0 ){
- gerror(stderr, "can't set up pipes for mainlib\n");
- got = -1;
- goto done;
- }
- ip = 0;
- /* make sure we have a command */
- if( !word(cmds[i], ibuf, &ip) ){
- gerror(stderr, "invalid or missing command for mainlib\n");
- got = -1;
- goto done;
- }
- /* make sure its a valid command */
- nowhite(ibuf, ibuf2);
- if( !(mles[i] = MainLibLookup(ml, NULL, ibuf2)) ){
- if( undef ){
- ip = 0;
- while( word(undef, tbuf, &ip) ){
- if( !strcasecmp(tbuf, "error") ){
- break;
- }
-#if HAVE_TCL
- else if( use_tcl && ml->tcllookup && ml->tcllookup(tcl, ibuf2) ){
- mles[i] = MainLibAdd(ml, cmds[i], ibuf2, NULL, MAINLIB_TCL);
- break;
- }
-#endif
- else if( (s=Find(ibuf2, "x", NULL, mainlib_path)) != NULL ){
- mles[i] = MainLibAdd(ml, s, ibuf2, NULL, MAINLIB_EXTN);
- xfree(s);
- break;
- }
- }
- if( !mles[i] ){
- gerror(stderr, "can't locate procedure '%s' for mainlib\n", ibuf);
- got = -1;
- goto done;
- }
- }
-#ifdef OLD
- switch(mainlibundef){
- case MAINLIB_ERROR:
- gerror(stderr, "can't locate procedure '%s' for mainlib\n", ibuf);
- got = -1;
- goto done;
- case MAINLIB_EXTN:
- if( (s=Find(ibuf2, "x", NULL, mainlib_path)) != NULL ){
- mles[i] = MainLibAdd(ml, s, ibuf2, NULL, MAINLIB_EXTN);
- xfree(s);
- }
- else
- gerror(stderr, "can't locate procedure '%s' for mainlib\n", ibuf);
- break;
- default:
- gerror(stderr, "can't locate procedure '%s' for mainlib\n", ibuf);
- got = -1;
- goto done;
- }
-#endif
-
- }
-
- /* package up the arguments */
- ip = 0;
- nargs[i] = 0;
- while( word(cmds[i], ibuf, &ip) ){
- nowhite(ibuf, ibuf2);
- if( *ibuf2 ){
- if( nargs[i] >= (MAINLIB_ARGS-1) ){
- gerror(stderr, "max args exceeded (%d) for mainlib\n", nargs[i]);
- got = -1;
- goto done;
- }
- args[i*MAINLIB_ARGS+nargs[i]] = xstrdup(ibuf2);
- nargs[i]++;
- args[i*MAINLIB_ARGS+nargs[i]] = NULL;
- }
- }
- }
-
- /* execute all commands */
- for(i=1; i<=ncmd; i++){
- /* fork new process */
- if( (ml->pids[i] = fork()) == -1 ){
- gerror(stderr, "can't fork()\n");
- got = -1;
- goto done;
- }
- /* child will call mainlib routine */
- if( ml->pids[i] == 0 ){
- /* reset optind in case its being used by child */
- optind = 1;
- /* stdin for this new process is */
- if( i == 1 ){
- /* first process either reads stdin from specified ifd,
- or else we leave it alone */
- if( ifd >= 0 ){
- if( ifd != 0 ){
- close(0); dup(ifd);
- }
- else{
- use_ifd = 1;
- }
- }
- }
- /* all other processes read stdin from previous process stdout */
- else{
- close(0); dup(pipes[i][0]);
- }
- /* set up stdout for this new process */
- if( i < ncmd ){
- close(1); dup(pipes[i+1][1]);
- }
- else{
- /* last process either writes stdout or to specified ofd */
- if( ofd >= 0 ){
- if( ofd != 1 ){
- close(1); dup(ofd);
- }
- else{
- use_ofd = 1;
- }
- }
- /* or sends stdout to main process */
- else{
- close(1); dup(pipes[0][1]);
- }
- }
- /* all processes redirect stderr, if required */
- if( efd >= 0 ){
- if( efd != 2 ){
- close(2); dup(efd);
- }
- else{
- use_efd = 1;
- }
- }
- /* close all pipes */
- for(j=0; j<=ncmd; j++){
- close(pipes[j][0]); close(pipes[j][1]);
- }
- /* including user-specified pipes */
- if( (ifd >=0) && !use_ifd ) close(ifd);
- if( (ofd >=0) && !use_ofd ) close(ofd);
- if( (efd >=0) && !use_efd ) close(efd);
- /* call specified subroutine */
- switch(mles[i]->type){
- case MAINLIB_ARGV:
- if( debug )
- fprintf(stderr, "Executing MainLib: %s\n", args[i*MAINLIB_ARGS]);
- mles[i]->proc(nargs[i], &args[i*MAINLIB_ARGS]);
- break;
- case MAINLIB_EXTN:
- if( debug )
- fprintf(stderr, "Executing external program: %s\n", mles[i]->xclass);
- if( mles[i]->xclass )
- execvp(mles[i]->xclass, (void *)&args[i*MAINLIB_ARGS]);
- else
- execvp(mles[i]->name, (void *)&args[i*MAINLIB_ARGS]);
- break;
-#if HAVE_TCL
- case MAINLIB_TCL:
- if( debug )
- fprintf(stderr, "Executing Tcl proc: %s\n", mles[i]->xclass);
- if( use_tcl && ml->tcleval){
- ml->tcleval(tcl, mles[i]->xclass);
- }
- else{
- gerror(stderr, "Tcl support missing for mainlib\n");
- }
- break;
-#endif
- default:
- gerror(stderr, "unknown program type for mainlib\n");
- break;
- }
- _exit(0);
- }
- }
-
- /* close all pipes except the final input pipe */
- close(pipes[0][1]);
- for(i=1; i<=ncmd; i++){
- close(pipes[i][0]);
- close(pipes[i][1]);
- }
-
- /* if not filling buffer, just return the pipe (user calls cleanup) */
- if( !fillbuf ){
- got = pipes[0][0];
- ml->npid = ncmd;
- goto done2;
- }
-
- /* wait for output from last process */
- got = Pipe2Buf(pipes[0][0], buf);
-
- /* and now close final input pipe */
- close(pipes[0][0]);
-
-done:
- /* done with processing, wait for children to finish */
- MainLibProcessCleanup(ml);
-
-done2:
- /* free up space */
- for(i=1; i<=ncmd; i++){
- for(j=0; j<nargs[i]; j++){
- if( args[i*MAINLIB_ARGS+j] ) xfree(args[i*MAINLIB_ARGS+j]);
- }
- if( cmds[i] ) xfree(cmds[i]);
- }
- if( undef ) xfree(undef);
-
- /* return: error (-1), number of bytes in buffer, or pipe fd */
- return got;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Routine: MainLibProcessCleanup
- *
- * Purpose: cleanup after mainlib processing
- *
- * Results: 1 on success, 0 for failure
- *
- *---------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibProcessCleanup (MainLib ml)
-#else
-int MainLibProcessCleanup(ml)
- MainLib ml;
-#endif
-{
- int i;
- int status;
-
- for(i=1; i<=ml->npid; i++){
- if( ml->pids[i] ){
-#if HAVE_MINGW32==0
- while( waitpid(ml->pids[i], &status, 0) < 0 ){
- if( errno != EINTR ) break;
- }
-#endif
- ml->pids[i] = 0;
- }
- }
- return 1;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Routine: MainLibDel
- *
- * Purpose: delete a MainLibEntry record structure
- *
- * Results: 0 on success, -1 for failure
- *
- *---------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibDel (MainLib ml, MainLibEntry mle)
-#else
-int MainLibDel(ml, mle)
- MainLib ml;
- MainLibEntry mle;
-#endif
-{
-
- /* make sure we have something to do */
- if( !ml || !mle ) return -1;
-
- /* free up space */
- if( mle->xclass ) xfree(mle->xclass);
- if( mle->name ) xfree(mle->name);
-
- /* remove from list of mainlibs */
- MainLibListDel(ml, mle);
-
- /* free up record struct */
- xfree((char *)mle);
-
- return 0;
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Routine: MainLibFree
- *
- * Purpose: free all members of this mainlib list
- *
- * Results: 1 on success, 0 for failure
- *
- *---------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibFree (MainLib ml)
-#else
-int MainLibFree(ml)
- MainLib ml;
-#endif
-{
- MainLibEntry mle, tmle;
-
- /* sanity check */
- if( !ml ) return 0;
-
- /* free all commands */
- for(mle=ml->head; mle!=NULL; ){
- tmle = mle->next;
- MainLibDel(ml, mle);
- mle = tmle;
- }
-
-#if HAVE_DLFCN_H
- /* release dynamic library */
- if( ml->dl ) dlclose(ml->dl);
-#endif
-
- /* free global struct */
- xfree(ml);
- return 1;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibLoad
- *
- * Purpose: load shared library and execute init function
- *
- * Results: 0=>OK, -1=> no shared obj, -2=>no init function
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int MainLibLoad(char *name, char *shlib, void **ml, char **ermsg)
-#else
-int MainLibLoad(name, shlib, ml, ermsg)
- char *name;
- char *shlib;
- void **ml;
- char **ermsg;
-#endif
-{
-#if HAVE_DLFCN_H
- char tbuf[SZ_LINE];
- MainLibInitCall irtn=NULL;
- MainLib tml=NULL;
- void *tdl=NULL;
-
- /* sanity checks */
- if( !name ){
- if( ermsg ) *ermsg = "no package name specified";
- return -3;
- }
- if( !ml ){
- if( ermsg ) *ermsg = "no return ml struct specified";
- return -3;
- }
-
- /* get name of init call */
- snprintf(tbuf, SZ_LINE-1, "%sMainLibInit", name);
-
- /* load shared library */
- if( !(tdl=dlopen(shlib, RTLD_LAZY)) ){
- if( ermsg ) *ermsg = (char *)dlerror();
- return -1;
- }
-
- /* look up init funtion */
- if( !(irtn=(MainLibInitCall)dlsym(tdl, tbuf)) ){
- if( ermsg ) *ermsg = (char *)dlerror();
- return -2;
- }
-
- /* execute init function */
- tml = (*irtn)();
-
- /* store values */
- tml->dl = tdl;
-
- /* look up and return MainLibProcess funtion, if it exists */
- tml->mainlibprocess=(MainLibProcessCall)dlsym(tml->dl, "MainLibProcess");
-
- /* store MainLib record */
- *ml = tml;
-
- /* if we got here, its OK */
- return 0;
-#else
- /* avoid -W unused parameter warning */
- if( 0 ){
- name = name;
- shlib = shlib;
- ml = ml;
- }
- /* didn't find dlfcn.h */
- if( ermsg ) *ermsg = "dynamic load supported not found";
- return -1;
-#endif
-}
diff --git a/funtools/util/mainlib.h b/funtools/util/mainlib.h
deleted file mode 100644
index 3e4534d..0000000
--- a/funtools/util/mainlib.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * mainlib.h
- *
- */
-
-#ifndef __mainlib_h
-#define __mainlib_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include "prsetup.h"
-#include "xalloc.h"
-#include "word.h"
-#include "find.h"
-#include "gio.h"
-
-/* types of mainlibs we recognize */
-#define MAINLIB_ERROR 0
-#define MAINLIB_ARGV 1
-#define MAINLIB_EXTN 2
-#define MAINLIB_TCL 3
-
-/* max values */
-#define MAINLIB_CMDS 32
-#define MAINLIB_ARGS 32
-
-/* defines the types of callback procedure we use */
-typedef int (*MainLibProc)(
-#ifdef ANSI_FUNC
- int argc,
- char **argv
-#endif
-);
-
-/* define init call */
-typedef void *(*MainLibInitCall)(
-#ifdef ANSI_FUNC
- void
-#endif
-);
-
-/* define proc call */
-typedef int (*MainLibProcessCall)(
-#ifdef ANSI_FUNC
- void *ml, char *cmd, char **buf, char *mode
-#endif
-);
-
-/* define Tcl lookup call */
-typedef int (*MainLibTclLookup)(
-#ifdef ANSI_FUNC
- void *interp, char *s
-#endif
-);
-
-/* define Tcl eval call */
-typedef int (*MainLibTclEval)(
-#ifdef ANSI_FUNC
- void *interp, char *s
-#endif
-);
-
-/*
- *
- *
- * mainlib record structure for a single command
- *
- */
-typedef struct mainlibentryrec{
- struct mainlibentryrec *next;
- char *xclass;
- char *name;
- MainLibProc proc;
- int type;
-} *MainLibEntry, MainLibEntryRec;
-
-/*
- *
- *
- * mainlib record structure for a group of commands
- *
- */
-typedef struct mainlibrec{
- MainLibEntry head;
- void *dl;
- MainLibProcessCall mainlibprocess;
- MainLibTclLookup tcllookup;
- MainLibTclEval tcleval;
- int npid;
- pid_t pids[MAINLIB_CMDS+1];
-} *MainLib, MainLibRec;
-
-/* library declarations */
-_PRbeg
-
-/* public */
-int MainLibLoad _PRx((char *name, char *shlib, void **ml, char **ermsg));
-MainLib MainLibNew _PRx((void));
-MainLibEntry MainLibAdd _PRx((MainLib ml, char *xclass, char *name,
- MainLibProc mainlibproc, int type));
-int MainLibProcess _PRx((MainLib ml, char *cmd, char **buf, char *mode));
-int MainLibProcessCleanup _PRx((MainLib ml));
-int MainLibDel _PRx((MainLib ml, MainLibEntry mle));
-int MainLibFree _PRx((MainLib ml));
-
-_PRend
-
-#endif /* __mainlib.h */
-
diff --git a/funtools/util/mkrtemp.c b/funtools/util/mkrtemp.c
deleted file mode 100644
index 51e1130..0000000
--- a/funtools/util/mkrtemp.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <mkrtemp.h>
-
-/*
- *
- * mkrtemp -- make a unique temportary filename that is hard to guess,
- * and, optionally, open it using securely: O_CREAT|O_EXCL|O_RDWR, 0600.
- * This should be an improvement over mktmp and mkstmp because of the use
- * of usec of gettimeofday() to make up the filename -- harder to guess.
- * If you want to use a random number generater instead, set the environment
- * variable MTRTEMP_RAND to "true".
- *
- * The routine also allows for both a prefix and suffix to be specified,
- * so that you can create files with extensions. Either of these can be NULL.
- *
- */
-#ifdef ANSI_FUNC
-int mkrtemp(char *prefix, char *suffix, char *path, int len, int doopen)
-#else
-int mkrtemp(prefix, suffix, path, len, doopen)
- char *prefix;
- char *suffix;
- char *path;
- int len;
- int doopen;
-#endif
-{
- char *s;
- int fd;
- long lval;
- struct stat sbuf;
- struct timeval tv;
- static int _method=0;
-
- /* clear the buffer */
- *path = '\0';
- if( len <=0 )
- return -1;
-
- /* check validity of the target directory, if necessary */
- if( prefix && *prefix ){
- int bad=0;
- char *xprefix=xstrdup(prefix);
- for(s=xprefix; *s; s++)
- ;
- for(; s>=xprefix ; s--){
- if( (*s == '/') || (*s == '\\') ){
- *s = '\0';
- if( stat(xprefix, &sbuf) ){
- bad = -1;
- }
- else if( !S_ISDIR(sbuf.st_mode) ){
- errno = ENOTDIR;
- bad = -1;
- }
- break;
- }
- }
- free(xprefix);
- if( bad )
- return -1;
- }
-
- /* initialize method */
- if( !_method ){
- /* assume gettimeofday() usecs */
- _method = 1;
- /* but allow for using RNG */
- if( (s=(char *)getenv("MKRTEMP_RAND")) && istrue(s) )
- _method = 2;
- gettimeofday(&tv, NULL);
- switch(_method){
- case 1:
- break;
- case 2:
- srand48(tv.tv_sec+tv.tv_usec);
- break;
- }
- }
-
- /* main loop -- make up a new file name and check for non-existence */
- lval = 0;
- while( 1 ){
- switch(_method){
- case 1:
- gettimeofday(&tv, NULL);
- /* avoid repeated checks on same value of lval */
- if( lval == tv.tv_usec )
- lval /= 2;
- else
- lval = tv.tv_usec;
- break;
- case 2:
- lval = lrand48();
- break;
- default:
- return -1;
- }
- snprintf(path, len, "%s%ld%s",
- (prefix?prefix:""), lval, (suffix?suffix:""));
- if( doopen ){
- if( (fd=open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
- return fd;
- if (errno != EEXIST)
- return -1;
- }
- else if( lstat(path, &sbuf) )
- return errno==ENOENT ? 0 : -1;
- }
-}
diff --git a/funtools/util/mkrtemp.h b/funtools/util/mkrtemp.h
deleted file mode 100644
index 5eae026..0000000
--- a/funtools/util/mkrtemp.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * mkrtemp.h -- declarations for mkrtemp, a fancy version of mkstemp
- *
- */
-
-#ifndef __mkrtemp_h
-#define __mkrtemp_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include "prsetup.h"
-#include "word.h"
-#include "xalloc.h"
-
-#ifdef __APPLE__
-#define lrand48 random
-#define srand48 srandom
-#endif
-
-#if HAVE_MINGW32
-#define lrand48 rand
-#define srand48 srand
-#define lstat stat
-#endif
-
-_PRbeg
-
-int mkrtemp _PRx((char *prefix, char *suffix, char *path, int len,
- int doopen));
-
-_PRend
-
-#endif
diff --git a/funtools/util/nan.c b/funtools/util/nan.c
deleted file mode 100644
index 4c1f856..0000000
--- a/funtools/util/nan.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-#include <swap.h>
-#include <prsetup.h>
-
-/*
- *
- * getnanf() -- return a float NaN
- *
- */
-#ifdef ANSI_FUNC
-float getnanf(void)
-#else
-float getnanf()
-#endif
-{
- unsigned char nan[4];
- int i;
-
- for(i=0; i<4; i++)
- nan[i] = 1;
-
- if( is_bigendian() ){
- nan[0] = 0x7F;
- nan[1] = 0x80;
- }
- else{
- nan[3] = 0x7F;
- nan[2] = 0x80;
- }
-
- return(*((float *)nan));
-}
-
-/*
- *
- * getnand() -- return a double NaN
- *
- */
-#ifdef ANSI_FUNC
-double getnand(void)
-#else
-double getnand()
-#endif
-{
- unsigned char nan[8];
- int i;
-
- for(i=0; i<8; i++)
- nan[i] = 1;
-
- if( is_bigendian() ){
- nan[0] = 0x7F;
- nan[1] = 0xF0;
- }
- else{
- nan[7] = 0x7F;
- nan[6] = 0xF0;
- }
-
- return(*((double *)nan));
-}
-
diff --git a/funtools/util/parse.c b/funtools/util/parse.c
deleted file mode 100644
index a238a46..0000000
--- a/funtools/util/parse.c
+++ /dev/null
@@ -1,1187 +0,0 @@
-/*
- * Copyright (c) 2004 Smithsonian Astrophysical Observatory
- */
-
-#include <parse.h>
-
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Private Routines and Data
- *
- *
- *----------------------------------------------------------------------------
- */
-
-static int __parseline;
-static ParseRec __parserec;
-static Parse _parse = &__parserec;
-static char _ctab[PARSE_TABLE_SIZE][PARSE_TABLE_SIZE];
-
-#ifdef ANSI_FUNC
-static int
-_gettype(char *s, double *d, longlong *i)
-#else
-_gettype(s, d, i)
- char *s;
- double *d;
- longlong *i;
-#endif
-{
- char *t;
- longlong lval;
- double dval;
-
- /* make sure we have something */
- if( !s || !*s ) return PARSE_NULL;
-
- /* the temp pointer will move along the string */
- t = s;
-
- /* skip leading spaces */
- while( *t && isspace((int)*t) ) t++;
- /* if all we had were spaces, its a string */
- if( !*t ) return PARSE_STRING;
-
- /* skip optional sign */
- if( *t && (*t == '+') ){
- t++;
- }
- /* skip optional minus sign or detect dashes */
- else if( *t && (*t == '-') ){
- t++;
- if( !*t ) return PARSE_DASH;
- if( *t && (*t == '-') ){
- for(t++; *t; t++){
- if( *t != '-' ) return PARSE_STRING;
- }
- return PARSE_DASH;
- }
- }
-
- /* look for hex indication */
- if( (*t == '0') && ((*(++t) == 'x') || (*t == 'X')) ){
- goto testhex;
- }
-
- /* quick look for indication of a float */
- for(; *t; t++){
- if( (*t == '.') || (*t == 'E') )
- goto testfloat;
- }
- goto testint;
-
-testfloat:
- dval = SAOstrtod(s, &t);
- while( *t && isspace((int)*t) )
- t++;
- if( *t != '\0' )
- return PARSE_STRING;
- if( d ) *d = dval;
- return PARSE_FLOAT;
-
-testint:
- lval = strtoll(s, &t, 10);
- while( *t && isspace((int)*t) )
- t++;
- if( *t != '\0' )
- return PARSE_STRING;
- if( i ) *i = (longlong)lval;
- if( d ) *d = (double)lval;
- return PARSE_INTEGER;
-
-testhex:
- lval = strtoll(s, &t, 16);
- while( *t && isspace((int)*t) )
- t++;
- if( *t != '\0' )
- return PARSE_STRING;
- if( i ) *i = (longlong)lval;
- if( d ) *d = (double)lval;
- return PARSE_HEXINT;
-}
-
-#ifdef ANSI_FUNC
-static void
-_ParseInitialize(void)
-#else
-static void _ParseInitialize()
-#endif
-{
- /* clear ctable */
- memset(_ctab, 0, PARSE_TABLE_SIZE * PARSE_TABLE_SIZE);
-
- /* set allowable type conversions */
- _ctab[PARSE_NULL][PARSE_NULL] = 1;
- _ctab[PARSE_NULL][PARSE_FLOAT] = 1;
- _ctab[PARSE_NULL][PARSE_INTEGER] = 1;
- _ctab[PARSE_NULL][PARSE_HEXINT] = 1;
- _ctab[PARSE_NULL][PARSE_STRING] = 1;
-
- _ctab[PARSE_DASH][PARSE_NULL] = 1;
- _ctab[PARSE_DASH][PARSE_FLOAT] = 1;
- _ctab[PARSE_DASH][PARSE_INTEGER] = 1;
- _ctab[PARSE_DASH][PARSE_HEXINT] = 1;
- _ctab[PARSE_DASH][PARSE_STRING] = 1;
-
- _ctab[PARSE_FLOAT][PARSE_FLOAT] = 1;
- _ctab[PARSE_FLOAT][PARSE_INTEGER] = 1;
- _ctab[PARSE_FLOAT][PARSE_HEXINT] = 1;
- _ctab[PARSE_FLOAT][PARSE_NULL] = 1;
-
- _ctab[PARSE_INTEGER][PARSE_INTEGER] = 1;
- _ctab[PARSE_INTEGER][PARSE_HEXINT] = 1;
- _ctab[PARSE_INTEGER][PARSE_NULL] = 1;
- _ctab[PARSE_INTEGER][PARSE_STRING] = 1;
-
- _ctab[PARSE_HEXINT][PARSE_HEXINT] = 1;
- _ctab[PARSE_HEXINT][PARSE_INTEGER] = 1;
- _ctab[PARSE_HEXINT][PARSE_NULL] = 1;
-
- _ctab[PARSE_STRING][PARSE_STRING] = 1;
- _ctab[PARSE_STRING][PARSE_NULL] = 1;
- _ctab[PARSE_STRING][PARSE_INTEGER] = 1;
-
- /* set i2f conversions (requires explicit enabling) */
- _ctab[PARSE_INTEGER][PARSE_FLOAT] = -1;
- _ctab[PARSE_HEXINT][PARSE_FLOAT] = -1;
-}
-
-#ifdef ANSI_FUNC
-static int
-_ParseEOT(Parse parse, char *line)
-#else
-static int _ParseEOT(parse, line)
- Parse parse;
- char *line;
-#endif
-{
- if( !parse || !line || !parse->eot || (parse->state & PARSE_STATE_BAD) )
- return 0;
- if( !strcmp(parse->eot->lines[parse->eot->ncur], line) ){
- parse->eot->ncur++;
- if( parse->eot->ncur == parse->eot->nline ){
- parse->eot->ncur = 0;
- return 1;
- }
- else{
- return -1;
- }
- }
- else{
- parse->eot->ncur = 0;
- if( !strcmp(parse->eot->lines[parse->eot->ncur], line) ){
- parse->eot->ncur++;
- return -1;
- }
- }
- return 0;
-}
-
-#ifdef ANSI_FUNC
-static int
-_ParseFixTokens(ParsedLine line1, ParsedLine line2)
-#else
-static int _ParseFixTokens(line1, line2)
- ParsedLine line1;
- ParsedLine line2;
-#endif
-{
- int i;
-
- /* sanity check */
- if( !line1 || !line2 ) return -1;
-
- /* horrible vizier hack: the units line often is missing trailing
- null values. we try to fix that here. this really stinks */
- if( line2->ntoken < line1->ntoken ){
- line2->tokens = (ParsedToken)xrealloc(line2->tokens,
- line1->ntoken*sizeof(ParsedTokenRec));
- for(i=line2->ntoken; i<line1->ntoken; i++){
- line2->tokens[i].sval = NULL;
- line2->tokens[i].type = PARSE_NULL;
- line2->tokens[i].delim = '\0';
- }
- line2->maxtoken = line1->ntoken;
- line2->ntoken = line1->ntoken;
- return 1;
- }
- else{
- return 0;
- }
-}
-
-#ifdef ANSI_FUNC
-static int
-_ParseLineState(Parse parse, int istate, char *UNUSED(mode))
-#else
-_ParseLineState(parse, istate, mode)
- Parse parse;
- int state;
- char *mode;
-#endif
-{
- int state;
- ParsedLine line;
-
- /* sanity check */
- if( !parse ) return PARSE_STATE_UNKNOWN;
-
- /* get line */
- line = parse->cur;
-
- /* look for EOT and blanks */
- if( line->types[0] == PARSE_EOT ) return(PARSE_STATE_EOT);
- if( !line->ntoken ) return(istate);
-
- /* comments might signify EOT under certain circumstances */
- if( line->types[0] == PARSE_COMMENT ){
- if( (istate == PARSE_STATE_DATA) && parse->data1 ){
- /* the middle of a multi-line EOT looks like a comment: just return */
- if( parse->eot && parse->eot->ncur ) return(istate);
- /* else check for comment-based EOT */
- switch(parse->comeot){
- case 0:
- return(istate);
- case 1:
- if( line->tokens[0].delim == '\n' )
- return(istate);
- else{
- state = PARSE_STATE_EOT|PARSE_STATE_REDOLINE;
- return(state);
- }
- break;
- case 2:
- state = PARSE_STATE_EOT|PARSE_STATE_REDOLINE;
- return(state);
- break;
- default:
- return(istate);
- }
- }
- else{
- return(istate);
- }
- }
-
- switch(istate){
- case PARSE_STATE_INITIAL:
- if( line->ntypes[PARSE_DASH] == line->ntoken ){
- state = PARSE_STATE_DATA;
- }
- /* yuck: fix 'justify' bug that puts spaces in blank header lines */
- else if( line->ntypes[PARSE_NULL] == line->ntoken ){
- /* make believe we just saw a comment */
- line->types[0] = PARSE_COMMENT;
- return istate;
- }
- else if( (line->ntypes[PARSE_STRING]+line->ntypes[PARSE_NULL]) ==
- line->ntoken ){
- state = PARSE_STATE_STRING;
- }
- else{
- state = PARSE_STATE_DATA;
- parse->data1 = ParseLineDup(parse, line);
- }
- break;
- case PARSE_STATE_STRING:
- if( line->ntypes[PARSE_DASH] == line->ntoken ){
- state = PARSE_STATE_DATA;
- if( parse->needunits && parse->prev2 ){
- parse->header = ParseLineDup(parse, parse->prev2);
- parse->units = ParseLineDup(parse, parse->prev);
- }
- else{
- parse->header = ParseLineDup(parse, parse->prev);
- }
- }
- else if( (line->ntypes[PARSE_STRING]+line->ntypes[PARSE_NULL]) ==
- line->ntoken ){
- if( parse->needunits ){
- if( parse->prev2 ){
- state = PARSE_STATE_DATA;
- parse->header = ParseLineDup(parse, parse->prev2);
- parse->units = ParseLineDup(parse, parse->prev);
- }
- else{
- state = PARSE_STATE_STRING;
- /* if needunits is set, this might be a broken vizier unit line */
- _ParseFixTokens(parse->prev, line);
- }
- }
- else{
- if( parse->needheader ){
- state = PARSE_STATE_DATA;
- parse->header = ParseLineDup(parse, parse->prev);
- parse->data1 = ParseLineDup(parse, line);
- }
- else{
- state = PARSE_STATE_DATA;
- parse->data1 = ParseLineDup(parse, parse->prev);
- }
- }
- }
- else{
- state = PARSE_STATE_DATA;
- if( parse->needunits && parse->prev2 ){
- parse->header = ParseLineDup(parse, parse->prev2);
- parse->units = ParseLineDup(parse, parse->prev);
- }
- else{
- parse->header = ParseLineDup(parse, parse->prev);
- }
- parse->data1 = ParseLineDup(parse, line);
- }
- break;
- case PARSE_STATE_DATA:
- /* all dashes means that we missed an EOT somewhere */
- if( line->ntypes[PARSE_DASH] == line->ntoken ){
- state = PARSE_STATE_BADMATCH;
- }
- /* all tokens are string might mean lazy EOT */
- else if( (line->ntypes[PARSE_STRING] == line->ntoken) && parse->lazyeot ){
- /* all tokens are strings and we have to look for a "lazy eot".
- we look for a mismatch in the number of tokens or in the number
- of string/null tokens between this line and the first data line */
- if( parse->data1 &&
- ((parse->data1->ntoken != line->ntoken) ||
- ((parse->data1->ntypes[PARSE_STRING]+parse->data1->ntypes[PARSE_NULL]) != line->ntoken)) ){
-#if PARSE_LOOSELY
- state = _ParseLineState(parse, PARSE_STATE_INITIAL, NULL);
- state |= PARSE_STATE_EOT|PARSE_STATE_NEXTLINE;
-#else
- state = PARSE_STATE_BADTYPE;
-#endif
- }
- else{
- state = PARSE_STATE_DATA;
- /* 8/22: I added this line to support tables containing only ascii
- columns. But is there a reason why it was not here before??? */
- if( !parse->data1 ) parse->data1 = ParseLineDup(parse, line);
- }
- }
- else{
- state = PARSE_STATE_DATA;
- if( !parse->data1 ) parse->data1 = ParseLineDup(parse, line);
- }
- break;
- case PARSE_STATE_BADMATCH:
- state = PARSE_STATE_BADMATCH;
- break;
- case PARSE_STATE_BADMAX:
- state = PARSE_STATE_BADMAX;
- break;
- case PARSE_STATE_UNKNOWN:
- state = PARSE_STATE_UNKNOWN;
- break;
- default:
- state = PARSE_STATE_UNKNOWN;
- break;
- }
- return state;
-}
-
-#ifdef ANSI_FUNC
-static int
-_ParseLineFree(ParsedLine line)
-#else
-static int _ParseLineFree(line)
- ParsedLine line;
-#endif
-{
- int i;
-
- /* sanity check */
- if( !line ) return 0;
-
- /* free token strings */
- for(i=0; i< line->ntoken; i++){
- if( line->tokens[i].sval ) xfree(line->tokens[i].sval);
- }
- /* free line strings */
- if( line->types ) xfree(line->types);
- if( line->tokens ) xfree(line->tokens);
- xfree(line);
-
- return 1;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Public Routines
- *
- *
- *----------------------------------------------------------------------------
- */
-
-#ifdef ANSI_FUNC
-int
-ParseWord(int *delims, int *comtab, int nullvalues, int whitespace,
- char *lbuf, void *token, int tmax, int *lptr, int *lastd)
-#else
-int ParseWord(delims, comtab, nullvalues, whitespace,
- lbuf, token, tmax, lptr, lastd)
- int *delims;
- int *comtab;
- int nullvalues;
- int whitespace;
- char *lbuf;
- void *token;
- int tmax;
- int *lptr;
- int *lastd;
-#endif
-{
- int ip;
- int i;
- int tlen;
- int tcomtab[PARSE_TABLE_SIZE];
- char quotes;
- char *tbuf=NULL;
-
- /* null out the output string, if passed in */
- if( tmax )
- *(char *)token = '\0';
-
- /* reset last delimiter */
- *lastd ='\0';
-
- /* look for comtab */
- if( !comtab ){
- memset(tcomtab, 0, PARSE_TABLE_SIZE*sizeof(int));
- comtab = tcomtab;
- }
-
- /* a more convenient pointer */
- ip = *lptr;
-
- /* if no buf, or we are at the end, just return */
- if( !lbuf || !lbuf[ip] ){
- *lastd = '\0';
- return(0);
- }
-
- /* comment at beginning of line, just return */
- if( (ip == 0) && comtab[(int)lbuf[ip]] ){
- *lastd = lbuf[ip];
- ip++;
- return(-2);
- }
-
- /* allocate token space if necessary */
- if( !tmax ){
- tlen = SZ_LINE;
- tbuf = xcalloc(tlen+1, sizeof(char));
- }
- else{
- tbuf = (char *)token;
- tlen = tmax;
- }
-
- /* skip over starting consecutive delims, if not processing null values */
- if( !nullvalues ){
- while( delims[(int)lbuf[ip]] ){
- if( lbuf[ip] == '\0' ){
- *lptr = ip;
- return(0);
- }
- else
- ip++;
- }
- }
-
- /* grab up to next delim or comment */
- for(i=0; lbuf[ip] && !delims[(int)lbuf[ip]] && !comtab[(int)lbuf[ip]]; ip++){
- /*first check for an explicit quote */
- if( lbuf[ip] == '"' ){
- quotes = '"';
- *lastd = '"';
- }
- else if( lbuf[ip] == '\'' ){
- quotes = '\'';
- *lastd = '\'';
- }
- else{
- quotes = '\0';
- }
- /* process quoted string as a single token */
- if( quotes != '\0' ){
- /* bump past quote */
- ip++;
- /* grab up to next quote -- but skip escaped quotes */
- for(; lbuf[ip] != '\0'; ip++){
- if( (lbuf[ip] == quotes) && ((ip==0) || lbuf[ip-1] != '\\') ){
- break;
- }
- else{
- if( (tlen >= 0) && (i >= tlen) ){
- if( tmax ){
- break;
- }
- else{
- tlen += SZ_LINE;
- tbuf = xrealloc(tbuf, tlen);
- }
- }
- tbuf[i++] = lbuf[ip];
- }
- }
- }
- /* single non-quoted token */
- else{
- if( (tlen >= 0) && (i >= tlen) ){
- if( tmax ){
- break;
- }
- else{
- tlen += SZ_LINE;
- tbuf = xrealloc(tbuf, tlen);
- }
- }
- tbuf[i++] = lbuf[ip];
- /* reset lastd to erase any trace of a quoted delim */
- *lastd = '\0';
- }
- }
- /* save this delimiter (unless we ended with a quoted string) */
- if( !*lastd ) *lastd = lbuf[ip];
- /* bump past delimiter (but not null terminator) */
- if( lbuf[ip] ) ip++;
-
- /* realloc if necessary */
- if( !tmax ){
- tbuf = xrealloc(tbuf, i+1);
- *(char **)token = tbuf;
- }
- /* check size one more time */
- if( i >= tlen )
- i = tlen-1;
- /* null terminate */
- tbuf[i] = '\0';
-
- /* remove surrounding white space, if necessary */
- if( !whitespace && (strlen(tbuf)>1) )
- nowhite(tbuf, tbuf);
-
- /* got something */
- *lptr = ip;
- /* make allowance for nullvalues, if necessary */
- if( nullvalues && !i && *lastd ) i = -1;
- return(i);
-}
-
-#ifdef ANSI_FUNC
-Parse
-ParseNew(char *delims, char *comchars, char *eot, char *mode)
-#else
-Parse ParseNew(delims, comchars, eot, mode)
- char *delims;
- char *comchars;
- char *eot;
- char *mode;
-#endif
-{
- int i;
- int ip;
- int lastd;
- int tlen=0;
- int dtable[PARSE_TABLE_SIZE];
- char c;
- char *s;
- char *t;
- char tbuf[SZ_LINE];
- char tbuf2[SZ_LINE];
- Parse parse=NULL;
- static int init=0;
-
- /* allocate parse struct */
- if( (parse = (Parse)xcalloc(1, sizeof(ParseRec))) == NULL )
- return(NULL);
-
- /* initialize globals first time through */
- if( !init ){
- _ParseInitialize();
- init++;
- }
-
- /* reset line counter */
- __parseline = 0;
-
- /* default type conversion scheme */
- parse->convert = PARSE_DEFAULT_CONVERT;
-
- /* set up delim table for removing enclosing chars from keyword strings */
- memset(dtable, 0, PARSE_TABLE_SIZE*sizeof(int));
- dtable[(int)'('] = 1;
- dtable[(int)')'] = 1;
-
- /* set the delim table */
- if( !delims ) delims = PARSE_DEFAULT_DELIMS;
- ip = 0; t = NULL;
- ParseWord(dtable, (int *)NULL, 0, 1, delims, &t, 0, &ip, &lastd);
- for(s=t; s && *s; s++){
- if( (i=(int)*s) == '\\' ){
- s++;
- if( *s == 'n' ) i = '\n';
- else if( *s == 't' ) i = '\t';
- else if( *s == 'r' ) i = '\r';
- else if( *s == 'f' ) i = '\014';
- }
- parse->delimtab[i] = 1;
- }
- if( t ) xfree(t);
-
- /* set the comment table */
- if( !comchars ) comchars = PARSE_DEFAULT_COMCHARS;
- ip = 0; t = NULL;
- ParseWord(dtable, (int *)NULL, 0, 1, comchars, &t, 0, &ip, &lastd);
- for(s=t; s && *s; s++){
- if( (i=(int)*s) == '\\' ){
- s++;
- if( *s == 'n' ) i = '\n';
- else if( *s == 't' ) i = '\t';
- else if( *s == 'r' ) i = '\r';
- else if( *s == 'f' ) i = '\014';
- }
- parse->comtab[i] = 1;
- }
- if( t ) xfree(t);
-
- /* set the eot records */
- if( eot && *eot ){
- ip = 0; t = NULL;
- ParseWord(dtable, (int *)NULL, 0, 1, eot, &t, 0, &ip, &lastd);
- parse->eot = (ParsedEOT)xcalloc(1, sizeof(ParsedEOTRec));
- parse->eot->nline = 0;
- parse->eot->maxline = 1;
- parse->eot->lines =
- (char **)xcalloc(parse->eot->maxline, sizeof(char *));
- *tbuf = '\0';
- tlen = 0;
- /* split up eot string into separate lines */
- for(s=t; s && *s; s++){
- if( (c=*s) == '\\' ){
- s++;
- if( *s == 'n' ) c = '\n';
- else if( *s == 't' ) c = '\t';
- else if( *s == 'r' ) c = '\r';
- else if( *s == 'f' ) c = '\014';
- }
- if( tlen >= SZ_LINE )
- gerror(stderr, "EOT specification is too long (%d)\n", tlen);
- tbuf[tlen++] = c;
- /* handle end of one line */
- if( c == '\n' ){
- tbuf[tlen] = '\0';
- parse->eot->lines[parse->eot->nline] = xstrdup(tbuf);
- parse->eot->nline++;
- while( parse->eot->nline >= parse->eot->maxline ){
- parse->eot->maxline++;
- parse->eot->lines =
- (char **)xrealloc(parse->eot->lines,
- parse->eot->maxline * sizeof(char *));
- parse->eot->lines[parse->eot->maxline-1] = NULL;
- }
- *tbuf = '\0';
- tlen = 0;
- }
- }
- /* process final line, if \n was not the last char */
- if( *tbuf ){
- tbuf[tlen++] = '\n';
- tbuf[tlen] = '\0';
- parse->eot->lines[parse->eot->nline] = xstrdup(tbuf);
- parse->eot->nline++;
- }
- if( t ) xfree(t);
- }
-
- /* process mode string */
- if( mode && *mode ){
- strncpy(tbuf, mode, SZ_LINE-1);
- tbuf[SZ_LINE-1] = '\0';
- if( keyword(tbuf, "nullvalues", tbuf2, SZ_LINE) )
- parse->nullvalues = istrue(tbuf2);
- if( keyword(tbuf, "whitespace", tbuf2, SZ_LINE) )
- parse->whitespace = istrue(tbuf2);
- if( keyword(tbuf, "header", tbuf2, SZ_LINE) )
- parse->needheader = istrue(tbuf2);
- if( keyword(tbuf, "units", tbuf2, SZ_LINE) )
- parse->needunits = istrue(tbuf2);
- if( keyword(tbuf, "i2f", tbuf2, SZ_LINE) )
- parse->i2f = istrue(tbuf2);
- if( keyword(tbuf, "debug", tbuf2, SZ_LINE) ){
- if( istrue(tbuf2) )
- parse->debug = 1;
- else if( isfalse(tbuf2) )
- parse->debug = 0;
- else
- parse->debug = atoi(tbuf2);
- }
- if( keyword(tbuf, "convert", tbuf2, SZ_LINE) ){
- if( istrue(tbuf2) )
- parse->convert = 1;
- else if( isfalse(tbuf2) )
- parse->convert = 0;
- }
- if( keyword(tbuf, "comeot", tbuf2, SZ_LINE) ){
- if( istrue(tbuf2) )
- parse->comeot = 1;
- else if( isfalse(tbuf2) )
- parse->comeot = 0;
- else
- parse->comeot = atoi(tbuf2);
- }
- if( keyword(tbuf, "lazyeot", tbuf2, SZ_LINE) ){
- if( istrue(tbuf2) )
- parse->lazyeot = 1;
- else if( isfalse(tbuf2) )
- parse->lazyeot = 0;
- }
- }
-
- /* save inputs */
- parse->delims = xstrdup(delims);
- parse->comchars = xstrdup(comchars);
- parse->mode = xstrdup(mode);
-
- /* start out in initial state */
- parse->state = PARSE_STATE_INITIAL;
-
- /* return the news */
- return parse;
-}
-
-#ifdef ANSI_FUNC
-int
-ParseLine(Parse parse, char *lbuf, char *UNUSED(mode))
-#else
-int ParseLine(parse, lbuf, mode)
- Parse parse;
- char *lbuf;
- char *mode;
-#endif
-{
- int i;
- int got;
- int ip;
- ParsedLine line=NULL;
-
- /* use default if necessary */
- if( !parse ) parse = _parse;
-
- /* if we have turned this parser off, just return */
- if( parse->state & PARSE_STATE_BAD ) return 0;
-
- /* shuffle lines as needed */
- if( parse->cur ){
- /* if cur is a comment, just clear it */
- if( PARSE_ISCOMMENT(parse->cur) ){
- _ParseLineFree(parse->cur);
- }
- /* valid line gets moved into prev */
- else{
- if( parse->prev ){
- if( parse->prev2 ) _ParseLineFree(parse->prev2);
- parse->prev2 = parse->prev;
- }
- parse->prev = parse->cur;
- }
- /* allocate space for the line */
- parse->cur = (ParsedLine)xcalloc(1, sizeof(ParsedLineRec));
- }
- else{
- /* allocate space for the line */
- parse->cur = (ParsedLine)xcalloc(1, sizeof(ParsedLineRec));
- }
-
- /* convenience pointer to current */
- line = parse->cur;
-
- /* increment line number */
- parse->nline++;
-
- /* initialize line if necessary */
- if( !line->tokens ){
- line->maxtoken = PARSE_TOKEN_INCR;
- line->tokens = (ParsedToken)xcalloc(line->maxtoken,sizeof(ParsedTokenRec));
- line->types = (char *)xcalloc((line->maxtoken+1), sizeof(char));
- }
-
- /* look for EOT */
- if( (got=_ParseEOT(parse, lbuf)) != 0 ){
- i = 0;
- /* end of table */
- if( got == 1 )
- line->tokens[i].type = PARSE_EOT;
- else
- /* first part of multi-line EOT -- treat as comment */
- line->tokens[i].type = PARSE_COMMENT;
- /* add type to line types */
- line->types[i] = line->tokens[i].type;
- /* increment the number of times we have seen this type */
- line->ntypes[line->tokens[i].type] += 1;
- /* bump index so we can null terminate properly */
- i++;
- goto done;
- }
-
- /* process each token in the line */
- for(i=0, ip=0; lbuf[ip]; i++){
- /* make sure we have enough room */
- if( i >= line->maxtoken ){
- line->maxtoken += PARSE_TOKEN_INCR;
- line->tokens = (ParsedToken)xrealloc(line->tokens,
- line->maxtoken*sizeof(ParsedTokenRec));
- line->types = (char *)xrealloc(line->types,
- (line->maxtoken+1)*sizeof(char));
- }
-
- /* process next word, and break if we don't get something */
- got=ParseWord(parse->delimtab, parse->comtab,
- parse->nullvalues, parse->whitespace,
- lbuf, &(line->tokens[i].sval), 0, &ip,
- &(line->tokens[i].delim));
- /* analyze result */
- if( (got == 0)
- && (line->tokens[i].delim != '\'') && (line->tokens[i].delim != '"') ){
- /* end of line (probably some extra spaces), so free up sval */
- if( line->tokens[i].sval ){
- xfree(line->tokens[i].sval);
- line->tokens[i].sval = NULL;
- }
- break;
- }
- else if( got < 0 ){
- if( got == -3 )
- /* end of table */
- line->tokens[i].type = PARSE_EOT;
- else if( got == -2)
- /* comment */
- line->tokens[i].type = PARSE_COMMENT;
- else if( got == -1 )
- /* null value */
- line->tokens[i].type = PARSE_NULL;
- /* add type to line types */
- line->types[i] = line->tokens[i].type;
- /* increment the number of times we have seen this type */
- line->ntypes[line->tokens[i].type] += 1;
- /* for all but NULL, we are done with this line */
- if( line->types[i] != PARSE_NULL ){
- /* bump index so we can null terminate properly */
- i++;
- break;
- }
- }
- else{
- /* valid token, set token type */
- if( parse->convert ){
- if( (line->tokens[i].delim == '\'') || (line->tokens[i].delim == '"') )
- line->tokens[i].type = PARSE_STRING;
- else
- line->tokens[i].type =
- _gettype(line->tokens[i].sval,
- &line->tokens[i].dval,
- &line->tokens[i].lval);
- }
- else{
- line->tokens[i].type = PARSE_STRING;
- }
- /* add type to line types */
- line->types[i] = line->tokens[i].type;
- /* increment the number of times we have seen this type */
- line->ntypes[line->tokens[i].type] += 1;
- }
- }
-
-done:
- /* null terminate and realloc to actual size */
- line->types[i] = '\0';
- line->maxtoken = i;
- line->tokens = (ParsedToken)xrealloc(line->tokens, i*sizeof(ParsedTokenRec));
- line->types = (char *)xrealloc(line->types, (i+1)*sizeof(char));
- /* finalize total number of tokens processed */
- line->ntoken = i;
- /* get parse state for this line */
- if( line->types[0] == PARSE_EOT ){
- line->state = PARSE_STATE_EOT;
- }
- else{
- line->state = _ParseLineState(parse, parse->state, NULL);
- }
-
- /* set line info in main record structure for access convenience */
- parse->state = line->state;
- parse->ntoken = line->ntoken;
- parse->types = line->types;
- parse->tokens = line->tokens;
-
- /* return the news */
- return parse->ntoken;
-}
-
-#ifdef ANSI_FUNC
-int
-ParseAnalyze(Parse *parsers, int nparser, char *lbuf)
-#else
-int ParseAnalyze(parsers, nparser, lbuf)
- Parse *parsers;
- int nparser;
- char *lbuf;
-#endif
-{
- int i, p;
- int eot=0;
- int np=0;
- int tmax=0;
- ParsedLine line;
-
- /* parse the line using all parsers */
- for(p=0; p<nparser; p++){
- if( parsers[p]->state & PARSE_STATE_BAD ) continue;
- if( parsers[p]->state & PARSE_STATE_EOT ) continue;
- ParseLine(parsers[p], lbuf, NULL);
- if( parsers[p]->state & PARSE_STATE_EOT ) eot++;
- if( parsers[p]->debug > 1 ){
- fprintf(stderr, "PARSE %d: state %x %s", p, parsers[p]->state, lbuf);
- }
- }
- /* if some parsers found eot, but others did not, we can no longer use
- the latter */
- if( eot ){
- for(p=0; p<nparser; p++){
- if( parsers[p]->state & PARSE_STATE_BAD ) continue;
- if( parsers[p]->state & PARSE_STATE_EOT ) continue;
- /* this parser is in an unknown state */
- parsers[p]->state = PARSE_STATE_UNKNOWN;
- if( parsers[p]->debug > 1 ){
- fprintf(stderr, "PARSE %d: did not find EOT (state unknown)\n", p);
- }
- }
- /* exit on EOT */
- return -1;
- }
-
- /* analyze each parser */
- /* remove any parsers where the number of args changes */
- for(p=0; p<nparser; p++){
- /* skip bad parsers */
- if( parsers[p]->state & PARSE_STATE_BAD ) continue;
- if( parsers[p]->state & PARSE_STATE_EOT ) continue;
- line = parsers[p]->cur;
- /* skip comments */
- if( line->types[0] == PARSE_COMMENT ) continue;
- /* make sure current ntokens == previous (non-comment) ntokens */
- if( parsers[p]->prev ){
- if( parsers[p]->prev->ntoken != parsers[p]->cur->ntoken ){
- parsers[p]->state = PARSE_STATE_BADMATCH;
- if( parsers[p]->debug ){
- fprintf(stderr, "PARSE: badmatch %d/%d: %d %d\n",
- p, __parseline,
- parsers[p]->prev->ntoken, parsers[p]->cur->ntoken);
- }
- }
- /* check data type transitions */
- if( parsers[p]->prev->state & PARSE_STATE_DATA ){
- for(i=0; i<parsers[p]->ntoken; i++){
- /* skip check if prev line did not had this many tokens */
- if( i > parsers[p]->prev->ntoken ) break;
- switch(_ctab[(int)parsers[p]->prev->types[i]][(int)parsers[p]->cur->types[i]]){
- case -1:
- /* i2f conversion explicity permitted is OK */
- if( parsers[p]->i2f ){
- break;
- }
- /* current data type same as initial data type is OK */
- if( parsers[p]->data1 && (i <= parsers[p]->data1->ntoken) &&
- (parsers[p]->data1->types[i] == parsers[p]->cur->types[i]) ){
- break;
- }
- /* bad i2f conversion: drop through to error */
- case 0:
- parsers[p]->state = PARSE_STATE_BADMATCH;
- if( parsers[p]->debug ){
- fprintf(stderr, "PARSE: badconv %d/%d/%d: %c->%c\n",
- p, __parseline, i,
- parsers[p]->prev->types[i], parsers[p]->cur->types[i]);
- }
- break;
- case 1:
- break;
- }
- }
- }
- }
- if( !(parsers[p]->state & PARSE_STATE_BAD) ){
- tmax=MAX(tmax, parsers[p]->ntoken);
- }
- }
-
- /* remove parsers with < tmax tokens */
- if( tmax > 2) tmax = 2;
- for(p=0; p<nparser; p++){
- /* skip bad parsers */
- if( parsers[p]->state & PARSE_STATE_BAD ) continue;
- if( parsers[p]->state & PARSE_STATE_EOT ) continue;
- /* skip comments */
- if( parsers[p]->types[0] == PARSE_COMMENT ) continue;
- /* check current number of tokens */
- if( parsers[p]->ntoken > 0 ){
- if( parsers[p]->ntoken < tmax ){
- parsers[p]->state = PARSE_STATE_BADMAX;
- if( parsers[p]->debug ){
- fprintf(stderr, "PARSE: badmax %d/%d: %d < %d\n",
- p, __parseline, parsers[p]->ntoken, tmax);
- }
- }
- }
- }
-
- /* make sure we still have a parser left */
- for(np=0, p=0; p<nparser; p++){
- if( parsers[p]->state & PARSE_STATE_BAD ) continue;
- if( parsers[p]->state & PARSE_STATE_EOT ) continue;
- np++;
- }
-
- /* parsed another line */
- __parseline++;
- /* we either have parsers (np>0) or an error condition (np==0) */
- return np;
-}
-
-#ifdef ANSI_FUNC
-ParsedLine
-ParseLineDup(Parse parse, ParsedLine line)
-#else
-ParsedLine ParseLineDup(parse, line)
- Parse parse;
- ParsedLine line;
-#endif
-{
- int i;
- ParsedLine nline;
-
- /* sanity check */
- if( !parse ) return NULL;
-
- /* rellocate everything */
- if( !(nline = (ParsedLine)xcalloc(1, sizeof(ParsedLineRec))) ) return NULL;
- memcpy(nline, line, sizeof(ParsedLineRec));
- nline->tokens = (ParsedToken)xcalloc(line->maxtoken, sizeof(ParsedTokenRec));
- memcpy(nline->tokens, line->tokens, line->maxtoken*sizeof(ParsedTokenRec));
- for(i=0; i<nline->ntoken; i++){
- nline->tokens[i].sval = xstrdup(line->tokens[i].sval);
- }
- nline->types = (char *)xcalloc((line->maxtoken+1), sizeof(char));
- memcpy(nline->types, line->types, line->maxtoken+1);
- return nline;
-}
-
-#ifdef ANSI_FUNC
-int
-ParseReset(Parse parse, ParsedLine line, int state)
-#else
- int ParseReset(parse, line, state)
- Parse parse;
- ParsedLine line;
- int state;
-#endif
-{
- if( !parse ) return 0;
-
- if( parse->prev2 ){
- _ParseLineFree(parse->prev2);
- parse->prev2 = NULL;
- }
- if( parse->prev ){
- _ParseLineFree(parse->prev);
- parse->prev = NULL;
- }
- if( parse->cur ){
- _ParseLineFree(parse->cur);
- parse->cur = NULL;
- }
- if( parse->header ){
- _ParseLineFree(parse->header);
- parse->header = NULL;
- }
- if( parse->units ){
- _ParseLineFree(parse->units);
- parse->units = NULL;
- }
- if( parse->data1 ){
- _ParseLineFree(parse->data1);
- parse->data1 = NULL;
- }
- if( parse->eot ) parse->eot->ncur = 0;
- parse->ntoken = 0;
- parse->types = NULL;
- parse->tokens = NULL;
-
- /* initialize as specified */
- if( line ){
- parse->cur = line;
- }
- if( state ){
- parse->state = state;
- }
- else{
- parse->state = PARSE_STATE_INITIAL;
- }
-
- return 1;
-}
-
-#ifdef ANSI_FUNC
-int
-ParseFree(Parse parse)
-#else
-int ParseFree(parse)
- Parse parse;
-#endif
-{
- int i;
-
- /* sanity check */
- if( !parse ) return 0;
-
- /* reset frees up some space */
- ParseReset(parse, NULL, 0);
-
- /* free up remainder of allocated space */
- if( parse->delims ) xfree(parse->delims);
- if( parse->comchars ) xfree(parse->comchars);
- if( parse->mode ) xfree(parse->mode);
- if( parse->eot ){
- if( parse->eot->lines ){
- for(i=0; i<parse->eot->maxline; i++){
- if( parse->eot->lines[i] ) xfree(parse->eot->lines[i]);
- }
- xfree(parse->eot->lines);
- }
- xfree(parse->eot);
- }
-
- /* free struct */
- xfree(parse);
-
- /* return the news */
- return 1;
-}
-
-#ifdef ANSI_FUNC
-int
-ParseDataType(char *s, double *dval, longlong *ival)
-#else
- int ParseFree(s, dval, ival)
- char *s;
- double *dval;
- longlong *ival;
-#endif
-{
- return _gettype(s, dval, ival);
-}
diff --git a/funtools/util/parse.h b/funtools/util/parse.h
deleted file mode 100644
index 58339f0..0000000
--- a/funtools/util/parse.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2004 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * parse.h - include file for the indexed man pager
- *
- */
-
-#ifndef __parse_h
-#define __parse_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-#include <ctype.h>
-
-#include "prsetup.h"
-#include "strtod.h"
-#include "xalloc.h"
-#include "word.h"
-#include "gio.h"
-#include "longlong.h"
-
-#define PARSE_DEBUG 1
-#if PARSE_DEBUG
-#define FPRINTF(x) fprintf x
-#define PERROR(x) perror x
-#else
-#define FPRINTF(x)
-#define PERROR(x)
-#endif
-
-#define PARSE_TABLE_SIZE 256
-#define PARSE_TOKEN_INCR 1024
-#define PARSE_DEFAULT_DELIMS " \t\n"
-#define PARSE_DEFAULT_COMCHARS "#\n"
-#define PARSE_DEFAULT_CONVERT 1
-#define PARSE_DEFAULT_NULLVALUES "nullvalue=false"
-#define PARSE_DEFAULT_WHITESPACE "whitespace=true"
-#define PARSE_DEFAULT_UNITS "units=false"
-#define PARSE_DEFAULT_COMEOT "comeot=1"
-#define PARSE_DEFAULT_LAZYEOT "lazyeot=1"
-#define PARSE_DEFAULT_ALEN 16
-
-/* token types */
-#define PARSE_COMMENT 'c'
-#define PARSE_DASH 'd'
-#define PARSE_EOL 'e'
-#define PARSE_FLOAT 'f'
-#define PARSE_HEXINT 'h'
-#define PARSE_INTEGER 'i'
-#define PARSE_NULL 'n'
-#define PARSE_STRING 's'
-#define PARSE_EOT 'z'
-
-
-/* machine states */
-#define PARSE_STATE_INITIAL 1
-#define PARSE_STATE_STRING 2
-#define PARSE_STATE_DATA 4
-#define PARSE_STATE_BADMATCH 8
-#define PARSE_STATE_BADMAX 16
-#define PARSE_STATE_BADTYPE 32
-#define PARSE_STATE_NEXTLINE 64
-#define PARSE_STATE_REDOLINE 128
-#define PARSE_STATE_UNKNOWN 256
-#define PARSE_STATE_EOT 512
-
-/* define if a change from numeric columns to an ascii column signals EOT,
- instead of BADTYPE */
-#define PARSE_LOOSELY 1
-
-#define PARSE_STATE_BAD (PARSE_STATE_BADMATCH|PARSE_STATE_BADMAX|PARSE_STATE_BADTYPE|PARSE_STATE_UNKNOWN)
-#define PARSE_ISCOMMENT(line) (line->types[0] == PARSE_COMMENT)
-
-typedef struct parsedtokenRec{
- char *sval;
- double dval;
- longlong lval;
- int type;
- int delim;
-} *ParsedToken, ParsedTokenRec;
-
-typedef struct parsedlineRec{
- int state;
- int ntoken;
- char *types;
- int ntypes[PARSE_TABLE_SIZE];
- int maxtoken;
- ParsedToken tokens;
-} *ParsedLine, ParsedLineRec;
-
-typedef struct eotRec{
- int nline;
- int maxline;
- int ncur;
- char **lines;
-} *ParsedEOT, ParsedEOTRec;
-
-typedef struct parseRec{
- char *delims;
- char *comchars;
- char *mode;
- int debug;
- int delimtab[PARSE_TABLE_SIZE];
- int comtab[PARSE_TABLE_SIZE];
- ParsedEOT eot;
- int nullvalues;
- int whitespace;
- int needheader;
- int needunits;
- int comeot;
- int lazyeot;
- int i2f;
- int convert;
- int nline;
- ParsedLine prev2;
- ParsedLine prev;
- ParsedLine cur;
- ParsedLine header;
- ParsedLine units;
- ParsedLine data1;
- int state;
- int ntoken;
- int data;
- char *types;
- ParsedToken tokens;
-} *Parse, ParseRec;
-
-_PRbeg
-
-Parse ParseNew _PRx((char *delims, char *comchars, char *eot, char *mode));
-
-ParsedLine ParseLineDup _PRx((Parse parse, ParsedLine line));
-
-int ParseWord _PRx((int *delims, int *comtab, int nullvalues, int whitespace,
- char *lbuf, void *token, int tmax,
- int *lptr, int *lastd));
-
-int ParseLine _PRx((Parse parse, char *lbuf, char *mode));
-
-int ParseAnalyze _PRx((Parse *parsers, int nparser, char *lbuf));
-
-int ParseReset _PRx((Parse parse, ParsedLine line, int state));
-
-int ParseFree _PRx((Parse parse));
-
-int ParseDataType _PRx((char *s, double *dval, longlong *ival));
-
-_PRend
-
-#endif /* __parse.h */
diff --git a/funtools/util/prsetup.h b/funtools/util/prsetup.h
deleted file mode 100644
index c8057f9..0000000
--- a/funtools/util/prsetup.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/* prsetup.h -- define variables for ANSI prototyping */
-
-#ifndef _prsetup
-#define _prsetup
-
-#ifdef NO_ANSI_FUNC
-#define _PRbeg
-#define _PRend
-#define _PRx(s) ()
-#ifdef ANSI_FUNC
-#undef ANSI_FUNC
-#endif
-#else
-#if defined(__cplusplus) || defined(c_plusplus)
-#define _PRbeg extern "C" { /* do not leave open across includes */
-#define _PRend }
-#define _PRx(s) s
-#define ANSI_FUNC 1
-#else
-#if defined(__STDC__)
-#define _PRbeg
-#define _PRend
-#define _PRx(s) s
-#define ANSI_FUNC 1
-#else
-#define _PRbeg
-#define _PRend
-#define _PRx(s) ()
-#ifdef ANSI_FUNC
-#undef ANSI_FUNC
-#endif
-#endif
-#endif
-#endif
-
-#ifndef UNUSED
-#ifdef __GNUC__
-# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
-#else
-# define UNUSED(x) UNUSED_ ## x
-#endif
-#endif
-
-/* the ever-present */
-#ifndef SZ_LINE
-#define SZ_LINE 4096
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-#ifndef ABS
-#define ABS(x) ((x)<0?(-(x)):(x))
-#endif
-
-#endif
-
diff --git a/funtools/util/strtod.c b/funtools/util/strtod.c
deleted file mode 100644
index ce69a37..0000000
--- a/funtools/util/strtod.c
+++ /dev/null
@@ -1,190 +0,0 @@
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-#include <stdio.h>
-#include <ctype.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#else
-double strtod();
-#endif
-#include <math.h>
-
-int SAOdtype=0;
-
-double SAOstrtod(str, ptr)
- char *str;
- char **ptr;
-{
- double d = 0.0;
- double m = 0.0;
- double s = 0.0;
- char *p, *px;
- char c;
-
- SAOdtype = 0;
-
- if ( ptr == NULL ) ptr = &p;
- while ( *str == ' ' ) str++;
-
-
- /* No base implied (yet).
- */
- d = strtod(str, ptr);
- px = *ptr;
-
- if( strchr(str, (int)'.') )
- SAOdtype = '.';
-
- if ( ( c = **ptr )
- && ( c == 'h' || c == 'd' || c == ':' || c == ' ' || c == 'm' )
- && ( (*ptr - str) <= 4 )
- && ( ( isdigit((int)*((*ptr)+1)) )
- || ( (*((*ptr)+1)) == ' ' && isdigit((int)*((*ptr)+2)) ) ) ) {
- double sign = 1.0;
-
- SAOdtype = c;
- (*ptr)++;
-
- if ( *str == '-' ) {
- sign = -1.0;
- d = -d;
- }
-
- m = strtod(*ptr, ptr);
-
- if ( c == 'm' ) {
- s = m;
- m = d;
- d = 0.0;
- } else
- if ( ( c = **ptr )
- && ( c == ':' || c == ' ' || c == 'm' )
- && ( (*ptr - px) <= 3 )
- && ( ( isdigit((int)*((*ptr)+1)) )
- || ( (*((*ptr)+1)) == ' ' && isdigit((int)*((*ptr)+2))))) {
-
- (*ptr)++;
-
- s = strtod(*ptr, ptr);
- }
-
- return sign * (d + m / 60 + s / 3600);
- }
-
- /* I guess that there wern't really any units.
- */
- return d;
-}
-
-char *SAOconvert(buff, val, type, prec)
- char *buff;
- double val;
- int type;
- int prec;
-{
- char fmt[32];
- char *sign = "";
-
- float degrees = val;
- float minutes;
- float seconds;
-
- char ch1, ch2;
-
- switch ( type ) {
- case 'b': {
- int v = val;
- unsigned int i;
- int c = 2;
-
- buff[0] = '0';
- buff[1] = 'b';
-
- for ( i = 0x8000; i; i /= 2 ) {
- if ( v & i || c > 2 ) {
- buff[c] = v & i ? '1' : '0';
- c++;
- }
- }
-
- buff[c] = '\0';
- return buff;
- }
- case 'o':
- sprintf(buff, "0o%o", (int) val);
- return buff;
-
- case 'x':
- sprintf(buff, "0x%x", (int) val);
- return buff;
-
- case ':': ch1 = ':'; ch2 = ':'; break;
- case ' ': ch1 = ' '; ch2 = ' '; break;
- case 'h': ch1 = 'h'; ch2 = 'm'; break;
- case 'd': ch1 = 'd'; ch2 = 'm'; break;
- case 'm': ch1 = 'm'; ch2 = 'm'; break;
- default: return 0;
- }
-
- if ( degrees < 0.0 ) {
- sign = "-";
- degrees = - degrees;
- }
-
- minutes = (degrees - ((int) degrees)) * 60;
- if ( minutes < 0 ) minutes = 0.0;
- seconds = (minutes - ((int) minutes)) * 60;
- if ( seconds < 0 ) seconds = 0.0;
-
- if ( prec == -1 ){
- if ( type == 'h' ) prec = 4;
- else prec = 3;
- }
- if ( prec == -2 ) {
- if ( type == 'm' ){
- if ( seconds < 10.0 )
- sprintf(buff, "%s%d%c0%g"
- , sign, (int)(minutes+degrees*60), ch2, seconds);
- else
- sprintf(buff, "%s%d%c%g"
- , sign, (int)(minutes+degrees*60), ch2, seconds);
- }
- else if ( seconds < 10.0 )
- sprintf(buff, "%s%d%c0%2d%c0%g"
- , sign, (int) (degrees)
- , ch1 , (int) (minutes)
- , ch2, seconds);
- else
- sprintf(buff, "%s%d%c%2d%c%g"
- , sign, (int) (degrees)
- , ch1 , (int) (minutes)
- , ch2, seconds);
- } else {
- double p = pow(10.0, (double) prec);
- int m = minutes;
- int d = degrees;
-
- if ( (((int)(seconds * p + .5))/ p) >= 60 ) {
- seconds = 0.0;
- m++;
- if ( m >= 60 ) {
- m = 0;
- d++;
- }
- }
-
- if ( (((int)(seconds * p + .5))/ p) < 10.0 )
- sprintf(fmt, "%%s%%d%c%%2.2d%c0%%.%df", ch1, ch2, prec);
- else
- sprintf(fmt, "%%s%%d%c%%2.2d%c%%.%df" , ch1, ch2, prec);
-
- sprintf(buff, fmt, sign, d, m, seconds);
- }
-
- return buff;
-}
-
diff --git a/funtools/util/strtod.h b/funtools/util/strtod.h
deleted file mode 100644
index 580902a..0000000
--- a/funtools/util/strtod.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * strtod.h -- declarations for SAOstrtod()
- *
- */
-
-#ifndef __strtod_h
-#define __strtod_h
-
-#include "prsetup.h"
-
-extern int SAOdtype;
-
-_PRbeg
-double SAOstrtod _PRx((char *s, char **t));
-_PRend
-
-#endif
diff --git a/funtools/util/swap.c b/funtools/util/swap.c
deleted file mode 100644
index 320b241..0000000
--- a/funtools/util/swap.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * swap.c -- swap data between native and IEEE format
- *
- *
- */
-
-#include <stdio.h>
-#include <prsetup.h>
-#include <swap.h>
-
-/*
- *
- * swap.c -- routines to swap parts of data
- *
- */
-
-#define _idx(x, n) ((unsigned char *) x)[n]
-
-/* from Harbison&Steele by way of GNU cinfigure ...
- returns 1 for bigendian, 0 for littleendian */
-#ifdef ANSI_FUNC
-int
-is_bigendian (void)
-#else
-int is_bigendian()
-#endif
-{
- union
- {
- long l;
- char c[sizeof (long)];
- } u;
- u.l = 1;
- return(u.c[sizeof (long) - 1] == 1);
-}
-
-#ifdef ANSI_FUNC
-void
-swap_short (short *buf, int n)
-#else
-void swap_short(buf, n)
- short *buf;
- int n;
-#endif
-{
- int i;
- register short *ptr;
- short val;
-
- ptr = buf;
- for(i=0; i<n; i++){
- _idx(&val, 0) = _idx(ptr, 1);
- _idx(&val, 1) = _idx(ptr, 0);
- *ptr++ = val;
- }
-}
-
-#ifdef ANSI_FUNC
-void
-swap_ushort (unsigned short *buf, int n)
-#else
-void swap_ushort(buf, n)
- unsigned short *buf;
- int n;
-#endif
-{
- int i;
- register unsigned short *ptr;
- unsigned short val;
-
- ptr = buf;
- for(i=0; i<n; i++){
- _idx(&val, 0) = _idx(ptr, 1);
- _idx(&val, 1) = _idx(ptr, 0);
- *ptr++ = val;
- }
-}
-
-#ifdef ANSI_FUNC
-void
-swap_int (int *buf, int n)
-#else
-void swap_int(buf, n)
- int *buf;
- int n;
-#endif
-{
- int i;
- register int *ptr;
- int val;
-
- ptr = buf;
- for(i=0; i<n; i++){
- _idx(&val, 0) = _idx(ptr, 3);
- _idx(&val, 1) = _idx(ptr, 2);
- _idx(&val, 2) = _idx(ptr, 1);
- _idx(&val, 3) = _idx(ptr, 0);
- *ptr++ = val;
- }
-}
-
-#ifdef ANSI_FUNC
-void
-swap_uint (unsigned int *buf, int n)
-#else
-void swap_uint(buf, n)
- unsigned int *buf;
- int n;
-#endif
-{
- int i;
- register unsigned int *ptr;
- unsigned int val;
-
- ptr = buf;
- for(i=0; i<n; i++){
- _idx(&val, 0) = _idx(ptr, 3);
- _idx(&val, 1) = _idx(ptr, 2);
- _idx(&val, 2) = _idx(ptr, 1);
- _idx(&val, 3) = _idx(ptr, 0);
- *ptr++ = val;
- }
-}
-
-#ifdef ANSI_FUNC
-void
-swap_float (float *buf, int n)
-#else
-void swap_float(buf, n)
- float *buf;
- int n;
-#endif
-{
- int i;
- register float *ptr;
- float val;
-
- ptr = buf;
- for(i=0; i<n; i++){
- _idx(&val, 0) = _idx(ptr, 3);
- _idx(&val, 1) = _idx(ptr, 2);
- _idx(&val, 2) = _idx(ptr, 1);
- _idx(&val, 3) = _idx(ptr, 0);
- *ptr++ = val;
- }
-}
-
-#ifdef ANSI_FUNC
-void
-swap_double (double *buf, int n)
-#else
-void swap_double(buf, n)
- double *buf;
- int n;
-#endif
-{
- int i;
- register double *ptr;
- double val;
-
- ptr = buf;
- for(i=0; i<n; i++){
- _idx(&val, 0) = _idx(ptr, 7);
- _idx(&val, 1) = _idx(ptr, 6);
- _idx(&val, 2) = _idx(ptr, 5);
- _idx(&val, 3) = _idx(ptr, 4);
- _idx(&val, 4) = _idx(ptr, 3);
- _idx(&val, 5) = _idx(ptr, 2);
- _idx(&val, 6) = _idx(ptr, 1);
- _idx(&val, 7) = _idx(ptr, 0);
- *ptr++ = val;
- }
-}
-
-/*
- *
-
- *
- */
-#ifdef ANSI_FUNC
-void
-swap_data(void *buf, int len, int dtype)
-#else
-void swap_data(buf, len, dtype)
- void *buf;
- int len;
- int dtype;
-#endif
-{
- /* set up input data pointer */
- switch(dtype){
- case TY_CHAR:
- case 'B':
- break;
- case TY_SHORT:
- case 'I':
- swap_short((short *)buf, len);
- break;
- case TY_USHORT:
- case 'U':
- swap_ushort((unsigned short *)buf, len);
- break;
- case TY_INT:
- case 'J':
- swap_int((int *)buf, len);
- break;
- case 'V':
- swap_uint((unsigned int *)buf, len);
- break;
- case TY_FLOAT:
- case 'E':
- swap_float((float *)buf, len);
- break;
- case TY_DOUBLE:
- case 'F':
- swap_double((double *)buf, len);
- break;
- default:
- fprintf(stderr, "ERROR: unknown input data type %d\n", dtype);
- break;
- }
-}
-
diff --git a/funtools/util/swap.h b/funtools/util/swap.h
deleted file mode 100644
index cb6a7db..0000000
--- a/funtools/util/swap.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * swap.h -- declarations for swap
- *
- */
-
-#ifndef __swap_h
-#define __swap_h
-
-#include "prsetup.h"
-
-/* data types */
-#define TY_CHAR 1
-#define TY_USHORT -2
-#define TY_SHORT 2
-#define TY_INT 4
-#define TY_FLOAT -4
-#define TY_DOUBLE -8
-
-_PRbeg
-
-int is_bigendian _PRx((void));
-void swap_short _PRx((short *buf, int n));
-void swap_ushort _PRx((unsigned short *buf, int n));
-void swap_int _PRx((int *buf, int n));
-void swap_uint _PRx((unsigned int *buf, int n));
-void swap_float _PRx((float *buf, int n));
-void swap_double _PRx((double *buf, int n));
-void swap_data _PRx((void *buf, int len, int dtype));
-
-_PRend
-
-#endif
diff --git a/funtools/util/tcl.m4 b/funtools/util/tcl.m4
deleted file mode 100644
index 8125361..0000000
--- a/funtools/util/tcl.m4
+++ /dev/null
@@ -1,2464 +0,0 @@
-#------------------------------------------------------------------------
-# SC_PATH_TCLCONFIG --
-#
-# Locate the tclConfig.sh file and perform a sanity check on
-# the Tcl compile flags
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --with-tcl=...
-#
-# Defines the following vars:
-# TCL_BIN_DIR Full path to the directory containing
-# the tclConfig.sh file
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_TCLCONFIG, [
- #
- # Ok, lets find the tcl configuration
- # First, look for one uninstalled.
- # the alternative search directory is invoked by --with-tcl
- #
-
- if test x"${no_tcl}" = x ; then
- # we reset no_tcl in case something fails here
- no_tcl=true
- AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
- AC_MSG_CHECKING([for Tcl configuration])
- if test x"${withval}" != xno ; then
- AC_CACHE_VAL(ac_cv_c_tclconfig,[
-
- # First check to see if --with-tcl was specified.
- if test x"${with_tclconfig}" != x ; then
- if test -f "${with_tclconfig}/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
- else
- AC_MSG_RESULT([${with_tclconfig} directory doesn't contain tclConfig.sh])
- fi
- fi
-
- # then check for a private Tcl installation
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ../tcl \
- `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../tcl \
- `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../../tcl \
- `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
-
- # check in a few common install locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in `ls -d ${libdir} 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` \
- `ls -d /usr/contrib/lib 2>/dev/null` \
- `ls -d /usr/lib 2>/dev/null` \
- ; do
- if test -f "$i/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i; pwd)`
- break
- fi
- done
- fi
-
- # check in a few other private locations
- if test x"${ac_cv_c_tclconfig}" = x ; then
- for i in \
- ${srcdir}/../tcl \
- `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tclConfig.sh" ; then
- ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
- ])
- else
- AC_MSG_RESULT(skipping Tcl configuration)
- ac_cv_c_tclconfig="none"
- fi
-
- if test x"${ac_cv_c_tclconfig}" = x ; then
- TCL_BIN_DIR="# no Tcl configs found"
- AC_MSG_RESULT(can't find Tcl configuration definitions)
-# no Tcl is OK egm 03/25/03
-# AC_MSG_WARN(Can't find Tcl configuration definitions)
-# exit 0
- elif test x"${ac_cv_c_tclconfig}" = xnone ; then
- TCL_BIN_DIR=""
- else
- no_tcl=
- TCL_BIN_DIR=${ac_cv_c_tclconfig}
- AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
- fi
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_PATH_TKCONFIG --
-#
-# Locate the tkConfig.sh file
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --with-tk=...
-#
-# Defines the following vars:
-# TK_BIN_DIR Full path to the directory containing
-# the tkConfig.sh file
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_TKCONFIG, [
- #
- # Ok, lets find the tk configuration
- # First, look for one uninstalled.
- # the alternative search directory is invoked by --with-tk
- #
-
- if test x"${no_tk}" = x ; then
- # we reset no_tk in case something fails here
- no_tk=true
- AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
- AC_MSG_CHECKING([for Tk configuration])
- AC_CACHE_VAL(ac_cv_c_tkconfig,[
-
- # First check to see if --with-tkconfig was specified.
- if test x"${with_tkconfig}" != x ; then
- if test -f "${with_tkconfig}/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
- else
- AC_MSG_RESULT([${with_tkconfig} directory doesn't contain tkConfig.sh])
- fi
- fi
-
- # then check for a private Tk library
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in \
- ../tk \
- `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../tk \
- `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
- ../../../tk \
- `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
- # check in a few common install locations
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in `ls -d ${libdir} 2>/dev/null` \
- `ls -d /usr/local/lib 2>/dev/null` \
- `ls -d /usr/contrib/lib 2>/dev/null` \
- `ls -d /usr/lib 2>/dev/null` \
- ; do
- if test -f "$i/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i; pwd)`
- break
- fi
- done
- fi
- # check in a few other private locations
- if test x"${ac_cv_c_tkconfig}" = x ; then
- for i in \
- ${srcdir}/../tk \
- `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
- if test -f "$i/unix/tkConfig.sh" ; then
- ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
- break
- fi
- done
- fi
- ])
- if test x"${ac_cv_c_tkconfig}" = x ; then
- TK_BIN_DIR="# no Tk configs found"
- AC_MSG_RESULT(can't find Tk configuration definitions)
-# no Tk is OK egm 03/25/03
-# AC_MSG_WARN(Can't find Tk configuration definitions)
-# exit 0
- else
- no_tk=
- TK_BIN_DIR=${ac_cv_c_tkconfig}
- AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
- fi
- fi
-
-])
-
-#------------------------------------------------------------------------
-# SC_LOAD_TCLCONFIG --
-#
-# Load the tclConfig.sh file
-#
-# Arguments:
-#
-# Requires the following vars to be set:
-# TCL_BIN_DIR
-#
-# Results:
-#
-# Subst the following vars:
-# TCL_BIN_DIR
-# TCL_SRC_DIR
-# TCL_LIB_FILE
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_LOAD_TCLCONFIG, [
- AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
-
- if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
- AC_MSG_RESULT([loading])
- . $TCL_BIN_DIR/tclConfig.sh
- else
- AC_MSG_RESULT([file not found])
- fi
-
- #
- # If the TCL_BIN_DIR is the build directory (not the install directory),
- # then set the common variable name to the value of the build variables.
- # For example, the variable TCL_LIB_SPEC will be set to the value
- # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
- # instead of TCL_BUILD_LIB_SPEC since it will work with both an
- # installed and uninstalled version of Tcl.
- #
-
- if test -f $TCL_BIN_DIR/Makefile ; then
- TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
- TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
- TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
- fi
-
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
- eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
- eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
- eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
- AC_SUBST(TCL_VERSION)
- AC_SUBST(TCL_BIN_DIR)
- AC_SUBST(TCL_SRC_DIR)
-
- AC_SUBST(TCL_LIB_FILE)
- AC_SUBST(TCL_LIB_FLAG)
- AC_SUBST(TCL_LIB_SPEC)
-
- AC_SUBST(TCL_STUB_LIB_FILE)
- AC_SUBST(TCL_STUB_LIB_FLAG)
- AC_SUBST(TCL_STUB_LIB_SPEC)
-])
-
-#------------------------------------------------------------------------
-# SC_LOAD_TKCONFIG --
-#
-# Load the tkConfig.sh file
-#
-# Arguments:
-#
-# Requires the following vars to be set:
-# TK_BIN_DIR
-#
-# Results:
-#
-# Sets the following vars that should be in tkConfig.sh:
-# TK_BIN_DIR
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_LOAD_TKCONFIG, [
- AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
-
- if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
- AC_MSG_RESULT([loading])
- . $TK_BIN_DIR/tkConfig.sh
- else
- AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
- fi
-
- AC_SUBST(TK_VERSION)
- AC_SUBST(TK_BIN_DIR)
- AC_SUBST(TK_SRC_DIR)
- AC_SUBST(TK_LIB_FILE)
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_SHARED --
-#
-# Allows the building of shared libraries
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-shared=yes|no
-#
-# Defines the following vars:
-# STATIC_BUILD Used for building import/export libraries
-# on Windows.
-#
-# Sets the following vars:
-# SHARED_BUILD Value of 1 or 0
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_SHARED, [
- AC_MSG_CHECKING([how to build libraries])
- AC_ARG_ENABLE(shared,
- [ --enable-shared build and link with shared libraries [--enable-shared]],
- [tcl_ok=$enableval], [tcl_ok=yes])
-
- if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- tcl_ok=$enableval
- else
- tcl_ok=yes
- fi
-
- if test "$tcl_ok" = "yes" ; then
- AC_MSG_RESULT([shared])
- SHARED_BUILD=1
- else
- AC_MSG_RESULT([static])
- SHARED_BUILD=0
- AC_DEFINE(STATIC_BUILD)
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_FRAMEWORK --
-#
-# Allows the building of shared libraries into frameworks
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-framework=yes|no
-#
-# Sets the following vars:
-# FRAMEWORK_BUILD Value of 1 or 0
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_FRAMEWORK, [
- AC_MSG_CHECKING([how to package libraries])
- AC_ARG_ENABLE(framework,
- [ --enable-framework package shared libraries in frameworks [--disable-framework]],
- [tcl_ok=$enableval], [tcl_ok=no])
-
- if test "${enable_framework+set}" = set; then
- enableval="$enable_framework"
- tcl_ok=$enableval
- else
- tcl_ok=no
- fi
-
- if test "$tcl_ok" = "yes" ; then
- AC_MSG_RESULT([framework])
- FRAMEWORK_BUILD=1
- if test "${SHARED_BUILD}" = "0" ; then
- AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes")
- FRAMEWORK_BUILD=0
- fi
- else
- AC_MSG_RESULT([standard shared library])
- FRAMEWORK_BUILD=0
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_THREADS --
-#
-# Specify if thread support should be enabled
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-threads
-#
-# Sets the following vars:
-# THREADS_LIBS Thread library(s)
-#
-# Defines the following vars:
-# TCL_THREADS
-# _REENTRANT
-# _THREAD_SAFE
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_THREADS, [
- AC_MSG_CHECKING(for building with threads)
- AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
- [tcl_ok=$enableval], [tcl_ok=no])
-
- if test "$tcl_ok" = "yes"; then
- AC_MSG_RESULT(yes)
- TCL_THREADS=1
- AC_DEFINE(TCL_THREADS)
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- AC_DEFINE(USE_THREAD_ALLOC)
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_THREAD_SAFE)
- AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "no"; then
- # Check a little harder for __pthread_mutex_init in the same
- # library, as some systems hide it there until pthread.h is
- # defined. We could alternatively do an AC_TRY_COMPILE with
- # pthread.h, but that will work with libpthread really doesn't
- # exist, like AIX 4.2. [Bug: 4359]
- AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- fi
-
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthread"
- else
- AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -lpthreads"
- else
- AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "no"; then
- AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
- if test "$tcl_ok" = "yes"; then
- # The space is needed
- THREADS_LIBS=" -pthread"
- else
- TCL_THREADS=0
- AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...")
- fi
- fi
- fi
- fi
-
- # Does the pthread-implementation provide
- # 'pthread_attr_setstacksize' ?
-
- ac_saved_libs=$LIBS
- LIBS="$LIBS $THREADS_LIBS"
- AC_CHECK_FUNCS(pthread_attr_setstacksize)
- LIBS=$ac_saved_libs
- AC_CHECK_FUNCS(readdir_r)
- else
- TCL_THREADS=0
- AC_MSG_RESULT([no (default)])
- fi
- AC_SUBST(TCL_THREADS)
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_SYMBOLS --
-#
-# Specify if debugging symbols should be used.
-# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
-# can also be enabled.
-#
-# Arguments:
-# none
-#
-# Requires the following vars to be set in the Makefile:
-# CFLAGS_DEBUG
-# CFLAGS_OPTIMIZE
-# LDFLAGS_DEBUG
-# LDFLAGS_OPTIMIZE
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-symbols
-#
-# Defines the following vars:
-# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
-# Sets to $(CFLAGS_OPTIMIZE) if false
-# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
-# Sets to $(LDFLAGS_OPTIMIZE) if false
-# DBGX Debug library extension
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_SYMBOLS, [
- AC_MSG_CHECKING([for build with symbols])
- AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
-# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
- if test "$tcl_ok" = "no"; then
- CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
- LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
- AC_MSG_RESULT([no])
- else
- CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
- LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
- if test "$tcl_ok" = "yes"; then
- AC_MSG_RESULT([yes (standard debugging)])
- fi
- fi
- AC_SUBST(CFLAGS_DEFAULT)
- AC_SUBST(LDFLAGS_DEFAULT)
-
- if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
- AC_DEFINE(TCL_MEM_DEBUG)
- fi
-
- if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
- AC_DEFINE(TCL_COMPILE_DEBUG)
- AC_DEFINE(TCL_COMPILE_STATS)
- fi
-
- if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
- if test "$tcl_ok" = "all"; then
- AC_MSG_RESULT([enabled symbols mem compile debugging])
- else
- AC_MSG_RESULT([enabled $tcl_ok debugging])
- fi
- fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_LANGINFO --
-#
-# Allows use of modern nl_langinfo check for better l10n.
-# This is only relevant for Unix.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-langinfo=yes|no (default is yes)
-#
-# Defines the following vars:
-# HAVE_LANGINFO Triggers use of nl_langinfo if defined.
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_ENABLE_LANGINFO, [
- AC_ARG_ENABLE(langinfo,
- [ --enable-langinfo use nl_langinfo if possible to determine
- encoding at startup, otherwise use old heuristic],
- [langinfo_ok=$enableval], [langinfo_ok=yes])
-
- HAVE_LANGINFO=0
- if test "$langinfo_ok" = "yes"; then
- if test "$langinfo_ok" = "yes"; then
- AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
- fi
- fi
- AC_MSG_CHECKING([whether to use nl_langinfo])
- if test "$langinfo_ok" = "yes"; then
- AC_TRY_COMPILE([#include <langinfo.h>],
- [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no])
- if test "$langinfo_ok" = "no"; then
- langinfo_ok="no (could not compile with nl_langinfo)";
- fi
- if test "$langinfo_ok" = "yes"; then
- AC_DEFINE(HAVE_LANGINFO)
- fi
- fi
- AC_MSG_RESULT([$langinfo_ok])
-])
-
-#--------------------------------------------------------------------
-# SC_CONFIG_MANPAGES
-#
-# Decide whether to use symlinks for linking the manpages and
-# whether to compress the manpages after installation.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-man-symlinks
-# --enable-man-compression=PROG
-#
-# Defines the following variable:
-#
-# MKLINKS_FLAGS - The apropriate flags for mkLinks
-# according to the user's selection.
-#
-#--------------------------------------------------------------------
-AC_DEFUN(SC_CONFIG_MANPAGES, [
-
- AC_MSG_CHECKING([whether to use symlinks for manpages])
- AC_ARG_ENABLE(man-symlinks,
- [ --enable-man-symlinks use symlinks for the manpages],
- test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --symlinks",
- enableval="no")
- AC_MSG_RESULT([$enableval])
-
- AC_MSG_CHECKING([compression for manpages])
- AC_ARG_ENABLE(man-compression,
- [ --enable-man-compression=PROG
- compress the manpages with PROG],
- test "$enableval" = "yes" && echo && AC_MSG_ERROR([missing argument to --enable-man-compression])
- test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --compress $enableval",
- enableval="no")
- AC_MSG_RESULT([$enableval])
-
- AC_SUBST(MKLINKS_FLAGS)
-])
-
-#--------------------------------------------------------------------
-# SC_CONFIG_CFLAGS
-#
-# Try to determine the proper flags to pass to the compiler
-# for building shared libraries and other such nonsense.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines and substitutes the following vars:
-#
-# DL_OBJS - Name of the object file that implements dynamic
-# loading for Tcl on this system.
-# DL_LIBS - Library file(s) to include in tclsh and other base
-# applications in order for the "load" command to work.
-# LDFLAGS - Flags to pass to the compiler when linking object
-# files into an executable application binary such
-# as tclsh.
-# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
-# that tell the run-time dynamic linker where to look
-# for shared libraries such as libtcl.so. Depends on
-# the variable LIB_RUNTIME_DIR in the Makefile. Could
-# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
-# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
-# that tell the run-time dynamic linker where to look
-# for shared libraries such as libtcl.so. Depends on
-# the variable LIB_RUNTIME_DIR in the Makefile.
-# MAKE_LIB - Command to execute to build the a library;
-# differs when building shared or static.
-# MAKE_STUB_LIB -
-# Command to execute to build a stub library.
-# INSTALL_LIB - Command to execute to install a library;
-# differs when building shared or static.
-# INSTALL_STUB_LIB -
-# Command to execute to install a stub library.
-# STLIB_LD - Base command to use for combining object files
-# into a static library.
-# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
-# of a shared library (may request position-independent
-# code, among other things).
-# SHLIB_LD - Base command to use for combining object files
-# into a shared library.
-# SHLIB_LD_FLAGS -Flags to pass when building a shared library. This
-# differes from the SHLIB_CFLAGS as it is not used
-# when building object files or executables.
-# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
-# creating shared libraries. This symbol typically
-# goes at the end of the "ld" commands that build
-# shared libraries. The value of the symbol is
-# "${LIBS}" if all of the dependent libraries should
-# be specified when creating a shared library. If
-# dependent libraries should not be specified (as on
-# SunOS 4.x, where they cause the link to fail, or in
-# general if Tcl and Tk aren't themselves shared
-# libraries), then this symbol has an empty string
-# as its value.
-# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
-# extensions. An empty string means we don't know how
-# to use shared libraries on this platform.
-# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
-# TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
-# tclConfig.sh, since they are only used for the build
-# of Tcl and Tk.
-# Examples: MacOS X records the library version and
-# compatibility version in the shared library. But
-# of course the Tcl version of this is only used for Tcl.
-# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
-# in a static or shared library name, using the $VERSION variable
-# to put the version in the right place. This is used
-# by platforms that need non-standard library names.
-# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
-# to have a version after the .so, and ${VERSION}.a
-# on AIX, since a shared library needs to have
-# a .a extension whereas shared objects for loadable
-# extensions have a .so extension. Defaults to
-# ${VERSION}${SHLIB_SUFFIX}.
-# TCL_NEEDS_EXP_FILE -
-# 1 means that an export file is needed to link to a
-# shared library.
-# TCL_EXP_FILE - The name of the installed export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
-# TCL_BUILD_EXP_FILE -
-# The name of the built export / import file which
-# should be used to link to the Tcl shared library.
-# Empty if Tcl is unshared.
-# CFLAGS_DEBUG -
-# Flags used when running the compiler in debug mode
-# CFLAGS_OPTIMIZE -
-# Flags used when running the compiler in optimize mode
-# EXTRA_CFLAGS
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_CONFIG_CFLAGS, [
-
- # Step 0.a: Enable 64 bit support?
-
- AC_MSG_CHECKING([if 64bit support is requested])
- AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
-
- if test "$enableval" = "yes"; then
- do64bit=yes
- else
- do64bit=no
- fi
- AC_MSG_RESULT($do64bit)
-
- # Step 0.b: Enable Solaris 64 bit VIS support?
-
- AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
- AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
-
- if test "$enableval" = "yes"; then
- # Force 64bit on with VIS
- do64bit=yes
- do64bitVIS=yes
- else
- do64bitVIS=no
- fi
- AC_MSG_RESULT($do64bitVIS)
-
- # Step 1: set the variable "system" to hold the name and version number
- # for the system. This can usually be done via the "uname" command, but
- # there are a few systems, like Next, where this doesn't work.
-
- AC_MSG_CHECKING([system version (for dynamic loading)])
- if test -f /usr/lib/NextStep/software_version; then
- system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
- else
- system=`uname -s`-`uname -r`
- if test "$?" -ne 0 ; then
- AC_MSG_RESULT([unknown (can't find uname command)])
- system=unknown
- else
- # Special check for weird MP-RAS system (uname returns weird
- # results, and the version is kept in special file).
-
- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
- fi
- if test "`uname -s`" = "AIX" ; then
- system=AIX-`uname -v`.`uname -r`
- fi
- AC_MSG_RESULT($system)
- fi
- fi
-
- # Step 2: check for existence of -ldl library. This is needed because
- # Linux can use either -ldl or -ldld for dynamic loading.
-
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
-
- # Require ranlib early so we can override it in special cases below.
-
- AC_REQUIRE([AC_PROG_RANLIB])
-
- # Step 3: set configuration options based on system name and version.
-
- do64bit_ok=no
- EXTRA_CFLAGS=""
- TCL_EXPORT_FILE_SUFFIX=""
- UNSHARED_LIB_SUFFIX=""
- TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
- ECHO_VERSION='`echo ${VERSION}`'
- TCL_LIB_VERSIONS_OK=ok
- CFLAGS_DEBUG=-g
- CFLAGS_OPTIMIZE=-O
- if test "$GCC" = "yes" ; then
- CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
- else
- CFLAGS_WARNING=""
- fi
- TCL_NEEDS_EXP_FILE=0
- TCL_BUILD_EXP_FILE=""
- TCL_EXP_FILE=""
-dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
-dnl AC_CHECK_TOOL(AR, ar)
- AC_CHECK_PROG(AR, ar, ar)
- if test "${AR}" = "" ; then
- AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
- fi
- STLIB_LD='${AR} cr'
- LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
- PLAT_OBJS=""
- case $system in
- AIX-5.*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
- # AIX requires the _r compiler when gcc isn't being used
- if test "${CC}" != "cc_r" ; then
- CC=${CC}_r
- fi
- AC_MSG_RESULT(Using $CC for compiling with threads)
- fi
- LIBS="$LIBS -lc"
- # AIX-5 uses ELF style dynamic libraries
- SHLIB_CFLAGS=""
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- if test "`uname -m`" = "ia64" ; then
- # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
- SHLIB_LD="/usr/ccs/bin/ld -G -z text"
- # AIX-5 has dl* in libc.so
- DL_LIBS=""
- if test "$GCC" = "yes" ; then
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- else
- CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
- fi
- LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- else
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- DL_LIBS="-ldl"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
- fi
-
- # Note: need the LIBS below, otherwise Tk won't find Tcl's
- # symbols when dynamically loaded into tclsh.
-
- DL_OBJS="tclLoadDl.o"
- LDFLAGS=""
-
- LD_LIBRARY_PATH_VAR="LIBPATH"
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- else
- do64bit_ok=yes
- EXTRA_CFLAGS="-q64"
- LDFLAGS="-q64"
- RANLIB="${RANLIB} -X64"
- AR="${AR} -X64"
- SHLIB_LD_FLAGS="-b64"
- fi
- fi
- ;;
- AIX-*)
- if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
- # AIX requires the _r compiler when gcc isn't being used
- if test "${CC}" != "cc_r" ; then
- CC=${CC}_r
- fi
- AC_MSG_RESULT(Using $CC for compiling with threads)
- fi
- LIBS="$LIBS -lc"
- SHLIB_CFLAGS=""
- SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- LD_LIBRARY_PATH_VAR="LIBPATH"
- TCL_NEEDS_EXP_FILE=1
- TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
-
- # AIX v<=4.1 has some different flags than 4.2+
- if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
- # upgrade to 2.5x egm 3/25/03
- AC_LIBOBJ(tclLoadAix.o)
- HAVE_COMPAT=true
- DL_LIBS="-lld"
- fi
-
- # On AIX <=v4 systems, libbsd.a has to be linked in to support
- # non-blocking file IO. This library has to be linked in after
- # the MATH_LIBS or it breaks the pow() function. The way to
- # insure proper sequencing, is to add it to the tail of MATH_LIBS.
- # This library also supplies gettimeofday.
- #
- # AIX does not have a timezone field in struct tm. When the AIX
- # bsd library is used, the timezone global and the gettimeofday
- # methods are to be avoided for timezone deduction instead, we
- # deduce the timezone by comparing the localtime result on a
- # known GMT value.
-
- AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
- if test $libbsd = yes; then
- MATH_LIBS="$MATH_LIBS -lbsd"
- AC_DEFINE(USE_DELTA_FOR_TZ)
- fi
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- else
- do64bit_ok=yes
- EXTRA_CFLAGS="-q64"
- LDFLAGS="-q64"
- RANLIB="${RANLIB} -X64"
- AR="${AR} -X64"
- SHLIB_LD_FLAGS="-b64"
- fi
- fi
- ;;
- BSD/OS-2.1*|BSD/OS-3*)
- SHLIB_CFLAGS=""
- SHLIB_LD="shlicc -r"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- BSD/OS-4.*)
- SHLIB_CFLAGS="-export-dynamic -fPIC"
- SHLIB_LD="cc -shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="-export-dynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- dgux*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- HP-UX-*.11.*)
- # Use updated header definitions where possible
- AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
- AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
- LIBS="$LIBS -lxnet" # Use the XOPEN network library
-
- SHLIB_SUFFIX=".sl"
- AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
- SHLIB_CFLAGS="+z"
- SHLIB_LD="ld -b"
- SHLIB_LD_LIBS='${LIBS}'
- DL_OBJS="tclLoadShl.o"
- DL_LIBS="-ldld"
- LDFLAGS="-Wl,-E"
- CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
- LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
- LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
-
- # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
- #EXTRA_CFLAGS="+DAportable"
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- hpux_arch=`gcc -dumpmachine`
- case $hpux_arch in
- hppa64*)
- # 64-bit gcc in use. Fix flags for GNU ld.
- do64bit_ok=yes
- SHLIB_LD="gcc -shared"
- SHLIB_LD_LIBS=""
- LD_SEARCH_FLAGS=''
- CC_SEARCH_FLAGS=''
- ;;
- *)
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- ;;
- esac
- else
- do64bit_ok=yes
- if test "`uname -m`" = "ia64" ; then
- EXTRA_CFLAGS="+DD64"
- LDFLAGS="+DD64 $LDFLAGS"
- else
- EXTRA_CFLAGS="+DA2.0W"
- LDFLAGS="+DA2.0W $LDFLAGS"
- fi
- fi
- fi
- ;;
- HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
- SHLIB_SUFFIX=".sl"
- AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
- if test "$tcl_ok" = yes; then
- SHLIB_CFLAGS="+z"
- SHLIB_LD="ld -b"
- SHLIB_LD_LIBS=""
- DL_OBJS="tclLoadShl.o"
- DL_LIBS="-ldld"
- LDFLAGS="-Wl,-E"
- CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
- LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
- LD_LIBRARY_PATH_VAR="SHLIB_PATH"
- fi
- ;;
- IRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_LD_LIBS='${LIBS}'
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="-Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- ;;
- IRIX-5.*)
- SHLIB_CFLAGS=""
- SHLIB_LD="ld -shared -rdata_shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- EXTRA_CFLAGS=""
- LDFLAGS=""
- ;;
- IRIX-6.*|IRIX64-6.5*)
- SHLIB_CFLAGS=""
- SHLIB_LD="ld -n32 -shared -rdata_shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- if test "$GCC" = "yes" ; then
- EXTRA_CFLAGS="-mabi=n32"
- LDFLAGS="-mabi=n32"
- else
- case $system in
- IRIX-6.3)
- # Use to build 6.2 compatible binaries on 6.3.
- EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
- ;;
- *)
- EXTRA_CFLAGS="-n32"
- ;;
- esac
- LDFLAGS="-n32"
- fi
- ;;
- IRIX64-6.*)
- SHLIB_CFLAGS=""
- SHLIB_LD="ld -n32 -shared -rdata_shared"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
-
- # Check to enable 64-bit flags for compiler/linker
-
- if test "$do64bit" = "yes" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN([64bit mode not supported by gcc])
- else
- do64bit_ok=yes
- SHLIB_LD="ld -64 -shared -rdata_shared"
- EXTRA_CFLAGS="-64"
- LDFLAGS="-64"
- fi
- fi
- ;;
- Linux*)
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
-
- # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
- # when you inline the string and math operations. Turn this off to
- # get rid of the warnings.
-
- CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
-
- if test "$have_dl" = yes; then
- SHLIB_LD="${CC} -shared"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="-rdynamic"
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS="tclLoadDld.o"
- DL_LIBS="-ldld"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- EXTRA_CFLAGS="-mieee"
- fi
-
- # The combo of gcc + glibc has a bug related
- # to inlining of functions like strtod(). The
- # -fno-builtin flag should address this problem
- # but it does not work. The -fno-inline flag
- # is kind of overkill but it works.
- # Disable inlining only when one of the
- # files in compat/*.c is being linked in.
- if test x"${HAVE_COMPAT}" = "xtrue" ; then
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline"
- fi
-
- # XIM peeking works under XFree86.
- AC_DEFINE(PEEK_XCLOSEIM)
-
- ;;
- GNU*)
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
-
- if test "$have_dl" = yes; then
- SHLIB_LD="${CC} -shared"
- DL_OBJS=""
- DL_LIBS="-ldl"
- LDFLAGS="-rdynamic"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- else
- AC_CHECK_HEADER(dld.h, [
- SHLIB_LD="ld -shared"
- DL_OBJS=""
- DL_LIBS="-ldld"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""])
- fi
- if test "`uname -m`" = "alpha" ; then
- EXTRA_CFLAGS="-mieee"
- fi
- ;;
- MP-RAS-02*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- MP-RAS-*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS="-Wl,-Bexport"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*)
- # Not available on all versions: check for include file.
- AC_CHECK_HEADER(dlfcn.h, [
- # NetBSD/SPARC needs -fPIC, -fpic will not do.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- AC_MSG_CHECKING(for ELF)
- AC_EGREP_CPP(yes, [
-#ifdef __ELF__
- yes
-#endif
- ],
- AC_MSG_RESULT(yes)
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so',
- AC_MSG_RESULT(no)
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- )
- ], [
- SHLIB_CFLAGS=""
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- ])
-
- # FreeBSD doesn't handle version numbers with dots.
-
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- FreeBSD-*)
- # FreeBSD 3.* and greater have ELF.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS="-export-dynamic"
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- if test "${TCL_THREADS}" = "1" ; then
- # The -pthread needs to go in the CFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- EXTRA_CFLAGS="-pthread"
- LDFLAGS="$LDFLAGS -pthread"
- fi
- case $system in
- FreeBSD-3.*)
- # FreeBSD-3 doesn't handle version numbers with dots.
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- esac
- ;;
- Rhapsody-*|Darwin-*)
- SHLIB_CFLAGS="-fno-common"
- SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
- TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000"
- TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".dylib"
- DL_OBJS="tclLoadDyld.o"
- PLAT_OBJS="tclMacOSXBundle.o"
- DL_LIBS=""
- LDFLAGS="-prebind"
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- CFLAGS_OPTIMIZE="-Os"
- LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
- # for compatibility with autoconf vers 2.13 :
- HACK=""
- EXTRA_CFLAGS="-DMA${HACK}C_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\\\"utf-8\\\""
- LIBS="$LIBS -framework CoreFoundation"
- ;;
- NEXTSTEP-*)
- SHLIB_CFLAGS=""
- SHLIB_LD="cc -nostdlib -r"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadNext.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OS/390-*)
- CFLAGS_OPTIMIZE="" # Optimizer is buggy
- AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
- ;;
- OSF1-1.0|OSF1-1.1|OSF1-1.2)
- # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
- SHLIB_CFLAGS=""
- # Hack: make package name same as library name
- SHLIB_LD='ld -R -export $@:'
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadOSF.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OSF1-1.*)
- # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
- SHLIB_CFLAGS="-fPIC"
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD="ld -shared"
- else
- SHLIB_LD="ld -non_shared"
- fi
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- OSF1-V*)
- # Digital OSF/1
- SHLIB_CFLAGS=""
- if test "$SHARED_BUILD" = "1" ; then
- SHLIB_LD='ld -shared -expect_unresolved "*"'
- else
- SHLIB_LD='ld -non_shared -expect_unresolved "*"'
- fi
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
- if test "$GCC" != "yes" ; then
- EXTRA_CFLAGS="-DHAVE_TZSET -std1"
- fi
- # see pthread_intro(3) for pthread support on osf1, k.furukawa
- if test "${TCL_THREADS}" = "1" ; then
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
- LIBS=`echo $LIBS | sed s/-lpthreads//`
- if test "$GCC" = "yes" ; then
- LIBS="$LIBS -lpthread -lmach -lexc"
- else
- EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
- LDFLAGS="-pthread"
- fi
- fi
-
- ;;
- QNX-6*)
- # QNX RTP
- # This may work for all QNX, but it was only reported for v6.
- SHLIB_CFLAGS="-fPIC"
- SHLIB_LD="ld -Bshareable -x"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- # dlopen is in -lc on QNX
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- RISCos-*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".a"
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="-Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- ;;
- SCO_SV-3.2*)
- # Note, dlopen is available only on SCO 3.2.5 and greater. However,
- # this test works, since "uname -s" was non-standard in 3.2.4 and
- # below.
- if test "$GCC" = "yes" ; then
- SHLIB_CFLAGS="-fPIC -melf"
- LDFLAGS="-melf -Wl,-Bexport"
- else
- SHLIB_CFLAGS="-Kpic -belf"
- LDFLAGS="-belf -Wl,-Bexport"
- fi
- SHLIB_LD="ld -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- SINIX*5.4*)
- SHLIB_CFLAGS="-K PIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- SunOS-4*)
- SHLIB_CFLAGS="-PIC"
- SHLIB_LD="ld"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
-
- # SunOS can't handle version numbers with dots in them in library
- # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
- # requires an extra version number at the end of .so file names.
- # So, the library has to have a name like libtcl75.so.1.0
-
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- SunOS-5.[[0-6]]*)
-
- # Note: If _REENTRANT isn't defined, then Solaris
- # won't define thread-safe library routines.
-
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
-
- SHLIB_CFLAGS="-KPIC"
-
- # Note: need the LIBS below, otherwise Tk won't find Tcl's
- # symbols when dynamically loaded into tclsh.
-
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- LDFLAGS=""
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- SHLIB_LD="/usr/ccs/bin/ld -G -z text"
- CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- fi
- ;;
- SunOS-5*)
-
- # Note: If _REENTRANT isn't defined, then Solaris
- # won't define thread-safe library routines.
-
- AC_DEFINE(_REENTRANT)
- AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
-
- SHLIB_CFLAGS="-KPIC"
- LDFLAGS=""
-
- # Check to enable 64-bit flags for compiler/linker
- if test "$do64bit" = "yes" ; then
- arch=`isainfo`
- if test "$arch" = "sparcv9 sparc" ; then
- if test "$GCC" = "yes" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on $system")
- else
- do64bit_ok=yes
- if test "$do64bitVIS" = "yes" ; then
- EXTRA_CFLAGS="-xarch=v9a"
- LDFLAGS="-xarch=v9a"
- else
- EXTRA_CFLAGS="-xarch=v9"
- LDFLAGS="-xarch=v9"
- fi
- fi
- else
- AC_MSG_WARN("64bit mode only supported sparcv9 system")
- fi
- fi
-
- # Note: need the LIBS below, otherwise Tk won't find Tcl's
- # symbols when dynamically loaded into tclsh.
-
- SHLIB_LD_LIBS='${LIBS}'
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- if test "$GCC" = "yes" ; then
- SHLIB_LD="$CC -shared"
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- else
- SHLIB_LD="/usr/ccs/bin/ld -G -z text"
- CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
- fi
- ;;
- ULTRIX-4.*)
- SHLIB_CFLAGS="-G 0"
- SHLIB_SUFFIX=".a"
- SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
- SHLIB_LD_LIBS='${LIBS}'
- DL_OBJS="tclLoadAout.o"
- DL_LIBS=""
- LDFLAGS="-Wl,-D,08000000"
- CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
- if test "$GCC" != "yes" ; then
- EXTRA_CFLAGS="-DHAVE_TZSET -std1"
- fi
- ;;
- UNIX_SV* | UnixWare-5*)
- SHLIB_CFLAGS="-KPIC"
- SHLIB_LD="cc -G"
- SHLIB_LD_LIBS=""
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS="-ldl"
- # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
- # that don't grok the -Bexport option. Test that it does.
- hold_ldflags=$LDFLAGS
- AC_MSG_CHECKING(for ld accepts -Bexport flag)
- LDFLAGS="${LDFLAGS} -Wl,-Bexport"
- AC_TRY_LINK(, [int i;], found=yes, found=no)
- LDFLAGS=$hold_ldflags
- AC_MSG_RESULT($found)
- if test $found = yes; then
- LDFLAGS="-Wl,-Bexport"
- else
- LDFLAGS=""
- fi
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- ;;
- esac
-
- if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
- AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
- fi
-
- # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
- # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
- # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
- # to determine which of several header files defines the a.out file
- # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
- # support only a file format that is more or less version-7-compatible.
- # In particular,
- # - a.out files must begin with `struct exec'.
- # - the N_TXTOFF on the `struct exec' must compute the seek address
- # of the text segment
- # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
- # and a_entry fields.
- # The following compilation should succeed if and only if either sys/exec.h
- # or a.out.h is usable for the purpose.
- #
- # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
- # `struct exec' includes a second header that contains information that
- # duplicates the v7 fields that are needed.
-
- if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
- AC_MSG_CHECKING(sys/exec.h)
- AC_TRY_COMPILE([#include <sys/exec.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_ok=usable, tcl_ok=unusable)
- AC_MSG_RESULT($tcl_ok)
- if test $tcl_ok = usable; then
- AC_DEFINE(USE_SYS_EXEC_H)
- else
- AC_MSG_CHECKING(a.out.h)
- AC_TRY_COMPILE([#include <a.out.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_magic == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_ok=usable, tcl_ok=unusable)
- AC_MSG_RESULT($tcl_ok)
- if test $tcl_ok = usable; then
- AC_DEFINE(USE_A_OUT_H)
- else
- AC_MSG_CHECKING(sys/exec_aout.h)
- AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
- struct exec foo;
- unsigned long seek;
- int flag;
-#if defined(__mips) || defined(mips)
- seek = N_TXTOFF (foo.ex_f, foo.ex_o);
-#else
- seek = N_TXTOFF (foo);
-#endif
- flag = (foo.a_midmag == OMAGIC);
- return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
- ], tcl_ok=usable, tcl_ok=unusable)
- AC_MSG_RESULT($tcl_ok)
- if test $tcl_ok = usable; then
- AC_DEFINE(USE_SYS_EXEC_AOUT_H)
- else
- DL_OBJS=""
- fi
- fi
- fi
- fi
-
- # Step 5: disable dynamic loading if requested via a command-line switch.
-
- AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
- [tcl_ok=$enableval], [tcl_ok=yes])
- if test "$tcl_ok" = "no"; then
- DL_OBJS=""
- fi
-
- if test "x$DL_OBJS" != "x" ; then
- BUILD_DLTEST="\$(DLTEST_TARGETS)"
- else
- echo "Can't figure out how to do dynamic loading or shared libraries"
- echo "on this system."
- SHLIB_CFLAGS=""
- SHLIB_LD=""
- SHLIB_SUFFIX=""
- DL_OBJS="tclLoadNone.o"
- DL_LIBS=""
- LDFLAGS=""
- CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
- BUILD_DLTEST=""
- fi
-
- # If we're running gcc, then change the C flags for compiling shared
- # libraries to the right flags for gcc, instead of those for the
- # standard manufacturer compiler.
-
- if test "$DL_OBJS" != "tclLoadNone.o" ; then
- if test "$GCC" = "yes" ; then
- case $system in
- AIX-*)
- ;;
- BSD/OS*)
- ;;
- IRIX*)
- ;;
- NetBSD-*|FreeBSD-*|OpenBSD-*)
- ;;
- Rhapsody-*|Darwin-*)
- ;;
- RISCos-*)
- ;;
- SCO_SV-3.2*)
- ;;
- ULTRIX-4.*)
- ;;
- *)
- SHLIB_CFLAGS="-fPIC"
- ;;
- esac
- fi
- fi
-
- if test "$SHARED_LIB_SUFFIX" = "" ; then
- SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
- fi
- if test "$UNSHARED_LIB_SUFFIX" = "" ; then
- UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
- fi
-
- if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
- LIB_SUFFIX=${SHARED_LIB_SUFFIX}
- MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
- LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
-
- if test "$RANLIB" = "" ; then
- MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
- else
- MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
- INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
- fi
-
-dnl Not at all clear what this was doing in Tcl's configure.in
-dnl or why it was needed was needed. In any event, this sort of
-dnl things needs to be done in the big loop above.
-dnl REMOVE THIS BLOCK LATER! (mdejong)
-dnl case $system in
-dnl BSD/OS*)
-dnl ;;
-dnl AIX-[[1-4]].*)
-dnl ;;
-dnl *)
-dnl SHLIB_LD_LIBS=""
-dnl ;;
-dnl esac
- fi
-
-
- # Stub lib does not depend on shared/static configuration
- if test "$RANLIB" = "" ; then
- MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
- else
- MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
- INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
- fi
-
-
- AC_SUBST(DL_LIBS)
-
- AC_SUBST(DL_OBJS)
- AC_SUBST(PLAT_OBJS)
- AC_SUBST(CFLAGS)
- AC_SUBST(CFLAGS_DEBUG)
- AC_SUBST(CFLAGS_OPTIMIZE)
- AC_SUBST(CFLAGS_WARNING)
- AC_SUBST(EXTRA_CFLAGS)
-
- AC_SUBST(LDFLAGS)
- AC_SUBST(LDFLAGS_DEBUG)
- AC_SUBST(LDFLAGS_OPTIMIZE)
- AC_SUBST(CC_SEARCH_FLAGS)
- AC_SUBST(LD_SEARCH_FLAGS)
-
- AC_SUBST(STLIB_LD)
- AC_SUBST(SHLIB_LD)
- AC_SUBST(TCL_SHLIB_LD_EXTRAS)
- AC_SUBST(TK_SHLIB_LD_EXTRAS)
- AC_SUBST(SHLIB_LD_FLAGS)
- AC_SUBST(SHLIB_LD_LIBS)
- AC_SUBST(SHLIB_CFLAGS)
- AC_SUBST(SHLIB_SUFFIX)
-
- AC_SUBST(MAKE_LIB)
- AC_SUBST(MAKE_STUB_LIB)
- AC_SUBST(INSTALL_LIB)
- AC_SUBST(INSTALL_STUB_LIB)
- AC_SUBST(RANLIB)
-])
-
-#--------------------------------------------------------------------
-# SC_SERIAL_PORT
-#
-# Determine which interface to use to talk to the serial port.
-# Note that #include lines must begin in leftmost column for
-# some compilers to recognize them as preprocessor directives,
-# and some build environments have stdin not pointing at a
-# pseudo-terminal (usually /dev/null instead.)
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines only one of the following vars:
-# HAVE_SYS_MODEM_H
-# USE_TERMIOS
-# USE_TERMIO
-# USE_SGTTY
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_SERIAL_PORT, [
- AC_CHECK_HEADERS(sys/modem.h)
- AC_MSG_CHECKING([termios vs. termio vs. sgtty])
- AC_CACHE_VAL(tcl_cv_api_serial, [
- AC_TRY_RUN([
-#include <termios.h>
-
-int main() {
- struct termios t;
- if (tcgetattr(0, &t) == 0) {
- cfsetospeed(&t, 0);
- t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- if test $tcl_cv_api_serial = no ; then
- AC_TRY_RUN([
-#include <termio.h>
-
-int main() {
- struct termio t;
- if (ioctl(0, TCGETA, &t) == 0) {
- t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no ; then
- AC_TRY_RUN([
-#include <sgtty.h>
-
-int main() {
- struct sgttyb t;
- if (ioctl(0, TIOCGETP, &t) == 0) {
- t.sg_ospeed = 0;
- t.sg_flags |= ODDP | EVENP | RAW;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no ; then
- AC_TRY_RUN([
-#include <termios.h>
-#include <errno.h>
-
-int main() {
- struct termios t;
- if (tcgetattr(0, &t) == 0
- || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
- cfsetospeed(&t, 0);
- t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no; then
- AC_TRY_RUN([
-#include <termio.h>
-#include <errno.h>
-
-int main() {
- struct termio t;
- if (ioctl(0, TCGETA, &t) == 0
- || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
- t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
- return 0;
- }
- return 1;
- }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
- fi
- if test $tcl_cv_api_serial = no; then
- AC_TRY_RUN([
-#include <sgtty.h>
-#include <errno.h>
-
-int main() {
- struct sgttyb t;
- if (ioctl(0, TIOCGETP, &t) == 0
- || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
- t.sg_ospeed = 0;
- t.sg_flags |= ODDP | EVENP | RAW;
- return 0;
- }
- return 1;
-}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
- fi])
- case $tcl_cv_api_serial in
- termios) AC_DEFINE(USE_TERMIOS);;
- termio) AC_DEFINE(USE_TERMIO);;
- sgtty) AC_DEFINE(USE_SGTTY);;
- esac
- AC_MSG_RESULT($tcl_cv_api_serial)
-])
-
-#--------------------------------------------------------------------
-# SC_MISSING_POSIX_HEADERS
-#
-# Supply substitutes for missing POSIX header files. Special
-# notes:
-# - stdlib.h doesn't define strtol, strtoul, or
-# strtod insome versions of SunOS
-# - some versions of string.h don't declare procedures such
-# as strstr
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines some of the following vars:
-# NO_DIRENT_H
-# NO_ERRNO_H
-# NO_VALUES_H
-# NO_LIMITS_H
-# NO_STDLIB_H
-# NO_STRING_H
-# NO_SYS_WAIT_H
-# NO_DLFCN_H
-# HAVE_UNISTD_H
-# HAVE_SYS_PARAM_H
-#
-# HAVE_STRING_H ?
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_MISSING_POSIX_HEADERS, [
- AC_MSG_CHECKING(dirent.h)
- AC_TRY_LINK([#include <sys/types.h>
-#include <dirent.h>], [
-#ifndef _POSIX_SOURCE
-# ifdef __Lynx__
- /*
- * Generate compilation error to make the test fail: Lynx headers
- * are only valid if really in the POSIX environment.
- */
-
- missing_procedure();
-# endif
-#endif
-DIR *d;
-struct dirent *entryPtr;
-char *p;
-d = opendir("foobar");
-entryPtr = readdir(d);
-p = entryPtr->d_name;
-closedir(d);
-], tcl_ok=yes, tcl_ok=no)
-
- if test $tcl_ok = no; then
- AC_DEFINE(NO_DIRENT_H)
- fi
-
- AC_MSG_RESULT($tcl_ok)
- AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
- AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
- AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
- AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)])
- AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
- AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
- AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
- AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STDLIB_H)
- fi
- AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
- AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
- AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
-
- # See also memmove check below for a place where NO_STRING_H can be
- # set and why.
-
- if test $tcl_ok = 0; then
- AC_DEFINE(NO_STRING_H)
- fi
-
- AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
- AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
-
- # OS/390 lacks sys/param.h (and doesn't need it, by chance).
-
- AC_HAVE_HEADERS(unistd.h sys/param.h)
-
-])
-
-#--------------------------------------------------------------------
-# SC_PATH_X
-#
-# Locate the X11 header files and the X11 library archive. Try
-# the ac_path_x macro first, but if it doesn't find the X stuff
-# (e.g. because there's no xmkmf program) then check through
-# a list of possible directories. Under some conditions the
-# autoconf macro will return an include directory that contains
-# no include files, so double-check its result just to be safe.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Sets the the following vars:
-# XINCLUDES
-# XLIBSW
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_X, [
- AC_PATH_X
- not_really_there=""
- if test "$no_x" = ""; then
- if test "$x_includes" = ""; then
- AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
- else
- if test ! -r $x_includes/X11/Intrinsic.h; then
- not_really_there="yes"
- fi
- fi
- fi
- if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
- AC_MSG_CHECKING(for X11 header files)
- found_xincludes="no"
- AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
- if test "$found_xincludes" = "no"; then
- dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
- for i in $dirs ; do
- if test -r $i/X11/Intrinsic.h; then
- AC_MSG_RESULT($i)
- XINCLUDES=" -I$i"
- found_xincludes="yes"
- break
- fi
- done
- fi
- else
- if test "$x_includes" != ""; then
- XINCLUDES="-I$x_includes"
- found_xincludes="yes"
- fi
- fi
- if test found_xincludes = "no"; then
- AC_MSG_RESULT(couldn't find any!)
- fi
-
- if test "$no_x" = yes; then
- AC_MSG_CHECKING(for X11 libraries)
- XLIBSW=nope
- dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
- for i in $dirs ; do
- if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
- AC_MSG_RESULT($i)
- XLIBSW="-L$i -lX11"
- x_libraries="$i"
- break
- fi
- done
- else
- if test "$x_libraries" = ""; then
- XLIBSW=-lX11
- else
- XLIBSW="-L$x_libraries -lX11"
- fi
- fi
- if test "$XLIBSW" = nope ; then
- AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
- fi
- if test "$XLIBSW" = nope ; then
- AC_MSG_RESULT(couldn't find any! Using -lX11.)
- XLIBSW=-lX11
- fi
-])
-#--------------------------------------------------------------------
-# SC_BLOCKING_STYLE
-#
-# The statements below check for systems where POSIX-style
-# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
-# On these systems (mostly older ones), use the old BSD-style
-# FIONBIO approach instead.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines some of the following vars:
-# HAVE_SYS_IOCTL_H
-# HAVE_SYS_FILIO_H
-# USE_FIONBIO
-# O_NONBLOCK
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_BLOCKING_STYLE, [
- AC_CHECK_HEADERS(sys/ioctl.h)
- AC_CHECK_HEADERS(sys/filio.h)
- AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
- if test -f /usr/lib/NextStep/software_version; then
- system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
- else
- system=`uname -s`-`uname -r`
- if test "$?" -ne 0 ; then
- system=unknown
- else
- # Special check for weird MP-RAS system (uname returns weird
- # results, and the version is kept in special file).
-
- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
- fi
- if test "`uname -s`" = "AIX" ; then
- system=AIX-`uname -v`.`uname -r`
- fi
- fi
- fi
- case $system in
- # There used to be code here to use FIONBIO under AIX. However, it
- # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
- # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
- # code (JO, 5/31/97).
-
- OSF*)
- AC_DEFINE(USE_FIONBIO)
- AC_MSG_RESULT(FIONBIO)
- ;;
- SunOS-4*)
- AC_DEFINE(USE_FIONBIO)
- AC_MSG_RESULT(FIONBIO)
- ;;
- ULTRIX-4.*)
- AC_DEFINE(USE_FIONBIO)
- AC_MSG_RESULT(FIONBIO)
- ;;
- *)
- AC_MSG_RESULT(O_NONBLOCK)
- ;;
- esac
-])
-
-#--------------------------------------------------------------------
-# SC_TIME_HANLDER
-#
-# Checks how the system deals with time.h, what time structures
-# are used on the system, and what fields the structures have.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Defines some of the following vars:
-# USE_DELTA_FOR_TZ
-# HAVE_TM_GMTOFF
-# HAVE_TM_TZADJ
-# HAVE_TIMEZONE_VAR
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TIME_HANDLER, [
- AC_CHECK_HEADERS(sys/time.h)
- AC_HEADER_TIME
- AC_STRUCT_TIMEZONE
-
- AC_CHECK_FUNCS(gmtime_r localtime_r)
-
- AC_MSG_CHECKING([tm_tzadj in struct tm])
- AC_CACHE_VAL(tcl_cv_member_tm_tzadj,
- AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
- tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
- AC_MSG_RESULT($tcl_cv_member_tm_tzadj)
- if test $tcl_cv_member_tm_tzadj = yes ; then
- AC_DEFINE(HAVE_TM_TZADJ)
- fi
-
- AC_MSG_CHECKING([tm_gmtoff in struct tm])
- AC_CACHE_VAL(tcl_cv_member_tm_gmtoff,
- AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
- tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
- AC_MSG_RESULT($tcl_cv_member_tm_gmtoff)
- if test $tcl_cv_member_tm_gmtoff = yes ; then
- AC_DEFINE(HAVE_TM_GMTOFF)
- fi
-
- #
- # Its important to include time.h in this check, as some systems
- # (like convex) have timezone functions, etc.
- #
- AC_MSG_CHECKING([long timezone variable])
- AC_CACHE_VAL(tcl_cv_var_timezone,
- AC_TRY_COMPILE([#include <time.h>],
- [extern long timezone;
- timezone += 1;
- exit (0);],
- tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
- AC_MSG_RESULT($tcl_cv_timezone_long)
- if test $tcl_cv_timezone_long = yes ; then
- AC_DEFINE(HAVE_TIMEZONE_VAR)
- else
- #
- # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
- #
- AC_MSG_CHECKING([time_t timezone variable])
- AC_CACHE_VAL(tcl_cv_timezone_time,
- AC_TRY_COMPILE([#include <time.h>],
- [extern time_t timezone;
- timezone += 1;
- exit (0);],
- tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
- AC_MSG_RESULT($tcl_cv_timezone_time)
- if test $tcl_cv_timezone_time = yes ; then
- AC_DEFINE(HAVE_TIMEZONE_VAR)
- fi
- fi
-])
-
-#--------------------------------------------------------------------
-# SC_BUGGY_STRTOD
-#
-# Under Solaris 2.4, strtod returns the wrong value for the
-# terminating character under some conditions. Check for this
-# and if the problem exists use a substitute procedure
-# "fixstrtod" (provided by Tcl) that corrects the error.
-# Also, on Compaq's Tru64 Unix 5.0,
-# strtod(" ") returns 0.0 instead of a failure to convert.
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Might defines some of the following vars:
-# strtod (=fixstrtod)
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_BUGGY_STRTOD, [
- AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
- if test "$tcl_strtod" = 1; then
- AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
- AC_CACHE_VAL(tcl_cv_strtod_buggy,[
- AC_TRY_RUN([
- extern double strtod();
- int main() {
- char *infString="Inf", *nanString="NaN", *spaceString=" ";
- char *term;
- double value;
- value = strtod(infString, &term);
- if ((term != infString) && (term[-1] == 0)) {
- exit(1);
- }
- value = strtod(nanString, &term);
- if ((term != nanString) && (term[-1] == 0)) {
- exit(1);
- }
- value = strtod(spaceString, &term);
- if (term == (spaceString+1)) {
- exit(1);
- }
- exit(0);
- }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)])
- if test "$tcl_cv_strtod_buggy" = 1; then
- AC_MSG_RESULT(ok)
- else
- AC_MSG_RESULT(buggy)
- # upgrade to 2.5x egm 3/25/03
- AC_LIBOBJ(fixstrtod.o)
- HAVE_COMPAT=true
- AC_DEFINE(strtod, fixstrtod)
- fi
- fi
-])
-
-#--------------------------------------------------------------------
-# SC_TCL_LINK_LIBS
-#
-# Search for the libraries needed to link the Tcl shell.
-# Things like the math library (-lm) and socket stuff (-lsocket vs.
-# -lnsl) are dealt with here.
-#
-# Arguments:
-# Requires the following vars to be set in the Makefile:
-# DL_LIBS
-# LIBS
-# MATH_LIBS
-#
-# Results:
-#
-# Subst's the following var:
-# TCL_LIBS
-# MATH_LIBS
-#
-# Might append to the following vars:
-# LIBS
-#
-# Might define the following vars:
-# HAVE_NET_ERRNO_H
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TCL_LINK_LIBS, [
- #--------------------------------------------------------------------
- # On a few very rare systems, all of the libm.a stuff is
- # already in libc.a. Set compiler flags accordingly.
- # Also, Linux requires the "ieee" library for math to work
- # right (and it must appear before "-lm").
- #--------------------------------------------------------------------
-
- AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
- AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
-
- #--------------------------------------------------------------------
- # Interactive UNIX requires -linet instead of -lsocket, plus it
- # needs net/errno.h to define the socket-related error codes.
- #--------------------------------------------------------------------
-
- AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
- AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
-
- #--------------------------------------------------------------------
- # Check for the existence of the -lsocket and -lnsl libraries.
- # The order here is important, so that they end up in the right
- # order in the command line generated by make. Here are some
- # special considerations:
- # 1. Use "connect" and "accept" to check for -lsocket, and
- # "gethostbyname" to check for -lnsl.
- # 2. Use each function name only once: can't redo a check because
- # autoconf caches the results of the last check and won't redo it.
- # 3. Use -lnsl and -lsocket only if they supply procedures that
- # aren't already present in the normal libraries. This is because
- # IRIX 5.2 has libraries, but they aren't needed and they're
- # bogus: they goof up name resolution if used.
- # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
- # To get around this problem, check for both libraries together
- # if -lsocket doesn't work by itself.
- #--------------------------------------------------------------------
-
- tcl_checkBoth=0
- AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
- if test "$tcl_checkSocket" = 1; then
- AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
- LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
- fi
- if test "$tcl_checkBoth" = 1; then
- tk_oldLibs=$LIBS
- LIBS="$LIBS -lsocket -lnsl"
- AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
- fi
- AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
- [LIBS="$LIBS -lnsl"])])
-
- # Don't perform the eval of the libraries here because DL_LIBS
- # won't be set until we call SC_CONFIG_CFLAGS
-
- TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
- AC_SUBST(TCL_LIBS)
- AC_SUBST(MATH_LIBS)
-])
-
-#--------------------------------------------------------------------
-# SC_TCL_EARLY_FLAGS
-#
-# Check for what flags are needed to be passed so the correct OS
-# features are available.
-#
-# Arguments:
-# None
-#
-# Results:
-#
-# Might define the following vars:
-# _ISOC99_SOURCE
-# _LARGEFILE64_SOURCE
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TCL_EARLY_FLAG,[
- AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
- AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
- AC_TRY_COMPILE([[#define ]$1[ 1
-]$2], $3,
- [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
- [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
- if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
- AC_DEFINE($1)
- tcl_flags="$tcl_flags $1"
- fi])
-
-AC_DEFUN(SC_TCL_EARLY_FLAGS,[
- AC_MSG_CHECKING([for required early compiler flags])
- tcl_flags=""
- SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
- [char *p = (char *)strtoll; char *q = (char *)strtoull;])
- SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
- [struct stat64 buf; int i = stat64("/", &buf);])
- if test "x${tcl_flags}" = "x" ; then
- AC_MSG_RESULT(none)
- else
- AC_MSG_RESULT(${tcl_flags})
- fi])
-
-#--------------------------------------------------------------------
-# SC_TCL_64BIT_FLAGS
-#
-# Check for what is defined in the way of 64-bit features.
-#
-# Arguments:
-# None
-#
-# Results:
-#
-# Might define the following vars:
-# TCL_WIDE_INT_IS_LONG
-# TCL_WIDE_INT_TYPE
-# HAVE_STRUCT_DIRENT64
-# HAVE_STRUCT_STAT64
-# HAVE_TYPE_OFF64_T
-#
-#--------------------------------------------------------------------
-
-AC_DEFUN(SC_TCL_64BIT_FLAGS, [
- AC_MSG_CHECKING([for 64-bit integer type])
- AC_CACHE_VAL(tcl_cv_type_64bit,[
- tcl_cv_type_64bit=none
- # See if the compiler knows natively about __int64
- AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
- tcl_type_64bit=__int64, tcl_type_64bit="long long")
- # See if we should use long anyway Note that we substitute in the
- # type that is our current guess for a 64-bit type inside this check
- # program, so it should be modified only carefully...
- AC_TRY_RUN([#include <unistd.h>
- int main() {exit(!(sizeof(]${tcl_type_64bit}[) > sizeof(long)));}
- ], tcl_cv_type_64bit=${tcl_type_64bit},:,:)])
- if test "${tcl_cv_type_64bit}" = none ; then
- AC_DEFINE(TCL_WIDE_INT_IS_LONG)
- AC_MSG_RESULT(using long)
- else
- AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
- AC_MSG_RESULT(${tcl_cv_type_64bit})
-
- # Now check for auxiliary declarations
- AC_MSG_CHECKING([for struct dirent64])
- AC_CACHE_VAL(tcl_cv_struct_dirent64,[
- AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/dirent.h>],[struct dirent64 p;],
- tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
- if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
- AC_DEFINE(HAVE_STRUCT_DIRENT64)
- fi
- AC_MSG_RESULT(${tcl_cv_struct_dirent64})
-
- AC_MSG_CHECKING([for struct stat64])
- AC_CACHE_VAL(tcl_cv_struct_stat64,[
- AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
-],
- tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
- if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
- AC_DEFINE(HAVE_STRUCT_STAT64)
- fi
- AC_MSG_RESULT(${tcl_cv_struct_stat64})
-
- AC_MSG_CHECKING([for off64_t])
- AC_CACHE_VAL(tcl_cv_type_off64_t,[
- AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
-],
- tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
- if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
- AC_DEFINE(HAVE_TYPE_OFF64_T)
- fi
- AC_MSG_RESULT(${tcl_cv_type_off64_t})
- fi])
diff --git a/funtools/util/tclmainlib.c b/funtools/util/tclmainlib.c
deleted file mode 100644
index 0503915..0000000
--- a/funtools/util/tclmainlib.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Copyright (c) 2004 Smithsonian Astrophysical Observatory
- */
-
-#include <tclmainlib.h>
-
-#if HAVE_TCL
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Private Routines and Data
- *
- *
- *----------------------------------------------------------------------------
- */
-
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Semi-Public Routines and Data
- *
- *
- *----------------------------------------------------------------------------
- */
-
-#ifdef ANSI_FUNC
-int
-MainLibInit_Tcl (MainLib ml)
-#else
-int MainLibInit_Tcl (ml)
- MainLib ml;
-#endif
-{
- /* sanity check */
- if( !ml ) return 0;
-
- /* populate struct with Tcl routines */
- ml->tcllookup = MainLibLookup_Tcl;
- ml->tcleval = MainLibEval_Tcl;
-
- return 1;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibLookup_Tcl
- *
- * Purpose: lookup a Tcl command
- *
- * Tcl call:
- *
- * NONE
- *
- * Returns: 1 if Tcl command, otherwise 0
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibLookup_Tcl (void *vinterp, char *s)
-#else
-int MainLibLookup_Tcl (vinterp, s)
- void *vinterp;
- char *s;
-#endif
-{
- Tcl_Interp *interp = (Tcl_Interp *)vinterp;
- Tcl_CmdInfo info;
- char lbuf[SZ_LINE];
- char tbuf[SZ_LINE];
- int ip=0;
- int got=0;
-
- /* create interpreter, if necessary */
- if( !vinterp ){
- interp = Tcl_CreateInterp();
- }
-
- /* get first token */
- strncpy(lbuf, s, SZ_LINE-1);
- lbuf[SZ_LINE-1] = '\0';
- if( !word(lbuf, tbuf, &ip) )
- return 0;
-
- /* lookup Tcl command */
- if( Tcl_GetCommandInfo(interp, tbuf, &info) )
- got = 1;
- else
- got = 0;
-
- /* delete interpreter, if necessary */
- if( !vinterp ){
- Tcl_DeleteInterp(interp);
- }
-
- /* return the news */
- return got;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibEval_Tcl
- *
- * Purpose: lookup a Tcl command
- *
- * Tcl call:
- *
- * NONE
- *
- * Returns: 1 if Tcl command, otherwise 0
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibEval_Tcl (void *vinterp, char *s)
-#else
-int MainLibEval_Tcl (vinterp, s)
- void *vinterp;
- char *s;
-#endif
-{
- Tcl_Interp *interp = (Tcl_Interp *)vinterp;
- int got=0;
-
- /* create interpreter, if necessary */
- if( !vinterp ){
- interp = Tcl_CreateInterp();
- }
-
- /* lookup Tcl command */
- got = Tcl_EvalEx(interp, s, strlen(s), TCL_EVAL_GLOBAL);
-
- /* delete interpreter, if necessary */
- if( !vinterp ){
- Tcl_DeleteInterp(interp);
- }
-
- /* return the news */
- return got;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibProcess_Tcl
- *
- * Purpose: execute the mainlibprocess command
- *
- * Tcl call:
- *
- * set result [mainlib $ml "command"]
- *
- * Returns: Tcl error code
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibProcess_Tcl(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[])
-#else
-int MainLibProcess_Tcl(clientData, interp, objc, objv)
- ClientData clientData;
- Tcl_Interp *interp;
- int objc;
- Tcl_Obj *CONST objv[];
-#endif
-{
- int len;
- int got;
- int fillbuf=1;
- void *tml;
- char *s=NULL;
- char *t=NULL;
- char *mode=NULL;
- char *name=NULL;
- char *cmd=NULL;
- char *args=NULL;
- char *buf=NULL;
- char tbuf[SZ_LINE];
- Tcl_Obj *resultPtr;
- MainLib ml;
-
- /* avoid -W unused parameter warning */
- if( 0 ){
- clientData = clientData;
- }
-
- /* make sure argument count is correct */
- if( (objc != 3) && (objc != 4) ){
- name = Tcl_GetStringFromObj(objv[0], NULL);
- if( !strcmp(name, TCL_MAINLIB_NAME) ){
- Tcl_WrongNumArgs(interp, 1, objv, "ml 'cmd args' [mode]");
- }
- else{
- snprintf(tbuf, SZ_LINE-1, "ml 'args' [mode]");
- Tcl_WrongNumArgs(interp, 1, objv, tbuf);
- }
- return(TCL_ERROR);
- }
-
- /* this will hold the result */
- resultPtr = Tcl_GetObjResult(interp);
-
- /* get name */
- name = Tcl_GetStringFromObj(objv[0], NULL);
-
- /* get mainlib handle */
- s = Tcl_GetStringFromObj(objv[1], NULL);
- if( (sscanf(s, "%p", &tml) != 1) ){
- Tcl_SetStringObj(resultPtr, "MAINLIB$ERROR: invalid mainlib handle", -1);
- return(TCL_ERROR);
- }
- ml = (MainLib)tml;
-
- /* make sure Tcl routines are in mainlib record */
- MainLibInit_Tcl(ml);
-
- /* if name is the default, then the full command is in argv[1] */
- name = Tcl_GetStringFromObj(objv[0], NULL);
- if( !strcmp(name, TCL_MAINLIB_NAME) ){
- cmd = xstrdup(Tcl_GetStringFromObj(objv[2], NULL));
- }
- /* otherwise, the command name is in argv[0] and arguments are in argv[1] */
- else{
- args = xstrdup(Tcl_GetStringFromObj(objv[2], NULL));
- len = strlen(name) + strlen(args) + 2;
- cmd = malloc(len);
- snprintf(cmd, len, "%s %s", name, args);
- }
-
- /* check for mode */
- if( objc == 4 ){
- mode = xstrdup(Tcl_GetStringFromObj(objv[3], NULL));
- }
-
- /* reset error/result condition */
- Tcl_ResetResult(interp);
-
- /* add tcl=[interp] to mode */
- snprintf(tbuf, SZ_LINE-1, "tcl=%p", (void *)interp);
- if( mode ){
- len = strlen(mode) + strlen(tbuf) + 2;
- mode = xrealloc(mode, len);
- snprintf(mode, len, "%s,%s", mode, tbuf);
- }
- else{
- mode = xstrdup(tbuf);
- }
-
- /* fillbuf determines meaning of MainLibProcess return value */
- if( (t = xstrdup(mode)) ){
- if( keyword(t, "fillbuf", tbuf, SZ_LINE) ) fillbuf = istrue(tbuf);
- xfree(t);
- }
-
- /* call the mainlib process routine */
- got = MainLibProcess(ml, cmd, &buf, mode);
-
- /* free up space */
- if( args ) xfree(args);
- if( cmd ) xfree(cmd);
- if( mode ) xfree(mode);
-
- /* return buf as the result */
- if( got >= 0 ){
- if( fillbuf ){
- if( buf ){
- Tcl_SetStringObj(resultPtr, buf, got);
- xfree(buf);
- }
- return(TCL_OK);
- }
-#if HAVE_CYGWIN==0
- else{
- Tcl_Channel chan;
- /* create a tcl channel corresponding to the pipe */
- if( !(chan = Tcl_MakeFileChannel((ClientData)got, TCL_READABLE)) ){
- Tcl_SetResult(interp, "can't create Tcl chan for pipe", TCL_STATIC);
- return TCL_ERROR;
- }
- else{
- /* register this channel with tcl */
- Tcl_RegisterChannel(interp, chan);
- /* return name so that it can be used by tcl */
- Tcl_SetResult(interp,(char *)Tcl_GetChannelName(chan), TCL_VOLATILE);
- return(TCL_OK);
- }
- }
-#else
- else{
- /* this probably is useless */
- snprintf(tbuf, SZ_LINE-1, "%d", got);
- Tcl_SetStringObj(resultPtr, tbuf, -1);
- return(TCL_OK);
- }
-#endif
- }
- else{
- Tcl_SetStringObj(resultPtr, "unable to execute mainlib command", -1);
- return(TCL_ERROR);
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibProcessCleanup_Tcl
- *
- * Purpose: execute the mainlibprocesscleanup command
- *
- * Tcl call:
- *
- * set result [mainlib ml]
- *
- * Returns: Tcl error code
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibProcessCleanup_Tcl(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[])
-#else
-int MainLibProcessCleanup_Tcl(clientData, interp, objc, objv)
- ClientData clientData;
- Tcl_Interp *interp;
- int objc;
- Tcl_Obj *CONST objv[];
-#endif
-{
- int got;
- char *s=NULL;
- void *tml;
- Tcl_Obj *resultPtr;
- MainLib ml;
-
- /* avoid -W unused parameter warning */
- if( 0 ){
- clientData = clientData;
- }
-
- /* make sure argument count is correct */
- if( objc != 2 ){
- Tcl_WrongNumArgs(interp, 1, objv, "ml");
- return(TCL_ERROR);
- }
-
- /* this will hold the result */
- resultPtr = Tcl_GetObjResult(interp);
-
- /* get mainlib handle */
- s = Tcl_GetStringFromObj(objv[1], NULL);
- if( (sscanf(s, "%p", &tml) != 1) ){
- Tcl_SetStringObj(resultPtr, "MAINLIB$ERROR: invalid mainlib handle", -1);
- return(TCL_ERROR);
- }
- ml = (MainLib)tml;
-
- /* reset error/result condition */
- Tcl_ResetResult(interp);
-
- /* call the mainlib process routine */
- got = MainLibProcessCleanup(ml);
-
- /* return buf as the result */
- if( got == 1 ){
- return(TCL_OK);
- }
- else{
- Tcl_SetStringObj(resultPtr, "error on mainlibcleanup command", -1);
- return(TCL_ERROR);
- }
-
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: MainLibLoad_Tcl
- *
- * Purpose: load shared object and execute the mainlibinit
- *
- * Tcl call:
- *
- * set result [mainlibload package sharedlib]
- *
- * Returns: Tcl error code
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-MainLibLoad_Tcl(ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[])
-#else
-int MainLibLoad_Tcl(clientData, interp, objc, objv)
- ClientData clientData;
- Tcl_Interp *interp;
- int objc;
- Tcl_Obj *CONST objv[];
-#endif
-{
- char *package=NULL;
- char *shlib=NULL;
- char *ermsg;
- char tbuf[SZ_LINE];
- void *dl=NULL;
- void *ml=NULL;
- Tcl_Obj *resultPtr;
-
- /* avoid -W unused parameter warning */
- if( 0 ){
- clientData = clientData;
- }
-
- /* make sure argument count is correct */
- if( objc != 3 ){
- Tcl_WrongNumArgs(interp, 1, objv, "package sharedlib");
- return(TCL_ERROR);
- }
-
- /* get arguments */
- package = Tcl_GetStringFromObj(objv[1], NULL);
- shlib = Tcl_GetStringFromObj(objv[2], NULL);
-
- /* this will hold the result */
- resultPtr = Tcl_GetObjResult(interp);
-
- /* load package and process result */
- switch(MainLibLoad(package, shlib, &ml, &ermsg)){
- case -1:
- snprintf(tbuf, SZ_LINE-1,
- "MAINLIB$ERROR: could not load shared library %s (%s)",
- shlib, ermsg);
- Tcl_SetStringObj(resultPtr, tbuf, -1);
- return(TCL_ERROR);
- case -2:
- snprintf(tbuf, SZ_LINE-1,
- "MAINLIB$ERROR: could not initialize package %s (%s)",
- package, ermsg);
- Tcl_SetStringObj(resultPtr, tbuf, -1);
- return(TCL_ERROR);
- default:
- snprintf(tbuf, SZ_LINE-1, "%p %p", ml, dl);
- Tcl_SetStringObj(resultPtr, tbuf, -1);
- return(TCL_OK);
- break;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Public Routines and Data
- *
- *
- *----------------------------------------------------------------------------
- */
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: Tclmainlib_Init
- *
- * Purpose: initialize Tcl mainlib package
- *
- * Returns: tcl return code
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-Tclmainlib_Init (void *vinterp)
-#else
-int Tclmainlib_Init (vinterp)
- void *vinterp;
-#endif
-{
- Tcl_Interp *interp = (Tcl_Interp *)vinterp;
-
- /* add mainlib commands to this interpreter */
- Tcl_CreateObjCommand(interp, TCL_MAINLIB_NAME,
- MainLibProcess_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-
- Tcl_CreateObjCommand(interp, "mainlibcleanup",
- MainLibProcessCleanup_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-
- Tcl_CreateObjCommand(interp, "mainlibload",
- MainLibLoad_Tcl,
- (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
-
- Tcl_PkgProvide(interp, "tclmainlib", "1.0");
- return(TCL_OK);
-}
-#endif
diff --git a/funtools/util/tclmainlib.h b/funtools/util/tclmainlib.h
deleted file mode 100644
index 7b224f2..0000000
--- a/funtools/util/tclmainlib.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "mainlib.h"
-
-#if HAVE_TCL
-
-/* name of tcl procedure */
-#include <tcl.h>
-
-#define TCL_MAINLIB_NAME "mainlib"
-
-/* library declarations */
-_PRbeg
-
-int MainLibInit_Tcl _PRx((MainLib ml));
-
-int MainLibLookup_Tcl _PRx((void *vinterp, char *s));
-
-int MainLibEval_Tcl _PRx((void *vinterp, char *s));
-
-int MainLibProcess_Tcl _PRx((ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-
-int MainLibProcessCleanup_Tcl _PRx((ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-
-int MainLibLoad_Tcl _PRx((ClientData clientData, Tcl_Interp *interp,
- int objc, Tcl_Obj *CONST objv[]));
-
-_PRend
-
-#endif
-
diff --git a/funtools/util/tlaunch.c b/funtools/util/tlaunch.c
deleted file mode 100644
index b12b074..0000000
--- a/funtools/util/tlaunch.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2007 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * tlaunch -- test launch routine
- *
- */
-
-#define HAVE_CONFIG_H 1
-#include <xlaunch.h>
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-int main (int argc, char **argv)
-#else
-int main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int got=0;
- int doattach=0;
- int dofiles=0;
- int dopipes=0;
- int pipes[2];
- char *prog=NULL;
- char *files[3];
- char *pfile=NULL;
- char wbuf[SZ_LINE];
- FILE *fd;
-
- /* init */
- memset(files, 0, sizeof(char *)*3);
- /* process switch arguments */
- while ((c = getopt(argc, argv, "ae:i:o:p:w:")) != -1){
- switch(c){
- case 'a':
- doattach = 1;
- break;
- case 'e':
- files[2] = optarg;
- dofiles |= 4;
- break;
- case 'i':
- files[0] = optarg;
- dofiles |= 1;
- break;
- case 'o':
- files[1] = optarg;
- dofiles |= 2;
- break;
- case 'p':
- pfile = optarg;
- dopipes = 1;
- break;
- case 'w':
- snprintf(wbuf, SZ_LINE, "LAUNCH_ROUTINE=%s", optarg);
- putenv(wbuf);
- default:
- break;
- }
- }
- if( optind >= argc ){
- fprintf(stderr,
- "usage: %s -a -i stdin -o stdout -e stderr -p pfile [command]\n",
- argv[0]);
- return 1;
- }
- prog = argv[optind++];
- if( !strcmp(prog, "tlaunch2") && !dopipes ){
- fprintf(stderr, "ERROR: use -p [file] with tlaunch2\n");
- return 1;
- }
- if( (got = Launch(prog, doattach, dofiles?files:NULL, dopipes?pipes:NULL)) )
- fprintf(stderr, "ERROR: got=%d\n", got);
- else
- fprintf(stderr, "SUCCESS: got(%x)=%d\n", dofiles, got);
- /* send pipe file contents to child, read back and display results */
- if( pfile ){
- if( !(fd = fopen(pfile,"r")) ){
- perror("fopen");
- return 1;
- }
- while( fread(&c, sizeof(char), 1, fd) ){
- write(pipes[1], &c, 1);
- if( read(pipes[0], &c, 1) ){
- fwrite(&c, sizeof(char), 1, stdout);
- }
- }
- fclose(fd);
- }
- return 0;
-}
diff --git a/funtools/util/tlaunch2.c b/funtools/util/tlaunch2.c
deleted file mode 100644
index 24afc12..0000000
--- a/funtools/util/tlaunch2.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * tlaunch2 -- test launch routine (child routines)
- *
- */
-
-#define HAVE_CONFIG_H 1
-
-#if HAVE_CONFIG_H
-#include <conf.h>
-#endif
-#include <stdio.h>
-#include <ctype.h>
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef ANSI_FUNC
-int main (int argc, char **argv)
-#else
-int main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int i;
- char c;
- char *s, *t, *u;
- int pipes[4];
- if( (s=getenv("LAUNCH_PIPES")) ){
- t = (char *)strdup(s);
- for(i=0, u=(char *)strtok(t, ","); i<4 && u;
- i++, u=(char *)strtok(NULL,",")){
- pipes[i] = atoi(u);
- fprintf(stderr, "child pipe #%d: %d\n", i, pipes[i]);
- }
- if( t ) free(t);
- if( i < 4 ) return(1);
- close(pipes[0]);
- close(pipes[3]);
- dup2(pipes[2], 0); close(pipes[2]);
- dup2(pipes[1], 1); close(pipes[1]);
- }
- else{
- fprintf(stderr, "No LAUNCH_PIPE environment variable\n");
- }
- while( read(0, &c, 1) ){
- if( islower((int)c) ) c = toupper((int)c);
- write(3, &c, 1);
- write(1, &c, 1);
- }
- return 0;
-}
diff --git a/funtools/util/tparse.c b/funtools/util/tparse.c
deleted file mode 100644
index 6167b19..0000000
--- a/funtools/util/tparse.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <parse.h>
-
-extern char *optarg;
-extern int optind;
-
-#ifdef ANSI_FUNC
-int
-main (int argc, char **argv)
-#else
-main(argc, argv)
- int argc;
- char **argv;
-#endif
-{
- int c;
- int i;
- int lptr=0;
- int lastd=0;
- int nullvalues=0;
- int whitespace=0;
- int dtab[PARSE_TABLE_SIZE];
- int ctab[PARSE_TABLE_SIZE];
- char *s;
- char tbuf[SZ_LINE];
- char lbuf[SZ_LINE];
- char *delims=" \n";
- char *comchars="#\n";
-
- /* we want the args in the same order in which they arrived, and
- gnu getopt sometimes changes things without this */
- putenv("POSIXLY_CORRECT=true");
-
- /* process switch arguments */
- while ((c = getopt(argc, argv, "c:d:nw")) != -1){
- switch(c){
- case 'c':
- comchars=optarg;
- break;
- case 'd':
- delims=optarg;
- break;
- case 'n':
- nullvalues=1;
- break;
- case 'w':
- whitespace=1;
- break;
- }
- }
-
- memset(dtab, 0, PARSE_TABLE_SIZE*sizeof(int));
- for(s=delims; s && *s; s++){
- if( (i=(int)*s) == '\\' ){
- s++;
- if( *s == 'n' ) i = '\n';
- else if( *s == 't' ) i = '\t';
- else if( *s == 'r' ) i = '\r';
- else if( *s == 'f' ) i = '\014';
- }
- dtab[i] = 1;
- }
-
- memset(ctab, 0, PARSE_TABLE_SIZE*sizeof(int));
- for(s=comchars; s && *s; s++){
- if( (i=(int)*s) == '\\' ){
- s++;
- if( *s == 'n' ) i = '\n';
- else if( *s == 't' ) i = '\t';
- else if( *s == 'r' ) i = '\r';
- else if( *s == 'f' ) i = '\014';
- }
- ctab[i] = 1;
- }
-
- i = 0;
- while( fgets(lbuf, SZ_LINE, stdin) ){
- lptr = 0;
- fprintf(stdout, "#%d: %s", i++, lbuf);
- while( ParseWord(dtab, ctab, nullvalues, whitespace,
- lbuf, tbuf, SZ_LINE, &lptr, &lastd) )
- fprintf(stdout, "%s\n", tbuf);
- }
-
- /* success */
- return 0;
-}
diff --git a/funtools/util/winprocess.c b/funtools/util/winprocess.c
deleted file mode 100644
index 70839dc..0000000
--- a/funtools/util/winprocess.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 2009 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * winprocess.c -- routines to start up and communicate with a slave process
- *
- * this is the windows version, see zprocess.c for original code
- *
- */
-
-#include <winprocess.h>
-
-#if defined(HAVE_CYGWIN) || defined(WIN32)
-
-#include <windows.h>
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-#define MAXPROCS 512
-
-typedef struct wproctable {
- HANDLE hIchan;
- HANDLE hOchan;
- HANDLE hProcess;
-} WPROC;
-
-
-static WPROC wprtable[MAXPROCS];
-
-/* WPR_FINDPROCESS -- Search the process table for a process */
-static WPROC *wpr_findprocess(HANDLE process)
-{
- register int wpr;
- for(wpr=0; wpr<MAXPROCS; wpr++){
- if(wprtable[wpr].hProcess == process){
- return (&wprtable[wpr]);
- }
- }
- return (NULL);
-}
-
-/* WPR_ENTER -- Make a new entry in the process table. */
-static int wpr_enter(HANDLE process, HANDLE ichan, HANDLE ochan)
-{
- register int wpr;
-
- for(wpr=0; wpr<MAXPROCS; wpr++){
- if(wprtable[wpr].hProcess == 0){
- wprtable[wpr].hProcess = process;
- wprtable[wpr].hIchan = ichan;
- wprtable[wpr].hOchan = ochan;
- return(1);
- }
- }
- return(0);
-}
-
-/* WPR_GETCHAN -- Get the codes for the IPC channels assigned to a process */
-static HANDLE wpr_getchan (HANDLE process, HANDLE *ichan, HANDLE *ochan)
-{
- register WPROC *wpr;
-
- /* Lookup process in table. Return an error if there is no entry */
- if ((wpr = wpr_findprocess(process)) == NULL){
- return(NULL);
- }
- else{
- *ichan = wpr->hIchan;
- *ochan = wpr->hOchan;
- return (process);
- }
-}
-
-/* WPR_RELEASE -- Release the table entry for the process. Used when a process
- * is killed and we do not wish to wait for process termination */
-static void wpr_release (HANDLE process)
-{
- register WPROC *wpr;
-
- if ((wpr = wpr_findprocess (process)) != NULL){
- wpr->hProcess = 0;
- wpr->hIchan = 0;
- wpr->hOchan = 0;
- }
-}
-
-/*
- *
- * Public Routines
- *
- *
- */
-
-int WinProcessOpen(char *cmd, HANDLE *ichan, HANDLE *ochan, HANDLE *process)
-{
- HANDLE g_hChildStd_IN_Rd = NULL;
- HANDLE g_hChildStd_IN_Wr = NULL;
- HANDLE g_hChildStd_OUT_Rd = NULL;
- HANDLE g_hChildStd_OUT_Wr = NULL;
-
- SECURITY_ATTRIBUTES saAttr;
- PROCESS_INFORMATION piProcInfo;
- STARTUPINFO siStartInfo;
- BOOL bSuccess = FALSE;
-
- // Set the bInheritHandle flag so pipe handles are inherited.
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
-
- // Create a pipe for the child process's STDOUT.
- if ( !CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0) )
- return 0;
-
- // Ensure the read handle to the pipe for STDOUT is not inherited.
- if ( !SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) )
- return 0;
-
- // Create a pipe for the child process's STDIN.
- if (!CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0))
- return 0;
-
- // Ensure the write handle to the pipe for STDIN is not inherited.
- if ( !SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) )
- return 0;
-
- // Set up members of the PROCESS_INFORMATION structure.
- ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );
-
- // Set up members of the STARTUPINFO structure.
- // This structure specifies the STDIN and STDOUT handles for redirection.
- ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
- siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.hStdError = g_hChildStd_OUT_Wr;
- siStartInfo.hStdOutput = g_hChildStd_OUT_Wr;
- siStartInfo.hStdInput = g_hChildStd_IN_Rd;
- siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
-
- // Create the child process.
- bSuccess = CreateProcess(NULL,
- cmd, // command line
- NULL, // process security attributes
- NULL, // primary thread security attributes
- TRUE, // handles are inherited
- 0, // creation flags
- NULL, // use parent's environment
- NULL, // use parent's current directory
- &siStartInfo, // STARTUPINFO pointer
- &piProcInfo); // receives PROCESS_INFORMATION
-
- // check for errors and configure return values
- if( bSuccess ) {
- /* save process info for later */
- wpr_enter (piProcInfo.hProcess, g_hChildStd_OUT_Rd, g_hChildStd_OUT_Rd);
- // Close handles to the child process and its primary thread.
- // Some applications might keep these handles to monitor the status
- // of the child process, for example.
- // CloseHandle(piProcInfo.hProcess);
- CloseHandle(piProcInfo.hThread);
- // close unused sides of the pipe
- CloseHandle(g_hChildStd_OUT_Wr);
- CloseHandle(g_hChildStd_IN_Rd);
- /* package up process info for return */
- *ichan = (void *)g_hChildStd_OUT_Rd;
- *ochan = (void *)g_hChildStd_IN_Wr;
- *process = (void *)piProcInfo.hProcess;
- /* success */
- return 1;
- } else {
- /* failure */
- *ichan = NULL;
- *ochan = NULL;
- *process = NULL;
- return 0;
- }
-}
-
-/*
- *
- * WinProcessClose -- Close a connected subprocess
- *
- */
-int WinProcessClose(void *vprocess, int *exit_status)
-{
- HANDLE ichan, ochan;
- HANDLE process = (HANDLE)vprocess;
-
-
- *exit_status = 0;
- if( wpr_getchan(process, &ichan, &ochan) != NULL ){
- CloseHandle(ochan);
- CloseHandle(ichan);
- CloseHandle(process);
- wpr_release(process);
- }
- return(*exit_status);
-}
-
-
-/*
- *
- * WinProcessRead -- Read next record from an IPC channel.
- *
- * Since UNIX pipes are byte streams we must take special measures to
- * transmit data through a pipe in records.
- * Each block of data is preceded by a header of sizeof(int) consisting
- * containing the number of bytes in the block.
- * To read a block we must read the count and then issue successive read
- * requests until the entire block has been read.
- *
-*/
-void *WinProcessRead(void *vfd, void *buf, int maxbytes, int *got)
-{
- register char *op;
- register int nbytes;
- char *obuf;
- int record_length;
- int temp;
- DWORD tgot;
- HANDLE fd = (HANDLE)vfd;
-
- /* no data read as yet */
- *got = 0;
-
- /* Get byte count of record.
- */
- if((ReadFile(fd, &temp, sizeof(int), &tgot, NULL) == FALSE) ||
- (tgot != sizeof(int)))
- return NULL;
- record_length = temp;
- if( maxbytes >= 0 )
- nbytes = min(record_length, maxbytes);
- else
- nbytes = record_length;
-
- /* allocate output buffer, if necessary */
- if( buf )
- obuf = buf;
- else{
- obuf = (char *)malloc(nbytes);
- if( !obuf ) return NULL;
- }
- op = (char *)obuf;
-
- /* Now read exactly nbytes of data from channel into user buffer.
- * Return actual byte count if EOF is seen. If an error is seen, return.
- * If necessary multiple read requests are issued to read the
- * entire record.
- */
- while (nbytes > 0){
- if( ReadFile(fd, op, nbytes, &tgot, NULL) == FALSE ){
- if( !buf ) free(obuf);
- *got = 0;
- return NULL;
- } else if( tgot == 0 ){
- return(obuf);
- } else {
- nbytes -= tgot;
- *got += tgot;
- op += tgot;
- }
- }
-
- /* If the record is larger than maxbytes, we must read and discard
- * the additional bytes. The method used is inefficient but it is
- * unlikely that we will be called to read less than a full record.
- */
- if( maxbytes >= 0 ){
- for (nbytes = maxbytes; nbytes < record_length; nbytes++){
- if( (ReadFile(fd, &temp, 1, &tgot, NULL) == FALSE) || (tgot == 0) ){
- break;
- }
- }
- }
- return(obuf);
-}
-
-/*
- *
- * ProcessWrite -- Write to an IPC channel.
- * Write the IPC block header followed by the data block.
- *
-*/
-int WinProcessWrite(void *vfd, void *buf, int nbytes)
-{
- DWORD tgot;
- BOOL got;
- HANDLE fd = (HANDLE)vfd;
-
- /* write byte count */
- WriteFile(fd, &nbytes, sizeof(int), &tgot, NULL);
-
- /* write data block */
- got = WriteFile(fd, buf, nbytes, &tgot, NULL);
- if( got == FALSE ){
- return(-1);
- } else {
- return((int)tgot);
- }
-}
-
-#else
-
-int have_winprocess=0;
-
-#endif
diff --git a/funtools/util/winprocess.h b/funtools/util/winprocess.h
deleted file mode 100644
index c60a7de..0000000
--- a/funtools/util/winprocess.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * winprocess.h - include file for the process handling
- *
- *
- */
-
-#ifndef __winprocess_h
-#define __winprocess_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include "prsetup.h"
-
-#if defined(HAVE_CYGWIN) || defined(WIN32)
-
-_PRbeg
-
-int WinProcessOpen _PRx((char *cmd, void **ichan, void **ochan, void **pid));
-void *WinProcessRead _PRx((void *fd, void *buf, int maxbytes, int *got));
-int WinProcessWrite _PRx((void *fd, void *buf, int nbytes));
-int WinProcessClose _PRx((void *pid, int *exit_status));
-int WinProcessGetChan _PRx((void *pid, void **ichan, void **ochan));
-
-_PRend
-
-#endif
-
-#endif /* __winprocess.h */
diff --git a/funtools/util/word.c b/funtools/util/word.c
deleted file mode 100644
index 54d8772..0000000
--- a/funtools/util/word.c
+++ /dev/null
@@ -1,1097 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- * word.c -- token parser, pattern matcher, macro expander,
- * and other word-related routines
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <word.h>
-
-/* SAOMOD_CTYPE -- work around Slackware/RedHat incompatibility */
-#ifdef linux
-#ifdef isalnum
-#undef isalnum
-#define isalnum(c) (isalpha(c)||isdigit(c))
-#endif
-#endif
-
-/* **************************************************************************
- *
- *
- * PRIVATE ROUTINES AND DATA
- *
- *
- * **************************************************************************/
-
-/* word */
-#define MAXDELIM 256
-#define MAXDTABLES 1024
-#define BUFINC 5000
-
-static char lastd;
-static char dtable[MAXDELIM];
-static char *dtables[MAXDTABLES];
-static int ndtable=0;
-
-/* tmatch */
-#define ALL '*'
-#define ANY '?'
-#define RANGE '['
-#define ENDRANGE ']'
-#define RANGEDELIM '-'
-#define NOTRANGE '~'
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: checkrange (from tmatch)
- *
- * Purpose: see if character is in specified range
- *
- * Returns: 1 if in range, otherwise 0
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static int
-checkrange (char *xtemplate, int *ptr, int c)
-#else
-static int checkrange(xtemplate, ptr, c)
- char *xtemplate;
- int *ptr;
- int c;
-#endif
-{
- int inrange, notrange;
- char lorange, hirange;
- int tptr;
-
- tptr = *ptr;
- /* make sure we have a close bracket */
- if( strchr(&xtemplate[tptr], ENDRANGE) == NULL )
- return(0);
- /* check for negation - match if not in range */
- if( xtemplate [tptr+1] == NOTRANGE ){
- notrange = 1; tptr++;
- }
- else
- notrange = 0;
- /* start pessimistically */
- inrange = 0;
- /* point past RANGE character */
- tptr++;
- while( xtemplate[tptr] != ENDRANGE ){
- /* get lo range */
- lorange = xtemplate[tptr];
- /* and hi range */
- tptr++;
- if( xtemplate[tptr] != RANGEDELIM )
- hirange = lorange;
- else{
- tptr++;hirange = xtemplate[tptr];tptr++;
- }
- if( (c>=lorange) && (c<=hirange) ){
- inrange = 1; break;
- }
- }
- /* only exclusive OR of inrange and notrange is ok */
- if( (inrange ^ notrange) ==0 )
- return(0);
- else{
- *ptr = strchr(&xtemplate[tptr],']') - xtemplate + 1;
- return(1);
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: addstring (from macro)
- *
- * Purpose: add a string to a buffer
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static void
-addstring (char **buf, int *blen, int *maxlen, char *str)
-#else
-static void addstring(buf, blen, maxlen, str)
- char **buf;
- int *blen;
- int *maxlen;
- char *str;
-#endif
-{
- int slen;
-
- slen = strlen(str) + 1;
- while( (*blen + slen) >= *maxlen ){
- *maxlen += BUFINC;
- *buf = (char *)xrealloc(*buf, *maxlen);
- }
- strcat(*buf, str);
- *blen += slen;
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: addchar (from macro)
- *
- * Purpose: add a single char to a buffer
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static void
-addchar (char **buf, int *blen, int *maxlen, int c)
-#else
-static void addchar(buf, blen, maxlen, c)
- char **buf;
- int *blen;
- int *maxlen;
- int c;
-#endif
-{
- char tbuf[2];
-
- tbuf[0] = c;
- tbuf[1] = '\0';
- addstring(buf, blen, maxlen, tbuf);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: lookupkeywords (from macro)
- *
- * Purpose: lookup a name in a list of keywords
- *
- * Returns: return the associated value or NULL
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static char *
-lookupkeywords (char *name, char **keyword, char **value, int nkey)
-#else
-static char *lookupkeywords(name, keyword, value, nkey)
- char *name;
- char **keyword;
- char **value;
- int nkey;
-#endif
-{
- int i;
- for(i=0; i<nkey; i++){
- if( !strcmp(name, keyword[i]) )
- return(value[i]);
- }
- return(NULL);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: hexval (from strtoul16)
- *
- * Purpose: return the int value corresponding to a hex character
- *
- * Returns: hex value or -1 if the character is not legal hex
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static int
-hexval (int c)
-#else
-static int hexval(c)
- int c;
-#endif
-{
- switch(c){
- case '0': return 0;
- case '1': return 1;
- case '2': return 2;
- case '3': return 3;
- case '4': return 4;
- case '5': return 5;
- case '6': return 6;
- case '7': return 7;
- case '8': return 8;
- case '9': return 9;
- case 'A': return 10;
- case 'a': return 10;
- case 'B': return 11;
- case 'b': return 11;
- case 'C': return 12;
- case 'c': return 12;
- case 'D': return 13;
- case 'd': return 13;
- case 'E': return 14;
- case 'e': return 14;
- case 'F': return 15;
- case 'f': return 15;
- default: return -1;
- }
-}
-
-/* **************************************************************************
- *
- *
- * PUBLIC ROUTINES
- *
- *
- * **************************************************************************/
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: word
- *
- * Purpose: a simple spaced parser
- *
- * Returns: 1 if word was found, else 0
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-word (char *lbuf, char *tbuf, int *lptr)
-#else
-int word(lbuf, tbuf, lptr)
- char *lbuf;
- char *tbuf;
- int *lptr;
-#endif
-{
- int ip;
- int i;
- char quotes;
-
- /* reset last delimiter */
- lastd='\0';
-
- /* null out the output string */
- *tbuf = '\0';
-
- /* if no string was specified, just return */
- if( lbuf == NULL )
- return(0);
-
- /* just a more convenient pointer ... */
- ip = *lptr;
-
- /* if we are at the end of string, just return */
- if( lbuf[ip] == '\0' )
- return(0);
-
- /* skip over white space */
- while( isspace((int)lbuf[ip]) || (dtable[(int)lbuf[ip]]>0) ){
- if( lbuf[ip] == '\0' ){
- *lptr = ip;
- return(0);
- }
- else
- ip++;
- }
-
- /* check for an explicit quote */
- quotes = '\0';
- if( lbuf[ip] == '"' ){
- quotes = '"';
- lastd = '"';
- }
- if( lbuf[ip] == '\'' ){
- quotes = '\'';
- lastd = '\'';
- }
-
- /* grab next token */
- if( quotes != '\0' ){
- /* bump past quotes */
- ip++;
- /* grab up to next quotes -- but skip escaped quotes */
- for(i=0; lbuf[ip] != '\0'; i++, ip++){
- if( (lbuf[ip] == quotes) && (lbuf[ip-1] != '\\') )
- break;
- else
- tbuf[i] = lbuf[ip];
- }
- }
- else{
- /* grab up to next whitespace */
- for(i=0;
- lbuf[ip] && !isspace((int)lbuf[ip]) && (dtable[(int)lbuf[ip]]==0);
- i++, ip++)
- tbuf[i] = lbuf[ip];
- /* save this delimiter */
- lastd = lbuf[ip];
- }
- /* bump past delimiter (but not null terminator) */
- if( lbuf[ip] )
- ip++;
-
- /* null terminate */
- tbuf[i] = '\0';
-
- /* got something */
- *lptr = ip;
- return(1);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: newdtable
- *
- * Purpose: save the current delim table and init a new one
- *
- * Returns: 1 if another delim table can be allocated, 0 otherwise
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-newdtable (char *s)
-#else
-int newdtable(s)
- char *s;
-#endif
-{
- int i;
- char *cur;
-
- if( ndtable >= MAXDTABLES ){
- fprintf(stderr, "ERROR: no more delimiter tables available\n");
- return(0);
- }
- /* save another dtable */
- ndtable++;
- /* allocate new space for this table */
- dtables[ndtable-1] = (char *)xmalloc(MAXDELIM);
- cur = dtables[ndtable-1];
- /* copy and zero the old table */
- for(i=0; i<MAXDELIM; i++){
- cur[i] = dtable[i];
- dtable[i] = 0;
- }
- /* add delims to the new table */
- if( s != NULL ){
- for(; *s; s++)
- dtable[(int)*s] = 1;
- }
- return(1);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: freedtable
- *
- * Purpose: restore last delim table as the current
- *
- * Returns: 1 if there is a table to restore, else 0
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-freedtable (void)
-#else
-int freedtable()
-#endif
-{
- int i;
- char *cur;
-
- if( ndtable <= 0 ){
- fprintf(stderr, "ERROR: no delimiter tables to restore\n");
- return(0);
- }
- cur = dtables[ndtable-1];
- /* copy the restored table into 'current' */
- for(i=0; i<MAXDELIM; i++){
- dtable[i] = cur[i];
- }
- /* free up this dtable */
- xfree((void *)cur);
- /* one less dtable to worry about */
- ndtable--;
- return(1);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: newdelim
- *
- * Purpose: add a string delimiters to the parse table
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-void
-newdelim (char *s)
-#else
-void newdelim(s)
- char *s;
-#endif
-{
- if( s != NULL ){
- for(; *s; s++)
- dtable[(int)*s] = 1;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: freedelim
- *
- * Purpose: remove delims from current delim table
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-void
-freedelim (char *s)
-#else
-void freedelim(s)
- char *s;
-#endif
-{
- int i;
-
- if( s ){
- for(; *s; s++)
- if( dtable[(int)*s] > 0 )
- dtable[(int)*s] -= 1;
- }
- else{
- for(i=0; i<MAXDELIM; i++)
- if( dtable[i] > 0 )
- dtable[i] -= 1;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: lastdelim
- *
- * Purpose: return the last delimiter
- *
- * Returns: delim character
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-lastdelim (void)
-#else
-int lastdelim()
-#endif
-{
- return((int)lastd);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: tmatch
- *
- * Purpose: match string to a template
- *
- * the legal meta characters in a template are just like the
- * C-shell meta characters, i.e:
- * ? match any character, but there must be one
- * * match anything, or nothing
- * [<c>...] match an inclusive set
- *
- *
- * Returns: non-zero if match, zero otherwise
-
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-tmatch (char *string, char *xtemplate)
-#else
-int tmatch(string, xtemplate)
- char *string;
- char *xtemplate;
-#endif
-{
- char *lastmeta=0;
- char *nonabsorbed=0;
- int sptr=0;
- int tptr=0;
-
- /* loop through string and template */
- while( (xtemplate[tptr] != '\0') || (string[sptr] != '\0') ){
- /* if exact match, just bump both pointers */
- if( string[sptr] == xtemplate[tptr] ){
- sptr++; tptr++; continue;
- }
- /* if range character, check ranges */
- if( xtemplate[tptr] == RANGE ){
- if( checkrange(xtemplate, &tptr, string[sptr]) == 0 ){
- /* no match - was there a meta character before */
- if( lastmeta == 0 ) return(0);
- /* if so, back up to it and try again */
- xtemplate = lastmeta; tptr=0;
- /* begin checking at the non-absorbed point */
- string = nonabsorbed; sptr=0;
- continue;
- }
- /* got a match, so bump past */
- else{
- sptr++; continue;
- }
- }
- /* if ANY, any character if fine, but there must be one */
- if( xtemplate[tptr] == ANY ){
- if( string[sptr] == '\0' )
- return(0);
- else{
- sptr++; tptr++; continue;
- }
- }
- /* if ALL, we can match anything */
- if( xtemplate[tptr] == ALL ){
- /* remember where the * is */
- lastmeta = &xtemplate[tptr];
- tptr++;
- /* no more template after this means a win */
- if( xtemplate[tptr] == '\0' ) return(1);
- /* if the next template char is not a meta,
- we skip up to its match in the string */
- if( xtemplate[tptr] == RANGE){
- while( checkrange(xtemplate, &tptr, string[sptr]) == 0 ){
- /* missing the next template char */
- if( string[sptr] == '\0' ) return(0);
- sptr++;
- }
- /* remember the first non-absorbed character */
- nonabsorbed = &string[sptr];nonabsorbed++;
- sptr++;
- continue;
- }
- /* skip past characters, if next template char is not a meta */
- else if( xtemplate[tptr] != ANY && xtemplate[tptr] != ALL ){
- while(string[sptr] != xtemplate[tptr]){
- /* not finding the next template char
- is bad */
- if( string[sptr] == '\0' ) return(0);
- sptr++;
- }
- /* remember the first non-absorbed character */
- nonabsorbed = &string[sptr];nonabsorbed++;
- continue;
- }
- else{
- /* remember the first non-absorbed character */
- nonabsorbed = &string[sptr];nonabsorbed++;
- continue;
- }
- }
- /* no match, no meta char - see if we once had a meta */
- else{
- if( lastmeta == 0 ) return(0);
- /* if so, back up to it and try again */
- xtemplate = lastmeta; tptr=0;
- /* begin checking at the non-absorbed point */
- string = nonabsorbed; sptr=0;
- continue;
- }
- }
- /* matched to the nulls - we win */
- return(1);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: keyword
- *
- * Purpose: look for a keyword=<value> string inside another string,
- * remove and return the <value> in another buffer
- *
- * Returns: len if keyword was found, 0 otherwise
- *
- * NB: ibuf cannot be static, as it is modified in place
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-keyword (char *ibuf, char *key, char *obuf, int maxlen)
-#else
-int keyword(ibuf, key, obuf, maxlen)
- char *ibuf;
- char *key;
- char *obuf;
- int maxlen;
-#endif
-{
- int len;
- int qlev;
- char *s;
- char *t;
- char *u;
- char *v;
- char *iptr=NULL;
- char quote='\0';
-
- /* if we have no input string, we are done */
- if( (ibuf == NULL) || (*ibuf == '\0') ){
- return(0);
- }
-
- /* start out pessimistically */
- *obuf = '\0';
- iptr = ibuf;
-
- /* maxlen generally is 1 more than we can handle */
- maxlen--;
-
- /* keep trying */
- while( *iptr ){
- /* look for key from current position */
- if( (s = (char *)strstr(iptr, key)) == NULL )
- return(0);
- /* if we found a key, we need to make sure ... */
- /* it must be preceeded by beginning of string, beginning of bracket,
- or by a "," from previous keyword */
- if( (s == ibuf) || (*(s-1) == ',') || (*(s-1) == '[') ){
- /* it can be followed by spaces ... */
- t = s + strlen(key);
- while( isspace((int)*t) )
- t++;
- /* but must be followed by an "=" */
- if( *t == '=' ){
- t++;
- /* skip spaces again */
- while( isspace((int)*t) )
- t++;
- /* this is where the actual value part of the string begins */
- u = t;
- /* this will be where it ends */
- v = t;
- /* gather up everything to the next "," or end of filter */
- if( (*t == '"') || (*t == '\'') || (*t == '(') || (*t == '[') ){
- switch(*t){
- case '"':
- case '\'':
- quote = *t;
- break;
- case '(':
- quote = ')';
- break;
- case '[':
- quote = ']';
- break;
- }
- /* bump past opening quote char */
- t++; u++; v++;
- while( *t && (*t != quote) ){
- t++; v++;
- }
- if( *t == quote ){
- t++;
- }
- }
- else{
- qlev = 0;
- while( *t &&
- ((qlev != 0) || (*t != ',')) &&
- ((qlev != 0) || (*t != ']')) ){
- if( *t == '[' )
- qlev++;
- else if( *t == ']' )
- qlev--;
- t++; v++;
- }
- }
- len = MIN(maxlen, v - u);
- strncpy(obuf, u, len);
- obuf[len] = '\0';
- /* remove keyword=value string from the original buffer */
- /* first remove preceding comma, if necessary */
- if( (s > ibuf) && (*(s-1) == ',') )
- s--;
- /* but leave 1 comma in place */
- else if( *t == ',' )
- t++;
- /* now overwrite original from where the keyword started */
- memmove(s, t, strlen(t)+1);
- return(len);
- }
- }
- /* start next search just past this one */
- iptr = s+1;
- }
- return(0);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: macro
- *
- * Purpose: expand a macro using a client's callback
- *
- * Returns: expanded macro as an allocated string
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-char *
-macro (char *icmd, char **keyword, char **value, int nkey,
- MacroCB client_callback, void *client_data)
-#else
-char *macro(icmd, keyword, value, nkey, client_callback, client_data)
- char *icmd;
- char **keyword;
- char **value;
- int nkey;
- MacroCB client_callback;
- void *client_data;
-#endif
-{
- int i, j;
- int maxlen;
- char brace;
- char *result;
- char tbuf[1000];
- char tbuf1[1000];
- char *s;
- char *ip;
- char *mip;
-
- /* make a new string using the command as a base, but substituting
- for "$" values as needed */
- result = (char *)xmalloc(BUFINC+1);
- maxlen = BUFINC;
- *result = '\0';
- for(i=0, ip=icmd; *ip; ip++){
- if( *ip != '$' ){
- addchar(&result, &i, &maxlen, *ip);
- }
- else{
- /* save beginning of macro */
- mip = ip;
- /* skip past '$' */
- ip++;
- /* check for brace mode */
- if( *ip == '{' ){
- brace = '{';
- ip++;
- }
- else if( *ip == '(' ){
- brace = '(';
- ip++;
- }
- else
- brace = '\0';
- /* get variable up to next non-alpha character or close brace */
- for(*tbuf='\0', j=0; *ip; ip++ ){
- /* if we are in brace mode, look for trailing brace */
- if( brace && *ip == (brace == '(' ? ')' : '}') ){
- ip++;
- break;
- }
- /* else look for a non-alpha character */
- else if( !isalnum((int)*ip) && *ip != '_'){
- break;
- }
- else{
- tbuf[j++] = *ip;
- tbuf[j] = '\0';
- }
- }
- /* back up so the outer loop adds this delimiting char to the output */
- ip--;
- /* search for keyword from the list */
- if( (nkey > 0) &&
- (s=lookupkeywords(tbuf, keyword, value, nkey)) != NULL ){
- addstring(&result, &i, &maxlen, s);
- }
- /* execute the client routine to expand macros */
- else if( (client_callback != NULL) &&
- ((s=(*client_callback)(tbuf, client_data)) != NULL) ){
- addstring(&result, &i, &maxlen, s);
- }
- /* look for an environment variable */
- else if( (s = (char *)getenv(tbuf)) != NULL ){
- addstring(&result, &i, &maxlen, s);
- }
- /* if we don't recognize this macro, put it back onto the string */
- else{
- int len;
- len = ip - mip + 1;
- strncpy(tbuf1, mip, len);
- tbuf1[len] = '\0';
- addstring(&result, &i, &maxlen, tbuf1);
- }
- }
- }
- /* null terminate and save the string */
- result[i] = '\0';
- result = (char *)xrealloc(result, i+1);
- return(result);
-}
-
-/* **************************************************************************
- *
- * misc word routines
- *
- * **************************************************************************/
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: cluc
- *
- * Purpose: convert lower to upper case string in place
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-void
-cluc (char *s)
-#else
-void cluc(s)
- char *s;
-#endif
-{
- while(*s){
- if( islower((int)*s) )
- *s = toupper(*s);
- s++;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: culc
- *
- * Purpose: convert upper to lower case string in place
- *
- * Returns:
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-void
-culc (char *s)
-#else
-void culc(s)
- char *s;
-#endif
-{
- while(*s){
- if( isupper((int)*s) )
- *s = tolower(*s);
- s++;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: nowhite
- *
- * Purpose: removes all beginning and ending white space from string
- *
- * Returns: returns the number of characters
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-nowhite (
- char *c, /* buffer to be cleaned */
- char *cr /* buffer for returned string */
-)
-#else
-int nowhite(c,cr)
-char *c; /* buffer to be cleaned */
-char *cr; /* buffer for returned string */
-#endif
-{
- char *cr0; /* initial value of cr */
- int n; /* the number of characters */
-
- /* skip leading white space */
- while(*c && isspace((int)*c))
- c++;
- /* copy up to the null */
- cr0 = cr;
- while(*c)
- *cr++ = *c++;
- n = cr - cr0; /* the number of characters */
- *cr-- = '\0'; /* Null and point to the last character */
- /* remove trailing white space */
- while( n && isspace((int)*cr) ){
- *cr-- = '\0';
- n--;
- }
- return(n);
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: nocr
- *
- * Purpose: remove trailing <CR> from a string (in place)
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-void
-nocr (char *s)
-#else
-void nocr(s)
- char *s;
-#endif
-{
- int len;
-
- if( (s==NULL) || (*s=='\0') )
- return;
- len = strlen(s);
- if( s[len-1] == '\n' )
- s[len-1] = '\0';
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: istrue
- *
- * Purpose: check if a string is "true" or "yes" or "on"
- *
- * Returns: 1 if true string, 0 otherwise
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-istrue (char *s)
-#else
-int istrue(s)
- char *s;
-#endif
-{
- char *t;
- int result;
-
- if( (s==NULL) || (*s=='\0') )
- return(0);
- t = (char *)xmalloc(strlen(s)+1);
- nowhite(s, t);
- culc(t);
- result = (!strcmp(t, "true") || !strcmp(t, "yes") ||
- !strcmp(t, "on") || !strcmp(t, "1") );
- xfree(t);
- return(result);
-}
-
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: isfalse
- *
- * Purpose: check if a string is "false" or "no" or "off"
- *
- * Returns: 1 if false string, 0 otherwise
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-int
-isfalse (char *s)
-#else
-int isfalse(s)
- char *s;
-#endif
-{
- char *t;
- int result;
-
- if( (s==NULL) || (*s=='\0') )
- return(0);
- t = (char *)xmalloc(strlen(s)+1);
- nowhite(s, t);
- culc(t);
- result = (!strcmp(t, "false") || !strcmp(t, "no") ||
- !strcmp(t, "off") || !strcmp(t, "0") );
- xfree(t);
- return(result);
-}
-
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: strtoul16
- *
- * Purpose: convert a string to an unsigned long hex value
- *
- * Returns: converted hex value (end of converted string is in t)
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-unsigned long strtoul16 (char *s, char **t)
-#else
-unsigned long strtoul16(s, t)
- char *s;
- char **t;
-#endif
-{
- unsigned long v=0;
- int h;
-
- while ( *s != ' ' &&
- *s != '\n' &&
- *s != '\r' &&
- *s != '\0' ){
- v *= 16;
- if( (h = hexval(*s)) >= 0 ){
- v += h;
- s++;
- }
- else{
- break;
- }
- }
- if( t != NULL )
- *t = s;
- return(v);
-}
diff --git a/funtools/util/word.h b/funtools/util/word.h
deleted file mode 100644
index 428941f..0000000
--- a/funtools/util/word.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * word.h -- declarations for word parsing
- *
- */
-
-#ifndef __word_h
-#define __word_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include "prsetup.h"
-#include "xalloc.h"
-
-/* defines the types of callback procedure we use */
-typedef char *(*MacroCB)(
-#ifdef ANSI_FUNC
- char *buf,
- void *client_data
-#endif
-);
-
-_PRbeg
-
-int word _PRx((char *lbuf, char *tbuf, int *lptr));
-int newdtable _PRx((char *s));
-int freedtable _PRx((void));
-void newdelim _PRx((char *s));
-void freedelim _PRx((char *s));
-int lastdelim _PRx((void));
-int tmatch _PRx((char *string, char *xtemplate));
-int keyword _PRx((char *ibuf, char *key, char *obuf, int maxlen));
-char *macro _PRx((char *icmd, char **keyword, char **value, int nkey,
- MacroCB client_callback, void *client_data));
-void cluc _PRx((char *s));
-void culc _PRx((char *s));
-int nowhite _PRx((char *c, char *cr));
-void nocr _PRx((char *s));
-int istrue _PRx((char *s));
-int isfalse _PRx((char *s));
-unsigned long strtoul16 _PRx((char *s, char **t));
-
-_PRend
-
-#endif
diff --git a/funtools/util/xalloc.c b/funtools/util/xalloc.c
deleted file mode 100644
index 18234db..0000000
--- a/funtools/util/xalloc.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2004-2009 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * xalloc -- safe memory allocation with error checking
- *
- */
-
-/* this module is compiled within a funtools filter and must not require
- the header files */
-#ifdef FILTER_PTYPE
-#define ANSI_FUNC 1
-#else
-#include <xalloc.h>
-#endif
-
-#define XALLOC_ERROR "ERROR: can't allocate memory (xalloc)\n"
-
-#if XALLOC_SETJMP
-
-static jmp_buf *xalloc_envptr=NULL;
-
-#ifdef ANSI_FUNC
-void xalloc_savejmp(jmp_buf *env)
-#else
-void xalloc_savejmp(env)
- jmp_buf *env;
-#endif
-{
- xalloc_envptr = env;
-}
-#endif
-
-
-#ifdef ANSI_FUNC
-static void _xalloc_error(void)
-#else
-static void _xalloc_error()
-#endif
-{
- write(1, XALLOC_ERROR, strlen(XALLOC_ERROR));
-#if XALLOC_SETJMP
- if( xalloc_envptr )
- longjmp(*xalloc_envptr, XALLOC_SETJMP);
- else
-#endif
- exit(1);
-}
-
-#ifdef ANSI_FUNC
-void *xmalloc(size_t n)
-#else
-void *xmalloc(n)
- size_t n;
-#endif
-{
- void *p;
-
- if( !(p = (void *)malloc(n)) )
- _xalloc_error();
- return p;
-}
-
-#ifdef ANSI_FUNC
-void *xcalloc (size_t n, size_t s)
-#else
-void *xcalloc (n, s)
- size_t n, s;
-#endif
-{
- void *p;
-
- if( !(p = (void *)calloc(n, s)) )
- _xalloc_error();
- return p;
-}
-
-#ifdef ANSI_FUNC
-void *xrealloc (void *p, size_t n)
-#else
-void *xrealloc (p, n)
- void *p;
- size_t n;
-#endif
-{
- if( !p )
- return xmalloc(n);
- if( !(p = (void *)realloc(p, n)) )
- _xalloc_error();
- return p;
-}
-
-#ifdef ANSI_FUNC
-void xfree (void *p)
-#else
-void xfree (p)
- void *p;
-#endif
-{
- if( p )
- free(p);
-}
-
-#ifdef ANSI_FUNC
-char *xstrdup (char *s)
-#else
-char *xstrdup (s)
- char *s;
-#endif
-{
- if( s )
- return((char *)strcpy((char *)xmalloc((size_t)strlen(s)+1), s));
- else
- return NULL;
-}
diff --git a/funtools/util/xalloc.h b/funtools/util/xalloc.h
deleted file mode 100644
index 09f74b0..0000000
--- a/funtools/util/xalloc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2004 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * xalloc.h -- declarations for safe (error-checked) memory allocation
- *
- */
-
-#ifndef __xalloc_h
-#define __xalloc_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <sys/types.h>
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SETJMP_H
-#define XALLOC_SETJMP 142857
-#include <setjmp.h>
-#endif
-
-#include "prsetup.h"
-
-_PRbeg
-
-void *xmalloc _PRx((size_t n));
-void *xcalloc _PRx((size_t n, size_t s));
-void *xrealloc _PRx((void *p, size_t n));
-void xfree _PRx((void *p));
-char *xstrdup _PRx((char *s));
-#if HAVE_SETJMP
-void xalloc_savejmp _PRx((jmp_buf *env));
-#endif
-
-_PRend
-
-#endif
diff --git a/funtools/util/xfileio.h b/funtools/util/xfileio.h
deleted file mode 100644
index 8cfd04d..0000000
--- a/funtools/util/xfileio.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- * xfileio.h -- package-specific xfileio.h used by fitsy
- *
- */
-
-#ifndef XFILEIO_H
-#define XFILEIO_H
-
-#include "gio.h"
-
-/* define the basic IO routines */
-typedef GIO File;
-#define ftOpen(n, m) gopen(n, m)
-#define ftRead(f, b, s, n) gread(f, b, s, n)
-#define ftGets(f, b, n) ggets(f, b, n)
-#define ftWrite(f, b, s, n) gwrite(f, b, s, n)
-#define ftFlush(f) gflush(f)
-#define ftSeek(f, o, n) (gseek(f, o, n), gtell(f))
-#define ftTell(f) gtell(f)
-#define ftClose(fd) gclose(fd)
-
-#endif
diff --git a/funtools/util/xlaunch.c b/funtools/util/xlaunch.c
deleted file mode 100644
index 9f064d1..0000000
--- a/funtools/util/xlaunch.c
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Copyright (c) 1999-2007 Smithsonian Astrophysical Observatory
- */
-
-#include <xlaunch.h>
-
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Private Routines and Data
- *
- *
- *----------------------------------------------------------------------------
- */
-
-static pid_t pid=0;
-
-#if HAVE_MINGW32==0
-
-/* wait for child process to start, using waitpid() */
-#ifdef ANSI_FUNC
-static int launch_pipes(int *pipes, int flag)
-#else
-static int launch_pipes(pipes, flag)
- int *pipes;
- int flag;
-#endif
-{
- int i;
- char tbuf[SZ_LINE];
- if( pipes ){
- for(i=0; i<4; i++){
- pipes[i] = -1;
- }
- if( (pipe(&pipes[0]) < 0) || (pipe(&pipes[2]) < 0) ) return -1;
- if( flag ){
-#if HAVE_SETENV
- snprintf(tbuf, SZ_LINE-1, "%d,%d,%d,%d",
- pipes[0], pipes[1], pipes[2], pipes[3]);
- setenv("LAUNCH_PIPES", tbuf, 1);
-#else
- snprintf(tbuf, SZ_LINE-1, "LAUNCH_PIPES=%d,%d,%d,%d",
- pipes[0], pipes[1], pipes[2], pipes[3]);
- putenv(xstrdup(tbuf));
-#endif
- }
- }
- return 0;
-}
-
-#ifdef ANSI_FUNC
-static int cleanup_pipes(int *pipes)
-#else
-static int cleanup_pipes(pipes)
- int *pipes;
-#endif
-{
- if( pipes ){
- /* close child pipes */
- close(pipes[1]);
- close(pipes[2]);
- /* move parent write into slot 1 */
- pipes[1] = pipes[3];
- /* set unused pipes to impossible value */
- pipes[2] = -1;
- pipes[3] = -1;
- }
- return 0;
-}
-
-#if LAUNCH_USE_WAITPID
-/* wait for child process to start, using waitpid() */
-#ifdef ANSI_FUNC
-static int launch_waitstart(pid_t pid)
-#else
-static int launch_waitstart(pid)
- pid_t pid;
-#endif
-{
- int i, got;
- int status=0;
- struct timeval tv;
- /* wait up to LAUNCH_WAIT_TRIES millisec to make sure the child started,
- but if we get an error, we can exit immediately */
- for(i=0; i<LAUNCH_WAIT_TRIES; i++){
- errno = 0;
- got=waitpid(pid, &status, WNOHANG);
- /* look for error termination */
- if( (got < 0) || ((got == 0) && xerrno) ){
- got = -1;
- /* make sure status shows error */
- if( status == 0 )
- status = -1;
- break;
- }
- /* look for normal termination */
- else if( got > 0 ){
- break;
- }
- /* no termination, sleep and wait some more */
- else{
- tv.tv_sec = 0;
- tv.tv_usec = LAUNCH_WAIT_MSEC;
- xselect(1, NULL, NULL, NULL, &tv);
- }
- }
- /* no termination means the child is still running */
- if( got == 0 ) status = 0;
- /* return the news */
- return status;
-}
-#endif
-
-/*
- * standard unix version of launch:
- * adapted from the system() code in:
- * W. Richard Stevens
- * "Advanced Programming in the Unix Environment"
- * Addison-Wesley Publishing Co, 1992
- * p. 314
- */
-#ifdef ANSI_FUNC
-static int launch_fork_exec(char *cmdstring, int attach,
- char **stdfiles, int *pipes)
-#else
- static int launch_fork_exec(cmdstring, attach, stdfiles, pipes)
- char *cmdstring;
- int attach;
- char **stdfiles;
- int *pipes;
-#endif
-{
- int status;
- int tpipes[4];
- struct sigaction ignore, saveintr, savequit;
- sigset_t chldmask, savemask;
-#if LAUNCH_USE_PIPE
- int fd[2];
-#endif
-
- /* return false if no command is specified */
- if( !cmdstring || !*cmdstring ) return -1;
-
- ignore.sa_handler = SIG_IGN; /* ignore SIGINT and SIGQUIT */
- sigemptyset(&ignore.sa_mask);
- ignore.sa_flags = 0;
- if (sigaction(SIGINT, &ignore, &saveintr) < 0)
- return -1;
- if (sigaction(SIGQUIT, &ignore, &savequit) < 0)
- return -1;
-
- sigemptyset(&chldmask); /* now block SIGCHLD */
- sigaddset(&chldmask, SIGCHLD);
- if (sigprocmask(SIG_BLOCK, &chldmask, &savemask) < 0)
- return -1;
-
-#if LAUNCH_USE_PIPE
- /* open a pipe so parent can hear if the child fails to exec */
- if( !attach ){
- if( pipe(fd) < 0 )
- return -1;
- xfcntl(fd[0], F_SETFD, FD_CLOEXEC);
- xfcntl(fd[1], F_SETFD, FD_CLOEXEC);
- }
-#endif
-
- /* create temp ipc pipes if necessary */
- if( pipes ){
- if( launch_pipes(tpipes, 0) < 0 ) return -1;
- }
-
- /* start new process */
- if( (pid = fork()) < 0 ){
-#if LAUNCH_USE_PIPE
- if( !attach ){
- close(fd[0]);
- close(fd[1]);
- }
-#endif
- if( pipes ){
- close(tpipes[0]);
- close(tpipes[1]);
- close(tpipes[2]);
- close(tpipes[3]);
- }
- status = -1; /* ERROR: probably out of processes */
- } else if( pid == 0 ){ /* child */
- int i, j, len;
- char *argv[LAUNCH_ARGS+1];
- char *path=NULL;
- char *s=NULL, *t=NULL;
-
- /* reset pipes, if necessary */
- if( pipes ){
- /* close parent's read/write pipes */
- close(tpipes[0]);
- close(tpipes[3]);
- /* change child's stdin/stdout to use the passed pipes to parent */
- dup2(tpipes[2], 0); close(tpipes[2]);
- dup2(tpipes[1], 1); close(tpipes[1]);
- }
-
- /* close and reopen stdio files, if necessary */
- if( stdfiles ){
- for(i=0; i<3; i++){
- if( stdfiles[i] ){
- close(i);
- switch(i){
- case 0:
- if( open(stdfiles[i], O_RDONLY) < 0){
- _exit(-1);
- }
- break;
- case 1:
- if( open(stdfiles[i], O_CREAT|O_WRONLY|O_TRUNC, 0600) < 0){
- _exit(-1);
- }
- break;
- case 2:
- /* if stderr is the same as stdout, just dup */
- if( stdfiles[1] && !strcmp(stdfiles[1], stdfiles[i]) ){
- dup(1);
- }
- else{
- if( open(stdfiles[i], O_CREAT|O_WRONLY|O_TRUNC, 0600) < 0){
- _exit(-1);
- }
- }
- break;
- }
- }
- }
- }
-
- /* restore previous signal actions & reset signal mask, but only if
- parent is waiting for completion (i.e., we are "attached") */
- if( attach ){
- sigaction(SIGINT, &saveintr, NULL);
- sigaction(SIGQUIT, &savequit, NULL);
- sigprocmask(SIG_SETMASK, &savemask, NULL);
- }
-#if LAUNCH_USE_PIPE
- /* child closes reader -- only writes status */
- else{
- close(fd[0]);
- }
-#endif
-
- /* package up the arguments for new process */
- t = (char *)xstrdup(cmdstring);
- for(i=0, s=(char *)strtok(t, " \t"); s;
- i++, s=(char *)strtok(NULL," \t")){
- if( i < LAUNCH_ARGS ){
- /* save argument */
- argv[i] = xstrdup(s);
- /* change back special char to spaces, if necessary */
- len = strlen(argv[i]);
- for(j=0; j<len; j++){
- if( argv[i][j] == LAUNCH_SPACE){
- argv[i][j] = ' ';
- }
- }
- argv[i+1] = NULL;
- /* save program name */
- if( i == 0 ) path = argv[i];
- }
- }
- if( t ) xfree(t);
-#ifndef HAVE_CYGWIN
- /* this call is broken in cygwin */
- /* for unattached processes, start a new session (with new process id),
- so that we do not inherit signals from parent (particularly SIGTERM) */
- if( !attach )
- setsid();
-#endif
- /* start up the new program */
- if( execvp(path, argv) ){
- status = 127;
-#if LAUNCH_USE_PIPE
- if( !attach ){
- write(fd[1], &status, 4);
- close(fd[1]);
- }
-#endif
- _exit(status); /* exec error */
- }
- } else { /* parent */
- /* wait for program termination from attached process */
- if( attach ){
- while( waitpid(pid, &status, 0) < 0 ){
- if( xerrno != EINTR ){
- status = -1; /* error other than EINTR from waitpid() */
- break;
- }
- }
- }
- else{
-#if LAUNCH_USE_WAITPID
- status = launch_waitstart(pid);
-#endif
-#if LAUNCH_USE_PIPE
- close(fd[1]);
- if( read(fd[0], &status, 4) == 0 ){
- status = 0;
- }
- close(fd[0]);
-#endif
- }
- }
-
- /* cleanup temp ipc pipes and move into user space */
- if( pipes ){
- cleanup_pipes(tpipes);
- pipes[0] = tpipes[0];
- pipes[1] = tpipes[1];
- }
-
- /* restore previous signal actions & reset signal mask */
- if( sigaction(SIGINT, &saveintr, NULL) < 0 ) return -1;
- if( sigaction(SIGQUIT, &savequit, NULL) < 0 ) return -1;
- if( sigprocmask(SIG_SETMASK, &savemask, NULL) < 0 ) return -1;
-
- /* return the news */
- return status;
-}
-
-#endif
-
-#if HAVE_POSIX_SPAWN
-
-#if defined(HAVE__NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-#else
-extern char **environ;
-#endif
-
-/* spawn calls POSIX posix_spawn */
-#ifdef ANSI_FUNC
-static int launch_posix_spawn(char *cmdstring, int attach,
- char **stdfiles, int *pipes)
-#else
- static int launch_posix_spawn(cmdstring, attach, stdfiles, pipes)
- char *cmdstring;
- int attach;
- char **stdfiles;
- int *pipes;
-#endif
-{
- int i, j, len;
- int status=0;
- int got=0;
- int tpipes[4];
- char *argv[LAUNCH_ARGS+1];
- char *path=NULL;
- char *s=NULL, *t=NULL;
- posix_spawn_file_actions_t act;
- posix_spawn_file_actions_t *pact=NULL;
-
- /* return false if no command is specified */
- if( !cmdstring || !*cmdstring )
- return -1;
-
- /* create temp ipc pipes if necessary */
- if( pipes ){
- if( launch_pipes(tpipes, 1) < 0 ) return -1;
- }
-
- /* package up the arguments for new process */
- t = (char *)xstrdup(cmdstring);
- for(i=0, s=(char *)strtok(t, " \t"); s;
- i++, s=(char *)strtok(NULL," \t")){
- if( i < LAUNCH_ARGS ){
- /* save argument */
- argv[i] = xstrdup(s);
- /* change back special char to spaces, if necessary */
- len = strlen(argv[i]);
- for(j=0; j<len; j++){
- if( argv[i][j] == LAUNCH_SPACE){
- argv[i][j] = ' ';
- }
- }
- /* last arg is always a NULL */
- argv[i+1] = NULL;
- /* save program name */
- if( i == 0 ) path = argv[i];
- /* inc arg count */
- got++;
- }
- }
- if( t ) xfree(t);
- /* arrange stdfiles files, if necessary */
- if( stdfiles ){
- if( posix_spawn_file_actions_init(&act) != 0)
- return -1;
- /* stdin */
- if(stdfiles[0] &&
- posix_spawn_file_actions_addopen(&act, 0, stdfiles[0], O_RDONLY, 0))
- return -1;
- /* stdout */
- if(stdfiles[1] &&
- posix_spawn_file_actions_addopen(&act, 1, stdfiles[1], O_CREAT|O_WRONLY|O_TRUNC, 0600))
- return -1;
- /* stderr */
- if(stdfiles[2] &&
- posix_spawn_file_actions_addopen(&act, 2, stdfiles[2], O_CREAT|O_WRONLY|O_TRUNC, 0600))
- return -1;
- pact = &act;
- }
- /* start the new process */
- if( (status = posix_spawnp(&pid, path, pact, NULL, argv, environ)) )
- return status;
- /* wait for program termination from attached process */
- if( attach ){
- while( waitpid(pid, &status, 0) < 0 ){
- if( xerrno != EINTR ){
- status = -1; /* error other than EINTR from waitpid() */
- break;
- }
- }
- }
-#if BIG_DELAY_WHEN_USING_THIS
- /* wait for child process to start */
- else{
- status = launch_waitstart(pid);
- }
-#endif
- /* clean up */
- if( stdfiles ) posix_spawn_file_actions_destroy(&act);
- /* cleanup temp ipc pipes and move into user space */
- if( pipes ){
- cleanup_pipes(tpipes);
- pipes[0] = tpipes[0];
- pipes[1] = tpipes[1];
- }
- for(i=0; i<got; i++){
- if( argv[i] ) xfree((char *)argv[i]);
- }
- /* return status */
- return status;
-}
-
-#endif
-
-#if HAVE_SPAWNVP
-
-#ifdef ANSI_FUNC
-static int launch_spawnvp(char *cmdstring, int attach,
- char **stdfiles, int *pipes)
-#else
- static int launch_spawnvp(cmdstring, attach, stdfiles, pipes)
- char *cmdstring;
- int attach;
- char **stdfiles;
- int *pipes;
-#endif
-{
- int i, j;
- int len;
- int got;
- int status;
- int tpipes[4];
- char *argv[LAUNCH_ARGS+1];
- char *path=NULL;
- char *s=NULL, *t=NULL;
- struct timeval tv;
-
- /* return false if no command is specified */
- if( !cmdstring || !*cmdstring ) return -1;
-
- /* for now, we can't support stdfiles */
- if( stdfiles ) return -1;
-
- /* create temp ipc pipes if necessary */
- if( pipes ){
-#if HAVE_MINGW32==0
- if( launch_pipes(tpipes, 1) < 0 ) return -1;
-#else
- fprintf(stderr, "ERROR: launch_pipes() not available in mingw\n");
- exit(1);
-#endif
- }
-
-
- /* package up the arguments for new process */
- t = (char *)xstrdup(cmdstring);
- for(i=0, got=0, s=(char *)strtok(t, " \t"); s;
- i++, s=(char *)strtok(NULL," \t")){
- if( i < LAUNCH_ARGS ){
- /* save argument */
- argv[i] = xstrdup(s);
- /* change back special char to spaces, if necessary */
- len = strlen(argv[i]);
- for(j=0; j<len; j++){
- if( argv[i][j] == LAUNCH_SPACE){
- argv[i][j] = ' ';
- }
- }
- /* last arg is always a NULL */
- argv[i+1] = NULL;
- /* save program name */
- if( i == 0 ) path = (char *)argv[i];
- /* inc arg count */
- got++;
- }
- }
- if( t ) xfree(t);
- if( attach )
- i = _P_WAIT;
- else
- i = _P_NOWAIT;
- if((status = spawnvp(i, path, (void *)argv)) != -1){
- status = 0;
- /* wait for child to start */
- tv.tv_sec = 0;
- tv.tv_usec = LAUNCH_WAIT_MSEC;
- xselect(1, NULL, NULL, NULL, &tv);
- }
- /* clean up */
- for(i=0; i<got; i++){
- if( argv[i] ) xfree((char *)argv[i]);
- }
- /* cleanup temp ipc pipes and move into user space */
- if( pipes ){
-#if HAVE_MINGW32==0
- cleanup_pipes(tpipes);
- pipes[0] = tpipes[0];
- pipes[1] = tpipes[1];
-#else
- fprintf(stderr, "ERROR: launch_pipes() not available in mingw\n");
- exit(1);
-#endif
- }
- return status;
-}
-
-#endif
-
-/*
- *----------------------------------------------------------------------------
- *
- *
- * Public Routines and Data
- *
- *
- *----------------------------------------------------------------------------
- */
-
-/*
- *
- * LaunchPid() -- return pid of last launched process
- *
- */
-#ifdef ANSI_FUNC
-pid_t LaunchPid(void)
-#else
-pid_t LaunchPid()
-#endif
-{
- return pid;
-}
-
-#ifdef ANSI_FUNC
-int Launch(char *cmdstring, int attach, char **stdfiles, int *pipes)
-#else
-int Launch(cmdstring, attach, stdfiles, piles)
- char *cmdstring;
- int attach;
- char **stdfiles;
- int *pipes;
-#endif
-{
- static int which_launch=0;
- static int which_debug=0;
- char *s=NULL;
-
- /* return false if no command is specified */
- if( !cmdstring || !*cmdstring ) return -1;
-
- /* sanity check: don't specify stdfiles and pipes simultaneously */
- if( stdfiles && pipes ){
- fprintf(stderr,
- "ERROR: stdfiles and pipes are mutually exclusive in Launch()\n");
- return -1;
- }
-
- /* if pipes are specified, we don't attach */
- if( pipes ) attach = 0;
-
- /* determine launch method */
- if( !which_launch ){
- which_launch = LAUNCH_DEFAULT_WHICH;
- if( (s=getenv("LAUNCH_ROUTINE")) ){
- /* fork_exec */
- if( !strncasecmp(s, "f", 1) ){
- which_launch = 1;
- if( *s == 'F' ) which_debug = 1;
- }
- /* posix_spawn */
- else if( !strncasecmp(s, "p", 1) ){
- which_launch = 2;
- if( *s == 'P' ) which_debug = 1;
- }
- /* spawnvp */
- else if( !strncasecmp(s, "s", 1) ){
- which_launch = 3;
- if( *s == 'S' ) which_debug = 1;
- }
- else if( *s == 'V' ) {
- which_debug = 1;
- }
- }
- }
- /* call the correct launch method */
- switch(which_launch){
- case 1:
-#if HAVE_MINGW32==0
- if( which_debug ) fprintf(stderr, "launch_fork_exec: %s\n", cmdstring);
- return launch_fork_exec(cmdstring, attach, stdfiles, pipes);
-#else
- fprintf(stderr, "ERROR: fork_exec() not available on this host\n");
- exit(1);
-#endif
- break;
- case 2:
-#if HAVE_POSIX_SPAWN
- if( which_debug ) fprintf(stderr, "launch_posix_spawn: %s\n", cmdstring);
- return launch_posix_spawn(cmdstring, attach, stdfiles, pipes);
-#else
- fprintf(stderr, "ERROR: posix_spawn() not available on this host\n");
- exit(1);
-#endif
- break;
- case 3:
-#if HAVE_SPAWNVP
- if( which_debug ) fprintf(stderr, "launch_spawnvp: %s\n", cmdstring);
- return launch_spawnvp(cmdstring, attach, stdfiles, pipes);
-#else
- fprintf(stderr, "ERROR: spawnvp() not available on this host\n");
- exit(1);
-#endif
- break;
- default:
-#if HAVE_MINGW32==0
- if( which_debug ) fprintf(stderr, "launch_fork_exec: %s\n", cmdstring);
- return launch_fork_exec(cmdstring, attach, stdfiles, pipes);
-#else
- fprintf(stderr, "ERROR: no launch techniques available on this host\n");
- exit(1);
-#endif
- break;
- }
- /* can't happen */
- return -1;
-}
-
diff --git a/funtools/util/xlaunch.h b/funtools/util/xlaunch.h
deleted file mode 100644
index 1dfb689..0000000
--- a/funtools/util/xlaunch.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * xlaunch.h -- declarations for launching a program
- *
- */
-
-#ifndef __xlaunch_h
-#define __xlaunch_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_POSIX_SPAWN
-#include <spawn.h>
-#endif
-#include "xport.h"
-#include "word.h"
-#include "xalloc.h"
-#include "prsetup.h"
-
-#define LAUNCH_ARGS 1024
-
-#define LAUNCH_SPACE '\001'
-
-/* for fork/exec, one of these is required to specify the technique to be used
- by the parent when determining if the child started successfully */
-#if !defined(LAUNCH_USE_PIPE) && !defined(LAUNCH_USE_WAITPID)
-#define LAUNCH_USE_PIPE 1
-#endif
-/* ... but not both */
-#if defined(LAUNCH_USE_PIPE) && defined(LAUNCH_USE_WAITPID)
-#error "LAUNCH_USE_PIPE and LAUNCH_USE_WAITPID are mutually exclusive"
-#endif
-
-#ifndef LAUNCH_WAIT_TRIES
-#define LAUNCH_WAIT_TRIES 100
-#endif
-#ifndef LAUNCH_WAIT_MSEC
-#define LAUNCH_WAIT_MSEC 5000
-#endif
-
-#if HAVE_MINGW32|HAVE_CYGWIN
-#define HAVE_SPAWNVP 1
-#endif
-
-#if HAVE_MINGW32
-/* for now, ensure that MinGW utilizes spawnvp() */
-#define LAUNCH_DEFAULT_WHICH 3
-#elif HAVE_POSIX_SPAWN
-/* use posix_spawn if possible (required for OS X 10.5) */
-#define LAUNCH_DEFAULT_WHICH 2
-#else
-/* use our home-grown version */
-#define LAUNCH_DEFAULT_WHICH 1
-#endif
-
-_PRbeg
-
-int Launch _PRx((char *cmdstring, int wait, char **stdfiles, int *pipes));
-pid_t LaunchPid _PRx((void));
-
-_PRend
-
-#endif
diff --git a/funtools/util/xport.h b/funtools/util/xport.h
deleted file mode 100644
index 52f230c..0000000
--- a/funtools/util/xport.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * xport.h - include file for platform-dependent system calls
- *
- */
-#ifndef __xport_h
-#define __xport_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#if HAVE_MINGW32
-
-#define FD_SETSIZE 8192
-#include <winsock2.h>
-#include <process.h>
-#include <io.h>
-
-#ifndef EINPROGRESS
-#define EINPROGRESS WSAEINPROGRESS
-#endif
-#ifndef EINTR
-#define EINTR WSAEINTR
-#endif
-#ifndef ETIMEDOUT
-#define ETIMEDOUT WSAETIMEDOUT
-#endif
-#ifndef ECONNREFUSED
-#define ECONNREFUSED WSAECONNREFUSED
-#endif
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#endif
-#ifndef EAGAIN
-#define EAGAIN WSAEWOULDBLOCK
-#endif
-
-#else
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <netinet/in.h> /* struct in_addr, struct sockaddr_in */
-#include <netdb.h> /* gethostbyname() */
-#include <arpa/inet.h> /* inet_addr() */
-#if HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-#if HAVE_CYGWIN
-#include <process.h>
-#endif
-
-#endif
-
-/* common definitions (i.e. not yet requiring platform differentiation) */
-
-#define xsocket(a,b,c) socket(a,b,c)
-#define xbind(a,b,c) bind(a,b,c)
-#define xaccept(a,b,c) accept(a,b,c)
-#define xselect(a,b,c,d,e) select(a,b,c,d,e)
-
-/* UNIX */
-#if HAVE_MINGW32==0
-
-#define xclose(a) close(a)
-
-#define xfcntl(a,b,c) fcntl(a,b,c)
-
-#define xfcntl_nonblock(a,b) \
- b = fcntl(a, F_GETFL, 0); \
- fcntl(a, F_SETFL, b|O_NONBLOCK)
-
-#define xfcntl_restore(a,b) fcntl(a, F_SETFL, b)
-
-#define xsocketstartup()
-
-#define xsocketcleanup()
-
-#define xfd_set_stdin(a,b) FD_SET(a,b)
-#define xfd_isset_stdin(a,b) (a >= 0) && FD_ISSET(a,b)
-#define xfd_clr_stdin(a,b) FD_CLR(a,b)
-
-#define xsignal_sigpipe() signal(SIGPIPE, SIG_IGN)
-
-#define xerrno errno
-
-#define xmkdir(a,b) mkdir(a,b)
-#define xchmod(a,b) chmod(a,b)
-
-/* WINDOWS */
-#else
-
-#define xclose(a) closesocket(a)
-
-#define xfcntl(a,b,c)
-
-#define xfcntl_nonblock(a,b) \
- { \
- int iomode=1; \
- ioctlsocket(a, FIONBIO, (u_long FAR *) &iomode); \
- }
-
-#define xfcntl_restore(a,b) \
- { \
- int iomode=0; \
- ioctlsocket(a, FIONBIO, (u_long FAR *) &iomode); \
- }
-
-#define xsocketstartup() \
- { \
- WSADATA wsaData; \
- WSAStartup(MAKEWORD(2,0), &wsaData); \
- }
-
-#define xsocketcleanup() WSACleanup()
-
-#define xfd_set_stdin(a,b) setmode(a, O_BINARY)
-
-#define xfd_isset_stdin(a,b) (a >= 0)
-#define xfd_clr_stdin(a,b)
-
-#define xsignal_sigpipe()
-
-#define xerrno WSAGetLastError()
-
-#define xmkdir(a,b) mkdir(a)
-#define xchmod(a,b) chmod(a,b)
-
-#ifndef WNOHANG
-#define WNOHANG 1
-#endif
-
-#endif
-
-#endif /* __xport.h */
diff --git a/funtools/util/zlib-1.2.3/ChangeLog b/funtools/util/zlib-1.2.3/ChangeLog
deleted file mode 100644
index 7f6869d..0000000
--- a/funtools/util/zlib-1.2.3/ChangeLog
+++ /dev/null
@@ -1,855 +0,0 @@
-
- ChangeLog file for zlib
-
-Changes in 1.2.3 (18 July 2005)
-- Apply security vulnerability fixes to contrib/infback9 as well
-- Clean up some text files (carriage returns, trailing space)
-- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
-
-Changes in 1.2.2.4 (11 July 2005)
-- Add inflatePrime() function for starting inflation at bit boundary
-- Avoid some Visual C warnings in deflate.c
-- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
- compile
-- Fix some spelling errors in comments [Betts]
-- Correct inflateInit2() error return documentation in zlib.h
-- Added zran.c example of compressed data random access to examples
- directory, shows use of inflatePrime()
-- Fix cast for assignments to strm->state in inflate.c and infback.c
-- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
-- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
-- Add cast in trees.c t avoid a warning [Oberhumer]
-- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
-- Update make_vms.com [Zinser]
-- Initialize state->write in inflateReset() since copied in inflate_fast()
-- Be more strict on incomplete code sets in inflate_table() and increase
- ENOUGH and MAXD -- this repairs a possible security vulnerability for
- invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
- discovering the vulnerability and providing test cases.
-- Add ia64 support to configure for HP-UX [Smith]
-- Add error return to gzread() for format or i/o error [Levin]
-- Use malloc.h for OS/2 [Necasek]
-
-Changes in 1.2.2.3 (27 May 2005)
-- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
-- Typecast fread() return values in gzio.c [Vollant]
-- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
-- Fix crc check bug in gzread() after gzungetc() [Heiner]
-- Add the deflateTune() function to adjust internal compression parameters
-- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
-- Remove an incorrect assertion in examples/zpipe.c
-- Add C++ wrapper in infback9.h [Donais]
-- Fix bug in inflateCopy() when decoding fixed codes
-- Note in zlib.h how much deflateSetDictionary() actually uses
-- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
-- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
-- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
-- Add gzdirect() function to indicate transparent reads
-- Update contrib/minizip [Vollant]
-- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
-- Add casts in crc32.c to avoid warnings [Oberhumer]
-- Add contrib/masmx64 [Vollant]
-- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
-
-Changes in 1.2.2.2 (30 December 2004)
-- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
- avoid implicit memcpy calls (portability for no-library compilation)
-- Increase sprintf() buffer size in gzdopen() to allow for large numbers
-- Add INFLATE_STRICT to check distances against zlib header
-- Improve WinCE errno handling and comments [Chang]
-- Remove comment about no gzip header processing in FAQ
-- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
-- Add updated make_vms.com [Coghlan], update README
-- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
- fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
-- Add FAQ entry and comments in deflate.c on uninitialized memory access
-- Add Solaris 9 make options in configure [Gilbert]
-- Allow strerror() usage in gzio.c for STDC
-- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
-- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
-- Use z_off_t for adler32_combine() and crc32_combine() lengths
-- Make adler32() much faster for small len
-- Use OS_CODE in deflate() default gzip header
-
-Changes in 1.2.2.1 (31 October 2004)
-- Allow inflateSetDictionary() call for raw inflate
-- Fix inflate header crc check bug for file names and comments
-- Add deflateSetHeader() and gz_header structure for custom gzip headers
-- Add inflateGetheader() to retrieve gzip headers
-- Add crc32_combine() and adler32_combine() functions
-- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
-- Use zstreamp consistently in zlib.h (inflate_back functions)
-- Remove GUNZIP condition from definition of inflate_mode in inflate.h
- and in contrib/inflate86/inffast.S [Truta, Anderson]
-- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
-- Update projects/README.projects and projects/visualc6 [Truta]
-- Update win32/DLL_FAQ.txt [Truta]
-- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
-- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
-- Use a new algorithm for setting strm->data_type in trees.c [Truta]
-- Do not define an exit() prototype in zutil.c unless DEBUG defined
-- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
-- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
-- Fix Darwin build version identification [Peterson]
-
-Changes in 1.2.2 (3 October 2004)
-- Update zlib.h comments on gzip in-memory processing
-- Set adler to 1 in inflateReset() to support Java test suite [Walles]
-- Add contrib/dotzlib [Ravn]
-- Update win32/DLL_FAQ.txt [Truta]
-- Update contrib/minizip [Vollant]
-- Move contrib/visual-basic.txt to old/ [Truta]
-- Fix assembler builds in projects/visualc6/ [Truta]
-
-Changes in 1.2.1.2 (9 September 2004)
-- Update INDEX file
-- Fix trees.c to update strm->data_type (no one ever noticed!)
-- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
-- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
-- Add limited multitasking protection to DYNAMIC_CRC_TABLE
-- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
-- Don't declare strerror() under VMS [Mozilla]
-- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
-- Update contrib/ada [Anisimkov]
-- Update contrib/minizip [Vollant]
-- Fix configure to not hardcode directories for Darwin [Peterson]
-- Fix gzio.c to not return error on empty files [Brown]
-- Fix indentation; update version in contrib/delphi/ZLib.pas and
- contrib/pascal/zlibpas.pas [Truta]
-- Update mkasm.bat in contrib/masmx86 [Truta]
-- Update contrib/untgz [Truta]
-- Add projects/README.projects [Truta]
-- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
-- Update win32/DLL_FAQ.txt [Truta]
-- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
-- Remove an unnecessary assignment to curr in inftrees.c [Truta]
-- Add OS/2 to exe builds in configure [Poltorak]
-- Remove err dummy parameter in zlib.h [Kientzle]
-
-Changes in 1.2.1.1 (9 January 2004)
-- Update email address in README
-- Several FAQ updates
-- Fix a big fat bug in inftrees.c that prevented decoding valid
- dynamic blocks with only literals and no distance codes --
- Thanks to "Hot Emu" for the bug report and sample file
-- Add a note to puff.c on no distance codes case.
-
-Changes in 1.2.1 (17 November 2003)
-- Remove a tab in contrib/gzappend/gzappend.c
-- Update some interfaces in contrib for new zlib functions
-- Update zlib version number in some contrib entries
-- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
-- Support shared libraries on Hurd and KFreeBSD [Brown]
-- Fix error in NO_DIVIDE option of adler32.c
-
-Changes in 1.2.0.8 (4 November 2003)
-- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
-- Add experimental NO_DIVIDE #define in adler32.c
- - Possibly faster on some processors (let me know if it is)
-- Correct Z_BLOCK to not return on first inflate call if no wrap
-- Fix strm->data_type on inflate() return to correctly indicate EOB
-- Add deflatePrime() function for appending in the middle of a byte
-- Add contrib/gzappend for an example of appending to a stream
-- Update win32/DLL_FAQ.txt [Truta]
-- Delete Turbo C comment in README [Truta]
-- Improve some indentation in zconf.h [Truta]
-- Fix infinite loop on bad input in configure script [Church]
-- Fix gzeof() for concatenated gzip files [Johnson]
-- Add example to contrib/visual-basic.txt [Michael B.]
-- Add -p to mkdir's in Makefile.in [vda]
-- Fix configure to properly detect presence or lack of printf functions
-- Add AS400 support [Monnerat]
-- Add a little Cygwin support [Wilson]
-
-Changes in 1.2.0.7 (21 September 2003)
-- Correct some debug formats in contrib/infback9
-- Cast a type in a debug statement in trees.c
-- Change search and replace delimiter in configure from % to # [Beebe]
-- Update contrib/untgz to 0.2 with various fixes [Truta]
-- Add build support for Amiga [Nikl]
-- Remove some directories in old that have been updated to 1.2
-- Add dylib building for Mac OS X in configure and Makefile.in
-- Remove old distribution stuff from Makefile
-- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
-- Update links in README
-
-Changes in 1.2.0.6 (13 September 2003)
-- Minor FAQ updates
-- Update contrib/minizip to 1.00 [Vollant]
-- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
-- Update POSTINC comment for 68060 [Nikl]
-- Add contrib/infback9 with deflate64 decoding (unsupported)
-- For MVS define NO_vsnprintf and undefine FAR [van Burik]
-- Add pragma for fdopen on MVS [van Burik]
-
-Changes in 1.2.0.5 (8 September 2003)
-- Add OF to inflateBackEnd() declaration in zlib.h
-- Remember start when using gzdopen in the middle of a file
-- Use internal off_t counters in gz* functions to properly handle seeks
-- Perform more rigorous check for distance-too-far in inffast.c
-- Add Z_BLOCK flush option to return from inflate at block boundary
-- Set strm->data_type on return from inflate
- - Indicate bits unused, if at block boundary, and if in last block
-- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
-- Add condition so old NO_DEFLATE define still works for compatibility
-- FAQ update regarding the Windows DLL [Truta]
-- INDEX update: add qnx entry, remove aix entry [Truta]
-- Install zlib.3 into mandir [Wilson]
-- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
-- Adapt the zlib interface to the new DLL convention guidelines [Truta]
-- Introduce ZLIB_WINAPI macro to allow the export of functions using
- the WINAPI calling convention, for Visual Basic [Vollant, Truta]
-- Update msdos and win32 scripts and makefiles [Truta]
-- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
-- Add contrib/ada [Anisimkov]
-- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
-- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
-- Add contrib/masm686 [Truta]
-- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
- [Truta, Vollant]
-- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
-- Remove contrib/delphi2; add a new contrib/delphi [Truta]
-- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
- and fix some method prototypes [Truta]
-- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
- [Truta]
-- Avoid the use of backslash (\) in contrib/minizip [Vollant]
-- Fix file time handling in contrib/untgz; update makefiles [Truta]
-- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
- [Vollant]
-- Remove contrib/vstudio/vc15_16 [Vollant]
-- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
-- Update README.contrib [Truta]
-- Invert the assignment order of match_head and s->prev[...] in
- INSERT_STRING [Truta]
-- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
- [Truta]
-- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
-- Fix prototype of syncsearch in inflate.c [Truta]
-- Introduce ASMINF macro to be enabled when using an ASM implementation
- of inflate_fast [Truta]
-- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
-- Modify test_gzio in example.c to take a single file name as a
- parameter [Truta]
-- Exit the example.c program if gzopen fails [Truta]
-- Add type casts around strlen in example.c [Truta]
-- Remove casting to sizeof in minigzip.c; give a proper type
- to the variable compared with SUFFIX_LEN [Truta]
-- Update definitions of STDC and STDC99 in zconf.h [Truta]
-- Synchronize zconf.h with the new Windows DLL interface [Truta]
-- Use SYS16BIT instead of __32BIT__ to distinguish between
- 16- and 32-bit platforms [Truta]
-- Use far memory allocators in small 16-bit memory models for
- Turbo C [Truta]
-- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
- zlibCompileFlags [Truta]
-- Cygwin has vsnprintf [Wilson]
-- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
-- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
-
-Changes in 1.2.0.4 (10 August 2003)
-- Minor FAQ updates
-- Be more strict when checking inflateInit2's windowBits parameter
-- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
-- Add gzip wrapper option to deflateInit2 using windowBits
-- Add updated QNX rule in configure and qnx directory [Bonnefoy]
-- Make inflate distance-too-far checks more rigorous
-- Clean up FAR usage in inflate
-- Add casting to sizeof() in gzio.c and minigzip.c
-
-Changes in 1.2.0.3 (19 July 2003)
-- Fix silly error in gzungetc() implementation [Vollant]
-- Update contrib/minizip and contrib/vstudio [Vollant]
-- Fix printf format in example.c
-- Correct cdecl support in zconf.in.h [Anisimkov]
-- Minor FAQ updates
-
-Changes in 1.2.0.2 (13 July 2003)
-- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
-- Attempt to avoid warnings in crc32.c for pointer-int conversion
-- Add AIX to configure, remove aix directory [Bakker]
-- Add some casts to minigzip.c
-- Improve checking after insecure sprintf() or vsprintf() calls
-- Remove #elif's from crc32.c
-- Change leave label to inf_leave in inflate.c and infback.c to avoid
- library conflicts
-- Remove inflate gzip decoding by default--only enable gzip decoding by
- special request for stricter backward compatibility
-- Add zlibCompileFlags() function to return compilation information
-- More typecasting in deflate.c to avoid warnings
-- Remove leading underscore from _Capital #defines [Truta]
-- Fix configure to link shared library when testing
-- Add some Windows CE target adjustments [Mai]
-- Remove #define ZLIB_DLL in zconf.h [Vollant]
-- Add zlib.3 [Rodgers]
-- Update RFC URL in deflate.c and algorithm.txt [Mai]
-- Add zlib_dll_FAQ.txt to contrib [Truta]
-- Add UL to some constants [Truta]
-- Update minizip and vstudio [Vollant]
-- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
-- Expand use of NO_DUMMY_DECL to avoid all dummy structures
-- Added iostream3 to contrib [Schwardt]
-- Replace rewind() with fseek() for WinCE [Truta]
-- Improve setting of zlib format compression level flags
- - Report 0 for huffman and rle strategies and for level == 0 or 1
- - Report 2 only for level == 6
-- Only deal with 64K limit when necessary at compile time [Truta]
-- Allow TOO_FAR check to be turned off at compile time [Truta]
-- Add gzclearerr() function [Souza]
-- Add gzungetc() function
-
-Changes in 1.2.0.1 (17 March 2003)
-- Add Z_RLE strategy for run-length encoding [Truta]
- - When Z_RLE requested, restrict matches to distance one
- - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
-- Correct FASTEST compilation to allow level == 0
-- Clean up what gets compiled for FASTEST
-- Incorporate changes to zconf.in.h [Vollant]
- - Refine detection of Turbo C need for dummy returns
- - Refine ZLIB_DLL compilation
- - Include additional header file on VMS for off_t typedef
-- Try to use _vsnprintf where it supplants vsprintf [Vollant]
-- Add some casts in inffast.c
-- Enchance comments in zlib.h on what happens if gzprintf() tries to
- write more than 4095 bytes before compression
-- Remove unused state from inflateBackEnd()
-- Remove exit(0) from minigzip.c, example.c
-- Get rid of all those darn tabs
-- Add "check" target to Makefile.in that does the same thing as "test"
-- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
-- Update contrib/inflate86 [Anderson]
-- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
-- Add msdos and win32 directories with makefiles [Truta]
-- More additions and improvements to the FAQ
-
-Changes in 1.2.0 (9 March 2003)
-- New and improved inflate code
- - About 20% faster
- - Does not allocate 32K window unless and until needed
- - Automatically detects and decompresses gzip streams
- - Raw inflate no longer needs an extra dummy byte at end
- - Added inflateBack functions using a callback interface--even faster
- than inflate, useful for file utilities (gzip, zip)
- - Added inflateCopy() function to record state for random access on
- externally generated deflate streams (e.g. in gzip files)
- - More readable code (I hope)
-- New and improved crc32()
- - About 50% faster, thanks to suggestions from Rodney Brown
-- Add deflateBound() and compressBound() functions
-- Fix memory leak in deflateInit2()
-- Permit setting dictionary for raw deflate (for parallel deflate)
-- Fix const declaration for gzwrite()
-- Check for some malloc() failures in gzio.c
-- Fix bug in gzopen() on single-byte file 0x1f
-- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
- and next buffer doesn't start with 0x8b
-- Fix uncompress() to return Z_DATA_ERROR on truncated input
-- Free memory at end of example.c
-- Remove MAX #define in trees.c (conflicted with some libraries)
-- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
-- Declare malloc() and free() in gzio.c if STDC not defined
-- Use malloc() instead of calloc() in zutil.c if int big enough
-- Define STDC for AIX
-- Add aix/ with approach for compiling shared library on AIX
-- Add HP-UX support for shared libraries in configure
-- Add OpenUNIX support for shared libraries in configure
-- Use $cc instead of gcc to build shared library
-- Make prefix directory if needed when installing
-- Correct Macintosh avoidance of typedef Byte in zconf.h
-- Correct Turbo C memory allocation when under Linux
-- Use libz.a instead of -lz in Makefile (assure use of compiled library)
-- Update configure to check for snprintf or vsnprintf functions and their
- return value, warn during make if using an insecure function
-- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
- is lost when library is used--resolution is to build new zconf.h
-- Documentation improvements (in zlib.h):
- - Document raw deflate and inflate
- - Update RFCs URL
- - Point out that zlib and gzip formats are different
- - Note that Z_BUF_ERROR is not fatal
- - Document string limit for gzprintf() and possible buffer overflow
- - Note requirement on avail_out when flushing
- - Note permitted values of flush parameter of inflate()
-- Add some FAQs (and even answers) to the FAQ
-- Add contrib/inflate86/ for x86 faster inflate
-- Add contrib/blast/ for PKWare Data Compression Library decompression
-- Add contrib/puff/ simple inflate for deflate format description
-
-Changes in 1.1.4 (11 March 2002)
-- ZFREE was repeated on same allocation on some error conditions.
- This creates a security problem described in
- http://www.zlib.org/advisory-2002-03-11.txt
-- Returned incorrect error (Z_MEM_ERROR) on some invalid data
-- Avoid accesses before window for invalid distances with inflate window
- less than 32K.
-- force windowBits > 8 to avoid a bug in the encoder for a window size
- of 256 bytes. (A complete fix will be available in 1.1.5).
-
-Changes in 1.1.3 (9 July 1998)
-- fix "an inflate input buffer bug that shows up on rare but persistent
- occasions" (Mark)
-- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
-- fix gzseek(..., SEEK_SET) in write mode
-- fix crc check after a gzeek (Frank Faubert)
-- fix miniunzip when the last entry in a zip file is itself a zip file
- (J Lillge)
-- add contrib/asm586 and contrib/asm686 (Brian Raiter)
- See http://www.muppetlabs.com/~breadbox/software/assembly.html
-- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
-- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
-- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
-- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
-- added a FAQ file
-
-- Support gzdopen on Mac with Metrowerks (Jason Linhart)
-- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
-- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
-- avoid some warnings with Borland C (Tom Tanner)
-- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
-- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
-- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
-- use libdir and includedir in Makefile.in (Tim Mooney)
-- support shared libraries on OSF1 V4 (Tim Mooney)
-- remove so_locations in "make clean" (Tim Mooney)
-- fix maketree.c compilation error (Glenn, Mark)
-- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
-- new Makefile.riscos (Rich Walker)
-- initialize static descriptors in trees.c for embedded targets (Nick Smith)
-- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
-- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
-- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
-- fix maketree.c to allow clean compilation of inffixed.h (Mark)
-- fix parameter check in deflateCopy (Gunther Nikl)
-- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
-- Many portability patches by Christian Spieler:
- . zutil.c, zutil.h: added "const" for zmem*
- . Make_vms.com: fixed some typos
- . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
- . msdos/Makefile.msc: remove "default rtl link library" info from obj files
- . msdos/Makefile.*: use model-dependent name for the built zlib library
- . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
- new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
-- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
-- replace __far with _far for better portability (Christian Spieler, Tom Lane)
-- fix test for errno.h in configure (Tim Newsham)
-
-Changes in 1.1.2 (19 March 98)
-- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
- See http://www.winimage.com/zLibDll/unzip.html
-- preinitialize the inflate tables for fixed codes, to make the code
- completely thread safe (Mark)
-- some simplifications and slight speed-up to the inflate code (Mark)
-- fix gzeof on non-compressed files (Allan Schrum)
-- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
-- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
-- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
-- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
-- do not wrap extern "C" around system includes (Tom Lane)
-- mention zlib binding for TCL in README (Andreas Kupries)
-- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
-- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
-- allow "configure --prefix $HOME" (Tim Mooney)
-- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
-- move Makefile.sas to amiga/Makefile.sas
-
-Changes in 1.1.1 (27 Feb 98)
-- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
-- remove block truncation heuristic which had very marginal effect for zlib
- (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
- compression ratio on some files. This also allows inlining _tr_tally for
- matches in deflate_slow.
-- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
-
-Changes in 1.1.0 (24 Feb 98)
-- do not return STREAM_END prematurely in inflate (John Bowler)
-- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
-- compile with -DFASTEST to get compression code optimized for speed only
-- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
-- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
- on Sun but significant on HP)
-
-- add a pointer to experimental unzip library in README (Gilles Vollant)
-- initialize variable gcc in configure (Chris Herborth)
-
-Changes in 1.0.9 (17 Feb 1998)
-- added gzputs and gzgets functions
-- do not clear eof flag in gzseek (Mark Diekhans)
-- fix gzseek for files in transparent mode (Mark Diekhans)
-- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
-- replace EXPORT with ZEXPORT to avoid conflict with other programs
-- added compress2 in zconf.h, zlib.def, zlib.dnt
-- new asm code from Gilles Vollant in contrib/asm386
-- simplify the inflate code (Mark):
- . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
- . ZALLOC the length list in inflate_trees_fixed() instead of using stack
- . ZALLOC the value area for huft_build() instead of using stack
- . Simplify Z_FINISH check in inflate()
-
-- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
-- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
-- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
- the declaration of FAR (Gilles VOllant)
-- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
-- read_buf buf parameter of type Bytef* instead of charf*
-- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
-- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
-- fix check for presence of directories in "make install" (Ian Willis)
-
-Changes in 1.0.8 (27 Jan 1998)
-- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
-- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
-- added compress2() to allow setting the compression level
-- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
-- use constant arrays for the static trees in trees.c instead of computing
- them at run time (thanks to Ken Raeburn for this suggestion). To create
- trees.h, compile with GEN_TREES_H and run "make test".
-- check return code of example in "make test" and display result
-- pass minigzip command line options to file_compress
-- simplifying code of inflateSync to avoid gcc 2.8 bug
-
-- support CC="gcc -Wall" in configure -s (QingLong)
-- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
-- fix test for shared library support to avoid compiler warnings
-- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
-- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
-- do not use fdopen for Metrowerks on Mac (Brad Pettit))
-- add checks for gzputc and gzputc in example.c
-- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
-- use const for the CRC table (Ken Raeburn)
-- fixed "make uninstall" for shared libraries
-- use Tracev instead of Trace in infblock.c
-- in example.c use correct compressed length for test_sync
-- suppress +vnocompatwarnings in configure for HPUX (not always supported)
-
-Changes in 1.0.7 (20 Jan 1998)
-- fix gzseek which was broken in write mode
-- return error for gzseek to negative absolute position
-- fix configure for Linux (Chun-Chung Chen)
-- increase stack space for MSC (Tim Wegner)
-- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
-- define EXPORTVA for gzprintf (Gilles Vollant)
-- added man page zlib.3 (Rick Rodgers)
-- for contrib/untgz, fix makedir() and improve Makefile
-
-- check gzseek in write mode in example.c
-- allocate extra buffer for seeks only if gzseek is actually called
-- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
-- add inflateSyncPoint in zconf.h
-- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
-
-Changes in 1.0.6 (19 Jan 1998)
-- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
- gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
-- Fix a deflate bug occurring only with compression level 0 (thanks to
- Andy Buckler for finding this one).
-- In minigzip, pass transparently also the first byte for .Z files.
-- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
-- check Z_FINISH in inflate (thanks to Marc Schluper)
-- Implement deflateCopy (thanks to Adam Costello)
-- make static libraries by default in configure, add --shared option.
-- move MSDOS or Windows specific files to directory msdos
-- suppress the notion of partial flush to simplify the interface
- (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
-- suppress history buffer provided by application to simplify the interface
- (this feature was not implemented anyway in 1.0.4)
-- next_in and avail_in must be initialized before calling inflateInit or
- inflateInit2
-- add EXPORT in all exported functions (for Windows DLL)
-- added Makefile.nt (thanks to Stephen Williams)
-- added the unsupported "contrib" directory:
- contrib/asm386/ by Gilles Vollant <info@winimage.com>
- 386 asm code replacing longest_match().
- contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
- A C++ I/O streams interface to the zlib gz* functions
- contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
- Another C++ I/O streams interface
- contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
- A very simple tar.gz file extractor using zlib
- contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
- How to use compress(), uncompress() and the gz* functions from VB.
-- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
- level) in minigzip (thanks to Tom Lane)
-
-- use const for rommable constants in deflate
-- added test for gzseek and gztell in example.c
-- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
-- add undocumented function zError to convert error code to string
- (for Tim Smithers)
-- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
-- Use default memcpy for Symantec MSDOS compiler.
-- Add EXPORT keyword for check_func (needed for Windows DLL)
-- add current directory to LD_LIBRARY_PATH for "make test"
-- create also a link for libz.so.1
-- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
-- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
-- added -soname for Linux in configure (Chun-Chung Chen,
-- assign numbers to the exported functions in zlib.def (for Windows DLL)
-- add advice in zlib.h for best usage of deflateSetDictionary
-- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
-- allow compilation with ANSI keywords only enabled for TurboC in large model
-- avoid "versionString"[0] (Borland bug)
-- add NEED_DUMMY_RETURN for Borland
-- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
-- allow compilation with CC
-- defined STDC for OS/2 (David Charlap)
-- limit external names to 8 chars for MVS (Thomas Lund)
-- in minigzip.c, use static buffers only for 16-bit systems
-- fix suffix check for "minigzip -d foo.gz"
-- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
-- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
-- added makelcc.bat for lcc-win32 (Tom St Denis)
-- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
-- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
-- check for unistd.h in configure (for off_t)
-- remove useless check parameter in inflate_blocks_free
-- avoid useless assignment of s->check to itself in inflate_blocks_new
-- do not flush twice in gzclose (thanks to Ken Raeburn)
-- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
-- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
-- work around buggy fclose on pipes for HP/UX
-- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
-- fix configure if CC is already equal to gcc
-
-Changes in 1.0.5 (3 Jan 98)
-- Fix inflate to terminate gracefully when fed corrupted or invalid data
-- Use const for rommable constants in inflate
-- Eliminate memory leaks on error conditions in inflate
-- Removed some vestigial code in inflate
-- Update web address in README
-
-Changes in 1.0.4 (24 Jul 96)
-- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
- bit, so the decompressor could decompress all the correct data but went
- on to attempt decompressing extra garbage data. This affected minigzip too.
-- zlibVersion and gzerror return const char* (needed for DLL)
-- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
-- use z_error only for DEBUG (avoid problem with DLLs)
-
-Changes in 1.0.3 (2 Jul 96)
-- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
- small and medium models; this makes the library incompatible with previous
- versions for these models. (No effect in large model or on other systems.)
-- return OK instead of BUF_ERROR if previous deflate call returned with
- avail_out as zero but there is nothing to do
-- added memcmp for non STDC compilers
-- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
-- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
-- better check for 16-bit mode MSC (avoids problem with Symantec)
-
-Changes in 1.0.2 (23 May 96)
-- added Windows DLL support
-- added a function zlibVersion (for the DLL support)
-- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
-- Bytef is define's instead of typedef'd only for Borland C
-- avoid reading uninitialized memory in example.c
-- mention in README that the zlib format is now RFC1950
-- updated Makefile.dj2
-- added algorithm.doc
-
-Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
-- fix array overlay in deflate.c which sometimes caused bad compressed data
-- fix inflate bug with empty stored block
-- fix MSDOS medium model which was broken in 0.99
-- fix deflateParams() which could generated bad compressed data.
-- Bytef is define'd instead of typedef'ed (work around Borland bug)
-- added an INDEX file
-- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
- Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
-- speed up adler32 for modern machines without auto-increment
-- added -ansi for IRIX in configure
-- static_init_done in trees.c is an int
-- define unlink as delete for VMS
-- fix configure for QNX
-- add configure branch for SCO and HPUX
-- avoid many warnings (unused variables, dead assignments, etc...)
-- no fdopen for BeOS
-- fix the Watcom fix for 32 bit mode (define FAR as empty)
-- removed redefinition of Byte for MKWERKS
-- work around an MWKERKS bug (incorrect merge of all .h files)
-
-Changes in 0.99 (27 Jan 96)
-- allow preset dictionary shared between compressor and decompressor
-- allow compression level 0 (no compression)
-- add deflateParams in zlib.h: allow dynamic change of compression level
- and compression strategy.
-- test large buffers and deflateParams in example.c
-- add optional "configure" to build zlib as a shared library
-- suppress Makefile.qnx, use configure instead
-- fixed deflate for 64-bit systems (detected on Cray)
-- fixed inflate_blocks for 64-bit systems (detected on Alpha)
-- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
-- always return Z_BUF_ERROR when deflate() has nothing to do
-- deflateInit and inflateInit are now macros to allow version checking
-- prefix all global functions and types with z_ with -DZ_PREFIX
-- make falloc completely reentrant (inftrees.c)
-- fixed very unlikely race condition in ct_static_init
-- free in reverse order of allocation to help memory manager
-- use zlib-1.0/* instead of zlib/* inside the tar.gz
-- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
- -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
-- allow gzread on concatenated .gz files
-- deflateEnd now returns Z_DATA_ERROR if it was premature
-- deflate is finally (?) fully deterministic (no matches beyond end of input)
-- Document Z_SYNC_FLUSH
-- add uninstall in Makefile
-- Check for __cpluplus in zlib.h
-- Better test in ct_align for partial flush
-- avoid harmless warnings for Borland C++
-- initialize hash_head in deflate.c
-- avoid warning on fdopen (gzio.c) for HP cc -Aa
-- include stdlib.h for STDC compilers
-- include errno.h for Cray
-- ignore error if ranlib doesn't exist
-- call ranlib twice for NeXTSTEP
-- use exec_prefix instead of prefix for libz.a
-- renamed ct_* as _tr_* to avoid conflict with applications
-- clear z->msg in inflateInit2 before any error return
-- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
-- fixed typo in zconf.h (_GNUC__ => __GNUC__)
-- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
-- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
-- in fcalloc, normalize pointer if size > 65520 bytes
-- don't use special fcalloc for 32 bit Borland C++
-- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
-- use Z_BINARY instead of BINARY
-- document that gzclose after gzdopen will close the file
-- allow "a" as mode in gzopen.
-- fix error checking in gzread
-- allow skipping .gz extra-field on pipes
-- added reference to Perl interface in README
-- put the crc table in FAR data (I dislike more and more the medium model :)
-- added get_crc_table
-- added a dimension to all arrays (Borland C can't count).
-- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
-- guard against multiple inclusion of *.h (for precompiled header on Mac)
-- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
-- don't use unsized arrays to avoid silly warnings by Visual C++:
- warning C4746: 'inflate_mask' : unsized array treated as '__far'
- (what's wrong with far data in far model?).
-- define enum out of inflate_blocks_state to allow compilation with C++
-
-Changes in 0.95 (16 Aug 95)
-- fix MSDOS small and medium model (now easier to adapt to any compiler)
-- inlined send_bits
-- fix the final (:-) bug for deflate with flush (output was correct but
- not completely flushed in rare occasions).
-- default window size is same for compression and decompression
- (it's now sufficient to set MAX_WBITS in zconf.h).
-- voidp -> voidpf and voidnp -> voidp (for consistency with other
- typedefs and because voidnp was not near in large model).
-
-Changes in 0.94 (13 Aug 95)
-- support MSDOS medium model
-- fix deflate with flush (could sometimes generate bad output)
-- fix deflateReset (zlib header was incorrectly suppressed)
-- added support for VMS
-- allow a compression level in gzopen()
-- gzflush now calls fflush
-- For deflate with flush, flush even if no more input is provided.
-- rename libgz.a as libz.a
-- avoid complex expression in infcodes.c triggering Turbo C bug
-- work around a problem with gcc on Alpha (in INSERT_STRING)
-- don't use inline functions (problem with some gcc versions)
-- allow renaming of Byte, uInt, etc... with #define.
-- avoid warning about (unused) pointer before start of array in deflate.c
-- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
-- avoid reserved word 'new' in trees.c
-
-Changes in 0.93 (25 June 95)
-- temporarily disable inline functions
-- make deflate deterministic
-- give enough lookahead for PARTIAL_FLUSH
-- Set binary mode for stdin/stdout in minigzip.c for OS/2
-- don't even use signed char in inflate (not portable enough)
-- fix inflate memory leak for segmented architectures
-
-Changes in 0.92 (3 May 95)
-- don't assume that char is signed (problem on SGI)
-- Clear bit buffer when starting a stored block
-- no memcpy on Pyramid
-- suppressed inftest.c
-- optimized fill_window, put longest_match inline for gcc
-- optimized inflate on stored blocks.
-- untabify all sources to simplify patches
-
-Changes in 0.91 (2 May 95)
-- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
-- Document the memory requirements in zconf.h
-- added "make install"
-- fix sync search logic in inflateSync
-- deflate(Z_FULL_FLUSH) now works even if output buffer too short
-- after inflateSync, don't scare people with just "lo world"
-- added support for DJGPP
-
-Changes in 0.9 (1 May 95)
-- don't assume that zalloc clears the allocated memory (the TurboC bug
- was Mark's bug after all :)
-- let again gzread copy uncompressed data unchanged (was working in 0.71)
-- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
-- added a test of inflateSync in example.c
-- moved MAX_WBITS to zconf.h because users might want to change that.
-- document explicitly that zalloc(64K) on MSDOS must return a normalized
- pointer (zero offset)
-- added Makefiles for Microsoft C, Turbo C, Borland C++
-- faster crc32()
-
-Changes in 0.8 (29 April 95)
-- added fast inflate (inffast.c)
-- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
- is incompatible with previous versions of zlib which returned Z_OK.
-- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
- (actually that was not a compiler bug, see 0.81 above)
-- gzread no longer reads one extra byte in certain cases
-- In gzio destroy(), don't reference a freed structure
-- avoid many warnings for MSDOS
-- avoid the ERROR symbol which is used by MS Windows
-
-Changes in 0.71 (14 April 95)
-- Fixed more MSDOS compilation problems :( There is still a bug with
- TurboC large model.
-
-Changes in 0.7 (14 April 95)
-- Added full inflate support.
-- Simplified the crc32() interface. The pre- and post-conditioning
- (one's complement) is now done inside crc32(). WARNING: this is
- incompatible with previous versions; see zlib.h for the new usage.
-
-Changes in 0.61 (12 April 95)
-- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
-
-Changes in 0.6 (11 April 95)
-- added minigzip.c
-- added gzdopen to reopen a file descriptor as gzFile
-- added transparent reading of non-gziped files in gzread.
-- fixed bug in gzread (don't read crc as data)
-- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
-- don't allocate big arrays in the stack (for MSDOS)
-- fix some MSDOS compilation problems
-
-Changes in 0.5:
-- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
- not yet Z_FULL_FLUSH.
-- support decompression but only in a single step (forced Z_FINISH)
-- added opaque object for zalloc and zfree.
-- added deflateReset and inflateReset
-- added a variable zlib_version for consistency checking.
-- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
- Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
-
-Changes in 0.4:
-- avoid "zip" everywhere, use zlib instead of ziplib.
-- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
- if compression method == 8.
-- added adler32 and crc32
-- renamed deflateOptions as deflateInit2, call one or the other but not both
-- added the method parameter for deflateInit2.
-- added inflateInit2
-- simplied considerably deflateInit and inflateInit by not supporting
- user-provided history buffer. This is supported only in deflateInit2
- and inflateInit2.
-
-Changes in 0.3:
-- prefix all macro names with Z_
-- use Z_FINISH instead of deflateEnd to finish compression.
-- added Z_HUFFMAN_ONLY
-- added gzerror()
diff --git a/funtools/util/zlib-1.2.3/FAQ b/funtools/util/zlib-1.2.3/FAQ
deleted file mode 100644
index 441d910..0000000
--- a/funtools/util/zlib-1.2.3/FAQ
+++ /dev/null
@@ -1,339 +0,0 @@
-
- Frequently Asked Questions about zlib
-
-
-If your question is not there, please check the zlib home page
-http://www.zlib.org which may have more recent information.
-The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
-
-
- 1. Is zlib Y2K-compliant?
-
- Yes. zlib doesn't handle dates.
-
- 2. Where can I get a Windows DLL version?
-
- The zlib sources can be compiled without change to produce a DLL.
- See the file win32/DLL_FAQ.txt in the zlib distribution.
- Pointers to the precompiled DLL are found in the zlib web site at
- http://www.zlib.org.
-
- 3. Where can I get a Visual Basic interface to zlib?
-
- See
- * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
- * contrib/visual-basic.txt in the zlib distribution
- * win32/DLL_FAQ.txt in the zlib distribution
-
- 4. compress() returns Z_BUF_ERROR.
-
- Make sure that before the call of compress, the length of the compressed
- buffer is equal to the total size of the compressed buffer and not
- zero. For Visual Basic, check that this parameter is passed by reference
- ("as any"), not by value ("as long").
-
- 5. deflate() or inflate() returns Z_BUF_ERROR.
-
- Before making the call, make sure that avail_in and avail_out are not
- zero. When setting the parameter flush equal to Z_FINISH, also make sure
- that avail_out is big enough to allow processing all pending input.
- Note that a Z_BUF_ERROR is not fatal--another call to deflate() or
- inflate() can be made with more input or output space. A Z_BUF_ERROR
- may in fact be unavoidable depending on how the functions are used, since
- it is not possible to tell whether or not there is more output pending
- when strm.avail_out returns with zero.
-
- 6. Where's the zlib documentation (man pages, etc.)?
-
- It's in zlib.h for the moment, and Francis S. Lin has converted it to a
- web page zlib.html. Volunteers to transform this to Unix-style man pages,
- please contact us (zlib@gzip.org). Examples of zlib usage are in the files
- example.c and minigzip.c.
-
- 7. Why don't you use GNU autoconf or libtool or ...?
-
- Because we would like to keep zlib as a very small and simple
- package. zlib is rather portable and doesn't need much configuration.
-
- 8. I found a bug in zlib.
-
- Most of the time, such problems are due to an incorrect usage of
- zlib. Please try to reproduce the problem with a small program and send
- the corresponding source to us at zlib@gzip.org . Do not send
- multi-megabyte data files without prior agreement.
-
- 9. Why do I get "undefined reference to gzputc"?
-
- If "make test" produces something like
-
- example.o(.text+0x154): undefined reference to `gzputc'
-
- check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
- /usr/X11R6/lib. Remove any old versions, then do "make install".
-
-10. I need a Delphi interface to zlib.
-
- See the contrib/delphi directory in the zlib distribution.
-
-11. Can zlib handle .zip archives?
-
- Not by itself, no. See the directory contrib/minizip in the zlib
- distribution.
-
-12. Can zlib handle .Z files?
-
- No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
- the code of uncompress on your own.
-
-13. How can I make a Unix shared library?
-
- make clean
- ./configure -s
- make
-
-14. How do I install a shared zlib library on Unix?
-
- After the above, then:
-
- make install
-
- However, many flavors of Unix come with a shared zlib already installed.
- Before going to the trouble of compiling a shared version of zlib and
- trying to install it, you may want to check if it's already there! If you
- can #include <zlib.h>, it's there. The -lz option will probably link to it.
-
-15. I have a question about OttoPDF.
-
- We are not the authors of OttoPDF. The real author is on the OttoPDF web
- site: Joel Hainley, jhainley@myndkryme.com.
-
-16. Can zlib decode Flate data in an Adobe PDF file?
-
- Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ .
- To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ .
-
-17. Why am I getting this "register_frame_info not found" error on Solaris?
-
- After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
- generates an error such as:
-
- ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
- symbol __register_frame_info: referenced symbol not found
-
- The symbol __register_frame_info is not part of zlib, it is generated by
- the C compiler (cc or gcc). You must recompile applications using zlib
- which have this problem. This problem is specific to Solaris. See
- http://www.sunfreeware.com for Solaris versions of zlib and applications
- using zlib.
-
-18. Why does gzip give an error on a file I make with compress/deflate?
-
- The compress and deflate functions produce data in the zlib format, which
- is different and incompatible with the gzip format. The gz* functions in
- zlib on the other hand use the gzip format. Both the zlib and gzip
- formats use the same compressed data format internally, but have different
- headers and trailers around the compressed data.
-
-19. Ok, so why are there two different formats?
-
- The gzip format was designed to retain the directory information about
- a single file, such as the name and last modification date. The zlib
- format on the other hand was designed for in-memory and communication
- channel applications, and has a much more compact header and trailer and
- uses a faster integrity check than gzip.
-
-20. Well that's nice, but how do I make a gzip file in memory?
-
- You can request that deflate write the gzip format instead of the zlib
- format using deflateInit2(). You can also request that inflate decode
- the gzip format using inflateInit2(). Read zlib.h for more details.
-
-21. Is zlib thread-safe?
-
- Yes. However any library routines that zlib uses and any application-
- provided memory allocation routines must also be thread-safe. zlib's gz*
- functions use stdio library routines, and most of zlib's functions use the
- library memory allocation routines by default. zlib's Init functions allow
- for the application to provide custom memory allocation routines.
-
- Of course, you should only operate on any given zlib or gzip stream from a
- single thread at a time.
-
-22. Can I use zlib in my commercial application?
-
- Yes. Please read the license in zlib.h.
-
-23. Is zlib under the GNU license?
-
- No. Please read the license in zlib.h.
-
-24. The license says that altered source versions must be "plainly marked". So
- what exactly do I need to do to meet that requirement?
-
- You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
- particular, the final version number needs to be changed to "f", and an
- identification string should be appended to ZLIB_VERSION. Version numbers
- x.x.x.f are reserved for modifications to zlib by others than the zlib
- maintainers. For example, if the version of the base zlib you are altering
- is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
- ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
- update the version strings in deflate.c and inftrees.c.
-
- For altered source distributions, you should also note the origin and
- nature of the changes in zlib.h, as well as in ChangeLog and README, along
- with the dates of the alterations. The origin should include at least your
- name (or your company's name), and an email address to contact for help or
- issues with the library.
-
- Note that distributing a compiled zlib library along with zlib.h and
- zconf.h is also a source distribution, and so you should change
- ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
- in zlib.h as you would for a full source distribution.
-
-25. Will zlib work on a big-endian or little-endian architecture, and can I
- exchange compressed data between them?
-
- Yes and yes.
-
-26. Will zlib work on a 64-bit machine?
-
- It should. It has been tested on 64-bit machines, and has no dependence
- on any data types being limited to 32-bits in length. If you have any
- difficulties, please provide a complete problem report to zlib@gzip.org
-
-27. Will zlib decompress data from the PKWare Data Compression Library?
-
- No. The PKWare DCL uses a completely different compressed data format
- than does PKZIP and zlib. However, you can look in zlib's contrib/blast
- directory for a possible solution to your problem.
-
-28. Can I access data randomly in a compressed stream?
-
- No, not without some preparation. If when compressing you periodically
- use Z_FULL_FLUSH, carefully write all the pending data at those points,
- and keep an index of those locations, then you can start decompression
- at those points. You have to be careful to not use Z_FULL_FLUSH too
- often, since it can significantly degrade compression.
-
-29. Does zlib work on MVS, OS/390, CICS, etc.?
-
- We don't know for sure. We have heard occasional reports of success on
- these systems. If you do use it on one of these, please provide us with
- a report, instructions, and patches that we can reference when we get
- these questions. Thanks.
-
-30. Is there some simpler, easier to read version of inflate I can look at
- to understand the deflate format?
-
- First off, you should read RFC 1951. Second, yes. Look in zlib's
- contrib/puff directory.
-
-31. Does zlib infringe on any patents?
-
- As far as we know, no. In fact, that was originally the whole point behind
- zlib. Look here for some more information:
-
- http://www.gzip.org/#faq11
-
-32. Can zlib work with greater than 4 GB of data?
-
- Yes. inflate() and deflate() will process any amount of data correctly.
- Each call of inflate() or deflate() is limited to input and output chunks
- of the maximum value that can be stored in the compiler's "unsigned int"
- type, but there is no limit to the number of chunks. Note however that the
- strm.total_in and strm_total_out counters may be limited to 4 GB. These
- counters are provided as a convenience and are not used internally by
- inflate() or deflate(). The application can easily set up its own counters
- updated after each call of inflate() or deflate() to count beyond 4 GB.
- compress() and uncompress() may be limited to 4 GB, since they operate in a
- single call. gzseek() and gztell() may be limited to 4 GB depending on how
- zlib is compiled. See the zlibCompileFlags() function in zlib.h.
-
- The word "may" appears several times above since there is a 4 GB limit
- only if the compiler's "long" type is 32 bits. If the compiler's "long"
- type is 64 bits, then the limit is 16 exabytes.
-
-33. Does zlib have any security vulnerabilities?
-
- The only one that we are aware of is potentially in gzprintf(). If zlib
- is compiled to use sprintf() or vsprintf(), then there is no protection
- against a buffer overflow of a 4K string space, other than the caller of
- gzprintf() assuring that the output will not exceed 4K. On the other
- hand, if zlib is compiled to use snprintf() or vsnprintf(), which should
- normally be the case, then there is no vulnerability. The ./configure
- script will display warnings if an insecure variation of sprintf() will
- be used by gzprintf(). Also the zlibCompileFlags() function will return
- information on what variant of sprintf() is used by gzprintf().
-
- If you don't have snprintf() or vsnprintf() and would like one, you can
- find a portable implementation here:
-
- http://www.ijs.si/software/snprintf/
-
- Note that you should be using the most recent version of zlib. Versions
- 1.1.3 and before were subject to a double-free vulnerability.
-
-34. Is there a Java version of zlib?
-
- Probably what you want is to use zlib in Java. zlib is already included
- as part of the Java SDK in the java.util.zip package. If you really want
- a version of zlib written in the Java language, look on the zlib home
- page for links: http://www.zlib.org/
-
-35. I get this or that compiler or source-code scanner warning when I crank it
- up to maximally-pedantic. Can't you guys write proper code?
-
- Many years ago, we gave up attempting to avoid warnings on every compiler
- in the universe. It just got to be a waste of time, and some compilers
- were downright silly. So now, we simply make sure that the code always
- works.
-
-36. Valgrind (or some similar memory access checker) says that deflate is
- performing a conditional jump that depends on an uninitialized value.
- Isn't that a bug?
-
- No. That is intentional for performance reasons, and the output of
- deflate is not affected. This only started showing up recently since
- zlib 1.2.x uses malloc() by default for allocations, whereas earlier
- versions used calloc(), which zeros out the allocated memory.
-
-37. Will zlib read the (insert any ancient or arcane format here) compressed
- data format?
-
- Probably not. Look in the comp.compression FAQ for pointers to various
- formats and associated software.
-
-38. How can I encrypt/decrypt zip files with zlib?
-
- zlib doesn't support encryption. The original PKZIP encryption is very weak
- and can be broken with freely available programs. To get strong encryption,
- use GnuPG, http://www.gnupg.org/ , which already includes zlib compression.
- For PKZIP compatible "encryption", look at http://www.info-zip.org/
-
-39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
-
- "gzip" is the gzip format, and "deflate" is the zlib format. They should
- probably have called the second one "zlib" instead to avoid confusion
- with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
- correctly points to the zlib specification in RFC 1950 for the "deflate"
- transfer encoding, there have been reports of servers and browsers that
- incorrectly produce or expect raw deflate data per the deflate
- specficiation in RFC 1951, most notably Microsoft. So even though the
- "deflate" transfer encoding using the zlib format would be the more
- efficient approach (and in fact exactly what the zlib format was designed
- for), using the "gzip" transfer encoding is probably more reliable due to
- an unfortunate choice of name on the part of the HTTP 1.1 authors.
-
- Bottom line: use the gzip format for HTTP 1.1 encoding.
-
-40. Does zlib support the new "Deflate64" format introduced by PKWare?
-
- No. PKWare has apparently decided to keep that format proprietary, since
- they have not documented it as they have previous compression formats.
- In any case, the compression improvements are so modest compared to other
- more modern approaches, that it's not worth the effort to implement.
-
-41. Can you please sign these lengthy legal documents and fax them back to us
- so that we can use your software in our product?
-
- No. Go away. Shoo.
diff --git a/funtools/util/zlib-1.2.3/INDEX b/funtools/util/zlib-1.2.3/INDEX
deleted file mode 100644
index 0587e59..0000000
--- a/funtools/util/zlib-1.2.3/INDEX
+++ /dev/null
@@ -1,51 +0,0 @@
-ChangeLog history of changes
-FAQ Frequently Asked Questions about zlib
-INDEX this file
-Makefile makefile for Unix (generated by configure)
-Makefile.in makefile for Unix (template for configure)
-README guess what
-algorithm.txt description of the (de)compression algorithm
-configure configure script for Unix
-zconf.in.h template for zconf.h (used by configure)
-
-amiga/ makefiles for Amiga SAS C
-as400/ makefiles for IBM AS/400
-msdos/ makefiles for MSDOS
-old/ makefiles for various architectures and zlib documentation
- files that have not yet been updated for zlib 1.2.x
-projects/ projects for various Integrated Development Environments
-qnx/ makefiles for QNX
-win32/ makefiles for Windows
-
- zlib public header files (must be kept):
-zconf.h
-zlib.h
-
- private source files used to build the zlib library:
-adler32.c
-compress.c
-crc32.c
-crc32.h
-deflate.c
-deflate.h
-gzio.c
-infback.c
-inffast.c
-inffast.h
-inffixed.h
-inflate.c
-inflate.h
-inftrees.c
-inftrees.h
-trees.c
-trees.h
-uncompr.c
-zutil.c
-zutil.h
-
- source files for sample programs:
-example.c
-minigzip.c
-
- unsupported contribution by third parties
-See contrib/README.contrib
diff --git a/funtools/util/zlib-1.2.3/Makefile b/funtools/util/zlib-1.2.3/Makefile
deleted file mode 100644
index 2fd6e45..0000000
--- a/funtools/util/zlib-1.2.3/Makefile
+++ /dev/null
@@ -1,154 +0,0 @@
-# Makefile for zlib
-# Copyright (C) 1995-2005 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile and test, type:
-# ./configure; make test
-# The call of configure is optional if you don't have special requirements
-# If you wish to build zlib as a shared library, use: ./configure -s
-
-# To use the asm code, type:
-# cp contrib/asm?86/match.S ./match.S
-# make LOC=-DASMV OBJA=match.o
-
-# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
-# make install
-# To install in $HOME instead of /usr/local, use:
-# make install prefix=$HOME
-
-CC=cc
-
-CFLAGS=-O
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-g -DDEBUG
-#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
-# -Wstrict-prototypes -Wmissing-prototypes
-
-LDFLAGS=libz.a
-LDSHARED=$(CC)
-CPP=$(CC) -E
-
-LIBS=libz.a
-SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.3
-SHAREDLIBM=libz.so.1
-
-AR=ar rc
-RANLIB=ranlib
-TAR=tar
-SHELL=/bin/sh
-EXE=
-
-prefix = /usr/local
-exec_prefix = ${prefix}
-libdir = ${exec_prefix}/lib
-includedir = ${prefix}/include
-mandir = ${prefix}/share/man
-man3dir = ${mandir}/man3
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-OBJA =
-# to use the asm code: make OBJA=match.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example$(EXE) minigzip$(EXE)
-
-check: test
-test: all
- @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
- echo hello world | ./minigzip | ./minigzip -d || \
- echo ' *** minigzip test FAILED ***' ; \
- if ./example; then \
- echo ' *** zlib test OK ***'; \
- else \
- echo ' *** zlib test FAILED ***'; \
- fi
-
-libz.a: $(OBJS) $(OBJA)
- $(AR) $@ $(OBJS) $(OBJA)
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-
-match.o: match.S
- $(CPP) match.S > _match.s
- $(CC) -c _match.s
- mv _match.o match.o
- rm -f _match.s
-
-$(SHAREDLIBV): $(OBJS)
- $(LDSHARED) -o $@ $(OBJS)
- rm -f $(SHAREDLIB) $(SHAREDLIBM)
- ln -s $@ $(SHAREDLIB)
- ln -s $@ $(SHAREDLIBM)
-
-example$(EXE): example.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
-
-minigzip$(EXE): minigzip.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
-
-install: $(LIBS)
- -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
- -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
- -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
- cp zlib.h zconf.h $(includedir)
- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
- cp $(LIBS) $(libdir)
- cd $(libdir); chmod 755 $(LIBS)
- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
- cd $(libdir); if test -f $(SHAREDLIBV); then \
- rm -f $(SHAREDLIB) $(SHAREDLIBM); \
- ln -s $(SHAREDLIBV) $(SHAREDLIB); \
- ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
- (ldconfig || true) >/dev/null 2>&1; \
- fi
- cp zlib.3 $(man3dir)
- chmod 644 $(man3dir)/zlib.3
-# The ranlib in install is needed on NeXTSTEP which checks file times
-# ldconfig is for Linux
-
-uninstall:
- cd $(includedir); \
- cd $(libdir); rm -f libz.a; \
- if test -f $(SHAREDLIBV); then \
- rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
- fi
- cd $(man3dir); rm -f zlib.3
-
-mostlyclean: clean
-clean:
- rm -f *.o *~ example$(EXE) minigzip$(EXE) \
- libz.* foo.gz so_locations \
- _match.s maketree contrib/infback9/*.o
-
-maintainer-clean: distclean
-distclean: clean
- cp -p Makefile.in Makefile
- cp -p zconf.in.h zconf.h
- rm -f .DS_Store
-
-tags:
- etags *.[ch]
-
-depend:
- makedepend -- $(CFLAGS) -- *.[ch]
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/Makefile.in b/funtools/util/zlib-1.2.3/Makefile.in
deleted file mode 100644
index 2fd6e45..0000000
--- a/funtools/util/zlib-1.2.3/Makefile.in
+++ /dev/null
@@ -1,154 +0,0 @@
-# Makefile for zlib
-# Copyright (C) 1995-2005 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile and test, type:
-# ./configure; make test
-# The call of configure is optional if you don't have special requirements
-# If you wish to build zlib as a shared library, use: ./configure -s
-
-# To use the asm code, type:
-# cp contrib/asm?86/match.S ./match.S
-# make LOC=-DASMV OBJA=match.o
-
-# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
-# make install
-# To install in $HOME instead of /usr/local, use:
-# make install prefix=$HOME
-
-CC=cc
-
-CFLAGS=-O
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-g -DDEBUG
-#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
-# -Wstrict-prototypes -Wmissing-prototypes
-
-LDFLAGS=libz.a
-LDSHARED=$(CC)
-CPP=$(CC) -E
-
-LIBS=libz.a
-SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.3
-SHAREDLIBM=libz.so.1
-
-AR=ar rc
-RANLIB=ranlib
-TAR=tar
-SHELL=/bin/sh
-EXE=
-
-prefix = /usr/local
-exec_prefix = ${prefix}
-libdir = ${exec_prefix}/lib
-includedir = ${prefix}/include
-mandir = ${prefix}/share/man
-man3dir = ${mandir}/man3
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-OBJA =
-# to use the asm code: make OBJA=match.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example$(EXE) minigzip$(EXE)
-
-check: test
-test: all
- @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
- echo hello world | ./minigzip | ./minigzip -d || \
- echo ' *** minigzip test FAILED ***' ; \
- if ./example; then \
- echo ' *** zlib test OK ***'; \
- else \
- echo ' *** zlib test FAILED ***'; \
- fi
-
-libz.a: $(OBJS) $(OBJA)
- $(AR) $@ $(OBJS) $(OBJA)
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-
-match.o: match.S
- $(CPP) match.S > _match.s
- $(CC) -c _match.s
- mv _match.o match.o
- rm -f _match.s
-
-$(SHAREDLIBV): $(OBJS)
- $(LDSHARED) -o $@ $(OBJS)
- rm -f $(SHAREDLIB) $(SHAREDLIBM)
- ln -s $@ $(SHAREDLIB)
- ln -s $@ $(SHAREDLIBM)
-
-example$(EXE): example.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
-
-minigzip$(EXE): minigzip.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
-
-install: $(LIBS)
- -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
- -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
- -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
- cp zlib.h zconf.h $(includedir)
- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
- cp $(LIBS) $(libdir)
- cd $(libdir); chmod 755 $(LIBS)
- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
- cd $(libdir); if test -f $(SHAREDLIBV); then \
- rm -f $(SHAREDLIB) $(SHAREDLIBM); \
- ln -s $(SHAREDLIBV) $(SHAREDLIB); \
- ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
- (ldconfig || true) >/dev/null 2>&1; \
- fi
- cp zlib.3 $(man3dir)
- chmod 644 $(man3dir)/zlib.3
-# The ranlib in install is needed on NeXTSTEP which checks file times
-# ldconfig is for Linux
-
-uninstall:
- cd $(includedir); \
- cd $(libdir); rm -f libz.a; \
- if test -f $(SHAREDLIBV); then \
- rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
- fi
- cd $(man3dir); rm -f zlib.3
-
-mostlyclean: clean
-clean:
- rm -f *.o *~ example$(EXE) minigzip$(EXE) \
- libz.* foo.gz so_locations \
- _match.s maketree contrib/infback9/*.o
-
-maintainer-clean: distclean
-distclean: clean
- cp -p Makefile.in Makefile
- cp -p zconf.in.h zconf.h
- rm -f .DS_Store
-
-tags:
- etags *.[ch]
-
-depend:
- makedepend -- $(CFLAGS) -- *.[ch]
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/README b/funtools/util/zlib-1.2.3/README
deleted file mode 100644
index 758cc50..0000000
--- a/funtools/util/zlib-1.2.3/README
+++ /dev/null
@@ -1,125 +0,0 @@
-ZLIB DATA COMPRESSION LIBRARY
-
-zlib 1.2.3 is a general purpose data compression library. All the code is
-thread safe. The data format used by the zlib library is described by RFCs
-(Request for Comments) 1950 to 1952 in the files
-http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
-and rfc1952.txt (gzip format). These documents are also available in other
-formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
-
-All functions of the compression library are documented in the file zlib.h
-(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
-of the library is given in the file example.c which also tests that the library
-is working correctly. Another example is given in the file minigzip.c. The
-compression library itself is composed of all source files except example.c and
-minigzip.c.
-
-To compile all files and run the test program, follow the instructions given at
-the top of Makefile. In short "make test; make install" should work for most
-machines. For Unix: "./configure; make test; make install". For MSDOS, use one
-of the special makefiles such as Makefile.msc. For VMS, use make_vms.com.
-
-Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
-<info@winimage.com> for the Windows DLL version. The zlib home page is
-http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
-please check this site to verify that you have the latest version of zlib;
-otherwise get the latest version and check whether the problem still exists or
-not.
-
-PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
-for help.
-
-Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
-issue of Dr. Dobb's Journal; a copy of the article is available in
-http://dogma.net/markn/articles/zlibtool/zlibtool.htm
-
-The changes made in version 1.2.3 are documented in the file ChangeLog.
-
-Unsupported third party contributions are provided in directory "contrib".
-
-A Java implementation of zlib is available in the Java Development Kit
-http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
-See the zlib home page http://www.zlib.org for details.
-
-A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
-CPAN (Comprehensive Perl Archive Network) sites
-http://www.cpan.org/modules/by-module/Compress/
-
-A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
-available in Python 1.5 and later versions, see
-http://www.python.org/doc/lib/module-zlib.html
-
-A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
-availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
-
-An experimental package to read and write files in .zip format, written on top
-of zlib by Gilles Vollant <info@winimage.com>, is available in the
-contrib/minizip directory of zlib.
-
-
-Notes for some targets:
-
-- For Windows DLL versions, please see win32/DLL_FAQ.txt
-
-- For 64-bit Irix, deflate.c must be compiled without any optimization. With
- -O, one libpng test fails. The test works in 32 bit mode (with the -n32
- compiler flag). The compiler bug has been reported to SGI.
-
-- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
- when compiled with cc.
-
-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
- necessary to get gzprintf working correctly. This is done by configure.
-
-- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
- other compilers. Use "make test" to check your compiler.
-
-- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
-
-- For PalmOs, see http://palmzlib.sourceforge.net/
-
-- When building a shared, i.e. dynamic library on Mac OS X, the library must be
- installed before testing (do "make install" before "make test"), since the
- library location is specified in the library.
-
-
-Acknowledgments:
-
- The deflate format used by zlib was defined by Phil Katz. The deflate
- and zlib specifications were written by L. Peter Deutsch. Thanks to all the
- people who reported problems and suggested various improvements in zlib;
- they are too numerous to cite here.
-
-Copyright notice:
-
- (C) 1995-2004 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-If you use the zlib library in a product, we would appreciate *not*
-receiving lengthy legal documents to sign. The sources are provided
-for free but without warranty of any kind. The library has been
-entirely written by Jean-loup Gailly and Mark Adler; it does not
-include third-party code.
-
-If you redistribute modified sources, we would appreciate that you include
-in the file ChangeLog history information documenting your changes. Please
-read the FAQ for more information on the distribution of modified source
-versions.
diff --git a/funtools/util/zlib-1.2.3/adler32.c b/funtools/util/zlib-1.2.3/adler32.c
deleted file mode 100644
index 007ba26..0000000
--- a/funtools/util/zlib-1.2.3/adler32.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-#define BASE 65521UL /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
-
-/* use NO_DIVIDE if your processor does not do division in hardware */
-#ifdef NO_DIVIDE
-# define MOD(a) \
- do { \
- if (a >= (BASE << 16)) a -= (BASE << 16); \
- if (a >= (BASE << 15)) a -= (BASE << 15); \
- if (a >= (BASE << 14)) a -= (BASE << 14); \
- if (a >= (BASE << 13)) a -= (BASE << 13); \
- if (a >= (BASE << 12)) a -= (BASE << 12); \
- if (a >= (BASE << 11)) a -= (BASE << 11); \
- if (a >= (BASE << 10)) a -= (BASE << 10); \
- if (a >= (BASE << 9)) a -= (BASE << 9); \
- if (a >= (BASE << 8)) a -= (BASE << 8); \
- if (a >= (BASE << 7)) a -= (BASE << 7); \
- if (a >= (BASE << 6)) a -= (BASE << 6); \
- if (a >= (BASE << 5)) a -= (BASE << 5); \
- if (a >= (BASE << 4)) a -= (BASE << 4); \
- if (a >= (BASE << 3)) a -= (BASE << 3); \
- if (a >= (BASE << 2)) a -= (BASE << 2); \
- if (a >= (BASE << 1)) a -= (BASE << 1); \
- if (a >= BASE) a -= BASE; \
- } while (0)
-# define MOD4(a) \
- do { \
- if (a >= (BASE << 4)) a -= (BASE << 4); \
- if (a >= (BASE << 3)) a -= (BASE << 3); \
- if (a >= (BASE << 2)) a -= (BASE << 2); \
- if (a >= (BASE << 1)) a -= (BASE << 1); \
- if (a >= BASE) a -= BASE; \
- } while (0)
-#else
-# define MOD(a) a %= BASE
-# define MOD4(a) a %= BASE
-#endif
-
-/* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
- unsigned long sum2;
- unsigned n;
-
- /* split Adler-32 into component sums */
- sum2 = (adler >> 16) & 0xffff;
- adler &= 0xffff;
-
- /* in case user likes doing a byte at a time, keep it fast */
- if (len == 1) {
- adler += buf[0];
- if (adler >= BASE)
- adler -= BASE;
- sum2 += adler;
- if (sum2 >= BASE)
- sum2 -= BASE;
- return adler | (sum2 << 16);
- }
-
- /* initial Adler-32 value (deferred check for len == 1 speed) */
- if (buf == Z_NULL)
- return 1L;
-
- /* in case short lengths are provided, keep it somewhat fast */
- if (len < 16) {
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- if (adler >= BASE)
- adler -= BASE;
- MOD4(sum2); /* only added so many BASE's */
- return adler | (sum2 << 16);
- }
-
- /* do length NMAX blocks -- requires just one modulo operation */
- while (len >= NMAX) {
- len -= NMAX;
- n = NMAX / 16; /* NMAX is divisible by 16 */
- do {
- DO16(buf); /* 16 sums unrolled */
- buf += 16;
- } while (--n);
- MOD(adler);
- MOD(sum2);
- }
-
- /* do remaining bytes (less than NMAX, still just one modulo) */
- if (len) { /* avoid modulos if none remaining */
- while (len >= 16) {
- len -= 16;
- DO16(buf);
- buf += 16;
- }
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- MOD(adler);
- MOD(sum2);
- }
-
- /* return recombined sums */
- return adler | (sum2 << 16);
-}
-
-/* ========================================================================= */
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off_t len2;
-{
- unsigned long sum1;
- unsigned long sum2;
- unsigned rem;
-
- /* the derivation of this formula is left as an exercise for the reader */
- rem = (unsigned)(len2 % BASE);
- sum1 = adler1 & 0xffff;
- sum2 = rem * sum1;
- MOD(sum2);
- sum1 += (adler2 & 0xffff) + BASE - 1;
- sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
- if (sum1 > BASE) sum1 -= BASE;
- if (sum1 > BASE) sum1 -= BASE;
- if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
- if (sum2 > BASE) sum2 -= BASE;
- return sum1 | (sum2 << 16);
-}
diff --git a/funtools/util/zlib-1.2.3/algorithm.txt b/funtools/util/zlib-1.2.3/algorithm.txt
deleted file mode 100644
index b022dde..0000000
--- a/funtools/util/zlib-1.2.3/algorithm.txt
+++ /dev/null
@@ -1,209 +0,0 @@
-1. Compression algorithm (deflate)
-
-The deflation algorithm used by gzip (also zip and zlib) is a variation of
-LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in
-the input data. The second occurrence of a string is replaced by a
-pointer to the previous string, in the form of a pair (distance,
-length). Distances are limited to 32K bytes, and lengths are limited
-to 258 bytes. When a string does not occur anywhere in the previous
-32K bytes, it is emitted as a sequence of literal bytes. (In this
-description, `string' must be taken as an arbitrary sequence of bytes,
-and is not restricted to printable characters.)
-
-Literals or match lengths are compressed with one Huffman tree, and
-match distances are compressed with another tree. The trees are stored
-in a compact form at the start of each block. The blocks can have any
-size (except that the compressed data for one block must fit in
-available memory). A block is terminated when deflate() determines that
-it would be useful to start another block with fresh trees. (This is
-somewhat similar to the behavior of LZW-based _compress_.)
-
-Duplicated strings are found using a hash table. All input strings of
-length 3 are inserted in the hash table. A hash index is computed for
-the next 3 bytes. If the hash chain for this index is not empty, all
-strings in the chain are compared with the current input string, and
-the longest match is selected.
-
-The hash chains are searched starting with the most recent strings, to
-favor small distances and thus take advantage of the Huffman encoding.
-The hash chains are singly linked. There are no deletions from the
-hash chains, the algorithm simply discards matches that are too old.
-
-To avoid a worst-case situation, very long hash chains are arbitrarily
-truncated at a certain length, determined by a runtime option (level
-parameter of deflateInit). So deflate() does not always find the longest
-possible match but generally finds a match which is long enough.
-
-deflate() also defers the selection of matches with a lazy evaluation
-mechanism. After a match of length N has been found, deflate() searches for
-a longer match at the next input byte. If a longer match is found, the
-previous match is truncated to a length of one (thus producing a single
-literal byte) and the process of lazy evaluation begins again. Otherwise,
-the original match is kept, and the next match search is attempted only N
-steps later.
-
-The lazy match evaluation is also subject to a runtime parameter. If
-the current match is long enough, deflate() reduces the search for a longer
-match, thus speeding up the whole process. If compression ratio is more
-important than speed, deflate() attempts a complete second search even if
-the first match is already long enough.
-
-The lazy match evaluation is not performed for the fastest compression
-modes (level parameter 1 to 3). For these fast modes, new strings
-are inserted in the hash table only when no match was found, or
-when the match is not too long. This degrades the compression ratio
-but saves time since there are both fewer insertions and fewer searches.
-
-
-2. Decompression algorithm (inflate)
-
-2.1 Introduction
-
-The key question is how to represent a Huffman code (or any prefix code) so
-that you can decode fast. The most important characteristic is that shorter
-codes are much more common than longer codes, so pay attention to decoding the
-short codes fast, and let the long codes take longer to decode.
-
-inflate() sets up a first level table that covers some number of bits of
-input less than the length of longest code. It gets that many bits from the
-stream, and looks it up in the table. The table will tell if the next
-code is that many bits or less and how many, and if it is, it will tell
-the value, else it will point to the next level table for which inflate()
-grabs more bits and tries to decode a longer code.
-
-How many bits to make the first lookup is a tradeoff between the time it
-takes to decode and the time it takes to build the table. If building the
-table took no time (and if you had infinite memory), then there would only
-be a first level table to cover all the way to the longest code. However,
-building the table ends up taking a lot longer for more bits since short
-codes are replicated many times in such a table. What inflate() does is
-simply to make the number of bits in the first table a variable, and then
-to set that variable for the maximum speed.
-
-For inflate, which has 286 possible codes for the literal/length tree, the size
-of the first table is nine bits. Also the distance trees have 30 possible
-values, and the size of the first table is six bits. Note that for each of
-those cases, the table ended up one bit longer than the ``average'' code
-length, i.e. the code length of an approximately flat code which would be a
-little more than eight bits for 286 symbols and a little less than five bits
-for 30 symbols.
-
-
-2.2 More details on the inflate table lookup
-
-Ok, you want to know what this cleverly obfuscated inflate tree actually
-looks like. You are correct that it's not a Huffman tree. It is simply a
-lookup table for the first, let's say, nine bits of a Huffman symbol. The
-symbol could be as short as one bit or as long as 15 bits. If a particular
-symbol is shorter than nine bits, then that symbol's translation is duplicated
-in all those entries that start with that symbol's bits. For example, if the
-symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a
-symbol is nine bits long, it appears in the table once.
-
-If the symbol is longer than nine bits, then that entry in the table points
-to another similar table for the remaining bits. Again, there are duplicated
-entries as needed. The idea is that most of the time the symbol will be short
-and there will only be one table look up. (That's whole idea behind data
-compression in the first place.) For the less frequent long symbols, there
-will be two lookups. If you had a compression method with really long
-symbols, you could have as many levels of lookups as is efficient. For
-inflate, two is enough.
-
-So a table entry either points to another table (in which case nine bits in
-the above example are gobbled), or it contains the translation for the symbol
-and the number of bits to gobble. Then you start again with the next
-ungobbled bit.
-
-You may wonder: why not just have one lookup table for how ever many bits the
-longest symbol is? The reason is that if you do that, you end up spending
-more time filling in duplicate symbol entries than you do actually decoding.
-At least for deflate's output that generates new trees every several 10's of
-kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code
-would take too long if you're only decoding several thousand symbols. At the
-other extreme, you could make a new table for every bit in the code. In fact,
-that's essentially a Huffman tree. But then you spend two much time
-traversing the tree while decoding, even for short symbols.
-
-So the number of bits for the first lookup table is a trade of the time to
-fill out the table vs. the time spent looking at the second level and above of
-the table.
-
-Here is an example, scaled down:
-
-The code being decoded, with 10 symbols, from 1 to 6 bits long:
-
-A: 0
-B: 10
-C: 1100
-D: 11010
-E: 11011
-F: 11100
-G: 11101
-H: 11110
-I: 111110
-J: 111111
-
-Let's make the first table three bits long (eight entries):
-
-000: A,1
-001: A,1
-010: A,1
-011: A,1
-100: B,2
-101: B,2
-110: -> table X (gobble 3 bits)
-111: -> table Y (gobble 3 bits)
-
-Each entry is what the bits decode as and how many bits that is, i.e. how
-many bits to gobble. Or the entry points to another table, with the number of
-bits to gobble implicit in the size of the table.
-
-Table X is two bits long since the longest code starting with 110 is five bits
-long:
-
-00: C,1
-01: C,1
-10: D,2
-11: E,2
-
-Table Y is three bits long since the longest code starting with 111 is six
-bits long:
-
-000: F,2
-001: F,2
-010: G,2
-011: G,2
-100: H,2
-101: H,2
-110: I,3
-111: J,3
-
-So what we have here are three tables with a total of 20 entries that had to
-be constructed. That's compared to 64 entries for a single table. Or
-compared to 16 entries for a Huffman tree (six two entry tables and one four
-entry table). Assuming that the code ideally represents the probability of
-the symbols, it takes on the average 1.25 lookups per symbol. That's compared
-to one lookup for the single table, or 1.66 lookups per symbol for the
-Huffman tree.
-
-There, I think that gives you a picture of what's going on. For inflate, the
-meaning of a particular symbol is often more than just a letter. It can be a
-byte (a "literal"), or it can be either a length or a distance which
-indicates a base value and a number of bits to fetch after the code that is
-added to the base value. Or it might be the special end-of-block code. The
-data structures created in inftrees.c try to encode all that information
-compactly in the tables.
-
-
-Jean-loup Gailly Mark Adler
-jloup@gzip.org madler@alumni.caltech.edu
-
-
-References:
-
-[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data
-Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
-pp. 337-343.
-
-``DEFLATE Compressed Data Format Specification'' available in
-http://www.ietf.org/rfc/rfc1951.txt
diff --git a/funtools/util/zlib-1.2.3/amiga/Makefile.pup b/funtools/util/zlib-1.2.3/amiga/Makefile.pup
deleted file mode 100644
index 3f7e155..0000000
--- a/funtools/util/zlib-1.2.3/amiga/Makefile.pup
+++ /dev/null
@@ -1,66 +0,0 @@
-# Amiga powerUP (TM) Makefile
-# makefile for libpng and SAS C V6.58/7.00 PPC compiler
-# Copyright (C) 1998 by Andreas R. Kleinert
-
-LIBNAME = libzip.a
-
-CC = scppc
-CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
- OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER
-AR = ppc-amigaos-ar cr
-RANLIB = ppc-amigaos-ranlib
-LD = ppc-amigaos-ld -r
-LDFLAGS = -o
-LDLIBS = LIB:scppc.a LIB:end.o
-RM = delete quiet
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example minigzip
-
-check: test
-test: all
- example
- echo hello world | minigzip | minigzip -d
-
-$(LIBNAME): $(OBJS)
- $(AR) $@ $(OBJS)
- -$(RANLIB) $@
-
-example: example.o $(LIBNAME)
- $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
-
-minigzip: minigzip.o $(LIBNAME)
- $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
-
-mostlyclean: clean
-clean:
- $(RM) *.o example minigzip $(LIBNAME) foo.gz
-
-zip:
- zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
- descrip.mms *.[ch]
-
-tgz:
- cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
- zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/amiga/Makefile.sas b/funtools/util/zlib-1.2.3/amiga/Makefile.sas
deleted file mode 100644
index 296ef48..0000000
--- a/funtools/util/zlib-1.2.3/amiga/Makefile.sas
+++ /dev/null
@@ -1,65 +0,0 @@
-# SMakefile for zlib
-# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly
-# Osma Ahvenlampi <Osma.Ahvenlampi@hut.fi>
-# Amiga, SAS/C 6.56 & Smake
-
-CC=sc
-CFLAGS=OPT
-#CFLAGS=OPT CPU=68030
-#CFLAGS=DEBUG=LINE
-LDFLAGS=LIB z.lib
-
-SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
- NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
- DEF=POSTINC
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: SCOPTIONS example minigzip
-
-check: test
-test: all
- example
- echo hello world | minigzip | minigzip -d
-
-install: z.lib
- copy clone zlib.h zconf.h INCLUDE:
- copy clone z.lib LIB:
-
-z.lib: $(OBJS)
- oml z.lib r $(OBJS)
-
-example: example.o z.lib
- $(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
-
-minigzip: minigzip.o z.lib
- $(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
-
-mostlyclean: clean
-clean:
- -delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS
-
-SCOPTIONS: Makefile.sas
- copy to $@ <from <
-$(SCOPTIONS)
-<
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/as400/bndsrc b/funtools/util/zlib-1.2.3/as400/bndsrc
deleted file mode 100644
index 9cf94bb..0000000
--- a/funtools/util/zlib-1.2.3/as400/bndsrc
+++ /dev/null
@@ -1,132 +0,0 @@
-STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
-
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-/* Version 1.1.3 entry points. */
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-
-/********************************************************************/
-/* *MODULE ADLER32 ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("adler32")
-
-/********************************************************************/
-/* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("compress")
- EXPORT SYMBOL("compress2")
-
-/********************************************************************/
-/* *MODULE CRC32 ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("crc32")
- EXPORT SYMBOL("get_crc_table")
-
-/********************************************************************/
-/* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("deflate")
- EXPORT SYMBOL("deflateEnd")
- EXPORT SYMBOL("deflateSetDictionary")
- EXPORT SYMBOL("deflateCopy")
- EXPORT SYMBOL("deflateReset")
- EXPORT SYMBOL("deflateParams")
- EXPORT SYMBOL("deflatePrime")
- EXPORT SYMBOL("deflateInit_")
- EXPORT SYMBOL("deflateInit2_")
-
-/********************************************************************/
-/* *MODULE GZIO ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("gzopen")
- EXPORT SYMBOL("gzdopen")
- EXPORT SYMBOL("gzsetparams")
- EXPORT SYMBOL("gzread")
- EXPORT SYMBOL("gzwrite")
- EXPORT SYMBOL("gzprintf")
- EXPORT SYMBOL("gzputs")
- EXPORT SYMBOL("gzgets")
- EXPORT SYMBOL("gzputc")
- EXPORT SYMBOL("gzgetc")
- EXPORT SYMBOL("gzflush")
- EXPORT SYMBOL("gzseek")
- EXPORT SYMBOL("gzrewind")
- EXPORT SYMBOL("gztell")
- EXPORT SYMBOL("gzeof")
- EXPORT SYMBOL("gzclose")
- EXPORT SYMBOL("gzerror")
-
-/********************************************************************/
-/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("inflate")
- EXPORT SYMBOL("inflateEnd")
- EXPORT SYMBOL("inflateSetDictionary")
- EXPORT SYMBOL("inflateSync")
- EXPORT SYMBOL("inflateReset")
- EXPORT SYMBOL("inflateInit_")
- EXPORT SYMBOL("inflateInit2_")
- EXPORT SYMBOL("inflateSyncPoint")
-
-/********************************************************************/
-/* *MODULE UNCOMPR ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("uncompress")
-
-/********************************************************************/
-/* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("zlibVersion")
- EXPORT SYMBOL("zError")
-
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-/* Version 1.2.1 additional entry points. */
-/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-
-/********************************************************************/
-/* *MODULE COMPRESS ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("compressBound")
-
-/********************************************************************/
-/* *MODULE DEFLATE ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("deflateBound")
-
-/********************************************************************/
-/* *MODULE GZIO ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("gzungetc")
- EXPORT SYMBOL("gzclearerr")
-
-/********************************************************************/
-/* *MODULE INFBACK ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("inflateBack")
- EXPORT SYMBOL("inflateBackEnd")
- EXPORT SYMBOL("inflateBackInit_")
-
-/********************************************************************/
-/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("inflateCopy")
-
-/********************************************************************/
-/* *MODULE ZUTIL ZLIB 01/02/01 00:15:09 */
-/********************************************************************/
-
- EXPORT SYMBOL("zlibCompileFlags")
-
-ENDPGMEXP
diff --git a/funtools/util/zlib-1.2.3/as400/compile.clp b/funtools/util/zlib-1.2.3/as400/compile.clp
deleted file mode 100644
index 8554951..0000000
--- a/funtools/util/zlib-1.2.3/as400/compile.clp
+++ /dev/null
@@ -1,123 +0,0 @@
-/******************************************************************************/
-/* */
-/* ZLIB */
-/* */
-/* Compile sources into modules and link them into a service program. */
-/* */
-/******************************************************************************/
-
- PGM
-
-/* Configuration adjustable parameters. */
-
- DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) +
- VALUE('ZLIB') /* Source library. */
- DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10) +
- VALUE('SOURCES') /* Source member file. */
- DCL VAR(&CTLFILE) TYPE(*CHAR) LEN(10) +
- VALUE('TOOLS') /* Control member file. */
-
- DCL VAR(&MODLIB) TYPE(*CHAR) LEN(10) +
- VALUE('ZLIB') /* Module library. */
-
- DCL VAR(&SRVLIB) TYPE(*CHAR) LEN(10) +
- VALUE('LGPL') /* Service program library. */
-
- DCL VAR(&CFLAGS) TYPE(*CHAR) +
- VALUE('OPTIMIZE(40)') /* Compile options. */
-
-
-/* Working storage. */
-
- DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(300) /* Command length. */
- DCL VAR(&CMD) TYPE(*CHAR) LEN(512)
-
-
-/* Compile sources into modules. */
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/ADLER32) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/COMPRESS) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/CRC32) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/DEFLATE) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/GZIO) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/INFBACK) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/INFFAST) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/INFLATE) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/INFTREES) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/TREES) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/UNCOMPR) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
- CHGVAR VAR(&CMD) VALUE('CRTCMOD MODULE(' *TCAT &MODLIB *TCAT +
- '/ZUTIL) SRCFILE(' *TCAT +
- &SRCLIB *TCAT '/' *TCAT &SRCFILE *TCAT +
- ') SYSIFCOPT(*IFSIO)' *BCAT &CFLAGS)
- CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
-
-
-/* Link modules into a service program. */
-
- CRTSRVPGM SRVPGM(&SRVLIB/ZLIB) +
- MODULE(&MODLIB/ADLER32 &MODLIB/COMPRESS +
- &MODLIB/CRC32 &MODLIB/DEFLATE +
- &MODLIB/GZIO &MODLIB/INFBACK +
- &MODLIB/INFFAST &MODLIB/INFLATE +
- &MODLIB/INFTREES &MODLIB/TREES +
- &MODLIB/UNCOMPR &MODLIB/ZUTIL) +
- SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
- TEXT('ZLIB 1.2.3') TGTRLS(V4R4M0)
-
- ENDPGM
diff --git a/funtools/util/zlib-1.2.3/as400/readme.txt b/funtools/util/zlib-1.2.3/as400/readme.txt
deleted file mode 100644
index beae13f..0000000
--- a/funtools/util/zlib-1.2.3/as400/readme.txt
+++ /dev/null
@@ -1,111 +0,0 @@
- ZLIB version 1.2.3 for AS400 installation instructions
-
-I) From an AS400 *SAVF file:
-
-1) Unpacking archive to an AS400 save file
-
-On the AS400:
-
-_ Create the ZLIB AS400 library:
-
- CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library')
-
-_ Create a work save file, for example:
-
- CRTSAVF FILE(ZLIB/ZLIBSAVF)
-
-On a PC connected to the target AS400:
-
-_ Unpack the save file image to a PC file "ZLIBSAVF"
-_ Upload this file into the save file on the AS400, for example
- using ftp in BINARY mode.
-
-
-2) Populating the ZLIB AS400 source library
-
-On the AS400:
-
-_ Extract the saved objects into the ZLIB AS400 library using:
-
-RSTOBJ OBJ(*ALL) SAVLIB(ZLIB) DEV(*SAVF) SAVF(ZLIB/ZLIBSAVF) RSTLIB(ZLIB)
-
-
-3) Customize installation:
-
-_ Edit CL member ZLIB/TOOLS(COMPILE) and change parameters if needed,
- according to the comments.
-
-_ Compile this member with:
-
- CRTCLPGM PGM(ZLIB/COMPILE) SRCFILE(ZLIB/TOOLS) SRCMBR(COMPILE)
-
-
-4) Compile and generate the service program:
-
-_ This can now be done by executing:
-
- CALL PGM(ZLIB/COMPILE)
-
-
-
-II) From the original source distribution:
-
-1) On the AS400, create the source library:
-
- CRTLIB LIB(ZLIB) TYPE(PROD) TEXT('ZLIB compression API library')
-
-2) Create the source files:
-
- CRTSRCPF FILE(ZLIB/SOURCES) RCDLEN(112) TEXT('ZLIB library modules')
- CRTSRCPF FILE(ZLIB/H) RCDLEN(112) TEXT('ZLIB library includes')
- CRTSRCPF FILE(ZLIB/TOOLS) RCDLEN(112) TEXT('ZLIB library control utilities')
-
-3) From the machine hosting the distribution files, upload them (with
- FTP in text mode, for example) according to the following table:
-
- Original AS400 AS400 AS400 AS400
- file file member type description
- SOURCES Original ZLIB C subprogram sources
- adler32.c ADLER32 C ZLIB - Compute the Adler-32 checksum of a dta strm
- compress.c COMPRESS C ZLIB - Compress a memory buffer
- crc32.c CRC32 C ZLIB - Compute the CRC-32 of a data stream
- deflate.c DEFLATE C ZLIB - Compress data using the deflation algorithm
- gzio.c GZIO C ZLIB - IO on .gz files
- infback.c INFBACK C ZLIB - Inflate using a callback interface
- inffast.c INFFAST C ZLIB - Fast proc. literals & length/distance pairs
- inflate.c INFLATE C ZLIB - Interface to inflate modules
- inftrees.c INFTREES C ZLIB - Generate Huffman trees for efficient decode
- trees.c TREES C ZLIB - Output deflated data using Huffman coding
- uncompr.c UNCOMPR C ZLIB - Decompress a memory buffer
- zutil.c ZUTIL C ZLIB - Target dependent utility functions
- H Original ZLIB C and ILE/RPG include files
- crc32.h CRC32 C ZLIB - CRC32 tables
- deflate.h DEFLATE C ZLIB - Internal compression state
- inffast.h INFFAST C ZLIB - Header to use inffast.c
- inffixed.h INFFIXED C ZLIB - Table for decoding fixed codes
- inflate.h INFLATE C ZLIB - Internal inflate state definitions
- inftrees.h INFTREES C ZLIB - Header to use inftrees.c
- trees.h TREES C ZLIB - Created automatically with -DGEN_TREES_H
- zconf.h ZCONF C ZLIB - Compression library configuration
- zlib.h ZLIB C ZLIB - Compression library C user interface
- as400/zlib.inc ZLIB.INC RPGLE ZLIB - Compression library ILE RPG user interface
- zutil.h ZUTIL C ZLIB - Internal interface and configuration
- TOOLS Building source software & AS/400 README
- as400/bndsrc BNDSRC Entry point exportation list
- as400/compile.clp COMPILE CLP Compile sources & generate service program
- as400/readme.txt README TXT Installation instructions
-
-4) Continue as in I)3).
-
-
-
-
-Notes: For AS400 ILE RPG programmers, a /copy member defining the ZLIB
- API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC).
- Please read comments in this member for more information.
-
- Remember that most foreign textual data are ASCII coded: this
- implementation does not handle conversion from/to ASCII, so
- text data code conversions must be done explicitely.
-
- Always open zipped files in binary mode.
diff --git a/funtools/util/zlib-1.2.3/as400/zlib.inc b/funtools/util/zlib-1.2.3/as400/zlib.inc
deleted file mode 100644
index 7bbfb7e..0000000
--- a/funtools/util/zlib-1.2.3/as400/zlib.inc
+++ /dev/null
@@ -1,331 +0,0 @@
- * ZLIB.INC - Interface to the general purpose compression library
- *
- * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
- * Version 1.2.3
- *
- *
- * WARNING:
- * Procedures inflateInit(), inflateInit2(), deflateInit(),
- * deflateInit2() and inflateBackInit() need to be called with
- * two additional arguments:
- * the package version string and the stream control structure.
- * size. This is needed because RPG lacks some macro feature.
- * Call these procedures as:
- * inflateInit(...: ZLIB_VERSION: %size(z_stream))
- *
- /if not defined(ZLIB_H_)
- /define ZLIB_H_
- *
- **************************************************************************
- * Constants
- **************************************************************************
- *
- * Versioning information.
- *
- D ZLIB_VERSION C '1.2.3'
- D ZLIB_VERNUM C X'1230'
- *
- * Other equates.
- *
- D Z_NO_FLUSH C 0
- D Z_SYNC_FLUSH C 2
- D Z_FULL_FLUSH C 3
- D Z_FINISH C 4
- D Z_BLOCK C 5
- *
- D Z_OK C 0
- D Z_STREAM_END C 1
- D Z_NEED_DICT C 2
- D Z_ERRNO C -1
- D Z_STREAM_ERROR C -2
- D Z_DATA_ERROR C -3
- D Z_MEM_ERROR C -4
- D Z_BUF_ERROR C -5
- DZ_VERSION_ERROR C -6
- *
- D Z_NO_COMPRESSION...
- D C 0
- D Z_BEST_SPEED C 1
- D Z_BEST_COMPRESSION...
- D C 9
- D Z_DEFAULT_COMPRESSION...
- D C -1
- *
- D Z_FILTERED C 1
- D Z_HUFFMAN_ONLY C 2
- D Z_RLE C 3
- D Z_DEFAULT_STRATEGY...
- D C 0
- *
- D Z_BINARY C 0
- D Z_ASCII C 1
- D Z_UNKNOWN C 2
- *
- D Z_DEFLATED C 8
- *
- D Z_NULL C 0
- *
- **************************************************************************
- * Types
- **************************************************************************
- *
- D z_streamp S * Stream struct ptr
- D gzFile S * File pointer
- D z_off_t S 10i 0 Stream offsets
- *
- **************************************************************************
- * Structures
- **************************************************************************
- *
- * The GZIP encode/decode stream support structure.
- *
- D z_stream DS align based(z_streamp)
- D zs_next_in * Next input byte
- D zs_avail_in 10U 0 Byte cnt at next_in
- D zs_total_in 10U 0 Total bytes read
- D zs_next_out * Output buffer ptr
- D zs_avail_out 10U 0 Room left @ next_out
- D zs_total_out 10U 0 Total bytes written
- D zs_msg * Last errmsg or null
- D zs_state * Internal state
- D zs_zalloc * procptr Int. state allocator
- D zs_free * procptr Int. state dealloc.
- D zs_opaque * Private alloc. data
- D zs_data_type 10i 0 ASC/BIN best guess
- D zs_adler 10u 0 Uncompr. adler32 val
- D 10U 0 Reserved
- D 10U 0 Ptr. alignment
- *
- **************************************************************************
- * Utility function prototypes
- **************************************************************************
- *
- D compress PR 10I 0 extproc('compress')
- D dest 32767 options(*varsize) Destination buffer
- D destLen 10U 0 Destination length
- D source 32767 const options(*varsize) Source buffer
- D sourceLen 10u 0 value Source length
- *
- D compress2 PR 10I 0 extproc('compress2')
- D dest 32767 options(*varsize) Destination buffer
- D destLen 10U 0 Destination length
- D source 32767 const options(*varsize) Source buffer
- D sourceLen 10U 0 value Source length
- D level 10I 0 value Compression level
- *
- D compressBound PR 10U 0 extproc('compressBound')
- D sourceLen 10U 0 value
- *
- D uncompress PR 10I 0 extproc('uncompress')
- D dest 32767 options(*varsize) Destination buffer
- D destLen 10U 0 Destination length
- D source 32767 const options(*varsize) Source buffer
- D sourceLen 10U 0 value Source length
- *
- D gzopen PR extproc('gzopen')
- D like(gzFile)
- D path * value options(*string) File pathname
- D mode * value options(*string) Open mode
- *
- D gzdopen PR extproc('gzdopen')
- D like(gzFile)
- D fd 10i 0 value File descriptor
- D mode * value options(*string) Open mode
- *
- D gzsetparams PR 10I 0 extproc('gzsetparams')
- D file value like(gzFile) File pointer
- D level 10I 0 value
- D strategy 10i 0 value
- *
- D gzread PR 10I 0 extproc('gzread')
- D file value like(gzFile) File pointer
- D buf 32767 options(*varsize) Buffer
- D len 10u 0 value Buffer length
- *
- D gzwrite PR 10I 0 extproc('gzwrite')
- D file value like(gzFile) File pointer
- D buf 32767 const options(*varsize) Buffer
- D len 10u 0 value Buffer length
- *
- D gzputs PR 10I 0 extproc('gzputs')
- D file value like(gzFile) File pointer
- D s * value options(*string) String to output
- *
- D gzgets PR * extproc('gzgets')
- D file value like(gzFile) File pointer
- D buf 32767 options(*varsize) Read buffer
- D len 10i 0 value Buffer length
- *
- D gzflush PR 10i 0 extproc('gzflush')
- D file value like(gzFile) File pointer
- D flush 10I 0 value Type of flush
- *
- D gzseek PR extproc('gzseek')
- D like(z_off_t)
- D file value like(gzFile) File pointer
- D offset value like(z_off_t) Offset
- D whence 10i 0 value Origin
- *
- D gzrewind PR 10i 0 extproc('gzrewind')
- D file value like(gzFile) File pointer
- *
- D gztell PR extproc('gztell')
- D like(z_off_t)
- D file value like(gzFile) File pointer
- *
- D gzeof PR 10i 0 extproc('gzeof')
- D file value like(gzFile) File pointer
- *
- D gzclose PR 10i 0 extproc('gzclose')
- D file value like(gzFile) File pointer
- *
- D gzerror PR * extproc('gzerror') Error string
- D file value like(gzFile) File pointer
- D errnum 10I 0 Error code
- *
- D gzclearerr PR extproc('gzclearerr')
- D file value like(gzFile) File pointer
- *
- **************************************************************************
- * Basic function prototypes
- **************************************************************************
- *
- D zlibVersion PR * extproc('zlibVersion') Version string
- *
- D deflateInit PR 10I 0 extproc('deflateInit_') Init. compression
- D strm like(z_stream) Compression stream
- D level 10I 0 value Compression level
- D version * value options(*string) Version string
- D stream_size 10i 0 value Stream struct. size
- *
- D deflate PR 10I 0 extproc('deflate') Compress data
- D strm like(z_stream) Compression stream
- D flush 10I 0 value Flush type required
- *
- D deflateEnd PR 10I 0 extproc('deflateEnd') Termin. compression
- D strm like(z_stream) Compression stream
- *
- D inflateInit PR 10I 0 extproc('inflateInit_') Init. expansion
- D strm like(z_stream) Expansion stream
- D version * value options(*string) Version string
- D stream_size 10i 0 value Stream struct. size
- *
- D inflate PR 10I 0 extproc('inflate') Expand data
- D strm like(z_stream) Expansion stream
- D flush 10I 0 value Flush type required
- *
- D inflateEnd PR 10I 0 extproc('inflateEnd') Termin. expansion
- D strm like(z_stream) Expansion stream
- *
- **************************************************************************
- * Advanced function prototypes
- **************************************************************************
- *
- D deflateInit2 PR 10I 0 extproc('deflateInit2_') Init. compression
- D strm like(z_stream) Compression stream
- D level 10I 0 value Compression level
- D method 10I 0 value Compression method
- D windowBits 10I 0 value log2(window size)
- D memLevel 10I 0 value Mem/cmpress tradeoff
- D strategy 10I 0 value Compression stategy
- D version * value options(*string) Version string
- D stream_size 10i 0 value Stream struct. size
- *
- D deflateSetDictionary...
- D PR 10I 0 extproc('deflateSetDictionary') Init. dictionary
- D strm like(z_stream) Compression stream
- D dictionary 32767 const options(*varsize) Dictionary bytes
- D dictLength 10U 0 value Dictionary length
- *
- D deflateCopy PR 10I 0 extproc('deflateCopy') Compress strm 2 strm
- D dest like(z_stream) Destination stream
- D source like(z_stream) Source stream
- *
- D deflateReset PR 10I 0 extproc('deflateReset') End and init. stream
- D strm like(z_stream) Compression stream
- *
- D deflateParams PR 10I 0 extproc('deflateParams') Change level & strat
- D strm like(z_stream) Compression stream
- D level 10I 0 value Compression level
- D strategy 10I 0 value Compression stategy
- *
- D deflateBound PR 10U 0 extproc('deflateBound') Change level & strat
- D strm like(z_stream) Compression stream
- D sourcelen 10U 0 value Compression level
- *
- D deflatePrime PR 10I 0 extproc('deflatePrime') Change level & strat
- D strm like(z_stream) Compression stream
- D bits 10I 0 value Number of bits to insert
- D value 10I 0 value Bits to insert
- *
- D inflateInit2 PR 10I 0 extproc('inflateInit2_') Init. expansion
- D strm like(z_stream) Expansion stream
- D windowBits 10I 0 value log2(window size)
- D version * value options(*string) Version string
- D stream_size 10i 0 value Stream struct. size
- *
- D inflateSetDictionary...
- D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary
- D strm like(z_stream) Expansion stream
- D dictionary 32767 const options(*varsize) Dictionary bytes
- D dictLength 10U 0 value Dictionary length
- *
- D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion
- D strm like(z_stream) Expansion stream
- *
- D inflateCopy PR 10I 0 extproc('inflateCopy')
- D dest like(z_stream) Destination stream
- D source like(z_stream) Source stream
- *
- D inflateReset PR 10I 0 extproc('inflateReset') End and init. stream
- D strm like(z_stream) Expansion stream
- *
- D inflateBackInit...
- D PR 10I 0 extproc('inflateBackInit_')
- D strm like(z_stream) Expansion stream
- D windowBits 10I 0 value Log2(buffer size)
- D window 32767 options(*varsize) Buffer
- D version * value options(*string) Version string
- D stream_size 10i 0 value Stream struct. size
- *
- D inflateBack PR 10I 0 extproc('inflateBack')
- D strm like(z_stream) Expansion stream
- D in * value procptr Input function
- D in_desc * value Input descriptor
- D out * value procptr Output function
- D out_desc * value Output descriptor
- *
- D inflateBackEnd PR 10I 0 extproc('inflateBackEnd')
- D strm like(z_stream) Expansion stream
- *
- D zlibCompileFlags...
- D PR 10U 0 extproc('zlibCompileFlags')
- *
- **************************************************************************
- * Checksum function prototypes
- **************************************************************************
- *
- D adler32 PR 10U 0 extproc('adler32') New checksum
- D adler 10U 0 value Old checksum
- D buf 32767 const options(*varsize) Bytes to accumulate
- D len 10U 0 value Buffer length
- *
- D crc32 PR 10U 0 extproc('crc32') New checksum
- D crc 10U 0 value Old checksum
- D buf 32767 const options(*varsize) Bytes to accumulate
- D len 10U 0 value Buffer length
- *
- **************************************************************************
- * Miscellaneous function prototypes
- **************************************************************************
- *
- D zError PR * extproc('zError') Error string
- D err 10I 0 value Error code
- *
- D inflateSyncPoint...
- D PR 10I 0 extproc('inflateSyncPoint')
- D strm like(z_stream) Expansion stream
- *
- D get_crc_table PR * extproc('get_crc_table') Ptr to ulongs
- *
- /endif
diff --git a/funtools/util/zlib-1.2.3/compress.c b/funtools/util/zlib-1.2.3/compress.c
deleted file mode 100644
index df04f01..0000000
--- a/funtools/util/zlib-1.2.3/compress.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2003 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
-#ifdef MAXSEG_64K
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-#endif
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
-
- err = deflateInit(&stream, level);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-/* ===========================================================================
- */
-int ZEXPORT compress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
- return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
-}
-
-/* ===========================================================================
- If the default memLevel or windowBits for deflateInit() is changed, then
- this function needs to be updated.
- */
-uLong ZEXPORT compressBound (sourceLen)
- uLong sourceLen;
-{
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
-}
diff --git a/funtools/util/zlib-1.2.3/configure b/funtools/util/zlib-1.2.3/configure
deleted file mode 100755
index d7ffdc3..0000000
--- a/funtools/util/zlib-1.2.3/configure
+++ /dev/null
@@ -1,459 +0,0 @@
-#!/bin/sh
-# configure script for zlib. This script is needed only if
-# you wish to build a shared library and your system supports them,
-# of if you need special compiler, flags or install directory.
-# Otherwise, you can just use directly "make test; make install"
-#
-# To create a shared library, use "configure --shared"; by default a static
-# library is created. If the primitive shared library support provided here
-# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
-#
-# To impose specific compiler or flags or install directory, use for example:
-# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
-# or for csh/tcsh users:
-# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
-# LDSHARED is the command to be used to create a shared library
-
-# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
-# If you have problems, try without defining CC and CFLAGS before reporting
-# an error.
-
-LIBS=libz.a
-LDFLAGS="-L. ${LIBS}"
-VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
-VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
-VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
-AR=${AR-"ar rc"}
-RANLIB=${RANLIB-"ranlib"}
-prefix=${prefix-/usr/local}
-exec_prefix=${exec_prefix-'${prefix}'}
-libdir=${libdir-'${exec_prefix}/lib'}
-includedir=${includedir-'${prefix}/include'}
-mandir=${mandir-'${prefix}/share/man'}
-shared_ext='.so'
-shared=0
-gcc=0
-old_cc="$CC"
-old_cflags="$CFLAGS"
-
-while test $# -ge 1
-do
-case "$1" in
- -h* | --h*)
- echo 'usage:'
- echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]'
- echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
- exit 0;;
- -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
- -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
- -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
- -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
- -p* | --p*) prefix="$2"; shift; shift;;
- -e* | --e*) exec_prefix="$2"; shift; shift;;
- -l* | --l*) libdir="$2"; shift; shift;;
- -i* | --i*) includedir="$2"; shift; shift;;
- -s* | --s*) shared=1; shift;;
- *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1;;
- esac
-done
-
-test=ztest$$
-cat > $test.c <<EOF
-extern int getchar();
-int hello() {return getchar();}
-EOF
-
-test -z "$CC" && echo Checking for gcc...
-cc=${CC-gcc}
-cflags=${CFLAGS-"-O3"}
-# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
-case "$cc" in
- *gcc*) gcc=1;;
-esac
-
-if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
- CC="$cc"
- SFLAGS=${CFLAGS-"-fPIC -O3"}
- CFLAGS="$cflags"
- case `(uname -s || echo unknown) 2>/dev/null` in
- Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
- CYGWIN* | Cygwin* | cygwin* | OS/2* )
- EXE='.exe';;
- QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
- # (alain.bonnefoy@icbt.com)
- LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};;
- HP-UX*)
- LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
- case `(uname -m || echo unknown) 2>/dev/null` in
- ia64)
- shared_ext='.so'
- SHAREDLIB='libz.so';;
- *)
- shared_ext='.sl'
- SHAREDLIB='libz.sl';;
- esac;;
- Darwin*) shared_ext='.dylib'
- SHAREDLIB=libz$shared_ext
- SHAREDLIBV=libz.$VER$shared_ext
- SHAREDLIBM=libz.$VER1$shared_ext
- LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"};;
- *) LDSHARED=${LDSHARED-"$cc -shared"};;
- esac
-else
- # find system name and corresponding cc options
- CC=${CC-cc}
- case `(uname -sr || echo unknown) 2>/dev/null` in
- HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
- CFLAGS=${CFLAGS-"-O"}
-# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
- LDSHARED=${LDSHARED-"ld -b"}
- case `(uname -m || echo unknown) 2>/dev/null` in
- ia64)
- shared_ext='.so'
- SHAREDLIB='libz.so';;
- *)
- shared_ext='.sl'
- SHAREDLIB='libz.sl';;
- esac;;
- IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
- CFLAGS=${CFLAGS-"-ansi -O2"}
- LDSHARED=${LDSHARED-"cc -shared"};;
- OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
- CFLAGS=${CFLAGS-"-O -std1"}
- LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
- OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
- CFLAGS=${CFLAGS-"-O -std1"}
- LDSHARED=${LDSHARED-"cc -shared"};;
- QNX*) SFLAGS=${CFLAGS-"-4 -O"}
- CFLAGS=${CFLAGS-"-4 -O"}
- LDSHARED=${LDSHARED-"cc"}
- RANLIB=${RANLIB-"true"}
- AR="cc -A";;
- SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
- CFLAGS=${CFLAGS-"-O3"}
- LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
- SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
- CFLAGS=${CFLAGS-"-fast -xcg89"}
- LDSHARED=${LDSHARED-"cc -G"};;
- SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
- CFLAGS=${CFLAGS-"-O2"}
- LDSHARED=${LDSHARED-"ld"};;
- SunStudio\ 9*) SFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
- CFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xtarget=ultra3 -xarch=v9b"}
- LDSHARED=${LDSHARED-"cc -xarch=v9b"};;
- UNIX_System_V\ 4.2.0)
- SFLAGS=${CFLAGS-"-KPIC -O"}
- CFLAGS=${CFLAGS-"-O"}
- LDSHARED=${LDSHARED-"cc -G"};;
- UNIX_SV\ 4.2MP)
- SFLAGS=${CFLAGS-"-Kconform_pic -O"}
- CFLAGS=${CFLAGS-"-O"}
- LDSHARED=${LDSHARED-"cc -G"};;
- OpenUNIX\ 5)
- SFLAGS=${CFLAGS-"-KPIC -O"}
- CFLAGS=${CFLAGS-"-O"}
- LDSHARED=${LDSHARED-"cc -G"};;
- AIX*) # Courtesy of dbakker@arrayasolutions.com
- SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
- CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
- LDSHARED=${LDSHARED-"xlc -G"};;
- # send working options for other systems to support@gzip.org
- *) SFLAGS=${CFLAGS-"-O"}
- CFLAGS=${CFLAGS-"-O"}
- LDSHARED=${LDSHARED-"cc -shared"};;
- esac
-fi
-
-SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
-SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
-SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
-
-if test $shared -eq 1; then
- echo Checking for shared library support...
- # we must test in two steps (cc then ld), required at least on SunOS 4.x
- if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
- test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
- CFLAGS="$SFLAGS"
- LIBS="$SHAREDLIBV"
- echo Building shared library $SHAREDLIBV with $CC.
- elif test -z "$old_cc" -a -z "$old_cflags"; then
- echo No shared library support.
- shared=0;
- else
- echo 'No shared library support; try without defining CC and CFLAGS'
- shared=0;
- fi
-fi
-if test $shared -eq 0; then
- LDSHARED="$CC"
- echo Building static library $LIBS version $VER with $CC.
-else
- LDFLAGS="-L. ${SHAREDLIBV}"
-fi
-
-cat > $test.c <<EOF
-#include <unistd.h>
-int main() { return 0; }
-EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h
- echo "Checking for unistd.h... Yes."
-else
- cp -p zconf.in.h zconf.h
- echo "Checking for unistd.h... No."
-fi
-
-cat > $test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-#include "zconf.h"
-
-int main()
-{
-#ifndef STDC
- choke me
-#endif
-
- return 0;
-}
-EOF
-
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()"
-
- cat > $test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-
-int mytest(char *fmt, ...)
-{
- char buf[20];
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return 0;
-}
-
-int main()
-{
- return (mytest("Hello%d\n", 1));
-}
-EOF
-
- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
- echo "Checking for vsnprintf() in stdio.h... Yes."
-
- cat >$test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-
-int mytest(char *fmt, ...)
-{
- int n;
- char buf[20];
- va_list ap;
-
- va_start(ap, fmt);
- n = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return n;
-}
-
-int main()
-{
- return (mytest("Hello%d\n", 1));
-}
-EOF
-
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- echo "Checking for return value of vsnprintf()... Yes."
- else
- CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
- echo "Checking for return value of vsnprintf()... No."
- echo " WARNING: apparently vsnprintf() does not return a value. zlib"
- echo " can build but will be open to possible string-format security"
- echo " vulnerabilities."
- fi
- else
- CFLAGS="$CFLAGS -DNO_vsnprintf"
- echo "Checking for vsnprintf() in stdio.h... No."
- echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib"
- echo " can build but will be open to possible buffer-overflow security"
- echo " vulnerabilities."
-
- cat >$test.c <<EOF
-#include <stdio.h>
-#include <stdarg.h>
-
-int mytest(char *fmt, ...)
-{
- int n;
- char buf[20];
- va_list ap;
-
- va_start(ap, fmt);
- n = vsprintf(buf, fmt, ap);
- va_end(ap);
- return n;
-}
-
-int main()
-{
- return (mytest("Hello%d\n", 1));
-}
-EOF
-
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- echo "Checking for return value of vsprintf()... Yes."
- else
- CFLAGS="$CFLAGS -DHAS_vsprintf_void"
- echo "Checking for return value of vsprintf()... No."
- echo " WARNING: apparently vsprintf() does not return a value. zlib"
- echo " can build but will be open to possible string-format security"
- echo " vulnerabilities."
- fi
- fi
-else
- echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()"
-
- cat >$test.c <<EOF
-#include <stdio.h>
-
-int mytest()
-{
- char buf[20];
-
- snprintf(buf, sizeof(buf), "%s", "foo");
- return 0;
-}
-
-int main()
-{
- return (mytest());
-}
-EOF
-
- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
- echo "Checking for snprintf() in stdio.h... Yes."
-
- cat >$test.c <<EOF
-#include <stdio.h>
-
-int mytest()
-{
- char buf[20];
-
- return snprintf(buf, sizeof(buf), "%s", "foo");
-}
-
-int main()
-{
- return (mytest());
-}
-EOF
-
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- echo "Checking for return value of snprintf()... Yes."
- else
- CFLAGS="$CFLAGS -DHAS_snprintf_void"
- echo "Checking for return value of snprintf()... No."
- echo " WARNING: apparently snprintf() does not return a value. zlib"
- echo " can build but will be open to possible string-format security"
- echo " vulnerabilities."
- fi
- else
- CFLAGS="$CFLAGS -DNO_snprintf"
- echo "Checking for snprintf() in stdio.h... No."
- echo " WARNING: snprintf() not found, falling back to sprintf(). zlib"
- echo " can build but will be open to possible buffer-overflow security"
- echo " vulnerabilities."
-
- cat >$test.c <<EOF
-#include <stdio.h>
-
-int mytest()
-{
- char buf[20];
-
- return sprintf(buf, "%s", "foo");
-}
-
-int main()
-{
- return (mytest());
-}
-EOF
-
- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- echo "Checking for return value of sprintf()... Yes."
- else
- CFLAGS="$CFLAGS -DHAS_sprintf_void"
- echo "Checking for return value of sprintf()... No."
- echo " WARNING: apparently sprintf() does not return a value. zlib"
- echo " can build but will be open to possible string-format security"
- echo " vulnerabilities."
- fi
- fi
-fi
-
-cat >$test.c <<EOF
-#include <errno.h>
-int main() { return 0; }
-EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- echo "Checking for errno.h... Yes."
-else
- echo "Checking for errno.h... No."
- CFLAGS="$CFLAGS -DNO_ERRNO_H"
-fi
-
-cat > $test.c <<EOF
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-caddr_t hello() {
- return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
-}
-EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- CFLAGS="$CFLAGS -DUSE_MMAP"
- echo Checking for mmap support... Yes.
-else
- echo Checking for mmap support... No.
-fi
-
-CPP=${CPP-"$CC -E"}
-case $CFLAGS in
- *ASMV*)
- if test "`nm $test.o | grep _hello`" = ""; then
- CPP="$CPP -DNO_UNDERLINE"
- echo Checking for underline in external names... No.
- else
- echo Checking for underline in external names... Yes.
- fi;;
-esac
-
-rm -f $test.[co] $test $test$shared_ext
-
-# udpate Makefile
-sed < Makefile.in "
-/^CC *=/s#=.*#=$CC#
-/^CFLAGS *=/s#=.*#=$CFLAGS#
-/^CPP *=/s#=.*#=$CPP#
-/^LDSHARED *=/s#=.*#=$LDSHARED#
-/^LIBS *=/s#=.*#=$LIBS#
-/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
-/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
-/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
-/^AR *=/s#=.*#=$AR#
-/^RANLIB *=/s#=.*#=$RANLIB#
-/^EXE *=/s#=.*#=$EXE#
-/^prefix *=/s#=.*#=$prefix#
-/^exec_prefix *=/s#=.*#=$exec_prefix#
-/^libdir *=/s#=.*#=$libdir#
-/^includedir *=/s#=.*#=$includedir#
-/^mandir *=/s#=.*#=$mandir#
-/^LDFLAGS *=/s#=.*#=$LDFLAGS#
-" > Makefile
diff --git a/funtools/util/zlib-1.2.3/contrib/README.contrib b/funtools/util/zlib-1.2.3/contrib/README.contrib
deleted file mode 100644
index 20afc62..0000000
--- a/funtools/util/zlib-1.2.3/contrib/README.contrib
+++ /dev/null
@@ -1,71 +0,0 @@
-All files under this contrib directory are UNSUPPORTED. There were
-provided by users of zlib and were not tested by the authors of zlib.
-Use at your own risk. Please contact the authors of the contributions
-for help about these, not the zlib authors. Thanks.
-
-
-ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
- Support for Ada
- See http://zlib-ada.sourceforge.net/
-
-asm586/
-asm686/ by Brian Raiter <breadbox@muppetlabs.com>
- asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
- See http://www.muppetlabs.com/~breadbox/software/assembly.html
-
-blast/ by Mark Adler <madler@alumni.caltech.edu>
- Decompressor for output of PKWare Data Compression Library (DCL)
-
-delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
- Support for Delphi and C++ Builder
-
-dotzlib/ by Henrik Ravn <henrik@ravn.com>
- Support for Microsoft .Net and Visual C++ .Net
-
-infback9/ by Mark Adler <madler@alumni.caltech.edu>
- Unsupported diffs to infback to decode the deflate64 format
-
-inflate86/ by Chris Anderson <christop@charm.net>
- Tuned x86 gcc asm code to replace inflate_fast()
-
-iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
- A C++ I/O streams interface to the zlib gz* functions
-
-iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
- Another C++ I/O streams interface
-
-iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
- and Kevin Ruland <kevin@rodin.wustl.edu>
- Yet another C++ I/O streams interface
-
-masm686/ by Dan Higdon <hdan@kinesoft.com>
- and Chuck Walbourn <chuckw@kinesoft.com>
- asm code for Pentium Pro/PII, using the MASM syntax
-
-masmx64/ by Gilles Vollant <info@winimage.com>
- x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
- replace longest_match() and inflate_fast()
-
-masmx86/ by Gilles Vollant <info@winimage.com>
- x86 asm code to replace longest_match() and inflate_fast(),
- for Visual C++ and MASM
-
-minizip/ by Gilles Vollant <info@winimage.com>
- Mini zip and unzip based on zlib
- See http://www.winimage.com/zLibDll/unzip.html
-
-pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
- Support for Pascal
-
-puff/ by Mark Adler <madler@alumni.caltech.edu>
- Small, low memory usage inflate. Also serves to provide an
- unambiguous description of the deflate format.
-
-testzlib/ by Gilles Vollant <info@winimage.com>
- Example of the use of zlib
-
-untgz/ by Pedro A. Aranda Gutierrez <paag@tid.es>
- A very simple tar.gz file extractor using zlib
-
-vstudio/ by Gilles Vollant <info@winimage.com>
- Building a minizip-enhanced zlib with Microsoft Visual Studio
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/buffer_demo.adb b/funtools/util/zlib-1.2.3/contrib/ada/buffer_demo.adb
deleted file mode 100644
index 46b8638..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/buffer_demo.adb
+++ /dev/null
@@ -1,106 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
---
--- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
-
--- This demo program provided by Dr Steve Sangwine <sjs@essex.ac.uk>
---
--- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
--- of exactly the correct size is used for decompressed data, and the last
--- few bytes passed in to Zlib are checksum bytes.
-
--- This program compresses a string of text, and then decompresses the
--- compressed text into a buffer of the same size as the original text.
-
-with Ada.Streams; use Ada.Streams;
-with Ada.Text_IO;
-
-with ZLib; use ZLib;
-
-procedure Buffer_Demo is
- EOL : Character renames ASCII.LF;
- Text : constant String
- := "Four score and seven years ago our fathers brought forth," & EOL &
- "upon this continent, a new nation, conceived in liberty," & EOL &
- "and dedicated to the proposition that `all men are created equal'.";
-
- Source : Stream_Element_Array (1 .. Text'Length);
- for Source'Address use Text'Address;
-
-begin
- Ada.Text_IO.Put (Text);
- Ada.Text_IO.New_Line;
- Ada.Text_IO.Put_Line
- ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
-
- declare
- Compressed_Data : Stream_Element_Array (1 .. Text'Length);
- L : Stream_Element_Offset;
- begin
- Compress : declare
- Compressor : Filter_Type;
- I : Stream_Element_Offset;
- begin
- Deflate_Init (Compressor);
-
- -- Compress the whole of T at once.
-
- Translate (Compressor, Source, I, Compressed_Data, L, Finish);
- pragma Assert (I = Source'Last);
-
- Close (Compressor);
-
- Ada.Text_IO.Put_Line
- ("Compressed size : "
- & Stream_Element_Offset'Image (L) & " bytes");
- end Compress;
-
- -- Now we decompress the data, passing short blocks of data to Zlib
- -- (because this demonstrates the problem - the last block passed will
- -- contain checksum information and there will be no output, only a
- -- check inside Zlib that the checksum is correct).
-
- Decompress : declare
- Decompressor : Filter_Type;
-
- Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
-
- Block_Size : constant := 4;
- -- This makes sure that the last block contains
- -- only Adler checksum data.
-
- P : Stream_Element_Offset := Compressed_Data'First - 1;
- O : Stream_Element_Offset;
- begin
- Inflate_Init (Decompressor);
-
- loop
- Translate
- (Decompressor,
- Compressed_Data
- (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
- P,
- Uncompressed_Data
- (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
- O,
- No_Flush);
-
- Ada.Text_IO.Put_Line
- ("Total in : " & Count'Image (Total_In (Decompressor)) &
- ", out : " & Count'Image (Total_Out (Decompressor)));
-
- exit when P = L;
- end loop;
-
- Ada.Text_IO.New_Line;
- Ada.Text_IO.Put_Line
- ("Decompressed text matches original text : "
- & Boolean'Image (Uncompressed_Data = Source));
- end Decompress;
- end;
-end Buffer_Demo;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/mtest.adb b/funtools/util/zlib-1.2.3/contrib/ada/mtest.adb
deleted file mode 100644
index c4dfd08..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/mtest.adb
+++ /dev/null
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
--- Continuous test for ZLib multithreading. If the test would fail
--- we should provide thread safe allocation routines for the Z_Stream.
---
--- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
-
-with ZLib;
-with Ada.Streams;
-with Ada.Numerics.Discrete_Random;
-with Ada.Text_IO;
-with Ada.Exceptions;
-with Ada.Task_Identification;
-
-procedure MTest is
- use Ada.Streams;
- use ZLib;
-
- Stop : Boolean := False;
-
- pragma Atomic (Stop);
-
- subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
-
- package Random_Elements is
- new Ada.Numerics.Discrete_Random (Visible_Symbols);
-
- task type Test_Task;
-
- task body Test_Task is
- Buffer : Stream_Element_Array (1 .. 100_000);
- Gen : Random_Elements.Generator;
-
- Buffer_First : Stream_Element_Offset;
- Compare_First : Stream_Element_Offset;
-
- Deflate : Filter_Type;
- Inflate : Filter_Type;
-
- procedure Further (Item : in Stream_Element_Array);
-
- procedure Read_Buffer
- (Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset);
-
- -------------
- -- Further --
- -------------
-
- procedure Further (Item : in Stream_Element_Array) is
-
- procedure Compare (Item : in Stream_Element_Array);
-
- -------------
- -- Compare --
- -------------
-
- procedure Compare (Item : in Stream_Element_Array) is
- Next_First : Stream_Element_Offset := Compare_First + Item'Length;
- begin
- if Buffer (Compare_First .. Next_First - 1) /= Item then
- raise Program_Error;
- end if;
-
- Compare_First := Next_First;
- end Compare;
-
- procedure Compare_Write is new ZLib.Write (Write => Compare);
- begin
- Compare_Write (Inflate, Item, No_Flush);
- end Further;
-
- -----------------
- -- Read_Buffer --
- -----------------
-
- procedure Read_Buffer
- (Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset)
- is
- Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First;
- Next_First : Stream_Element_Offset;
- begin
- if Item'Length <= Buff_Diff then
- Last := Item'Last;
-
- Next_First := Buffer_First + Item'Length;
-
- Item := Buffer (Buffer_First .. Next_First - 1);
-
- Buffer_First := Next_First;
- else
- Last := Item'First + Buff_Diff;
- Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
- Buffer_First := Buffer'Last + 1;
- end if;
- end Read_Buffer;
-
- procedure Translate is new Generic_Translate
- (Data_In => Read_Buffer,
- Data_Out => Further);
-
- begin
- Random_Elements.Reset (Gen);
-
- Buffer := (others => 20);
-
- Main : loop
- for J in Buffer'Range loop
- Buffer (J) := Random_Elements.Random (Gen);
-
- Deflate_Init (Deflate);
- Inflate_Init (Inflate);
-
- Buffer_First := Buffer'First;
- Compare_First := Buffer'First;
-
- Translate (Deflate);
-
- if Compare_First /= Buffer'Last + 1 then
- raise Program_Error;
- end if;
-
- Ada.Text_IO.Put_Line
- (Ada.Task_Identification.Image
- (Ada.Task_Identification.Current_Task)
- & Stream_Element_Offset'Image (J)
- & ZLib.Count'Image (Total_Out (Deflate)));
-
- Close (Deflate);
- Close (Inflate);
-
- exit Main when Stop;
- end loop;
- end loop Main;
- exception
- when E : others =>
- Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
- Stop := True;
- end Test_Task;
-
- Test : array (1 .. 4) of Test_Task;
-
- pragma Unreferenced (Test);
-
- Dummy : Character;
-
-begin
- Ada.Text_IO.Get_Immediate (Dummy);
- Stop := True;
-end MTest;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/read.adb b/funtools/util/zlib-1.2.3/contrib/ada/read.adb
deleted file mode 100644
index 1f2efbf..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/read.adb
+++ /dev/null
@@ -1,156 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $
-
--- Test/demo program for the generic read interface.
-
-with Ada.Numerics.Discrete_Random;
-with Ada.Streams;
-with Ada.Text_IO;
-
-with ZLib;
-
-procedure Read is
-
- use Ada.Streams;
-
- ------------------------------------
- -- Test configuration parameters --
- ------------------------------------
-
- File_Size : Stream_Element_Offset := 100_000;
-
- Continuous : constant Boolean := False;
- -- If this constant is True, the test would be repeated again and again,
- -- with increment File_Size for every iteration.
-
- Header : constant ZLib.Header_Type := ZLib.Default;
- -- Do not use Header other than Default in ZLib versions 1.1.4 and older.
-
- Init_Random : constant := 8;
- -- We are using the same random sequence, in case of we catch bug,
- -- so we would be able to reproduce it.
-
- -- End --
-
- Pack_Size : Stream_Element_Offset;
- Offset : Stream_Element_Offset;
-
- Filter : ZLib.Filter_Type;
-
- subtype Visible_Symbols
- is Stream_Element range 16#20# .. 16#7E#;
-
- package Random_Elements is new
- Ada.Numerics.Discrete_Random (Visible_Symbols);
-
- Gen : Random_Elements.Generator;
- Period : constant Stream_Element_Offset := 200;
- -- Period constant variable for random generator not to be very random.
- -- Bigger period, harder random.
-
- Read_Buffer : Stream_Element_Array (1 .. 2048);
- Read_First : Stream_Element_Offset;
- Read_Last : Stream_Element_Offset;
-
- procedure Reset;
-
- procedure Read
- (Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset);
- -- this procedure is for generic instantiation of
- -- ZLib.Read
- -- reading data from the File_In.
-
- procedure Read is new ZLib.Read
- (Read,
- Read_Buffer,
- Rest_First => Read_First,
- Rest_Last => Read_Last);
-
- ----------
- -- Read --
- ----------
-
- procedure Read
- (Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset) is
- begin
- Last := Stream_Element_Offset'Min
- (Item'Last,
- Item'First + File_Size - Offset);
-
- for J in Item'First .. Last loop
- if J < Item'First + Period then
- Item (J) := Random_Elements.Random (Gen);
- else
- Item (J) := Item (J - Period);
- end if;
-
- Offset := Offset + 1;
- end loop;
- end Read;
-
- -----------
- -- Reset --
- -----------
-
- procedure Reset is
- begin
- Random_Elements.Reset (Gen, Init_Random);
- Pack_Size := 0;
- Offset := 1;
- Read_First := Read_Buffer'Last + 1;
- Read_Last := Read_Buffer'Last;
- end Reset;
-
-begin
- Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
-
- loop
- for Level in ZLib.Compression_Level'Range loop
-
- Ada.Text_IO.Put ("Level ="
- & ZLib.Compression_Level'Image (Level));
-
- -- Deflate using generic instantiation.
-
- ZLib.Deflate_Init
- (Filter,
- Level,
- Header => Header);
-
- Reset;
-
- Ada.Text_IO.Put
- (Stream_Element_Offset'Image (File_Size) & " ->");
-
- loop
- declare
- Buffer : Stream_Element_Array (1 .. 1024);
- Last : Stream_Element_Offset;
- begin
- Read (Filter, Buffer, Last);
-
- Pack_Size := Pack_Size + Last - Buffer'First + 1;
-
- exit when Last < Buffer'Last;
- end;
- end loop;
-
- Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size));
-
- ZLib.Close (Filter);
- end loop;
-
- exit when not Continuous;
-
- File_Size := File_Size + 1;
- end loop;
-end Read;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/readme.txt b/funtools/util/zlib-1.2.3/contrib/ada/readme.txt
deleted file mode 100644
index ce4d2ca..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/readme.txt
+++ /dev/null
@@ -1,65 +0,0 @@
- ZLib for Ada thick binding (ZLib.Ada)
- Release 1.3
-
-ZLib.Ada is a thick binding interface to the popular ZLib data
-compression library, available at http://www.gzip.org/zlib/.
-It provides Ada-style access to the ZLib C library.
-
-
- Here are the main changes since ZLib.Ada 1.2:
-
-- Attension: ZLib.Read generic routine have a initialization requirement
- for Read_Last parameter now. It is a bit incompartible with previous version,
- but extends functionality, we could use new parameters Allow_Read_Some and
- Flush now.
-
-- Added Is_Open routines to ZLib and ZLib.Streams packages.
-
-- Add pragma Assert to check Stream_Element is 8 bit.
-
-- Fix extraction to buffer with exact known decompressed size. Error reported by
- Steve Sangwine.
-
-- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits
- computers. Patch provided by Pascal Obry.
-
-- Add Status_Error exception definition.
-
-- Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit.
-
-
- How to build ZLib.Ada under GNAT
-
-You should have the ZLib library already build on your computer, before
-building ZLib.Ada. Make the directory of ZLib.Ada sources current and
-issue the command:
-
- gnatmake test -largs -L<directory where libz.a is> -lz
-
-Or use the GNAT project file build for GNAT 3.15 or later:
-
- gnatmake -Pzlib.gpr -L<directory where libz.a is>
-
-
- How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2
-
-1. Make a project with all *.ads and *.adb files from the distribution.
-2. Build the libz.a library from the ZLib C sources.
-3. Rename libz.a to z.lib.
-4. Add the library z.lib to the project.
-5. Add the libc.lib library from the ObjectAda distribution to the project.
-6. Build the executable using test.adb as a main procedure.
-
-
- How to use ZLib.Ada
-
-The source files test.adb and read.adb are small demo programs that show
-the main functionality of ZLib.Ada.
-
-The routines from the package specifications are commented.
-
-
-Homepage: http://zlib-ada.sourceforge.net/
-Author: Dmitriy Anisimkov <anisimkov@yahoo.com>
-
-Contributors: Pascal Obry <pascal@obry.org>, Steve Sangwine <sjs@essex.ac.uk>
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/test.adb b/funtools/util/zlib-1.2.3/contrib/ada/test.adb
deleted file mode 100644
index 90773ac..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/test.adb
+++ /dev/null
@@ -1,463 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $
-
--- The program has a few aims.
--- 1. Test ZLib.Ada95 thick binding functionality.
--- 2. Show the example of use main functionality of the ZLib.Ada95 binding.
--- 3. Build this program automatically compile all ZLib.Ada95 packages under
--- GNAT Ada95 compiler.
-
-with ZLib.Streams;
-with Ada.Streams.Stream_IO;
-with Ada.Numerics.Discrete_Random;
-
-with Ada.Text_IO;
-
-with Ada.Calendar;
-
-procedure Test is
-
- use Ada.Streams;
- use Stream_IO;
-
- ------------------------------------
- -- Test configuration parameters --
- ------------------------------------
-
- File_Size : Count := 100_000;
- Continuous : constant Boolean := False;
-
- Header : constant ZLib.Header_Type := ZLib.Default;
- -- ZLib.None;
- -- ZLib.Auto;
- -- ZLib.GZip;
- -- Do not use Header other then Default in ZLib versions 1.1.4
- -- and older.
-
- Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy;
- Init_Random : constant := 10;
-
- -- End --
-
- In_File_Name : constant String := "testzlib.in";
- -- Name of the input file
-
- Z_File_Name : constant String := "testzlib.zlb";
- -- Name of the compressed file.
-
- Out_File_Name : constant String := "testzlib.out";
- -- Name of the decompressed file.
-
- File_In : File_Type;
- File_Out : File_Type;
- File_Back : File_Type;
- File_Z : ZLib.Streams.Stream_Type;
-
- Filter : ZLib.Filter_Type;
-
- Time_Stamp : Ada.Calendar.Time;
-
- procedure Generate_File;
- -- Generate file of spetsified size with some random data.
- -- The random data is repeatable, for the good compression.
-
- procedure Compare_Streams
- (Left, Right : in out Root_Stream_Type'Class);
- -- The procedure compearing data in 2 streams.
- -- It is for compare data before and after compression/decompression.
-
- procedure Compare_Files (Left, Right : String);
- -- Compare files. Based on the Compare_Streams.
-
- procedure Copy_Streams
- (Source, Target : in out Root_Stream_Type'Class;
- Buffer_Size : in Stream_Element_Offset := 1024);
- -- Copying data from one stream to another. It is for test stream
- -- interface of the library.
-
- procedure Data_In
- (Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset);
- -- this procedure is for generic instantiation of
- -- ZLib.Generic_Translate.
- -- reading data from the File_In.
-
- procedure Data_Out (Item : in Stream_Element_Array);
- -- this procedure is for generic instantiation of
- -- ZLib.Generic_Translate.
- -- writing data to the File_Out.
-
- procedure Stamp;
- -- Store the timestamp to the local variable.
-
- procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count);
- -- Print the time statistic with the message.
-
- procedure Translate is new ZLib.Generic_Translate
- (Data_In => Data_In,
- Data_Out => Data_Out);
- -- This procedure is moving data from File_In to File_Out
- -- with compression or decompression, depend on initialization of
- -- Filter parameter.
-
- -------------------
- -- Compare_Files --
- -------------------
-
- procedure Compare_Files (Left, Right : String) is
- Left_File, Right_File : File_Type;
- begin
- Open (Left_File, In_File, Left);
- Open (Right_File, In_File, Right);
- Compare_Streams (Stream (Left_File).all, Stream (Right_File).all);
- Close (Left_File);
- Close (Right_File);
- end Compare_Files;
-
- ---------------------
- -- Compare_Streams --
- ---------------------
-
- procedure Compare_Streams
- (Left, Right : in out Ada.Streams.Root_Stream_Type'Class)
- is
- Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#);
- Left_Last, Right_Last : Stream_Element_Offset;
- begin
- loop
- Read (Left, Left_Buffer, Left_Last);
- Read (Right, Right_Buffer, Right_Last);
-
- if Left_Last /= Right_Last then
- Ada.Text_IO.Put_Line ("Compare error :"
- & Stream_Element_Offset'Image (Left_Last)
- & " /= "
- & Stream_Element_Offset'Image (Right_Last));
-
- raise Constraint_Error;
-
- elsif Left_Buffer (0 .. Left_Last)
- /= Right_Buffer (0 .. Right_Last)
- then
- Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal.");
- raise Constraint_Error;
-
- end if;
-
- exit when Left_Last < Left_Buffer'Last;
- end loop;
- end Compare_Streams;
-
- ------------------
- -- Copy_Streams --
- ------------------
-
- procedure Copy_Streams
- (Source, Target : in out Ada.Streams.Root_Stream_Type'Class;
- Buffer_Size : in Stream_Element_Offset := 1024)
- is
- Buffer : Stream_Element_Array (1 .. Buffer_Size);
- Last : Stream_Element_Offset;
- begin
- loop
- Read (Source, Buffer, Last);
- Write (Target, Buffer (1 .. Last));
-
- exit when Last < Buffer'Last;
- end loop;
- end Copy_Streams;
-
- -------------
- -- Data_In --
- -------------
-
- procedure Data_In
- (Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset) is
- begin
- Read (File_In, Item, Last);
- end Data_In;
-
- --------------
- -- Data_Out --
- --------------
-
- procedure Data_Out (Item : in Stream_Element_Array) is
- begin
- Write (File_Out, Item);
- end Data_Out;
-
- -------------------
- -- Generate_File --
- -------------------
-
- procedure Generate_File is
- subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
-
- package Random_Elements is
- new Ada.Numerics.Discrete_Random (Visible_Symbols);
-
- Gen : Random_Elements.Generator;
- Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10;
-
- Buffer_Count : constant Count := File_Size / Buffer'Length;
- -- Number of same buffers in the packet.
-
- Density : constant Count := 30; -- from 0 to Buffer'Length - 2;
-
- procedure Fill_Buffer (J, D : in Count);
- -- Change the part of the buffer.
-
- -----------------
- -- Fill_Buffer --
- -----------------
-
- procedure Fill_Buffer (J, D : in Count) is
- begin
- for K in 0 .. D loop
- Buffer
- (Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1))
- := Random_Elements.Random (Gen);
-
- end loop;
- end Fill_Buffer;
-
- begin
- Random_Elements.Reset (Gen, Init_Random);
-
- Create (File_In, Out_File, In_File_Name);
-
- Fill_Buffer (1, Buffer'Length - 2);
-
- for J in 1 .. Buffer_Count loop
- Write (File_In, Buffer);
-
- Fill_Buffer (J, Density);
- end loop;
-
- -- fill remain size.
-
- Write
- (File_In,
- Buffer
- (1 .. Stream_Element_Offset
- (File_Size - Buffer'Length * Buffer_Count)));
-
- Flush (File_In);
- Close (File_In);
- end Generate_File;
-
- ---------------------
- -- Print_Statistic --
- ---------------------
-
- procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is
- use Ada.Calendar;
- use Ada.Text_IO;
-
- package Count_IO is new Integer_IO (ZLib.Count);
-
- Curr_Dur : Duration := Clock - Time_Stamp;
- begin
- Put (Msg);
-
- Set_Col (20);
- Ada.Text_IO.Put ("size =");
-
- Count_IO.Put
- (Data_Size,
- Width => Stream_IO.Count'Image (File_Size)'Length);
-
- Put_Line (" duration =" & Duration'Image (Curr_Dur));
- end Print_Statistic;
-
- -----------
- -- Stamp --
- -----------
-
- procedure Stamp is
- begin
- Time_Stamp := Ada.Calendar.Clock;
- end Stamp;
-
-begin
- Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version);
-
- loop
- Generate_File;
-
- for Level in ZLib.Compression_Level'Range loop
-
- Ada.Text_IO.Put_Line ("Level ="
- & ZLib.Compression_Level'Image (Level));
-
- -- Test generic interface.
- Open (File_In, In_File, In_File_Name);
- Create (File_Out, Out_File, Z_File_Name);
-
- Stamp;
-
- -- Deflate using generic instantiation.
-
- ZLib.Deflate_Init
- (Filter => Filter,
- Level => Level,
- Strategy => Strategy,
- Header => Header);
-
- Translate (Filter);
- Print_Statistic ("Generic compress", ZLib.Total_Out (Filter));
- ZLib.Close (Filter);
-
- Close (File_In);
- Close (File_Out);
-
- Open (File_In, In_File, Z_File_Name);
- Create (File_Out, Out_File, Out_File_Name);
-
- Stamp;
-
- -- Inflate using generic instantiation.
-
- ZLib.Inflate_Init (Filter, Header => Header);
-
- Translate (Filter);
- Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter));
-
- ZLib.Close (Filter);
-
- Close (File_In);
- Close (File_Out);
-
- Compare_Files (In_File_Name, Out_File_Name);
-
- -- Test stream interface.
-
- -- Compress to the back stream.
-
- Open (File_In, In_File, In_File_Name);
- Create (File_Back, Out_File, Z_File_Name);
-
- Stamp;
-
- ZLib.Streams.Create
- (Stream => File_Z,
- Mode => ZLib.Streams.Out_Stream,
- Back => ZLib.Streams.Stream_Access
- (Stream (File_Back)),
- Back_Compressed => True,
- Level => Level,
- Strategy => Strategy,
- Header => Header);
-
- Copy_Streams
- (Source => Stream (File_In).all,
- Target => File_Z);
-
- -- Flushing internal buffers to the back stream.
-
- ZLib.Streams.Flush (File_Z, ZLib.Finish);
-
- Print_Statistic ("Write compress",
- ZLib.Streams.Write_Total_Out (File_Z));
-
- ZLib.Streams.Close (File_Z);
-
- Close (File_In);
- Close (File_Back);
-
- -- Compare reading from original file and from
- -- decompression stream.
-
- Open (File_In, In_File, In_File_Name);
- Open (File_Back, In_File, Z_File_Name);
-
- ZLib.Streams.Create
- (Stream => File_Z,
- Mode => ZLib.Streams.In_Stream,
- Back => ZLib.Streams.Stream_Access
- (Stream (File_Back)),
- Back_Compressed => True,
- Header => Header);
-
- Stamp;
- Compare_Streams (Stream (File_In).all, File_Z);
-
- Print_Statistic ("Read decompress",
- ZLib.Streams.Read_Total_Out (File_Z));
-
- ZLib.Streams.Close (File_Z);
- Close (File_In);
- Close (File_Back);
-
- -- Compress by reading from compression stream.
-
- Open (File_Back, In_File, In_File_Name);
- Create (File_Out, Out_File, Z_File_Name);
-
- ZLib.Streams.Create
- (Stream => File_Z,
- Mode => ZLib.Streams.In_Stream,
- Back => ZLib.Streams.Stream_Access
- (Stream (File_Back)),
- Back_Compressed => False,
- Level => Level,
- Strategy => Strategy,
- Header => Header);
-
- Stamp;
- Copy_Streams
- (Source => File_Z,
- Target => Stream (File_Out).all);
-
- Print_Statistic ("Read compress",
- ZLib.Streams.Read_Total_Out (File_Z));
-
- ZLib.Streams.Close (File_Z);
-
- Close (File_Out);
- Close (File_Back);
-
- -- Decompress to decompression stream.
-
- Open (File_In, In_File, Z_File_Name);
- Create (File_Back, Out_File, Out_File_Name);
-
- ZLib.Streams.Create
- (Stream => File_Z,
- Mode => ZLib.Streams.Out_Stream,
- Back => ZLib.Streams.Stream_Access
- (Stream (File_Back)),
- Back_Compressed => False,
- Header => Header);
-
- Stamp;
-
- Copy_Streams
- (Source => Stream (File_In).all,
- Target => File_Z);
-
- Print_Statistic ("Write decompress",
- ZLib.Streams.Write_Total_Out (File_Z));
-
- ZLib.Streams.Close (File_Z);
- Close (File_In);
- Close (File_Back);
-
- Compare_Files (In_File_Name, Out_File_Name);
- end loop;
-
- Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok.");
-
- exit when not Continuous;
-
- File_Size := File_Size + 1;
- end loop;
-end Test;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.adb b/funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.adb
deleted file mode 100644
index b6497ba..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.adb
+++ /dev/null
@@ -1,225 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $
-
-with Ada.Unchecked_Deallocation;
-
-package body ZLib.Streams is
-
- -----------
- -- Close --
- -----------
-
- procedure Close (Stream : in out Stream_Type) is
- procedure Free is new Ada.Unchecked_Deallocation
- (Stream_Element_Array, Buffer_Access);
- begin
- if Stream.Mode = Out_Stream or Stream.Mode = Duplex then
- -- We should flush the data written by the writer.
-
- Flush (Stream, Finish);
-
- Close (Stream.Writer);
- end if;
-
- if Stream.Mode = In_Stream or Stream.Mode = Duplex then
- Close (Stream.Reader);
- Free (Stream.Buffer);
- end if;
- end Close;
-
- ------------
- -- Create --
- ------------
-
- procedure Create
- (Stream : out Stream_Type;
- Mode : in Stream_Mode;
- Back : in Stream_Access;
- Back_Compressed : in Boolean;
- Level : in Compression_Level := Default_Compression;
- Strategy : in Strategy_Type := Default_Strategy;
- Header : in Header_Type := Default;
- Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
- := Default_Buffer_Size;
- Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
- := Default_Buffer_Size)
- is
-
- subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size);
-
- procedure Init_Filter
- (Filter : in out Filter_Type;
- Compress : in Boolean);
-
- -----------------
- -- Init_Filter --
- -----------------
-
- procedure Init_Filter
- (Filter : in out Filter_Type;
- Compress : in Boolean) is
- begin
- if Compress then
- Deflate_Init
- (Filter, Level, Strategy, Header => Header);
- else
- Inflate_Init (Filter, Header => Header);
- end if;
- end Init_Filter;
-
- begin
- Stream.Back := Back;
- Stream.Mode := Mode;
-
- if Mode = Out_Stream or Mode = Duplex then
- Init_Filter (Stream.Writer, Back_Compressed);
- Stream.Buffer_Size := Write_Buffer_Size;
- else
- Stream.Buffer_Size := 0;
- end if;
-
- if Mode = In_Stream or Mode = Duplex then
- Init_Filter (Stream.Reader, not Back_Compressed);
-
- Stream.Buffer := new Buffer_Subtype;
- Stream.Rest_First := Stream.Buffer'Last + 1;
- Stream.Rest_Last := Stream.Buffer'Last;
- end if;
- end Create;
-
- -----------
- -- Flush --
- -----------
-
- procedure Flush
- (Stream : in out Stream_Type;
- Mode : in Flush_Mode := Sync_Flush)
- is
- Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size);
- Last : Stream_Element_Offset;
- begin
- loop
- Flush (Stream.Writer, Buffer, Last, Mode);
-
- Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
-
- exit when Last < Buffer'Last;
- end loop;
- end Flush;
-
- -------------
- -- Is_Open --
- -------------
-
- function Is_Open (Stream : Stream_Type) return Boolean is
- begin
- return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer);
- end Is_Open;
-
- ----------
- -- Read --
- ----------
-
- procedure Read
- (Stream : in out Stream_Type;
- Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset)
- is
-
- procedure Read
- (Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset);
-
- ----------
- -- Read --
- ----------
-
- procedure Read
- (Item : out Stream_Element_Array;
- Last : out Stream_Element_Offset) is
- begin
- Ada.Streams.Read (Stream.Back.all, Item, Last);
- end Read;
-
- procedure Read is new ZLib.Read
- (Read => Read,
- Buffer => Stream.Buffer.all,
- Rest_First => Stream.Rest_First,
- Rest_Last => Stream.Rest_Last);
-
- begin
- Read (Stream.Reader, Item, Last);
- end Read;
-
- -------------------
- -- Read_Total_In --
- -------------------
-
- function Read_Total_In (Stream : in Stream_Type) return Count is
- begin
- return Total_In (Stream.Reader);
- end Read_Total_In;
-
- --------------------
- -- Read_Total_Out --
- --------------------
-
- function Read_Total_Out (Stream : in Stream_Type) return Count is
- begin
- return Total_Out (Stream.Reader);
- end Read_Total_Out;
-
- -----------
- -- Write --
- -----------
-
- procedure Write
- (Stream : in out Stream_Type;
- Item : in Stream_Element_Array)
- is
-
- procedure Write (Item : in Stream_Element_Array);
-
- -----------
- -- Write --
- -----------
-
- procedure Write (Item : in Stream_Element_Array) is
- begin
- Ada.Streams.Write (Stream.Back.all, Item);
- end Write;
-
- procedure Write is new ZLib.Write
- (Write => Write,
- Buffer_Size => Stream.Buffer_Size);
-
- begin
- Write (Stream.Writer, Item, No_Flush);
- end Write;
-
- --------------------
- -- Write_Total_In --
- --------------------
-
- function Write_Total_In (Stream : in Stream_Type) return Count is
- begin
- return Total_In (Stream.Writer);
- end Write_Total_In;
-
- ---------------------
- -- Write_Total_Out --
- ---------------------
-
- function Write_Total_Out (Stream : in Stream_Type) return Count is
- begin
- return Total_Out (Stream.Writer);
- end Write_Total_Out;
-
-end ZLib.Streams;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.ads b/funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.ads
deleted file mode 100644
index f0193c6..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib-streams.ads
+++ /dev/null
@@ -1,114 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
-
-package ZLib.Streams is
-
- type Stream_Mode is (In_Stream, Out_Stream, Duplex);
-
- type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
-
- type Stream_Type is
- new Ada.Streams.Root_Stream_Type with private;
-
- procedure Read
- (Stream : in out Stream_Type;
- Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset);
-
- procedure Write
- (Stream : in out Stream_Type;
- Item : in Ada.Streams.Stream_Element_Array);
-
- procedure Flush
- (Stream : in out Stream_Type;
- Mode : in Flush_Mode := Sync_Flush);
- -- Flush the written data to the back stream,
- -- all data placed to the compressor is flushing to the Back stream.
- -- Should not be used untill necessary, becouse it is decreasing
- -- compression.
-
- function Read_Total_In (Stream : in Stream_Type) return Count;
- pragma Inline (Read_Total_In);
- -- Return total number of bytes read from back stream so far.
-
- function Read_Total_Out (Stream : in Stream_Type) return Count;
- pragma Inline (Read_Total_Out);
- -- Return total number of bytes read so far.
-
- function Write_Total_In (Stream : in Stream_Type) return Count;
- pragma Inline (Write_Total_In);
- -- Return total number of bytes written so far.
-
- function Write_Total_Out (Stream : in Stream_Type) return Count;
- pragma Inline (Write_Total_Out);
- -- Return total number of bytes written to the back stream.
-
- procedure Create
- (Stream : out Stream_Type;
- Mode : in Stream_Mode;
- Back : in Stream_Access;
- Back_Compressed : in Boolean;
- Level : in Compression_Level := Default_Compression;
- Strategy : in Strategy_Type := Default_Strategy;
- Header : in Header_Type := Default;
- Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
- := Default_Buffer_Size;
- Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
- := Default_Buffer_Size);
- -- Create the Comression/Decompression stream.
- -- If mode is In_Stream then Write operation is disabled.
- -- If mode is Out_Stream then Read operation is disabled.
-
- -- If Back_Compressed is true then
- -- Data written to the Stream is compressing to the Back stream
- -- and data read from the Stream is decompressed data from the Back stream.
-
- -- If Back_Compressed is false then
- -- Data written to the Stream is decompressing to the Back stream
- -- and data read from the Stream is compressed data from the Back stream.
-
- -- !!! When the Need_Header is False ZLib-Ada is using undocumented
- -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
-
- function Is_Open (Stream : Stream_Type) return Boolean;
-
- procedure Close (Stream : in out Stream_Type);
-
-private
-
- use Ada.Streams;
-
- type Buffer_Access is access all Stream_Element_Array;
-
- type Stream_Type
- is new Root_Stream_Type with
- record
- Mode : Stream_Mode;
-
- Buffer : Buffer_Access;
- Rest_First : Stream_Element_Offset;
- Rest_Last : Stream_Element_Offset;
- -- Buffer for Read operation.
- -- We need to have this buffer in the record
- -- becouse not all read data from back stream
- -- could be processed during the read operation.
-
- Buffer_Size : Stream_Element_Offset;
- -- Buffer size for write operation.
- -- We do not need to have this buffer
- -- in the record becouse all data could be
- -- processed in the write operation.
-
- Back : Stream_Access;
- Reader : Filter_Type;
- Writer : Filter_Type;
- end record;
-
-end ZLib.Streams;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.adb b/funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.adb
deleted file mode 100644
index 0ca4a71..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.adb
+++ /dev/null
@@ -1,141 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
-
-package body ZLib.Thin is
-
- ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
-
- Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
-
- --------------
- -- Avail_In --
- --------------
-
- function Avail_In (Strm : in Z_Stream) return UInt is
- begin
- return Strm.Avail_In;
- end Avail_In;
-
- ---------------
- -- Avail_Out --
- ---------------
-
- function Avail_Out (Strm : in Z_Stream) return UInt is
- begin
- return Strm.Avail_Out;
- end Avail_Out;
-
- ------------------
- -- Deflate_Init --
- ------------------
-
- function Deflate_Init
- (strm : Z_Streamp;
- level : Int;
- method : Int;
- windowBits : Int;
- memLevel : Int;
- strategy : Int)
- return Int is
- begin
- return deflateInit2
- (strm,
- level,
- method,
- windowBits,
- memLevel,
- strategy,
- ZLIB_VERSION,
- Z_Stream_Size);
- end Deflate_Init;
-
- ------------------
- -- Inflate_Init --
- ------------------
-
- function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
- begin
- return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
- end Inflate_Init;
-
- ------------------------
- -- Last_Error_Message --
- ------------------------
-
- function Last_Error_Message (Strm : in Z_Stream) return String is
- use Interfaces.C.Strings;
- begin
- if Strm.msg = Null_Ptr then
- return "";
- else
- return Value (Strm.msg);
- end if;
- end Last_Error_Message;
-
- ------------
- -- Set_In --
- ------------
-
- procedure Set_In
- (Strm : in out Z_Stream;
- Buffer : in Voidp;
- Size : in UInt) is
- begin
- Strm.Next_In := Buffer;
- Strm.Avail_In := Size;
- end Set_In;
-
- ------------------
- -- Set_Mem_Func --
- ------------------
-
- procedure Set_Mem_Func
- (Strm : in out Z_Stream;
- Opaque : in Voidp;
- Alloc : in alloc_func;
- Free : in free_func) is
- begin
- Strm.opaque := Opaque;
- Strm.zalloc := Alloc;
- Strm.zfree := Free;
- end Set_Mem_Func;
-
- -------------
- -- Set_Out --
- -------------
-
- procedure Set_Out
- (Strm : in out Z_Stream;
- Buffer : in Voidp;
- Size : in UInt) is
- begin
- Strm.Next_Out := Buffer;
- Strm.Avail_Out := Size;
- end Set_Out;
-
- --------------
- -- Total_In --
- --------------
-
- function Total_In (Strm : in Z_Stream) return ULong is
- begin
- return Strm.Total_In;
- end Total_In;
-
- ---------------
- -- Total_Out --
- ---------------
-
- function Total_Out (Strm : in Z_Stream) return ULong is
- begin
- return Strm.Total_Out;
- end Total_Out;
-
-end ZLib.Thin;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.ads b/funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.ads
deleted file mode 100644
index d4407eb..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib-thin.ads
+++ /dev/null
@@ -1,450 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2003 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $
-
-with Interfaces.C.Strings;
-
-with System;
-
-private package ZLib.Thin is
-
- -- From zconf.h
-
- MAX_MEM_LEVEL : constant := 9; -- zconf.h:105
- -- zconf.h:105
- MAX_WBITS : constant := 15; -- zconf.h:115
- -- 32K LZ77 window
- -- zconf.h:115
- SEEK_SET : constant := 8#0000#; -- zconf.h:244
- -- Seek from beginning of file.
- -- zconf.h:244
- SEEK_CUR : constant := 1; -- zconf.h:245
- -- Seek from current position.
- -- zconf.h:245
- SEEK_END : constant := 2; -- zconf.h:246
- -- Set file pointer to EOF plus "offset"
- -- zconf.h:246
-
- type Byte is new Interfaces.C.unsigned_char; -- 8 bits
- -- zconf.h:214
- type UInt is new Interfaces.C.unsigned; -- 16 bits or more
- -- zconf.h:216
- type Int is new Interfaces.C.int;
-
- type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more
- -- zconf.h:217
- subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr;
-
- type ULong_Access is access ULong;
- type Int_Access is access Int;
-
- subtype Voidp is System.Address; -- zconf.h:232
-
- subtype Byte_Access is Voidp;
-
- Nul : constant Voidp := System.Null_Address;
- -- end from zconf
-
- Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125
- -- zlib.h:125
- Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126
- -- will be removed, use
- -- Z_SYNC_FLUSH instead
- -- zlib.h:126
- Z_SYNC_FLUSH : constant := 2; -- zlib.h:127
- -- zlib.h:127
- Z_FULL_FLUSH : constant := 3; -- zlib.h:128
- -- zlib.h:128
- Z_FINISH : constant := 4; -- zlib.h:129
- -- zlib.h:129
- Z_OK : constant := 8#0000#; -- zlib.h:132
- -- zlib.h:132
- Z_STREAM_END : constant := 1; -- zlib.h:133
- -- zlib.h:133
- Z_NEED_DICT : constant := 2; -- zlib.h:134
- -- zlib.h:134
- Z_ERRNO : constant := -1; -- zlib.h:135
- -- zlib.h:135
- Z_STREAM_ERROR : constant := -2; -- zlib.h:136
- -- zlib.h:136
- Z_DATA_ERROR : constant := -3; -- zlib.h:137
- -- zlib.h:137
- Z_MEM_ERROR : constant := -4; -- zlib.h:138
- -- zlib.h:138
- Z_BUF_ERROR : constant := -5; -- zlib.h:139
- -- zlib.h:139
- Z_VERSION_ERROR : constant := -6; -- zlib.h:140
- -- zlib.h:140
- Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145
- -- zlib.h:145
- Z_BEST_SPEED : constant := 1; -- zlib.h:146
- -- zlib.h:146
- Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147
- -- zlib.h:147
- Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148
- -- zlib.h:148
- Z_FILTERED : constant := 1; -- zlib.h:151
- -- zlib.h:151
- Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152
- -- zlib.h:152
- Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153
- -- zlib.h:153
- Z_BINARY : constant := 8#0000#; -- zlib.h:156
- -- zlib.h:156
- Z_ASCII : constant := 1; -- zlib.h:157
- -- zlib.h:157
- Z_UNKNOWN : constant := 2; -- zlib.h:158
- -- zlib.h:158
- Z_DEFLATED : constant := 8; -- zlib.h:161
- -- zlib.h:161
- Z_NULL : constant := 8#0000#; -- zlib.h:164
- -- for initializing zalloc, zfree, opaque
- -- zlib.h:164
- type gzFile is new Voidp; -- zlib.h:646
-
- type Z_Stream is private;
-
- type Z_Streamp is access all Z_Stream; -- zlib.h:89
-
- type alloc_func is access function
- (Opaque : Voidp;
- Items : UInt;
- Size : UInt)
- return Voidp; -- zlib.h:63
-
- type free_func is access procedure (opaque : Voidp; address : Voidp);
-
- function zlibVersion return Chars_Ptr;
-
- function Deflate (strm : Z_Streamp; flush : Int) return Int;
-
- function DeflateEnd (strm : Z_Streamp) return Int;
-
- function Inflate (strm : Z_Streamp; flush : Int) return Int;
-
- function InflateEnd (strm : Z_Streamp) return Int;
-
- function deflateSetDictionary
- (strm : Z_Streamp;
- dictionary : Byte_Access;
- dictLength : UInt)
- return Int;
-
- function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int;
- -- zlib.h:478
-
- function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495
-
- function deflateParams
- (strm : Z_Streamp;
- level : Int;
- strategy : Int)
- return Int; -- zlib.h:506
-
- function inflateSetDictionary
- (strm : Z_Streamp;
- dictionary : Byte_Access;
- dictLength : UInt)
- return Int; -- zlib.h:548
-
- function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565
-
- function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580
-
- function compress
- (dest : Byte_Access;
- destLen : ULong_Access;
- source : Byte_Access;
- sourceLen : ULong)
- return Int; -- zlib.h:601
-
- function compress2
- (dest : Byte_Access;
- destLen : ULong_Access;
- source : Byte_Access;
- sourceLen : ULong;
- level : Int)
- return Int; -- zlib.h:615
-
- function uncompress
- (dest : Byte_Access;
- destLen : ULong_Access;
- source : Byte_Access;
- sourceLen : ULong)
- return Int;
-
- function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile;
-
- function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile;
-
- function gzsetparams
- (file : gzFile;
- level : Int;
- strategy : Int)
- return Int;
-
- function gzread
- (file : gzFile;
- buf : Voidp;
- len : UInt)
- return Int;
-
- function gzwrite
- (file : in gzFile;
- buf : in Voidp;
- len : in UInt)
- return Int;
-
- function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int;
-
- function gzputs (file : in gzFile; s : in Chars_Ptr) return Int;
-
- function gzgets
- (file : gzFile;
- buf : Chars_Ptr;
- len : Int)
- return Chars_Ptr;
-
- function gzputc (file : gzFile; char : Int) return Int;
-
- function gzgetc (file : gzFile) return Int;
-
- function gzflush (file : gzFile; flush : Int) return Int;
-
- function gzseek
- (file : gzFile;
- offset : Int;
- whence : Int)
- return Int;
-
- function gzrewind (file : gzFile) return Int;
-
- function gztell (file : gzFile) return Int;
-
- function gzeof (file : gzFile) return Int;
-
- function gzclose (file : gzFile) return Int;
-
- function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr;
-
- function adler32
- (adler : ULong;
- buf : Byte_Access;
- len : UInt)
- return ULong;
-
- function crc32
- (crc : ULong;
- buf : Byte_Access;
- len : UInt)
- return ULong;
-
- function deflateInit
- (strm : Z_Streamp;
- level : Int;
- version : Chars_Ptr;
- stream_size : Int)
- return Int;
-
- function deflateInit2
- (strm : Z_Streamp;
- level : Int;
- method : Int;
- windowBits : Int;
- memLevel : Int;
- strategy : Int;
- version : Chars_Ptr;
- stream_size : Int)
- return Int;
-
- function Deflate_Init
- (strm : Z_Streamp;
- level : Int;
- method : Int;
- windowBits : Int;
- memLevel : Int;
- strategy : Int)
- return Int;
- pragma Inline (Deflate_Init);
-
- function inflateInit
- (strm : Z_Streamp;
- version : Chars_Ptr;
- stream_size : Int)
- return Int;
-
- function inflateInit2
- (strm : in Z_Streamp;
- windowBits : in Int;
- version : in Chars_Ptr;
- stream_size : in Int)
- return Int;
-
- function inflateBackInit
- (strm : in Z_Streamp;
- windowBits : in Int;
- window : in Byte_Access;
- version : in Chars_Ptr;
- stream_size : in Int)
- return Int;
- -- Size of window have to be 2**windowBits.
-
- function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int;
- pragma Inline (Inflate_Init);
-
- function zError (err : Int) return Chars_Ptr;
-
- function inflateSyncPoint (z : Z_Streamp) return Int;
-
- function get_crc_table return ULong_Access;
-
- -- Interface to the available fields of the z_stream structure.
- -- The application must update next_in and avail_in when avail_in has
- -- dropped to zero. It must update next_out and avail_out when avail_out
- -- has dropped to zero. The application must initialize zalloc, zfree and
- -- opaque before calling the init function.
-
- procedure Set_In
- (Strm : in out Z_Stream;
- Buffer : in Voidp;
- Size : in UInt);
- pragma Inline (Set_In);
-
- procedure Set_Out
- (Strm : in out Z_Stream;
- Buffer : in Voidp;
- Size : in UInt);
- pragma Inline (Set_Out);
-
- procedure Set_Mem_Func
- (Strm : in out Z_Stream;
- Opaque : in Voidp;
- Alloc : in alloc_func;
- Free : in free_func);
- pragma Inline (Set_Mem_Func);
-
- function Last_Error_Message (Strm : in Z_Stream) return String;
- pragma Inline (Last_Error_Message);
-
- function Avail_Out (Strm : in Z_Stream) return UInt;
- pragma Inline (Avail_Out);
-
- function Avail_In (Strm : in Z_Stream) return UInt;
- pragma Inline (Avail_In);
-
- function Total_In (Strm : in Z_Stream) return ULong;
- pragma Inline (Total_In);
-
- function Total_Out (Strm : in Z_Stream) return ULong;
- pragma Inline (Total_Out);
-
- function inflateCopy
- (dest : in Z_Streamp;
- Source : in Z_Streamp)
- return Int;
-
- function compressBound (Source_Len : in ULong) return ULong;
-
- function deflateBound
- (Strm : in Z_Streamp;
- Source_Len : in ULong)
- return ULong;
-
- function gzungetc (C : in Int; File : in gzFile) return Int;
-
- function zlibCompileFlags return ULong;
-
-private
-
- type Z_Stream is record -- zlib.h:68
- Next_In : Voidp := Nul; -- next input byte
- Avail_In : UInt := 0; -- number of bytes available at next_in
- Total_In : ULong := 0; -- total nb of input bytes read so far
- Next_Out : Voidp := Nul; -- next output byte should be put there
- Avail_Out : UInt := 0; -- remaining free space at next_out
- Total_Out : ULong := 0; -- total nb of bytes output so far
- msg : Chars_Ptr; -- last error message, NULL if no error
- state : Voidp; -- not visible by applications
- zalloc : alloc_func := null; -- used to allocate the internal state
- zfree : free_func := null; -- used to free the internal state
- opaque : Voidp; -- private data object passed to
- -- zalloc and zfree
- data_type : Int; -- best guess about the data type:
- -- ascii or binary
- adler : ULong; -- adler32 value of the uncompressed
- -- data
- reserved : ULong; -- reserved for future use
- end record;
-
- pragma Convention (C, Z_Stream);
-
- pragma Import (C, zlibVersion, "zlibVersion");
- pragma Import (C, Deflate, "deflate");
- pragma Import (C, DeflateEnd, "deflateEnd");
- pragma Import (C, Inflate, "inflate");
- pragma Import (C, InflateEnd, "inflateEnd");
- pragma Import (C, deflateSetDictionary, "deflateSetDictionary");
- pragma Import (C, deflateCopy, "deflateCopy");
- pragma Import (C, deflateReset, "deflateReset");
- pragma Import (C, deflateParams, "deflateParams");
- pragma Import (C, inflateSetDictionary, "inflateSetDictionary");
- pragma Import (C, inflateSync, "inflateSync");
- pragma Import (C, inflateReset, "inflateReset");
- pragma Import (C, compress, "compress");
- pragma Import (C, compress2, "compress2");
- pragma Import (C, uncompress, "uncompress");
- pragma Import (C, gzopen, "gzopen");
- pragma Import (C, gzdopen, "gzdopen");
- pragma Import (C, gzsetparams, "gzsetparams");
- pragma Import (C, gzread, "gzread");
- pragma Import (C, gzwrite, "gzwrite");
- pragma Import (C, gzprintf, "gzprintf");
- pragma Import (C, gzputs, "gzputs");
- pragma Import (C, gzgets, "gzgets");
- pragma Import (C, gzputc, "gzputc");
- pragma Import (C, gzgetc, "gzgetc");
- pragma Import (C, gzflush, "gzflush");
- pragma Import (C, gzseek, "gzseek");
- pragma Import (C, gzrewind, "gzrewind");
- pragma Import (C, gztell, "gztell");
- pragma Import (C, gzeof, "gzeof");
- pragma Import (C, gzclose, "gzclose");
- pragma Import (C, gzerror, "gzerror");
- pragma Import (C, adler32, "adler32");
- pragma Import (C, crc32, "crc32");
- pragma Import (C, deflateInit, "deflateInit_");
- pragma Import (C, inflateInit, "inflateInit_");
- pragma Import (C, deflateInit2, "deflateInit2_");
- pragma Import (C, inflateInit2, "inflateInit2_");
- pragma Import (C, zError, "zError");
- pragma Import (C, inflateSyncPoint, "inflateSyncPoint");
- pragma Import (C, get_crc_table, "get_crc_table");
-
- -- since zlib 1.2.0:
-
- pragma Import (C, inflateCopy, "inflateCopy");
- pragma Import (C, compressBound, "compressBound");
- pragma Import (C, deflateBound, "deflateBound");
- pragma Import (C, gzungetc, "gzungetc");
- pragma Import (C, zlibCompileFlags, "zlibCompileFlags");
-
- pragma Import (C, inflateBackInit, "inflateBackInit_");
-
- -- I stopped binding the inflateBack routines, becouse realize that
- -- it does not support zlib and gzip headers for now, and have no
- -- symmetric deflateBack routines.
- -- ZLib-Ada is symmetric regarding deflate/inflate data transformation
- -- and has a similar generic callback interface for the
- -- deflate/inflate transformation based on the regular Deflate/Inflate
- -- routines.
-
- -- pragma Import (C, inflateBack, "inflateBack");
- -- pragma Import (C, inflateBackEnd, "inflateBackEnd");
-
-end ZLib.Thin;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib.adb b/funtools/util/zlib-1.2.3/contrib/ada/zlib.adb
deleted file mode 100644
index 8b6fd68..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib.adb
+++ /dev/null
@@ -1,701 +0,0 @@
-----------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- Open source license information is in the zlib.ads file. --
-----------------------------------------------------------------
-
--- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $
-
-with Ada.Exceptions;
-with Ada.Unchecked_Conversion;
-with Ada.Unchecked_Deallocation;
-
-with Interfaces.C.Strings;
-
-with ZLib.Thin;
-
-package body ZLib is
-
- use type Thin.Int;
-
- type Z_Stream is new Thin.Z_Stream;
-
- type Return_Code_Enum is
- (OK,
- STREAM_END,
- NEED_DICT,
- ERRNO,
- STREAM_ERROR,
- DATA_ERROR,
- MEM_ERROR,
- BUF_ERROR,
- VERSION_ERROR);
-
- type Flate_Step_Function is access
- function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int;
- pragma Convention (C, Flate_Step_Function);
-
- type Flate_End_Function is access
- function (Ctrm : in Thin.Z_Streamp) return Thin.Int;
- pragma Convention (C, Flate_End_Function);
-
- type Flate_Type is record
- Step : Flate_Step_Function;
- Done : Flate_End_Function;
- end record;
-
- subtype Footer_Array is Stream_Element_Array (1 .. 8);
-
- Simple_GZip_Header : constant Stream_Element_Array (1 .. 10)
- := (16#1f#, 16#8b#, -- Magic header
- 16#08#, -- Z_DEFLATED
- 16#00#, -- Flags
- 16#00#, 16#00#, 16#00#, 16#00#, -- Time
- 16#00#, -- XFlags
- 16#03# -- OS code
- );
- -- The simplest gzip header is not for informational, but just for
- -- gzip format compatibility.
- -- Note that some code below is using assumption
- -- Simple_GZip_Header'Last > Footer_Array'Last, so do not make
- -- Simple_GZip_Header'Last <= Footer_Array'Last.
-
- Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum
- := (0 => OK,
- 1 => STREAM_END,
- 2 => NEED_DICT,
- -1 => ERRNO,
- -2 => STREAM_ERROR,
- -3 => DATA_ERROR,
- -4 => MEM_ERROR,
- -5 => BUF_ERROR,
- -6 => VERSION_ERROR);
-
- Flate : constant array (Boolean) of Flate_Type
- := (True => (Step => Thin.Deflate'Access,
- Done => Thin.DeflateEnd'Access),
- False => (Step => Thin.Inflate'Access,
- Done => Thin.InflateEnd'Access));
-
- Flush_Finish : constant array (Boolean) of Flush_Mode
- := (True => Finish, False => No_Flush);
-
- procedure Raise_Error (Stream : in Z_Stream);
- pragma Inline (Raise_Error);
-
- procedure Raise_Error (Message : in String);
- pragma Inline (Raise_Error);
-
- procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int);
-
- procedure Free is new Ada.Unchecked_Deallocation
- (Z_Stream, Z_Stream_Access);
-
- function To_Thin_Access is new Ada.Unchecked_Conversion
- (Z_Stream_Access, Thin.Z_Streamp);
-
- procedure Translate_GZip
- (Filter : in out Filter_Type;
- In_Data : in Ada.Streams.Stream_Element_Array;
- In_Last : out Ada.Streams.Stream_Element_Offset;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode);
- -- Separate translate routine for make gzip header.
-
- procedure Translate_Auto
- (Filter : in out Filter_Type;
- In_Data : in Ada.Streams.Stream_Element_Array;
- In_Last : out Ada.Streams.Stream_Element_Offset;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode);
- -- translate routine without additional headers.
-
- -----------------
- -- Check_Error --
- -----------------
-
- procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is
- use type Thin.Int;
- begin
- if Code /= Thin.Z_OK then
- Raise_Error
- (Return_Code_Enum'Image (Return_Code (Code))
- & ": " & Last_Error_Message (Stream));
- end if;
- end Check_Error;
-
- -----------
- -- Close --
- -----------
-
- procedure Close
- (Filter : in out Filter_Type;
- Ignore_Error : in Boolean := False)
- is
- Code : Thin.Int;
- begin
- if not Ignore_Error and then not Is_Open (Filter) then
- raise Status_Error;
- end if;
-
- Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm));
-
- if Ignore_Error or else Code = Thin.Z_OK then
- Free (Filter.Strm);
- else
- declare
- Error_Message : constant String
- := Last_Error_Message (Filter.Strm.all);
- begin
- Free (Filter.Strm);
- Ada.Exceptions.Raise_Exception
- (ZLib_Error'Identity,
- Return_Code_Enum'Image (Return_Code (Code))
- & ": " & Error_Message);
- end;
- end if;
- end Close;
-
- -----------
- -- CRC32 --
- -----------
-
- function CRC32
- (CRC : in Unsigned_32;
- Data : in Ada.Streams.Stream_Element_Array)
- return Unsigned_32
- is
- use Thin;
- begin
- return Unsigned_32 (crc32 (ULong (CRC),
- Data'Address,
- Data'Length));
- end CRC32;
-
- procedure CRC32
- (CRC : in out Unsigned_32;
- Data : in Ada.Streams.Stream_Element_Array) is
- begin
- CRC := CRC32 (CRC, Data);
- end CRC32;
-
- ------------------
- -- Deflate_Init --
- ------------------
-
- procedure Deflate_Init
- (Filter : in out Filter_Type;
- Level : in Compression_Level := Default_Compression;
- Strategy : in Strategy_Type := Default_Strategy;
- Method : in Compression_Method := Deflated;
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
- Memory_Level : in Memory_Level_Type := Default_Memory_Level;
- Header : in Header_Type := Default)
- is
- use type Thin.Int;
- Win_Bits : Thin.Int := Thin.Int (Window_Bits);
- begin
- if Is_Open (Filter) then
- raise Status_Error;
- end if;
-
- -- We allow ZLib to make header only in case of default header type.
- -- Otherwise we would either do header by ourselfs, or do not do
- -- header at all.
-
- if Header = None or else Header = GZip then
- Win_Bits := -Win_Bits;
- end if;
-
- -- For the GZip CRC calculation and make headers.
-
- if Header = GZip then
- Filter.CRC := 0;
- Filter.Offset := Simple_GZip_Header'First;
- else
- Filter.Offset := Simple_GZip_Header'Last + 1;
- end if;
-
- Filter.Strm := new Z_Stream;
- Filter.Compression := True;
- Filter.Stream_End := False;
- Filter.Header := Header;
-
- if Thin.Deflate_Init
- (To_Thin_Access (Filter.Strm),
- Level => Thin.Int (Level),
- method => Thin.Int (Method),
- windowBits => Win_Bits,
- memLevel => Thin.Int (Memory_Level),
- strategy => Thin.Int (Strategy)) /= Thin.Z_OK
- then
- Raise_Error (Filter.Strm.all);
- end if;
- end Deflate_Init;
-
- -----------
- -- Flush --
- -----------
-
- procedure Flush
- (Filter : in out Filter_Type;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode)
- is
- No_Data : Stream_Element_Array := (1 .. 0 => 0);
- Last : Stream_Element_Offset;
- begin
- Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush);
- end Flush;
-
- -----------------------
- -- Generic_Translate --
- -----------------------
-
- procedure Generic_Translate
- (Filter : in out ZLib.Filter_Type;
- In_Buffer_Size : in Integer := Default_Buffer_Size;
- Out_Buffer_Size : in Integer := Default_Buffer_Size)
- is
- In_Buffer : Stream_Element_Array
- (1 .. Stream_Element_Offset (In_Buffer_Size));
- Out_Buffer : Stream_Element_Array
- (1 .. Stream_Element_Offset (Out_Buffer_Size));
- Last : Stream_Element_Offset;
- In_Last : Stream_Element_Offset;
- In_First : Stream_Element_Offset;
- Out_Last : Stream_Element_Offset;
- begin
- Main : loop
- Data_In (In_Buffer, Last);
-
- In_First := In_Buffer'First;
-
- loop
- Translate
- (Filter => Filter,
- In_Data => In_Buffer (In_First .. Last),
- In_Last => In_Last,
- Out_Data => Out_Buffer,
- Out_Last => Out_Last,
- Flush => Flush_Finish (Last < In_Buffer'First));
-
- if Out_Buffer'First <= Out_Last then
- Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last));
- end if;
-
- exit Main when Stream_End (Filter);
-
- -- The end of in buffer.
-
- exit when In_Last = Last;
-
- In_First := In_Last + 1;
- end loop;
- end loop Main;
-
- end Generic_Translate;
-
- ------------------
- -- Inflate_Init --
- ------------------
-
- procedure Inflate_Init
- (Filter : in out Filter_Type;
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
- Header : in Header_Type := Default)
- is
- use type Thin.Int;
- Win_Bits : Thin.Int := Thin.Int (Window_Bits);
-
- procedure Check_Version;
- -- Check the latest header types compatibility.
-
- procedure Check_Version is
- begin
- if Version <= "1.1.4" then
- Raise_Error
- ("Inflate header type " & Header_Type'Image (Header)
- & " incompatible with ZLib version " & Version);
- end if;
- end Check_Version;
-
- begin
- if Is_Open (Filter) then
- raise Status_Error;
- end if;
-
- case Header is
- when None =>
- Check_Version;
-
- -- Inflate data without headers determined
- -- by negative Win_Bits.
-
- Win_Bits := -Win_Bits;
- when GZip =>
- Check_Version;
-
- -- Inflate gzip data defined by flag 16.
-
- Win_Bits := Win_Bits + 16;
- when Auto =>
- Check_Version;
-
- -- Inflate with automatic detection
- -- of gzip or native header defined by flag 32.
-
- Win_Bits := Win_Bits + 32;
- when Default => null;
- end case;
-
- Filter.Strm := new Z_Stream;
- Filter.Compression := False;
- Filter.Stream_End := False;
- Filter.Header := Header;
-
- if Thin.Inflate_Init
- (To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK
- then
- Raise_Error (Filter.Strm.all);
- end if;
- end Inflate_Init;
-
- -------------
- -- Is_Open --
- -------------
-
- function Is_Open (Filter : in Filter_Type) return Boolean is
- begin
- return Filter.Strm /= null;
- end Is_Open;
-
- -----------------
- -- Raise_Error --
- -----------------
-
- procedure Raise_Error (Message : in String) is
- begin
- Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message);
- end Raise_Error;
-
- procedure Raise_Error (Stream : in Z_Stream) is
- begin
- Raise_Error (Last_Error_Message (Stream));
- end Raise_Error;
-
- ----------
- -- Read --
- ----------
-
- procedure Read
- (Filter : in out Filter_Type;
- Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode := No_Flush)
- is
- In_Last : Stream_Element_Offset;
- Item_First : Ada.Streams.Stream_Element_Offset := Item'First;
- V_Flush : Flush_Mode := Flush;
-
- begin
- pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1);
- pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last);
-
- loop
- if Rest_Last = Buffer'First - 1 then
- V_Flush := Finish;
-
- elsif Rest_First > Rest_Last then
- Read (Buffer, Rest_Last);
- Rest_First := Buffer'First;
-
- if Rest_Last < Buffer'First then
- V_Flush := Finish;
- end if;
- end if;
-
- Translate
- (Filter => Filter,
- In_Data => Buffer (Rest_First .. Rest_Last),
- In_Last => In_Last,
- Out_Data => Item (Item_First .. Item'Last),
- Out_Last => Last,
- Flush => V_Flush);
-
- Rest_First := In_Last + 1;
-
- exit when Stream_End (Filter)
- or else Last = Item'Last
- or else (Last >= Item'First and then Allow_Read_Some);
-
- Item_First := Last + 1;
- end loop;
- end Read;
-
- ----------------
- -- Stream_End --
- ----------------
-
- function Stream_End (Filter : in Filter_Type) return Boolean is
- begin
- if Filter.Header = GZip and Filter.Compression then
- return Filter.Stream_End
- and then Filter.Offset = Footer_Array'Last + 1;
- else
- return Filter.Stream_End;
- end if;
- end Stream_End;
-
- --------------
- -- Total_In --
- --------------
-
- function Total_In (Filter : in Filter_Type) return Count is
- begin
- return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all));
- end Total_In;
-
- ---------------
- -- Total_Out --
- ---------------
-
- function Total_Out (Filter : in Filter_Type) return Count is
- begin
- return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all));
- end Total_Out;
-
- ---------------
- -- Translate --
- ---------------
-
- procedure Translate
- (Filter : in out Filter_Type;
- In_Data : in Ada.Streams.Stream_Element_Array;
- In_Last : out Ada.Streams.Stream_Element_Offset;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode) is
- begin
- if Filter.Header = GZip and then Filter.Compression then
- Translate_GZip
- (Filter => Filter,
- In_Data => In_Data,
- In_Last => In_Last,
- Out_Data => Out_Data,
- Out_Last => Out_Last,
- Flush => Flush);
- else
- Translate_Auto
- (Filter => Filter,
- In_Data => In_Data,
- In_Last => In_Last,
- Out_Data => Out_Data,
- Out_Last => Out_Last,
- Flush => Flush);
- end if;
- end Translate;
-
- --------------------
- -- Translate_Auto --
- --------------------
-
- procedure Translate_Auto
- (Filter : in out Filter_Type;
- In_Data : in Ada.Streams.Stream_Element_Array;
- In_Last : out Ada.Streams.Stream_Element_Offset;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode)
- is
- use type Thin.Int;
- Code : Thin.Int;
-
- begin
- if not Is_Open (Filter) then
- raise Status_Error;
- end if;
-
- if Out_Data'Length = 0 and then In_Data'Length = 0 then
- raise Constraint_Error;
- end if;
-
- Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length);
- Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length);
-
- Code := Flate (Filter.Compression).Step
- (To_Thin_Access (Filter.Strm),
- Thin.Int (Flush));
-
- if Code = Thin.Z_STREAM_END then
- Filter.Stream_End := True;
- else
- Check_Error (Filter.Strm.all, Code);
- end if;
-
- In_Last := In_Data'Last
- - Stream_Element_Offset (Avail_In (Filter.Strm.all));
- Out_Last := Out_Data'Last
- - Stream_Element_Offset (Avail_Out (Filter.Strm.all));
- end Translate_Auto;
-
- --------------------
- -- Translate_GZip --
- --------------------
-
- procedure Translate_GZip
- (Filter : in out Filter_Type;
- In_Data : in Ada.Streams.Stream_Element_Array;
- In_Last : out Ada.Streams.Stream_Element_Offset;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode)
- is
- Out_First : Stream_Element_Offset;
-
- procedure Add_Data (Data : in Stream_Element_Array);
- -- Add data to stream from the Filter.Offset till necessary,
- -- used for add gzip headr/footer.
-
- procedure Put_32
- (Item : in out Stream_Element_Array;
- Data : in Unsigned_32);
- pragma Inline (Put_32);
-
- --------------
- -- Add_Data --
- --------------
-
- procedure Add_Data (Data : in Stream_Element_Array) is
- Data_First : Stream_Element_Offset renames Filter.Offset;
- Data_Last : Stream_Element_Offset;
- Data_Len : Stream_Element_Offset; -- -1
- Out_Len : Stream_Element_Offset; -- -1
- begin
- Out_First := Out_Last + 1;
-
- if Data_First > Data'Last then
- return;
- end if;
-
- Data_Len := Data'Last - Data_First;
- Out_Len := Out_Data'Last - Out_First;
-
- if Data_Len <= Out_Len then
- Out_Last := Out_First + Data_Len;
- Data_Last := Data'Last;
- else
- Out_Last := Out_Data'Last;
- Data_Last := Data_First + Out_Len;
- end if;
-
- Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last);
-
- Data_First := Data_Last + 1;
- Out_First := Out_Last + 1;
- end Add_Data;
-
- ------------
- -- Put_32 --
- ------------
-
- procedure Put_32
- (Item : in out Stream_Element_Array;
- Data : in Unsigned_32)
- is
- D : Unsigned_32 := Data;
- begin
- for J in Item'First .. Item'First + 3 loop
- Item (J) := Stream_Element (D and 16#FF#);
- D := Shift_Right (D, 8);
- end loop;
- end Put_32;
-
- begin
- Out_Last := Out_Data'First - 1;
-
- if not Filter.Stream_End then
- Add_Data (Simple_GZip_Header);
-
- Translate_Auto
- (Filter => Filter,
- In_Data => In_Data,
- In_Last => In_Last,
- Out_Data => Out_Data (Out_First .. Out_Data'Last),
- Out_Last => Out_Last,
- Flush => Flush);
-
- CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
- end if;
-
- if Filter.Stream_End and then Out_Last <= Out_Data'Last then
- -- This detection method would work only when
- -- Simple_GZip_Header'Last > Footer_Array'Last
-
- if Filter.Offset = Simple_GZip_Header'Last + 1 then
- Filter.Offset := Footer_Array'First;
- end if;
-
- declare
- Footer : Footer_Array;
- begin
- Put_32 (Footer, Filter.CRC);
- Put_32 (Footer (Footer'First + 4 .. Footer'Last),
- Unsigned_32 (Total_In (Filter)));
- Add_Data (Footer);
- end;
- end if;
- end Translate_GZip;
-
- -------------
- -- Version --
- -------------
-
- function Version return String is
- begin
- return Interfaces.C.Strings.Value (Thin.zlibVersion);
- end Version;
-
- -----------
- -- Write --
- -----------
-
- procedure Write
- (Filter : in out Filter_Type;
- Item : in Ada.Streams.Stream_Element_Array;
- Flush : in Flush_Mode := No_Flush)
- is
- Buffer : Stream_Element_Array (1 .. Buffer_Size);
- In_Last : Stream_Element_Offset;
- Out_Last : Stream_Element_Offset;
- In_First : Stream_Element_Offset := Item'First;
- begin
- if Item'Length = 0 and Flush = No_Flush then
- return;
- end if;
-
- loop
- Translate
- (Filter => Filter,
- In_Data => Item (In_First .. Item'Last),
- In_Last => In_Last,
- Out_Data => Buffer,
- Out_Last => Out_Last,
- Flush => Flush);
-
- if Out_Last >= Buffer'First then
- Write (Buffer (1 .. Out_Last));
- end if;
-
- exit when In_Last = Item'Last or Stream_End (Filter);
-
- In_First := In_Last + 1;
- end loop;
- end Write;
-
-end ZLib;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib.ads b/funtools/util/zlib-1.2.3/contrib/ada/zlib.ads
deleted file mode 100644
index 79ffc40..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib.ads
+++ /dev/null
@@ -1,328 +0,0 @@
-------------------------------------------------------------------------------
--- ZLib for Ada thick binding. --
--- --
--- Copyright (C) 2002-2004 Dmitriy Anisimkov --
--- --
--- This library is free software; you can redistribute it and/or modify --
--- it under the terms of the GNU General Public License as published by --
--- the Free Software Foundation; either version 2 of the License, or (at --
--- your option) any later version. --
--- --
--- This library is distributed in the hope that it will be useful, but --
--- WITHOUT ANY WARRANTY; without even the implied warranty of --
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
--- General Public License for more details. --
--- --
--- You should have received a copy of the GNU General Public License --
--- along with this library; if not, write to the Free Software Foundation, --
--- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
--- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
-------------------------------------------------------------------------------
-
--- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $
-
-with Ada.Streams;
-
-with Interfaces;
-
-package ZLib is
-
- ZLib_Error : exception;
- Status_Error : exception;
-
- type Compression_Level is new Integer range -1 .. 9;
-
- type Flush_Mode is private;
-
- type Compression_Method is private;
-
- type Window_Bits_Type is new Integer range 8 .. 15;
-
- type Memory_Level_Type is new Integer range 1 .. 9;
-
- type Unsigned_32 is new Interfaces.Unsigned_32;
-
- type Strategy_Type is private;
-
- type Header_Type is (None, Auto, Default, GZip);
- -- Header type usage have a some limitation for inflate.
- -- See comment for Inflate_Init.
-
- subtype Count is Ada.Streams.Stream_Element_Count;
-
- Default_Memory_Level : constant Memory_Level_Type := 8;
- Default_Window_Bits : constant Window_Bits_Type := 15;
-
- ----------------------------------
- -- Compression method constants --
- ----------------------------------
-
- Deflated : constant Compression_Method;
- -- Only one method allowed in this ZLib version
-
- ---------------------------------
- -- Compression level constants --
- ---------------------------------
-
- No_Compression : constant Compression_Level := 0;
- Best_Speed : constant Compression_Level := 1;
- Best_Compression : constant Compression_Level := 9;
- Default_Compression : constant Compression_Level := -1;
-
- --------------------------
- -- Flush mode constants --
- --------------------------
-
- No_Flush : constant Flush_Mode;
- -- Regular way for compression, no flush
-
- Partial_Flush : constant Flush_Mode;
- -- Will be removed, use Z_SYNC_FLUSH instead
-
- Sync_Flush : constant Flush_Mode;
- -- All pending output is flushed to the output buffer and the output
- -- is aligned on a byte boundary, so that the decompressor can get all
- -- input data available so far. (In particular avail_in is zero after the
- -- call if enough output space has been provided before the call.)
- -- Flushing may degrade compression for some compression algorithms and so
- -- it should be used only when necessary.
-
- Block_Flush : constant Flush_Mode;
- -- Z_BLOCK requests that inflate() stop
- -- if and when it get to the next deflate block boundary. When decoding the
- -- zlib or gzip format, this will cause inflate() to return immediately
- -- after the header and before the first block. When doing a raw inflate,
- -- inflate() will go ahead and process the first block, and will return
- -- when it gets to the end of that block, or when it runs out of data.
-
- Full_Flush : constant Flush_Mode;
- -- All output is flushed as with SYNC_FLUSH, and the compression state
- -- is reset so that decompression can restart from this point if previous
- -- compressed data has been damaged or if random access is desired. Using
- -- Full_Flush too often can seriously degrade the compression.
-
- Finish : constant Flush_Mode;
- -- Just for tell the compressor that input data is complete.
-
- ------------------------------------
- -- Compression strategy constants --
- ------------------------------------
-
- -- RLE stategy could be used only in version 1.2.0 and later.
-
- Filtered : constant Strategy_Type;
- Huffman_Only : constant Strategy_Type;
- RLE : constant Strategy_Type;
- Default_Strategy : constant Strategy_Type;
-
- Default_Buffer_Size : constant := 4096;
-
- type Filter_Type is tagged limited private;
- -- The filter is for compression and for decompression.
- -- The usage of the type is depend of its initialization.
-
- function Version return String;
- pragma Inline (Version);
- -- Return string representation of the ZLib version.
-
- procedure Deflate_Init
- (Filter : in out Filter_Type;
- Level : in Compression_Level := Default_Compression;
- Strategy : in Strategy_Type := Default_Strategy;
- Method : in Compression_Method := Deflated;
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
- Memory_Level : in Memory_Level_Type := Default_Memory_Level;
- Header : in Header_Type := Default);
- -- Compressor initialization.
- -- When Header parameter is Auto or Default, then default zlib header
- -- would be provided for compressed data.
- -- When Header is GZip, then gzip header would be set instead of
- -- default header.
- -- When Header is None, no header would be set for compressed data.
-
- procedure Inflate_Init
- (Filter : in out Filter_Type;
- Window_Bits : in Window_Bits_Type := Default_Window_Bits;
- Header : in Header_Type := Default);
- -- Decompressor initialization.
- -- Default header type mean that ZLib default header is expecting in the
- -- input compressed stream.
- -- Header type None mean that no header is expecting in the input stream.
- -- GZip header type mean that GZip header is expecting in the
- -- input compressed stream.
- -- Auto header type mean that header type (GZip or Native) would be
- -- detected automatically in the input stream.
- -- Note that header types parameter values None, GZip and Auto are
- -- supported for inflate routine only in ZLib versions 1.2.0.2 and later.
- -- Deflate_Init is supporting all header types.
-
- function Is_Open (Filter : in Filter_Type) return Boolean;
- pragma Inline (Is_Open);
- -- Is the filter opened for compression or decompression.
-
- procedure Close
- (Filter : in out Filter_Type;
- Ignore_Error : in Boolean := False);
- -- Closing the compression or decompressor.
- -- If stream is closing before the complete and Ignore_Error is False,
- -- The exception would be raised.
-
- generic
- with procedure Data_In
- (Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset);
- with procedure Data_Out
- (Item : in Ada.Streams.Stream_Element_Array);
- procedure Generic_Translate
- (Filter : in out Filter_Type;
- In_Buffer_Size : in Integer := Default_Buffer_Size;
- Out_Buffer_Size : in Integer := Default_Buffer_Size);
- -- Compress/decompress data fetch from Data_In routine and pass the result
- -- to the Data_Out routine. User should provide Data_In and Data_Out
- -- for compression/decompression data flow.
- -- Compression or decompression depend on Filter initialization.
-
- function Total_In (Filter : in Filter_Type) return Count;
- pragma Inline (Total_In);
- -- Returns total number of input bytes read so far
-
- function Total_Out (Filter : in Filter_Type) return Count;
- pragma Inline (Total_Out);
- -- Returns total number of bytes output so far
-
- function CRC32
- (CRC : in Unsigned_32;
- Data : in Ada.Streams.Stream_Element_Array)
- return Unsigned_32;
- pragma Inline (CRC32);
- -- Compute CRC32, it could be necessary for make gzip format
-
- procedure CRC32
- (CRC : in out Unsigned_32;
- Data : in Ada.Streams.Stream_Element_Array);
- pragma Inline (CRC32);
- -- Compute CRC32, it could be necessary for make gzip format
-
- -------------------------------------------------
- -- Below is more complex low level routines. --
- -------------------------------------------------
-
- procedure Translate
- (Filter : in out Filter_Type;
- In_Data : in Ada.Streams.Stream_Element_Array;
- In_Last : out Ada.Streams.Stream_Element_Offset;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode);
- -- Compress/decompress the In_Data buffer and place the result into
- -- Out_Data. In_Last is the index of last element from In_Data accepted by
- -- the Filter. Out_Last is the last element of the received data from
- -- Filter. To tell the filter that incoming data are complete put the
- -- Flush parameter to Finish.
-
- function Stream_End (Filter : in Filter_Type) return Boolean;
- pragma Inline (Stream_End);
- -- Return the true when the stream is complete.
-
- procedure Flush
- (Filter : in out Filter_Type;
- Out_Data : out Ada.Streams.Stream_Element_Array;
- Out_Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode);
- pragma Inline (Flush);
- -- Flushing the data from the compressor.
-
- generic
- with procedure Write
- (Item : in Ada.Streams.Stream_Element_Array);
- -- User should provide this routine for accept
- -- compressed/decompressed data.
-
- Buffer_Size : in Ada.Streams.Stream_Element_Offset
- := Default_Buffer_Size;
- -- Buffer size for Write user routine.
-
- procedure Write
- (Filter : in out Filter_Type;
- Item : in Ada.Streams.Stream_Element_Array;
- Flush : in Flush_Mode := No_Flush);
- -- Compress/Decompress data from Item to the generic parameter procedure
- -- Write. Output buffer size could be set in Buffer_Size generic parameter.
-
- generic
- with procedure Read
- (Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset);
- -- User should provide data for compression/decompression
- -- thru this routine.
-
- Buffer : in out Ada.Streams.Stream_Element_Array;
- -- Buffer for keep remaining data from the previous
- -- back read.
-
- Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset;
- -- Rest_First have to be initialized to Buffer'Last + 1
- -- Rest_Last have to be initialized to Buffer'Last
- -- before usage.
-
- Allow_Read_Some : in Boolean := False;
- -- Is it allowed to return Last < Item'Last before end of data.
-
- procedure Read
- (Filter : in out Filter_Type;
- Item : out Ada.Streams.Stream_Element_Array;
- Last : out Ada.Streams.Stream_Element_Offset;
- Flush : in Flush_Mode := No_Flush);
- -- Compress/Decompress data from generic parameter procedure Read to the
- -- Item. User should provide Buffer and initialized Rest_First, Rest_Last
- -- indicators. If Allow_Read_Some is True, Read routines could return
- -- Last < Item'Last only at end of stream.
-
-private
-
- use Ada.Streams;
-
- pragma Assert (Ada.Streams.Stream_Element'Size = 8);
- pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8);
-
- type Flush_Mode is new Integer range 0 .. 5;
-
- type Compression_Method is new Integer range 8 .. 8;
-
- type Strategy_Type is new Integer range 0 .. 3;
-
- No_Flush : constant Flush_Mode := 0;
- Partial_Flush : constant Flush_Mode := 1;
- Sync_Flush : constant Flush_Mode := 2;
- Full_Flush : constant Flush_Mode := 3;
- Finish : constant Flush_Mode := 4;
- Block_Flush : constant Flush_Mode := 5;
-
- Filtered : constant Strategy_Type := 1;
- Huffman_Only : constant Strategy_Type := 2;
- RLE : constant Strategy_Type := 3;
- Default_Strategy : constant Strategy_Type := 0;
-
- Deflated : constant Compression_Method := 8;
-
- type Z_Stream;
-
- type Z_Stream_Access is access all Z_Stream;
-
- type Filter_Type is tagged limited record
- Strm : Z_Stream_Access;
- Compression : Boolean;
- Stream_End : Boolean;
- Header : Header_Type;
- CRC : Unsigned_32;
- Offset : Stream_Element_Offset;
- -- Offset for gzip header/footer output.
- end record;
-
-end ZLib;
diff --git a/funtools/util/zlib-1.2.3/contrib/ada/zlib.gpr b/funtools/util/zlib-1.2.3/contrib/ada/zlib.gpr
deleted file mode 100644
index 296b22a..0000000
--- a/funtools/util/zlib-1.2.3/contrib/ada/zlib.gpr
+++ /dev/null
@@ -1,20 +0,0 @@
-project Zlib is
-
- for Languages use ("Ada");
- for Source_Dirs use (".");
- for Object_Dir use ".";
- for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo");
-
- package Compiler is
- for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst");
- end Compiler;
-
- package Linker is
- for Default_Switches ("ada") use ("-lz");
- end Linker;
-
- package Builder is
- for Default_Switches ("ada") use ("-s", "-gnatQ");
- end Builder;
-
-end Zlib;
diff --git a/funtools/util/zlib-1.2.3/contrib/asm586/README.586 b/funtools/util/zlib-1.2.3/contrib/asm586/README.586
deleted file mode 100644
index 6bb78f3..0000000
--- a/funtools/util/zlib-1.2.3/contrib/asm586/README.586
+++ /dev/null
@@ -1,43 +0,0 @@
-This is a patched version of zlib modified to use
-Pentium-optimized assembly code in the deflation algorithm. The files
-changed/added by this patch are:
-
-README.586
-match.S
-
-The effectiveness of these modifications is a bit marginal, as the the
-program's bottleneck seems to be mostly L1-cache contention, for which
-there is no real way to work around without rewriting the basic
-algorithm. The speedup on average is around 5-10% (which is generally
-less than the amount of variance between subsequent executions).
-However, when used at level 9 compression, the cache contention can
-drop enough for the assembly version to achieve 10-20% speedup (and
-sometimes more, depending on the amount of overall redundancy in the
-files). Even here, though, cache contention can still be the limiting
-factor, depending on the nature of the program using the zlib library.
-This may also mean that better improvements will be seen on a Pentium
-with MMX, which suffers much less from L1-cache contention, but I have
-not yet verified this.
-
-Note that this code has been tailored for the Pentium in particular,
-and will not perform well on the Pentium Pro (due to the use of a
-partial register in the inner loop).
-
-If you are using an assembler other than GNU as, you will have to
-translate match.S to use your assembler's syntax. (Have fun.)
-
-Brian Raiter
-breadbox@muppetlabs.com
-April, 1998
-
-
-Added for zlib 1.1.3:
-
-The patches come from
-http://www.muppetlabs.com/~breadbox/software/assembly.html
-
-To compile zlib with this asm file, copy match.S to the zlib directory
-then do:
-
-CFLAGS="-O3 -DASMV" ./configure
-make OBJA=match.o
diff --git a/funtools/util/zlib-1.2.3/contrib/asm586/match.S b/funtools/util/zlib-1.2.3/contrib/asm586/match.S
deleted file mode 100644
index 0368b35..0000000
--- a/funtools/util/zlib-1.2.3/contrib/asm586/match.S
+++ /dev/null
@@ -1,364 +0,0 @@
-/* match.s -- Pentium-optimized version of longest_match()
- * Written for zlib 1.1.2
- * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License.
- */
-
-#ifndef NO_UNDERLINE
-#define match_init _match_init
-#define longest_match _longest_match
-#endif
-
-#define MAX_MATCH (258)
-#define MIN_MATCH (3)
-#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
-#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
-
-/* stack frame offsets */
-
-#define wmask 0 /* local copy of s->wmask */
-#define window 4 /* local copy of s->window */
-#define windowbestlen 8 /* s->window + bestlen */
-#define chainlenscanend 12 /* high word: current chain len */
- /* low word: last bytes sought */
-#define scanstart 16 /* first two bytes of string */
-#define scanalign 20 /* dword-misalignment of string */
-#define nicematch 24 /* a good enough match size */
-#define bestlen 28 /* size of best match so far */
-#define scan 32 /* ptr to string wanting match */
-
-#define LocalVarsSize (36)
-/* saved ebx 36 */
-/* saved edi 40 */
-/* saved esi 44 */
-/* saved ebp 48 */
-/* return address 52 */
-#define deflatestate 56 /* the function arguments */
-#define curmatch 60
-
-/* Offsets for fields in the deflate_state structure. These numbers
- * are calculated from the definition of deflate_state, with the
- * assumption that the compiler will dword-align the fields. (Thus,
- * changing the definition of deflate_state could easily cause this
- * program to crash horribly, without so much as a warning at
- * compile time. Sigh.)
- */
-
-/* All the +zlib1222add offsets are due to the addition of fields
- * in zlib in the deflate_state structure since the asm code was first written
- * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
- * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
- * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
- */
-
-#define zlib1222add (8)
-
-#define dsWSize (36+zlib1222add)
-#define dsWMask (44+zlib1222add)
-#define dsWindow (48+zlib1222add)
-#define dsPrev (56+zlib1222add)
-#define dsMatchLen (88+zlib1222add)
-#define dsPrevMatch (92+zlib1222add)
-#define dsStrStart (100+zlib1222add)
-#define dsMatchStart (104+zlib1222add)
-#define dsLookahead (108+zlib1222add)
-#define dsPrevLen (112+zlib1222add)
-#define dsMaxChainLen (116+zlib1222add)
-#define dsGoodMatch (132+zlib1222add)
-#define dsNiceMatch (136+zlib1222add)
-
-
-.file "match.S"
-
-.globl match_init, longest_match
-
-.text
-
-/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
-
-longest_match:
-
-/* Save registers that the compiler may be using, and adjust %esp to */
-/* make room for our stack frame. */
-
- pushl %ebp
- pushl %edi
- pushl %esi
- pushl %ebx
- subl $LocalVarsSize, %esp
-
-/* Retrieve the function arguments. %ecx will hold cur_match */
-/* throughout the entire function. %edx will hold the pointer to the */
-/* deflate_state structure during the function's setup (before */
-/* entering the main loop). */
-
- movl deflatestate(%esp), %edx
- movl curmatch(%esp), %ecx
-
-/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
-
- movl dsNiceMatch(%edx), %eax
- movl dsLookahead(%edx), %ebx
- cmpl %eax, %ebx
- jl LookaheadLess
- movl %eax, %ebx
-LookaheadLess: movl %ebx, nicematch(%esp)
-
-/* register Bytef *scan = s->window + s->strstart; */
-
- movl dsWindow(%edx), %esi
- movl %esi, window(%esp)
- movl dsStrStart(%edx), %ebp
- lea (%esi,%ebp), %edi
- movl %edi, scan(%esp)
-
-/* Determine how many bytes the scan ptr is off from being */
-/* dword-aligned. */
-
- movl %edi, %eax
- negl %eax
- andl $3, %eax
- movl %eax, scanalign(%esp)
-
-/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
-/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
-
- movl dsWSize(%edx), %eax
- subl $MIN_LOOKAHEAD, %eax
- subl %eax, %ebp
- jg LimitPositive
- xorl %ebp, %ebp
-LimitPositive:
-
-/* unsigned chain_length = s->max_chain_length; */
-/* if (s->prev_length >= s->good_match) { */
-/* chain_length >>= 2; */
-/* } */
-
- movl dsPrevLen(%edx), %eax
- movl dsGoodMatch(%edx), %ebx
- cmpl %ebx, %eax
- movl dsMaxChainLen(%edx), %ebx
- jl LastMatchGood
- shrl $2, %ebx
-LastMatchGood:
-
-/* chainlen is decremented once beforehand so that the function can */
-/* use the sign flag instead of the zero flag for the exit test. */
-/* It is then shifted into the high word, to make room for the scanend */
-/* scanend value, which it will always accompany. */
-
- decl %ebx
- shll $16, %ebx
-
-/* int best_len = s->prev_length; */
-
- movl dsPrevLen(%edx), %eax
- movl %eax, bestlen(%esp)
-
-/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
-
- addl %eax, %esi
- movl %esi, windowbestlen(%esp)
-
-/* register ush scan_start = *(ushf*)scan; */
-/* register ush scan_end = *(ushf*)(scan+best_len-1); */
-
- movw (%edi), %bx
- movw %bx, scanstart(%esp)
- movw -1(%edi,%eax), %bx
- movl %ebx, chainlenscanend(%esp)
-
-/* Posf *prev = s->prev; */
-/* uInt wmask = s->w_mask; */
-
- movl dsPrev(%edx), %edi
- movl dsWMask(%edx), %edx
- mov %edx, wmask(%esp)
-
-/* Jump into the main loop. */
-
- jmp LoopEntry
-
-.balign 16
-
-/* do {
- * match = s->window + cur_match;
- * if (*(ushf*)(match+best_len-1) != scan_end ||
- * *(ushf*)match != scan_start) continue;
- * [...]
- * } while ((cur_match = prev[cur_match & wmask]) > limit
- * && --chain_length != 0);
- *
- * Here is the inner loop of the function. The function will spend the
- * majority of its time in this loop, and majority of that time will
- * be spent in the first ten instructions.
- *
- * Within this loop:
- * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend)
- * %ecx = curmatch
- * %edx = curmatch & wmask
- * %esi = windowbestlen - i.e., (window + bestlen)
- * %edi = prev
- * %ebp = limit
- *
- * Two optimization notes on the choice of instructions:
- *
- * The first instruction uses a 16-bit address, which costs an extra,
- * unpairable cycle. This is cheaper than doing a 32-bit access and
- * zeroing the high word, due to the 3-cycle misalignment penalty which
- * would occur half the time. This also turns out to be cheaper than
- * doing two separate 8-bit accesses, as the memory is so rarely in the
- * L1 cache.
- *
- * The window buffer, however, apparently spends a lot of time in the
- * cache, and so it is faster to retrieve the word at the end of the
- * match string with two 8-bit loads. The instructions that test the
- * word at the beginning of the match string, however, are executed
- * much less frequently, and there it was cheaper to use 16-bit
- * instructions, which avoided the necessity of saving off and
- * subsequently reloading one of the other registers.
- */
-LookupLoop:
- /* 1 U & V */
- movw (%edi,%edx,2), %cx /* 2 U pipe */
- movl wmask(%esp), %edx /* 2 V pipe */
- cmpl %ebp, %ecx /* 3 U pipe */
- jbe LeaveNow /* 3 V pipe */
- subl $0x00010000, %ebx /* 4 U pipe */
- js LeaveNow /* 4 V pipe */
-LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */
- andl %ecx, %edx /* 5 V pipe */
- cmpb %bl, %al /* 6 U pipe */
- jnz LookupLoop /* 6 V pipe */
- movb (%esi,%ecx), %ah
- cmpb %bh, %ah
- jnz LookupLoop
- movl window(%esp), %eax
- movw (%eax,%ecx), %ax
- cmpw scanstart(%esp), %ax
- jnz LookupLoop
-
-/* Store the current value of chainlen. */
-
- movl %ebx, chainlenscanend(%esp)
-
-/* Point %edi to the string under scrutiny, and %esi to the string we */
-/* are hoping to match it up with. In actuality, %esi and %edi are */
-/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
-/* initialized to -(MAX_MATCH_8 - scanalign). */
-
- movl window(%esp), %esi
- movl scan(%esp), %edi
- addl %ecx, %esi
- movl scanalign(%esp), %eax
- movl $(-MAX_MATCH_8), %edx
- lea MAX_MATCH_8(%edi,%eax), %edi
- lea MAX_MATCH_8(%esi,%eax), %esi
-
-/* Test the strings for equality, 8 bytes at a time. At the end,
- * adjust %edx so that it is offset to the exact byte that mismatched.
- *
- * We already know at this point that the first three bytes of the
- * strings match each other, and they can be safely passed over before
- * starting the compare loop. So what this code does is skip over 0-3
- * bytes, as much as necessary in order to dword-align the %edi
- * pointer. (%esi will still be misaligned three times out of four.)
- *
- * It should be confessed that this loop usually does not represent
- * much of the total running time. Replacing it with a more
- * straightforward "rep cmpsb" would not drastically degrade
- * performance.
- */
-LoopCmps:
- movl (%esi,%edx), %eax
- movl (%edi,%edx), %ebx
- xorl %ebx, %eax
- jnz LeaveLoopCmps
- movl 4(%esi,%edx), %eax
- movl 4(%edi,%edx), %ebx
- xorl %ebx, %eax
- jnz LeaveLoopCmps4
- addl $8, %edx
- jnz LoopCmps
- jmp LenMaximum
-LeaveLoopCmps4: addl $4, %edx
-LeaveLoopCmps: testl $0x0000FFFF, %eax
- jnz LenLower
- addl $2, %edx
- shrl $16, %eax
-LenLower: subb $1, %al
- adcl $0, %edx
-
-/* Calculate the length of the match. If it is longer than MAX_MATCH, */
-/* then automatically accept it as the best possible match and leave. */
-
- lea (%edi,%edx), %eax
- movl scan(%esp), %edi
- subl %edi, %eax
- cmpl $MAX_MATCH, %eax
- jge LenMaximum
-
-/* If the length of the match is not longer than the best match we */
-/* have so far, then forget it and return to the lookup loop. */
-
- movl deflatestate(%esp), %edx
- movl bestlen(%esp), %ebx
- cmpl %ebx, %eax
- jg LongerMatch
- movl chainlenscanend(%esp), %ebx
- movl windowbestlen(%esp), %esi
- movl dsPrev(%edx), %edi
- movl wmask(%esp), %edx
- andl %ecx, %edx
- jmp LookupLoop
-
-/* s->match_start = cur_match; */
-/* best_len = len; */
-/* if (len >= nice_match) break; */
-/* scan_end = *(ushf*)(scan+best_len-1); */
-
-LongerMatch: movl nicematch(%esp), %ebx
- movl %eax, bestlen(%esp)
- movl %ecx, dsMatchStart(%edx)
- cmpl %ebx, %eax
- jge LeaveNow
- movl window(%esp), %esi
- addl %eax, %esi
- movl %esi, windowbestlen(%esp)
- movl chainlenscanend(%esp), %ebx
- movw -1(%edi,%eax), %bx
- movl dsPrev(%edx), %edi
- movl %ebx, chainlenscanend(%esp)
- movl wmask(%esp), %edx
- andl %ecx, %edx
- jmp LookupLoop
-
-/* Accept the current string, with the maximum possible length. */
-
-LenMaximum: movl deflatestate(%esp), %edx
- movl $MAX_MATCH, bestlen(%esp)
- movl %ecx, dsMatchStart(%edx)
-
-/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
-/* return s->lookahead; */
-
-LeaveNow:
- movl deflatestate(%esp), %edx
- movl bestlen(%esp), %ebx
- movl dsLookahead(%edx), %eax
- cmpl %eax, %ebx
- jg LookaheadRet
- movl %ebx, %eax
-LookaheadRet:
-
-/* Restore the stack and return from whence we came. */
-
- addl $LocalVarsSize, %esp
- popl %ebx
- popl %esi
- popl %edi
- popl %ebp
-match_init: ret
diff --git a/funtools/util/zlib-1.2.3/contrib/asm686/README.686 b/funtools/util/zlib-1.2.3/contrib/asm686/README.686
deleted file mode 100644
index a593f23..0000000
--- a/funtools/util/zlib-1.2.3/contrib/asm686/README.686
+++ /dev/null
@@ -1,34 +0,0 @@
-This is a patched version of zlib, modified to use
-Pentium-Pro-optimized assembly code in the deflation algorithm. The
-files changed/added by this patch are:
-
-README.686
-match.S
-
-The speedup that this patch provides varies, depending on whether the
-compiler used to build the original version of zlib falls afoul of the
-PPro's speed traps. My own tests show a speedup of around 10-20% at
-the default compression level, and 20-30% using -9, against a version
-compiled using gcc 2.7.2.3. Your mileage may vary.
-
-Note that this code has been tailored for the PPro/PII in particular,
-and will not perform particuarly well on a Pentium.
-
-If you are using an assembler other than GNU as, you will have to
-translate match.S to use your assembler's syntax. (Have fun.)
-
-Brian Raiter
-breadbox@muppetlabs.com
-April, 1998
-
-
-Added for zlib 1.1.3:
-
-The patches come from
-http://www.muppetlabs.com/~breadbox/software/assembly.html
-
-To compile zlib with this asm file, copy match.S to the zlib directory
-then do:
-
-CFLAGS="-O3 -DASMV" ./configure
-make OBJA=match.o
diff --git a/funtools/util/zlib-1.2.3/contrib/asm686/match.S b/funtools/util/zlib-1.2.3/contrib/asm686/match.S
deleted file mode 100644
index 5c3e9ee..0000000
--- a/funtools/util/zlib-1.2.3/contrib/asm686/match.S
+++ /dev/null
@@ -1,329 +0,0 @@
-/* match.s -- Pentium-Pro-optimized version of longest_match()
- * Written for zlib 1.1.2
- * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License.
- */
-
-#ifndef NO_UNDERLINE
-#define match_init _match_init
-#define longest_match _longest_match
-#endif
-
-#define MAX_MATCH (258)
-#define MIN_MATCH (3)
-#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
-#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
-
-/* stack frame offsets */
-
-#define chainlenwmask 0 /* high word: current chain len */
- /* low word: s->wmask */
-#define window 4 /* local copy of s->window */
-#define windowbestlen 8 /* s->window + bestlen */
-#define scanstart 16 /* first two bytes of string */
-#define scanend 12 /* last two bytes of string */
-#define scanalign 20 /* dword-misalignment of string */
-#define nicematch 24 /* a good enough match size */
-#define bestlen 28 /* size of best match so far */
-#define scan 32 /* ptr to string wanting match */
-
-#define LocalVarsSize (36)
-/* saved ebx 36 */
-/* saved edi 40 */
-/* saved esi 44 */
-/* saved ebp 48 */
-/* return address 52 */
-#define deflatestate 56 /* the function arguments */
-#define curmatch 60
-
-/* All the +zlib1222add offsets are due to the addition of fields
- * in zlib in the deflate_state structure since the asm code was first written
- * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
- * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
- * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
- */
-
-#define zlib1222add (8)
-
-#define dsWSize (36+zlib1222add)
-#define dsWMask (44+zlib1222add)
-#define dsWindow (48+zlib1222add)
-#define dsPrev (56+zlib1222add)
-#define dsMatchLen (88+zlib1222add)
-#define dsPrevMatch (92+zlib1222add)
-#define dsStrStart (100+zlib1222add)
-#define dsMatchStart (104+zlib1222add)
-#define dsLookahead (108+zlib1222add)
-#define dsPrevLen (112+zlib1222add)
-#define dsMaxChainLen (116+zlib1222add)
-#define dsGoodMatch (132+zlib1222add)
-#define dsNiceMatch (136+zlib1222add)
-
-
-.file "match.S"
-
-.globl match_init, longest_match
-
-.text
-
-/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
-
-longest_match:
-
-/* Save registers that the compiler may be using, and adjust %esp to */
-/* make room for our stack frame. */
-
- pushl %ebp
- pushl %edi
- pushl %esi
- pushl %ebx
- subl $LocalVarsSize, %esp
-
-/* Retrieve the function arguments. %ecx will hold cur_match */
-/* throughout the entire function. %edx will hold the pointer to the */
-/* deflate_state structure during the function's setup (before */
-/* entering the main loop). */
-
- movl deflatestate(%esp), %edx
- movl curmatch(%esp), %ecx
-
-/* uInt wmask = s->w_mask; */
-/* unsigned chain_length = s->max_chain_length; */
-/* if (s->prev_length >= s->good_match) { */
-/* chain_length >>= 2; */
-/* } */
-
- movl dsPrevLen(%edx), %eax
- movl dsGoodMatch(%edx), %ebx
- cmpl %ebx, %eax
- movl dsWMask(%edx), %eax
- movl dsMaxChainLen(%edx), %ebx
- jl LastMatchGood
- shrl $2, %ebx
-LastMatchGood:
-
-/* chainlen is decremented once beforehand so that the function can */
-/* use the sign flag instead of the zero flag for the exit test. */
-/* It is then shifted into the high word, to make room for the wmask */
-/* value, which it will always accompany. */
-
- decl %ebx
- shll $16, %ebx
- orl %eax, %ebx
- movl %ebx, chainlenwmask(%esp)
-
-/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
-
- movl dsNiceMatch(%edx), %eax
- movl dsLookahead(%edx), %ebx
- cmpl %eax, %ebx
- jl LookaheadLess
- movl %eax, %ebx
-LookaheadLess: movl %ebx, nicematch(%esp)
-
-/* register Bytef *scan = s->window + s->strstart; */
-
- movl dsWindow(%edx), %esi
- movl %esi, window(%esp)
- movl dsStrStart(%edx), %ebp
- lea (%esi,%ebp), %edi
- movl %edi, scan(%esp)
-
-/* Determine how many bytes the scan ptr is off from being */
-/* dword-aligned. */
-
- movl %edi, %eax
- negl %eax
- andl $3, %eax
- movl %eax, scanalign(%esp)
-
-/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
-/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
-
- movl dsWSize(%edx), %eax
- subl $MIN_LOOKAHEAD, %eax
- subl %eax, %ebp
- jg LimitPositive
- xorl %ebp, %ebp
-LimitPositive:
-
-/* int best_len = s->prev_length; */
-
- movl dsPrevLen(%edx), %eax
- movl %eax, bestlen(%esp)
-
-/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
-
- addl %eax, %esi
- movl %esi, windowbestlen(%esp)
-
-/* register ush scan_start = *(ushf*)scan; */
-/* register ush scan_end = *(ushf*)(scan+best_len-1); */
-/* Posf *prev = s->prev; */
-
- movzwl (%edi), %ebx
- movl %ebx, scanstart(%esp)
- movzwl -1(%edi,%eax), %ebx
- movl %ebx, scanend(%esp)
- movl dsPrev(%edx), %edi
-
-/* Jump into the main loop. */
-
- movl chainlenwmask(%esp), %edx
- jmp LoopEntry
-
-.balign 16
-
-/* do {
- * match = s->window + cur_match;
- * if (*(ushf*)(match+best_len-1) != scan_end ||
- * *(ushf*)match != scan_start) continue;
- * [...]
- * } while ((cur_match = prev[cur_match & wmask]) > limit
- * && --chain_length != 0);
- *
- * Here is the inner loop of the function. The function will spend the
- * majority of its time in this loop, and majority of that time will
- * be spent in the first ten instructions.
- *
- * Within this loop:
- * %ebx = scanend
- * %ecx = curmatch
- * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
- * %esi = windowbestlen - i.e., (window + bestlen)
- * %edi = prev
- * %ebp = limit
- */
-LookupLoop:
- andl %edx, %ecx
- movzwl (%edi,%ecx,2), %ecx
- cmpl %ebp, %ecx
- jbe LeaveNow
- subl $0x00010000, %edx
- js LeaveNow
-LoopEntry: movzwl -1(%esi,%ecx), %eax
- cmpl %ebx, %eax
- jnz LookupLoop
- movl window(%esp), %eax
- movzwl (%eax,%ecx), %eax
- cmpl scanstart(%esp), %eax
- jnz LookupLoop
-
-/* Store the current value of chainlen. */
-
- movl %edx, chainlenwmask(%esp)
-
-/* Point %edi to the string under scrutiny, and %esi to the string we */
-/* are hoping to match it up with. In actuality, %esi and %edi are */
-/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
-/* initialized to -(MAX_MATCH_8 - scanalign). */
-
- movl window(%esp), %esi
- movl scan(%esp), %edi
- addl %ecx, %esi
- movl scanalign(%esp), %eax
- movl $(-MAX_MATCH_8), %edx
- lea MAX_MATCH_8(%edi,%eax), %edi
- lea MAX_MATCH_8(%esi,%eax), %esi
-
-/* Test the strings for equality, 8 bytes at a time. At the end,
- * adjust %edx so that it is offset to the exact byte that mismatched.
- *
- * We already know at this point that the first three bytes of the
- * strings match each other, and they can be safely passed over before
- * starting the compare loop. So what this code does is skip over 0-3
- * bytes, as much as necessary in order to dword-align the %edi
- * pointer. (%esi will still be misaligned three times out of four.)
- *
- * It should be confessed that this loop usually does not represent
- * much of the total running time. Replacing it with a more
- * straightforward "rep cmpsb" would not drastically degrade
- * performance.
- */
-LoopCmps:
- movl (%esi,%edx), %eax
- xorl (%edi,%edx), %eax
- jnz LeaveLoopCmps
- movl 4(%esi,%edx), %eax
- xorl 4(%edi,%edx), %eax
- jnz LeaveLoopCmps4
- addl $8, %edx
- jnz LoopCmps
- jmp LenMaximum
-LeaveLoopCmps4: addl $4, %edx
-LeaveLoopCmps: testl $0x0000FFFF, %eax
- jnz LenLower
- addl $2, %edx
- shrl $16, %eax
-LenLower: subb $1, %al
- adcl $0, %edx
-
-/* Calculate the length of the match. If it is longer than MAX_MATCH, */
-/* then automatically accept it as the best possible match and leave. */
-
- lea (%edi,%edx), %eax
- movl scan(%esp), %edi
- subl %edi, %eax
- cmpl $MAX_MATCH, %eax
- jge LenMaximum
-
-/* If the length of the match is not longer than the best match we */
-/* have so far, then forget it and return to the lookup loop. */
-
- movl deflatestate(%esp), %edx
- movl bestlen(%esp), %ebx
- cmpl %ebx, %eax
- jg LongerMatch
- movl windowbestlen(%esp), %esi
- movl dsPrev(%edx), %edi
- movl scanend(%esp), %ebx
- movl chainlenwmask(%esp), %edx
- jmp LookupLoop
-
-/* s->match_start = cur_match; */
-/* best_len = len; */
-/* if (len >= nice_match) break; */
-/* scan_end = *(ushf*)(scan+best_len-1); */
-
-LongerMatch: movl nicematch(%esp), %ebx
- movl %eax, bestlen(%esp)
- movl %ecx, dsMatchStart(%edx)
- cmpl %ebx, %eax
- jge LeaveNow
- movl window(%esp), %esi
- addl %eax, %esi
- movl %esi, windowbestlen(%esp)
- movzwl -1(%edi,%eax), %ebx
- movl dsPrev(%edx), %edi
- movl %ebx, scanend(%esp)
- movl chainlenwmask(%esp), %edx
- jmp LookupLoop
-
-/* Accept the current string, with the maximum possible length. */
-
-LenMaximum: movl deflatestate(%esp), %edx
- movl $MAX_MATCH, bestlen(%esp)
- movl %ecx, dsMatchStart(%edx)
-
-/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
-/* return s->lookahead; */
-
-LeaveNow:
- movl deflatestate(%esp), %edx
- movl bestlen(%esp), %ebx
- movl dsLookahead(%edx), %eax
- cmpl %eax, %ebx
- jg LookaheadRet
- movl %ebx, %eax
-LookaheadRet:
-
-/* Restore the stack and return from whence we came. */
-
- addl $LocalVarsSize, %esp
- popl %ebx
- popl %esi
- popl %edi
- popl %ebp
-match_init: ret
diff --git a/funtools/util/zlib-1.2.3/contrib/blast/Makefile b/funtools/util/zlib-1.2.3/contrib/blast/Makefile
deleted file mode 100644
index 9be80ba..0000000
--- a/funtools/util/zlib-1.2.3/contrib/blast/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-blast: blast.c blast.h
- cc -DTEST -o blast blast.c
-
-test: blast
- blast < test.pk | cmp - test.txt
-
-clean:
- rm -f blast blast.o
diff --git a/funtools/util/zlib-1.2.3/contrib/blast/README b/funtools/util/zlib-1.2.3/contrib/blast/README
deleted file mode 100644
index e3a60b3..0000000
--- a/funtools/util/zlib-1.2.3/contrib/blast/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Read blast.h for purpose and usage.
-
-Mark Adler
-madler@alumni.caltech.edu
diff --git a/funtools/util/zlib-1.2.3/contrib/blast/blast.c b/funtools/util/zlib-1.2.3/contrib/blast/blast.c
deleted file mode 100644
index 4ce697a..0000000
--- a/funtools/util/zlib-1.2.3/contrib/blast/blast.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* blast.c
- * Copyright (C) 2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in blast.h
- * version 1.1, 16 Feb 2003
- *
- * blast.c decompresses data compressed by the PKWare Compression Library.
- * This function provides functionality similar to the explode() function of
- * the PKWare library, hence the name "blast".
- *
- * This decompressor is based on the excellent format description provided by
- * Ben Rudiak-Gould in comp.compression on August 13, 2001. Interestingly, the
- * example Ben provided in the post is incorrect. The distance 110001 should
- * instead be 111000. When corrected, the example byte stream becomes:
- *
- * 00 04 82 24 25 8f 80 7f
- *
- * which decompresses to "AIAIAIAIAIAIA" (without the quotes).
- */
-
-/*
- * Change history:
- *
- * 1.0 12 Feb 2003 - First version
- * 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data
- */
-
-#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
-#include "blast.h" /* prototype for blast() */
-
-#define local static /* for local function definitions */
-#define MAXBITS 13 /* maximum code length */
-#define MAXWIN 4096 /* maximum window size */
-
-/* input and output state */
-struct state {
- /* input state */
- blast_in infun; /* input function provided by user */
- void *inhow; /* opaque information passed to infun() */
- unsigned char *in; /* next input location */
- unsigned left; /* available input at in */
- int bitbuf; /* bit buffer */
- int bitcnt; /* number of bits in bit buffer */
-
- /* input limit error return state for bits() and decode() */
- jmp_buf env;
-
- /* output state */
- blast_out outfun; /* output function provided by user */
- void *outhow; /* opaque information passed to outfun() */
- unsigned next; /* index of next write location in out[] */
- int first; /* true to check distances (for first 4K) */
- unsigned char out[MAXWIN]; /* output buffer and sliding window */
-};
-
-/*
- * Return need bits from the input stream. This always leaves less than
- * eight bits in the buffer. bits() works properly for need == 0.
- *
- * Format notes:
- *
- * - Bits are stored in bytes from the least significant bit to the most
- * significant bit. Therefore bits are dropped from the bottom of the bit
- * buffer, using shift right, and new bytes are appended to the top of the
- * bit buffer, using shift left.
- */
-local int bits(struct state *s, int need)
-{
- int val; /* bit accumulator */
-
- /* load at least need bits into val */
- val = s->bitbuf;
- while (s->bitcnt < need) {
- if (s->left == 0) {
- s->left = s->infun(s->inhow, &(s->in));
- if (s->left == 0) longjmp(s->env, 1); /* out of input */
- }
- val |= (int)(*(s->in)++) << s->bitcnt; /* load eight bits */
- s->left--;
- s->bitcnt += 8;
- }
-
- /* drop need bits and update buffer, always zero to seven bits left */
- s->bitbuf = val >> need;
- s->bitcnt -= need;
-
- /* return need bits, zeroing the bits above that */
- return val & ((1 << need) - 1);
-}
-
-/*
- * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of
- * each length, which for a canonical code are stepped through in order.
- * symbol[] are the symbol values in canonical order, where the number of
- * entries is the sum of the counts in count[]. The decoding process can be
- * seen in the function decode() below.
- */
-struct huffman {
- short *count; /* number of symbols of each length */
- short *symbol; /* canonically ordered symbols */
-};
-
-/*
- * Decode a code from the stream s using huffman table h. Return the symbol or
- * a negative value if there is an error. If all of the lengths are zero, i.e.
- * an empty code, or if the code is incomplete and an invalid code is received,
- * then -9 is returned after reading MAXBITS bits.
- *
- * Format notes:
- *
- * - The codes as stored in the compressed data are bit-reversed relative to
- * a simple integer ordering of codes of the same lengths. Hence below the
- * bits are pulled from the compressed data one at a time and used to
- * build the code value reversed from what is in the stream in order to
- * permit simple integer comparisons for decoding.
- *
- * - The first code for the shortest length is all ones. Subsequent codes of
- * the same length are simply integer decrements of the previous code. When
- * moving up a length, a one bit is appended to the code. For a complete
- * code, the last code of the longest length will be all zeros. To support
- * this ordering, the bits pulled during decoding are inverted to apply the
- * more "natural" ordering starting with all zeros and incrementing.
- */
-local int decode(struct state *s, struct huffman *h)
-{
- int len; /* current number of bits in code */
- int code; /* len bits being decoded */
- int first; /* first code of length len */
- int count; /* number of codes of length len */
- int index; /* index of first code of length len in symbol table */
- int bitbuf; /* bits from stream */
- int left; /* bits left in next or left to process */
- short *next; /* next number of codes */
-
- bitbuf = s->bitbuf;
- left = s->bitcnt;
- code = first = index = 0;
- len = 1;
- next = h->count + 1;
- while (1) {
- while (left--) {
- code |= (bitbuf & 1) ^ 1; /* invert code */
- bitbuf >>= 1;
- count = *next++;
- if (code < first + count) { /* if length len, return symbol */
- s->bitbuf = bitbuf;
- s->bitcnt = (s->bitcnt - len) & 7;
- return h->symbol[index + (code - first)];
- }
- index += count; /* else update for next length */
- first += count;
- first <<= 1;
- code <<= 1;
- len++;
- }
- left = (MAXBITS+1) - len;
- if (left == 0) break;
- if (s->left == 0) {
- s->left = s->infun(s->inhow, &(s->in));
- if (s->left == 0) longjmp(s->env, 1); /* out of input */
- }
- bitbuf = *(s->in)++;
- s->left--;
- if (left > 8) left = 8;
- }
- return -9; /* ran out of codes */
-}
-
-/*
- * Given a list of repeated code lengths rep[0..n-1], where each byte is a
- * count (high four bits + 1) and a code length (low four bits), generate the
- * list of code lengths. This compaction reduces the size of the object code.
- * Then given the list of code lengths length[0..n-1] representing a canonical
- * Huffman code for n symbols, construct the tables required to decode those
- * codes. Those tables are the number of codes of each length, and the symbols
- * sorted by length, retaining their original order within each length. The
- * return value is zero for a complete code set, negative for an over-
- * subscribed code set, and positive for an incomplete code set. The tables
- * can be used if the return value is zero or positive, but they cannot be used
- * if the return value is negative. If the return value is zero, it is not
- * possible for decode() using that table to return an error--any stream of
- * enough bits will resolve to a symbol. If the return value is positive, then
- * it is possible for decode() using that table to return an error for received
- * codes past the end of the incomplete lengths.
- */
-local int construct(struct huffman *h, const unsigned char *rep, int n)
-{
- int symbol; /* current symbol when stepping through length[] */
- int len; /* current length when stepping through h->count[] */
- int left; /* number of possible codes left of current length */
- short offs[MAXBITS+1]; /* offsets in symbol table for each length */
- short length[256]; /* code lengths */
-
- /* convert compact repeat counts into symbol bit length list */
- symbol = 0;
- do {
- len = *rep++;
- left = (len >> 4) + 1;
- len &= 15;
- do {
- length[symbol++] = len;
- } while (--left);
- } while (--n);
- n = symbol;
-
- /* count number of codes of each length */
- for (len = 0; len <= MAXBITS; len++)
- h->count[len] = 0;
- for (symbol = 0; symbol < n; symbol++)
- (h->count[length[symbol]])++; /* assumes lengths are within bounds */
- if (h->count[0] == n) /* no codes! */
- return 0; /* complete, but decode() will fail */
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1; /* one possible code of zero length */
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1; /* one more bit, double codes left */
- left -= h->count[len]; /* deduct count from possible codes */
- if (left < 0) return left; /* over-subscribed--return negative */
- } /* left > 0 means incomplete */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + h->count[len];
-
- /*
- * put symbols in table sorted by length, by symbol order within each
- * length
- */
- for (symbol = 0; symbol < n; symbol++)
- if (length[symbol] != 0)
- h->symbol[offs[length[symbol]]++] = symbol;
-
- /* return zero for complete set, positive for incomplete set */
- return left;
-}
-
-/*
- * Decode PKWare Compression Library stream.
- *
- * Format notes:
- *
- * - First byte is 0 if literals are uncoded or 1 if they are coded. Second
- * byte is 4, 5, or 6 for the number of extra bits in the distance code.
- * This is the base-2 logarithm of the dictionary size minus six.
- *
- * - Compressed data is a combination of literals and length/distance pairs
- * terminated by an end code. Literals are either Huffman coded or
- * uncoded bytes. A length/distance pair is a coded length followed by a
- * coded distance to represent a string that occurs earlier in the
- * uncompressed data that occurs again at the current location.
- *
- * - A bit preceding a literal or length/distance pair indicates which comes
- * next, 0 for literals, 1 for length/distance.
- *
- * - If literals are uncoded, then the next eight bits are the literal, in the
- * normal bit order in th stream, i.e. no bit-reversal is needed. Similarly,
- * no bit reversal is needed for either the length extra bits or the distance
- * extra bits.
- *
- * - Literal bytes are simply written to the output. A length/distance pair is
- * an instruction to copy previously uncompressed bytes to the output. The
- * copy is from distance bytes back in the output stream, copying for length
- * bytes.
- *
- * - Distances pointing before the beginning of the output data are not
- * permitted.
- *
- * - Overlapped copies, where the length is greater than the distance, are
- * allowed and common. For example, a distance of one and a length of 518
- * simply copies the last byte 518 times. A distance of four and a length of
- * twelve copies the last four bytes three times. A simple forward copy
- * ignoring whether the length is greater than the distance or not implements
- * this correctly.
- */
-local int decomp(struct state *s)
-{
- int lit; /* true if literals are coded */
- int dict; /* log2(dictionary size) - 6 */
- int symbol; /* decoded symbol, extra bits for distance */
- int len; /* length for copy */
- int dist; /* distance for copy */
- int copy; /* copy counter */
- unsigned char *from, *to; /* copy pointers */
- static int virgin = 1; /* build tables once */
- static short litcnt[MAXBITS+1], litsym[256]; /* litcode memory */
- static short lencnt[MAXBITS+1], lensym[16]; /* lencode memory */
- static short distcnt[MAXBITS+1], distsym[64]; /* distcode memory */
- static struct huffman litcode = {litcnt, litsym}; /* length code */
- static struct huffman lencode = {lencnt, lensym}; /* length code */
- static struct huffman distcode = {distcnt, distsym};/* distance code */
- /* bit lengths of literal codes */
- static const unsigned char litlen[] = {
- 11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 10, 8, 12, 10, 12, 10, 8, 23, 8,
- 9, 7, 6, 7, 8, 7, 6, 55, 8, 23, 24, 12, 11, 7, 9, 11, 12, 6, 7, 22, 5,
- 7, 24, 6, 11, 9, 6, 7, 22, 7, 11, 38, 7, 9, 8, 25, 11, 8, 11, 9, 12,
- 8, 12, 5, 38, 5, 38, 5, 11, 7, 5, 6, 21, 6, 10, 53, 8, 7, 24, 10, 27,
- 44, 253, 253, 253, 252, 252, 252, 13, 12, 45, 12, 45, 12, 61, 12, 45,
- 44, 173};
- /* bit lengths of length codes 0..15 */
- static const unsigned char lenlen[] = {2, 35, 36, 53, 38, 23};
- /* bit lengths of distance codes 0..63 */
- static const unsigned char distlen[] = {2, 20, 53, 230, 247, 151, 248};
- static const short base[16] = { /* base for length codes */
- 3, 2, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24, 40, 72, 136, 264};
- static const char extra[16] = { /* extra bits for length codes */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8};
-
- /* set up decoding tables (once--might not be thread-safe) */
- if (virgin) {
- construct(&litcode, litlen, sizeof(litlen));
- construct(&lencode, lenlen, sizeof(lenlen));
- construct(&distcode, distlen, sizeof(distlen));
- virgin = 0;
- }
-
- /* read header */
- lit = bits(s, 8);
- if (lit > 1) return -1;
- dict = bits(s, 8);
- if (dict < 4 || dict > 6) return -2;
-
- /* decode literals and length/distance pairs */
- do {
- if (bits(s, 1)) {
- /* get length */
- symbol = decode(s, &lencode);
- len = base[symbol] + bits(s, extra[symbol]);
- if (len == 519) break; /* end code */
-
- /* get distance */
- symbol = len == 2 ? 2 : dict;
- dist = decode(s, &distcode) << symbol;
- dist += bits(s, symbol);
- dist++;
- if (s->first && dist > s->next)
- return -3; /* distance too far back */
-
- /* copy length bytes from distance bytes back */
- do {
- to = s->out + s->next;
- from = to - dist;
- copy = MAXWIN;
- if (s->next < dist) {
- from += copy;
- copy = dist;
- }
- copy -= s->next;
- if (copy > len) copy = len;
- len -= copy;
- s->next += copy;
- do {
- *to++ = *from++;
- } while (--copy);
- if (s->next == MAXWIN) {
- if (s->outfun(s->outhow, s->out, s->next)) return 1;
- s->next = 0;
- s->first = 0;
- }
- } while (len != 0);
- }
- else {
- /* get literal and write it */
- symbol = lit ? decode(s, &litcode) : bits(s, 8);
- s->out[s->next++] = symbol;
- if (s->next == MAXWIN) {
- if (s->outfun(s->outhow, s->out, s->next)) return 1;
- s->next = 0;
- s->first = 0;
- }
- }
- } while (1);
- return 0;
-}
-
-/* See comments in blast.h */
-int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
-{
- struct state s; /* input/output state */
- int err; /* return value */
-
- /* initialize input state */
- s.infun = infun;
- s.inhow = inhow;
- s.left = 0;
- s.bitbuf = 0;
- s.bitcnt = 0;
-
- /* initialize output state */
- s.outfun = outfun;
- s.outhow = outhow;
- s.next = 0;
- s.first = 1;
-
- /* return if bits() or decode() tries to read past available input */
- if (setjmp(s.env) != 0) /* if came back here via longjmp(), */
- err = 2; /* then skip decomp(), return error */
- else
- err = decomp(&s); /* decompress */
-
- /* write any leftover output and update the error code if needed */
- if (err != 1 && s.next && s.outfun(s.outhow, s.out, s.next) && err == 0)
- err = 1;
- return err;
-}
-
-#ifdef TEST
-/* Example of how to use blast() */
-#include <stdio.h>
-#include <stdlib.h>
-
-#define CHUNK 16384
-
-local unsigned inf(void *how, unsigned char **buf)
-{
- static unsigned char hold[CHUNK];
-
- *buf = hold;
- return fread(hold, 1, CHUNK, (FILE *)how);
-}
-
-local int outf(void *how, unsigned char *buf, unsigned len)
-{
- return fwrite(buf, 1, len, (FILE *)how) != len;
-}
-
-/* Decompress a PKWare Compression Library stream from stdin to stdout */
-int main(void)
-{
- int ret, n;
-
- /* decompress to stdout */
- ret = blast(inf, stdin, outf, stdout);
- if (ret != 0) fprintf(stderr, "blast error: %d\n", ret);
-
- /* see if there are any leftover bytes */
- n = 0;
- while (getchar() != EOF) n++;
- if (n) fprintf(stderr, "blast warning: %d unused bytes of input\n", n);
-
- /* return blast() error code */
- return ret;
-}
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/blast/blast.h b/funtools/util/zlib-1.2.3/contrib/blast/blast.h
deleted file mode 100644
index ce9e541..0000000
--- a/funtools/util/zlib-1.2.3/contrib/blast/blast.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* blast.h -- interface for blast.c
- Copyright (C) 2003 Mark Adler
- version 1.1, 16 Feb 2003
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Mark Adler madler@alumni.caltech.edu
- */
-
-
-/*
- * blast() decompresses the PKWare Data Compression Library (DCL) compressed
- * format. It provides the same functionality as the explode() function in
- * that library. (Note: PKWare overused the "implode" verb, and the format
- * used by their library implode() function is completely different and
- * incompatible with the implode compression method supported by PKZIP.)
- */
-
-
-typedef unsigned (*blast_in)(void *how, unsigned char **buf);
-typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
-/* Definitions for input/output functions passed to blast(). See below for
- * what the provided functions need to do.
- */
-
-
-int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
-/* Decompress input to output using the provided infun() and outfun() calls.
- * On success, the return value of blast() is zero. If there is an error in
- * the source data, i.e. it is not in the proper format, then a negative value
- * is returned. If there is not enough input available or there is not enough
- * output space, then a positive error is returned.
- *
- * The input function is invoked: len = infun(how, &buf), where buf is set by
- * infun() to point to the input buffer, and infun() returns the number of
- * available bytes there. If infun() returns zero, then blast() returns with
- * an input error. (blast() only asks for input if it needs it.) inhow is for
- * use by the application to pass an input descriptor to infun(), if desired.
- *
- * The output function is invoked: err = outfun(how, buf, len), where the bytes
- * to be written are buf[0..len-1]. If err is not zero, then blast() returns
- * with an output error. outfun() is always called with len <= 4096. outhow
- * is for use by the application to pass an output descriptor to outfun(), if
- * desired.
- *
- * The return codes are:
- *
- * 2: ran out of input before completing decompression
- * 1: output error before completing decompression
- * 0: successful decompression
- * -1: literal flag not zero or one
- * -2: dictionary size not in 4..6
- * -3: distance is too far back
- *
- * At the bottom of blast.c is an example program that uses blast() that can be
- * compiled to produce a command-line decompression filter by defining TEST.
- */
diff --git a/funtools/util/zlib-1.2.3/contrib/blast/test.pk b/funtools/util/zlib-1.2.3/contrib/blast/test.pk
deleted file mode 100644
index be10b2b..0000000
--- a/funtools/util/zlib-1.2.3/contrib/blast/test.pk
+++ /dev/null
Binary files differ
diff --git a/funtools/util/zlib-1.2.3/contrib/blast/test.txt b/funtools/util/zlib-1.2.3/contrib/blast/test.txt
deleted file mode 100644
index bfdf1c5..0000000
--- a/funtools/util/zlib-1.2.3/contrib/blast/test.txt
+++ /dev/null
@@ -1 +0,0 @@
-AIAIAIAIAIAIA \ No newline at end of file
diff --git a/funtools/util/zlib-1.2.3/contrib/delphi/ZLib.pas b/funtools/util/zlib-1.2.3/contrib/delphi/ZLib.pas
deleted file mode 100644
index 3f2b8b4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/delphi/ZLib.pas
+++ /dev/null
@@ -1,557 +0,0 @@
-{*******************************************************}
-{ }
-{ Borland Delphi Supplemental Components }
-{ ZLIB Data Compression Interface Unit }
-{ }
-{ Copyright (c) 1997,99 Borland Corporation }
-{ }
-{*******************************************************}
-
-{ Updated for zlib 1.2.x by Cosmin Truta <cosmint@cs.ubbcluj.ro> }
-
-unit ZLib;
-
-interface
-
-uses SysUtils, Classes;
-
-type
- TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; cdecl;
- TFree = procedure (AppData, Block: Pointer); cdecl;
-
- // Internal structure. Ignore.
- TZStreamRec = packed record
- next_in: PChar; // next input byte
- avail_in: Integer; // number of bytes available at next_in
- total_in: Longint; // total nb of input bytes read so far
-
- next_out: PChar; // next output byte should be put here
- avail_out: Integer; // remaining free space at next_out
- total_out: Longint; // total nb of bytes output so far
-
- msg: PChar; // last error message, NULL if no error
- internal: Pointer; // not visible by applications
-
- zalloc: TAlloc; // used to allocate the internal state
- zfree: TFree; // used to free the internal state
- AppData: Pointer; // private data object passed to zalloc and zfree
-
- data_type: Integer; // best guess about the data type: ascii or binary
- adler: Longint; // adler32 value of the uncompressed data
- reserved: Longint; // reserved for future use
- end;
-
- // Abstract ancestor class
- TCustomZlibStream = class(TStream)
- private
- FStrm: TStream;
- FStrmPos: Integer;
- FOnProgress: TNotifyEvent;
- FZRec: TZStreamRec;
- FBuffer: array [Word] of Char;
- protected
- procedure Progress(Sender: TObject); dynamic;
- property OnProgress: TNotifyEvent read FOnProgress write FOnProgress;
- constructor Create(Strm: TStream);
- end;
-
-{ TCompressionStream compresses data on the fly as data is written to it, and
- stores the compressed data to another stream.
-
- TCompressionStream is write-only and strictly sequential. Reading from the
- stream will raise an exception. Using Seek to move the stream pointer
- will raise an exception.
-
- Output data is cached internally, written to the output stream only when
- the internal output buffer is full. All pending output data is flushed
- when the stream is destroyed.
-
- The Position property returns the number of uncompressed bytes of
- data that have been written to the stream so far.
-
- CompressionRate returns the on-the-fly percentage by which the original
- data has been compressed: (1 - (CompressedBytes / UncompressedBytes)) * 100
- If raw data size = 100 and compressed data size = 25, the CompressionRate
- is 75%
-
- The OnProgress event is called each time the output buffer is filled and
- written to the output stream. This is useful for updating a progress
- indicator when you are writing a large chunk of data to the compression
- stream in a single call.}
-
-
- TCompressionLevel = (clNone, clFastest, clDefault, clMax);
-
- TCompressionStream = class(TCustomZlibStream)
- private
- function GetCompressionRate: Single;
- public
- constructor Create(CompressionLevel: TCompressionLevel; Dest: TStream);
- destructor Destroy; override;
- function Read(var Buffer; Count: Longint): Longint; override;
- function Write(const Buffer; Count: Longint): Longint; override;
- function Seek(Offset: Longint; Origin: Word): Longint; override;
- property CompressionRate: Single read GetCompressionRate;
- property OnProgress;
- end;
-
-{ TDecompressionStream decompresses data on the fly as data is read from it.
-
- Compressed data comes from a separate source stream. TDecompressionStream
- is read-only and unidirectional; you can seek forward in the stream, but not
- backwards. The special case of setting the stream position to zero is
- allowed. Seeking forward decompresses data until the requested position in
- the uncompressed data has been reached. Seeking backwards, seeking relative
- to the end of the stream, requesting the size of the stream, and writing to
- the stream will raise an exception.
-
- The Position property returns the number of bytes of uncompressed data that
- have been read from the stream so far.
-
- The OnProgress event is called each time the internal input buffer of
- compressed data is exhausted and the next block is read from the input stream.
- This is useful for updating a progress indicator when you are reading a
- large chunk of data from the decompression stream in a single call.}
-
- TDecompressionStream = class(TCustomZlibStream)
- public
- constructor Create(Source: TStream);
- destructor Destroy; override;
- function Read(var Buffer; Count: Longint): Longint; override;
- function Write(const Buffer; Count: Longint): Longint; override;
- function Seek(Offset: Longint; Origin: Word): Longint; override;
- property OnProgress;
- end;
-
-
-
-{ CompressBuf compresses data, buffer to buffer, in one call.
- In: InBuf = ptr to compressed data
- InBytes = number of bytes in InBuf
- Out: OutBuf = ptr to newly allocated buffer containing decompressed data
- OutBytes = number of bytes in OutBuf }
-procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
- out OutBuf: Pointer; out OutBytes: Integer);
-
-
-{ DecompressBuf decompresses data, buffer to buffer, in one call.
- In: InBuf = ptr to compressed data
- InBytes = number of bytes in InBuf
- OutEstimate = zero, or est. size of the decompressed data
- Out: OutBuf = ptr to newly allocated buffer containing decompressed data
- OutBytes = number of bytes in OutBuf }
-procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer;
- OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer);
-
-{ DecompressToUserBuf decompresses data, buffer to buffer, in one call.
- In: InBuf = ptr to compressed data
- InBytes = number of bytes in InBuf
- Out: OutBuf = ptr to user-allocated buffer to contain decompressed data
- BufSize = number of bytes in OutBuf }
-procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
- const OutBuf: Pointer; BufSize: Integer);
-
-const
- zlib_version = '1.2.3';
-
-type
- EZlibError = class(Exception);
- ECompressionError = class(EZlibError);
- EDecompressionError = class(EZlibError);
-
-implementation
-
-uses ZLibConst;
-
-const
- Z_NO_FLUSH = 0;
- Z_PARTIAL_FLUSH = 1;
- Z_SYNC_FLUSH = 2;
- Z_FULL_FLUSH = 3;
- Z_FINISH = 4;
-
- Z_OK = 0;
- Z_STREAM_END = 1;
- Z_NEED_DICT = 2;
- Z_ERRNO = (-1);
- Z_STREAM_ERROR = (-2);
- Z_DATA_ERROR = (-3);
- Z_MEM_ERROR = (-4);
- Z_BUF_ERROR = (-5);
- Z_VERSION_ERROR = (-6);
-
- Z_NO_COMPRESSION = 0;
- Z_BEST_SPEED = 1;
- Z_BEST_COMPRESSION = 9;
- Z_DEFAULT_COMPRESSION = (-1);
-
- Z_FILTERED = 1;
- Z_HUFFMAN_ONLY = 2;
- Z_RLE = 3;
- Z_DEFAULT_STRATEGY = 0;
-
- Z_BINARY = 0;
- Z_ASCII = 1;
- Z_UNKNOWN = 2;
-
- Z_DEFLATED = 8;
-
-
-{$L adler32.obj}
-{$L compress.obj}
-{$L crc32.obj}
-{$L deflate.obj}
-{$L infback.obj}
-{$L inffast.obj}
-{$L inflate.obj}
-{$L inftrees.obj}
-{$L trees.obj}
-{$L uncompr.obj}
-{$L zutil.obj}
-
-procedure adler32; external;
-procedure compressBound; external;
-procedure crc32; external;
-procedure deflateInit2_; external;
-procedure deflateParams; external;
-
-function _malloc(Size: Integer): Pointer; cdecl;
-begin
- Result := AllocMem(Size);
-end;
-
-procedure _free(Block: Pointer); cdecl;
-begin
- FreeMem(Block);
-end;
-
-procedure _memset(P: Pointer; B: Byte; count: Integer); cdecl;
-begin
- FillChar(P^, count, B);
-end;
-
-procedure _memcpy(dest, source: Pointer; count: Integer); cdecl;
-begin
- Move(source^, dest^, count);
-end;
-
-
-
-// deflate compresses data
-function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar;
- recsize: Integer): Integer; external;
-function deflate(var strm: TZStreamRec; flush: Integer): Integer; external;
-function deflateEnd(var strm: TZStreamRec): Integer; external;
-
-// inflate decompresses data
-function inflateInit_(var strm: TZStreamRec; version: PChar;
- recsize: Integer): Integer; external;
-function inflate(var strm: TZStreamRec; flush: Integer): Integer; external;
-function inflateEnd(var strm: TZStreamRec): Integer; external;
-function inflateReset(var strm: TZStreamRec): Integer; external;
-
-
-function zlibAllocMem(AppData: Pointer; Items, Size: Integer): Pointer; cdecl;
-begin
-// GetMem(Result, Items*Size);
- Result := AllocMem(Items * Size);
-end;
-
-procedure zlibFreeMem(AppData, Block: Pointer); cdecl;
-begin
- FreeMem(Block);
-end;
-
-{function zlibCheck(code: Integer): Integer;
-begin
- Result := code;
- if code < 0 then
- raise EZlibError.Create('error'); //!!
-end;}
-
-function CCheck(code: Integer): Integer;
-begin
- Result := code;
- if code < 0 then
- raise ECompressionError.Create('error'); //!!
-end;
-
-function DCheck(code: Integer): Integer;
-begin
- Result := code;
- if code < 0 then
- raise EDecompressionError.Create('error'); //!!
-end;
-
-procedure CompressBuf(const InBuf: Pointer; InBytes: Integer;
- out OutBuf: Pointer; out OutBytes: Integer);
-var
- strm: TZStreamRec;
- P: Pointer;
-begin
- FillChar(strm, sizeof(strm), 0);
- strm.zalloc := zlibAllocMem;
- strm.zfree := zlibFreeMem;
- OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255;
- GetMem(OutBuf, OutBytes);
- try
- strm.next_in := InBuf;
- strm.avail_in := InBytes;
- strm.next_out := OutBuf;
- strm.avail_out := OutBytes;
- CCheck(deflateInit_(strm, Z_BEST_COMPRESSION, zlib_version, sizeof(strm)));
- try
- while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do
- begin
- P := OutBuf;
- Inc(OutBytes, 256);
- ReallocMem(OutBuf, OutBytes);
- strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
- strm.avail_out := 256;
- end;
- finally
- CCheck(deflateEnd(strm));
- end;
- ReallocMem(OutBuf, strm.total_out);
- OutBytes := strm.total_out;
- except
- FreeMem(OutBuf);
- raise
- end;
-end;
-
-
-procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer;
- OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer);
-var
- strm: TZStreamRec;
- P: Pointer;
- BufInc: Integer;
-begin
- FillChar(strm, sizeof(strm), 0);
- strm.zalloc := zlibAllocMem;
- strm.zfree := zlibFreeMem;
- BufInc := (InBytes + 255) and not 255;
- if OutEstimate = 0 then
- OutBytes := BufInc
- else
- OutBytes := OutEstimate;
- GetMem(OutBuf, OutBytes);
- try
- strm.next_in := InBuf;
- strm.avail_in := InBytes;
- strm.next_out := OutBuf;
- strm.avail_out := OutBytes;
- DCheck(inflateInit_(strm, zlib_version, sizeof(strm)));
- try
- while DCheck(inflate(strm, Z_NO_FLUSH)) <> Z_STREAM_END do
- begin
- P := OutBuf;
- Inc(OutBytes, BufInc);
- ReallocMem(OutBuf, OutBytes);
- strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
- strm.avail_out := BufInc;
- end;
- finally
- DCheck(inflateEnd(strm));
- end;
- ReallocMem(OutBuf, strm.total_out);
- OutBytes := strm.total_out;
- except
- FreeMem(OutBuf);
- raise
- end;
-end;
-
-procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
- const OutBuf: Pointer; BufSize: Integer);
-var
- strm: TZStreamRec;
-begin
- FillChar(strm, sizeof(strm), 0);
- strm.zalloc := zlibAllocMem;
- strm.zfree := zlibFreeMem;
- strm.next_in := InBuf;
- strm.avail_in := InBytes;
- strm.next_out := OutBuf;
- strm.avail_out := BufSize;
- DCheck(inflateInit_(strm, zlib_version, sizeof(strm)));
- try
- if DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END then
- raise EZlibError.CreateRes(@sTargetBufferTooSmall);
- finally
- DCheck(inflateEnd(strm));
- end;
-end;
-
-// TCustomZlibStream
-
-constructor TCustomZLibStream.Create(Strm: TStream);
-begin
- inherited Create;
- FStrm := Strm;
- FStrmPos := Strm.Position;
- FZRec.zalloc := zlibAllocMem;
- FZRec.zfree := zlibFreeMem;
-end;
-
-procedure TCustomZLibStream.Progress(Sender: TObject);
-begin
- if Assigned(FOnProgress) then FOnProgress(Sender);
-end;
-
-
-// TCompressionStream
-
-constructor TCompressionStream.Create(CompressionLevel: TCompressionLevel;
- Dest: TStream);
-const
- Levels: array [TCompressionLevel] of ShortInt =
- (Z_NO_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION);
-begin
- inherited Create(Dest);
- FZRec.next_out := FBuffer;
- FZRec.avail_out := sizeof(FBuffer);
- CCheck(deflateInit_(FZRec, Levels[CompressionLevel], zlib_version, sizeof(FZRec)));
-end;
-
-destructor TCompressionStream.Destroy;
-begin
- FZRec.next_in := nil;
- FZRec.avail_in := 0;
- try
- if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos;
- while (CCheck(deflate(FZRec, Z_FINISH)) <> Z_STREAM_END)
- and (FZRec.avail_out = 0) do
- begin
- FStrm.WriteBuffer(FBuffer, sizeof(FBuffer));
- FZRec.next_out := FBuffer;
- FZRec.avail_out := sizeof(FBuffer);
- end;
- if FZRec.avail_out < sizeof(FBuffer) then
- FStrm.WriteBuffer(FBuffer, sizeof(FBuffer) - FZRec.avail_out);
- finally
- deflateEnd(FZRec);
- end;
- inherited Destroy;
-end;
-
-function TCompressionStream.Read(var Buffer; Count: Longint): Longint;
-begin
- raise ECompressionError.CreateRes(@sInvalidStreamOp);
-end;
-
-function TCompressionStream.Write(const Buffer; Count: Longint): Longint;
-begin
- FZRec.next_in := @Buffer;
- FZRec.avail_in := Count;
- if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos;
- while (FZRec.avail_in > 0) do
- begin
- CCheck(deflate(FZRec, 0));
- if FZRec.avail_out = 0 then
- begin
- FStrm.WriteBuffer(FBuffer, sizeof(FBuffer));
- FZRec.next_out := FBuffer;
- FZRec.avail_out := sizeof(FBuffer);
- FStrmPos := FStrm.Position;
- Progress(Self);
- end;
- end;
- Result := Count;
-end;
-
-function TCompressionStream.Seek(Offset: Longint; Origin: Word): Longint;
-begin
- if (Offset = 0) and (Origin = soFromCurrent) then
- Result := FZRec.total_in
- else
- raise ECompressionError.CreateRes(@sInvalidStreamOp);
-end;
-
-function TCompressionStream.GetCompressionRate: Single;
-begin
- if FZRec.total_in = 0 then
- Result := 0
- else
- Result := (1.0 - (FZRec.total_out / FZRec.total_in)) * 100.0;
-end;
-
-
-// TDecompressionStream
-
-constructor TDecompressionStream.Create(Source: TStream);
-begin
- inherited Create(Source);
- FZRec.next_in := FBuffer;
- FZRec.avail_in := 0;
- DCheck(inflateInit_(FZRec, zlib_version, sizeof(FZRec)));
-end;
-
-destructor TDecompressionStream.Destroy;
-begin
- FStrm.Seek(-FZRec.avail_in, 1);
- inflateEnd(FZRec);
- inherited Destroy;
-end;
-
-function TDecompressionStream.Read(var Buffer; Count: Longint): Longint;
-begin
- FZRec.next_out := @Buffer;
- FZRec.avail_out := Count;
- if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos;
- while (FZRec.avail_out > 0) do
- begin
- if FZRec.avail_in = 0 then
- begin
- FZRec.avail_in := FStrm.Read(FBuffer, sizeof(FBuffer));
- if FZRec.avail_in = 0 then
- begin
- Result := Count - FZRec.avail_out;
- Exit;
- end;
- FZRec.next_in := FBuffer;
- FStrmPos := FStrm.Position;
- Progress(Self);
- end;
- CCheck(inflate(FZRec, 0));
- end;
- Result := Count;
-end;
-
-function TDecompressionStream.Write(const Buffer; Count: Longint): Longint;
-begin
- raise EDecompressionError.CreateRes(@sInvalidStreamOp);
-end;
-
-function TDecompressionStream.Seek(Offset: Longint; Origin: Word): Longint;
-var
- I: Integer;
- Buf: array [0..4095] of Char;
-begin
- if (Offset = 0) and (Origin = soFromBeginning) then
- begin
- DCheck(inflateReset(FZRec));
- FZRec.next_in := FBuffer;
- FZRec.avail_in := 0;
- FStrm.Position := 0;
- FStrmPos := 0;
- end
- else if ( (Offset >= 0) and (Origin = soFromCurrent)) or
- ( ((Offset - FZRec.total_out) > 0) and (Origin = soFromBeginning)) then
- begin
- if Origin = soFromBeginning then Dec(Offset, FZRec.total_out);
- if Offset > 0 then
- begin
- for I := 1 to Offset div sizeof(Buf) do
- ReadBuffer(Buf, sizeof(Buf));
- ReadBuffer(Buf, Offset mod sizeof(Buf));
- end;
- end
- else
- raise EDecompressionError.CreateRes(@sInvalidStreamOp);
- Result := FZRec.total_out;
-end;
-
-
-end.
diff --git a/funtools/util/zlib-1.2.3/contrib/delphi/ZLibConst.pas b/funtools/util/zlib-1.2.3/contrib/delphi/ZLibConst.pas
deleted file mode 100644
index cdfe136..0000000
--- a/funtools/util/zlib-1.2.3/contrib/delphi/ZLibConst.pas
+++ /dev/null
@@ -1,11 +0,0 @@
-unit ZLibConst;
-
-interface
-
-resourcestring
- sTargetBufferTooSmall = 'ZLib error: target buffer may be too small';
- sInvalidStreamOp = 'Invalid stream operation';
-
-implementation
-
-end.
diff --git a/funtools/util/zlib-1.2.3/contrib/delphi/readme.txt b/funtools/util/zlib-1.2.3/contrib/delphi/readme.txt
deleted file mode 100644
index 2dc9a8b..0000000
--- a/funtools/util/zlib-1.2.3/contrib/delphi/readme.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-
-Overview
-========
-
-This directory contains an update to the ZLib interface unit,
-distributed by Borland as a Delphi supplemental component.
-
-The original ZLib unit is Copyright (c) 1997,99 Borland Corp.,
-and is based on zlib version 1.0.4. There are a series of bugs
-and security problems associated with that old zlib version, and
-we recommend the users to update their ZLib unit.
-
-
-Summary of modifications
-========================
-
-- Improved makefile, adapted to zlib version 1.2.1.
-
-- Some field types from TZStreamRec are changed from Integer to
- Longint, for consistency with the zlib.h header, and for 64-bit
- readiness.
-
-- The zlib_version constant is updated.
-
-- The new Z_RLE strategy has its corresponding symbolic constant.
-
-- The allocation and deallocation functions and function types
- (TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl,
- and _malloc and _free are added as C RTL stubs. As a result,
- the original C sources of zlib can be compiled out of the box,
- and linked to the ZLib unit.
-
-
-Suggestions for improvements
-============================
-
-Currently, the ZLib unit provides only a limited wrapper around
-the zlib library, and much of the original zlib functionality is
-missing. Handling compressed file formats like ZIP/GZIP or PNG
-cannot be implemented without having this functionality.
-Applications that handle these formats are either using their own,
-duplicated code, or not using the ZLib unit at all.
-
-Here are a few suggestions:
-
-- Checksum class wrappers around adler32() and crc32(), similar
- to the Java classes that implement the java.util.zip.Checksum
- interface.
-
-- The ability to read and write raw deflate streams, without the
- zlib stream header and trailer. Raw deflate streams are used
- in the ZIP file format.
-
-- The ability to read and write gzip streams, used in the GZIP
- file format, and normally produced by the gzip program.
-
-- The ability to select a different compression strategy, useful
- to PNG and MNG image compression, and to multimedia compression
- in general. Besides the compression level
-
- TCompressionLevel = (clNone, clFastest, clDefault, clMax);
-
- which, in fact, could have used the 'z' prefix and avoided
- TColor-like symbols
-
- TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax);
-
- there could be a compression strategy
-
- TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle);
-
-- ZIP and GZIP stream handling via TStreams.
-
-
---
-Cosmin Truta <cosmint@cs.ubbcluj.ro>
diff --git a/funtools/util/zlib-1.2.3/contrib/delphi/zlibd32.mak b/funtools/util/zlib-1.2.3/contrib/delphi/zlibd32.mak
deleted file mode 100644
index 88fafa0..0000000
--- a/funtools/util/zlib-1.2.3/contrib/delphi/zlibd32.mak
+++ /dev/null
@@ -1,93 +0,0 @@
-# Makefile for zlib
-# For use with Delphi and C++ Builder under Win32
-# Updated for zlib 1.2.x by Cosmin Truta
-
-# ------------ Borland C++ ------------
-
-# This project uses the Delphi (fastcall/register) calling convention:
-LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl
-
-CC = bcc32
-LD = bcc32
-AR = tlib
-# do not use "-pr" in CFLAGS
-CFLAGS = -a -d -k- -O2 $(LOC)
-LDFLAGS =
-
-
-# variables
-ZLIB_LIB = zlib.lib
-
-OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
-OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj
-OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
-
-
-# targets
-all: $(ZLIB_LIB) example.exe minigzip.exe
-
-.c.obj:
- $(CC) -c $(CFLAGS) $*.c
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-
-
-# For the sake of the old Borland make,
-# the command line is cut to fit in the MS-DOS 128 byte limit:
-$(ZLIB_LIB): $(OBJ1) $(OBJ2)
- -del $(ZLIB_LIB)
- $(AR) $(ZLIB_LIB) $(OBJP1)
- $(AR) $(ZLIB_LIB) $(OBJP2)
-
-
-# testing
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-example.exe: example.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
-
-minigzip.exe: minigzip.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
-
-
-# cleanup
-clean:
- -del *.obj
- -del *.exe
- -del *.lib
- -del *.tds
- -del zlib.bak
- -del foo.gz
-
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.build b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.build
deleted file mode 100644
index ed19cc9..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.build
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<project name="DotZLib" default="build" basedir="./DotZLib">
- <description>A .Net wrapper library around ZLib1.dll</description>
-
- <property name="nunit.location" value="c:/program files/NUnit V2.1/bin" />
- <property name="build.root" value="bin" />
-
- <property name="debug" value="true" />
- <property name="nunit" value="true" />
-
- <property name="build.folder" value="${build.root}/debug/" if="${debug}" />
- <property name="build.folder" value="${build.root}/release/" unless="${debug}" />
-
- <target name="clean" description="Remove all generated files">
- <delete dir="${build.root}" failonerror="false" />
- </target>
-
- <target name="build" description="compiles the source code">
-
- <mkdir dir="${build.folder}" />
- <csc target="library" output="${build.folder}DotZLib.dll" debug="${debug}">
- <references basedir="${nunit.location}">
- <includes if="${nunit}" name="nunit.framework.dll" />
- </references>
- <sources>
- <includes name="*.cs" />
- <excludes name="UnitTests.cs" unless="${nunit}" />
- </sources>
- <arg value="/d:nunit" if="${nunit}" />
- </csc>
- </target>
-
-</project> \ No newline at end of file
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.sln b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.sln
deleted file mode 100644
index ac45ca0..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib.sln
+++ /dev/null
@@ -1,21 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET
- {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET
- {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET
- {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs
deleted file mode 100644
index 6fc0fdc..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("DotZLib")]
-[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Henrik Ravn")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs
deleted file mode 100644
index dfe7e90..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs
+++ /dev/null
@@ -1,202 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-
-namespace DotZLib
-{
- #region ChecksumGeneratorBase
- /// <summary>
- /// Implements the common functionality needed for all <see cref="ChecksumGenerator"/>s
- /// </summary>
- /// <example></example>
- public abstract class ChecksumGeneratorBase : ChecksumGenerator
- {
- /// <summary>
- /// The value of the current checksum
- /// </summary>
- protected uint _current;
-
- /// <summary>
- /// Initializes a new instance of the checksum generator base - the current checksum is
- /// set to zero
- /// </summary>
- public ChecksumGeneratorBase()
- {
- _current = 0;
- }
-
- /// <summary>
- /// Initializes a new instance of the checksum generator basewith a specified value
- /// </summary>
- /// <param name="initialValue">The value to set the current checksum to</param>
- public ChecksumGeneratorBase(uint initialValue)
- {
- _current = initialValue;
- }
-
- /// <summary>
- /// Resets the current checksum to zero
- /// </summary>
- public void Reset() { _current = 0; }
-
- /// <summary>
- /// Gets the current checksum value
- /// </summary>
- public uint Value { get { return _current; } }
-
- /// <summary>
- /// Updates the current checksum with part of an array of bytes
- /// </summary>
- /// <param name="data">The data to update the checksum with</param>
- /// <param name="offset">Where in <c>data</c> to start updating</param>
- /// <param name="count">The number of bytes from <c>data</c> to use</param>
- /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
- /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
- /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
- /// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one.
- /// This is therefore the only method a derived class has to implement</remarks>
- public abstract void Update(byte[] data, int offset, int count);
-
- /// <summary>
- /// Updates the current checksum with an array of bytes.
- /// </summary>
- /// <param name="data">The data to update the checksum with</param>
- public void Update(byte[] data)
- {
- Update(data, 0, data.Length);
- }
-
- /// <summary>
- /// Updates the current checksum with the data from a string
- /// </summary>
- /// <param name="data">The string to update the checksum with</param>
- /// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
- public void Update(string data)
- {
- Update(Encoding.UTF8.GetBytes(data));
- }
-
- /// <summary>
- /// Updates the current checksum with the data from a string, using a specific encoding
- /// </summary>
- /// <param name="data">The string to update the checksum with</param>
- /// <param name="encoding">The encoding to use</param>
- public void Update(string data, Encoding encoding)
- {
- Update(encoding.GetBytes(data));
- }
-
- }
- #endregion
-
- #region CRC32
- /// <summary>
- /// Implements a CRC32 checksum generator
- /// </summary>
- public sealed class CRC32Checksum : ChecksumGeneratorBase
- {
- #region DLL imports
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern uint crc32(uint crc, int data, uint length);
-
- #endregion
-
- /// <summary>
- /// Initializes a new instance of the CRC32 checksum generator
- /// </summary>
- public CRC32Checksum() : base() {}
-
- /// <summary>
- /// Initializes a new instance of the CRC32 checksum generator with a specified value
- /// </summary>
- /// <param name="initialValue">The value to set the current checksum to</param>
- public CRC32Checksum(uint initialValue) : base(initialValue) {}
-
- /// <summary>
- /// Updates the current checksum with part of an array of bytes
- /// </summary>
- /// <param name="data">The data to update the checksum with</param>
- /// <param name="offset">Where in <c>data</c> to start updating</param>
- /// <param name="count">The number of bytes from <c>data</c> to use</param>
- /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
- /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
- /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
- public override void Update(byte[] data, int offset, int count)
- {
- if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
- if ((offset+count) > data.Length) throw new ArgumentException();
- GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
- try
- {
- _current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
- }
- finally
- {
- hData.Free();
- }
- }
-
- }
- #endregion
-
- #region Adler
- /// <summary>
- /// Implements a checksum generator that computes the Adler checksum on data
- /// </summary>
- public sealed class AdlerChecksum : ChecksumGeneratorBase
- {
- #region DLL imports
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern uint adler32(uint adler, int data, uint length);
-
- #endregion
-
- /// <summary>
- /// Initializes a new instance of the Adler checksum generator
- /// </summary>
- public AdlerChecksum() : base() {}
-
- /// <summary>
- /// Initializes a new instance of the Adler checksum generator with a specified value
- /// </summary>
- /// <param name="initialValue">The value to set the current checksum to</param>
- public AdlerChecksum(uint initialValue) : base(initialValue) {}
-
- /// <summary>
- /// Updates the current checksum with part of an array of bytes
- /// </summary>
- /// <param name="data">The data to update the checksum with</param>
- /// <param name="offset">Where in <c>data</c> to start updating</param>
- /// <param name="count">The number of bytes from <c>data</c> to use</param>
- /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
- /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
- /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
- public override void Update(byte[] data, int offset, int count)
- {
- if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
- if ((offset+count) > data.Length) throw new ArgumentException();
- GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
- try
- {
- _current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
- }
- finally
- {
- hData.Free();
- }
- }
-
- }
- #endregion
-
-} \ No newline at end of file
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CircularBuffer.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CircularBuffer.cs
deleted file mode 100644
index 16997e9..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CircularBuffer.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.Diagnostics;
-
-namespace DotZLib
-{
-
- /// <summary>
- /// This class implements a circular buffer
- /// </summary>
- internal class CircularBuffer
- {
- #region Private data
- private int _capacity;
- private int _head;
- private int _tail;
- private int _size;
- private byte[] _buffer;
- #endregion
-
- public CircularBuffer(int capacity)
- {
- Debug.Assert( capacity > 0 );
- _buffer = new byte[capacity];
- _capacity = capacity;
- _head = 0;
- _tail = 0;
- _size = 0;
- }
-
- public int Size { get { return _size; } }
-
- public int Put(byte[] source, int offset, int count)
- {
- Debug.Assert( count > 0 );
- int trueCount = Math.Min(count, _capacity - Size);
- for (int i = 0; i < trueCount; ++i)
- _buffer[(_tail+i) % _capacity] = source[offset+i];
- _tail += trueCount;
- _tail %= _capacity;
- _size += trueCount;
- return trueCount;
- }
-
- public bool Put(byte b)
- {
- if (Size == _capacity) // no room
- return false;
- _buffer[_tail++] = b;
- _tail %= _capacity;
- ++_size;
- return true;
- }
-
- public int Get(byte[] destination, int offset, int count)
- {
- int trueCount = Math.Min(count,Size);
- for (int i = 0; i < trueCount; ++i)
- destination[offset + i] = _buffer[(_head+i) % _capacity];
- _head += trueCount;
- _head %= _capacity;
- _size -= trueCount;
- return trueCount;
- }
-
- public int Get()
- {
- if (Size == 0)
- return -1;
-
- int result = (int)_buffer[_head++ % _capacity];
- --_size;
- return result;
- }
-
- }
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CodecBase.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CodecBase.cs
deleted file mode 100644
index 954db7d..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/CodecBase.cs
+++ /dev/null
@@ -1,198 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace DotZLib
-{
- /// <summary>
- /// Implements the common functionality needed for all <see cref="Codec"/>s
- /// </summary>
- public abstract class CodecBase : Codec, IDisposable
- {
-
- #region Data members
-
- /// <summary>
- /// Instance of the internal zlib buffer structure that is
- /// passed to all functions in the zlib dll
- /// </summary>
- internal ZStream _ztream = new ZStream();
-
- /// <summary>
- /// True if the object instance has been disposed, false otherwise
- /// </summary>
- protected bool _isDisposed = false;
-
- /// <summary>
- /// The size of the internal buffers
- /// </summary>
- protected const int kBufferSize = 16384;
-
- private byte[] _outBuffer = new byte[kBufferSize];
- private byte[] _inBuffer = new byte[kBufferSize];
-
- private GCHandle _hInput;
- private GCHandle _hOutput;
-
- private uint _checksum = 0;
-
- #endregion
-
- /// <summary>
- /// Initializes a new instance of the <c>CodeBase</c> class.
- /// </summary>
- public CodecBase()
- {
- try
- {
- _hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned);
- _hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned);
- }
- catch (Exception)
- {
- CleanUp(false);
- throw;
- }
- }
-
-
- #region Codec Members
-
- /// <summary>
- /// Occurs when more processed data are available.
- /// </summary>
- public event DataAvailableHandler DataAvailable;
-
- /// <summary>
- /// Fires the <see cref="DataAvailable"/> event
- /// </summary>
- protected void OnDataAvailable()
- {
- if (_ztream.total_out > 0)
- {
- if (DataAvailable != null)
- DataAvailable( _outBuffer, 0, (int)_ztream.total_out);
- resetOutput();
- }
- }
-
- /// <summary>
- /// Adds more data to the codec to be processed.
- /// </summary>
- /// <param name="data">Byte array containing the data to be added to the codec</param>
- /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
- public void Add(byte[] data)
- {
- Add(data,0,data.Length);
- }
-
- /// <summary>
- /// Adds more data to the codec to be processed.
- /// </summary>
- /// <param name="data">Byte array containing the data to be added to the codec</param>
- /// <param name="offset">The index of the first byte to add from <c>data</c></param>
- /// <param name="count">The number of bytes to add</param>
- /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
- /// <remarks>This must be implemented by a derived class</remarks>
- public abstract void Add(byte[] data, int offset, int count);
-
- /// <summary>
- /// Finishes up any pending data that needs to be processed and handled.
- /// </summary>
- /// <remarks>This must be implemented by a derived class</remarks>
- public abstract void Finish();
-
- /// <summary>
- /// Gets the checksum of the data that has been added so far
- /// </summary>
- public uint Checksum { get { return _checksum; } }
-
- #endregion
-
- #region Destructor & IDisposable stuff
-
- /// <summary>
- /// Destroys this instance
- /// </summary>
- ~CodecBase()
- {
- CleanUp(false);
- }
-
- /// <summary>
- /// Releases any unmanaged resources and calls the <see cref="CleanUp()"/> method of the derived class
- /// </summary>
- public void Dispose()
- {
- CleanUp(true);
- }
-
- /// <summary>
- /// Performs any codec specific cleanup
- /// </summary>
- /// <remarks>This must be implemented by a derived class</remarks>
- protected abstract void CleanUp();
-
- // performs the release of the handles and calls the dereived CleanUp()
- private void CleanUp(bool isDisposing)
- {
- if (!_isDisposed)
- {
- CleanUp();
- if (_hInput.IsAllocated)
- _hInput.Free();
- if (_hOutput.IsAllocated)
- _hOutput.Free();
-
- _isDisposed = true;
- }
- }
-
-
- #endregion
-
- #region Helper methods
-
- /// <summary>
- /// Copies a number of bytes to the internal codec buffer - ready for proccesing
- /// </summary>
- /// <param name="data">The byte array that contains the data to copy</param>
- /// <param name="startIndex">The index of the first byte to copy</param>
- /// <param name="count">The number of bytes to copy from <c>data</c></param>
- protected void copyInput(byte[] data, int startIndex, int count)
- {
- Array.Copy(data, startIndex, _inBuffer,0, count);
- _ztream.next_in = _hInput.AddrOfPinnedObject();
- _ztream.total_in = 0;
- _ztream.avail_in = (uint)count;
-
- }
-
- /// <summary>
- /// Resets the internal output buffers to a known state - ready for processing
- /// </summary>
- protected void resetOutput()
- {
- _ztream.total_out = 0;
- _ztream.avail_out = kBufferSize;
- _ztream.next_out = _hOutput.AddrOfPinnedObject();
- }
-
- /// <summary>
- /// Updates the running checksum property
- /// </summary>
- /// <param name="newSum">The new checksum value</param>
- protected void setChecksum(uint newSum)
- {
- _checksum = newSum;
- }
- #endregion
-
- }
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Deflater.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Deflater.cs
deleted file mode 100644
index d7b8dcc..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Deflater.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace DotZLib
-{
-
- /// <summary>
- /// Implements a data compressor, using the deflate algorithm in the ZLib dll
- /// </summary>
- public sealed class Deflater : CodecBase
- {
- #region Dll imports
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
- private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int deflate(ref ZStream sz, int flush);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int deflateReset(ref ZStream sz);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int deflateEnd(ref ZStream sz);
- #endregion
-
- /// <summary>
- /// Constructs an new instance of the <c>Deflater</c>
- /// </summary>
- /// <param name="level">The compression level to use for this <c>Deflater</c></param>
- public Deflater(CompressLevel level) : base()
- {
- int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream));
- if (retval != 0)
- throw new ZLibException(retval, "Could not initialize deflater");
-
- resetOutput();
- }
-
- /// <summary>
- /// Adds more data to the codec to be processed.
- /// </summary>
- /// <param name="data">Byte array containing the data to be added to the codec</param>
- /// <param name="offset">The index of the first byte to add from <c>data</c></param>
- /// <param name="count">The number of bytes to add</param>
- /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
- public override void Add(byte[] data, int offset, int count)
- {
- if (data == null) throw new ArgumentNullException();
- if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
- if ((offset+count) > data.Length) throw new ArgumentException();
-
- int total = count;
- int inputIndex = offset;
- int err = 0;
-
- while (err >= 0 && inputIndex < total)
- {
- copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
- while (err >= 0 && _ztream.avail_in > 0)
- {
- err = deflate(ref _ztream, (int)FlushTypes.None);
- if (err == 0)
- while (_ztream.avail_out == 0)
- {
- OnDataAvailable();
- err = deflate(ref _ztream, (int)FlushTypes.None);
- }
- inputIndex += (int)_ztream.total_in;
- }
- }
- setChecksum( _ztream.adler );
- }
-
-
- /// <summary>
- /// Finishes up any pending data that needs to be processed and handled.
- /// </summary>
- public override void Finish()
- {
- int err;
- do
- {
- err = deflate(ref _ztream, (int)FlushTypes.Finish);
- OnDataAvailable();
- }
- while (err == 0);
- setChecksum( _ztream.adler );
- deflateReset(ref _ztream);
- resetOutput();
- }
-
- /// <summary>
- /// Closes the internal zlib deflate stream
- /// </summary>
- protected override void CleanUp() { deflateEnd(ref _ztream); }
-
- }
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.cs
deleted file mode 100644
index 410deb0..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.cs
+++ /dev/null
@@ -1,288 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-
-
-namespace DotZLib
-{
-
- #region Internal types
-
- /// <summary>
- /// Defines constants for the various flush types used with zlib
- /// </summary>
- internal enum FlushTypes
- {
- None, Partial, Sync, Full, Finish, Block
- }
-
- #region ZStream structure
- // internal mapping of the zlib zstream structure for marshalling
- [StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)]
- internal struct ZStream
- {
- public IntPtr next_in;
- public uint avail_in;
- public uint total_in;
-
- public IntPtr next_out;
- public uint avail_out;
- public uint total_out;
-
- [MarshalAs(UnmanagedType.LPStr)]
- string msg;
- uint state;
-
- uint zalloc;
- uint zfree;
- uint opaque;
-
- int data_type;
- public uint adler;
- uint reserved;
- }
-
- #endregion
-
- #endregion
-
- #region Public enums
- /// <summary>
- /// Defines constants for the available compression levels in zlib
- /// </summary>
- public enum CompressLevel : int
- {
- /// <summary>
- /// The default compression level with a reasonable compromise between compression and speed
- /// </summary>
- Default = -1,
- /// <summary>
- /// No compression at all. The data are passed straight through.
- /// </summary>
- None = 0,
- /// <summary>
- /// The maximum compression rate available.
- /// </summary>
- Best = 9,
- /// <summary>
- /// The fastest available compression level.
- /// </summary>
- Fastest = 1
- }
- #endregion
-
- #region Exception classes
- /// <summary>
- /// The exception that is thrown when an error occurs on the zlib dll
- /// </summary>
- public class ZLibException : ApplicationException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
- /// error message and error code
- /// </summary>
- /// <param name="errorCode">The zlib error code that caused the exception</param>
- /// <param name="msg">A message that (hopefully) describes the error</param>
- public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg))
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ZLibException"/> class with a specified
- /// error code
- /// </summary>
- /// <param name="errorCode">The zlib error code that caused the exception</param>
- public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode))
- {
- }
- }
- #endregion
-
- #region Interfaces
-
- /// <summary>
- /// Declares methods and properties that enables a running checksum to be calculated
- /// </summary>
- public interface ChecksumGenerator
- {
- /// <summary>
- /// Gets the current value of the checksum
- /// </summary>
- uint Value { get; }
-
- /// <summary>
- /// Clears the current checksum to 0
- /// </summary>
- void Reset();
-
- /// <summary>
- /// Updates the current checksum with an array of bytes
- /// </summary>
- /// <param name="data">The data to update the checksum with</param>
- void Update(byte[] data);
-
- /// <summary>
- /// Updates the current checksum with part of an array of bytes
- /// </summary>
- /// <param name="data">The data to update the checksum with</param>
- /// <param name="offset">Where in <c>data</c> to start updating</param>
- /// <param name="count">The number of bytes from <c>data</c> to use</param>
- /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
- /// <exception cref="ArgumentNullException"><c>data</c> is a null reference</exception>
- /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
- void Update(byte[] data, int offset, int count);
-
- /// <summary>
- /// Updates the current checksum with the data from a string
- /// </summary>
- /// <param name="data">The string to update the checksum with</param>
- /// <remarks>The characters in the string are converted by the UTF-8 encoding</remarks>
- void Update(string data);
-
- /// <summary>
- /// Updates the current checksum with the data from a string, using a specific encoding
- /// </summary>
- /// <param name="data">The string to update the checksum with</param>
- /// <param name="encoding">The encoding to use</param>
- void Update(string data, Encoding encoding);
- }
-
-
- /// <summary>
- /// Represents the method that will be called from a codec when new data
- /// are available.
- /// </summary>
- /// <paramref name="data">The byte array containing the processed data</paramref>
- /// <paramref name="startIndex">The index of the first processed byte in <c>data</c></paramref>
- /// <paramref name="count">The number of processed bytes available</paramref>
- /// <remarks>On return from this method, the data may be overwritten, so grab it while you can.
- /// You cannot assume that startIndex will be zero.
- /// </remarks>
- public delegate void DataAvailableHandler(byte[] data, int startIndex, int count);
-
- /// <summary>
- /// Declares methods and events for implementing compressors/decompressors
- /// </summary>
- public interface Codec
- {
- /// <summary>
- /// Occurs when more processed data are available.
- /// </summary>
- event DataAvailableHandler DataAvailable;
-
- /// <summary>
- /// Adds more data to the codec to be processed.
- /// </summary>
- /// <param name="data">Byte array containing the data to be added to the codec</param>
- /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
- void Add(byte[] data);
-
- /// <summary>
- /// Adds more data to the codec to be processed.
- /// </summary>
- /// <param name="data">Byte array containing the data to be added to the codec</param>
- /// <param name="offset">The index of the first byte to add from <c>data</c></param>
- /// <param name="count">The number of bytes to add</param>
- /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
- void Add(byte[] data, int offset, int count);
-
- /// <summary>
- /// Finishes up any pending data that needs to be processed and handled.
- /// </summary>
- void Finish();
-
- /// <summary>
- /// Gets the checksum of the data that has been added so far
- /// </summary>
- uint Checksum { get; }
-
-
- }
-
- #endregion
-
- #region Classes
- /// <summary>
- /// Encapsulates general information about the ZLib library
- /// </summary>
- public class Info
- {
- #region DLL imports
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern uint zlibCompileFlags();
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern string zlibVersion();
- #endregion
-
- #region Private stuff
- private uint _flags;
-
- // helper function that unpacks a bitsize mask
- private static int bitSize(uint bits)
- {
- switch (bits)
- {
- case 0: return 16;
- case 1: return 32;
- case 2: return 64;
- }
- return -1;
- }
- #endregion
-
- /// <summary>
- /// Constructs an instance of the <c>Info</c> class.
- /// </summary>
- public Info()
- {
- _flags = zlibCompileFlags();
- }
-
- /// <summary>
- /// True if the library is compiled with debug info
- /// </summary>
- public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } }
-
- /// <summary>
- /// True if the library is compiled with assembly optimizations
- /// </summary>
- public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } }
-
- /// <summary>
- /// Gets the size of the unsigned int that was compiled into Zlib
- /// </summary>
- public int SizeOfUInt { get { return bitSize(_flags & 3); } }
-
- /// <summary>
- /// Gets the size of the unsigned long that was compiled into Zlib
- /// </summary>
- public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } }
-
- /// <summary>
- /// Gets the size of the pointers that were compiled into Zlib
- /// </summary>
- public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } }
-
- /// <summary>
- /// Gets the size of the z_off_t type that was compiled into Zlib
- /// </summary>
- public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } }
-
- /// <summary>
- /// Gets the version of ZLib as a string, e.g. "1.2.1"
- /// </summary>
- public static string Version { get { return zlibVersion(); } }
- }
-
- #endregion
-
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.csproj b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.csproj
deleted file mode 100644
index 71eeb85..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/DotZLib.csproj
+++ /dev/null
@@ -1,141 +0,0 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.10.3077"
- SchemaVersion = "2.0"
- ProjectGuid = "{BB1EE0B1-1808-46CB-B786-949D91117FC5}"
- >
- <Build>
- <Settings
- ApplicationIcon = ""
- AssemblyKeyContainerName = ""
- AssemblyName = "DotZLib"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "Library"
- PreBuildEvent = ""
- PostBuildEvent = ""
- RootNamespace = "DotZLib"
- RunPostBuildEvent = "OnBuildSuccess"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = "docs\DotZLib.xml"
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = "1591"
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = "docs\DotZLib.xml"
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- NoStdLib = "false"
- NoWarn = ""
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
- />
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
- />
- <Reference
- Name = "nunit.framework"
- AssemblyName = "nunit.framework"
- HintPath = "E:\apps\NUnit V2.1\\bin\nunit.framework.dll"
- AssemblyFolderKey = "hklm\dn\nunit.framework"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ChecksumImpl.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "CircularBuffer.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "CodecBase.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Deflater.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "DotZLib.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "GZipStream.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Inflater.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "UnitTests.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/GZipStream.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/GZipStream.cs
deleted file mode 100644
index f861675..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/GZipStream.cs
+++ /dev/null
@@ -1,301 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace DotZLib
-{
- /// <summary>
- /// Implements a compressed <see cref="Stream"/>, in GZip (.gz) format.
- /// </summary>
- public class GZipStream : Stream, IDisposable
- {
- #region Dll Imports
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
- private static extern IntPtr gzopen(string name, string mode);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int gzclose(IntPtr gzFile);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int gzwrite(IntPtr gzFile, int data, int length);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int gzread(IntPtr gzFile, int data, int length);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int gzgetc(IntPtr gzFile);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int gzputc(IntPtr gzFile, int c);
-
- #endregion
-
- #region Private data
- private IntPtr _gzFile;
- private bool _isDisposed = false;
- private bool _isWriting;
- #endregion
-
- #region Constructors
- /// <summary>
- /// Creates a new file as a writeable GZipStream
- /// </summary>
- /// <param name="fileName">The name of the compressed file to create</param>
- /// <param name="level">The compression level to use when adding data</param>
- /// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
- public GZipStream(string fileName, CompressLevel level)
- {
- _isWriting = true;
- _gzFile = gzopen(fileName, String.Format("wb{0}", (int)level));
- if (_gzFile == IntPtr.Zero)
- throw new ZLibException(-1, "Could not open " + fileName);
- }
-
- /// <summary>
- /// Opens an existing file as a readable GZipStream
- /// </summary>
- /// <param name="fileName">The name of the file to open</param>
- /// <exception cref="ZLibException">If an error occurred in the internal zlib function</exception>
- public GZipStream(string fileName)
- {
- _isWriting = false;
- _gzFile = gzopen(fileName, "rb");
- if (_gzFile == IntPtr.Zero)
- throw new ZLibException(-1, "Could not open " + fileName);
-
- }
- #endregion
-
- #region Access properties
- /// <summary>
- /// Returns true of this stream can be read from, false otherwise
- /// </summary>
- public override bool CanRead
- {
- get
- {
- return !_isWriting;
- }
- }
-
-
- /// <summary>
- /// Returns false.
- /// </summary>
- public override bool CanSeek
- {
- get
- {
- return false;
- }
- }
-
- /// <summary>
- /// Returns true if this tsream is writeable, false otherwise
- /// </summary>
- public override bool CanWrite
- {
- get
- {
- return _isWriting;
- }
- }
- #endregion
-
- #region Destructor & IDispose stuff
-
- /// <summary>
- /// Destroys this instance
- /// </summary>
- ~GZipStream()
- {
- cleanUp(false);
- }
-
- /// <summary>
- /// Closes the external file handle
- /// </summary>
- public void Dispose()
- {
- cleanUp(true);
- }
-
- // Does the actual closing of the file handle.
- private void cleanUp(bool isDisposing)
- {
- if (!_isDisposed)
- {
- gzclose(_gzFile);
- _isDisposed = true;
- }
- }
- #endregion
-
- #region Basic reading and writing
- /// <summary>
- /// Attempts to read a number of bytes from the stream.
- /// </summary>
- /// <param name="buffer">The destination data buffer</param>
- /// <param name="offset">The index of the first destination byte in <c>buffer</c></param>
- /// <param name="count">The number of bytes requested</param>
- /// <returns>The number of bytes read</returns>
- /// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
- /// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
- /// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is &gt; buffer.Length</exception>
- /// <exception cref="NotSupportedException">If this stream is not readable.</exception>
- /// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
- public override int Read(byte[] buffer, int offset, int count)
- {
- if (!CanRead) throw new NotSupportedException();
- if (buffer == null) throw new ArgumentNullException();
- if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
- if ((offset+count) > buffer.Length) throw new ArgumentException();
- if (_isDisposed) throw new ObjectDisposedException("GZipStream");
-
- GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
- int result;
- try
- {
- result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
- if (result < 0)
- throw new IOException();
- }
- finally
- {
- h.Free();
- }
- return result;
- }
-
- /// <summary>
- /// Attempts to read a single byte from the stream.
- /// </summary>
- /// <returns>The byte that was read, or -1 in case of error or End-Of-File</returns>
- public override int ReadByte()
- {
- if (!CanRead) throw new NotSupportedException();
- if (_isDisposed) throw new ObjectDisposedException("GZipStream");
- return gzgetc(_gzFile);
- }
-
- /// <summary>
- /// Writes a number of bytes to the stream
- /// </summary>
- /// <param name="buffer"></param>
- /// <param name="offset"></param>
- /// <param name="count"></param>
- /// <exception cref="ArgumentNullException">If <c>buffer</c> is null</exception>
- /// <exception cref="ArgumentOutOfRangeException">If <c>count</c> or <c>offset</c> are negative</exception>
- /// <exception cref="ArgumentException">If <c>offset</c> + <c>count</c> is &gt; buffer.Length</exception>
- /// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
- /// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
- public override void Write(byte[] buffer, int offset, int count)
- {
- if (!CanWrite) throw new NotSupportedException();
- if (buffer == null) throw new ArgumentNullException();
- if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
- if ((offset+count) > buffer.Length) throw new ArgumentException();
- if (_isDisposed) throw new ObjectDisposedException("GZipStream");
-
- GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned);
- try
- {
- int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count);
- if (result < 0)
- throw new IOException();
- }
- finally
- {
- h.Free();
- }
- }
-
- /// <summary>
- /// Writes a single byte to the stream
- /// </summary>
- /// <param name="value">The byte to add to the stream.</param>
- /// <exception cref="NotSupportedException">If this stream is not writeable.</exception>
- /// <exception cref="ObjectDisposedException">If this stream has been disposed.</exception>
- public override void WriteByte(byte value)
- {
- if (!CanWrite) throw new NotSupportedException();
- if (_isDisposed) throw new ObjectDisposedException("GZipStream");
-
- int result = gzputc(_gzFile, (int)value);
- if (result < 0)
- throw new IOException();
- }
- #endregion
-
- #region Position & length stuff
- /// <summary>
- /// Not supported.
- /// </summary>
- /// <param name="value"></param>
- /// <exception cref="NotSupportedException">Always thrown</exception>
- public override void SetLength(long value)
- {
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Not suppported.
- /// </summary>
- /// <param name="offset"></param>
- /// <param name="origin"></param>
- /// <returns></returns>
- /// <exception cref="NotSupportedException">Always thrown</exception>
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotSupportedException();
- }
-
- /// <summary>
- /// Flushes the <c>GZipStream</c>.
- /// </summary>
- /// <remarks>In this implementation, this method does nothing. This is because excessive
- /// flushing may degrade the achievable compression rates.</remarks>
- public override void Flush()
- {
- // left empty on purpose
- }
-
- /// <summary>
- /// Gets/sets the current position in the <c>GZipStream</c>. Not suppported.
- /// </summary>
- /// <remarks>In this implementation this property is not supported</remarks>
- /// <exception cref="NotSupportedException">Always thrown</exception>
- public override long Position
- {
- get
- {
- throw new NotSupportedException();
- }
- set
- {
- throw new NotSupportedException();
- }
- }
-
- /// <summary>
- /// Gets the size of the stream. Not suppported.
- /// </summary>
- /// <remarks>In this implementation this property is not supported</remarks>
- /// <exception cref="NotSupportedException">Always thrown</exception>
- public override long Length
- {
- get
- {
- throw new NotSupportedException();
- }
- }
- #endregion
- }
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Inflater.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Inflater.cs
deleted file mode 100644
index 4e60cda..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/Inflater.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace DotZLib
-{
-
- /// <summary>
- /// Implements a data decompressor, using the inflate algorithm in the ZLib dll
- /// </summary>
- public class Inflater : CodecBase
- {
- #region Dll imports
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)]
- private static extern int inflateInit_(ref ZStream sz, string vs, int size);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int inflate(ref ZStream sz, int flush);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int inflateReset(ref ZStream sz);
-
- [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)]
- private static extern int inflateEnd(ref ZStream sz);
- #endregion
-
- /// <summary>
- /// Constructs an new instance of the <c>Inflater</c>
- /// </summary>
- public Inflater() : base()
- {
- int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream));
- if (retval != 0)
- throw new ZLibException(retval, "Could not initialize inflater");
-
- resetOutput();
- }
-
-
- /// <summary>
- /// Adds more data to the codec to be processed.
- /// </summary>
- /// <param name="data">Byte array containing the data to be added to the codec</param>
- /// <param name="offset">The index of the first byte to add from <c>data</c></param>
- /// <param name="count">The number of bytes to add</param>
- /// <remarks>Adding data may, or may not, raise the <c>DataAvailable</c> event</remarks>
- public override void Add(byte[] data, int offset, int count)
- {
- if (data == null) throw new ArgumentNullException();
- if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
- if ((offset+count) > data.Length) throw new ArgumentException();
-
- int total = count;
- int inputIndex = offset;
- int err = 0;
-
- while (err >= 0 && inputIndex < total)
- {
- copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize));
- err = inflate(ref _ztream, (int)FlushTypes.None);
- if (err == 0)
- while (_ztream.avail_out == 0)
- {
- OnDataAvailable();
- err = inflate(ref _ztream, (int)FlushTypes.None);
- }
-
- inputIndex += (int)_ztream.total_in;
- }
- setChecksum( _ztream.adler );
- }
-
-
- /// <summary>
- /// Finishes up any pending data that needs to be processed and handled.
- /// </summary>
- public override void Finish()
- {
- int err;
- do
- {
- err = inflate(ref _ztream, (int)FlushTypes.Finish);
- OnDataAvailable();
- }
- while (err == 0);
- setChecksum( _ztream.adler );
- inflateReset(ref _ztream);
- resetOutput();
- }
-
- /// <summary>
- /// Closes the internal zlib inflate stream
- /// </summary>
- protected override void CleanUp() { inflateEnd(ref _ztream); }
-
-
- }
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/UnitTests.cs b/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/UnitTests.cs
deleted file mode 100644
index 8dc00db..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/DotZLib/UnitTests.cs
+++ /dev/null
@@ -1,274 +0,0 @@
-//
-// © Copyright Henrik Ravn 2004
-//
-// Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-using System;
-using System.Collections;
-using System.IO;
-
-// uncomment the define below to include unit tests
-//#define nunit
-#if nunit
-using NUnit.Framework;
-
-// Unit tests for the DotZLib class library
-// ----------------------------------------
-//
-// Use this with NUnit 2 from http://www.nunit.org
-//
-
-namespace DotZLibTests
-{
- using DotZLib;
-
- // helper methods
- internal class Utils
- {
- public static bool byteArrEqual( byte[] lhs, byte[] rhs )
- {
- if (lhs.Length != rhs.Length)
- return false;
- for (int i = lhs.Length-1; i >= 0; --i)
- if (lhs[i] != rhs[i])
- return false;
- return true;
- }
-
- }
-
-
- [TestFixture]
- public class CircBufferTests
- {
- #region Circular buffer tests
- [Test]
- public void SinglePutGet()
- {
- CircularBuffer buf = new CircularBuffer(10);
- Assert.AreEqual( 0, buf.Size );
- Assert.AreEqual( -1, buf.Get() );
-
- Assert.IsTrue(buf.Put( 1 ));
- Assert.AreEqual( 1, buf.Size );
- Assert.AreEqual( 1, buf.Get() );
- Assert.AreEqual( 0, buf.Size );
- Assert.AreEqual( -1, buf.Get() );
- }
-
- [Test]
- public void BlockPutGet()
- {
- CircularBuffer buf = new CircularBuffer(10);
- byte[] arr = {1,2,3,4,5,6,7,8,9,10};
- Assert.AreEqual( 10, buf.Put(arr,0,10) );
- Assert.AreEqual( 10, buf.Size );
- Assert.IsFalse( buf.Put(11) );
- Assert.AreEqual( 1, buf.Get() );
- Assert.IsTrue( buf.Put(11) );
-
- byte[] arr2 = (byte[])arr.Clone();
- Assert.AreEqual( 9, buf.Get(arr2,1,9) );
- Assert.IsTrue( Utils.byteArrEqual(arr,arr2) );
- }
-
- #endregion
- }
-
- [TestFixture]
- public class ChecksumTests
- {
- #region CRC32 Tests
- [Test]
- public void CRC32_Null()
- {
- CRC32Checksum crc32 = new CRC32Checksum();
- Assert.AreEqual( 0, crc32.Value );
-
- crc32 = new CRC32Checksum(1);
- Assert.AreEqual( 1, crc32.Value );
-
- crc32 = new CRC32Checksum(556);
- Assert.AreEqual( 556, crc32.Value );
- }
-
- [Test]
- public void CRC32_Data()
- {
- CRC32Checksum crc32 = new CRC32Checksum();
- byte[] data = { 1,2,3,4,5,6,7 };
- crc32.Update(data);
- Assert.AreEqual( 0x70e46888, crc32.Value );
-
- crc32 = new CRC32Checksum();
- crc32.Update("penguin");
- Assert.AreEqual( 0x0e5c1a120, crc32.Value );
-
- crc32 = new CRC32Checksum(1);
- crc32.Update("penguin");
- Assert.AreEqual(0x43b6aa94, crc32.Value);
-
- }
- #endregion
-
- #region Adler tests
-
- [Test]
- public void Adler_Null()
- {
- AdlerChecksum adler = new AdlerChecksum();
- Assert.AreEqual(0, adler.Value);
-
- adler = new AdlerChecksum(1);
- Assert.AreEqual( 1, adler.Value );
-
- adler = new AdlerChecksum(556);
- Assert.AreEqual( 556, adler.Value );
- }
-
- [Test]
- public void Adler_Data()
- {
- AdlerChecksum adler = new AdlerChecksum(1);
- byte[] data = { 1,2,3,4,5,6,7 };
- adler.Update(data);
- Assert.AreEqual( 0x5b001d, adler.Value );
-
- adler = new AdlerChecksum();
- adler.Update("penguin");
- Assert.AreEqual(0x0bcf02f6, adler.Value );
-
- adler = new AdlerChecksum(1);
- adler.Update("penguin");
- Assert.AreEqual(0x0bd602f7, adler.Value);
-
- }
- #endregion
- }
-
- [TestFixture]
- public class InfoTests
- {
- #region Info tests
- [Test]
- public void Info_Version()
- {
- Info info = new Info();
- Assert.AreEqual("1.2.3", Info.Version);
- Assert.AreEqual(32, info.SizeOfUInt);
- Assert.AreEqual(32, info.SizeOfULong);
- Assert.AreEqual(32, info.SizeOfPointer);
- Assert.AreEqual(32, info.SizeOfOffset);
- }
- #endregion
- }
-
- [TestFixture]
- public class DeflateInflateTests
- {
- #region Deflate tests
- [Test]
- public void Deflate_Init()
- {
- using (Deflater def = new Deflater(CompressLevel.Default))
- {
- }
- }
-
- private ArrayList compressedData = new ArrayList();
- private uint adler1;
-
- private ArrayList uncompressedData = new ArrayList();
- private uint adler2;
-
- public void CDataAvail(byte[] data, int startIndex, int count)
- {
- for (int i = 0; i < count; ++i)
- compressedData.Add(data[i+startIndex]);
- }
-
- [Test]
- public void Deflate_Compress()
- {
- compressedData.Clear();
-
- byte[] testData = new byte[35000];
- for (int i = 0; i < testData.Length; ++i)
- testData[i] = 5;
-
- using (Deflater def = new Deflater((CompressLevel)5))
- {
- def.DataAvailable += new DataAvailableHandler(CDataAvail);
- def.Add(testData);
- def.Finish();
- adler1 = def.Checksum;
- }
- }
- #endregion
-
- #region Inflate tests
- [Test]
- public void Inflate_Init()
- {
- using (Inflater inf = new Inflater())
- {
- }
- }
-
- private void DDataAvail(byte[] data, int startIndex, int count)
- {
- for (int i = 0; i < count; ++i)
- uncompressedData.Add(data[i+startIndex]);
- }
-
- [Test]
- public void Inflate_Expand()
- {
- uncompressedData.Clear();
-
- using (Inflater inf = new Inflater())
- {
- inf.DataAvailable += new DataAvailableHandler(DDataAvail);
- inf.Add((byte[])compressedData.ToArray(typeof(byte)));
- inf.Finish();
- adler2 = inf.Checksum;
- }
- Assert.AreEqual( adler1, adler2 );
- }
- #endregion
- }
-
- [TestFixture]
- public class GZipStreamTests
- {
- #region GZipStream test
- [Test]
- public void GZipStream_WriteRead()
- {
- using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best))
- {
- BinaryWriter writer = new BinaryWriter(gzOut);
- writer.Write("hi there");
- writer.Write(Math.PI);
- writer.Write(42);
- }
-
- using (GZipStream gzIn = new GZipStream("gzstream.gz"))
- {
- BinaryReader reader = new BinaryReader(gzIn);
- string s = reader.ReadString();
- Assert.AreEqual("hi there",s);
- double d = reader.ReadDouble();
- Assert.AreEqual(Math.PI, d);
- int i = reader.ReadInt32();
- Assert.AreEqual(42,i);
- }
-
- }
- #endregion
- }
-}
-
-#endif \ No newline at end of file
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/LICENSE_1_0.txt b/funtools/util/zlib-1.2.3/contrib/dotzlib/LICENSE_1_0.txt
deleted file mode 100644
index 30aac2c..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/LICENSE_1_0.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/funtools/util/zlib-1.2.3/contrib/dotzlib/readme.txt b/funtools/util/zlib-1.2.3/contrib/dotzlib/readme.txt
deleted file mode 100644
index 210f4b0..0000000
--- a/funtools/util/zlib-1.2.3/contrib/dotzlib/readme.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-This directory contains a .Net wrapper class library for the ZLib1.dll
-
-The wrapper includes support for inflating/deflating memory buffers,
-.Net streaming wrappers for the gz streams part of zlib, and wrappers
-for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples.
-
-Directory structure:
---------------------
-
-LICENSE_1_0.txt - License file.
-readme.txt - This file.
-DotZLib.chm - Class library documentation
-DotZLib.build - NAnt build file
-DotZLib.sln - Microsoft Visual Studio 2003 solution file
-
-DotZLib\*.cs - Source files for the class library
-
-Unit tests:
------------
-The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher.
-To include unit tests in the build, define nunit before building.
-
-
-Build instructions:
--------------------
-
-1. Using Visual Studio.Net 2003:
- Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll)
- will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on
- you are building the release or debug version of the library. Check
- DotZLib/UnitTests.cs for instructions on how to include unit tests in the
- build.
-
-2. Using NAnt:
- Open a command prompt with access to the build environment and run nant
- in the same directory as the DotZLib.build file.
- You can define 2 properties on the nant command-line to control the build:
- debug={true|false} to toggle between release/debug builds (default=true).
- nunit={true|false} to include or esclude unit tests (default=true).
- Also the target clean will remove binaries.
- Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
- or ./DotZLib/bin/debug, depending on whether you are building the release
- or debug version of the library.
-
- Examples:
- nant -D:debug=false -D:nunit=false
- will build a release mode version of the library without unit tests.
- nant
- will build a debug version of the library with unit tests
- nant clean
- will remove all previously built files.
-
-
----------------------------------
-Copyright (c) Henrik Ravn 2004
-
-Use, modification and distribution are subject to the Boost Software License, Version 1.0.
-(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/README b/funtools/util/zlib-1.2.3/contrib/infback9/README
deleted file mode 100644
index e75ed13..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/README
+++ /dev/null
@@ -1 +0,0 @@
-See infback9.h for what this is and how to use it.
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/infback9.c b/funtools/util/zlib-1.2.3/contrib/infback9/infback9.c
deleted file mode 100644
index f5ddde6..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/infback9.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/* infback9.c -- inflate deflate64 data using a call-back interface
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "infback9.h"
-#include "inftree9.h"
-#include "inflate9.h"
-
-#define WSIZE 65536UL
-
-/*
- strm provides memory allocation functions in zalloc and zfree, or
- Z_NULL to use the library memory allocation functions.
-
- window is a user-supplied window and output buffer that is 64K bytes.
- */
-int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
-z_stream FAR *strm;
-unsigned char FAR *window;
-const char *version;
-int stream_size;
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL)
- return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
- sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (voidpf)state;
- state->window = window;
- return Z_OK;
-}
-
-/*
- Build and output length and distance decoding tables for fixed code
- decoding.
- */
-#ifdef MAKEFIXED
-#include <stdio.h>
-
-void makefixed9(void)
-{
- unsigned sym, bits, low, size;
- code *next, *lenfix, *distfix;
- struct inflate_state state;
- code fixed[544];
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state.lens[sym++] = 8;
- while (sym < 256) state.lens[sym++] = 9;
- while (sym < 280) state.lens[sym++] = 7;
- while (sym < 288) state.lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table9(LENS, state.lens, 288, &(next), &(bits), state.work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state.lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table9(DISTS, state.lens, 32, &(next), &(bits), state.work);
-
- /* write tables */
- puts(" /* inffix9.h -- table for decoding deflate64 fixed codes");
- puts(" * Generated automatically by makefixed9().");
- puts(" */");
- puts("");
- puts(" /* WARNING: this file should *not* be used by applications.");
- puts(" It is part of the implementation of this library and is");
- puts(" subject to change. Applications should only use zlib.h.");
- puts(" */");
- puts("");
- size = 1U << 9;
- printf(" static const code lenfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 6) == 0) printf("\n ");
- printf("{%u,%u,%d}", lenfix[low].op, lenfix[low].bits,
- lenfix[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
- size = 1U << 5;
- printf("\n static const code distfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 5) == 0) printf("\n ");
- printf("{%u,%u,%d}", distfix[low].op, distfix[low].bits,
- distfix[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
-}
-#endif /* MAKEFIXED */
-
-/* Macros for inflateBack(): */
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Assure that some input is available. If input is requested, but denied,
- then return a Z_BUF_ERROR from inflateBack(). */
-#define PULL() \
- do { \
- if (have == 0) { \
- have = in(in_desc, &next); \
- if (have == 0) { \
- next = Z_NULL; \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflateBack()
- with an error if there is no input available. */
-#define PULLBYTE() \
- do { \
- PULL(); \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflateBack() with
- an error. */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n <= 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Assure that some output space is available, by writing out the window
- if it's full. If the write fails, return from inflateBack() with a
- Z_BUF_ERROR. */
-#define ROOM() \
- do { \
- if (left == 0) { \
- put = window; \
- left = WSIZE; \
- wrap = 1; \
- if (out(out_desc, put, (unsigned)left)) { \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/*
- strm provides the memory allocation functions and window buffer on input,
- and provides information on the unused input on return. For Z_DATA_ERROR
- returns, strm will also provide an error message.
-
- in() and out() are the call-back input and output functions. When
- inflateBack() needs more input, it calls in(). When inflateBack() has
- filled the window with output, or when it completes with data in the
- window, it calls out() to write out the data. The application must not
- change the provided input until in() is called again or inflateBack()
- returns. The application must not change the window/output buffer until
- inflateBack() returns.
-
- in() and out() are called with a descriptor parameter provided in the
- inflateBack() call. This parameter can be a structure that provides the
- information required to do the read or write, as well as accumulated
- information on the input and output such as totals and check values.
-
- in() should return zero on failure. out() should return non-zero on
- failure. If either in() or out() fails, than inflateBack() returns a
- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
- was in() or out() that caused in the error. Otherwise, inflateBack()
- returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
- error, or Z_MEM_ERROR if it could not allocate memory for the state.
- inflateBack() can also return Z_STREAM_ERROR if the input parameters
- are not correct, i.e. strm is Z_NULL or the state was not initialized.
- */
-int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
-z_stream FAR *strm;
-in_func in;
-void FAR *in_desc;
-out_func out;
-void FAR *out_desc;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have; /* available input */
- unsigned long left; /* available output */
- inflate_mode mode; /* current inflate mode */
- int lastblock; /* true if processing last block */
- int wrap; /* true if the window has wrapped */
- unsigned long write; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned extra; /* extra bits needed */
- unsigned long length; /* literal or length of data to copy */
- unsigned long offset; /* distance back to copy string from */
- unsigned long copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code const FAR *lencode; /* starting table for length/literal codes */
- code const FAR *distcode; /* starting table for distance codes */
- unsigned lenbits; /* index bits for lencode */
- unsigned distbits; /* index bits for distcode */
- code this; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-#include "inffix9.h"
-
- /* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* Reset the state */
- strm->msg = Z_NULL;
- mode = TYPE;
- lastblock = 0;
- write = 0;
- wrap = 0;
- window = state->window;
- next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
- hold = 0;
- bits = 0;
- put = window;
- left = WSIZE;
- lencode = Z_NULL;
- distcode = Z_NULL;
-
- /* Inflate until end of block marked as last */
- for (;;)
- switch (mode) {
- case TYPE:
- /* determine and dispatch block type */
- if (lastblock) {
- BYTEBITS();
- mode = DONE;
- break;
- }
- NEEDBITS(3);
- lastblock = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- lastblock ? " (last)" : ""));
- mode = STORED;
- break;
- case 1: /* fixed block */
- lencode = lenfix;
- lenbits = 9;
- distcode = distfix;
- distbits = 5;
- Tracev((stderr, "inflate: fixed codes block%s\n",
- lastblock ? " (last)" : ""));
- mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- lastblock ? " (last)" : ""));
- mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- mode = BAD;
- }
- DROPBITS(2);
- break;
-
- case STORED:
- /* get and verify stored block length */
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- mode = BAD;
- break;
- }
- length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %lu\n",
- length));
- INITBITS();
-
- /* copy stored block from input to output */
- while (length != 0) {
- copy = length;
- PULL();
- ROOM();
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- length -= copy;
- }
- Tracev((stderr, "inflate: stored end\n"));
- mode = TYPE;
- break;
-
- case TABLE:
- /* get dynamic table entries descriptor */
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
- if (state->nlen > 286) {
- strm->msg = (char *)"too many length symbols";
- mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: table sizes ok\n"));
-
- /* get code length code lengths (not a typo) */
- state->have = 0;
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- lencode = (code const FAR *)(state->next);
- lenbits = 7;
- ret = inflate_table9(CODES, state->lens, 19, &(state->next),
- &(lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
-
- /* get length and distance code code lengths */
- state->have = 0;
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- this = lencode[BITS(lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.val < 16) {
- NEEDBITS(this.bits);
- DROPBITS(this.bits);
- state->lens[state->have++] = this.val;
- }
- else {
- if (this.val == 16) {
- NEEDBITS(this.bits + 2);
- DROPBITS(this.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- mode = BAD;
- break;
- }
- len = (unsigned)(state->lens[state->have - 1]);
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (this.val == 17) {
- NEEDBITS(this.bits + 3);
- DROPBITS(this.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(this.bits + 7);
- DROPBITS(this.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (mode == BAD) break;
-
- /* build code tables */
- state->next = state->codes;
- lencode = (code const FAR *)(state->next);
- lenbits = 9;
- ret = inflate_table9(LENS, state->lens, state->nlen,
- &(state->next), &(lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- mode = BAD;
- break;
- }
- distcode = (code const FAR *)(state->next);
- distbits = 6;
- ret = inflate_table9(DISTS, state->lens + state->nlen,
- state->ndist, &(state->next), &(distbits),
- state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- mode = LEN;
-
- case LEN:
- /* get a literal, length, or end-of-block code */
- for (;;) {
- this = lencode[BITS(lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.op && (this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- length = (unsigned)this.val;
-
- /* process literal */
- if (this.op == 0) {
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- ROOM();
- *put++ = (unsigned char)(length);
- left--;
- mode = LEN;
- break;
- }
-
- /* process end of block */
- if (this.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- mode = TYPE;
- break;
- }
-
- /* invalid code */
- if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- mode = BAD;
- break;
- }
-
- /* length code -- get extra bits, if any */
- extra = (unsigned)(this.op) & 31;
- if (extra != 0) {
- NEEDBITS(extra);
- length += BITS(extra);
- DROPBITS(extra);
- }
- Tracevv((stderr, "inflate: length %lu\n", length));
-
- /* get distance code */
- for (;;) {
- this = distcode[BITS(distbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if ((this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
- mode = BAD;
- break;
- }
- offset = (unsigned)this.val;
-
- /* get distance extra bits, if any */
- extra = (unsigned)(this.op) & 15;
- if (extra != 0) {
- NEEDBITS(extra);
- offset += BITS(extra);
- DROPBITS(extra);
- }
- if (offset > WSIZE - (wrap ? 0: left)) {
- strm->msg = (char *)"invalid distance too far back";
- mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %lu\n", offset));
-
- /* copy match from window to output */
- do {
- ROOM();
- copy = WSIZE - offset;
- if (copy < left) {
- from = put + copy;
- copy = left - copy;
- }
- else {
- from = put - offset;
- copy = left;
- }
- if (copy > length) copy = length;
- length -= copy;
- left -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- } while (length != 0);
- break;
-
- case DONE:
- /* inflate stream terminated properly -- write leftover output */
- ret = Z_STREAM_END;
- if (left < WSIZE) {
- if (out(out_desc, window, (unsigned)(WSIZE - left)))
- ret = Z_BUF_ERROR;
- }
- goto inf_leave;
-
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
-
- default: /* can't happen, but makes compilers happy */
- ret = Z_STREAM_ERROR;
- goto inf_leave;
- }
-
- /* Return unused input */
- inf_leave:
- strm->next_in = next;
- strm->avail_in = have;
- return ret;
-}
-
-int ZEXPORT inflateBack9End(strm)
-z_stream FAR *strm;
-{
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/infback9.h b/funtools/util/zlib-1.2.3/contrib/infback9/infback9.h
deleted file mode 100644
index 1073c0a..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/infback9.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* infback9.h -- header for using inflateBack9 functions
- * Copyright (C) 2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * This header file and associated patches provide a decoder for PKWare's
- * undocumented deflate64 compression method (method 9). Use with infback9.c,
- * inftree9.h, inftree9.c, and inffix9.h. These patches are not supported.
- * This should be compiled with zlib, since it uses zutil.h and zutil.o.
- * This code has not yet been tested on 16-bit architectures. See the
- * comments in zlib.h for inflateBack() usage. These functions are used
- * identically, except that there is no windowBits parameter, and a 64K
- * window must be provided. Also if int's are 16 bits, then a zero for
- * the third parameter of the "out" function actually means 65536UL.
- * zlib.h must be included before this header file.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
-ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm));
-ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
-#define inflateBack9Init(strm, window) \
- inflateBack9Init_((strm), (window), \
- ZLIB_VERSION, sizeof(z_stream))
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/inffix9.h b/funtools/util/zlib-1.2.3/contrib/infback9/inffix9.h
deleted file mode 100644
index ee5671d..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/inffix9.h
+++ /dev/null
@@ -1,107 +0,0 @@
- /* inffix9.h -- table for decoding deflate64 fixed codes
- * Generated automatically by makefixed9().
- */
-
- /* WARNING: this file should *not* be used by applications.
- It is part of the implementation of this library and is
- subject to change. Applications should only use zlib.h.
- */
-
- static const code lenfix[512] = {
- {96,7,0},{0,8,80},{0,8,16},{132,8,115},{130,7,31},{0,8,112},
- {0,8,48},{0,9,192},{128,7,10},{0,8,96},{0,8,32},{0,9,160},
- {0,8,0},{0,8,128},{0,8,64},{0,9,224},{128,7,6},{0,8,88},
- {0,8,24},{0,9,144},{131,7,59},{0,8,120},{0,8,56},{0,9,208},
- {129,7,17},{0,8,104},{0,8,40},{0,9,176},{0,8,8},{0,8,136},
- {0,8,72},{0,9,240},{128,7,4},{0,8,84},{0,8,20},{133,8,227},
- {131,7,43},{0,8,116},{0,8,52},{0,9,200},{129,7,13},{0,8,100},
- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},
- {128,7,8},{0,8,92},{0,8,28},{0,9,152},{132,7,83},{0,8,124},
- {0,8,60},{0,9,216},{130,7,23},{0,8,108},{0,8,44},{0,9,184},
- {0,8,12},{0,8,140},{0,8,76},{0,9,248},{128,7,3},{0,8,82},
- {0,8,18},{133,8,163},{131,7,35},{0,8,114},{0,8,50},{0,9,196},
- {129,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},{0,8,130},
- {0,8,66},{0,9,228},{128,7,7},{0,8,90},{0,8,26},{0,9,148},
- {132,7,67},{0,8,122},{0,8,58},{0,9,212},{130,7,19},{0,8,106},
- {0,8,42},{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},
- {128,7,5},{0,8,86},{0,8,22},{65,8,0},{131,7,51},{0,8,118},
- {0,8,54},{0,9,204},{129,7,15},{0,8,102},{0,8,38},{0,9,172},
- {0,8,6},{0,8,134},{0,8,70},{0,9,236},{128,7,9},{0,8,94},
- {0,8,30},{0,9,156},{132,7,99},{0,8,126},{0,8,62},{0,9,220},
- {130,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{133,8,131},
- {130,7,31},{0,8,113},{0,8,49},{0,9,194},{128,7,10},{0,8,97},
- {0,8,33},{0,9,162},{0,8,1},{0,8,129},{0,8,65},{0,9,226},
- {128,7,6},{0,8,89},{0,8,25},{0,9,146},{131,7,59},{0,8,121},
- {0,8,57},{0,9,210},{129,7,17},{0,8,105},{0,8,41},{0,9,178},
- {0,8,9},{0,8,137},{0,8,73},{0,9,242},{128,7,4},{0,8,85},
- {0,8,21},{144,8,3},{131,7,43},{0,8,117},{0,8,53},{0,9,202},
- {129,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},
- {0,8,69},{0,9,234},{128,7,8},{0,8,93},{0,8,29},{0,9,154},
- {132,7,83},{0,8,125},{0,8,61},{0,9,218},{130,7,23},{0,8,109},
- {0,8,45},{0,9,186},{0,8,13},{0,8,141},{0,8,77},{0,9,250},
- {128,7,3},{0,8,83},{0,8,19},{133,8,195},{131,7,35},{0,8,115},
- {0,8,51},{0,9,198},{129,7,11},{0,8,99},{0,8,35},{0,9,166},
- {0,8,3},{0,8,131},{0,8,67},{0,9,230},{128,7,7},{0,8,91},
- {0,8,27},{0,9,150},{132,7,67},{0,8,123},{0,8,59},{0,9,214},
- {130,7,19},{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},
- {0,8,75},{0,9,246},{128,7,5},{0,8,87},{0,8,23},{77,8,0},
- {131,7,51},{0,8,119},{0,8,55},{0,9,206},{129,7,15},{0,8,103},
- {0,8,39},{0,9,174},{0,8,7},{0,8,135},{0,8,71},{0,9,238},
- {128,7,9},{0,8,95},{0,8,31},{0,9,158},{132,7,99},{0,8,127},
- {0,8,63},{0,9,222},{130,7,27},{0,8,111},{0,8,47},{0,9,190},
- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},
- {0,8,16},{132,8,115},{130,7,31},{0,8,112},{0,8,48},{0,9,193},
- {128,7,10},{0,8,96},{0,8,32},{0,9,161},{0,8,0},{0,8,128},
- {0,8,64},{0,9,225},{128,7,6},{0,8,88},{0,8,24},{0,9,145},
- {131,7,59},{0,8,120},{0,8,56},{0,9,209},{129,7,17},{0,8,104},
- {0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},{0,9,241},
- {128,7,4},{0,8,84},{0,8,20},{133,8,227},{131,7,43},{0,8,116},
- {0,8,52},{0,9,201},{129,7,13},{0,8,100},{0,8,36},{0,9,169},
- {0,8,4},{0,8,132},{0,8,68},{0,9,233},{128,7,8},{0,8,92},
- {0,8,28},{0,9,153},{132,7,83},{0,8,124},{0,8,60},{0,9,217},
- {130,7,23},{0,8,108},{0,8,44},{0,9,185},{0,8,12},{0,8,140},
- {0,8,76},{0,9,249},{128,7,3},{0,8,82},{0,8,18},{133,8,163},
- {131,7,35},{0,8,114},{0,8,50},{0,9,197},{129,7,11},{0,8,98},
- {0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
- {128,7,7},{0,8,90},{0,8,26},{0,9,149},{132,7,67},{0,8,122},
- {0,8,58},{0,9,213},{130,7,19},{0,8,106},{0,8,42},{0,9,181},
- {0,8,10},{0,8,138},{0,8,74},{0,9,245},{128,7,5},{0,8,86},
- {0,8,22},{65,8,0},{131,7,51},{0,8,118},{0,8,54},{0,9,205},
- {129,7,15},{0,8,102},{0,8,38},{0,9,173},{0,8,6},{0,8,134},
- {0,8,70},{0,9,237},{128,7,9},{0,8,94},{0,8,30},{0,9,157},
- {132,7,99},{0,8,126},{0,8,62},{0,9,221},{130,7,27},{0,8,110},
- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},
- {96,7,0},{0,8,81},{0,8,17},{133,8,131},{130,7,31},{0,8,113},
- {0,8,49},{0,9,195},{128,7,10},{0,8,97},{0,8,33},{0,9,163},
- {0,8,1},{0,8,129},{0,8,65},{0,9,227},{128,7,6},{0,8,89},
- {0,8,25},{0,9,147},{131,7,59},{0,8,121},{0,8,57},{0,9,211},
- {129,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},{0,8,137},
- {0,8,73},{0,9,243},{128,7,4},{0,8,85},{0,8,21},{144,8,3},
- {131,7,43},{0,8,117},{0,8,53},{0,9,203},{129,7,13},{0,8,101},
- {0,8,37},{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},
- {128,7,8},{0,8,93},{0,8,29},{0,9,155},{132,7,83},{0,8,125},
- {0,8,61},{0,9,219},{130,7,23},{0,8,109},{0,8,45},{0,9,187},
- {0,8,13},{0,8,141},{0,8,77},{0,9,251},{128,7,3},{0,8,83},
- {0,8,19},{133,8,195},{131,7,35},{0,8,115},{0,8,51},{0,9,199},
- {129,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
- {0,8,67},{0,9,231},{128,7,7},{0,8,91},{0,8,27},{0,9,151},
- {132,7,67},{0,8,123},{0,8,59},{0,9,215},{130,7,19},{0,8,107},
- {0,8,43},{0,9,183},{0,8,11},{0,8,139},{0,8,75},{0,9,247},
- {128,7,5},{0,8,87},{0,8,23},{77,8,0},{131,7,51},{0,8,119},
- {0,8,55},{0,9,207},{129,7,15},{0,8,103},{0,8,39},{0,9,175},
- {0,8,7},{0,8,135},{0,8,71},{0,9,239},{128,7,9},{0,8,95},
- {0,8,31},{0,9,159},{132,7,99},{0,8,127},{0,8,63},{0,9,223},
- {130,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},
- {0,8,79},{0,9,255}
- };
-
- static const code distfix[32] = {
- {128,5,1},{135,5,257},{131,5,17},{139,5,4097},{129,5,5},
- {137,5,1025},{133,5,65},{141,5,16385},{128,5,3},{136,5,513},
- {132,5,33},{140,5,8193},{130,5,9},{138,5,2049},{134,5,129},
- {142,5,32769},{128,5,2},{135,5,385},{131,5,25},{139,5,6145},
- {129,5,7},{137,5,1537},{133,5,97},{141,5,24577},{128,5,4},
- {136,5,769},{132,5,49},{140,5,12289},{130,5,13},{138,5,3073},
- {134,5,193},{142,5,49153}
- };
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/inflate9.h b/funtools/util/zlib-1.2.3/contrib/infback9/inflate9.h
deleted file mode 100644
index ee9a793..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/inflate9.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* inflate9.h -- internal inflate state definition
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Possible inflate modes between inflate() calls */
-typedef enum {
- TYPE, /* i: waiting for type bits, including last-flag bit */
- STORED, /* i: waiting for stored size (length and complement) */
- TABLE, /* i: waiting for dynamic block table lengths */
- LEN, /* i: waiting for length/lit code */
- DONE, /* finished check, done -- remain here until reset */
- BAD /* got a data error -- remain here until reset */
-} inflate_mode;
-
-/*
- State transitions between above modes -
-
- (most modes can go to the BAD mode -- not shown for clarity)
-
- Read deflate blocks:
- TYPE -> STORED or TABLE or LEN or DONE
- STORED -> TYPE
- TABLE -> LENLENS -> CODELENS -> LEN
- Read deflate codes:
- LEN -> LEN or TYPE
- */
-
-/* state maintained between inflate() calls. Approximately 7K bytes. */
-struct inflate_state {
- /* sliding window */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- /* dynamic table building */
- unsigned ncode; /* number of code length code lengths */
- unsigned nlen; /* number of length code lengths */
- unsigned ndist; /* number of distance code lengths */
- unsigned have; /* number of code lengths in lens[] */
- code FAR *next; /* next available space in codes[] */
- unsigned short lens[320]; /* temporary storage for code lengths */
- unsigned short work[288]; /* work area for code table building */
- code codes[ENOUGH]; /* space for code tables */
-};
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/inftree9.c b/funtools/util/zlib-1.2.3/contrib/infback9/inftree9.c
deleted file mode 100644
index 0993f75..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/inftree9.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* inftree9.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftree9.h"
-
-#define MAXBITS 15
-
-const char inflate9_copyright[] =
- " inflate9 1.2.3 Copyright 1995-2005 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/*
- Build a set of tables to decode the provided canonical Huffman code.
- The code lengths are lens[0..codes-1]. The result starts at *table,
- whose indices are 0..2^bits-1. work is a writable array of at least
- lens shorts, which is used as a work area. type is the type of code
- to be generated, CODES, LENS, or DISTS. On return, zero is success,
- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
- on return points to the next available entry's address. bits is the
- requested root table index bits, and on return it is the actual root
- table index bits. It will differ if the request is greater than the
- longest code or if it is less than the shortest code.
- */
-int inflate_table9(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
-{
- unsigned len; /* a code's length in bits */
- unsigned sym; /* index of code symbols */
- unsigned min, max; /* minimum and maximum code lengths */
- unsigned root; /* number of index bits for root table */
- unsigned curr; /* number of index bits for current table */
- unsigned drop; /* code bits to drop for sub-table */
- int left; /* number of prefix codes available */
- unsigned used; /* code entries in table used */
- unsigned huff; /* Huffman code */
- unsigned incr; /* for incrementing code, index */
- unsigned fill; /* index for replicating entries */
- unsigned low; /* low bits for current root entry */
- unsigned mask; /* mask for low root bits */
- code this; /* table entry for duplication */
- code FAR *next; /* next available space in table */
- const unsigned short FAR *base; /* base value table to use */
- const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
- unsigned short count[MAXBITS+1]; /* number of codes of each length */
- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
- 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
- 131, 163, 195, 227, 3, 0, 0};
- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
- 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
- 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
- 133, 133, 133, 133, 144, 201, 196};
- static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
- 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
- 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
- static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
- 128, 128, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
- 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138,
- 139, 139, 140, 140, 141, 141, 142, 142};
-
- /*
- Process a set of code lengths to create a canonical Huffman code. The
- code lengths are lens[0..codes-1]. Each length corresponds to the
- symbols 0..codes-1. The Huffman code is generated by first sorting the
- symbols by length from short to long, and retaining the symbol order
- for codes with equal lengths. Then the code starts with all zero bits
- for the first code of the shortest length, and the codes are integer
- increments for the same length, and zeros are appended as the length
- increases. For the deflate format, these bits are stored backwards
- from their more natural integer increment ordering, and so when the
- decoding tables are built in the large loop below, the integer codes
- are incremented backwards.
-
- This routine assumes, but does not check, that all of the entries in
- lens[] are in the range 0..MAXBITS. The caller must assure this.
- 1..MAXBITS is interpreted as that code length. zero means that that
- symbol does not occur in this code.
-
- The codes are sorted by computing a count of codes for each length,
- creating from that a table of starting indices for each length in the
- sorted table, and then entering the symbols in order in the sorted
- table. The sorted table is work[], with that space being provided by
- the caller.
-
- The length counts are used for other purposes as well, i.e. finding
- the minimum and maximum length codes, determining if there are any
- codes at all, checking for a valid set of lengths, and looking ahead
- at length counts to determine sub-table sizes when building the
- decoding tables.
- */
-
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
- for (len = 0; len <= MAXBITS; len++)
- count[len] = 0;
- for (sym = 0; sym < codes; sym++)
- count[lens[sym]]++;
-
- /* bound code lengths, force root to be within code lengths */
- root = *bits;
- for (max = MAXBITS; max >= 1; max--)
- if (count[max] != 0) break;
- if (root > max) root = max;
- if (max == 0) return -1; /* no codes! */
- for (min = 1; min <= MAXBITS; min++)
- if (count[min] != 0) break;
- if (root < min) root = min;
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1;
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1;
- left -= count[len];
- if (left < 0) return -1; /* over-subscribed */
- }
- if (left > 0 && (type == CODES || max != 1))
- return -1; /* incomplete set */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + count[len];
-
- /* sort symbols by length, by symbol order within each length */
- for (sym = 0; sym < codes; sym++)
- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
-
- /*
- Create and fill in decoding tables. In this loop, the table being
- filled is at next and has curr index bits. The code being used is huff
- with length len. That code is converted to an index by dropping drop
- bits off of the bottom. For codes where len is less than drop + curr,
- those top drop + curr - len bits are incremented through all values to
- fill the table with replicated entries.
-
- root is the number of index bits for the root table. When len exceeds
- root, sub-tables are created pointed to by the root entry with an index
- of the low root bits of huff. This is saved in low to check for when a
- new sub-table should be started. drop is zero when the root table is
- being filled, and drop is root when sub-tables are being filled.
-
- When a new sub-table is needed, it is necessary to look ahead in the
- code lengths to determine what size sub-table is needed. The length
- counts are used for this, and so count[] is decremented as codes are
- entered in the tables.
-
- used keeps track of how many table entries have been allocated from the
- provided *table space. It is checked when a LENS table is being made
- against the space in *table, ENOUGH, minus the maximum space needed by
- the worst case distance code, MAXD. This should never happen, but the
- sufficiency of ENOUGH has not been proven exhaustively, hence the check.
- This assumes that when type == LENS, bits == 9.
-
- sym increments through all symbols, and the loop terminates when
- all codes of length max, i.e. all codes, have been processed. This
- routine permits incomplete codes, so another loop after this one fills
- in the rest of the decoding tables with invalid code markers.
- */
-
- /* set up for code type */
- switch (type) {
- case CODES:
- base = extra = work; /* dummy value--not used */
- end = 19;
- break;
- case LENS:
- base = lbase;
- base -= 257;
- extra = lext;
- extra -= 257;
- end = 256;
- break;
- default: /* DISTS */
- base = dbase;
- extra = dext;
- end = -1;
- }
-
- /* initialize state for loop */
- huff = 0; /* starting code */
- sym = 0; /* starting code symbol */
- len = min; /* starting code length */
- next = *table; /* current table to fill in */
- curr = root; /* current table index bits */
- drop = 0; /* current bits to drop from code for index */
- low = (unsigned)(-1); /* trigger new sub-table when len > root */
- used = 1U << root; /* use root table entries */
- mask = used - 1; /* mask for comparing low */
-
- /* check available table space */
- if (type == LENS && used >= ENOUGH - MAXD)
- return 1;
-
- /* process all codes and make table entries */
- for (;;) {
- /* create table entry */
- this.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
- this.op = (unsigned char)0;
- this.val = work[sym];
- }
- else if ((int)(work[sym]) > end) {
- this.op = (unsigned char)(extra[work[sym]]);
- this.val = base[work[sym]];
- }
- else {
- this.op = (unsigned char)(32 + 64); /* end of block */
- this.val = 0;
- }
-
- /* replicate for those indices with low len bits equal to huff */
- incr = 1U << (len - drop);
- fill = 1U << curr;
- do {
- fill -= incr;
- next[(huff >> drop) + fill] = this;
- } while (fill != 0);
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
-
- /* go to next symbol, update count, len */
- sym++;
- if (--(count[len]) == 0) {
- if (len == max) break;
- len = lens[work[sym]];
- }
-
- /* create new sub-table if needed */
- if (len > root && (huff & mask) != low) {
- /* if first time, transition to sub-tables */
- if (drop == 0)
- drop = root;
-
- /* increment past last table */
- next += 1U << curr;
-
- /* determine length of next table */
- curr = len - drop;
- left = (int)(1 << curr);
- while (curr + drop < max) {
- left -= count[curr + drop];
- if (left <= 0) break;
- curr++;
- left <<= 1;
- }
-
- /* check for enough space */
- used += 1U << curr;
- if (type == LENS && used >= ENOUGH - MAXD)
- return 1;
-
- /* point entry in root table to sub-table */
- low = huff & mask;
- (*table)[low].op = (unsigned char)curr;
- (*table)[low].bits = (unsigned char)root;
- (*table)[low].val = (unsigned short)(next - *table);
- }
- }
-
- /*
- Fill in rest of table for incomplete codes. This loop is similar to the
- loop above in incrementing huff for table indices. It is assumed that
- len is equal to curr + drop, so there is no loop needed to increment
- through high index bits. When the current sub-table is filled, the loop
- drops back to the root table to fill in any remaining entries there.
- */
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)(len - drop);
- this.val = (unsigned short)0;
- while (huff != 0) {
- /* when done with sub-table, drop back to root table */
- if (drop != 0 && (huff & mask) != low) {
- drop = 0;
- len = root;
- next = *table;
- curr = root;
- this.bits = (unsigned char)len;
- }
-
- /* put invalid code marker in table */
- next[huff >> drop] = this;
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
- }
-
- /* set return parameters */
- *table += used;
- *bits = root;
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/infback9/inftree9.h b/funtools/util/zlib-1.2.3/contrib/infback9/inftree9.h
deleted file mode 100644
index a268084..0000000
--- a/funtools/util/zlib-1.2.3/contrib/infback9/inftree9.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* inftree9.h -- header to use inftree9.c
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Structure for decoding tables. Each entry provides either the
- information needed to do the operation requested by the code that
- indexed that table entry, or it provides a pointer to another
- table that indexes more bits of the code. op indicates whether
- the entry is a pointer to another table, a literal, a length or
- distance, an end-of-block, or an invalid code. For a table
- pointer, the low four bits of op is the number of index bits of
- that table. For a length or distance, the low four bits of op
- is the number of extra bits to get after the code. bits is
- the number of bits in this code or part of the code to drop off
- of the bit buffer. val is the actual byte to output in the case
- of a literal, the base length or distance, or the offset from
- the current table to the next table. Each entry is four bytes. */
-typedef struct {
- unsigned char op; /* operation, extra bits, table bits */
- unsigned char bits; /* bits in this part of the code */
- unsigned short val; /* offset in table or code value */
-} code;
-
-/* op values as set by inflate_table():
- 00000000 - literal
- 0000tttt - table link, tttt != 0 is the number of table index bits
- 100eeeee - length or distance, eeee is the number of extra bits
- 01100000 - end of block
- 01000000 - invalid code
- */
-
-/* Maximum size of dynamic tree. The maximum found in a long but non-
- exhaustive search was 1444 code structures (852 for length/literals
- and 592 for distances, the latter actually the result of an
- exhaustive search). The true maximum is not known, but the value
- below is more than safe. */
-#define ENOUGH 2048
-#define MAXD 592
-
-/* Type of code to build for inftable() */
-typedef enum {
- CODES,
- LENS,
- DISTS
-} codetype;
-
-extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
diff --git a/funtools/util/zlib-1.2.3/contrib/inflate86/inffas86.c b/funtools/util/zlib-1.2.3/contrib/inflate86/inffas86.c
deleted file mode 100644
index 6da7635..0000000
--- a/funtools/util/zlib-1.2.3/contrib/inflate86/inffas86.c
+++ /dev/null
@@ -1,1157 +0,0 @@
-/* inffas86.c is a hand tuned assembler version of
- *
- * inffast.c -- fast decoding
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Copyright (C) 2003 Chris Anderson <christop@charm.net>
- * Please use the copyright conditions above.
- *
- * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
- * slightly quicker on x86 systems because, instead of using rep movsb to copy
- * data, it uses rep movsw, which moves data in 2-byte chunks instead of single
- * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
- * from http://fedora.linux.duke.edu/fc1_x86_64
- * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
- * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
- * when decompressing mozilla-source-1.3.tar.gz.
- *
- * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
- * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
- * the moment. I have successfully compiled and tested this code with gcc2.96,
- * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
- * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
- * enabled. I will attempt to merge the MMX code into this version. Newer
- * versions of this and inffast.S can be found at
- * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-/* Mark Adler's comments from inffast.c: */
-
-/*
- Decode literal, length, and distance codes and write out the resulting
- literal and match bytes until either not enough input or output is
- available, an end-of-block is encountered, or a data error is encountered.
- When large enough input and output buffers are supplied to inflate(), for
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
-
- Entry assumptions:
-
- state->mode == LEN
- strm->avail_in >= 6
- strm->avail_out >= 258
- start >= strm->avail_out
- state->bits < 8
-
- On return, state->mode is one of:
-
- LEN -- ran out of enough output space or enough available input
- TYPE -- reached end of block code, inflate() to interpret next block
- BAD -- error in block data
-
- Notes:
-
- - The maximum input bits used by a length/distance pair is 15 bits for the
- length code, 5 bits for the length extra, 15 bits for the distance code,
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
- Therefore if strm->avail_in >= 6, then there is enough input to avoid
- checking for available input while decoding.
-
- - The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
- requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
- */
-void inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
- struct inflate_state FAR *state;
- struct inffast_ar {
-/* 64 32 x86 x86_64 */
-/* ar offset register */
-/* 0 0 */ void *esp; /* esp save */
-/* 8 4 */ void *ebp; /* ebp save */
-/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
-/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
-/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
-/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
-/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
-/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
-/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
-/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
-/* 80 40 */ unsigned long hold; /* edx rdx local strm->hold */
-/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
-/* 92 48 */ unsigned wsize; /* window size */
-/* 96 52 */ unsigned write; /* window write index */
-/*100 56 */ unsigned lmask; /* r12 mask for lcode */
-/*104 60 */ unsigned dmask; /* r13 mask for dcode */
-/*108 64 */ unsigned len; /* r14 match length */
-/*112 68 */ unsigned dist; /* r15 match distance */
-/*116 72 */ unsigned status; /* set when state chng*/
- } ar;
-
-#if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )
-#define PAD_AVAIL_IN 6
-#define PAD_AVAIL_OUT 258
-#else
-#define PAD_AVAIL_IN 5
-#define PAD_AVAIL_OUT 257
-#endif
-
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
- ar.in = strm->next_in;
- ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
- ar.out = strm->next_out;
- ar.beg = ar.out - (start - strm->avail_out);
- ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
- ar.wsize = state->wsize;
- ar.write = state->write;
- ar.window = state->window;
- ar.hold = state->hold;
- ar.bits = state->bits;
- ar.lcode = state->lencode;
- ar.dcode = state->distcode;
- ar.lmask = (1U << state->lenbits) - 1;
- ar.dmask = (1U << state->distbits) - 1;
-
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
-
- /* align in on 1/2 hold size boundary */
- while (((unsigned long)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
- ar.hold += (unsigned long)*ar.in++ << ar.bits;
- ar.bits += 8;
- }
-
-#if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )
- __asm__ __volatile__ (
-" leaq %0, %%rax\n"
-" movq %%rbp, 8(%%rax)\n" /* save regs rbp and rsp */
-" movq %%rsp, (%%rax)\n"
-" movq %%rax, %%rsp\n" /* make rsp point to &ar */
-" movq 16(%%rsp), %%rsi\n" /* rsi = in */
-" movq 32(%%rsp), %%rdi\n" /* rdi = out */
-" movq 24(%%rsp), %%r9\n" /* r9 = last */
-" movq 48(%%rsp), %%r10\n" /* r10 = end */
-" movq 64(%%rsp), %%rbp\n" /* rbp = lcode */
-" movq 72(%%rsp), %%r11\n" /* r11 = dcode */
-" movq 80(%%rsp), %%rdx\n" /* rdx = hold */
-" movl 88(%%rsp), %%ebx\n" /* ebx = bits */
-" movl 100(%%rsp), %%r12d\n" /* r12d = lmask */
-" movl 104(%%rsp), %%r13d\n" /* r13d = dmask */
- /* r14d = len */
- /* r15d = dist */
-" cld\n"
-" cmpq %%rdi, %%r10\n"
-" je .L_one_time\n" /* if only one decode left */
-" cmpq %%rsi, %%r9\n"
-" je .L_one_time\n"
-" jmp .L_do_loop\n"
-
-".L_one_time:\n"
-" movq %%r12, %%r8\n" /* r8 = lmask */
-" cmpb $32, %%bl\n"
-" ja .L_get_length_code_one_time\n"
-
-" lodsl\n" /* eax = *(uint *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $32, %%bl\n" /* bits += 32 */
-" shlq %%cl, %%rax\n"
-" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */
-" jmp .L_get_length_code_one_time\n"
-
-".align 32,0x90\n"
-".L_while_test:\n"
-" cmpq %%rdi, %%r10\n"
-" jbe .L_break_loop\n"
-" cmpq %%rsi, %%r9\n"
-" jbe .L_break_loop\n"
-
-".L_do_loop:\n"
-" movq %%r12, %%r8\n" /* r8 = lmask */
-" cmpb $32, %%bl\n"
-" ja .L_get_length_code\n" /* if (32 < bits) */
-
-" lodsl\n" /* eax = *(uint *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $32, %%bl\n" /* bits += 32 */
-" shlq %%cl, %%rax\n"
-" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */
-
-".L_get_length_code:\n"
-" andq %%rdx, %%r8\n" /* r8 &= hold */
-" movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */
-
-" movb %%ah, %%cl\n" /* cl = this.bits */
-" subb %%ah, %%bl\n" /* bits -= this.bits */
-" shrq %%cl, %%rdx\n" /* hold >>= this.bits */
-
-" testb %%al, %%al\n"
-" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */
-
-" movq %%r12, %%r8\n" /* r8 = lmask */
-" shrl $16, %%eax\n" /* output this.val char */
-" stosb\n"
-
-".L_get_length_code_one_time:\n"
-" andq %%rdx, %%r8\n" /* r8 &= hold */
-" movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */
-
-".L_dolen:\n"
-" movb %%ah, %%cl\n" /* cl = this.bits */
-" subb %%ah, %%bl\n" /* bits -= this.bits */
-" shrq %%cl, %%rdx\n" /* hold >>= this.bits */
-
-" testb %%al, %%al\n"
-" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */
-
-" shrl $16, %%eax\n" /* output this.val char */
-" stosb\n"
-" jmp .L_while_test\n"
-
-".align 32,0x90\n"
-".L_test_for_length_base:\n"
-" movl %%eax, %%r14d\n" /* len = this */
-" shrl $16, %%r14d\n" /* len = this.val */
-" movb %%al, %%cl\n"
-
-" testb $16, %%al\n"
-" jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */
-" andb $15, %%cl\n" /* op &= 15 */
-" jz .L_decode_distance\n" /* if (!op) */
-
-".L_add_bits_to_len:\n"
-" subb %%cl, %%bl\n"
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n"
-" andl %%edx, %%eax\n" /* eax &= hold */
-" shrq %%cl, %%rdx\n"
-" addl %%eax, %%r14d\n" /* len += hold & mask[op] */
-
-".L_decode_distance:\n"
-" movq %%r13, %%r8\n" /* r8 = dmask */
-" cmpb $32, %%bl\n"
-" ja .L_get_distance_code\n" /* if (32 < bits) */
-
-" lodsl\n" /* eax = *(uint *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $32, %%bl\n" /* bits += 32 */
-" shlq %%cl, %%rax\n"
-" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */
-
-".L_get_distance_code:\n"
-" andq %%rdx, %%r8\n" /* r8 &= hold */
-" movl (%%r11,%%r8,4), %%eax\n" /* eax = dcode[hold & dmask] */
-
-".L_dodist:\n"
-" movl %%eax, %%r15d\n" /* dist = this */
-" shrl $16, %%r15d\n" /* dist = this.val */
-" movb %%ah, %%cl\n"
-" subb %%ah, %%bl\n" /* bits -= this.bits */
-" shrq %%cl, %%rdx\n" /* hold >>= this.bits */
-" movb %%al, %%cl\n" /* cl = this.op */
-
-" testb $16, %%al\n" /* if ((op & 16) == 0) */
-" jz .L_test_for_second_level_dist\n"
-" andb $15, %%cl\n" /* op &= 15 */
-" jz .L_check_dist_one\n"
-
-".L_add_bits_to_dist:\n"
-" subb %%cl, %%bl\n"
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n" /* (1 << op) - 1 */
-" andl %%edx, %%eax\n" /* eax &= hold */
-" shrq %%cl, %%rdx\n"
-" addl %%eax, %%r15d\n" /* dist += hold & ((1 << op) - 1) */
-
-".L_check_window:\n"
-" movq %%rsi, %%r8\n" /* save in so from can use it's reg */
-" movq %%rdi, %%rax\n"
-" subq 40(%%rsp), %%rax\n" /* nbytes = out - beg */
-
-" cmpl %%r15d, %%eax\n"
-" jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */
-
-" movl %%r14d, %%ecx\n" /* ecx = len */
-" movq %%rdi, %%rsi\n"
-" subq %%r15, %%rsi\n" /* from = out - dist */
-
-" sarl %%ecx\n"
-" jnc .L_copy_two\n" /* if len % 2 == 0 */
-
-" rep movsw\n"
-" movb (%%rsi), %%al\n"
-" movb %%al, (%%rdi)\n"
-" incq %%rdi\n"
-
-" movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */
-" jmp .L_while_test\n"
-
-".L_copy_two:\n"
-" rep movsw\n"
-" movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */
-" jmp .L_while_test\n"
-
-".align 32,0x90\n"
-".L_check_dist_one:\n"
-" cmpl $1, %%r15d\n" /* if dist 1, is a memset */
-" jne .L_check_window\n"
-" cmpq %%rdi, 40(%%rsp)\n" /* if out == beg, outside window */
-" je .L_check_window\n"
-
-" movl %%r14d, %%ecx\n" /* ecx = len */
-" movb -1(%%rdi), %%al\n"
-" movb %%al, %%ah\n"
-
-" sarl %%ecx\n"
-" jnc .L_set_two\n"
-" movb %%al, (%%rdi)\n"
-" incq %%rdi\n"
-
-".L_set_two:\n"
-" rep stosw\n"
-" jmp .L_while_test\n"
-
-".align 32,0x90\n"
-".L_test_for_second_level_length:\n"
-" testb $64, %%al\n"
-" jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */
-
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n"
-" andl %%edx, %%eax\n" /* eax &= hold */
-" addl %%r14d, %%eax\n" /* eax += len */
-" movl (%%rbp,%%rax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/
-" jmp .L_dolen\n"
-
-".align 32,0x90\n"
-".L_test_for_second_level_dist:\n"
-" testb $64, %%al\n"
-" jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */
-
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n"
-" andl %%edx, %%eax\n" /* eax &= hold */
-" addl %%r15d, %%eax\n" /* eax += dist */
-" movl (%%r11,%%rax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/
-" jmp .L_dodist\n"
-
-".align 32,0x90\n"
-".L_clip_window:\n"
-" movl %%eax, %%ecx\n" /* ecx = nbytes */
-" movl 92(%%rsp), %%eax\n" /* eax = wsize, prepare for dist cmp */
-" negl %%ecx\n" /* nbytes = -nbytes */
-
-" cmpl %%r15d, %%eax\n"
-" jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */
-
-" addl %%r15d, %%ecx\n" /* nbytes = dist - nbytes */
-" cmpl $0, 96(%%rsp)\n"
-" jne .L_wrap_around_window\n" /* if (write != 0) */
-
-" movq 56(%%rsp), %%rsi\n" /* from = window */
-" subl %%ecx, %%eax\n" /* eax -= nbytes */
-" addq %%rax, %%rsi\n" /* from += wsize - nbytes */
-
-" movl %%r14d, %%eax\n" /* eax = len */
-" cmpl %%ecx, %%r14d\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* eax -= nbytes */
-" rep movsb\n"
-" movq %%rdi, %%rsi\n"
-" subq %%r15, %%rsi\n" /* from = &out[ -dist ] */
-" jmp .L_do_copy\n"
-
-".align 32,0x90\n"
-".L_wrap_around_window:\n"
-" movl 96(%%rsp), %%eax\n" /* eax = write */
-" cmpl %%eax, %%ecx\n"
-" jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */
-
-" movl 92(%%rsp), %%esi\n" /* from = wsize */
-" addq 56(%%rsp), %%rsi\n" /* from += window */
-" addq %%rax, %%rsi\n" /* from += write */
-" subq %%rcx, %%rsi\n" /* from -= nbytes */
-" subl %%eax, %%ecx\n" /* nbytes -= write */
-
-" movl %%r14d, %%eax\n" /* eax = len */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movq 56(%%rsp), %%rsi\n" /* from = window */
-" movl 96(%%rsp), %%ecx\n" /* nbytes = write */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movq %%rdi, %%rsi\n"
-" subq %%r15, %%rsi\n" /* from = out - dist */
-" jmp .L_do_copy\n"
-
-".align 32,0x90\n"
-".L_contiguous_in_window:\n"
-" movq 56(%%rsp), %%rsi\n" /* rsi = window */
-" addq %%rax, %%rsi\n"
-" subq %%rcx, %%rsi\n" /* from += write - nbytes */
-
-" movl %%r14d, %%eax\n" /* eax = len */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movq %%rdi, %%rsi\n"
-" subq %%r15, %%rsi\n" /* from = out - dist */
-" jmp .L_do_copy\n" /* if (nbytes >= len) */
-
-".align 32,0x90\n"
-".L_do_copy:\n"
-" movl %%eax, %%ecx\n" /* ecx = len */
-" rep movsb\n"
-
-" movq %%r8, %%rsi\n" /* move in back to %esi, toss from */
-" jmp .L_while_test\n"
-
-".L_test_for_end_of_block:\n"
-" testb $32, %%al\n"
-" jz .L_invalid_literal_length_code\n"
-" movl $1, 116(%%rsp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_invalid_literal_length_code:\n"
-" movl $2, 116(%%rsp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_invalid_distance_code:\n"
-" movl $3, 116(%%rsp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_invalid_distance_too_far:\n"
-" movl $4, 116(%%rsp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_break_loop:\n"
-" movl $0, 116(%%rsp)\n"
-
-".L_break_loop_with_status:\n"
-/* put in, out, bits, and hold back into ar and pop esp */
-" movq %%rsi, 16(%%rsp)\n" /* in */
-" movq %%rdi, 32(%%rsp)\n" /* out */
-" movl %%ebx, 88(%%rsp)\n" /* bits */
-" movq %%rdx, 80(%%rsp)\n" /* hold */
-" movq (%%rsp), %%rax\n" /* restore rbp and rsp */
-" movq 8(%%rsp), %%rbp\n"
-" movq %%rax, %%rsp\n"
- :
- : "m" (ar)
- : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
- "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
- );
-#elif ( defined( __GNUC__ ) || defined( __ICC ) ) && defined( __i386 )
- __asm__ __volatile__ (
-" leal %0, %%eax\n"
-" movl %%esp, (%%eax)\n" /* save esp, ebp */
-" movl %%ebp, 4(%%eax)\n"
-" movl %%eax, %%esp\n"
-" movl 8(%%esp), %%esi\n" /* esi = in */
-" movl 16(%%esp), %%edi\n" /* edi = out */
-" movl 40(%%esp), %%edx\n" /* edx = hold */
-" movl 44(%%esp), %%ebx\n" /* ebx = bits */
-" movl 32(%%esp), %%ebp\n" /* ebp = lcode */
-
-" cld\n"
-" jmp .L_do_loop\n"
-
-".align 32,0x90\n"
-".L_while_test:\n"
-" cmpl %%edi, 24(%%esp)\n" /* out < end */
-" jbe .L_break_loop\n"
-" cmpl %%esi, 12(%%esp)\n" /* in < last */
-" jbe .L_break_loop\n"
-
-".L_do_loop:\n"
-" cmpb $15, %%bl\n"
-" ja .L_get_length_code\n" /* if (15 < bits) */
-
-" xorl %%eax, %%eax\n"
-" lodsw\n" /* al = *(ushort *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $16, %%bl\n" /* bits += 16 */
-" shll %%cl, %%eax\n"
-" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */
-
-".L_get_length_code:\n"
-" movl 56(%%esp), %%eax\n" /* eax = lmask */
-" andl %%edx, %%eax\n" /* eax &= hold */
-" movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[hold & lmask] */
-
-".L_dolen:\n"
-" movb %%ah, %%cl\n" /* cl = this.bits */
-" subb %%ah, %%bl\n" /* bits -= this.bits */
-" shrl %%cl, %%edx\n" /* hold >>= this.bits */
-
-" testb %%al, %%al\n"
-" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */
-
-" shrl $16, %%eax\n" /* output this.val char */
-" stosb\n"
-" jmp .L_while_test\n"
-
-".align 32,0x90\n"
-".L_test_for_length_base:\n"
-" movl %%eax, %%ecx\n" /* len = this */
-" shrl $16, %%ecx\n" /* len = this.val */
-" movl %%ecx, 64(%%esp)\n" /* save len */
-" movb %%al, %%cl\n"
-
-" testb $16, %%al\n"
-" jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */
-" andb $15, %%cl\n" /* op &= 15 */
-" jz .L_decode_distance\n" /* if (!op) */
-" cmpb %%cl, %%bl\n"
-" jae .L_add_bits_to_len\n" /* if (op <= bits) */
-
-" movb %%cl, %%ch\n" /* stash op in ch, freeing cl */
-" xorl %%eax, %%eax\n"
-" lodsw\n" /* al = *(ushort *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $16, %%bl\n" /* bits += 16 */
-" shll %%cl, %%eax\n"
-" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */
-" movb %%ch, %%cl\n" /* move op back to ecx */
-
-".L_add_bits_to_len:\n"
-" subb %%cl, %%bl\n"
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n"
-" andl %%edx, %%eax\n" /* eax &= hold */
-" shrl %%cl, %%edx\n"
-" addl %%eax, 64(%%esp)\n" /* len += hold & mask[op] */
-
-".L_decode_distance:\n"
-" cmpb $15, %%bl\n"
-" ja .L_get_distance_code\n" /* if (15 < bits) */
-
-" xorl %%eax, %%eax\n"
-" lodsw\n" /* al = *(ushort *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $16, %%bl\n" /* bits += 16 */
-" shll %%cl, %%eax\n"
-" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */
-
-".L_get_distance_code:\n"
-" movl 60(%%esp), %%eax\n" /* eax = dmask */
-" movl 36(%%esp), %%ecx\n" /* ecx = dcode */
-" andl %%edx, %%eax\n" /* eax &= hold */
-" movl (%%ecx,%%eax,4), %%eax\n"/* eax = dcode[hold & dmask] */
-
-".L_dodist:\n"
-" movl %%eax, %%ebp\n" /* dist = this */
-" shrl $16, %%ebp\n" /* dist = this.val */
-" movb %%ah, %%cl\n"
-" subb %%ah, %%bl\n" /* bits -= this.bits */
-" shrl %%cl, %%edx\n" /* hold >>= this.bits */
-" movb %%al, %%cl\n" /* cl = this.op */
-
-" testb $16, %%al\n" /* if ((op & 16) == 0) */
-" jz .L_test_for_second_level_dist\n"
-" andb $15, %%cl\n" /* op &= 15 */
-" jz .L_check_dist_one\n"
-" cmpb %%cl, %%bl\n"
-" jae .L_add_bits_to_dist\n" /* if (op <= bits) 97.6% */
-
-" movb %%cl, %%ch\n" /* stash op in ch, freeing cl */
-" xorl %%eax, %%eax\n"
-" lodsw\n" /* al = *(ushort *)in++ */
-" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */
-" addb $16, %%bl\n" /* bits += 16 */
-" shll %%cl, %%eax\n"
-" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */
-" movb %%ch, %%cl\n" /* move op back to ecx */
-
-".L_add_bits_to_dist:\n"
-" subb %%cl, %%bl\n"
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n" /* (1 << op) - 1 */
-" andl %%edx, %%eax\n" /* eax &= hold */
-" shrl %%cl, %%edx\n"
-" addl %%eax, %%ebp\n" /* dist += hold & ((1 << op) - 1) */
-
-".L_check_window:\n"
-" movl %%esi, 8(%%esp)\n" /* save in so from can use it's reg */
-" movl %%edi, %%eax\n"
-" subl 20(%%esp), %%eax\n" /* nbytes = out - beg */
-
-" cmpl %%ebp, %%eax\n"
-" jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */
-
-" movl 64(%%esp), %%ecx\n" /* ecx = len */
-" movl %%edi, %%esi\n"
-" subl %%ebp, %%esi\n" /* from = out - dist */
-
-" sarl %%ecx\n"
-" jnc .L_copy_two\n" /* if len % 2 == 0 */
-
-" rep movsw\n"
-" movb (%%esi), %%al\n"
-" movb %%al, (%%edi)\n"
-" incl %%edi\n"
-
-" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */
-" movl 32(%%esp), %%ebp\n" /* ebp = lcode */
-" jmp .L_while_test\n"
-
-".L_copy_two:\n"
-" rep movsw\n"
-" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */
-" movl 32(%%esp), %%ebp\n" /* ebp = lcode */
-" jmp .L_while_test\n"
-
-".align 32,0x90\n"
-".L_check_dist_one:\n"
-" cmpl $1, %%ebp\n" /* if dist 1, is a memset */
-" jne .L_check_window\n"
-" cmpl %%edi, 20(%%esp)\n"
-" je .L_check_window\n" /* out == beg, if outside window */
-
-" movl 64(%%esp), %%ecx\n" /* ecx = len */
-" movb -1(%%edi), %%al\n"
-" movb %%al, %%ah\n"
-
-" sarl %%ecx\n"
-" jnc .L_set_two\n"
-" movb %%al, (%%edi)\n"
-" incl %%edi\n"
-
-".L_set_two:\n"
-" rep stosw\n"
-" movl 32(%%esp), %%ebp\n" /* ebp = lcode */
-" jmp .L_while_test\n"
-
-".align 32,0x90\n"
-".L_test_for_second_level_length:\n"
-" testb $64, %%al\n"
-" jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */
-
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n"
-" andl %%edx, %%eax\n" /* eax &= hold */
-" addl 64(%%esp), %%eax\n" /* eax += len */
-" movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/
-" jmp .L_dolen\n"
-
-".align 32,0x90\n"
-".L_test_for_second_level_dist:\n"
-" testb $64, %%al\n"
-" jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */
-
-" xorl %%eax, %%eax\n"
-" incl %%eax\n"
-" shll %%cl, %%eax\n"
-" decl %%eax\n"
-" andl %%edx, %%eax\n" /* eax &= hold */
-" addl %%ebp, %%eax\n" /* eax += dist */
-" movl 36(%%esp), %%ecx\n" /* ecx = dcode */
-" movl (%%ecx,%%eax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/
-" jmp .L_dodist\n"
-
-".align 32,0x90\n"
-".L_clip_window:\n"
-" movl %%eax, %%ecx\n"
-" movl 48(%%esp), %%eax\n" /* eax = wsize */
-" negl %%ecx\n" /* nbytes = -nbytes */
-" movl 28(%%esp), %%esi\n" /* from = window */
-
-" cmpl %%ebp, %%eax\n"
-" jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */
-
-" addl %%ebp, %%ecx\n" /* nbytes = dist - nbytes */
-" cmpl $0, 52(%%esp)\n"
-" jne .L_wrap_around_window\n" /* if (write != 0) */
-
-" subl %%ecx, %%eax\n"
-" addl %%eax, %%esi\n" /* from += wsize - nbytes */
-
-" movl 64(%%esp), %%eax\n" /* eax = len */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movl %%edi, %%esi\n"
-" subl %%ebp, %%esi\n" /* from = out - dist */
-" jmp .L_do_copy\n"
-
-".align 32,0x90\n"
-".L_wrap_around_window:\n"
-" movl 52(%%esp), %%eax\n" /* eax = write */
-" cmpl %%eax, %%ecx\n"
-" jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */
-
-" addl 48(%%esp), %%esi\n" /* from += wsize */
-" addl %%eax, %%esi\n" /* from += write */
-" subl %%ecx, %%esi\n" /* from -= nbytes */
-" subl %%eax, %%ecx\n" /* nbytes -= write */
-
-" movl 64(%%esp), %%eax\n" /* eax = len */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movl 28(%%esp), %%esi\n" /* from = window */
-" movl 52(%%esp), %%ecx\n" /* nbytes = write */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movl %%edi, %%esi\n"
-" subl %%ebp, %%esi\n" /* from = out - dist */
-" jmp .L_do_copy\n"
-
-".align 32,0x90\n"
-".L_contiguous_in_window:\n"
-" addl %%eax, %%esi\n"
-" subl %%ecx, %%esi\n" /* from += write - nbytes */
-
-" movl 64(%%esp), %%eax\n" /* eax = len */
-" cmpl %%ecx, %%eax\n"
-" jbe .L_do_copy\n" /* if (nbytes >= len) */
-
-" subl %%ecx, %%eax\n" /* len -= nbytes */
-" rep movsb\n"
-" movl %%edi, %%esi\n"
-" subl %%ebp, %%esi\n" /* from = out - dist */
-" jmp .L_do_copy\n" /* if (nbytes >= len) */
-
-".align 32,0x90\n"
-".L_do_copy:\n"
-" movl %%eax, %%ecx\n"
-" rep movsb\n"
-
-" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */
-" movl 32(%%esp), %%ebp\n" /* ebp = lcode */
-" jmp .L_while_test\n"
-
-".L_test_for_end_of_block:\n"
-" testb $32, %%al\n"
-" jz .L_invalid_literal_length_code\n"
-" movl $1, 72(%%esp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_invalid_literal_length_code:\n"
-" movl $2, 72(%%esp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_invalid_distance_code:\n"
-" movl $3, 72(%%esp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_invalid_distance_too_far:\n"
-" movl 8(%%esp), %%esi\n"
-" movl $4, 72(%%esp)\n"
-" jmp .L_break_loop_with_status\n"
-
-".L_break_loop:\n"
-" movl $0, 72(%%esp)\n"
-
-".L_break_loop_with_status:\n"
-/* put in, out, bits, and hold back into ar and pop esp */
-" movl %%esi, 8(%%esp)\n" /* save in */
-" movl %%edi, 16(%%esp)\n" /* save out */
-" movl %%ebx, 44(%%esp)\n" /* save bits */
-" movl %%edx, 40(%%esp)\n" /* save hold */
-" movl 4(%%esp), %%ebp\n" /* restore esp, ebp */
-" movl (%%esp), %%esp\n"
- :
- : "m" (ar)
- : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi"
- );
-#elif defined( _MSC_VER ) && ! defined( _M_AMD64 )
- __asm {
- lea eax, ar
- mov [eax], esp /* save esp, ebp */
- mov [eax+4], ebp
- mov esp, eax
- mov esi, [esp+8] /* esi = in */
- mov edi, [esp+16] /* edi = out */
- mov edx, [esp+40] /* edx = hold */
- mov ebx, [esp+44] /* ebx = bits */
- mov ebp, [esp+32] /* ebp = lcode */
-
- cld
- jmp L_do_loop
-
-ALIGN 4
-L_while_test:
- cmp [esp+24], edi
- jbe L_break_loop
- cmp [esp+12], esi
- jbe L_break_loop
-
-L_do_loop:
- cmp bl, 15
- ja L_get_length_code /* if (15 < bits) */
-
- xor eax, eax
- lodsw /* al = *(ushort *)in++ */
- mov cl, bl /* cl = bits, needs it for shifting */
- add bl, 16 /* bits += 16 */
- shl eax, cl
- or edx, eax /* hold |= *((ushort *)in)++ << bits */
-
-L_get_length_code:
- mov eax, [esp+56] /* eax = lmask */
- and eax, edx /* eax &= hold */
- mov eax, [ebp+eax*4] /* eax = lcode[hold & lmask] */
-
-L_dolen:
- mov cl, ah /* cl = this.bits */
- sub bl, ah /* bits -= this.bits */
- shr edx, cl /* hold >>= this.bits */
-
- test al, al
- jnz L_test_for_length_base /* if (op != 0) 45.7% */
-
- shr eax, 16 /* output this.val char */
- stosb
- jmp L_while_test
-
-ALIGN 4
-L_test_for_length_base:
- mov ecx, eax /* len = this */
- shr ecx, 16 /* len = this.val */
- mov [esp+64], ecx /* save len */
- mov cl, al
-
- test al, 16
- jz L_test_for_second_level_length /* if ((op & 16) == 0) 8% */
- and cl, 15 /* op &= 15 */
- jz L_decode_distance /* if (!op) */
- cmp bl, cl
- jae L_add_bits_to_len /* if (op <= bits) */
-
- mov ch, cl /* stash op in ch, freeing cl */
- xor eax, eax
- lodsw /* al = *(ushort *)in++ */
- mov cl, bl /* cl = bits, needs it for shifting */
- add bl, 16 /* bits += 16 */
- shl eax, cl
- or edx, eax /* hold |= *((ushort *)in)++ << bits */
- mov cl, ch /* move op back to ecx */
-
-L_add_bits_to_len:
- sub bl, cl
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- and eax, edx /* eax &= hold */
- shr edx, cl
- add [esp+64], eax /* len += hold & mask[op] */
-
-L_decode_distance:
- cmp bl, 15
- ja L_get_distance_code /* if (15 < bits) */
-
- xor eax, eax
- lodsw /* al = *(ushort *)in++ */
- mov cl, bl /* cl = bits, needs it for shifting */
- add bl, 16 /* bits += 16 */
- shl eax, cl
- or edx, eax /* hold |= *((ushort *)in)++ << bits */
-
-L_get_distance_code:
- mov eax, [esp+60] /* eax = dmask */
- mov ecx, [esp+36] /* ecx = dcode */
- and eax, edx /* eax &= hold */
- mov eax, [ecx+eax*4]/* eax = dcode[hold & dmask] */
-
-L_dodist:
- mov ebp, eax /* dist = this */
- shr ebp, 16 /* dist = this.val */
- mov cl, ah
- sub bl, ah /* bits -= this.bits */
- shr edx, cl /* hold >>= this.bits */
- mov cl, al /* cl = this.op */
-
- test al, 16 /* if ((op & 16) == 0) */
- jz L_test_for_second_level_dist
- and cl, 15 /* op &= 15 */
- jz L_check_dist_one
- cmp bl, cl
- jae L_add_bits_to_dist /* if (op <= bits) 97.6% */
-
- mov ch, cl /* stash op in ch, freeing cl */
- xor eax, eax
- lodsw /* al = *(ushort *)in++ */
- mov cl, bl /* cl = bits, needs it for shifting */
- add bl, 16 /* bits += 16 */
- shl eax, cl
- or edx, eax /* hold |= *((ushort *)in)++ << bits */
- mov cl, ch /* move op back to ecx */
-
-L_add_bits_to_dist:
- sub bl, cl
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax /* (1 << op) - 1 */
- and eax, edx /* eax &= hold */
- shr edx, cl
- add ebp, eax /* dist += hold & ((1 << op) - 1) */
-
-L_check_window:
- mov [esp+8], esi /* save in so from can use it's reg */
- mov eax, edi
- sub eax, [esp+20] /* nbytes = out - beg */
-
- cmp eax, ebp
- jb L_clip_window /* if (dist > nbytes) 4.2% */
-
- mov ecx, [esp+64] /* ecx = len */
- mov esi, edi
- sub esi, ebp /* from = out - dist */
-
- sar ecx, 1
- jnc L_copy_two
-
- rep movsw
- mov al, [esi]
- mov [edi], al
- inc edi
-
- mov esi, [esp+8] /* move in back to %esi, toss from */
- mov ebp, [esp+32] /* ebp = lcode */
- jmp L_while_test
-
-L_copy_two:
- rep movsw
- mov esi, [esp+8] /* move in back to %esi, toss from */
- mov ebp, [esp+32] /* ebp = lcode */
- jmp L_while_test
-
-ALIGN 4
-L_check_dist_one:
- cmp ebp, 1 /* if dist 1, is a memset */
- jne L_check_window
- cmp [esp+20], edi
- je L_check_window /* out == beg, if outside window */
-
- mov ecx, [esp+64] /* ecx = len */
- mov al, [edi-1]
- mov ah, al
-
- sar ecx, 1
- jnc L_set_two
- mov [edi], al /* memset out with from[-1] */
- inc edi
-
-L_set_two:
- rep stosw
- mov ebp, [esp+32] /* ebp = lcode */
- jmp L_while_test
-
-ALIGN 4
-L_test_for_second_level_length:
- test al, 64
- jnz L_test_for_end_of_block /* if ((op & 64) != 0) */
-
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- and eax, edx /* eax &= hold */
- add eax, [esp+64] /* eax += len */
- mov eax, [ebp+eax*4] /* eax = lcode[val+(hold&mask[op])]*/
- jmp L_dolen
-
-ALIGN 4
-L_test_for_second_level_dist:
- test al, 64
- jnz L_invalid_distance_code /* if ((op & 64) != 0) */
-
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- and eax, edx /* eax &= hold */
- add eax, ebp /* eax += dist */
- mov ecx, [esp+36] /* ecx = dcode */
- mov eax, [ecx+eax*4] /* eax = dcode[val+(hold&mask[op])]*/
- jmp L_dodist
-
-ALIGN 4
-L_clip_window:
- mov ecx, eax
- mov eax, [esp+48] /* eax = wsize */
- neg ecx /* nbytes = -nbytes */
- mov esi, [esp+28] /* from = window */
-
- cmp eax, ebp
- jb L_invalid_distance_too_far /* if (dist > wsize) */
-
- add ecx, ebp /* nbytes = dist - nbytes */
- cmp dword ptr [esp+52], 0
- jne L_wrap_around_window /* if (write != 0) */
-
- sub eax, ecx
- add esi, eax /* from += wsize - nbytes */
-
- mov eax, [esp+64] /* eax = len */
- cmp eax, ecx
- jbe L_do_copy /* if (nbytes >= len) */
-
- sub eax, ecx /* len -= nbytes */
- rep movsb
- mov esi, edi
- sub esi, ebp /* from = out - dist */
- jmp L_do_copy
-
-ALIGN 4
-L_wrap_around_window:
- mov eax, [esp+52] /* eax = write */
- cmp ecx, eax
- jbe L_contiguous_in_window /* if (write >= nbytes) */
-
- add esi, [esp+48] /* from += wsize */
- add esi, eax /* from += write */
- sub esi, ecx /* from -= nbytes */
- sub ecx, eax /* nbytes -= write */
-
- mov eax, [esp+64] /* eax = len */
- cmp eax, ecx
- jbe L_do_copy /* if (nbytes >= len) */
-
- sub eax, ecx /* len -= nbytes */
- rep movsb
- mov esi, [esp+28] /* from = window */
- mov ecx, [esp+52] /* nbytes = write */
- cmp eax, ecx
- jbe L_do_copy /* if (nbytes >= len) */
-
- sub eax, ecx /* len -= nbytes */
- rep movsb
- mov esi, edi
- sub esi, ebp /* from = out - dist */
- jmp L_do_copy
-
-ALIGN 4
-L_contiguous_in_window:
- add esi, eax
- sub esi, ecx /* from += write - nbytes */
-
- mov eax, [esp+64] /* eax = len */
- cmp eax, ecx
- jbe L_do_copy /* if (nbytes >= len) */
-
- sub eax, ecx /* len -= nbytes */
- rep movsb
- mov esi, edi
- sub esi, ebp /* from = out - dist */
- jmp L_do_copy
-
-ALIGN 4
-L_do_copy:
- mov ecx, eax
- rep movsb
-
- mov esi, [esp+8] /* move in back to %esi, toss from */
- mov ebp, [esp+32] /* ebp = lcode */
- jmp L_while_test
-
-L_test_for_end_of_block:
- test al, 32
- jz L_invalid_literal_length_code
- mov dword ptr [esp+72], 1
- jmp L_break_loop_with_status
-
-L_invalid_literal_length_code:
- mov dword ptr [esp+72], 2
- jmp L_break_loop_with_status
-
-L_invalid_distance_code:
- mov dword ptr [esp+72], 3
- jmp L_break_loop_with_status
-
-L_invalid_distance_too_far:
- mov esi, [esp+4]
- mov dword ptr [esp+72], 4
- jmp L_break_loop_with_status
-
-L_break_loop:
- mov dword ptr [esp+72], 0
-
-L_break_loop_with_status:
-/* put in, out, bits, and hold back into ar and pop esp */
- mov [esp+8], esi /* save in */
- mov [esp+16], edi /* save out */
- mov [esp+44], ebx /* save bits */
- mov [esp+40], edx /* save hold */
- mov ebp, [esp+4] /* restore esp, ebp */
- mov esp, [esp]
- }
-#else
-#error "x86 architecture not defined"
-#endif
-
- if (ar.status > 1) {
- if (ar.status == 2)
- strm->msg = "invalid literal/length code";
- else if (ar.status == 3)
- strm->msg = "invalid distance code";
- else
- strm->msg = "invalid distance too far back";
- state->mode = BAD;
- }
- else if ( ar.status == 1 ) {
- state->mode = TYPE;
- }
-
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- ar.len = ar.bits >> 3;
- ar.in -= ar.len;
- ar.bits -= ar.len << 3;
- ar.hold &= (1U << ar.bits) - 1;
-
- /* update state and return */
- strm->next_in = ar.in;
- strm->next_out = ar.out;
- strm->avail_in = (unsigned)(ar.in < ar.last ?
- PAD_AVAIL_IN + (ar.last - ar.in) :
- PAD_AVAIL_IN - (ar.in - ar.last));
- strm->avail_out = (unsigned)(ar.out < ar.end ?
- PAD_AVAIL_OUT + (ar.end - ar.out) :
- PAD_AVAIL_OUT - (ar.out - ar.end));
- state->hold = ar.hold;
- state->bits = ar.bits;
- return;
-}
-
diff --git a/funtools/util/zlib-1.2.3/contrib/inflate86/inffast.S b/funtools/util/zlib-1.2.3/contrib/inflate86/inffast.S
deleted file mode 100644
index 2245a29..0000000
--- a/funtools/util/zlib-1.2.3/contrib/inflate86/inffast.S
+++ /dev/null
@@ -1,1368 +0,0 @@
-/*
- * inffast.S is a hand tuned assembler version of:
- *
- * inffast.c -- fast decoding
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Copyright (C) 2003 Chris Anderson <christop@charm.net>
- * Please use the copyright conditions above.
- *
- * This version (Jan-23-2003) of inflate_fast was coded and tested under
- * GNU/Linux on a pentium 3, using the gcc-3.2 compiler distribution. On that
- * machine, I found that gzip style archives decompressed about 20% faster than
- * the gcc-3.2 -O3 -fomit-frame-pointer compiled version. Your results will
- * depend on how large of a buffer is used for z_stream.next_in & next_out
- * (8K-32K worked best for my 256K cpu cache) and how much overhead there is in
- * stream processing I/O and crc32/addler32. In my case, this routine used
- * 70% of the cpu time and crc32 used 20%.
- *
- * I am confident that this version will work in the general case, but I have
- * not tested a wide variety of datasets or a wide variety of platforms.
- *
- * Jan-24-2003 -- Added -DUSE_MMX define for slightly faster inflating.
- * It should be a runtime flag instead of compile time flag...
- *
- * Jan-26-2003 -- Added runtime check for MMX support with cpuid instruction.
- * With -DUSE_MMX, only MMX code is compiled. With -DNO_MMX, only non-MMX code
- * is compiled. Without either option, runtime detection is enabled. Runtime
- * detection should work on all modern cpus and the recomended algorithm (flip
- * ID bit on eflags and then use the cpuid instruction) is used in many
- * multimedia applications. Tested under win2k with gcc-2.95 and gas-2.12
- * distributed with cygwin3. Compiling with gcc-2.95 -c inffast.S -o
- * inffast.obj generates a COFF object which can then be linked with MSVC++
- * compiled code. Tested under FreeBSD 4.7 with gcc-2.95.
- *
- * Jan-28-2003 -- Tested Athlon XP... MMX mode is slower than no MMX (and
- * slower than compiler generated code). Adjusted cpuid check to use the MMX
- * code only for Pentiums < P4 until I have more data on the P4. Speed
- * improvment is only about 15% on the Athlon when compared with code generated
- * with MSVC++. Not sure yet, but I think the P4 will also be slower using the
- * MMX mode because many of it's x86 ALU instructions execute in .5 cycles and
- * have less latency than MMX ops. Added code to buffer the last 11 bytes of
- * the input stream since the MMX code grabs bits in chunks of 32, which
- * differs from the inffast.c algorithm. I don't think there would have been
- * read overruns where a page boundary was crossed (a segfault), but there
- * could have been overruns when next_in ends on unaligned memory (unintialized
- * memory read).
- *
- * Mar-13-2003 -- P4 MMX is slightly slower than P4 NO_MMX. I created a C
- * version of the non-MMX code so that it doesn't depend on zstrm and zstate
- * structure offsets which are hard coded in this file. This was last tested
- * with zlib-1.2.0 which is currently in beta testing, newer versions of this
- * and inffas86.c can be found at http://www.eetbeetee.com/zlib/ and
- * http://www.charm.net/~christop/zlib/
- */
-
-
-/*
- * if you have underscore linking problems (_inflate_fast undefined), try
- * using -DGAS_COFF
- */
-#if ! defined( GAS_COFF ) && ! defined( GAS_ELF )
-
-#if defined( WIN32 ) || defined( __CYGWIN__ )
-#define GAS_COFF /* windows object format */
-#else
-#define GAS_ELF
-#endif
-
-#endif /* ! GAS_COFF && ! GAS_ELF */
-
-
-#if defined( GAS_COFF )
-
-/* coff externals have underscores */
-#define inflate_fast _inflate_fast
-#define inflate_fast_use_mmx _inflate_fast_use_mmx
-
-#endif /* GAS_COFF */
-
-
-.file "inffast.S"
-
-.globl inflate_fast
-
-.text
-.align 4,0
-.L_invalid_literal_length_code_msg:
-.string "invalid literal/length code"
-
-.align 4,0
-.L_invalid_distance_code_msg:
-.string "invalid distance code"
-
-.align 4,0
-.L_invalid_distance_too_far_msg:
-.string "invalid distance too far back"
-
-#if ! defined( NO_MMX )
-.align 4,0
-.L_mask: /* mask[N] = ( 1 << N ) - 1 */
-.long 0
-.long 1
-.long 3
-.long 7
-.long 15
-.long 31
-.long 63
-.long 127
-.long 255
-.long 511
-.long 1023
-.long 2047
-.long 4095
-.long 8191
-.long 16383
-.long 32767
-.long 65535
-.long 131071
-.long 262143
-.long 524287
-.long 1048575
-.long 2097151
-.long 4194303
-.long 8388607
-.long 16777215
-.long 33554431
-.long 67108863
-.long 134217727
-.long 268435455
-.long 536870911
-.long 1073741823
-.long 2147483647
-.long 4294967295
-#endif /* NO_MMX */
-
-.text
-
-/*
- * struct z_stream offsets, in zlib.h
- */
-#define next_in_strm 0 /* strm->next_in */
-#define avail_in_strm 4 /* strm->avail_in */
-#define next_out_strm 12 /* strm->next_out */
-#define avail_out_strm 16 /* strm->avail_out */
-#define msg_strm 24 /* strm->msg */
-#define state_strm 28 /* strm->state */
-
-/*
- * struct inflate_state offsets, in inflate.h
- */
-#define mode_state 0 /* state->mode */
-#define wsize_state 32 /* state->wsize */
-#define write_state 40 /* state->write */
-#define window_state 44 /* state->window */
-#define hold_state 48 /* state->hold */
-#define bits_state 52 /* state->bits */
-#define lencode_state 68 /* state->lencode */
-#define distcode_state 72 /* state->distcode */
-#define lenbits_state 76 /* state->lenbits */
-#define distbits_state 80 /* state->distbits */
-
-/*
- * inflate_fast's activation record
- */
-#define local_var_size 64 /* how much local space for vars */
-#define strm_sp 88 /* first arg: z_stream * (local_var_size + 24) */
-#define start_sp 92 /* second arg: unsigned int (local_var_size + 28) */
-
-/*
- * offsets for local vars on stack
- */
-#define out 60 /* unsigned char* */
-#define window 56 /* unsigned char* */
-#define wsize 52 /* unsigned int */
-#define write 48 /* unsigned int */
-#define in 44 /* unsigned char* */
-#define beg 40 /* unsigned char* */
-#define buf 28 /* char[ 12 ] */
-#define len 24 /* unsigned int */
-#define last 20 /* unsigned char* */
-#define end 16 /* unsigned char* */
-#define dcode 12 /* code* */
-#define lcode 8 /* code* */
-#define dmask 4 /* unsigned int */
-#define lmask 0 /* unsigned int */
-
-/*
- * typedef enum inflate_mode consts, in inflate.h
- */
-#define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */
-#define INFLATE_MODE_BAD 26
-
-
-#if ! defined( USE_MMX ) && ! defined( NO_MMX )
-
-#define RUN_TIME_MMX
-
-#define CHECK_MMX 1
-#define DO_USE_MMX 2
-#define DONT_USE_MMX 3
-
-.globl inflate_fast_use_mmx
-
-.data
-
-.align 4,0
-inflate_fast_use_mmx: /* integer flag for run time control 1=check,2=mmx,3=no */
-.long CHECK_MMX
-
-#if defined( GAS_ELF )
-/* elf info */
-.type inflate_fast_use_mmx,@object
-.size inflate_fast_use_mmx,4
-#endif
-
-#endif /* RUN_TIME_MMX */
-
-#if defined( GAS_COFF )
-/* coff info: scl 2 = extern, type 32 = function */
-.def inflate_fast; .scl 2; .type 32; .endef
-#endif
-
-.text
-
-.align 32,0x90
-inflate_fast:
- pushl %edi
- pushl %esi
- pushl %ebp
- pushl %ebx
- pushf /* save eflags (strm_sp, state_sp assumes this is 32 bits) */
- subl $local_var_size, %esp
- cld
-
-#define strm_r %esi
-#define state_r %edi
-
- movl strm_sp(%esp), strm_r
- movl state_strm(strm_r), state_r
-
- /* in = strm->next_in;
- * out = strm->next_out;
- * last = in + strm->avail_in - 11;
- * beg = out - (start - strm->avail_out);
- * end = out + (strm->avail_out - 257);
- */
- movl avail_in_strm(strm_r), %edx
- movl next_in_strm(strm_r), %eax
-
- addl %eax, %edx /* avail_in += next_in */
- subl $11, %edx /* avail_in -= 11 */
-
- movl %eax, in(%esp)
- movl %edx, last(%esp)
-
- movl start_sp(%esp), %ebp
- movl avail_out_strm(strm_r), %ecx
- movl next_out_strm(strm_r), %ebx
-
- subl %ecx, %ebp /* start -= avail_out */
- negl %ebp /* start = -start */
- addl %ebx, %ebp /* start += next_out */
-
- subl $257, %ecx /* avail_out -= 257 */
- addl %ebx, %ecx /* avail_out += out */
-
- movl %ebx, out(%esp)
- movl %ebp, beg(%esp)
- movl %ecx, end(%esp)
-
- /* wsize = state->wsize;
- * write = state->write;
- * window = state->window;
- * hold = state->hold;
- * bits = state->bits;
- * lcode = state->lencode;
- * dcode = state->distcode;
- * lmask = ( 1 << state->lenbits ) - 1;
- * dmask = ( 1 << state->distbits ) - 1;
- */
-
- movl lencode_state(state_r), %eax
- movl distcode_state(state_r), %ecx
-
- movl %eax, lcode(%esp)
- movl %ecx, dcode(%esp)
-
- movl $1, %eax
- movl lenbits_state(state_r), %ecx
- shll %cl, %eax
- decl %eax
- movl %eax, lmask(%esp)
-
- movl $1, %eax
- movl distbits_state(state_r), %ecx
- shll %cl, %eax
- decl %eax
- movl %eax, dmask(%esp)
-
- movl wsize_state(state_r), %eax
- movl write_state(state_r), %ecx
- movl window_state(state_r), %edx
-
- movl %eax, wsize(%esp)
- movl %ecx, write(%esp)
- movl %edx, window(%esp)
-
- movl hold_state(state_r), %ebp
- movl bits_state(state_r), %ebx
-
-#undef strm_r
-#undef state_r
-
-#define in_r %esi
-#define from_r %esi
-#define out_r %edi
-
- movl in(%esp), in_r
- movl last(%esp), %ecx
- cmpl in_r, %ecx
- ja .L_align_long /* if in < last */
-
- addl $11, %ecx /* ecx = &in[ avail_in ] */
- subl in_r, %ecx /* ecx = avail_in */
- movl $12, %eax
- subl %ecx, %eax /* eax = 12 - avail_in */
- leal buf(%esp), %edi
- rep movsb /* memcpy( buf, in, avail_in ) */
- movl %eax, %ecx
- xorl %eax, %eax
- rep stosb /* memset( &buf[ avail_in ], 0, 12 - avail_in ) */
- leal buf(%esp), in_r /* in = buf */
- movl in_r, last(%esp) /* last = in, do just one iteration */
- jmp .L_is_aligned
-
- /* align in_r on long boundary */
-.L_align_long:
- testl $3, in_r
- jz .L_is_aligned
- xorl %eax, %eax
- movb (in_r), %al
- incl in_r
- movl %ebx, %ecx
- addl $8, %ebx
- shll %cl, %eax
- orl %eax, %ebp
- jmp .L_align_long
-
-.L_is_aligned:
- movl out(%esp), out_r
-
-#if defined( NO_MMX )
- jmp .L_do_loop
-#endif
-
-#if defined( USE_MMX )
- jmp .L_init_mmx
-#endif
-
-/*** Runtime MMX check ***/
-
-#if defined( RUN_TIME_MMX )
-.L_check_mmx:
- cmpl $DO_USE_MMX, inflate_fast_use_mmx
- je .L_init_mmx
- ja .L_do_loop /* > 2 */
-
- pushl %eax
- pushl %ebx
- pushl %ecx
- pushl %edx
- pushf
- movl (%esp), %eax /* copy eflags to eax */
- xorl $0x200000, (%esp) /* try toggling ID bit of eflags (bit 21)
- * to see if cpu supports cpuid...
- * ID bit method not supported by NexGen but
- * bios may load a cpuid instruction and
- * cpuid may be disabled on Cyrix 5-6x86 */
- popf
- pushf
- popl %edx /* copy new eflags to edx */
- xorl %eax, %edx /* test if ID bit is flipped */
- jz .L_dont_use_mmx /* not flipped if zero */
- xorl %eax, %eax
- cpuid
- cmpl $0x756e6547, %ebx /* check for GenuineIntel in ebx,ecx,edx */
- jne .L_dont_use_mmx
- cmpl $0x6c65746e, %ecx
- jne .L_dont_use_mmx
- cmpl $0x49656e69, %edx
- jne .L_dont_use_mmx
- movl $1, %eax
- cpuid /* get cpu features */
- shrl $8, %eax
- andl $15, %eax
- cmpl $6, %eax /* check for Pentium family, is 0xf for P4 */
- jne .L_dont_use_mmx
- testl $0x800000, %edx /* test if MMX feature is set (bit 23) */
- jnz .L_use_mmx
- jmp .L_dont_use_mmx
-.L_use_mmx:
- movl $DO_USE_MMX, inflate_fast_use_mmx
- jmp .L_check_mmx_pop
-.L_dont_use_mmx:
- movl $DONT_USE_MMX, inflate_fast_use_mmx
-.L_check_mmx_pop:
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
- jmp .L_check_mmx
-#endif
-
-
-/*** Non-MMX code ***/
-
-#if defined ( NO_MMX ) || defined( RUN_TIME_MMX )
-
-#define hold_r %ebp
-#define bits_r %bl
-#define bitslong_r %ebx
-
-.align 32,0x90
-.L_while_test:
- /* while (in < last && out < end)
- */
- cmpl out_r, end(%esp)
- jbe .L_break_loop /* if (out >= end) */
-
- cmpl in_r, last(%esp)
- jbe .L_break_loop
-
-.L_do_loop:
- /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out
- *
- * do {
- * if (bits < 15) {
- * hold |= *((unsigned short *)in)++ << bits;
- * bits += 16
- * }
- * this = lcode[hold & lmask]
- */
- cmpb $15, bits_r
- ja .L_get_length_code /* if (15 < bits) */
-
- xorl %eax, %eax
- lodsw /* al = *(ushort *)in++ */
- movb bits_r, %cl /* cl = bits, needs it for shifting */
- addb $16, bits_r /* bits += 16 */
- shll %cl, %eax
- orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */
-
-.L_get_length_code:
- movl lmask(%esp), %edx /* edx = lmask */
- movl lcode(%esp), %ecx /* ecx = lcode */
- andl hold_r, %edx /* edx &= hold */
- movl (%ecx,%edx,4), %eax /* eax = lcode[hold & lmask] */
-
-.L_dolen:
- /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out
- *
- * dolen:
- * bits -= this.bits;
- * hold >>= this.bits
- */
- movb %ah, %cl /* cl = this.bits */
- subb %ah, bits_r /* bits -= this.bits */
- shrl %cl, hold_r /* hold >>= this.bits */
-
- /* check if op is a literal
- * if (op == 0) {
- * PUP(out) = this.val;
- * }
- */
- testb %al, %al
- jnz .L_test_for_length_base /* if (op != 0) 45.7% */
-
- shrl $16, %eax /* output this.val char */
- stosb
- jmp .L_while_test
-
-.L_test_for_length_base:
- /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = len
- *
- * else if (op & 16) {
- * len = this.val
- * op &= 15
- * if (op) {
- * if (op > bits) {
- * hold |= *((unsigned short *)in)++ << bits;
- * bits += 16
- * }
- * len += hold & mask[op];
- * bits -= op;
- * hold >>= op;
- * }
- */
-#define len_r %edx
- movl %eax, len_r /* len = this */
- shrl $16, len_r /* len = this.val */
- movb %al, %cl
-
- testb $16, %al
- jz .L_test_for_second_level_length /* if ((op & 16) == 0) 8% */
- andb $15, %cl /* op &= 15 */
- jz .L_save_len /* if (!op) */
- cmpb %cl, bits_r
- jae .L_add_bits_to_len /* if (op <= bits) */
-
- movb %cl, %ch /* stash op in ch, freeing cl */
- xorl %eax, %eax
- lodsw /* al = *(ushort *)in++ */
- movb bits_r, %cl /* cl = bits, needs it for shifting */
- addb $16, bits_r /* bits += 16 */
- shll %cl, %eax
- orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */
- movb %ch, %cl /* move op back to ecx */
-
-.L_add_bits_to_len:
- movl $1, %eax
- shll %cl, %eax
- decl %eax
- subb %cl, bits_r
- andl hold_r, %eax /* eax &= hold */
- shrl %cl, hold_r
- addl %eax, len_r /* len += hold & mask[op] */
-
-.L_save_len:
- movl len_r, len(%esp) /* save len */
-#undef len_r
-
-.L_decode_distance:
- /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = dist
- *
- * if (bits < 15) {
- * hold |= *((unsigned short *)in)++ << bits;
- * bits += 16
- * }
- * this = dcode[hold & dmask];
- * dodist:
- * bits -= this.bits;
- * hold >>= this.bits;
- * op = this.op;
- */
-
- cmpb $15, bits_r
- ja .L_get_distance_code /* if (15 < bits) */
-
- xorl %eax, %eax
- lodsw /* al = *(ushort *)in++ */
- movb bits_r, %cl /* cl = bits, needs it for shifting */
- addb $16, bits_r /* bits += 16 */
- shll %cl, %eax
- orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */
-
-.L_get_distance_code:
- movl dmask(%esp), %edx /* edx = dmask */
- movl dcode(%esp), %ecx /* ecx = dcode */
- andl hold_r, %edx /* edx &= hold */
- movl (%ecx,%edx,4), %eax /* eax = dcode[hold & dmask] */
-
-#define dist_r %edx
-.L_dodist:
- movl %eax, dist_r /* dist = this */
- shrl $16, dist_r /* dist = this.val */
- movb %ah, %cl
- subb %ah, bits_r /* bits -= this.bits */
- shrl %cl, hold_r /* hold >>= this.bits */
-
- /* if (op & 16) {
- * dist = this.val
- * op &= 15
- * if (op > bits) {
- * hold |= *((unsigned short *)in)++ << bits;
- * bits += 16
- * }
- * dist += hold & mask[op];
- * bits -= op;
- * hold >>= op;
- */
- movb %al, %cl /* cl = this.op */
-
- testb $16, %al /* if ((op & 16) == 0) */
- jz .L_test_for_second_level_dist
- andb $15, %cl /* op &= 15 */
- jz .L_check_dist_one
- cmpb %cl, bits_r
- jae .L_add_bits_to_dist /* if (op <= bits) 97.6% */
-
- movb %cl, %ch /* stash op in ch, freeing cl */
- xorl %eax, %eax
- lodsw /* al = *(ushort *)in++ */
- movb bits_r, %cl /* cl = bits, needs it for shifting */
- addb $16, bits_r /* bits += 16 */
- shll %cl, %eax
- orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */
- movb %ch, %cl /* move op back to ecx */
-
-.L_add_bits_to_dist:
- movl $1, %eax
- shll %cl, %eax
- decl %eax /* (1 << op) - 1 */
- subb %cl, bits_r
- andl hold_r, %eax /* eax &= hold */
- shrl %cl, hold_r
- addl %eax, dist_r /* dist += hold & ((1 << op) - 1) */
- jmp .L_check_window
-
-.L_check_window:
- /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist
- * %ecx = nbytes
- *
- * nbytes = out - beg;
- * if (dist <= nbytes) {
- * from = out - dist;
- * do {
- * PUP(out) = PUP(from);
- * } while (--len > 0) {
- * }
- */
-
- movl in_r, in(%esp) /* save in so from can use it's reg */
- movl out_r, %eax
- subl beg(%esp), %eax /* nbytes = out - beg */
-
- cmpl dist_r, %eax
- jb .L_clip_window /* if (dist > nbytes) 4.2% */
-
- movl len(%esp), %ecx
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
-
- subl $3, %ecx
- movb (from_r), %al
- movb %al, (out_r)
- movb 1(from_r), %al
- movb 2(from_r), %dl
- addl $3, from_r
- movb %al, 1(out_r)
- movb %dl, 2(out_r)
- addl $3, out_r
- rep movsb
-
- movl in(%esp), in_r /* move in back to %esi, toss from */
- jmp .L_while_test
-
-.align 16,0x90
-.L_check_dist_one:
- cmpl $1, dist_r
- jne .L_check_window
- cmpl out_r, beg(%esp)
- je .L_check_window
-
- decl out_r
- movl len(%esp), %ecx
- movb (out_r), %al
- subl $3, %ecx
-
- movb %al, 1(out_r)
- movb %al, 2(out_r)
- movb %al, 3(out_r)
- addl $4, out_r
- rep stosb
-
- jmp .L_while_test
-
-.align 16,0x90
-.L_test_for_second_level_length:
- /* else if ((op & 64) == 0) {
- * this = lcode[this.val + (hold & mask[op])];
- * }
- */
- testb $64, %al
- jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */
-
- movl $1, %eax
- shll %cl, %eax
- decl %eax
- andl hold_r, %eax /* eax &= hold */
- addl %edx, %eax /* eax += this.val */
- movl lcode(%esp), %edx /* edx = lcode */
- movl (%edx,%eax,4), %eax /* eax = lcode[val + (hold&mask[op])] */
- jmp .L_dolen
-
-.align 16,0x90
-.L_test_for_second_level_dist:
- /* else if ((op & 64) == 0) {
- * this = dcode[this.val + (hold & mask[op])];
- * }
- */
- testb $64, %al
- jnz .L_invalid_distance_code /* if ((op & 64) != 0) */
-
- movl $1, %eax
- shll %cl, %eax
- decl %eax
- andl hold_r, %eax /* eax &= hold */
- addl %edx, %eax /* eax += this.val */
- movl dcode(%esp), %edx /* edx = dcode */
- movl (%edx,%eax,4), %eax /* eax = dcode[val + (hold&mask[op])] */
- jmp .L_dodist
-
-.align 16,0x90
-.L_clip_window:
- /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist
- * %ecx = nbytes
- *
- * else {
- * if (dist > wsize) {
- * invalid distance
- * }
- * from = window;
- * nbytes = dist - nbytes;
- * if (write == 0) {
- * from += wsize - nbytes;
- */
-#define nbytes_r %ecx
- movl %eax, nbytes_r
- movl wsize(%esp), %eax /* prepare for dist compare */
- negl nbytes_r /* nbytes = -nbytes */
- movl window(%esp), from_r /* from = window */
-
- cmpl dist_r, %eax
- jb .L_invalid_distance_too_far /* if (dist > wsize) */
-
- addl dist_r, nbytes_r /* nbytes = dist - nbytes */
- cmpl $0, write(%esp)
- jne .L_wrap_around_window /* if (write != 0) */
-
- subl nbytes_r, %eax
- addl %eax, from_r /* from += wsize - nbytes */
-
- /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist
- * %ecx = nbytes, %eax = len
- *
- * if (nbytes < len) {
- * len -= nbytes;
- * do {
- * PUP(out) = PUP(from);
- * } while (--nbytes);
- * from = out - dist;
- * }
- * }
- */
-#define len_r %eax
- movl len(%esp), len_r
- cmpl nbytes_r, len_r
- jbe .L_do_copy1 /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
- jmp .L_do_copy1
-
- cmpl nbytes_r, len_r
- jbe .L_do_copy1 /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
- jmp .L_do_copy1
-
-.L_wrap_around_window:
- /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist
- * %ecx = nbytes, %eax = write, %eax = len
- *
- * else if (write < nbytes) {
- * from += wsize + write - nbytes;
- * nbytes -= write;
- * if (nbytes < len) {
- * len -= nbytes;
- * do {
- * PUP(out) = PUP(from);
- * } while (--nbytes);
- * from = window;
- * nbytes = write;
- * if (nbytes < len) {
- * len -= nbytes;
- * do {
- * PUP(out) = PUP(from);
- * } while(--nbytes);
- * from = out - dist;
- * }
- * }
- * }
- */
-#define write_r %eax
- movl write(%esp), write_r
- cmpl write_r, nbytes_r
- jbe .L_contiguous_in_window /* if (write >= nbytes) */
-
- addl wsize(%esp), from_r
- addl write_r, from_r
- subl nbytes_r, from_r /* from += wsize + write - nbytes */
- subl write_r, nbytes_r /* nbytes -= write */
-#undef write_r
-
- movl len(%esp), len_r
- cmpl nbytes_r, len_r
- jbe .L_do_copy1 /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl window(%esp), from_r /* from = window */
- movl write(%esp), nbytes_r /* nbytes = write */
- cmpl nbytes_r, len_r
- jbe .L_do_copy1 /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
- jmp .L_do_copy1
-
-.L_contiguous_in_window:
- /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist
- * %ecx = nbytes, %eax = write, %eax = len
- *
- * else {
- * from += write - nbytes;
- * if (nbytes < len) {
- * len -= nbytes;
- * do {
- * PUP(out) = PUP(from);
- * } while (--nbytes);
- * from = out - dist;
- * }
- * }
- */
-#define write_r %eax
- addl write_r, from_r
- subl nbytes_r, from_r /* from += write - nbytes */
-#undef write_r
-
- movl len(%esp), len_r
- cmpl nbytes_r, len_r
- jbe .L_do_copy1 /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
-
-.L_do_copy1:
- /* regs: %esi = from, %esi = in, %ebp = hold, %bl = bits, %edi = out
- * %eax = len
- *
- * while (len > 0) {
- * PUP(out) = PUP(from);
- * len--;
- * }
- * }
- * } while (in < last && out < end);
- */
-#undef nbytes_r
-#define in_r %esi
- movl len_r, %ecx
- rep movsb
-
- movl in(%esp), in_r /* move in back to %esi, toss from */
- jmp .L_while_test
-
-#undef len_r
-#undef dist_r
-
-#endif /* NO_MMX || RUN_TIME_MMX */
-
-
-/*** MMX code ***/
-
-#if defined( USE_MMX ) || defined( RUN_TIME_MMX )
-
-.align 32,0x90
-.L_init_mmx:
- emms
-
-#undef bits_r
-#undef bitslong_r
-#define bitslong_r %ebp
-#define hold_mm %mm0
- movd %ebp, hold_mm
- movl %ebx, bitslong_r
-
-#define used_mm %mm1
-#define dmask2_mm %mm2
-#define lmask2_mm %mm3
-#define lmask_mm %mm4
-#define dmask_mm %mm5
-#define tmp_mm %mm6
-
- movd lmask(%esp), lmask_mm
- movq lmask_mm, lmask2_mm
- movd dmask(%esp), dmask_mm
- movq dmask_mm, dmask2_mm
- pxor used_mm, used_mm
- movl lcode(%esp), %ebx /* ebx = lcode */
- jmp .L_do_loop_mmx
-
-.align 32,0x90
-.L_while_test_mmx:
- /* while (in < last && out < end)
- */
- cmpl out_r, end(%esp)
- jbe .L_break_loop /* if (out >= end) */
-
- cmpl in_r, last(%esp)
- jbe .L_break_loop
-
-.L_do_loop_mmx:
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
-
- cmpl $32, bitslong_r
- ja .L_get_length_code_mmx /* if (32 < bits) */
-
- movd bitslong_r, tmp_mm
- movd (in_r), %mm7
- addl $4, in_r
- psllq tmp_mm, %mm7
- addl $32, bitslong_r
- por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */
-
-.L_get_length_code_mmx:
- pand hold_mm, lmask_mm
- movd lmask_mm, %eax
- movq lmask2_mm, lmask_mm
- movl (%ebx,%eax,4), %eax /* eax = lcode[hold & lmask] */
-
-.L_dolen_mmx:
- movzbl %ah, %ecx /* ecx = this.bits */
- movd %ecx, used_mm
- subl %ecx, bitslong_r /* bits -= this.bits */
-
- testb %al, %al
- jnz .L_test_for_length_base_mmx /* if (op != 0) 45.7% */
-
- shrl $16, %eax /* output this.val char */
- stosb
- jmp .L_while_test_mmx
-
-.L_test_for_length_base_mmx:
-#define len_r %edx
- movl %eax, len_r /* len = this */
- shrl $16, len_r /* len = this.val */
-
- testb $16, %al
- jz .L_test_for_second_level_length_mmx /* if ((op & 16) == 0) 8% */
- andl $15, %eax /* op &= 15 */
- jz .L_decode_distance_mmx /* if (!op) */
-
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
- movd %eax, used_mm
- movd hold_mm, %ecx
- subl %eax, bitslong_r
- andl .L_mask(,%eax,4), %ecx
- addl %ecx, len_r /* len += hold & mask[op] */
-
-.L_decode_distance_mmx:
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
-
- cmpl $32, bitslong_r
- ja .L_get_dist_code_mmx /* if (32 < bits) */
-
- movd bitslong_r, tmp_mm
- movd (in_r), %mm7
- addl $4, in_r
- psllq tmp_mm, %mm7
- addl $32, bitslong_r
- por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */
-
-.L_get_dist_code_mmx:
- movl dcode(%esp), %ebx /* ebx = dcode */
- pand hold_mm, dmask_mm
- movd dmask_mm, %eax
- movq dmask2_mm, dmask_mm
- movl (%ebx,%eax,4), %eax /* eax = dcode[hold & lmask] */
-
-.L_dodist_mmx:
-#define dist_r %ebx
- movzbl %ah, %ecx /* ecx = this.bits */
- movl %eax, dist_r
- shrl $16, dist_r /* dist = this.val */
- subl %ecx, bitslong_r /* bits -= this.bits */
- movd %ecx, used_mm
-
- testb $16, %al /* if ((op & 16) == 0) */
- jz .L_test_for_second_level_dist_mmx
- andl $15, %eax /* op &= 15 */
- jz .L_check_dist_one_mmx
-
-.L_add_bits_to_dist_mmx:
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
- movd %eax, used_mm /* save bit length of current op */
- movd hold_mm, %ecx /* get the next bits on input stream */
- subl %eax, bitslong_r /* bits -= op bits */
- andl .L_mask(,%eax,4), %ecx /* ecx = hold & mask[op] */
- addl %ecx, dist_r /* dist += hold & mask[op] */
-
-.L_check_window_mmx:
- movl in_r, in(%esp) /* save in so from can use it's reg */
- movl out_r, %eax
- subl beg(%esp), %eax /* nbytes = out - beg */
-
- cmpl dist_r, %eax
- jb .L_clip_window_mmx /* if (dist > nbytes) 4.2% */
-
- movl len_r, %ecx
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
-
- subl $3, %ecx
- movb (from_r), %al
- movb %al, (out_r)
- movb 1(from_r), %al
- movb 2(from_r), %dl
- addl $3, from_r
- movb %al, 1(out_r)
- movb %dl, 2(out_r)
- addl $3, out_r
- rep movsb
-
- movl in(%esp), in_r /* move in back to %esi, toss from */
- movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */
- jmp .L_while_test_mmx
-
-.align 16,0x90
-.L_check_dist_one_mmx:
- cmpl $1, dist_r
- jne .L_check_window_mmx
- cmpl out_r, beg(%esp)
- je .L_check_window_mmx
-
- decl out_r
- movl len_r, %ecx
- movb (out_r), %al
- subl $3, %ecx
-
- movb %al, 1(out_r)
- movb %al, 2(out_r)
- movb %al, 3(out_r)
- addl $4, out_r
- rep stosb
-
- movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */
- jmp .L_while_test_mmx
-
-.align 16,0x90
-.L_test_for_second_level_length_mmx:
- testb $64, %al
- jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */
-
- andl $15, %eax
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
- movd hold_mm, %ecx
- andl .L_mask(,%eax,4), %ecx
- addl len_r, %ecx
- movl (%ebx,%ecx,4), %eax /* eax = lcode[hold & lmask] */
- jmp .L_dolen_mmx
-
-.align 16,0x90
-.L_test_for_second_level_dist_mmx:
- testb $64, %al
- jnz .L_invalid_distance_code /* if ((op & 64) != 0) */
-
- andl $15, %eax
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
- movd hold_mm, %ecx
- andl .L_mask(,%eax,4), %ecx
- movl dcode(%esp), %eax /* ecx = dcode */
- addl dist_r, %ecx
- movl (%eax,%ecx,4), %eax /* eax = lcode[hold & lmask] */
- jmp .L_dodist_mmx
-
-.align 16,0x90
-.L_clip_window_mmx:
-#define nbytes_r %ecx
- movl %eax, nbytes_r
- movl wsize(%esp), %eax /* prepare for dist compare */
- negl nbytes_r /* nbytes = -nbytes */
- movl window(%esp), from_r /* from = window */
-
- cmpl dist_r, %eax
- jb .L_invalid_distance_too_far /* if (dist > wsize) */
-
- addl dist_r, nbytes_r /* nbytes = dist - nbytes */
- cmpl $0, write(%esp)
- jne .L_wrap_around_window_mmx /* if (write != 0) */
-
- subl nbytes_r, %eax
- addl %eax, from_r /* from += wsize - nbytes */
-
- cmpl nbytes_r, len_r
- jbe .L_do_copy1_mmx /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
- jmp .L_do_copy1_mmx
-
- cmpl nbytes_r, len_r
- jbe .L_do_copy1_mmx /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
- jmp .L_do_copy1_mmx
-
-.L_wrap_around_window_mmx:
-#define write_r %eax
- movl write(%esp), write_r
- cmpl write_r, nbytes_r
- jbe .L_contiguous_in_window_mmx /* if (write >= nbytes) */
-
- addl wsize(%esp), from_r
- addl write_r, from_r
- subl nbytes_r, from_r /* from += wsize + write - nbytes */
- subl write_r, nbytes_r /* nbytes -= write */
-#undef write_r
-
- cmpl nbytes_r, len_r
- jbe .L_do_copy1_mmx /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl window(%esp), from_r /* from = window */
- movl write(%esp), nbytes_r /* nbytes = write */
- cmpl nbytes_r, len_r
- jbe .L_do_copy1_mmx /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
- jmp .L_do_copy1_mmx
-
-.L_contiguous_in_window_mmx:
-#define write_r %eax
- addl write_r, from_r
- subl nbytes_r, from_r /* from += write - nbytes */
-#undef write_r
-
- cmpl nbytes_r, len_r
- jbe .L_do_copy1_mmx /* if (nbytes >= len) */
-
- subl nbytes_r, len_r /* len -= nbytes */
- rep movsb
- movl out_r, from_r
- subl dist_r, from_r /* from = out - dist */
-
-.L_do_copy1_mmx:
-#undef nbytes_r
-#define in_r %esi
- movl len_r, %ecx
- rep movsb
-
- movl in(%esp), in_r /* move in back to %esi, toss from */
- movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */
- jmp .L_while_test_mmx
-
-#undef hold_r
-#undef bitslong_r
-
-#endif /* USE_MMX || RUN_TIME_MMX */
-
-
-/*** USE_MMX, NO_MMX, and RUNTIME_MMX from here on ***/
-
-.L_invalid_distance_code:
- /* else {
- * strm->msg = "invalid distance code";
- * state->mode = BAD;
- * }
- */
- movl $.L_invalid_distance_code_msg, %ecx
- movl $INFLATE_MODE_BAD, %edx
- jmp .L_update_stream_state
-
-.L_test_for_end_of_block:
- /* else if (op & 32) {
- * state->mode = TYPE;
- * break;
- * }
- */
- testb $32, %al
- jz .L_invalid_literal_length_code /* if ((op & 32) == 0) */
-
- movl $0, %ecx
- movl $INFLATE_MODE_TYPE, %edx
- jmp .L_update_stream_state
-
-.L_invalid_literal_length_code:
- /* else {
- * strm->msg = "invalid literal/length code";
- * state->mode = BAD;
- * }
- */
- movl $.L_invalid_literal_length_code_msg, %ecx
- movl $INFLATE_MODE_BAD, %edx
- jmp .L_update_stream_state
-
-.L_invalid_distance_too_far:
- /* strm->msg = "invalid distance too far back";
- * state->mode = BAD;
- */
- movl in(%esp), in_r /* from_r has in's reg, put in back */
- movl $.L_invalid_distance_too_far_msg, %ecx
- movl $INFLATE_MODE_BAD, %edx
- jmp .L_update_stream_state
-
-.L_update_stream_state:
- /* set strm->msg = %ecx, strm->state->mode = %edx */
- movl strm_sp(%esp), %eax
- testl %ecx, %ecx /* if (msg != NULL) */
- jz .L_skip_msg
- movl %ecx, msg_strm(%eax) /* strm->msg = msg */
-.L_skip_msg:
- movl state_strm(%eax), %eax /* state = strm->state */
- movl %edx, mode_state(%eax) /* state->mode = edx (BAD | TYPE) */
- jmp .L_break_loop
-
-.align 32,0x90
-.L_break_loop:
-
-/*
- * Regs:
- *
- * bits = %ebp when mmx, and in %ebx when non-mmx
- * hold = %hold_mm when mmx, and in %ebp when non-mmx
- * in = %esi
- * out = %edi
- */
-
-#if defined( USE_MMX ) || defined( RUN_TIME_MMX )
-
-#if defined( RUN_TIME_MMX )
-
- cmpl $DO_USE_MMX, inflate_fast_use_mmx
- jne .L_update_next_in
-
-#endif /* RUN_TIME_MMX */
-
- movl %ebp, %ebx
-
-.L_update_next_in:
-
-#endif
-
-#define strm_r %eax
-#define state_r %edx
-
- /* len = bits >> 3;
- * in -= len;
- * bits -= len << 3;
- * hold &= (1U << bits) - 1;
- * state->hold = hold;
- * state->bits = bits;
- * strm->next_in = in;
- * strm->next_out = out;
- */
- movl strm_sp(%esp), strm_r
- movl %ebx, %ecx
- movl state_strm(strm_r), state_r
- shrl $3, %ecx
- subl %ecx, in_r
- shll $3, %ecx
- subl %ecx, %ebx
- movl out_r, next_out_strm(strm_r)
- movl %ebx, bits_state(state_r)
- movl %ebx, %ecx
-
- leal buf(%esp), %ebx
- cmpl %ebx, last(%esp)
- jne .L_buf_not_used /* if buf != last */
-
- subl %ebx, in_r /* in -= buf */
- movl next_in_strm(strm_r), %ebx
- movl %ebx, last(%esp) /* last = strm->next_in */
- addl %ebx, in_r /* in += strm->next_in */
- movl avail_in_strm(strm_r), %ebx
- subl $11, %ebx
- addl %ebx, last(%esp) /* last = &strm->next_in[ avail_in - 11 ] */
-
-.L_buf_not_used:
- movl in_r, next_in_strm(strm_r)
-
- movl $1, %ebx
- shll %cl, %ebx
- decl %ebx
-
-#if defined( USE_MMX ) || defined( RUN_TIME_MMX )
-
-#if defined( RUN_TIME_MMX )
-
- cmpl $DO_USE_MMX, inflate_fast_use_mmx
- jne .L_update_hold
-
-#endif /* RUN_TIME_MMX */
-
- psrlq used_mm, hold_mm /* hold_mm >>= last bit length */
- movd hold_mm, %ebp
-
- emms
-
-.L_update_hold:
-
-#endif /* USE_MMX || RUN_TIME_MMX */
-
- andl %ebx, %ebp
- movl %ebp, hold_state(state_r)
-
-#define last_r %ebx
-
- /* strm->avail_in = in < last ? 11 + (last - in) : 11 - (in - last) */
- movl last(%esp), last_r
- cmpl in_r, last_r
- jbe .L_last_is_smaller /* if (in >= last) */
-
- subl in_r, last_r /* last -= in */
- addl $11, last_r /* last += 11 */
- movl last_r, avail_in_strm(strm_r)
- jmp .L_fixup_out
-.L_last_is_smaller:
- subl last_r, in_r /* in -= last */
- negl in_r /* in = -in */
- addl $11, in_r /* in += 11 */
- movl in_r, avail_in_strm(strm_r)
-
-#undef last_r
-#define end_r %ebx
-
-.L_fixup_out:
- /* strm->avail_out = out < end ? 257 + (end - out) : 257 - (out - end)*/
- movl end(%esp), end_r
- cmpl out_r, end_r
- jbe .L_end_is_smaller /* if (out >= end) */
-
- subl out_r, end_r /* end -= out */
- addl $257, end_r /* end += 257 */
- movl end_r, avail_out_strm(strm_r)
- jmp .L_done
-.L_end_is_smaller:
- subl end_r, out_r /* out -= end */
- negl out_r /* out = -out */
- addl $257, out_r /* out += 257 */
- movl out_r, avail_out_strm(strm_r)
-
-#undef end_r
-#undef strm_r
-#undef state_r
-
-.L_done:
- addl $local_var_size, %esp
- popf
- popl %ebx
- popl %ebp
- popl %esi
- popl %edi
- ret
-
-#if defined( GAS_ELF )
-/* elf info */
-.type inflate_fast,@function
-.size inflate_fast,.-inflate_fast
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream/test.cpp b/funtools/util/zlib-1.2.3/contrib/iostream/test.cpp
deleted file mode 100644
index 7d265b3..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream/test.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-#include "zfstream.h"
-
-int main() {
-
- // Construct a stream object with this filebuffer. Anything sent
- // to this stream will go to standard out.
- gzofstream os( 1, ios::out );
-
- // This text is getting compressed and sent to stdout.
- // To prove this, run 'test | zcat'.
- os << "Hello, Mommy" << endl;
-
- os << setcompressionlevel( Z_NO_COMPRESSION );
- os << "hello, hello, hi, ho!" << endl;
-
- setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
- << "I'm compressing again" << endl;
-
- os.close();
-
- return 0;
-
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream/zfstream.cpp b/funtools/util/zlib-1.2.3/contrib/iostream/zfstream.cpp
deleted file mode 100644
index d0cd85f..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream/zfstream.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-
-#include "zfstream.h"
-
-gzfilebuf::gzfilebuf() :
- file(NULL),
- mode(0),
- own_file_descriptor(0)
-{ }
-
-gzfilebuf::~gzfilebuf() {
-
- sync();
- if ( own_file_descriptor )
- close();
-
-}
-
-gzfilebuf *gzfilebuf::open( const char *name,
- int io_mode ) {
-
- if ( is_open() )
- return NULL;
-
- char char_mode[10];
- char *p = char_mode;
-
- if ( io_mode & ios::in ) {
- mode = ios::in;
- *p++ = 'r';
- } else if ( io_mode & ios::app ) {
- mode = ios::app;
- *p++ = 'a';
- } else {
- mode = ios::out;
- *p++ = 'w';
- }
-
- if ( io_mode & ios::binary ) {
- mode |= ios::binary;
- *p++ = 'b';
- }
-
- // Hard code the compression level
- if ( io_mode & (ios::out|ios::app )) {
- *p++ = '9';
- }
-
- // Put the end-of-string indicator
- *p = '\0';
-
- if ( (file = gzopen(name, char_mode)) == NULL )
- return NULL;
-
- own_file_descriptor = 1;
-
- return this;
-
-}
-
-gzfilebuf *gzfilebuf::attach( int file_descriptor,
- int io_mode ) {
-
- if ( is_open() )
- return NULL;
-
- char char_mode[10];
- char *p = char_mode;
-
- if ( io_mode & ios::in ) {
- mode = ios::in;
- *p++ = 'r';
- } else if ( io_mode & ios::app ) {
- mode = ios::app;
- *p++ = 'a';
- } else {
- mode = ios::out;
- *p++ = 'w';
- }
-
- if ( io_mode & ios::binary ) {
- mode |= ios::binary;
- *p++ = 'b';
- }
-
- // Hard code the compression level
- if ( io_mode & (ios::out|ios::app )) {
- *p++ = '9';
- }
-
- // Put the end-of-string indicator
- *p = '\0';
-
- if ( (file = gzdopen(file_descriptor, char_mode)) == NULL )
- return NULL;
-
- own_file_descriptor = 0;
-
- return this;
-
-}
-
-gzfilebuf *gzfilebuf::close() {
-
- if ( is_open() ) {
-
- sync();
- gzclose( file );
- file = NULL;
-
- }
-
- return this;
-
-}
-
-int gzfilebuf::setcompressionlevel( int comp_level ) {
-
- return gzsetparams(file, comp_level, -2);
-
-}
-
-int gzfilebuf::setcompressionstrategy( int comp_strategy ) {
-
- return gzsetparams(file, -2, comp_strategy);
-
-}
-
-
-streampos gzfilebuf::seekoff( streamoff off, ios::seek_dir dir, int which ) {
-
- return streampos(EOF);
-
-}
-
-int gzfilebuf::underflow() {
-
- // If the file hasn't been opened for reading, error.
- if ( !is_open() || !(mode & ios::in) )
- return EOF;
-
- // if a buffer doesn't exists, allocate one.
- if ( !base() ) {
-
- if ( (allocate()) == EOF )
- return EOF;
- setp(0,0);
-
- } else {
-
- if ( in_avail() )
- return (unsigned char) *gptr();
-
- if ( out_waiting() ) {
- if ( flushbuf() == EOF )
- return EOF;
- }
-
- }
-
- // Attempt to fill the buffer.
-
- int result = fillbuf();
- if ( result == EOF ) {
- // disable get area
- setg(0,0,0);
- return EOF;
- }
-
- return (unsigned char) *gptr();
-
-}
-
-int gzfilebuf::overflow( int c ) {
-
- if ( !is_open() || !(mode & ios::out) )
- return EOF;
-
- if ( !base() ) {
- if ( allocate() == EOF )
- return EOF;
- setg(0,0,0);
- } else {
- if (in_avail()) {
- return EOF;
- }
- if (out_waiting()) {
- if (flushbuf() == EOF)
- return EOF;
- }
- }
-
- int bl = blen();
- setp( base(), base() + bl);
-
- if ( c != EOF ) {
-
- *pptr() = c;
- pbump(1);
-
- }
-
- return 0;
-
-}
-
-int gzfilebuf::sync() {
-
- if ( !is_open() )
- return EOF;
-
- if ( out_waiting() )
- return flushbuf();
-
- return 0;
-
-}
-
-int gzfilebuf::flushbuf() {
-
- int n;
- char *q;
-
- q = pbase();
- n = pptr() - q;
-
- if ( gzwrite( file, q, n) < n )
- return EOF;
-
- setp(0,0);
-
- return 0;
-
-}
-
-int gzfilebuf::fillbuf() {
-
- int required;
- char *p;
-
- p = base();
-
- required = blen();
-
- int t = gzread( file, p, required );
-
- if ( t <= 0) return EOF;
-
- setg( base(), base(), base()+t);
-
- return t;
-
-}
-
-gzfilestream_common::gzfilestream_common() :
- ios( gzfilestream_common::rdbuf() )
-{ }
-
-gzfilestream_common::~gzfilestream_common()
-{ }
-
-void gzfilestream_common::attach( int fd, int io_mode ) {
-
- if ( !buffer.attach( fd, io_mode) )
- clear( ios::failbit | ios::badbit );
- else
- clear();
-
-}
-
-void gzfilestream_common::open( const char *name, int io_mode ) {
-
- if ( !buffer.open( name, io_mode ) )
- clear( ios::failbit | ios::badbit );
- else
- clear();
-
-}
-
-void gzfilestream_common::close() {
-
- if ( !buffer.close() )
- clear( ios::failbit | ios::badbit );
-
-}
-
-gzfilebuf *gzfilestream_common::rdbuf()
-{
- return &buffer;
-}
-
-gzifstream::gzifstream() :
- ios( gzfilestream_common::rdbuf() )
-{
- clear( ios::badbit );
-}
-
-gzifstream::gzifstream( const char *name, int io_mode ) :
- ios( gzfilestream_common::rdbuf() )
-{
- gzfilestream_common::open( name, io_mode );
-}
-
-gzifstream::gzifstream( int fd, int io_mode ) :
- ios( gzfilestream_common::rdbuf() )
-{
- gzfilestream_common::attach( fd, io_mode );
-}
-
-gzifstream::~gzifstream() { }
-
-gzofstream::gzofstream() :
- ios( gzfilestream_common::rdbuf() )
-{
- clear( ios::badbit );
-}
-
-gzofstream::gzofstream( const char *name, int io_mode ) :
- ios( gzfilestream_common::rdbuf() )
-{
- gzfilestream_common::open( name, io_mode );
-}
-
-gzofstream::gzofstream( int fd, int io_mode ) :
- ios( gzfilestream_common::rdbuf() )
-{
- gzfilestream_common::attach( fd, io_mode );
-}
-
-gzofstream::~gzofstream() { }
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream/zfstream.h b/funtools/util/zlib-1.2.3/contrib/iostream/zfstream.h
deleted file mode 100644
index ed79098..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream/zfstream.h
+++ /dev/null
@@ -1,128 +0,0 @@
-
-#ifndef zfstream_h
-#define zfstream_h
-
-#include <fstream.h>
-#include "zlib.h"
-
-class gzfilebuf : public streambuf {
-
-public:
-
- gzfilebuf( );
- virtual ~gzfilebuf();
-
- gzfilebuf *open( const char *name, int io_mode );
- gzfilebuf *attach( int file_descriptor, int io_mode );
- gzfilebuf *close();
-
- int setcompressionlevel( int comp_level );
- int setcompressionstrategy( int comp_strategy );
-
- inline int is_open() const { return (file !=NULL); }
-
- virtual streampos seekoff( streamoff, ios::seek_dir, int );
-
- virtual int sync();
-
-protected:
-
- virtual int underflow();
- virtual int overflow( int = EOF );
-
-private:
-
- gzFile file;
- short mode;
- short own_file_descriptor;
-
- int flushbuf();
- int fillbuf();
-
-};
-
-class gzfilestream_common : virtual public ios {
-
- friend class gzifstream;
- friend class gzofstream;
- friend gzofstream &setcompressionlevel( gzofstream &, int );
- friend gzofstream &setcompressionstrategy( gzofstream &, int );
-
-public:
- virtual ~gzfilestream_common();
-
- void attach( int fd, int io_mode );
- void open( const char *name, int io_mode );
- void close();
-
-protected:
- gzfilestream_common();
-
-private:
- gzfilebuf *rdbuf();
-
- gzfilebuf buffer;
-
-};
-
-class gzifstream : public gzfilestream_common, public istream {
-
-public:
-
- gzifstream();
- gzifstream( const char *name, int io_mode = ios::in );
- gzifstream( int fd, int io_mode = ios::in );
-
- virtual ~gzifstream();
-
-};
-
-class gzofstream : public gzfilestream_common, public ostream {
-
-public:
-
- gzofstream();
- gzofstream( const char *name, int io_mode = ios::out );
- gzofstream( int fd, int io_mode = ios::out );
-
- virtual ~gzofstream();
-
-};
-
-template<class T> class gzomanip {
- friend gzofstream &operator<<(gzofstream &, const gzomanip<T> &);
-public:
- gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { }
-private:
- gzofstream &(*func)(gzofstream &, T);
- T val;
-};
-
-template<class T> gzofstream &operator<<(gzofstream &s, const gzomanip<T> &m)
-{
- return (*m.func)(s, m.val);
-}
-
-inline gzofstream &setcompressionlevel( gzofstream &s, int l )
-{
- (s.rdbuf())->setcompressionlevel(l);
- return s;
-}
-
-inline gzofstream &setcompressionstrategy( gzofstream &s, int l )
-{
- (s.rdbuf())->setcompressionstrategy(l);
- return s;
-}
-
-inline gzomanip<int> setcompressionlevel(int l)
-{
- return gzomanip<int>(&setcompressionlevel,l);
-}
-
-inline gzomanip<int> setcompressionstrategy(int l)
-{
- return gzomanip<int>(&setcompressionstrategy,l);
-}
-
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream2/zstream.h b/funtools/util/zlib-1.2.3/contrib/iostream2/zstream.h
deleted file mode 100644
index 43d2332..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream2/zstream.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- *
- * Copyright (c) 1997
- * Christian Michelsen Research AS
- * Advanced Computing
- * Fantoftvegen 38, 5036 BERGEN, Norway
- * http://www.cmr.no
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Christian Michelsen Research AS makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef ZSTREAM__H
-#define ZSTREAM__H
-
-/*
- * zstream.h - C++ interface to the 'zlib' general purpose compression library
- * $Id: zstream.h 1.1 1997-06-25 12:00:56+02 tyge Exp tyge $
- */
-
-#include <strstream.h>
-#include <string.h>
-#include <stdio.h>
-#include "zlib.h"
-
-#if defined(_WIN32)
-# include <fcntl.h>
-# include <io.h>
-# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
-#else
-# define SET_BINARY_MODE(file)
-#endif
-
-class zstringlen {
-public:
- zstringlen(class izstream&);
- zstringlen(class ozstream&, const char*);
- size_t value() const { return val.word; }
-private:
- struct Val { unsigned char byte; size_t word; } val;
-};
-
-// ----------------------------- izstream -----------------------------
-
-class izstream
-{
- public:
- izstream() : m_fp(0) {}
- izstream(FILE* fp) : m_fp(0) { open(fp); }
- izstream(const char* name) : m_fp(0) { open(name); }
- ~izstream() { close(); }
-
- /* Opens a gzip (.gz) file for reading.
- * open() can be used to read a file which is not in gzip format;
- * in this case read() will directly read from the file without
- * decompression. errno can be checked to distinguish two error
- * cases (if errno is zero, the zlib error is Z_MEM_ERROR).
- */
- void open(const char* name) {
- if (m_fp) close();
- m_fp = ::gzopen(name, "rb");
- }
-
- void open(FILE* fp) {
- SET_BINARY_MODE(fp);
- if (m_fp) close();
- m_fp = ::gzdopen(fileno(fp), "rb");
- }
-
- /* Flushes all pending input if necessary, closes the compressed file
- * and deallocates all the (de)compression state. The return value is
- * the zlib error number (see function error() below).
- */
- int close() {
- int r = ::gzclose(m_fp);
- m_fp = 0; return r;
- }
-
- /* Binary read the given number of bytes from the compressed file.
- */
- int read(void* buf, size_t len) {
- return ::gzread(m_fp, buf, len);
- }
-
- /* Returns the error message for the last error which occurred on the
- * given compressed file. errnum is set to zlib error number. If an
- * error occurred in the file system and not in the compression library,
- * errnum is set to Z_ERRNO and the application may consult errno
- * to get the exact error code.
- */
- const char* error(int* errnum) {
- return ::gzerror(m_fp, errnum);
- }
-
- gzFile fp() { return m_fp; }
-
- private:
- gzFile m_fp;
-};
-
-/*
- * Binary read the given (array of) object(s) from the compressed file.
- * If the input file was not in gzip format, read() copies the objects number
- * of bytes into the buffer.
- * returns the number of uncompressed bytes actually read
- * (0 for end of file, -1 for error).
- */
-template <class T, class Items>
-inline int read(izstream& zs, T* x, Items items) {
- return ::gzread(zs.fp(), x, items*sizeof(T));
-}
-
-/*
- * Binary input with the '>' operator.
- */
-template <class T>
-inline izstream& operator>(izstream& zs, T& x) {
- ::gzread(zs.fp(), &x, sizeof(T));
- return zs;
-}
-
-
-inline zstringlen::zstringlen(izstream& zs) {
- zs > val.byte;
- if (val.byte == 255) zs > val.word;
- else val.word = val.byte;
-}
-
-/*
- * Read length of string + the string with the '>' operator.
- */
-inline izstream& operator>(izstream& zs, char* x) {
- zstringlen len(zs);
- ::gzread(zs.fp(), x, len.value());
- x[len.value()] = '\0';
- return zs;
-}
-
-inline char* read_string(izstream& zs) {
- zstringlen len(zs);
- char* x = new char[len.value()+1];
- ::gzread(zs.fp(), x, len.value());
- x[len.value()] = '\0';
- return x;
-}
-
-// ----------------------------- ozstream -----------------------------
-
-class ozstream
-{
- public:
- ozstream() : m_fp(0), m_os(0) {
- }
- ozstream(FILE* fp, int level = Z_DEFAULT_COMPRESSION)
- : m_fp(0), m_os(0) {
- open(fp, level);
- }
- ozstream(const char* name, int level = Z_DEFAULT_COMPRESSION)
- : m_fp(0), m_os(0) {
- open(name, level);
- }
- ~ozstream() {
- close();
- }
-
- /* Opens a gzip (.gz) file for writing.
- * The compression level parameter should be in 0..9
- * errno can be checked to distinguish two error cases
- * (if errno is zero, the zlib error is Z_MEM_ERROR).
- */
- void open(const char* name, int level = Z_DEFAULT_COMPRESSION) {
- char mode[4] = "wb\0";
- if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level;
- if (m_fp) close();
- m_fp = ::gzopen(name, mode);
- }
-
- /* open from a FILE pointer.
- */
- void open(FILE* fp, int level = Z_DEFAULT_COMPRESSION) {
- SET_BINARY_MODE(fp);
- char mode[4] = "wb\0";
- if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level;
- if (m_fp) close();
- m_fp = ::gzdopen(fileno(fp), mode);
- }
-
- /* Flushes all pending output if necessary, closes the compressed file
- * and deallocates all the (de)compression state. The return value is
- * the zlib error number (see function error() below).
- */
- int close() {
- if (m_os) {
- ::gzwrite(m_fp, m_os->str(), m_os->pcount());
- delete[] m_os->str(); delete m_os; m_os = 0;
- }
- int r = ::gzclose(m_fp); m_fp = 0; return r;
- }
-
- /* Binary write the given number of bytes into the compressed file.
- */
- int write(const void* buf, size_t len) {
- return ::gzwrite(m_fp, (voidp) buf, len);
- }
-
- /* Flushes all pending output into the compressed file. The parameter
- * _flush is as in the deflate() function. The return value is the zlib
- * error number (see function gzerror below). flush() returns Z_OK if
- * the flush_ parameter is Z_FINISH and all output could be flushed.
- * flush() should be called only when strictly necessary because it can
- * degrade compression.
- */
- int flush(int _flush) {
- os_flush();
- return ::gzflush(m_fp, _flush);
- }
-
- /* Returns the error message for the last error which occurred on the
- * given compressed file. errnum is set to zlib error number. If an
- * error occurred in the file system and not in the compression library,
- * errnum is set to Z_ERRNO and the application may consult errno
- * to get the exact error code.
- */
- const char* error(int* errnum) {
- return ::gzerror(m_fp, errnum);
- }
-
- gzFile fp() { return m_fp; }
-
- ostream& os() {
- if (m_os == 0) m_os = new ostrstream;
- return *m_os;
- }
-
- void os_flush() {
- if (m_os && m_os->pcount()>0) {
- ostrstream* oss = new ostrstream;
- oss->fill(m_os->fill());
- oss->flags(m_os->flags());
- oss->precision(m_os->precision());
- oss->width(m_os->width());
- ::gzwrite(m_fp, m_os->str(), m_os->pcount());
- delete[] m_os->str(); delete m_os; m_os = oss;
- }
- }
-
- private:
- gzFile m_fp;
- ostrstream* m_os;
-};
-
-/*
- * Binary write the given (array of) object(s) into the compressed file.
- * returns the number of uncompressed bytes actually written
- * (0 in case of error).
- */
-template <class T, class Items>
-inline int write(ozstream& zs, const T* x, Items items) {
- return ::gzwrite(zs.fp(), (voidp) x, items*sizeof(T));
-}
-
-/*
- * Binary output with the '<' operator.
- */
-template <class T>
-inline ozstream& operator<(ozstream& zs, const T& x) {
- ::gzwrite(zs.fp(), (voidp) &x, sizeof(T));
- return zs;
-}
-
-inline zstringlen::zstringlen(ozstream& zs, const char* x) {
- val.byte = 255; val.word = ::strlen(x);
- if (val.word < 255) zs < (val.byte = val.word);
- else zs < val;
-}
-
-/*
- * Write length of string + the string with the '<' operator.
- */
-inline ozstream& operator<(ozstream& zs, const char* x) {
- zstringlen len(zs, x);
- ::gzwrite(zs.fp(), (voidp) x, len.value());
- return zs;
-}
-
-#ifdef _MSC_VER
-inline ozstream& operator<(ozstream& zs, char* const& x) {
- return zs < (const char*) x;
-}
-#endif
-
-/*
- * Ascii write with the << operator;
- */
-template <class T>
-inline ostream& operator<<(ozstream& zs, const T& x) {
- zs.os_flush();
- return zs.os() << x;
-}
-
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream2/zstream_test.cpp b/funtools/util/zlib-1.2.3/contrib/iostream2/zstream_test.cpp
deleted file mode 100644
index 6273f62..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream2/zstream_test.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "zstream.h"
-#include <math.h>
-#include <stdlib.h>
-#include <iomanip.h>
-
-void main() {
- char h[256] = "Hello";
- char* g = "Goodbye";
- ozstream out("temp.gz");
- out < "This works well" < h < g;
- out.close();
-
- izstream in("temp.gz"); // read it back
- char *x = read_string(in), *y = new char[256], z[256];
- in > y > z;
- in.close();
- cout << x << endl << y << endl << z << endl;
-
- out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results
- out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl;
- out << z << endl << y << endl << x << endl;
- out << 1.1234567890123456789 << endl;
-
- delete[] x; delete[] y;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream3/README b/funtools/util/zlib-1.2.3/contrib/iostream3/README
deleted file mode 100644
index f7b319a..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream3/README
+++ /dev/null
@@ -1,35 +0,0 @@
-These classes provide a C++ stream interface to the zlib library. It allows you
-to do things like:
-
- gzofstream outf("blah.gz");
- outf << "These go into the gzip file " << 123 << endl;
-
-It does this by deriving a specialized stream buffer for gzipped files, which is
-the way Stroustrup would have done it. :->
-
-The gzifstream and gzofstream classes were originally written by Kevin Ruland
-and made available in the zlib contrib/iostream directory. The older version still
-compiles under gcc 2.xx, but not under gcc 3.xx, which sparked the development of
-this version.
-
-The new classes are as standard-compliant as possible, closely following the
-approach of the standard library's fstream classes. It compiles under gcc versions
-3.2 and 3.3, but not under gcc 2.xx. This is mainly due to changes in the standard
-library naming scheme. The new version of gzifstream/gzofstream/gzfilebuf differs
-from the previous one in the following respects:
-- added showmanyc
-- added setbuf, with support for unbuffered output via setbuf(0,0)
-- a few bug fixes of stream behavior
-- gzipped output file opened with default compression level instead of maximum level
-- setcompressionlevel()/strategy() members replaced by single setcompression()
-
-The code is provided "as is", with the permission to use, copy, modify, distribute
-and sell it for any purpose without fee.
-
-Ludwig Schwardt
-<schwardt@sun.ac.za>
-
-DSP Lab
-Electrical & Electronic Engineering Department
-University of Stellenbosch
-South Africa
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream3/TODO b/funtools/util/zlib-1.2.3/contrib/iostream3/TODO
deleted file mode 100644
index 7032f97..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream3/TODO
+++ /dev/null
@@ -1,17 +0,0 @@
-Possible upgrades to gzfilebuf:
-
-- The ability to do putback (e.g. putbackfail)
-
-- The ability to seek (zlib supports this, but could be slow/tricky)
-
-- Simultaneous read/write access (does it make sense?)
-
-- Support for ios_base::ate open mode
-
-- Locale support?
-
-- Check public interface to see which calls give problems
- (due to dependence on library internals)
-
-- Override operator<<(ostream&, gzfilebuf*) to allow direct copying
- of stream buffer to stream ( i.e. os << is.rdbuf(); )
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream3/test.cc b/funtools/util/zlib-1.2.3/contrib/iostream3/test.cc
deleted file mode 100644
index 9423533..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream3/test.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Test program for gzifstream and gzofstream
- *
- * by Ludwig Schwardt <schwardt@sun.ac.za>
- * original version by Kevin Ruland <kevin@rodin.wustl.edu>
- */
-
-#include "zfstream.h"
-#include <iostream> // for cout
-
-int main() {
-
- gzofstream outf;
- gzifstream inf;
- char buf[80];
-
- outf.open("test1.txt.gz");
- outf << "The quick brown fox sidestepped the lazy canine\n"
- << 1.3 << "\nPlan " << 9 << std::endl;
- outf.close();
- std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n"
- << "The quick brown fox sidestepped the lazy canine\n"
- << 1.3 << "\nPlan " << 9 << std::endl;
-
- std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n";
- inf.open("test1.txt.gz");
- while (inf.getline(buf,80,'\n')) {
- std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n";
- }
- inf.close();
-
- outf.rdbuf()->pubsetbuf(0,0);
- outf.open("test2.txt.gz");
- outf << setcompression(Z_NO_COMPRESSION)
- << "The quick brown fox sidestepped the lazy canine\n"
- << 1.3 << "\nPlan " << 9 << std::endl;
- outf.close();
- std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form";
-
- std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n";
- inf.rdbuf()->pubsetbuf(0,0);
- inf.open("test2.txt.gz");
- while (inf.getline(buf,80,'\n')) {
- std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n";
- }
- inf.close();
-
- return 0;
-
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.cc b/funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.cc
deleted file mode 100644
index 94eb933..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.cc
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * A C++ I/O streams interface to the zlib gz* functions
- *
- * by Ludwig Schwardt <schwardt@sun.ac.za>
- * original version by Kevin Ruland <kevin@rodin.wustl.edu>
- *
- * This version is standard-compliant and compatible with gcc 3.x.
- */
-
-#include "zfstream.h"
-#include <cstring> // for strcpy, strcat, strlen (mode strings)
-#include <cstdio> // for BUFSIZ
-
-// Internal buffer sizes (default and "unbuffered" versions)
-#define BIGBUFSIZE BUFSIZ
-#define SMALLBUFSIZE 1
-
-/*****************************************************************************/
-
-// Default constructor
-gzfilebuf::gzfilebuf()
-: file(NULL), io_mode(std::ios_base::openmode(0)), own_fd(false),
- buffer(NULL), buffer_size(BIGBUFSIZE), own_buffer(true)
-{
- // No buffers to start with
- this->disable_buffer();
-}
-
-// Destructor
-gzfilebuf::~gzfilebuf()
-{
- // Sync output buffer and close only if responsible for file
- // (i.e. attached streams should be left open at this stage)
- this->sync();
- if (own_fd)
- this->close();
- // Make sure internal buffer is deallocated
- this->disable_buffer();
-}
-
-// Set compression level and strategy
-int
-gzfilebuf::setcompression(int comp_level,
- int comp_strategy)
-{
- return gzsetparams(file, comp_level, comp_strategy);
-}
-
-// Open gzipped file
-gzfilebuf*
-gzfilebuf::open(const char *name,
- std::ios_base::openmode mode)
-{
- // Fail if file already open
- if (this->is_open())
- return NULL;
- // Don't support simultaneous read/write access (yet)
- if ((mode & std::ios_base::in) && (mode & std::ios_base::out))
- return NULL;
-
- // Build mode string for gzopen and check it [27.8.1.3.2]
- char char_mode[6] = "\0\0\0\0\0";
- if (!this->open_mode(mode, char_mode))
- return NULL;
-
- // Attempt to open file
- if ((file = gzopen(name, char_mode)) == NULL)
- return NULL;
-
- // On success, allocate internal buffer and set flags
- this->enable_buffer();
- io_mode = mode;
- own_fd = true;
- return this;
-}
-
-// Attach to gzipped file
-gzfilebuf*
-gzfilebuf::attach(int fd,
- std::ios_base::openmode mode)
-{
- // Fail if file already open
- if (this->is_open())
- return NULL;
- // Don't support simultaneous read/write access (yet)
- if ((mode & std::ios_base::in) && (mode & std::ios_base::out))
- return NULL;
-
- // Build mode string for gzdopen and check it [27.8.1.3.2]
- char char_mode[6] = "\0\0\0\0\0";
- if (!this->open_mode(mode, char_mode))
- return NULL;
-
- // Attempt to attach to file
- if ((file = gzdopen(fd, char_mode)) == NULL)
- return NULL;
-
- // On success, allocate internal buffer and set flags
- this->enable_buffer();
- io_mode = mode;
- own_fd = false;
- return this;
-}
-
-// Close gzipped file
-gzfilebuf*
-gzfilebuf::close()
-{
- // Fail immediately if no file is open
- if (!this->is_open())
- return NULL;
- // Assume success
- gzfilebuf* retval = this;
- // Attempt to sync and close gzipped file
- if (this->sync() == -1)
- retval = NULL;
- if (gzclose(file) < 0)
- retval = NULL;
- // File is now gone anyway (postcondition [27.8.1.3.8])
- file = NULL;
- own_fd = false;
- // Destroy internal buffer if it exists
- this->disable_buffer();
- return retval;
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-// Convert int open mode to mode string
-bool
-gzfilebuf::open_mode(std::ios_base::openmode mode,
- char* c_mode) const
-{
- bool testb = mode & std::ios_base::binary;
- bool testi = mode & std::ios_base::in;
- bool testo = mode & std::ios_base::out;
- bool testt = mode & std::ios_base::trunc;
- bool testa = mode & std::ios_base::app;
-
- // Check for valid flag combinations - see [27.8.1.3.2] (Table 92)
- // Original zfstream hardcoded the compression level to maximum here...
- // Double the time for less than 1% size improvement seems
- // excessive though - keeping it at the default level
- // To change back, just append "9" to the next three mode strings
- if (!testi && testo && !testt && !testa)
- strcpy(c_mode, "w");
- if (!testi && testo && !testt && testa)
- strcpy(c_mode, "a");
- if (!testi && testo && testt && !testa)
- strcpy(c_mode, "w");
- if (testi && !testo && !testt && !testa)
- strcpy(c_mode, "r");
- // No read/write mode yet
-// if (testi && testo && !testt && !testa)
-// strcpy(c_mode, "r+");
-// if (testi && testo && testt && !testa)
-// strcpy(c_mode, "w+");
-
- // Mode string should be empty for invalid combination of flags
- if (strlen(c_mode) == 0)
- return false;
- if (testb)
- strcat(c_mode, "b");
- return true;
-}
-
-// Determine number of characters in internal get buffer
-std::streamsize
-gzfilebuf::showmanyc()
-{
- // Calls to underflow will fail if file not opened for reading
- if (!this->is_open() || !(io_mode & std::ios_base::in))
- return -1;
- // Make sure get area is in use
- if (this->gptr() && (this->gptr() < this->egptr()))
- return std::streamsize(this->egptr() - this->gptr());
- else
- return 0;
-}
-
-// Fill get area from gzipped file
-gzfilebuf::int_type
-gzfilebuf::underflow()
-{
- // If something is left in the get area by chance, return it
- // (this shouldn't normally happen, as underflow is only supposed
- // to be called when gptr >= egptr, but it serves as error check)
- if (this->gptr() && (this->gptr() < this->egptr()))
- return traits_type::to_int_type(*(this->gptr()));
-
- // If the file hasn't been opened for reading, produce error
- if (!this->is_open() || !(io_mode & std::ios_base::in))
- return traits_type::eof();
-
- // Attempt to fill internal buffer from gzipped file
- // (buffer must be guaranteed to exist...)
- int bytes_read = gzread(file, buffer, buffer_size);
- // Indicates error or EOF
- if (bytes_read <= 0)
- {
- // Reset get area
- this->setg(buffer, buffer, buffer);
- return traits_type::eof();
- }
- // Make all bytes read from file available as get area
- this->setg(buffer, buffer, buffer + bytes_read);
-
- // Return next character in get area
- return traits_type::to_int_type(*(this->gptr()));
-}
-
-// Write put area to gzipped file
-gzfilebuf::int_type
-gzfilebuf::overflow(int_type c)
-{
- // Determine whether put area is in use
- if (this->pbase())
- {
- // Double-check pointer range
- if (this->pptr() > this->epptr() || this->pptr() < this->pbase())
- return traits_type::eof();
- // Add extra character to buffer if not EOF
- if (!traits_type::eq_int_type(c, traits_type::eof()))
- {
- *(this->pptr()) = traits_type::to_char_type(c);
- this->pbump(1);
- }
- // Number of characters to write to file
- int bytes_to_write = this->pptr() - this->pbase();
- // Overflow doesn't fail if nothing is to be written
- if (bytes_to_write > 0)
- {
- // If the file hasn't been opened for writing, produce error
- if (!this->is_open() || !(io_mode & std::ios_base::out))
- return traits_type::eof();
- // If gzipped file won't accept all bytes written to it, fail
- if (gzwrite(file, this->pbase(), bytes_to_write) != bytes_to_write)
- return traits_type::eof();
- // Reset next pointer to point to pbase on success
- this->pbump(-bytes_to_write);
- }
- }
- // Write extra character to file if not EOF
- else if (!traits_type::eq_int_type(c, traits_type::eof()))
- {
- // If the file hasn't been opened for writing, produce error
- if (!this->is_open() || !(io_mode & std::ios_base::out))
- return traits_type::eof();
- // Impromptu char buffer (allows "unbuffered" output)
- char_type last_char = traits_type::to_char_type(c);
- // If gzipped file won't accept this character, fail
- if (gzwrite(file, &last_char, 1) != 1)
- return traits_type::eof();
- }
-
- // If you got here, you have succeeded (even if c was EOF)
- // The return value should therefore be non-EOF
- if (traits_type::eq_int_type(c, traits_type::eof()))
- return traits_type::not_eof(c);
- else
- return c;
-}
-
-// Assign new buffer
-std::streambuf*
-gzfilebuf::setbuf(char_type* p,
- std::streamsize n)
-{
- // First make sure stuff is sync'ed, for safety
- if (this->sync() == -1)
- return NULL;
- // If buffering is turned off on purpose via setbuf(0,0), still allocate one...
- // "Unbuffered" only really refers to put [27.8.1.4.10], while get needs at
- // least a buffer of size 1 (very inefficient though, therefore make it bigger?)
- // This follows from [27.5.2.4.3]/12 (gptr needs to point at something, it seems)
- if (!p || !n)
- {
- // Replace existing buffer (if any) with small internal buffer
- this->disable_buffer();
- buffer = NULL;
- buffer_size = 0;
- own_buffer = true;
- this->enable_buffer();
- }
- else
- {
- // Replace existing buffer (if any) with external buffer
- this->disable_buffer();
- buffer = p;
- buffer_size = n;
- own_buffer = false;
- this->enable_buffer();
- }
- return this;
-}
-
-// Write put area to gzipped file (i.e. ensures that put area is empty)
-int
-gzfilebuf::sync()
-{
- return traits_type::eq_int_type(this->overflow(), traits_type::eof()) ? -1 : 0;
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-// Allocate internal buffer
-void
-gzfilebuf::enable_buffer()
-{
- // If internal buffer required, allocate one
- if (own_buffer && !buffer)
- {
- // Check for buffered vs. "unbuffered"
- if (buffer_size > 0)
- {
- // Allocate internal buffer
- buffer = new char_type[buffer_size];
- // Get area starts empty and will be expanded by underflow as need arises
- this->setg(buffer, buffer, buffer);
- // Setup entire internal buffer as put area.
- // The one-past-end pointer actually points to the last element of the buffer,
- // so that overflow(c) can safely add the extra character c to the sequence.
- // These pointers remain in place for the duration of the buffer
- this->setp(buffer, buffer + buffer_size - 1);
- }
- else
- {
- // Even in "unbuffered" case, (small?) get buffer is still required
- buffer_size = SMALLBUFSIZE;
- buffer = new char_type[buffer_size];
- this->setg(buffer, buffer, buffer);
- // "Unbuffered" means no put buffer
- this->setp(0, 0);
- }
- }
- else
- {
- // If buffer already allocated, reset buffer pointers just to make sure no
- // stale chars are lying around
- this->setg(buffer, buffer, buffer);
- this->setp(buffer, buffer + buffer_size - 1);
- }
-}
-
-// Destroy internal buffer
-void
-gzfilebuf::disable_buffer()
-{
- // If internal buffer exists, deallocate it
- if (own_buffer && buffer)
- {
- // Preserve unbuffered status by zeroing size
- if (!this->pbase())
- buffer_size = 0;
- delete[] buffer;
- buffer = NULL;
- this->setg(0, 0, 0);
- this->setp(0, 0);
- }
- else
- {
- // Reset buffer pointers to initial state if external buffer exists
- this->setg(buffer, buffer, buffer);
- if (buffer)
- this->setp(buffer, buffer + buffer_size - 1);
- else
- this->setp(0, 0);
- }
-}
-
-/*****************************************************************************/
-
-// Default constructor initializes stream buffer
-gzifstream::gzifstream()
-: std::istream(NULL), sb()
-{ this->init(&sb); }
-
-// Initialize stream buffer and open file
-gzifstream::gzifstream(const char* name,
- std::ios_base::openmode mode)
-: std::istream(NULL), sb()
-{
- this->init(&sb);
- this->open(name, mode);
-}
-
-// Initialize stream buffer and attach to file
-gzifstream::gzifstream(int fd,
- std::ios_base::openmode mode)
-: std::istream(NULL), sb()
-{
- this->init(&sb);
- this->attach(fd, mode);
-}
-
-// Open file and go into fail() state if unsuccessful
-void
-gzifstream::open(const char* name,
- std::ios_base::openmode mode)
-{
- if (!sb.open(name, mode | std::ios_base::in))
- this->setstate(std::ios_base::failbit);
- else
- this->clear();
-}
-
-// Attach to file and go into fail() state if unsuccessful
-void
-gzifstream::attach(int fd,
- std::ios_base::openmode mode)
-{
- if (!sb.attach(fd, mode | std::ios_base::in))
- this->setstate(std::ios_base::failbit);
- else
- this->clear();
-}
-
-// Close file
-void
-gzifstream::close()
-{
- if (!sb.close())
- this->setstate(std::ios_base::failbit);
-}
-
-/*****************************************************************************/
-
-// Default constructor initializes stream buffer
-gzofstream::gzofstream()
-: std::ostream(NULL), sb()
-{ this->init(&sb); }
-
-// Initialize stream buffer and open file
-gzofstream::gzofstream(const char* name,
- std::ios_base::openmode mode)
-: std::ostream(NULL), sb()
-{
- this->init(&sb);
- this->open(name, mode);
-}
-
-// Initialize stream buffer and attach to file
-gzofstream::gzofstream(int fd,
- std::ios_base::openmode mode)
-: std::ostream(NULL), sb()
-{
- this->init(&sb);
- this->attach(fd, mode);
-}
-
-// Open file and go into fail() state if unsuccessful
-void
-gzofstream::open(const char* name,
- std::ios_base::openmode mode)
-{
- if (!sb.open(name, mode | std::ios_base::out))
- this->setstate(std::ios_base::failbit);
- else
- this->clear();
-}
-
-// Attach to file and go into fail() state if unsuccessful
-void
-gzofstream::attach(int fd,
- std::ios_base::openmode mode)
-{
- if (!sb.attach(fd, mode | std::ios_base::out))
- this->setstate(std::ios_base::failbit);
- else
- this->clear();
-}
-
-// Close file
-void
-gzofstream::close()
-{
- if (!sb.close())
- this->setstate(std::ios_base::failbit);
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.h b/funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.h
deleted file mode 100644
index 8574479..0000000
--- a/funtools/util/zlib-1.2.3/contrib/iostream3/zfstream.h
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * A C++ I/O streams interface to the zlib gz* functions
- *
- * by Ludwig Schwardt <schwardt@sun.ac.za>
- * original version by Kevin Ruland <kevin@rodin.wustl.edu>
- *
- * This version is standard-compliant and compatible with gcc 3.x.
- */
-
-#ifndef ZFSTREAM_H
-#define ZFSTREAM_H
-
-#include <istream> // not iostream, since we don't need cin/cout
-#include <ostream>
-#include "zlib.h"
-
-/*****************************************************************************/
-
-/**
- * @brief Gzipped file stream buffer class.
- *
- * This class implements basic_filebuf for gzipped files. It doesn't yet support
- * seeking (allowed by zlib but slow/limited), putback and read/write access
- * (tricky). Otherwise, it attempts to be a drop-in replacement for the standard
- * file streambuf.
-*/
-class gzfilebuf : public std::streambuf
-{
-public:
- // Default constructor.
- gzfilebuf();
-
- // Destructor.
- virtual
- ~gzfilebuf();
-
- /**
- * @brief Set compression level and strategy on the fly.
- * @param comp_level Compression level (see zlib.h for allowed values)
- * @param comp_strategy Compression strategy (see zlib.h for allowed values)
- * @return Z_OK on success, Z_STREAM_ERROR otherwise.
- *
- * Unfortunately, these parameters cannot be modified separately, as the
- * previous zfstream version assumed. Since the strategy is seldom changed,
- * it can default and setcompression(level) then becomes like the old
- * setcompressionlevel(level).
- */
- int
- setcompression(int comp_level,
- int comp_strategy = Z_DEFAULT_STRATEGY);
-
- /**
- * @brief Check if file is open.
- * @return True if file is open.
- */
- bool
- is_open() const { return (file != NULL); }
-
- /**
- * @brief Open gzipped file.
- * @param name File name.
- * @param mode Open mode flags.
- * @return @c this on success, NULL on failure.
- */
- gzfilebuf*
- open(const char* name,
- std::ios_base::openmode mode);
-
- /**
- * @brief Attach to already open gzipped file.
- * @param fd File descriptor.
- * @param mode Open mode flags.
- * @return @c this on success, NULL on failure.
- */
- gzfilebuf*
- attach(int fd,
- std::ios_base::openmode mode);
-
- /**
- * @brief Close gzipped file.
- * @return @c this on success, NULL on failure.
- */
- gzfilebuf*
- close();
-
-protected:
- /**
- * @brief Convert ios open mode int to mode string used by zlib.
- * @return True if valid mode flag combination.
- */
- bool
- open_mode(std::ios_base::openmode mode,
- char* c_mode) const;
-
- /**
- * @brief Number of characters available in stream buffer.
- * @return Number of characters.
- *
- * This indicates number of characters in get area of stream buffer.
- * These characters can be read without accessing the gzipped file.
- */
- virtual std::streamsize
- showmanyc();
-
- /**
- * @brief Fill get area from gzipped file.
- * @return First character in get area on success, EOF on error.
- *
- * This actually reads characters from gzipped file to stream
- * buffer. Always buffered.
- */
- virtual int_type
- underflow();
-
- /**
- * @brief Write put area to gzipped file.
- * @param c Extra character to add to buffer contents.
- * @return Non-EOF on success, EOF on error.
- *
- * This actually writes characters in stream buffer to
- * gzipped file. With unbuffered output this is done one
- * character at a time.
- */
- virtual int_type
- overflow(int_type c = traits_type::eof());
-
- /**
- * @brief Installs external stream buffer.
- * @param p Pointer to char buffer.
- * @param n Size of external buffer.
- * @return @c this on success, NULL on failure.
- *
- * Call setbuf(0,0) to enable unbuffered output.
- */
- virtual std::streambuf*
- setbuf(char_type* p,
- std::streamsize n);
-
- /**
- * @brief Flush stream buffer to file.
- * @return 0 on success, -1 on error.
- *
- * This calls underflow(EOF) to do the job.
- */
- virtual int
- sync();
-
-//
-// Some future enhancements
-//
-// virtual int_type uflow();
-// virtual int_type pbackfail(int_type c = traits_type::eof());
-// virtual pos_type
-// seekoff(off_type off,
-// std::ios_base::seekdir way,
-// std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);
-// virtual pos_type
-// seekpos(pos_type sp,
-// std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);
-
-private:
- /**
- * @brief Allocate internal buffer.
- *
- * This function is safe to call multiple times. It will ensure
- * that a proper internal buffer exists if it is required. If the
- * buffer already exists or is external, the buffer pointers will be
- * reset to their original state.
- */
- void
- enable_buffer();
-
- /**
- * @brief Destroy internal buffer.
- *
- * This function is safe to call multiple times. It will ensure
- * that the internal buffer is deallocated if it exists. In any
- * case, it will also reset the buffer pointers.
- */
- void
- disable_buffer();
-
- /**
- * Underlying file pointer.
- */
- gzFile file;
-
- /**
- * Mode in which file was opened.
- */
- std::ios_base::openmode io_mode;
-
- /**
- * @brief True if this object owns file descriptor.
- *
- * This makes the class responsible for closing the file
- * upon destruction.
- */
- bool own_fd;
-
- /**
- * @brief Stream buffer.
- *
- * For simplicity this remains allocated on the free store for the
- * entire life span of the gzfilebuf object, unless replaced by setbuf.
- */
- char_type* buffer;
-
- /**
- * @brief Stream buffer size.
- *
- * Defaults to system default buffer size (typically 8192 bytes).
- * Modified by setbuf.
- */
- std::streamsize buffer_size;
-
- /**
- * @brief True if this object owns stream buffer.
- *
- * This makes the class responsible for deleting the buffer
- * upon destruction.
- */
- bool own_buffer;
-};
-
-/*****************************************************************************/
-
-/**
- * @brief Gzipped file input stream class.
- *
- * This class implements ifstream for gzipped files. Seeking and putback
- * is not supported yet.
-*/
-class gzifstream : public std::istream
-{
-public:
- // Default constructor
- gzifstream();
-
- /**
- * @brief Construct stream on gzipped file to be opened.
- * @param name File name.
- * @param mode Open mode flags (forced to contain ios::in).
- */
- explicit
- gzifstream(const char* name,
- std::ios_base::openmode mode = std::ios_base::in);
-
- /**
- * @brief Construct stream on already open gzipped file.
- * @param fd File descriptor.
- * @param mode Open mode flags (forced to contain ios::in).
- */
- explicit
- gzifstream(int fd,
- std::ios_base::openmode mode = std::ios_base::in);
-
- /**
- * Obtain underlying stream buffer.
- */
- gzfilebuf*
- rdbuf() const
- { return const_cast<gzfilebuf*>(&sb); }
-
- /**
- * @brief Check if file is open.
- * @return True if file is open.
- */
- bool
- is_open() { return sb.is_open(); }
-
- /**
- * @brief Open gzipped file.
- * @param name File name.
- * @param mode Open mode flags (forced to contain ios::in).
- *
- * Stream will be in state good() if file opens successfully;
- * otherwise in state fail(). This differs from the behavior of
- * ifstream, which never sets the state to good() and therefore
- * won't allow you to reuse the stream for a second file unless
- * you manually clear() the state. The choice is a matter of
- * convenience.
- */
- void
- open(const char* name,
- std::ios_base::openmode mode = std::ios_base::in);
-
- /**
- * @brief Attach to already open gzipped file.
- * @param fd File descriptor.
- * @param mode Open mode flags (forced to contain ios::in).
- *
- * Stream will be in state good() if attach succeeded; otherwise
- * in state fail().
- */
- void
- attach(int fd,
- std::ios_base::openmode mode = std::ios_base::in);
-
- /**
- * @brief Close gzipped file.
- *
- * Stream will be in state fail() if close failed.
- */
- void
- close();
-
-private:
- /**
- * Underlying stream buffer.
- */
- gzfilebuf sb;
-};
-
-/*****************************************************************************/
-
-/**
- * @brief Gzipped file output stream class.
- *
- * This class implements ofstream for gzipped files. Seeking and putback
- * is not supported yet.
-*/
-class gzofstream : public std::ostream
-{
-public:
- // Default constructor
- gzofstream();
-
- /**
- * @brief Construct stream on gzipped file to be opened.
- * @param name File name.
- * @param mode Open mode flags (forced to contain ios::out).
- */
- explicit
- gzofstream(const char* name,
- std::ios_base::openmode mode = std::ios_base::out);
-
- /**
- * @brief Construct stream on already open gzipped file.
- * @param fd File descriptor.
- * @param mode Open mode flags (forced to contain ios::out).
- */
- explicit
- gzofstream(int fd,
- std::ios_base::openmode mode = std::ios_base::out);
-
- /**
- * Obtain underlying stream buffer.
- */
- gzfilebuf*
- rdbuf() const
- { return const_cast<gzfilebuf*>(&sb); }
-
- /**
- * @brief Check if file is open.
- * @return True if file is open.
- */
- bool
- is_open() { return sb.is_open(); }
-
- /**
- * @brief Open gzipped file.
- * @param name File name.
- * @param mode Open mode flags (forced to contain ios::out).
- *
- * Stream will be in state good() if file opens successfully;
- * otherwise in state fail(). This differs from the behavior of
- * ofstream, which never sets the state to good() and therefore
- * won't allow you to reuse the stream for a second file unless
- * you manually clear() the state. The choice is a matter of
- * convenience.
- */
- void
- open(const char* name,
- std::ios_base::openmode mode = std::ios_base::out);
-
- /**
- * @brief Attach to already open gzipped file.
- * @param fd File descriptor.
- * @param mode Open mode flags (forced to contain ios::out).
- *
- * Stream will be in state good() if attach succeeded; otherwise
- * in state fail().
- */
- void
- attach(int fd,
- std::ios_base::openmode mode = std::ios_base::out);
-
- /**
- * @brief Close gzipped file.
- *
- * Stream will be in state fail() if close failed.
- */
- void
- close();
-
-private:
- /**
- * Underlying stream buffer.
- */
- gzfilebuf sb;
-};
-
-/*****************************************************************************/
-
-/**
- * @brief Gzipped file output stream manipulator class.
- *
- * This class defines a two-argument manipulator for gzofstream. It is used
- * as base for the setcompression(int,int) manipulator.
-*/
-template<typename T1, typename T2>
- class gzomanip2
- {
- public:
- // Allows insertor to peek at internals
- template <typename Ta, typename Tb>
- friend gzofstream&
- operator<<(gzofstream&,
- const gzomanip2<Ta,Tb>&);
-
- // Constructor
- gzomanip2(gzofstream& (*f)(gzofstream&, T1, T2),
- T1 v1,
- T2 v2);
- private:
- // Underlying manipulator function
- gzofstream&
- (*func)(gzofstream&, T1, T2);
-
- // Arguments for manipulator function
- T1 val1;
- T2 val2;
- };
-
-/*****************************************************************************/
-
-// Manipulator function thunks through to stream buffer
-inline gzofstream&
-setcompression(gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY)
-{
- (gzs.rdbuf())->setcompression(l, s);
- return gzs;
-}
-
-// Manipulator constructor stores arguments
-template<typename T1, typename T2>
- inline
- gzomanip2<T1,T2>::gzomanip2(gzofstream &(*f)(gzofstream &, T1, T2),
- T1 v1,
- T2 v2)
- : func(f), val1(v1), val2(v2)
- { }
-
-// Insertor applies underlying manipulator function to stream
-template<typename T1, typename T2>
- inline gzofstream&
- operator<<(gzofstream& s, const gzomanip2<T1,T2>& m)
- { return (*m.func)(s, m.val1, m.val2); }
-
-// Insert this onto stream to simplify setting of compression level
-inline gzomanip2<int,int>
-setcompression(int l, int s = Z_DEFAULT_STRATEGY)
-{ return gzomanip2<int,int>(&setcompression, l, s); }
-
-#endif // ZFSTREAM_H
diff --git a/funtools/util/zlib-1.2.3/contrib/masm686/match.asm b/funtools/util/zlib-1.2.3/contrib/masm686/match.asm
deleted file mode 100644
index 4b03a71..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masm686/match.asm
+++ /dev/null
@@ -1,413 +0,0 @@
-
-; match.asm -- Pentium-Pro optimized version of longest_match()
-;
-; Updated for zlib 1.1.3 and converted to MASM 6.1x
-; Copyright (C) 2000 Dan Higdon <hdan@kinesoft.com>
-; and Chuck Walbourn <chuckw@kinesoft.com>
-; Corrections by Cosmin Truta <cosmint@cs.ubbcluj.ro>
-;
-; This is free software; you can redistribute it and/or modify it
-; under the terms of the GNU General Public License.
-
-; Based on match.S
-; Written for zlib 1.1.2
-; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
-;
-; Modified by Gilles Vollant (2005) for add gzhead and gzindex
-
- .686P
- .MODEL FLAT
-
-;===========================================================================
-; EQUATES
-;===========================================================================
-
-MAX_MATCH EQU 258
-MIN_MATCH EQU 3
-MIN_LOOKAHEAD EQU (MAX_MATCH + MIN_MATCH + 1)
-MAX_MATCH_8 EQU ((MAX_MATCH + 7) AND (NOT 7))
-
-;===========================================================================
-; STRUCTURES
-;===========================================================================
-
-; This STRUCT assumes a 4-byte alignment
-
-DEFLATE_STATE STRUCT
-ds_strm dd ?
-ds_status dd ?
-ds_pending_buf dd ?
-ds_pending_buf_size dd ?
-ds_pending_out dd ?
-ds_pending dd ?
-ds_wrap dd ?
-; gzhead and gzindex are added in zlib 1.2.2.2 (see deflate.h)
-ds_gzhead dd ?
-ds_gzindex dd ?
-ds_data_type db ?
-ds_method db ?
- db ? ; padding
- db ? ; padding
-ds_last_flush dd ?
-ds_w_size dd ? ; used
-ds_w_bits dd ?
-ds_w_mask dd ? ; used
-ds_window dd ? ; used
-ds_window_size dd ?
-ds_prev dd ? ; used
-ds_head dd ?
-ds_ins_h dd ?
-ds_hash_size dd ?
-ds_hash_bits dd ?
-ds_hash_mask dd ?
-ds_hash_shift dd ?
-ds_block_start dd ?
-ds_match_length dd ? ; used
-ds_prev_match dd ? ; used
-ds_match_available dd ?
-ds_strstart dd ? ; used
-ds_match_start dd ? ; used
-ds_lookahead dd ? ; used
-ds_prev_length dd ? ; used
-ds_max_chain_length dd ? ; used
-ds_max_laxy_match dd ?
-ds_level dd ?
-ds_strategy dd ?
-ds_good_match dd ? ; used
-ds_nice_match dd ? ; used
-
-; Don't need anymore of the struct for match
-DEFLATE_STATE ENDS
-
-;===========================================================================
-; CODE
-;===========================================================================
-_TEXT SEGMENT
-
-;---------------------------------------------------------------------------
-; match_init
-;---------------------------------------------------------------------------
- ALIGN 4
-PUBLIC _match_init
-_match_init PROC
- ; no initialization needed
- ret
-_match_init ENDP
-
-;---------------------------------------------------------------------------
-; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
-;---------------------------------------------------------------------------
- ALIGN 4
-
-PUBLIC _longest_match
-_longest_match PROC
-
-; Since this code uses EBP for a scratch register, the stack frame must
-; be manually constructed and referenced relative to the ESP register.
-
-; Stack image
-; Variables
-chainlenwmask = 0 ; high word: current chain len
- ; low word: s->wmask
-window = 4 ; local copy of s->window
-windowbestlen = 8 ; s->window + bestlen
-scanend = 12 ; last two bytes of string
-scanstart = 16 ; first two bytes of string
-scanalign = 20 ; dword-misalignment of string
-nicematch = 24 ; a good enough match size
-bestlen = 28 ; size of best match so far
-scan = 32 ; ptr to string wanting match
-varsize = 36 ; number of bytes (also offset to last saved register)
-
-; Saved Registers (actually pushed into place)
-ebx_save = 36
-edi_save = 40
-esi_save = 44
-ebp_save = 48
-
-; Parameters
-retaddr = 52
-deflatestate = 56
-curmatch = 60
-
-; Save registers that the compiler may be using
- push ebp
- push edi
- push esi
- push ebx
-
-; Allocate local variable space
- sub esp,varsize
-
-; Retrieve the function arguments. ecx will hold cur_match
-; throughout the entire function. edx will hold the pointer to the
-; deflate_state structure during the function's setup (before
-; entering the main loop).
-
- mov edx, [esp+deflatestate]
-ASSUME edx:PTR DEFLATE_STATE
-
- mov ecx, [esp+curmatch]
-
-; uInt wmask = s->w_mask;
-; unsigned chain_length = s->max_chain_length;
-; if (s->prev_length >= s->good_match) {
-; chain_length >>= 2;
-; }
-
- mov eax, [edx].ds_prev_length
- mov ebx, [edx].ds_good_match
- cmp eax, ebx
- mov eax, [edx].ds_w_mask
- mov ebx, [edx].ds_max_chain_length
- jl SHORT LastMatchGood
- shr ebx, 2
-LastMatchGood:
-
-; chainlen is decremented once beforehand so that the function can
-; use the sign flag instead of the zero flag for the exit test.
-; It is then shifted into the high word, to make room for the wmask
-; value, which it will always accompany.
-
- dec ebx
- shl ebx, 16
- or ebx, eax
- mov [esp+chainlenwmask], ebx
-
-; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- mov eax, [edx].ds_nice_match
- mov ebx, [edx].ds_lookahead
- cmp ebx, eax
- jl SHORT LookaheadLess
- mov ebx, eax
-LookaheadLess:
- mov [esp+nicematch], ebx
-
-;/* register Bytef *scan = s->window + s->strstart; */
-
- mov esi, [edx].ds_window
- mov [esp+window], esi
- mov ebp, [edx].ds_strstart
- lea edi, [esi+ebp]
- mov [esp+scan],edi
-
-;/* Determine how many bytes the scan ptr is off from being */
-;/* dword-aligned. */
-
- mov eax, edi
- neg eax
- and eax, 3
- mov [esp+scanalign], eax
-
-;/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
-;/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
-
- mov eax, [edx].ds_w_size
- sub eax, MIN_LOOKAHEAD
- sub ebp, eax
- jg SHORT LimitPositive
- xor ebp, ebp
-LimitPositive:
-
-;/* int best_len = s->prev_length; */
-
- mov eax, [edx].ds_prev_length
- mov [esp+bestlen], eax
-
-;/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
-
- add esi, eax
- mov [esp+windowbestlen], esi
-
-;/* register ush scan_start = *(ushf*)scan; */
-;/* register ush scan_end = *(ushf*)(scan+best_len-1); */
-;/* Posf *prev = s->prev; */
-
- movzx ebx, WORD PTR[edi]
- mov [esp+scanstart], ebx
- movzx ebx, WORD PTR[eax+edi-1]
- mov [esp+scanend], ebx
- mov edi, [edx].ds_prev
-
-;/* Jump into the main loop. */
-
- mov edx, [esp+chainlenwmask]
- jmp SHORT LoopEntry
-
-;/* do {
-; * match = s->window + cur_match;
-; * if (*(ushf*)(match+best_len-1) != scan_end ||
-; * *(ushf*)match != scan_start) continue;
-; * [...]
-; * } while ((cur_match = prev[cur_match & wmask]) > limit
-; * && --chain_length != 0);
-; *
-; * Here is the inner loop of the function. The function will spend the
-; * majority of its time in this loop, and majority of that time will
-; * be spent in the first ten instructions.
-; *
-; * Within this loop:
-; * %ebx = scanend
-; * %ecx = curmatch
-; * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
-; * %esi = windowbestlen - i.e., (window + bestlen)
-; * %edi = prev
-; * %ebp = limit
-; */
-
- ALIGN 4
-LookupLoop:
- and ecx, edx
- movzx ecx, WORD PTR[edi+ecx*2]
- cmp ecx, ebp
- jbe LeaveNow
- sub edx, 000010000H
- js LeaveNow
-
-LoopEntry:
- movzx eax, WORD PTR[esi+ecx-1]
- cmp eax, ebx
- jnz SHORT LookupLoop
-
- mov eax, [esp+window]
- movzx eax, WORD PTR[eax+ecx]
- cmp eax, [esp+scanstart]
- jnz SHORT LookupLoop
-
-;/* Store the current value of chainlen. */
-
- mov [esp+chainlenwmask], edx
-
-;/* Point %edi to the string under scrutiny, and %esi to the string we */
-;/* are hoping to match it up with. In actuality, %esi and %edi are */
-;/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
-;/* initialized to -(MAX_MATCH_8 - scanalign). */
-
- mov esi, [esp+window]
- mov edi, [esp+scan]
- add esi, ecx
- mov eax, [esp+scanalign]
- mov edx, -MAX_MATCH_8
- lea edi, [edi+eax+MAX_MATCH_8]
- lea esi, [esi+eax+MAX_MATCH_8]
-
-;/* Test the strings for equality, 8 bytes at a time. At the end,
-; * adjust %edx so that it is offset to the exact byte that mismatched.
-; *
-; * We already know at this point that the first three bytes of the
-; * strings match each other, and they can be safely passed over before
-; * starting the compare loop. So what this code does is skip over 0-3
-; * bytes, as much as necessary in order to dword-align the %edi
-; * pointer. (%esi will still be misaligned three times out of four.)
-; *
-; * It should be confessed that this loop usually does not represent
-; * much of the total running time. Replacing it with a more
-; * straightforward "rep cmpsb" would not drastically degrade
-; * performance.
-; */
-
-LoopCmps:
- mov eax, DWORD PTR[esi+edx]
- xor eax, DWORD PTR[edi+edx]
- jnz SHORT LeaveLoopCmps
-
- mov eax, DWORD PTR[esi+edx+4]
- xor eax, DWORD PTR[edi+edx+4]
- jnz SHORT LeaveLoopCmps4
-
- add edx, 8
- jnz SHORT LoopCmps
- jmp LenMaximum
- ALIGN 4
-
-LeaveLoopCmps4:
- add edx, 4
-
-LeaveLoopCmps:
- test eax, 00000FFFFH
- jnz SHORT LenLower
-
- add edx, 2
- shr eax, 16
-
-LenLower:
- sub al, 1
- adc edx, 0
-
-;/* Calculate the length of the match. If it is longer than MAX_MATCH, */
-;/* then automatically accept it as the best possible match and leave. */
-
- lea eax, [edi+edx]
- mov edi, [esp+scan]
- sub eax, edi
- cmp eax, MAX_MATCH
- jge SHORT LenMaximum
-
-;/* If the length of the match is not longer than the best match we */
-;/* have so far, then forget it and return to the lookup loop. */
-
- mov edx, [esp+deflatestate]
- mov ebx, [esp+bestlen]
- cmp eax, ebx
- jg SHORT LongerMatch
- mov esi, [esp+windowbestlen]
- mov edi, [edx].ds_prev
- mov ebx, [esp+scanend]
- mov edx, [esp+chainlenwmask]
- jmp LookupLoop
- ALIGN 4
-
-;/* s->match_start = cur_match; */
-;/* best_len = len; */
-;/* if (len >= nice_match) break; */
-;/* scan_end = *(ushf*)(scan+best_len-1); */
-
-LongerMatch:
- mov ebx, [esp+nicematch]
- mov [esp+bestlen], eax
- mov [edx].ds_match_start, ecx
- cmp eax, ebx
- jge SHORT LeaveNow
- mov esi, [esp+window]
- add esi, eax
- mov [esp+windowbestlen], esi
- movzx ebx, WORD PTR[edi+eax-1]
- mov edi, [edx].ds_prev
- mov [esp+scanend], ebx
- mov edx, [esp+chainlenwmask]
- jmp LookupLoop
- ALIGN 4
-
-;/* Accept the current string, with the maximum possible length. */
-
-LenMaximum:
- mov edx, [esp+deflatestate]
- mov DWORD PTR[esp+bestlen], MAX_MATCH
- mov [edx].ds_match_start, ecx
-
-;/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
-;/* return s->lookahead; */
-
-LeaveNow:
- mov edx, [esp+deflatestate]
- mov ebx, [esp+bestlen]
- mov eax, [edx].ds_lookahead
- cmp ebx, eax
- jg SHORT LookaheadRet
- mov eax, ebx
-LookaheadRet:
-
-; Restore the stack and return from whence we came.
-
- add esp, varsize
- pop ebx
- pop esi
- pop edi
- pop ebp
- ret
-
-_longest_match ENDP
-
-_TEXT ENDS
-END
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/bld_ml64.bat b/funtools/util/zlib-1.2.3/contrib/masmx64/bld_ml64.bat
deleted file mode 100755
index 8f9343d..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/bld_ml64.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
-ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.asm b/funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.asm
deleted file mode 100644
index 790d655..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.asm
+++ /dev/null
@@ -1,513 +0,0 @@
-;uInt longest_match_x64(
-; deflate_state *s,
-; IPos cur_match); /* current match */
-
-; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86
-; Copyright (C) 1995-2005 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
-;
-; File written by Gilles Vollant, by converting to assembly the longest_match
-; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
-;
-; and by taking inspiration on asm686 with masm, optimised assembly code
-; from Brian Raiter, written 1998
-;
-; http://www.zlib.net
-; http://www.winimage.com/zLibDll
-; http://www.muppetlabs.com/~breadbox/software/assembly.html
-;
-; to compile this file for infozip Zip, I use option:
-; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm
-;
-; to compile this file for zLib, I use option:
-; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
-; Be carrefull to adapt zlib1222add below to your version of zLib
-; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change
-; value of zlib1222add later)
-;
-; This file compile with Microsoft Macro Assembler (x64) for AMD64
-;
-; ml64.exe is given with Visual Studio 2005 and Windows 2003 server DDK
-;
-; (you can get Windows 2003 server DDK with ml64 and cl for AMD64 from
-; http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)
-;
-
-
-;uInt longest_match(s, cur_match)
-; deflate_state *s;
-; IPos cur_match; /* current match */
-.code
-longest_match PROC
-
-
-;LocalVarsSize equ 88
- LocalVarsSize equ 72
-
-; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12
-; free register : r14,r15
-; register can be saved : rsp
-
- chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len
- ; low word: s->wmask
-;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10
-;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11
-;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w
-;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx
-;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13
-;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d
-;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9
-IFDEF INFOZIP
-ELSE
- nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size
-ENDIF
-
-save_rdi equ rsp + 24 - LocalVarsSize
-save_rsi equ rsp + 32 - LocalVarsSize
-save_rbx equ rsp + 40 - LocalVarsSize
-save_rbp equ rsp + 48 - LocalVarsSize
-save_r12 equ rsp + 56 - LocalVarsSize
-save_r13 equ rsp + 64 - LocalVarsSize
-;save_r14 equ rsp + 72 - LocalVarsSize
-;save_r15 equ rsp + 80 - LocalVarsSize
-
-
-
-; all the +4 offsets are due to the addition of pending_buf_size (in zlib
-; in the deflate_state structure since the asm code was first written
-; (if you compile with zlib 1.0.4 or older, remove the +4).
-; Note : these value are good with a 8 bytes boundary pack structure
-
-
- MAX_MATCH equ 258
- MIN_MATCH equ 3
- MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
-
-
-;;; Offsets for fields in the deflate_state structure. These numbers
-;;; are calculated from the definition of deflate_state, with the
-;;; assumption that the compiler will dword-align the fields. (Thus,
-;;; changing the definition of deflate_state could easily cause this
-;;; program to crash horribly, without so much as a warning at
-;;; compile time. Sigh.)
-
-; all the +zlib1222add offsets are due to the addition of fields
-; in zlib in the deflate_state structure since the asm code was first written
-; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
-; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
-; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
-
-
-IFDEF INFOZIP
-
-_DATA SEGMENT
-COMM window_size:DWORD
-; WMask ; 7fff
-COMM window:BYTE:010040H
-COMM prev:WORD:08000H
-; MatchLen : unused
-; PrevMatch : unused
-COMM strstart:DWORD
-COMM match_start:DWORD
-; Lookahead : ignore
-COMM prev_length:DWORD ; PrevLen
-COMM max_chain_length:DWORD
-COMM good_match:DWORD
-COMM nice_match:DWORD
-prev_ad equ OFFSET prev
-window_ad equ OFFSET window
-nicematch equ nice_match
-_DATA ENDS
-WMask equ 07fffh
-
-ELSE
-
- IFNDEF zlib1222add
- zlib1222add equ 8
- ENDIF
-dsWSize equ 56+zlib1222add+(zlib1222add/2)
-dsWMask equ 64+zlib1222add+(zlib1222add/2)
-dsWindow equ 72+zlib1222add
-dsPrev equ 88+zlib1222add
-dsMatchLen equ 128+zlib1222add
-dsPrevMatch equ 132+zlib1222add
-dsStrStart equ 140+zlib1222add
-dsMatchStart equ 144+zlib1222add
-dsLookahead equ 148+zlib1222add
-dsPrevLen equ 152+zlib1222add
-dsMaxChainLen equ 156+zlib1222add
-dsGoodMatch equ 172+zlib1222add
-dsNiceMatch equ 176+zlib1222add
-
-window_size equ [ rcx + dsWSize]
-WMask equ [ rcx + dsWMask]
-window_ad equ [ rcx + dsWindow]
-prev_ad equ [ rcx + dsPrev]
-strstart equ [ rcx + dsStrStart]
-match_start equ [ rcx + dsMatchStart]
-Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip
-prev_length equ [ rcx + dsPrevLen]
-max_chain_length equ [ rcx + dsMaxChainLen]
-good_match equ [ rcx + dsGoodMatch]
-nice_match equ [ rcx + dsNiceMatch]
-ENDIF
-
-; parameter 1 in r8(deflate state s), param 2 in rdx (cur match)
-
-; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
-; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
-;
-; All registers must be preserved across the call, except for
-; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
-
-
-
-;;; Save registers that the compiler may be using, and adjust esp to
-;;; make room for our stack frame.
-
-
-;;; Retrieve the function arguments. r8d will hold cur_match
-;;; throughout the entire function. edx will hold the pointer to the
-;;; deflate_state structure during the function's setup (before
-;;; entering the main loop.
-
-; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match)
-
-; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
-
- mov [save_rdi],rdi
- mov [save_rsi],rsi
- mov [save_rbx],rbx
- mov [save_rbp],rbp
-IFDEF INFOZIP
- mov r8d,ecx
-ELSE
- mov r8d,edx
-ENDIF
- mov [save_r12],r12
- mov [save_r13],r13
-; mov [save_r14],r14
-; mov [save_r15],r15
-
-
-;;; uInt wmask = s->w_mask;
-;;; unsigned chain_length = s->max_chain_length;
-;;; if (s->prev_length >= s->good_match) {
-;;; chain_length >>= 2;
-;;; }
-
- mov edi, prev_length
- mov esi, good_match
- mov eax, WMask
- mov ebx, max_chain_length
- cmp edi, esi
- jl LastMatchGood
- shr ebx, 2
-LastMatchGood:
-
-;;; chainlen is decremented once beforehand so that the function can
-;;; use the sign flag instead of the zero flag for the exit test.
-;;; It is then shifted into the high word, to make room for the wmask
-;;; value, which it will always accompany.
-
- dec ebx
- shl ebx, 16
- or ebx, eax
-
-;;; on zlib only
-;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
-IFDEF INFOZIP
- mov [chainlenwmask], ebx
-; on infozip nice_match = [nice_match]
-ELSE
- mov eax, nice_match
- mov [chainlenwmask], ebx
- mov r10d, Lookahead
- cmp r10d, eax
- cmovnl r10d, eax
- mov [nicematch],r10d
-ENDIF
-
-;;; register Bytef *scan = s->window + s->strstart;
- mov r10, window_ad
- mov ebp, strstart
- lea r13, [r10 + rbp]
-
-;;; Determine how many bytes the scan ptr is off from being
-;;; dword-aligned.
-
- mov r9,r13
- neg r13
- and r13,3
-
-;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
-;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
-IFDEF INFOZIP
- mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1))
-ELSE
- mov eax, window_size
- sub eax, MIN_LOOKAHEAD
-ENDIF
- xor edi,edi
- sub ebp, eax
-
- mov r11d, prev_length
-
- cmovng ebp,edi
-
-;;; int best_len = s->prev_length;
-
-
-;;; Store the sum of s->window + best_len in esi locally, and in esi.
-
- lea rsi,[r10+r11]
-
-;;; register ush scan_start = *(ushf*)scan;
-;;; register ush scan_end = *(ushf*)(scan+best_len-1);
-;;; Posf *prev = s->prev;
-
- movzx r12d,word ptr [r9]
- movzx ebx, word ptr [r9 + r11 - 1]
-
- mov rdi, prev_ad
-
-;;; Jump into the main loop.
-
- mov edx, [chainlenwmask]
-
- cmp bx,word ptr [rsi + r8 - 1]
- jz LookupLoopIsZero
-
-LookupLoop1:
- and r8d, edx
-
- movzx r8d, word ptr [rdi + r8*2]
- cmp r8d, ebp
- jbe LeaveNow
- sub edx, 00010000h
- js LeaveNow
-
-LoopEntry1:
- cmp bx,word ptr [rsi + r8 - 1]
- jz LookupLoopIsZero
-
-LookupLoop2:
- and r8d, edx
-
- movzx r8d, word ptr [rdi + r8*2]
- cmp r8d, ebp
- jbe LeaveNow
- sub edx, 00010000h
- js LeaveNow
-
-LoopEntry2:
- cmp bx,word ptr [rsi + r8 - 1]
- jz LookupLoopIsZero
-
-LookupLoop4:
- and r8d, edx
-
- movzx r8d, word ptr [rdi + r8*2]
- cmp r8d, ebp
- jbe LeaveNow
- sub edx, 00010000h
- js LeaveNow
-
-LoopEntry4:
-
- cmp bx,word ptr [rsi + r8 - 1]
- jnz LookupLoop1
- jmp LookupLoopIsZero
-
-
-;;; do {
-;;; match = s->window + cur_match;
-;;; if (*(ushf*)(match+best_len-1) != scan_end ||
-;;; *(ushf*)match != scan_start) continue;
-;;; [...]
-;;; } while ((cur_match = prev[cur_match & wmask]) > limit
-;;; && --chain_length != 0);
-;;;
-;;; Here is the inner loop of the function. The function will spend the
-;;; majority of its time in this loop, and majority of that time will
-;;; be spent in the first ten instructions.
-;;;
-;;; Within this loop:
-;;; ebx = scanend
-;;; r8d = curmatch
-;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
-;;; esi = windowbestlen - i.e., (window + bestlen)
-;;; edi = prev
-;;; ebp = limit
-
-LookupLoop:
- and r8d, edx
-
- movzx r8d, word ptr [rdi + r8*2]
- cmp r8d, ebp
- jbe LeaveNow
- sub edx, 00010000h
- js LeaveNow
-
-LoopEntry:
-
- cmp bx,word ptr [rsi + r8 - 1]
- jnz LookupLoop1
-LookupLoopIsZero:
- cmp r12w, word ptr [r10 + r8]
- jnz LookupLoop1
-
-
-;;; Store the current value of chainlen.
- mov [chainlenwmask], edx
-
-;;; Point edi to the string under scrutiny, and esi to the string we
-;;; are hoping to match it up with. In actuality, esi and edi are
-;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
-;;; initialized to -(MAX_MATCH_8 - scanalign).
-
- lea rsi,[r8+r10]
- mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8)
- lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8]
- lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8]
-
- prefetcht1 [rsi+rdx]
- prefetcht1 [rdi+rdx]
-
-
-;;; Test the strings for equality, 8 bytes at a time. At the end,
-;;; adjust rdx so that it is offset to the exact byte that mismatched.
-;;;
-;;; We already know at this point that the first three bytes of the
-;;; strings match each other, and they can be safely passed over before
-;;; starting the compare loop. So what this code does is skip over 0-3
-;;; bytes, as much as necessary in order to dword-align the edi
-;;; pointer. (rsi will still be misaligned three times out of four.)
-;;;
-;;; It should be confessed that this loop usually does not represent
-;;; much of the total running time. Replacing it with a more
-;;; straightforward "rep cmpsb" would not drastically degrade
-;;; performance.
-
-
-LoopCmps:
- mov rax, [rsi + rdx]
- xor rax, [rdi + rdx]
- jnz LeaveLoopCmps
-
- mov rax, [rsi + rdx + 8]
- xor rax, [rdi + rdx + 8]
- jnz LeaveLoopCmps8
-
-
- mov rax, [rsi + rdx + 8+8]
- xor rax, [rdi + rdx + 8+8]
- jnz LeaveLoopCmps16
-
- add rdx,8+8+8
-
- jmp short LoopCmps
-LeaveLoopCmps16: add rdx,8
-LeaveLoopCmps8: add rdx,8
-LeaveLoopCmps:
-
- test eax, 0000FFFFh
- jnz LenLower
-
- test eax,0ffffffffh
-
- jnz LenLower32
-
- add rdx,4
- shr rax,32
- or ax,ax
- jnz LenLower
-
-LenLower32:
- shr eax,16
- add rdx,2
-LenLower: sub al, 1
- adc rdx, 0
-;;; Calculate the length of the match. If it is longer than MAX_MATCH,
-;;; then automatically accept it as the best possible match and leave.
-
- lea rax, [rdi + rdx]
- sub rax, r9
- cmp eax, MAX_MATCH
- jge LenMaximum
-
-;;; If the length of the match is not longer than the best match we
-;;; have so far, then forget it and return to the lookup loop.
-;///////////////////////////////////
-
- cmp eax, r11d
- jg LongerMatch
-
- lea rsi,[r10+r11]
-
- mov rdi, prev_ad
- mov edx, [chainlenwmask]
- jmp LookupLoop
-
-;;; s->match_start = cur_match;
-;;; best_len = len;
-;;; if (len >= nice_match) break;
-;;; scan_end = *(ushf*)(scan+best_len-1);
-
-LongerMatch:
- mov r11d, eax
- mov match_start, r8d
- cmp eax, [nicematch]
- jge LeaveNow
-
- lea rsi,[r10+rax]
-
- movzx ebx, word ptr [r9 + rax - 1]
- mov rdi, prev_ad
- mov edx, [chainlenwmask]
- jmp LookupLoop
-
-;;; Accept the current string, with the maximum possible length.
-
-LenMaximum:
- mov r11d,MAX_MATCH
- mov match_start, r8d
-
-;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
-;;; return s->lookahead;
-
-LeaveNow:
-IFDEF INFOZIP
- mov eax,r11d
-ELSE
- mov eax, Lookahead
- cmp r11d, eax
- cmovng eax, r11d
-ENDIF
-
-;;; Restore the stack and return from whence we came.
-
-
- mov rsi,[save_rsi]
- mov rdi,[save_rdi]
- mov rbx,[save_rbx]
- mov rbp,[save_rbp]
- mov r12,[save_r12]
- mov r13,[save_r13]
-; mov r14,[save_r14]
-; mov r15,[save_r15]
-
-
- ret 0
-; please don't remove this string !
-; Your can freely use gvmat64 in any free or commercial app
-; but it is far better don't remove the string in the binary!
- db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0
-longest_match ENDP
-
-match_init PROC
- ret 0
-match_init ENDP
-
-
-END
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.obj b/funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.obj
deleted file mode 100644
index a49ca02..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/gvmat64.obj
+++ /dev/null
Binary files differ
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/inffas8664.c b/funtools/util/zlib-1.2.3/contrib/masmx64/inffas8664.c
deleted file mode 100644
index 3af764d..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/inffas8664.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding
- * version for AMD64 on Windows using Microsoft C compiler
- *
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Copyright (C) 2003 Chris Anderson <christop@charm.net>
- * Please use the copyright conditions above.
- *
- * 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant
- *
- * inffas8664.c call function inffas8664fnc in inffasx64.asm
- * inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
- *
- * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
- * slightly quicker on x86 systems because, instead of using rep movsb to copy
- * data, it uses rep movsw, which moves data in 2-byte chunks instead of single
- * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
- * from http://fedora.linux.duke.edu/fc1_x86_64
- * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
- * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
- * when decompressing mozilla-source-1.3.tar.gz.
- *
- * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
- * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
- * the moment. I have successfully compiled and tested this code with gcc2.96,
- * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
- * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
- * enabled. I will attempt to merge the MMX code into this version. Newer
- * versions of this and inffast.S can be found at
- * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
- *
- */
-
-#include <stdio.h>
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-/* Mark Adler's comments from inffast.c: */
-
-/*
- Decode literal, length, and distance codes and write out the resulting
- literal and match bytes until either not enough input or output is
- available, an end-of-block is encountered, or a data error is encountered.
- When large enough input and output buffers are supplied to inflate(), for
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
-
- Entry assumptions:
-
- state->mode == LEN
- strm->avail_in >= 6
- strm->avail_out >= 258
- start >= strm->avail_out
- state->bits < 8
-
- On return, state->mode is one of:
-
- LEN -- ran out of enough output space or enough available input
- TYPE -- reached end of block code, inflate() to interpret next block
- BAD -- error in block data
-
- Notes:
-
- - The maximum input bits used by a length/distance pair is 15 bits for the
- length code, 5 bits for the length extra, 15 bits for the distance code,
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
- Therefore if strm->avail_in >= 6, then there is enough input to avoid
- checking for available input while decoding.
-
- - The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
- requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
- */
-
-
-
- typedef struct inffast_ar {
-/* 64 32 x86 x86_64 */
-/* ar offset register */
-/* 0 0 */ void *esp; /* esp save */
-/* 8 4 */ void *ebp; /* ebp save */
-/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
-/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
-/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
-/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
-/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
-/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
-/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
-/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
-/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */
-/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
-/* 92 48 */ unsigned wsize; /* window size */
-/* 96 52 */ unsigned write; /* window write index */
-/*100 56 */ unsigned lmask; /* r12 mask for lcode */
-/*104 60 */ unsigned dmask; /* r13 mask for dcode */
-/*108 64 */ unsigned len; /* r14 match length */
-/*112 68 */ unsigned dist; /* r15 match distance */
-/*116 72 */ unsigned status; /* set when state chng*/
- } type_ar;
-#ifdef ASMINF
-
-void inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
- struct inflate_state FAR *state;
- type_ar ar;
- void inffas8664fnc(struct inffast_ar * par);
-
-
-
-#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64))
-#define PAD_AVAIL_IN 6
-#define PAD_AVAIL_OUT 258
-#else
-#define PAD_AVAIL_IN 5
-#define PAD_AVAIL_OUT 257
-#endif
-
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
-
- ar.in = strm->next_in;
- ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
- ar.out = strm->next_out;
- ar.beg = ar.out - (start - strm->avail_out);
- ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
- ar.wsize = state->wsize;
- ar.write = state->write;
- ar.window = state->window;
- ar.hold = state->hold;
- ar.bits = state->bits;
- ar.lcode = state->lencode;
- ar.dcode = state->distcode;
- ar.lmask = (1U << state->lenbits) - 1;
- ar.dmask = (1U << state->distbits) - 1;
-
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
-
- /* align in on 1/2 hold size boundary */
- while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
- ar.hold += (unsigned long)*ar.in++ << ar.bits;
- ar.bits += 8;
- }
-
- inffas8664fnc(&ar);
-
- if (ar.status > 1) {
- if (ar.status == 2)
- strm->msg = "invalid literal/length code";
- else if (ar.status == 3)
- strm->msg = "invalid distance code";
- else
- strm->msg = "invalid distance too far back";
- state->mode = BAD;
- }
- else if ( ar.status == 1 ) {
- state->mode = TYPE;
- }
-
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- ar.len = ar.bits >> 3;
- ar.in -= ar.len;
- ar.bits -= ar.len << 3;
- ar.hold &= (1U << ar.bits) - 1;
-
- /* update state and return */
- strm->next_in = ar.in;
- strm->next_out = ar.out;
- strm->avail_in = (unsigned)(ar.in < ar.last ?
- PAD_AVAIL_IN + (ar.last - ar.in) :
- PAD_AVAIL_IN - (ar.in - ar.last));
- strm->avail_out = (unsigned)(ar.out < ar.end ?
- PAD_AVAIL_OUT + (ar.end - ar.out) :
- PAD_AVAIL_OUT - (ar.out - ar.end));
- state->hold = (unsigned long)ar.hold;
- state->bits = ar.bits;
- return;
-}
-
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.asm b/funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.asm
deleted file mode 100644
index b5d93a2..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.asm
+++ /dev/null
@@ -1,392 +0,0 @@
-; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding
-; version for AMD64 on Windows using Microsoft C compiler
-;
-; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
-; inffasx64.asm is called by inffas8664.c, which contain more info.
-
-
-; to compile this file, I use option
-; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
-; with Microsoft Macro Assembler (x64) for AMD64
-;
-; ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK
-;
-; (you can get Windows 2003 server DDK with ml64 and cl.exe for AMD64 from
-; http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)
-;
-
-.code
-inffas8664fnc PROC
-
-; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
-; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
-;
-; All registers must be preserved across the call, except for
-; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch.
-
-
- mov [rsp-8],rsi
- mov [rsp-16],rdi
- mov [rsp-24],r12
- mov [rsp-32],r13
- mov [rsp-40],r14
- mov [rsp-48],r15
- mov [rsp-56],rbx
-
- mov rax,rcx
-
- mov [rax+8], rbp ; /* save regs rbp and rsp */
- mov [rax], rsp
-
- mov rsp, rax ; /* make rsp point to &ar */
-
- mov rsi, [rsp+16] ; /* rsi = in */
- mov rdi, [rsp+32] ; /* rdi = out */
- mov r9, [rsp+24] ; /* r9 = last */
- mov r10, [rsp+48] ; /* r10 = end */
- mov rbp, [rsp+64] ; /* rbp = lcode */
- mov r11, [rsp+72] ; /* r11 = dcode */
- mov rdx, [rsp+80] ; /* rdx = hold */
- mov ebx, [rsp+88] ; /* ebx = bits */
- mov r12d, [rsp+100] ; /* r12d = lmask */
- mov r13d, [rsp+104] ; /* r13d = dmask */
- ; /* r14d = len */
- ; /* r15d = dist */
-
-
- cld
- cmp r10, rdi
- je L_one_time ; /* if only one decode left */
- cmp r9, rsi
-
- jne L_do_loop
-
-
-L_one_time:
- mov r8, r12 ; /* r8 = lmask */
- cmp bl, 32
- ja L_get_length_code_one_time
-
- lodsd ; /* eax = *(uint *)in++ */
- mov cl, bl ; /* cl = bits, needs it for shifting */
- add bl, 32 ; /* bits += 32 */
- shl rax, cl
- or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
- jmp L_get_length_code_one_time
-
-ALIGN 4
-L_while_test:
- cmp r10, rdi
- jbe L_break_loop
- cmp r9, rsi
- jbe L_break_loop
-
-L_do_loop:
- mov r8, r12 ; /* r8 = lmask */
- cmp bl, 32
- ja L_get_length_code ; /* if (32 < bits) */
-
- lodsd ; /* eax = *(uint *)in++ */
- mov cl, bl ; /* cl = bits, needs it for shifting */
- add bl, 32 ; /* bits += 32 */
- shl rax, cl
- or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
-
-L_get_length_code:
- and r8, rdx ; /* r8 &= hold */
- mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
-
- mov cl, ah ; /* cl = this.bits */
- sub bl, ah ; /* bits -= this.bits */
- shr rdx, cl ; /* hold >>= this.bits */
-
- test al, al
- jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
-
- mov r8, r12 ; /* r8 = lmask */
- shr eax, 16 ; /* output this.val char */
- stosb
-
-L_get_length_code_one_time:
- and r8, rdx ; /* r8 &= hold */
- mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
-
-L_dolen:
- mov cl, ah ; /* cl = this.bits */
- sub bl, ah ; /* bits -= this.bits */
- shr rdx, cl ; /* hold >>= this.bits */
-
- test al, al
- jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
-
- shr eax, 16 ; /* output this.val char */
- stosb
- jmp L_while_test
-
-ALIGN 4
-L_test_for_length_base:
- mov r14d, eax ; /* len = this */
- shr r14d, 16 ; /* len = this.val */
- mov cl, al
-
- test al, 16
- jz L_test_for_second_level_length ; /* if ((op & 16) == 0) 8% */
- and cl, 15 ; /* op &= 15 */
- jz L_decode_distance ; /* if (!op) */
-
-L_add_bits_to_len:
- sub bl, cl
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- and eax, edx ; /* eax &= hold */
- shr rdx, cl
- add r14d, eax ; /* len += hold & mask[op] */
-
-L_decode_distance:
- mov r8, r13 ; /* r8 = dmask */
- cmp bl, 32
- ja L_get_distance_code ; /* if (32 < bits) */
-
- lodsd ; /* eax = *(uint *)in++ */
- mov cl, bl ; /* cl = bits, needs it for shifting */
- add bl, 32 ; /* bits += 32 */
- shl rax, cl
- or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
-
-L_get_distance_code:
- and r8, rdx ; /* r8 &= hold */
- mov eax, [r11+r8*4] ; /* eax = dcode[hold & dmask] */
-
-L_dodist:
- mov r15d, eax ; /* dist = this */
- shr r15d, 16 ; /* dist = this.val */
- mov cl, ah
- sub bl, ah ; /* bits -= this.bits */
- shr rdx, cl ; /* hold >>= this.bits */
- mov cl, al ; /* cl = this.op */
-
- test al, 16 ; /* if ((op & 16) == 0) */
- jz L_test_for_second_level_dist
- and cl, 15 ; /* op &= 15 */
- jz L_check_dist_one
-
-L_add_bits_to_dist:
- sub bl, cl
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax ; /* (1 << op) - 1 */
- and eax, edx ; /* eax &= hold */
- shr rdx, cl
- add r15d, eax ; /* dist += hold & ((1 << op) - 1) */
-
-L_check_window:
- mov r8, rsi ; /* save in so from can use it's reg */
- mov rax, rdi
- sub rax, [rsp+40] ; /* nbytes = out - beg */
-
- cmp eax, r15d
- jb L_clip_window ; /* if (dist > nbytes) 4.2% */
-
- mov ecx, r14d ; /* ecx = len */
- mov rsi, rdi
- sub rsi, r15 ; /* from = out - dist */
-
- sar ecx, 1
- jnc L_copy_two ; /* if len % 2 == 0 */
-
- rep movsw
- mov al, [rsi]
- mov [rdi], al
- inc rdi
-
- mov rsi, r8 ; /* move in back to %rsi, toss from */
- jmp L_while_test
-
-L_copy_two:
- rep movsw
- mov rsi, r8 ; /* move in back to %rsi, toss from */
- jmp L_while_test
-
-ALIGN 4
-L_check_dist_one:
- cmp r15d, 1 ; /* if dist 1, is a memset */
- jne L_check_window
- cmp [rsp+40], rdi ; /* if out == beg, outside window */
- je L_check_window
-
- mov ecx, r14d ; /* ecx = len */
- mov al, [rdi-1]
- mov ah, al
-
- sar ecx, 1
- jnc L_set_two
- mov [rdi], al
- inc rdi
-
-L_set_two:
- rep stosw
- jmp L_while_test
-
-ALIGN 4
-L_test_for_second_level_length:
- test al, 64
- jnz L_test_for_end_of_block ; /* if ((op & 64) != 0) */
-
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- and eax, edx ; /* eax &= hold */
- add eax, r14d ; /* eax += len */
- mov eax, [rbp+rax*4] ; /* eax = lcode[val+(hold&mask[op])]*/
- jmp L_dolen
-
-ALIGN 4
-L_test_for_second_level_dist:
- test al, 64
- jnz L_invalid_distance_code ; /* if ((op & 64) != 0) */
-
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- and eax, edx ; /* eax &= hold */
- add eax, r15d ; /* eax += dist */
- mov eax, [r11+rax*4] ; /* eax = dcode[val+(hold&mask[op])]*/
- jmp L_dodist
-
-ALIGN 4
-L_clip_window:
- mov ecx, eax ; /* ecx = nbytes */
- mov eax, [rsp+92] ; /* eax = wsize, prepare for dist cmp */
- neg ecx ; /* nbytes = -nbytes */
-
- cmp eax, r15d
- jb L_invalid_distance_too_far ; /* if (dist > wsize) */
-
- add ecx, r15d ; /* nbytes = dist - nbytes */
- cmp dword ptr [rsp+96], 0
- jne L_wrap_around_window ; /* if (write != 0) */
-
- mov rsi, [rsp+56] ; /* from = window */
- sub eax, ecx ; /* eax -= nbytes */
- add rsi, rax ; /* from += wsize - nbytes */
-
- mov eax, r14d ; /* eax = len */
- cmp r14d, ecx
- jbe L_do_copy ; /* if (nbytes >= len) */
-
- sub eax, ecx ; /* eax -= nbytes */
- rep movsb
- mov rsi, rdi
- sub rsi, r15 ; /* from = &out[ -dist ] */
- jmp L_do_copy
-
-ALIGN 4
-L_wrap_around_window:
- mov eax, [rsp+96] ; /* eax = write */
- cmp ecx, eax
- jbe L_contiguous_in_window ; /* if (write >= nbytes) */
-
- mov esi, [rsp+92] ; /* from = wsize */
- add rsi, [rsp+56] ; /* from += window */
- add rsi, rax ; /* from += write */
- sub rsi, rcx ; /* from -= nbytes */
- sub ecx, eax ; /* nbytes -= write */
-
- mov eax, r14d ; /* eax = len */
- cmp eax, ecx
- jbe L_do_copy ; /* if (nbytes >= len) */
-
- sub eax, ecx ; /* len -= nbytes */
- rep movsb
- mov rsi, [rsp+56] ; /* from = window */
- mov ecx, [rsp+96] ; /* nbytes = write */
- cmp eax, ecx
- jbe L_do_copy ; /* if (nbytes >= len) */
-
- sub eax, ecx ; /* len -= nbytes */
- rep movsb
- mov rsi, rdi
- sub rsi, r15 ; /* from = out - dist */
- jmp L_do_copy
-
-ALIGN 4
-L_contiguous_in_window:
- mov rsi, [rsp+56] ; /* rsi = window */
- add rsi, rax
- sub rsi, rcx ; /* from += write - nbytes */
-
- mov eax, r14d ; /* eax = len */
- cmp eax, ecx
- jbe L_do_copy ; /* if (nbytes >= len) */
-
- sub eax, ecx ; /* len -= nbytes */
- rep movsb
- mov rsi, rdi
- sub rsi, r15 ; /* from = out - dist */
- jmp L_do_copy ; /* if (nbytes >= len) */
-
-ALIGN 4
-L_do_copy:
- mov ecx, eax ; /* ecx = len */
- rep movsb
-
- mov rsi, r8 ; /* move in back to %esi, toss from */
- jmp L_while_test
-
-L_test_for_end_of_block:
- test al, 32
- jz L_invalid_literal_length_code
- mov dword ptr [rsp+116], 1
- jmp L_break_loop_with_status
-
-L_invalid_literal_length_code:
- mov dword ptr [rsp+116], 2
- jmp L_break_loop_with_status
-
-L_invalid_distance_code:
- mov dword ptr [rsp+116], 3
- jmp L_break_loop_with_status
-
-L_invalid_distance_too_far:
- mov dword ptr [rsp+116], 4
- jmp L_break_loop_with_status
-
-L_break_loop:
- mov dword ptr [rsp+116], 0
-
-L_break_loop_with_status:
-; /* put in, out, bits, and hold back into ar and pop esp */
- mov [rsp+16], rsi ; /* in */
- mov [rsp+32], rdi ; /* out */
- mov [rsp+88], ebx ; /* bits */
- mov [rsp+80], rdx ; /* hold */
-
- mov rax, [rsp] ; /* restore rbp and rsp */
- mov rbp, [rsp+8]
- mov rsp, rax
-
-
-
- mov rsi,[rsp-8]
- mov rdi,[rsp-16]
- mov r12,[rsp-24]
- mov r13,[rsp-32]
- mov r14,[rsp-40]
- mov r15,[rsp-48]
- mov rbx,[rsp-56]
-
- ret 0
-; :
-; : "m" (ar)
-; : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
-; "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
-; );
-
-inffas8664fnc ENDP
-;_TEXT ENDS
-END
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.obj b/funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.obj
deleted file mode 100644
index 8df5d82..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/inffasx64.obj
+++ /dev/null
Binary files differ
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx64/readme.txt b/funtools/util/zlib-1.2.3/contrib/masmx64/readme.txt
deleted file mode 100644
index ee03115..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx64/readme.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-Summary
--------
-This directory contains ASM implementations of the functions
-longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t),
-for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits.
-
-gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits
- assembly optimized version from Jean-loup Gailly original longest_match function
-
-inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing
- original function from Mark Adler
-
-Use instructions
-----------------
-Copy these files into the zlib source directory.
-
-define ASMV and ASMINF in your project. Include inffas8664.c in your source tree,
-and inffasx64.obj and gvmat64.obj as object to link.
-
-
-Build instructions
-------------------
-run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe)
-
-ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK
-
-You can get Windows 2003 server DDK with ml64 and cl for AMD64 from
- http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx86/bld_ml32.bat b/funtools/util/zlib-1.2.3/contrib/masmx86/bld_ml32.bat
deleted file mode 100755
index 99144d0..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx86/bld_ml32.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm
-ml /coff /Zi /c /Flinffas32.lst inffas32.asm
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32.asm b/funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32.asm
deleted file mode 100644
index 874bb2d..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32.asm
+++ /dev/null
@@ -1,972 +0,0 @@
-; gvmat32.asm -- Asm portion of the optimized longest_match for 32 bits x86
-; Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
-; File written by Gilles Vollant, by modifiying the longest_match
-; from Jean-loup Gailly in deflate.c
-;
-; http://www.zlib.net
-; http://www.winimage.com/zLibDll
-; http://www.muppetlabs.com/~breadbox/software/assembly.html
-;
-; For Visual C++ 4.x and higher and ML 6.x and higher
-; ml.exe is in directory \MASM611C of Win95 DDK
-; ml.exe is also distributed in http://www.masm32.com/masmdl.htm
-; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/
-;
-; this file contain two implementation of longest_match
-;
-; longest_match_7fff : written 1996 by Gilles Vollant optimized for
-; first Pentium. Assume s->w_mask == 0x7fff
-; longest_match_686 : written by Brian raiter (1998), optimized for Pentium Pro
-;
-; for using an seembly version of longest_match, you need define ASMV in project
-; There is two way in using gvmat32.asm
-;
-; A) Suggested method
-; if you want include both longest_match_7fff and longest_match_686
-; compile the asm file running
-; ml /coff /Zi /Flgvmat32.lst /c gvmat32.asm
-; and include gvmat32c.c in your project
-; if you have an old cpu (386,486 or first Pentium) and s->w_mask==0x7fff,
-; longest_match_7fff will be used
-; if you have a more modern CPU (Pentium Pro, II and higher)
-; longest_match_686 will be used
-; on old cpu with s->w_mask!=0x7fff, longest_match_686 will be used,
-; but this is not a sitation you'll find often
-;
-; B) Alternative
-; if you are not interresed in old cpu performance and want the smaller
-; binaries possible
-;
-; compile the asm file running
-; ml /coff /Zi /c /Flgvmat32.lst /DNOOLDPENTIUMCODE gvmat32.asm
-; and do not include gvmat32c.c in your project (ou define also
-; NOOLDPENTIUMCODE)
-;
-; note : as I known, longest_match_686 is very faster than longest_match_7fff
-; on pentium Pro/II/III, faster (but less) in P4, but it seem
-; longest_match_7fff can be faster (very very litte) on AMD Athlon64/K8
-;
-; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2
-
-;uInt longest_match_7fff(s, cur_match)
-; deflate_state *s;
-; IPos cur_match; /* current match */
-
- NbStack equ 76
- cur_match equ dword ptr[esp+NbStack-0]
- str_s equ dword ptr[esp+NbStack-4]
-; 5 dword on top (ret,ebp,esi,edi,ebx)
- adrret equ dword ptr[esp+NbStack-8]
- pushebp equ dword ptr[esp+NbStack-12]
- pushedi equ dword ptr[esp+NbStack-16]
- pushesi equ dword ptr[esp+NbStack-20]
- pushebx equ dword ptr[esp+NbStack-24]
-
- chain_length equ dword ptr [esp+NbStack-28]
- limit equ dword ptr [esp+NbStack-32]
- best_len equ dword ptr [esp+NbStack-36]
- window equ dword ptr [esp+NbStack-40]
- prev equ dword ptr [esp+NbStack-44]
- scan_start equ word ptr [esp+NbStack-48]
- wmask equ dword ptr [esp+NbStack-52]
- match_start_ptr equ dword ptr [esp+NbStack-56]
- nice_match equ dword ptr [esp+NbStack-60]
- scan equ dword ptr [esp+NbStack-64]
-
- windowlen equ dword ptr [esp+NbStack-68]
- match_start equ dword ptr [esp+NbStack-72]
- strend equ dword ptr [esp+NbStack-76]
- NbStackAdd equ (NbStack-24)
-
- .386p
-
- name gvmatch
- .MODEL FLAT
-
-
-
-; all the +zlib1222add offsets are due to the addition of fields
-; in zlib in the deflate_state structure since the asm code was first written
-; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
-; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
-; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
-
- zlib1222add equ 8
-
-; Note : these value are good with a 8 bytes boundary pack structure
- dep_chain_length equ 74h+zlib1222add
- dep_window equ 30h+zlib1222add
- dep_strstart equ 64h+zlib1222add
- dep_prev_length equ 70h+zlib1222add
- dep_nice_match equ 88h+zlib1222add
- dep_w_size equ 24h+zlib1222add
- dep_prev equ 38h+zlib1222add
- dep_w_mask equ 2ch+zlib1222add
- dep_good_match equ 84h+zlib1222add
- dep_match_start equ 68h+zlib1222add
- dep_lookahead equ 6ch+zlib1222add
-
-
-_TEXT segment
-
-IFDEF NOUNDERLINE
- IFDEF NOOLDPENTIUMCODE
- public longest_match
- public match_init
- ELSE
- public longest_match_7fff
- public cpudetect32
- public longest_match_686
- ENDIF
-ELSE
- IFDEF NOOLDPENTIUMCODE
- public _longest_match
- public _match_init
- ELSE
- public _longest_match_7fff
- public _cpudetect32
- public _longest_match_686
- ENDIF
-ENDIF
-
- MAX_MATCH equ 258
- MIN_MATCH equ 3
- MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
-
-
-
-IFNDEF NOOLDPENTIUMCODE
-IFDEF NOUNDERLINE
-longest_match_7fff proc near
-ELSE
-_longest_match_7fff proc near
-ENDIF
-
- mov edx,[esp+4]
-
-
-
- push ebp
- push edi
- push esi
- push ebx
-
- sub esp,NbStackAdd
-
-; initialize or check the variables used in match.asm.
- mov ebp,edx
-
-; chain_length = s->max_chain_length
-; if (prev_length>=good_match) chain_length >>= 2
- mov edx,[ebp+dep_chain_length]
- mov ebx,[ebp+dep_prev_length]
- cmp [ebp+dep_good_match],ebx
- ja noshr
- shr edx,2
-noshr:
-; we increment chain_length because in the asm, the --chain_lenght is in the beginning of the loop
- inc edx
- mov edi,[ebp+dep_nice_match]
- mov chain_length,edx
- mov eax,[ebp+dep_lookahead]
- cmp eax,edi
-; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
- jae nolookaheadnicematch
- mov edi,eax
-nolookaheadnicematch:
-; best_len = s->prev_length
- mov best_len,ebx
-
-; window = s->window
- mov esi,[ebp+dep_window]
- mov ecx,[ebp+dep_strstart]
- mov window,esi
-
- mov nice_match,edi
-; scan = window + strstart
- add esi,ecx
- mov scan,esi
-; dx = *window
- mov dx,word ptr [esi]
-; bx = *(window+best_len-1)
- mov bx,word ptr [esi+ebx-1]
- add esi,MAX_MATCH-1
-; scan_start = *scan
- mov scan_start,dx
-; strend = scan + MAX_MATCH-1
- mov strend,esi
-; bx = scan_end = *(window+best_len-1)
-
-; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
-; s->strstart - (IPos)MAX_DIST(s) : NIL;
-
- mov esi,[ebp+dep_w_size]
- sub esi,MIN_LOOKAHEAD
-; here esi = MAX_DIST(s)
- sub ecx,esi
- ja nodist
- xor ecx,ecx
-nodist:
- mov limit,ecx
-
-; prev = s->prev
- mov edx,[ebp+dep_prev]
- mov prev,edx
-
-;
- mov edx,dword ptr [ebp+dep_match_start]
- mov bp,scan_start
- mov eax,cur_match
- mov match_start,edx
-
- mov edx,window
- mov edi,edx
- add edi,best_len
- mov esi,prev
- dec edi
-; windowlen = window + best_len -1
- mov windowlen,edi
-
- jmp beginloop2
- align 4
-
-; here, in the loop
-; eax = ax = cur_match
-; ecx = limit
-; bx = scan_end
-; bp = scan_start
-; edi = windowlen (window + best_len -1)
-; esi = prev
-
-
-;// here; chain_length <=16
-normalbeg0add16:
- add chain_length,16
- jz exitloop
-normalbeg0:
- cmp word ptr[edi+eax],bx
- je normalbeg2noroll
-rcontlabnoroll:
-; cur_match = prev[cur_match & wmask]
- and eax,7fffh
- mov ax,word ptr[esi+eax*2]
-; if cur_match > limit, go to exitloop
- cmp ecx,eax
- jnb exitloop
-; if --chain_length != 0, go to exitloop
- dec chain_length
- jnz normalbeg0
- jmp exitloop
-
-normalbeg2noroll:
-; if (scan_start==*(cur_match+window)) goto normalbeg2
- cmp bp,word ptr[edx+eax]
- jne rcontlabnoroll
- jmp normalbeg2
-
-contloop3:
- mov edi,windowlen
-
-; cur_match = prev[cur_match & wmask]
- and eax,7fffh
- mov ax,word ptr[esi+eax*2]
-; if cur_match > limit, go to exitloop
- cmp ecx,eax
-jnbexitloopshort1:
- jnb exitloop
-; if --chain_length != 0, go to exitloop
-
-
-; begin the main loop
-beginloop2:
- sub chain_length,16+1
-; if chain_length <=16, don't use the unrolled loop
- jna normalbeg0add16
-
-do16:
- cmp word ptr[edi+eax],bx
- je normalbeg2dc0
-
-maccn MACRO lab
- and eax,7fffh
- mov ax,word ptr[esi+eax*2]
- cmp ecx,eax
- jnb exitloop
- cmp word ptr[edi+eax],bx
- je lab
- ENDM
-
-rcontloop0:
- maccn normalbeg2dc1
-
-rcontloop1:
- maccn normalbeg2dc2
-
-rcontloop2:
- maccn normalbeg2dc3
-
-rcontloop3:
- maccn normalbeg2dc4
-
-rcontloop4:
- maccn normalbeg2dc5
-
-rcontloop5:
- maccn normalbeg2dc6
-
-rcontloop6:
- maccn normalbeg2dc7
-
-rcontloop7:
- maccn normalbeg2dc8
-
-rcontloop8:
- maccn normalbeg2dc9
-
-rcontloop9:
- maccn normalbeg2dc10
-
-rcontloop10:
- maccn short normalbeg2dc11
-
-rcontloop11:
- maccn short normalbeg2dc12
-
-rcontloop12:
- maccn short normalbeg2dc13
-
-rcontloop13:
- maccn short normalbeg2dc14
-
-rcontloop14:
- maccn short normalbeg2dc15
-
-rcontloop15:
- and eax,7fffh
- mov ax,word ptr[esi+eax*2]
- cmp ecx,eax
- jnb exitloop
-
- sub chain_length,16
- ja do16
- jmp normalbeg0add16
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-normbeg MACRO rcontlab,valsub
-; if we are here, we know that *(match+best_len-1) == scan_end
- cmp bp,word ptr[edx+eax]
-; if (match != scan_start) goto rcontlab
- jne rcontlab
-; calculate the good chain_length, and we'll compare scan and match string
- add chain_length,16-valsub
- jmp iseq
- ENDM
-
-
-normalbeg2dc11:
- normbeg rcontloop11,11
-
-normalbeg2dc12:
- normbeg short rcontloop12,12
-
-normalbeg2dc13:
- normbeg short rcontloop13,13
-
-normalbeg2dc14:
- normbeg short rcontloop14,14
-
-normalbeg2dc15:
- normbeg short rcontloop15,15
-
-normalbeg2dc10:
- normbeg rcontloop10,10
-
-normalbeg2dc9:
- normbeg rcontloop9,9
-
-normalbeg2dc8:
- normbeg rcontloop8,8
-
-normalbeg2dc7:
- normbeg rcontloop7,7
-
-normalbeg2dc6:
- normbeg rcontloop6,6
-
-normalbeg2dc5:
- normbeg rcontloop5,5
-
-normalbeg2dc4:
- normbeg rcontloop4,4
-
-normalbeg2dc3:
- normbeg rcontloop3,3
-
-normalbeg2dc2:
- normbeg rcontloop2,2
-
-normalbeg2dc1:
- normbeg rcontloop1,1
-
-normalbeg2dc0:
- normbeg rcontloop0,0
-
-
-; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end
-
-normalbeg2:
- mov edi,window
-
- cmp bp,word ptr[edi+eax]
- jne contloop3 ; if *(ushf*)match != scan_start, continue
-
-iseq:
-; if we are here, we know that *(match+best_len-1) == scan_end
-; and (match == scan_start)
-
- mov edi,edx
- mov esi,scan ; esi = scan
- add edi,eax ; edi = window + cur_match = match
-
- mov edx,[esi+3] ; compare manually dword at match+3
- xor edx,[edi+3] ; and scan +3
-
- jz begincompare ; if equal, go to long compare
-
-; we will determine the unmatch byte and calculate len (in esi)
- or dl,dl
- je eq1rr
- mov esi,3
- jmp trfinval
-eq1rr:
- or dx,dx
- je eq1
-
- mov esi,4
- jmp trfinval
-eq1:
- and edx,0ffffffh
- jz eq11
- mov esi,5
- jmp trfinval
-eq11:
- mov esi,6
- jmp trfinval
-
-begincompare:
- ; here we now scan and match begin same
- add edi,6
- add esi,6
- mov ecx,(MAX_MATCH-(2+4))/4 ; scan for at most MAX_MATCH bytes
- repe cmpsd ; loop until mismatch
-
- je trfin ; go to trfin if not unmatch
-; we determine the unmatch byte
- sub esi,4
- mov edx,[edi-4]
- xor edx,[esi]
-
- or dl,dl
- jnz trfin
- inc esi
-
- or dx,dx
- jnz trfin
- inc esi
-
- and edx,0ffffffh
- jnz trfin
- inc esi
-
-trfin:
- sub esi,scan ; esi = len
-trfinval:
-; here we have finised compare, and esi contain len of equal string
- cmp esi,best_len ; if len > best_len, go newbestlen
- ja short newbestlen
-; now we restore edx, ecx and esi, for the big loop
- mov esi,prev
- mov ecx,limit
- mov edx,window
- jmp contloop3
-
-newbestlen:
- mov best_len,esi ; len become best_len
-
- mov match_start,eax ; save new position as match_start
- cmp esi,nice_match ; if best_len >= nice_match, exit
- jae exitloop
- mov ecx,scan
- mov edx,window ; restore edx=window
- add ecx,esi
- add esi,edx
-
- dec esi
- mov windowlen,esi ; windowlen = window + best_len-1
- mov bx,[ecx-1] ; bx = *(scan+best_len-1) = scan_end
-
-; now we restore ecx and esi, for the big loop :
- mov esi,prev
- mov ecx,limit
- jmp contloop3
-
-exitloop:
-; exit : s->match_start=match_start
- mov ebx,match_start
- mov ebp,str_s
- mov ecx,best_len
- mov dword ptr [ebp+dep_match_start],ebx
- mov eax,dword ptr [ebp+dep_lookahead]
- cmp ecx,eax
- ja minexlo
- mov eax,ecx
-minexlo:
-; return min(best_len,s->lookahead)
-
-; restore stack and register ebx,esi,edi,ebp
- add esp,NbStackAdd
-
- pop ebx
- pop esi
- pop edi
- pop ebp
- ret
-InfoAuthor:
-; please don't remove this string !
-; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary!
- db 0dh,0ah,"GVMat32 optimised assembly code written 1996-98 by Gilles Vollant",0dh,0ah
-
-
-
-IFDEF NOUNDERLINE
-longest_match_7fff endp
-ELSE
-_longest_match_7fff endp
-ENDIF
-
-
-IFDEF NOUNDERLINE
-cpudetect32 proc near
-ELSE
-_cpudetect32 proc near
-ENDIF
-
- push ebx
-
- pushfd ; push original EFLAGS
- pop eax ; get original EFLAGS
- mov ecx, eax ; save original EFLAGS
- xor eax, 40000h ; flip AC bit in EFLAGS
- push eax ; save new EFLAGS value on stack
- popfd ; replace current EFLAGS value
- pushfd ; get new EFLAGS
- pop eax ; store new EFLAGS in EAX
- xor eax, ecx ; can’t toggle AC bit, processor=80386
- jz end_cpu_is_386 ; jump if 80386 processor
- push ecx
- popfd ; restore AC bit in EFLAGS first
-
- pushfd
- pushfd
- pop ecx
-
- mov eax, ecx ; get original EFLAGS
- xor eax, 200000h ; flip ID bit in EFLAGS
- push eax ; save new EFLAGS value on stack
- popfd ; replace current EFLAGS value
- pushfd ; get new EFLAGS
- pop eax ; store new EFLAGS in EAX
- popfd ; restore original EFLAGS
- xor eax, ecx ; can’t toggle ID bit,
- je is_old_486 ; processor=old
-
- mov eax,1
- db 0fh,0a2h ;CPUID
-
-exitcpudetect:
- pop ebx
- ret
-
-end_cpu_is_386:
- mov eax,0300h
- jmp exitcpudetect
-
-is_old_486:
- mov eax,0400h
- jmp exitcpudetect
-
-IFDEF NOUNDERLINE
-cpudetect32 endp
-ELSE
-_cpudetect32 endp
-ENDIF
-ENDIF
-
-MAX_MATCH equ 258
-MIN_MATCH equ 3
-MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1)
-MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h)
-
-
-;;; stack frame offsets
-
-chainlenwmask equ esp + 0 ; high word: current chain len
- ; low word: s->wmask
-window equ esp + 4 ; local copy of s->window
-windowbestlen equ esp + 8 ; s->window + bestlen
-scanstart equ esp + 16 ; first two bytes of string
-scanend equ esp + 12 ; last two bytes of string
-scanalign equ esp + 20 ; dword-misalignment of string
-nicematch equ esp + 24 ; a good enough match size
-bestlen equ esp + 28 ; size of best match so far
-scan equ esp + 32 ; ptr to string wanting match
-
-LocalVarsSize equ 36
-; saved ebx byte esp + 36
-; saved edi byte esp + 40
-; saved esi byte esp + 44
-; saved ebp byte esp + 48
-; return address byte esp + 52
-deflatestate equ esp + 56 ; the function arguments
-curmatch equ esp + 60
-
-;;; Offsets for fields in the deflate_state structure. These numbers
-;;; are calculated from the definition of deflate_state, with the
-;;; assumption that the compiler will dword-align the fields. (Thus,
-;;; changing the definition of deflate_state could easily cause this
-;;; program to crash horribly, without so much as a warning at
-;;; compile time. Sigh.)
-
-dsWSize equ 36+zlib1222add
-dsWMask equ 44+zlib1222add
-dsWindow equ 48+zlib1222add
-dsPrev equ 56+zlib1222add
-dsMatchLen equ 88+zlib1222add
-dsPrevMatch equ 92+zlib1222add
-dsStrStart equ 100+zlib1222add
-dsMatchStart equ 104+zlib1222add
-dsLookahead equ 108+zlib1222add
-dsPrevLen equ 112+zlib1222add
-dsMaxChainLen equ 116+zlib1222add
-dsGoodMatch equ 132+zlib1222add
-dsNiceMatch equ 136+zlib1222add
-
-
-;;; match.asm -- Pentium-Pro-optimized version of longest_match()
-;;; Written for zlib 1.1.2
-;;; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
-;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html
-;;;
-;;; This is free software; you can redistribute it and/or modify it
-;;; under the terms of the GNU General Public License.
-
-;GLOBAL _longest_match, _match_init
-
-
-;SECTION .text
-
-;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
-
-;_longest_match:
-IFDEF NOOLDPENTIUMCODE
- IFDEF NOUNDERLINE
- longest_match proc near
- ELSE
- _longest_match proc near
- ENDIF
-ELSE
- IFDEF NOUNDERLINE
- longest_match_686 proc near
- ELSE
- _longest_match_686 proc near
- ENDIF
-ENDIF
-
-;;; Save registers that the compiler may be using, and adjust esp to
-;;; make room for our stack frame.
-
- push ebp
- push edi
- push esi
- push ebx
- sub esp, LocalVarsSize
-
-;;; Retrieve the function arguments. ecx will hold cur_match
-;;; throughout the entire function. edx will hold the pointer to the
-;;; deflate_state structure during the function's setup (before
-;;; entering the main loop.
-
- mov edx, [deflatestate]
- mov ecx, [curmatch]
-
-;;; uInt wmask = s->w_mask;
-;;; unsigned chain_length = s->max_chain_length;
-;;; if (s->prev_length >= s->good_match) {
-;;; chain_length >>= 2;
-;;; }
-
- mov eax, [edx + dsPrevLen]
- mov ebx, [edx + dsGoodMatch]
- cmp eax, ebx
- mov eax, [edx + dsWMask]
- mov ebx, [edx + dsMaxChainLen]
- jl LastMatchGood
- shr ebx, 2
-LastMatchGood:
-
-;;; chainlen is decremented once beforehand so that the function can
-;;; use the sign flag instead of the zero flag for the exit test.
-;;; It is then shifted into the high word, to make room for the wmask
-;;; value, which it will always accompany.
-
- dec ebx
- shl ebx, 16
- or ebx, eax
- mov [chainlenwmask], ebx
-
-;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- mov eax, [edx + dsNiceMatch]
- mov ebx, [edx + dsLookahead]
- cmp ebx, eax
- jl LookaheadLess
- mov ebx, eax
-LookaheadLess: mov [nicematch], ebx
-
-;;; register Bytef *scan = s->window + s->strstart;
-
- mov esi, [edx + dsWindow]
- mov [window], esi
- mov ebp, [edx + dsStrStart]
- lea edi, [esi + ebp]
- mov [scan], edi
-
-;;; Determine how many bytes the scan ptr is off from being
-;;; dword-aligned.
-
- mov eax, edi
- neg eax
- and eax, 3
- mov [scanalign], eax
-
-;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
-;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
-
- mov eax, [edx + dsWSize]
- sub eax, MIN_LOOKAHEAD
- sub ebp, eax
- jg LimitPositive
- xor ebp, ebp
-LimitPositive:
-
-;;; int best_len = s->prev_length;
-
- mov eax, [edx + dsPrevLen]
- mov [bestlen], eax
-
-;;; Store the sum of s->window + best_len in esi locally, and in esi.
-
- add esi, eax
- mov [windowbestlen], esi
-
-;;; register ush scan_start = *(ushf*)scan;
-;;; register ush scan_end = *(ushf*)(scan+best_len-1);
-;;; Posf *prev = s->prev;
-
- movzx ebx, word ptr [edi]
- mov [scanstart], ebx
- movzx ebx, word ptr [edi + eax - 1]
- mov [scanend], ebx
- mov edi, [edx + dsPrev]
-
-;;; Jump into the main loop.
-
- mov edx, [chainlenwmask]
- jmp short LoopEntry
-
-align 4
-
-;;; do {
-;;; match = s->window + cur_match;
-;;; if (*(ushf*)(match+best_len-1) != scan_end ||
-;;; *(ushf*)match != scan_start) continue;
-;;; [...]
-;;; } while ((cur_match = prev[cur_match & wmask]) > limit
-;;; && --chain_length != 0);
-;;;
-;;; Here is the inner loop of the function. The function will spend the
-;;; majority of its time in this loop, and majority of that time will
-;;; be spent in the first ten instructions.
-;;;
-;;; Within this loop:
-;;; ebx = scanend
-;;; ecx = curmatch
-;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
-;;; esi = windowbestlen - i.e., (window + bestlen)
-;;; edi = prev
-;;; ebp = limit
-
-LookupLoop:
- and ecx, edx
- movzx ecx, word ptr [edi + ecx*2]
- cmp ecx, ebp
- jbe LeaveNow
- sub edx, 00010000h
- js LeaveNow
-LoopEntry: movzx eax, word ptr [esi + ecx - 1]
- cmp eax, ebx
- jnz LookupLoop
- mov eax, [window]
- movzx eax, word ptr [eax + ecx]
- cmp eax, [scanstart]
- jnz LookupLoop
-
-;;; Store the current value of chainlen.
-
- mov [chainlenwmask], edx
-
-;;; Point edi to the string under scrutiny, and esi to the string we
-;;; are hoping to match it up with. In actuality, esi and edi are
-;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
-;;; initialized to -(MAX_MATCH_8 - scanalign).
-
- mov esi, [window]
- mov edi, [scan]
- add esi, ecx
- mov eax, [scanalign]
- mov edx, 0fffffef8h; -(MAX_MATCH_8)
- lea edi, [edi + eax + 0108h] ;MAX_MATCH_8]
- lea esi, [esi + eax + 0108h] ;MAX_MATCH_8]
-
-;;; Test the strings for equality, 8 bytes at a time. At the end,
-;;; adjust edx so that it is offset to the exact byte that mismatched.
-;;;
-;;; We already know at this point that the first three bytes of the
-;;; strings match each other, and they can be safely passed over before
-;;; starting the compare loop. So what this code does is skip over 0-3
-;;; bytes, as much as necessary in order to dword-align the edi
-;;; pointer. (esi will still be misaligned three times out of four.)
-;;;
-;;; It should be confessed that this loop usually does not represent
-;;; much of the total running time. Replacing it with a more
-;;; straightforward "rep cmpsb" would not drastically degrade
-;;; performance.
-
-LoopCmps:
- mov eax, [esi + edx]
- xor eax, [edi + edx]
- jnz LeaveLoopCmps
- mov eax, [esi + edx + 4]
- xor eax, [edi + edx + 4]
- jnz LeaveLoopCmps4
- add edx, 8
- jnz LoopCmps
- jmp short LenMaximum
-LeaveLoopCmps4: add edx, 4
-LeaveLoopCmps: test eax, 0000FFFFh
- jnz LenLower
- add edx, 2
- shr eax, 16
-LenLower: sub al, 1
- adc edx, 0
-
-;;; Calculate the length of the match. If it is longer than MAX_MATCH,
-;;; then automatically accept it as the best possible match and leave.
-
- lea eax, [edi + edx]
- mov edi, [scan]
- sub eax, edi
- cmp eax, MAX_MATCH
- jge LenMaximum
-
-;;; If the length of the match is not longer than the best match we
-;;; have so far, then forget it and return to the lookup loop.
-
- mov edx, [deflatestate]
- mov ebx, [bestlen]
- cmp eax, ebx
- jg LongerMatch
- mov esi, [windowbestlen]
- mov edi, [edx + dsPrev]
- mov ebx, [scanend]
- mov edx, [chainlenwmask]
- jmp LookupLoop
-
-;;; s->match_start = cur_match;
-;;; best_len = len;
-;;; if (len >= nice_match) break;
-;;; scan_end = *(ushf*)(scan+best_len-1);
-
-LongerMatch: mov ebx, [nicematch]
- mov [bestlen], eax
- mov [edx + dsMatchStart], ecx
- cmp eax, ebx
- jge LeaveNow
- mov esi, [window]
- add esi, eax
- mov [windowbestlen], esi
- movzx ebx, word ptr [edi + eax - 1]
- mov edi, [edx + dsPrev]
- mov [scanend], ebx
- mov edx, [chainlenwmask]
- jmp LookupLoop
-
-;;; Accept the current string, with the maximum possible length.
-
-LenMaximum: mov edx, [deflatestate]
- mov dword ptr [bestlen], MAX_MATCH
- mov [edx + dsMatchStart], ecx
-
-;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
-;;; return s->lookahead;
-
-LeaveNow:
- mov edx, [deflatestate]
- mov ebx, [bestlen]
- mov eax, [edx + dsLookahead]
- cmp ebx, eax
- jg LookaheadRet
- mov eax, ebx
-LookaheadRet:
-
-;;; Restore the stack and return from whence we came.
-
- add esp, LocalVarsSize
- pop ebx
- pop esi
- pop edi
- pop ebp
-
- ret
-; please don't remove this string !
-; Your can freely use gvmat32 in any free or commercial app if you don't remove the string in the binary!
- db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah
-
-
-IFDEF NOOLDPENTIUMCODE
- IFDEF NOUNDERLINE
- longest_match endp
- ELSE
- _longest_match endp
- ENDIF
-
- IFDEF NOUNDERLINE
- match_init proc near
- ret
- match_init endp
- ELSE
- _match_init proc near
- ret
- _match_init endp
- ENDIF
-ELSE
- IFDEF NOUNDERLINE
- longest_match_686 endp
- ELSE
- _longest_match_686 endp
- ENDIF
-ENDIF
-
-_TEXT ends
-end
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32c.c b/funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32c.c
deleted file mode 100644
index 7ad2b27..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx86/gvmat32c.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86
- * Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
- * File written by Gilles Vollant, by modifiying the longest_match
- * from Jean-loup Gailly in deflate.c
- * it prepare all parameters and call the assembly longest_match_gvasm
- * longest_match execute standard C code is wmask != 0x7fff
- * (assembly code is faster with a fixed wmask)
- *
- * Read comment at beginning of gvmat32.asm for more information
- */
-
-#if defined(ASMV) && (!defined(NOOLDPENTIUMCODE))
-#include "deflate.h"
-
-/* if your C compiler don't add underline before function name,
- define ADD_UNDERLINE_ASMFUNC */
-#ifdef ADD_UNDERLINE_ASMFUNC
-#define longest_match_7fff _longest_match_7fff
-#define longest_match_686 _longest_match_686
-#define cpudetect32 _cpudetect32
-#endif
-
-
-unsigned long cpudetect32();
-
-uInt longest_match_c(
- deflate_state *s,
- IPos cur_match); /* current match */
-
-
-uInt longest_match_7fff(
- deflate_state *s,
- IPos cur_match); /* current match */
-
-uInt longest_match_686(
- deflate_state *s,
- IPos cur_match); /* current match */
-
-
-static uInt iIsPPro=2;
-
-void match_init ()
-{
- iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
-}
-
-uInt longest_match(
- deflate_state *s,
- IPos cur_match) /* current match */
-{
- if (iIsPPro!=0)
- return longest_match_686(s,cur_match);
-
- if (s->w_mask != 0x7fff)
- return longest_match_686(s,cur_match);
-
- /* now ((s->w_mask == 0x7fff) && (iIsPPro==0)) */
- return longest_match_7fff(s,cur_match);
-}
-
-
-#endif /* defined(ASMV) && (!defined(NOOLDPENTIUMCODE)) */
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx86/inffas32.asm b/funtools/util/zlib-1.2.3/contrib/masmx86/inffas32.asm
deleted file mode 100644
index 4a20512..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx86/inffas32.asm
+++ /dev/null
@@ -1,1083 +0,0 @@
-;/* inffas32.asm is a hand tuned assembler version of inffast.c -- fast decoding
-; *
-; * inffas32.asm is derivated from inffas86.c, with translation of assembly code
-; *
-; * Copyright (C) 1995-2003 Mark Adler
-; * For conditions of distribution and use, see copyright notice in zlib.h
-; *
-; * Copyright (C) 2003 Chris Anderson <christop@charm.net>
-; * Please use the copyright conditions above.
-; *
-; * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
-; * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
-; * the moment. I have successfully compiled and tested this code with gcc2.96,
-; * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
-; * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
-; * enabled. I will attempt to merge the MMX code into this version. Newer
-; * versions of this and inffast.S can be found at
-; * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
-; *
-; * 2005 : modification by Gilles Vollant
-; */
-; For Visual C++ 4.x and higher and ML 6.x and higher
-; ml.exe is in directory \MASM611C of Win95 DDK
-; ml.exe is also distributed in http://www.masm32.com/masmdl.htm
-; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/
-;
-;
-; compile with command line option
-; ml /coff /Zi /c /Flinffas32.lst inffas32.asm
-
-; if you define NO_GZIP (see inflate.h), compile with
-; ml /coff /Zi /c /Flinffas32.lst /DNO_GUNZIP inffas32.asm
-
-
-; zlib122sup is 0 fort zlib 1.2.2.1 and lower
-; zlib122sup is 8 fort zlib 1.2.2.2 and more (with addition of dmax and head
-; in inflate_state in inflate.h)
-zlib1222sup equ 8
-
-
-IFDEF GUNZIP
- INFLATE_MODE_TYPE equ 11
- INFLATE_MODE_BAD equ 26
-ELSE
- IFNDEF NO_GUNZIP
- INFLATE_MODE_TYPE equ 11
- INFLATE_MODE_BAD equ 26
- ELSE
- INFLATE_MODE_TYPE equ 3
- INFLATE_MODE_BAD equ 17
- ENDIF
-ENDIF
-
-
-; 75 "inffast.S"
-;FILE "inffast.S"
-
-;;;GLOBAL _inflate_fast
-
-;;;SECTION .text
-
-
-
- .586p
- .mmx
-
- name inflate_fast_x86
- .MODEL FLAT
-
-_DATA segment
-inflate_fast_use_mmx:
- dd 1
-
-
-_TEXT segment
-PUBLIC _inflate_fast
-
-ALIGN 4
-_inflate_fast:
- jmp inflate_fast_entry
-
-
-
-ALIGN 4
- db 'Fast decoding Code from Chris Anderson'
- db 0
-
-ALIGN 4
-invalid_literal_length_code_msg:
- db 'invalid literal/length code'
- db 0
-
-ALIGN 4
-invalid_distance_code_msg:
- db 'invalid distance code'
- db 0
-
-ALIGN 4
-invalid_distance_too_far_msg:
- db 'invalid distance too far back'
- db 0
-
-
-ALIGN 4
-inflate_fast_mask:
-dd 0
-dd 1
-dd 3
-dd 7
-dd 15
-dd 31
-dd 63
-dd 127
-dd 255
-dd 511
-dd 1023
-dd 2047
-dd 4095
-dd 8191
-dd 16383
-dd 32767
-dd 65535
-dd 131071
-dd 262143
-dd 524287
-dd 1048575
-dd 2097151
-dd 4194303
-dd 8388607
-dd 16777215
-dd 33554431
-dd 67108863
-dd 134217727
-dd 268435455
-dd 536870911
-dd 1073741823
-dd 2147483647
-dd 4294967295
-
-
-mode_state equ 0 ;/* state->mode */
-wsize_state equ (32+zlib1222sup) ;/* state->wsize */
-write_state equ (36+4+zlib1222sup) ;/* state->write */
-window_state equ (40+4+zlib1222sup) ;/* state->window */
-hold_state equ (44+4+zlib1222sup) ;/* state->hold */
-bits_state equ (48+4+zlib1222sup) ;/* state->bits */
-lencode_state equ (64+4+zlib1222sup) ;/* state->lencode */
-distcode_state equ (68+4+zlib1222sup) ;/* state->distcode */
-lenbits_state equ (72+4+zlib1222sup) ;/* state->lenbits */
-distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */
-
-
-;;SECTION .text
-; 205 "inffast.S"
-;GLOBAL inflate_fast_use_mmx
-
-;SECTION .data
-
-
-; GLOBAL inflate_fast_use_mmx:object
-;.size inflate_fast_use_mmx, 4
-; 226 "inffast.S"
-;SECTION .text
-
-ALIGN 4
-inflate_fast_entry:
- push edi
- push esi
- push ebp
- push ebx
- pushfd
- sub esp,64
- cld
-
-
-
-
- mov esi, [esp+88]
- mov edi, [esi+28]
-
-
-
-
-
-
-
- mov edx, [esi+4]
- mov eax, [esi+0]
-
- add edx,eax
- sub edx,11
-
- mov [esp+44],eax
- mov [esp+20],edx
-
- mov ebp, [esp+92]
- mov ecx, [esi+16]
- mov ebx, [esi+12]
-
- sub ebp,ecx
- neg ebp
- add ebp,ebx
-
- sub ecx,257
- add ecx,ebx
-
- mov [esp+60],ebx
- mov [esp+40],ebp
- mov [esp+16],ecx
-; 285 "inffast.S"
- mov eax, [edi+lencode_state]
- mov ecx, [edi+distcode_state]
-
- mov [esp+8],eax
- mov [esp+12],ecx
-
- mov eax,1
- mov ecx, [edi+lenbits_state]
- shl eax,cl
- dec eax
- mov [esp+0],eax
-
- mov eax,1
- mov ecx, [edi+distbits_state]
- shl eax,cl
- dec eax
- mov [esp+4],eax
-
- mov eax, [edi+wsize_state]
- mov ecx, [edi+write_state]
- mov edx, [edi+window_state]
-
- mov [esp+52],eax
- mov [esp+48],ecx
- mov [esp+56],edx
-
- mov ebp, [edi+hold_state]
- mov ebx, [edi+bits_state]
-; 321 "inffast.S"
- mov esi, [esp+44]
- mov ecx, [esp+20]
- cmp ecx,esi
- ja L_align_long
-
- add ecx,11
- sub ecx,esi
- mov eax,12
- sub eax,ecx
- lea edi, [esp+28]
- rep movsb
- mov ecx,eax
- xor eax,eax
- rep stosb
- lea esi, [esp+28]
- mov [esp+20],esi
- jmp L_is_aligned
-
-
-L_align_long:
- test esi,3
- jz L_is_aligned
- xor eax,eax
- mov al, [esi]
- inc esi
- mov ecx,ebx
- add ebx,8
- shl eax,cl
- or ebp,eax
- jmp L_align_long
-
-L_is_aligned:
- mov edi, [esp+60]
-; 366 "inffast.S"
-L_check_mmx:
- cmp dword ptr [inflate_fast_use_mmx],2
- je L_init_mmx
- ja L_do_loop
-
- push eax
- push ebx
- push ecx
- push edx
- pushfd
- mov eax, [esp]
- xor dword ptr [esp],0200000h
-
-
-
-
- popfd
- pushfd
- pop edx
- xor edx,eax
- jz L_dont_use_mmx
- xor eax,eax
- cpuid
- cmp ebx,0756e6547h
- jne L_dont_use_mmx
- cmp ecx,06c65746eh
- jne L_dont_use_mmx
- cmp edx,049656e69h
- jne L_dont_use_mmx
- mov eax,1
- cpuid
- shr eax,8
- and eax,15
- cmp eax,6
- jne L_dont_use_mmx
- test edx,0800000h
- jnz L_use_mmx
- jmp L_dont_use_mmx
-L_use_mmx:
- mov dword ptr [inflate_fast_use_mmx],2
- jmp L_check_mmx_pop
-L_dont_use_mmx:
- mov dword ptr [inflate_fast_use_mmx],3
-L_check_mmx_pop:
- pop edx
- pop ecx
- pop ebx
- pop eax
- jmp L_check_mmx
-; 426 "inffast.S"
-ALIGN 4
-L_do_loop:
-; 437 "inffast.S"
- cmp bl,15
- ja L_get_length_code
-
- xor eax,eax
- lodsw
- mov cl,bl
- add bl,16
- shl eax,cl
- or ebp,eax
-
-L_get_length_code:
- mov edx, [esp+0]
- mov ecx, [esp+8]
- and edx,ebp
- mov eax, [ecx+edx*4]
-
-L_dolen:
-
-
-
-
-
-
- mov cl,ah
- sub bl,ah
- shr ebp,cl
-
-
-
-
-
-
- test al,al
- jnz L_test_for_length_base
-
- shr eax,16
- stosb
-
-L_while_test:
-
-
- cmp [esp+16],edi
- jbe L_break_loop
-
- cmp [esp+20],esi
- ja L_do_loop
- jmp L_break_loop
-
-L_test_for_length_base:
-; 502 "inffast.S"
- mov edx,eax
- shr edx,16
- mov cl,al
-
- test al,16
- jz L_test_for_second_level_length
- and cl,15
- jz L_save_len
- cmp bl,cl
- jae L_add_bits_to_len
-
- mov ch,cl
- xor eax,eax
- lodsw
- mov cl,bl
- add bl,16
- shl eax,cl
- or ebp,eax
- mov cl,ch
-
-L_add_bits_to_len:
- mov eax,1
- shl eax,cl
- dec eax
- sub bl,cl
- and eax,ebp
- shr ebp,cl
- add edx,eax
-
-L_save_len:
- mov [esp+24],edx
-
-
-L_decode_distance:
-; 549 "inffast.S"
- cmp bl,15
- ja L_get_distance_code
-
- xor eax,eax
- lodsw
- mov cl,bl
- add bl,16
- shl eax,cl
- or ebp,eax
-
-L_get_distance_code:
- mov edx, [esp+4]
- mov ecx, [esp+12]
- and edx,ebp
- mov eax, [ecx+edx*4]
-
-
-L_dodist:
- mov edx,eax
- shr edx,16
- mov cl,ah
- sub bl,ah
- shr ebp,cl
-; 584 "inffast.S"
- mov cl,al
-
- test al,16
- jz L_test_for_second_level_dist
- and cl,15
- jz L_check_dist_one
- cmp bl,cl
- jae L_add_bits_to_dist
-
- mov ch,cl
- xor eax,eax
- lodsw
- mov cl,bl
- add bl,16
- shl eax,cl
- or ebp,eax
- mov cl,ch
-
-L_add_bits_to_dist:
- mov eax,1
- shl eax,cl
- dec eax
- sub bl,cl
- and eax,ebp
- shr ebp,cl
- add edx,eax
- jmp L_check_window
-
-L_check_window:
-; 625 "inffast.S"
- mov [esp+44],esi
- mov eax,edi
- sub eax, [esp+40]
-
- cmp eax,edx
- jb L_clip_window
-
- mov ecx, [esp+24]
- mov esi,edi
- sub esi,edx
-
- sub ecx,3
- mov al, [esi]
- mov [edi],al
- mov al, [esi+1]
- mov dl, [esi+2]
- add esi,3
- mov [edi+1],al
- mov [edi+2],dl
- add edi,3
- rep movsb
-
- mov esi, [esp+44]
- jmp L_while_test
-
-ALIGN 4
-L_check_dist_one:
- cmp edx,1
- jne L_check_window
- cmp [esp+40],edi
- je L_check_window
-
- dec edi
- mov ecx, [esp+24]
- mov al, [edi]
- sub ecx,3
-
- mov [edi+1],al
- mov [edi+2],al
- mov [edi+3],al
- add edi,4
- rep stosb
-
- jmp L_while_test
-
-ALIGN 4
-L_test_for_second_level_length:
-
-
-
-
- test al,64
- jnz L_test_for_end_of_block
-
- mov eax,1
- shl eax,cl
- dec eax
- and eax,ebp
- add eax,edx
- mov edx, [esp+8]
- mov eax, [edx+eax*4]
- jmp L_dolen
-
-ALIGN 4
-L_test_for_second_level_dist:
-
-
-
-
- test al,64
- jnz L_invalid_distance_code
-
- mov eax,1
- shl eax,cl
- dec eax
- and eax,ebp
- add eax,edx
- mov edx, [esp+12]
- mov eax, [edx+eax*4]
- jmp L_dodist
-
-ALIGN 4
-L_clip_window:
-; 721 "inffast.S"
- mov ecx,eax
- mov eax, [esp+52]
- neg ecx
- mov esi, [esp+56]
-
- cmp eax,edx
- jb L_invalid_distance_too_far
-
- add ecx,edx
- cmp dword ptr [esp+48],0
- jne L_wrap_around_window
-
- sub eax,ecx
- add esi,eax
-; 749 "inffast.S"
- mov eax, [esp+24]
- cmp eax,ecx
- jbe L_do_copy1
-
- sub eax,ecx
- rep movsb
- mov esi,edi
- sub esi,edx
- jmp L_do_copy1
-
- cmp eax,ecx
- jbe L_do_copy1
-
- sub eax,ecx
- rep movsb
- mov esi,edi
- sub esi,edx
- jmp L_do_copy1
-
-L_wrap_around_window:
-; 793 "inffast.S"
- mov eax, [esp+48]
- cmp ecx,eax
- jbe L_contiguous_in_window
-
- add esi, [esp+52]
- add esi,eax
- sub esi,ecx
- sub ecx,eax
-
-
- mov eax, [esp+24]
- cmp eax,ecx
- jbe L_do_copy1
-
- sub eax,ecx
- rep movsb
- mov esi, [esp+56]
- mov ecx, [esp+48]
- cmp eax,ecx
- jbe L_do_copy1
-
- sub eax,ecx
- rep movsb
- mov esi,edi
- sub esi,edx
- jmp L_do_copy1
-
-L_contiguous_in_window:
-; 836 "inffast.S"
- add esi,eax
- sub esi,ecx
-
-
- mov eax, [esp+24]
- cmp eax,ecx
- jbe L_do_copy1
-
- sub eax,ecx
- rep movsb
- mov esi,edi
- sub esi,edx
-
-L_do_copy1:
-; 862 "inffast.S"
- mov ecx,eax
- rep movsb
-
- mov esi, [esp+44]
- jmp L_while_test
-; 878 "inffast.S"
-ALIGN 4
-L_init_mmx:
- emms
-
-
-
-
-
- movd mm0,ebp
- mov ebp,ebx
-; 896 "inffast.S"
- movd mm4,[esp+0]
- movq mm3,mm4
- movd mm5,[esp+4]
- movq mm2,mm5
- pxor mm1,mm1
- mov ebx, [esp+8]
- jmp L_do_loop_mmx
-
-ALIGN 4
-L_do_loop_mmx:
- psrlq mm0,mm1
-
- cmp ebp,32
- ja L_get_length_code_mmx
-
- movd mm6,ebp
- movd mm7,[esi]
- add esi,4
- psllq mm7,mm6
- add ebp,32
- por mm0,mm7
-
-L_get_length_code_mmx:
- pand mm4,mm0
- movd eax,mm4
- movq mm4,mm3
- mov eax, [ebx+eax*4]
-
-L_dolen_mmx:
- movzx ecx,ah
- movd mm1,ecx
- sub ebp,ecx
-
- test al,al
- jnz L_test_for_length_base_mmx
-
- shr eax,16
- stosb
-
-L_while_test_mmx:
-
-
- cmp [esp+16],edi
- jbe L_break_loop
-
- cmp [esp+20],esi
- ja L_do_loop_mmx
- jmp L_break_loop
-
-L_test_for_length_base_mmx:
-
- mov edx,eax
- shr edx,16
-
- test al,16
- jz L_test_for_second_level_length_mmx
- and eax,15
- jz L_decode_distance_mmx
-
- psrlq mm0,mm1
- movd mm1,eax
- movd ecx,mm0
- sub ebp,eax
- and ecx, [inflate_fast_mask+eax*4]
- add edx,ecx
-
-L_decode_distance_mmx:
- psrlq mm0,mm1
-
- cmp ebp,32
- ja L_get_dist_code_mmx
-
- movd mm6,ebp
- movd mm7,[esi]
- add esi,4
- psllq mm7,mm6
- add ebp,32
- por mm0,mm7
-
-L_get_dist_code_mmx:
- mov ebx, [esp+12]
- pand mm5,mm0
- movd eax,mm5
- movq mm5,mm2
- mov eax, [ebx+eax*4]
-
-L_dodist_mmx:
-
- movzx ecx,ah
- mov ebx,eax
- shr ebx,16
- sub ebp,ecx
- movd mm1,ecx
-
- test al,16
- jz L_test_for_second_level_dist_mmx
- and eax,15
- jz L_check_dist_one_mmx
-
-L_add_bits_to_dist_mmx:
- psrlq mm0,mm1
- movd mm1,eax
- movd ecx,mm0
- sub ebp,eax
- and ecx, [inflate_fast_mask+eax*4]
- add ebx,ecx
-
-L_check_window_mmx:
- mov [esp+44],esi
- mov eax,edi
- sub eax, [esp+40]
-
- cmp eax,ebx
- jb L_clip_window_mmx
-
- mov ecx,edx
- mov esi,edi
- sub esi,ebx
-
- sub ecx,3
- mov al, [esi]
- mov [edi],al
- mov al, [esi+1]
- mov dl, [esi+2]
- add esi,3
- mov [edi+1],al
- mov [edi+2],dl
- add edi,3
- rep movsb
-
- mov esi, [esp+44]
- mov ebx, [esp+8]
- jmp L_while_test_mmx
-
-ALIGN 4
-L_check_dist_one_mmx:
- cmp ebx,1
- jne L_check_window_mmx
- cmp [esp+40],edi
- je L_check_window_mmx
-
- dec edi
- mov ecx,edx
- mov al, [edi]
- sub ecx,3
-
- mov [edi+1],al
- mov [edi+2],al
- mov [edi+3],al
- add edi,4
- rep stosb
-
- mov ebx, [esp+8]
- jmp L_while_test_mmx
-
-ALIGN 4
-L_test_for_second_level_length_mmx:
- test al,64
- jnz L_test_for_end_of_block
-
- and eax,15
- psrlq mm0,mm1
- movd ecx,mm0
- and ecx, [inflate_fast_mask+eax*4]
- add ecx,edx
- mov eax, [ebx+ecx*4]
- jmp L_dolen_mmx
-
-ALIGN 4
-L_test_for_second_level_dist_mmx:
- test al,64
- jnz L_invalid_distance_code
-
- and eax,15
- psrlq mm0,mm1
- movd ecx,mm0
- and ecx, [inflate_fast_mask+eax*4]
- mov eax, [esp+12]
- add ecx,ebx
- mov eax, [eax+ecx*4]
- jmp L_dodist_mmx
-
-ALIGN 4
-L_clip_window_mmx:
-
- mov ecx,eax
- mov eax, [esp+52]
- neg ecx
- mov esi, [esp+56]
-
- cmp eax,ebx
- jb L_invalid_distance_too_far
-
- add ecx,ebx
- cmp dword ptr [esp+48],0
- jne L_wrap_around_window_mmx
-
- sub eax,ecx
- add esi,eax
-
- cmp edx,ecx
- jbe L_do_copy1_mmx
-
- sub edx,ecx
- rep movsb
- mov esi,edi
- sub esi,ebx
- jmp L_do_copy1_mmx
-
- cmp edx,ecx
- jbe L_do_copy1_mmx
-
- sub edx,ecx
- rep movsb
- mov esi,edi
- sub esi,ebx
- jmp L_do_copy1_mmx
-
-L_wrap_around_window_mmx:
-
- mov eax, [esp+48]
- cmp ecx,eax
- jbe L_contiguous_in_window_mmx
-
- add esi, [esp+52]
- add esi,eax
- sub esi,ecx
- sub ecx,eax
-
-
- cmp edx,ecx
- jbe L_do_copy1_mmx
-
- sub edx,ecx
- rep movsb
- mov esi, [esp+56]
- mov ecx, [esp+48]
- cmp edx,ecx
- jbe L_do_copy1_mmx
-
- sub edx,ecx
- rep movsb
- mov esi,edi
- sub esi,ebx
- jmp L_do_copy1_mmx
-
-L_contiguous_in_window_mmx:
-
- add esi,eax
- sub esi,ecx
-
-
- cmp edx,ecx
- jbe L_do_copy1_mmx
-
- sub edx,ecx
- rep movsb
- mov esi,edi
- sub esi,ebx
-
-L_do_copy1_mmx:
-
-
- mov ecx,edx
- rep movsb
-
- mov esi, [esp+44]
- mov ebx, [esp+8]
- jmp L_while_test_mmx
-; 1174 "inffast.S"
-L_invalid_distance_code:
-
-
-
-
-
- mov ecx, invalid_distance_code_msg
- mov edx,INFLATE_MODE_BAD
- jmp L_update_stream_state
-
-L_test_for_end_of_block:
-
-
-
-
-
- test al,32
- jz L_invalid_literal_length_code
-
- mov ecx,0
- mov edx,INFLATE_MODE_TYPE
- jmp L_update_stream_state
-
-L_invalid_literal_length_code:
-
-
-
-
-
- mov ecx, invalid_literal_length_code_msg
- mov edx,INFLATE_MODE_BAD
- jmp L_update_stream_state
-
-L_invalid_distance_too_far:
-
-
-
- mov esi, [esp+44]
- mov ecx, invalid_distance_too_far_msg
- mov edx,INFLATE_MODE_BAD
- jmp L_update_stream_state
-
-L_update_stream_state:
-
- mov eax, [esp+88]
- test ecx,ecx
- jz L_skip_msg
- mov [eax+24],ecx
-L_skip_msg:
- mov eax, [eax+28]
- mov [eax+mode_state],edx
- jmp L_break_loop
-
-ALIGN 4
-L_break_loop:
-; 1243 "inffast.S"
- cmp dword ptr [inflate_fast_use_mmx],2
- jne L_update_next_in
-
-
-
- mov ebx,ebp
-
-L_update_next_in:
-; 1266 "inffast.S"
- mov eax, [esp+88]
- mov ecx,ebx
- mov edx, [eax+28]
- shr ecx,3
- sub esi,ecx
- shl ecx,3
- sub ebx,ecx
- mov [eax+12],edi
- mov [edx+bits_state],ebx
- mov ecx,ebx
-
- lea ebx, [esp+28]
- cmp [esp+20],ebx
- jne L_buf_not_used
-
- sub esi,ebx
- mov ebx, [eax+0]
- mov [esp+20],ebx
- add esi,ebx
- mov ebx, [eax+4]
- sub ebx,11
- add [esp+20],ebx
-
-L_buf_not_used:
- mov [eax+0],esi
-
- mov ebx,1
- shl ebx,cl
- dec ebx
-
-
-
-
-
- cmp dword ptr [inflate_fast_use_mmx],2
- jne L_update_hold
-
-
-
- psrlq mm0,mm1
- movd ebp,mm0
-
- emms
-
-L_update_hold:
-
-
-
- and ebp,ebx
- mov [edx+hold_state],ebp
-
-
-
-
- mov ebx, [esp+20]
- cmp ebx,esi
- jbe L_last_is_smaller
-
- sub ebx,esi
- add ebx,11
- mov [eax+4],ebx
- jmp L_fixup_out
-L_last_is_smaller:
- sub esi,ebx
- neg esi
- add esi,11
- mov [eax+4],esi
-
-
-
-
-L_fixup_out:
-
- mov ebx, [esp+16]
- cmp ebx,edi
- jbe L_end_is_smaller
-
- sub ebx,edi
- add ebx,257
- mov [eax+16],ebx
- jmp L_done
-L_end_is_smaller:
- sub edi,ebx
- neg edi
- add edi,257
- mov [eax+16],edi
-
-
-
-
-
-L_done:
- add esp,64
- popfd
- pop ebx
- pop ebp
- pop esi
- pop edi
- ret
-
-_TEXT ends
-end
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx86/mkasm.bat b/funtools/util/zlib-1.2.3/contrib/masmx86/mkasm.bat
deleted file mode 100755
index 70a51f8..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx86/mkasm.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-cl /DASMV /I..\.. /O2 /c gvmat32c.c
-ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm
-ml /coff /Zi /c /Flinffas32.lst inffas32.asm
diff --git a/funtools/util/zlib-1.2.3/contrib/masmx86/readme.txt b/funtools/util/zlib-1.2.3/contrib/masmx86/readme.txt
deleted file mode 100644
index 7b57167..0000000
--- a/funtools/util/zlib-1.2.3/contrib/masmx86/readme.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-
-Summary
--------
-This directory contains ASM implementations of the functions
-longest_match() and inflate_fast().
-
-
-Use instructions
-----------------
-Copy these files into the zlib source directory, then run the
-appropriate makefile, as suggested below.
-
-
-Build instructions
-------------------
-* With Microsoft C and MASM:
-nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="gvmat32c.obj gvmat32.obj inffas32.obj"
-
-* With Borland C and TASM:
-make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="gvmat32c.obj gvmat32.obj inffas32.obj" OBJPA="+gvmat32c.obj+gvmat32.obj+inffas32.obj"
-
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/ChangeLogUnzip b/funtools/util/zlib-1.2.3/contrib/minizip/ChangeLogUnzip
deleted file mode 100644
index 50ca6a9..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/ChangeLogUnzip
+++ /dev/null
@@ -1,67 +0,0 @@
-Change in 1.01e (12 feb 05)
-- Fix in zipOpen2 for globalcomment (Rolf Kalbermatter)
-- Fix possible memory leak in unzip.c (Zoran Stevanovic)
-
-Change in 1.01b (20 may 04)
-- Integrate patch from Debian package (submited by Mark Brown)
-- Add tools mztools from Xavier Roche
-
-Change in 1.01 (8 may 04)
-- fix buffer overrun risk in unzip.c (Xavier Roche)
-- fix a minor buffer insecurity in minizip.c (Mike Whittaker)
-
-Change in 1.00: (10 sept 03)
-- rename to 1.00
-- cosmetic code change
-
-Change in 0.22: (19 May 03)
-- crypting support (unless you define NOCRYPT)
-- append file in existing zipfile
-
-Change in 0.21: (10 Mar 03)
-- bug fixes
-
-Change in 0.17: (27 Jan 02)
-- bug fixes
-
-Change in 0.16: (19 Jan 02)
-- Support of ioapi for virtualize zip file access
-
-Change in 0.15: (19 Mar 98)
-- fix memory leak in minizip.c
-
-Change in 0.14: (10 Mar 98)
-- fix bugs in minizip.c sample for zipping big file
-- fix problem in month in date handling
-- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for
- comment handling
-
-Change in 0.13: (6 Mar 98)
-- fix bugs in zip.c
-- add real minizip sample
-
-Change in 0.12: (4 Mar 98)
-- add zip.c and zip.h for creates .zip file
-- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly)
-- fix miniunz.c for file without specific record for directory
-
-Change in 0.11: (3 Mar 98)
-- fix bug in unzGetCurrentFileInfo for get extra field and comment
-- enhance miniunz sample, remove the bad unztst.c sample
-
-Change in 0.10: (2 Mar 98)
-- fix bug in unzReadCurrentFile
-- rename unzip* to unz* function and structure
-- remove Windows-like hungary notation variable name
-- modify some structure in unzip.h
-- add somes comment in source
-- remove unzipGetcCurrentFile function
-- replace ZUNZEXPORT by ZEXPORT
-- add unzGetLocalExtrafield for get the local extrafield info
-- add a new sample, miniunz.c
-
-Change in 0.4: (25 Feb 98)
-- suppress the type unzipFileInZip.
- Only on file in the zipfile can be open at the same time
-- fix somes typo in code
-- added tm_unz structure in unzip_file_info (date/time in readable format)
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/Makefile b/funtools/util/zlib-1.2.3/contrib/minizip/Makefile
deleted file mode 100644
index 84eaad2..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-CC=cc
-CFLAGS=-O -I../..
-
-UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
-ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
-
-.c.o:
- $(CC) -c $(CFLAGS) $*.c
-
-all: miniunz minizip
-
-miniunz: $(UNZ_OBJS)
- $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
-
-minizip: $(ZIP_OBJS)
- $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
-
-test: miniunz minizip
- ./minizip test readme.txt
- ./miniunz -l test.zip
- mv readme.txt readme.old
- ./miniunz test.zip
-
-clean:
- /bin/rm -f *.o *~ minizip miniunz
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/crypt.h b/funtools/util/zlib-1.2.3/contrib/minizip/crypt.h
deleted file mode 100644
index 622f4bc..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/crypt.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* crypt.h -- base code for crypt/uncrypt ZIPfile
-
-
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-
- This code is a modified version of crypting code in Infozip distribution
-
- The encryption/decryption parts of this source code (as opposed to the
- non-echoing password parts) were originally written in Europe. The
- whole source package can be freely distributed, including from the USA.
- (Prior to January 2000, re-export from the US was a violation of US law.)
-
- This encryption code is a direct transcription of the algorithm from
- Roger Schlafly, described by Phil Katz in the file appnote.txt. This
- file (appnote.txt) is distributed with the PKZIP program (even in the
- version without encryption capabilities).
-
- If you don't need crypting in your application, just define symbols
- NOCRYPT and NOUNCRYPT.
-
- This code support the "Traditional PKWARE Encryption".
-
- The new AES encryption added on Zip format by Winzip (see the page
- http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
- Encryption is not supported.
-*/
-
-#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
-
-/***********************************************************************
- * Return the next byte in the pseudo-random sequence
- */
-static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
-{
- unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
- * unpredictable manner on 16-bit systems; not a problem
- * with any known compiler so far, though */
-
- temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
- return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
-}
-
-/***********************************************************************
- * Update the encryption keys with the next byte of plain text
- */
-static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
-{
- (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
- (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
- (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
- {
- register int keyshift = (int)((*(pkeys+1)) >> 24);
- (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
- }
- return c;
-}
-
-
-/***********************************************************************
- * Initialize the encryption keys and the random header according to
- * the given password.
- */
-static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
-{
- *(pkeys+0) = 305419896L;
- *(pkeys+1) = 591751049L;
- *(pkeys+2) = 878082192L;
- while (*passwd != '\0') {
- update_keys(pkeys,pcrc_32_tab,(int)*passwd);
- passwd++;
- }
-}
-
-#define zdecode(pkeys,pcrc_32_tab,c) \
- (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
-
-#define zencode(pkeys,pcrc_32_tab,c,t) \
- (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
-
-#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
-
-#define RAND_HEAD_LEN 12
- /* "last resort" source for second part of crypt seed pattern */
-# ifndef ZCR_SEED2
-# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
-# endif
-
-static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
- const char *passwd; /* password string */
- unsigned char *buf; /* where to write header */
- int bufSize;
- unsigned long* pkeys;
- const unsigned long* pcrc_32_tab;
- unsigned long crcForCrypting;
-{
- int n; /* index in random header */
- int t; /* temporary */
- int c; /* random byte */
- unsigned char header[RAND_HEAD_LEN-2]; /* random header */
- static unsigned calls = 0; /* ensure different random header each time */
-
- if (bufSize<RAND_HEAD_LEN)
- return 0;
-
- /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
- * output of rand() to get less predictability, since rand() is
- * often poorly implemented.
- */
- if (++calls == 1)
- {
- srand((unsigned)(time(NULL) ^ ZCR_SEED2));
- }
- init_keys(passwd, pkeys, pcrc_32_tab);
- for (n = 0; n < RAND_HEAD_LEN-2; n++)
- {
- c = (rand() >> 7) & 0xff;
- header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
- }
- /* Encrypt random header (last two bytes is high word of crc) */
- init_keys(passwd, pkeys, pcrc_32_tab);
- for (n = 0; n < RAND_HEAD_LEN-2; n++)
- {
- buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
- }
- buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
- buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
- return n;
-}
-
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/ioapi.c b/funtools/util/zlib-1.2.3/contrib/minizip/ioapi.c
deleted file mode 100644
index f1bee23..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/ioapi.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* ioapi.c -- IO base function header for compress/uncompress .zip
- files using zlib + zip or unzip API
-
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "zlib.h"
-#include "ioapi.h"
-
-
-
-/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-voidpf ZCALLBACK fopen_file_func OF((
- voidpf opaque,
- const char* filename,
- int mode));
-
-uLong ZCALLBACK fread_file_func OF((
- voidpf opaque,
- voidpf stream,
- void* buf,
- uLong size));
-
-uLong ZCALLBACK fwrite_file_func OF((
- voidpf opaque,
- voidpf stream,
- const void* buf,
- uLong size));
-
-long ZCALLBACK ftell_file_func OF((
- voidpf opaque,
- voidpf stream));
-
-long ZCALLBACK fseek_file_func OF((
- voidpf opaque,
- voidpf stream,
- uLong offset,
- int origin));
-
-int ZCALLBACK fclose_file_func OF((
- voidpf opaque,
- voidpf stream));
-
-int ZCALLBACK ferror_file_func OF((
- voidpf opaque,
- voidpf stream));
-
-
-voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
- voidpf opaque;
- const char* filename;
- int mode;
-{
- FILE* file = NULL;
- const char* mode_fopen = NULL;
- if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
- mode_fopen = "rb";
- else
- if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
- mode_fopen = "r+b";
- else
- if (mode & ZLIB_FILEFUNC_MODE_CREATE)
- mode_fopen = "wb";
-
- if ((filename!=NULL) && (mode_fopen != NULL))
- file = fopen(filename, mode_fopen);
- return file;
-}
-
-
-uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
- voidpf opaque;
- voidpf stream;
- void* buf;
- uLong size;
-{
- uLong ret;
- ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
- return ret;
-}
-
-
-uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
- voidpf opaque;
- voidpf stream;
- const void* buf;
- uLong size;
-{
- uLong ret;
- ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
- return ret;
-}
-
-long ZCALLBACK ftell_file_func (opaque, stream)
- voidpf opaque;
- voidpf stream;
-{
- long ret;
- ret = ftell((FILE *)stream);
- return ret;
-}
-
-long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
- voidpf opaque;
- voidpf stream;
- uLong offset;
- int origin;
-{
- int fseek_origin=0;
- long ret;
- switch (origin)
- {
- case ZLIB_FILEFUNC_SEEK_CUR :
- fseek_origin = SEEK_CUR;
- break;
- case ZLIB_FILEFUNC_SEEK_END :
- fseek_origin = SEEK_END;
- break;
- case ZLIB_FILEFUNC_SEEK_SET :
- fseek_origin = SEEK_SET;
- break;
- default: return -1;
- }
- ret = 0;
- fseek((FILE *)stream, offset, fseek_origin);
- return ret;
-}
-
-int ZCALLBACK fclose_file_func (opaque, stream)
- voidpf opaque;
- voidpf stream;
-{
- int ret;
- ret = fclose((FILE *)stream);
- return ret;
-}
-
-int ZCALLBACK ferror_file_func (opaque, stream)
- voidpf opaque;
- voidpf stream;
-{
- int ret;
- ret = ferror((FILE *)stream);
- return ret;
-}
-
-void fill_fopen_filefunc (pzlib_filefunc_def)
- zlib_filefunc_def* pzlib_filefunc_def;
-{
- pzlib_filefunc_def->zopen_file = fopen_file_func;
- pzlib_filefunc_def->zread_file = fread_file_func;
- pzlib_filefunc_def->zwrite_file = fwrite_file_func;
- pzlib_filefunc_def->ztell_file = ftell_file_func;
- pzlib_filefunc_def->zseek_file = fseek_file_func;
- pzlib_filefunc_def->zclose_file = fclose_file_func;
- pzlib_filefunc_def->zerror_file = ferror_file_func;
- pzlib_filefunc_def->opaque = NULL;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/ioapi.h b/funtools/util/zlib-1.2.3/contrib/minizip/ioapi.h
deleted file mode 100644
index 7d457ba..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/ioapi.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ioapi.h -- IO base function header for compress/uncompress .zip
- files using zlib + zip or unzip API
-
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#ifndef _ZLIBIOAPI_H
-#define _ZLIBIOAPI_H
-
-
-#define ZLIB_FILEFUNC_SEEK_CUR (1)
-#define ZLIB_FILEFUNC_SEEK_END (2)
-#define ZLIB_FILEFUNC_SEEK_SET (0)
-
-#define ZLIB_FILEFUNC_MODE_READ (1)
-#define ZLIB_FILEFUNC_MODE_WRITE (2)
-#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
-
-#define ZLIB_FILEFUNC_MODE_EXISTING (4)
-#define ZLIB_FILEFUNC_MODE_CREATE (8)
-
-
-#ifndef ZCALLBACK
-
-#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
-#define ZCALLBACK CALLBACK
-#else
-#define ZCALLBACK
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
-typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
-typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
-typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
-typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
-typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
-typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
-
-typedef struct zlib_filefunc_def_s
-{
- open_file_func zopen_file;
- read_file_func zread_file;
- write_file_func zwrite_file;
- tell_file_func ztell_file;
- seek_file_func zseek_file;
- close_file_func zclose_file;
- testerror_file_func zerror_file;
- voidpf opaque;
-} zlib_filefunc_def;
-
-
-
-void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
-
-#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
-#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
-#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
-#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
-#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
-#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/iowin32.c b/funtools/util/zlib-1.2.3/contrib/minizip/iowin32.c
deleted file mode 100644
index a9b5f78..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/iowin32.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* iowin32.c -- IO base function header for compress/uncompress .zip
- files using zlib + zip or unzip API
- This IO API version uses the Win32 API (for Microsoft Windows)
-
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#include <stdlib.h>
-
-#include "zlib.h"
-#include "ioapi.h"
-#include "iowin32.h"
-
-#ifndef INVALID_HANDLE_VALUE
-#define INVALID_HANDLE_VALUE (0xFFFFFFFF)
-#endif
-
-#ifndef INVALID_SET_FILE_POINTER
-#define INVALID_SET_FILE_POINTER ((DWORD)-1)
-#endif
-
-voidpf ZCALLBACK win32_open_file_func OF((
- voidpf opaque,
- const char* filename,
- int mode));
-
-uLong ZCALLBACK win32_read_file_func OF((
- voidpf opaque,
- voidpf stream,
- void* buf,
- uLong size));
-
-uLong ZCALLBACK win32_write_file_func OF((
- voidpf opaque,
- voidpf stream,
- const void* buf,
- uLong size));
-
-long ZCALLBACK win32_tell_file_func OF((
- voidpf opaque,
- voidpf stream));
-
-long ZCALLBACK win32_seek_file_func OF((
- voidpf opaque,
- voidpf stream,
- uLong offset,
- int origin));
-
-int ZCALLBACK win32_close_file_func OF((
- voidpf opaque,
- voidpf stream));
-
-int ZCALLBACK win32_error_file_func OF((
- voidpf opaque,
- voidpf stream));
-
-typedef struct
-{
- HANDLE hf;
- int error;
-} WIN32FILE_IOWIN;
-
-voidpf ZCALLBACK win32_open_file_func (opaque, filename, mode)
- voidpf opaque;
- const char* filename;
- int mode;
-{
- const char* mode_fopen = NULL;
- DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
- HANDLE hFile = 0;
- voidpf ret=NULL;
-
- dwDesiredAccess = dwShareMode = dwFlagsAndAttributes = 0;
-
- if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
- {
- dwDesiredAccess = GENERIC_READ;
- dwCreationDisposition = OPEN_EXISTING;
- dwShareMode = FILE_SHARE_READ;
- }
- else
- if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
- {
- dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
- dwCreationDisposition = OPEN_EXISTING;
- }
- else
- if (mode & ZLIB_FILEFUNC_MODE_CREATE)
- {
- dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
- dwCreationDisposition = CREATE_ALWAYS;
- }
-
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL,
- dwCreationDisposition, dwFlagsAndAttributes, NULL);
-
- if (hFile == INVALID_HANDLE_VALUE)
- hFile = NULL;
-
- if (hFile != NULL)
- {
- WIN32FILE_IOWIN w32fiow;
- w32fiow.hf = hFile;
- w32fiow.error = 0;
- ret = malloc(sizeof(WIN32FILE_IOWIN));
- if (ret==NULL)
- CloseHandle(hFile);
- else *((WIN32FILE_IOWIN*)ret) = w32fiow;
- }
- return ret;
-}
-
-
-uLong ZCALLBACK win32_read_file_func (opaque, stream, buf, size)
- voidpf opaque;
- voidpf stream;
- void* buf;
- uLong size;
-{
- uLong ret=0;
- HANDLE hFile = NULL;
- if (stream!=NULL)
- hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
- if (hFile != NULL)
- if (!ReadFile(hFile, buf, size, &ret, NULL))
- {
- DWORD dwErr = GetLastError();
- if (dwErr == ERROR_HANDLE_EOF)
- dwErr = 0;
- ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
- }
-
- return ret;
-}
-
-
-uLong ZCALLBACK win32_write_file_func (opaque, stream, buf, size)
- voidpf opaque;
- voidpf stream;
- const void* buf;
- uLong size;
-{
- uLong ret=0;
- HANDLE hFile = NULL;
- if (stream!=NULL)
- hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
-
- if (hFile !=NULL)
- if (!WriteFile(hFile, buf, size, &ret, NULL))
- {
- DWORD dwErr = GetLastError();
- if (dwErr == ERROR_HANDLE_EOF)
- dwErr = 0;
- ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
- }
-
- return ret;
-}
-
-long ZCALLBACK win32_tell_file_func (opaque, stream)
- voidpf opaque;
- voidpf stream;
-{
- long ret=-1;
- HANDLE hFile = NULL;
- if (stream!=NULL)
- hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
- if (hFile != NULL)
- {
- DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
- if (dwSet == INVALID_SET_FILE_POINTER)
- {
- DWORD dwErr = GetLastError();
- ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
- ret = -1;
- }
- else
- ret=(long)dwSet;
- }
- return ret;
-}
-
-long ZCALLBACK win32_seek_file_func (opaque, stream, offset, origin)
- voidpf opaque;
- voidpf stream;
- uLong offset;
- int origin;
-{
- DWORD dwMoveMethod=0xFFFFFFFF;
- HANDLE hFile = NULL;
-
- long ret=-1;
- if (stream!=NULL)
- hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
- switch (origin)
- {
- case ZLIB_FILEFUNC_SEEK_CUR :
- dwMoveMethod = FILE_CURRENT;
- break;
- case ZLIB_FILEFUNC_SEEK_END :
- dwMoveMethod = FILE_END;
- break;
- case ZLIB_FILEFUNC_SEEK_SET :
- dwMoveMethod = FILE_BEGIN;
- break;
- default: return -1;
- }
-
- if (hFile != NULL)
- {
- DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod);
- if (dwSet == INVALID_SET_FILE_POINTER)
- {
- DWORD dwErr = GetLastError();
- ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
- ret = -1;
- }
- else
- ret=0;
- }
- return ret;
-}
-
-int ZCALLBACK win32_close_file_func (opaque, stream)
- voidpf opaque;
- voidpf stream;
-{
- int ret=-1;
-
- if (stream!=NULL)
- {
- HANDLE hFile;
- hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
- if (hFile != NULL)
- {
- CloseHandle(hFile);
- ret=0;
- }
- free(stream);
- }
- return ret;
-}
-
-int ZCALLBACK win32_error_file_func (opaque, stream)
- voidpf opaque;
- voidpf stream;
-{
- int ret=-1;
- if (stream!=NULL)
- {
- ret = ((WIN32FILE_IOWIN*)stream) -> error;
- }
- return ret;
-}
-
-void fill_win32_filefunc (pzlib_filefunc_def)
- zlib_filefunc_def* pzlib_filefunc_def;
-{
- pzlib_filefunc_def->zopen_file = win32_open_file_func;
- pzlib_filefunc_def->zread_file = win32_read_file_func;
- pzlib_filefunc_def->zwrite_file = win32_write_file_func;
- pzlib_filefunc_def->ztell_file = win32_tell_file_func;
- pzlib_filefunc_def->zseek_file = win32_seek_file_func;
- pzlib_filefunc_def->zclose_file = win32_close_file_func;
- pzlib_filefunc_def->zerror_file = win32_error_file_func;
- pzlib_filefunc_def->opaque=NULL;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/iowin32.h b/funtools/util/zlib-1.2.3/contrib/minizip/iowin32.h
deleted file mode 100644
index a3a437a..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/iowin32.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* iowin32.h -- IO base function header for compress/uncompress .zip
- files using zlib + zip or unzip API
- This IO API version uses the Win32 API (for Microsoft Windows)
-
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#include <windows.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/miniunz.c b/funtools/util/zlib-1.2.3/contrib/minizip/miniunz.c
deleted file mode 100644
index f599938..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/miniunz.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- miniunz.c
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#ifdef unix
-# include <unistd.h>
-# include <utime.h>
-#else
-# include <direct.h>
-# include <io.h>
-#endif
-
-#include "unzip.h"
-
-#define CASESENSITIVITY (0)
-#define WRITEBUFFERSIZE (8192)
-#define MAXFILENAME (256)
-
-#ifdef WIN32
-#define USEWIN32IOAPI
-#include "iowin32.h"
-#endif
-/*
- mini unzip, demo of unzip package
-
- usage :
- Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir]
-
- list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
- if it exists
-*/
-
-
-/* change_file_date : change the date/time of a file
- filename : the filename of the file where date/time must be modified
- dosdate : the new date at the MSDos format (4 bytes)
- tmu_date : the SAME new date at the tm_unz format */
-void change_file_date(filename,dosdate,tmu_date)
- const char *filename;
- uLong dosdate;
- tm_unz tmu_date;
-{
-#ifdef WIN32
- HANDLE hFile;
- FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
-
- hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE,
- 0,NULL,OPEN_EXISTING,0,NULL);
- GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
- DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
- LocalFileTimeToFileTime(&ftLocal,&ftm);
- SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
- CloseHandle(hFile);
-#else
-#ifdef unix
- struct utimbuf ut;
- struct tm newdate;
- newdate.tm_sec = tmu_date.tm_sec;
- newdate.tm_min=tmu_date.tm_min;
- newdate.tm_hour=tmu_date.tm_hour;
- newdate.tm_mday=tmu_date.tm_mday;
- newdate.tm_mon=tmu_date.tm_mon;
- if (tmu_date.tm_year > 1900)
- newdate.tm_year=tmu_date.tm_year - 1900;
- else
- newdate.tm_year=tmu_date.tm_year ;
- newdate.tm_isdst=-1;
-
- ut.actime=ut.modtime=mktime(&newdate);
- utime(filename,&ut);
-#endif
-#endif
-}
-
-
-/* mymkdir and change_file_date are not 100 % portable
- As I don't know well Unix, I wait feedback for the unix portion */
-
-int mymkdir(dirname)
- const char* dirname;
-{
- int ret=0;
-#ifdef WIN32
- ret = mkdir(dirname);
-#else
-#ifdef unix
- ret = mkdir (dirname,0775);
-#endif
-#endif
- return ret;
-}
-
-int makedir (newdir)
- char *newdir;
-{
- char *buffer ;
- char *p;
- int len = (int)strlen(newdir);
-
- if (len <= 0)
- return 0;
-
- buffer = (char*)malloc(len+1);
- strcpy(buffer,newdir);
-
- if (buffer[len-1] == '/') {
- buffer[len-1] = '\0';
- }
- if (mymkdir(buffer) == 0)
- {
- free(buffer);
- return 1;
- }
-
- p = buffer+1;
- while (1)
- {
- char hold;
-
- while(*p && *p != '\\' && *p != '/')
- p++;
- hold = *p;
- *p = 0;
- if ((mymkdir(buffer) == -1) && (errno == ENOENT))
- {
- printf("couldn't create directory %s\n",buffer);
- free(buffer);
- return 0;
- }
- if (hold == 0)
- break;
- *p++ = hold;
- }
- free(buffer);
- return 1;
-}
-
-void do_banner()
-{
- printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
- printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
-}
-
-void do_help()
-{
- printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
- " -e Extract without pathname (junk paths)\n" \
- " -x Extract with pathname\n" \
- " -v list files\n" \
- " -l list files\n" \
- " -d directory to extract into\n" \
- " -o overwrite files without prompting\n" \
- " -p extract crypted file using password\n\n");
-}
-
-
-int do_list(uf)
- unzFile uf;
-{
- uLong i;
- unz_global_info gi;
- int err;
-
- err = unzGetGlobalInfo (uf,&gi);
- if (err!=UNZ_OK)
- printf("error %d with zipfile in unzGetGlobalInfo \n",err);
- printf(" Length Method Size Ratio Date Time CRC-32 Name\n");
- printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
- for (i=0;i<gi.number_entry;i++)
- {
- char filename_inzip[256];
- unz_file_info file_info;
- uLong ratio=0;
- const char *string_method;
- char charCrypt=' ';
- err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
- if (err!=UNZ_OK)
- {
- printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
- break;
- }
- if (file_info.uncompressed_size>0)
- ratio = (file_info.compressed_size*100)/file_info.uncompressed_size;
-
- /* display a '*' if the file is crypted */
- if ((file_info.flag & 1) != 0)
- charCrypt='*';
-
- if (file_info.compression_method==0)
- string_method="Stored";
- else
- if (file_info.compression_method==Z_DEFLATED)
- {
- uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
- if (iLevel==0)
- string_method="Defl:N";
- else if (iLevel==1)
- string_method="Defl:X";
- else if ((iLevel==2) || (iLevel==3))
- string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
- }
- else
- string_method="Unkn. ";
-
- printf("%7lu %6s%c%7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n",
- file_info.uncompressed_size,string_method,
- charCrypt,
- file_info.compressed_size,
- ratio,
- (uLong)file_info.tmu_date.tm_mon + 1,
- (uLong)file_info.tmu_date.tm_mday,
- (uLong)file_info.tmu_date.tm_year % 100,
- (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min,
- (uLong)file_info.crc,filename_inzip);
- if ((i+1)<gi.number_entry)
- {
- err = unzGoToNextFile(uf);
- if (err!=UNZ_OK)
- {
- printf("error %d with zipfile in unzGoToNextFile\n",err);
- break;
- }
- }
- }
-
- return 0;
-}
-
-
-int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
- unzFile uf;
- const int* popt_extract_without_path;
- int* popt_overwrite;
- const char* password;
-{
- char filename_inzip[256];
- char* filename_withoutpath;
- char* p;
- int err=UNZ_OK;
- FILE *fout=NULL;
- void* buf;
- uInt size_buf;
-
- unz_file_info file_info;
- uLong ratio=0;
- err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
-
- if (err!=UNZ_OK)
- {
- printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
- return err;
- }
-
- size_buf = WRITEBUFFERSIZE;
- buf = (void*)malloc(size_buf);
- if (buf==NULL)
- {
- printf("Error allocating memory\n");
- return UNZ_INTERNALERROR;
- }
-
- p = filename_withoutpath = filename_inzip;
- while ((*p) != '\0')
- {
- if (((*p)=='/') || ((*p)=='\\'))
- filename_withoutpath = p+1;
- p++;
- }
-
- if ((*filename_withoutpath)=='\0')
- {
- if ((*popt_extract_without_path)==0)
- {
- printf("creating directory: %s\n",filename_inzip);
- mymkdir(filename_inzip);
- }
- }
- else
- {
- const char* write_filename;
- int skip=0;
-
- if ((*popt_extract_without_path)==0)
- write_filename = filename_inzip;
- else
- write_filename = filename_withoutpath;
-
- err = unzOpenCurrentFilePassword(uf,password);
- if (err!=UNZ_OK)
- {
- printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
- }
-
- if (((*popt_overwrite)==0) && (err==UNZ_OK))
- {
- char rep=0;
- FILE* ftestexist;
- ftestexist = fopen(write_filename,"rb");
- if (ftestexist!=NULL)
- {
- fclose(ftestexist);
- do
- {
- char answer[128];
- int ret;
-
- printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
- ret = scanf("%1s",answer);
- if (ret != 1)
- {
- exit(EXIT_FAILURE);
- }
- rep = answer[0] ;
- if ((rep>='a') && (rep<='z'))
- rep -= 0x20;
- }
- while ((rep!='Y') && (rep!='N') && (rep!='A'));
- }
-
- if (rep == 'N')
- skip = 1;
-
- if (rep == 'A')
- *popt_overwrite=1;
- }
-
- if ((skip==0) && (err==UNZ_OK))
- {
- fout=fopen(write_filename,"wb");
-
- /* some zipfile don't contain directory alone before file */
- if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
- (filename_withoutpath!=(char*)filename_inzip))
- {
- char c=*(filename_withoutpath-1);
- *(filename_withoutpath-1)='\0';
- makedir(write_filename);
- *(filename_withoutpath-1)=c;
- fout=fopen(write_filename,"wb");
- }
-
- if (fout==NULL)
- {
- printf("error opening %s\n",write_filename);
- }
- }
-
- if (fout!=NULL)
- {
- printf(" extracting: %s\n",write_filename);
-
- do
- {
- err = unzReadCurrentFile(uf,buf,size_buf);
- if (err<0)
- {
- printf("error %d with zipfile in unzReadCurrentFile\n",err);
- break;
- }
- if (err>0)
- if (fwrite(buf,err,1,fout)!=1)
- {
- printf("error in writing extracted file\n");
- err=UNZ_ERRNO;
- break;
- }
- }
- while (err>0);
- if (fout)
- fclose(fout);
-
- if (err==0)
- change_file_date(write_filename,file_info.dosDate,
- file_info.tmu_date);
- }
-
- if (err==UNZ_OK)
- {
- err = unzCloseCurrentFile (uf);
- if (err!=UNZ_OK)
- {
- printf("error %d with zipfile in unzCloseCurrentFile\n",err);
- }
- }
- else
- unzCloseCurrentFile(uf); /* don't lose the error */
- }
-
- free(buf);
- return err;
-}
-
-
-int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
- unzFile uf;
- int opt_extract_without_path;
- int opt_overwrite;
- const char* password;
-{
- uLong i;
- unz_global_info gi;
- int err;
- FILE* fout=NULL;
-
- err = unzGetGlobalInfo (uf,&gi);
- if (err!=UNZ_OK)
- printf("error %d with zipfile in unzGetGlobalInfo \n",err);
-
- for (i=0;i<gi.number_entry;i++)
- {
- if (do_extract_currentfile(uf,&opt_extract_without_path,
- &opt_overwrite,
- password) != UNZ_OK)
- break;
-
- if ((i+1)<gi.number_entry)
- {
- err = unzGoToNextFile(uf);
- if (err!=UNZ_OK)
- {
- printf("error %d with zipfile in unzGoToNextFile\n",err);
- break;
- }
- }
- }
-
- return 0;
-}
-
-int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
- unzFile uf;
- const char* filename;
- int opt_extract_without_path;
- int opt_overwrite;
- const char* password;
-{
- int err = UNZ_OK;
- if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
- {
- printf("file %s not found in the zipfile\n",filename);
- return 2;
- }
-
- if (do_extract_currentfile(uf,&opt_extract_without_path,
- &opt_overwrite,
- password) == UNZ_OK)
- return 0;
- else
- return 1;
-}
-
-
-int main(argc,argv)
- int argc;
- char *argv[];
-{
- const char *zipfilename=NULL;
- const char *filename_to_extract=NULL;
- const char *password=NULL;
- char filename_try[MAXFILENAME+16] = "";
- int i;
- int opt_do_list=0;
- int opt_do_extract=1;
- int opt_do_extract_withoutpath=0;
- int opt_overwrite=0;
- int opt_extractdir=0;
- const char *dirname=NULL;
- unzFile uf=NULL;
-
- do_banner();
- if (argc==1)
- {
- do_help();
- return 0;
- }
- else
- {
- for (i=1;i<argc;i++)
- {
- if ((*argv[i])=='-')
- {
- const char *p=argv[i]+1;
-
- while ((*p)!='\0')
- {
- char c=*(p++);;
- if ((c=='l') || (c=='L'))
- opt_do_list = 1;
- if ((c=='v') || (c=='V'))
- opt_do_list = 1;
- if ((c=='x') || (c=='X'))
- opt_do_extract = 1;
- if ((c=='e') || (c=='E'))
- opt_do_extract = opt_do_extract_withoutpath = 1;
- if ((c=='o') || (c=='O'))
- opt_overwrite=1;
- if ((c=='d') || (c=='D'))
- {
- opt_extractdir=1;
- dirname=argv[i+1];
- }
-
- if (((c=='p') || (c=='P')) && (i+1<argc))
- {
- password=argv[i+1];
- i++;
- }
- }
- }
- else
- {
- if (zipfilename == NULL)
- zipfilename = argv[i];
- else if ((filename_to_extract==NULL) && (!opt_extractdir))
- filename_to_extract = argv[i] ;
- }
- }
- }
-
- if (zipfilename!=NULL)
- {
-
-# ifdef USEWIN32IOAPI
- zlib_filefunc_def ffunc;
-# endif
-
- strncpy(filename_try, zipfilename,MAXFILENAME-1);
- /* strncpy doesnt append the trailing NULL, of the string is too long. */
- filename_try[ MAXFILENAME ] = '\0';
-
-# ifdef USEWIN32IOAPI
- fill_win32_filefunc(&ffunc);
- uf = unzOpen2(zipfilename,&ffunc);
-# else
- uf = unzOpen(zipfilename);
-# endif
- if (uf==NULL)
- {
- strcat(filename_try,".zip");
-# ifdef USEWIN32IOAPI
- uf = unzOpen2(filename_try,&ffunc);
-# else
- uf = unzOpen(filename_try);
-# endif
- }
- }
-
- if (uf==NULL)
- {
- printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename);
- return 1;
- }
- printf("%s opened\n",filename_try);
-
- if (opt_do_list==1)
- return do_list(uf);
- else if (opt_do_extract==1)
- {
- if (opt_extractdir && chdir(dirname))
- {
- printf("Error changing into %s, aborting\n", dirname);
- exit(-1);
- }
-
- if (filename_to_extract == NULL)
- return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
- else
- return do_extract_onefile(uf,filename_to_extract,
- opt_do_extract_withoutpath,opt_overwrite,password);
- }
- unzCloseCurrentFile(uf);
-
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/minizip.c b/funtools/util/zlib-1.2.3/contrib/minizip/minizip.c
deleted file mode 100644
index f2dfecd..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/minizip.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- minizip.c
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#ifdef unix
-# include <unistd.h>
-# include <utime.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-#else
-# include <direct.h>
-# include <io.h>
-#endif
-
-#include "zip.h"
-
-#ifdef WIN32
-#define USEWIN32IOAPI
-#include "iowin32.h"
-#endif
-
-
-
-#define WRITEBUFFERSIZE (16384)
-#define MAXFILENAME (256)
-
-#ifdef WIN32
-uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
- tm_zip *tmzip; /* return value: access, modific. and creation times */
- uLong *dt; /* dostime */
-{
- int ret = 0;
- {
- FILETIME ftLocal;
- HANDLE hFind;
- WIN32_FIND_DATA ff32;
-
- hFind = FindFirstFile(f,&ff32);
- if (hFind != INVALID_HANDLE_VALUE)
- {
- FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
- FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
- FindClose(hFind);
- ret = 1;
- }
- }
- return ret;
-}
-#else
-#ifdef unix
-uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
- tm_zip *tmzip; /* return value: access, modific. and creation times */
- uLong *dt; /* dostime */
-{
- int ret=0;
- struct stat s; /* results of stat() */
- struct tm* filedate;
- time_t tm_t=0;
-
- if (strcmp(f,"-")!=0)
- {
- char name[MAXFILENAME+1];
- int len = strlen(f);
- if (len > MAXFILENAME)
- len = MAXFILENAME;
-
- strncpy(name, f,MAXFILENAME-1);
- /* strncpy doesnt append the trailing NULL, of the string is too long. */
- name[ MAXFILENAME ] = '\0';
-
- if (name[len - 1] == '/')
- name[len - 1] = '\0';
- /* not all systems allow stat'ing a file with / appended */
- if (stat(name,&s)==0)
- {
- tm_t = s.st_mtime;
- ret = 1;
- }
- }
- filedate = localtime(&tm_t);
-
- tmzip->tm_sec = filedate->tm_sec;
- tmzip->tm_min = filedate->tm_min;
- tmzip->tm_hour = filedate->tm_hour;
- tmzip->tm_mday = filedate->tm_mday;
- tmzip->tm_mon = filedate->tm_mon ;
- tmzip->tm_year = filedate->tm_year;
-
- return ret;
-}
-#else
-uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
- tm_zip *tmzip; /* return value: access, modific. and creation times */
- uLong *dt; /* dostime */
-{
- return 0;
-}
-#endif
-#endif
-
-
-
-
-int check_exist_file(filename)
- const char* filename;
-{
- FILE* ftestexist;
- int ret = 1;
- ftestexist = fopen(filename,"rb");
- if (ftestexist==NULL)
- ret = 0;
- else
- fclose(ftestexist);
- return ret;
-}
-
-void do_banner()
-{
- printf("MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant\n");
- printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
-}
-
-void do_help()
-{
- printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \
- " -o Overwrite existing file.zip\n" \
- " -a Append to existing file.zip\n" \
- " -0 Store only\n" \
- " -1 Compress faster\n" \
- " -9 Compress better\n\n");
-}
-
-/* calculate the CRC32 of a file,
- because to encrypt a file, we need known the CRC32 of the file before */
-int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
-{
- unsigned long calculate_crc=0;
- int err=ZIP_OK;
- FILE * fin = fopen(filenameinzip,"rb");
- unsigned long size_read = 0;
- unsigned long total_read = 0;
- if (fin==NULL)
- {
- err = ZIP_ERRNO;
- }
-
- if (err == ZIP_OK)
- do
- {
- err = ZIP_OK;
- size_read = (int)fread(buf,1,size_buf,fin);
- if (size_read < size_buf)
- if (feof(fin)==0)
- {
- printf("error in reading %s\n",filenameinzip);
- err = ZIP_ERRNO;
- }
-
- if (size_read>0)
- calculate_crc = crc32(calculate_crc,buf,size_read);
- total_read += size_read;
-
- } while ((err == ZIP_OK) && (size_read>0));
-
- if (fin)
- fclose(fin);
-
- *result_crc=calculate_crc;
- printf("file %s crc %x\n",filenameinzip,calculate_crc);
- return err;
-}
-
-int main(argc,argv)
- int argc;
- char *argv[];
-{
- int i;
- int opt_overwrite=0;
- int opt_compress_level=Z_DEFAULT_COMPRESSION;
- int zipfilenamearg = 0;
- char filename_try[MAXFILENAME+16];
- int zipok;
- int err=0;
- int size_buf=0;
- void* buf=NULL;
- const char* password=NULL;
-
-
- do_banner();
- if (argc==1)
- {
- do_help();
- return 0;
- }
- else
- {
- for (i=1;i<argc;i++)
- {
- if ((*argv[i])=='-')
- {
- const char *p=argv[i]+1;
-
- while ((*p)!='\0')
- {
- char c=*(p++);;
- if ((c=='o') || (c=='O'))
- opt_overwrite = 1;
- if ((c=='a') || (c=='A'))
- opt_overwrite = 2;
- if ((c>='0') && (c<='9'))
- opt_compress_level = c-'0';
-
- if (((c=='p') || (c=='P')) && (i+1<argc))
- {
- password=argv[i+1];
- i++;
- }
- }
- }
- else
- if (zipfilenamearg == 0)
- zipfilenamearg = i ;
- }
- }
-
- size_buf = WRITEBUFFERSIZE;
- buf = (void*)malloc(size_buf);
- if (buf==NULL)
- {
- printf("Error allocating memory\n");
- return ZIP_INTERNALERROR;
- }
-
- if (zipfilenamearg==0)
- zipok=0;
- else
- {
- int i,len;
- int dot_found=0;
-
- zipok = 1 ;
- strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
- /* strncpy doesnt append the trailing NULL, of the string is too long. */
- filename_try[ MAXFILENAME ] = '\0';
-
- len=(int)strlen(filename_try);
- for (i=0;i<len;i++)
- if (filename_try[i]=='.')
- dot_found=1;
-
- if (dot_found==0)
- strcat(filename_try,".zip");
-
- if (opt_overwrite==2)
- {
- /* if the file don't exist, we not append file */
- if (check_exist_file(filename_try)==0)
- opt_overwrite=1;
- }
- else
- if (opt_overwrite==0)
- if (check_exist_file(filename_try)!=0)
- {
- char rep=0;
- do
- {
- char answer[128];
- int ret;
- printf("The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
- ret = scanf("%1s",answer);
- if (ret != 1)
- {
- exit(EXIT_FAILURE);
- }
- rep = answer[0] ;
- if ((rep>='a') && (rep<='z'))
- rep -= 0x20;
- }
- while ((rep!='Y') && (rep!='N') && (rep!='A'));
- if (rep=='N')
- zipok = 0;
- if (rep=='A')
- opt_overwrite = 2;
- }
- }
-
- if (zipok==1)
- {
- zipFile zf;
- int errclose;
-# ifdef USEWIN32IOAPI
- zlib_filefunc_def ffunc;
- fill_win32_filefunc(&ffunc);
- zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc);
-# else
- zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0);
-# endif
-
- if (zf == NULL)
- {
- printf("error opening %s\n",filename_try);
- err= ZIP_ERRNO;
- }
- else
- printf("creating %s\n",filename_try);
-
- for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
- {
- if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
- ((argv[i][1]=='o') || (argv[i][1]=='O') ||
- (argv[i][1]=='a') || (argv[i][1]=='A') ||
- (argv[i][1]=='p') || (argv[i][1]=='P') ||
- ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
- (strlen(argv[i]) == 2)))
- {
- FILE * fin;
- int size_read;
- const char* filenameinzip = argv[i];
- zip_fileinfo zi;
- unsigned long crcFile=0;
-
- zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
- zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
- zi.dosDate = 0;
- zi.internal_fa = 0;
- zi.external_fa = 0;
- filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
-
-/*
- err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
- NULL,0,NULL,0,NULL / * comment * /,
- (opt_compress_level != 0) ? Z_DEFLATED : 0,
- opt_compress_level);
-*/
- if ((password != NULL) && (err==ZIP_OK))
- err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
-
- err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,
- NULL,0,NULL,0,NULL /* comment*/,
- (opt_compress_level != 0) ? Z_DEFLATED : 0,
- opt_compress_level,0,
- /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
- -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
- password,crcFile);
-
- if (err != ZIP_OK)
- printf("error in opening %s in zipfile\n",filenameinzip);
- else
- {
- fin = fopen(filenameinzip,"rb");
- if (fin==NULL)
- {
- err=ZIP_ERRNO;
- printf("error in opening %s for reading\n",filenameinzip);
- }
- }
-
- if (err == ZIP_OK)
- do
- {
- err = ZIP_OK;
- size_read = (int)fread(buf,1,size_buf,fin);
- if (size_read < size_buf)
- if (feof(fin)==0)
- {
- printf("error in reading %s\n",filenameinzip);
- err = ZIP_ERRNO;
- }
-
- if (size_read>0)
- {
- err = zipWriteInFileInZip (zf,buf,size_read);
- if (err<0)
- {
- printf("error in writing %s in the zipfile\n",
- filenameinzip);
- }
-
- }
- } while ((err == ZIP_OK) && (size_read>0));
-
- if (fin)
- fclose(fin);
-
- if (err<0)
- err=ZIP_ERRNO;
- else
- {
- err = zipCloseFileInZip(zf);
- if (err!=ZIP_OK)
- printf("error in closing %s in the zipfile\n",
- filenameinzip);
- }
- }
- }
- errclose = zipClose(zf,NULL);
- if (errclose != ZIP_OK)
- printf("error in closing %s\n",filename_try);
- }
- else
- {
- do_help();
- }
-
- free(buf);
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/mztools.c b/funtools/util/zlib-1.2.3/contrib/minizip/mztools.c
deleted file mode 100644
index 8a50ee4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/mztools.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- Additional tools for Minizip
- Code: Xavier Roche '2004
- License: Same as ZLIB (www.gzip.org)
-*/
-
-/* Code */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "zlib.h"
-#include "unzip.h"
-
-#define READ_8(adr) ((unsigned char)*(adr))
-#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
-#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
-
-#define WRITE_8(buff, n) do { \
- *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
-} while(0)
-#define WRITE_16(buff, n) do { \
- WRITE_8((unsigned char*)(buff), n); \
- WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
-} while(0)
-#define WRITE_32(buff, n) do { \
- WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
- WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
-} while(0)
-
-extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
-const char* file;
-const char* fileOut;
-const char* fileOutTmp;
-uLong* nRecovered;
-uLong* bytesRecovered;
-{
- int err = Z_OK;
- FILE* fpZip = fopen(file, "rb");
- FILE* fpOut = fopen(fileOut, "wb");
- FILE* fpOutCD = fopen(fileOutTmp, "wb");
- if (fpZip != NULL && fpOut != NULL) {
- int entries = 0;
- uLong totalBytes = 0;
- char header[30];
- char filename[256];
- char extra[1024];
- int offset = 0;
- int offsetCD = 0;
- while ( fread(header, 1, 30, fpZip) == 30 ) {
- int currentOffset = offset;
-
- /* File entry */
- if (READ_32(header) == 0x04034b50) {
- unsigned int version = READ_16(header + 4);
- unsigned int gpflag = READ_16(header + 6);
- unsigned int method = READ_16(header + 8);
- unsigned int filetime = READ_16(header + 10);
- unsigned int filedate = READ_16(header + 12);
- unsigned int crc = READ_32(header + 14); /* crc */
- unsigned int cpsize = READ_32(header + 18); /* compressed size */
- unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
- unsigned int fnsize = READ_16(header + 26); /* file name length */
- unsigned int extsize = READ_16(header + 28); /* extra field length */
- filename[0] = extra[0] = '\0';
-
- /* Header */
- if (fwrite(header, 1, 30, fpOut) == 30) {
- offset += 30;
- } else {
- err = Z_ERRNO;
- break;
- }
-
- /* Filename */
- if (fnsize > 0) {
- if (fread(filename, 1, fnsize, fpZip) == fnsize) {
- if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
- offset += fnsize;
- } else {
- err = Z_ERRNO;
- break;
- }
- } else {
- err = Z_ERRNO;
- break;
- }
- } else {
- err = Z_STREAM_ERROR;
- break;
- }
-
- /* Extra field */
- if (extsize > 0) {
- if (fread(extra, 1, extsize, fpZip) == extsize) {
- if (fwrite(extra, 1, extsize, fpOut) == extsize) {
- offset += extsize;
- } else {
- err = Z_ERRNO;
- break;
- }
- } else {
- err = Z_ERRNO;
- break;
- }
- }
-
- /* Data */
- {
- int dataSize = cpsize;
- if (dataSize == 0) {
- dataSize = uncpsize;
- }
- if (dataSize > 0) {
- char* data = malloc(dataSize);
- if (data != NULL) {
- if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
- if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
- offset += dataSize;
- totalBytes += dataSize;
- } else {
- err = Z_ERRNO;
- }
- } else {
- err = Z_ERRNO;
- }
- free(data);
- if (err != Z_OK) {
- break;
- }
- } else {
- err = Z_MEM_ERROR;
- break;
- }
- }
- }
-
- /* Central directory entry */
- {
- char header[46];
- char* comment = "";
- int comsize = (int) strlen(comment);
- WRITE_32(header, 0x02014b50);
- WRITE_16(header + 4, version);
- WRITE_16(header + 6, version);
- WRITE_16(header + 8, gpflag);
- WRITE_16(header + 10, method);
- WRITE_16(header + 12, filetime);
- WRITE_16(header + 14, filedate);
- WRITE_32(header + 16, crc);
- WRITE_32(header + 20, cpsize);
- WRITE_32(header + 24, uncpsize);
- WRITE_16(header + 28, fnsize);
- WRITE_16(header + 30, extsize);
- WRITE_16(header + 32, comsize);
- WRITE_16(header + 34, 0); /* disk # */
- WRITE_16(header + 36, 0); /* int attrb */
- WRITE_32(header + 38, 0); /* ext attrb */
- WRITE_32(header + 42, currentOffset);
- /* Header */
- if (fwrite(header, 1, 46, fpOutCD) == 46) {
- offsetCD += 46;
-
- /* Filename */
- if (fnsize > 0) {
- if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
- offsetCD += fnsize;
- } else {
- err = Z_ERRNO;
- break;
- }
- } else {
- err = Z_STREAM_ERROR;
- break;
- }
-
- /* Extra field */
- if (extsize > 0) {
- if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
- offsetCD += extsize;
- } else {
- err = Z_ERRNO;
- break;
- }
- }
-
- /* Comment field */
- if (comsize > 0) {
- if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
- offsetCD += comsize;
- } else {
- err = Z_ERRNO;
- break;
- }
- }
-
-
- } else {
- err = Z_ERRNO;
- break;
- }
- }
-
- /* Success */
- entries++;
-
- } else {
- break;
- }
- }
-
- /* Final central directory */
- {
- int entriesZip = entries;
- char header[22];
- char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
- int comsize = (int) strlen(comment);
- if (entriesZip > 0xffff) {
- entriesZip = 0xffff;
- }
- WRITE_32(header, 0x06054b50);
- WRITE_16(header + 4, 0); /* disk # */
- WRITE_16(header + 6, 0); /* disk # */
- WRITE_16(header + 8, entriesZip); /* hack */
- WRITE_16(header + 10, entriesZip); /* hack */
- WRITE_32(header + 12, offsetCD); /* size of CD */
- WRITE_32(header + 16, offset); /* offset to CD */
- WRITE_16(header + 20, comsize); /* comment */
-
- /* Header */
- if (fwrite(header, 1, 22, fpOutCD) == 22) {
-
- /* Comment field */
- if (comsize > 0) {
- if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
- err = Z_ERRNO;
- }
- }
-
- } else {
- err = Z_ERRNO;
- }
- }
-
- /* Final merge (file + central directory) */
- fclose(fpOutCD);
- if (err == Z_OK) {
- fpOutCD = fopen(fileOutTmp, "rb");
- if (fpOutCD != NULL) {
- int nRead;
- char buffer[8192];
- while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
- if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
- err = Z_ERRNO;
- break;
- }
- }
- fclose(fpOutCD);
- }
- }
-
- /* Close */
- fclose(fpZip);
- fclose(fpOut);
-
- /* Wipe temporary file */
- (void)remove(fileOutTmp);
-
- /* Number of recovered entries */
- if (err == Z_OK) {
- if (nRecovered != NULL) {
- *nRecovered = entries;
- }
- if (bytesRecovered != NULL) {
- *bytesRecovered = totalBytes;
- }
- }
- } else {
- err = Z_STREAM_ERROR;
- }
- return err;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/mztools.h b/funtools/util/zlib-1.2.3/contrib/minizip/mztools.h
deleted file mode 100644
index eee78dc..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/mztools.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Additional tools for Minizip
- Code: Xavier Roche '2004
- License: Same as ZLIB (www.gzip.org)
-*/
-
-#ifndef _zip_tools_H
-#define _zip_tools_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#include "unzip.h"
-
-/* Repair a ZIP file (missing central directory)
- file: file to recover
- fileOut: output file after recovery
- fileOutTmp: temporary file name used for recovery
-*/
-extern int ZEXPORT unzRepair(const char* file,
- const char* fileOut,
- const char* fileOutTmp,
- uLong* nRecovered,
- uLong* bytesRecovered);
-
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/unzip.c b/funtools/util/zlib-1.2.3/contrib/minizip/unzip.c
deleted file mode 100644
index 9ad4766..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/unzip.c
+++ /dev/null
@@ -1,1598 +0,0 @@
-/* unzip.c -- IO for uncompress .zip files using zlib
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-
- Read unzip.h for more info
-*/
-
-/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
-compatibility with older software. The following is from the original crypt.c. Code
-woven in by Terry Thorsen 1/2003.
-*/
-/*
- Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
-
- See the accompanying file LICENSE, version 2000-Apr-09 or later
- (the contents of which are also included in zip.h) for terms of use.
- If, for some reason, all these files are missing, the Info-ZIP license
- also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
-*/
-/*
- crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
-
- The encryption/decryption parts of this source code (as opposed to the
- non-echoing password parts) were originally written in Europe. The
- whole source package can be freely distributed, including from the USA.
- (Prior to January 2000, re-export from the US was a violation of US law.)
- */
-
-/*
- This encryption code is a direct transcription of the algorithm from
- Roger Schlafly, described by Phil Katz in the file appnote.txt. This
- file (appnote.txt) is distributed with the PKZIP program (even in the
- version without encryption capabilities).
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "zlib.h"
-#include "unzip.h"
-
-#ifdef STDC
-# include <stddef.h>
-# include <string.h>
-# include <stdlib.h>
-#endif
-#ifdef NO_ERRNO_H
- extern int errno;
-#else
-# include <errno.h>
-#endif
-
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-
-#ifndef CASESENSITIVITYDEFAULT_NO
-# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
-# define CASESENSITIVITYDEFAULT_NO
-# endif
-#endif
-
-
-#ifndef UNZ_BUFSIZE
-#define UNZ_BUFSIZE (16384)
-#endif
-
-#ifndef UNZ_MAXFILENAMEINZIP
-#define UNZ_MAXFILENAMEINZIP (256)
-#endif
-
-#ifndef ALLOC
-# define ALLOC(size) (malloc(size))
-#endif
-#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
-#endif
-
-#define SIZECENTRALDIRITEM (0x2e)
-#define SIZEZIPLOCALHEADER (0x1e)
-
-
-
-
-const char unz_copyright[] =
- " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
-
-/* unz_file_info_interntal contain internal info about a file in zipfile*/
-typedef struct unz_file_info_internal_s
-{
- uLong offset_curfile;/* relative offset of local header 4 bytes */
-} unz_file_info_internal;
-
-
-/* file_in_zip_read_info_s contain internal information about a file in zipfile,
- when reading and decompress it */
-typedef struct
-{
- char *read_buffer; /* internal buffer for compressed data */
- z_stream stream; /* zLib stream structure for inflate */
-
- uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
- uLong stream_initialised; /* flag set if stream structure is initialised*/
-
- uLong offset_local_extrafield;/* offset of the local extra field */
- uInt size_local_extrafield;/* size of the local extra field */
- uLong pos_local_extrafield; /* position in the local extra field in read*/
-
- uLong crc32; /* crc32 of all data uncompressed */
- uLong crc32_wait; /* crc32 we must obtain after decompress all */
- uLong rest_read_compressed; /* number of byte to be decompressed */
- uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
- zlib_filefunc_def z_filefunc;
- voidpf filestream; /* io structore of the zipfile */
- uLong compression_method; /* compression method (0==store) */
- uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
- int raw;
-} file_in_zip_read_info_s;
-
-
-/* unz_s contain internal information about the zipfile
-*/
-typedef struct
-{
- zlib_filefunc_def z_filefunc;
- voidpf filestream; /* io structore of the zipfile */
- unz_global_info gi; /* public global information */
- uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
- uLong num_file; /* number of the current file in the zipfile*/
- uLong pos_in_central_dir; /* pos of the current file in the central dir*/
- uLong current_file_ok; /* flag about the usability of the current file*/
- uLong central_pos; /* position of the beginning of the central dir*/
-
- uLong size_central_dir; /* size of the central directory */
- uLong offset_central_dir; /* offset of start of central directory with
- respect to the starting disk number */
-
- unz_file_info cur_file_info; /* public info about the current file in zip*/
- unz_file_info_internal cur_file_info_internal; /* private info about it*/
- file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
- file if we are decompressing it */
- int encrypted;
-# ifndef NOUNCRYPT
- unsigned long keys[3]; /* keys defining the pseudo-random sequence */
- const unsigned long* pcrc_32_tab;
-# endif
-} unz_s;
-
-
-#ifndef NOUNCRYPT
-#include "crypt.h"
-#endif
-
-/* ===========================================================================
- Read a byte from a gz_stream; update next_in and avail_in. Return EOF
- for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
-*/
-
-
-local int unzlocal_getByte OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream,
- int *pi));
-
-local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- int *pi;
-{
- unsigned char c;
- int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
- if (err==1)
- {
- *pi = (int)c;
- return UNZ_OK;
- }
- else
- {
- if (ZERROR(*pzlib_filefunc_def,filestream))
- return UNZ_ERRNO;
- else
- return UNZ_EOF;
- }
-}
-
-
-/* ===========================================================================
- Reads a long in LSB order from the given gz_stream. Sets
-*/
-local int unzlocal_getShort OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream,
- uLong *pX));
-
-local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- uLong *pX;
-{
- uLong x ;
- int i;
- int err;
-
- err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
- x = (uLong)i;
-
- if (err==UNZ_OK)
- err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<8;
-
- if (err==UNZ_OK)
- *pX = x;
- else
- *pX = 0;
- return err;
-}
-
-local int unzlocal_getLong OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream,
- uLong *pX));
-
-local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- uLong *pX;
-{
- uLong x ;
- int i;
- int err;
-
- err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
- x = (uLong)i;
-
- if (err==UNZ_OK)
- err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<8;
-
- if (err==UNZ_OK)
- err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<16;
-
- if (err==UNZ_OK)
- err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<24;
-
- if (err==UNZ_OK)
- *pX = x;
- else
- *pX = 0;
- return err;
-}
-
-
-/* My own strcmpi / strcasecmp */
-local int strcmpcasenosensitive_internal (fileName1,fileName2)
- const char* fileName1;
- const char* fileName2;
-{
- for (;;)
- {
- char c1=*(fileName1++);
- char c2=*(fileName2++);
- if ((c1>='a') && (c1<='z'))
- c1 -= 0x20;
- if ((c2>='a') && (c2<='z'))
- c2 -= 0x20;
- if (c1=='\0')
- return ((c2=='\0') ? 0 : -1);
- if (c2=='\0')
- return 1;
- if (c1<c2)
- return -1;
- if (c1>c2)
- return 1;
- }
-}
-
-
-#ifdef CASESENSITIVITYDEFAULT_NO
-#define CASESENSITIVITYDEFAULTVALUE 2
-#else
-#define CASESENSITIVITYDEFAULTVALUE 1
-#endif
-
-#ifndef STRCMPCASENOSENTIVEFUNCTION
-#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
-#endif
-
-/*
- Compare two filename (fileName1,fileName2).
- If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
- If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
- or strcasecmp)
- If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
- (like 1 on Unix, 2 on Windows)
-
-*/
-extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
- const char* fileName1;
- const char* fileName2;
- int iCaseSensitivity;
-{
- if (iCaseSensitivity==0)
- iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
-
- if (iCaseSensitivity==1)
- return strcmp(fileName1,fileName2);
-
- return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
-}
-
-#ifndef BUFREADCOMMENT
-#define BUFREADCOMMENT (0x400)
-#endif
-
-/*
- Locate the Central directory of a zipfile (at the end, just before
- the global comment)
-*/
-local uLong unzlocal_SearchCentralDir OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream));
-
-local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
-{
- unsigned char* buf;
- uLong uSizeFile;
- uLong uBackRead;
- uLong uMaxBack=0xffff; /* maximum size of global comment */
- uLong uPosFound=0;
-
- if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
- return 0;
-
-
- uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
-
- if (uMaxBack>uSizeFile)
- uMaxBack = uSizeFile;
-
- buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
- if (buf==NULL)
- return 0;
-
- uBackRead = 4;
- while (uBackRead<uMaxBack)
- {
- uLong uReadSize,uReadPos ;
- int i;
- if (uBackRead+BUFREADCOMMENT>uMaxBack)
- uBackRead = uMaxBack;
- else
- uBackRead+=BUFREADCOMMENT;
- uReadPos = uSizeFile-uBackRead ;
-
- uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
- (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
- if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
- break;
-
- if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
- break;
-
- for (i=(int)uReadSize-3; (i--)>0;)
- if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
- ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
- {
- uPosFound = uReadPos+i;
- break;
- }
-
- if (uPosFound!=0)
- break;
- }
- TRYFREE(buf);
- return uPosFound;
-}
-
-/*
- Open a Zip file. path contain the full pathname (by example,
- on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer
- "zlib/zlib114.zip".
- If the zipfile cannot be opened (file doesn't exist or in not valid), the
- return value is NULL.
- Else, the return value is a unzFile Handle, usable with other function
- of this unzip package.
-*/
-extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
- const char *path;
- zlib_filefunc_def* pzlib_filefunc_def;
-{
- unz_s us;
- unz_s *s;
- uLong central_pos,uL;
-
- uLong number_disk; /* number of the current dist, used for
- spaning ZIP, unsupported, always 0*/
- uLong number_disk_with_CD; /* number the the disk with central dir, used
- for spaning ZIP, unsupported, always 0*/
- uLong number_entry_CD; /* total number of entries in
- the central dir
- (same than number_entry on nospan) */
-
- int err=UNZ_OK;
-
- if (unz_copyright[0]!=' ')
- return NULL;
-
- if (pzlib_filefunc_def==NULL)
- fill_fopen_filefunc(&us.z_filefunc);
- else
- us.z_filefunc = *pzlib_filefunc_def;
-
- us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque,
- path,
- ZLIB_FILEFUNC_MODE_READ |
- ZLIB_FILEFUNC_MODE_EXISTING);
- if (us.filestream==NULL)
- return NULL;
-
- central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream);
- if (central_pos==0)
- err=UNZ_ERRNO;
-
- if (ZSEEK(us.z_filefunc, us.filestream,
- central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
- err=UNZ_ERRNO;
-
- /* the signature, already checked */
- if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- /* number of this disk */
- if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- /* number of the disk with the start of the central directory */
- if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- /* total number of entries in the central dir on this disk */
- if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- /* total number of entries in the central dir */
- if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- if ((number_entry_CD!=us.gi.number_entry) ||
- (number_disk_with_CD!=0) ||
- (number_disk!=0))
- err=UNZ_BADZIPFILE;
-
- /* size of the central directory */
- if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- /* offset of start of central directory with respect to the
- starting disk number */
- if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- /* zipfile comment length */
- if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
- err=UNZ_ERRNO;
-
- if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
- (err==UNZ_OK))
- err=UNZ_BADZIPFILE;
-
- if (err!=UNZ_OK)
- {
- ZCLOSE(us.z_filefunc, us.filestream);
- return NULL;
- }
-
- us.byte_before_the_zipfile = central_pos -
- (us.offset_central_dir+us.size_central_dir);
- us.central_pos = central_pos;
- us.pfile_in_zip_read = NULL;
- us.encrypted = 0;
-
-
- s=(unz_s*)ALLOC(sizeof(unz_s));
- *s=us;
- unzGoToFirstFile((unzFile)s);
- return (unzFile)s;
-}
-
-
-extern unzFile ZEXPORT unzOpen (path)
- const char *path;
-{
- return unzOpen2(path, NULL);
-}
-
-/*
- Close a ZipFile opened with unzipOpen.
- If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
- these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
- return UNZ_OK if there is no problem. */
-extern int ZEXPORT unzClose (file)
- unzFile file;
-{
- unz_s* s;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
-
- if (s->pfile_in_zip_read!=NULL)
- unzCloseCurrentFile(file);
-
- ZCLOSE(s->z_filefunc, s->filestream);
- TRYFREE(s);
- return UNZ_OK;
-}
-
-
-/*
- Write info about the ZipFile in the *pglobal_info structure.
- No preparation of the structure is needed
- return UNZ_OK if there is no problem. */
-extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
- unzFile file;
- unz_global_info *pglobal_info;
-{
- unz_s* s;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- *pglobal_info=s->gi;
- return UNZ_OK;
-}
-
-
-/*
- Translate date/time from Dos format to tm_unz (readable more easilty)
-*/
-local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
- uLong ulDosDate;
- tm_unz* ptm;
-{
- uLong uDate;
- uDate = (uLong)(ulDosDate>>16);
- ptm->tm_mday = (uInt)(uDate&0x1f) ;
- ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
- ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
-
- ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
- ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
- ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
-}
-
-/*
- Get Info about the current file in the zipfile, with internal only info
-*/
-local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
- unz_file_info *pfile_info,
- unz_file_info_internal
- *pfile_info_internal,
- char *szFileName,
- uLong fileNameBufferSize,
- void *extraField,
- uLong extraFieldBufferSize,
- char *szComment,
- uLong commentBufferSize));
-
-local int unzlocal_GetCurrentFileInfoInternal (file,
- pfile_info,
- pfile_info_internal,
- szFileName, fileNameBufferSize,
- extraField, extraFieldBufferSize,
- szComment, commentBufferSize)
- unzFile file;
- unz_file_info *pfile_info;
- unz_file_info_internal *pfile_info_internal;
- char *szFileName;
- uLong fileNameBufferSize;
- void *extraField;
- uLong extraFieldBufferSize;
- char *szComment;
- uLong commentBufferSize;
-{
- unz_s* s;
- unz_file_info file_info;
- unz_file_info_internal file_info_internal;
- int err=UNZ_OK;
- uLong uMagic;
- long lSeek=0;
-
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- if (ZSEEK(s->z_filefunc, s->filestream,
- s->pos_in_central_dir+s->byte_before_the_zipfile,
- ZLIB_FILEFUNC_SEEK_SET)!=0)
- err=UNZ_ERRNO;
-
-
- /* we check the magic */
- if (err==UNZ_OK)
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
- err=UNZ_ERRNO;
- else if (uMagic!=0x02014b50)
- err=UNZ_BADZIPFILE;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
- err=UNZ_ERRNO;
-
- unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
- err=UNZ_ERRNO;
-
- lSeek+=file_info.size_filename;
- if ((err==UNZ_OK) && (szFileName!=NULL))
- {
- uLong uSizeRead ;
- if (file_info.size_filename<fileNameBufferSize)
- {
- *(szFileName+file_info.size_filename)='\0';
- uSizeRead = file_info.size_filename;
- }
- else
- uSizeRead = fileNameBufferSize;
-
- if ((file_info.size_filename>0) && (fileNameBufferSize>0))
- if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
- err=UNZ_ERRNO;
- lSeek -= uSizeRead;
- }
-
-
- if ((err==UNZ_OK) && (extraField!=NULL))
- {
- uLong uSizeRead ;
- if (file_info.size_file_extra<extraFieldBufferSize)
- uSizeRead = file_info.size_file_extra;
- else
- uSizeRead = extraFieldBufferSize;
-
- if (lSeek!=0)
- if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
- if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
- if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
- err=UNZ_ERRNO;
- lSeek += file_info.size_file_extra - uSizeRead;
- }
- else
- lSeek+=file_info.size_file_extra;
-
-
- if ((err==UNZ_OK) && (szComment!=NULL))
- {
- uLong uSizeRead ;
- if (file_info.size_file_comment<commentBufferSize)
- {
- *(szComment+file_info.size_file_comment)='\0';
- uSizeRead = file_info.size_file_comment;
- }
- else
- uSizeRead = commentBufferSize;
-
- if (lSeek!=0)
- if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
- if ((file_info.size_file_comment>0) && (commentBufferSize>0))
- if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
- err=UNZ_ERRNO;
- lSeek+=file_info.size_file_comment - uSizeRead;
- }
- else
- lSeek+=file_info.size_file_comment;
-
- if ((err==UNZ_OK) && (pfile_info!=NULL))
- *pfile_info=file_info;
-
- if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
- *pfile_info_internal=file_info_internal;
-
- return err;
-}
-
-
-
-/*
- Write info about the ZipFile in the *pglobal_info structure.
- No preparation of the structure is needed
- return UNZ_OK if there is no problem.
-*/
-extern int ZEXPORT unzGetCurrentFileInfo (file,
- pfile_info,
- szFileName, fileNameBufferSize,
- extraField, extraFieldBufferSize,
- szComment, commentBufferSize)
- unzFile file;
- unz_file_info *pfile_info;
- char *szFileName;
- uLong fileNameBufferSize;
- void *extraField;
- uLong extraFieldBufferSize;
- char *szComment;
- uLong commentBufferSize;
-{
- return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
- szFileName,fileNameBufferSize,
- extraField,extraFieldBufferSize,
- szComment,commentBufferSize);
-}
-
-/*
- Set the current file of the zipfile to the first file.
- return UNZ_OK if there is no problem
-*/
-extern int ZEXPORT unzGoToFirstFile (file)
- unzFile file;
-{
- int err=UNZ_OK;
- unz_s* s;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- s->pos_in_central_dir=s->offset_central_dir;
- s->num_file=0;
- err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
- &s->cur_file_info_internal,
- NULL,0,NULL,0,NULL,0);
- s->current_file_ok = (err == UNZ_OK);
- return err;
-}
-
-/*
- Set the current file of the zipfile to the next file.
- return UNZ_OK if there is no problem
- return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
-*/
-extern int ZEXPORT unzGoToNextFile (file)
- unzFile file;
-{
- unz_s* s;
- int err;
-
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- if (!s->current_file_ok)
- return UNZ_END_OF_LIST_OF_FILE;
- if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
- if (s->num_file+1==s->gi.number_entry)
- return UNZ_END_OF_LIST_OF_FILE;
-
- s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
- s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
- s->num_file++;
- err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
- &s->cur_file_info_internal,
- NULL,0,NULL,0,NULL,0);
- s->current_file_ok = (err == UNZ_OK);
- return err;
-}
-
-
-/*
- Try locate the file szFileName in the zipfile.
- For the iCaseSensitivity signification, see unzipStringFileNameCompare
-
- return value :
- UNZ_OK if the file is found. It becomes the current file.
- UNZ_END_OF_LIST_OF_FILE if the file is not found
-*/
-extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
- unzFile file;
- const char *szFileName;
- int iCaseSensitivity;
-{
- unz_s* s;
- int err;
-
- /* We remember the 'current' position in the file so that we can jump
- * back there if we fail.
- */
- unz_file_info cur_file_infoSaved;
- unz_file_info_internal cur_file_info_internalSaved;
- uLong num_fileSaved;
- uLong pos_in_central_dirSaved;
-
-
- if (file==NULL)
- return UNZ_PARAMERROR;
-
- if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
- return UNZ_PARAMERROR;
-
- s=(unz_s*)file;
- if (!s->current_file_ok)
- return UNZ_END_OF_LIST_OF_FILE;
-
- /* Save the current state */
- num_fileSaved = s->num_file;
- pos_in_central_dirSaved = s->pos_in_central_dir;
- cur_file_infoSaved = s->cur_file_info;
- cur_file_info_internalSaved = s->cur_file_info_internal;
-
- err = unzGoToFirstFile(file);
-
- while (err == UNZ_OK)
- {
- char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
- err = unzGetCurrentFileInfo(file,NULL,
- szCurrentFileName,sizeof(szCurrentFileName)-1,
- NULL,0,NULL,0);
- if (err == UNZ_OK)
- {
- if (unzStringFileNameCompare(szCurrentFileName,
- szFileName,iCaseSensitivity)==0)
- return UNZ_OK;
- err = unzGoToNextFile(file);
- }
- }
-
- /* We failed, so restore the state of the 'current file' to where we
- * were.
- */
- s->num_file = num_fileSaved ;
- s->pos_in_central_dir = pos_in_central_dirSaved ;
- s->cur_file_info = cur_file_infoSaved;
- s->cur_file_info_internal = cur_file_info_internalSaved;
- return err;
-}
-
-
-/*
-///////////////////////////////////////////
-// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)
-// I need random access
-//
-// Further optimization could be realized by adding an ability
-// to cache the directory in memory. The goal being a single
-// comprehensive file read to put the file I need in a memory.
-*/
-
-/*
-typedef struct unz_file_pos_s
-{
- uLong pos_in_zip_directory; // offset in file
- uLong num_of_file; // # of file
-} unz_file_pos;
-*/
-
-extern int ZEXPORT unzGetFilePos(file, file_pos)
- unzFile file;
- unz_file_pos* file_pos;
-{
- unz_s* s;
-
- if (file==NULL || file_pos==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- if (!s->current_file_ok)
- return UNZ_END_OF_LIST_OF_FILE;
-
- file_pos->pos_in_zip_directory = s->pos_in_central_dir;
- file_pos->num_of_file = s->num_file;
-
- return UNZ_OK;
-}
-
-extern int ZEXPORT unzGoToFilePos(file, file_pos)
- unzFile file;
- unz_file_pos* file_pos;
-{
- unz_s* s;
- int err;
-
- if (file==NULL || file_pos==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
-
- /* jump to the right spot */
- s->pos_in_central_dir = file_pos->pos_in_zip_directory;
- s->num_file = file_pos->num_of_file;
-
- /* set the current file */
- err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
- &s->cur_file_info_internal,
- NULL,0,NULL,0,NULL,0);
- /* return results */
- s->current_file_ok = (err == UNZ_OK);
- return err;
-}
-
-/*
-// Unzip Helper Functions - should be here?
-///////////////////////////////////////////
-*/
-
-/*
- Read the local header of the current zipfile
- Check the coherency of the local header and info in the end of central
- directory about this file
- store in *piSizeVar the size of extra info in local header
- (filename and size of extra field data)
-*/
-local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
- poffset_local_extrafield,
- psize_local_extrafield)
- unz_s* s;
- uInt* piSizeVar;
- uLong *poffset_local_extrafield;
- uInt *psize_local_extrafield;
-{
- uLong uMagic,uData,uFlags;
- uLong size_filename;
- uLong size_extra_field;
- int err=UNZ_OK;
-
- *piSizeVar = 0;
- *poffset_local_extrafield = 0;
- *psize_local_extrafield = 0;
-
- if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
- s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
- return UNZ_ERRNO;
-
-
- if (err==UNZ_OK)
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
- err=UNZ_ERRNO;
- else if (uMagic!=0x04034b50)
- err=UNZ_BADZIPFILE;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
- err=UNZ_ERRNO;
-/*
- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
- err=UNZ_BADZIPFILE;
-*/
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
- err=UNZ_ERRNO;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
- err=UNZ_ERRNO;
- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
- err=UNZ_BADZIPFILE;
-
- if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
- (s->cur_file_info.compression_method!=Z_DEFLATED))
- err=UNZ_BADZIPFILE;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
- err=UNZ_ERRNO;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
- err=UNZ_ERRNO;
- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
- ((uFlags & 8)==0))
- err=UNZ_BADZIPFILE;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
- err=UNZ_ERRNO;
- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
- ((uFlags & 8)==0))
- err=UNZ_BADZIPFILE;
-
- if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
- err=UNZ_ERRNO;
- else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
- ((uFlags & 8)==0))
- err=UNZ_BADZIPFILE;
-
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
- err=UNZ_ERRNO;
- else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
- err=UNZ_BADZIPFILE;
-
- *piSizeVar += (uInt)size_filename;
-
- if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
- err=UNZ_ERRNO;
- *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
- SIZEZIPLOCALHEADER + size_filename;
- *psize_local_extrafield = (uInt)size_extra_field;
-
- *piSizeVar += (uInt)size_extra_field;
-
- return err;
-}
-
-/*
- Open for reading data the current file in the zipfile.
- If there is no error and the file is opened, the return value is UNZ_OK.
-*/
-extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
- unzFile file;
- int* method;
- int* level;
- int raw;
- const char* password;
-{
- int err=UNZ_OK;
- uInt iSizeVar;
- unz_s* s;
- file_in_zip_read_info_s* pfile_in_zip_read_info;
- uLong offset_local_extrafield; /* offset of the local extra field */
- uInt size_local_extrafield; /* size of the local extra field */
-# ifndef NOUNCRYPT
- char source[12];
-# else
- if (password != NULL)
- return UNZ_PARAMERROR;
-# endif
-
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- if (!s->current_file_ok)
- return UNZ_PARAMERROR;
-
- if (s->pfile_in_zip_read != NULL)
- unzCloseCurrentFile(file);
-
- if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
- &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
- return UNZ_BADZIPFILE;
-
- pfile_in_zip_read_info = (file_in_zip_read_info_s*)
- ALLOC(sizeof(file_in_zip_read_info_s));
- if (pfile_in_zip_read_info==NULL)
- return UNZ_INTERNALERROR;
-
- pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
- pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
- pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
- pfile_in_zip_read_info->pos_local_extrafield=0;
- pfile_in_zip_read_info->raw=raw;
-
- if (pfile_in_zip_read_info->read_buffer==NULL)
- {
- TRYFREE(pfile_in_zip_read_info);
- return UNZ_INTERNALERROR;
- }
-
- pfile_in_zip_read_info->stream_initialised=0;
-
- if (method!=NULL)
- *method = (int)s->cur_file_info.compression_method;
-
- if (level!=NULL)
- {
- *level = 6;
- switch (s->cur_file_info.flag & 0x06)
- {
- case 6 : *level = 1; break;
- case 4 : *level = 2; break;
- case 2 : *level = 9; break;
- }
- }
-
- if ((s->cur_file_info.compression_method!=0) &&
- (s->cur_file_info.compression_method!=Z_DEFLATED))
- err=UNZ_BADZIPFILE;
-
- pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
- pfile_in_zip_read_info->crc32=0;
- pfile_in_zip_read_info->compression_method =
- s->cur_file_info.compression_method;
- pfile_in_zip_read_info->filestream=s->filestream;
- pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
- pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
-
- pfile_in_zip_read_info->stream.total_out = 0;
-
- if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
- (!raw))
- {
- pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
- pfile_in_zip_read_info->stream.zfree = (free_func)0;
- pfile_in_zip_read_info->stream.opaque = (voidpf)0;
- pfile_in_zip_read_info->stream.next_in = (voidpf)0;
- pfile_in_zip_read_info->stream.avail_in = 0;
-
- err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
- if (err == Z_OK)
- pfile_in_zip_read_info->stream_initialised=1;
- else
- {
- TRYFREE(pfile_in_zip_read_info);
- return err;
- }
- /* windowBits is passed < 0 to tell that there is no zlib header.
- * Note that in this case inflate *requires* an extra "dummy" byte
- * after the compressed stream in order to complete decompression and
- * return Z_STREAM_END.
- * In unzip, i don't wait absolutely Z_STREAM_END because I known the
- * size of both compressed and uncompressed data
- */
- }
- pfile_in_zip_read_info->rest_read_compressed =
- s->cur_file_info.compressed_size ;
- pfile_in_zip_read_info->rest_read_uncompressed =
- s->cur_file_info.uncompressed_size ;
-
-
- pfile_in_zip_read_info->pos_in_zipfile =
- s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
- iSizeVar;
-
- pfile_in_zip_read_info->stream.avail_in = (uInt)0;
-
- s->pfile_in_zip_read = pfile_in_zip_read_info;
-
-# ifndef NOUNCRYPT
- if (password != NULL)
- {
- int i;
- s->pcrc_32_tab = get_crc_table();
- init_keys(password,s->keys,s->pcrc_32_tab);
- if (ZSEEK(s->z_filefunc, s->filestream,
- s->pfile_in_zip_read->pos_in_zipfile +
- s->pfile_in_zip_read->byte_before_the_zipfile,
- SEEK_SET)!=0)
- return UNZ_INTERNALERROR;
- if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
- return UNZ_INTERNALERROR;
-
- for (i = 0; i<12; i++)
- zdecode(s->keys,s->pcrc_32_tab,source[i]);
-
- s->pfile_in_zip_read->pos_in_zipfile+=12;
- s->encrypted=1;
- }
-# endif
-
-
- return UNZ_OK;
-}
-
-extern int ZEXPORT unzOpenCurrentFile (file)
- unzFile file;
-{
- return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
-}
-
-extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
- unzFile file;
- const char* password;
-{
- return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
-}
-
-extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
- unzFile file;
- int* method;
- int* level;
- int raw;
-{
- return unzOpenCurrentFile3(file, method, level, raw, NULL);
-}
-
-/*
- Read bytes from the current file.
- buf contain buffer where data must be copied
- len the size of buf.
-
- return the number of byte copied if somes bytes are copied
- return 0 if the end of file was reached
- return <0 with error code if there is an error
- (UNZ_ERRNO for IO error, or zLib error for uncompress error)
-*/
-extern int ZEXPORT unzReadCurrentFile (file, buf, len)
- unzFile file;
- voidp buf;
- unsigned len;
-{
- int err=UNZ_OK;
- uInt iRead = 0;
- unz_s* s;
- file_in_zip_read_info_s* pfile_in_zip_read_info;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- pfile_in_zip_read_info=s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info==NULL)
- return UNZ_PARAMERROR;
-
-
- if ((pfile_in_zip_read_info->read_buffer == NULL))
- return UNZ_END_OF_LIST_OF_FILE;
- if (len==0)
- return 0;
-
- pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
-
- pfile_in_zip_read_info->stream.avail_out = (uInt)len;
-
- if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
- (!(pfile_in_zip_read_info->raw)))
- pfile_in_zip_read_info->stream.avail_out =
- (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
-
- if ((len>pfile_in_zip_read_info->rest_read_compressed+
- pfile_in_zip_read_info->stream.avail_in) &&
- (pfile_in_zip_read_info->raw))
- pfile_in_zip_read_info->stream.avail_out =
- (uInt)pfile_in_zip_read_info->rest_read_compressed+
- pfile_in_zip_read_info->stream.avail_in;
-
- while (pfile_in_zip_read_info->stream.avail_out>0)
- {
- if ((pfile_in_zip_read_info->stream.avail_in==0) &&
- (pfile_in_zip_read_info->rest_read_compressed>0))
- {
- uInt uReadThis = UNZ_BUFSIZE;
- if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
- uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
- if (uReadThis == 0)
- return UNZ_EOF;
- if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
- pfile_in_zip_read_info->filestream,
- pfile_in_zip_read_info->pos_in_zipfile +
- pfile_in_zip_read_info->byte_before_the_zipfile,
- ZLIB_FILEFUNC_SEEK_SET)!=0)
- return UNZ_ERRNO;
- if (ZREAD(pfile_in_zip_read_info->z_filefunc,
- pfile_in_zip_read_info->filestream,
- pfile_in_zip_read_info->read_buffer,
- uReadThis)!=uReadThis)
- return UNZ_ERRNO;
-
-
-# ifndef NOUNCRYPT
- if(s->encrypted)
- {
- uInt i;
- for(i=0;i<uReadThis;i++)
- pfile_in_zip_read_info->read_buffer[i] =
- zdecode(s->keys,s->pcrc_32_tab,
- pfile_in_zip_read_info->read_buffer[i]);
- }
-# endif
-
-
- pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
-
- pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
-
- pfile_in_zip_read_info->stream.next_in =
- (Bytef*)pfile_in_zip_read_info->read_buffer;
- pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
- }
-
- if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
- {
- uInt uDoCopy,i ;
-
- if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
- (pfile_in_zip_read_info->rest_read_compressed == 0))
- return (iRead==0) ? UNZ_EOF : iRead;
-
- if (pfile_in_zip_read_info->stream.avail_out <
- pfile_in_zip_read_info->stream.avail_in)
- uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
- else
- uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
-
- for (i=0;i<uDoCopy;i++)
- *(pfile_in_zip_read_info->stream.next_out+i) =
- *(pfile_in_zip_read_info->stream.next_in+i);
-
- pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
- pfile_in_zip_read_info->stream.next_out,
- uDoCopy);
- pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
- pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
- pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
- pfile_in_zip_read_info->stream.next_out += uDoCopy;
- pfile_in_zip_read_info->stream.next_in += uDoCopy;
- pfile_in_zip_read_info->stream.total_out += uDoCopy;
- iRead += uDoCopy;
- }
- else
- {
- uLong uTotalOutBefore,uTotalOutAfter;
- const Bytef *bufBefore;
- uLong uOutThis;
- int flush=Z_SYNC_FLUSH;
-
- uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
- bufBefore = pfile_in_zip_read_info->stream.next_out;
-
- /*
- if ((pfile_in_zip_read_info->rest_read_uncompressed ==
- pfile_in_zip_read_info->stream.avail_out) &&
- (pfile_in_zip_read_info->rest_read_compressed == 0))
- flush = Z_FINISH;
- */
- err=inflate(&pfile_in_zip_read_info->stream,flush);
-
- if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
- err = Z_DATA_ERROR;
-
- uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
- uOutThis = uTotalOutAfter-uTotalOutBefore;
-
- pfile_in_zip_read_info->crc32 =
- crc32(pfile_in_zip_read_info->crc32,bufBefore,
- (uInt)(uOutThis));
-
- pfile_in_zip_read_info->rest_read_uncompressed -=
- uOutThis;
-
- iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
-
- if (err==Z_STREAM_END)
- return (iRead==0) ? UNZ_EOF : iRead;
- if (err!=Z_OK)
- break;
- }
- }
-
- if (err==Z_OK)
- return iRead;
- return err;
-}
-
-
-/*
- Give the current position in uncompressed data
-*/
-extern z_off_t ZEXPORT unztell (file)
- unzFile file;
-{
- unz_s* s;
- file_in_zip_read_info_s* pfile_in_zip_read_info;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- pfile_in_zip_read_info=s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info==NULL)
- return UNZ_PARAMERROR;
-
- return (z_off_t)pfile_in_zip_read_info->stream.total_out;
-}
-
-
-/*
- return 1 if the end of file was reached, 0 elsewhere
-*/
-extern int ZEXPORT unzeof (file)
- unzFile file;
-{
- unz_s* s;
- file_in_zip_read_info_s* pfile_in_zip_read_info;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- pfile_in_zip_read_info=s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info==NULL)
- return UNZ_PARAMERROR;
-
- if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
- return 1;
- else
- return 0;
-}
-
-
-
-/*
- Read extra field from the current file (opened by unzOpenCurrentFile)
- This is the local-header version of the extra field (sometimes, there is
- more info in the local-header version than in the central-header)
-
- if buf==NULL, it return the size of the local extra field that can be read
-
- if buf!=NULL, len is the size of the buffer, the extra header is copied in
- buf.
- the return value is the number of bytes copied in buf, or (if <0)
- the error code
-*/
-extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
- unzFile file;
- voidp buf;
- unsigned len;
-{
- unz_s* s;
- file_in_zip_read_info_s* pfile_in_zip_read_info;
- uInt read_now;
- uLong size_to_read;
-
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- pfile_in_zip_read_info=s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info==NULL)
- return UNZ_PARAMERROR;
-
- size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
- pfile_in_zip_read_info->pos_local_extrafield);
-
- if (buf==NULL)
- return (int)size_to_read;
-
- if (len>size_to_read)
- read_now = (uInt)size_to_read;
- else
- read_now = (uInt)len ;
-
- if (read_now==0)
- return 0;
-
- if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
- pfile_in_zip_read_info->filestream,
- pfile_in_zip_read_info->offset_local_extrafield +
- pfile_in_zip_read_info->pos_local_extrafield,
- ZLIB_FILEFUNC_SEEK_SET)!=0)
- return UNZ_ERRNO;
-
- if (ZREAD(pfile_in_zip_read_info->z_filefunc,
- pfile_in_zip_read_info->filestream,
- buf,read_now)!=read_now)
- return UNZ_ERRNO;
-
- return (int)read_now;
-}
-
-/*
- Close the file in zip opened with unzipOpenCurrentFile
- Return UNZ_CRCERROR if all the file was read but the CRC is not good
-*/
-extern int ZEXPORT unzCloseCurrentFile (file)
- unzFile file;
-{
- int err=UNZ_OK;
-
- unz_s* s;
- file_in_zip_read_info_s* pfile_in_zip_read_info;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- pfile_in_zip_read_info=s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info==NULL)
- return UNZ_PARAMERROR;
-
-
- if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
- (!pfile_in_zip_read_info->raw))
- {
- if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
- err=UNZ_CRCERROR;
- }
-
-
- TRYFREE(pfile_in_zip_read_info->read_buffer);
- pfile_in_zip_read_info->read_buffer = NULL;
- if (pfile_in_zip_read_info->stream_initialised)
- inflateEnd(&pfile_in_zip_read_info->stream);
-
- pfile_in_zip_read_info->stream_initialised = 0;
- TRYFREE(pfile_in_zip_read_info);
-
- s->pfile_in_zip_read=NULL;
-
- return err;
-}
-
-
-/*
- Get the global comment string of the ZipFile, in the szComment buffer.
- uSizeBuf is the size of the szComment buffer.
- return the number of byte copied or an error code <0
-*/
-extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
- unzFile file;
- char *szComment;
- uLong uSizeBuf;
-{
- int err=UNZ_OK;
- unz_s* s;
- uLong uReadThis ;
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
-
- uReadThis = uSizeBuf;
- if (uReadThis>s->gi.size_comment)
- uReadThis = s->gi.size_comment;
-
- if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
- return UNZ_ERRNO;
-
- if (uReadThis>0)
- {
- *szComment='\0';
- if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
- return UNZ_ERRNO;
- }
-
- if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
- *(szComment+s->gi.size_comment)='\0';
- return (int)uReadThis;
-}
-
-/* Additions by RX '2004 */
-extern uLong ZEXPORT unzGetOffset (file)
- unzFile file;
-{
- unz_s* s;
-
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
- if (!s->current_file_ok)
- return 0;
- if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
- if (s->num_file==s->gi.number_entry)
- return 0;
- return s->pos_in_central_dir;
-}
-
-extern int ZEXPORT unzSetOffset (file, pos)
- unzFile file;
- uLong pos;
-{
- unz_s* s;
- int err;
-
- if (file==NULL)
- return UNZ_PARAMERROR;
- s=(unz_s*)file;
-
- s->pos_in_central_dir = pos;
- s->num_file = s->gi.number_entry; /* hack */
- err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
- &s->cur_file_info_internal,
- NULL,0,NULL,0,NULL,0);
- s->current_file_ok = (err == UNZ_OK);
- return err;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/unzip.h b/funtools/util/zlib-1.2.3/contrib/minizip/unzip.h
deleted file mode 100644
index b247937..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/unzip.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/* unzip.h -- IO for uncompress .zip files using zlib
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-
- This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
- WinZip, InfoZip tools and compatible.
-
- Multi volume ZipFile (span) are not supported.
- Encryption compatible with pkzip 2.04g only supported
- Old compressions used by old PKZip 1.x are not supported
-
-
- I WAIT FEEDBACK at mail info@winimage.com
- Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
-
- Condition of use and distribution are the same than zlib :
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
-
-*/
-
-/* for more info about .ZIP format, see
- http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
- http://www.info-zip.org/pub/infozip/doc/
- PkWare has also a specification at :
- ftp://ftp.pkware.com/probdesc.zip
-*/
-
-#ifndef _unz_H
-#define _unz_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#ifndef _ZLIBIOAPI_H
-#include "ioapi.h"
-#endif
-
-#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
-/* like the STRICT of WIN32, we define a pointer that cannot be converted
- from (void*) without cast */
-typedef struct TagunzFile__ { int unused; } unzFile__;
-typedef unzFile__ *unzFile;
-#else
-typedef voidp unzFile;
-#endif
-
-
-#define UNZ_OK (0)
-#define UNZ_END_OF_LIST_OF_FILE (-100)
-#define UNZ_ERRNO (Z_ERRNO)
-#define UNZ_EOF (0)
-#define UNZ_PARAMERROR (-102)
-#define UNZ_BADZIPFILE (-103)
-#define UNZ_INTERNALERROR (-104)
-#define UNZ_CRCERROR (-105)
-
-/* tm_unz contain date/time info */
-typedef struct tm_unz_s
-{
- uInt tm_sec; /* seconds after the minute - [0,59] */
- uInt tm_min; /* minutes after the hour - [0,59] */
- uInt tm_hour; /* hours since midnight - [0,23] */
- uInt tm_mday; /* day of the month - [1,31] */
- uInt tm_mon; /* months since January - [0,11] */
- uInt tm_year; /* years - [1980..2044] */
-} tm_unz;
-
-/* unz_global_info structure contain global data about the ZIPfile
- These data comes from the end of central dir */
-typedef struct unz_global_info_s
-{
- uLong number_entry; /* total number of entries in
- the central dir on this disk */
- uLong size_comment; /* size of the global comment of the zipfile */
-} unz_global_info;
-
-
-/* unz_file_info contain information about a file in the zipfile */
-typedef struct unz_file_info_s
-{
- uLong version; /* version made by 2 bytes */
- uLong version_needed; /* version needed to extract 2 bytes */
- uLong flag; /* general purpose bit flag 2 bytes */
- uLong compression_method; /* compression method 2 bytes */
- uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
- uLong crc; /* crc-32 4 bytes */
- uLong compressed_size; /* compressed size 4 bytes */
- uLong uncompressed_size; /* uncompressed size 4 bytes */
- uLong size_filename; /* filename length 2 bytes */
- uLong size_file_extra; /* extra field length 2 bytes */
- uLong size_file_comment; /* file comment length 2 bytes */
-
- uLong disk_num_start; /* disk number start 2 bytes */
- uLong internal_fa; /* internal file attributes 2 bytes */
- uLong external_fa; /* external file attributes 4 bytes */
-
- tm_unz tmu_date;
-} unz_file_info;
-
-extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
- const char* fileName2,
- int iCaseSensitivity));
-/*
- Compare two filename (fileName1,fileName2).
- If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
- If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
- or strcasecmp)
- If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
- (like 1 on Unix, 2 on Windows)
-*/
-
-
-extern unzFile ZEXPORT unzOpen OF((const char *path));
-/*
- Open a Zip file. path contain the full pathname (by example,
- on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
- "zlib/zlib113.zip".
- If the zipfile cannot be opened (file don't exist or in not valid), the
- return value is NULL.
- Else, the return value is a unzFile Handle, usable with other function
- of this unzip package.
-*/
-
-extern unzFile ZEXPORT unzOpen2 OF((const char *path,
- zlib_filefunc_def* pzlib_filefunc_def));
-/*
- Open a Zip file, like unzOpen, but provide a set of file low level API
- for read/write the zip file (see ioapi.h)
-*/
-
-extern int ZEXPORT unzClose OF((unzFile file));
-/*
- Close a ZipFile opened with unzipOpen.
- If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
- these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
- return UNZ_OK if there is no problem. */
-
-extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
- unz_global_info *pglobal_info));
-/*
- Write info about the ZipFile in the *pglobal_info structure.
- No preparation of the structure is needed
- return UNZ_OK if there is no problem. */
-
-
-extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
- char *szComment,
- uLong uSizeBuf));
-/*
- Get the global comment string of the ZipFile, in the szComment buffer.
- uSizeBuf is the size of the szComment buffer.
- return the number of byte copied or an error code <0
-*/
-
-
-/***************************************************************************/
-/* Unzip package allow you browse the directory of the zipfile */
-
-extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
-/*
- Set the current file of the zipfile to the first file.
- return UNZ_OK if there is no problem
-*/
-
-extern int ZEXPORT unzGoToNextFile OF((unzFile file));
-/*
- Set the current file of the zipfile to the next file.
- return UNZ_OK if there is no problem
- return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
-*/
-
-extern int ZEXPORT unzLocateFile OF((unzFile file,
- const char *szFileName,
- int iCaseSensitivity));
-/*
- Try locate the file szFileName in the zipfile.
- For the iCaseSensitivity signification, see unzStringFileNameCompare
-
- return value :
- UNZ_OK if the file is found. It becomes the current file.
- UNZ_END_OF_LIST_OF_FILE if the file is not found
-*/
-
-
-/* ****************************************** */
-/* Ryan supplied functions */
-/* unz_file_info contain information about a file in the zipfile */
-typedef struct unz_file_pos_s
-{
- uLong pos_in_zip_directory; /* offset in zip file directory */
- uLong num_of_file; /* # of file */
-} unz_file_pos;
-
-extern int ZEXPORT unzGetFilePos(
- unzFile file,
- unz_file_pos* file_pos);
-
-extern int ZEXPORT unzGoToFilePos(
- unzFile file,
- unz_file_pos* file_pos);
-
-/* ****************************************** */
-
-extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
- unz_file_info *pfile_info,
- char *szFileName,
- uLong fileNameBufferSize,
- void *extraField,
- uLong extraFieldBufferSize,
- char *szComment,
- uLong commentBufferSize));
-/*
- Get Info about the current file
- if pfile_info!=NULL, the *pfile_info structure will contain somes info about
- the current file
- if szFileName!=NULL, the filemane string will be copied in szFileName
- (fileNameBufferSize is the size of the buffer)
- if extraField!=NULL, the extra field information will be copied in extraField
- (extraFieldBufferSize is the size of the buffer).
- This is the Central-header version of the extra field
- if szComment!=NULL, the comment string of the file will be copied in szComment
- (commentBufferSize is the size of the buffer)
-*/
-
-/***************************************************************************/
-/* for reading the content of the current zipfile, you can open it, read data
- from it, and close it (you can close it before reading all the file)
- */
-
-extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
-/*
- Open for reading data the current file in the zipfile.
- If there is no error, the return value is UNZ_OK.
-*/
-
-extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
- const char* password));
-/*
- Open for reading data the current file in the zipfile.
- password is a crypting password
- If there is no error, the return value is UNZ_OK.
-*/
-
-extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
- int* method,
- int* level,
- int raw));
-/*
- Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
- if raw==1
- *method will receive method of compression, *level will receive level of
- compression
- note : you can set level parameter as NULL (if you did not want known level,
- but you CANNOT set method parameter as NULL
-*/
-
-extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
- int* method,
- int* level,
- int raw,
- const char* password));
-/*
- Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
- if raw==1
- *method will receive method of compression, *level will receive level of
- compression
- note : you can set level parameter as NULL (if you did not want known level,
- but you CANNOT set method parameter as NULL
-*/
-
-
-extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
-/*
- Close the file in zip opened with unzOpenCurrentFile
- Return UNZ_CRCERROR if all the file was read but the CRC is not good
-*/
-
-extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
- voidp buf,
- unsigned len));
-/*
- Read bytes from the current file (opened by unzOpenCurrentFile)
- buf contain buffer where data must be copied
- len the size of buf.
-
- return the number of byte copied if somes bytes are copied
- return 0 if the end of file was reached
- return <0 with error code if there is an error
- (UNZ_ERRNO for IO error, or zLib error for uncompress error)
-*/
-
-extern z_off_t ZEXPORT unztell OF((unzFile file));
-/*
- Give the current position in uncompressed data
-*/
-
-extern int ZEXPORT unzeof OF((unzFile file));
-/*
- return 1 if the end of file was reached, 0 elsewhere
-*/
-
-extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
- voidp buf,
- unsigned len));
-/*
- Read extra field from the current file (opened by unzOpenCurrentFile)
- This is the local-header version of the extra field (sometimes, there is
- more info in the local-header version than in the central-header)
-
- if buf==NULL, it return the size of the local extra field
-
- if buf!=NULL, len is the size of the buffer, the extra header is copied in
- buf.
- the return value is the number of bytes copied in buf, or (if <0)
- the error code
-*/
-
-/***************************************************************************/
-
-/* Get the current file offset */
-extern uLong ZEXPORT unzGetOffset (unzFile file);
-
-/* Set the current file offset */
-extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _unz_H */
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/zip.c b/funtools/util/zlib-1.2.3/contrib/minizip/zip.c
deleted file mode 100644
index 7fbe002..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/zip.c
+++ /dev/null
@@ -1,1219 +0,0 @@
-/* zip.c -- IO on .zip files using zlib
- Version 1.01e, February 12th, 2005
-
- 27 Dec 2004 Rolf Kalbermatter
- Modification to zipOpen2 to support globalComment retrieval.
-
- Copyright (C) 1998-2005 Gilles Vollant
-
- Read zip.h for more info
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "zlib.h"
-#include "zip.h"
-
-#ifdef STDC
-# include <stddef.h>
-# include <string.h>
-# include <stdlib.h>
-#endif
-#ifdef NO_ERRNO_H
- extern int errno;
-#else
-# include <errno.h>
-#endif
-
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-#ifndef VERSIONMADEBY
-# define VERSIONMADEBY (0x0) /* platform depedent */
-#endif
-
-#ifndef Z_BUFSIZE
-#define Z_BUFSIZE (16384)
-#endif
-
-#ifndef Z_MAXFILENAMEINZIP
-#define Z_MAXFILENAMEINZIP (256)
-#endif
-
-#ifndef ALLOC
-# define ALLOC(size) (malloc(size))
-#endif
-#ifndef TRYFREE
-# define TRYFREE(p) {if (p) free(p);}
-#endif
-
-/*
-#define SIZECENTRALDIRITEM (0x2e)
-#define SIZEZIPLOCALHEADER (0x1e)
-*/
-
-/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#ifndef DEF_MEM_LEVEL
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-#endif
-const char zip_copyright[] =
- " zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
-
-
-#define SIZEDATA_INDATABLOCK (4096-(4*4))
-
-#define LOCALHEADERMAGIC (0x04034b50)
-#define CENTRALHEADERMAGIC (0x02014b50)
-#define ENDHEADERMAGIC (0x06054b50)
-
-#define FLAG_LOCALHEADER_OFFSET (0x06)
-#define CRC_LOCALHEADER_OFFSET (0x0e)
-
-#define SIZECENTRALHEADER (0x2e) /* 46 */
-
-typedef struct linkedlist_datablock_internal_s
-{
- struct linkedlist_datablock_internal_s* next_datablock;
- uLong avail_in_this_block;
- uLong filled_in_this_block;
- uLong unused; /* for future use and alignement */
- unsigned char data[SIZEDATA_INDATABLOCK];
-} linkedlist_datablock_internal;
-
-typedef struct linkedlist_data_s
-{
- linkedlist_datablock_internal* first_block;
- linkedlist_datablock_internal* last_block;
-} linkedlist_data;
-
-
-typedef struct
-{
- z_stream stream; /* zLib stream structure for inflate */
- int stream_initialised; /* 1 is stream is initialised */
- uInt pos_in_buffered_data; /* last written byte in buffered_data */
-
- uLong pos_local_header; /* offset of the local header of the file
- currenty writing */
- char* central_header; /* central header data for the current file */
- uLong size_centralheader; /* size of the central header for cur file */
- uLong flag; /* flag of the file currently writing */
-
- int method; /* compression method of file currenty wr.*/
- int raw; /* 1 for directly writing raw data */
- Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
- uLong dosDate;
- uLong crc32;
- int encrypt;
-#ifndef NOCRYPT
- unsigned long keys[3]; /* keys defining the pseudo-random sequence */
- const unsigned long* pcrc_32_tab;
- int crypt_header_size;
-#endif
-} curfile_info;
-
-typedef struct
-{
- zlib_filefunc_def z_filefunc;
- voidpf filestream; /* io structore of the zipfile */
- linkedlist_data central_dir;/* datablock with central dir in construction*/
- int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
- curfile_info ci; /* info on the file curretly writing */
-
- uLong begin_pos; /* position of the beginning of the zipfile */
- uLong add_position_when_writting_offset;
- uLong number_entry;
-#ifndef NO_ADDFILEINEXISTINGZIP
- char *globalcomment;
-#endif
-} zip_internal;
-
-
-
-#ifndef NOCRYPT
-#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
-#include "crypt.h"
-#endif
-
-local linkedlist_datablock_internal* allocate_new_datablock()
-{
- linkedlist_datablock_internal* ldi;
- ldi = (linkedlist_datablock_internal*)
- ALLOC(sizeof(linkedlist_datablock_internal));
- if (ldi!=NULL)
- {
- ldi->next_datablock = NULL ;
- ldi->filled_in_this_block = 0 ;
- ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
- }
- return ldi;
-}
-
-local void free_datablock(ldi)
- linkedlist_datablock_internal* ldi;
-{
- while (ldi!=NULL)
- {
- linkedlist_datablock_internal* ldinext = ldi->next_datablock;
- TRYFREE(ldi);
- ldi = ldinext;
- }
-}
-
-local void init_linkedlist(ll)
- linkedlist_data* ll;
-{
- ll->first_block = ll->last_block = NULL;
-}
-
-local void free_linkedlist(ll)
- linkedlist_data* ll;
-{
- free_datablock(ll->first_block);
- ll->first_block = ll->last_block = NULL;
-}
-
-
-local int add_data_in_datablock(ll,buf,len)
- linkedlist_data* ll;
- const void* buf;
- uLong len;
-{
- linkedlist_datablock_internal* ldi;
- const unsigned char* from_copy;
-
- if (ll==NULL)
- return ZIP_INTERNALERROR;
-
- if (ll->last_block == NULL)
- {
- ll->first_block = ll->last_block = allocate_new_datablock();
- if (ll->first_block == NULL)
- return ZIP_INTERNALERROR;
- }
-
- ldi = ll->last_block;
- from_copy = (unsigned char*)buf;
-
- while (len>0)
- {
- uInt copy_this;
- uInt i;
- unsigned char* to_copy;
-
- if (ldi->avail_in_this_block==0)
- {
- ldi->next_datablock = allocate_new_datablock();
- if (ldi->next_datablock == NULL)
- return ZIP_INTERNALERROR;
- ldi = ldi->next_datablock ;
- ll->last_block = ldi;
- }
-
- if (ldi->avail_in_this_block < len)
- copy_this = (uInt)ldi->avail_in_this_block;
- else
- copy_this = (uInt)len;
-
- to_copy = &(ldi->data[ldi->filled_in_this_block]);
-
- for (i=0;i<copy_this;i++)
- *(to_copy+i)=*(from_copy+i);
-
- ldi->filled_in_this_block += copy_this;
- ldi->avail_in_this_block -= copy_this;
- from_copy += copy_this ;
- len -= copy_this;
- }
- return ZIP_OK;
-}
-
-
-
-/****************************************************************************/
-
-#ifndef NO_ADDFILEINEXISTINGZIP
-/* ===========================================================================
- Inputs a long in LSB order to the given file
- nbByte == 1, 2 or 4 (byte, short or long)
-*/
-
-local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream, uLong x, int nbByte));
-local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- uLong x;
- int nbByte;
-{
- unsigned char buf[4];
- int n;
- for (n = 0; n < nbByte; n++)
- {
- buf[n] = (unsigned char)(x & 0xff);
- x >>= 8;
- }
- if (x != 0)
- { /* data overflow - hack for ZIP64 (X Roche) */
- for (n = 0; n < nbByte; n++)
- {
- buf[n] = 0xff;
- }
- }
-
- if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
- return ZIP_ERRNO;
- else
- return ZIP_OK;
-}
-
-local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
-local void ziplocal_putValue_inmemory (dest, x, nbByte)
- void* dest;
- uLong x;
- int nbByte;
-{
- unsigned char* buf=(unsigned char*)dest;
- int n;
- for (n = 0; n < nbByte; n++) {
- buf[n] = (unsigned char)(x & 0xff);
- x >>= 8;
- }
-
- if (x != 0)
- { /* data overflow - hack for ZIP64 */
- for (n = 0; n < nbByte; n++)
- {
- buf[n] = 0xff;
- }
- }
-}
-
-/****************************************************************************/
-
-
-local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
- const tm_zip* ptm;
- uLong dosDate;
-{
- uLong year = (uLong)ptm->tm_year;
- if (year>1980)
- year-=1980;
- else if (year>80)
- year-=80;
- return
- (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
- ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
-}
-
-
-/****************************************************************************/
-
-local int ziplocal_getByte OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream,
- int *pi));
-
-local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- int *pi;
-{
- unsigned char c;
- int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
- if (err==1)
- {
- *pi = (int)c;
- return ZIP_OK;
- }
- else
- {
- if (ZERROR(*pzlib_filefunc_def,filestream))
- return ZIP_ERRNO;
- else
- return ZIP_EOF;
- }
-}
-
-
-/* ===========================================================================
- Reads a long in LSB order from the given gz_stream. Sets
-*/
-local int ziplocal_getShort OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream,
- uLong *pX));
-
-local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- uLong *pX;
-{
- uLong x ;
- int i;
- int err;
-
- err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
- x = (uLong)i;
-
- if (err==ZIP_OK)
- err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<8;
-
- if (err==ZIP_OK)
- *pX = x;
- else
- *pX = 0;
- return err;
-}
-
-local int ziplocal_getLong OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream,
- uLong *pX));
-
-local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
- uLong *pX;
-{
- uLong x ;
- int i;
- int err;
-
- err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
- x = (uLong)i;
-
- if (err==ZIP_OK)
- err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<8;
-
- if (err==ZIP_OK)
- err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<16;
-
- if (err==ZIP_OK)
- err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
- x += ((uLong)i)<<24;
-
- if (err==ZIP_OK)
- *pX = x;
- else
- *pX = 0;
- return err;
-}
-
-#ifndef BUFREADCOMMENT
-#define BUFREADCOMMENT (0x400)
-#endif
-/*
- Locate the Central directory of a zipfile (at the end, just before
- the global comment)
-*/
-local uLong ziplocal_SearchCentralDir OF((
- const zlib_filefunc_def* pzlib_filefunc_def,
- voidpf filestream));
-
-local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
- const zlib_filefunc_def* pzlib_filefunc_def;
- voidpf filestream;
-{
- unsigned char* buf;
- uLong uSizeFile;
- uLong uBackRead;
- uLong uMaxBack=0xffff; /* maximum size of global comment */
- uLong uPosFound=0;
-
- if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
- return 0;
-
-
- uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
-
- if (uMaxBack>uSizeFile)
- uMaxBack = uSizeFile;
-
- buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
- if (buf==NULL)
- return 0;
-
- uBackRead = 4;
- while (uBackRead<uMaxBack)
- {
- uLong uReadSize,uReadPos ;
- int i;
- if (uBackRead+BUFREADCOMMENT>uMaxBack)
- uBackRead = uMaxBack;
- else
- uBackRead+=BUFREADCOMMENT;
- uReadPos = uSizeFile-uBackRead ;
-
- uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
- (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
- if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
- break;
-
- if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
- break;
-
- for (i=(int)uReadSize-3; (i--)>0;)
- if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
- ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
- {
- uPosFound = uReadPos+i;
- break;
- }
-
- if (uPosFound!=0)
- break;
- }
- TRYFREE(buf);
- return uPosFound;
-}
-#endif /* !NO_ADDFILEINEXISTINGZIP*/
-
-/************************************************************/
-extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def)
- const char *pathname;
- int append;
- zipcharpc* globalcomment;
- zlib_filefunc_def* pzlib_filefunc_def;
-{
- zip_internal ziinit;
- zip_internal* zi;
- int err=ZIP_OK;
-
-
- if (pzlib_filefunc_def==NULL)
- fill_fopen_filefunc(&ziinit.z_filefunc);
- else
- ziinit.z_filefunc = *pzlib_filefunc_def;
-
- ziinit.filestream = (*(ziinit.z_filefunc.zopen_file))
- (ziinit.z_filefunc.opaque,
- pathname,
- (append == APPEND_STATUS_CREATE) ?
- (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
- (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));
-
- if (ziinit.filestream == NULL)
- return NULL;
- ziinit.begin_pos = ZTELL(ziinit.z_filefunc,ziinit.filestream);
- ziinit.in_opened_file_inzip = 0;
- ziinit.ci.stream_initialised = 0;
- ziinit.number_entry = 0;
- ziinit.add_position_when_writting_offset = 0;
- init_linkedlist(&(ziinit.central_dir));
-
-
- zi = (zip_internal*)ALLOC(sizeof(zip_internal));
- if (zi==NULL)
- {
- ZCLOSE(ziinit.z_filefunc,ziinit.filestream);
- return NULL;
- }
-
- /* now we add file in a zipfile */
-# ifndef NO_ADDFILEINEXISTINGZIP
- ziinit.globalcomment = NULL;
- if (append == APPEND_STATUS_ADDINZIP)
- {
- uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
-
- uLong size_central_dir; /* size of the central directory */
- uLong offset_central_dir; /* offset of start of central directory */
- uLong central_pos,uL;
-
- uLong number_disk; /* number of the current dist, used for
- spaning ZIP, unsupported, always 0*/
- uLong number_disk_with_CD; /* number the the disk with central dir, used
- for spaning ZIP, unsupported, always 0*/
- uLong number_entry;
- uLong number_entry_CD; /* total number of entries in
- the central dir
- (same than number_entry on nospan) */
- uLong size_comment;
-
- central_pos = ziplocal_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream);
- if (central_pos==0)
- err=ZIP_ERRNO;
-
- if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
- central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
- err=ZIP_ERRNO;
-
- /* the signature, already checked */
- if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&uL)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- /* number of this disk */
- if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- /* number of the disk with the start of the central directory */
- if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- /* total number of entries in the central dir on this disk */
- if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- /* total number of entries in the central dir */
- if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- if ((number_entry_CD!=number_entry) ||
- (number_disk_with_CD!=0) ||
- (number_disk!=0))
- err=ZIP_BADZIPFILE;
-
- /* size of the central directory */
- if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- /* offset of start of central directory with respect to the
- starting disk number */
- if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- /* zipfile global comment length */
- if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment)!=ZIP_OK)
- err=ZIP_ERRNO;
-
- if ((central_pos<offset_central_dir+size_central_dir) &&
- (err==ZIP_OK))
- err=ZIP_BADZIPFILE;
-
- if (err!=ZIP_OK)
- {
- ZCLOSE(ziinit.z_filefunc, ziinit.filestream);
- return NULL;
- }
-
- if (size_comment>0)
- {
- ziinit.globalcomment = ALLOC(size_comment+1);
- if (ziinit.globalcomment)
- {
- size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
- ziinit.globalcomment[size_comment]=0;
- }
- }
-
- byte_before_the_zipfile = central_pos -
- (offset_central_dir+size_central_dir);
- ziinit.add_position_when_writting_offset = byte_before_the_zipfile;
-
- {
- uLong size_central_dir_to_read = size_central_dir;
- size_t buf_size = SIZEDATA_INDATABLOCK;
- void* buf_read = (void*)ALLOC(buf_size);
- if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
- offset_central_dir + byte_before_the_zipfile,
- ZLIB_FILEFUNC_SEEK_SET) != 0)
- err=ZIP_ERRNO;
-
- while ((size_central_dir_to_read>0) && (err==ZIP_OK))
- {
- uLong read_this = SIZEDATA_INDATABLOCK;
- if (read_this > size_central_dir_to_read)
- read_this = size_central_dir_to_read;
- if (ZREAD(ziinit.z_filefunc, ziinit.filestream,buf_read,read_this) != read_this)
- err=ZIP_ERRNO;
-
- if (err==ZIP_OK)
- err = add_data_in_datablock(&ziinit.central_dir,buf_read,
- (uLong)read_this);
- size_central_dir_to_read-=read_this;
- }
- TRYFREE(buf_read);
- }
- ziinit.begin_pos = byte_before_the_zipfile;
- ziinit.number_entry = number_entry_CD;
-
- if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
- offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
- err=ZIP_ERRNO;
- }
-
- if (globalcomment)
- {
- *globalcomment = ziinit.globalcomment;
- }
-# endif /* !NO_ADDFILEINEXISTINGZIP*/
-
- if (err != ZIP_OK)
- {
-# ifndef NO_ADDFILEINEXISTINGZIP
- TRYFREE(ziinit.globalcomment);
-# endif /* !NO_ADDFILEINEXISTINGZIP*/
- TRYFREE(zi);
- return NULL;
- }
- else
- {
- *zi = ziinit;
- return (zipFile)zi;
- }
-}
-
-extern zipFile ZEXPORT zipOpen (pathname, append)
- const char *pathname;
- int append;
-{
- return zipOpen2(pathname,append,NULL,NULL);
-}
-
-extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
- extrafield_local, size_extrafield_local,
- extrafield_global, size_extrafield_global,
- comment, method, level, raw,
- windowBits, memLevel, strategy,
- password, crcForCrypting)
- zipFile file;
- const char* filename;
- const zip_fileinfo* zipfi;
- const void* extrafield_local;
- uInt size_extrafield_local;
- const void* extrafield_global;
- uInt size_extrafield_global;
- const char* comment;
- int method;
- int level;
- int raw;
- int windowBits;
- int memLevel;
- int strategy;
- const char* password;
- uLong crcForCrypting;
-{
- zip_internal* zi;
- uInt size_filename;
- uInt size_comment;
- uInt i;
- int err = ZIP_OK;
-
-# ifdef NOCRYPT
- if (password != NULL)
- return ZIP_PARAMERROR;
-# endif
-
- if (file == NULL)
- return ZIP_PARAMERROR;
- if ((method!=0) && (method!=Z_DEFLATED))
- return ZIP_PARAMERROR;
-
- zi = (zip_internal*)file;
-
- if (zi->in_opened_file_inzip == 1)
- {
- err = zipCloseFileInZip (file);
- if (err != ZIP_OK)
- return err;
- }
-
-
- if (filename==NULL)
- filename="-";
-
- if (comment==NULL)
- size_comment = 0;
- else
- size_comment = (uInt)strlen(comment);
-
- size_filename = (uInt)strlen(filename);
-
- if (zipfi == NULL)
- zi->ci.dosDate = 0;
- else
- {
- if (zipfi->dosDate != 0)
- zi->ci.dosDate = zipfi->dosDate;
- else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate);
- }
-
- zi->ci.flag = 0;
- if ((level==8) || (level==9))
- zi->ci.flag |= 2;
- if ((level==2))
- zi->ci.flag |= 4;
- if ((level==1))
- zi->ci.flag |= 6;
- if (password != NULL)
- zi->ci.flag |= 1;
-
- zi->ci.crc32 = 0;
- zi->ci.method = method;
- zi->ci.encrypt = 0;
- zi->ci.stream_initialised = 0;
- zi->ci.pos_in_buffered_data = 0;
- zi->ci.raw = raw;
- zi->ci.pos_local_header = ZTELL(zi->z_filefunc,zi->filestream) ;
- zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename +
- size_extrafield_global + size_comment;
- zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader);
-
- ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
- /* version info */
- ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4);
- ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/
- ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/
- ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/
- ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/
-
- if (zipfi==NULL)
- ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2);
- else
- ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2);
-
- if (zipfi==NULL)
- ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4);
- else
- ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4);
-
- ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header- zi->add_position_when_writting_offset,4);
-
- for (i=0;i<size_filename;i++)
- *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
-
- for (i=0;i<size_extrafield_global;i++)
- *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) =
- *(((const char*)extrafield_global)+i);
-
- for (i=0;i<size_comment;i++)
- *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
- size_extrafield_global+i) = *(comment+i);
- if (zi->ci.central_header == NULL)
- return ZIP_INTERNALERROR;
-
- /* write the local header */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC,4);
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2);
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2);
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4);
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2);
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield_local,2);
-
- if ((err==ZIP_OK) && (size_filename>0))
- if (ZWRITE(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename)
- err = ZIP_ERRNO;
-
- if ((err==ZIP_OK) && (size_extrafield_local>0))
- if (ZWRITE(zi->z_filefunc,zi->filestream,extrafield_local,size_extrafield_local)
- !=size_extrafield_local)
- err = ZIP_ERRNO;
-
- zi->ci.stream.avail_in = (uInt)0;
- zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
- zi->ci.stream.next_out = zi->ci.buffered_data;
- zi->ci.stream.total_in = 0;
- zi->ci.stream.total_out = 0;
-
- if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
- {
- zi->ci.stream.zalloc = (alloc_func)0;
- zi->ci.stream.zfree = (free_func)0;
- zi->ci.stream.opaque = (voidpf)0;
-
- if (windowBits>0)
- windowBits = -windowBits;
-
- err = deflateInit2(&zi->ci.stream, level,
- Z_DEFLATED, windowBits, memLevel, strategy);
-
- if (err==Z_OK)
- zi->ci.stream_initialised = 1;
- }
-# ifndef NOCRYPT
- zi->ci.crypt_header_size = 0;
- if ((err==Z_OK) && (password != NULL))
- {
- unsigned char bufHead[RAND_HEAD_LEN];
- unsigned int sizeHead;
- zi->ci.encrypt = 1;
- zi->ci.pcrc_32_tab = get_crc_table();
- /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
-
- sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
- zi->ci.crypt_header_size = sizeHead;
-
- if (ZWRITE(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
- err = ZIP_ERRNO;
- }
-# endif
-
- if (err==Z_OK)
- zi->in_opened_file_inzip = 1;
- return err;
-}
-
-extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
- extrafield_local, size_extrafield_local,
- extrafield_global, size_extrafield_global,
- comment, method, level, raw)
- zipFile file;
- const char* filename;
- const zip_fileinfo* zipfi;
- const void* extrafield_local;
- uInt size_extrafield_local;
- const void* extrafield_global;
- uInt size_extrafield_global;
- const char* comment;
- int method;
- int level;
- int raw;
-{
- return zipOpenNewFileInZip3 (file, filename, zipfi,
- extrafield_local, size_extrafield_local,
- extrafield_global, size_extrafield_global,
- comment, method, level, raw,
- -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
- NULL, 0);
-}
-
-extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi,
- extrafield_local, size_extrafield_local,
- extrafield_global, size_extrafield_global,
- comment, method, level)
- zipFile file;
- const char* filename;
- const zip_fileinfo* zipfi;
- const void* extrafield_local;
- uInt size_extrafield_local;
- const void* extrafield_global;
- uInt size_extrafield_global;
- const char* comment;
- int method;
- int level;
-{
- return zipOpenNewFileInZip2 (file, filename, zipfi,
- extrafield_local, size_extrafield_local,
- extrafield_global, size_extrafield_global,
- comment, method, level, 0);
-}
-
-local int zipFlushWriteBuffer(zi)
- zip_internal* zi;
-{
- int err=ZIP_OK;
-
- if (zi->ci.encrypt != 0)
- {
-#ifndef NOCRYPT
- uInt i;
- int t;
- for (i=0;i<zi->ci.pos_in_buffered_data;i++)
- zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab,
- zi->ci.buffered_data[i],t);
-#endif
- }
- if (ZWRITE(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data)
- !=zi->ci.pos_in_buffered_data)
- err = ZIP_ERRNO;
- zi->ci.pos_in_buffered_data = 0;
- return err;
-}
-
-extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
- zipFile file;
- const void* buf;
- unsigned len;
-{
- zip_internal* zi;
- int err=ZIP_OK;
-
- if (file == NULL)
- return ZIP_PARAMERROR;
- zi = (zip_internal*)file;
-
- if (zi->in_opened_file_inzip == 0)
- return ZIP_PARAMERROR;
-
- zi->ci.stream.next_in = (void*)buf;
- zi->ci.stream.avail_in = len;
- zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
-
- while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
- {
- if (zi->ci.stream.avail_out == 0)
- {
- if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
- err = ZIP_ERRNO;
- zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
- zi->ci.stream.next_out = zi->ci.buffered_data;
- }
-
-
- if(err != ZIP_OK)
- break;
-
- if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
- {
- uLong uTotalOutBefore = zi->ci.stream.total_out;
- err=deflate(&zi->ci.stream, Z_NO_FLUSH);
- zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
-
- }
- else
- {
- uInt copy_this,i;
- if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
- copy_this = zi->ci.stream.avail_in;
- else
- copy_this = zi->ci.stream.avail_out;
- for (i=0;i<copy_this;i++)
- *(((char*)zi->ci.stream.next_out)+i) =
- *(((const char*)zi->ci.stream.next_in)+i);
- {
- zi->ci.stream.avail_in -= copy_this;
- zi->ci.stream.avail_out-= copy_this;
- zi->ci.stream.next_in+= copy_this;
- zi->ci.stream.next_out+= copy_this;
- zi->ci.stream.total_in+= copy_this;
- zi->ci.stream.total_out+= copy_this;
- zi->ci.pos_in_buffered_data += copy_this;
- }
- }
- }
-
- return err;
-}
-
-extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
- zipFile file;
- uLong uncompressed_size;
- uLong crc32;
-{
- zip_internal* zi;
- uLong compressed_size;
- int err=ZIP_OK;
-
- if (file == NULL)
- return ZIP_PARAMERROR;
- zi = (zip_internal*)file;
-
- if (zi->in_opened_file_inzip == 0)
- return ZIP_PARAMERROR;
- zi->ci.stream.avail_in = 0;
-
- if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
- while (err==ZIP_OK)
- {
- uLong uTotalOutBefore;
- if (zi->ci.stream.avail_out == 0)
- {
- if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
- err = ZIP_ERRNO;
- zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
- zi->ci.stream.next_out = zi->ci.buffered_data;
- }
- uTotalOutBefore = zi->ci.stream.total_out;
- err=deflate(&zi->ci.stream, Z_FINISH);
- zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
- }
-
- if (err==Z_STREAM_END)
- err=ZIP_OK; /* this is normal */
-
- if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
- if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
- err = ZIP_ERRNO;
-
- if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
- {
- err=deflateEnd(&zi->ci.stream);
- zi->ci.stream_initialised = 0;
- }
-
- if (!zi->ci.raw)
- {
- crc32 = (uLong)zi->ci.crc32;
- uncompressed_size = (uLong)zi->ci.stream.total_in;
- }
- compressed_size = (uLong)zi->ci.stream.total_out;
-# ifndef NOCRYPT
- compressed_size += zi->ci.crypt_header_size;
-# endif
-
- ziplocal_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/
- ziplocal_putValue_inmemory(zi->ci.central_header+20,
- compressed_size,4); /*compr size*/
- if (zi->ci.stream.data_type == Z_ASCII)
- ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2);
- ziplocal_putValue_inmemory(zi->ci.central_header+24,
- uncompressed_size,4); /*uncompr size*/
-
- if (err==ZIP_OK)
- err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header,
- (uLong)zi->ci.size_centralheader);
- free(zi->ci.central_header);
-
- if (err==ZIP_OK)
- {
- long cur_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
- if (ZSEEK(zi->z_filefunc,zi->filestream,
- zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0)
- err = ZIP_ERRNO;
-
- if (err==ZIP_OK)
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */
-
- if (err==ZIP_OK) /* compressed size, unknown */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4);
-
- if (err==ZIP_OK) /* uncompressed size, unknown */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4);
-
- if (ZSEEK(zi->z_filefunc,zi->filestream,
- cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0)
- err = ZIP_ERRNO;
- }
-
- zi->number_entry ++;
- zi->in_opened_file_inzip = 0;
-
- return err;
-}
-
-extern int ZEXPORT zipCloseFileInZip (file)
- zipFile file;
-{
- return zipCloseFileInZipRaw (file,0,0);
-}
-
-extern int ZEXPORT zipClose (file, global_comment)
- zipFile file;
- const char* global_comment;
-{
- zip_internal* zi;
- int err = 0;
- uLong size_centraldir = 0;
- uLong centraldir_pos_inzip;
- uInt size_global_comment;
- if (file == NULL)
- return ZIP_PARAMERROR;
- zi = (zip_internal*)file;
-
- if (zi->in_opened_file_inzip == 1)
- {
- err = zipCloseFileInZip (file);
- }
-
-#ifndef NO_ADDFILEINEXISTINGZIP
- if (global_comment==NULL)
- global_comment = zi->globalcomment;
-#endif
- if (global_comment==NULL)
- size_global_comment = 0;
- else
- size_global_comment = (uInt)strlen(global_comment);
-
- centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
- if (err==ZIP_OK)
- {
- linkedlist_datablock_internal* ldi = zi->central_dir.first_block ;
- while (ldi!=NULL)
- {
- if ((err==ZIP_OK) && (ldi->filled_in_this_block>0))
- if (ZWRITE(zi->z_filefunc,zi->filestream,
- ldi->data,ldi->filled_in_this_block)
- !=ldi->filled_in_this_block )
- err = ZIP_ERRNO;
-
- size_centraldir += ldi->filled_in_this_block;
- ldi = ldi->next_datablock;
- }
- }
- free_datablock(zi->central_dir.first_block);
-
- if (err==ZIP_OK) /* Magic End */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
-
- if (err==ZIP_OK) /* number of this disk */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
-
- if (err==ZIP_OK) /* number of the disk with the start of the central directory */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
-
- if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
-
- if (err==ZIP_OK) /* total number of entries in the central dir */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
-
- if (err==ZIP_OK) /* size of the central directory */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4);
-
- if (err==ZIP_OK) /* offset of start of central directory with respect to the
- starting disk number */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,
- (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
-
- if (err==ZIP_OK) /* zipfile comment length */
- err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2);
-
- if ((err==ZIP_OK) && (size_global_comment>0))
- if (ZWRITE(zi->z_filefunc,zi->filestream,
- global_comment,size_global_comment) != size_global_comment)
- err = ZIP_ERRNO;
-
- if (ZCLOSE(zi->z_filefunc,zi->filestream) != 0)
- if (err == ZIP_OK)
- err = ZIP_ERRNO;
-
-#ifndef NO_ADDFILEINEXISTINGZIP
- TRYFREE(zi->globalcomment);
-#endif
- TRYFREE(zi);
-
- return err;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/minizip/zip.h b/funtools/util/zlib-1.2.3/contrib/minizip/zip.h
deleted file mode 100644
index acacce8..0000000
--- a/funtools/util/zlib-1.2.3/contrib/minizip/zip.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* zip.h -- IO for compress .zip files using zlib
- Version 1.01e, February 12th, 2005
-
- Copyright (C) 1998-2005 Gilles Vollant
-
- This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
- WinZip, InfoZip tools and compatible.
- Multi volume ZipFile (span) are not supported.
- Encryption compatible with pkzip 2.04g only supported
- Old compressions used by old PKZip 1.x are not supported
-
- For uncompress .zip file, look at unzip.h
-
-
- I WAIT FEEDBACK at mail info@winimage.com
- Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
-
- Condition of use and distribution are the same than zlib :
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
-
-*/
-
-/* for more info about .ZIP format, see
- http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
- http://www.info-zip.org/pub/infozip/doc/
- PkWare has also a specification at :
- ftp://ftp.pkware.com/probdesc.zip
-*/
-
-#ifndef _zip_H
-#define _zip_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#ifndef _ZLIBIOAPI_H
-#include "ioapi.h"
-#endif
-
-#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
-/* like the STRICT of WIN32, we define a pointer that cannot be converted
- from (void*) without cast */
-typedef struct TagzipFile__ { int unused; } zipFile__;
-typedef zipFile__ *zipFile;
-#else
-typedef voidp zipFile;
-#endif
-
-#define ZIP_OK (0)
-#define ZIP_EOF (0)
-#define ZIP_ERRNO (Z_ERRNO)
-#define ZIP_PARAMERROR (-102)
-#define ZIP_BADZIPFILE (-103)
-#define ZIP_INTERNALERROR (-104)
-
-#ifndef DEF_MEM_LEVEL
-# if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-# else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-# endif
-#endif
-/* default memLevel */
-
-/* tm_zip contain date/time info */
-typedef struct tm_zip_s
-{
- uInt tm_sec; /* seconds after the minute - [0,59] */
- uInt tm_min; /* minutes after the hour - [0,59] */
- uInt tm_hour; /* hours since midnight - [0,23] */
- uInt tm_mday; /* day of the month - [1,31] */
- uInt tm_mon; /* months since January - [0,11] */
- uInt tm_year; /* years - [1980..2044] */
-} tm_zip;
-
-typedef struct
-{
- tm_zip tmz_date; /* date in understandable format */
- uLong dosDate; /* if dos_date == 0, tmu_date is used */
-/* uLong flag; */ /* general purpose bit flag 2 bytes */
-
- uLong internal_fa; /* internal file attributes 2 bytes */
- uLong external_fa; /* external file attributes 4 bytes */
-} zip_fileinfo;
-
-typedef const char* zipcharpc;
-
-
-#define APPEND_STATUS_CREATE (0)
-#define APPEND_STATUS_CREATEAFTER (1)
-#define APPEND_STATUS_ADDINZIP (2)
-
-extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
-/*
- Create a zipfile.
- pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
- an Unix computer "zlib/zlib113.zip".
- if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
- will be created at the end of the file.
- (useful if the file contain a self extractor code)
- if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
- add files in existing zip (be sure you don't add file that doesn't exist)
- If the zipfile cannot be opened, the return value is NULL.
- Else, the return value is a zipFile Handle, usable with other function
- of this zip package.
-*/
-
-/* Note : there is no delete function into a zipfile.
- If you want delete file into a zipfile, you must open a zipfile, and create another
- Of couse, you can use RAW reading and writing to copy the file you did not want delte
-*/
-
-extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
- int append,
- zipcharpc* globalcomment,
- zlib_filefunc_def* pzlib_filefunc_def));
-
-extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
- const char* filename,
- const zip_fileinfo* zipfi,
- const void* extrafield_local,
- uInt size_extrafield_local,
- const void* extrafield_global,
- uInt size_extrafield_global,
- const char* comment,
- int method,
- int level));
-/*
- Open a file in the ZIP for writing.
- filename : the filename in zip (if NULL, '-' without quote will be used
- *zipfi contain supplemental information
- if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
- contains the extrafield data the the local header
- if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
- contains the extrafield data the the local header
- if comment != NULL, comment contain the comment string
- method contain the compression method (0 for store, Z_DEFLATED for deflate)
- level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
-*/
-
-
-extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
- const char* filename,
- const zip_fileinfo* zipfi,
- const void* extrafield_local,
- uInt size_extrafield_local,
- const void* extrafield_global,
- uInt size_extrafield_global,
- const char* comment,
- int method,
- int level,
- int raw));
-
-/*
- Same than zipOpenNewFileInZip, except if raw=1, we write raw file
- */
-
-extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
- const char* filename,
- const zip_fileinfo* zipfi,
- const void* extrafield_local,
- uInt size_extrafield_local,
- const void* extrafield_global,
- uInt size_extrafield_global,
- const char* comment,
- int method,
- int level,
- int raw,
- int windowBits,
- int memLevel,
- int strategy,
- const char* password,
- uLong crcForCtypting));
-
-/*
- Same than zipOpenNewFileInZip2, except
- windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
- password : crypting password (NULL for no crypting)
- crcForCtypting : crc of file to compress (needed for crypting)
- */
-
-
-extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
- const void* buf,
- unsigned len));
-/*
- Write data in the zipfile
-*/
-
-extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
-/*
- Close the current file in the zipfile
-*/
-
-extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
- uLong uncompressed_size,
- uLong crc32));
-/*
- Close the current file in the zipfile, for fiel opened with
- parameter raw=1 in zipOpenNewFileInZip2
- uncompressed_size and crc32 are value for the uncompressed size
-*/
-
-extern int ZEXPORT zipClose OF((zipFile file,
- const char* global_comment));
-/*
- Close the zipfile
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _zip_H */
diff --git a/funtools/util/zlib-1.2.3/contrib/pascal/example.pas b/funtools/util/zlib-1.2.3/contrib/pascal/example.pas
deleted file mode 100644
index 5518b36..0000000
--- a/funtools/util/zlib-1.2.3/contrib/pascal/example.pas
+++ /dev/null
@@ -1,599 +0,0 @@
-(* example.c -- usage example of the zlib compression library
- * Copyright (C) 1995-2003 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Pascal translation
- * Copyright (C) 1998 by Jacques Nomssi Nzali.
- * For conditions of distribution and use, see copyright notice in readme.txt
- *
- * Adaptation to the zlibpas interface
- * Copyright (C) 2003 by Cosmin Truta.
- * For conditions of distribution and use, see copyright notice in readme.txt
- *)
-
-program example;
-
-{$DEFINE TEST_COMPRESS}
-{DO NOT $DEFINE TEST_GZIO}
-{$DEFINE TEST_DEFLATE}
-{$DEFINE TEST_INFLATE}
-{$DEFINE TEST_FLUSH}
-{$DEFINE TEST_SYNC}
-{$DEFINE TEST_DICT}
-
-uses SysUtils, zlibpas;
-
-const TESTFILE = 'foo.gz';
-
-(* "hello world" would be more standard, but the repeated "hello"
- * stresses the compression code better, sorry...
- *)
-const hello: PChar = 'hello, hello!';
-
-const dictionary: PChar = 'hello';
-
-var dictId: LongInt; (* Adler32 value of the dictionary *)
-
-procedure CHECK_ERR(err: Integer; msg: String);
-begin
- if err <> Z_OK then
- begin
- WriteLn(msg, ' error: ', err);
- Halt(1);
- end;
-end;
-
-procedure EXIT_ERR(const msg: String);
-begin
- WriteLn('Error: ', msg);
- Halt(1);
-end;
-
-(* ===========================================================================
- * Test compress and uncompress
- *)
-{$IFDEF TEST_COMPRESS}
-procedure test_compress(compr: Pointer; comprLen: LongInt;
- uncompr: Pointer; uncomprLen: LongInt);
-var err: Integer;
- len: LongInt;
-begin
- len := StrLen(hello)+1;
-
- err := compress(compr, comprLen, hello, len);
- CHECK_ERR(err, 'compress');
-
- StrCopy(PChar(uncompr), 'garbage');
-
- err := uncompress(uncompr, uncomprLen, compr, comprLen);
- CHECK_ERR(err, 'uncompress');
-
- if StrComp(PChar(uncompr), hello) <> 0 then
- EXIT_ERR('bad uncompress')
- else
- WriteLn('uncompress(): ', PChar(uncompr));
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test read/write of .gz files
- *)
-{$IFDEF TEST_GZIO}
-procedure test_gzio(const fname: PChar; (* compressed file name *)
- uncompr: Pointer;
- uncomprLen: LongInt);
-var err: Integer;
- len: Integer;
- zfile: gzFile;
- pos: LongInt;
-begin
- len := StrLen(hello)+1;
-
- zfile := gzopen(fname, 'wb');
- if zfile = NIL then
- begin
- WriteLn('gzopen error');
- Halt(1);
- end;
- gzputc(zfile, 'h');
- if gzputs(zfile, 'ello') <> 4 then
- begin
- WriteLn('gzputs err: ', gzerror(zfile, err));
- Halt(1);
- end;
- {$IFDEF GZ_FORMAT_STRING}
- if gzprintf(zfile, ', %s!', 'hello') <> 8 then
- begin
- WriteLn('gzprintf err: ', gzerror(zfile, err));
- Halt(1);
- end;
- {$ELSE}
- if gzputs(zfile, ', hello!') <> 8 then
- begin
- WriteLn('gzputs err: ', gzerror(zfile, err));
- Halt(1);
- end;
- {$ENDIF}
- gzseek(zfile, 1, SEEK_CUR); (* add one zero byte *)
- gzclose(zfile);
-
- zfile := gzopen(fname, 'rb');
- if zfile = NIL then
- begin
- WriteLn('gzopen error');
- Halt(1);
- end;
-
- StrCopy(PChar(uncompr), 'garbage');
-
- if gzread(zfile, uncompr, uncomprLen) <> len then
- begin
- WriteLn('gzread err: ', gzerror(zfile, err));
- Halt(1);
- end;
- if StrComp(PChar(uncompr), hello) <> 0 then
- begin
- WriteLn('bad gzread: ', PChar(uncompr));
- Halt(1);
- end
- else
- WriteLn('gzread(): ', PChar(uncompr));
-
- pos := gzseek(zfile, -8, SEEK_CUR);
- if (pos <> 6) or (gztell(zfile) <> pos) then
- begin
- WriteLn('gzseek error, pos=', pos, ', gztell=', gztell(zfile));
- Halt(1);
- end;
-
- if gzgetc(zfile) <> ' ' then
- begin
- WriteLn('gzgetc error');
- Halt(1);
- end;
-
- if gzungetc(' ', zfile) <> ' ' then
- begin
- WriteLn('gzungetc error');
- Halt(1);
- end;
-
- gzgets(zfile, PChar(uncompr), uncomprLen);
- uncomprLen := StrLen(PChar(uncompr));
- if uncomprLen <> 7 then (* " hello!" *)
- begin
- WriteLn('gzgets err after gzseek: ', gzerror(zfile, err));
- Halt(1);
- end;
- if StrComp(PChar(uncompr), hello + 6) <> 0 then
- begin
- WriteLn('bad gzgets after gzseek');
- Halt(1);
- end
- else
- WriteLn('gzgets() after gzseek: ', PChar(uncompr));
-
- gzclose(zfile);
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test deflate with small buffers
- *)
-{$IFDEF TEST_DEFLATE}
-procedure test_deflate(compr: Pointer; comprLen: LongInt);
-var c_stream: z_stream; (* compression stream *)
- err: Integer;
- len: LongInt;
-begin
- len := StrLen(hello)+1;
-
- c_stream.zalloc := NIL;
- c_stream.zfree := NIL;
- c_stream.opaque := NIL;
-
- err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION);
- CHECK_ERR(err, 'deflateInit');
-
- c_stream.next_in := hello;
- c_stream.next_out := compr;
-
- while (c_stream.total_in <> len) and
- (c_stream.total_out < comprLen) do
- begin
- c_stream.avail_out := 1; { force small buffers }
- c_stream.avail_in := 1;
- err := deflate(c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, 'deflate');
- end;
-
- (* Finish the stream, still forcing small buffers: *)
- while TRUE do
- begin
- c_stream.avail_out := 1;
- err := deflate(c_stream, Z_FINISH);
- if err = Z_STREAM_END then
- break;
- CHECK_ERR(err, 'deflate');
- end;
-
- err := deflateEnd(c_stream);
- CHECK_ERR(err, 'deflateEnd');
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test inflate with small buffers
- *)
-{$IFDEF TEST_INFLATE}
-procedure test_inflate(compr: Pointer; comprLen : LongInt;
- uncompr: Pointer; uncomprLen : LongInt);
-var err: Integer;
- d_stream: z_stream; (* decompression stream *)
-begin
- StrCopy(PChar(uncompr), 'garbage');
-
- d_stream.zalloc := NIL;
- d_stream.zfree := NIL;
- d_stream.opaque := NIL;
-
- d_stream.next_in := compr;
- d_stream.avail_in := 0;
- d_stream.next_out := uncompr;
-
- err := inflateInit(d_stream);
- CHECK_ERR(err, 'inflateInit');
-
- while (d_stream.total_out < uncomprLen) and
- (d_stream.total_in < comprLen) do
- begin
- d_stream.avail_out := 1; (* force small buffers *)
- d_stream.avail_in := 1;
- err := inflate(d_stream, Z_NO_FLUSH);
- if err = Z_STREAM_END then
- break;
- CHECK_ERR(err, 'inflate');
- end;
-
- err := inflateEnd(d_stream);
- CHECK_ERR(err, 'inflateEnd');
-
- if StrComp(PChar(uncompr), hello) <> 0 then
- EXIT_ERR('bad inflate')
- else
- WriteLn('inflate(): ', PChar(uncompr));
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test deflate with large buffers and dynamic change of compression level
- *)
-{$IFDEF TEST_DEFLATE}
-procedure test_large_deflate(compr: Pointer; comprLen: LongInt;
- uncompr: Pointer; uncomprLen: LongInt);
-var c_stream: z_stream; (* compression stream *)
- err: Integer;
-begin
- c_stream.zalloc := NIL;
- c_stream.zfree := NIL;
- c_stream.opaque := NIL;
-
- err := deflateInit(c_stream, Z_BEST_SPEED);
- CHECK_ERR(err, 'deflateInit');
-
- c_stream.next_out := compr;
- c_stream.avail_out := Integer(comprLen);
-
- (* At this point, uncompr is still mostly zeroes, so it should compress
- * very well:
- *)
- c_stream.next_in := uncompr;
- c_stream.avail_in := Integer(uncomprLen);
- err := deflate(c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, 'deflate');
- if c_stream.avail_in <> 0 then
- EXIT_ERR('deflate not greedy');
-
- (* Feed in already compressed data and switch to no compression: *)
- deflateParams(c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
- c_stream.next_in := compr;
- c_stream.avail_in := Integer(comprLen div 2);
- err := deflate(c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, 'deflate');
-
- (* Switch back to compressing mode: *)
- deflateParams(c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
- c_stream.next_in := uncompr;
- c_stream.avail_in := Integer(uncomprLen);
- err := deflate(c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, 'deflate');
-
- err := deflate(c_stream, Z_FINISH);
- if err <> Z_STREAM_END then
- EXIT_ERR('deflate should report Z_STREAM_END');
-
- err := deflateEnd(c_stream);
- CHECK_ERR(err, 'deflateEnd');
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test inflate with large buffers
- *)
-{$IFDEF TEST_INFLATE}
-procedure test_large_inflate(compr: Pointer; comprLen: LongInt;
- uncompr: Pointer; uncomprLen: LongInt);
-var err: Integer;
- d_stream: z_stream; (* decompression stream *)
-begin
- StrCopy(PChar(uncompr), 'garbage');
-
- d_stream.zalloc := NIL;
- d_stream.zfree := NIL;
- d_stream.opaque := NIL;
-
- d_stream.next_in := compr;
- d_stream.avail_in := Integer(comprLen);
-
- err := inflateInit(d_stream);
- CHECK_ERR(err, 'inflateInit');
-
- while TRUE do
- begin
- d_stream.next_out := uncompr; (* discard the output *)
- d_stream.avail_out := Integer(uncomprLen);
- err := inflate(d_stream, Z_NO_FLUSH);
- if err = Z_STREAM_END then
- break;
- CHECK_ERR(err, 'large inflate');
- end;
-
- err := inflateEnd(d_stream);
- CHECK_ERR(err, 'inflateEnd');
-
- if d_stream.total_out <> 2 * uncomprLen + comprLen div 2 then
- begin
- WriteLn('bad large inflate: ', d_stream.total_out);
- Halt(1);
- end
- else
- WriteLn('large_inflate(): OK');
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test deflate with full flush
- *)
-{$IFDEF TEST_FLUSH}
-procedure test_flush(compr: Pointer; var comprLen : LongInt);
-var c_stream: z_stream; (* compression stream *)
- err: Integer;
- len: Integer;
-begin
- len := StrLen(hello)+1;
-
- c_stream.zalloc := NIL;
- c_stream.zfree := NIL;
- c_stream.opaque := NIL;
-
- err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION);
- CHECK_ERR(err, 'deflateInit');
-
- c_stream.next_in := hello;
- c_stream.next_out := compr;
- c_stream.avail_in := 3;
- c_stream.avail_out := Integer(comprLen);
- err := deflate(c_stream, Z_FULL_FLUSH);
- CHECK_ERR(err, 'deflate');
-
- Inc(PByteArray(compr)^[3]); (* force an error in first compressed block *)
- c_stream.avail_in := len - 3;
-
- err := deflate(c_stream, Z_FINISH);
- if err <> Z_STREAM_END then
- CHECK_ERR(err, 'deflate');
-
- err := deflateEnd(c_stream);
- CHECK_ERR(err, 'deflateEnd');
-
- comprLen := c_stream.total_out;
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test inflateSync()
- *)
-{$IFDEF TEST_SYNC}
-procedure test_sync(compr: Pointer; comprLen: LongInt;
- uncompr: Pointer; uncomprLen : LongInt);
-var err: Integer;
- d_stream: z_stream; (* decompression stream *)
-begin
- StrCopy(PChar(uncompr), 'garbage');
-
- d_stream.zalloc := NIL;
- d_stream.zfree := NIL;
- d_stream.opaque := NIL;
-
- d_stream.next_in := compr;
- d_stream.avail_in := 2; (* just read the zlib header *)
-
- err := inflateInit(d_stream);
- CHECK_ERR(err, 'inflateInit');
-
- d_stream.next_out := uncompr;
- d_stream.avail_out := Integer(uncomprLen);
-
- inflate(d_stream, Z_NO_FLUSH);
- CHECK_ERR(err, 'inflate');
-
- d_stream.avail_in := Integer(comprLen-2); (* read all compressed data *)
- err := inflateSync(d_stream); (* but skip the damaged part *)
- CHECK_ERR(err, 'inflateSync');
-
- err := inflate(d_stream, Z_FINISH);
- if err <> Z_DATA_ERROR then
- EXIT_ERR('inflate should report DATA_ERROR');
- (* Because of incorrect adler32 *)
-
- err := inflateEnd(d_stream);
- CHECK_ERR(err, 'inflateEnd');
-
- WriteLn('after inflateSync(): hel', PChar(uncompr));
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test deflate with preset dictionary
- *)
-{$IFDEF TEST_DICT}
-procedure test_dict_deflate(compr: Pointer; comprLen: LongInt);
-var c_stream: z_stream; (* compression stream *)
- err: Integer;
-begin
- c_stream.zalloc := NIL;
- c_stream.zfree := NIL;
- c_stream.opaque := NIL;
-
- err := deflateInit(c_stream, Z_BEST_COMPRESSION);
- CHECK_ERR(err, 'deflateInit');
-
- err := deflateSetDictionary(c_stream, dictionary, StrLen(dictionary));
- CHECK_ERR(err, 'deflateSetDictionary');
-
- dictId := c_stream.adler;
- c_stream.next_out := compr;
- c_stream.avail_out := Integer(comprLen);
-
- c_stream.next_in := hello;
- c_stream.avail_in := StrLen(hello)+1;
-
- err := deflate(c_stream, Z_FINISH);
- if err <> Z_STREAM_END then
- EXIT_ERR('deflate should report Z_STREAM_END');
-
- err := deflateEnd(c_stream);
- CHECK_ERR(err, 'deflateEnd');
-end;
-{$ENDIF}
-
-(* ===========================================================================
- * Test inflate with a preset dictionary
- *)
-{$IFDEF TEST_DICT}
-procedure test_dict_inflate(compr: Pointer; comprLen: LongInt;
- uncompr: Pointer; uncomprLen: LongInt);
-var err: Integer;
- d_stream: z_stream; (* decompression stream *)
-begin
- StrCopy(PChar(uncompr), 'garbage');
-
- d_stream.zalloc := NIL;
- d_stream.zfree := NIL;
- d_stream.opaque := NIL;
-
- d_stream.next_in := compr;
- d_stream.avail_in := Integer(comprLen);
-
- err := inflateInit(d_stream);
- CHECK_ERR(err, 'inflateInit');
-
- d_stream.next_out := uncompr;
- d_stream.avail_out := Integer(uncomprLen);
-
- while TRUE do
- begin
- err := inflate(d_stream, Z_NO_FLUSH);
- if err = Z_STREAM_END then
- break;
- if err = Z_NEED_DICT then
- begin
- if d_stream.adler <> dictId then
- EXIT_ERR('unexpected dictionary');
- err := inflateSetDictionary(d_stream, dictionary, StrLen(dictionary));
- end;
- CHECK_ERR(err, 'inflate with dict');
- end;
-
- err := inflateEnd(d_stream);
- CHECK_ERR(err, 'inflateEnd');
-
- if StrComp(PChar(uncompr), hello) <> 0 then
- EXIT_ERR('bad inflate with dict')
- else
- WriteLn('inflate with dictionary: ', PChar(uncompr));
-end;
-{$ENDIF}
-
-var compr, uncompr: Pointer;
- comprLen, uncomprLen: LongInt;
-
-begin
- if zlibVersion^ <> ZLIB_VERSION[1] then
- EXIT_ERR('Incompatible zlib version');
-
- WriteLn('zlib version: ', zlibVersion);
- WriteLn('zlib compile flags: ', Format('0x%x', [zlibCompileFlags]));
-
- comprLen := 10000 * SizeOf(Integer); (* don't overflow on MSDOS *)
- uncomprLen := comprLen;
- GetMem(compr, comprLen);
- GetMem(uncompr, uncomprLen);
- if (compr = NIL) or (uncompr = NIL) then
- EXIT_ERR('Out of memory');
- (* compr and uncompr are cleared to avoid reading uninitialized
- * data and to ensure that uncompr compresses well.
- *)
- FillChar(compr^, comprLen, 0);
- FillChar(uncompr^, uncomprLen, 0);
-
- {$IFDEF TEST_COMPRESS}
- WriteLn('** Testing compress');
- test_compress(compr, comprLen, uncompr, uncomprLen);
- {$ENDIF}
-
- {$IFDEF TEST_GZIO}
- WriteLn('** Testing gzio');
- if ParamCount >= 1 then
- test_gzio(ParamStr(1), uncompr, uncomprLen)
- else
- test_gzio(TESTFILE, uncompr, uncomprLen);
- {$ENDIF}
-
- {$IFDEF TEST_DEFLATE}
- WriteLn('** Testing deflate with small buffers');
- test_deflate(compr, comprLen);
- {$ENDIF}
- {$IFDEF TEST_INFLATE}
- WriteLn('** Testing inflate with small buffers');
- test_inflate(compr, comprLen, uncompr, uncomprLen);
- {$ENDIF}
-
- {$IFDEF TEST_DEFLATE}
- WriteLn('** Testing deflate with large buffers');
- test_large_deflate(compr, comprLen, uncompr, uncomprLen);
- {$ENDIF}
- {$IFDEF TEST_INFLATE}
- WriteLn('** Testing inflate with large buffers');
- test_large_inflate(compr, comprLen, uncompr, uncomprLen);
- {$ENDIF}
-
- {$IFDEF TEST_FLUSH}
- WriteLn('** Testing deflate with full flush');
- test_flush(compr, comprLen);
- {$ENDIF}
- {$IFDEF TEST_SYNC}
- WriteLn('** Testing inflateSync');
- test_sync(compr, comprLen, uncompr, uncomprLen);
- {$ENDIF}
- comprLen := uncomprLen;
-
- {$IFDEF TEST_DICT}
- WriteLn('** Testing deflate and inflate with preset dictionary');
- test_dict_deflate(compr, comprLen);
- test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
- {$ENDIF}
-
- FreeMem(compr, comprLen);
- FreeMem(uncompr, uncomprLen);
-end.
diff --git a/funtools/util/zlib-1.2.3/contrib/pascal/readme.txt b/funtools/util/zlib-1.2.3/contrib/pascal/readme.txt
deleted file mode 100644
index 60e87c8..0000000
--- a/funtools/util/zlib-1.2.3/contrib/pascal/readme.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-
-This directory contains a Pascal (Delphi, Kylix) interface to the
-zlib data compression library.
-
-
-Directory listing
-=================
-
-zlibd32.mak makefile for Borland C++
-example.pas usage example of zlib
-zlibpas.pas the Pascal interface to zlib
-readme.txt this file
-
-
-Compatibility notes
-===================
-
-- Although the name "zlib" would have been more normal for the
- zlibpas unit, this name is already taken by Borland's ZLib unit.
- This is somehow unfortunate, because that unit is not a genuine
- interface to the full-fledged zlib functionality, but a suite of
- class wrappers around zlib streams. Other essential features,
- such as checksums, are missing.
- It would have been more appropriate for that unit to have a name
- like "ZStreams", or something similar.
-
-- The C and zlib-supplied types int, uInt, long, uLong, etc. are
- translated directly into Pascal types of similar sizes (Integer,
- LongInt, etc.), to avoid namespace pollution. In particular,
- there is no conversion of unsigned int into a Pascal unsigned
- integer. The Word type is non-portable and has the same size
- (16 bits) both in a 16-bit and in a 32-bit environment, unlike
- Integer. Even if there is a 32-bit Cardinal type, there is no
- real need for unsigned int in zlib under a 32-bit environment.
-
-- Except for the callbacks, the zlib function interfaces are
- assuming the calling convention normally used in Pascal
- (__pascal for DOS and Windows16, __fastcall for Windows32).
- Since the cdecl keyword is used, the old Turbo Pascal does
- not work with this interface.
-
-- The gz* function interfaces are not translated, to avoid
- interfacing problems with the C runtime library. Besides,
- gzprintf(gzFile file, const char *format, ...)
- cannot be translated into Pascal.
-
-
-Legal issues
-============
-
-The zlibpas interface is:
- Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler.
- Copyright (C) 1998 by Bob Dellaca.
- Copyright (C) 2003 by Cosmin Truta.
-
-The example program is:
- Copyright (C) 1995-2003 by Jean-loup Gailly.
- Copyright (C) 1998,1999,2000 by Jacques Nomssi Nzali.
- Copyright (C) 2003 by Cosmin Truta.
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
diff --git a/funtools/util/zlib-1.2.3/contrib/pascal/zlibd32.mak b/funtools/util/zlib-1.2.3/contrib/pascal/zlibd32.mak
deleted file mode 100644
index 88fafa0..0000000
--- a/funtools/util/zlib-1.2.3/contrib/pascal/zlibd32.mak
+++ /dev/null
@@ -1,93 +0,0 @@
-# Makefile for zlib
-# For use with Delphi and C++ Builder under Win32
-# Updated for zlib 1.2.x by Cosmin Truta
-
-# ------------ Borland C++ ------------
-
-# This project uses the Delphi (fastcall/register) calling convention:
-LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl
-
-CC = bcc32
-LD = bcc32
-AR = tlib
-# do not use "-pr" in CFLAGS
-CFLAGS = -a -d -k- -O2 $(LOC)
-LDFLAGS =
-
-
-# variables
-ZLIB_LIB = zlib.lib
-
-OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
-OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj
-OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
-
-
-# targets
-all: $(ZLIB_LIB) example.exe minigzip.exe
-
-.c.obj:
- $(CC) -c $(CFLAGS) $*.c
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-
-
-# For the sake of the old Borland make,
-# the command line is cut to fit in the MS-DOS 128 byte limit:
-$(ZLIB_LIB): $(OBJ1) $(OBJ2)
- -del $(ZLIB_LIB)
- $(AR) $(ZLIB_LIB) $(OBJP1)
- $(AR) $(ZLIB_LIB) $(OBJP2)
-
-
-# testing
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-example.exe: example.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
-
-minigzip.exe: minigzip.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
-
-
-# cleanup
-clean:
- -del *.obj
- -del *.exe
- -del *.lib
- -del *.tds
- -del zlib.bak
- -del foo.gz
-
diff --git a/funtools/util/zlib-1.2.3/contrib/pascal/zlibpas.pas b/funtools/util/zlib-1.2.3/contrib/pascal/zlibpas.pas
deleted file mode 100644
index 836848c..0000000
--- a/funtools/util/zlib-1.2.3/contrib/pascal/zlibpas.pas
+++ /dev/null
@@ -1,236 +0,0 @@
-(* zlibpas -- Pascal interface to the zlib data compression library
- *
- * Copyright (C) 2003 Cosmin Truta.
- * Derived from original sources by Bob Dellaca.
- * For conditions of distribution and use, see copyright notice in readme.txt
- *)
-
-unit zlibpas;
-
-interface
-
-const
- ZLIB_VERSION = '1.2.3';
-
-type
- alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
- cdecl;
- free_func = procedure(opaque, address: Pointer);
- cdecl;
-
- in_func = function(opaque: Pointer; var buf: PByte): Integer;
- cdecl;
- out_func = function(opaque: Pointer; buf: PByte; size: Integer): Integer;
- cdecl;
-
- z_streamp = ^z_stream;
- z_stream = packed record
- next_in: PChar; (* next input byte *)
- avail_in: Integer; (* number of bytes available at next_in *)
- total_in: LongInt; (* total nb of input bytes read so far *)
-
- next_out: PChar; (* next output byte should be put there *)
- avail_out: Integer; (* remaining free space at next_out *)
- total_out: LongInt; (* total nb of bytes output so far *)
-
- msg: PChar; (* last error message, NULL if no error *)
- state: Pointer; (* not visible by applications *)
-
- zalloc: alloc_func; (* used to allocate the internal state *)
- zfree: free_func; (* used to free the internal state *)
- opaque: Pointer; (* private data object passed to zalloc and zfree *)
-
- data_type: Integer; (* best guess about the data type: ascii or binary *)
- adler: LongInt; (* adler32 value of the uncompressed data *)
- reserved: LongInt; (* reserved for future use *)
- end;
-
-(* constants *)
-const
- Z_NO_FLUSH = 0;
- Z_PARTIAL_FLUSH = 1;
- Z_SYNC_FLUSH = 2;
- Z_FULL_FLUSH = 3;
- Z_FINISH = 4;
-
- Z_OK = 0;
- Z_STREAM_END = 1;
- Z_NEED_DICT = 2;
- Z_ERRNO = -1;
- Z_STREAM_ERROR = -2;
- Z_DATA_ERROR = -3;
- Z_MEM_ERROR = -4;
- Z_BUF_ERROR = -5;
- Z_VERSION_ERROR = -6;
-
- Z_NO_COMPRESSION = 0;
- Z_BEST_SPEED = 1;
- Z_BEST_COMPRESSION = 9;
- Z_DEFAULT_COMPRESSION = -1;
-
- Z_FILTERED = 1;
- Z_HUFFMAN_ONLY = 2;
- Z_RLE = 3;
- Z_DEFAULT_STRATEGY = 0;
-
- Z_BINARY = 0;
- Z_ASCII = 1;
- Z_UNKNOWN = 2;
-
- Z_DEFLATED = 8;
-
-(* basic functions *)
-function zlibVersion: PChar;
-function deflateInit(var strm: z_stream; level: Integer): Integer;
-function deflate(var strm: z_stream; flush: Integer): Integer;
-function deflateEnd(var strm: z_stream): Integer;
-function inflateInit(var strm: z_stream): Integer;
-function inflate(var strm: z_stream; flush: Integer): Integer;
-function inflateEnd(var strm: z_stream): Integer;
-
-(* advanced functions *)
-function deflateInit2(var strm: z_stream; level, method, windowBits,
- memLevel, strategy: Integer): Integer;
-function deflateSetDictionary(var strm: z_stream; const dictionary: PChar;
- dictLength: Integer): Integer;
-function deflateCopy(var dest, source: z_stream): Integer;
-function deflateReset(var strm: z_stream): Integer;
-function deflateParams(var strm: z_stream; level, strategy: Integer): Integer;
-function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt;
-function deflatePrime(var strm: z_stream; bits, value: Integer): Integer;
-function inflateInit2(var strm: z_stream; windowBits: Integer): Integer;
-function inflateSetDictionary(var strm: z_stream; const dictionary: PChar;
- dictLength: Integer): Integer;
-function inflateSync(var strm: z_stream): Integer;
-function inflateCopy(var dest, source: z_stream): Integer;
-function inflateReset(var strm: z_stream): Integer;
-function inflateBackInit(var strm: z_stream;
- windowBits: Integer; window: PChar): Integer;
-function inflateBack(var strm: z_stream; in_fn: in_func; in_desc: Pointer;
- out_fn: out_func; out_desc: Pointer): Integer;
-function inflateBackEnd(var strm: z_stream): Integer;
-function zlibCompileFlags: LongInt;
-
-(* utility functions *)
-function compress(dest: PChar; var destLen: LongInt;
- const source: PChar; sourceLen: LongInt): Integer;
-function compress2(dest: PChar; var destLen: LongInt;
- const source: PChar; sourceLen: LongInt;
- level: Integer): Integer;
-function compressBound(sourceLen: LongInt): LongInt;
-function uncompress(dest: PChar; var destLen: LongInt;
- const source: PChar; sourceLen: LongInt): Integer;
-
-(* checksum functions *)
-function adler32(adler: LongInt; const buf: PChar; len: Integer): LongInt;
-function crc32(crc: LongInt; const buf: PChar; len: Integer): LongInt;
-
-(* various hacks, don't look :) *)
-function deflateInit_(var strm: z_stream; level: Integer;
- const version: PChar; stream_size: Integer): Integer;
-function inflateInit_(var strm: z_stream; const version: PChar;
- stream_size: Integer): Integer;
-function deflateInit2_(var strm: z_stream;
- level, method, windowBits, memLevel, strategy: Integer;
- const version: PChar; stream_size: Integer): Integer;
-function inflateInit2_(var strm: z_stream; windowBits: Integer;
- const version: PChar; stream_size: Integer): Integer;
-function inflateBackInit_(var strm: z_stream;
- windowBits: Integer; window: PChar;
- const version: PChar; stream_size: Integer): Integer;
-
-
-implementation
-
-{$L adler32.obj}
-{$L compress.obj}
-{$L crc32.obj}
-{$L deflate.obj}
-{$L infback.obj}
-{$L inffast.obj}
-{$L inflate.obj}
-{$L inftrees.obj}
-{$L trees.obj}
-{$L uncompr.obj}
-{$L zutil.obj}
-
-function adler32; external;
-function compress; external;
-function compress2; external;
-function compressBound; external;
-function crc32; external;
-function deflate; external;
-function deflateBound; external;
-function deflateCopy; external;
-function deflateEnd; external;
-function deflateInit_; external;
-function deflateInit2_; external;
-function deflateParams; external;
-function deflatePrime; external;
-function deflateReset; external;
-function deflateSetDictionary; external;
-function inflate; external;
-function inflateBack; external;
-function inflateBackEnd; external;
-function inflateBackInit_; external;
-function inflateCopy; external;
-function inflateEnd; external;
-function inflateInit_; external;
-function inflateInit2_; external;
-function inflateReset; external;
-function inflateSetDictionary; external;
-function inflateSync; external;
-function uncompress; external;
-function zlibCompileFlags; external;
-function zlibVersion; external;
-
-function deflateInit(var strm: z_stream; level: Integer): Integer;
-begin
- Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream));
-end;
-
-function deflateInit2(var strm: z_stream; level, method, windowBits, memLevel,
- strategy: Integer): Integer;
-begin
- Result := deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- ZLIB_VERSION, sizeof(z_stream));
-end;
-
-function inflateInit(var strm: z_stream): Integer;
-begin
- Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream));
-end;
-
-function inflateInit2(var strm: z_stream; windowBits: Integer): Integer;
-begin
- Result := inflateInit2_(strm, windowBits, ZLIB_VERSION, sizeof(z_stream));
-end;
-
-function inflateBackInit(var strm: z_stream;
- windowBits: Integer; window: PChar): Integer;
-begin
- Result := inflateBackInit_(strm, windowBits, window,
- ZLIB_VERSION, sizeof(z_stream));
-end;
-
-function _malloc(Size: Integer): Pointer; cdecl;
-begin
- GetMem(Result, Size);
-end;
-
-procedure _free(Block: Pointer); cdecl;
-begin
- FreeMem(Block);
-end;
-
-procedure _memset(P: Pointer; B: Byte; count: Integer); cdecl;
-begin
- FillChar(P^, count, B);
-end;
-
-procedure _memcpy(dest, source: Pointer; count: Integer); cdecl;
-begin
- Move(source^, dest^, count);
-end;
-
-end.
diff --git a/funtools/util/zlib-1.2.3/contrib/puff/Makefile b/funtools/util/zlib-1.2.3/contrib/puff/Makefile
deleted file mode 100644
index b6b6940..0000000
--- a/funtools/util/zlib-1.2.3/contrib/puff/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-puff: puff.c puff.h
- cc -DTEST -o puff puff.c
-
-test: puff
- puff zeros.raw
-
-clean:
- rm -f puff puff.o
diff --git a/funtools/util/zlib-1.2.3/contrib/puff/README b/funtools/util/zlib-1.2.3/contrib/puff/README
deleted file mode 100644
index bbc4cb5..0000000
--- a/funtools/util/zlib-1.2.3/contrib/puff/README
+++ /dev/null
@@ -1,63 +0,0 @@
-Puff -- A Simple Inflate
-3 Mar 2003
-Mark Adler
-madler@alumni.caltech.edu
-
-What this is --
-
-puff.c provides the routine puff() to decompress the deflate data format. It
-does so more slowly than zlib, but the code is about one-fifth the size of the
-inflate code in zlib, and written to be very easy to read.
-
-Why I wrote this --
-
-puff.c was written to document the deflate format unambiguously, by virtue of
-being working C code. It is meant to supplement RFC 1951, which formally
-describes the deflate format. I have received many questions on details of the
-deflate format, and I hope that reading this code will answer those questions.
-puff.c is heavily commented with details of the deflate format, especially
-those little nooks and cranies of the format that might not be obvious from a
-specification.
-
-puff.c may also be useful in applications where code size or memory usage is a
-very limited resource, and speed is not as important.
-
-How to use it --
-
-Well, most likely you should just be reading puff.c and using zlib for actual
-applications, but if you must ...
-
-Include puff.h in your code, which provides this prototype:
-
-int puff(unsigned char *dest, /* pointer to destination pointer */
- unsigned long *destlen, /* amount of output space */
- unsigned char *source, /* pointer to source data pointer */
- unsigned long *sourcelen); /* amount of input available */
-
-Then you can call puff() to decompress a deflate stream that is in memory in
-its entirety at source, to a sufficiently sized block of memory for the
-decompressed data at dest. puff() is the only external symbol in puff.c The
-only C library functions that puff.c needs are setjmp() and longjmp(), which
-are used to simplify error checking in the code to improve readabilty. puff.c
-does no memory allocation, and uses less than 2K bytes off of the stack.
-
-If destlen is not enough space for the uncompressed data, then inflate will
-return an error without writing more than destlen bytes. Note that this means
-that in order to decompress the deflate data successfully, you need to know
-the size of the uncompressed data ahead of time.
-
-If needed, puff() can determine the size of the uncompressed data with no
-output space. This is done by passing dest equal to (unsigned char *)0. Then
-the initial value of *destlen is ignored and *destlen is set to the length of
-the uncompressed data. So if the size of the uncompressed data is not known,
-then two passes of puff() can be used--first to determine the size, and second
-to do the actual inflation after allocating the appropriate memory. Not
-pretty, but it works. (This is one of the reasons you should be using zlib.)
-
-The deflate format is self-terminating. If the deflate stream does not end
-in *sourcelen bytes, puff() will return an error without reading at or past
-endsource.
-
-On return, *sourcelen is updated to the amount of input data consumed, and
-*destlen is updated to the size of the uncompressed data. See the comments
-in puff.c for the possible return codes for puff().
diff --git a/funtools/util/zlib-1.2.3/contrib/puff/puff.c b/funtools/util/zlib-1.2.3/contrib/puff/puff.c
deleted file mode 100644
index ce0cc40..0000000
--- a/funtools/util/zlib-1.2.3/contrib/puff/puff.c
+++ /dev/null
@@ -1,837 +0,0 @@
-/*
- * puff.c
- * Copyright (C) 2002-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in puff.h
- * version 1.8, 9 Jan 2004
- *
- * puff.c is a simple inflate written to be an unambiguous way to specify the
- * deflate format. It is not written for speed but rather simplicity. As a
- * side benefit, this code might actually be useful when small code is more
- * important than speed, such as bootstrap applications. For typical deflate
- * data, zlib's inflate() is about four times as fast as puff(). zlib's
- * inflate compiles to around 20K on my machine, whereas puff.c compiles to
- * around 4K on my machine (a PowerPC using GNU cc). If the faster decode()
- * function here is used, then puff() is only twice as slow as zlib's
- * inflate().
- *
- * All dynamically allocated memory comes from the stack. The stack required
- * is less than 2K bytes. This code is compatible with 16-bit int's and
- * assumes that long's are at least 32 bits. puff.c uses the short data type,
- * assumed to be 16 bits, for arrays in order to to conserve memory. The code
- * works whether integers are stored big endian or little endian.
- *
- * In the comments below are "Format notes" that describe the inflate process
- * and document some of the less obvious aspects of the format. This source
- * code is meant to supplement RFC 1951, which formally describes the deflate
- * format:
- *
- * http://www.zlib.org/rfc-deflate.html
- */
-
-/*
- * Change history:
- *
- * 1.0 10 Feb 2002 - First version
- * 1.1 17 Feb 2002 - Clarifications of some comments and notes
- * - Update puff() dest and source pointers on negative
- * errors to facilitate debugging deflators
- * - Remove longest from struct huffman -- not needed
- * - Simplify offs[] index in construct()
- * - Add input size and checking, using longjmp() to
- * maintain easy readability
- * - Use short data type for large arrays
- * - Use pointers instead of long to specify source and
- * destination sizes to avoid arbitrary 4 GB limits
- * 1.2 17 Mar 2002 - Add faster version of decode(), doubles speed (!),
- * but leave simple version for readabilty
- * - Make sure invalid distances detected if pointers
- * are 16 bits
- * - Fix fixed codes table error
- * - Provide a scanning mode for determining size of
- * uncompressed data
- * 1.3 20 Mar 2002 - Go back to lengths for puff() parameters [Jean-loup]
- * - Add a puff.h file for the interface
- * - Add braces in puff() for else do [Jean-loup]
- * - Use indexes instead of pointers for readability
- * 1.4 31 Mar 2002 - Simplify construct() code set check
- * - Fix some comments
- * - Add FIXLCODES #define
- * 1.5 6 Apr 2002 - Minor comment fixes
- * 1.6 7 Aug 2002 - Minor format changes
- * 1.7 3 Mar 2003 - Added test code for distribution
- * - Added zlib-like license
- * 1.8 9 Jan 2004 - Added some comments on no distance codes case
- */
-
-#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
-#include "puff.h" /* prototype for puff() */
-
-#define local static /* for local function definitions */
-#define NIL ((unsigned char *)0) /* for no output option */
-
-/*
- * Maximums for allocations and loops. It is not useful to change these --
- * they are fixed by the deflate format.
- */
-#define MAXBITS 15 /* maximum bits in a code */
-#define MAXLCODES 286 /* maximum number of literal/length codes */
-#define MAXDCODES 30 /* maximum number of distance codes */
-#define MAXCODES (MAXLCODES+MAXDCODES) /* maximum codes lengths to read */
-#define FIXLCODES 288 /* number of fixed literal/length codes */
-
-/* input and output state */
-struct state {
- /* output state */
- unsigned char *out; /* output buffer */
- unsigned long outlen; /* available space at out */
- unsigned long outcnt; /* bytes written to out so far */
-
- /* input state */
- unsigned char *in; /* input buffer */
- unsigned long inlen; /* available input at in */
- unsigned long incnt; /* bytes read so far */
- int bitbuf; /* bit buffer */
- int bitcnt; /* number of bits in bit buffer */
-
- /* input limit error return state for bits() and decode() */
- jmp_buf env;
-};
-
-/*
- * Return need bits from the input stream. This always leaves less than
- * eight bits in the buffer. bits() works properly for need == 0.
- *
- * Format notes:
- *
- * - Bits are stored in bytes from the least significant bit to the most
- * significant bit. Therefore bits are dropped from the bottom of the bit
- * buffer, using shift right, and new bytes are appended to the top of the
- * bit buffer, using shift left.
- */
-local int bits(struct state *s, int need)
-{
- long val; /* bit accumulator (can use up to 20 bits) */
-
- /* load at least need bits into val */
- val = s->bitbuf;
- while (s->bitcnt < need) {
- if (s->incnt == s->inlen) longjmp(s->env, 1); /* out of input */
- val |= (long)(s->in[s->incnt++]) << s->bitcnt; /* load eight bits */
- s->bitcnt += 8;
- }
-
- /* drop need bits and update buffer, always zero to seven bits left */
- s->bitbuf = (int)(val >> need);
- s->bitcnt -= need;
-
- /* return need bits, zeroing the bits above that */
- return (int)(val & ((1L << need) - 1));
-}
-
-/*
- * Process a stored block.
- *
- * Format notes:
- *
- * - After the two-bit stored block type (00), the stored block length and
- * stored bytes are byte-aligned for fast copying. Therefore any leftover
- * bits in the byte that has the last bit of the type, as many as seven, are
- * discarded. The value of the discarded bits are not defined and should not
- * be checked against any expectation.
- *
- * - The second inverted copy of the stored block length does not have to be
- * checked, but it's probably a good idea to do so anyway.
- *
- * - A stored block can have zero length. This is sometimes used to byte-align
- * subsets of the compressed data for random access or partial recovery.
- */
-local int stored(struct state *s)
-{
- unsigned len; /* length of stored block */
-
- /* discard leftover bits from current byte (assumes s->bitcnt < 8) */
- s->bitbuf = 0;
- s->bitcnt = 0;
-
- /* get length and check against its one's complement */
- if (s->incnt + 4 > s->inlen) return 2; /* not enough input */
- len = s->in[s->incnt++];
- len |= s->in[s->incnt++] << 8;
- if (s->in[s->incnt++] != (~len & 0xff) ||
- s->in[s->incnt++] != ((~len >> 8) & 0xff))
- return -2; /* didn't match complement! */
-
- /* copy len bytes from in to out */
- if (s->incnt + len > s->inlen) return 2; /* not enough input */
- if (s->out != NIL) {
- if (s->outcnt + len > s->outlen)
- return 1; /* not enough output space */
- while (len--)
- s->out[s->outcnt++] = s->in[s->incnt++];
- }
- else { /* just scanning */
- s->outcnt += len;
- s->incnt += len;
- }
-
- /* done with a valid stored block */
- return 0;
-}
-
-/*
- * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of
- * each length, which for a canonical code are stepped through in order.
- * symbol[] are the symbol values in canonical order, where the number of
- * entries is the sum of the counts in count[]. The decoding process can be
- * seen in the function decode() below.
- */
-struct huffman {
- short *count; /* number of symbols of each length */
- short *symbol; /* canonically ordered symbols */
-};
-
-/*
- * Decode a code from the stream s using huffman table h. Return the symbol or
- * a negative value if there is an error. If all of the lengths are zero, i.e.
- * an empty code, or if the code is incomplete and an invalid code is received,
- * then -9 is returned after reading MAXBITS bits.
- *
- * Format notes:
- *
- * - The codes as stored in the compressed data are bit-reversed relative to
- * a simple integer ordering of codes of the same lengths. Hence below the
- * bits are pulled from the compressed data one at a time and used to
- * build the code value reversed from what is in the stream in order to
- * permit simple integer comparisons for decoding. A table-based decoding
- * scheme (as used in zlib) does not need to do this reversal.
- *
- * - The first code for the shortest length is all zeros. Subsequent codes of
- * the same length are simply integer increments of the previous code. When
- * moving up a length, a zero bit is appended to the code. For a complete
- * code, the last code of the longest length will be all ones.
- *
- * - Incomplete codes are handled by this decoder, since they are permitted
- * in the deflate format. See the format notes for fixed() and dynamic().
- */
-#ifdef SLOW
-local int decode(struct state *s, struct huffman *h)
-{
- int len; /* current number of bits in code */
- int code; /* len bits being decoded */
- int first; /* first code of length len */
- int count; /* number of codes of length len */
- int index; /* index of first code of length len in symbol table */
-
- code = first = index = 0;
- for (len = 1; len <= MAXBITS; len++) {
- code |= bits(s, 1); /* get next bit */
- count = h->count[len];
- if (code < first + count) /* if length len, return symbol */
- return h->symbol[index + (code - first)];
- index += count; /* else update for next length */
- first += count;
- first <<= 1;
- code <<= 1;
- }
- return -9; /* ran out of codes */
-}
-
-/*
- * A faster version of decode() for real applications of this code. It's not
- * as readable, but it makes puff() twice as fast. And it only makes the code
- * a few percent larger.
- */
-#else /* !SLOW */
-local int decode(struct state *s, struct huffman *h)
-{
- int len; /* current number of bits in code */
- int code; /* len bits being decoded */
- int first; /* first code of length len */
- int count; /* number of codes of length len */
- int index; /* index of first code of length len in symbol table */
- int bitbuf; /* bits from stream */
- int left; /* bits left in next or left to process */
- short *next; /* next number of codes */
-
- bitbuf = s->bitbuf;
- left = s->bitcnt;
- code = first = index = 0;
- len = 1;
- next = h->count + 1;
- while (1) {
- while (left--) {
- code |= bitbuf & 1;
- bitbuf >>= 1;
- count = *next++;
- if (code < first + count) { /* if length len, return symbol */
- s->bitbuf = bitbuf;
- s->bitcnt = (s->bitcnt - len) & 7;
- return h->symbol[index + (code - first)];
- }
- index += count; /* else update for next length */
- first += count;
- first <<= 1;
- code <<= 1;
- len++;
- }
- left = (MAXBITS+1) - len;
- if (left == 0) break;
- if (s->incnt == s->inlen) longjmp(s->env, 1); /* out of input */
- bitbuf = s->in[s->incnt++];
- if (left > 8) left = 8;
- }
- return -9; /* ran out of codes */
-}
-#endif /* SLOW */
-
-/*
- * Given the list of code lengths length[0..n-1] representing a canonical
- * Huffman code for n symbols, construct the tables required to decode those
- * codes. Those tables are the number of codes of each length, and the symbols
- * sorted by length, retaining their original order within each length. The
- * return value is zero for a complete code set, negative for an over-
- * subscribed code set, and positive for an incomplete code set. The tables
- * can be used if the return value is zero or positive, but they cannot be used
- * if the return value is negative. If the return value is zero, it is not
- * possible for decode() using that table to return an error--any stream of
- * enough bits will resolve to a symbol. If the return value is positive, then
- * it is possible for decode() using that table to return an error for received
- * codes past the end of the incomplete lengths.
- *
- * Not used by decode(), but used for error checking, h->count[0] is the number
- * of the n symbols not in the code. So n - h->count[0] is the number of
- * codes. This is useful for checking for incomplete codes that have more than
- * one symbol, which is an error in a dynamic block.
- *
- * Assumption: for all i in 0..n-1, 0 <= length[i] <= MAXBITS
- * This is assured by the construction of the length arrays in dynamic() and
- * fixed() and is not verified by construct().
- *
- * Format notes:
- *
- * - Permitted and expected examples of incomplete codes are one of the fixed
- * codes and any code with a single symbol which in deflate is coded as one
- * bit instead of zero bits. See the format notes for fixed() and dynamic().
- *
- * - Within a given code length, the symbols are kept in ascending order for
- * the code bits definition.
- */
-local int construct(struct huffman *h, short *length, int n)
-{
- int symbol; /* current symbol when stepping through length[] */
- int len; /* current length when stepping through h->count[] */
- int left; /* number of possible codes left of current length */
- short offs[MAXBITS+1]; /* offsets in symbol table for each length */
-
- /* count number of codes of each length */
- for (len = 0; len <= MAXBITS; len++)
- h->count[len] = 0;
- for (symbol = 0; symbol < n; symbol++)
- (h->count[length[symbol]])++; /* assumes lengths are within bounds */
- if (h->count[0] == n) /* no codes! */
- return 0; /* complete, but decode() will fail */
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1; /* one possible code of zero length */
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1; /* one more bit, double codes left */
- left -= h->count[len]; /* deduct count from possible codes */
- if (left < 0) return left; /* over-subscribed--return negative */
- } /* left > 0 means incomplete */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + h->count[len];
-
- /*
- * put symbols in table sorted by length, by symbol order within each
- * length
- */
- for (symbol = 0; symbol < n; symbol++)
- if (length[symbol] != 0)
- h->symbol[offs[length[symbol]]++] = symbol;
-
- /* return zero for complete set, positive for incomplete set */
- return left;
-}
-
-/*
- * Decode literal/length and distance codes until an end-of-block code.
- *
- * Format notes:
- *
- * - Compressed data that is after the block type if fixed or after the code
- * description if dynamic is a combination of literals and length/distance
- * pairs terminated by and end-of-block code. Literals are simply Huffman
- * coded bytes. A length/distance pair is a coded length followed by a
- * coded distance to represent a string that occurs earlier in the
- * uncompressed data that occurs again at the current location.
- *
- * - Literals, lengths, and the end-of-block code are combined into a single
- * code of up to 286 symbols. They are 256 literals (0..255), 29 length
- * symbols (257..285), and the end-of-block symbol (256).
- *
- * - There are 256 possible lengths (3..258), and so 29 symbols are not enough
- * to represent all of those. Lengths 3..10 and 258 are in fact represented
- * by just a length symbol. Lengths 11..257 are represented as a symbol and
- * some number of extra bits that are added as an integer to the base length
- * of the length symbol. The number of extra bits is determined by the base
- * length symbol. These are in the static arrays below, lens[] for the base
- * lengths and lext[] for the corresponding number of extra bits.
- *
- * - The reason that 258 gets its own symbol is that the longest length is used
- * often in highly redundant files. Note that 258 can also be coded as the
- * base value 227 plus the maximum extra value of 31. While a good deflate
- * should never do this, it is not an error, and should be decoded properly.
- *
- * - If a length is decoded, including its extra bits if any, then it is
- * followed a distance code. There are up to 30 distance symbols. Again
- * there are many more possible distances (1..32768), so extra bits are added
- * to a base value represented by the symbol. The distances 1..4 get their
- * own symbol, but the rest require extra bits. The base distances and
- * corresponding number of extra bits are below in the static arrays dist[]
- * and dext[].
- *
- * - Literal bytes are simply written to the output. A length/distance pair is
- * an instruction to copy previously uncompressed bytes to the output. The
- * copy is from distance bytes back in the output stream, copying for length
- * bytes.
- *
- * - Distances pointing before the beginning of the output data are not
- * permitted.
- *
- * - Overlapped copies, where the length is greater than the distance, are
- * allowed and common. For example, a distance of one and a length of 258
- * simply copies the last byte 258 times. A distance of four and a length of
- * twelve copies the last four bytes three times. A simple forward copy
- * ignoring whether the length is greater than the distance or not implements
- * this correctly. You should not use memcpy() since its behavior is not
- * defined for overlapped arrays. You should not use memmove() or bcopy()
- * since though their behavior -is- defined for overlapping arrays, it is
- * defined to do the wrong thing in this case.
- */
-local int codes(struct state *s,
- struct huffman *lencode,
- struct huffman *distcode)
-{
- int symbol; /* decoded symbol */
- int len; /* length for copy */
- unsigned dist; /* distance for copy */
- static const short lens[29] = { /* Size base for length codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
- static const short lext[29] = { /* Extra bits for length codes 257..285 */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
- static const short dists[30] = { /* Offset base for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577};
- static const short dext[30] = { /* Extra bits for distance codes 0..29 */
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13};
-
- /* decode literals and length/distance pairs */
- do {
- symbol = decode(s, lencode);
- if (symbol < 0) return symbol; /* invalid symbol */
- if (symbol < 256) { /* literal: symbol is the byte */
- /* write out the literal */
- if (s->out != NIL) {
- if (s->outcnt == s->outlen) return 1;
- s->out[s->outcnt] = symbol;
- }
- s->outcnt++;
- }
- else if (symbol > 256) { /* length */
- /* get and compute length */
- symbol -= 257;
- if (symbol >= 29) return -9; /* invalid fixed code */
- len = lens[symbol] + bits(s, lext[symbol]);
-
- /* get and check distance */
- symbol = decode(s, distcode);
- if (symbol < 0) return symbol; /* invalid symbol */
- dist = dists[symbol] + bits(s, dext[symbol]);
- if (dist > s->outcnt)
- return -10; /* distance too far back */
-
- /* copy length bytes from distance bytes back */
- if (s->out != NIL) {
- if (s->outcnt + len > s->outlen) return 1;
- while (len--) {
- s->out[s->outcnt] = s->out[s->outcnt - dist];
- s->outcnt++;
- }
- }
- else
- s->outcnt += len;
- }
- } while (symbol != 256); /* end of block symbol */
-
- /* done with a valid fixed or dynamic block */
- return 0;
-}
-
-/*
- * Process a fixed codes block.
- *
- * Format notes:
- *
- * - This block type can be useful for compressing small amounts of data for
- * which the size of the code descriptions in a dynamic block exceeds the
- * benefit of custom codes for that block. For fixed codes, no bits are
- * spent on code descriptions. Instead the code lengths for literal/length
- * codes and distance codes are fixed. The specific lengths for each symbol
- * can be seen in the "for" loops below.
- *
- * - The literal/length code is complete, but has two symbols that are invalid
- * and should result in an error if received. This cannot be implemented
- * simply as an incomplete code since those two symbols are in the "middle"
- * of the code. They are eight bits long and the longest literal/length\
- * code is nine bits. Therefore the code must be constructed with those
- * symbols, and the invalid symbols must be detected after decoding.
- *
- * - The fixed distance codes also have two invalid symbols that should result
- * in an error if received. Since all of the distance codes are the same
- * length, this can be implemented as an incomplete code. Then the invalid
- * codes are detected while decoding.
- */
-local int fixed(struct state *s)
-{
- static int virgin = 1;
- static short lencnt[MAXBITS+1], lensym[FIXLCODES];
- static short distcnt[MAXBITS+1], distsym[MAXDCODES];
- static struct huffman lencode = {lencnt, lensym};
- static struct huffman distcode = {distcnt, distsym};
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- int symbol;
- short lengths[FIXLCODES];
-
- /* literal/length table */
- for (symbol = 0; symbol < 144; symbol++)
- lengths[symbol] = 8;
- for (; symbol < 256; symbol++)
- lengths[symbol] = 9;
- for (; symbol < 280; symbol++)
- lengths[symbol] = 7;
- for (; symbol < FIXLCODES; symbol++)
- lengths[symbol] = 8;
- construct(&lencode, lengths, FIXLCODES);
-
- /* distance table */
- for (symbol = 0; symbol < MAXDCODES; symbol++)
- lengths[symbol] = 5;
- construct(&distcode, lengths, MAXDCODES);
-
- /* do this just once */
- virgin = 0;
- }
-
- /* decode data until end-of-block code */
- return codes(s, &lencode, &distcode);
-}
-
-/*
- * Process a dynamic codes block.
- *
- * Format notes:
- *
- * - A dynamic block starts with a description of the literal/length and
- * distance codes for that block. New dynamic blocks allow the compressor to
- * rapidly adapt to changing data with new codes optimized for that data.
- *
- * - The codes used by the deflate format are "canonical", which means that
- * the actual bits of the codes are generated in an unambiguous way simply
- * from the number of bits in each code. Therefore the code descriptions
- * are simply a list of code lengths for each symbol.
- *
- * - The code lengths are stored in order for the symbols, so lengths are
- * provided for each of the literal/length symbols, and for each of the
- * distance symbols.
- *
- * - If a symbol is not used in the block, this is represented by a zero as
- * as the code length. This does not mean a zero-length code, but rather
- * that no code should be created for this symbol. There is no way in the
- * deflate format to represent a zero-length code.
- *
- * - The maximum number of bits in a code is 15, so the possible lengths for
- * any code are 1..15.
- *
- * - The fact that a length of zero is not permitted for a code has an
- * interesting consequence. Normally if only one symbol is used for a given
- * code, then in fact that code could be represented with zero bits. However
- * in deflate, that code has to be at least one bit. So for example, if
- * only a single distance base symbol appears in a block, then it will be
- * represented by a single code of length one, in particular one 0 bit. This
- * is an incomplete code, since if a 1 bit is received, it has no meaning,
- * and should result in an error. So incomplete distance codes of one symbol
- * should be permitted, and the receipt of invalid codes should be handled.
- *
- * - It is also possible to have a single literal/length code, but that code
- * must be the end-of-block code, since every dynamic block has one. This
- * is not the most efficient way to create an empty block (an empty fixed
- * block is fewer bits), but it is allowed by the format. So incomplete
- * literal/length codes of one symbol should also be permitted.
- *
- * - If there are only literal codes and no lengths, then there are no distance
- * codes. This is represented by one distance code with zero bits.
- *
- * - The list of up to 286 length/literal lengths and up to 30 distance lengths
- * are themselves compressed using Huffman codes and run-length encoding. In
- * the list of code lengths, a 0 symbol means no code, a 1..15 symbol means
- * that length, and the symbols 16, 17, and 18 are run-length instructions.
- * Each of 16, 17, and 18 are follwed by extra bits to define the length of
- * the run. 16 copies the last length 3 to 6 times. 17 represents 3 to 10
- * zero lengths, and 18 represents 11 to 138 zero lengths. Unused symbols
- * are common, hence the special coding for zero lengths.
- *
- * - The symbols for 0..18 are Huffman coded, and so that code must be
- * described first. This is simply a sequence of up to 19 three-bit values
- * representing no code (0) or the code length for that symbol (1..7).
- *
- * - A dynamic block starts with three fixed-size counts from which is computed
- * the number of literal/length code lengths, the number of distance code
- * lengths, and the number of code length code lengths (ok, you come up with
- * a better name!) in the code descriptions. For the literal/length and
- * distance codes, lengths after those provided are considered zero, i.e. no
- * code. The code length code lengths are received in a permuted order (see
- * the order[] array below) to make a short code length code length list more
- * likely. As it turns out, very short and very long codes are less likely
- * to be seen in a dynamic code description, hence what may appear initially
- * to be a peculiar ordering.
- *
- * - Given the number of literal/length code lengths (nlen) and distance code
- * lengths (ndist), then they are treated as one long list of nlen + ndist
- * code lengths. Therefore run-length coding can and often does cross the
- * boundary between the two sets of lengths.
- *
- * - So to summarize, the code description at the start of a dynamic block is
- * three counts for the number of code lengths for the literal/length codes,
- * the distance codes, and the code length codes. This is followed by the
- * code length code lengths, three bits each. This is used to construct the
- * code length code which is used to read the remainder of the lengths. Then
- * the literal/length code lengths and distance lengths are read as a single
- * set of lengths using the code length codes. Codes are constructed from
- * the resulting two sets of lengths, and then finally you can start
- * decoding actual compressed data in the block.
- *
- * - For reference, a "typical" size for the code description in a dynamic
- * block is around 80 bytes.
- */
-local int dynamic(struct state *s)
-{
- int nlen, ndist, ncode; /* number of lengths in descriptor */
- int index; /* index of lengths[] */
- int err; /* construct() return value */
- short lengths[MAXCODES]; /* descriptor code lengths */
- short lencnt[MAXBITS+1], lensym[MAXLCODES]; /* lencode memory */
- short distcnt[MAXBITS+1], distsym[MAXDCODES]; /* distcode memory */
- struct huffman lencode = {lencnt, lensym}; /* length code */
- struct huffman distcode = {distcnt, distsym}; /* distance code */
- static const short order[19] = /* permutation of code length codes */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- /* get number of lengths in each table, check lengths */
- nlen = bits(s, 5) + 257;
- ndist = bits(s, 5) + 1;
- ncode = bits(s, 4) + 4;
- if (nlen > MAXLCODES || ndist > MAXDCODES)
- return -3; /* bad counts */
-
- /* read code length code lengths (really), missing lengths are zero */
- for (index = 0; index < ncode; index++)
- lengths[order[index]] = bits(s, 3);
- for (; index < 19; index++)
- lengths[order[index]] = 0;
-
- /* build huffman table for code lengths codes (use lencode temporarily) */
- err = construct(&lencode, lengths, 19);
- if (err != 0) return -4; /* require complete code set here */
-
- /* read length/literal and distance code length tables */
- index = 0;
- while (index < nlen + ndist) {
- int symbol; /* decoded value */
- int len; /* last length to repeat */
-
- symbol = decode(s, &lencode);
- if (symbol < 16) /* length in 0..15 */
- lengths[index++] = symbol;
- else { /* repeat instruction */
- len = 0; /* assume repeating zeros */
- if (symbol == 16) { /* repeat last length 3..6 times */
- if (index == 0) return -5; /* no last length! */
- len = lengths[index - 1]; /* last length */
- symbol = 3 + bits(s, 2);
- }
- else if (symbol == 17) /* repeat zero 3..10 times */
- symbol = 3 + bits(s, 3);
- else /* == 18, repeat zero 11..138 times */
- symbol = 11 + bits(s, 7);
- if (index + symbol > nlen + ndist)
- return -6; /* too many lengths! */
- while (symbol--) /* repeat last or zero symbol times */
- lengths[index++] = len;
- }
- }
-
- /* build huffman table for literal/length codes */
- err = construct(&lencode, lengths, nlen);
- if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
- return -7; /* only allow incomplete codes if just one code */
-
- /* build huffman table for distance codes */
- err = construct(&distcode, lengths + nlen, ndist);
- if (err < 0 || (err > 0 && ndist - distcode.count[0] != 1))
- return -8; /* only allow incomplete codes if just one code */
-
- /* decode data until end-of-block code */
- return codes(s, &lencode, &distcode);
-}
-
-/*
- * Inflate source to dest. On return, destlen and sourcelen are updated to the
- * size of the uncompressed data and the size of the deflate data respectively.
- * On success, the return value of puff() is zero. If there is an error in the
- * source data, i.e. it is not in the deflate format, then a negative value is
- * returned. If there is not enough input available or there is not enough
- * output space, then a positive error is returned. In that case, destlen and
- * sourcelen are not updated to facilitate retrying from the beginning with the
- * provision of more input data or more output space. In the case of invalid
- * inflate data (a negative error), the dest and source pointers are updated to
- * facilitate the debugging of deflators.
- *
- * puff() also has a mode to determine the size of the uncompressed output with
- * no output written. For this dest must be (unsigned char *)0. In this case,
- * the input value of *destlen is ignored, and on return *destlen is set to the
- * size of the uncompressed output.
- *
- * The return codes are:
- *
- * 2: available inflate data did not terminate
- * 1: output space exhausted before completing inflate
- * 0: successful inflate
- * -1: invalid block type (type == 3)
- * -2: stored block length did not match one's complement
- * -3: dynamic block code description: too many length or distance codes
- * -4: dynamic block code description: code lengths codes incomplete
- * -5: dynamic block code description: repeat lengths with no first length
- * -6: dynamic block code description: repeat more than specified lengths
- * -7: dynamic block code description: invalid literal/length code lengths
- * -8: dynamic block code description: invalid distance code lengths
- * -9: invalid literal/length or distance code in fixed or dynamic block
- * -10: distance is too far back in fixed or dynamic block
- *
- * Format notes:
- *
- * - Three bits are read for each block to determine the kind of block and
- * whether or not it is the last block. Then the block is decoded and the
- * process repeated if it was not the last block.
- *
- * - The leftover bits in the last byte of the deflate data after the last
- * block (if it was a fixed or dynamic block) are undefined and have no
- * expected values to check.
- */
-int puff(unsigned char *dest, /* pointer to destination pointer */
- unsigned long *destlen, /* amount of output space */
- unsigned char *source, /* pointer to source data pointer */
- unsigned long *sourcelen) /* amount of input available */
-{
- struct state s; /* input/output state */
- int last, type; /* block information */
- int err; /* return value */
-
- /* initialize output state */
- s.out = dest;
- s.outlen = *destlen; /* ignored if dest is NIL */
- s.outcnt = 0;
-
- /* initialize input state */
- s.in = source;
- s.inlen = *sourcelen;
- s.incnt = 0;
- s.bitbuf = 0;
- s.bitcnt = 0;
-
- /* return if bits() or decode() tries to read past available input */
- if (setjmp(s.env) != 0) /* if came back here via longjmp() */
- err = 2; /* then skip do-loop, return error */
- else {
- /* process blocks until last block or error */
- do {
- last = bits(&s, 1); /* one if last block */
- type = bits(&s, 2); /* block type 0..3 */
- err = type == 0 ? stored(&s) :
- (type == 1 ? fixed(&s) :
- (type == 2 ? dynamic(&s) :
- -1)); /* type == 3, invalid */
- if (err != 0) break; /* return with error */
- } while (!last);
- }
-
- /* update the lengths and return */
- if (err <= 0) {
- *destlen = s.outcnt;
- *sourcelen = s.incnt;
- }
- return err;
-}
-
-#ifdef TEST
-/* Example of how to use puff() */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-local unsigned char *yank(char *name, unsigned long *len)
-{
- unsigned long size;
- unsigned char *buf;
- FILE *in;
- struct stat s;
-
- *len = 0;
- if (stat(name, &s)) return NULL;
- if ((s.st_mode & S_IFMT) != S_IFREG) return NULL;
- size = (unsigned long)(s.st_size);
- if (size == 0 || (off_t)size != s.st_size) return NULL;
- in = fopen(name, "r");
- if (in == NULL) return NULL;
- buf = malloc(size);
- if (buf != NULL && fread(buf, 1, size, in) != size) {
- free(buf);
- buf = NULL;
- }
- fclose(in);
- *len = size;
- return buf;
-}
-
-int main(int argc, char **argv)
-{
- int ret;
- unsigned char *source;
- unsigned long len, sourcelen, destlen;
-
- if (argc < 2) return 2;
- source = yank(argv[1], &len);
- if (source == NULL) return 2;
- sourcelen = len;
- ret = puff(NIL, &destlen, source, &sourcelen);
- if (ret)
- printf("puff() failed with return code %d\n", ret);
- else {
- printf("puff() succeeded uncompressing %lu bytes\n", destlen);
- if (sourcelen < len) printf("%lu compressed bytes unused\n",
- len - sourcelen);
- }
- free(source);
- return ret;
-}
-#endif
diff --git a/funtools/util/zlib-1.2.3/contrib/puff/puff.h b/funtools/util/zlib-1.2.3/contrib/puff/puff.h
deleted file mode 100644
index ef61252..0000000
--- a/funtools/util/zlib-1.2.3/contrib/puff/puff.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* puff.h
- Copyright (C) 2002, 2003 Mark Adler, all rights reserved
- version 1.7, 3 Mar 2002
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Mark Adler madler@alumni.caltech.edu
- */
-
-
-/*
- * See puff.c for purpose and usage.
- */
-int puff(unsigned char *dest, /* pointer to destination pointer */
- unsigned long *destlen, /* amount of output space */
- unsigned char *source, /* pointer to source data pointer */
- unsigned long *sourcelen); /* amount of input available */
diff --git a/funtools/util/zlib-1.2.3/contrib/puff/zeros.raw b/funtools/util/zlib-1.2.3/contrib/puff/zeros.raw
deleted file mode 100644
index 637b7be..0000000
--- a/funtools/util/zlib-1.2.3/contrib/puff/zeros.raw
+++ /dev/null
Binary files differ
diff --git a/funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.c b/funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.c
deleted file mode 100644
index e5574f4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.c
+++ /dev/null
@@ -1,275 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <windows.h>
-
-#include "zlib.h"
-
-
-void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B)
-{
- R->HighPart = A.HighPart - B.HighPart;
- if (A.LowPart >= B.LowPart)
- R->LowPart = A.LowPart - B.LowPart;
- else
- {
- R->LowPart = A.LowPart - B.LowPart;
- R->HighPart --;
- }
-}
-
-#ifdef _M_X64
-// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc
-unsigned __int64 __rdtsc(void);
-void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
-{
- // printf("rdtsc = %I64x\n",__rdtsc());
- pbeginTime64->QuadPart=__rdtsc();
-}
-
-LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
-{
- LARGE_INTEGER LIres;
- unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart));
- LIres.QuadPart=res;
- // printf("rdtsc = %I64x\n",__rdtsc());
- return LIres;
-}
-#else
-#ifdef _M_IX86
-void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
-{
- DWORD dwEdx,dwEax;
- _asm
- {
- rdtsc
- mov dwEax,eax
- mov dwEdx,edx
- }
- pbeginTime64->LowPart=dwEax;
- pbeginTime64->HighPart=dwEdx;
-}
-
-void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
-{
- myGetRDTSC32(pbeginTime64);
-}
-
-LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
-{
- LARGE_INTEGER LIres,endTime64;
- myGetRDTSC32(&endTime64);
-
- LIres.LowPart=LIres.HighPart=0;
- MyDoMinus64(&LIres,endTime64,beginTime64);
- return LIres;
-}
-#else
-void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
-{
-}
-
-void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
-{
-}
-
-LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
-{
- LARGE_INTEGER lr;
- lr.QuadPart=0;
- return lr;
-}
-#endif
-#endif
-
-void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf)
-{
- if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(pbeginTime64)))
- {
- pbeginTime64->LowPart = GetTickCount();
- pbeginTime64->HighPart = 0;
- }
-}
-
-DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
-{
- LARGE_INTEGER endTime64,ticksPerSecond,ticks;
- DWORDLONG ticksShifted,tickSecShifted;
- DWORD dwLog=16+0;
- DWORD dwRet;
- if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(&endTime64)))
- dwRet = (GetTickCount() - beginTime64.LowPart)*1;
- else
- {
- MyDoMinus64(&ticks,endTime64,beginTime64);
- QueryPerformanceFrequency(&ticksPerSecond);
-
-
- {
- ticksShifted = Int64ShrlMod32(*(DWORDLONG*)&ticks,dwLog);
- tickSecShifted = Int64ShrlMod32(*(DWORDLONG*)&ticksPerSecond,dwLog);
-
- }
-
- dwRet = (DWORD)((((DWORD)ticksShifted)*1000)/(DWORD)(tickSecShifted));
- dwRet *=1;
- }
- return dwRet;
-}
-
-int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr)
-{
- FILE* stream;
- void* ptr;
- int retVal=1;
- stream=fopen(filename, "rb");
- if (stream==NULL)
- return 0;
-
- fseek(stream,0,SEEK_END);
-
- *plFileSize=ftell(stream);
- fseek(stream,0,SEEK_SET);
- ptr=malloc((*plFileSize)+1);
- if (ptr==NULL)
- retVal=0;
- else
- {
- if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize))
- retVal=0;
- }
- fclose(stream);
- *pFilePtr=ptr;
- return retVal;
-}
-
-int main(int argc, char *argv[])
-{
- int BlockSizeCompress=0x8000;
- int BlockSizeUncompress=0x8000;
- int cprLevel=Z_DEFAULT_COMPRESSION ;
- long lFileSize;
- unsigned char* FilePtr;
- long lBufferSizeCpr;
- long lBufferSizeUncpr;
- long lCompressedSize=0;
- unsigned char* CprPtr;
- unsigned char* UncprPtr;
- long lSizeCpr,lSizeUncpr;
- DWORD dwGetTick,dwMsecQP;
- LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc;
-
- if (argc<=1)
- {
- printf("run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n");
- return 0;
- }
-
- if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0)
- {
- printf("error reading %s\n",argv[1]);
- return 1;
- }
- else printf("file %s read, %u bytes\n",argv[1],lFileSize);
-
- if (argc>=3)
- BlockSizeCompress=atol(argv[2]);
-
- if (argc>=4)
- BlockSizeUncompress=atol(argv[3]);
-
- if (argc>=5)
- cprLevel=(int)atol(argv[4]);
-
- lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;
- lBufferSizeUncpr = lBufferSizeCpr;
-
- CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress);
-
- BeginCountPerfCounter(&li_qp,TRUE);
- dwGetTick=GetTickCount();
- BeginCountRdtsc(&li_rdtsc);
- {
- z_stream zcpr;
- int ret=Z_OK;
- long lOrigToDo = lFileSize;
- long lOrigDone = 0;
- int step=0;
- memset(&zcpr,0,sizeof(z_stream));
- deflateInit(&zcpr,cprLevel);
-
- zcpr.next_in = FilePtr;
- zcpr.next_out = CprPtr;
-
-
- do
- {
- long all_read_before = zcpr.total_in;
- zcpr.avail_in = min(lOrigToDo,BlockSizeCompress);
- zcpr.avail_out = BlockSizeCompress;
- ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH);
- lOrigDone += (zcpr.total_in-all_read_before);
- lOrigToDo -= (zcpr.total_in-all_read_before);
- step++;
- } while (ret==Z_OK);
-
- lSizeCpr=zcpr.total_out;
- deflateEnd(&zcpr);
- dwGetTick=GetTickCount()-dwGetTick;
- dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
- dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
- printf("total compress size = %u, in %u step\n",lSizeCpr,step);
- printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
- printf("defcpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
- printf("defcpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
- }
-
- CprPtr=(unsigned char*)realloc(CprPtr,lSizeCpr);
- UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress);
-
- BeginCountPerfCounter(&li_qp,TRUE);
- dwGetTick=GetTickCount();
- BeginCountRdtsc(&li_rdtsc);
- {
- z_stream zcpr;
- int ret=Z_OK;
- long lOrigToDo = lSizeCpr;
- long lOrigDone = 0;
- int step=0;
- memset(&zcpr,0,sizeof(z_stream));
- inflateInit(&zcpr);
-
- zcpr.next_in = CprPtr;
- zcpr.next_out = UncprPtr;
-
-
- do
- {
- long all_read_before = zcpr.total_in;
- zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress);
- zcpr.avail_out = BlockSizeUncompress;
- ret=inflate(&zcpr,Z_SYNC_FLUSH);
- lOrigDone += (zcpr.total_in-all_read_before);
- lOrigToDo -= (zcpr.total_in-all_read_before);
- step++;
- } while (ret==Z_OK);
-
- lSizeUncpr=zcpr.total_out;
- inflateEnd(&zcpr);
- dwGetTick=GetTickCount()-dwGetTick;
- dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE);
- dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE);
- printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step);
- printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.);
- printf("uncpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.);
- printf("uncpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
- }
-
- if (lSizeUncpr==lFileSize)
- {
- if (memcmp(FilePtr,UncprPtr,lFileSize)==0)
- printf("compare ok\n");
-
- }
-
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.txt b/funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.txt
deleted file mode 100644
index 62258f1..0000000
--- a/funtools/util/zlib-1.2.3/contrib/testzlib/testzlib.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-To build testzLib with Visual Studio 2005:
-
-copy to a directory file from :
-- root of zLib tree
-- contrib/testzlib
-- contrib/masmx86
-- contrib/masmx64
-- contrib/vstudio/vc7
-
-and open testzlib8.sln \ No newline at end of file
diff --git a/funtools/util/zlib-1.2.3/contrib/untgz/Makefile b/funtools/util/zlib-1.2.3/contrib/untgz/Makefile
deleted file mode 100644
index b54266f..0000000
--- a/funtools/util/zlib-1.2.3/contrib/untgz/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-CC=cc
-CFLAGS=-g
-
-untgz: untgz.o ../../libz.a
- $(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz
-
-untgz.o: untgz.c ../../zlib.h
- $(CC) $(CFLAGS) -c -I../.. untgz.c
-
-../../libz.a:
- cd ../..; ./configure; make
-
-clean:
- rm -f untgz untgz.o *~
diff --git a/funtools/util/zlib-1.2.3/contrib/untgz/Makefile.msc b/funtools/util/zlib-1.2.3/contrib/untgz/Makefile.msc
deleted file mode 100644
index 77b8602..0000000
--- a/funtools/util/zlib-1.2.3/contrib/untgz/Makefile.msc
+++ /dev/null
@@ -1,17 +0,0 @@
-CC=cl
-CFLAGS=-MD
-
-untgz.exe: untgz.obj ..\..\zlib.lib
- $(CC) $(CFLAGS) untgz.obj ..\..\zlib.lib
-
-untgz.obj: untgz.c ..\..\zlib.h
- $(CC) $(CFLAGS) -c -I..\.. untgz.c
-
-..\..\zlib.lib:
- cd ..\..
- $(MAKE) -f win32\makefile.msc
- cd contrib\untgz
-
-clean:
- -del untgz.obj
- -del untgz.exe
diff --git a/funtools/util/zlib-1.2.3/contrib/untgz/untgz.c b/funtools/util/zlib-1.2.3/contrib/untgz/untgz.c
deleted file mode 100644
index 2c391e5..0000000
--- a/funtools/util/zlib-1.2.3/contrib/untgz/untgz.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/*
- * untgz.c -- Display contents and extract files from a gzip'd TAR file
- *
- * written by Pedro A. Aranda Gutierrez <paag@tid.es>
- * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
- * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-
-#include "zlib.h"
-
-#ifdef unix
-# include <unistd.h>
-#else
-# include <direct.h>
-# include <io.h>
-#endif
-
-#ifdef WIN32
-#include <windows.h>
-# ifndef F_OK
-# define F_OK 0
-# endif
-# define mkdir(dirname,mode) _mkdir(dirname)
-# ifdef _MSC_VER
-# define access(path,mode) _access(path,mode)
-# define chmod(path,mode) _chmod(path,mode)
-# define strdup(str) _strdup(str)
-# endif
-#else
-# include <utime.h>
-#endif
-
-
-/* values used in typeflag field */
-
-#define REGTYPE '0' /* regular file */
-#define AREGTYPE '\0' /* regular file */
-#define LNKTYPE '1' /* link */
-#define SYMTYPE '2' /* reserved */
-#define CHRTYPE '3' /* character special */
-#define BLKTYPE '4' /* block special */
-#define DIRTYPE '5' /* directory */
-#define FIFOTYPE '6' /* FIFO special */
-#define CONTTYPE '7' /* reserved */
-
-/* GNU tar extensions */
-
-#define GNUTYPE_DUMPDIR 'D' /* file names from dumped directory */
-#define GNUTYPE_LONGLINK 'K' /* long link name */
-#define GNUTYPE_LONGNAME 'L' /* long file name */
-#define GNUTYPE_MULTIVOL 'M' /* continuation of file from another volume */
-#define GNUTYPE_NAMES 'N' /* file name that does not fit into main hdr */
-#define GNUTYPE_SPARSE 'S' /* sparse file */
-#define GNUTYPE_VOLHDR 'V' /* tape/volume header */
-
-
-/* tar header */
-
-#define BLOCKSIZE 512
-#define SHORTNAMESIZE 100
-
-struct tar_header
-{ /* byte offset */
- char name[100]; /* 0 */
- char mode[8]; /* 100 */
- char uid[8]; /* 108 */
- char gid[8]; /* 116 */
- char size[12]; /* 124 */
- char mtime[12]; /* 136 */
- char chksum[8]; /* 148 */
- char typeflag; /* 156 */
- char linkname[100]; /* 157 */
- char magic[6]; /* 257 */
- char version[2]; /* 263 */
- char uname[32]; /* 265 */
- char gname[32]; /* 297 */
- char devmajor[8]; /* 329 */
- char devminor[8]; /* 337 */
- char prefix[155]; /* 345 */
- /* 500 */
-};
-
-union tar_buffer
-{
- char buffer[BLOCKSIZE];
- struct tar_header header;
-};
-
-struct attr_item
-{
- struct attr_item *next;
- char *fname;
- int mode;
- time_t time;
-};
-
-enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID };
-
-char *TGZfname OF((const char *));
-void TGZnotfound OF((const char *));
-
-int getoct OF((char *, int));
-char *strtime OF((time_t *));
-int setfiletime OF((char *, time_t));
-void push_attr OF((struct attr_item **, char *, int, time_t));
-void restore_attr OF((struct attr_item **));
-
-int ExprMatch OF((char *, char *));
-
-int makedir OF((char *));
-int matchname OF((int, int, char **, char *));
-
-void error OF((const char *));
-int tar OF((gzFile, int, int, int, char **));
-
-void help OF((int));
-int main OF((int, char **));
-
-char *prog;
-
-const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL };
-
-/* return the file name of the TGZ archive */
-/* or NULL if it does not exist */
-
-char *TGZfname (const char *arcname)
-{
- static char buffer[1024];
- int origlen,i;
-
- strcpy(buffer,arcname);
- origlen = strlen(buffer);
-
- for (i=0; TGZsuffix[i]; i++)
- {
- strcpy(buffer+origlen,TGZsuffix[i]);
- if (access(buffer,F_OK) == 0)
- return buffer;
- }
- return NULL;
-}
-
-
-/* error message for the filename */
-
-void TGZnotfound (const char *arcname)
-{
- int i;
-
- fprintf(stderr,"%s: Couldn't find ",prog);
- for (i=0;TGZsuffix[i];i++)
- fprintf(stderr,(TGZsuffix[i+1]) ? "%s%s, " : "or %s%s\n",
- arcname,
- TGZsuffix[i]);
- exit(1);
-}
-
-
-/* convert octal digits to int */
-/* on error return -1 */
-
-int getoct (char *p,int width)
-{
- int result = 0;
- char c;
-
- while (width--)
- {
- c = *p++;
- if (c == 0)
- break;
- if (c == ' ')
- continue;
- if (c < '0' || c > '7')
- return -1;
- result = result * 8 + (c - '0');
- }
- return result;
-}
-
-
-/* convert time_t to string */
-/* use the "YYYY/MM/DD hh:mm:ss" format */
-
-char *strtime (time_t *t)
-{
- struct tm *local;
- static char result[32];
-
- local = localtime(t);
- sprintf(result,"%4d/%02d/%02d %02d:%02d:%02d",
- local->tm_year+1900, local->tm_mon+1, local->tm_mday,
- local->tm_hour, local->tm_min, local->tm_sec);
- return result;
-}
-
-
-/* set file time */
-
-int setfiletime (char *fname,time_t ftime)
-{
-#ifdef WIN32
- static int isWinNT = -1;
- SYSTEMTIME st;
- FILETIME locft, modft;
- struct tm *loctm;
- HANDLE hFile;
- int result;
-
- loctm = localtime(&ftime);
- if (loctm == NULL)
- return -1;
-
- st.wYear = (WORD)loctm->tm_year + 1900;
- st.wMonth = (WORD)loctm->tm_mon + 1;
- st.wDayOfWeek = (WORD)loctm->tm_wday;
- st.wDay = (WORD)loctm->tm_mday;
- st.wHour = (WORD)loctm->tm_hour;
- st.wMinute = (WORD)loctm->tm_min;
- st.wSecond = (WORD)loctm->tm_sec;
- st.wMilliseconds = 0;
- if (!SystemTimeToFileTime(&st, &locft) ||
- !LocalFileTimeToFileTime(&locft, &modft))
- return -1;
-
- if (isWinNT < 0)
- isWinNT = (GetVersion() < 0x80000000) ? 1 : 0;
- hFile = CreateFile(fname, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
- (isWinNT ? FILE_FLAG_BACKUP_SEMANTICS : 0),
- NULL);
- if (hFile == INVALID_HANDLE_VALUE)
- return -1;
- result = SetFileTime(hFile, NULL, NULL, &modft) ? 0 : -1;
- CloseHandle(hFile);
- return result;
-#else
- struct utimbuf settime;
-
- settime.actime = settime.modtime = ftime;
- return utime(fname,&settime);
-#endif
-}
-
-
-/* push file attributes */
-
-void push_attr(struct attr_item **list,char *fname,int mode,time_t time)
-{
- struct attr_item *item;
-
- item = (struct attr_item *)malloc(sizeof(struct attr_item));
- if (item == NULL)
- error("Out of memory");
- item->fname = strdup(fname);
- item->mode = mode;
- item->time = time;
- item->next = *list;
- *list = item;
-}
-
-
-/* restore file attributes */
-
-void restore_attr(struct attr_item **list)
-{
- struct attr_item *item, *prev;
-
- for (item = *list; item != NULL; )
- {
- setfiletime(item->fname,item->time);
- chmod(item->fname,item->mode);
- prev = item;
- item = item->next;
- free(prev);
- }
- *list = NULL;
-}
-
-
-/* match regular expression */
-
-#define ISSPECIAL(c) (((c) == '*') || ((c) == '/'))
-
-int ExprMatch (char *string,char *expr)
-{
- while (1)
- {
- if (ISSPECIAL(*expr))
- {
- if (*expr == '/')
- {
- if (*string != '\\' && *string != '/')
- return 0;
- string ++; expr++;
- }
- else if (*expr == '*')
- {
- if (*expr ++ == 0)
- return 1;
- while (*++string != *expr)
- if (*string == 0)
- return 0;
- }
- }
- else
- {
- if (*string != *expr)
- return 0;
- if (*expr++ == 0)
- return 1;
- string++;
- }
- }
-}
-
-
-/* recursive mkdir */
-/* abort on ENOENT; ignore other errors like "directory already exists" */
-/* return 1 if OK */
-/* 0 on error */
-
-int makedir (char *newdir)
-{
- char *buffer = strdup(newdir);
- char *p;
- int len = strlen(buffer);
-
- if (len <= 0) {
- free(buffer);
- return 0;
- }
- if (buffer[len-1] == '/') {
- buffer[len-1] = '\0';
- }
- if (mkdir(buffer, 0755) == 0)
- {
- free(buffer);
- return 1;
- }
-
- p = buffer+1;
- while (1)
- {
- char hold;
-
- while(*p && *p != '\\' && *p != '/')
- p++;
- hold = *p;
- *p = 0;
- if ((mkdir(buffer, 0755) == -1) && (errno == ENOENT))
- {
- fprintf(stderr,"%s: Couldn't create directory %s\n",prog,buffer);
- free(buffer);
- return 0;
- }
- if (hold == 0)
- break;
- *p++ = hold;
- }
- free(buffer);
- return 1;
-}
-
-
-int matchname (int arg,int argc,char **argv,char *fname)
-{
- if (arg == argc) /* no arguments given (untgz tgzarchive) */
- return 1;
-
- while (arg < argc)
- if (ExprMatch(fname,argv[arg++]))
- return 1;
-
- return 0; /* ignore this for the moment being */
-}
-
-
-/* tar file list or extract */
-
-int tar (gzFile in,int action,int arg,int argc,char **argv)
-{
- union tar_buffer buffer;
- int len;
- int err;
- int getheader = 1;
- int remaining = 0;
- FILE *outfile = NULL;
- char fname[BLOCKSIZE];
- int tarmode;
- time_t tartime;
- struct attr_item *attributes = NULL;
-
- if (action == TGZ_LIST)
- printf(" date time size file\n"
- " ---------- -------- --------- -------------------------------------\n");
- while (1)
- {
- len = gzread(in, &buffer, BLOCKSIZE);
- if (len < 0)
- error(gzerror(in, &err));
- /*
- * Always expect complete blocks to process
- * the tar information.
- */
- if (len != BLOCKSIZE)
- {
- action = TGZ_INVALID; /* force error exit */
- remaining = 0; /* force I/O cleanup */
- }
-
- /*
- * If we have to get a tar header
- */
- if (getheader >= 1)
- {
- /*
- * if we met the end of the tar
- * or the end-of-tar block,
- * we are done
- */
- if (len == 0 || buffer.header.name[0] == 0)
- break;
-
- tarmode = getoct(buffer.header.mode,8);
- tartime = (time_t)getoct(buffer.header.mtime,12);
- if (tarmode == -1 || tartime == (time_t)-1)
- {
- buffer.header.name[0] = 0;
- action = TGZ_INVALID;
- }
-
- if (getheader == 1)
- {
- strncpy(fname,buffer.header.name,SHORTNAMESIZE);
- if (fname[SHORTNAMESIZE-1] != 0)
- fname[SHORTNAMESIZE] = 0;
- }
- else
- {
- /*
- * The file name is longer than SHORTNAMESIZE
- */
- if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0)
- error("bad long name");
- getheader = 1;
- }
-
- /*
- * Act according to the type flag
- */
- switch (buffer.header.typeflag)
- {
- case DIRTYPE:
- if (action == TGZ_LIST)
- printf(" %s <dir> %s\n",strtime(&tartime),fname);
- if (action == TGZ_EXTRACT)
- {
- makedir(fname);
- push_attr(&attributes,fname,tarmode,tartime);
- }
- break;
- case REGTYPE:
- case AREGTYPE:
- remaining = getoct(buffer.header.size,12);
- if (remaining == -1)
- {
- action = TGZ_INVALID;
- break;
- }
- if (action == TGZ_LIST)
- printf(" %s %9d %s\n",strtime(&tartime),remaining,fname);
- else if (action == TGZ_EXTRACT)
- {
- if (matchname(arg,argc,argv,fname))
- {
- outfile = fopen(fname,"wb");
- if (outfile == NULL) {
- /* try creating directory */
- char *p = strrchr(fname, '/');
- if (p != NULL) {
- *p = '\0';
- makedir(fname);
- *p = '/';
- outfile = fopen(fname,"wb");
- }
- }
- if (outfile != NULL)
- printf("Extracting %s\n",fname);
- else
- fprintf(stderr, "%s: Couldn't create %s",prog,fname);
- }
- else
- outfile = NULL;
- }
- getheader = 0;
- break;
- case GNUTYPE_LONGLINK:
- case GNUTYPE_LONGNAME:
- remaining = getoct(buffer.header.size,12);
- if (remaining < 0 || remaining >= BLOCKSIZE)
- {
- action = TGZ_INVALID;
- break;
- }
- len = gzread(in, fname, BLOCKSIZE);
- if (len < 0)
- error(gzerror(in, &err));
- if (fname[BLOCKSIZE-1] != 0 || (int)strlen(fname) > remaining)
- {
- action = TGZ_INVALID;
- break;
- }
- getheader = 2;
- break;
- default:
- if (action == TGZ_LIST)
- printf(" %s <---> %s\n",strtime(&tartime),fname);
- break;
- }
- }
- else
- {
- unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
-
- if (outfile != NULL)
- {
- if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes)
- {
- fprintf(stderr,
- "%s: Error writing %s -- skipping\n",prog,fname);
- fclose(outfile);
- outfile = NULL;
- remove(fname);
- }
- }
- remaining -= bytes;
- }
-
- if (remaining == 0)
- {
- getheader = 1;
- if (outfile != NULL)
- {
- fclose(outfile);
- outfile = NULL;
- if (action != TGZ_INVALID)
- push_attr(&attributes,fname,tarmode,tartime);
- }
- }
-
- /*
- * Abandon if errors are found
- */
- if (action == TGZ_INVALID)
- {
- error("broken archive");
- break;
- }
- }
-
- /*
- * Restore file modes and time stamps
- */
- restore_attr(&attributes);
-
- if (gzclose(in) != Z_OK)
- error("failed gzclose");
-
- return 0;
-}
-
-
-/* ============================================================ */
-
-void help(int exitval)
-{
- printf("untgz version 0.2.1\n"
- " using zlib version %s\n\n",
- zlibVersion());
- printf("Usage: untgz file.tgz extract all files\n"
- " untgz file.tgz fname ... extract selected files\n"
- " untgz -l file.tgz list archive contents\n"
- " untgz -h display this help\n");
- exit(exitval);
-}
-
-void error(const char *msg)
-{
- fprintf(stderr, "%s: %s\n", prog, msg);
- exit(1);
-}
-
-
-/* ============================================================ */
-
-#if defined(WIN32) && defined(__GNUC__)
-int _CRT_glob = 0; /* disable argument globbing in MinGW */
-#endif
-
-int main(int argc,char **argv)
-{
- int action = TGZ_EXTRACT;
- int arg = 1;
- char *TGZfile;
- gzFile *f;
-
- prog = strrchr(argv[0],'\\');
- if (prog == NULL)
- {
- prog = strrchr(argv[0],'/');
- if (prog == NULL)
- {
- prog = strrchr(argv[0],':');
- if (prog == NULL)
- prog = argv[0];
- else
- prog++;
- }
- else
- prog++;
- }
- else
- prog++;
-
- if (argc == 1)
- help(0);
-
- if (strcmp(argv[arg],"-l") == 0)
- {
- action = TGZ_LIST;
- if (argc == ++arg)
- help(0);
- }
- else if (strcmp(argv[arg],"-h") == 0)
- {
- help(0);
- }
-
- if ((TGZfile = TGZfname(argv[arg])) == NULL)
- TGZnotfound(argv[arg]);
-
- ++arg;
- if ((action == TGZ_LIST) && (arg != argc))
- help(1);
-
-/*
- * Process the TGZ file
- */
- switch(action)
- {
- case TGZ_LIST:
- case TGZ_EXTRACT:
- f = gzopen(TGZfile,"rb");
- if (f == NULL)
- {
- fprintf(stderr,"%s: Couldn't gzopen %s\n",prog,TGZfile);
- return 1;
- }
- exit(tar(f, action, arg, argc, argv));
- break;
-
- default:
- error("Unknown option");
- exit(1);
- }
-
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/readme.txt b/funtools/util/zlib-1.2.3/contrib/vstudio/readme.txt
deleted file mode 100644
index 16159f9..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/readme.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-Building instructions for the DLL versions of Zlib 1.2.3
-========================================================
-
-This directory contains projects that build zlib and minizip using
-Microsoft Visual C++ 7.0/7.1, and Visual C++ .
-
-You don't need to build these projects yourself. You can download the
-binaries from:
- http://www.winimage.com/zLibDll
-
-More information can be found at this site.
-
-
-Build instructions for Visual Studio 7.x (32 bits)
---------------------------------------------------
-- Uncompress current zlib, including all contrib/* files
-- Download the crtdll library from
- http://www.winimage.com/zLibDll/crtdll.zip
- Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc7.
-- Open contrib\vstudio\vc7\zlibvc.sln with Microsoft Visual C++ 7.x
- (Visual Studio .Net 2002 or 2003).
-
-Build instructions for Visual Studio 2005 (32 bits or 64 bits)
---------------------------------------------------------------
-- Uncompress current zlib, including all contrib/* files
-- For 32 bits only: download the crtdll library from
- http://www.winimage.com/zLibDll/crtdll.zip
- Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc8.
-- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0
-
-Build instructions for Visual Studio 2005 64 bits, PSDK compiler
-----------------------------------------------------------------
-at the time of writing this text file, Visual Studio 2005 (and
- Microsoft Visual C++ 8.0) is on the beta 2 stage.
-Using you can get the free 64 bits compiler from Platform SDK,
- which is NOT a beta, and compile using the Visual studio 2005 IDE
-see http://www.winimage.com/misc/sdk64onvs2005/ for instruction
-
-- Uncompress current zlib, including all contrib/* files
-- start Visual Studio 2005 from a platform SDK command prompt, using
- the /useenv switch
-- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0
-
-
-Important
----------
-- To use zlibwapi.dll in your application, you must define the
- macro ZLIB_WINAPI when compiling your application's source files.
-
-
-Additional notes
-----------------
-- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built
- by Gilles Vollant from the zlib 1.1.x sources, and distributed at
- http://www.winimage.com/zLibDll
- It uses the WINAPI calling convention for the exported functions, and
- includes the minizip functionality. If your application needs that
- particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll.
-
-- The new DLL was renamed because there exist several incompatible
- versions of zlib.dll on the Internet.
-
-- There is also an official DLL build of zlib, named zlib1.dll. This one
- is exporting the functions using the CDECL convention. See the file
- win32\DLL_FAQ.txt found in this zlib distribution.
-
-- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol
- has a slightly different effect. To avoid compatibility problems, do
- not define it here.
-
-
-Gilles Vollant
-info@winimage.com
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/miniunz.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/miniunz.vcproj
deleted file mode 100644
index ad5117c..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/miniunz.vcproj
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="miniunz"
- ProjectGUID="{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
- <File
- RelativePath="..\..\minizip\miniunz.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- </Filter>
- <File
- RelativePath="ReleaseDll\zlibwapi.lib">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/minizip.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/minizip.vcproj
deleted file mode 100644
index fb5b632..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/minizip.vcproj
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="minizip"
- ProjectGUID="{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/minizip.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
- <File
- RelativePath="..\..\minizip\minizip.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- </Filter>
- <File
- RelativePath="ReleaseDll\zlibwapi.lib">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/testzlib.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/testzlib.vcproj
deleted file mode 100644
index 97bc3e8..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/testzlib.vcproj
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="testZlibDll"
- ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
- <File
- RelativePath="..\..\testzlib\testzlib.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- </Filter>
- <File
- RelativePath="ReleaseDll\zlibwapi.lib">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlib.rc b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlib.rc
deleted file mode 100644
index 72cb8b4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlib.rc
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <windows.h>
-
-#define IDR_VERSION1 1
-IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
- FILEVERSION 1,2,3,0
- PRODUCTVERSION 1,2,3,0
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
- FILEFLAGS 0
- FILEOS VOS_DOS_WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE 0 // not used
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904E4"
- //language ID = U.S. English, char set = Windows, Multilingual
-
- BEGIN
- VALUE "FileDescription", "zlib data compression library\0"
- VALUE "FileVersion", "1.2.3.0\0"
- VALUE "InternalName", "zlib\0"
- VALUE "OriginalFilename", "zlib.dll\0"
- VALUE "ProductName", "ZLib.DLL\0"
- VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
- VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0409, 1252
- END
-END
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibstat.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibstat.vcproj
deleted file mode 100644
index 766d7a4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibstat.vcproj
+++ /dev/null
@@ -1,246 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="zlibstat"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\zlibstatDebug"
- IntermediateDirectory=".\zlibstatDebug"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
- ExceptionHandling="FALSE"
- RuntimeLibrary="5"
- PrecompiledHeaderFile=".\zlibstatDebug/zlibstat.pch"
- AssemblerListingLocation=".\zlibstatDebug/"
- ObjectFile=".\zlibstatDebug/"
- ProgramDataBaseFileName=".\zlibstatDebug/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="1"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/NODEFAULTLIB "
- OutputFile=".\zlibstatDebug\zlibstat.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="ReleaseAxp|Win32"
- OutputDirectory=".\zlibsta0"
- IntermediateDirectory=".\zlibsta0"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\zlibsta0/zlibstat.pch"
- AssemblerListingLocation=".\zlibsta0/"
- ObjectFile=".\zlibsta0/"
- ProgramDataBaseFileName=".\zlibsta0/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/NODEFAULTLIB "
- OutputFile=".\zlibsta0\zlibstat.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\zlibstat"
- IntermediateDirectory=".\zlibstat"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;ASMV;ASMINF"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\zlibstat/zlibstat.pch"
- AssemblerListingLocation=".\zlibstat/"
- ObjectFile=".\zlibstat/"
- ProgramDataBaseFileName=".\zlibstat/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj /NODEFAULTLIB "
- OutputFile=".\zlibstat\zlibstat.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Win32"
- OutputDirectory="zlibstatWithoutAsm"
- IntermediateDirectory="zlibstatWithoutAsm"
- ConfigurationType="4"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\zlibstat/zlibstat.pch"
- AssemblerListingLocation=".\zlibstatWithoutAsm/"
- ObjectFile=".\zlibstatWithoutAsm/"
- ProgramDataBaseFileName=".\zlibstatWithoutAsm/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions=" /NODEFAULTLIB "
- OutputFile=".\zlibstatWithoutAsm\zlibstat.lib"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="">
- <File
- RelativePath="..\..\..\adler32.c">
- </File>
- <File
- RelativePath="..\..\..\compress.c">
- </File>
- <File
- RelativePath="..\..\..\crc32.c">
- </File>
- <File
- RelativePath="..\..\..\deflate.c">
- </File>
- <File
- RelativePath="..\..\masmx86\gvmat32c.c">
- </File>
- <File
- RelativePath="..\..\..\gzio.c">
- </File>
- <File
- RelativePath="..\..\..\infback.c">
- </File>
- <File
- RelativePath="..\..\..\inffast.c">
- </File>
- <File
- RelativePath="..\..\..\inflate.c">
- </File>
- <File
- RelativePath="..\..\..\inftrees.c">
- </File>
- <File
- RelativePath="..\..\minizip\ioapi.c">
- </File>
- <File
- RelativePath="..\..\..\trees.c">
- </File>
- <File
- RelativePath="..\..\..\uncompr.c">
- </File>
- <File
- RelativePath="..\..\minizip\unzip.c">
- </File>
- <File
- RelativePath="..\..\minizip\zip.c">
- </File>
- <File
- RelativePath=".\zlib.rc">
- </File>
- <File
- RelativePath=".\zlibvc.def">
- </File>
- <File
- RelativePath="..\..\..\zutil.c">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.def b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.def
deleted file mode 100644
index a40e715..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.def
+++ /dev/null
@@ -1,92 +0,0 @@
-
-VERSION 1.23
-
-HEAPSIZE 1048576,8192
-
-EXPORTS
- adler32 @1
- compress @2
- crc32 @3
- deflate @4
- deflateCopy @5
- deflateEnd @6
- deflateInit2_ @7
- deflateInit_ @8
- deflateParams @9
- deflateReset @10
- deflateSetDictionary @11
- gzclose @12
- gzdopen @13
- gzerror @14
- gzflush @15
- gzopen @16
- gzread @17
- gzwrite @18
- inflate @19
- inflateEnd @20
- inflateInit2_ @21
- inflateInit_ @22
- inflateReset @23
- inflateSetDictionary @24
- inflateSync @25
- uncompress @26
- zlibVersion @27
- gzprintf @28
- gzputc @29
- gzgetc @30
- gzseek @31
- gzrewind @32
- gztell @33
- gzeof @34
- gzsetparams @35
- zError @36
- inflateSyncPoint @37
- get_crc_table @38
- compress2 @39
- gzputs @40
- gzgets @41
- inflateCopy @42
- inflateBackInit_ @43
- inflateBack @44
- inflateBackEnd @45
- compressBound @46
- deflateBound @47
- gzclearerr @48
- gzungetc @49
- zlibCompileFlags @50
- deflatePrime @51
-
- unzOpen @61
- unzClose @62
- unzGetGlobalInfo @63
- unzGetCurrentFileInfo @64
- unzGoToFirstFile @65
- unzGoToNextFile @66
- unzOpenCurrentFile @67
- unzReadCurrentFile @68
- unzOpenCurrentFile3 @69
- unztell @70
- unzeof @71
- unzCloseCurrentFile @72
- unzGetGlobalComment @73
- unzStringFileNameCompare @74
- unzLocateFile @75
- unzGetLocalExtrafield @76
- unzOpen2 @77
- unzOpenCurrentFile2 @78
- unzOpenCurrentFilePassword @79
-
- zipOpen @80
- zipOpenNewFileInZip @81
- zipWriteInFileInZip @82
- zipCloseFileInZip @83
- zipClose @84
- zipOpenNewFileInZip2 @86
- zipCloseFileInZipRaw @87
- zipOpen2 @88
- zipOpenNewFileInZip3 @89
-
- unzGetFilePos @100
- unzGoToFilePos @101
-
- fill_win32_filefunc @110
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.sln b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.sln
deleted file mode 100644
index 927b42b..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.sln
+++ /dev/null
@@ -1,78 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testZlibDll", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- ConfigName.2 = ReleaseAxp
- ConfigName.3 = ReleaseWithoutAsm
- ConfigName.4 = ReleaseWithoutCrtdll
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug.ActiveCfg = Debug|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug.Build.0 = Debug|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release.ActiveCfg = Release|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release.Build.0 = Release|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseAxp.Build.0 = ReleaseAxp|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutCrtdll.ActiveCfg = ReleaseAxp|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutCrtdll.Build.0 = ReleaseAxp|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug.ActiveCfg = Debug|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug.Build.0 = Debug|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release.ActiveCfg = Release|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release.Build.0 = Release|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseAxp.Build.0 = ReleaseAxp|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutCrtdll.ActiveCfg = ReleaseWithoutCrtdll|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutCrtdll.Build.0 = ReleaseWithoutCrtdll|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug.ActiveCfg = Debug|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug.Build.0 = Debug|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release.ActiveCfg = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release.Build.0 = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAxp.ActiveCfg = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAxp.Build.0 = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm.Build.0 = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug.ActiveCfg = Debug|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug.Build.0 = Debug|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release.ActiveCfg = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release.Build.0 = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseAxp.ActiveCfg = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseAxp.Build.0 = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.ActiveCfg = Debug|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.Build.0 = Debug|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.ActiveCfg = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.Build.0 = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.ActiveCfg = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.Build.0 = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.Build.0 = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.vcproj
deleted file mode 100644
index 8533b49..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc7/zlibvc.vcproj
+++ /dev/null
@@ -1,445 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="zlibvc"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\DebugDll"
- IntermediateDirectory=".\DebugDll"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
- ExceptionHandling="FALSE"
- RuntimeLibrary="1"
- PrecompiledHeaderFile=".\DebugDll/zlibvc.pch"
- AssemblerListingLocation=".\DebugDll/"
- ObjectFile=".\DebugDll/"
- ProgramDataBaseFileName=".\DebugDll/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
- OutputFile=".\DebugDll\zlibwapi.dll"
- LinkIncremental="2"
- SuppressStartupBanner="TRUE"
- ModuleDefinitionFile=".\zlibvc.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\DebugDll/zlibwapi.pdb"
- SubSystem="2"
- ImportLibrary=".\DebugDll/zlibwapi.lib"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\DebugDll/zlibvc.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Win32"
- OutputDirectory=".\zlibDllWithoutAsm"
- IntermediateDirectory=".\zlibDllWithoutAsm"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\zlibDllWithoutAsm/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation=".\zlibDllWithoutAsm/"
- ObjectFile=".\zlibDllWithoutAsm/"
- ProgramDataBaseFileName=".\zlibDllWithoutAsm/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="crtdll.lib"
- OutputFile=".\zlibDllWithoutAsm\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- IgnoreAllDefaultLibraries="TRUE"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile=".\zlibDllWithoutAsm/zlibwapi.pdb"
- GenerateMapFile="TRUE"
- MapFileName=".\zlibDllWithoutAsm/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary=".\zlibDllWithoutAsm/zlibwapi.lib"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\zlibDllWithoutAsm/zlibvc.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="ReleaseWithoutCrtdll|Win32"
- OutputDirectory=".\zlibDllWithoutCrtDll"
- IntermediateDirectory=".\zlibDllWithoutCrtDll"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\zlibDllWithoutCrtDll/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation=".\zlibDllWithoutCrtDll/"
- ObjectFile=".\zlibDllWithoutCrtDll/"
- ProgramDataBaseFileName=".\zlibDllWithoutCrtDll/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
- OutputFile=".\zlibDllWithoutCrtDll\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- IgnoreAllDefaultLibraries="FALSE"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile=".\zlibDllWithoutCrtDll/zlibwapi.pdb"
- GenerateMapFile="TRUE"
- MapFileName=".\zlibDllWithoutCrtDll/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary=".\zlibDllWithoutCrtDll/zlibwapi.lib"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\zlibDllWithoutCrtDll/zlibvc.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="ReleaseAxp|Win32"
- OutputDirectory=".\zlibvc__"
- IntermediateDirectory=".\zlibvc__"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\zlibvc__/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation=".\zlibvc__/"
- ObjectFile=".\zlibvc__/"
- ProgramDataBaseFileName=".\zlibvc__/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="crtdll.lib"
- OutputFile="zlibvc__\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- IgnoreAllDefaultLibraries="TRUE"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile=".\zlibvc__/zlibwapi.pdb"
- GenerateMapFile="TRUE"
- MapFileName=".\zlibvc__/zlibwapi.map"
- SubSystem="2"
- ImportLibrary=".\zlibvc__/zlibwapi.lib"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\zlibvc__/zlibvc.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\ReleaseDll"
- IntermediateDirectory=".\ReleaseDll"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
- StringPooling="TRUE"
- ExceptionHandling="FALSE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- PrecompiledHeaderFile=".\ReleaseDll/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation=".\ReleaseDll/"
- ObjectFile=".\ReleaseDll/"
- ProgramDataBaseFileName=".\ReleaseDll/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj crtdll.lib"
- OutputFile=".\ReleaseDll\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- IgnoreAllDefaultLibraries="TRUE"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile=".\ReleaseDll/zlibwapi.pdb"
- GenerateMapFile="TRUE"
- MapFileName=".\ReleaseDll/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary=".\ReleaseDll/zlibwapi.lib"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/zlibvc.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">
- <File
- RelativePath="..\..\..\adler32.c">
- </File>
- <File
- RelativePath="..\..\..\compress.c">
- </File>
- <File
- RelativePath="..\..\..\crc32.c">
- </File>
- <File
- RelativePath="..\..\..\deflate.c">
- </File>
- <File
- RelativePath="..\..\masmx86\gvmat32c.c">
- <FileConfiguration
- Name="ReleaseWithoutAsm|Win32"
- ExcludedFromBuild="TRUE">
- <Tool
- Name="VCCLCompilerTool"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\gzio.c">
- </File>
- <File
- RelativePath="..\..\..\infback.c">
- </File>
- <File
- RelativePath="..\..\..\inffast.c">
- </File>
- <File
- RelativePath="..\..\..\inflate.c">
- </File>
- <File
- RelativePath="..\..\..\inftrees.c">
- </File>
- <File
- RelativePath="..\..\minizip\ioapi.c">
- </File>
- <File
- RelativePath="..\..\minizip\iowin32.c">
- </File>
- <File
- RelativePath="..\..\..\trees.c">
- </File>
- <File
- RelativePath="..\..\..\uncompr.c">
- </File>
- <File
- RelativePath="..\..\minizip\unzip.c">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\minizip\zip.c">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\zlib.rc">
- </File>
- <File
- RelativePath=".\zlibvc.def">
- </File>
- <File
- RelativePath="..\..\..\zutil.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;fi;fd">
- <File
- RelativePath="..\..\..\deflate.h">
- </File>
- <File
- RelativePath="..\..\..\infblock.h">
- </File>
- <File
- RelativePath="..\..\..\infcodes.h">
- </File>
- <File
- RelativePath="..\..\..\inffast.h">
- </File>
- <File
- RelativePath="..\..\..\inftrees.h">
- </File>
- <File
- RelativePath="..\..\..\infutil.h">
- </File>
- <File
- RelativePath="..\..\..\zconf.h">
- </File>
- <File
- RelativePath="..\..\..\zlib.h">
- </File>
- <File
- RelativePath="..\..\..\zutil.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/miniunz.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/miniunz.vcproj
deleted file mode 100644
index 4af53e8..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/miniunz.vcproj
+++ /dev/null
@@ -1,566 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="miniunz"
- ProjectGUID="{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- <Platform
- Name="Itanium"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="x86\MiniUnzip$(ConfigurationName)"
- IntermediateDirectory="x86\MiniUnzip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="1"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x86\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="x64\MiniUnzip$(ConfigurationName)"
- IntermediateDirectory="x64\MiniUnzip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x64\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Itanium"
- OutputDirectory="ia64\MiniUnzip$(ConfigurationName)"
- IntermediateDirectory="ia64\MiniUnzip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ia64\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
- SubSystem="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="x86\MiniUnzip$(ConfigurationName)"
- IntermediateDirectory="x86\MiniUnzip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x86\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="x64\MiniUnzip$(ConfigurationName)"
- IntermediateDirectory="x64\MiniUnzip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x64\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Itanium"
- OutputDirectory="ia64\MiniUnzip$(ConfigurationName)"
- IntermediateDirectory="ia64\MiniUnzip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ia64\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/miniunz.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
- >
- <File
- RelativePath="..\..\minizip\miniunz.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/minizip.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/minizip.vcproj
deleted file mode 100644
index 85f64c4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/minizip.vcproj
+++ /dev/null
@@ -1,563 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="minizip"
- ProjectGUID="{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- <Platform
- Name="Itanium"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="x86\MiniZip$(ConfigurationName)"
- IntermediateDirectory="x86\MiniZip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="1"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x86\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/minizip.pdb"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="x64\$(ConfigurationName)"
- IntermediateDirectory="x64\$(ConfigurationName)"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x64\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/minizip.pdb"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Itanium"
- OutputDirectory="ia64\$(ConfigurationName)"
- IntermediateDirectory="ia64\$(ConfigurationName)"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ia64\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/minizip.pdb"
- SubSystem="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="x86\MiniZip$(ConfigurationName)"
- IntermediateDirectory="x86\MiniZip$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x86\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="x64\$(ConfigurationName)"
- IntermediateDirectory="x64\$(ConfigurationName)"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x64\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Itanium"
- OutputDirectory="ia64\$(ConfigurationName)"
- IntermediateDirectory="ia64\$(ConfigurationName)"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ia64\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/minizip.exe"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
- >
- <File
- RelativePath="..\..\minizip\minizip.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlib.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlib.vcproj
deleted file mode 100644
index 68c3539..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlib.vcproj
+++ /dev/null
@@ -1,948 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="testzlib"
- ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}"
- RootNamespace="testzlib"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- <Platform
- Name="Itanium"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="x86\TestZlib$(ConfigurationName)"
- IntermediateDirectory="x86\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="1"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerOutput="4"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="x64\TestZlib$(ConfigurationName)"
- IntermediateDirectory="x64\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- AssemblerListingLocation="$(IntDir)\"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj"
- GenerateManifest="false"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Itanium"
- OutputDirectory="ia64\TestZlib$(ConfigurationName)"
- IntermediateDirectory="ia64\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerOutput="4"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
- SubSystem="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Win32"
- OutputDirectory="x86\TestZlib$(ConfigurationName)"
- IntermediateDirectory="x86\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|x64"
- OutputDirectory="x64\TestZlib$(ConfigurationName)"
- IntermediateDirectory="x64\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- AssemblerListingLocation="$(IntDir)\"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies=""
- GenerateManifest="false"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Itanium"
- OutputDirectory="ia64\TestZlib$(ConfigurationName)"
- IntermediateDirectory="ia64\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="x86\TestZlib$(ConfigurationName)"
- IntermediateDirectory="x86\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="x64\TestZlib$(ConfigurationName)"
- IntermediateDirectory="x64\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- AssemblerListingLocation="$(IntDir)\"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj"
- GenerateManifest="false"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Itanium"
- OutputDirectory="ia64\TestZlib$(ConfigurationName)"
- IntermediateDirectory="ia64\TestZlib$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\.."
- PreprocessorDefinitions="ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
- >
- <File
- RelativePath="..\..\..\adler32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\compress.c"
- >
- </File>
- <File
- RelativePath="..\..\..\crc32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\deflate.c"
- >
- </File>
- <File
- RelativePath="..\..\masmx86\gvmat32c.c"
- >
- <FileConfiguration
- Name="Debug|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win64 (AMD64)"
- ExcludedFromBuild="TRUE"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win64 (AMD64)"
- ExcludedFromBuild="TRUE"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseAsm|Win64 (AMD64)"
- ExcludedFromBuild="TRUE"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\infback.c"
- >
- </File>
- <File
- RelativePath="..\..\masmx64\inffas8664.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\inffast.c"
- >
- </File>
- <File
- RelativePath="..\..\..\inflate.c"
- >
- </File>
- <File
- RelativePath="..\..\..\inftrees.c"
- >
- </File>
- <File
- RelativePath="..\..\testzlib\testzlib.c"
- >
- </File>
- <File
- RelativePath="..\..\..\trees.c"
- >
- </File>
- <File
- RelativePath="..\..\..\uncompr.c"
- >
- </File>
- <File
- RelativePath="..\..\..\zutil.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlibdll.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlibdll.vcproj
deleted file mode 100644
index f38ab5e..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/testzlibdll.vcproj
+++ /dev/null
@@ -1,567 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="TestZlibDll"
- ProjectGUID="{C52F9E7B-498A-42BE-8DB4-85A15694366A}"
- Keyword="Win32Proj"
- SignManifests="true"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- <Platform
- Name="Itanium"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="x86\TestZlibDll$(ConfigurationName)"
- IntermediateDirectory="x86\TestZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="1"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x86\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="x64\TestZlibDll$(ConfigurationName)"
- IntermediateDirectory="x64\TestZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x64\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
- SubSystem="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Itanium"
- OutputDirectory="ia64\TestZlibDll$(ConfigurationName)"
- IntermediateDirectory="ia64\TestZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
- MinimalRebuild="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ia64\ZlibDllDebug\zlibwapi.lib"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="2"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
- SubSystem="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="x86\TestZlibDll$(ConfigurationName)"
- IntermediateDirectory="x86\TestZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x86\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="x64\TestZlibDll$(ConfigurationName)"
- IntermediateDirectory="x64\TestZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="x64\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Itanium"
- OutputDirectory="ia64\TestZlibDll$(ConfigurationName)"
- IntermediateDirectory="ia64\TestZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="1"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="true"
- AdditionalIncludeDirectories="..\..\..;..\..\minizip"
- PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
- StringPooling="true"
- BasicRuntimeChecks="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- AssemblerListingLocation="$(IntDir)\"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ia64\ZlibDllRelease\zlibwapi.lib"
- OutputFile="$(OutDir)/testzlib.exe"
- LinkIncremental="1"
- GenerateManifest="false"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
- >
- <File
- RelativePath="..\..\testzlib\testzlib.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlib.rc b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlib.rc
deleted file mode 100644
index 72cb8b4..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlib.rc
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <windows.h>
-
-#define IDR_VERSION1 1
-IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
- FILEVERSION 1,2,3,0
- PRODUCTVERSION 1,2,3,0
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
- FILEFLAGS 0
- FILEOS VOS_DOS_WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE 0 // not used
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904E4"
- //language ID = U.S. English, char set = Windows, Multilingual
-
- BEGIN
- VALUE "FileDescription", "zlib data compression library\0"
- VALUE "FileVersion", "1.2.3.0\0"
- VALUE "InternalName", "zlib\0"
- VALUE "OriginalFilename", "zlib.dll\0"
- VALUE "ProductName", "ZLib.DLL\0"
- VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
- VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0409, 1252
- END
-END
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibstat.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibstat.vcproj
deleted file mode 100644
index fb97037..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibstat.vcproj
+++ /dev/null
@@ -1,870 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="zlibstat"
- ProjectGUID="{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- <Platform
- Name="Itanium"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="x86\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- ExceptionHandling="0"
- RuntimeLibrary="1"
- BufferSecurityCheck="false"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:X86 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="x64\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="x64\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- ExceptionHandling="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:AMD64 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Itanium"
- OutputDirectory="ia64\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="ia64\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- ExceptionHandling="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:IA64 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="x86\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ASMV;ASMINF"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:X86 /NODEFAULTLIB"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="x64\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="x64\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ASMV;ASMINF;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:AMD64 /NODEFAULTLIB"
- AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj "
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Itanium"
- OutputDirectory="ia64\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="ia64\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:IA64 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Win32"
- OutputDirectory="x86\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:X86 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|x64"
- OutputDirectory="x64\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="x64\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:AMD64 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Itanium"
- OutputDirectory="ia64\ZlibStat$(ConfigurationName)"
- IntermediateDirectory="ia64\ZlibStat$(ConfigurationName)\Tmp"
- ConfigurationType="4"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="2"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- AdditionalOptions="/MACHINE:IA64 /NODEFAULTLIB"
- OutputFile="$(OutDir)\zlibstat.lib"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- >
- <File
- RelativePath="..\..\..\adler32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\compress.c"
- >
- </File>
- <File
- RelativePath="..\..\..\crc32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\deflate.c"
- >
- </File>
- <File
- RelativePath="..\..\masmx86\gvmat32c.c"
- >
- <FileConfiguration
- Name="Debug|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\gzio.c"
- >
- </File>
- <File
- RelativePath="..\..\..\infback.c"
- >
- </File>
- <File
- RelativePath="..\..\masmx64\inffas8664.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\inffast.c"
- >
- </File>
- <File
- RelativePath="..\..\..\inflate.c"
- >
- </File>
- <File
- RelativePath="..\..\..\inftrees.c"
- >
- </File>
- <File
- RelativePath="..\..\minizip\ioapi.c"
- >
- </File>
- <File
- RelativePath="..\..\..\trees.c"
- >
- </File>
- <File
- RelativePath="..\..\..\uncompr.c"
- >
- </File>
- <File
- RelativePath="..\..\minizip\unzip.c"
- >
- </File>
- <File
- RelativePath="..\..\minizip\zip.c"
- >
- </File>
- <File
- RelativePath=".\zlib.rc"
- >
- </File>
- <File
- RelativePath=".\zlibvc.def"
- >
- </File>
- <File
- RelativePath="..\..\..\zutil.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.def b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.def
deleted file mode 100644
index a40e715..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.def
+++ /dev/null
@@ -1,92 +0,0 @@
-
-VERSION 1.23
-
-HEAPSIZE 1048576,8192
-
-EXPORTS
- adler32 @1
- compress @2
- crc32 @3
- deflate @4
- deflateCopy @5
- deflateEnd @6
- deflateInit2_ @7
- deflateInit_ @8
- deflateParams @9
- deflateReset @10
- deflateSetDictionary @11
- gzclose @12
- gzdopen @13
- gzerror @14
- gzflush @15
- gzopen @16
- gzread @17
- gzwrite @18
- inflate @19
- inflateEnd @20
- inflateInit2_ @21
- inflateInit_ @22
- inflateReset @23
- inflateSetDictionary @24
- inflateSync @25
- uncompress @26
- zlibVersion @27
- gzprintf @28
- gzputc @29
- gzgetc @30
- gzseek @31
- gzrewind @32
- gztell @33
- gzeof @34
- gzsetparams @35
- zError @36
- inflateSyncPoint @37
- get_crc_table @38
- compress2 @39
- gzputs @40
- gzgets @41
- inflateCopy @42
- inflateBackInit_ @43
- inflateBack @44
- inflateBackEnd @45
- compressBound @46
- deflateBound @47
- gzclearerr @48
- gzungetc @49
- zlibCompileFlags @50
- deflatePrime @51
-
- unzOpen @61
- unzClose @62
- unzGetGlobalInfo @63
- unzGetCurrentFileInfo @64
- unzGoToFirstFile @65
- unzGoToNextFile @66
- unzOpenCurrentFile @67
- unzReadCurrentFile @68
- unzOpenCurrentFile3 @69
- unztell @70
- unzeof @71
- unzCloseCurrentFile @72
- unzGetGlobalComment @73
- unzStringFileNameCompare @74
- unzLocateFile @75
- unzGetLocalExtrafield @76
- unzOpen2 @77
- unzOpenCurrentFile2 @78
- unzOpenCurrentFilePassword @79
-
- zipOpen @80
- zipOpenNewFileInZip @81
- zipWriteInFileInZip @82
- zipCloseFileInZip @83
- zipClose @84
- zipOpenNewFileInZip2 @86
- zipCloseFileInZipRaw @87
- zipOpen2 @88
- zipOpenNewFileInZip3 @89
-
- unzGetFilePos @100
- unzGoToFilePos @101
-
- fill_win32_filefunc @110
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.sln b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.sln
deleted file mode 100644
index a815a55..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.sln
+++ /dev/null
@@ -1,144 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestZlibDll", "testzlibdll.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}"
- ProjectSection(ProjectDependencies) = postProject
- {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}"
- ProjectSection(ProjectDependencies) = postProject
- {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
- ProjectSection(ProjectDependencies) = postProject
- {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Itanium = Debug|Itanium
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Itanium = Release|Itanium
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium
- ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32
- ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Itanium
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.Build.0 = Debug|Itanium
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Itanium
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.Build.0 = Release|Itanium
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = ReleaseWithoutAsm|x64
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = ReleaseWithoutAsm|x64
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
- {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
- {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
- {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.Build.0 = Debug|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.Build.0 = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium
- {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.Build.0 = Debug|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.Build.0 = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium
- {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.vcproj b/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.vcproj
deleted file mode 100644
index e717011..0000000
--- a/funtools/util/zlib-1.2.3/contrib/vstudio/vc8/zlibvc.vcproj
+++ /dev/null
@@ -1,1219 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="zlibvc"
- ProjectGUID="{8FD826F8-3739-44E6-8CC8-997122E53B8D}"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- <Platform
- Name="Itanium"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="x86\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="x86\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI,ASMV,ASMINF"
- ExceptionHandling="0"
- RuntimeLibrary="1"
- BufferSecurityCheck="false"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- ModuleDefinitionFile=".\zlibvc.def"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="x64\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="x64\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI,ASMV,ASMINF;WIN64"
- ExceptionHandling="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj "
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- ModuleDefinitionFile=".\zlibvc.def"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|Itanium"
- OutputDirectory="ia64\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="ia64\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="2"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;WIN64"
- ExceptionHandling="0"
- RuntimeLibrary="3"
- BufferSecurityCheck="false"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- ModuleDefinitionFile=".\zlibvc.def"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Win32"
- OutputDirectory="x86\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="x86\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- IgnoreAllDefaultLibraries="false"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|x64"
- OutputDirectory="x64\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="x64\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- IgnoreAllDefaultLibraries="false"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="ReleaseWithoutAsm|Itanium"
- OutputDirectory="ia64\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="ia64\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="2"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- IgnoreAllDefaultLibraries="false"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="x86\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="x86\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;ASMV;ASMINF"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- IgnoreAllDefaultLibraries="false"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="x64\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="x64\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="3"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;ASMV;ASMINF;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj "
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- IgnoreAllDefaultLibraries="false"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Itanium"
- OutputDirectory="ia64\ZlibDll$(ConfigurationName)"
- IntermediateDirectory="ia64\ZlibDll$(ConfigurationName)\Tmp"
- ConfigurationType="2"
- InheritedPropertySheets="UpgradeFromVC70.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="2"
- TypeLibraryName="$(OutDir)/zlibvc.tlb"
- />
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
- PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;WIN64"
- StringPooling="true"
- ExceptionHandling="0"
- RuntimeLibrary="2"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
- AssemblerOutput="2"
- AssemblerListingLocation="$(IntDir)\"
- ObjectFile="$(IntDir)\"
- ProgramDataBaseFileName="$(OutDir)\"
- BrowseInformation="0"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1036"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)\zlibwapi.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- GenerateManifest="false"
- IgnoreAllDefaultLibraries="false"
- ModuleDefinitionFile=".\zlibvc.def"
- ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
- GenerateMapFile="true"
- MapFileName="$(OutDir)/zlibwapi.map"
- SubSystem="2"
- OptimizeForWindows98="1"
- ImportLibrary="$(OutDir)/zlibwapi.lib"
- TargetMachine="5"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
- >
- <File
- RelativePath="..\..\..\adler32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\compress.c"
- >
- </File>
- <File
- RelativePath="..\..\..\crc32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\deflate.c"
- >
- </File>
- <File
- RelativePath="..\..\masmx86\gvmat32c.c"
- >
- <FileConfiguration
- Name="Debug|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\gzio.c"
- >
- </File>
- <File
- RelativePath="..\..\..\infback.c"
- >
- </File>
- <File
- RelativePath="..\..\masmx64\inffas8664.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="ReleaseWithoutAsm|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCLCompilerTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\..\inffast.c"
- >
- </File>
- <File
- RelativePath="..\..\..\inflate.c"
- >
- </File>
- <File
- RelativePath="..\..\..\inftrees.c"
- >
- </File>
- <File
- RelativePath="..\..\minizip\ioapi.c"
- >
- </File>
- <File
- RelativePath="..\..\minizip\iowin32.c"
- >
- </File>
- <File
- RelativePath="..\..\..\trees.c"
- >
- </File>
- <File
- RelativePath="..\..\..\uncompr.c"
- >
- </File>
- <File
- RelativePath="..\..\minizip\unzip.c"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\..\minizip\zip.c"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Itanium"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="ZLIB_INTERNAL"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\zlib.rc"
- >
- </File>
- <File
- RelativePath=".\zlibvc.def"
- >
- </File>
- <File
- RelativePath="..\..\..\zutil.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;fi;fd"
- >
- <File
- RelativePath="..\..\..\deflate.h"
- >
- </File>
- <File
- RelativePath="..\..\..\infblock.h"
- >
- </File>
- <File
- RelativePath="..\..\..\infcodes.h"
- >
- </File>
- <File
- RelativePath="..\..\..\inffast.h"
- >
- </File>
- <File
- RelativePath="..\..\..\inftrees.h"
- >
- </File>
- <File
- RelativePath="..\..\..\infutil.h"
- >
- </File>
- <File
- RelativePath="..\..\..\zconf.h"
- >
- </File>
- <File
- RelativePath="..\..\..\zlib.h"
- >
- </File>
- <File
- RelativePath="..\..\..\zutil.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/funtools/util/zlib-1.2.3/crc32.c b/funtools/util/zlib-1.2.3/crc32.c
deleted file mode 100644
index f658a9e..0000000
--- a/funtools/util/zlib-1.2.3/crc32.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
- * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
- * tables for updating the shift register in one step with three exclusive-ors
- * instead of four steps with four exclusive-ors. This results in about a
- * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
- */
-
-/* @(#) $Id$ */
-
-/*
- Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
- protection on the static variables used to control the first-use generation
- of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
- first call get_crc_table() to initialize the tables before allowing more than
- one thread to use crc32().
- */
-
-#ifdef MAKECRCH
-# include <stdio.h>
-# ifndef DYNAMIC_CRC_TABLE
-# define DYNAMIC_CRC_TABLE
-# endif /* !DYNAMIC_CRC_TABLE */
-#endif /* MAKECRCH */
-
-#include "zutil.h" /* for STDC and FAR definitions */
-
-#define local static
-
-/* Find a four-byte integer type for crc32_little() and crc32_big(). */
-#ifndef NOBYFOUR
-# ifdef STDC /* need ANSI C limits.h to determine sizes */
-# include <limits.h>
-# define BYFOUR
-# if (UINT_MAX == 0xffffffffUL)
- typedef unsigned int u4;
-# else
-# if (ULONG_MAX == 0xffffffffUL)
- typedef unsigned long u4;
-# else
-# if (USHRT_MAX == 0xffffffffUL)
- typedef unsigned short u4;
-# else
-# undef BYFOUR /* can't find a four-byte integer type! */
-# endif
-# endif
-# endif
-# endif /* STDC */
-#endif /* !NOBYFOUR */
-
-/* Definitions for doing the crc four data bytes at a time. */
-#ifdef BYFOUR
-# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
- (((w)&0xff00)<<8)+(((w)&0xff)<<24))
- local unsigned long crc32_little OF((unsigned long,
- const unsigned char FAR *, unsigned));
- local unsigned long crc32_big OF((unsigned long,
- const unsigned char FAR *, unsigned));
-# define TBLS 8
-#else
-# define TBLS 1
-#endif /* BYFOUR */
-
-/* Local functions for crc concatenation */
-local unsigned long gf2_matrix_times OF((unsigned long *mat,
- unsigned long vec));
-local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
-
-#ifdef DYNAMIC_CRC_TABLE
-
-local volatile int crc_table_empty = 1;
-local unsigned long FAR crc_table[TBLS][256];
-local void make_crc_table OF((void));
-#ifdef MAKECRCH
- local void write_table OF((FILE *, const unsigned long FAR *));
-#endif /* MAKECRCH */
-/*
- Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
- x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
-
- Polynomials over GF(2) are represented in binary, one bit per coefficient,
- with the lowest powers in the most significant bit. Then adding polynomials
- is just exclusive-or, and multiplying a polynomial by x is a right shift by
- one. If we call the above polynomial p, and represent a byte as the
- polynomial q, also with the lowest power in the most significant bit (so the
- byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
- where a mod b means the remainder after dividing a by b.
-
- This calculation is done using the shift-register method of multiplying and
- taking the remainder. The register is initialized to zero, and for each
- incoming bit, x^32 is added mod p to the register if the bit is a one (where
- x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
- x (which is shifting right by one and adding x^32 mod p if the bit shifted
- out is a one). We start with the highest power (least significant bit) of
- q and repeat for all eight bits of q.
-
- The first table is simply the CRC of all possible eight bit values. This is
- all the information needed to generate CRCs on data a byte at a time for all
- combinations of CRC register values and incoming bytes. The remaining tables
- allow for word-at-a-time CRC calculation for both big-endian and little-
- endian machines, where a word is four bytes.
-*/
-local void make_crc_table()
-{
- unsigned long c;
- int n, k;
- unsigned long poly; /* polynomial exclusive-or pattern */
- /* terms of polynomial defining this crc (except x^32): */
- static volatile int first = 1; /* flag to limit concurrent making */
- static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
-
- /* See if another task is already doing this (not thread-safe, but better
- than nothing -- significantly reduces duration of vulnerability in
- case the advice about DYNAMIC_CRC_TABLE is ignored) */
- if (first) {
- first = 0;
-
- /* make exclusive-or pattern from polynomial (0xedb88320UL) */
- poly = 0UL;
- for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
- poly |= 1UL << (31 - p[n]);
-
- /* generate a crc for every 8-bit value */
- for (n = 0; n < 256; n++) {
- c = (unsigned long)n;
- for (k = 0; k < 8; k++)
- c = c & 1 ? poly ^ (c >> 1) : c >> 1;
- crc_table[0][n] = c;
- }
-
-#ifdef BYFOUR
- /* generate crc for each value followed by one, two, and three zeros,
- and then the byte reversal of those as well as the first table */
- for (n = 0; n < 256; n++) {
- c = crc_table[0][n];
- crc_table[4][n] = REV(c);
- for (k = 1; k < 4; k++) {
- c = crc_table[0][c & 0xff] ^ (c >> 8);
- crc_table[k][n] = c;
- crc_table[k + 4][n] = REV(c);
- }
- }
-#endif /* BYFOUR */
-
- crc_table_empty = 0;
- }
- else { /* not first */
- /* wait for the other guy to finish (not efficient, but rare) */
- while (crc_table_empty)
- ;
- }
-
-#ifdef MAKECRCH
- /* write out CRC tables to crc32.h */
- {
- FILE *out;
-
- out = fopen("crc32.h", "w");
- if (out == NULL) return;
- fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
- fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
- fprintf(out, "local const unsigned long FAR ");
- fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
- write_table(out, crc_table[0]);
-# ifdef BYFOUR
- fprintf(out, "#ifdef BYFOUR\n");
- for (k = 1; k < 8; k++) {
- fprintf(out, " },\n {\n");
- write_table(out, crc_table[k]);
- }
- fprintf(out, "#endif\n");
-# endif /* BYFOUR */
- fprintf(out, " }\n};\n");
- fclose(out);
- }
-#endif /* MAKECRCH */
-}
-
-#ifdef MAKECRCH
-local void write_table(out, table)
- FILE *out;
- const unsigned long FAR *table;
-{
- int n;
-
- for (n = 0; n < 256; n++)
- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
- n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
-}
-#endif /* MAKECRCH */
-
-#else /* !DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Tables of CRC-32s of all single-byte values, made by make_crc_table().
- */
-#include "crc32.h"
-#endif /* DYNAMIC_CRC_TABLE */
-
-/* =========================================================================
- * This function can be used by asm versions of crc32()
- */
-const unsigned long FAR * ZEXPORT get_crc_table()
-{
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
- return (const unsigned long FAR *)crc_table;
-}
-
-/* ========================================================================= */
-#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
-#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
-
-/* ========================================================================= */
-unsigned long ZEXPORT crc32(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- if (buf == Z_NULL) return 0UL;
-
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
-
-#ifdef BYFOUR
- if (sizeof(void *) == sizeof(ptrdiff_t)) {
- u4 endian;
-
- endian = 1;
- if (*((unsigned char *)(&endian)))
- return crc32_little(crc, buf, len);
- else
- return crc32_big(crc, buf, len);
- }
-#endif /* BYFOUR */
- crc = crc ^ 0xffffffffUL;
- while (len >= 8) {
- DO8;
- len -= 8;
- }
- if (len) do {
- DO1;
- } while (--len);
- return crc ^ 0xffffffffUL;
-}
-
-#ifdef BYFOUR
-
-/* ========================================================================= */
-#define DOLIT4 c ^= *buf4++; \
- c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
- crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
-#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
-
-/* ========================================================================= */
-local unsigned long crc32_little(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- register u4 c;
- register const u4 FAR *buf4;
-
- c = (u4)crc;
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- len--;
- }
-
- buf4 = (const u4 FAR *)(const void FAR *)buf;
- while (len >= 32) {
- DOLIT32;
- len -= 32;
- }
- while (len >= 4) {
- DOLIT4;
- len -= 4;
- }
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- } while (--len);
- c = ~c;
- return (unsigned long)c;
-}
-
-/* ========================================================================= */
-#define DOBIG4 c ^= *++buf4; \
- c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
- crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
-#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
-
-/* ========================================================================= */
-local unsigned long crc32_big(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- register u4 c;
- register const u4 FAR *buf4;
-
- c = REV((u4)crc);
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- len--;
- }
-
- buf4 = (const u4 FAR *)(const void FAR *)buf;
- buf4--;
- while (len >= 32) {
- DOBIG32;
- len -= 32;
- }
- while (len >= 4) {
- DOBIG4;
- len -= 4;
- }
- buf4++;
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- } while (--len);
- c = ~c;
- return (unsigned long)(REV(c));
-}
-
-#endif /* BYFOUR */
-
-#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
-
-/* ========================================================================= */
-local unsigned long gf2_matrix_times(mat, vec)
- unsigned long *mat;
- unsigned long vec;
-{
- unsigned long sum;
-
- sum = 0;
- while (vec) {
- if (vec & 1)
- sum ^= *mat;
- vec >>= 1;
- mat++;
- }
- return sum;
-}
-
-/* ========================================================================= */
-local void gf2_matrix_square(square, mat)
- unsigned long *square;
- unsigned long *mat;
-{
- int n;
-
- for (n = 0; n < GF2_DIM; n++)
- square[n] = gf2_matrix_times(mat, mat[n]);
-}
-
-/* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
-{
- int n;
- unsigned long row;
- unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
- unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
-
- /* degenerate case */
- if (len2 == 0)
- return crc1;
-
- /* put operator for one zero bit in odd */
- odd[0] = 0xedb88320L; /* CRC-32 polynomial */
- row = 1;
- for (n = 1; n < GF2_DIM; n++) {
- odd[n] = row;
- row <<= 1;
- }
-
- /* put operator for two zero bits in even */
- gf2_matrix_square(even, odd);
-
- /* put operator for four zero bits in odd */
- gf2_matrix_square(odd, even);
-
- /* apply len2 zeros to crc1 (first square will put the operator for one
- zero byte, eight zero bits, in even) */
- do {
- /* apply zeros operator for this bit of len2 */
- gf2_matrix_square(even, odd);
- if (len2 & 1)
- crc1 = gf2_matrix_times(even, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- if (len2 == 0)
- break;
-
- /* another iteration of the loop with odd and even swapped */
- gf2_matrix_square(odd, even);
- if (len2 & 1)
- crc1 = gf2_matrix_times(odd, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- } while (len2 != 0);
-
- /* return combined crc */
- crc1 ^= crc2;
- return crc1;
-}
diff --git a/funtools/util/zlib-1.2.3/crc32.h b/funtools/util/zlib-1.2.3/crc32.h
deleted file mode 100644
index 8053b61..0000000
--- a/funtools/util/zlib-1.2.3/crc32.h
+++ /dev/null
@@ -1,441 +0,0 @@
-/* crc32.h -- tables for rapid CRC calculation
- * Generated automatically by crc32.c
- */
-
-local const unsigned long FAR crc_table[TBLS][256] =
-{
- {
- 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
- 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
- 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
- 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
- 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
- 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
- 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
- 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
- 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
- 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
- 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
- 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
- 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
- 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
- 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
- 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
- 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
- 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
- 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
- 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
- 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
- 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
- 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
- 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
- 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
- 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
- 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
- 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
- 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
- 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
- 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
- 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
- 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
- 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
- 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
- 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
- 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
- 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
- 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
- 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
- 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
- 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
- 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
- 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
- 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
- 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
- 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
- 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
- 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
- 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
- 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
- 0x2d02ef8dUL
-#ifdef BYFOUR
- },
- {
- 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
- 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
- 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
- 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
- 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
- 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
- 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
- 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
- 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
- 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
- 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
- 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
- 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
- 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
- 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
- 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
- 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
- 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
- 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
- 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
- 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
- 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
- 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
- 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
- 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
- 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
- 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
- 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
- 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
- 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
- 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
- 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
- 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
- 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
- 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
- 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
- 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
- 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
- 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
- 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
- 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
- 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
- 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
- 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
- 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
- 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
- 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
- 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
- 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
- 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
- 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
- 0x9324fd72UL
- },
- {
- 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
- 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
- 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
- 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
- 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
- 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
- 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
- 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
- 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
- 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
- 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
- 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
- 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
- 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
- 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
- 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
- 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
- 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
- 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
- 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
- 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
- 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
- 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
- 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
- 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
- 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
- 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
- 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
- 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
- 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
- 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
- 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
- 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
- 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
- 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
- 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
- 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
- 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
- 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
- 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
- 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
- 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
- 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
- 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
- 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
- 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
- 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
- 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
- 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
- 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
- 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
- 0xbe9834edUL
- },
- {
- 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
- 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
- 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
- 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
- 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
- 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
- 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
- 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
- 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
- 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
- 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
- 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
- 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
- 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
- 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
- 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
- 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
- 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
- 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
- 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
- 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
- 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
- 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
- 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
- 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
- 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
- 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
- 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
- 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
- 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
- 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
- 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
- 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
- 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
- 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
- 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
- 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
- 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
- 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
- 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
- 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
- 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
- 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
- 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
- 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
- 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
- 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
- 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
- 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
- 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
- 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
- 0xde0506f1UL
- },
- {
- 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
- 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
- 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
- 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
- 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
- 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
- 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
- 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
- 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
- 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
- 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
- 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
- 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
- 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
- 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
- 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
- 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
- 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
- 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
- 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
- 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
- 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
- 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
- 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
- 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
- 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
- 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
- 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
- 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
- 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
- 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
- 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
- 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
- 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
- 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
- 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
- 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
- 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
- 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
- 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
- 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
- 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
- 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
- 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
- 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
- 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
- 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
- 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
- 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
- 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
- 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
- 0x8def022dUL
- },
- {
- 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
- 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
- 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
- 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
- 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
- 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
- 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
- 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
- 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
- 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
- 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
- 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
- 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
- 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
- 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
- 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
- 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
- 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
- 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
- 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
- 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
- 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
- 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
- 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
- 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
- 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
- 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
- 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
- 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
- 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
- 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
- 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
- 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
- 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
- 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
- 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
- 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
- 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
- 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
- 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
- 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
- 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
- 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
- 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
- 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
- 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
- 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
- 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
- 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
- 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
- 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
- 0x72fd2493UL
- },
- {
- 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
- 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
- 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
- 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
- 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
- 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
- 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
- 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
- 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
- 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
- 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
- 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
- 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
- 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
- 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
- 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
- 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
- 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
- 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
- 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
- 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
- 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
- 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
- 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
- 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
- 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
- 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
- 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
- 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
- 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
- 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
- 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
- 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
- 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
- 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
- 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
- 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
- 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
- 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
- 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
- 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
- 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
- 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
- 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
- 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
- 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
- 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
- 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
- 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
- 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
- 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
- 0xed3498beUL
- },
- {
- 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
- 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
- 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
- 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
- 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
- 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
- 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
- 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
- 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
- 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
- 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
- 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
- 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
- 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
- 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
- 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
- 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
- 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
- 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
- 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
- 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
- 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
- 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
- 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
- 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
- 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
- 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
- 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
- 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
- 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
- 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
- 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
- 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
- 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
- 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
- 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
- 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
- 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
- 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
- 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
- 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
- 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
- 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
- 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
- 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
- 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
- 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
- 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
- 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
- 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
- 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
- 0xf10605deUL
-#endif
- }
-};
diff --git a/funtools/util/zlib-1.2.3/deflate.c b/funtools/util/zlib-1.2.3/deflate.c
deleted file mode 100644
index 29ce1f6..0000000
--- a/funtools/util/zlib-1.2.3/deflate.c
+++ /dev/null
@@ -1,1736 +0,0 @@
-/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process depends on being able to identify portions
- * of the input text which are identical to earlier input (within a
- * sliding window trailing behind the input currently being processed).
- *
- * The most straightforward technique turns out to be the fastest for
- * most input files: try all possible matches and select the longest.
- * The key feature of this algorithm is that insertions into the string
- * dictionary are very simple and thus fast, and deletions are avoided
- * completely. Insertions are performed at each input character, whereas
- * string matches are performed only when the previous match ends. So it
- * is preferable to spend more time in matches to allow very fast string
- * insertions and avoid deletions. The matching algorithm for small
- * strings is inspired from that of Rabin & Karp. A brute force approach
- * is used to find longer strings when a small match has been found.
- * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
- * (by Leonid Broukhis).
- * A previous version of this file used a more sophisticated algorithm
- * (by Fiala and Greene) which is guaranteed to run in linear amortized
- * time, but has a larger average cost, uses more memory and is patented.
- * However the F&G algorithm may be faster for some highly redundant
- * files if the parameter max_chain_length (described below) is too large.
- *
- * ACKNOWLEDGEMENTS
- *
- * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
- * I found it in 'freeze' written by Leonid Broukhis.
- * Thanks to many people for bug reports and testing.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- * Available in http://www.ietf.org/rfc/rfc1951.txt
- *
- * A description of the Rabin and Karp algorithm is given in the book
- * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
- *
- * Fiala,E.R., and Greene,D.H.
- * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
- *
- */
-
-/* @(#) $Id$ */
-
-#include "deflate.h"
-
-const char deflate_copyright[] =
- " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/* ===========================================================================
- * Function prototypes.
- */
-typedef enum {
- need_more, /* block not completed, need more input or more output */
- block_done, /* block flush performed */
- finish_started, /* finish started, need only more output at next deflate */
- finish_done /* finish done, accept no more input or output */
-} block_state;
-
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
-/* Compression function. Returns the block state after the call. */
-
-local void fill_window OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast OF((deflate_state *s, int flush));
-#ifndef FASTEST
-local block_state deflate_slow OF((deflate_state *s, int flush));
-#endif
-local void lm_init OF((deflate_state *s));
-local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm));
-local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-#ifndef FASTEST
-#ifdef ASMV
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
-#else
-local uInt longest_match OF((deflate_state *s, IPos cur_match));
-#endif
-#endif
-local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
-
-#ifdef DEBUG
-local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
-#endif
-
-/* ===========================================================================
- * Local data
- */
-
-#define NIL 0
-/* Tail of hash chains */
-
-#ifndef TOO_FAR
-# define TOO_FAR 4096
-#endif
-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-/* Values for max_lazy_match, good_match and max_chain_length, depending on
- * the desired pack level (0..9). The values given below have been tuned to
- * exclude worst case performance for pathological files. Better values may be
- * found for specific files.
- */
-typedef struct config_s {
- ush good_length; /* reduce lazy search above this match length */
- ush max_lazy; /* do not perform lazy search above this match length */
- ush nice_length; /* quit search above this match length */
- ush max_chain;
- compress_func func;
-} config;
-
-#ifdef FASTEST
-local const config configuration_table[2] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
-#else
-local const config configuration_table[10] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
-/* 2 */ {4, 5, 16, 8, deflate_fast},
-/* 3 */ {4, 6, 32, 32, deflate_fast},
-
-/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
-/* 5 */ {8, 16, 32, 32, deflate_slow},
-/* 6 */ {8, 16, 128, 128, deflate_slow},
-/* 7 */ {8, 32, 128, 256, deflate_slow},
-/* 8 */ {32, 128, 258, 1024, deflate_slow},
-/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
-#endif
-
-/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
- * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
- * meaning.
- */
-
-#define EQUAL 0
-/* result of memcmp for equal strings */
-
-#ifndef NO_DUMMY_DECL
-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
-#endif
-
-/* ===========================================================================
- * Update a hash value with the given input byte
- * IN assertion: all calls to to UPDATE_HASH are made with consecutive
- * input characters, so that a running hash key can be computed from the
- * previous key instead of complete recalculation each time.
- */
-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
-
-
-/* ===========================================================================
- * Insert string str in the dictionary and set match_head to the previous head
- * of the hash chain (the most recent string with same hash key). Return
- * the previous length of the hash chain.
- * If this file is compiled with -DFASTEST, the compression level is forced
- * to 1, and no hash chains are maintained.
- * IN assertion: all calls to to INSERT_STRING are made with consecutive
- * input characters and the first MIN_MATCH bytes of str are valid
- * (except for the last MIN_MATCH-1 bytes of the input file).
- */
-#ifdef FASTEST
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#else
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#endif
-
-/* ===========================================================================
- * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
- * prev[] will be initialized on the fly.
- */
-#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
-
-/* ========================================================================= */
-int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
-{
- return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
- Z_DEFAULT_STRATEGY, version, stream_size);
- /* To do: ignore strm->next_in if we use it as window */
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
-{
- deflate_state *s;
- int wrap = 1;
- static const char my_version[] = ZLIB_VERSION;
-
- ushf *overlay;
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
- * output size for (length,distance) codes is <= 24 bits.
- */
-
- if (version == Z_NULL || version[0] != my_version[0] ||
- stream_size != sizeof(z_stream)) {
- return Z_VERSION_ERROR;
- }
- if (strm == Z_NULL) return Z_STREAM_ERROR;
-
- strm->msg = Z_NULL;
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
-
- if (windowBits < 0) { /* suppress zlib wrapper */
- wrap = 0;
- windowBits = -windowBits;
- }
-#ifdef GZIP
- else if (windowBits > 15) {
- wrap = 2; /* write gzip wrapper instead */
- windowBits -= 16;
- }
-#endif
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
- strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
- s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
- if (s == Z_NULL) return Z_MEM_ERROR;
- strm->state = (struct internal_state FAR *)s;
- s->strm = strm;
-
- s->wrap = wrap;
- s->gzhead = Z_NULL;
- s->w_bits = windowBits;
- s->w_size = 1 << s->w_bits;
- s->w_mask = s->w_size - 1;
-
- s->hash_bits = memLevel + 7;
- s->hash_size = 1 << s->hash_bits;
- s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
-
- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
- s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
- s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
-
- s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
-
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
- s->pending_buf = (uchf *) overlay;
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
-
- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
- s->pending_buf == Z_NULL) {
- s->status = FINISH_STATE;
- strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
- deflateEnd (strm);
- return Z_MEM_ERROR;
- }
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
-
- s->level = level;
- s->strategy = strategy;
- s->method = (Byte)method;
-
- return deflateReset(strm);
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
-{
- deflate_state *s;
- uInt length = dictLength;
- uInt n;
- IPos hash_head = 0;
-
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
- strm->state->wrap == 2 ||
- (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
- return Z_STREAM_ERROR;
-
- s = strm->state;
- if (s->wrap)
- strm->adler = adler32(strm->adler, dictionary, dictLength);
-
- if (length < MIN_MATCH) return Z_OK;
- if (length > MAX_DIST(s)) {
- length = MAX_DIST(s);
- dictionary += dictLength - length; /* use the tail of the dictionary */
- }
- zmemcpy(s->window, dictionary, length);
- s->strstart = length;
- s->block_start = (long)length;
-
- /* Insert all strings in the hash table (except for the last two bytes).
- * s->lookahead stays null, so s->ins_h will be recomputed at the next
- * call of fill_window.
- */
- s->ins_h = s->window[0];
- UPDATE_HASH(s, s->ins_h, s->window[1]);
- for (n = 0; n <= length - MIN_MATCH; n++) {
- INSERT_STRING(s, n, hash_head);
- }
- if (hash_head) hash_head = 0; /* to make compiler happy */
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
- z_streamp strm;
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
- return Z_STREAM_ERROR;
- }
-
- strm->total_in = strm->total_out = 0;
- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
- strm->data_type = Z_UNKNOWN;
-
- s = (deflate_state *)strm->state;
- s->pending = 0;
- s->pending_out = s->pending_buf;
-
- if (s->wrap < 0) {
- s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
- }
- s->status = s->wrap ? INIT_STATE : BUSY_STATE;
- strm->adler =
-#ifdef GZIP
- s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
-#endif
- adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
-
- _tr_init(s);
- lm_init(s);
-
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
- gz_headerp head;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (strm->state->wrap != 2) return Z_STREAM_ERROR;
- strm->state->gzhead = head;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- strm->state->bi_valid = bits;
- strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
-{
- deflate_state *s;
- compress_func func;
- int err = Z_OK;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
- if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- func = configuration_table[s->level].func;
-
- if (func != configuration_table[level].func && strm->total_in != 0) {
- /* Flush the last buffer: */
- err = deflate(strm, Z_PARTIAL_FLUSH);
- }
- if (s->level != level) {
- s->level = level;
- s->max_lazy_match = configuration_table[level].max_lazy;
- s->good_match = configuration_table[level].good_length;
- s->nice_match = configuration_table[level].nice_length;
- s->max_chain_length = configuration_table[level].max_chain;
- }
- s->strategy = strategy;
- return err;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
- int good_length;
- int max_lazy;
- int nice_length;
- int max_chain;
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- s->good_match = good_length;
- s->max_lazy_match = max_lazy;
- s->nice_match = nice_length;
- s->max_chain_length = max_chain;
- return Z_OK;
-}
-
-/* =========================================================================
- * For the default windowBits of 15 and memLevel of 8, this function returns
- * a close to exact, as well as small, upper bound on the compressed size.
- * They are coded as constants here for a reason--if the #define's are
- * changed, then this function needs to be changed as well. The return
- * value for 15 and 8 only works for those exact settings.
- *
- * For any setting other than those defaults for windowBits and memLevel,
- * the value returned is a conservative worst case for the maximum expansion
- * resulting from using fixed blocks instead of stored blocks, which deflate
- * can emit on compressed data for some combinations of the parameters.
- *
- * This function could be more sophisticated to provide closer upper bounds
- * for every combination of windowBits and memLevel, as well as wrap.
- * But even the conservative upper bound of about 14% expansion does not
- * seem onerous for output buffer allocation.
- */
-uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
- uLong sourceLen;
-{
- deflate_state *s;
- uLong destLen;
-
- /* conservative upper bound */
- destLen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
-
- /* if can't get parameters, return conservative bound */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return destLen;
-
- /* if not default parameters, return conservative bound */
- s = strm->state;
- if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return destLen;
-
- /* default settings: return tight bound for that case */
- return compressBound(sourceLen);
-}
-
-/* =========================================================================
- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
- * IN assertion: the stream state is correct and there is enough room in
- * pending_buf.
- */
-local void putShortMSB (s, b)
- deflate_state *s;
- uInt b;
-{
- put_byte(s, (Byte)(b >> 8));
- put_byte(s, (Byte)(b & 0xff));
-}
-
-/* =========================================================================
- * Flush as much pending output as possible. All deflate() output goes
- * through this function so some applications may wish to modify it
- * to avoid allocating a large strm->next_out buffer and copying into it.
- * (See also read_buf()).
- */
-local void flush_pending(strm)
- z_streamp strm;
-{
- unsigned len = strm->state->pending;
-
- if (len > strm->avail_out) len = strm->avail_out;
- if (len == 0) return;
-
- zmemcpy(strm->next_out, strm->state->pending_out, len);
- strm->next_out += len;
- strm->state->pending_out += len;
- strm->total_out += len;
- strm->avail_out -= len;
- strm->state->pending -= len;
- if (strm->state->pending == 0) {
- strm->state->pending_out = strm->state->pending_buf;
- }
-}
-
-/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
- z_streamp strm;
- int flush;
-{
- int old_flush; /* value of flush param for previous deflate call */
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- flush > Z_FINISH || flush < 0) {
- return Z_STREAM_ERROR;
- }
- s = strm->state;
-
- if (strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0) ||
- (s->status == FINISH_STATE && flush != Z_FINISH)) {
- ERR_RETURN(strm, Z_STREAM_ERROR);
- }
- if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
-
- s->strm = strm; /* just in case */
- old_flush = s->last_flush;
- s->last_flush = flush;
-
- /* Write the header */
- if (s->status == INIT_STATE) {
-#ifdef GZIP
- if (s->wrap == 2) {
- strm->adler = crc32(0L, Z_NULL, 0);
- put_byte(s, 31);
- put_byte(s, 139);
- put_byte(s, 8);
- if (s->gzhead == NULL) {
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, OS_CODE);
- s->status = BUSY_STATE;
- }
- else {
- put_byte(s, (s->gzhead->text ? 1 : 0) +
- (s->gzhead->hcrc ? 2 : 0) +
- (s->gzhead->extra == Z_NULL ? 0 : 4) +
- (s->gzhead->name == Z_NULL ? 0 : 8) +
- (s->gzhead->comment == Z_NULL ? 0 : 16)
- );
- put_byte(s, (Byte)(s->gzhead->time & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, s->gzhead->os & 0xff);
- if (s->gzhead->extra != NULL) {
- put_byte(s, s->gzhead->extra_len & 0xff);
- put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
- }
- if (s->gzhead->hcrc)
- strm->adler = crc32(strm->adler, s->pending_buf,
- s->pending);
- s->gzindex = 0;
- s->status = EXTRA_STATE;
- }
- }
- else
-#endif
- {
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
- uInt level_flags;
-
- if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
- level_flags = 0;
- else if (s->level < 6)
- level_flags = 1;
- else if (s->level == 6)
- level_flags = 2;
- else
- level_flags = 3;
- header |= (level_flags << 6);
- if (s->strstart != 0) header |= PRESET_DICT;
- header += 31 - (header % 31);
-
- s->status = BUSY_STATE;
- putShortMSB(s, header);
-
- /* Save the adler32 of the preset dictionary: */
- if (s->strstart != 0) {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- strm->adler = adler32(0L, Z_NULL, 0);
- }
- }
-#ifdef GZIP
- if (s->status == EXTRA_STATE) {
- if (s->gzhead->extra != NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
-
- while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size)
- break;
- }
- put_byte(s, s->gzhead->extra[s->gzindex]);
- s->gzindex++;
- }
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (s->gzindex == s->gzhead->extra_len) {
- s->gzindex = 0;
- s->status = NAME_STATE;
- }
- }
- else
- s->status = NAME_STATE;
- }
- if (s->status == NAME_STATE) {
- if (s->gzhead->name != NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->name[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0) {
- s->gzindex = 0;
- s->status = COMMENT_STATE;
- }
- }
- else
- s->status = COMMENT_STATE;
- }
- if (s->status == COMMENT_STATE) {
- if (s->gzhead->comment != NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->comment[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0)
- s->status = HCRC_STATE;
- }
- else
- s->status = HCRC_STATE;
- }
- if (s->status == HCRC_STATE) {
- if (s->gzhead->hcrc) {
- if (s->pending + 2 > s->pending_buf_size)
- flush_pending(strm);
- if (s->pending + 2 <= s->pending_buf_size) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- strm->adler = crc32(0L, Z_NULL, 0);
- s->status = BUSY_STATE;
- }
- }
- else
- s->status = BUSY_STATE;
- }
-#endif
-
- /* Flush as much pending output as possible */
- if (s->pending != 0) {
- flush_pending(strm);
- if (strm->avail_out == 0) {
- /* Since avail_out is 0, deflate will be called again with
- * more output space, but possibly with both pending and
- * avail_in equal to zero. There won't be anything to do,
- * but this is not an error situation so make sure we
- * return OK instead of BUF_ERROR at next call of deflate:
- */
- s->last_flush = -1;
- return Z_OK;
- }
-
- /* Make sure there is something to do and avoid duplicate consecutive
- * flushes. For repeated and useless calls with Z_FINISH, we keep
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
- */
- } else if (strm->avail_in == 0 && flush <= old_flush &&
- flush != Z_FINISH) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* User must not provide more input after the first FINISH: */
- if (s->status == FINISH_STATE && strm->avail_in != 0) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* Start a new block or continue the current one.
- */
- if (strm->avail_in != 0 || s->lookahead != 0 ||
- (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
- block_state bstate;
-
- bstate = (*(configuration_table[s->level].func))(s, flush);
-
- if (bstate == finish_started || bstate == finish_done) {
- s->status = FINISH_STATE;
- }
- if (bstate == need_more || bstate == finish_started) {
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
- }
- return Z_OK;
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
- * of deflate should use the same flush parameter to make sure
- * that the flush is complete. So we don't have to output an
- * empty block here, this will be done at next call. This also
- * ensures that for a very small output buffer, we emit at most
- * one empty block.
- */
- }
- if (bstate == block_done) {
- if (flush == Z_PARTIAL_FLUSH) {
- _tr_align(s);
- } else { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
- /* For a full flush, this empty block will be recognized
- * as a special marker by inflate_sync().
- */
- if (flush == Z_FULL_FLUSH) {
- CLEAR_HASH(s); /* forget history */
- }
- }
- flush_pending(strm);
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
- return Z_OK;
- }
- }
- }
- Assert(strm->avail_out > 0, "bug2");
-
- if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
-
- /* Write the trailer */
-#ifdef GZIP
- if (s->wrap == 2) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
- put_byte(s, (Byte)(strm->total_in & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
- }
- else
-#endif
- {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- flush_pending(strm);
- /* If avail_out is zero, the application will call deflate again
- * to flush the rest.
- */
- if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
- z_streamp strm;
-{
- int status;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
-
- status = strm->state->status;
- if (status != INIT_STATE &&
- status != EXTRA_STATE &&
- status != NAME_STATE &&
- status != COMMENT_STATE &&
- status != HCRC_STATE &&
- status != BUSY_STATE &&
- status != FINISH_STATE) {
- return Z_STREAM_ERROR;
- }
-
- /* Deallocate in reverse order of allocations: */
- TRY_FREE(strm, strm->state->pending_buf);
- TRY_FREE(strm, strm->state->head);
- TRY_FREE(strm, strm->state->prev);
- TRY_FREE(strm, strm->state->window);
-
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
-
- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
-}
-
-/* =========================================================================
- * Copy the source state to the destination state.
- * To simplify the source, this is not supported for 16-bit MSDOS (which
- * doesn't have enough memory anyway to duplicate compression states).
- */
-int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
-{
-#ifdef MAXSEG_64K
- return Z_STREAM_ERROR;
-#else
- deflate_state *ds;
- deflate_state *ss;
- ushf *overlay;
-
-
- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
- return Z_STREAM_ERROR;
- }
-
- ss = source->state;
-
- zmemcpy(dest, source, sizeof(z_stream));
-
- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
- if (ds == Z_NULL) return Z_MEM_ERROR;
- dest->state = (struct internal_state FAR *) ds;
- zmemcpy(ds, ss, sizeof(deflate_state));
- ds->strm = dest;
-
- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
- ds->pending_buf = (uchf *) overlay;
-
- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
- ds->pending_buf == Z_NULL) {
- deflateEnd (dest);
- return Z_MEM_ERROR;
- }
- /* following zmemcpy do not work for 16-bit MSDOS */
- zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
- zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
- zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
-
- ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
-
- ds->l_desc.dyn_tree = ds->dyn_ltree;
- ds->d_desc.dyn_tree = ds->dyn_dtree;
- ds->bl_desc.dyn_tree = ds->bl_tree;
-
- return Z_OK;
-#endif /* MAXSEG_64K */
-}
-
-/* ===========================================================================
- * Read a new buffer from the current input stream, update the adler32
- * and total number of bytes read. All deflate() input goes through
- * this function so some applications may wish to modify it to avoid
- * allocating a large strm->next_in buffer and copying from it.
- * (See also flush_pending()).
- */
-local int read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
-{
- unsigned len = strm->avail_in;
-
- if (len > size) len = size;
- if (len == 0) return 0;
-
- strm->avail_in -= len;
-
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, strm->next_in, len);
- }
-#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, strm->next_in, len);
- }
-#endif
- zmemcpy(buf, strm->next_in, len);
- strm->next_in += len;
- strm->total_in += len;
-
- return (int)len;
-}
-
-/* ===========================================================================
- * Initialize the "longest match" routines for a new zlib stream
- */
-local void lm_init (s)
- deflate_state *s;
-{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
-#ifndef FASTEST
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
-#endif
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Set match_start to the longest match starting at the given string and
- * return its length. Matches shorter or equal to prev_length are discarded,
- * in which case the result is equal to prev_length and match_start is
- * garbage.
- * IN assertions: cur_match is the head of the hash chain for the current
- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
- * OUT assertion: the match length is not greater than s->lookahead.
- */
-#ifndef ASMV
-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
- * match.S. The code will be functionally equivalent.
- */
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
- unsigned chain_length = s->max_chain_length;/* max hash chain length */
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- int best_len = s->prev_length; /* best match length so far */
- int nice_match = s->nice_match; /* stop if match long enough */
- IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
- s->strstart - (IPos)MAX_DIST(s) : NIL;
- /* Stop when cur_match becomes <= limit. To simplify the code,
- * we prevent matches with the string of window index 0.
- */
- Posf *prev = s->prev;
- uInt wmask = s->w_mask;
-
-#ifdef UNALIGNED_OK
- /* Compare two bytes at a time. Note: this is not always beneficial.
- * Try with and without -DUNALIGNED_OK to check.
- */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
-#else
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
- register Byte scan_end = scan[best_len];
-#endif
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- /* Do not waste too much time if we already have a good match: */
- if (s->prev_length >= s->good_match) {
- chain_length >>= 2;
- }
- /* Do not look for matches beyond the end of the input. This is necessary
- * to make deflate deterministic.
- */
- if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- do {
- Assert(cur_match < s->strstart, "no future");
- match = s->window + cur_match;
-
- /* Skip to next match if the match length cannot increase
- * or if the match length is less than 2. Note that the checks below
- * for insufficient lookahead only occur occasionally for performance
- * reasons. Therefore uninitialized memory will be accessed, and
- * conditional jumps will be made that depend on those values.
- * However the length of the match is limited to the lookahead, so
- * the output of deflate is not affected by the uninitialized values.
- */
-#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
- /* This code assumes sizeof(unsigned short) == 2. Do not use
- * UNALIGNED_OK if your compiler uses a different size.
- */
- if (*(ushf*)(match+best_len-1) != scan_end ||
- *(ushf*)match != scan_start) continue;
-
- /* It is not necessary to compare scan[2] and match[2] since they are
- * always equal when the other bytes match, given that the hash keys
- * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
- * lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
- * necessary to put more guard bytes at the end of the window, or
- * to check more often for insufficient lookahead.
- */
- Assert(scan[2] == match[2], "scan[2]?");
- scan++, match++;
- do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- scan < strend);
- /* The funny "do {}" generates better code on most compilers */
-
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
- if (*scan == *match) scan++;
-
- len = (MAX_MATCH - 1) - (int)(strend-scan);
- scan = strend - (MAX_MATCH-1);
-
-#else /* UNALIGNED_OK */
-
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match++;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
- scan = strend - MAX_MATCH;
-
-#endif /* UNALIGNED_OK */
-
- if (len > best_len) {
- s->match_start = cur_match;
- best_len = len;
- if (len >= nice_match) break;
-#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
-#else
- scan_end1 = scan[best_len-1];
- scan_end = scan[best_len];
-#endif
- }
- } while ((cur_match = prev[cur_match & wmask]) > limit
- && --chain_length != 0);
-
- if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
- return s->lookahead;
-}
-#endif /* ASMV */
-#endif /* FASTEST */
-
-/* ---------------------------------------------------------------------------
- * Optimized version for level == 1 or strategy == Z_RLE only
- */
-local uInt longest_match_fast(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- Assert(cur_match < s->strstart, "no future");
-
- match = s->window + cur_match;
-
- /* Return failure if the match length is less than 2:
- */
- if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match += 2;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
-
- if (len < MIN_MATCH) return MIN_MATCH - 1;
-
- s->match_start = cur_match;
- return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
-}
-
-#ifdef DEBUG
-/* ===========================================================================
- * Check that the match at match_start is indeed a match.
- */
-local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
-{
- /* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
- do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
- z_error("invalid match");
- }
- if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
- do { putc(s->window[start++], stderr); } while (--length != 0);
- }
-}
-#else
-# define check_match(s, start, match, length)
-#endif /* DEBUG */
-
-/* ===========================================================================
- * Fill the window when the lookahead becomes insufficient.
- * Updates strstart and lookahead.
- *
- * IN assertion: lookahead < MIN_LOOKAHEAD
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
- * At least one byte has been read, or avail_in == 0; reads are
- * performed for at least two bytes (required for the zip translate_eol
- * option -- not supported here).
- */
-local void fill_window(s)
- deflate_state *s;
-{
- register unsigned n, m;
- register Posf *p;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize+MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
-
- /* Slide the hash table (could be avoided with 32 bit values
- at the expense of memory usage). We slide even when level == 0
- to keep the hash table consistent if we switch back to level > 0
- later. (Using level 0 permanently is not an optimal usage of
- zlib, so we don't care about this pathological case.)
- */
- /* %%% avoid this when Z_RLE */
- n = s->hash_size;
- p = &s->head[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- } while (--n);
-
- n = wsize;
-#ifndef FASTEST
- p = &s->prev[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- /* If n is not on any hash chain, prev[n] is garbage but
- * its value will never be used.
- */
- } while (--n);
-#endif
- more += wsize;
- }
- if (s->strm->avail_in == 0) return;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead >= MIN_MATCH) {
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-}
-
-/* ===========================================================================
- * Flush the current block, with given end-of-file flag.
- * IN assertion: strstart is set to the end of the current match.
- */
-#define FLUSH_BLOCK_ONLY(s, eof) { \
- _tr_flush_block(s, (s->block_start >= 0L ? \
- (charf *)&s->window[(unsigned)s->block_start] : \
- (charf *)Z_NULL), \
- (ulg)((long)s->strstart - s->block_start), \
- (eof)); \
- s->block_start = s->strstart; \
- flush_pending(s->strm); \
- Tracev((stderr,"[FLUSH]")); \
-}
-
-/* Same but force premature exit if necessary. */
-#define FLUSH_BLOCK(s, eof) { \
- FLUSH_BLOCK_ONLY(s, eof); \
- if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
-}
-
-/* ===========================================================================
- * Copy without compression as much as possible from the input stream, return
- * the current block state.
- * This function does not insert new strings in the dictionary since
- * uncompressible data is probably not useful. This function is used
- * only for the level=0 compression option.
- * NOTE: this function should be optimized to avoid extra copying from
- * window to pending_buf.
- */
-local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
-{
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
- * to pending_buf_size, and each stored block has a 5 byte header:
- */
- ulg max_block_size = 0xffff;
- ulg max_start;
-
- if (max_block_size > s->pending_buf_size - 5) {
- max_block_size = s->pending_buf_size - 5;
- }
-
- /* Copy as much as possible from input to output: */
- for (;;) {
- /* Fill the window as much as possible: */
- if (s->lookahead <= 1) {
-
- Assert(s->strstart < s->w_size+MAX_DIST(s) ||
- s->block_start >= (long)s->w_size, "slide too late");
-
- fill_window(s);
- if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
-
- if (s->lookahead == 0) break; /* flush the current block */
- }
- Assert(s->block_start >= 0L, "block gone");
-
- s->strstart += s->lookahead;
- s->lookahead = 0;
-
- /* Emit a stored block if pending_buf will be full: */
- max_start = s->block_start + max_block_size;
- if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
- /* strstart == 0 is possible when wraparound on 16-bit machine */
- s->lookahead = (uInt)(s->strstart - max_start);
- s->strstart = (uInt)max_start;
- FLUSH_BLOCK(s, 0);
- }
- /* Flush if we may have to slide, otherwise block_start may become
- * negative and the data will be gone:
- */
- if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
- FLUSH_BLOCK(s, 0);
- }
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-
-/* ===========================================================================
- * Compress as much as possible from the input stream, return the current
- * block state.
- * This function does not perform lazy evaluation of matches and inserts
- * new strings in the dictionary only for unmatched strings or for short
- * matches. It is used only for the fast compression options.
- */
-local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
-{
- IPos hash_head = NIL; /* head of the hash chain */
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- * At this point we have always match_length < MIN_MATCH
- */
- if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
-#ifdef FASTEST
- if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||
- (s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
- s->match_length = longest_match_fast (s, hash_head);
- }
-#else
- if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
- s->match_length = longest_match (s, hash_head);
- } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
- s->match_length = longest_match_fast (s, hash_head);
- }
-#endif
- /* longest_match() or longest_match_fast() sets match_start */
- }
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->match_start, s->match_length);
-
- _tr_tally_dist(s, s->strstart - s->match_start,
- s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
-
- /* Insert new strings in the hash table only if the match length
- * is not too large. This saves time but degrades compression.
- */
-#ifndef FASTEST
- if (s->match_length <= s->max_insert_length &&
- s->lookahead >= MIN_MATCH) {
- s->match_length--; /* string at strstart already in table */
- do {
- s->strstart++;
- INSERT_STRING(s, s->strstart, hash_head);
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
- * always MIN_MATCH bytes ahead.
- */
- } while (--s->match_length != 0);
- s->strstart++;
- } else
-#endif
- {
- s->strstart += s->match_length;
- s->match_length = 0;
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
- * matter since it will be recomputed at next deflate call.
- */
- }
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Same as above, but achieves better compression. We use a lazy
- * evaluation for matches: a match is finally adopted only if there is
- * no better match at the next window position.
- */
-local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
-{
- IPos hash_head = NIL; /* head of hash chain */
- int bflush; /* set if current block must be flushed */
-
- /* Process the input block. */
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- */
- s->prev_length = s->match_length, s->prev_match = s->match_start;
- s->match_length = MIN_MATCH-1;
-
- if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
- s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
- s->match_length = longest_match (s, hash_head);
- } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
- s->match_length = longest_match_fast (s, hash_head);
- }
- /* longest_match() or longest_match_fast() sets match_start */
-
- if (s->match_length <= 5 && (s->strategy == Z_FILTERED
-#if TOO_FAR <= 32767
- || (s->match_length == MIN_MATCH &&
- s->strstart - s->match_start > TOO_FAR)
-#endif
- )) {
-
- /* If prev_match is also MIN_MATCH, match_start is garbage
- * but we will ignore the current match anyway.
- */
- s->match_length = MIN_MATCH-1;
- }
- }
- /* If there was a match at the previous step and the current
- * match is not better, output the previous match:
- */
- if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
- uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
- /* Do not insert strings in hash table beyond this. */
-
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
-
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
- s->prev_length - MIN_MATCH, bflush);
-
- /* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
- * enough lookahead, the last two strings are not inserted in
- * the hash table.
- */
- s->lookahead -= s->prev_length-1;
- s->prev_length -= 2;
- do {
- if (++s->strstart <= max_insert) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
- } while (--s->prev_length != 0);
- s->match_available = 0;
- s->match_length = MIN_MATCH-1;
- s->strstart++;
-
- if (bflush) FLUSH_BLOCK(s, 0);
-
- } else if (s->match_available) {
- /* If there was no match at the previous position, output a
- * single literal. If there was a match but the current match
- * is longer, truncate the previous match to a single literal.
- */
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- if (bflush) {
- FLUSH_BLOCK_ONLY(s, 0);
- }
- s->strstart++;
- s->lookahead--;
- if (s->strm->avail_out == 0) return need_more;
- } else {
- /* There is no previous match to compare with, wait for
- * the next step to decide.
- */
- s->match_available = 1;
- s->strstart++;
- s->lookahead--;
- }
- }
- Assert (flush != Z_NO_FLUSH, "no flush?");
- if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- s->match_available = 0;
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-#endif /* FASTEST */
-
-#if 0
-/* ===========================================================================
- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
- * one. Do not maintain a hash table. (It will be regenerated if this run of
- * deflate switches away from Z_RLE.)
- */
-local block_state deflate_rle(s, flush)
- deflate_state *s;
- int flush;
-{
- int bflush; /* set if current block must be flushed */
- uInt run; /* length of run */
- uInt max; /* maximum length of run */
- uInt prev; /* byte at distance one to match */
- Bytef *scan; /* scan for end of run */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the longest encodable run.
- */
- if (s->lookahead < MAX_MATCH) {
- fill_window(s);
- if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* See how many times the previous byte repeats */
- run = 0;
- if (s->strstart > 0) { /* if there is a previous byte, that is */
- max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH;
- scan = s->window + s->strstart - 1;
- prev = *scan++;
- do {
- if (*scan++ != prev)
- break;
- } while (++run < max);
- }
-
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
- if (run >= MIN_MATCH) {
- check_match(s, s->strstart, s->strstart - 1, run);
- _tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
- s->lookahead -= run;
- s->strstart += run;
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- FLUSH_BLOCK(s, flush == Z_FINISH);
- return flush == Z_FINISH ? finish_done : block_done;
-}
-#endif
diff --git a/funtools/util/zlib-1.2.3/deflate.h b/funtools/util/zlib-1.2.3/deflate.h
deleted file mode 100644
index 05a5ab3..0000000
--- a/funtools/util/zlib-1.2.3/deflate.h
+++ /dev/null
@@ -1,331 +0,0 @@
-/* deflate.h -- internal compression state
- * Copyright (C) 1995-2004 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef DEFLATE_H
-#define DEFLATE_H
-
-#include "zutil.h"
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer creation by deflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip encoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GZIP
-#endif
-
-/* ===========================================================================
- * Internal compression state.
- */
-
-#define LENGTH_CODES 29
-/* number of length codes, not counting the special END_BLOCK code */
-
-#define LITERALS 256
-/* number of literal bytes 0..255 */
-
-#define L_CODES (LITERALS+1+LENGTH_CODES)
-/* number of Literal or Length codes, including the END_BLOCK code */
-
-#define D_CODES 30
-/* number of distance codes */
-
-#define BL_CODES 19
-/* number of codes used to transfer the bit lengths */
-
-#define HEAP_SIZE (2*L_CODES+1)
-/* maximum heap size */
-
-#define MAX_BITS 15
-/* All codes must not exceed MAX_BITS bits */
-
-#define INIT_STATE 42
-#define EXTRA_STATE 69
-#define NAME_STATE 73
-#define COMMENT_STATE 91
-#define HCRC_STATE 103
-#define BUSY_STATE 113
-#define FINISH_STATE 666
-/* Stream status */
-
-
-/* Data structure describing a single value and its code string. */
-typedef struct ct_data_s {
- union {
- ush freq; /* frequency count */
- ush code; /* bit string */
- } fc;
- union {
- ush dad; /* father node in Huffman tree */
- ush len; /* length of bit string */
- } dl;
-} FAR ct_data;
-
-#define Freq fc.freq
-#define Code fc.code
-#define Dad dl.dad
-#define Len dl.len
-
-typedef struct static_tree_desc_s static_tree_desc;
-
-typedef struct tree_desc_s {
- ct_data *dyn_tree; /* the dynamic tree */
- int max_code; /* largest code with non zero frequency */
- static_tree_desc *stat_desc; /* the corresponding static tree */
-} FAR tree_desc;
-
-typedef ush Pos;
-typedef Pos FAR Posf;
-typedef unsigned IPos;
-
-/* A Pos is an index in the character window. We use short instead of int to
- * save space in the various tables. IPos is used only for parameter passing.
- */
-
-typedef struct internal_state {
- z_streamp strm; /* pointer back to this zlib stream */
- int status; /* as the name implies */
- Bytef *pending_buf; /* output still pending */
- ulg pending_buf_size; /* size of pending_buf */
- Bytef *pending_out; /* next pending byte to output to the stream */
- uInt pending; /* nb of bytes in the pending buffer */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- gz_headerp gzhead; /* gzip header information to write */
- uInt gzindex; /* where in extra, name, or comment */
- Byte method; /* STORED (for zip only) or DEFLATED */
- int last_flush; /* value of flush param for previous deflate call */
-
- /* used by deflate.c: */
-
- uInt w_size; /* LZ77 window size (32K by default) */
- uInt w_bits; /* log2(w_size) (8..16) */
- uInt w_mask; /* w_size - 1 */
-
- Bytef *window;
- /* Sliding window. Input bytes are read into the second half of the window,
- * and move to the first half later to keep a dictionary of at least wSize
- * bytes. With this organization, matches are limited to a distance of
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
- * performed with a length multiple of the block size. Also, it limits
- * the window size to 64K, which is quite useful on MSDOS.
- * To do: use the user input buffer as sliding window.
- */
-
- ulg window_size;
- /* Actual size of window: 2*wSize, except when the user input buffer
- * is directly used as sliding window.
- */
-
- Posf *prev;
- /* Link to older string with same hash index. To limit the size of this
- * array to 64K, this link is maintained only for the last 32K strings.
- * An index in this array is thus a window index modulo 32K.
- */
-
- Posf *head; /* Heads of the hash chains or NIL. */
-
- uInt ins_h; /* hash index of string to be inserted */
- uInt hash_size; /* number of elements in hash table */
- uInt hash_bits; /* log2(hash_size) */
- uInt hash_mask; /* hash_size-1 */
-
- uInt hash_shift;
- /* Number of bits by which ins_h must be shifted at each input
- * step. It must be such that after MIN_MATCH steps, the oldest
- * byte no longer takes part in the hash key, that is:
- * hash_shift * MIN_MATCH >= hash_bits
- */
-
- long block_start;
- /* Window position at the beginning of the current output block. Gets
- * negative when the window is moved backwards.
- */
-
- uInt match_length; /* length of best match */
- IPos prev_match; /* previous match */
- int match_available; /* set if previous match exists */
- uInt strstart; /* start of string to insert */
- uInt match_start; /* start of matching string */
- uInt lookahead; /* number of valid bytes ahead in window */
-
- uInt prev_length;
- /* Length of the best match at previous step. Matches not greater than this
- * are discarded. This is used in the lazy match evaluation.
- */
-
- uInt max_chain_length;
- /* To speed up deflation, hash chains are never searched beyond this
- * length. A higher limit improves compression ratio but degrades the
- * speed.
- */
-
- uInt max_lazy_match;
- /* Attempt to find a better match only when the current match is strictly
- * smaller than this value. This mechanism is used only for compression
- * levels >= 4.
- */
-# define max_insert_length max_lazy_match
- /* Insert new strings in the hash table only if the match length is not
- * greater than this length. This saves time but degrades compression.
- * max_insert_length is used only for compression levels <= 3.
- */
-
- int level; /* compression level (1..9) */
- int strategy; /* favor or force Huffman coding*/
-
- uInt good_match;
- /* Use a faster search when the previous match is longer than this */
-
- int nice_match; /* Stop searching when current match exceeds this */
-
- /* used by trees.c: */
- /* Didn't use ct_data typedef below to supress compiler warning */
- struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
- struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
- struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
-
- struct tree_desc_s l_desc; /* desc. for literal tree */
- struct tree_desc_s d_desc; /* desc. for distance tree */
- struct tree_desc_s bl_desc; /* desc. for bit length tree */
-
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
- int heap_len; /* number of elements in the heap */
- int heap_max; /* element of largest frequency */
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
- * The same heap array is used to build all trees.
- */
-
- uch depth[2*L_CODES+1];
- /* Depth of each subtree used as tie breaker for trees of equal frequency
- */
-
- uchf *l_buf; /* buffer for literals or lengths */
-
- uInt lit_bufsize;
- /* Size of match buffer for literals/lengths. There are 4 reasons for
- * limiting lit_bufsize to 64K:
- * - frequencies can be kept in 16 bit counters
- * - if compression is not successful for the first block, all input
- * data is still in the window so we can still emit a stored block even
- * when input comes from standard input. (This can also be done for
- * all blocks if lit_bufsize is not greater than 32K.)
- * - if compression is not successful for a file smaller than 64K, we can
- * even emit a stored file instead of a stored block (saving 5 bytes).
- * This is applicable only for zip (not gzip or zlib).
- * - creating new Huffman trees less frequently may not provide fast
- * adaptation to changes in the input data statistics. (Take for
- * example a binary file with poorly compressible code followed by
- * a highly compressible string table.) Smaller buffer sizes give
- * fast adaptation but have of course the overhead of transmitting
- * trees more frequently.
- * - I can't count above 4
- */
-
- uInt last_lit; /* running index in l_buf */
-
- ushf *d_buf;
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
- * the same number of elements. To use different lengths, an extra flag
- * array would be necessary.
- */
-
- ulg opt_len; /* bit length of current block with optimal trees */
- ulg static_len; /* bit length of current block with static trees */
- uInt matches; /* number of string matches in current block */
- int last_eob_len; /* bit length of EOB code for last block */
-
-#ifdef DEBUG
- ulg compressed_len; /* total bit length of compressed file mod 2^32 */
- ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
-#endif
-
- ush bi_buf;
- /* Output buffer. bits are inserted starting at the bottom (least
- * significant bits).
- */
- int bi_valid;
- /* Number of valid bits in bi_buf. All bits above the last valid bit
- * are always zero.
- */
-
-} FAR deflate_state;
-
-/* Output a byte on the stream.
- * IN assertion: there is enough room in pending_buf.
- */
-#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
-
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
- * distances are limited to MAX_DIST instead of WSIZE.
- */
-
- /* in trees.c */
-void _tr_init OF((deflate_state *s));
-int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
-void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
- int eof));
-void _tr_align OF((deflate_state *s));
-void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
- int eof));
-
-#define d_code(dist) \
- ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
-/* Mapping from a distance to a distance code. dist is the distance - 1 and
- * must not have side effects. _dist_code[256] and _dist_code[257] are never
- * used.
- */
-
-#ifndef DEBUG
-/* Inline versions of _tr_tally for speed: */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
- extern uch _length_code[];
- extern uch _dist_code[];
-#else
- extern const uch _length_code[];
- extern const uch _dist_code[];
-#endif
-
-# define _tr_tally_lit(s, c, flush) \
- { uch cc = (c); \
- s->d_buf[s->last_lit] = 0; \
- s->l_buf[s->last_lit++] = cc; \
- s->dyn_ltree[cc].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-# define _tr_tally_dist(s, distance, length, flush) \
- { uch len = (length); \
- ush dist = (distance); \
- s->d_buf[s->last_lit] = dist; \
- s->l_buf[s->last_lit++] = len; \
- dist--; \
- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
- s->dyn_dtree[d_code(dist)].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-#else
-# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
-# define _tr_tally_dist(s, distance, length, flush) \
- flush = _tr_tally(s, distance, length)
-#endif
-
-#endif /* DEFLATE_H */
diff --git a/funtools/util/zlib-1.2.3/example.c b/funtools/util/zlib-1.2.3/example.c
deleted file mode 100644
index 6c8a0ee..0000000
--- a/funtools/util/zlib-1.2.3/example.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* example.c -- usage example of the zlib compression library
- * Copyright (C) 1995-2004 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include <stdio.h>
-#include "zlib.h"
-
-#ifdef STDC
-# include <string.h>
-# include <stdlib.h>
-#endif
-
-#if defined(VMS) || defined(RISCOS)
-# define TESTFILE "foo-gz"
-#else
-# define TESTFILE "foo.gz"
-#endif
-
-#define CHECK_ERR(err, msg) { \
- if (err != Z_OK) { \
- fprintf(stderr, "%s error: %d\n", msg, err); \
- exit(1); \
- } \
-}
-
-const char hello[] = "hello, hello!";
-/* "hello world" would be more standard, but the repeated "hello"
- * stresses the compression code better, sorry...
- */
-
-const char dictionary[] = "hello";
-uLong dictId; /* Adler32 value of the dictionary */
-
-void test_compress OF((Byte *compr, uLong comprLen,
- Byte *uncompr, uLong uncomprLen));
-void test_gzio OF((const char *fname,
- Byte *uncompr, uLong uncomprLen));
-void test_deflate OF((Byte *compr, uLong comprLen));
-void test_inflate OF((Byte *compr, uLong comprLen,
- Byte *uncompr, uLong uncomprLen));
-void test_large_deflate OF((Byte *compr, uLong comprLen,
- Byte *uncompr, uLong uncomprLen));
-void test_large_inflate OF((Byte *compr, uLong comprLen,
- Byte *uncompr, uLong uncomprLen));
-void test_flush OF((Byte *compr, uLong *comprLen));
-void test_sync OF((Byte *compr, uLong comprLen,
- Byte *uncompr, uLong uncomprLen));
-void test_dict_deflate OF((Byte *compr, uLong comprLen));
-void test_dict_inflate OF((Byte *compr, uLong comprLen,
- Byte *uncompr, uLong uncomprLen));
-int main OF((int argc, char *argv[]));
-
-/* ===========================================================================
- * Test compress() and uncompress()
- */
-void test_compress(compr, comprLen, uncompr, uncomprLen)
- Byte *compr, *uncompr;
- uLong comprLen, uncomprLen;
-{
- int err;
- uLong len = (uLong)strlen(hello)+1;
-
- err = compress(compr, &comprLen, (const Bytef*)hello, len);
- CHECK_ERR(err, "compress");
-
- strcpy((char*)uncompr, "garbage");
-
- err = uncompress(uncompr, &uncomprLen, compr, comprLen);
- CHECK_ERR(err, "uncompress");
-
- if (strcmp((char*)uncompr, hello)) {
- fprintf(stderr, "bad uncompress\n");
- exit(1);
- } else {
- printf("uncompress(): %s\n", (char *)uncompr);
- }
-}
-
-/* ===========================================================================
- * Test read/write of .gz files
- */
-void test_gzio(fname, uncompr, uncomprLen)
- const char *fname; /* compressed file name */
- Byte *uncompr;
- uLong uncomprLen;
-{
-#ifdef NO_GZCOMPRESS
- fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
-#else
- int err;
- int len = (int)strlen(hello)+1;
- gzFile file;
- z_off_t pos;
-
- file = gzopen(fname, "wb");
- if (file == NULL) {
- fprintf(stderr, "gzopen error\n");
- exit(1);
- }
- gzputc(file, 'h');
- if (gzputs(file, "ello") != 4) {
- fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
- exit(1);
- }
- if (gzprintf(file, ", %s!", "hello") != 8) {
- fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
- exit(1);
- }
- gzseek(file, 1L, SEEK_CUR); /* add one zero byte */
- gzclose(file);
-
- file = gzopen(fname, "rb");
- if (file == NULL) {
- fprintf(stderr, "gzopen error\n");
- exit(1);
- }
- strcpy((char*)uncompr, "garbage");
-
- if (gzread(file, uncompr, (unsigned)uncomprLen) != len) {
- fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));
- exit(1);
- }
- if (strcmp((char*)uncompr, hello)) {
- fprintf(stderr, "bad gzread: %s\n", (char*)uncompr);
- exit(1);
- } else {
- printf("gzread(): %s\n", (char*)uncompr);
- }
-
- pos = gzseek(file, -8L, SEEK_CUR);
- if (pos != 6 || gztell(file) != pos) {
- fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",
- (long)pos, (long)gztell(file));
- exit(1);
- }
-
- if (gzgetc(file) != ' ') {
- fprintf(stderr, "gzgetc error\n");
- exit(1);
- }
-
- if (gzungetc(' ', file) != ' ') {
- fprintf(stderr, "gzungetc error\n");
- exit(1);
- }
-
- gzgets(file, (char*)uncompr, (int)uncomprLen);
- if (strlen((char*)uncompr) != 7) { /* " hello!" */
- fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
- exit(1);
- }
- if (strcmp((char*)uncompr, hello + 6)) {
- fprintf(stderr, "bad gzgets after gzseek\n");
- exit(1);
- } else {
- printf("gzgets() after gzseek: %s\n", (char*)uncompr);
- }
-
- gzclose(file);
-#endif
-}
-
-/* ===========================================================================
- * Test deflate() with small buffers
- */
-void test_deflate(compr, comprLen)
- Byte *compr;
- uLong comprLen;
-{
- z_stream c_stream; /* compression stream */
- int err;
- uLong len = (uLong)strlen(hello)+1;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
- CHECK_ERR(err, "deflateInit");
-
- c_stream.next_in = (Bytef*)hello;
- c_stream.next_out = compr;
-
- while (c_stream.total_in != len && c_stream.total_out < comprLen) {
- c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
- err = deflate(&c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, "deflate");
- }
- /* Finish the stream, still forcing small buffers: */
- for (;;) {
- c_stream.avail_out = 1;
- err = deflate(&c_stream, Z_FINISH);
- if (err == Z_STREAM_END) break;
- CHECK_ERR(err, "deflate");
- }
-
- err = deflateEnd(&c_stream);
- CHECK_ERR(err, "deflateEnd");
-}
-
-/* ===========================================================================
- * Test inflate() with small buffers
- */
-void test_inflate(compr, comprLen, uncompr, uncomprLen)
- Byte *compr, *uncompr;
- uLong comprLen, uncomprLen;
-{
- int err;
- z_stream d_stream; /* decompression stream */
-
- strcpy((char*)uncompr, "garbage");
-
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- d_stream.next_in = compr;
- d_stream.avail_in = 0;
- d_stream.next_out = uncompr;
-
- err = inflateInit(&d_stream);
- CHECK_ERR(err, "inflateInit");
-
- while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
- d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
- err = inflate(&d_stream, Z_NO_FLUSH);
- if (err == Z_STREAM_END) break;
- CHECK_ERR(err, "inflate");
- }
-
- err = inflateEnd(&d_stream);
- CHECK_ERR(err, "inflateEnd");
-
- if (strcmp((char*)uncompr, hello)) {
- fprintf(stderr, "bad inflate\n");
- exit(1);
- } else {
- printf("inflate(): %s\n", (char *)uncompr);
- }
-}
-
-/* ===========================================================================
- * Test deflate() with large buffers and dynamic change of compression level
- */
-void test_large_deflate(compr, comprLen, uncompr, uncomprLen)
- Byte *compr, *uncompr;
- uLong comprLen, uncomprLen;
-{
- z_stream c_stream; /* compression stream */
- int err;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- err = deflateInit(&c_stream, Z_BEST_SPEED);
- CHECK_ERR(err, "deflateInit");
-
- c_stream.next_out = compr;
- c_stream.avail_out = (uInt)comprLen;
-
- /* At this point, uncompr is still mostly zeroes, so it should compress
- * very well:
- */
- c_stream.next_in = uncompr;
- c_stream.avail_in = (uInt)uncomprLen;
- err = deflate(&c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, "deflate");
- if (c_stream.avail_in != 0) {
- fprintf(stderr, "deflate not greedy\n");
- exit(1);
- }
-
- /* Feed in already compressed data and switch to no compression: */
- deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
- c_stream.next_in = compr;
- c_stream.avail_in = (uInt)comprLen/2;
- err = deflate(&c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, "deflate");
-
- /* Switch back to compressing mode: */
- deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
- c_stream.next_in = uncompr;
- c_stream.avail_in = (uInt)uncomprLen;
- err = deflate(&c_stream, Z_NO_FLUSH);
- CHECK_ERR(err, "deflate");
-
- err = deflate(&c_stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- fprintf(stderr, "deflate should report Z_STREAM_END\n");
- exit(1);
- }
- err = deflateEnd(&c_stream);
- CHECK_ERR(err, "deflateEnd");
-}
-
-/* ===========================================================================
- * Test inflate() with large buffers
- */
-void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
- Byte *compr, *uncompr;
- uLong comprLen, uncomprLen;
-{
- int err;
- z_stream d_stream; /* decompression stream */
-
- strcpy((char*)uncompr, "garbage");
-
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- d_stream.next_in = compr;
- d_stream.avail_in = (uInt)comprLen;
-
- err = inflateInit(&d_stream);
- CHECK_ERR(err, "inflateInit");
-
- for (;;) {
- d_stream.next_out = uncompr; /* discard the output */
- d_stream.avail_out = (uInt)uncomprLen;
- err = inflate(&d_stream, Z_NO_FLUSH);
- if (err == Z_STREAM_END) break;
- CHECK_ERR(err, "large inflate");
- }
-
- err = inflateEnd(&d_stream);
- CHECK_ERR(err, "inflateEnd");
-
- if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
- fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
- exit(1);
- } else {
- printf("large_inflate(): OK\n");
- }
-}
-
-/* ===========================================================================
- * Test deflate() with full flush
- */
-void test_flush(compr, comprLen)
- Byte *compr;
- uLong *comprLen;
-{
- z_stream c_stream; /* compression stream */
- int err;
- uInt len = (uInt)strlen(hello)+1;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
- CHECK_ERR(err, "deflateInit");
-
- c_stream.next_in = (Bytef*)hello;
- c_stream.next_out = compr;
- c_stream.avail_in = 3;
- c_stream.avail_out = (uInt)*comprLen;
- err = deflate(&c_stream, Z_FULL_FLUSH);
- CHECK_ERR(err, "deflate");
-
- compr[3]++; /* force an error in first compressed block */
- c_stream.avail_in = len - 3;
-
- err = deflate(&c_stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- CHECK_ERR(err, "deflate");
- }
- err = deflateEnd(&c_stream);
- CHECK_ERR(err, "deflateEnd");
-
- *comprLen = c_stream.total_out;
-}
-
-/* ===========================================================================
- * Test inflateSync()
- */
-void test_sync(compr, comprLen, uncompr, uncomprLen)
- Byte *compr, *uncompr;
- uLong comprLen, uncomprLen;
-{
- int err;
- z_stream d_stream; /* decompression stream */
-
- strcpy((char*)uncompr, "garbage");
-
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- d_stream.next_in = compr;
- d_stream.avail_in = 2; /* just read the zlib header */
-
- err = inflateInit(&d_stream);
- CHECK_ERR(err, "inflateInit");
-
- d_stream.next_out = uncompr;
- d_stream.avail_out = (uInt)uncomprLen;
-
- inflate(&d_stream, Z_NO_FLUSH);
- CHECK_ERR(err, "inflate");
-
- d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */
- err = inflateSync(&d_stream); /* but skip the damaged part */
- CHECK_ERR(err, "inflateSync");
-
- err = inflate(&d_stream, Z_FINISH);
- if (err != Z_DATA_ERROR) {
- fprintf(stderr, "inflate should report DATA_ERROR\n");
- /* Because of incorrect adler32 */
- exit(1);
- }
- err = inflateEnd(&d_stream);
- CHECK_ERR(err, "inflateEnd");
-
- printf("after inflateSync(): hel%s\n", (char *)uncompr);
-}
-
-/* ===========================================================================
- * Test deflate() with preset dictionary
- */
-void test_dict_deflate(compr, comprLen)
- Byte *compr;
- uLong comprLen;
-{
- z_stream c_stream; /* compression stream */
- int err;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
- CHECK_ERR(err, "deflateInit");
-
- err = deflateSetDictionary(&c_stream,
- (const Bytef*)dictionary, sizeof(dictionary));
- CHECK_ERR(err, "deflateSetDictionary");
-
- dictId = c_stream.adler;
- c_stream.next_out = compr;
- c_stream.avail_out = (uInt)comprLen;
-
- c_stream.next_in = (Bytef*)hello;
- c_stream.avail_in = (uInt)strlen(hello)+1;
-
- err = deflate(&c_stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- fprintf(stderr, "deflate should report Z_STREAM_END\n");
- exit(1);
- }
- err = deflateEnd(&c_stream);
- CHECK_ERR(err, "deflateEnd");
-}
-
-/* ===========================================================================
- * Test inflate() with a preset dictionary
- */
-void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
- Byte *compr, *uncompr;
- uLong comprLen, uncomprLen;
-{
- int err;
- z_stream d_stream; /* decompression stream */
-
- strcpy((char*)uncompr, "garbage");
-
- d_stream.zalloc = (alloc_func)0;
- d_stream.zfree = (free_func)0;
- d_stream.opaque = (voidpf)0;
-
- d_stream.next_in = compr;
- d_stream.avail_in = (uInt)comprLen;
-
- err = inflateInit(&d_stream);
- CHECK_ERR(err, "inflateInit");
-
- d_stream.next_out = uncompr;
- d_stream.avail_out = (uInt)uncomprLen;
-
- for (;;) {
- err = inflate(&d_stream, Z_NO_FLUSH);
- if (err == Z_STREAM_END) break;
- if (err == Z_NEED_DICT) {
- if (d_stream.adler != dictId) {
- fprintf(stderr, "unexpected dictionary");
- exit(1);
- }
- err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
- sizeof(dictionary));
- }
- CHECK_ERR(err, "inflate with dict");
- }
-
- err = inflateEnd(&d_stream);
- CHECK_ERR(err, "inflateEnd");
-
- if (strcmp((char*)uncompr, hello)) {
- fprintf(stderr, "bad inflate with dict\n");
- exit(1);
- } else {
- printf("inflate with dictionary: %s\n", (char *)uncompr);
- }
-}
-
-/* ===========================================================================
- * Usage: example [output.gz [input.gz]]
- */
-
-int main(argc, argv)
- int argc;
- char *argv[];
-{
- Byte *compr, *uncompr;
- uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
- uLong uncomprLen = comprLen;
- static const char* myVersion = ZLIB_VERSION;
-
- if (zlibVersion()[0] != myVersion[0]) {
- fprintf(stderr, "incompatible zlib version\n");
- exit(1);
-
- } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
- fprintf(stderr, "warning: different zlib version\n");
- }
-
- printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
- ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());
-
- compr = (Byte*)calloc((uInt)comprLen, 1);
- uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
- /* compr and uncompr are cleared to avoid reading uninitialized
- * data and to ensure that uncompr compresses well.
- */
- if (compr == Z_NULL || uncompr == Z_NULL) {
- printf("out of memory\n");
- exit(1);
- }
- test_compress(compr, comprLen, uncompr, uncomprLen);
-
- test_gzio((argc > 1 ? argv[1] : TESTFILE),
- uncompr, uncomprLen);
-
- test_deflate(compr, comprLen);
- test_inflate(compr, comprLen, uncompr, uncomprLen);
-
- test_large_deflate(compr, comprLen, uncompr, uncomprLen);
- test_large_inflate(compr, comprLen, uncompr, uncomprLen);
-
- test_flush(compr, &comprLen);
- test_sync(compr, comprLen, uncompr, uncomprLen);
- comprLen = uncomprLen;
-
- test_dict_deflate(compr, comprLen);
- test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
-
- free(compr);
- free(uncompr);
-
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/examples/README.examples b/funtools/util/zlib-1.2.3/examples/README.examples
deleted file mode 100644
index 5632d7a..0000000
--- a/funtools/util/zlib-1.2.3/examples/README.examples
+++ /dev/null
@@ -1,42 +0,0 @@
-This directory contains examples of the use of zlib.
-
-fitblk.c
- compress just enough input to nearly fill a requested output size
- - zlib isn't designed to do this, but fitblk does it anyway
-
-gun.c
- uncompress a gzip file
- - illustrates the use of inflateBack() for high speed file-to-file
- decompression using call-back functions
- - is approximately twice as fast as gzip -d
- - also provides Unix uncompress functionality, again twice as fast
-
-gzappend.c
- append to a gzip file
- - illustrates the use of the Z_BLOCK flush parameter for inflate()
- - illustrates the use of deflatePrime() to start at any bit
-
-gzjoin.c
- join gzip files without recalculating the crc or recompressing
- - illustrates the use of the Z_BLOCK flush parameter for inflate()
- - illustrates the use of crc32_combine()
-
-gzlog.c
-gzlog.h
- efficiently maintain a message log file in gzip format
- - illustrates use of raw deflate and Z_SYNC_FLUSH
- - illustrates use of gzip header extra field
-
-zlib_how.html
- painfully comprehensive description of zpipe.c (see below)
- - describes in excruciating detail the use of deflate() and inflate()
-
-zpipe.c
- reads and writes zlib streams from stdin to stdout
- - illustrates the proper use of deflate() and inflate()
- - deeply commented in zlib_how.html (see above)
-
-zran.c
- index a zlib or gzip stream and randomly access it
- - illustrates the use of Z_BLOCK, inflatePrime(), and
- inflateSetDictionary() to provide random access
diff --git a/funtools/util/zlib-1.2.3/examples/fitblk.c b/funtools/util/zlib-1.2.3/examples/fitblk.c
deleted file mode 100644
index c61de5c..0000000
--- a/funtools/util/zlib-1.2.3/examples/fitblk.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* fitblk.c: example of fitting compressed output to a specified size
- Not copyrighted -- provided to the public domain
- Version 1.1 25 November 2004 Mark Adler */
-
-/* Version history:
- 1.0 24 Nov 2004 First version
- 1.1 25 Nov 2004 Change deflateInit2() to deflateInit()
- Use fixed-size, stack-allocated raw buffers
- Simplify code moving compression to subroutines
- Use assert() for internal errors
- Add detailed description of approach
- */
-
-/* Approach to just fitting a requested compressed size:
-
- fitblk performs three compression passes on a portion of the input
- data in order to determine how much of that input will compress to
- nearly the requested output block size. The first pass generates
- enough deflate blocks to produce output to fill the requested
- output size plus a specfied excess amount (see the EXCESS define
- below). The last deflate block may go quite a bit past that, but
- is discarded. The second pass decompresses and recompresses just
- the compressed data that fit in the requested plus excess sized
- buffer. The deflate process is terminated after that amount of
- input, which is less than the amount consumed on the first pass.
- The last deflate block of the result will be of a comparable size
- to the final product, so that the header for that deflate block and
- the compression ratio for that block will be about the same as in
- the final product. The third compression pass decompresses the
- result of the second step, but only the compressed data up to the
- requested size minus an amount to allow the compressed stream to
- complete (see the MARGIN define below). That will result in a
- final compressed stream whose length is less than or equal to the
- requested size. Assuming sufficient input and a requested size
- greater than a few hundred bytes, the shortfall will typically be
- less than ten bytes.
-
- If the input is short enough that the first compression completes
- before filling the requested output size, then that compressed
- stream is return with no recompression.
-
- EXCESS is chosen to be just greater than the shortfall seen in a
- two pass approach similar to the above. That shortfall is due to
- the last deflate block compressing more efficiently with a smaller
- header on the second pass. EXCESS is set to be large enough so
- that there is enough uncompressed data for the second pass to fill
- out the requested size, and small enough so that the final deflate
- block of the second pass will be close in size to the final deflate
- block of the third and final pass. MARGIN is chosen to be just
- large enough to assure that the final compression has enough room
- to complete in all cases.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "zlib.h"
-
-#define local static
-
-/* print nastygram and leave */
-local void quit(char *why)
-{
- fprintf(stderr, "fitblk abort: %s\n", why);
- exit(1);
-}
-
-#define RAWLEN 4096 /* intermediate uncompressed buffer size */
-
-/* compress from file to def until provided buffer is full or end of
- input reached; return last deflate() return value, or Z_ERRNO if
- there was read error on the file */
-local int partcompress(FILE *in, z_streamp def)
-{
- int ret, flush;
- unsigned char raw[RAWLEN];
-
- flush = Z_NO_FLUSH;
- do {
- def->avail_in = fread(raw, 1, RAWLEN, in);
- if (ferror(in))
- return Z_ERRNO;
- def->next_in = raw;
- if (feof(in))
- flush = Z_FINISH;
- ret = deflate(def, flush);
- assert(ret != Z_STREAM_ERROR);
- } while (def->avail_out != 0 && flush == Z_NO_FLUSH);
- return ret;
-}
-
-/* recompress from inf's input to def's output; the input for inf and
- the output for def are set in those structures before calling;
- return last deflate() return value, or Z_MEM_ERROR if inflate()
- was not able to allocate enough memory when it needed to */
-local int recompress(z_streamp inf, z_streamp def)
-{
- int ret, flush;
- unsigned char raw[RAWLEN];
-
- flush = Z_NO_FLUSH;
- do {
- /* decompress */
- inf->avail_out = RAWLEN;
- inf->next_out = raw;
- ret = inflate(inf, Z_NO_FLUSH);
- assert(ret != Z_STREAM_ERROR && ret != Z_DATA_ERROR &&
- ret != Z_NEED_DICT);
- if (ret == Z_MEM_ERROR)
- return ret;
-
- /* compress what was decompresed until done or no room */
- def->avail_in = RAWLEN - inf->avail_out;
- def->next_in = raw;
- if (inf->avail_out != 0)
- flush = Z_FINISH;
- ret = deflate(def, flush);
- assert(ret != Z_STREAM_ERROR);
- } while (ret != Z_STREAM_END && def->avail_out != 0);
- return ret;
-}
-
-#define EXCESS 256 /* empirically determined stream overage */
-#define MARGIN 8 /* amount to back off for completion */
-
-/* compress from stdin to fixed-size block on stdout */
-int main(int argc, char **argv)
-{
- int ret; /* return code */
- unsigned size; /* requested fixed output block size */
- unsigned have; /* bytes written by deflate() call */
- unsigned char *blk; /* intermediate and final stream */
- unsigned char *tmp; /* close to desired size stream */
- z_stream def, inf; /* zlib deflate and inflate states */
-
- /* get requested output size */
- if (argc != 2)
- quit("need one argument: size of output block");
- ret = strtol(argv[1], argv + 1, 10);
- if (argv[1][0] != 0)
- quit("argument must be a number");
- if (ret < 8) /* 8 is minimum zlib stream size */
- quit("need positive size of 8 or greater");
- size = (unsigned)ret;
-
- /* allocate memory for buffers and compression engine */
- blk = malloc(size + EXCESS);
- def.zalloc = Z_NULL;
- def.zfree = Z_NULL;
- def.opaque = Z_NULL;
- ret = deflateInit(&def, Z_DEFAULT_COMPRESSION);
- if (ret != Z_OK || blk == NULL)
- quit("out of memory");
-
- /* compress from stdin until output full, or no more input */
- def.avail_out = size + EXCESS;
- def.next_out = blk;
- ret = partcompress(stdin, &def);
- if (ret == Z_ERRNO)
- quit("error reading input");
-
- /* if it all fit, then size was undersubscribed -- done! */
- if (ret == Z_STREAM_END && def.avail_out >= EXCESS) {
- /* write block to stdout */
- have = size + EXCESS - def.avail_out;
- if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
- quit("error writing output");
-
- /* clean up and print results to stderr */
- ret = deflateEnd(&def);
- assert(ret != Z_STREAM_ERROR);
- free(blk);
- fprintf(stderr,
- "%u bytes unused out of %u requested (all input)\n",
- size - have, size);
- return 0;
- }
-
- /* it didn't all fit -- set up for recompression */
- inf.zalloc = Z_NULL;
- inf.zfree = Z_NULL;
- inf.opaque = Z_NULL;
- inf.avail_in = 0;
- inf.next_in = Z_NULL;
- ret = inflateInit(&inf);
- tmp = malloc(size + EXCESS);
- if (ret != Z_OK || tmp == NULL)
- quit("out of memory");
- ret = deflateReset(&def);
- assert(ret != Z_STREAM_ERROR);
-
- /* do first recompression close to the right amount */
- inf.avail_in = size + EXCESS;
- inf.next_in = blk;
- def.avail_out = size + EXCESS;
- def.next_out = tmp;
- ret = recompress(&inf, &def);
- if (ret == Z_MEM_ERROR)
- quit("out of memory");
-
- /* set up for next reocmpression */
- ret = inflateReset(&inf);
- assert(ret != Z_STREAM_ERROR);
- ret = deflateReset(&def);
- assert(ret != Z_STREAM_ERROR);
-
- /* do second and final recompression (third compression) */
- inf.avail_in = size - MARGIN; /* assure stream will complete */
- inf.next_in = tmp;
- def.avail_out = size;
- def.next_out = blk;
- ret = recompress(&inf, &def);
- if (ret == Z_MEM_ERROR)
- quit("out of memory");
- assert(ret == Z_STREAM_END); /* otherwise MARGIN too small */
-
- /* done -- write block to stdout */
- have = size - def.avail_out;
- if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
- quit("error writing output");
-
- /* clean up and print results to stderr */
- free(tmp);
- ret = inflateEnd(&inf);
- assert(ret != Z_STREAM_ERROR);
- ret = deflateEnd(&def);
- assert(ret != Z_STREAM_ERROR);
- free(blk);
- fprintf(stderr,
- "%u bytes unused out of %u requested (%lu input)\n",
- size - have, size, def.total_in);
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/examples/gun.c b/funtools/util/zlib-1.2.3/examples/gun.c
deleted file mode 100644
index bfec590..0000000
--- a/funtools/util/zlib-1.2.3/examples/gun.c
+++ /dev/null
@@ -1,693 +0,0 @@
-/* gun.c -- simple gunzip to give an example of the use of inflateBack()
- * Copyright (C) 2003, 2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- Version 1.3 12 June 2005 Mark Adler */
-
-/* Version history:
- 1.0 16 Feb 2003 First version for testing of inflateBack()
- 1.1 21 Feb 2005 Decompress concatenated gzip streams
- Remove use of "this" variable (C++ keyword)
- Fix return value for in()
- Improve allocation failure checking
- Add typecasting for void * structures
- Add -h option for command version and usage
- Add a bunch of comments
- 1.2 20 Mar 2005 Add Unix compress (LZW) decompression
- Copy file attributes from input file to output file
- 1.3 12 Jun 2005 Add casts for error messages [Oberhumer]
- */
-
-/*
- gun [ -t ] [ name ... ]
-
- decompresses the data in the named gzip files. If no arguments are given,
- gun will decompress from stdin to stdout. The names must end in .gz, -gz,
- .z, -z, _z, or .Z. The uncompressed data will be written to a file name
- with the suffix stripped. On success, the original file is deleted. On
- failure, the output file is deleted. For most failures, the command will
- continue to process the remaining names on the command line. A memory
- allocation failure will abort the command. If -t is specified, then the
- listed files or stdin will be tested as gzip files for integrity (without
- checking for a proper suffix), no output will be written, and no files
- will be deleted.
-
- Like gzip, gun allows concatenated gzip streams and will decompress them,
- writing all of the uncompressed data to the output. Unlike gzip, gun allows
- an empty file on input, and will produce no error writing an empty output
- file.
-
- gun will also decompress files made by Unix compress, which uses LZW
- compression. These files are automatically detected by virtue of their
- magic header bytes. Since the end of Unix compress stream is marked by the
- end-of-file, they cannot be concantenated. If a Unix compress stream is
- encountered in an input file, it is the last stream in that file.
-
- Like gunzip and uncompress, the file attributes of the orignal compressed
- file are maintained in the final uncompressed file, to the extent that the
- user permissions allow it.
-
- On my Mac OS X PowerPC G4, gun is almost twice as fast as gunzip (version
- 1.2.4) is on the same file, when gun is linked with zlib 1.2.2. Also the
- LZW decompression provided by gun is about twice as fast as the standard
- Unix uncompress command.
- */
-
-/* external functions and related types and constants */
-#include <stdio.h> /* fprintf() */
-#include <stdlib.h> /* malloc(), free() */
-#include <string.h> /* strerror(), strcmp(), strlen(), memcpy() */
-#include <errno.h> /* errno */
-#include <fcntl.h> /* open() */
-#include <unistd.h> /* read(), write(), close(), chown(), unlink() */
-#include <sys/types.h>
-#include <sys/stat.h> /* stat(), chmod() */
-#include <utime.h> /* utime() */
-#include "zlib.h" /* inflateBackInit(), inflateBack(), */
- /* inflateBackEnd(), crc32() */
-
-/* function declaration */
-#define local static
-
-/* buffer constants */
-#define SIZE 32768U /* input and output buffer sizes */
-#define PIECE 16384 /* limits i/o chunks for 16-bit int case */
-
-/* structure for infback() to pass to input function in() -- it maintains the
- input file and a buffer of size SIZE */
-struct ind {
- int infile;
- unsigned char *inbuf;
-};
-
-/* Load input buffer, assumed to be empty, and return bytes loaded and a
- pointer to them. read() is called until the buffer is full, or until it
- returns end-of-file or error. Return 0 on error. */
-local unsigned in(void *in_desc, unsigned char **buf)
-{
- int ret;
- unsigned len;
- unsigned char *next;
- struct ind *me = (struct ind *)in_desc;
-
- next = me->inbuf;
- *buf = next;
- len = 0;
- do {
- ret = PIECE;
- if ((unsigned)ret > SIZE - len)
- ret = (int)(SIZE - len);
- ret = (int)read(me->infile, next, ret);
- if (ret == -1) {
- len = 0;
- break;
- }
- next += ret;
- len += ret;
- } while (ret != 0 && len < SIZE);
- return len;
-}
-
-/* structure for infback() to pass to output function out() -- it maintains the
- output file, a running CRC-32 check on the output and the total number of
- bytes output, both for checking against the gzip trailer. (The length in
- the gzip trailer is stored modulo 2^32, so it's ok if a long is 32 bits and
- the output is greater than 4 GB.) */
-struct outd {
- int outfile;
- int check; /* true if checking crc and total */
- unsigned long crc;
- unsigned long total;
-};
-
-/* Write output buffer and update the CRC-32 and total bytes written. write()
- is called until all of the output is written or an error is encountered.
- On success out() returns 0. For a write failure, out() returns 1. If the
- output file descriptor is -1, then nothing is written.
- */
-local int out(void *out_desc, unsigned char *buf, unsigned len)
-{
- int ret;
- struct outd *me = (struct outd *)out_desc;
-
- if (me->check) {
- me->crc = crc32(me->crc, buf, len);
- me->total += len;
- }
- if (me->outfile != -1)
- do {
- ret = PIECE;
- if ((unsigned)ret > len)
- ret = (int)len;
- ret = (int)write(me->outfile, buf, ret);
- if (ret == -1)
- return 1;
- buf += ret;
- len -= ret;
- } while (len != 0);
- return 0;
-}
-
-/* next input byte macro for use inside lunpipe() and gunpipe() */
-#define NEXT() (have ? 0 : (have = in(indp, &next)), \
- last = have ? (have--, (int)(*next++)) : -1)
-
-/* memory for gunpipe() and lunpipe() --
- the first 256 entries of prefix[] and suffix[] are never used, could
- have offset the index, but it's faster to waste the memory */
-unsigned char inbuf[SIZE]; /* input buffer */
-unsigned char outbuf[SIZE]; /* output buffer */
-unsigned short prefix[65536]; /* index to LZW prefix string */
-unsigned char suffix[65536]; /* one-character LZW suffix */
-unsigned char match[65280 + 2]; /* buffer for reversed match or gzip
- 32K sliding window */
-
-/* throw out what's left in the current bits byte buffer (this is a vestigial
- aspect of the compressed data format derived from an implementation that
- made use of a special VAX machine instruction!) */
-#define FLUSHCODE() \
- do { \
- left = 0; \
- rem = 0; \
- if (chunk > have) { \
- chunk -= have; \
- have = 0; \
- if (NEXT() == -1) \
- break; \
- chunk--; \
- if (chunk > have) { \
- chunk = have = 0; \
- break; \
- } \
- } \
- have -= chunk; \
- next += chunk; \
- chunk = 0; \
- } while (0)
-
-/* Decompress a compress (LZW) file from indp to outfile. The compress magic
- header (two bytes) has already been read and verified. There are have bytes
- of buffered input at next. strm is used for passing error information back
- to gunpipe().
-
- lunpipe() will return Z_OK on success, Z_BUF_ERROR for an unexpected end of
- file, read error, or write error (a write error indicated by strm->next_in
- not equal to Z_NULL), or Z_DATA_ERROR for invalid input.
- */
-local int lunpipe(unsigned have, unsigned char *next, struct ind *indp,
- int outfile, z_stream *strm)
-{
- int last; /* last byte read by NEXT(), or -1 if EOF */
- int chunk; /* bytes left in current chunk */
- int left; /* bits left in rem */
- unsigned rem; /* unused bits from input */
- int bits; /* current bits per code */
- unsigned code; /* code, table traversal index */
- unsigned mask; /* mask for current bits codes */
- int max; /* maximum bits per code for this stream */
- int flags; /* compress flags, then block compress flag */
- unsigned end; /* last valid entry in prefix/suffix tables */
- unsigned temp; /* current code */
- unsigned prev; /* previous code */
- unsigned final; /* last character written for previous code */
- unsigned stack; /* next position for reversed string */
- unsigned outcnt; /* bytes in output buffer */
- struct outd outd; /* output structure */
-
- /* set up output */
- outd.outfile = outfile;
- outd.check = 0;
-
- /* process remainder of compress header -- a flags byte */
- flags = NEXT();
- if (last == -1)
- return Z_BUF_ERROR;
- if (flags & 0x60) {
- strm->msg = (char *)"unknown lzw flags set";
- return Z_DATA_ERROR;
- }
- max = flags & 0x1f;
- if (max < 9 || max > 16) {
- strm->msg = (char *)"lzw bits out of range";
- return Z_DATA_ERROR;
- }
- if (max == 9) /* 9 doesn't really mean 9 */
- max = 10;
- flags &= 0x80; /* true if block compress */
-
- /* clear table */
- bits = 9;
- mask = 0x1ff;
- end = flags ? 256 : 255;
-
- /* set up: get first 9-bit code, which is the first decompressed byte, but
- don't create a table entry until the next code */
- if (NEXT() == -1) /* no compressed data is ok */
- return Z_OK;
- final = prev = (unsigned)last; /* low 8 bits of code */
- if (NEXT() == -1) /* missing a bit */
- return Z_BUF_ERROR;
- if (last & 1) { /* code must be < 256 */
- strm->msg = (char *)"invalid lzw code";
- return Z_DATA_ERROR;
- }
- rem = (unsigned)last >> 1; /* remaining 7 bits */
- left = 7;
- chunk = bits - 2; /* 7 bytes left in this chunk */
- outbuf[0] = (unsigned char)final; /* write first decompressed byte */
- outcnt = 1;
-
- /* decode codes */
- stack = 0;
- for (;;) {
- /* if the table will be full after this, increment the code size */
- if (end >= mask && bits < max) {
- FLUSHCODE();
- bits++;
- mask <<= 1;
- mask++;
- }
-
- /* get a code of length bits */
- if (chunk == 0) /* decrement chunk modulo bits */
- chunk = bits;
- code = rem; /* low bits of code */
- if (NEXT() == -1) { /* EOF is end of compressed data */
- /* write remaining buffered output */
- if (outcnt && out(&outd, outbuf, outcnt)) {
- strm->next_in = outbuf; /* signal write error */
- return Z_BUF_ERROR;
- }
- return Z_OK;
- }
- code += (unsigned)last << left; /* middle (or high) bits of code */
- left += 8;
- chunk--;
- if (bits > left) { /* need more bits */
- if (NEXT() == -1) /* can't end in middle of code */
- return Z_BUF_ERROR;
- code += (unsigned)last << left; /* high bits of code */
- left += 8;
- chunk--;
- }
- code &= mask; /* mask to current code length */
- left -= bits; /* number of unused bits */
- rem = (unsigned)last >> (8 - left); /* unused bits from last byte */
-
- /* process clear code (256) */
- if (code == 256 && flags) {
- FLUSHCODE();
- bits = 9; /* initialize bits and mask */
- mask = 0x1ff;
- end = 255; /* empty table */
- continue; /* get next code */
- }
-
- /* special code to reuse last match */
- temp = code; /* save the current code */
- if (code > end) {
- /* Be picky on the allowed code here, and make sure that the code
- we drop through (prev) will be a valid index so that random
- input does not cause an exception. The code != end + 1 check is
- empirically derived, and not checked in the original uncompress
- code. If this ever causes a problem, that check could be safely
- removed. Leaving this check in greatly improves gun's ability
- to detect random or corrupted input after a compress header.
- In any case, the prev > end check must be retained. */
- if (code != end + 1 || prev > end) {
- strm->msg = (char *)"invalid lzw code";
- return Z_DATA_ERROR;
- }
- match[stack++] = (unsigned char)final;
- code = prev;
- }
-
- /* walk through linked list to generate output in reverse order */
- while (code >= 256) {
- match[stack++] = suffix[code];
- code = prefix[code];
- }
- match[stack++] = (unsigned char)code;
- final = code;
-
- /* link new table entry */
- if (end < mask) {
- end++;
- prefix[end] = (unsigned short)prev;
- suffix[end] = (unsigned char)final;
- }
-
- /* set previous code for next iteration */
- prev = temp;
-
- /* write output in forward order */
- while (stack > SIZE - outcnt) {
- while (outcnt < SIZE)
- outbuf[outcnt++] = match[--stack];
- if (out(&outd, outbuf, outcnt)) {
- strm->next_in = outbuf; /* signal write error */
- return Z_BUF_ERROR;
- }
- outcnt = 0;
- }
- do {
- outbuf[outcnt++] = match[--stack];
- } while (stack);
-
- /* loop for next code with final and prev as the last match, rem and
- left provide the first 0..7 bits of the next code, end is the last
- valid table entry */
- }
-}
-
-/* Decompress a gzip file from infile to outfile. strm is assumed to have been
- successfully initialized with inflateBackInit(). The input file may consist
- of a series of gzip streams, in which case all of them will be decompressed
- to the output file. If outfile is -1, then the gzip stream(s) integrity is
- checked and nothing is written.
-
- The return value is a zlib error code: Z_MEM_ERROR if out of memory,
- Z_DATA_ERROR if the header or the compressed data is invalid, or if the
- trailer CRC-32 check or length doesn't match, Z_BUF_ERROR if the input ends
- prematurely or a write error occurs, or Z_ERRNO if junk (not a another gzip
- stream) follows a valid gzip stream.
- */
-local int gunpipe(z_stream *strm, int infile, int outfile)
-{
- int ret, first, last;
- unsigned have, flags, len;
- unsigned char *next;
- struct ind ind, *indp;
- struct outd outd;
-
- /* setup input buffer */
- ind.infile = infile;
- ind.inbuf = inbuf;
- indp = &ind;
-
- /* decompress concatenated gzip streams */
- have = 0; /* no input data read in yet */
- first = 1; /* looking for first gzip header */
- strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */
- for (;;) {
- /* look for the two magic header bytes for a gzip stream */
- if (NEXT() == -1) {
- ret = Z_OK;
- break; /* empty gzip stream is ok */
- }
- if (last != 31 || (NEXT() != 139 && last != 157)) {
- strm->msg = (char *)"incorrect header check";
- ret = first ? Z_DATA_ERROR : Z_ERRNO;
- break; /* not a gzip or compress header */
- }
- first = 0; /* next non-header is junk */
-
- /* process a compress (LZW) file -- can't be concatenated after this */
- if (last == 157) {
- ret = lunpipe(have, next, indp, outfile, strm);
- break;
- }
-
- /* process remainder of gzip header */
- ret = Z_BUF_ERROR;
- if (NEXT() != 8) { /* only deflate method allowed */
- if (last == -1) break;
- strm->msg = (char *)"unknown compression method";
- ret = Z_DATA_ERROR;
- break;
- }
- flags = NEXT(); /* header flags */
- NEXT(); /* discard mod time, xflgs, os */
- NEXT();
- NEXT();
- NEXT();
- NEXT();
- NEXT();
- if (last == -1) break;
- if (flags & 0xe0) {
- strm->msg = (char *)"unknown header flags set";
- ret = Z_DATA_ERROR;
- break;
- }
- if (flags & 4) { /* extra field */
- len = NEXT();
- len += (unsigned)(NEXT()) << 8;
- if (last == -1) break;
- while (len > have) {
- len -= have;
- have = 0;
- if (NEXT() == -1) break;
- len--;
- }
- if (last == -1) break;
- have -= len;
- next += len;
- }
- if (flags & 8) /* file name */
- while (NEXT() != 0 && last != -1)
- ;
- if (flags & 16) /* comment */
- while (NEXT() != 0 && last != -1)
- ;
- if (flags & 2) { /* header crc */
- NEXT();
- NEXT();
- }
- if (last == -1) break;
-
- /* set up output */
- outd.outfile = outfile;
- outd.check = 1;
- outd.crc = crc32(0L, Z_NULL, 0);
- outd.total = 0;
-
- /* decompress data to output */
- strm->next_in = next;
- strm->avail_in = have;
- ret = inflateBack(strm, in, indp, out, &outd);
- if (ret != Z_STREAM_END) break;
- next = strm->next_in;
- have = strm->avail_in;
- strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */
-
- /* check trailer */
- ret = Z_BUF_ERROR;
- if (NEXT() != (outd.crc & 0xff) ||
- NEXT() != ((outd.crc >> 8) & 0xff) ||
- NEXT() != ((outd.crc >> 16) & 0xff) ||
- NEXT() != ((outd.crc >> 24) & 0xff)) {
- /* crc error */
- if (last != -1) {
- strm->msg = (char *)"incorrect data check";
- ret = Z_DATA_ERROR;
- }
- break;
- }
- if (NEXT() != (outd.total & 0xff) ||
- NEXT() != ((outd.total >> 8) & 0xff) ||
- NEXT() != ((outd.total >> 16) & 0xff) ||
- NEXT() != ((outd.total >> 24) & 0xff)) {
- /* length error */
- if (last != -1) {
- strm->msg = (char *)"incorrect length check";
- ret = Z_DATA_ERROR;
- }
- break;
- }
-
- /* go back and look for another gzip stream */
- }
-
- /* clean up and return */
- return ret;
-}
-
-/* Copy file attributes, from -> to, as best we can. This is best effort, so
- no errors are reported. The mode bits, including suid, sgid, and the sticky
- bit are copied (if allowed), the owner's user id and group id are copied
- (again if allowed), and the access and modify times are copied. */
-local void copymeta(char *from, char *to)
-{
- struct stat was;
- struct utimbuf when;
-
- /* get all of from's Unix meta data, return if not a regular file */
- if (stat(from, &was) != 0 || (was.st_mode & S_IFMT) != S_IFREG)
- return;
-
- /* set to's mode bits, ignore errors */
- (void)chmod(to, was.st_mode & 07777);
-
- /* copy owner's user and group, ignore errors */
- (void)chown(to, was.st_uid, was.st_gid);
-
- /* copy access and modify times, ignore errors */
- when.actime = was.st_atime;
- when.modtime = was.st_mtime;
- (void)utime(to, &when);
-}
-
-/* Decompress the file inname to the file outnname, of if test is true, just
- decompress without writing and check the gzip trailer for integrity. If
- inname is NULL or an empty string, read from stdin. If outname is NULL or
- an empty string, write to stdout. strm is a pre-initialized inflateBack
- structure. When appropriate, copy the file attributes from inname to
- outname.
-
- gunzip() returns 1 if there is an out-of-memory error or an unexpected
- return code from gunpipe(). Otherwise it returns 0.
- */
-local int gunzip(z_stream *strm, char *inname, char *outname, int test)
-{
- int ret;
- int infile, outfile;
-
- /* open files */
- if (inname == NULL || *inname == 0) {
- inname = "-";
- infile = 0; /* stdin */
- }
- else {
- infile = open(inname, O_RDONLY, 0);
- if (infile == -1) {
- fprintf(stderr, "gun cannot open %s\n", inname);
- return 0;
- }
- }
- if (test)
- outfile = -1;
- else if (outname == NULL || *outname == 0) {
- outname = "-";
- outfile = 1; /* stdout */
- }
- else {
- outfile = open(outname, O_CREAT | O_TRUNC | O_WRONLY, 0666);
- if (outfile == -1) {
- close(infile);
- fprintf(stderr, "gun cannot create %s\n", outname);
- return 0;
- }
- }
- errno = 0;
-
- /* decompress */
- ret = gunpipe(strm, infile, outfile);
- if (outfile > 2) close(outfile);
- if (infile > 2) close(infile);
-
- /* interpret result */
- switch (ret) {
- case Z_OK:
- case Z_ERRNO:
- if (infile > 2 && outfile > 2) {
- copymeta(inname, outname); /* copy attributes */
- unlink(inname);
- }
- if (ret == Z_ERRNO)
- fprintf(stderr, "gun warning: trailing garbage ignored in %s\n",
- inname);
- break;
- case Z_DATA_ERROR:
- if (outfile > 2) unlink(outname);
- fprintf(stderr, "gun data error on %s: %s\n", inname, strm->msg);
- break;
- case Z_MEM_ERROR:
- if (outfile > 2) unlink(outname);
- fprintf(stderr, "gun out of memory error--aborting\n");
- return 1;
- case Z_BUF_ERROR:
- if (outfile > 2) unlink(outname);
- if (strm->next_in != Z_NULL) {
- fprintf(stderr, "gun write error on %s: %s\n",
- outname, strerror(errno));
- }
- else if (errno) {
- fprintf(stderr, "gun read error on %s: %s\n",
- inname, strerror(errno));
- }
- else {
- fprintf(stderr, "gun unexpected end of file on %s\n",
- inname);
- }
- break;
- default:
- if (outfile > 2) unlink(outname);
- fprintf(stderr, "gun internal error--aborting\n");
- return 1;
- }
- return 0;
-}
-
-/* Process the gun command line arguments. See the command syntax near the
- beginning of this source file. */
-int main(int argc, char **argv)
-{
- int ret, len, test;
- char *outname;
- unsigned char *window;
- z_stream strm;
-
- /* initialize inflateBack state for repeated use */
- window = match; /* reuse LZW match buffer */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- ret = inflateBackInit(&strm, 15, window);
- if (ret != Z_OK) {
- fprintf(stderr, "gun out of memory error--aborting\n");
- return 1;
- }
-
- /* decompress each file to the same name with the suffix removed */
- argc--;
- argv++;
- test = 0;
- if (argc && strcmp(*argv, "-h") == 0) {
- fprintf(stderr, "gun 1.3 (12 Jun 2005)\n");
- fprintf(stderr, "Copyright (c) 2005 Mark Adler\n");
- fprintf(stderr, "usage: gun [-t] [file1.gz [file2.Z ...]]\n");
- return 0;
- }
- if (argc && strcmp(*argv, "-t") == 0) {
- test = 1;
- argc--;
- argv++;
- }
- if (argc)
- do {
- if (test)
- outname = NULL;
- else {
- len = (int)strlen(*argv);
- if (strcmp(*argv + len - 3, ".gz") == 0 ||
- strcmp(*argv + len - 3, "-gz") == 0)
- len -= 3;
- else if (strcmp(*argv + len - 2, ".z") == 0 ||
- strcmp(*argv + len - 2, "-z") == 0 ||
- strcmp(*argv + len - 2, "_z") == 0 ||
- strcmp(*argv + len - 2, ".Z") == 0)
- len -= 2;
- else {
- fprintf(stderr, "gun error: no gz type on %s--skipping\n",
- *argv);
- continue;
- }
- outname = malloc(len + 1);
- if (outname == NULL) {
- fprintf(stderr, "gun out of memory error--aborting\n");
- ret = 1;
- break;
- }
- memcpy(outname, *argv, len);
- outname[len] = 0;
- }
- ret = gunzip(&strm, *argv, outname, test);
- if (outname != NULL) free(outname);
- if (ret) break;
- } while (argv++, --argc);
- else
- ret = gunzip(&strm, NULL, NULL, test);
-
- /* clean up */
- inflateBackEnd(&strm);
- return ret;
-}
diff --git a/funtools/util/zlib-1.2.3/examples/gzappend.c b/funtools/util/zlib-1.2.3/examples/gzappend.c
deleted file mode 100644
index e9e878e..0000000
--- a/funtools/util/zlib-1.2.3/examples/gzappend.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/* gzappend -- command to append to a gzip file
-
- Copyright (C) 2003 Mark Adler, all rights reserved
- version 1.1, 4 Nov 2003
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Mark Adler madler@alumni.caltech.edu
- */
-
-/*
- * Change history:
- *
- * 1.0 19 Oct 2003 - First version
- * 1.1 4 Nov 2003 - Expand and clarify some comments and notes
- * - Add version and copyright to help
- * - Send help to stdout instead of stderr
- * - Add some preemptive typecasts
- * - Add L to constants in lseek() calls
- * - Remove some debugging information in error messages
- * - Use new data_type definition for zlib 1.2.1
- * - Simplfy and unify file operations
- * - Finish off gzip file in gztack()
- * - Use deflatePrime() instead of adding empty blocks
- * - Keep gzip file clean on appended file read errors
- * - Use in-place rotate instead of auxiliary buffer
- * (Why you ask? Because it was fun to write!)
- */
-
-/*
- gzappend takes a gzip file and appends to it, compressing files from the
- command line or data from stdin. The gzip file is written to directly, to
- avoid copying that file, in case it's large. Note that this results in the
- unfriendly behavior that if gzappend fails, the gzip file is corrupted.
-
- This program was written to illustrate the use of the new Z_BLOCK option of
- zlib 1.2.x's inflate() function. This option returns from inflate() at each
- block boundary to facilitate locating and modifying the last block bit at
- the start of the final deflate block. Also whether using Z_BLOCK or not,
- another required feature of zlib 1.2.x is that inflate() now provides the
- number of unusued bits in the last input byte used. gzappend will not work
- with versions of zlib earlier than 1.2.1.
-
- gzappend first decompresses the gzip file internally, discarding all but
- the last 32K of uncompressed data, and noting the location of the last block
- bit and the number of unused bits in the last byte of the compressed data.
- The gzip trailer containing the CRC-32 and length of the uncompressed data
- is verified. This trailer will be later overwritten.
-
- Then the last block bit is cleared by seeking back in the file and rewriting
- the byte that contains it. Seeking forward, the last byte of the compressed
- data is saved along with the number of unused bits to initialize deflate.
-
- A deflate process is initialized, using the last 32K of the uncompressed
- data from the gzip file to initialize the dictionary. If the total
- uncompressed data was less than 32K, then all of it is used to initialize
- the dictionary. The deflate output bit buffer is also initialized with the
- last bits from the original deflate stream. From here on, the data to
- append is simply compressed using deflate, and written to the gzip file.
- When that is complete, the new CRC-32 and uncompressed length are written
- as the trailer of the gzip file.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "zlib.h"
-
-#define local static
-#define LGCHUNK 14
-#define CHUNK (1U << LGCHUNK)
-#define DSIZE 32768U
-
-/* print an error message and terminate with extreme prejudice */
-local void bye(char *msg1, char *msg2)
-{
- fprintf(stderr, "gzappend error: %s%s\n", msg1, msg2);
- exit(1);
-}
-
-/* return the greatest common divisor of a and b using Euclid's algorithm,
- modified to be fast when one argument much greater than the other, and
- coded to avoid unnecessary swapping */
-local unsigned gcd(unsigned a, unsigned b)
-{
- unsigned c;
-
- while (a && b)
- if (a > b) {
- c = b;
- while (a - c >= c)
- c <<= 1;
- a -= c;
- }
- else {
- c = a;
- while (b - c >= c)
- c <<= 1;
- b -= c;
- }
- return a + b;
-}
-
-/* rotate list[0..len-1] left by rot positions, in place */
-local void rotate(unsigned char *list, unsigned len, unsigned rot)
-{
- unsigned char tmp;
- unsigned cycles;
- unsigned char *start, *last, *to, *from;
-
- /* normalize rot and handle degenerate cases */
- if (len < 2) return;
- if (rot >= len) rot %= len;
- if (rot == 0) return;
-
- /* pointer to last entry in list */
- last = list + (len - 1);
-
- /* do simple left shift by one */
- if (rot == 1) {
- tmp = *list;
- memcpy(list, list + 1, len - 1);
- *last = tmp;
- return;
- }
-
- /* do simple right shift by one */
- if (rot == len - 1) {
- tmp = *last;
- memmove(list + 1, list, len - 1);
- *list = tmp;
- return;
- }
-
- /* otherwise do rotate as a set of cycles in place */
- cycles = gcd(len, rot); /* number of cycles */
- do {
- start = from = list + cycles; /* start index is arbitrary */
- tmp = *from; /* save entry to be overwritten */
- for (;;) {
- to = from; /* next step in cycle */
- from += rot; /* go right rot positions */
- if (from > last) from -= len; /* (pointer better not wrap) */
- if (from == start) break; /* all but one shifted */
- *to = *from; /* shift left */
- }
- *to = tmp; /* complete the circle */
- } while (--cycles);
-}
-
-/* structure for gzip file read operations */
-typedef struct {
- int fd; /* file descriptor */
- int size; /* 1 << size is bytes in buf */
- unsigned left; /* bytes available at next */
- unsigned char *buf; /* buffer */
- unsigned char *next; /* next byte in buffer */
- char *name; /* file name for error messages */
-} file;
-
-/* reload buffer */
-local int readin(file *in)
-{
- int len;
-
- len = read(in->fd, in->buf, 1 << in->size);
- if (len == -1) bye("error reading ", in->name);
- in->left = (unsigned)len;
- in->next = in->buf;
- return len;
-}
-
-/* read from file in, exit if end-of-file */
-local int readmore(file *in)
-{
- if (readin(in) == 0) bye("unexpected end of ", in->name);
- return 0;
-}
-
-#define read1(in) (in->left == 0 ? readmore(in) : 0, \
- in->left--, *(in->next)++)
-
-/* skip over n bytes of in */
-local void skip(file *in, unsigned n)
-{
- unsigned bypass;
-
- if (n > in->left) {
- n -= in->left;
- bypass = n & ~((1U << in->size) - 1);
- if (bypass) {
- if (lseek(in->fd, (off_t)bypass, SEEK_CUR) == -1)
- bye("seeking ", in->name);
- n -= bypass;
- }
- readmore(in);
- if (n > in->left)
- bye("unexpected end of ", in->name);
- }
- in->left -= n;
- in->next += n;
-}
-
-/* read a four-byte unsigned integer, little-endian, from in */
-unsigned long read4(file *in)
-{
- unsigned long val;
-
- val = read1(in);
- val += (unsigned)read1(in) << 8;
- val += (unsigned long)read1(in) << 16;
- val += (unsigned long)read1(in) << 24;
- return val;
-}
-
-/* skip over gzip header */
-local void gzheader(file *in)
-{
- int flags;
- unsigned n;
-
- if (read1(in) != 31 || read1(in) != 139) bye(in->name, " not a gzip file");
- if (read1(in) != 8) bye("unknown compression method in", in->name);
- flags = read1(in);
- if (flags & 0xe0) bye("unknown header flags set in", in->name);
- skip(in, 6);
- if (flags & 4) {
- n = read1(in);
- n += (unsigned)(read1(in)) << 8;
- skip(in, n);
- }
- if (flags & 8) while (read1(in) != 0) ;
- if (flags & 16) while (read1(in) != 0) ;
- if (flags & 2) skip(in, 2);
-}
-
-/* decompress gzip file "name", return strm with a deflate stream ready to
- continue compression of the data in the gzip file, and return a file
- descriptor pointing to where to write the compressed data -- the deflate
- stream is initialized to compress using level "level" */
-local int gzscan(char *name, z_stream *strm, int level)
-{
- int ret, lastbit, left, full;
- unsigned have;
- unsigned long crc, tot;
- unsigned char *window;
- off_t lastoff, end;
- file gz;
-
- /* open gzip file */
- gz.name = name;
- gz.fd = open(name, O_RDWR, 0);
- if (gz.fd == -1) bye("cannot open ", name);
- gz.buf = malloc(CHUNK);
- if (gz.buf == NULL) bye("out of memory", "");
- gz.size = LGCHUNK;
- gz.left = 0;
-
- /* skip gzip header */
- gzheader(&gz);
-
- /* prepare to decompress */
- window = malloc(DSIZE);
- if (window == NULL) bye("out of memory", "");
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
- strm->opaque = Z_NULL;
- ret = inflateInit2(strm, -15);
- if (ret != Z_OK) bye("out of memory", " or library mismatch");
-
- /* decompress the deflate stream, saving append information */
- lastbit = 0;
- lastoff = lseek(gz.fd, 0L, SEEK_CUR) - gz.left;
- left = 0;
- strm->avail_in = gz.left;
- strm->next_in = gz.next;
- crc = crc32(0L, Z_NULL, 0);
- have = full = 0;
- do {
- /* if needed, get more input */
- if (strm->avail_in == 0) {
- readmore(&gz);
- strm->avail_in = gz.left;
- strm->next_in = gz.next;
- }
-
- /* set up output to next available section of sliding window */
- strm->avail_out = DSIZE - have;
- strm->next_out = window + have;
-
- /* inflate and check for errors */
- ret = inflate(strm, Z_BLOCK);
- if (ret == Z_STREAM_ERROR) bye("internal stream error!", "");
- if (ret == Z_MEM_ERROR) bye("out of memory", "");
- if (ret == Z_DATA_ERROR)
- bye("invalid compressed data--format violated in", name);
-
- /* update crc and sliding window pointer */
- crc = crc32(crc, window + have, DSIZE - have - strm->avail_out);
- if (strm->avail_out)
- have = DSIZE - strm->avail_out;
- else {
- have = 0;
- full = 1;
- }
-
- /* process end of block */
- if (strm->data_type & 128) {
- if (strm->data_type & 64)
- left = strm->data_type & 0x1f;
- else {
- lastbit = strm->data_type & 0x1f;
- lastoff = lseek(gz.fd, 0L, SEEK_CUR) - strm->avail_in;
- }
- }
- } while (ret != Z_STREAM_END);
- inflateEnd(strm);
- gz.left = strm->avail_in;
- gz.next = strm->next_in;
-
- /* save the location of the end of the compressed data */
- end = lseek(gz.fd, 0L, SEEK_CUR) - gz.left;
-
- /* check gzip trailer and save total for deflate */
- if (crc != read4(&gz))
- bye("invalid compressed data--crc mismatch in ", name);
- tot = strm->total_out;
- if ((tot & 0xffffffffUL) != read4(&gz))
- bye("invalid compressed data--length mismatch in", name);
-
- /* if not at end of file, warn */
- if (gz.left || readin(&gz))
- fprintf(stderr,
- "gzappend warning: junk at end of gzip file overwritten\n");
-
- /* clear last block bit */
- lseek(gz.fd, lastoff - (lastbit != 0), SEEK_SET);
- if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name);
- *gz.buf = (unsigned char)(*gz.buf ^ (1 << ((8 - lastbit) & 7)));
- lseek(gz.fd, -1L, SEEK_CUR);
- if (write(gz.fd, gz.buf, 1) != 1) bye("writing after seek to ", name);
-
- /* if window wrapped, build dictionary from window by rotating */
- if (full) {
- rotate(window, DSIZE, have);
- have = DSIZE;
- }
-
- /* set up deflate stream with window, crc, total_in, and leftover bits */
- ret = deflateInit2(strm, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
- if (ret != Z_OK) bye("out of memory", "");
- deflateSetDictionary(strm, window, have);
- strm->adler = crc;
- strm->total_in = tot;
- if (left) {
- lseek(gz.fd, --end, SEEK_SET);
- if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name);
- deflatePrime(strm, 8 - left, *gz.buf);
- }
- lseek(gz.fd, end, SEEK_SET);
-
- /* clean up and return */
- free(window);
- free(gz.buf);
- return gz.fd;
-}
-
-/* append file "name" to gzip file gd using deflate stream strm -- if last
- is true, then finish off the deflate stream at the end */
-local void gztack(char *name, int gd, z_stream *strm, int last)
-{
- int fd, len, ret;
- unsigned left;
- unsigned char *in, *out;
-
- /* open file to compress and append */
- fd = 0;
- if (name != NULL) {
- fd = open(name, O_RDONLY, 0);
- if (fd == -1)
- fprintf(stderr, "gzappend warning: %s not found, skipping ...\n",
- name);
- }
-
- /* allocate buffers */
- in = fd == -1 ? NULL : malloc(CHUNK);
- out = malloc(CHUNK);
- if (out == NULL) bye("out of memory", "");
-
- /* compress input file and append to gzip file */
- do {
- /* get more input */
- len = fd == -1 ? 0 : read(fd, in, CHUNK);
- if (len == -1) {
- fprintf(stderr,
- "gzappend warning: error reading %s, skipping rest ...\n",
- name);
- len = 0;
- }
- strm->avail_in = (unsigned)len;
- strm->next_in = in;
- if (len) strm->adler = crc32(strm->adler, in, (unsigned)len);
-
- /* compress and write all available output */
- do {
- strm->avail_out = CHUNK;
- strm->next_out = out;
- ret = deflate(strm, last && len == 0 ? Z_FINISH : Z_NO_FLUSH);
- left = CHUNK - strm->avail_out;
- while (left) {
- len = write(gd, out + CHUNK - strm->avail_out - left, left);
- if (len == -1) bye("writing gzip file", "");
- left -= (unsigned)len;
- }
- } while (strm->avail_out == 0 && ret != Z_STREAM_END);
- } while (len != 0);
-
- /* write trailer after last entry */
- if (last) {
- deflateEnd(strm);
- out[0] = (unsigned char)(strm->adler);
- out[1] = (unsigned char)(strm->adler >> 8);
- out[2] = (unsigned char)(strm->adler >> 16);
- out[3] = (unsigned char)(strm->adler >> 24);
- out[4] = (unsigned char)(strm->total_in);
- out[5] = (unsigned char)(strm->total_in >> 8);
- out[6] = (unsigned char)(strm->total_in >> 16);
- out[7] = (unsigned char)(strm->total_in >> 24);
- len = 8;
- do {
- ret = write(gd, out + 8 - len, len);
- if (ret == -1) bye("writing gzip file", "");
- len -= ret;
- } while (len);
- close(gd);
- }
-
- /* clean up and return */
- free(out);
- if (in != NULL) free(in);
- if (fd > 0) close(fd);
-}
-
-/* process the compression level option if present, scan the gzip file, and
- append the specified files, or append the data from stdin if no other file
- names are provided on the command line -- the gzip file must be writable
- and seekable */
-int main(int argc, char **argv)
-{
- int gd, level;
- z_stream strm;
-
- /* ignore command name */
- argv++;
-
- /* provide usage if no arguments */
- if (*argv == NULL) {
- printf("gzappend 1.1 (4 Nov 2003) Copyright (C) 2003 Mark Adler\n");
- printf(
- "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n");
- return 0;
- }
-
- /* set compression level */
- level = Z_DEFAULT_COMPRESSION;
- if (argv[0][0] == '-') {
- if (argv[0][1] < '0' || argv[0][1] > '9' || argv[0][2] != 0)
- bye("invalid compression level", "");
- level = argv[0][1] - '0';
- if (*++argv == NULL) bye("no gzip file name after options", "");
- }
-
- /* prepare to append to gzip file */
- gd = gzscan(*argv++, &strm, level);
-
- /* append files on command line, or from stdin if none */
- if (*argv == NULL)
- gztack(NULL, gd, &strm, 1);
- else
- do {
- gztack(*argv, gd, &strm, argv[1] == NULL);
- } while (*++argv != NULL);
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/examples/gzjoin.c b/funtools/util/zlib-1.2.3/examples/gzjoin.c
deleted file mode 100644
index 129347c..0000000
--- a/funtools/util/zlib-1.2.3/examples/gzjoin.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/* gzjoin -- command to join gzip files into one gzip file
-
- Copyright (C) 2004 Mark Adler, all rights reserved
- version 1.0, 11 Dec 2004
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Mark Adler madler@alumni.caltech.edu
- */
-
-/*
- * Change history:
- *
- * 1.0 11 Dec 2004 - First version
- * 1.1 12 Jun 2005 - Changed ssize_t to long for portability
- */
-
-/*
- gzjoin takes one or more gzip files on the command line and writes out a
- single gzip file that will uncompress to the concatenation of the
- uncompressed data from the individual gzip files. gzjoin does this without
- having to recompress any of the data and without having to calculate a new
- crc32 for the concatenated uncompressed data. gzjoin does however have to
- decompress all of the input data in order to find the bits in the compressed
- data that need to be modified to concatenate the streams.
-
- gzjoin does not do an integrity check on the input gzip files other than
- checking the gzip header and decompressing the compressed data. They are
- otherwise assumed to be complete and correct.
-
- Each joint between gzip files removes at least 18 bytes of previous trailer
- and subsequent header, and inserts an average of about three bytes to the
- compressed data in order to connect the streams. The output gzip file
- has a minimal ten-byte gzip header with no file name or modification time.
-
- This program was written to illustrate the use of the Z_BLOCK option of
- inflate() and the crc32_combine() function. gzjoin will not compile with
- versions of zlib earlier than 1.2.3.
- */
-
-#include <stdio.h> /* fputs(), fprintf(), fwrite(), putc() */
-#include <stdlib.h> /* exit(), malloc(), free() */
-#include <fcntl.h> /* open() */
-#include <unistd.h> /* close(), read(), lseek() */
-#include "zlib.h"
- /* crc32(), crc32_combine(), inflateInit2(), inflate(), inflateEnd() */
-
-#define local static
-
-/* exit with an error (return a value to allow use in an expression) */
-local int bail(char *why1, char *why2)
-{
- fprintf(stderr, "gzjoin error: %s%s, output incomplete\n", why1, why2);
- exit(1);
- return 0;
-}
-
-/* -- simple buffered file input with access to the buffer -- */
-
-#define CHUNK 32768 /* must be a power of two and fit in unsigned */
-
-/* bin buffered input file type */
-typedef struct {
- char *name; /* name of file for error messages */
- int fd; /* file descriptor */
- unsigned left; /* bytes remaining at next */
- unsigned char *next; /* next byte to read */
- unsigned char *buf; /* allocated buffer of length CHUNK */
-} bin;
-
-/* close a buffered file and free allocated memory */
-local void bclose(bin *in)
-{
- if (in != NULL) {
- if (in->fd != -1)
- close(in->fd);
- if (in->buf != NULL)
- free(in->buf);
- free(in);
- }
-}
-
-/* open a buffered file for input, return a pointer to type bin, or NULL on
- failure */
-local bin *bopen(char *name)
-{
- bin *in;
-
- in = malloc(sizeof(bin));
- if (in == NULL)
- return NULL;
- in->buf = malloc(CHUNK);
- in->fd = open(name, O_RDONLY, 0);
- if (in->buf == NULL || in->fd == -1) {
- bclose(in);
- return NULL;
- }
- in->left = 0;
- in->next = in->buf;
- in->name = name;
- return in;
-}
-
-/* load buffer from file, return -1 on read error, 0 or 1 on success, with
- 1 indicating that end-of-file was reached */
-local int bload(bin *in)
-{
- long len;
-
- if (in == NULL)
- return -1;
- if (in->left != 0)
- return 0;
- in->next = in->buf;
- do {
- len = (long)read(in->fd, in->buf + in->left, CHUNK - in->left);
- if (len < 0)
- return -1;
- in->left += (unsigned)len;
- } while (len != 0 && in->left < CHUNK);
- return len == 0 ? 1 : 0;
-}
-
-/* get a byte from the file, bail if end of file */
-#define bget(in) (in->left ? 0 : bload(in), \
- in->left ? (in->left--, *(in->next)++) : \
- bail("unexpected end of file on ", in->name))
-
-/* get a four-byte little-endian unsigned integer from file */
-local unsigned long bget4(bin *in)
-{
- unsigned long val;
-
- val = bget(in);
- val += (unsigned long)(bget(in)) << 8;
- val += (unsigned long)(bget(in)) << 16;
- val += (unsigned long)(bget(in)) << 24;
- return val;
-}
-
-/* skip bytes in file */
-local void bskip(bin *in, unsigned skip)
-{
- /* check pointer */
- if (in == NULL)
- return;
-
- /* easy case -- skip bytes in buffer */
- if (skip <= in->left) {
- in->left -= skip;
- in->next += skip;
- return;
- }
-
- /* skip what's in buffer, discard buffer contents */
- skip -= in->left;
- in->left = 0;
-
- /* seek past multiples of CHUNK bytes */
- if (skip > CHUNK) {
- unsigned left;
-
- left = skip & (CHUNK - 1);
- if (left == 0) {
- /* exact number of chunks: seek all the way minus one byte to check
- for end-of-file with a read */
- lseek(in->fd, skip - 1, SEEK_CUR);
- if (read(in->fd, in->buf, 1) != 1)
- bail("unexpected end of file on ", in->name);
- return;
- }
-
- /* skip the integral chunks, update skip with remainder */
- lseek(in->fd, skip - left, SEEK_CUR);
- skip = left;
- }
-
- /* read more input and skip remainder */
- bload(in);
- if (skip > in->left)
- bail("unexpected end of file on ", in->name);
- in->left -= skip;
- in->next += skip;
-}
-
-/* -- end of buffered input functions -- */
-
-/* skip the gzip header from file in */
-local void gzhead(bin *in)
-{
- int flags;
-
- /* verify gzip magic header and compression method */
- if (bget(in) != 0x1f || bget(in) != 0x8b || bget(in) != 8)
- bail(in->name, " is not a valid gzip file");
-
- /* get and verify flags */
- flags = bget(in);
- if ((flags & 0xe0) != 0)
- bail("unknown reserved bits set in ", in->name);
-
- /* skip modification time, extra flags, and os */
- bskip(in, 6);
-
- /* skip extra field if present */
- if (flags & 4) {
- unsigned len;
-
- len = bget(in);
- len += (unsigned)(bget(in)) << 8;
- bskip(in, len);
- }
-
- /* skip file name if present */
- if (flags & 8)
- while (bget(in) != 0)
- ;
-
- /* skip comment if present */
- if (flags & 16)
- while (bget(in) != 0)
- ;
-
- /* skip header crc if present */
- if (flags & 2)
- bskip(in, 2);
-}
-
-/* write a four-byte little-endian unsigned integer to out */
-local void put4(unsigned long val, FILE *out)
-{
- putc(val & 0xff, out);
- putc((val >> 8) & 0xff, out);
- putc((val >> 16) & 0xff, out);
- putc((val >> 24) & 0xff, out);
-}
-
-/* Load up zlib stream from buffered input, bail if end of file */
-local void zpull(z_streamp strm, bin *in)
-{
- if (in->left == 0)
- bload(in);
- if (in->left == 0)
- bail("unexpected end of file on ", in->name);
- strm->avail_in = in->left;
- strm->next_in = in->next;
-}
-
-/* Write header for gzip file to out and initialize trailer. */
-local void gzinit(unsigned long *crc, unsigned long *tot, FILE *out)
-{
- fwrite("\x1f\x8b\x08\0\0\0\0\0\0\xff", 1, 10, out);
- *crc = crc32(0L, Z_NULL, 0);
- *tot = 0;
-}
-
-/* Copy the compressed data from name, zeroing the last block bit of the last
- block if clr is true, and adding empty blocks as needed to get to a byte
- boundary. If clr is false, then the last block becomes the last block of
- the output, and the gzip trailer is written. crc and tot maintains the
- crc and length (modulo 2^32) of the output for the trailer. The resulting
- gzip file is written to out. gzinit() must be called before the first call
- of gzcopy() to write the gzip header and to initialize crc and tot. */
-local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot,
- FILE *out)
-{
- int ret; /* return value from zlib functions */
- int pos; /* where the "last block" bit is in byte */
- int last; /* true if processing the last block */
- bin *in; /* buffered input file */
- unsigned char *start; /* start of compressed data in buffer */
- unsigned char *junk; /* buffer for uncompressed data -- discarded */
- z_off_t len; /* length of uncompressed data (support > 4 GB) */
- z_stream strm; /* zlib inflate stream */
-
- /* open gzip file and skip header */
- in = bopen(name);
- if (in == NULL)
- bail("could not open ", name);
- gzhead(in);
-
- /* allocate buffer for uncompressed data and initialize raw inflate
- stream */
- junk = malloc(CHUNK);
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- ret = inflateInit2(&strm, -15);
- if (junk == NULL || ret != Z_OK)
- bail("out of memory", "");
-
- /* inflate and copy compressed data, clear last-block bit if requested */
- len = 0;
- zpull(&strm, in);
- start = strm.next_in;
- last = start[0] & 1;
- if (last && clr)
- start[0] &= ~1;
- strm.avail_out = 0;
- for (;;) {
- /* if input used and output done, write used input and get more */
- if (strm.avail_in == 0 && strm.avail_out != 0) {
- fwrite(start, 1, strm.next_in - start, out);
- start = in->buf;
- in->left = 0;
- zpull(&strm, in);
- }
-
- /* decompress -- return early when end-of-block reached */
- strm.avail_out = CHUNK;
- strm.next_out = junk;
- ret = inflate(&strm, Z_BLOCK);
- switch (ret) {
- case Z_MEM_ERROR:
- bail("out of memory", "");
- case Z_DATA_ERROR:
- bail("invalid compressed data in ", in->name);
- }
-
- /* update length of uncompressed data */
- len += CHUNK - strm.avail_out;
-
- /* check for block boundary (only get this when block copied out) */
- if (strm.data_type & 128) {
- /* if that was the last block, then done */
- if (last)
- break;
-
- /* number of unused bits in last byte */
- pos = strm.data_type & 7;
-
- /* find the next last-block bit */
- if (pos != 0) {
- /* next last-block bit is in last used byte */
- pos = 0x100 >> pos;
- last = strm.next_in[-1] & pos;
- if (last && clr)
- strm.next_in[-1] &= ~pos;
- }
- else {
- /* next last-block bit is in next unused byte */
- if (strm.avail_in == 0) {
- /* don't have that byte yet -- get it */
- fwrite(start, 1, strm.next_in - start, out);
- start = in->buf;
- in->left = 0;
- zpull(&strm, in);
- }
- last = strm.next_in[0] & 1;
- if (last && clr)
- strm.next_in[0] &= ~1;
- }
- }
- }
-
- /* update buffer with unused input */
- in->left = strm.avail_in;
- in->next = strm.next_in;
-
- /* copy used input, write empty blocks to get to byte boundary */
- pos = strm.data_type & 7;
- fwrite(start, 1, in->next - start - 1, out);
- last = in->next[-1];
- if (pos == 0 || !clr)
- /* already at byte boundary, or last file: write last byte */
- putc(last, out);
- else {
- /* append empty blocks to last byte */
- last &= ((0x100 >> pos) - 1); /* assure unused bits are zero */
- if (pos & 1) {
- /* odd -- append an empty stored block */
- putc(last, out);
- if (pos == 1)
- putc(0, out); /* two more bits in block header */
- fwrite("\0\0\xff\xff", 1, 4, out);
- }
- else {
- /* even -- append 1, 2, or 3 empty fixed blocks */
- switch (pos) {
- case 6:
- putc(last | 8, out);
- last = 0;
- case 4:
- putc(last | 0x20, out);
- last = 0;
- case 2:
- putc(last | 0x80, out);
- putc(0, out);
- }
- }
- }
-
- /* update crc and tot */
- *crc = crc32_combine(*crc, bget4(in), len);
- *tot += (unsigned long)len;
-
- /* clean up */
- inflateEnd(&strm);
- free(junk);
- bclose(in);
-
- /* write trailer if this is the last gzip file */
- if (!clr) {
- put4(*crc, out);
- put4(*tot, out);
- }
-}
-
-/* join the gzip files on the command line, write result to stdout */
-int main(int argc, char **argv)
-{
- unsigned long crc, tot; /* running crc and total uncompressed length */
-
- /* skip command name */
- argc--;
- argv++;
-
- /* show usage if no arguments */
- if (argc == 0) {
- fputs("gzjoin usage: gzjoin f1.gz [f2.gz [f3.gz ...]] > fjoin.gz\n",
- stderr);
- return 0;
- }
-
- /* join gzip files on command line and write to stdout */
- gzinit(&crc, &tot, stdout);
- while (argc--)
- gzcopy(*argv++, argc, &crc, &tot, stdout);
-
- /* done */
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/examples/gzlog.c b/funtools/util/zlib-1.2.3/examples/gzlog.c
deleted file mode 100644
index f71f817..0000000
--- a/funtools/util/zlib-1.2.3/examples/gzlog.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * gzlog.c
- * Copyright (C) 2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in gzlog.h
- * version 1.0, 26 Nov 2004
- *
- */
-
-#include <string.h> /* memcmp() */
-#include <stdlib.h> /* malloc(), free(), NULL */
-#include <sys/types.h> /* size_t, off_t */
-#include <unistd.h> /* read(), close(), sleep(), ftruncate(), */
- /* lseek() */
-#include <fcntl.h> /* open() */
-#include <sys/file.h> /* flock() */
-#include "zlib.h" /* deflateInit2(), deflate(), deflateEnd() */
-
-#include "gzlog.h" /* interface */
-#define local static
-
-/* log object structure */
-typedef struct {
- int id; /* object identifier */
- int fd; /* log file descriptor */
- off_t extra; /* offset of extra "ap" subfield */
- off_t mark_off; /* offset of marked data */
- off_t last_off; /* offset of last block */
- unsigned long crc; /* uncompressed crc */
- unsigned long len; /* uncompressed length (modulo 2^32) */
- unsigned stored; /* length of current stored block */
-} gz_log;
-
-#define GZLOGID 19334 /* gz_log object identifier */
-
-#define LOCK_RETRY 1 /* retry lock once a second */
-#define LOCK_PATIENCE 1200 /* try about twenty minutes before forcing */
-
-/* acquire a lock on a file */
-local int lock(int fd)
-{
- int patience;
-
- /* try to lock every LOCK_RETRY seconds for LOCK_PATIENCE seconds */
- patience = LOCK_PATIENCE;
- do {
- if (flock(fd, LOCK_EX + LOCK_NB) == 0)
- return 0;
- (void)sleep(LOCK_RETRY);
- patience -= LOCK_RETRY;
- } while (patience > 0);
-
- /* we've run out of patience -- give up */
- return -1;
-}
-
-/* release lock */
-local void unlock(int fd)
-{
- (void)flock(fd, LOCK_UN);
-}
-
-/* release a log object */
-local void log_clean(gz_log *log)
-{
- unlock(log->fd);
- (void)close(log->fd);
- free(log);
-}
-
-/* read an unsigned long from a byte buffer little-endian */
-local unsigned long make_ulg(unsigned char *buf)
-{
- int n;
- unsigned long val;
-
- val = (unsigned long)(*buf++);
- for (n = 8; n < 32; n += 8)
- val += (unsigned long)(*buf++) << n;
- return val;
-}
-
-/* read an off_t from a byte buffer little-endian */
-local off_t make_off(unsigned char *buf)
-{
- int n;
- off_t val;
-
- val = (off_t)(*buf++);
- for (n = 8; n < 64; n += 8)
- val += (off_t)(*buf++) << n;
- return val;
-}
-
-/* write an unsigned long little-endian to byte buffer */
-local void dice_ulg(unsigned long val, unsigned char *buf)
-{
- int n;
-
- for (n = 0; n < 4; n++) {
- *buf++ = val & 0xff;
- val >>= 8;
- }
-}
-
-/* write an off_t little-endian to byte buffer */
-local void dice_off(off_t val, unsigned char *buf)
-{
- int n;
-
- for (n = 0; n < 8; n++) {
- *buf++ = val & 0xff;
- val >>= 8;
- }
-}
-
-/* initial, empty gzip file for appending */
-local char empty_gz[] = {
- 0x1f, 0x8b, /* magic gzip id */
- 8, /* compression method is deflate */
- 4, /* there is an extra field */
- 0, 0, 0, 0, /* no modification time provided */
- 0, 0xff, /* no extra flags, no OS */
- 20, 0, 'a', 'p', 16, 0, /* extra field with "ap" subfield */
- 32, 0, 0, 0, 0, 0, 0, 0, /* offset of uncompressed data */
- 32, 0, 0, 0, 0, 0, 0, 0, /* offset of last block */
- 1, 0, 0, 0xff, 0xff, /* empty stored block (last) */
- 0, 0, 0, 0, /* crc */
- 0, 0, 0, 0 /* uncompressed length */
-};
-
-/* initialize a log object with locking */
-void *gzlog_open(char *path)
-{
- unsigned xlen;
- unsigned char temp[20];
- unsigned sub_len;
- int good;
- gz_log *log;
-
- /* allocate log structure */
- log = malloc(sizeof(gz_log));
- if (log == NULL)
- return NULL;
- log->id = GZLOGID;
-
- /* open file, creating it if necessary, and locking it */
- log->fd = open(path, O_RDWR | O_CREAT, 0600);
- if (log->fd < 0) {
- free(log);
- return NULL;
- }
- if (lock(log->fd)) {
- close(log->fd);
- free(log);
- return NULL;
- }
-
- /* if file is empty, write new gzip stream */
- if (lseek(log->fd, 0, SEEK_END) == 0) {
- if (write(log->fd, empty_gz, sizeof(empty_gz)) != sizeof(empty_gz)) {
- log_clean(log);
- return NULL;
- }
- }
-
- /* check gzip header */
- (void)lseek(log->fd, 0, SEEK_SET);
- if (read(log->fd, temp, 12) != 12 || temp[0] != 0x1f ||
- temp[1] != 0x8b || temp[2] != 8 || (temp[3] & 4) == 0) {
- log_clean(log);
- return NULL;
- }
-
- /* process extra field to find "ap" sub-field */
- xlen = temp[10] + (temp[11] << 8);
- good = 0;
- while (xlen) {
- if (xlen < 4 || read(log->fd, temp, 4) != 4)
- break;
- sub_len = temp[2];
- sub_len += temp[3] << 8;
- xlen -= 4;
- if (memcmp(temp, "ap", 2) == 0 && sub_len == 16) {
- good = 1;
- break;
- }
- if (xlen < sub_len)
- break;
- (void)lseek(log->fd, sub_len, SEEK_CUR);
- xlen -= sub_len;
- }
- if (!good) {
- log_clean(log);
- return NULL;
- }
-
- /* read in "ap" sub-field */
- log->extra = lseek(log->fd, 0, SEEK_CUR);
- if (read(log->fd, temp, 16) != 16) {
- log_clean(log);
- return NULL;
- }
- log->mark_off = make_off(temp);
- log->last_off = make_off(temp + 8);
-
- /* get crc, length of gzip file */
- (void)lseek(log->fd, log->last_off, SEEK_SET);
- if (read(log->fd, temp, 13) != 13 ||
- memcmp(temp, "\001\000\000\377\377", 5) != 0) {
- log_clean(log);
- return NULL;
- }
- log->crc = make_ulg(temp + 5);
- log->len = make_ulg(temp + 9);
-
- /* set up to write over empty last block */
- (void)lseek(log->fd, log->last_off + 5, SEEK_SET);
- log->stored = 0;
- return (void *)log;
-}
-
-/* maximum amount to put in a stored block before starting a new one */
-#define MAX_BLOCK 16384
-
-/* write a block to a log object */
-int gzlog_write(void *obj, char *data, size_t len)
-{
- size_t some;
- unsigned char temp[5];
- gz_log *log;
-
- /* check object */
- log = (gz_log *)obj;
- if (log == NULL || log->id != GZLOGID)
- return 1;
-
- /* write stored blocks until all of the input is written */
- do {
- some = MAX_BLOCK - log->stored;
- if (some > len)
- some = len;
- if (write(log->fd, data, some) != some)
- return 1;
- log->crc = crc32(log->crc, data, some);
- log->len += some;
- len -= some;
- data += some;
- log->stored += some;
-
- /* if the stored block is full, end it and start another */
- if (log->stored == MAX_BLOCK) {
- (void)lseek(log->fd, log->last_off, SEEK_SET);
- temp[0] = 0;
- dice_ulg(log->stored + ((unsigned long)(~log->stored) << 16),
- temp + 1);
- if (write(log->fd, temp, 5) != 5)
- return 1;
- log->last_off = lseek(log->fd, log->stored, SEEK_CUR);
- (void)lseek(log->fd, 5, SEEK_CUR);
- log->stored = 0;
- }
- } while (len);
- return 0;
-}
-
-/* recompress the remaining stored deflate data in place */
-local int recomp(gz_log *log)
-{
- z_stream strm;
- size_t len, max;
- unsigned char *in;
- unsigned char *out;
- unsigned char temp[16];
-
- /* allocate space and read it all in (it's around 1 MB) */
- len = log->last_off - log->mark_off;
- max = len + (len >> 12) + (len >> 14) + 11;
- out = malloc(max);
- if (out == NULL)
- return 1;
- in = malloc(len);
- if (in == NULL) {
- free(out);
- return 1;
- }
- (void)lseek(log->fd, log->mark_off, SEEK_SET);
- if (read(log->fd, in, len) != len) {
- free(in);
- free(out);
- return 1;
- }
-
- /* recompress in memory, decoding stored data as we go */
- /* note: this assumes that unsigned is four bytes or more */
- /* consider not making that assumption */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- if (deflateInit2(&strm, Z_BEST_COMPRESSION, Z_DEFLATED, -15, 8,
- Z_DEFAULT_STRATEGY) != Z_OK) {
- free(in);
- free(out);
- return 1;
- }
- strm.next_in = in;
- strm.avail_out = max;
- strm.next_out = out;
- while (len >= 5) {
- if (strm.next_in[0] != 0)
- break;
- strm.avail_in = strm.next_in[1] + (strm.next_in[2] << 8);
- strm.next_in += 5;
- len -= 5;
- if (strm.avail_in != 0) {
- if (len < strm.avail_in)
- break;
- len -= strm.avail_in;
- (void)deflate(&strm, Z_NO_FLUSH);
- if (strm.avail_in != 0 || strm.avail_out == 0)
- break;
- }
- }
- (void)deflate(&strm, Z_SYNC_FLUSH);
- (void)deflateEnd(&strm);
- free(in);
- if (len != 0 || strm.avail_out == 0) {
- free(out);
- return 1;
- }
-
- /* overwrite stored data with compressed data */
- (void)lseek(log->fd, log->mark_off, SEEK_SET);
- len = max - strm.avail_out;
- if (write(log->fd, out, len) != len) {
- free(out);
- return 1;
- }
- free(out);
-
- /* write last empty block, crc, and length */
- log->mark_off = log->last_off = lseek(log->fd, 0, SEEK_CUR);
- temp[0] = 1;
- dice_ulg(0xffffL << 16, temp + 1);
- dice_ulg(log->crc, temp + 5);
- dice_ulg(log->len, temp + 9);
- if (write(log->fd, temp, 13) != 13)
- return 1;
-
- /* truncate file to discard remaining stored data and old trailer */
- ftruncate(log->fd, lseek(log->fd, 0, SEEK_CUR));
-
- /* update extra field to point to new last empty block */
- (void)lseek(log->fd, log->extra, SEEK_SET);
- dice_off(log->mark_off, temp);
- dice_off(log->last_off, temp + 8);
- if (write(log->fd, temp, 16) != 16)
- return 1;
- return 0;
-}
-
-/* maximum accumulation of stored blocks before compressing */
-#define MAX_STORED 1048576
-
-/* close log object */
-int gzlog_close(void *obj)
-{
- unsigned char temp[8];
- gz_log *log;
-
- /* check object */
- log = (gz_log *)obj;
- if (log == NULL || log->id != GZLOGID)
- return 1;
-
- /* go to start of most recent block being written */
- (void)lseek(log->fd, log->last_off, SEEK_SET);
-
- /* if some stuff was put there, update block */
- if (log->stored) {
- temp[0] = 0;
- dice_ulg(log->stored + ((unsigned long)(~log->stored) << 16),
- temp + 1);
- if (write(log->fd, temp, 5) != 5)
- return 1;
- log->last_off = lseek(log->fd, log->stored, SEEK_CUR);
- }
-
- /* write last block (empty) */
- if (write(log->fd, "\001\000\000\377\377", 5) != 5)
- return 1;
-
- /* write updated crc and uncompressed length */
- dice_ulg(log->crc, temp);
- dice_ulg(log->len, temp + 4);
- if (write(log->fd, temp, 8) != 8)
- return 1;
-
- /* put offset of that last block in gzip extra block */
- (void)lseek(log->fd, log->extra + 8, SEEK_SET);
- dice_off(log->last_off, temp);
- if (write(log->fd, temp, 8) != 8)
- return 1;
-
- /* if more than 1 MB stored, then time to compress it */
- if (log->last_off - log->mark_off > MAX_STORED) {
- if (recomp(log))
- return 1;
- }
-
- /* unlock and close file */
- log_clean(log);
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/examples/gzlog.h b/funtools/util/zlib-1.2.3/examples/gzlog.h
deleted file mode 100644
index a800bd5..0000000
--- a/funtools/util/zlib-1.2.3/examples/gzlog.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* gzlog.h
- Copyright (C) 2004 Mark Adler, all rights reserved
- version 1.0, 26 Nov 2004
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Mark Adler madler@alumni.caltech.edu
- */
-
-/*
- The gzlog object allows writing short messages to a gzipped log file,
- opening the log file locked for small bursts, and then closing it. The log
- object works by appending stored data to the gzip file until 1 MB has been
- accumulated. At that time, the stored data is compressed, and replaces the
- uncompressed data in the file. The log file is truncated to its new size at
- that time. After closing, the log file is always valid gzip file that can
- decompressed to recover what was written.
-
- A gzip header "extra" field contains two file offsets for appending. The
- first points to just after the last compressed data. The second points to
- the last stored block in the deflate stream, which is empty. All of the
- data between those pointers is uncompressed.
- */
-
-/* Open a gzlog object, creating the log file if it does not exist. Return
- NULL on error. Note that gzlog_open() could take a long time to return if
- there is difficulty in locking the file. */
-void *gzlog_open(char *path);
-
-/* Write to a gzlog object. Return non-zero on error. This function will
- simply write data to the file uncompressed. Compression of the data
- will not occur until gzlog_close() is called. It is expected that
- gzlog_write() is used for a short message, and then gzlog_close() is
- called. If a large amount of data is to be written, then the application
- should write no more than 1 MB at a time with gzlog_write() before
- calling gzlog_close() and then gzlog_open() again. */
-int gzlog_write(void *log, char *data, size_t len);
-
-/* Close a gzlog object. Return non-zero on error. The log file is locked
- until this function is called. This function will compress stored data
- at the end of the gzip file if at least 1 MB has been accumulated. Note
- that the file will not be a valid gzip file until this function completes.
- */
-int gzlog_close(void *log);
diff --git a/funtools/util/zlib-1.2.3/examples/zlib_how.html b/funtools/util/zlib-1.2.3/examples/zlib_how.html
deleted file mode 100644
index 40998db..0000000
--- a/funtools/util/zlib-1.2.3/examples/zlib_how.html
+++ /dev/null
@@ -1,523 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
- "http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>zlib Usage Example</title>
-<!-- Copyright (c) 2004 Mark Adler. -->
-</head>
-<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#00A000">
-<h2 align="center"> zlib Usage Example </h2>
-We often get questions about how the <tt>deflate()</tt> and <tt>inflate()</tt> functions should be used.
-Users wonder when they should provide more input, when they should use more output,
-what to do with a <tt>Z_BUF_ERROR</tt>, how to make sure the process terminates properly, and
-so on. So for those who have read <tt>zlib.h</tt> (a few times), and
-would like further edification, below is an annotated example in C of simple routines to compress and decompress
-from an input file to an output file using <tt>deflate()</tt> and <tt>inflate()</tt> respectively. The
-annotations are interspersed between lines of the code. So please read between the lines.
-We hope this helps explain some of the intricacies of <em>zlib</em>.
-<p>
-Without further adieu, here is the program <a href="zpipe.c"><tt>zpipe.c</tt></a>:
-<pre><b>
-/* zpipe.c: example of proper use of zlib's inflate() and deflate()
- Not copyrighted -- provided to the public domain
- Version 1.2 9 November 2004 Mark Adler */
-
-/* Version history:
- 1.0 30 Oct 2004 First version
- 1.1 8 Nov 2004 Add void casting for unused return values
- Use switch statement for inflate() return values
- 1.2 9 Nov 2004 Add assertions to document zlib guarantees
- */
-</b></pre><!-- -->
-We now include the header files for the required definitions. From
-<tt>stdio.h</tt> we use <tt>fopen()</tt>, <tt>fread()</tt>, <tt>fwrite()</tt>,
-<tt>feof()</tt>, <tt>ferror()</tt>, and <tt>fclose()</tt> for file i/o, and
-<tt>fputs()</tt> for error messages. From <tt>string.h</tt> we use
-<tt>strcmp()</tt> for command line argument processing.
-From <tt>assert.h</tt> we use the <tt>assert()</tt> macro.
-From <tt>zlib.h</tt>
-we use the basic compression functions <tt>deflateInit()</tt>,
-<tt>deflate()</tt>, and <tt>deflateEnd()</tt>, and the basic decompression
-functions <tt>inflateInit()</tt>, <tt>inflate()</tt>, and
-<tt>inflateEnd()</tt>.
-<pre><b>
-#include &lt;stdio.h&gt;
-#include &lt;string.h&gt;
-#include &lt;assert.h&gt;
-#include "zlib.h"
-</b></pre><!-- -->
-<tt>CHUNK</tt> is simply the buffer size for feeding data to and pulling data
-from the <em>zlib</em> routines. Larger buffer sizes would be more efficient,
-especially for <tt>inflate()</tt>. If the memory is available, buffers sizes
-on the order of 128K or 256K bytes should be used.
-<pre><b>
-#define CHUNK 16384
-</b></pre><!-- -->
-The <tt>def()</tt> routine compresses data from an input file to an output file. The output data
-will be in the <em>zlib</em> format, which is different from the <em>gzip</em> or <em>zip</em>
-formats. The <em>zlib</em> format has a very small header of only two bytes to identify it as
-a <em>zlib</em> stream and to provide decoding information, and a four-byte trailer with a fast
-check value to verify the integrity of the uncompressed data after decoding.
-<pre><b>
-/* Compress from file source to file dest until EOF on source.
- def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
- allocated for processing, Z_STREAM_ERROR if an invalid compression
- level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
- version of the library linked do not match, or Z_ERRNO if there is
- an error reading or writing the files. */
-int def(FILE *source, FILE *dest, int level)
-{
-</b></pre>
-Here are the local variables for <tt>def()</tt>. <tt>ret</tt> will be used for <em>zlib</em>
-return codes. <tt>flush</tt> will keep track of the current flushing state for <tt>deflate()</tt>,
-which is either no flushing, or flush to completion after the end of the input file is reached.
-<tt>have</tt> is the amount of data returned from <tt>deflate()</tt>. The <tt>strm</tt> structure
-is used to pass information to and from the <em>zlib</em> routines, and to maintain the
-<tt>deflate()</tt> state. <tt>in</tt> and <tt>out</tt> are the input and output buffers for
-<tt>deflate()</tt>.
-<pre><b>
- int ret, flush;
- unsigned have;
- z_stream strm;
- char in[CHUNK];
- char out[CHUNK];
-</b></pre><!-- -->
-The first thing we do is to initialize the <em>zlib</em> state for compression using
-<tt>deflateInit()</tt>. This must be done before the first use of <tt>deflate()</tt>.
-The <tt>zalloc</tt>, <tt>zfree</tt>, and <tt>opaque</tt> fields in the <tt>strm</tt>
-structure must be initialized before calling <tt>deflateInit()</tt>. Here they are
-set to the <em>zlib</em> constant <tt>Z_NULL</tt> to request that <em>zlib</em> use
-the default memory allocation routines. An application may also choose to provide
-custom memory allocation routines here. <tt>deflateInit()</tt> will allocate on the
-order of 256K bytes for the internal state.
-(See <a href="zlib_tech.html"><em>zlib Technical Details</em></a>.)
-<p>
-<tt>deflateInit()</tt> is called with a pointer to the structure to be initialized and
-the compression level, which is an integer in the range of -1 to 9. Lower compression
-levels result in faster execution, but less compression. Higher levels result in
-greater compression, but slower execution. The <em>zlib</em> constant Z_DEFAULT_COMPRESSION,
-equal to -1,
-provides a good compromise between compression and speed and is equivalent to level 6.
-Level 0 actually does no compression at all, and in fact expands the data slightly to produce
-the <em>zlib</em> format (it is not a byte-for-byte copy of the input).
-More advanced applications of <em>zlib</em>
-may use <tt>deflateInit2()</tt> here instead. Such an application may want to reduce how
-much memory will be used, at some price in compression. Or it may need to request a
-<em>gzip</em> header and trailer instead of a <em>zlib</em> header and trailer, or raw
-encoding with no header or trailer at all.
-<p>
-We must check the return value of <tt>deflateInit()</tt> against the <em>zlib</em> constant
-<tt>Z_OK</tt> to make sure that it was able to
-allocate memory for the internal state, and that the provided arguments were valid.
-<tt>deflateInit()</tt> will also check that the version of <em>zlib</em> that the <tt>zlib.h</tt>
-file came from matches the version of <em>zlib</em> actually linked with the program. This
-is especially important for environments in which <em>zlib</em> is a shared library.
-<p>
-Note that an application can initialize multiple, independent <em>zlib</em> streams, which can
-operate in parallel. The state information maintained in the structure allows the <em>zlib</em>
-routines to be reentrant.
-<pre><b>
- /* allocate deflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- ret = deflateInit(&amp;strm, level);
- if (ret != Z_OK)
- return ret;
-</b></pre><!-- -->
-With the pleasantries out of the way, now we can get down to business. The outer <tt>do</tt>-loop
-reads all of the input file and exits at the bottom of the loop once end-of-file is reached.
-This loop contains the only call of <tt>deflate()</tt>. So we must make sure that all of the
-input data has been processed and that all of the output data has been generated and consumed
-before we fall out of the loop at the bottom.
-<pre><b>
- /* compress until end of file */
- do {
-</b></pre>
-We start off by reading data from the input file. The number of bytes read is put directly
-into <tt>avail_in</tt>, and a pointer to those bytes is put into <tt>next_in</tt>. We also
-check to see if end-of-file on the input has been reached. If we are at the end of file, then <tt>flush</tt> is set to the
-<em>zlib</em> constant <tt>Z_FINISH</tt>, which is later passed to <tt>deflate()</tt> to
-indicate that this is the last chunk of input data to compress. We need to use <tt>feof()</tt>
-to check for end-of-file as opposed to seeing if fewer than <tt>CHUNK</tt> bytes have been read. The
-reason is that if the input file length is an exact multiple of <tt>CHUNK</tt>, we will miss
-the fact that we got to the end-of-file, and not know to tell <tt>deflate()</tt> to finish
-up the compressed stream. If we are not yet at the end of the input, then the <em>zlib</em>
-constant <tt>Z_NO_FLUSH</tt> will be passed to <tt>deflate</tt> to indicate that we are still
-in the middle of the uncompressed data.
-<p>
-If there is an error in reading from the input file, the process is aborted with
-<tt>deflateEnd()</tt> being called to free the allocated <em>zlib</em> state before returning
-the error. We wouldn't want a memory leak, now would we? <tt>deflateEnd()</tt> can be called
-at any time after the state has been initialized. Once that's done, <tt>deflateInit()</tt> (or
-<tt>deflateInit2()</tt>) would have to be called to start a new compression process. There is
-no point here in checking the <tt>deflateEnd()</tt> return code. The deallocation can't fail.
-<pre><b>
- strm.avail_in = fread(in, 1, CHUNK, source);
- if (ferror(source)) {
- (void)deflateEnd(&amp;strm);
- return Z_ERRNO;
- }
- flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
- strm.next_in = in;
-</b></pre><!-- -->
-The inner <tt>do</tt>-loop passes our chunk of input data to <tt>deflate()</tt>, and then
-keeps calling <tt>deflate()</tt> until it is done producing output. Once there is no more
-new output, <tt>deflate()</tt> is guaranteed to have consumed all of the input, i.e.,
-<tt>avail_in</tt> will be zero.
-<pre><b>
- /* run deflate() on input until output buffer not full, finish
- compression if all of source has been read in */
- do {
-</b></pre>
-Output space is provided to <tt>deflate()</tt> by setting <tt>avail_out</tt> to the number
-of available output bytes and <tt>next_out</tt> to a pointer to that space.
-<pre><b>
- strm.avail_out = CHUNK;
- strm.next_out = out;
-</b></pre>
-Now we call the compression engine itself, <tt>deflate()</tt>. It takes as many of the
-<tt>avail_in</tt> bytes at <tt>next_in</tt> as it can process, and writes as many as
-<tt>avail_out</tt> bytes to <tt>next_out</tt>. Those counters and pointers are then
-updated past the input data consumed and the output data written. It is the amount of
-output space available that may limit how much input is consumed.
-Hence the inner loop to make sure that
-all of the input is consumed by providing more output space each time. Since <tt>avail_in</tt>
-and <tt>next_in</tt> are updated by <tt>deflate()</tt>, we don't have to mess with those
-between <tt>deflate()</tt> calls until it's all used up.
-<p>
-The parameters to <tt>deflate()</tt> are a pointer to the <tt>strm</tt> structure containing
-the input and output information and the internal compression engine state, and a parameter
-indicating whether and how to flush data to the output. Normally <tt>deflate</tt> will consume
-several K bytes of input data before producing any output (except for the header), in order
-to accumulate statistics on the data for optimum compression. It will then put out a burst of
-compressed data, and proceed to consume more input before the next burst. Eventually,
-<tt>deflate()</tt>
-must be told to terminate the stream, complete the compression with provided input data, and
-write out the trailer check value. <tt>deflate()</tt> will continue to compress normally as long
-as the flush parameter is <tt>Z_NO_FLUSH</tt>. Once the <tt>Z_FINISH</tt> parameter is provided,
-<tt>deflate()</tt> will begin to complete the compressed output stream. However depending on how
-much output space is provided, <tt>deflate()</tt> may have to be called several times until it
-has provided the complete compressed stream, even after it has consumed all of the input. The flush
-parameter must continue to be <tt>Z_FINISH</tt> for those subsequent calls.
-<p>
-There are other values of the flush parameter that are used in more advanced applications. You can
-force <tt>deflate()</tt> to produce a burst of output that encodes all of the input data provided
-so far, even if it wouldn't have otherwise, for example to control data latency on a link with
-compressed data. You can also ask that <tt>deflate()</tt> do that as well as erase any history up to
-that point so that what follows can be decompressed independently, for example for random access
-applications. Both requests will degrade compression by an amount depending on how often such
-requests are made.
-<p>
-<tt>deflate()</tt> has a return value that can indicate errors, yet we do not check it here. Why
-not? Well, it turns out that <tt>deflate()</tt> can do no wrong here. Let's go through
-<tt>deflate()</tt>'s return values and dispense with them one by one. The possible values are
-<tt>Z_OK</tt>, <tt>Z_STREAM_END</tt>, <tt>Z_STREAM_ERROR</tt>, or <tt>Z_BUF_ERROR</tt>. <tt>Z_OK</tt>
-is, well, ok. <tt>Z_STREAM_END</tt> is also ok and will be returned for the last call of
-<tt>deflate()</tt>. This is already guaranteed by calling <tt>deflate()</tt> with <tt>Z_FINISH</tt>
-until it has no more output. <tt>Z_STREAM_ERROR</tt> is only possible if the stream is not
-initialized properly, but we did initialize it properly. There is no harm in checking for
-<tt>Z_STREAM_ERROR</tt> here, for example to check for the possibility that some
-other part of the application inadvertently clobbered the memory containing the <em>zlib</em> state.
-<tt>Z_BUF_ERROR</tt> will be explained further below, but
-suffice it to say that this is simply an indication that <tt>deflate()</tt> could not consume
-more input or produce more output. <tt>deflate()</tt> can be called again with more output space
-or more available input, which it will be in this code.
-<pre><b>
- ret = deflate(&amp;strm, flush); /* no bad return value */
- assert(ret != Z_STREAM_ERROR); /* state not clobbered */
-</b></pre>
-Now we compute how much output <tt>deflate()</tt> provided on the last call, which is the
-difference between how much space was provided before the call, and how much output space
-is still available after the call. Then that data, if any, is written to the output file.
-We can then reuse the output buffer for the next call of <tt>deflate()</tt>. Again if there
-is a file i/o error, we call <tt>deflateEnd()</tt> before returning to avoid a memory leak.
-<pre><b>
- have = CHUNK - strm.avail_out;
- if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
- (void)deflateEnd(&amp;strm);
- return Z_ERRNO;
- }
-</b></pre>
-The inner <tt>do</tt>-loop is repeated until the last <tt>deflate()</tt> call fails to fill the
-provided output buffer. Then we know that <tt>deflate()</tt> has done as much as it can with
-the provided input, and that all of that input has been consumed. We can then fall out of this
-loop and reuse the input buffer.
-<p>
-The way we tell that <tt>deflate()</tt> has no more output is by seeing that it did not fill
-the output buffer, leaving <tt>avail_out</tt> greater than zero. However suppose that
-<tt>deflate()</tt> has no more output, but just so happened to exactly fill the output buffer!
-<tt>avail_out</tt> is zero, and we can't tell that <tt>deflate()</tt> has done all it can.
-As far as we know, <tt>deflate()</tt>
-has more output for us. So we call it again. But now <tt>deflate()</tt> produces no output
-at all, and <tt>avail_out</tt> remains unchanged as <tt>CHUNK</tt>. That <tt>deflate()</tt> call
-wasn't able to do anything, either consume input or produce output, and so it returns
-<tt>Z_BUF_ERROR</tt>. (See, I told you I'd cover this later.) However this is not a problem at
-all. Now we finally have the desired indication that <tt>deflate()</tt> is really done,
-and so we drop out of the inner loop to provide more input to <tt>deflate()</tt>.
-<p>
-With <tt>flush</tt> set to <tt>Z_FINISH</tt>, this final set of <tt>deflate()</tt> calls will
-complete the output stream. Once that is done, subsequent calls of <tt>deflate()</tt> would return
-<tt>Z_STREAM_ERROR</tt> if the flush parameter is not <tt>Z_FINISH</tt>, and do no more processing
-until the state is reinitialized.
-<p>
-Some applications of <em>zlib</em> have two loops that call <tt>deflate()</tt>
-instead of the single inner loop we have here. The first loop would call
-without flushing and feed all of the data to <tt>deflate()</tt>. The second loop would call
-<tt>deflate()</tt> with no more
-data and the <tt>Z_FINISH</tt> parameter to complete the process. As you can see from this
-example, that can be avoided by simply keeping track of the current flush state.
-<pre><b>
- } while (strm.avail_out == 0);
- assert(strm.avail_in == 0); /* all input will be used */
-</b></pre><!-- -->
-Now we check to see if we have already processed all of the input file. That information was
-saved in the <tt>flush</tt> variable, so we see if that was set to <tt>Z_FINISH</tt>. If so,
-then we're done and we fall out of the outer loop. We're guaranteed to get <tt>Z_STREAM_END</tt>
-from the last <tt>deflate()</tt> call, since we ran it until the last chunk of input was
-consumed and all of the output was generated.
-<pre><b>
- /* done when last data in file processed */
- } while (flush != Z_FINISH);
- assert(ret == Z_STREAM_END); /* stream will be complete */
-</b></pre><!-- -->
-The process is complete, but we still need to deallocate the state to avoid a memory leak
-(or rather more like a memory hemorrhage if you didn't do this). Then
-finally we can return with a happy return value.
-<pre><b>
- /* clean up and return */
- (void)deflateEnd(&amp;strm);
- return Z_OK;
-}
-</b></pre><!-- -->
-Now we do the same thing for decompression in the <tt>inf()</tt> routine. <tt>inf()</tt>
-decompresses what is hopefully a valid <em>zlib</em> stream from the input file and writes the
-uncompressed data to the output file. Much of the discussion above for <tt>def()</tt>
-applies to <tt>inf()</tt> as well, so the discussion here will focus on the differences between
-the two.
-<pre><b>
-/* Decompress from file source to file dest until stream ends or EOF.
- inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
- allocated for processing, Z_DATA_ERROR if the deflate data is
- invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
- the version of the library linked do not match, or Z_ERRNO if there
- is an error reading or writing the files. */
-int inf(FILE *source, FILE *dest)
-{
-</b></pre>
-The local variables have the same functionality as they do for <tt>def()</tt>. The
-only difference is that there is no <tt>flush</tt> variable, since <tt>inflate()</tt>
-can tell from the <em>zlib</em> stream itself when the stream is complete.
-<pre><b>
- int ret;
- unsigned have;
- z_stream strm;
- char in[CHUNK];
- char out[CHUNK];
-</b></pre><!-- -->
-The initialization of the state is the same, except that there is no compression level,
-of course, and two more elements of the structure are initialized. <tt>avail_in</tt>
-and <tt>next_in</tt> must be initialized before calling <tt>inflateInit()</tt>. This
-is because the application has the option to provide the start of the zlib stream in
-order for <tt>inflateInit()</tt> to have access to information about the compression
-method to aid in memory allocation. In the current implementation of <em>zlib</em>
-(up through versions 1.2.x), the method-dependent memory allocations are deferred to the first call of
-<tt>inflate()</tt> anyway. However those fields must be initialized since later versions
-of <em>zlib</em> that provide more compression methods may take advantage of this interface.
-In any case, no decompression is performed by <tt>inflateInit()</tt>, so the
-<tt>avail_out</tt> and <tt>next_out</tt> fields do not need to be initialized before calling.
-<p>
-Here <tt>avail_in</tt> is set to zero and <tt>next_in</tt> is set to <tt>Z_NULL</tt> to
-indicate that no input data is being provided.
-<pre><b>
- /* allocate inflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- ret = inflateInit(&amp;strm);
- if (ret != Z_OK)
- return ret;
-</b></pre><!-- -->
-The outer <tt>do</tt>-loop decompresses input until <tt>inflate()</tt> indicates
-that it has reached the end of the compressed data and has produced all of the uncompressed
-output. This is in contrast to <tt>def()</tt> which processes all of the input file.
-If end-of-file is reached before the compressed data self-terminates, then the compressed
-data is incomplete and an error is returned.
-<pre><b>
- /* decompress until deflate stream ends or end of file */
- do {
-</b></pre>
-We read input data and set the <tt>strm</tt> structure accordingly. If we've reached the
-end of the input file, then we leave the outer loop and report an error, since the
-compressed data is incomplete. Note that we may read more data than is eventually consumed
-by <tt>inflate()</tt>, if the input file continues past the <em>zlib</em> stream.
-For applications where <em>zlib</em> streams are embedded in other data, this routine would
-need to be modified to return the unused data, or at least indicate how much of the input
-data was not used, so the application would know where to pick up after the <em>zlib</em> stream.
-<pre><b>
- strm.avail_in = fread(in, 1, CHUNK, source);
- if (ferror(source)) {
- (void)inflateEnd(&amp;strm);
- return Z_ERRNO;
- }
- if (strm.avail_in == 0)
- break;
- strm.next_in = in;
-</b></pre><!-- -->
-The inner <tt>do</tt>-loop has the same function it did in <tt>def()</tt>, which is to
-keep calling <tt>inflate()</tt> until has generated all of the output it can with the
-provided input.
-<pre><b>
- /* run inflate() on input until output buffer not full */
- do {
-</b></pre>
-Just like in <tt>def()</tt>, the same output space is provided for each call of <tt>inflate()</tt>.
-<pre><b>
- strm.avail_out = CHUNK;
- strm.next_out = out;
-</b></pre>
-Now we run the decompression engine itself. There is no need to adjust the flush parameter, since
-the <em>zlib</em> format is self-terminating. The main difference here is that there are
-return values that we need to pay attention to. <tt>Z_DATA_ERROR</tt>
-indicates that <tt>inflate()</tt> detected an error in the <em>zlib</em> compressed data format,
-which means that either the data is not a <em>zlib</em> stream to begin with, or that the data was
-corrupted somewhere along the way since it was compressed. The other error to be processed is
-<tt>Z_MEM_ERROR</tt>, which can occur since memory allocation is deferred until <tt>inflate()</tt>
-needs it, unlike <tt>deflate()</tt>, whose memory is allocated at the start by <tt>deflateInit()</tt>.
-<p>
-Advanced applications may use
-<tt>deflateSetDictionary()</tt> to prime <tt>deflate()</tt> with a set of likely data to improve the
-first 32K or so of compression. This is noted in the <em>zlib</em> header, so <tt>inflate()</tt>
-requests that that dictionary be provided before it can start to decompress. Without the dictionary,
-correct decompression is not possible. For this routine, we have no idea what the dictionary is,
-so the <tt>Z_NEED_DICT</tt> indication is converted to a <tt>Z_DATA_ERROR</tt>.
-<p>
-<tt>inflate()</tt> can also return <tt>Z_STREAM_ERROR</tt>, which should not be possible here,
-but could be checked for as noted above for <tt>def()</tt>. <tt>Z_BUF_ERROR</tt> does not need to be
-checked for here, for the same reasons noted for <tt>def()</tt>. <tt>Z_STREAM_END</tt> will be
-checked for later.
-<pre><b>
- ret = inflate(&amp;strm, Z_NO_FLUSH);
- assert(ret != Z_STREAM_ERROR); /* state not clobbered */
- switch (ret) {
- case Z_NEED_DICT:
- ret = Z_DATA_ERROR; /* and fall through */
- case Z_DATA_ERROR:
- case Z_MEM_ERROR:
- (void)inflateEnd(&amp;strm);
- return ret;
- }
-</b></pre>
-The output of <tt>inflate()</tt> is handled identically to that of <tt>deflate()</tt>.
-<pre><b>
- have = CHUNK - strm.avail_out;
- if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
- (void)inflateEnd(&amp;strm);
- return Z_ERRNO;
- }
-</b></pre>
-The inner <tt>do</tt>-loop ends when <tt>inflate()</tt> has no more output as indicated
-by not filling the output buffer, just as for <tt>deflate()</tt>. In this case, we cannot
-assert that <tt>strm.avail_in</tt> will be zero, since the deflate stream may end before the file
-does.
-<pre><b>
- } while (strm.avail_out == 0);
-</b></pre><!-- -->
-The outer <tt>do</tt>-loop ends when <tt>inflate()</tt> reports that it has reached the
-end of the input <em>zlib</em> stream, has completed the decompression and integrity
-check, and has provided all of the output. This is indicated by the <tt>inflate()</tt>
-return value <tt>Z_STREAM_END</tt>. The inner loop is guaranteed to leave <tt>ret</tt>
-equal to <tt>Z_STREAM_END</tt> if the last chunk of the input file read contained the end
-of the <em>zlib</em> stream. So if the return value is not <tt>Z_STREAM_END</tt>, the
-loop continues to read more input.
-<pre><b>
- /* done when inflate() says it's done */
- } while (ret != Z_STREAM_END);
-</b></pre><!-- -->
-At this point, decompression successfully completed, or we broke out of the loop due to no
-more data being available from the input file. If the last <tt>inflate()</tt> return value
-is not <tt>Z_STREAM_END</tt>, then the <em>zlib</em> stream was incomplete and a data error
-is returned. Otherwise, we return with a happy return value. Of course, <tt>inflateEnd()</tt>
-is called first to avoid a memory leak.
-<pre><b>
- /* clean up and return */
- (void)inflateEnd(&amp;strm);
- return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
-}
-</b></pre><!-- -->
-That ends the routines that directly use <em>zlib</em>. The following routines make this
-a command-line program by running data through the above routines from <tt>stdin</tt> to
-<tt>stdout</tt>, and handling any errors reported by <tt>def()</tt> or <tt>inf()</tt>.
-<p>
-<tt>zerr()</tt> is used to interpret the possible error codes from <tt>def()</tt>
-and <tt>inf()</tt>, as detailed in their comments above, and print out an error message.
-Note that these are only a subset of the possible return values from <tt>deflate()</tt>
-and <tt>inflate()</tt>.
-<pre><b>
-/* report a zlib or i/o error */
-void zerr(int ret)
-{
- fputs("zpipe: ", stderr);
- switch (ret) {
- case Z_ERRNO:
- if (ferror(stdin))
- fputs("error reading stdin\n", stderr);
- if (ferror(stdout))
- fputs("error writing stdout\n", stderr);
- break;
- case Z_STREAM_ERROR:
- fputs("invalid compression level\n", stderr);
- break;
- case Z_DATA_ERROR:
- fputs("invalid or incomplete deflate data\n", stderr);
- break;
- case Z_MEM_ERROR:
- fputs("out of memory\n", stderr);
- break;
- case Z_VERSION_ERROR:
- fputs("zlib version mismatch!\n", stderr);
- }
-}
-</b></pre><!-- -->
-Here is the <tt>main()</tt> routine used to test <tt>def()</tt> and <tt>inf()</tt>. The
-<tt>zpipe</tt> command is simply a compression pipe from <tt>stdin</tt> to <tt>stdout</tt>, if
-no arguments are given, or it is a decompression pipe if <tt>zpipe -d</tt> is used. If any other
-arguments are provided, no compression or decompression is performed. Instead a usage
-message is displayed. Examples are <tt>zpipe < foo.txt > foo.txt.z</tt> to compress, and
-<tt>zpipe -d < foo.txt.z > foo.txt</tt> to decompress.
-<pre><b>
-/* compress or decompress from stdin to stdout */
-int main(int argc, char **argv)
-{
- int ret;
-
- /* do compression if no arguments */
- if (argc == 1) {
- ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);
- if (ret != Z_OK)
- zerr(ret);
- return ret;
- }
-
- /* do decompression if -d specified */
- else if (argc == 2 &amp;&amp; strcmp(argv[1], "-d") == 0) {
- ret = inf(stdin, stdout);
- if (ret != Z_OK)
- zerr(ret);
- return ret;
- }
-
- /* otherwise, report usage */
- else {
- fputs("zpipe usage: zpipe [-d] &lt; source &gt; dest\n", stderr);
- return 1;
- }
-}
-</b></pre>
-<hr>
-<i>Copyright (c) 2004 by Mark Adler<br>Last modified 13 November 2004</i>
-</body>
-</html>
diff --git a/funtools/util/zlib-1.2.3/examples/zpipe.c b/funtools/util/zlib-1.2.3/examples/zpipe.c
deleted file mode 100644
index 26abb56..0000000
--- a/funtools/util/zlib-1.2.3/examples/zpipe.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* zpipe.c: example of proper use of zlib's inflate() and deflate()
- Not copyrighted -- provided to the public domain
- Version 1.2 9 November 2004 Mark Adler */
-
-/* Version history:
- 1.0 30 Oct 2004 First version
- 1.1 8 Nov 2004 Add void casting for unused return values
- Use switch statement for inflate() return values
- 1.2 9 Nov 2004 Add assertions to document zlib guarantees
- 1.3 6 Apr 2005 Remove incorrect assertion in inf()
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "zlib.h"
-
-#define CHUNK 16384
-
-/* Compress from file source to file dest until EOF on source.
- def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
- allocated for processing, Z_STREAM_ERROR if an invalid compression
- level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
- version of the library linked do not match, or Z_ERRNO if there is
- an error reading or writing the files. */
-int def(FILE *source, FILE *dest, int level)
-{
- int ret, flush;
- unsigned have;
- z_stream strm;
- char in[CHUNK];
- char out[CHUNK];
-
- /* allocate deflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- ret = deflateInit(&strm, level);
- if (ret != Z_OK)
- return ret;
-
- /* compress until end of file */
- do {
- strm.avail_in = fread(in, 1, CHUNK, source);
- if (ferror(source)) {
- (void)deflateEnd(&strm);
- return Z_ERRNO;
- }
- flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
- strm.next_in = in;
-
- /* run deflate() on input until output buffer not full, finish
- compression if all of source has been read in */
- do {
- strm.avail_out = CHUNK;
- strm.next_out = out;
- ret = deflate(&strm, flush); /* no bad return value */
- assert(ret != Z_STREAM_ERROR); /* state not clobbered */
- have = CHUNK - strm.avail_out;
- if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
- (void)deflateEnd(&strm);
- return Z_ERRNO;
- }
- } while (strm.avail_out == 0);
- assert(strm.avail_in == 0); /* all input will be used */
-
- /* done when last data in file processed */
- } while (flush != Z_FINISH);
- assert(ret == Z_STREAM_END); /* stream will be complete */
-
- /* clean up and return */
- (void)deflateEnd(&strm);
- return Z_OK;
-}
-
-/* Decompress from file source to file dest until stream ends or EOF.
- inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
- allocated for processing, Z_DATA_ERROR if the deflate data is
- invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
- the version of the library linked do not match, or Z_ERRNO if there
- is an error reading or writing the files. */
-int inf(FILE *source, FILE *dest)
-{
- int ret;
- unsigned have;
- z_stream strm;
- char in[CHUNK];
- char out[CHUNK];
-
- /* allocate inflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- ret = inflateInit(&strm);
- if (ret != Z_OK)
- return ret;
-
- /* decompress until deflate stream ends or end of file */
- do {
- strm.avail_in = fread(in, 1, CHUNK, source);
- if (ferror(source)) {
- (void)inflateEnd(&strm);
- return Z_ERRNO;
- }
- if (strm.avail_in == 0)
- break;
- strm.next_in = in;
-
- /* run inflate() on input until output buffer not full */
- do {
- strm.avail_out = CHUNK;
- strm.next_out = out;
- ret = inflate(&strm, Z_NO_FLUSH);
- assert(ret != Z_STREAM_ERROR); /* state not clobbered */
- switch (ret) {
- case Z_NEED_DICT:
- ret = Z_DATA_ERROR; /* and fall through */
- case Z_DATA_ERROR:
- case Z_MEM_ERROR:
- (void)inflateEnd(&strm);
- return ret;
- }
- have = CHUNK - strm.avail_out;
- if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
- (void)inflateEnd(&strm);
- return Z_ERRNO;
- }
- } while (strm.avail_out == 0);
-
- /* done when inflate() says it's done */
- } while (ret != Z_STREAM_END);
-
- /* clean up and return */
- (void)inflateEnd(&strm);
- return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
-}
-
-/* report a zlib or i/o error */
-void zerr(int ret)
-{
- fputs("zpipe: ", stderr);
- switch (ret) {
- case Z_ERRNO:
- if (ferror(stdin))
- fputs("error reading stdin\n", stderr);
- if (ferror(stdout))
- fputs("error writing stdout\n", stderr);
- break;
- case Z_STREAM_ERROR:
- fputs("invalid compression level\n", stderr);
- break;
- case Z_DATA_ERROR:
- fputs("invalid or incomplete deflate data\n", stderr);
- break;
- case Z_MEM_ERROR:
- fputs("out of memory\n", stderr);
- break;
- case Z_VERSION_ERROR:
- fputs("zlib version mismatch!\n", stderr);
- }
-}
-
-/* compress or decompress from stdin to stdout */
-int main(int argc, char **argv)
-{
- int ret;
-
- /* do compression if no arguments */
- if (argc == 1) {
- ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);
- if (ret != Z_OK)
- zerr(ret);
- return ret;
- }
-
- /* do decompression if -d specified */
- else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
- ret = inf(stdin, stdout);
- if (ret != Z_OK)
- zerr(ret);
- return ret;
- }
-
- /* otherwise, report usage */
- else {
- fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
- return 1;
- }
-}
diff --git a/funtools/util/zlib-1.2.3/examples/zran.c b/funtools/util/zlib-1.2.3/examples/zran.c
deleted file mode 100644
index 8c7717e..0000000
--- a/funtools/util/zlib-1.2.3/examples/zran.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* zran.c -- example of zlib/gzip stream indexing and random access
- * Copyright (C) 2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- Version 1.0 29 May 2005 Mark Adler */
-
-/* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary()
- for random access of a compressed file. A file containing a zlib or gzip
- stream is provided on the command line. The compressed stream is decoded in
- its entirety, and an index built with access points about every SPAN bytes
- in the uncompressed output. The compressed file is left open, and can then
- be read randomly, having to decompress on the average SPAN/2 uncompressed
- bytes before getting to the desired block of data.
-
- An access point can be created at the start of any deflate block, by saving
- the starting file offset and bit of that block, and the 32K bytes of
- uncompressed data that precede that block. Also the uncompressed offset of
- that block is saved to provide a referece for locating a desired starting
- point in the uncompressed stream. build_index() works by decompressing the
- input zlib or gzip stream a block at a time, and at the end of each block
- deciding if enough uncompressed data has gone by to justify the creation of
- a new access point. If so, that point is saved in a data structure that
- grows as needed to accommodate the points.
-
- To use the index, an offset in the uncompressed data is provided, for which
- the latest accees point at or preceding that offset is located in the index.
- The input file is positioned to the specified location in the index, and if
- necessary the first few bits of the compressed data is read from the file.
- inflate is initialized with those bits and the 32K of uncompressed data, and
- the decompression then proceeds until the desired offset in the file is
- reached. Then the decompression continues to read the desired uncompressed
- data from the file.
-
- Another approach would be to generate the index on demand. In that case,
- requests for random access reads from the compressed data would try to use
- the index, but if a read far enough past the end of the index is required,
- then further index entries would be generated and added.
-
- There is some fair bit of overhead to starting inflation for the random
- access, mainly copying the 32K byte dictionary. So if small pieces of the
- file are being accessed, it would make sense to implement a cache to hold
- some lookahead and avoid many calls to extract() for small lengths.
-
- Another way to build an index would be to use inflateCopy(). That would
- not be constrained to have access points at block boundaries, but requires
- more memory per access point, and also cannot be saved to file due to the
- use of pointers in the state. The approach here allows for storage of the
- index in a file.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "zlib.h"
-
-#define local static
-
-#define SPAN 1048576L /* desired distance between access points */
-#define WINSIZE 32768U /* sliding window size */
-#define CHUNK 16384 /* file input buffer size */
-
-/* access point entry */
-struct point {
- off_t out; /* corresponding offset in uncompressed data */
- off_t in; /* offset in input file of first full byte */
- int bits; /* number of bits (1-7) from byte at in - 1, or 0 */
- unsigned char window[WINSIZE]; /* preceding 32K of uncompressed data */
-};
-
-/* access point list */
-struct access {
- int have; /* number of list entries filled in */
- int size; /* number of list entries allocated */
- struct point *list; /* allocated list */
-};
-
-/* Deallocate an index built by build_index() */
-local void free_index(struct access *index)
-{
- if (index != NULL) {
- free(index->list);
- free(index);
- }
-}
-
-/* Add an entry to the access point list. If out of memory, deallocate the
- existing list and return NULL. */
-local struct access *addpoint(struct access *index, int bits,
- off_t in, off_t out, unsigned left, unsigned char *window)
-{
- struct point *next;
-
- /* if list is empty, create it (start with eight points) */
- if (index == NULL) {
- index = malloc(sizeof(struct access));
- if (index == NULL) return NULL;
- index->list = malloc(sizeof(struct point) << 3);
- if (index->list == NULL) {
- free(index);
- return NULL;
- }
- index->size = 8;
- index->have = 0;
- }
-
- /* if list is full, make it bigger */
- else if (index->have == index->size) {
- index->size <<= 1;
- next = realloc(index->list, sizeof(struct point) * index->size);
- if (next == NULL) {
- free_index(index);
- return NULL;
- }
- index->list = next;
- }
-
- /* fill in entry and increment how many we have */
- next = index->list + index->have;
- next->bits = bits;
- next->in = in;
- next->out = out;
- if (left)
- memcpy(next->window, window + WINSIZE - left, left);
- if (left < WINSIZE)
- memcpy(next->window + left, window, WINSIZE - left);
- index->have++;
-
- /* return list, possibly reallocated */
- return index;
-}
-
-/* Make one entire pass through the compressed stream and build an index, with
- access points about every span bytes of uncompressed output -- span is
- chosen to balance the speed of random access against the memory requirements
- of the list, about 32K bytes per access point. Note that data after the end
- of the first zlib or gzip stream in the file is ignored. build_index()
- returns the number of access points on success (>= 1), Z_MEM_ERROR for out
- of memory, Z_DATA_ERROR for an error in the input file, or Z_ERRNO for a
- file read error. On success, *built points to the resulting index. */
-local int build_index(FILE *in, off_t span, struct access **built)
-{
- int ret;
- off_t totin, totout; /* our own total counters to avoid 4GB limit */
- off_t last; /* totout value of last access point */
- struct access *index; /* access points being generated */
- z_stream strm;
- unsigned char input[CHUNK];
- unsigned char window[WINSIZE];
-
- /* initialize inflate */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- ret = inflateInit2(&strm, 47); /* automatic zlib or gzip decoding */
- if (ret != Z_OK)
- return ret;
-
- /* inflate the input, maintain a sliding window, and build an index -- this
- also validates the integrity of the compressed data using the check
- information at the end of the gzip or zlib stream */
- totin = totout = last = 0;
- index = NULL; /* will be allocated by first addpoint() */
- strm.avail_out = 0;
- do {
- /* get some compressed data from input file */
- strm.avail_in = fread(input, 1, CHUNK, in);
- if (ferror(in)) {
- ret = Z_ERRNO;
- goto build_index_error;
- }
- if (strm.avail_in == 0) {
- ret = Z_DATA_ERROR;
- goto build_index_error;
- }
- strm.next_in = input;
-
- /* process all of that, or until end of stream */
- do {
- /* reset sliding window if necessary */
- if (strm.avail_out == 0) {
- strm.avail_out = WINSIZE;
- strm.next_out = window;
- }
-
- /* inflate until out of input, output, or at end of block --
- update the total input and output counters */
- totin += strm.avail_in;
- totout += strm.avail_out;
- ret = inflate(&strm, Z_BLOCK); /* return at end of block */
- totin -= strm.avail_in;
- totout -= strm.avail_out;
- if (ret == Z_NEED_DICT)
- ret = Z_DATA_ERROR;
- if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR)
- goto build_index_error;
- if (ret == Z_STREAM_END)
- break;
-
- /* if at end of block, consider adding an index entry (note that if
- data_type indicates an end-of-block, then all of the
- uncompressed data from that block has been delivered, and none
- of the compressed data after that block has been consumed,
- except for up to seven bits) -- the totout == 0 provides an
- entry point after the zlib or gzip header, and assures that the
- index always has at least one access point; we avoid creating an
- access point after the last block by checking bit 6 of data_type
- */
- if ((strm.data_type & 128) && !(strm.data_type & 64) &&
- (totout == 0 || totout - last > span)) {
- index = addpoint(index, strm.data_type & 7, totin,
- totout, strm.avail_out, window);
- if (index == NULL) {
- ret = Z_MEM_ERROR;
- goto build_index_error;
- }
- last = totout;
- }
- } while (strm.avail_in != 0);
- } while (ret != Z_STREAM_END);
-
- /* clean up and return index (release unused entries in list) */
- (void)inflateEnd(&strm);
- index = realloc(index, sizeof(struct point) * index->have);
- index->size = index->have;
- *built = index;
- return index->size;
-
- /* return error */
- build_index_error:
- (void)inflateEnd(&strm);
- if (index != NULL)
- free_index(index);
- return ret;
-}
-
-/* Use the index to read len bytes from offset into buf, return bytes read or
- negative for error (Z_DATA_ERROR or Z_MEM_ERROR). If data is requested past
- the end of the uncompressed data, then extract() will return a value less
- than len, indicating how much as actually read into buf. This function
- should not return a data error unless the file was modified since the index
- was generated. extract() may also return Z_ERRNO if there is an error on
- reading or seeking the input file. */
-local int extract(FILE *in, struct access *index, off_t offset,
- unsigned char *buf, int len)
-{
- int ret, skip;
- z_stream strm;
- struct point *here;
- unsigned char input[CHUNK];
- unsigned char discard[WINSIZE];
-
- /* proceed only if something reasonable to do */
- if (len < 0)
- return 0;
-
- /* find where in stream to start */
- here = index->list;
- ret = index->have;
- while (--ret && here[1].out <= offset)
- here++;
-
- /* initialize file and inflate state to start there */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = 0;
- strm.next_in = Z_NULL;
- ret = inflateInit2(&strm, -15); /* raw inflate */
- if (ret != Z_OK)
- return ret;
- ret = fseeko(in, here->in - (here->bits ? 1 : 0), SEEK_SET);
- if (ret == -1)
- goto extract_ret;
- if (here->bits) {
- ret = getc(in);
- if (ret == -1) {
- ret = ferror(in) ? Z_ERRNO : Z_DATA_ERROR;
- goto extract_ret;
- }
- (void)inflatePrime(&strm, here->bits, ret >> (8 - here->bits));
- }
- (void)inflateSetDictionary(&strm, here->window, WINSIZE);
-
- /* skip uncompressed bytes until offset reached, then satisfy request */
- offset -= here->out;
- strm.avail_in = 0;
- skip = 1; /* while skipping to offset */
- do {
- /* define where to put uncompressed data, and how much */
- if (offset == 0 && skip) { /* at offset now */
- strm.avail_out = len;
- strm.next_out = buf;
- skip = 0; /* only do this once */
- }
- if (offset > WINSIZE) { /* skip WINSIZE bytes */
- strm.avail_out = WINSIZE;
- strm.next_out = discard;
- offset -= WINSIZE;
- }
- else if (offset != 0) { /* last skip */
- strm.avail_out = (unsigned)offset;
- strm.next_out = discard;
- offset = 0;
- }
-
- /* uncompress until avail_out filled, or end of stream */
- do {
- if (strm.avail_in == 0) {
- strm.avail_in = fread(input, 1, CHUNK, in);
- if (ferror(in)) {
- ret = Z_ERRNO;
- goto extract_ret;
- }
- if (strm.avail_in == 0) {
- ret = Z_DATA_ERROR;
- goto extract_ret;
- }
- strm.next_in = input;
- }
- ret = inflate(&strm, Z_NO_FLUSH); /* normal inflate */
- if (ret == Z_NEED_DICT)
- ret = Z_DATA_ERROR;
- if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR)
- goto extract_ret;
- if (ret == Z_STREAM_END)
- break;
- } while (strm.avail_out != 0);
-
- /* if reach end of stream, then don't keep trying to get more */
- if (ret == Z_STREAM_END)
- break;
-
- /* do until offset reached and requested data read, or stream ends */
- } while (skip);
-
- /* compute number of uncompressed bytes read after offset */
- ret = skip ? 0 : len - strm.avail_out;
-
- /* clean up and return bytes read or error */
- extract_ret:
- (void)inflateEnd(&strm);
- return ret;
-}
-
-/* Demonstrate the use of build_index() and extract() by processing the file
- provided on the command line, and the extracting 16K from about 2/3rds of
- the way through the uncompressed output, and writing that to stdout. */
-int main(int argc, char **argv)
-{
- int len;
- off_t offset;
- FILE *in;
- struct access *index;
- unsigned char buf[CHUNK];
-
- /* open input file */
- if (argc != 2) {
- fprintf(stderr, "usage: zran file.gz\n");
- return 1;
- }
- in = fopen(argv[1], "rb");
- if (in == NULL) {
- fprintf(stderr, "zran: could not open %s for reading\n", argv[1]);
- return 1;
- }
-
- /* build index */
- len = build_index(in, SPAN, &index);
- if (len < 0) {
- fclose(in);
- switch (len) {
- case Z_MEM_ERROR:
- fprintf(stderr, "zran: out of memory\n");
- break;
- case Z_DATA_ERROR:
- fprintf(stderr, "zran: compressed data error in %s\n", argv[1]);
- break;
- case Z_ERRNO:
- fprintf(stderr, "zran: read error on %s\n", argv[1]);
- break;
- default:
- fprintf(stderr, "zran: error %d while building index\n", len);
- }
- return 1;
- }
- fprintf(stderr, "zran: built index with %d access points\n", len);
-
- /* use index by reading some bytes from an arbitrary offset */
- offset = (index->list[index->have - 1].out << 1) / 3;
- len = extract(in, index, offset, buf, CHUNK);
- if (len < 0)
- fprintf(stderr, "zran: extraction failed: %s error\n",
- len == Z_MEM_ERROR ? "out of memory" : "input corrupted");
- else {
- fwrite(buf, 1, len, stdout);
- fprintf(stderr, "zran: extracted %d bytes at %llu\n", len, offset);
- }
-
- /* clean up and exit */
- free_index(index);
- fclose(in);
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/gzio.c b/funtools/util/zlib-1.2.3/gzio.c
deleted file mode 100644
index 7e90f49..0000000
--- a/funtools/util/zlib-1.2.3/gzio.c
+++ /dev/null
@@ -1,1026 +0,0 @@
-/* gzio.c -- IO on .gz files
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
- */
-
-/* @(#) $Id$ */
-
-#include <stdio.h>
-
-#include "zutil.h"
-
-#ifdef NO_DEFLATE /* for compatibility with old definition */
-# define NO_GZCOMPRESS
-#endif
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-#ifndef Z_BUFSIZE
-# ifdef MAXSEG_64K
-# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
-# else
-# define Z_BUFSIZE 16384
-# endif
-#endif
-#ifndef Z_PRINTF_BUFSIZE
-# define Z_PRINTF_BUFSIZE 4096
-#endif
-
-#ifdef __MVS__
-# pragma map (fdopen , "\174\174FDOPEN")
- FILE *fdopen(int, const char *);
-#endif
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-#define ALLOC(size) malloc(size)
-#define TRYFREE(p) {if (p) free(p);}
-
-static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
-
-/* gzip flag byte */
-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
-#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
-#define COMMENT 0x10 /* bit 4 set: file comment present */
-#define RESERVED 0xE0 /* bits 5..7: reserved */
-
-typedef struct gz_stream {
- z_stream stream;
- int z_err; /* error code for last stream operation */
- int z_eof; /* set if end of input file */
- FILE *file; /* .gz file */
- Byte *inbuf; /* input buffer */
- Byte *outbuf; /* output buffer */
- uLong crc; /* crc32 of uncompressed data */
- char *msg; /* error message */
- char *path; /* path name for debugging only */
- int transparent; /* 1 if input file is not a .gz file */
- char mode; /* 'w' or 'r' */
- z_off_t start; /* start of compressed data in file (header skipped) */
- z_off_t in; /* bytes into deflate or inflate */
- z_off_t out; /* bytes out of deflate or inflate */
- int back; /* one character push-back */
- int last; /* true if push-back is last character */
-} gz_stream;
-
-
-local gzFile gz_open OF((const char *path, const char *mode, int fd));
-local int do_flush OF((gzFile file, int flush));
-local int get_byte OF((gz_stream *s));
-local void check_header OF((gz_stream *s));
-local int destroy OF((gz_stream *s));
-local void putLong OF((FILE *file, uLong x));
-local uLong getLong OF((gz_stream *s));
-
-/* ===========================================================================
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb"). The file is given either by file descriptor
- or path name (if fd == -1).
- gz_open returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR).
-*/
-local gzFile gz_open (path, mode, fd)
- const char *path;
- const char *mode;
- int fd;
-{
- int err;
- int level = Z_DEFAULT_COMPRESSION; /* compression level */
- int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
- char *p = (char*)mode;
- gz_stream *s;
- char fmode[80]; /* copy of mode, without the compression level */
- char *m = fmode;
-
- if (!path || !mode) return Z_NULL;
-
- s = (gz_stream *)ALLOC(sizeof(gz_stream));
- if (!s) return Z_NULL;
-
- s->stream.zalloc = (alloc_func)0;
- s->stream.zfree = (free_func)0;
- s->stream.opaque = (voidpf)0;
- s->stream.next_in = s->inbuf = Z_NULL;
- s->stream.next_out = s->outbuf = Z_NULL;
- s->stream.avail_in = s->stream.avail_out = 0;
- s->file = NULL;
- s->z_err = Z_OK;
- s->z_eof = 0;
- s->in = 0;
- s->out = 0;
- s->back = EOF;
- s->crc = crc32(0L, Z_NULL, 0);
- s->msg = NULL;
- s->transparent = 0;
-
- s->path = (char*)ALLOC(strlen(path)+1);
- if (s->path == NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- strcpy(s->path, path); /* do this early for debugging */
-
- s->mode = '\0';
- do {
- if (*p == 'r') s->mode = 'r';
- if (*p == 'w' || *p == 'a') s->mode = 'w';
- if (*p >= '0' && *p <= '9') {
- level = *p - '0';
- } else if (*p == 'f') {
- strategy = Z_FILTERED;
- } else if (*p == 'h') {
- strategy = Z_HUFFMAN_ONLY;
- } else if (*p == 'R') {
- strategy = Z_RLE;
- } else {
- *m++ = *p; /* copy the mode */
- }
- } while (*p++ && m != fmode + sizeof(fmode));
- if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- err = Z_STREAM_ERROR;
-#else
- err = deflateInit2(&(s->stream), level,
- Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
- /* windowBits is passed < 0 to suppress zlib header */
-
- s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
-#endif
- if (err != Z_OK || s->outbuf == Z_NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- } else {
- s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
-
- err = inflateInit2(&(s->stream), -MAX_WBITS);
- /* windowBits is passed < 0 to tell that there is no zlib header.
- * Note that in this case inflate *requires* an extra "dummy" byte
- * after the compressed stream in order to complete decompression and
- * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
- * present after the compressed stream.
- */
- if (err != Z_OK || s->inbuf == Z_NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- }
- s->stream.avail_out = Z_BUFSIZE;
-
- errno = 0;
- s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
-
- if (s->file == NULL) {
- return destroy(s), (gzFile)Z_NULL;
- }
- if (s->mode == 'w') {
- /* Write a very simple .gz header:
- */
- fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
- Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
- s->start = 10L;
- /* We use 10L instead of ftell(s->file) to because ftell causes an
- * fflush on some systems. This version of the library doesn't use
- * start anyway in write mode, so this initialization is not
- * necessary.
- */
- } else {
- check_header(s); /* skip the .gz header */
- s->start = ftell(s->file) - s->stream.avail_in;
- }
-
- return (gzFile)s;
-}
-
-/* ===========================================================================
- Opens a gzip (.gz) file for reading or writing.
-*/
-gzFile ZEXPORT gzopen (path, mode)
- const char *path;
- const char *mode;
-{
- return gz_open (path, mode, -1);
-}
-
-/* ===========================================================================
- Associate a gzFile with the file descriptor fd. fd is not dup'ed here
- to mimic the behavio(u)r of fdopen.
-*/
-gzFile ZEXPORT gzdopen (fd, mode)
- int fd;
- const char *mode;
-{
- char name[46]; /* allow for up to 128-bit integers */
-
- if (fd < 0) return (gzFile)Z_NULL;
- sprintf(name, "<fd:%d>", fd); /* for debugging */
-
- return gz_open (name, mode, fd);
-}
-
-/* ===========================================================================
- * Update the compression level and strategy
- */
-int ZEXPORT gzsetparams (file, level, strategy)
- gzFile file;
- int level;
- int strategy;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- /* Make room to allow flushing */
- if (s->stream.avail_out == 0) {
-
- s->stream.next_out = s->outbuf;
- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
- s->z_err = Z_ERRNO;
- }
- s->stream.avail_out = Z_BUFSIZE;
- }
-
- return deflateParams (&(s->stream), level, strategy);
-}
-
-/* ===========================================================================
- Read a byte from a gz_stream; update next_in and avail_in. Return EOF
- for end of file.
- IN assertion: the stream s has been sucessfully opened for reading.
-*/
-local int get_byte(s)
- gz_stream *s;
-{
- if (s->z_eof) return EOF;
- if (s->stream.avail_in == 0) {
- errno = 0;
- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
- if (s->stream.avail_in == 0) {
- s->z_eof = 1;
- if (ferror(s->file)) s->z_err = Z_ERRNO;
- return EOF;
- }
- s->stream.next_in = s->inbuf;
- }
- s->stream.avail_in--;
- return *(s->stream.next_in)++;
-}
-
-/* ===========================================================================
- Check the gzip header of a gz_stream opened for reading. Set the stream
- mode to transparent if the gzip magic header is not present; set s->err
- to Z_DATA_ERROR if the magic header is present but the rest of the header
- is incorrect.
- IN assertion: the stream s has already been created sucessfully;
- s->stream.avail_in is zero for the first time, but may be non-zero
- for concatenated .gz files.
-*/
-local void check_header(s)
- gz_stream *s;
-{
- int method; /* method byte */
- int flags; /* flags byte */
- uInt len;
- int c;
-
- /* Assure two bytes in the buffer so we can peek ahead -- handle case
- where first byte of header is at the end of the buffer after the last
- gzip segment */
- len = s->stream.avail_in;
- if (len < 2) {
- if (len) s->inbuf[0] = s->stream.next_in[0];
- errno = 0;
- len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
- if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
- s->stream.avail_in += len;
- s->stream.next_in = s->inbuf;
- if (s->stream.avail_in < 2) {
- s->transparent = s->stream.avail_in;
- return;
- }
- }
-
- /* Peek ahead to check the gzip magic header */
- if (s->stream.next_in[0] != gz_magic[0] ||
- s->stream.next_in[1] != gz_magic[1]) {
- s->transparent = 1;
- return;
- }
- s->stream.avail_in -= 2;
- s->stream.next_in += 2;
-
- /* Check the rest of the gzip header */
- method = get_byte(s);
- flags = get_byte(s);
- if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
- s->z_err = Z_DATA_ERROR;
- return;
- }
-
- /* Discard time, xflags and OS code: */
- for (len = 0; len < 6; len++) (void)get_byte(s);
-
- if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
- len = (uInt)get_byte(s);
- len += ((uInt)get_byte(s))<<8;
- /* len is garbage if EOF but the loop below will quit anyway */
- while (len-- != 0 && get_byte(s) != EOF) ;
- }
- if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
- while ((c = get_byte(s)) != 0 && c != EOF) ;
- }
- if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
- while ((c = get_byte(s)) != 0 && c != EOF) ;
- }
- if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
- for (len = 0; len < 2; len++) (void)get_byte(s);
- }
- s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
-}
-
- /* ===========================================================================
- * Cleanup then free the given gz_stream. Return a zlib error code.
- Try freeing in the reverse order of allocations.
- */
-local int destroy (s)
- gz_stream *s;
-{
- int err = Z_OK;
-
- if (!s) return Z_STREAM_ERROR;
-
- TRYFREE(s->msg);
-
- if (s->stream.state != NULL) {
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- err = Z_STREAM_ERROR;
-#else
- err = deflateEnd(&(s->stream));
-#endif
- } else if (s->mode == 'r') {
- err = inflateEnd(&(s->stream));
- }
- }
- if (s->file != NULL && fclose(s->file)) {
-#ifdef ESPIPE
- if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
-#endif
- err = Z_ERRNO;
- }
- if (s->z_err < 0) err = s->z_err;
-
- TRYFREE(s->inbuf);
- TRYFREE(s->outbuf);
- TRYFREE(s->path);
- TRYFREE(s);
- return err;
-}
-
-/* ===========================================================================
- Reads the given number of uncompressed bytes from the compressed file.
- gzread returns the number of bytes actually read (0 for end of file).
-*/
-int ZEXPORT gzread (file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
-{
- gz_stream *s = (gz_stream*)file;
- Bytef *start = (Bytef*)buf; /* starting point for crc computation */
- Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
-
- if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
-
- if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
- if (s->z_err == Z_STREAM_END) return 0; /* EOF */
-
- next_out = (Byte*)buf;
- s->stream.next_out = (Bytef*)buf;
- s->stream.avail_out = len;
-
- if (s->stream.avail_out && s->back != EOF) {
- *next_out++ = s->back;
- s->stream.next_out++;
- s->stream.avail_out--;
- s->back = EOF;
- s->out++;
- start++;
- if (s->last) {
- s->z_err = Z_STREAM_END;
- return 1;
- }
- }
-
- while (s->stream.avail_out != 0) {
-
- if (s->transparent) {
- /* Copy first the lookahead bytes: */
- uInt n = s->stream.avail_in;
- if (n > s->stream.avail_out) n = s->stream.avail_out;
- if (n > 0) {
- zmemcpy(s->stream.next_out, s->stream.next_in, n);
- next_out += n;
- s->stream.next_out = next_out;
- s->stream.next_in += n;
- s->stream.avail_out -= n;
- s->stream.avail_in -= n;
- }
- if (s->stream.avail_out > 0) {
- s->stream.avail_out -=
- (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
- }
- len -= s->stream.avail_out;
- s->in += len;
- s->out += len;
- if (len == 0) s->z_eof = 1;
- return (int)len;
- }
- if (s->stream.avail_in == 0 && !s->z_eof) {
-
- errno = 0;
- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
- if (s->stream.avail_in == 0) {
- s->z_eof = 1;
- if (ferror(s->file)) {
- s->z_err = Z_ERRNO;
- break;
- }
- }
- s->stream.next_in = s->inbuf;
- }
- s->in += s->stream.avail_in;
- s->out += s->stream.avail_out;
- s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
- s->in -= s->stream.avail_in;
- s->out -= s->stream.avail_out;
-
- if (s->z_err == Z_STREAM_END) {
- /* Check CRC and original size */
- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
- start = s->stream.next_out;
-
- if (getLong(s) != s->crc) {
- s->z_err = Z_DATA_ERROR;
- } else {
- (void)getLong(s);
- /* The uncompressed length returned by above getlong() may be
- * different from s->out in case of concatenated .gz files.
- * Check for such files:
- */
- check_header(s);
- if (s->z_err == Z_OK) {
- inflateReset(&(s->stream));
- s->crc = crc32(0L, Z_NULL, 0);
- }
- }
- }
- if (s->z_err != Z_OK || s->z_eof) break;
- }
- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
-
- if (len == s->stream.avail_out &&
- (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
- return -1;
- return (int)(len - s->stream.avail_out);
-}
-
-
-/* ===========================================================================
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-int ZEXPORT gzgetc(file)
- gzFile file;
-{
- unsigned char c;
-
- return gzread(file, &c, 1) == 1 ? c : -1;
-}
-
-
-/* ===========================================================================
- Push one byte back onto the stream.
-*/
-int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF;
- s->back = c;
- s->out--;
- s->last = (s->z_err == Z_STREAM_END);
- if (s->last) s->z_err = Z_OK;
- s->z_eof = 0;
- return c;
-}
-
-
-/* ===========================================================================
- Reads bytes from the compressed file until len-1 characters are
- read, or a newline character is read and transferred to buf, or an
- end-of-file condition is encountered. The string is then terminated
- with a null character.
- gzgets returns buf, or Z_NULL in case of error.
-
- The current implementation is not optimized at all.
-*/
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
-{
- char *b = buf;
- if (buf == Z_NULL || len <= 0) return Z_NULL;
-
- while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
- *buf = '\0';
- return b == buf && len > 0 ? Z_NULL : b;
-}
-
-
-#ifndef NO_GZCOMPRESS
-/* ===========================================================================
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of bytes actually written (0 in case of error).
-*/
-int ZEXPORT gzwrite (file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- s->stream.next_in = (Bytef*)buf;
- s->stream.avail_in = len;
-
- while (s->stream.avail_in != 0) {
-
- if (s->stream.avail_out == 0) {
-
- s->stream.next_out = s->outbuf;
- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
- s->z_err = Z_ERRNO;
- break;
- }
- s->stream.avail_out = Z_BUFSIZE;
- }
- s->in += s->stream.avail_in;
- s->out += s->stream.avail_out;
- s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
- s->in -= s->stream.avail_in;
- s->out -= s->stream.avail_out;
- if (s->z_err != Z_OK) break;
- }
- s->crc = crc32(s->crc, (const Bytef *)buf, len);
-
- return (int)(len - s->stream.avail_in);
-}
-
-
-/* ===========================================================================
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error).
-*/
-#ifdef STDC
-#include <stdarg.h>
-
-int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
-{
- char buf[Z_PRINTF_BUFSIZE];
- va_list va;
- int len;
-
- buf[sizeof(buf) - 1] = 0;
- va_start(va, format);
-#ifdef NO_vsnprintf
-# ifdef HAS_vsprintf_void
- (void)vsprintf(buf, format, va);
- va_end(va);
- for (len = 0; len < sizeof(buf); len++)
- if (buf[len] == 0) break;
-# else
- len = vsprintf(buf, format, va);
- va_end(va);
-# endif
-#else
-# ifdef HAS_vsnprintf_void
- (void)vsnprintf(buf, sizeof(buf), format, va);
- va_end(va);
- len = strlen(buf);
-# else
- len = vsnprintf(buf, sizeof(buf), format, va);
- va_end(va);
-# endif
-#endif
- if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
- return 0;
- return gzwrite(file, buf, (unsigned)len);
-}
-#else /* not ANSI C */
-
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
- char buf[Z_PRINTF_BUFSIZE];
- int len;
-
- buf[sizeof(buf) - 1] = 0;
-#ifdef NO_snprintf
-# ifdef HAS_sprintf_void
- sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < sizeof(buf); len++)
- if (buf[len] == 0) break;
-# else
- len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#else
-# ifdef HAS_snprintf_void
- snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen(buf);
-# else
- len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#endif
- if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
- return 0;
- return gzwrite(file, buf, len);
-}
-#endif
-
-/* ===========================================================================
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
-{
- unsigned char cc = (unsigned char) c; /* required for big endian systems */
-
- return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
-}
-
-
-/* ===========================================================================
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-int ZEXPORT gzputs(file, s)
- gzFile file;
- const char *s;
-{
- return gzwrite(file, (char*)s, (unsigned)strlen(s));
-}
-
-
-/* ===========================================================================
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function.
-*/
-local int do_flush (file, flush)
- gzFile file;
- int flush;
-{
- uInt len;
- int done = 0;
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
-
- s->stream.avail_in = 0; /* should be zero already anyway */
-
- for (;;) {
- len = Z_BUFSIZE - s->stream.avail_out;
-
- if (len != 0) {
- if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
- s->z_err = Z_ERRNO;
- return Z_ERRNO;
- }
- s->stream.next_out = s->outbuf;
- s->stream.avail_out = Z_BUFSIZE;
- }
- if (done) break;
- s->out += s->stream.avail_out;
- s->z_err = deflate(&(s->stream), flush);
- s->out -= s->stream.avail_out;
-
- /* Ignore the second of two consecutive flushes: */
- if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
-
- /* deflate has finished flushing only when it hasn't used up
- * all the available space in the output buffer:
- */
- done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
-
- if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
- }
- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
-}
-
-int ZEXPORT gzflush (file, flush)
- gzFile file;
- int flush;
-{
- gz_stream *s = (gz_stream*)file;
- int err = do_flush (file, flush);
-
- if (err) return err;
- fflush(s->file);
- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
-}
-#endif /* NO_GZCOMPRESS */
-
-/* ===========================================================================
- Sets the starting position for the next gzread or gzwrite on the given
- compressed file. The offset represents a number of bytes in the
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error.
- SEEK_END is not implemented, returns error.
- In this version of the library, gzseek can be extremely slow.
-*/
-z_off_t ZEXPORT gzseek (file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || whence == SEEK_END ||
- s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
- return -1L;
- }
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- return -1L;
-#else
- if (whence == SEEK_SET) {
- offset -= s->in;
- }
- if (offset < 0) return -1L;
-
- /* At this point, offset is the number of zero bytes to write. */
- if (s->inbuf == Z_NULL) {
- s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
- if (s->inbuf == Z_NULL) return -1L;
- zmemzero(s->inbuf, Z_BUFSIZE);
- }
- while (offset > 0) {
- uInt size = Z_BUFSIZE;
- if (offset < Z_BUFSIZE) size = (uInt)offset;
-
- size = gzwrite(file, s->inbuf, size);
- if (size == 0) return -1L;
-
- offset -= size;
- }
- return s->in;
-#endif
- }
- /* Rest of function is for reading only */
-
- /* compute absolute position */
- if (whence == SEEK_CUR) {
- offset += s->out;
- }
- if (offset < 0) return -1L;
-
- if (s->transparent) {
- /* map to fseek */
- s->back = EOF;
- s->stream.avail_in = 0;
- s->stream.next_in = s->inbuf;
- if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
-
- s->in = s->out = offset;
- return offset;
- }
-
- /* For a negative seek, rewind and use positive seek */
- if (offset >= s->out) {
- offset -= s->out;
- } else if (gzrewind(file) < 0) {
- return -1L;
- }
- /* offset is now the number of bytes to skip. */
-
- if (offset != 0 && s->outbuf == Z_NULL) {
- s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
- if (s->outbuf == Z_NULL) return -1L;
- }
- if (offset && s->back != EOF) {
- s->back = EOF;
- s->out++;
- offset--;
- if (s->last) s->z_err = Z_STREAM_END;
- }
- while (offset > 0) {
- int size = Z_BUFSIZE;
- if (offset < Z_BUFSIZE) size = (int)offset;
-
- size = gzread(file, s->outbuf, (uInt)size);
- if (size <= 0) return -1L;
- offset -= size;
- }
- return s->out;
-}
-
-/* ===========================================================================
- Rewinds input file.
-*/
-int ZEXPORT gzrewind (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r') return -1;
-
- s->z_err = Z_OK;
- s->z_eof = 0;
- s->back = EOF;
- s->stream.avail_in = 0;
- s->stream.next_in = s->inbuf;
- s->crc = crc32(0L, Z_NULL, 0);
- if (!s->transparent) (void)inflateReset(&s->stream);
- s->in = 0;
- s->out = 0;
- return fseek(s->file, s->start, SEEK_SET);
-}
-
-/* ===========================================================================
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-*/
-z_off_t ZEXPORT gztell (file)
- gzFile file;
-{
- return gzseek(file, 0L, SEEK_CUR);
-}
-
-/* ===========================================================================
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-int ZEXPORT gzeof (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- /* With concatenated compressed files that can have embedded
- * crc trailers, z_eof is no longer the only/best indicator of EOF
- * on a gz_stream. Handle end-of-stream error explicitly here.
- */
- if (s == NULL || s->mode != 'r') return 0;
- if (s->z_eof) return 1;
- return s->z_err == Z_STREAM_END;
-}
-
-/* ===========================================================================
- Returns 1 if reading and doing so transparently, otherwise zero.
-*/
-int ZEXPORT gzdirect (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL || s->mode != 'r') return 0;
- return s->transparent;
-}
-
-/* ===========================================================================
- Outputs a long in LSB order to the given file
-*/
-local void putLong (file, x)
- FILE *file;
- uLong x;
-{
- int n;
- for (n = 0; n < 4; n++) {
- fputc((int)(x & 0xff), file);
- x >>= 8;
- }
-}
-
-/* ===========================================================================
- Reads a long in LSB order from the given gz_stream. Sets z_err in case
- of error.
-*/
-local uLong getLong (s)
- gz_stream *s;
-{
- uLong x = (uLong)get_byte(s);
- int c;
-
- x += ((uLong)get_byte(s))<<8;
- x += ((uLong)get_byte(s))<<16;
- c = get_byte(s);
- if (c == EOF) s->z_err = Z_DATA_ERROR;
- x += ((uLong)c)<<24;
- return x;
-}
-
-/* ===========================================================================
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state.
-*/
-int ZEXPORT gzclose (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) return Z_STREAM_ERROR;
-
- if (s->mode == 'w') {
-#ifdef NO_GZCOMPRESS
- return Z_STREAM_ERROR;
-#else
- if (do_flush (file, Z_FINISH) != Z_OK)
- return destroy((gz_stream*)file);
-
- putLong (s->file, s->crc);
- putLong (s->file, (uLong)(s->in & 0xffffffff));
-#endif
- }
- return destroy((gz_stream*)file);
-}
-
-#ifdef STDC
-# define zstrerror(errnum) strerror(errnum)
-#else
-# define zstrerror(errnum) ""
-#endif
-
-/* ===========================================================================
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-const char * ZEXPORT gzerror (file, errnum)
- gzFile file;
- int *errnum;
-{
- char *m;
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) {
- *errnum = Z_STREAM_ERROR;
- return (const char*)ERR_MSG(Z_STREAM_ERROR);
- }
- *errnum = s->z_err;
- if (*errnum == Z_OK) return (const char*)"";
-
- m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
-
- if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
-
- TRYFREE(s->msg);
- s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
- if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
- strcpy(s->msg, s->path);
- strcat(s->msg, ": ");
- strcat(s->msg, m);
- return (const char*)s->msg;
-}
-
-/* ===========================================================================
- Clear the error and end-of-file flags, and do the same for the real file.
-*/
-void ZEXPORT gzclearerr (file)
- gzFile file;
-{
- gz_stream *s = (gz_stream*)file;
-
- if (s == NULL) return;
- if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
- s->z_eof = 0;
- clearerr(s->file);
-}
diff --git a/funtools/util/zlib-1.2.3/infback.c b/funtools/util/zlib-1.2.3/infback.c
deleted file mode 100644
index 455dbc9..0000000
--- a/funtools/util/zlib-1.2.3/infback.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- This code is largely copied from inflate.c. Normally either infback.o or
- inflate.o would be linked into an application--not both. The interface
- with inffast.c is retained so that optimized assembler-coded versions of
- inflate_fast() can be used with either inflate.c or infback.c.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-
-/*
- strm provides memory allocation functions in zalloc and zfree, or
- Z_NULL to use the library memory allocation functions.
-
- windowBits is in the range 8..15, and window is a user-supplied
- window and output buffer that is 2**windowBits bytes.
- */
-int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
-z_streamp strm;
-int windowBits;
-unsigned char FAR *window;
-const char *version;
-int stream_size;
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL ||
- windowBits < 8 || windowBits > 15)
- return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
- sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->dmax = 32768U;
- state->wbits = windowBits;
- state->wsize = 1U << windowBits;
- state->window = window;
- state->write = 0;
- state->whave = 0;
- return Z_OK;
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-/* Macros for inflateBack(): */
-
-/* Load returned state from inflate_fast() */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Set state from registers for inflate_fast() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Assure that some input is available. If input is requested, but denied,
- then return a Z_BUF_ERROR from inflateBack(). */
-#define PULL() \
- do { \
- if (have == 0) { \
- have = in(in_desc, &next); \
- if (have == 0) { \
- next = Z_NULL; \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflateBack()
- with an error if there is no input available. */
-#define PULLBYTE() \
- do { \
- PULL(); \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflateBack() with
- an error. */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Assure that some output space is available, by writing out the window
- if it's full. If the write fails, return from inflateBack() with a
- Z_BUF_ERROR. */
-#define ROOM() \
- do { \
- if (left == 0) { \
- put = state->window; \
- left = state->wsize; \
- state->whave = left; \
- if (out(out_desc, put, left)) { \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/*
- strm provides the memory allocation functions and window buffer on input,
- and provides information on the unused input on return. For Z_DATA_ERROR
- returns, strm will also provide an error message.
-
- in() and out() are the call-back input and output functions. When
- inflateBack() needs more input, it calls in(). When inflateBack() has
- filled the window with output, or when it completes with data in the
- window, it calls out() to write out the data. The application must not
- change the provided input until in() is called again or inflateBack()
- returns. The application must not change the window/output buffer until
- inflateBack() returns.
-
- in() and out() are called with a descriptor parameter provided in the
- inflateBack() call. This parameter can be a structure that provides the
- information required to do the read or write, as well as accumulated
- information on the input and output such as totals and check values.
-
- in() should return zero on failure. out() should return non-zero on
- failure. If either in() or out() fails, than inflateBack() returns a
- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
- was in() or out() that caused in the error. Otherwise, inflateBack()
- returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
- error, or Z_MEM_ERROR if it could not allocate memory for the state.
- inflateBack() can also return Z_STREAM_ERROR if the input parameters
- are not correct, i.e. strm is Z_NULL or the state was not initialized.
- */
-int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
-z_streamp strm;
-in_func in;
-void FAR *in_desc;
-out_func out;
-void FAR *out_desc;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code this; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- /* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* Reset the state */
- strm->msg = Z_NULL;
- state->mode = TYPE;
- state->last = 0;
- state->whave = 0;
- next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
- hold = 0;
- bits = 0;
- put = state->window;
- left = state->wsize;
-
- /* Inflate until end of block marked as last */
- for (;;)
- switch (state->mode) {
- case TYPE:
- /* determine and dispatch block type */
- if (state->last) {
- BYTEBITS();
- state->mode = DONE;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
-
- case STORED:
- /* get and verify stored block length */
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
-
- /* copy stored block from input to output */
- while (state->length != 0) {
- copy = state->length;
- PULL();
- ROOM();
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
-
- case TABLE:
- /* get dynamic table entries descriptor */
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
-
- /* get code length code lengths (not a typo) */
- state->have = 0;
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
-
- /* get length and distance code code lengths */
- state->have = 0;
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.val < 16) {
- NEEDBITS(this.bits);
- DROPBITS(this.bits);
- state->lens[state->have++] = this.val;
- }
- else {
- if (this.val == 16) {
- NEEDBITS(this.bits + 2);
- DROPBITS(this.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = (unsigned)(state->lens[state->have - 1]);
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (this.val == 17) {
- NEEDBITS(this.bits + 3);
- DROPBITS(this.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(this.bits + 7);
- DROPBITS(this.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* build code tables */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
-
- case LEN:
- /* use inflate_fast() if we have enough input and output */
- if (have >= 6 && left >= 258) {
- RESTORE();
- if (state->whave < state->wsize)
- state->whave = state->wsize - left;
- inflate_fast(strm, state->wsize);
- LOAD();
- break;
- }
-
- /* get a literal, length, or end-of-block code */
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.op && (this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- state->length = (unsigned)this.val;
-
- /* process literal */
- if (this.op == 0) {
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- ROOM();
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- }
-
- /* process end of block */
- if (this.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
-
- /* invalid code */
- if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
-
- /* length code -- get extra bits, if any */
- state->extra = (unsigned)(this.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
-
- /* get distance code */
- for (;;) {
- this = state->distcode[BITS(state->distbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if ((this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)this.val;
-
- /* get distance extra bits, if any */
- state->extra = (unsigned)(this.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
- if (state->offset > state->wsize - (state->whave < state->wsize ?
- left : 0)) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
-
- /* copy match from window to output */
- do {
- ROOM();
- copy = state->wsize - state->offset;
- if (copy < left) {
- from = put + copy;
- copy = left - copy;
- }
- else {
- from = put - state->offset;
- copy = left;
- }
- if (copy > state->length) copy = state->length;
- state->length -= copy;
- left -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- } while (state->length != 0);
- break;
-
- case DONE:
- /* inflate stream terminated properly -- write leftover output */
- ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
- goto inf_leave;
-
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
-
- default: /* can't happen, but makes compilers happy */
- ret = Z_STREAM_ERROR;
- goto inf_leave;
- }
-
- /* Return unused input */
- inf_leave:
- strm->next_in = next;
- strm->avail_in = have;
- return ret;
-}
-
-int ZEXPORT inflateBackEnd(strm)
-z_streamp strm;
-{
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
diff --git a/funtools/util/zlib-1.2.3/inffast.c b/funtools/util/zlib-1.2.3/inffast.c
deleted file mode 100644
index bbee92e..0000000
--- a/funtools/util/zlib-1.2.3/inffast.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* inffast.c -- fast decoding
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifndef ASMINF
-
-/* Allow machine dependent optimization for post-increment or pre-increment.
- Based on testing to date,
- Pre-increment preferred for:
- - PowerPC G3 (Adler)
- - MIPS R5000 (Randers-Pehrson)
- Post-increment preferred for:
- - none
- No measurable difference:
- - Pentium III (Anderson)
- - M68060 (Nikl)
- */
-#ifdef POSTINC
-# define OFF 0
-# define PUP(a) *(a)++
-#else
-# define OFF 1
-# define PUP(a) *++(a)
-#endif
-
-/*
- Decode literal, length, and distance codes and write out the resulting
- literal and match bytes until either not enough input or output is
- available, an end-of-block is encountered, or a data error is encountered.
- When large enough input and output buffers are supplied to inflate(), for
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
-
- Entry assumptions:
-
- state->mode == LEN
- strm->avail_in >= 6
- strm->avail_out >= 258
- start >= strm->avail_out
- state->bits < 8
-
- On return, state->mode is one of:
-
- LEN -- ran out of enough output space or enough available input
- TYPE -- reached end of block code, inflate() to interpret next block
- BAD -- error in block data
-
- Notes:
-
- - The maximum input bits used by a length/distance pair is 15 bits for the
- length code, 5 bits for the length extra, 15 bits for the distance code,
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
- Therefore if strm->avail_in >= 6, then there is enough input to avoid
- checking for available input while decoding.
-
- - The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
- requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
- */
-void inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
- struct inflate_state FAR *state;
- unsigned char FAR *in; /* local strm->next_in */
- unsigned char FAR *last; /* while in < last, enough input available */
- unsigned char FAR *out; /* local strm->next_out */
- unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
- unsigned char FAR *end; /* while out < end, enough space available */
-#ifdef INFLATE_STRICT
- unsigned dmax; /* maximum distance from zlib header */
-#endif
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned write; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
- unsigned long hold; /* local strm->hold */
- unsigned bits; /* local strm->bits */
- code const FAR *lcode; /* local strm->lencode */
- code const FAR *dcode; /* local strm->distcode */
- unsigned lmask; /* mask for first level of length codes */
- unsigned dmask; /* mask for first level of distance codes */
- code this; /* retrieved table entry */
- unsigned op; /* code bits, operation, extra bits, or */
- /* window position, window bytes to copy */
- unsigned len; /* match length, unused bytes */
- unsigned dist; /* match distance */
- unsigned char FAR *from; /* where to copy match from */
-
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
- in = strm->next_in - OFF;
- last = in + (strm->avail_in - 5);
- out = strm->next_out - OFF;
- beg = out - (start - strm->avail_out);
- end = out + (strm->avail_out - 257);
-#ifdef INFLATE_STRICT
- dmax = state->dmax;
-#endif
- wsize = state->wsize;
- whave = state->whave;
- write = state->write;
- window = state->window;
- hold = state->hold;
- bits = state->bits;
- lcode = state->lencode;
- dcode = state->distcode;
- lmask = (1U << state->lenbits) - 1;
- dmask = (1U << state->distbits) - 1;
-
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
- do {
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- this = lcode[hold & lmask];
- dolen:
- op = (unsigned)(this.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(this.op);
- if (op == 0) { /* literal */
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- PUP(out) = (unsigned char)(this.val);
- }
- else if (op & 16) { /* length base */
- len = (unsigned)(this.val);
- op &= 15; /* number of extra bits */
- if (op) {
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- len += (unsigned)hold & ((1U << op) - 1);
- hold >>= op;
- bits -= op;
- }
- Tracevv((stderr, "inflate: length %u\n", len));
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- this = dcode[hold & dmask];
- dodist:
- op = (unsigned)(this.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(this.op);
- if (op & 16) { /* distance base */
- dist = (unsigned)(this.val);
- op &= 15; /* number of extra bits */
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- }
- dist += (unsigned)hold & ((1U << op) - 1);
-#ifdef INFLATE_STRICT
- if (dist > dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- hold >>= op;
- bits -= op;
- Tracevv((stderr, "inflate: distance %u\n", dist));
- op = (unsigned)(out - beg); /* max distance in output */
- if (dist > op) { /* see if copy from window */
- op = dist - op; /* distance back in window */
- if (op > whave) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- from = window - OFF;
- if (write == 0) { /* very common case */
- from += wsize - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- else if (write < op) { /* wrap around window */
- from += wsize + write - op;
- op -= write;
- if (op < len) { /* some from end of window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = window - OFF;
- if (write < len) { /* some from start of window */
- op = write;
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- }
- else { /* contiguous in window */
- from += write - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- while (len > 2) {
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- }
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- else {
- from = out - dist; /* copy direct from output */
- do { /* minimum length is three */
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- } while (len > 2);
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- }
- else if ((op & 64) == 0) { /* 2nd level distance code */
- this = dcode[this.val + (hold & ((1U << op) - 1))];
- goto dodist;
- }
- else {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- }
- else if ((op & 64) == 0) { /* 2nd level length code */
- this = lcode[this.val + (hold & ((1U << op) - 1))];
- goto dolen;
- }
- else if (op & 32) { /* end-of-block */
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- else {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- } while (in < last && out < end);
-
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- len = bits >> 3;
- in -= len;
- bits -= len << 3;
- hold &= (1U << bits) - 1;
-
- /* update state and return */
- strm->next_in = in + OFF;
- strm->next_out = out + OFF;
- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
- strm->avail_out = (unsigned)(out < end ?
- 257 + (end - out) : 257 - (out - end));
- state->hold = hold;
- state->bits = bits;
- return;
-}
-
-/*
- inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
- - Using bit fields for code structure
- - Different op definition to avoid & for extra bits (do & for table bits)
- - Three separate decoding do-loops for direct, window, and write == 0
- - Special case for distance > 1 copies to do overlapped load and store copy
- - Explicit branch predictions (based on measured branch probabilities)
- - Deferring match copy and interspersed it with decoding subsequent codes
- - Swapping literal/length else
- - Swapping window/direct else
- - Larger unrolled copy loops (three is about right)
- - Moving len -= 3 statement into middle of loop
- */
-
-#endif /* !ASMINF */
diff --git a/funtools/util/zlib-1.2.3/inffast.h b/funtools/util/zlib-1.2.3/inffast.h
deleted file mode 100644
index 1e88d2d..0000000
--- a/funtools/util/zlib-1.2.3/inffast.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-2003 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-void inflate_fast OF((z_streamp strm, unsigned start));
diff --git a/funtools/util/zlib-1.2.3/inffixed.h b/funtools/util/zlib-1.2.3/inffixed.h
deleted file mode 100644
index 75ed4b5..0000000
--- a/funtools/util/zlib-1.2.3/inffixed.h
+++ /dev/null
@@ -1,94 +0,0 @@
- /* inffixed.h -- table for decoding fixed codes
- * Generated automatically by makefixed().
- */
-
- /* WARNING: this file should *not* be used by applications. It
- is part of the implementation of the compression library and
- is subject to change. Applications should only use zlib.h.
- */
-
- static const code lenfix[512] = {
- {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
- {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
- {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
- {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
- {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
- {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
- {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
- {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
- {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
- {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
- {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
- {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
- {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
- {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
- {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
- {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
- {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
- {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
- {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
- {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
- {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
- {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
- {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
- {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
- {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
- {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
- {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
- {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
- {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
- {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
- {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
- {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
- {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
- {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
- {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
- {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
- {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
- {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
- {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
- {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
- {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
- {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
- {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
- {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
- {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
- {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
- {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
- {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
- {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
- {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
- {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
- {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
- {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
- {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
- {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
- {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
- {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
- {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
- {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
- {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
- {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
- {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
- {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
- {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
- {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
- {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
- {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
- {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
- {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
- {0,9,255}
- };
-
- static const code distfix[32] = {
- {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
- {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
- {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
- {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
- {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
- {22,5,193},{64,5,0}
- };
diff --git a/funtools/util/zlib-1.2.3/inflate.c b/funtools/util/zlib-1.2.3/inflate.c
deleted file mode 100644
index 792fdee..0000000
--- a/funtools/util/zlib-1.2.3/inflate.c
+++ /dev/null
@@ -1,1368 +0,0 @@
-/* inflate.c -- zlib decompression
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * Change history:
- *
- * 1.2.beta0 24 Nov 2002
- * - First version -- complete rewrite of inflate to simplify code, avoid
- * creation of window when not needed, minimize use of window when it is
- * needed, make inffast.c even faster, implement gzip decoding, and to
- * improve code readability and style over the previous zlib inflate code
- *
- * 1.2.beta1 25 Nov 2002
- * - Use pointers for available input and output checking in inffast.c
- * - Remove input and output counters in inffast.c
- * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
- * - Remove unnecessary second byte pull from length extra in inffast.c
- * - Unroll direct copy to three copies per loop in inffast.c
- *
- * 1.2.beta2 4 Dec 2002
- * - Change external routine names to reduce potential conflicts
- * - Correct filename to inffixed.h for fixed tables in inflate.c
- * - Make hbuf[] unsigned char to match parameter type in inflate.c
- * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
- * to avoid negation problem on Alphas (64 bit) in inflate.c
- *
- * 1.2.beta3 22 Dec 2002
- * - Add comments on state->bits assertion in inffast.c
- * - Add comments on op field in inftrees.h
- * - Fix bug in reuse of allocated window after inflateReset()
- * - Remove bit fields--back to byte structure for speed
- * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
- * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
- * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
- * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
- * - Use local copies of stream next and avail values, as well as local bit
- * buffer and bit count in inflate()--for speed when inflate_fast() not used
- *
- * 1.2.beta4 1 Jan 2003
- * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
- * - Move a comment on output buffer sizes from inffast.c to inflate.c
- * - Add comments in inffast.c to introduce the inflate_fast() routine
- * - Rearrange window copies in inflate_fast() for speed and simplification
- * - Unroll last copy for window match in inflate_fast()
- * - Use local copies of window variables in inflate_fast() for speed
- * - Pull out common write == 0 case for speed in inflate_fast()
- * - Make op and len in inflate_fast() unsigned for consistency
- * - Add FAR to lcode and dcode declarations in inflate_fast()
- * - Simplified bad distance check in inflate_fast()
- * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
- * source file infback.c to provide a call-back interface to inflate for
- * programs like gzip and unzip -- uses window as output buffer to avoid
- * window copying
- *
- * 1.2.beta5 1 Jan 2003
- * - Improved inflateBack() interface to allow the caller to provide initial
- * input in strm.
- * - Fixed stored blocks bug in inflateBack()
- *
- * 1.2.beta6 4 Jan 2003
- * - Added comments in inffast.c on effectiveness of POSTINC
- * - Typecasting all around to reduce compiler warnings
- * - Changed loops from while (1) or do {} while (1) to for (;;), again to
- * make compilers happy
- * - Changed type of window in inflateBackInit() to unsigned char *
- *
- * 1.2.beta7 27 Jan 2003
- * - Changed many types to unsigned or unsigned short to avoid warnings
- * - Added inflateCopy() function
- *
- * 1.2.0 9 Mar 2003
- * - Changed inflateBack() interface to provide separate opaque descriptors
- * for the in() and out() functions
- * - Changed inflateBack() argument and in_func typedef to swap the length
- * and buffer address return values for the input function
- * - Check next_in and next_out for Z_NULL on entry to inflate()
- *
- * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifdef MAKEFIXED
-# ifndef BUILDFIXED
-# define BUILDFIXED
-# endif
-#endif
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, unsigned out));
-#ifdef BUILDFIXED
- void makefixed OF((void));
-#endif
-local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
- unsigned len));
-
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- strm->total_in = strm->total_out = state->total = 0;
- strm->msg = Z_NULL;
- strm->adler = 1; /* to support ill-conceived Java test suite */
- state->mode = HEAD;
- state->last = 0;
- state->havedict = 0;
- state->dmax = 32768U;
- state->head = Z_NULL;
- state->wsize = 0;
- state->whave = 0;
- state->write = 0;
- state->hold = 0;
- state->bits = 0;
- state->lencode = state->distcode = state->next = state->codes;
- Tracev((stderr, "inflate: reset\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
-int bits;
-int value;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
- value &= (1L << bits) - 1;
- state->hold += value << state->bits;
- state->bits += bits;
- return Z_OK;
-}
-
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL) return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
- }
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
- state = (struct inflate_state FAR *)
- ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- if (windowBits < 0) {
- state->wrap = 0;
- windowBits = -windowBits;
- }
- else {
- state->wrap = (windowBits >> 4) + 1;
-#ifdef GUNZIP
- if (windowBits < 48) windowBits &= 15;
-#endif
- }
- if (windowBits < 8 || windowBits > 15) {
- ZFREE(strm, state);
- strm->state = Z_NULL;
- return Z_STREAM_ERROR;
- }
- state->wbits = (unsigned)windowBits;
- state->window = Z_NULL;
- return inflateReset(strm);
-}
-
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
-{
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-#ifdef MAKEFIXED
-#include <stdio.h>
-
-/*
- Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
- defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
- those tables to stdout, which would be piped to inffixed.h. A small program
- can simply call makefixed to do this:
-
- void makefixed(void);
-
- int main(void)
- {
- makefixed();
- return 0;
- }
-
- Then that can be linked with zlib built with MAKEFIXED defined and run:
-
- a.out > inffixed.h
- */
-void makefixed()
-{
- unsigned low, size;
- struct inflate_state state;
-
- fixedtables(&state);
- puts(" /* inffixed.h -- table for decoding fixed codes");
- puts(" * Generated automatically by makefixed().");
- puts(" */");
- puts("");
- puts(" /* WARNING: this file should *not* be used by applications.");
- puts(" It is part of the implementation of this library and is");
- puts(" subject to change. Applications should only use zlib.h.");
- puts(" */");
- puts("");
- size = 1U << 9;
- printf(" static const code lenfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 7) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
- state.lencode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
- size = 1U << 5;
- printf("\n static const code distfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 6) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
- state.distcode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
-}
-#endif /* MAKEFIXED */
-
-/*
- Update the window with the last wsize (normally 32K) bytes written before
- returning. If window does not exist yet, create it. This is only called
- when a window is already in use, or when output has been written during this
- inflate call, but the end of the deflate stream has not been reached yet.
- It is also called to create a window for dictionary data when a dictionary
- is loaded.
-
- Providing output buffers larger than 32K to inflate() should provide a speed
- advantage, since only the last 32K of output is copied to the sliding window
- upon return from inflate(), and since all distances after the first 32K of
- output will fall in the output data, making match copies simpler and faster.
- The advantage may be dependent on the size of the processor's data caches.
- */
-local int updatewindow(strm, out)
-z_streamp strm;
-unsigned out;
-{
- struct inflate_state FAR *state;
- unsigned copy, dist;
-
- state = (struct inflate_state FAR *)strm->state;
-
- /* if it hasn't been done already, allocate space for the window */
- if (state->window == Z_NULL) {
- state->window = (unsigned char FAR *)
- ZALLOC(strm, 1U << state->wbits,
- sizeof(unsigned char));
- if (state->window == Z_NULL) return 1;
- }
-
- /* if window not in use yet, initialize */
- if (state->wsize == 0) {
- state->wsize = 1U << state->wbits;
- state->write = 0;
- state->whave = 0;
- }
-
- /* copy state->wsize or less output bytes into the circular window */
- copy = out - strm->avail_out;
- if (copy >= state->wsize) {
- zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
- state->write = 0;
- state->whave = state->wsize;
- }
- else {
- dist = state->wsize - state->write;
- if (dist > copy) dist = copy;
- zmemcpy(state->window + state->write, strm->next_out - copy, dist);
- copy -= dist;
- if (copy) {
- zmemcpy(state->window, strm->next_out - copy, copy);
- state->write = copy;
- state->whave = state->wsize;
- }
- else {
- state->write += dist;
- if (state->write == state->wsize) state->write = 0;
- if (state->whave < state->wsize) state->whave += dist;
- }
- }
- return 0;
-}
-
-/* Macros for inflate(): */
-
-/* check function to use adler32() for zlib or crc32() for gzip */
-#ifdef GUNZIP
-# define UPDATE(check, buf, len) \
- (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
-#else
-# define UPDATE(check, buf, len) adler32(check, buf, len)
-#endif
-
-/* check macros for header crc */
-#ifdef GUNZIP
-# define CRC2(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- check = crc32(check, hbuf, 2); \
- } while (0)
-
-# define CRC4(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- hbuf[2] = (unsigned char)((word) >> 16); \
- hbuf[3] = (unsigned char)((word) >> 24); \
- check = crc32(check, hbuf, 4); \
- } while (0)
-#endif
-
-/* Load registers with state in inflate() for speed */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Restore state from registers in inflate() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflate()
- if there is no input available. */
-#define PULLBYTE() \
- do { \
- if (have == 0) goto inf_leave; \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflate(). */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
-/*
- inflate() uses a state machine to process as much input data and generate as
- much output data as possible before returning. The state machine is
- structured roughly as follows:
-
- for (;;) switch (state) {
- ...
- case STATEn:
- if (not enough input data or output space to make progress)
- return;
- ... make progress ...
- state = STATEm;
- break;
- ...
- }
-
- so when inflate() is called again, the same case is attempted again, and
- if the appropriate resources are provided, the machine proceeds to the
- next state. The NEEDBITS() macro is usually the way the state evaluates
- whether it can proceed or should return. NEEDBITS() does the return if
- the requested bits are not available. The typical use of the BITS macros
- is:
-
- NEEDBITS(n);
- ... do something with BITS(n) ...
- DROPBITS(n);
-
- where NEEDBITS(n) either returns from inflate() if there isn't enough
- input left to load n bits into the accumulator, or it continues. BITS(n)
- gives the low n bits in the accumulator. When done, DROPBITS(n) drops
- the low n bits off the accumulator. INITBITS() clears the accumulator
- and sets the number of available bits to zero. BYTEBITS() discards just
- enough bits to put the accumulator on a byte boundary. After BYTEBITS()
- and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
-
- NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
- if there is no input available. The decoding of variable length codes uses
- PULLBYTE() directly in order to pull just enough bytes to decode the next
- code, and no more.
-
- Some states loop until they get enough input, making sure that enough
- state information is maintained to continue the loop where it left off
- if NEEDBITS() returns in the loop. For example, want, need, and keep
- would all have to actually be part of the saved state in case NEEDBITS()
- returns:
-
- case STATEw:
- while (want < need) {
- NEEDBITS(n);
- keep[want++] = BITS(n);
- DROPBITS(n);
- }
- state = STATEx;
- case STATEx:
-
- As shown above, if the next state is also the next case, then the break
- is omitted.
-
- A state may also return if there is not enough output space available to
- complete that state. Those states are copying stored data, writing a
- literal byte, and copying a matching string.
-
- When returning, a "goto inf_leave" is used to update the total counters,
- update the check value, and determine whether any progress has been made
- during that inflate() call in order to return the proper return code.
- Progress is defined as a change in either strm->avail_in or strm->avail_out.
- When there is a window, goto inf_leave will update the window with the last
- output written. If a goto inf_leave occurs in the middle of decompression
- and there is no window currently, goto inf_leave will create one and copy
- output to the window for the next call of inflate().
-
- In this implementation, the flush parameter of inflate() only affects the
- return code (per zlib.h). inflate() always writes as much as possible to
- strm->next_out, given the space available and the provided input--the effect
- documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
- the allocation of and copying into a sliding window until necessary, which
- provides the effect documented in zlib.h for Z_FINISH when the entire input
- stream available. So the only thing the flush parameter actually does is:
- when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
- will return Z_BUF_ERROR if it has not reached the end of the stream.
- */
-
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned in, out; /* save starting available input and output */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code this; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
-#ifdef GUNZIP
- unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
-#endif
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0))
- return Z_STREAM_ERROR;
-
- state = (struct inflate_state FAR *)strm->state;
- if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
- LOAD();
- in = have;
- out = left;
- ret = Z_OK;
- for (;;)
- switch (state->mode) {
- case HEAD:
- if (state->wrap == 0) {
- state->mode = TYPEDO;
- break;
- }
- NEEDBITS(16);
-#ifdef GUNZIP
- if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
- state->check = crc32(0L, Z_NULL, 0);
- CRC2(state->check, hold);
- INITBITS();
- state->mode = FLAGS;
- break;
- }
- state->flags = 0; /* expect zlib header */
- if (state->head != Z_NULL)
- state->head->done = -1;
- if (!(state->wrap & 1) || /* check if zlib header allowed */
-#else
- if (
-#endif
- ((BITS(8) << 8) + (hold >> 8)) % 31) {
- strm->msg = (char *)"incorrect header check";
- state->mode = BAD;
- break;
- }
- if (BITS(4) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- DROPBITS(4);
- len = BITS(4) + 8;
- if (len > state->wbits) {
- strm->msg = (char *)"invalid window size";
- state->mode = BAD;
- break;
- }
- state->dmax = 1U << len;
- Tracev((stderr, "inflate: zlib header ok\n"));
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = hold & 0x200 ? DICTID : TYPE;
- INITBITS();
- break;
-#ifdef GUNZIP
- case FLAGS:
- NEEDBITS(16);
- state->flags = (int)(hold);
- if ((state->flags & 0xff) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- if (state->flags & 0xe000) {
- strm->msg = (char *)"unknown header flags set";
- state->mode = BAD;
- break;
- }
- if (state->head != Z_NULL)
- state->head->text = (int)((hold >> 8) & 1);
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = TIME;
- case TIME:
- NEEDBITS(32);
- if (state->head != Z_NULL)
- state->head->time = hold;
- if (state->flags & 0x0200) CRC4(state->check, hold);
- INITBITS();
- state->mode = OS;
- case OS:
- NEEDBITS(16);
- if (state->head != Z_NULL) {
- state->head->xflags = (int)(hold & 0xff);
- state->head->os = (int)(hold >> 8);
- }
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = EXLEN;
- case EXLEN:
- if (state->flags & 0x0400) {
- NEEDBITS(16);
- state->length = (unsigned)(hold);
- if (state->head != Z_NULL)
- state->head->extra_len = (unsigned)hold;
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- }
- else if (state->head != Z_NULL)
- state->head->extra = Z_NULL;
- state->mode = EXTRA;
- case EXTRA:
- if (state->flags & 0x0400) {
- copy = state->length;
- if (copy > have) copy = have;
- if (copy) {
- if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
- zmemcpy(state->head->extra + len, next,
- len + copy > state->head->extra_max ?
- state->head->extra_max - len : copy);
- }
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- state->length -= copy;
- }
- if (state->length) goto inf_leave;
- }
- state->length = 0;
- state->mode = NAME;
- case NAME:
- if (state->flags & 0x0800) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->name != Z_NULL &&
- state->length < state->head->name_max)
- state->head->name[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->name = Z_NULL;
- state->length = 0;
- state->mode = COMMENT;
- case COMMENT:
- if (state->flags & 0x1000) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->comment != Z_NULL &&
- state->length < state->head->comm_max)
- state->head->comment[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->comment = Z_NULL;
- state->mode = HCRC;
- case HCRC:
- if (state->flags & 0x0200) {
- NEEDBITS(16);
- if (hold != (state->check & 0xffff)) {
- strm->msg = (char *)"header crc mismatch";
- state->mode = BAD;
- break;
- }
- INITBITS();
- }
- if (state->head != Z_NULL) {
- state->head->hcrc = (int)((state->flags >> 9) & 1);
- state->head->done = 1;
- }
- strm->adler = state->check = crc32(0L, Z_NULL, 0);
- state->mode = TYPE;
- break;
-#endif
- case DICTID:
- NEEDBITS(32);
- strm->adler = state->check = REVERSE(hold);
- INITBITS();
- state->mode = DICT;
- case DICT:
- if (state->havedict == 0) {
- RESTORE();
- return Z_NEED_DICT;
- }
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = TYPE;
- case TYPE:
- if (flush == Z_BLOCK) goto inf_leave;
- case TYPEDO:
- if (state->last) {
- BYTEBITS();
- state->mode = CHECK;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
- case STORED:
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
- state->mode = COPY;
- case COPY:
- copy = state->length;
- if (copy) {
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- if (copy == 0) goto inf_leave;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- break;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
- case TABLE:
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
- state->have = 0;
- state->mode = LENLENS;
- case LENLENS:
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
- state->have = 0;
- state->mode = CODELENS;
- case CODELENS:
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.val < 16) {
- NEEDBITS(this.bits);
- DROPBITS(this.bits);
- state->lens[state->have++] = this.val;
- }
- else {
- if (this.val == 16) {
- NEEDBITS(this.bits + 2);
- DROPBITS(this.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = state->lens[state->have - 1];
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (this.val == 17) {
- NEEDBITS(this.bits + 3);
- DROPBITS(this.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(this.bits + 7);
- DROPBITS(this.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* build code tables */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
- case LEN:
- if (have >= 6 && left >= 258) {
- RESTORE();
- inflate_fast(strm, out);
- LOAD();
- break;
- }
- for (;;) {
- this = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if (this.op && (this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- state->length = (unsigned)this.val;
- if ((int)(this.op) == 0) {
- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", this.val));
- state->mode = LIT;
- break;
- }
- if (this.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- state->extra = (unsigned)(this.op) & 15;
- state->mode = LENEXT;
- case LENEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
- state->mode = DIST;
- case DIST:
- for (;;) {
- this = state->distcode[BITS(state->distbits)];
- if ((unsigned)(this.bits) <= bits) break;
- PULLBYTE();
- }
- if ((this.op & 0xf0) == 0) {
- last = this;
- for (;;) {
- this = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + this.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(this.bits);
- if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)this.val;
- state->extra = (unsigned)(this.op) & 15;
- state->mode = DISTEXT;
- case DISTEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
-#ifdef INFLATE_STRICT
- if (state->offset > state->dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- if (state->offset > state->whave + out - left) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
- state->mode = MATCH;
- case MATCH:
- if (left == 0) goto inf_leave;
- copy = out - left;
- if (state->offset > copy) { /* copy from window */
- copy = state->offset - copy;
- if (copy > state->write) {
- copy -= state->write;
- from = state->window + (state->wsize - copy);
- }
- else
- from = state->window + (state->write - copy);
- if (copy > state->length) copy = state->length;
- }
- else { /* copy from output */
- from = put - state->offset;
- copy = state->length;
- }
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
- case LIT:
- if (left == 0) goto inf_leave;
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- case CHECK:
- if (state->wrap) {
- NEEDBITS(32);
- out -= left;
- strm->total_out += out;
- state->total += out;
- if (out)
- strm->adler = state->check =
- UPDATE(state->check, put - out, out);
- out = left;
- if ((
-#ifdef GUNZIP
- state->flags ? hold :
-#endif
- REVERSE(hold)) != state->check) {
- strm->msg = (char *)"incorrect data check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: check matches trailer\n"));
- }
-#ifdef GUNZIP
- state->mode = LENGTH;
- case LENGTH:
- if (state->wrap && state->flags) {
- NEEDBITS(32);
- if (hold != (state->total & 0xffffffffUL)) {
- strm->msg = (char *)"incorrect length check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: length matches trailer\n"));
- }
-#endif
- state->mode = DONE;
- case DONE:
- ret = Z_STREAM_END;
- goto inf_leave;
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
- case MEM:
- return Z_MEM_ERROR;
- case SYNC:
- default:
- return Z_STREAM_ERROR;
- }
-
- /*
- Return from inflate(), updating the total counts and the check value.
- If there was no progress during the inflate() call, return a buffer
- error. Call updatewindow() to create and/or update the window state.
- Note: a memory error from inflate() is non-recoverable.
- */
- inf_leave:
- RESTORE();
- if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
- if (updatewindow(strm, out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- in -= strm->avail_in;
- out -= strm->avail_out;
- strm->total_in += in;
- strm->total_out += out;
- state->total += out;
- if (state->wrap && out)
- strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
- strm->data_type = state->bits + (state->last ? 64 : 0) +
- (state->mode == TYPE ? 128 : 0);
- if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
- ret = Z_BUF_ERROR;
- return ret;
-}
-
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->window != Z_NULL) ZFREE(strm, state->window);
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-const Bytef *dictionary;
-uInt dictLength;
-{
- struct inflate_state FAR *state;
- unsigned long id;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->wrap != 0 && state->mode != DICT)
- return Z_STREAM_ERROR;
-
- /* check for correct dictionary id */
- if (state->mode == DICT) {
- id = adler32(0L, Z_NULL, 0);
- id = adler32(id, dictionary, dictLength);
- if (id != state->check)
- return Z_DATA_ERROR;
- }
-
- /* copy dictionary to window */
- if (updatewindow(strm, strm->avail_out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- if (dictLength > state->wsize) {
- zmemcpy(state->window, dictionary + dictLength - state->wsize,
- state->wsize);
- state->whave = state->wsize;
- }
- else {
- zmemcpy(state->window + state->wsize - dictLength, dictionary,
- dictLength);
- state->whave = dictLength;
- }
- state->havedict = 1;
- Tracev((stderr, "inflate: dictionary set\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateGetHeader(strm, head)
-z_streamp strm;
-gz_headerp head;
-{
- struct inflate_state FAR *state;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
-
- /* save header structure */
- state->head = head;
- head->done = 0;
- return Z_OK;
-}
-
-/*
- Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
- or when out of input. When called, *have is the number of pattern bytes
- found in order so far, in 0..3. On return *have is updated to the new
- state. If on return *have equals four, then the pattern was found and the
- return value is how many bytes were read including the last byte of the
- pattern. If *have is less than four, then the pattern has not been found
- yet and the return value is len. In the latter case, syncsearch() can be
- called again with more data and the *have state. *have is initialized to
- zero for the first call.
- */
-local unsigned syncsearch(have, buf, len)
-unsigned FAR *have;
-unsigned char FAR *buf;
-unsigned len;
-{
- unsigned got;
- unsigned next;
-
- got = *have;
- next = 0;
- while (next < len && got < 4) {
- if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
- got++;
- else if (buf[next])
- got = 0;
- else
- got = 4 - got;
- next++;
- }
- *have = got;
- return next;
-}
-
-int ZEXPORT inflateSync(strm)
-z_streamp strm;
-{
- unsigned len; /* number of bytes to look at or looked at */
- unsigned long in, out; /* temporary to save total_in and total_out */
- unsigned char buf[4]; /* to restore bit buffer to byte string */
- struct inflate_state FAR *state;
-
- /* check parameters */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
-
- /* if first time, start search in bit buffer */
- if (state->mode != SYNC) {
- state->mode = SYNC;
- state->hold <<= state->bits & 7;
- state->bits -= state->bits & 7;
- len = 0;
- while (state->bits >= 8) {
- buf[len++] = (unsigned char)(state->hold);
- state->hold >>= 8;
- state->bits -= 8;
- }
- state->have = 0;
- syncsearch(&(state->have), buf, len);
- }
-
- /* search available input */
- len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
- strm->avail_in -= len;
- strm->next_in += len;
- strm->total_in += len;
-
- /* return no joy or set up to restart inflate() on a new block */
- if (state->have != 4) return Z_DATA_ERROR;
- in = strm->total_in; out = strm->total_out;
- inflateReset(strm);
- strm->total_in = in; strm->total_out = out;
- state->mode = TYPE;
- return Z_OK;
-}
-
-/*
- Returns true if inflate is currently at the end of a block generated by
- Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
- implementation to provide an additional safety check. PPP uses
- Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
- block. When decompressing, PPP checks that at the end of input packet,
- inflate is waiting for these length bytes.
- */
-int ZEXPORT inflateSyncPoint(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- return state->mode == STORED && state->bits == 0;
-}
-
-int ZEXPORT inflateCopy(dest, source)
-z_streamp dest;
-z_streamp source;
-{
- struct inflate_state FAR *state;
- struct inflate_state FAR *copy;
- unsigned char FAR *window;
- unsigned wsize;
-
- /* check input */
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)source->state;
-
- /* allocate space */
- copy = (struct inflate_state FAR *)
- ZALLOC(source, 1, sizeof(struct inflate_state));
- if (copy == Z_NULL) return Z_MEM_ERROR;
- window = Z_NULL;
- if (state->window != Z_NULL) {
- window = (unsigned char FAR *)
- ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
- if (window == Z_NULL) {
- ZFREE(source, copy);
- return Z_MEM_ERROR;
- }
- }
-
- /* copy state */
- zmemcpy(dest, source, sizeof(z_stream));
- zmemcpy(copy, state, sizeof(struct inflate_state));
- if (state->lencode >= state->codes &&
- state->lencode <= state->codes + ENOUGH - 1) {
- copy->lencode = copy->codes + (state->lencode - state->codes);
- copy->distcode = copy->codes + (state->distcode - state->codes);
- }
- copy->next = copy->codes + (state->next - state->codes);
- if (window != Z_NULL) {
- wsize = 1U << state->wbits;
- zmemcpy(window, state->window, wsize);
- }
- copy->window = window;
- dest->state = (struct internal_state FAR *)copy;
- return Z_OK;
-}
diff --git a/funtools/util/zlib-1.2.3/inflate.h b/funtools/util/zlib-1.2.3/inflate.h
deleted file mode 100644
index 07bd3e7..0000000
--- a/funtools/util/zlib-1.2.3/inflate.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* inflate.h -- internal inflate state definition
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip decoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GUNZIP
-#endif
-
-/* Possible inflate modes between inflate() calls */
-typedef enum {
- HEAD, /* i: waiting for magic header */
- FLAGS, /* i: waiting for method and flags (gzip) */
- TIME, /* i: waiting for modification time (gzip) */
- OS, /* i: waiting for extra flags and operating system (gzip) */
- EXLEN, /* i: waiting for extra length (gzip) */
- EXTRA, /* i: waiting for extra bytes (gzip) */
- NAME, /* i: waiting for end of file name (gzip) */
- COMMENT, /* i: waiting for end of comment (gzip) */
- HCRC, /* i: waiting for header crc (gzip) */
- DICTID, /* i: waiting for dictionary check value */
- DICT, /* waiting for inflateSetDictionary() call */
- TYPE, /* i: waiting for type bits, including last-flag bit */
- TYPEDO, /* i: same, but skip check to exit inflate on new block */
- STORED, /* i: waiting for stored size (length and complement) */
- COPY, /* i/o: waiting for input or output to copy stored block */
- TABLE, /* i: waiting for dynamic block table lengths */
- LENLENS, /* i: waiting for code length code lengths */
- CODELENS, /* i: waiting for length/lit and distance code lengths */
- LEN, /* i: waiting for length/lit code */
- LENEXT, /* i: waiting for length extra bits */
- DIST, /* i: waiting for distance code */
- DISTEXT, /* i: waiting for distance extra bits */
- MATCH, /* o: waiting for output space to copy string */
- LIT, /* o: waiting for output space to write literal */
- CHECK, /* i: waiting for 32-bit check value */
- LENGTH, /* i: waiting for 32-bit length (gzip) */
- DONE, /* finished check, done -- remain here until reset */
- BAD, /* got a data error -- remain here until reset */
- MEM, /* got an inflate() memory error -- remain here until reset */
- SYNC /* looking for synchronization bytes to restart inflate() */
-} inflate_mode;
-
-/*
- State transitions between above modes -
-
- (most modes can go to the BAD or MEM mode -- not shown for clarity)
-
- Process header:
- HEAD -> (gzip) or (zlib)
- (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
- NAME -> COMMENT -> HCRC -> TYPE
- (zlib) -> DICTID or TYPE
- DICTID -> DICT -> TYPE
- Read deflate blocks:
- TYPE -> STORED or TABLE or LEN or CHECK
- STORED -> COPY -> TYPE
- TABLE -> LENLENS -> CODELENS -> LEN
- Read deflate codes:
- LEN -> LENEXT or LIT or TYPE
- LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
- LIT -> LEN
- Process trailer:
- CHECK -> LENGTH -> DONE
- */
-
-/* state maintained between inflate() calls. Approximately 7K bytes. */
-struct inflate_state {
- inflate_mode mode; /* current inflate mode */
- int last; /* true if processing last block */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- int havedict; /* true if dictionary provided */
- int flags; /* gzip header method and flags (0 if zlib) */
- unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
- unsigned long check; /* protected copy of check value */
- unsigned long total; /* protected copy of output count */
- gz_headerp head; /* where to save gzip header information */
- /* sliding window */
- unsigned wbits; /* log base 2 of requested window size */
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned write; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- /* bit accumulator */
- unsigned long hold; /* input bit accumulator */
- unsigned bits; /* number of bits in "in" */
- /* for string and stored block copying */
- unsigned length; /* literal or length of data to copy */
- unsigned offset; /* distance back to copy string from */
- /* for table and code decoding */
- unsigned extra; /* extra bits needed */
- /* fixed and dynamic code tables */
- code const FAR *lencode; /* starting table for length/literal codes */
- code const FAR *distcode; /* starting table for distance codes */
- unsigned lenbits; /* index bits for lencode */
- unsigned distbits; /* index bits for distcode */
- /* dynamic table building */
- unsigned ncode; /* number of code length code lengths */
- unsigned nlen; /* number of length code lengths */
- unsigned ndist; /* number of distance code lengths */
- unsigned have; /* number of code lengths in lens[] */
- code FAR *next; /* next available space in codes[] */
- unsigned short lens[320]; /* temporary storage for code lengths */
- unsigned short work[288]; /* work area for code table building */
- code codes[ENOUGH]; /* space for code tables */
-};
diff --git a/funtools/util/zlib-1.2.3/inftrees.c b/funtools/util/zlib-1.2.3/inftrees.c
deleted file mode 100644
index 8a9c13f..0000000
--- a/funtools/util/zlib-1.2.3/inftrees.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-
-#define MAXBITS 15
-
-const char inflate_copyright[] =
- " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/*
- Build a set of tables to decode the provided canonical Huffman code.
- The code lengths are lens[0..codes-1]. The result starts at *table,
- whose indices are 0..2^bits-1. work is a writable array of at least
- lens shorts, which is used as a work area. type is the type of code
- to be generated, CODES, LENS, or DISTS. On return, zero is success,
- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
- on return points to the next available entry's address. bits is the
- requested root table index bits, and on return it is the actual root
- table index bits. It will differ if the request is greater than the
- longest code or if it is less than the shortest code.
- */
-int inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
-{
- unsigned len; /* a code's length in bits */
- unsigned sym; /* index of code symbols */
- unsigned min, max; /* minimum and maximum code lengths */
- unsigned root; /* number of index bits for root table */
- unsigned curr; /* number of index bits for current table */
- unsigned drop; /* code bits to drop for sub-table */
- int left; /* number of prefix codes available */
- unsigned used; /* code entries in table used */
- unsigned huff; /* Huffman code */
- unsigned incr; /* for incrementing code, index */
- unsigned fill; /* index for replicating entries */
- unsigned low; /* low bits for current root entry */
- unsigned mask; /* mask for low root bits */
- code this; /* table entry for duplication */
- code FAR *next; /* next available space in table */
- const unsigned short FAR *base; /* base value table to use */
- const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
- unsigned short count[MAXBITS+1]; /* number of codes of each length */
- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
- static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577, 0, 0};
- static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
- 28, 28, 29, 29, 64, 64};
-
- /*
- Process a set of code lengths to create a canonical Huffman code. The
- code lengths are lens[0..codes-1]. Each length corresponds to the
- symbols 0..codes-1. The Huffman code is generated by first sorting the
- symbols by length from short to long, and retaining the symbol order
- for codes with equal lengths. Then the code starts with all zero bits
- for the first code of the shortest length, and the codes are integer
- increments for the same length, and zeros are appended as the length
- increases. For the deflate format, these bits are stored backwards
- from their more natural integer increment ordering, and so when the
- decoding tables are built in the large loop below, the integer codes
- are incremented backwards.
-
- This routine assumes, but does not check, that all of the entries in
- lens[] are in the range 0..MAXBITS. The caller must assure this.
- 1..MAXBITS is interpreted as that code length. zero means that that
- symbol does not occur in this code.
-
- The codes are sorted by computing a count of codes for each length,
- creating from that a table of starting indices for each length in the
- sorted table, and then entering the symbols in order in the sorted
- table. The sorted table is work[], with that space being provided by
- the caller.
-
- The length counts are used for other purposes as well, i.e. finding
- the minimum and maximum length codes, determining if there are any
- codes at all, checking for a valid set of lengths, and looking ahead
- at length counts to determine sub-table sizes when building the
- decoding tables.
- */
-
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
- for (len = 0; len <= MAXBITS; len++)
- count[len] = 0;
- for (sym = 0; sym < codes; sym++)
- count[lens[sym]]++;
-
- /* bound code lengths, force root to be within code lengths */
- root = *bits;
- for (max = MAXBITS; max >= 1; max--)
- if (count[max] != 0) break;
- if (root > max) root = max;
- if (max == 0) { /* no symbols to code at all */
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)1;
- this.val = (unsigned short)0;
- *(*table)++ = this; /* make a table to force an error */
- *(*table)++ = this;
- *bits = 1;
- return 0; /* no symbols, but wait for decoding to report error */
- }
- for (min = 1; min <= MAXBITS; min++)
- if (count[min] != 0) break;
- if (root < min) root = min;
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1;
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1;
- left -= count[len];
- if (left < 0) return -1; /* over-subscribed */
- }
- if (left > 0 && (type == CODES || max != 1))
- return -1; /* incomplete set */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + count[len];
-
- /* sort symbols by length, by symbol order within each length */
- for (sym = 0; sym < codes; sym++)
- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
-
- /*
- Create and fill in decoding tables. In this loop, the table being
- filled is at next and has curr index bits. The code being used is huff
- with length len. That code is converted to an index by dropping drop
- bits off of the bottom. For codes where len is less than drop + curr,
- those top drop + curr - len bits are incremented through all values to
- fill the table with replicated entries.
-
- root is the number of index bits for the root table. When len exceeds
- root, sub-tables are created pointed to by the root entry with an index
- of the low root bits of huff. This is saved in low to check for when a
- new sub-table should be started. drop is zero when the root table is
- being filled, and drop is root when sub-tables are being filled.
-
- When a new sub-table is needed, it is necessary to look ahead in the
- code lengths to determine what size sub-table is needed. The length
- counts are used for this, and so count[] is decremented as codes are
- entered in the tables.
-
- used keeps track of how many table entries have been allocated from the
- provided *table space. It is checked when a LENS table is being made
- against the space in *table, ENOUGH, minus the maximum space needed by
- the worst case distance code, MAXD. This should never happen, but the
- sufficiency of ENOUGH has not been proven exhaustively, hence the check.
- This assumes that when type == LENS, bits == 9.
-
- sym increments through all symbols, and the loop terminates when
- all codes of length max, i.e. all codes, have been processed. This
- routine permits incomplete codes, so another loop after this one fills
- in the rest of the decoding tables with invalid code markers.
- */
-
- /* set up for code type */
- switch (type) {
- case CODES:
- base = extra = work; /* dummy value--not used */
- end = 19;
- break;
- case LENS:
- base = lbase;
- base -= 257;
- extra = lext;
- extra -= 257;
- end = 256;
- break;
- default: /* DISTS */
- base = dbase;
- extra = dext;
- end = -1;
- }
-
- /* initialize state for loop */
- huff = 0; /* starting code */
- sym = 0; /* starting code symbol */
- len = min; /* starting code length */
- next = *table; /* current table to fill in */
- curr = root; /* current table index bits */
- drop = 0; /* current bits to drop from code for index */
- low = (unsigned)(-1); /* trigger new sub-table when len > root */
- used = 1U << root; /* use root table entries */
- mask = used - 1; /* mask for comparing low */
-
- /* check available table space */
- if (type == LENS && used >= ENOUGH - MAXD)
- return 1;
-
- /* process all codes and make table entries */
- for (;;) {
- /* create table entry */
- this.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
- this.op = (unsigned char)0;
- this.val = work[sym];
- }
- else if ((int)(work[sym]) > end) {
- this.op = (unsigned char)(extra[work[sym]]);
- this.val = base[work[sym]];
- }
- else {
- this.op = (unsigned char)(32 + 64); /* end of block */
- this.val = 0;
- }
-
- /* replicate for those indices with low len bits equal to huff */
- incr = 1U << (len - drop);
- fill = 1U << curr;
- min = fill; /* save offset to next table */
- do {
- fill -= incr;
- next[(huff >> drop) + fill] = this;
- } while (fill != 0);
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
-
- /* go to next symbol, update count, len */
- sym++;
- if (--(count[len]) == 0) {
- if (len == max) break;
- len = lens[work[sym]];
- }
-
- /* create new sub-table if needed */
- if (len > root && (huff & mask) != low) {
- /* if first time, transition to sub-tables */
- if (drop == 0)
- drop = root;
-
- /* increment past last table */
- next += min; /* here min is 1 << curr */
-
- /* determine length of next table */
- curr = len - drop;
- left = (int)(1 << curr);
- while (curr + drop < max) {
- left -= count[curr + drop];
- if (left <= 0) break;
- curr++;
- left <<= 1;
- }
-
- /* check for enough space */
- used += 1U << curr;
- if (type == LENS && used >= ENOUGH - MAXD)
- return 1;
-
- /* point entry in root table to sub-table */
- low = huff & mask;
- (*table)[low].op = (unsigned char)curr;
- (*table)[low].bits = (unsigned char)root;
- (*table)[low].val = (unsigned short)(next - *table);
- }
- }
-
- /*
- Fill in rest of table for incomplete codes. This loop is similar to the
- loop above in incrementing huff for table indices. It is assumed that
- len is equal to curr + drop, so there is no loop needed to increment
- through high index bits. When the current sub-table is filled, the loop
- drops back to the root table to fill in any remaining entries there.
- */
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)(len - drop);
- this.val = (unsigned short)0;
- while (huff != 0) {
- /* when done with sub-table, drop back to root table */
- if (drop != 0 && (huff & mask) != low) {
- drop = 0;
- len = root;
- next = *table;
- this.bits = (unsigned char)len;
- }
-
- /* put invalid code marker in table */
- next[huff >> drop] = this;
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
- }
-
- /* set return parameters */
- *table += used;
- *bits = root;
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/inftrees.h b/funtools/util/zlib-1.2.3/inftrees.h
deleted file mode 100644
index b1104c8..0000000
--- a/funtools/util/zlib-1.2.3/inftrees.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-2005 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Structure for decoding tables. Each entry provides either the
- information needed to do the operation requested by the code that
- indexed that table entry, or it provides a pointer to another
- table that indexes more bits of the code. op indicates whether
- the entry is a pointer to another table, a literal, a length or
- distance, an end-of-block, or an invalid code. For a table
- pointer, the low four bits of op is the number of index bits of
- that table. For a length or distance, the low four bits of op
- is the number of extra bits to get after the code. bits is
- the number of bits in this code or part of the code to drop off
- of the bit buffer. val is the actual byte to output in the case
- of a literal, the base length or distance, or the offset from
- the current table to the next table. Each entry is four bytes. */
-typedef struct {
- unsigned char op; /* operation, extra bits, table bits */
- unsigned char bits; /* bits in this part of the code */
- unsigned short val; /* offset in table or code value */
-} code;
-
-/* op values as set by inflate_table():
- 00000000 - literal
- 0000tttt - table link, tttt != 0 is the number of table index bits
- 0001eeee - length or distance, eeee is the number of extra bits
- 01100000 - end of block
- 01000000 - invalid code
- */
-
-/* Maximum size of dynamic tree. The maximum found in a long but non-
- exhaustive search was 1444 code structures (852 for length/literals
- and 592 for distances, the latter actually the result of an
- exhaustive search). The true maximum is not known, but the value
- below is more than safe. */
-#define ENOUGH 2048
-#define MAXD 592
-
-/* Type of code to build for inftable() */
-typedef enum {
- CODES,
- LENS,
- DISTS
-} codetype;
-
-extern int inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
diff --git a/funtools/util/zlib-1.2.3/make_vms.com b/funtools/util/zlib-1.2.3/make_vms.com
deleted file mode 100755
index c2a1fb5..0000000
--- a/funtools/util/zlib-1.2.3/make_vms.com
+++ /dev/null
@@ -1,461 +0,0 @@
-$! make libz under VMS written by
-$! Martin P.J. Zinser
-$! <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
-$!
-$ on error then goto err_exit
-$!
-$!
-$! Just some general constants...
-$!
-$ true = 1
-$ false = 0
-$ tmpnam = "temp_" + f$getjpi("","pid")
-$ SAY = "WRITE SYS$OUTPUT"
-$!
-$! Setup variables holding "config" information
-$!
-$ Make = ""
-$ name = "Zlib"
-$ version = "?.?.?"
-$ v_string = "ZLIB_VERSION"
-$ v_file = "zlib.h"
-$ ccopt = ""
-$ lopts = ""
-$ linkonly = false
-$ optfile = name + ".opt"
-$ its_decc = false
-$ its_vaxc = false
-$ its_gnuc = false
-$ axp = f$getsyi("HW_MODEL").ge.1024
-$ s_case = false
-$! Check for MMK/MMS
-$!
-$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
-$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
-$!
-$!
-$ gosub find_version
-$!
-$ gosub check_opts
-$!
-$! Look for the compiler used
-$!
-$ gosub check_compiler
-$ if its_decc
-$ then
-$ ccopt = "/prefix=all" + ccopt
-$ if f$trnlnm("SYS") .eqs. ""
-$ then
-$ if axp
-$ then
-$ define sys sys$library:
-$ else
-$ ccopt = "/decc" + ccopt
-$ define sys decc$library_include:
-$ endif
-$ endif
-$ endif
-$ if its_vaxc .or. its_gnuc
-$ then
-$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
-$ endif
-$!
-$! Build the thing plain or with mms
-$!
-$ write sys$output "Compiling Zlib sources ..."
-$ if make.eqs.""
-$ then
-$ dele example.obj;*,minigzip.obj;*
-$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
- adler32.c zlib.h zconf.h
-$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
- compress.c zlib.h zconf.h
-$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
- crc32.c zlib.h zconf.h
-$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
- deflate.c deflate.h zutil.h zlib.h zconf.h
-$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
- gzio.c zutil.h zlib.h zconf.h
-$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
- infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
-$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
- inffast.c zutil.h zlib.h zconf.h inffast.h
-$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
- inflate.c zutil.h zlib.h zconf.h infblock.h
-$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
- inftrees.c zutil.h zlib.h zconf.h inftrees.h
-$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
- trees.c deflate.h zutil.h zlib.h zconf.h
-$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
- uncompr.c zlib.h zconf.h
-$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
- zutil.c zutil.h zlib.h zconf.h
-$ write sys$output "Building Zlib ..."
-$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
-$ write sys$output "Building example..."
-$ CALL MAKE example.OBJ "CC ''CCOPT' example" -
- example.c zlib.h zconf.h
-$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
-$ if f$search("x11vms:xvmsutils.olb") .nes. ""
-$ then
-$ write sys$output "Building minigzip..."
-$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
- minigzip.c zlib.h zconf.h
-$ call make minigzip.exe -
- "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
- minigzip.obj libz.olb
-$ endif
-$ else
-$ gosub crea_mms
-$ SAY "Make ''name' ''version' with ''Make' "
-$ 'make'
-$ endif
-$!
-$! Alpha gets a shareable image
-$!
-$ If axp
-$ Then
-$ gosub crea_olist
-$ write sys$output "Creating libzshr.exe"
-$ call anal_obj_axp modules.opt _link.opt
-$ if s_case
-$ then
-$ open/append optf modules.opt
-$ write optf "case_sensitive=YES"
-$ close optf
-$ endif
-$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt
-$ endif
-$ write sys$output "Zlib build completed"
-$ exit
-$CC_ERR:
-$ write sys$output "C compiler required to build ''name'"
-$ goto err_exit
-$ERR_EXIT:
-$ set message/facil/ident/sever/text
-$ write sys$output "Exiting..."
-$ exit 2
-$!
-$!
-$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
-$ V = 'F$Verify(0)
-$! P1 = What we are trying to make
-$! P2 = Command to make it
-$! P3 - P8 What it depends on
-$
-$ If F$Search(P1) .Eqs. "" Then Goto Makeit
-$ Time = F$CvTime(F$File(P1,"RDT"))
-$arg=3
-$Loop:
-$ Argument = P'arg
-$ If Argument .Eqs. "" Then Goto Exit
-$ El=0
-$Loop2:
-$ File = F$Element(El," ",Argument)
-$ If File .Eqs. " " Then Goto Endl
-$ AFile = ""
-$Loop3:
-$ OFile = AFile
-$ AFile = F$Search(File)
-$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
-$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
-$ Goto Loop3
-$NextEL:
-$ El = El + 1
-$ Goto Loop2
-$EndL:
-$ arg=arg+1
-$ If arg .Le. 8 Then Goto Loop
-$ Goto Exit
-$
-$Makeit:
-$ VV=F$VERIFY(0)
-$ write sys$output P2
-$ 'P2
-$ VV='F$Verify(VV)
-$Exit:
-$ If V Then Set Verify
-$ENDSUBROUTINE
-$!------------------------------------------------------------------------------
-$!
-$! Check command line options and set symbols accordingly
-$!
-$ CHECK_OPTS:
-$ i = 1
-$ OPT_LOOP:
-$ if i .lt. 9
-$ then
-$ cparm = f$edit(p'i',"upcase")
-$ if cparm .eqs. "DEBUG"
-$ then
-$ ccopt = ccopt + "/noopt/deb"
-$ lopts = lopts + "/deb"
-$ endif
-$ if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
-$ then
-$ start = f$locate("=",cparm) + 1
-$ len = f$length(cparm) - start
-$ ccopt = ccopt + f$extract(start,len,cparm)
-$ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
- then s_case = true
-$ endif
-$ if cparm .eqs. "LINK" then linkonly = true
-$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
-$ then
-$ start = f$locate("=",cparm) + 1
-$ len = f$length(cparm) - start
-$ lopts = lopts + f$extract(start,len,cparm)
-$ endif
-$ if f$locate("CC=",cparm) .lt. f$length(cparm)
-$ then
-$ start = f$locate("=",cparm) + 1
-$ len = f$length(cparm) - start
-$ cc_com = f$extract(start,len,cparm)
- if (cc_com .nes. "DECC") .and. -
- (cc_com .nes. "VAXC") .and. -
- (cc_com .nes. "GNUC")
-$ then
-$ write sys$output "Unsupported compiler choice ''cc_com' ignored"
-$ write sys$output "Use DECC, VAXC, or GNUC instead"
-$ else
-$ if cc_com .eqs. "DECC" then its_decc = true
-$ if cc_com .eqs. "VAXC" then its_vaxc = true
-$ if cc_com .eqs. "GNUC" then its_gnuc = true
-$ endif
-$ endif
-$ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
-$ then
-$ start = f$locate("=",cparm) + 1
-$ len = f$length(cparm) - start
-$ mmks = f$extract(start,len,cparm)
-$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
-$ then
-$ make = mmks
-$ else
-$ write sys$output "Unsupported make choice ''mmks' ignored"
-$ write sys$output "Use MMK or MMS instead"
-$ endif
-$ endif
-$ i = i + 1
-$ goto opt_loop
-$ endif
-$ return
-$!------------------------------------------------------------------------------
-$!
-$! Look for the compiler used
-$!
-$CHECK_COMPILER:
-$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
-$ then
-$ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
-$ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
-$ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
-$ endif
-$!
-$! Exit if no compiler available
-$!
-$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
-$ then goto CC_ERR
-$ else
-$ if its_decc then write sys$output "CC compiler check ... Compaq C"
-$ if its_vaxc then write sys$output "CC compiler check ... VAX C"
-$ if its_gnuc then write sys$output "CC compiler check ... GNU C"
-$ endif
-$ return
-$!------------------------------------------------------------------------------
-$!
-$! If MMS/MMK are available dump out the descrip.mms if required
-$!
-$CREA_MMS:
-$ write sys$output "Creating descrip.mms..."
-$ create descrip.mms
-$ open/append out descrip.mms
-$ copy sys$input: out
-$ deck
-# descrip.mms: MMS description file for building zlib on VMS
-# written by Martin P.J. Zinser
-# <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
-
-OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\
- deflate.obj, trees.obj, zutil.obj, inflate.obj, \
- inftrees.obj, inffast.obj
-
-$ eod
-$ write out "CFLAGS=", ccopt
-$ write out "LOPTS=", lopts
-$ copy sys$input: out
-$ deck
-
-all : example.exe minigzip.exe libz.olb
- @ write sys$output " Example applications available"
-
-libz.olb : libz.olb($(OBJS))
- @ write sys$output " libz available"
-
-example.exe : example.obj libz.olb
- link $(LOPTS) example,libz.olb/lib
-
-minigzip.exe : minigzip.obj libz.olb
- link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
-
-clean :
- delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
-
-
-# Other dependencies.
-adler32.obj : adler32.c zutil.h zlib.h zconf.h
-compress.obj : compress.c zlib.h zconf.h
-crc32.obj : crc32.c zutil.h zlib.h zconf.h
-deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h
-example.obj : example.c zlib.h zconf.h
-gzio.obj : gzio.c zutil.h zlib.h zconf.h
-inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
-inflate.obj : inflate.c zutil.h zlib.h zconf.h
-inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
-minigzip.obj : minigzip.c zlib.h zconf.h
-trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h
-uncompr.obj : uncompr.c zlib.h zconf.h
-zutil.obj : zutil.c zutil.h zlib.h zconf.h
-infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
-$ eod
-$ close out
-$ return
-$!------------------------------------------------------------------------------
-$!
-$! Read list of core library sources from makefile.in and create options
-$! needed to build shareable image
-$!
-$CREA_OLIST:
-$ open/read min makefile.in
-$ open/write mod modules.opt
-$ src_check = "OBJS ="
-$MRLOOP:
-$ read/end=mrdone min rec
-$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop
-$ rec = rec - src_check
-$ gosub extra_filnam
-$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone
-$MRSLOOP:
-$ read/end=mrdone min rec
-$ gosub extra_filnam
-$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
-$MRDONE:
-$ close min
-$ close mod
-$ return
-$!------------------------------------------------------------------------------
-$!
-$! Take record extracted in crea_olist and split it into single filenames
-$!
-$EXTRA_FILNAM:
-$ myrec = f$edit(rec - "\", "trim,compress")
-$ i = 0
-$FELOOP:
-$ srcfil = f$element(i," ", myrec)
-$ if (srcfil .nes. " ")
-$ then
-$ write mod f$parse(srcfil,,,"NAME"), ".obj"
-$ i = i + 1
-$ goto feloop
-$ endif
-$ return
-$!------------------------------------------------------------------------------
-$!
-$! Find current Zlib version number
-$!
-$FIND_VERSION:
-$ open/read h_in 'v_file'
-$hloop:
-$ read/end=hdone h_in rec
-$ rec = f$edit(rec,"TRIM")
-$ if (f$extract(0,1,rec) .nes. "#") then goto hloop
-$ rec = f$edit(rec - "#", "TRIM")
-$ if f$element(0," ",rec) .nes. "define" then goto hloop
-$ if f$element(1," ",rec) .eqs. v_string
-$ then
-$ version = 'f$element(2," ",rec)'
-$ goto hdone
-$ endif
-$ goto hloop
-$hdone:
-$ close h_in
-$ return
-$!------------------------------------------------------------------------------
-$!
-$! Analyze Object files for OpenVMS AXP to extract Procedure and Data
-$! information to build a symbol vector for a shareable image
-$! All the "brains" of this logic was suggested by Hartmut Becker
-$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me
-$! (zinser@decus.de), so if you do have problem reports please do not
-$! bother Hartmut/HP, but get in touch with me
-$!
-$ ANAL_OBJ_AXP: Subroutine
-$ V = 'F$Verify(0)
-$ SAY := "WRITE_ SYS$OUTPUT"
-$
-$ IF F$SEARCH("''P1'") .EQS. ""
-$ THEN
-$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available"
-$ goto exit_aa
-$ ENDIF
-$ IF "''P2'" .EQS. ""
-$ THEN
-$ SAY "ANAL_OBJ_AXP: Error, no output file provided"
-$ goto exit_aa
-$ ENDIF
-$
-$ open/read in 'p1
-$ create a.tmp
-$ open/append atmp a.tmp
-$ loop:
-$ read/end=end_loop in line
-$ f= f$search(line)
-$ if f .eqs. ""
-$ then
-$ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'"
-$ goto loop
-$ endif
-$ define/user sys$output nl:
-$ define/user sys$error nl:
-$ anal/obj/gsd 'f /out=x.tmp
-$ open/read xtmp x.tmp
-$ XLOOP:
-$ read/end=end_xloop xtmp xline
-$ xline = f$edit(xline,"compress")
-$ write atmp xline
-$ goto xloop
-$ END_XLOOP:
-$ close xtmp
-$ goto loop
-$ end_loop:
-$ close in
-$ close atmp
-$ if f$search("a.tmp") .eqs. "" -
- then $ exit
-$ ! all global definitions
-$ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp
-$ ! all procedures
-$ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp
-$ search c.tmp "symbol:"/out=d.tmp
-$ define/user sys$output nl:
-$ edito/edt/command=sys$input d.tmp
-sub/symbol: "/symbol_vector=(/whole
-sub/"/=PROCEDURE)/whole
-exit
-$ ! all data
-$ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp
-$ search e.tmp "symbol:"/out=f.tmp
-$ define/user sys$output nl:
-$ edito/edt/command=sys$input f.tmp
-sub/symbol: "/symbol_vector=(/whole
-sub/"/=DATA)/whole
-exit
-$ sort/nodupl d.tmp,f.tmp 'p2'
-$ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;*
-$ if f$search("x.tmp") .nes. "" -
- then $ delete x.tmp;*
-$!
-$ EXIT_AA:
-$ if V then set verify
-$ endsubroutine
-$!------------------------------------------------------------------------------
diff --git a/funtools/util/zlib-1.2.3/minigzip.c b/funtools/util/zlib-1.2.3/minigzip.c
deleted file mode 100644
index 4524b96..0000000
--- a/funtools/util/zlib-1.2.3/minigzip.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/* minigzip.c -- simulate gzip using the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * minigzip is a minimal implementation of the gzip utility. This is
- * only an example of using zlib and isn't meant to replace the
- * full-featured gzip. No attempt is made to deal with file systems
- * limiting names to 14 or 8+3 characters, etc... Error checking is
- * very limited. So use minigzip only for testing; use gzip for the
- * real thing. On MSDOS, use only on file names without extension
- * or in pipe mode.
- */
-
-/* @(#) $Id$ */
-
-#include <stdio.h>
-#include "zlib.h"
-
-#ifdef STDC
-# include <string.h>
-# include <stdlib.h>
-#endif
-
-#ifdef USE_MMAP
-# include <sys/types.h>
-# include <sys/mman.h>
-# include <sys/stat.h>
-#endif
-
-#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
-# include <fcntl.h>
-# include <io.h>
-# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
-#else
-# define SET_BINARY_MODE(file)
-#endif
-
-#ifdef VMS
-# define unlink delete
-# define GZ_SUFFIX "-gz"
-#endif
-#ifdef RISCOS
-# define unlink remove
-# define GZ_SUFFIX "-gz"
-# define fileno(file) file->__file
-#endif
-#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fileno */
-#endif
-
-#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
- extern int unlink OF((const char *));
-#endif
-
-#ifndef GZ_SUFFIX
-# define GZ_SUFFIX ".gz"
-#endif
-#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
-
-#define BUFLEN 16384
-#define MAX_NAME_LEN 1024
-
-#ifdef MAXSEG_64K
-# define local static
- /* Needed for systems with limitation on stack size. */
-#else
-# define local
-#endif
-
-char *prog;
-
-void error OF((const char *msg));
-void gz_compress OF((FILE *in, gzFile out));
-#ifdef USE_MMAP
-int gz_compress_mmap OF((FILE *in, gzFile out));
-#endif
-void gz_uncompress OF((gzFile in, FILE *out));
-void file_compress OF((char *file, char *mode));
-void file_uncompress OF((char *file));
-int main OF((int argc, char *argv[]));
-
-/* ===========================================================================
- * Display error message and exit
- */
-void error(msg)
- const char *msg;
-{
- fprintf(stderr, "%s: %s\n", prog, msg);
- exit(1);
-}
-
-/* ===========================================================================
- * Compress input to output then close both files.
- */
-
-void gz_compress(in, out)
- FILE *in;
- gzFile out;
-{
- local char buf[BUFLEN];
- int len;
- int err;
-
-#ifdef USE_MMAP
- /* Try first compressing with mmap. If mmap fails (minigzip used in a
- * pipe), use the normal fread loop.
- */
- if (gz_compress_mmap(in, out) == Z_OK) return;
-#endif
- for (;;) {
- len = (int)fread(buf, 1, sizeof(buf), in);
- if (ferror(in)) {
- perror("fread");
- exit(1);
- }
- if (len == 0) break;
-
- if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
- }
- fclose(in);
- if (gzclose(out) != Z_OK) error("failed gzclose");
-}
-
-#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
-
-/* Try compressing the input file at once using mmap. Return Z_OK if
- * if success, Z_ERRNO otherwise.
- */
-int gz_compress_mmap(in, out)
- FILE *in;
- gzFile out;
-{
- int len;
- int err;
- int ifd = fileno(in);
- caddr_t buf; /* mmap'ed buffer for the entire input file */
- off_t buf_len; /* length of the input file */
- struct stat sb;
-
- /* Determine the size of the file, needed for mmap: */
- if (fstat(ifd, &sb) < 0) return Z_ERRNO;
- buf_len = sb.st_size;
- if (buf_len <= 0) return Z_ERRNO;
-
- /* Now do the actual mmap: */
- buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
- if (buf == (caddr_t)(-1)) return Z_ERRNO;
-
- /* Compress the whole file at once: */
- len = gzwrite(out, (char *)buf, (unsigned)buf_len);
-
- if (len != (int)buf_len) error(gzerror(out, &err));
-
- munmap(buf, buf_len);
- fclose(in);
- if (gzclose(out) != Z_OK) error("failed gzclose");
- return Z_OK;
-}
-#endif /* USE_MMAP */
-
-/* ===========================================================================
- * Uncompress input to output then close both files.
- */
-void gz_uncompress(in, out)
- gzFile in;
- FILE *out;
-{
- local char buf[BUFLEN];
- int len;
- int err;
-
- for (;;) {
- len = gzread(in, buf, sizeof(buf));
- if (len < 0) error (gzerror(in, &err));
- if (len == 0) break;
-
- if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
- error("failed fwrite");
- }
- }
- if (fclose(out)) error("failed fclose");
-
- if (gzclose(in) != Z_OK) error("failed gzclose");
-}
-
-
-/* ===========================================================================
- * Compress the given file: create a corresponding .gz file and remove the
- * original.
- */
-void file_compress(file, mode)
- char *file;
- char *mode;
-{
- local char outfile[MAX_NAME_LEN];
- FILE *in;
- gzFile out;
-
- strcpy(outfile, file);
- strcat(outfile, GZ_SUFFIX);
-
- in = fopen(file, "rb");
- if (in == NULL) {
- perror(file);
- exit(1);
- }
- out = gzopen(outfile, mode);
- if (out == NULL) {
- fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
- exit(1);
- }
- gz_compress(in, out);
-
- unlink(file);
-}
-
-
-/* ===========================================================================
- * Uncompress the given file and remove the original.
- */
-void file_uncompress(file)
- char *file;
-{
- local char buf[MAX_NAME_LEN];
- char *infile, *outfile;
- FILE *out;
- gzFile in;
- uInt len = (uInt)strlen(file);
-
- strcpy(buf, file);
-
- if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
- infile = file;
- outfile = buf;
- outfile[len-3] = '\0';
- } else {
- outfile = file;
- infile = buf;
- strcat(infile, GZ_SUFFIX);
- }
- in = gzopen(infile, "rb");
- if (in == NULL) {
- fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
- exit(1);
- }
- out = fopen(outfile, "wb");
- if (out == NULL) {
- perror(file);
- exit(1);
- }
-
- gz_uncompress(in, out);
-
- unlink(infile);
-}
-
-
-/* ===========================================================================
- * Usage: minigzip [-d] [-f] [-h] [-r] [-1 to -9] [files...]
- * -d : decompress
- * -f : compress with Z_FILTERED
- * -h : compress with Z_HUFFMAN_ONLY
- * -r : compress with Z_RLE
- * -1 to -9 : compression level
- */
-
-int main(argc, argv)
- int argc;
- char *argv[];
-{
- int uncompr = 0;
- gzFile file;
- char outmode[20];
-
- strcpy(outmode, "wb6 ");
-
- prog = argv[0];
- argc--, argv++;
-
- while (argc > 0) {
- if (strcmp(*argv, "-d") == 0)
- uncompr = 1;
- else if (strcmp(*argv, "-f") == 0)
- outmode[3] = 'f';
- else if (strcmp(*argv, "-h") == 0)
- outmode[3] = 'h';
- else if (strcmp(*argv, "-r") == 0)
- outmode[3] = 'R';
- else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' &&
- (*argv)[2] == 0)
- outmode[2] = (*argv)[1];
- else
- break;
- argc--, argv++;
- }
- if (outmode[3] == ' ')
- outmode[3] = 0;
- if (argc == 0) {
- SET_BINARY_MODE(stdin);
- SET_BINARY_MODE(stdout);
- if (uncompr) {
- file = gzdopen(fileno(stdin), "rb");
- if (file == NULL) error("can't gzdopen stdin");
- gz_uncompress(file, stdout);
- } else {
- file = gzdopen(fileno(stdout), outmode);
- if (file == NULL) error("can't gzdopen stdout");
- gz_compress(stdin, file);
- }
- } else {
- do {
- if (uncompr) {
- file_uncompress(*argv);
- } else {
- file_compress(*argv, outmode);
- }
- } while (argv++, --argc);
- }
- return 0;
-}
diff --git a/funtools/util/zlib-1.2.3/msdos/Makefile.bor b/funtools/util/zlib-1.2.3/msdos/Makefile.bor
deleted file mode 100644
index 8f8132d..0000000
--- a/funtools/util/zlib-1.2.3/msdos/Makefile.bor
+++ /dev/null
@@ -1,109 +0,0 @@
-# Makefile for zlib
-# Borland C++
-# Last updated: 15-Mar-2003
-
-# To use, do "make -fmakefile.bor"
-# To compile in small model, set below: MODEL=s
-
-# WARNING: the small model is supported but only for small values of
-# MAX_WBITS and MAX_MEM_LEVEL. For example:
-# -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3
-# If you wish to reduce the memory requirements (default 256K for big
-# objects plus a few K), you can add to the LOC macro below:
-# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
-# See zconf.h for details about the memory requirements.
-
-# ------------ Turbo C++, Borland C++ ------------
-
-# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
-# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
-# to the declaration of LOC here:
-LOC = $(LOCAL_ZLIB)
-
-# type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
-CPU_TYP = 0
-
-# memory model: one of s, m, c, l (small, medium, compact, large)
-MODEL=l
-
-# replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version
-CC=bcc
-LD=bcc
-AR=tlib
-
-# compiler flags
-# replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0
-CFLAGS=-O2 -Z -m$(MODEL) $(LOC)
-
-LDFLAGS=-m$(MODEL) -f-
-
-
-# variables
-ZLIB_LIB = zlib_$(MODEL).lib
-
-OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
-OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj
-OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
-
-
-# targets
-all: $(ZLIB_LIB) example.exe minigzip.exe
-
-.c.obj:
- $(CC) -c $(CFLAGS) $*.c
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-
-
-# the command line is cut to fit in the MS-DOS 128 byte limit:
-$(ZLIB_LIB): $(OBJ1) $(OBJ2)
- -del $(ZLIB_LIB)
- $(AR) $(ZLIB_LIB) $(OBJP1)
- $(AR) $(ZLIB_LIB) $(OBJP2)
-
-example.exe: example.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
-
-minigzip.exe: minigzip.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
-
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-clean:
- -del *.obj
- -del *.lib
- -del *.exe
- -del zlib_*.bak
- -del foo.gz
diff --git a/funtools/util/zlib-1.2.3/msdos/Makefile.dj2 b/funtools/util/zlib-1.2.3/msdos/Makefile.dj2
deleted file mode 100644
index 283d1d9..0000000
--- a/funtools/util/zlib-1.2.3/msdos/Makefile.dj2
+++ /dev/null
@@ -1,104 +0,0 @@
-# Makefile for zlib. Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96.
-# Copyright (C) 1995-1998 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile, or to compile and test, type:
-#
-# make -fmakefile.dj2; make test -fmakefile.dj2
-#
-# To install libz.a, zconf.h and zlib.h in the djgpp directories, type:
-#
-# make install -fmakefile.dj2
-#
-# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as
-# in the sample below if the pattern of the DJGPP distribution is to
-# be followed. Remember that, while <sp>'es around <=> are ignored in
-# makefiles, they are *not* in batch files or in djgpp.env.
-# - - - - -
-# [make]
-# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include
-# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib
-# BUTT=-m486
-# - - - - -
-# Alternately, these variables may be defined below, overriding the values
-# in djgpp.env, as
-# INCLUDE_PATH=c:\usr\include
-# LIBRARY_PATH=c:\usr\lib
-
-CC=gcc
-
-#CFLAGS=-MMD -O
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-MMD -g -DDEBUG
-CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
- -Wstrict-prototypes -Wmissing-prototypes
-
-# If cp.exe is available, replace "copy /Y" with "cp -fp" .
-CP=copy /Y
-# If gnu install.exe is available, replace $(CP) with ginstall.
-INSTALL=$(CP)
-# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
-RM=del
-LDLIBS=-L. -lz
-LD=$(CC) -s -o
-LDSHARED=$(CC)
-
-INCL=zlib.h zconf.h
-LIBS=libz.a
-
-AR=ar rcs
-
-prefix=/usr/local
-exec_prefix = $(prefix)
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-OBJA =
-# to use the asm code: make OBJA=match.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example.exe minigzip.exe
-
-check: test
-test: all
- ./example
- echo hello world | .\minigzip | .\minigzip -d
-
-%.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-libz.a: $(OBJS) $(OBJA)
- $(AR) $@ $(OBJS) $(OBJA)
-
-%.exe : %.o $(LIBS)
- $(LD) $@ $< $(LDLIBS)
-
-# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
-
-.PHONY : uninstall clean
-
-install: $(INCL) $(LIBS)
- -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
- -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
- $(INSTALL) zlib.h $(INCLUDE_PATH)
- $(INSTALL) zconf.h $(INCLUDE_PATH)
- $(INSTALL) libz.a $(LIBRARY_PATH)
-
-uninstall:
- $(RM) $(INCLUDE_PATH)\zlib.h
- $(RM) $(INCLUDE_PATH)\zconf.h
- $(RM) $(LIBRARY_PATH)\libz.a
-
-clean:
- $(RM) *.d
- $(RM) *.o
- $(RM) *.exe
- $(RM) libz.a
- $(RM) foo.gz
-
-DEPS := $(wildcard *.d)
-ifneq ($(DEPS),)
-include $(DEPS)
-endif
diff --git a/funtools/util/zlib-1.2.3/msdos/Makefile.emx b/funtools/util/zlib-1.2.3/msdos/Makefile.emx
deleted file mode 100644
index ed4c31f..0000000
--- a/funtools/util/zlib-1.2.3/msdos/Makefile.emx
+++ /dev/null
@@ -1,69 +0,0 @@
-# Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98.
-# Copyright (C) 1995-1998 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile, or to compile and test, type:
-#
-# make -fmakefile.emx; make test -fmakefile.emx
-#
-
-CC=gcc
-
-#CFLAGS=-MMD -O
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-MMD -g -DDEBUG
-CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
- -Wstrict-prototypes -Wmissing-prototypes
-
-# If cp.exe is available, replace "copy /Y" with "cp -fp" .
-CP=copy /Y
-# If gnu install.exe is available, replace $(CP) with ginstall.
-INSTALL=$(CP)
-# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
-RM=del
-LDLIBS=-L. -lzlib
-LD=$(CC) -s -o
-LDSHARED=$(CC)
-
-INCL=zlib.h zconf.h
-LIBS=zlib.a
-
-AR=ar rcs
-
-prefix=/usr/local
-exec_prefix = $(prefix)
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example.exe minigzip.exe
-
-test: all
- ./example
- echo hello world | .\minigzip | .\minigzip -d
-
-%.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-zlib.a: $(OBJS)
- $(AR) $@ $(OBJS)
-
-%.exe : %.o $(LIBS)
- $(LD) $@ $< $(LDLIBS)
-
-
-.PHONY : clean
-
-clean:
- $(RM) *.d
- $(RM) *.o
- $(RM) *.exe
- $(RM) zlib.a
- $(RM) foo.gz
-
-DEPS := $(wildcard *.d)
-ifneq ($(DEPS),)
-include $(DEPS)
-endif
diff --git a/funtools/util/zlib-1.2.3/msdos/Makefile.msc b/funtools/util/zlib-1.2.3/msdos/Makefile.msc
deleted file mode 100644
index b8fc665..0000000
--- a/funtools/util/zlib-1.2.3/msdos/Makefile.msc
+++ /dev/null
@@ -1,106 +0,0 @@
-# Makefile for zlib
-# Microsoft C 5.1 or later
-# Last updated: 19-Mar-2003
-
-# To use, do "make makefile.msc"
-# To compile in small model, set below: MODEL=S
-
-# If you wish to reduce the memory requirements (default 256K for big
-# objects plus a few K), you can add to the LOC macro below:
-# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
-# See zconf.h for details about the memory requirements.
-
-# ------------- Microsoft C 5.1 and later -------------
-
-# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
-# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
-# to the declaration of LOC here:
-LOC = $(LOCAL_ZLIB)
-
-# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
-CPU_TYP = 0
-
-# Memory model: one of S, M, C, L (small, medium, compact, large)
-MODEL=L
-
-CC=cl
-CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC)
-#-Ox generates bad code with MSC 5.1
-LIB_CFLAGS=-Zl $(CFLAGS)
-
-LD=link
-LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode
-# "/farcall/packcode" are only useful for `large code' memory models
-# but should be a "no-op" for small code models.
-
-
-# variables
-ZLIB_LIB = zlib_$(MODEL).lib
-
-OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
-OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-
-
-# targets
-all: $(ZLIB_LIB) example.exe minigzip.exe
-
-.c.obj:
- $(CC) -c $(LIB_CFLAGS) $*.c
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
- $(CC) -c $(CFLAGS) $*.c
-
-minigzip.obj: minigzip.c zlib.h zconf.h
- $(CC) -c $(CFLAGS) $*.c
-
-
-# the command line is cut to fit in the MS-DOS 128 byte limit:
-$(ZLIB_LIB): $(OBJ1) $(OBJ2)
- if exist $(ZLIB_LIB) del $(ZLIB_LIB)
- lib $(ZLIB_LIB) $(OBJ1);
- lib $(ZLIB_LIB) $(OBJ2);
-
-example.exe: example.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB);
-
-minigzip.exe: minigzip.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB);
-
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-clean:
- -del *.obj
- -del *.lib
- -del *.exe
- -del *.map
- -del zlib_*.bak
- -del foo.gz
diff --git a/funtools/util/zlib-1.2.3/msdos/Makefile.tc b/funtools/util/zlib-1.2.3/msdos/Makefile.tc
deleted file mode 100644
index 480750a..0000000
--- a/funtools/util/zlib-1.2.3/msdos/Makefile.tc
+++ /dev/null
@@ -1,94 +0,0 @@
-# Makefile for zlib
-# Turbo C 2.01, Turbo C++ 1.01
-# Last updated: 15-Mar-2003
-
-# To use, do "make -fmakefile.tc"
-# To compile in small model, set below: MODEL=s
-
-# WARNING: the small model is supported but only for small values of
-# MAX_WBITS and MAX_MEM_LEVEL. For example:
-# -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
-# If you wish to reduce the memory requirements (default 256K for big
-# objects plus a few K), you can add to CFLAGS below:
-# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
-# See zconf.h for details about the memory requirements.
-
-# ------------ Turbo C 2.01, Turbo C++ 1.01 ------------
-MODEL=l
-CC=tcc
-LD=tcc
-AR=tlib
-# CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
-CFLAGS=-O2 -G -Z -m$(MODEL)
-LDFLAGS=-m$(MODEL) -f-
-
-
-# variables
-ZLIB_LIB = zlib_$(MODEL).lib
-
-OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
-OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj
-OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
-
-
-# targets
-all: $(ZLIB_LIB) example.exe minigzip.exe
-
-.c.obj:
- $(CC) -c $(CFLAGS) $*.c
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-
-
-# the command line is cut to fit in the MS-DOS 128 byte limit:
-$(ZLIB_LIB): $(OBJ1) $(OBJ2)
- -del $(ZLIB_LIB)
- $(AR) $(ZLIB_LIB) $(OBJP1)
- $(AR) $(ZLIB_LIB) $(OBJP2)
-
-example.exe: example.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
-
-minigzip.exe: minigzip.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
-
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-clean:
- -del *.obj
- -del *.lib
- -del *.exe
- -del zlib_*.bak
- -del foo.gz
diff --git a/funtools/util/zlib-1.2.3/old/Makefile.riscos b/funtools/util/zlib-1.2.3/old/Makefile.riscos
deleted file mode 100644
index 57e29d3..0000000
--- a/funtools/util/zlib-1.2.3/old/Makefile.riscos
+++ /dev/null
@@ -1,151 +0,0 @@
-# Project: zlib_1_03
-# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430
-# test works out-of-the-box, installs `somewhere' on demand
-
-# Toolflags:
-CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah
-C++flags = -c -depend !Depend -IC: -throwback
-Linkflags = -aif -c++ -o $@
-ObjAsmflags = -throwback -NoCache -depend !Depend
-CMHGflags =
-LibFileflags = -c -l -o $@
-Squeezeflags = -o $@
-
-# change the line below to where _you_ want the library installed.
-libdest = lib:zlib
-
-# Final targets:
-@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
- @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
- @.o.uncompr @.o.zutil
- LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
- @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
- @.o.trees @.o.uncompr @.o.zutil
-test: @.minigzip @.example @.lib
- @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
- @echo running tests: hang on.
- @/@.minigzip -f -9 libc
- @/@.minigzip -d libc-gz
- @/@.minigzip -f -1 libc
- @/@.minigzip -d libc-gz
- @/@.minigzip -h -9 libc
- @/@.minigzip -d libc-gz
- @/@.minigzip -h -1 libc
- @/@.minigzip -d libc-gz
- @/@.minigzip -9 libc
- @/@.minigzip -d libc-gz
- @/@.minigzip -1 libc
- @/@.minigzip -d libc-gz
- @diff @.lib @.libc
- @echo that should have reported '@.lib and @.libc identical' if you have diff.
- @/@.example @.fred @.fred
- @echo that will have given lots of hello!'s.
-
-@.minigzip: @.o.minigzip @.lib C:o.Stubs
- Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
-@.example: @.o.example @.lib C:o.Stubs
- Link $(Linkflags) @.o.example @.lib C:o.Stubs
-
-install: @.lib
- cdir $(libdest)
- cdir $(libdest).h
- @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV
- @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV
- @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV
- @echo okay, installed zlib in $(libdest)
-
-clean:; remove @.minigzip
- remove @.example
- remove @.libc
- -wipe @.o.* F~r~cV
- remove @.fred
-
-# User-editable dependencies:
-.c.o:
- cc $(ccflags) -o $@ $<
-
-# Static dependencies:
-
-# Dynamic dependencies:
-o.example: c.example
-o.example: h.zlib
-o.example: h.zconf
-o.minigzip: c.minigzip
-o.minigzip: h.zlib
-o.minigzip: h.zconf
-o.adler32: c.adler32
-o.adler32: h.zlib
-o.adler32: h.zconf
-o.compress: c.compress
-o.compress: h.zlib
-o.compress: h.zconf
-o.crc32: c.crc32
-o.crc32: h.zlib
-o.crc32: h.zconf
-o.deflate: c.deflate
-o.deflate: h.deflate
-o.deflate: h.zutil
-o.deflate: h.zlib
-o.deflate: h.zconf
-o.gzio: c.gzio
-o.gzio: h.zutil
-o.gzio: h.zlib
-o.gzio: h.zconf
-o.infblock: c.infblock
-o.infblock: h.zutil
-o.infblock: h.zlib
-o.infblock: h.zconf
-o.infblock: h.infblock
-o.infblock: h.inftrees
-o.infblock: h.infcodes
-o.infblock: h.infutil
-o.infcodes: c.infcodes
-o.infcodes: h.zutil
-o.infcodes: h.zlib
-o.infcodes: h.zconf
-o.infcodes: h.inftrees
-o.infcodes: h.infblock
-o.infcodes: h.infcodes
-o.infcodes: h.infutil
-o.infcodes: h.inffast
-o.inffast: c.inffast
-o.inffast: h.zutil
-o.inffast: h.zlib
-o.inffast: h.zconf
-o.inffast: h.inftrees
-o.inffast: h.infblock
-o.inffast: h.infcodes
-o.inffast: h.infutil
-o.inffast: h.inffast
-o.inflate: c.inflate
-o.inflate: h.zutil
-o.inflate: h.zlib
-o.inflate: h.zconf
-o.inflate: h.infblock
-o.inftrees: c.inftrees
-o.inftrees: h.zutil
-o.inftrees: h.zlib
-o.inftrees: h.zconf
-o.inftrees: h.inftrees
-o.inftrees: h.inffixed
-o.infutil: c.infutil
-o.infutil: h.zutil
-o.infutil: h.zlib
-o.infutil: h.zconf
-o.infutil: h.infblock
-o.infutil: h.inftrees
-o.infutil: h.infcodes
-o.infutil: h.infutil
-o.trees: c.trees
-o.trees: h.deflate
-o.trees: h.zutil
-o.trees: h.zlib
-o.trees: h.zconf
-o.trees: h.trees
-o.uncompr: c.uncompr
-o.uncompr: h.zlib
-o.uncompr: h.zconf
-o.zutil: c.zutil
-o.zutil: h.zutil
-o.zutil: h.zlib
-o.zutil: h.zconf
diff --git a/funtools/util/zlib-1.2.3/old/README b/funtools/util/zlib-1.2.3/old/README
deleted file mode 100644
index 800bf07..0000000
--- a/funtools/util/zlib-1.2.3/old/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This directory contains files that have not been updated for zlib 1.2.x
-
-(Volunteers are encouraged to help clean this up. Thanks.)
diff --git a/funtools/util/zlib-1.2.3/old/descrip.mms b/funtools/util/zlib-1.2.3/old/descrip.mms
deleted file mode 100644
index 7066da5..0000000
--- a/funtools/util/zlib-1.2.3/old/descrip.mms
+++ /dev/null
@@ -1,48 +0,0 @@
-# descrip.mms: MMS description file for building zlib on VMS
-# written by Martin P.J. Zinser <m.zinser@gsi.de>
-
-cc_defs =
-c_deb =
-
-.ifdef __DECC__
-pref = /prefix=all
-.endif
-
-OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\
- deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\
- inftrees.obj, infcodes.obj, infutil.obj, inffast.obj
-
-CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
-
-all : example.exe minigzip.exe
- @ write sys$output " Example applications available"
-libz.olb : libz.olb($(OBJS))
- @ write sys$output " libz available"
-
-example.exe : example.obj libz.olb
- link example,libz.olb/lib
-
-minigzip.exe : minigzip.obj libz.olb
- link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
-
-clean :
- delete *.obj;*,libz.olb;*
-
-
-# Other dependencies.
-adler32.obj : zutil.h zlib.h zconf.h
-compress.obj : zlib.h zconf.h
-crc32.obj : zutil.h zlib.h zconf.h
-deflate.obj : deflate.h zutil.h zlib.h zconf.h
-example.obj : zlib.h zconf.h
-gzio.obj : zutil.h zlib.h zconf.h
-infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
-infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
-inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
-inflate.obj : zutil.h zlib.h zconf.h infblock.h
-inftrees.obj : zutil.h zlib.h zconf.h inftrees.h
-infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h
-minigzip.obj : zlib.h zconf.h
-trees.obj : deflate.h zutil.h zlib.h zconf.h
-uncompr.obj : zlib.h zconf.h
-zutil.obj : zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/old/os2/Makefile.os2 b/funtools/util/zlib-1.2.3/old/os2/Makefile.os2
deleted file mode 100644
index a105aaa..0000000
--- a/funtools/util/zlib-1.2.3/old/os2/Makefile.os2
+++ /dev/null
@@ -1,136 +0,0 @@
-# Makefile for zlib under OS/2 using GCC (PGCC)
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile and test, type:
-# cp Makefile.os2 ..
-# cd ..
-# make -f Makefile.os2 test
-
-# This makefile will build a static library z.lib, a shared library
-# z.dll and a import library zdll.lib. You can use either z.lib or
-# zdll.lib by specifying either -lz or -lzdll on gcc's command line
-
-CC=gcc -Zomf -s
-
-CFLAGS=-O6 -Wall
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-g -DDEBUG
-#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
-# -Wstrict-prototypes -Wmissing-prototypes
-
-#################### BUG WARNING: #####################
-## infcodes.c hits a bug in pgcc-1.0, so you have to use either
-## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem)
-## This bug is reportedly fixed in pgcc >1.0, but this was not tested
-CFLAGS+=-fno-force-mem
-
-LDFLAGS=-s -L. -lzdll -Zcrtdll
-LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll
-
-VER=1.1.0
-ZLIB=z.lib
-SHAREDLIB=z.dll
-SHAREDLIBIMP=zdll.lib
-LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
-
-AR=emxomfar cr
-IMPLIB=emximp
-RANLIB=echo
-TAR=tar
-SHELL=bash
-
-prefix=/usr/local
-exec_prefix = $(prefix)
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
-
-TEST_OBJS = example.o minigzip.o
-
-DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
- algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
- nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \
- contrib/asm386/*.asm contrib/asm386/*.c \
- contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
- contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
- contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
-
-all: example.exe minigzip.exe
-
-test: all
- @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
- echo hello world | ./minigzip | ./minigzip -d || \
- echo ' *** minigzip test FAILED ***' ; \
- if ./example; then \
- echo ' *** zlib test OK ***'; \
- else \
- echo ' *** zlib test FAILED ***'; \
- fi
-
-$(ZLIB): $(OBJS)
- $(AR) $@ $(OBJS)
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-
-$(SHAREDLIB): $(OBJS) os2/z.def
- $(LDSHARED) -o $@ $^
-
-$(SHAREDLIBIMP): os2/z.def
- $(IMPLIB) -o $@ $^
-
-example.exe: example.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
-
-minigzip.exe: minigzip.o $(LIBS)
- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
-
-clean:
- rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
-
-distclean: clean
-
-zip:
- mv Makefile Makefile~; cp -p Makefile.in Makefile
- rm -f test.c ztest*.c
- v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
- zip -ul9 zlib$$v $(DISTFILES)
- mv Makefile~ Makefile
-
-dist:
- mv Makefile Makefile~; cp -p Makefile.in Makefile
- rm -f test.c ztest*.c
- d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
- rm -f $$d.tar.gz; \
- if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
- files=""; \
- for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
- cd ..; \
- GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
- if test ! -d $$d; then rm -f $$d; fi
- mv Makefile~ Makefile
-
-tags:
- etags *.[ch]
-
-depend:
- makedepend -- $(CFLAGS) -- *.[ch]
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
-infcodes.o: zutil.h zlib.h zconf.h
-infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h
-inffast.o: infblock.h infcodes.h infutil.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h infblock.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/old/os2/zlib.def b/funtools/util/zlib-1.2.3/old/os2/zlib.def
deleted file mode 100644
index 4c753f1..0000000
--- a/funtools/util/zlib-1.2.3/old/os2/zlib.def
+++ /dev/null
@@ -1,51 +0,0 @@
-;
-; Slightly modified version of ../nt/zlib.dnt :-)
-;
-
-LIBRARY Z
-DESCRIPTION "Zlib compression library for OS/2"
-CODE PRELOAD MOVEABLE DISCARDABLE
-DATA PRELOAD MOVEABLE MULTIPLE
-
-EXPORTS
- adler32
- compress
- crc32
- deflate
- deflateCopy
- deflateEnd
- deflateInit2_
- deflateInit_
- deflateParams
- deflateReset
- deflateSetDictionary
- gzclose
- gzdopen
- gzerror
- gzflush
- gzopen
- gzread
- gzwrite
- inflate
- inflateEnd
- inflateInit2_
- inflateInit_
- inflateReset
- inflateSetDictionary
- inflateSync
- uncompress
- zlibVersion
- gzprintf
- gzputc
- gzgetc
- gzseek
- gzrewind
- gztell
- gzeof
- gzsetparams
- zError
- inflateSyncPoint
- get_crc_table
- compress2
- gzputs
- gzgets
diff --git a/funtools/util/zlib-1.2.3/old/visual-basic.txt b/funtools/util/zlib-1.2.3/old/visual-basic.txt
deleted file mode 100644
index 57efe58..0000000
--- a/funtools/util/zlib-1.2.3/old/visual-basic.txt
+++ /dev/null
@@ -1,160 +0,0 @@
-See below some functions declarations for Visual Basic.
-
-Frequently Asked Question:
-
-Q: Each time I use the compress function I get the -5 error (not enough
- room in the output buffer).
-
-A: Make sure that the length of the compressed buffer is passed by
- reference ("as any"), not by value ("as long"). Also check that
- before the call of compress this length is equal to the total size of
- the compressed buffer and not zero.
-
-
-From: "Jon Caruana" <jon-net@usa.net>
-Subject: Re: How to port zlib declares to vb?
-Date: Mon, 28 Oct 1996 18:33:03 -0600
-
-Got the answer! (I haven't had time to check this but it's what I got, and
-looks correct):
-
-He has the following routines working:
- compress
- uncompress
- gzopen
- gzwrite
- gzread
- gzclose
-
-Declares follow: (Quoted from Carlos Rios <c_rios@sonda.cl>, in Vb4 form)
-
-#If Win16 Then 'Use Win16 calls.
-Declare Function compress Lib "ZLIB.DLL" (ByVal compr As
- String, comprLen As Any, ByVal buf As String, ByVal buflen
- As Long) As Integer
-Declare Function uncompress Lib "ZLIB.DLL" (ByVal uncompr
- As String, uncomprLen As Any, ByVal compr As String, ByVal
- lcompr As Long) As Integer
-Declare Function gzopen Lib "ZLIB.DLL" (ByVal filePath As
- String, ByVal mode As String) As Long
-Declare Function gzread Lib "ZLIB.DLL" (ByVal file As
- Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
- As Integer
-Declare Function gzwrite Lib "ZLIB.DLL" (ByVal file As
- Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
- As Integer
-Declare Function gzclose Lib "ZLIB.DLL" (ByVal file As
- Long) As Integer
-#Else
-Declare Function compress Lib "ZLIB32.DLL"
- (ByVal compr As String, comprLen As Any, ByVal buf As
- String, ByVal buflen As Long) As Integer
-Declare Function uncompress Lib "ZLIB32.DLL"
- (ByVal uncompr As String, uncomprLen As Any, ByVal compr As
- String, ByVal lcompr As Long) As Long
-Declare Function gzopen Lib "ZLIB32.DLL"
- (ByVal file As String, ByVal mode As String) As Long
-Declare Function gzread Lib "ZLIB32.DLL"
- (ByVal file As Long, ByVal uncompr As String, ByVal
- uncomprLen As Long) As Long
-Declare Function gzwrite Lib "ZLIB32.DLL"
- (ByVal file As Long, ByVal uncompr As String, ByVal
- uncomprLen As Long) As Long
-Declare Function gzclose Lib "ZLIB32.DLL"
- (ByVal file As Long) As Long
-#End If
-
--Jon Caruana
-jon-net@usa.net
-Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member
-
-
-Here is another example from Michael <michael_borgsys@hotmail.com> that he
-says conforms to the VB guidelines, and that solves the problem of not
-knowing the uncompressed size by storing it at the end of the file:
-
-'Calling the functions:
-'bracket meaning: <parameter> [optional] {Range of possible values}
-'Call subCompressFile(<path with filename to compress> [, <path with
-filename to write to>, [level of compression {1..9}]])
-'Call subUncompressFile(<path with filename to compress>)
-
-Option Explicit
-Private lngpvtPcnSml As Long 'Stores value for 'lngPercentSmaller'
-Private Const SUCCESS As Long = 0
-Private Const strFilExt As String = ".cpr"
-Private Declare Function lngfncCpr Lib "zlib.dll" Alias "compress2" (ByRef
-dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long,
-ByVal level As Integer) As Long
-Private Declare Function lngfncUcp Lib "zlib.dll" Alias "uncompress" (ByRef
-dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long)
-As Long
-
-Public Sub subCompressFile(ByVal strargOriFilPth As String, Optional ByVal
-strargCprFilPth As String, Optional ByVal intLvl As Integer = 9)
- Dim strCprPth As String
- Dim lngOriSiz As Long
- Dim lngCprSiz As Long
- Dim bytaryOri() As Byte
- Dim bytaryCpr() As Byte
- lngOriSiz = FileLen(strargOriFilPth)
- ReDim bytaryOri(lngOriSiz - 1)
- Open strargOriFilPth For Binary Access Read As #1
- Get #1, , bytaryOri()
- Close #1
- strCprPth = IIf(strargCprFilPth = "", strargOriFilPth, strargCprFilPth)
-'Select file path and name
- strCprPth = strCprPth & IIf(Right(strCprPth, Len(strFilExt)) =
-strFilExt, "", strFilExt) 'Add file extension if not exists
- lngCprSiz = (lngOriSiz * 1.01) + 12 'Compression needs temporary a bit
-more space then original file size
- ReDim bytaryCpr(lngCprSiz - 1)
- If lngfncCpr(bytaryCpr(0), lngCprSiz, bytaryOri(0), lngOriSiz, intLvl) =
-SUCCESS Then
- lngpvtPcnSml = (1# - (lngCprSiz / lngOriSiz)) * 100
- ReDim Preserve bytaryCpr(lngCprSiz - 1)
- Open strCprPth For Binary Access Write As #1
- Put #1, , bytaryCpr()
- Put #1, , lngOriSiz 'Add the the original size value to the end
-(last 4 bytes)
- Close #1
- Else
- MsgBox "Compression error"
- End If
- Erase bytaryCpr
- Erase bytaryOri
-End Sub
-
-Public Sub subUncompressFile(ByVal strargFilPth As String)
- Dim bytaryCpr() As Byte
- Dim bytaryOri() As Byte
- Dim lngOriSiz As Long
- Dim lngCprSiz As Long
- Dim strOriPth As String
- lngCprSiz = FileLen(strargFilPth)
- ReDim bytaryCpr(lngCprSiz - 1)
- Open strargFilPth For Binary Access Read As #1
- Get #1, , bytaryCpr()
- Close #1
- 'Read the original file size value:
- lngOriSiz = bytaryCpr(lngCprSiz - 1) * (2 ^ 24) _
- + bytaryCpr(lngCprSiz - 2) * (2 ^ 16) _
- + bytaryCpr(lngCprSiz - 3) * (2 ^ 8) _
- + bytaryCpr(lngCprSiz - 4)
- ReDim Preserve bytaryCpr(lngCprSiz - 5) 'Cut of the original size value
- ReDim bytaryOri(lngOriSiz - 1)
- If lngfncUcp(bytaryOri(0), lngOriSiz, bytaryCpr(0), lngCprSiz) = SUCCESS
-Then
- strOriPth = Left(strargFilPth, Len(strargFilPth) - Len(strFilExt))
- Open strOriPth For Binary Access Write As #1
- Put #1, , bytaryOri()
- Close #1
- Else
- MsgBox "Uncompression error"
- End If
- Erase bytaryCpr
- Erase bytaryOri
-End Sub
-Public Property Get lngPercentSmaller() As Long
- lngPercentSmaller = lngpvtPcnSml
-End Property
diff --git a/funtools/util/zlib-1.2.3/old/zlib.html b/funtools/util/zlib-1.2.3/old/zlib.html
deleted file mode 100644
index 8c1b190..0000000
--- a/funtools/util/zlib-1.2.3/old/zlib.html
+++ /dev/null
@@ -1,971 +0,0 @@
-<html>
-<head>
- <title>
- zlib general purpose compression library version 1.1.4
- </title>
-</head>
-<body bgcolor="White" text="Black" vlink="Red" alink="Navy" link="Red">
-<!-- background="zlibbg.gif" -->
-
-<h1> zlib 1.1.4 Manual </h1>
-<hr>
-<a name="Contents"><h2>Contents</h2>
-<ol type="I">
-<li> <a href="#Prologue">Prologue</a>
-<li> <a href="#Introduction">Introduction</a>
-<li> <a href="#Utility functions">Utility functions</a>
-<li> <a href="#Basic functions">Basic functions</a>
-<li> <a href="#Advanced functions">Advanced functions</a>
-<li> <a href="#Constants">Constants</a>
-<li> <a href="#struct z_stream_s">struct z_stream_s</a>
-<li> <a href="#Checksum functions">Checksum functions</a>
-<li> <a href="#Misc">Misc</a>
-</ol>
-<hr>
-<a name="Prologue"><h2> Prologue </h2>
- 'zlib' general purpose compression library version 1.1.4, March 11th, 2002
- <p>
- Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
- <p>
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
- <p>
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
- <ol>
- <li> The origin of this software must not be misrepresented ; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- <li> Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- <li> This notice may not be removed or altered from any source distribution.
- </ol>
-
- <dl>
- <dt>Jean-loup Gailly
- <dd><a href="mailto:jloup@gzip.org">jloup@gzip.org</a>
- <dt>Mark Adler
- <dd><a href="mailto:madler@alumni.caltech.edu">madler@alumni.caltech.edu</a>
- </dl>
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files
- <a href="ftp://ds.internic.net/rfc/rfc1950.txt">
- ftp://ds.internic.net/rfc/rfc1950.txt </a>
- (zlib format),
- <a href="ftp://ds.internic.net/rfc/rfc1951.txt">
- rfc1951.txt </a>
- (<a href="#deflate">deflate</a> format) and
- <a href="ftp://ds.internic.net/rfc/rfc1952.txt">
- rfc1952.txt </a>
- (gzip format).
- <p>
- This manual is converted from zlib.h by
- <a href="mailto:piaip@csie.ntu.edu.tw"> piaip </a>
- <p>
- Visit <a href="http://ftp.cdrom.com/pub/infozip/zlib/">
- http://ftp.cdrom.com/pub/infozip/zlib/</a>
- for the official zlib web page.
- <p>
-
-<hr>
-<a name="Introduction"><h2> Introduction </h2>
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms will be added later and will have the same
- stream interface.
- <p>
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
- <p>
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio.
- <p>
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never
- crash even in case of corrupted input.
- <p>
-
-<hr>
-<a name="Utility functions"><h2> Utility functions </h2>
- The following utility functions are implemented on top of the
- <a href="#Basic functions">basic stream-oriented functions</a>.
- To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-<h3> Function list </h3>
-<ul>
-<li> int <a href="#compress">compress</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
-<li> int <a href="#compress2">compress2</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level);
-<li> int <a href="#uncompress">uncompress</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
-<li> typedef voidp gzFile;
-<li> gzFile <a href="#gzopen">gzopen</a> (const char *path, const char *mode);
-<li> gzFile <a href="#gzdopen">gzdopen</a> (int fd, const char *mode);
-<li> int <a href="#gzsetparams">gzsetparams</a> (gzFile file, int level, int strategy);
-<li> int <a href="#gzread">gzread</a> (gzFile file, voidp buf, unsigned len);
-<li> int <a href="#gzwrite">gzwrite</a> (gzFile file, const voidp buf, unsigned len);
-<li> int VA <a href="#gzprintf">gzprintf</a> (gzFile file, const char *format, ...);
-<li> int <a href="#gzputs">gzputs</a> (gzFile file, const char *s);
-<li> char * <a href="#gzgets">gzgets</a> (gzFile file, char *buf, int len);
-<li> int <a href="#gzputc">gzputc</a> (gzFile file, int c);
-<li> int <a href="#gzgetc">gzgetc</a> (gzFile file);
-<li> int <a href="#gzflush">gzflush</a> (gzFile file, int flush);
-<li> z_off_t <a href="#gzseek">gzseek</a> (gzFile file, z_off_t offset, int whence);
-<li> z_off_t <a href="#gztell">gztell</a> (gzFile file);
-<li> int <a href="#gzrewind">gzrewind</a> (gzFile file);
-<li> int <a href="#gzeof">gzeof</a> (gzFile file);
-<li> int <a href="#gzclose">gzclose</a> (gzFile file);
-<li> const char * <a href="#gzerror">gzerror</a> (gzFile file, int *errnum);
-</ul>
-<h3> Function description </h3>
-<dl>
-<font color="Blue"><dt> int <a name="compress">compress</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);</font>
-<dd>
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least 0.1% larger than
- sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
- compressed buffer.<p>
- This function can be used to <a href="#compress">compress</a> a whole file at once if the
- input file is mmap'ed.<p>
- <a href="#compress">compress</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
- enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output
- buffer.<p>
-
-<font color="Blue"><dt> int <a name="compress2">compress2</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level);</font>
-<dd>
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in <a href="#deflateInit">deflateInit</a>. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
- <p>
-
- <a href="#compress2">compress2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
- memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output buffer,
- <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the level parameter is invalid.
- <p>
-
-<font color="Blue"><dt> int <a name="uncompress">uncompress</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);</font>
-<dd>
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer. <p>
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
- <p>
-
- <a href="#uncompress">uncompress</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
- enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output
- buffer, or <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was corrupted.
- <p>
-
-<dt> typedef voidp gzFile;
-<dd> <p>
-
-<font color="Blue"><dt> gzFile <a name="gzopen">gzopen</a> (const char *path, const char *mode);</font>
-<dd>
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h". (See the description
- of <a href="#deflateInit2">deflateInit2</a> for more information about the strategy parameter.)
- <p>
-
- <a href="#gzopen">gzopen</a> can be used to read a file which is not in gzip format ; in this
- case <a href="#gzread">gzread</a> will directly read from the file without decompression.
- <p>
-
- <a href="#gzopen">gzopen</a> returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression <a href="#state">state</a> ; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a>).
- <p>
-
-<font color="Blue"><dt> gzFile <a name="gzdopen">gzdopen</a> (int fd, const char *mode);</font>
-<dd>
- <a href="#gzdopen">gzdopen</a>() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in <a href="#gzopen">gzopen</a>.
- <p>
- The next call of <a href="#gzclose">gzclose</a> on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use <a href="#gzdopen">gzdopen</a>(dup(fd), mode).
- <p>
- <a href="#gzdopen">gzdopen</a> returns NULL if there was insufficient memory to allocate
- the (de)compression <a href="#state">state</a>.
- <p>
-
-<font color="Blue"><dt> int <a name="gzsetparams">gzsetparams</a> (gzFile file, int level, int strategy);</font>
-<dd>
- Dynamically update the compression level or strategy. See the description
- of <a href="#deflateInit2">deflateInit2</a> for the meaning of these parameters.
- <p>
- <a href="#gzsetparams">gzsetparams</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the file was not
- opened for writing.
- <p>
-
-<font color="Blue"><dt> int <a name="gzread">gzread</a> (gzFile file, voidp buf, unsigned len);</font>
-<dd>
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, <a href="#gzread">gzread</a> copies the given number
- of bytes into the buffer.
- <p>
- <a href="#gzread">gzread</a> returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error).
- <p>
-
-<font color="Blue"><dt> int <a name="gzwrite">gzwrite</a> (gzFile file, const voidp buf, unsigned len);</font>
-<dd>
- Writes the given number of uncompressed bytes into the compressed file.
- <a href="#gzwrite">gzwrite</a> returns the number of uncompressed bytes actually written
- (0 in case of error).
- <p>
-
-<font color="Blue"><dt> int VA <a name="gzprintf">gzprintf</a> (gzFile file, const char *format, ...);</font>
-<dd>
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. <a href="#gzprintf">gzprintf</a> returns the number of
- uncompressed bytes actually written (0 in case of error).
- <p>
-
-<font color="Blue"><dt> int <a name="gzputs">gzputs</a> (gzFile file, const char *s);</font>
-<dd>
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- <p>
- <a href="#gzputs">gzputs</a> returns the number of characters written, or -1 in case of error.
- <p>
-
-<font color="Blue"><dt> char * <a name="gzgets">gzgets</a> (gzFile file, char *buf, int len);</font>
-<dd>
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- <p>
- <a href="#gzgets">gzgets</a> returns buf, or <a href="#Z_NULL">Z_NULL</a> in case of error.
- <p>
-
-<font color="Blue"><dt> int <a name="gzputc">gzputc</a> (gzFile file, int c);</font>
-<dd>
- Writes c, converted to an unsigned char, into the compressed file.
- <a href="#gzputc">gzputc</a> returns the value that was written, or -1 in case of error.
- <p>
-
-<font color="Blue"><dt> int <a name="gzgetc">gzgetc</a> (gzFile file);</font>
-<dd>
- Reads one byte from the compressed file. <a href="#gzgetc">gzgetc</a> returns this byte
- or -1 in case of end of file or error.
- <p>
-
-<font color="Blue"><dt> int <a name="gzflush">gzflush</a> (gzFile file, int flush);</font>
-<dd>
- Flushes all pending output into the compressed file. The parameter
- flush is as in the <a href="#deflate">deflate</a>() function. The return value is the zlib
- error number (see function <a href="#gzerror">gzerror</a> below). <a href="#gzflush">gzflush</a> returns <a href="#Z_OK">Z_OK</a> if
- the flush parameter is <a href="#Z_FINISH">Z_FINISH</a> and all output could be flushed.
- <p>
- <a href="#gzflush">gzflush</a> should be called only when strictly necessary because it can
- degrade compression.
- <p>
-
-<font color="Blue"><dt> z_off_t <a name="gzseek">gzseek</a> (gzFile file, z_off_t offset, int whence);</font>
-<dd>
- Sets the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
- <p>
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported ; <a href="#gzseek">gzseek</a> then compresses a sequence of zeroes up to the new
- starting position.
- <p>
- <a href="#gzseek">gzseek</a> returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
- <p>
-
-<font color="Blue"><dt> int <a name="gzrewind">gzrewind</a> (gzFile file);</font>
-<dd>
- Rewinds the given file. This function is supported only for reading.
- <p>
- <a href="#gzrewind">gzrewind</a>(file) is equivalent to (int)<a href="#gzseek">gzseek</a>(file, 0L, SEEK_SET)
- <p>
-
-<font color="Blue"><dt> z_off_t <a name="gztell">gztell</a> (gzFile file);</font>
-<dd>
- Returns the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
- <p>
-
- <a href="#gztell">gztell</a>(file) is equivalent to <a href="#gzseek">gzseek</a>(file, 0L, SEEK_CUR)
- <p>
-
-<font color="Blue"><dt> int <a name="gzeof">gzeof</a> (gzFile file);</font>
-<dd>
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
- <p>
-
-<font color="Blue"><dt> int <a name="gzclose">gzclose</a> (gzFile file);</font>
-<dd>
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression <a href="#state">state</a>. The return value is the zlib
- error number (see function <a href="#gzerror">gzerror</a> below).
- <p>
-
-<font color="Blue"><dt> const char * <a name="gzerror">gzerror</a> (gzFile file, int *errnum);</font>
-<dd>
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to <a href="#Z_ERRNO">Z_ERRNO</a> and the application may consult errno
- to get the exact error code.
- <p>
-</dl>
-<hr>
-<a name="Basic functions"><h2> Basic functions </h2>
-<h3> Function list </h3>
-<ul>
-<li> const char * <a href="#zlibVersion">zlibVersion</a> (void);
-<li> int <a href="#deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);
-<li> int <a href="#deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);
-<li> int <a href="#deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);
-<li> int <a href="#inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);
-<li> int <a href="#inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);
-<li> int <a href="#inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);
-</ul>
-
-<h3> Function description </h3>
-<dl>
-<font color="Blue"><dt> const char * <a name="zlibVersion">zlibVersion</a> (void);</font>
-<dd> The application can compare <a href="#zlibVersion">zlibVersion</a> and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a>.
- <p>
-
-<font color="Blue"><dt> int <a name="deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);</font>
-<dd>
- Initializes the internal stream <a href="#state">state</a> for compression. The fields
- <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by the caller.
- If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#deflateInit">deflateInit</a> updates them to
- use default allocation functions.
- <p>
-
- The compression level must be <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a>, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- <p>
-
- <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a> requests a default compromise between speed and
- compression (currently equivalent to level 6).
- <p>
-
- <a href="#deflateInit">deflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
- enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if level is not a valid compression level,
- <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version (<a href="#zlib_version">zlib_version</a>) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- <a href="#msg">msg</a> is set to null if there is no error message. <a href="#deflateInit">deflateInit</a> does not
- perform any compression: this will be done by <a href="#deflate">deflate</a>().
- <p>
-
-<font color="Blue"><dt> int <a name="deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font>
-<dd>
- <a href="#deflate">deflate</a> compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce some
- output latency (reading input without producing any output) except when
- forced to flush.<p>
-
- The detailed semantics are as follows. <a href="#deflate">deflate</a> performs one or both of the
- following actions:
-
- <ul>
- <li> Compress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> are updated and
- processing will resume at this point for the next call of <a href="#deflate">deflate</a>().
-
- <li>
- Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a>
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
- </ul> <p>
-
- Before the call of <a href="#deflate">deflate</a>(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> accordingly ; <a href="#avail_out">avail_out</a>
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (<a href="#avail_out">avail_out</a> == 0), or after each call of <a href="#deflate">deflate</a>(). If <a href="#deflate">deflate</a> returns <a href="#Z_OK">Z_OK</a>
- and with zero <a href="#avail_out">avail_out</a>, it must be called again after making room in the
- output buffer because there might be more output pending.
- <p>
-
- If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In particular
- <a href="#avail_in">avail_in</a> is zero after the call if enough output space has been provided
- before the call.) Flushing may degrade compression for some compression
- algorithms and so it should be used only when necessary.
- <p>
-
- If flush is set to <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>, all output is flushed as with
- <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, and the compression <a href="#state">state</a> is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a> too often can seriously degrade
- the compression.
- <p>
-
- If <a href="#deflate">deflate</a> returns with <a href="#avail_out">avail_out</a> == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- <a href="#avail_out">avail_out</a>), until the flush is complete (<a href="#deflate">deflate</a> returns with non-zero
- <a href="#avail_out">avail_out</a>).
- <p>
-
- If the parameter flush is set to <a href="#Z_FINISH">Z_FINISH</a>, pending input is processed,
- pending output is flushed and <a href="#deflate">deflate</a> returns with <a href="#Z_STREAM_END">Z_STREAM_END</a> if there
- was enough output space ; if <a href="#deflate">deflate</a> returns with <a href="#Z_OK">Z_OK</a>, this function must be
- called again with <a href="#Z_FINISH">Z_FINISH</a> and more output space (updated <a href="#avail_out">avail_out</a>) but no
- more input data, until it returns with <a href="#Z_STREAM_END">Z_STREAM_END</a> or an error. After
- <a href="#deflate">deflate</a> has returned <a href="#Z_STREAM_END">Z_STREAM_END</a>, the only possible operations on the
- stream are <a href="#deflateReset">deflateReset</a> or <a href="#deflateEnd">deflateEnd</a>.
- <p>
-
- <a href="#Z_FINISH">Z_FINISH</a> can be used immediately after <a href="#deflateInit">deflateInit</a> if all the compression
- is to be done in a single step. In this case, <a href="#avail_out">avail_out</a> must be at least
- 0.1% larger than <a href="#avail_in">avail_in</a> plus 12 bytes. If <a href="#deflate">deflate</a> does not return
- <a href="#Z_STREAM_END">Z_STREAM_END</a>, then it must be called again as described above.
- <p>
-
- <a href="#deflate">deflate</a>() sets strm-&gt <a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of all input read
- so far (that is, <a href="#total_in">total_in</a> bytes).
- <p>
-
- <a href="#deflate">deflate</a>() may update <a href="#data_type">data_type</a> if it can make a good guess about
- the input data type (<a href="#Z_ASCII">Z_ASCII</a> or <a href="#Z_BINARY">Z_BINARY</a>). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
- <p>
-
- <a href="#deflate">deflate</a>() returns <a href="#Z_OK">Z_OK</a> if some progress has been made (more input
- processed or more output produced), <a href="#Z_STREAM_END">Z_STREAM_END</a> if all input has been
- consumed and all output has been produced (only when flush is set to
- <a href="#Z_FINISH">Z_FINISH</a>), <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <a href="#state">state</a> was inconsistent (for example
- if <a href="#next_in">next_in</a> or <a href="#next_out">next_out</a> was NULL), <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible
- (for example <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> was zero).
- <p>
-
-<font color="Blue"><dt> int <a name="deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
-<dd>
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
- <p>
-
- <a href="#deflateEnd">deflateEnd</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the
- stream <a href="#state">state</a> was inconsistent, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- <a href="#msg">msg</a> may be set but then points to a static string (which must not be
- deallocated).
- <p>
-
-<font color="Blue"><dt> int <a name="inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
-<dd>
- Initializes the internal stream <a href="#state">state</a> for decompression. The fields
- <a href="#next_in">next_in</a>, <a href="#avail_in">avail_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by
- the caller. If <a href="#next_in">next_in</a> is not <a href="#Z_NULL">Z_NULL</a> and <a href="#avail_in">avail_in</a> is large enough (the exact
- value depends on the compression method), <a href="#inflateInit">inflateInit</a> determines the
- compression method from the zlib header and allocates all data structures
- accordingly ; otherwise the allocation will be deferred to the first call of
- <a href="#inflate">inflate</a>. If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#inflateInit">inflateInit</a> updates them to
- use default allocation functions.
- <p>
-
- <a href="#inflateInit">inflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
- memory, <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version is incompatible with the
- version assumed by the caller. <a href="#msg">msg</a> is set to null if there is no error
- message. <a href="#inflateInit">inflateInit</a> does not perform any decompression apart from reading
- the zlib header if present: this will be done by <a href="#inflate">inflate</a>(). (So <a href="#next_in">next_in</a> and
- <a href="#avail_in">avail_in</a> may be modified, but <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> are unchanged.)
- <p>
-
-<font color="Blue"><dt> int <a name="inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font>
-<dd>
- <a href="#inflate">inflate</a> decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may some
- introduce some output latency (reading input without producing any output)
- except when forced to flush.
- <p>
-
- The detailed semantics are as follows. <a href="#inflate">inflate</a> performs one or both of the
- following actions:
-
- <ul>
- <li> Decompress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), <a href="#next_in">next_in</a> is updated and processing
- will resume at this point for the next call of <a href="#inflate">inflate</a>().
-
- <li> Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and
- <a href="#avail_out">avail_out</a> accordingly. <a href="#inflate">inflate</a>() provides as much output as possible,
- until there is no more input data or no more space in the output buffer
- (see below about the flush parameter).
- </ul> <p>
-
- Before the call of <a href="#inflate">inflate</a>(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (<a href="#avail_out">avail_out</a> == 0), or after each
- call of <a href="#inflate">inflate</a>(). If <a href="#inflate">inflate</a> returns <a href="#Z_OK">Z_OK</a> and with zero <a href="#avail_out">avail_out</a>, it
- must be called again after making room in the output buffer because there
- might be more output pending.
- <p>
-
- If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, <a href="#inflate">inflate</a> flushes as much
- output as possible to the output buffer. The flushing behavior of <a href="#inflate">inflate</a> is
- not specified for values of the flush parameter other than <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>
- and <a href="#Z_FINISH">Z_FINISH</a>, but the current implementation actually flushes as much output
- as possible anyway.
- <p>
-
- <a href="#inflate">inflate</a>() should normally be called until it returns <a href="#Z_STREAM_END">Z_STREAM_END</a> or an
- error. However if all decompression is to be performed in a single step
- (a single call of <a href="#inflate">inflate</a>), the parameter flush should be set to
- <a href="#Z_FINISH">Z_FINISH</a>. In this case all pending input is processed and all pending
- output is flushed ; <a href="#avail_out">avail_out</a> must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be <a href="#inflateEnd">inflateEnd</a> to deallocate the decompression <a href="#state">state</a>. The use of <a href="#Z_FINISH">Z_FINISH</a>
- is never required, but can be used to inform <a href="#inflate">inflate</a> that a faster routine
- may be used for the single <a href="#inflate">inflate</a>() call.
- <p>
-
- If a preset dictionary is needed at this point (see <a href="#inflateSetDictionary">inflateSetDictionary</a>
- below), <a href="#inflate">inflate</a> sets strm-<a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of the
- dictionary chosen by the compressor and returns <a href="#Z_NEED_DICT">Z_NEED_DICT</a> ; otherwise
- it sets strm-&gt <a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of all output produced
- so far (that is, <a href="#total_out">total_out</a> bytes) and returns <a href="#Z_OK">Z_OK</a>, <a href="#Z_STREAM_END">Z_STREAM_END</a> or
- an error code as described below. At the end of the stream, <a href="#inflate">inflate</a>()
- checks that its computed <a href="#adler32">adler32</a> checksum is equal to that saved by the
- compressor and returns <a href="#Z_STREAM_END">Z_STREAM_END</a> only if the checksum is correct.
- <p>
-
- <a href="#inflate">inflate</a>() returns <a href="#Z_OK">Z_OK</a> if some progress has been made (more input processed
- or more output produced), <a href="#Z_STREAM_END">Z_STREAM_END</a> if the end of the compressed data has
- been reached and all uncompressed output has been produced, <a href="#Z_NEED_DICT">Z_NEED_DICT</a> if a
- preset dictionary is needed at this point, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect
- <a href="#adler32">adler32</a> checksum), <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent
- (for example if <a href="#next_in">next_in</a> or <a href="#next_out">next_out</a> was NULL), <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
- enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible or if there was not
- enough room in the output buffer when <a href="#Z_FINISH">Z_FINISH</a> is used. In the <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a>
- case, the application may then call <a href="#inflateSync">inflateSync</a> to look for a good
- compression block.
- <p>
-
-<font color="Blue"><dt> int <a name="inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
-<dd>
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
- <p>
-
- <a href="#inflateEnd">inflateEnd</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <a href="#state">state</a>
- was inconsistent. In the error case, <a href="#msg">msg</a> may be set but then points to a
- static string (which must not be deallocated).
-</dl>
-<hr>
-<a name="Advanced functions"><h2> Advanced functions </h2>
- The following functions are needed only in some special applications.
-<h3> Function list </h3>
-<ul>
-<li> int <a href="#deflateInit2">deflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm,
-<li> int <a href="#deflateSetDictionary">deflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);
-<li> int <a href="#deflateCopy">deflateCopy</a> (<a href="#z_streamp">z_streamp</a> dest, <a href="#z_streamp">z_streamp</a> source);
-<li> int <a href="#deflateReset">deflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);
-<li> int <a href="#deflateParams">deflateParams</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int strategy);
-<li> int <a href="#inflateInit2">inflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int windowBits);
-<li> int <a href="#inflateSetDictionary">inflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);
-<li> int <a href="#inflateSync">inflateSync</a> (<a href="#z_streamp">z_streamp</a> strm);
-<li> int <a href="#inflateReset">inflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);
-
-</ul>
-<h3> Function description </h3>
-<dl>
-<font color="Blue"><dt> int <a name="deflateInit2">deflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int method, int windowBits, int memLevel, int strategy);</font>
-
-<dd> This is another version of <a href="#deflateInit">deflateInit</a> with more compression options. The
- fields <a href="#next_in">next_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by
- the caller.<p>
-
- The method parameter is the compression method. It must be <a href="#Z_DEFLATED">Z_DEFLATED</a> in
- this version of the library.<p>
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- <a href="#deflateInit">deflateInit</a> is used instead.<p>
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression <a href="#state">state</a>. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio ; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.<p>
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value <a href="#Z_DEFAULT_STRATEGY">Z_DEFAULT_STRATEGY</a> for normal data, <a href="#Z_FILTERED">Z_FILTERED</a> for data produced by a
- filter (or predictor), or <a href="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a> to force Huffman encoding only (no
- string match). Filtered data consists mostly of small values with a
- somewhat random distribution. In this case, the compression algorithm is
- tuned to <a href="#compress">compress</a> them better. The effect of <a href="#Z_FILTERED">Z_FILTERED</a> is to force more
- Huffman coding and less string matching ; it is somewhat intermediate
- between Z_DEFAULT and <a href="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a>. The strategy parameter only affects
- the compression ratio but not the correctness of the compressed output even
- if it is not set appropriately.<p>
-
- <a href="#deflateInit2">deflateInit2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
- memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as an invalid
- method). <a href="#msg">msg</a> is set to null if there is no error message. <a href="#deflateInit2">deflateInit2</a> does
- not perform any compression: this will be done by <a href="#deflate">deflate</a>().<p>
-
-<font color="Blue"><dt> int <a name="deflateSetDictionary">deflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);</font>
-<dd>
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after <a href="#deflateInit">deflateInit</a>, <a href="#deflateInit2">deflateInit2</a> or <a href="#deflateReset">deflateReset</a>, before any
- call of <a href="#deflate">deflate</a>. The compressor and decompressor must use exactly the same
- dictionary (see <a href="#inflateSetDictionary">inflateSetDictionary</a>).<p>
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy ; the data can then be compressed better than
- with the default empty dictionary.<p>
-
- Depending on the size of the compression data structures selected by
- <a href="#deflateInit">deflateInit</a> or <a href="#deflateInit2">deflateInit2</a>, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- <a href="#deflate">deflate</a> or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front.<p>
-
- Upon return of this function, strm-&gt <a href="#adler">adler</a> is set to the Adler32 value
- of the dictionary ; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The Adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.)<p>
-
- <a href="#deflateSetDictionary">deflateSetDictionary</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
- parameter is invalid (such as NULL dictionary) or the stream <a href="#state">state</a> is
- inconsistent (for example if <a href="#deflate">deflate</a> has already been called for this stream
- or if the compression method is bsort). <a href="#deflateSetDictionary">deflateSetDictionary</a> does not
- perform any compression: this will be done by <a href="#deflate">deflate</a>().<p>
-
-<font color="Blue"><dt> int <a name="deflateCopy">deflateCopy</a> (<a href="#z_streamp">z_streamp</a> dest, <a href="#z_streamp">z_streamp</a> source);</font>
-<dd>
- Sets the destination stream as a complete copy of the source stream.<p>
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling <a href="#deflateEnd">deflateEnd</a>. Note that <a href="#deflateCopy">deflateCopy</a> duplicates the internal
- compression <a href="#state">state</a> which can be quite large, so this strategy is slow and
- can consume lots of memory.<p>
-
- <a href="#deflateCopy">deflateCopy</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
- enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source stream <a href="#state">state</a> was inconsistent
- (such as <a href="#zalloc">zalloc</a> being NULL). <a href="#msg">msg</a> is left unchanged in both source and
- destination.<p>
-
-<font color="Blue"><dt> int <a name="deflateReset">deflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
-<dd> This function is equivalent to <a href="#deflateEnd">deflateEnd</a> followed by <a href="#deflateInit">deflateInit</a>,
- but does not free and reallocate all the internal compression <a href="#state">state</a>.
- The stream will keep the same compression level and any other attributes
- that may have been set by <a href="#deflateInit2">deflateInit2</a>.<p>
-
- <a href="#deflateReset">deflateReset</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
- stream <a href="#state">state</a> was inconsistent (such as <a href="#zalloc">zalloc</a> or <a href="#state">state</a> being NULL).<p>
-
-<font color="Blue"><dt> int <a name="deflateParams">deflateParams</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int strategy);</font>
-<dd>
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in <a href="#deflateInit2">deflateInit2</a>. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of <a href="#deflate">deflate</a>().<p>
-
- Before the call of <a href="#deflateParams">deflateParams</a>, the stream <a href="#state">state</a> must be set as for
- a call of <a href="#deflate">deflate</a>(), since the currently available input may have to
- be compressed and flushed. In particular, strm-&gt <a href="#avail_out">avail_out</a> must be
- non-zero.<p>
-
- <a href="#deflateParams">deflateParams</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
- stream <a href="#state">state</a> was inconsistent or if a parameter was invalid, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a>
- if strm-&gtavail_out was zero.<p>
-
-<font color="Blue"><dt> int <a name="inflateInit2">inflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int windowBits);</font>
-
-<dd> This is another version of <a href="#inflateInit">inflateInit</a> with an extra parameter. The
- fields <a href="#next_in">next_in</a>, <a href="#avail_in">avail_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized
- before by the caller.<p>
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if <a href="#inflateInit">inflateInit</a> is used
- instead. If a compressed stream with a larger window size is given as
- input, <a href="#inflate">inflate</a>() will return with the error code <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> instead of
- trying to allocate a larger window.<p>
-
- <a href="#inflateInit2">inflateInit2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
- memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as a negative
- memLevel). <a href="#msg">msg</a> is set to null if there is no error message. <a href="#inflateInit2">inflateInit2</a>
- does not perform any decompression apart from reading the zlib header if
- present: this will be done by <a href="#inflate">inflate</a>(). (So <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> may be
- modified, but <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> are unchanged.)<p>
-
-<font color="Blue"><dt> int <a name="inflateSetDictionary">inflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);</font>
-<dd>
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of <a href="#inflate">inflate</a>
- if this call returned <a href="#Z_NEED_DICT">Z_NEED_DICT</a>. The dictionary chosen by the compressor
- can be determined from the Adler32 value returned by this call of
- <a href="#inflate">inflate</a>. The compressor and decompressor must use exactly the same
- dictionary (see <a href="#deflateSetDictionary">deflateSetDictionary</a>).<p>
-
- <a href="#inflateSetDictionary">inflateSetDictionary</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
- parameter is invalid (such as NULL dictionary) or the stream <a href="#state">state</a> is
- inconsistent, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the given dictionary doesn't match the
- expected one (incorrect Adler32 value). <a href="#inflateSetDictionary">inflateSetDictionary</a> does not
- perform any decompression: this will be done by subsequent calls of
- <a href="#inflate">inflate</a>().<p>
-
-<font color="Blue"><dt> int <a name="inflateSync">inflateSync</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
-
-<dd> Skips invalid compressed data until a full flush point (see above the
- description of <a href="#deflate">deflate</a> with <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>) can be found, or until all
- available input is skipped. No output is provided.<p>
-
- <a href="#inflateSync">inflateSync</a> returns <a href="#Z_OK">Z_OK</a> if a full flush point has been found, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a>
- if no more input was provided, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if no flush point has been found,
- or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent. In the success
- case, the application may save the current current value of <a href="#total_in">total_in</a> which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call <a href="#inflateSync">inflateSync</a>, providing more input each time,
- until success or end of the input data.<p>
-
-<font color="Blue"><dt> int <a name="inflateReset">inflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
-<dd>
- This function is equivalent to <a href="#inflateEnd">inflateEnd</a> followed by <a href="#inflateInit">inflateInit</a>,
- but does not free and reallocate all the internal decompression <a href="#state">state</a>.
- The stream will keep attributes that may have been set by <a href="#inflateInit2">inflateInit2</a>.
- <p>
-
- <a href="#inflateReset">inflateReset</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
- stream <a href="#state">state</a> was inconsistent (such as <a href="#zalloc">zalloc</a> or <a href="#state">state</a> being NULL).
- <p>
-</dl>
-
-<hr>
-<a name="Checksum functions"><h2> Checksum functions </h2>
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-<h3> Function list </h3>
-<ul>
-<li> uLong <a href="#adler32">adler32</a> (uLong <a href="#adler">adler</a>, const Bytef *buf, uInt len);
-<li> uLong <a href="#crc32">crc32</a> (uLong crc, const Bytef *buf, uInt len);
-</ul>
-<h3> Function description </h3>
-<dl>
-<font color="Blue"><dt> uLong <a name="adler32">adler32</a> (uLong <a href="#adler">adler</a>, const Bytef *buf, uInt len);</font>
-<dd>
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- <p>
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
- <pre>
-
- uLong <a href="#adler">adler</a> = <a href="#adler32">adler32</a>(0L, <a href="#Z_NULL">Z_NULL</a>, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- <a href="#adler">adler</a> = <a href="#adler32">adler32</a>(<a href="#adler">adler</a>, buffer, length);
- }
- if (<a href="#adler">adler</a> != original_adler) error();
- </pre>
-
-<font color="Blue"><dt> uLong <a name="crc32">crc32</a> (uLong crc, const Bytef *buf, uInt len);</font>
-<dd>
- Update a running crc with the bytes buf[0..len-1] and return the updated
- crc. If buf is NULL, this function returns the required initial value
- for the crc. Pre- and post-conditioning (one's complement) is performed
- within this function so it shouldn't be done by the application.
- Usage example:
- <pre>
-
- uLong crc = <a href="#crc32">crc32</a>(0L, <a href="#Z_NULL">Z_NULL</a>, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = <a href="#crc32">crc32</a>(crc, buffer, length);
- }
- if (crc != original_crc) error();
- </pre>
-</dl>
-<hr>
-<a name="struct z_stream_s"><h2> struct z_stream_s </h2>
-<font color="Blue">
-<a name="z_stream_s">
-<pre>
-typedef struct z_stream_s {
- Bytef *<a name="next_in">next_in</a>; /* next input byte */
- uInt <a name="avail_in">avail_in</a>; /* number of bytes available at <a href="#next_in">next_in</a> */
- uLong <a name="total_in">total_in</a>; /* total nb of input bytes read so far */
-
- Bytef *<a name="next_out">next_out</a>; /* next output byte should be put there */
- uInt <a name="avail_out">avail_out</a>; /* remaining free space at <a href="#next_out">next_out</a> */
- uLong <a name="total_out">total_out</a>; /* total nb of bytes output so far */
-
- char *<a name="msg">msg</a>; /* last error message, NULL if no error */
- struct internal_state FAR *<a name="state">state</a>; /* not visible by applications */
-
- alloc_func <a name="zalloc">zalloc</a>; /* used to allocate the internal <a href="#state">state</a> */
- free_func <a name="zfree">zfree</a>; /* used to free the internal <a href="#state">state</a> */
- voidpf <a name="opaque">opaque</a>; /* private data object passed to <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> */
-
- int <a name="data_type">data_type</a>; /* best guess about the data type: ascii or binary */
- uLong <a name="adler">adler</a>; /* <a href="#adler32">adler32</a> value of the uncompressed data */
- uLong <a name="reserved">reserved</a>; /* <a href="#reserved">reserved</a> for future use */
-} <a href="#z_stream_s">z_stream</a> ;
-
-typedef <a href="#z_stream_s">z_stream</a> FAR * <a name="z_streamp">z_streamp</a>; ÿ
-</pre>
-</font>
- The application must update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> when <a href="#avail_in">avail_in</a> has
- dropped to zero. It must update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> when <a href="#avail_out">avail_out</a>
- has dropped to zero. The application must initialize <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and
- <a href="#opaque">opaque</a> before calling the init function. All other fields are set by the
- compression library and must not be updated by the application. <p>
-
- The <a href="#opaque">opaque</a> value provided by the application will be passed as the first
- parameter for calls of <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a>. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- <a href="#opaque">opaque</a> value. <p>
-
- <a href="#zalloc">zalloc</a> must return <a href="#Z_NULL">Z_NULL</a> if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> must be
- thread safe. <p>
-
- On 16-bit systems, the functions <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by <a href="#zalloc">zalloc</a> for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
- <p>
-
- The fields <a href="#total_in">total_in</a> and <a href="#total_out">total_out</a> can be used for statistics or
- progress reports. After compression, <a href="#total_in">total_in</a> holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step). <p>
-
-<hr>
-<a name="Constants"><h2> Constants </h2>
-<font color="Blue">
-<pre>
-#define <a name="Z_NO_FLUSH">Z_NO_FLUSH</a> 0
-#define <a name="Z_PARTIAL_FLUSH">Z_PARTIAL_FLUSH</a> 1
- /* will be removed, use <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a> instead */
-#define <a name="Z_SYNC_FLUSH">Z_SYNC_FLUSH</a> 2
-#define <a name="Z_FULL_FLUSH">Z_FULL_FLUSH</a> 3
-#define <a name="Z_FINISH">Z_FINISH</a> 4
-/* Allowed flush values ; see <a href="#deflate">deflate</a>() below for details */
-
-#define <a name="Z_OK">Z_OK</a> 0
-#define <a name="Z_STREAM_END">Z_STREAM_END</a> 1
-#define <a name="Z_NEED_DICT">Z_NEED_DICT</a> 2
-#define <a name="Z_ERRNO">Z_ERRNO</a> (-1)
-#define <a name="Z_STREAM_ERROR">Z_STREAM_ERROR</a> (-2)
-#define <a name="Z_DATA_ERROR">Z_DATA_ERROR</a> (-3)
-#define <a name="Z_MEM_ERROR">Z_MEM_ERROR</a> (-4)
-#define <a name="Z_BUF_ERROR">Z_BUF_ERROR</a> (-5)
-#define <a name="Z_VERSION_ERROR">Z_VERSION_ERROR</a> (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define <a name="Z_NO_COMPRESSION">Z_NO_COMPRESSION</a> 0
-#define <a name="Z_BEST_SPEED">Z_BEST_SPEED</a> 1
-#define <a name="Z_BEST_COMPRESSION">Z_BEST_COMPRESSION</a> 9
-#define <a name="Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a> (-1)
-/* compression levels */
-
-#define <a name="Z_FILTERED">Z_FILTERED</a> 1
-#define <a name="Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a> 2
-#define <a name="Z_DEFAULT_STRATEGY">Z_DEFAULT_STRATEGY</a> 0
-/* compression strategy ; see <a href="#deflateInit2">deflateInit2</a>() below for details */
-
-#define <a name="Z_BINARY">Z_BINARY</a> 0
-#define <a name="Z_ASCII">Z_ASCII</a> 1
-#define <a name="Z_UNKNOWN">Z_UNKNOWN</a> 2
-/* Possible values of the <a href="#data_type">data_type</a> field */
-
-#define <a name="Z_DEFLATED">Z_DEFLATED</a> 8
-/* The <a href="#deflate">deflate</a> compression method (the only one supported in this version) */
-
-#define <a name="Z_NULL">Z_NULL</a> 0 /* for initializing <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a>, <a href="#opaque">opaque</a> */
-
-#define <a name="zlib_version">zlib_version</a> <a href="#zlibVersion">zlibVersion</a>()
-/* for compatibility with versions less than 1.0.2 */
-</pre>
-</font>
-
-<hr>
-<a name="Misc"><h2> Misc </h2>
- <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a> are macros to allow checking the zlib version
- and the compiler's view of <a href="#z_stream_s">z_stream</a>.
- <p>
- Other functions:
- <dl>
- <font color="Blue"><dt> const char * <a name="zError">zError</a> (int err);</font>
- <font color="Blue"><dt> int <a name="inflateSyncPoint">inflateSyncPoint</a> (<a href="#z_streamp">z_streamp</a> z);</font>
- <font color="Blue"><dt> const uLongf * <a name="get_crc_table">get_crc_table</a> (void);</font>
- </dl>
- <hr>
- <font size="-1">
- Last update: Wed Oct 13 20:42:34 1999<br>
- piapi@csie.ntu.edu.tw
- </font>
-
-</body>
-</html>
diff --git a/funtools/util/zlib-1.2.3/projects/README.projects b/funtools/util/zlib-1.2.3/projects/README.projects
deleted file mode 100644
index 1c029e4..0000000
--- a/funtools/util/zlib-1.2.3/projects/README.projects
+++ /dev/null
@@ -1,41 +0,0 @@
-This directory contains project files for building zlib under various
-Integrated Development Environments (IDE).
-
-If you wish to submit a new project to this directory, you should comply
-to the following requirements. Otherwise (e.g. if you wish to integrate
-a custom piece of code that changes the zlib interface or its behavior),
-please consider submitting the project to the contrib directory.
-
-
-Requirements
-============
-
-- The project must build zlib using the source files from the official
- zlib source distribution, exclusively.
-
-- If the project produces redistributable builds (e.g. shared objects
- or DLL files), these builds must be compatible to those produced by
- makefiles, if such makefiles exist in the zlib distribution.
- In particular, if the project produces a DLL build for the Win32
- platform, this build must comply to the officially-ammended Win32 DLL
- Application Binary Interface (ABI), described in win32/DLL_FAQ.txt.
-
-- The project may provide additional build targets, which depend on
- 3rd-party (unofficially-supported) software, present in the contrib
- directory. For example, it is possible to provide an "ASM build",
- besides the officially-supported build, and have ASM source files
- among its dependencies.
-
-- If there are significant differences between the project files created
- by different versions of an IDE (e.g. Visual C++ 6.0 vs. 7.0), the name
- of the project directory should contain the version number of the IDE
- for which the project is intended (e.g. "visualc6" for Visual C++ 6.0,
- or "visualc7" for Visual C++ 7.0 and 7.1).
-
-
-Current projects
-================
-
-visualc6/ by Simon-Pierre Cadieux <methodex@methodex.ca>
- and Cosmin Truta <cosmint@cs.ubbcluj.ro>
- Project for Microsoft Visual C++ 6.0
diff --git a/funtools/util/zlib-1.2.3/projects/visualc6/README.txt b/funtools/util/zlib-1.2.3/projects/visualc6/README.txt
deleted file mode 100644
index d0296c2..0000000
--- a/funtools/util/zlib-1.2.3/projects/visualc6/README.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-Microsoft Developer Studio Project Files, Format Version 6.00 for zlib.
-
-Copyright (C) 2000-2004 Simon-Pierre Cadieux.
-Copyright (C) 2004 Cosmin Truta.
-For conditions of distribution and use, see copyright notice in zlib.h.
-
-
-This project builds the zlib binaries as follows:
-
-* Win32_DLL_Release\zlib1.dll DLL build
-* Win32_DLL_Debug\zlib1d.dll DLL build (debug version)
-* Win32_DLL_ASM_Release\zlib1.dll DLL build using ASM code
-* Win32_DLL_ASM_Debug\zlib1d.dll DLL build using ASM code (debug version)
-* Win32_LIB_Release\zlib.lib static build
-* Win32_LIB_Debug\zlibd.lib static build (debug version)
-* Win32_LIB_ASM_Release\zlib.lib static build using ASM code
-* Win32_LIB_ASM_Debug\zlibd.lib static build using ASM code (debug version)
-
-
-For more information regarding the DLL builds, please see the DLL FAQ
-in ..\..\win32\DLL_FAQ.txt.
-
-
-To build and test:
-
-1) On the main menu, select "File | Open Workspace".
- Open "zlib.dsw".
-
-2) Select "Build | Set Active Configuration".
- Choose the configuration you wish to build.
-
-3) Select "Build | Clean".
-
-4) Select "Build | Build ... (F7)". Ignore warning messages about
- not being able to find certain include files (e.g. alloc.h).
-
-5) If you built one of the sample programs (example or minigzip),
- select "Build | Execute ... (Ctrl+F5)".
-
-
-To use:
-
-1) Select "Project | Settings (Alt+F7)".
- Make note of the configuration names used in your project.
- Usually, these names are "Win32 Release" and "Win32 Debug".
-
-2) In the Workspace window, select the "FileView" tab.
- Right-click on the root item "Workspace '...'".
- Select "Insert Project into Workspace".
- Switch on the checkbox "Dependency of:", and select the name
- of your project. Open "zlib.dsp".
-
-3) Select "Build | Configurations".
- For each configuration of your project:
- 3.1) Choose the zlib configuration you wish to use.
- 3.2) Click on "Add".
- 3.3) Set the new zlib configuration name to the name used by
- the configuration from the current iteration.
-
-4) Select "Build | Set Active Configuration".
- Choose the configuration you wish to build.
-
-5) Select "Build | Build ... (F7)".
-
-6) If you built an executable program, select
- "Build | Execute ... (Ctrl+F5)".
-
-
-Note:
-
-To build the ASM-enabled code, you need Microsoft Assembler
-(ML.EXE). You can get it by downloading and installing the
-latest Processor Pack for Visual C++ 6.0.
diff --git a/funtools/util/zlib-1.2.3/projects/visualc6/example.dsp b/funtools/util/zlib-1.2.3/projects/visualc6/example.dsp
deleted file mode 100644
index e072a37..0000000
--- a/funtools/util/zlib-1.2.3/projects/visualc6/example.dsp
+++ /dev/null
@@ -1,278 +0,0 @@
-# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=example - Win32 LIB Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "example.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 LIB Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "example - Win32 DLL Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 DLL Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 DLL ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 DLL ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 LIB Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 LIB Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 LIB ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "example - Win32 LIB ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "example - Win32 DLL Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "example___Win32_DLL_Release"
-# PROP BASE Intermediate_Dir "example___Win32_DLL_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_DLL_Release"
-# PROP Intermediate_Dir "Win32_DLL_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "example - Win32 DLL Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "example___Win32_DLL_Debug"
-# PROP BASE Intermediate_Dir "example___Win32_DLL_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_DLL_Debug"
-# PROP Intermediate_Dir "Win32_DLL_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "example - Win32 DLL ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "example___Win32_DLL_ASM_Release"
-# PROP BASE Intermediate_Dir "example___Win32_DLL_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_DLL_ASM_Release"
-# PROP Intermediate_Dir "Win32_DLL_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "example - Win32 DLL ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "example___Win32_DLL_ASM_Debug"
-# PROP BASE Intermediate_Dir "example___Win32_DLL_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_DLL_ASM_Debug"
-# PROP Intermediate_Dir "Win32_DLL_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "example - Win32 LIB Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "example___Win32_LIB_Release"
-# PROP BASE Intermediate_Dir "example___Win32_LIB_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_LIB_Release"
-# PROP Intermediate_Dir "Win32_LIB_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "example - Win32 LIB Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "example___Win32_LIB_Debug"
-# PROP BASE Intermediate_Dir "example___Win32_LIB_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_LIB_Debug"
-# PROP Intermediate_Dir "Win32_LIB_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "example - Win32 LIB ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "example___Win32_LIB_ASM_Release"
-# PROP BASE Intermediate_Dir "example___Win32_LIB_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_LIB_ASM_Release"
-# PROP Intermediate_Dir "Win32_LIB_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "example - Win32 LIB ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "example___Win32_LIB_ASM_Debug"
-# PROP BASE Intermediate_Dir "example___Win32_LIB_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_LIB_ASM_Debug"
-# PROP Intermediate_Dir "Win32_LIB_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "example - Win32 DLL Release"
-# Name "example - Win32 DLL Debug"
-# Name "example - Win32 DLL ASM Release"
-# Name "example - Win32 DLL ASM Debug"
-# Name "example - Win32 LIB Release"
-# Name "example - Win32 LIB Debug"
-# Name "example - Win32 LIB ASM Release"
-# Name "example - Win32 LIB ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\example.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\zconf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zlib.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/funtools/util/zlib-1.2.3/projects/visualc6/minigzip.dsp b/funtools/util/zlib-1.2.3/projects/visualc6/minigzip.dsp
deleted file mode 100644
index f32024e..0000000
--- a/funtools/util/zlib-1.2.3/projects/visualc6/minigzip.dsp
+++ /dev/null
@@ -1,278 +0,0 @@
-# Microsoft Developer Studio Project File - Name="minigzip" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=minigzip - Win32 LIB Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "minigzip.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "minigzip.mak" CFG="minigzip - Win32 LIB Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "minigzip - Win32 DLL Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 DLL Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 DLL ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 DLL ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 LIB Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 LIB Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 LIB ASM Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "minigzip - Win32 LIB ASM Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "minigzip - Win32 DLL Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "minigzip___Win32_DLL_Release"
-# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_DLL_Release"
-# PROP Intermediate_Dir "Win32_DLL_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 DLL Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "minigzip___Win32_DLL_Debug"
-# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_DLL_Debug"
-# PROP Intermediate_Dir "Win32_DLL_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "minigzip___Win32_DLL_ASM_Release"
-# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_DLL_ASM_Release"
-# PROP Intermediate_Dir "Win32_DLL_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "minigzip___Win32_DLL_ASM_Debug"
-# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_DLL_ASM_Debug"
-# PROP Intermediate_Dir "Win32_DLL_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 LIB Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "minigzip___Win32_LIB_Release"
-# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_LIB_Release"
-# PROP Intermediate_Dir "Win32_LIB_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 LIB Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "minigzip___Win32_LIB_Debug"
-# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_LIB_Debug"
-# PROP Intermediate_Dir "Win32_LIB_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "minigzip___Win32_LIB_ASM_Release"
-# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_LIB_ASM_Release"
-# PROP Intermediate_Dir "Win32_LIB_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "minigzip___Win32_LIB_ASM_Debug"
-# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_LIB_ASM_Debug"
-# PROP Intermediate_Dir "Win32_LIB_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "minigzip - Win32 DLL Release"
-# Name "minigzip - Win32 DLL Debug"
-# Name "minigzip - Win32 DLL ASM Release"
-# Name "minigzip - Win32 DLL ASM Debug"
-# Name "minigzip - Win32 LIB Release"
-# Name "minigzip - Win32 LIB Debug"
-# Name "minigzip - Win32 LIB ASM Release"
-# Name "minigzip - Win32 LIB ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\minigzip.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\zconf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zlib.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsp b/funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsp
deleted file mode 100644
index 0fe0604..0000000
--- a/funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsp
+++ /dev/null
@@ -1,609 +0,0 @@
-# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=zlib - Win32 LIB Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 LIB Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zlib - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 DLL ASM Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 DLL ASM Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 LIB Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "zlib - Win32 LIB Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "zlib - Win32 LIB ASM Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "zlib - Win32 LIB ASM Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-
-!IF "$(CFG)" == "zlib - Win32 DLL Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "zlib___Win32_DLL_Release"
-# PROP BASE Intermediate_Dir "zlib___Win32_DLL_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_DLL_Release"
-# PROP Intermediate_Dir "Win32_DLL_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-MTL=midl.exe
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 /nologo /dll /machine:I386 /out:"Win32_DLL_Release\zlib1.dll"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "zlib___Win32_DLL_Debug"
-# PROP BASE Intermediate_Dir "zlib___Win32_DLL_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_DLL_Debug"
-# PROP Intermediate_Dir "Win32_DLL_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-MTL=midl.exe
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\zlib1d.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "zlib___Win32_DLL_ASM_Release"
-# PROP BASE Intermediate_Dir "zlib___Win32_DLL_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_DLL_ASM_Release"
-# PROP Intermediate_Dir "Win32_DLL_ASM_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "ASMV" /D "ASMINF" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-MTL=midl.exe
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 /nologo /dll /machine:I386 /out:"Win32_DLL_ASM_Release\zlib1.dll"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "zlib___Win32_DLL_ASM_Debug"
-# PROP BASE Intermediate_Dir "zlib___Win32_DLL_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_DLL_ASM_Debug"
-# PROP Intermediate_Dir "Win32_DLL_ASM_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "ASMV" /D "ASMINF" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-MTL=midl.exe
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Win32_DLL_ASM_Debug\zlib1d.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "zlib___Win32_LIB_Release"
-# PROP BASE Intermediate_Dir "zlib___Win32_LIB_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_LIB_Release"
-# PROP Intermediate_Dir "Win32_LIB_Release"
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "zlib___Win32_LIB_Debug"
-# PROP BASE Intermediate_Dir "zlib___Win32_LIB_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_LIB_Debug"
-# PROP Intermediate_Dir "Win32_LIB_Debug"
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"Win32_LIB_Debug\zlibd.lib"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "zlib___Win32_LIB_ASM_Release"
-# PROP BASE Intermediate_Dir "zlib___Win32_LIB_ASM_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Win32_LIB_ASM_Release"
-# PROP Intermediate_Dir "Win32_LIB_ASM_Release"
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "ASMV" /D "ASMINF" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "zlib___Win32_LIB_ASM_Debug"
-# PROP BASE Intermediate_Dir "zlib___Win32_LIB_ASM_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Win32_LIB_ASM_Debug"
-# PROP Intermediate_Dir "Win32_LIB_ASM_Debug"
-# PROP Target_Dir ""
-CPP=cl.exe
-# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "ASMV" /D "ASMINF" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-RSC=rc.exe
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"Win32_LIB_ASM_Debug\zlibd.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "zlib - Win32 DLL Release"
-# Name "zlib - Win32 DLL Debug"
-# Name "zlib - Win32 DLL ASM Release"
-# Name "zlib - Win32 DLL ASM Debug"
-# Name "zlib - Win32 LIB Release"
-# Name "zlib - Win32 LIB Debug"
-# Name "zlib - Win32 LIB ASM Release"
-# Name "zlib - Win32 LIB ASM Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\adler32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\compress.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\deflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gzio.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\infback.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inffast.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inftrees.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\trees.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\uncompr.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\zlib.def
-
-!IF "$(CFG)" == "zlib - Win32 DLL Release"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\crc32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\deflate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inffast.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inffixed.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inflate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\inftrees.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\trees.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zconf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zlib.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\zutil.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=..\..\win32\zlib1.rc
-# End Source File
-# End Group
-# Begin Group "Assembler Files (Unsupported)"
-
-# PROP Default_Filter "asm;obj;c;cpp;cxx;h;hpp;hxx"
-# Begin Source File
-
-SOURCE=..\..\contrib\masmx86\gvmat32.asm
-
-!IF "$(CFG)" == "zlib - Win32 DLL Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_DLL_ASM_Release
-InputPath=..\..\contrib\masmx86\gvmat32.asm
-InputName=gvmat32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_DLL_ASM_Debug
-InputPath=..\..\contrib\masmx86\gvmat32.asm
-InputName=gvmat32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_LIB_ASM_Release
-InputPath=..\..\contrib\masmx86\gvmat32.asm
-InputName=gvmat32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_LIB_ASM_Debug
-InputPath=..\..\contrib\masmx86\gvmat32.asm
-InputName=gvmat32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\contrib\masmx86\gvmat32c.c
-
-!IF "$(CFG)" == "zlib - Win32 DLL Release"
-
-# PROP Exclude_From_Build 1
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
-
-# PROP Exclude_From_Build 1
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
-
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
-
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
-
-# PROP Exclude_From_Build 1
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
-
-# PROP Exclude_From_Build 1
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
-
-# ADD CPP /I "..\.."
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
-
-# ADD CPP /I "..\.."
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\contrib\masmx86\inffas32.asm
-
-!IF "$(CFG)" == "zlib - Win32 DLL Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_DLL_ASM_Release
-InputPath=..\..\contrib\masmx86\inffas32.asm
-InputName=inffas32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_DLL_ASM_Debug
-InputPath=..\..\contrib\masmx86\inffas32.asm
-InputName=inffas32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_LIB_ASM_Release
-InputPath=..\..\contrib\masmx86\inffas32.asm
-InputName=inffas32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug"
-
-# Begin Custom Build - Assembling...
-IntDir=.\Win32_LIB_ASM_Debug
-InputPath=..\..\contrib\masmx86\inffas32.asm
-InputName=inffas32
-
-"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)"
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README.txt
-# End Source File
-# End Target
-# End Project
diff --git a/funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsw b/funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsw
deleted file mode 100644
index 3a771fc..0000000
--- a/funtools/util/zlib-1.2.3/projects/visualc6/zlib.dsw
+++ /dev/null
@@ -1,59 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "example"=.\example.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name zlib
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "minigzip"=.\minigzip.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name zlib
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "zlib"=.\zlib.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/funtools/util/zlib-1.2.3/qnx/package.qpg b/funtools/util/zlib-1.2.3/qnx/package.qpg
deleted file mode 100644
index 8a4a47c..0000000
--- a/funtools/util/zlib-1.2.3/qnx/package.qpg
+++ /dev/null
@@ -1,141 +0,0 @@
-<QPG:Generation>
- <QPG:Options>
- <QPG:User unattended="no" verbosity="2" listfiles="yes"/>
- <QPG:Defaults type="qnx_package"/>
- <QPG:Source></QPG:Source>
- <QPG:Release number="+"/>
- <QPG:Build></QPG:Build>
- <QPG:FileSorting strip="yes"/>
- <QPG:Package targets="combine"/>
- <QPG:Repository generate="yes"/>
- <QPG:FinalDir></QPG:FinalDir>
- <QPG:Cleanup></QPG:Cleanup>
- </QPG:Options>
-
- <QPG:Responsible>
- <QPG:Company></QPG:Company>
- <QPG:Department></QPG:Department>
- <QPG:Group></QPG:Group>
- <QPG:Team></QPG:Team>
- <QPG:Employee></QPG:Employee>
- <QPG:EmailAddress></QPG:EmailAddress>
- </QPG:Responsible>
-
- <QPG:Values>
- <QPG:Files>
- <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
- <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
- <QPG:Add file="../libz.so.1.2.3" install="/opt/lib/" user="root:bin" permission="644"/>
- <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.3"/>
- <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3"/>
- <QPG:Add file="../libz.so.1.2.3" install="/opt/lib/" component="slib"/>
- </QPG:Files>
-
- <QPG:PackageFilter>
- <QPM:PackageManifest>
- <QPM:PackageDescription>
- <QPM:PackageType>Library</QPM:PackageType>
- <QPM:PackageReleaseNotes></QPM:PackageReleaseNotes>
- <QPM:PackageReleaseUrgency>Medium</QPM:PackageReleaseUrgency>
- <QPM:PackageRepository></QPM:PackageRepository>
- <QPM:FileVersion>2.0</QPM:FileVersion>
- </QPM:PackageDescription>
-
- <QPM:ProductDescription>
- <QPM:ProductName>zlib</QPM:ProductName>
- <QPM:ProductIdentifier>zlib</QPM:ProductIdentifier>
- <QPM:ProductEmail>alain.bonnefoy@icbt.com</QPM:ProductEmail>
- <QPM:VendorName>Public</QPM:VendorName>
- <QPM:VendorInstallName>public</QPM:VendorInstallName>
- <QPM:VendorURL>www.gzip.org/zlib</QPM:VendorURL>
- <QPM:VendorEmbedURL></QPM:VendorEmbedURL>
- <QPM:VendorEmail></QPM:VendorEmail>
- <QPM:AuthorName>Jean-Loup Gailly,Mark Adler</QPM:AuthorName>
- <QPM:AuthorURL>www.gzip.org/zlib</QPM:AuthorURL>
- <QPM:AuthorEmbedURL></QPM:AuthorEmbedURL>
- <QPM:AuthorEmail>zlib@gzip.org</QPM:AuthorEmail>
- <QPM:ProductIconSmall></QPM:ProductIconSmall>
- <QPM:ProductIconLarge></QPM:ProductIconLarge>
- <QPM:ProductDescriptionShort>A massively spiffy yet delicately unobtrusive compression library.</QPM:ProductDescriptionShort>
- <QPM:ProductDescriptionLong>zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system.</QPM:ProductDescriptionLong>
- <QPM:ProductDescriptionURL>http://www.gzip.org/zlib</QPM:ProductDescriptionURL>
- <QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL>
- </QPM:ProductDescription>
-
- <QPM:ReleaseDescription>
- <QPM:ReleaseVersion>1.2.3</QPM:ReleaseVersion>
- <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
- <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
- <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
- <QPM:ReleaseNoteMajor></QPM:ReleaseNoteMajor>
- <QPM:ExcludeCountries>
- <QPM:Country></QPM:Country>
- </QPM:ExcludeCountries>
-
- <QPM:ReleaseCopyright>No License</QPM:ReleaseCopyright>
- </QPM:ReleaseDescription>
-
- <QPM:ContentDescription>
- <QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
- <QPM:ContentKeyword>zlib,compression</QPM:ContentKeyword>
- <QPM:TargetOS>qnx6</QPM:TargetOS>
- <QPM:HostOS>qnx6</QPM:HostOS>
- <QPM:DisplayEnvironment xmlmultiple="true">None</QPM:DisplayEnvironment>
- <QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
- </QPM:ContentDescription>
- </QPM:PackageManifest>
- </QPG:PackageFilter>
-
- <QPG:PackageFilter proc="none" target="none">
- <QPM:PackageManifest>
- <QPM:ProductInstallationDependencies>
- <QPM:ProductRequirements></QPM:ProductRequirements>
- </QPM:ProductInstallationDependencies>
-
- <QPM:ProductInstallationProcedure>
- <QPM:Script xmlmultiple="true">
- <QPM:ScriptName></QPM:ScriptName>
- <QPM:ScriptType>Install</QPM:ScriptType>
- <QPM:ScriptTiming>Post</QPM:ScriptTiming>
- <QPM:ScriptBlocking>No</QPM:ScriptBlocking>
- <QPM:ScriptResult>Ignore</QPM:ScriptResult>
- <QPM:ShortDescription></QPM:ShortDescription>
- <QPM:UseBinaries>No</QPM:UseBinaries>
- <QPM:Priority>Optional</QPM:Priority>
- </QPM:Script>
- </QPM:ProductInstallationProcedure>
- </QPM:PackageManifest>
-
- <QPM:Launch>
- </QPM:Launch>
- </QPG:PackageFilter>
-
- <QPG:PackageFilter type="core" component="none">
- <QPM:PackageManifest>
- <QPM:ProductInstallationProcedure>
- <QPM:OrderDependency xmlmultiple="true">
- <QPM:Order>InstallOver</QPM:Order>
- <QPM:Product>zlib</QPM:Product>
- </QPM:OrderDependency>
- </QPM:ProductInstallationProcedure>
- </QPM:PackageManifest>
-
- <QPM:Launch>
- </QPM:Launch>
- </QPG:PackageFilter>
-
- <QPG:PackageFilter type="core" component="dev">
- <QPM:PackageManifest>
- <QPM:ProductInstallationProcedure>
- <QPM:OrderDependency xmlmultiple="true">
- <QPM:Order>InstallOver</QPM:Order>
- <QPM:Product>zlib-dev</QPM:Product>
- </QPM:OrderDependency>
- </QPM:ProductInstallationProcedure>
- </QPM:PackageManifest>
-
- <QPM:Launch>
- </QPM:Launch>
- </QPG:PackageFilter>
- </QPG:Values>
-</QPG:Generation>
diff --git a/funtools/util/zlib-1.2.3/trees.c b/funtools/util/zlib-1.2.3/trees.c
deleted file mode 100644
index 395e4e1..0000000
--- a/funtools/util/zlib-1.2.3/trees.c
+++ /dev/null
@@ -1,1219 +0,0 @@
-/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2005 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process uses several Huffman trees. The more
- * common source values are represented by shorter bit sequences.
- *
- * Each code tree is stored in a compressed form which is itself
- * a Huffman encoding of the lengths of all the code strings (in
- * ascending order by source values). The actual code strings are
- * reconstructed from the lengths in the inflate process, as described
- * in the deflate specification.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
- * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
- *
- * Storer, James A.
- * Data Compression: Methods and Theory, pp. 49-50.
- * Computer Science Press, 1988. ISBN 0-7167-8156-5.
- *
- * Sedgewick, R.
- * Algorithms, p290.
- * Addison-Wesley, 1983. ISBN 0-201-06672-6.
- */
-
-/* @(#) $Id$ */
-
-/* #define GEN_TREES_H */
-
-#include "deflate.h"
-
-#ifdef DEBUG
-# include <ctype.h>
-#endif
-
-/* ===========================================================================
- * Constants
- */
-
-#define MAX_BL_BITS 7
-/* Bit length codes must not exceed MAX_BL_BITS bits */
-
-#define END_BLOCK 256
-/* end of block literal code */
-
-#define REP_3_6 16
-/* repeat previous bit length 3-6 times (2 bits of repeat count) */
-
-#define REPZ_3_10 17
-/* repeat a zero length 3-10 times (3 bits of repeat count) */
-
-#define REPZ_11_138 18
-/* repeat a zero length 11-138 times (7 bits of repeat count) */
-
-local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
-
-local const int extra_dbits[D_CODES] /* extra bits for each distance code */
- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-
-local const uch bl_order[BL_CODES]
- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
-/* The lengths of the bit length codes are sent in order of decreasing
- * probability, to avoid transmitting the lengths for unused bit length codes.
- */
-
-#define Buf_size (8 * 2*sizeof(char))
-/* Number of bits used within bi_buf. (bi_buf might be implemented on
- * more than 16 bits on some systems.)
- */
-
-/* ===========================================================================
- * Local data. These are initialized only once.
- */
-
-#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
-/* non ANSI compilers may not accept trees.h */
-
-local ct_data static_ltree[L_CODES+2];
-/* The static literal tree. Since the bit lengths are imposed, there is no
- * need for the L_CODES extra codes used during heap construction. However
- * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
- * below).
- */
-
-local ct_data static_dtree[D_CODES];
-/* The static distance tree. (Actually a trivial tree since all codes use
- * 5 bits.)
- */
-
-uch _dist_code[DIST_CODE_LEN];
-/* Distance codes. The first 256 values correspond to the distances
- * 3 .. 258, the last 256 values correspond to the top 8 bits of
- * the 15 bit distances.
- */
-
-uch _length_code[MAX_MATCH-MIN_MATCH+1];
-/* length code for each normalized match length (0 == MIN_MATCH) */
-
-local int base_length[LENGTH_CODES];
-/* First normalized length for each code (0 = MIN_MATCH) */
-
-local int base_dist[D_CODES];
-/* First normalized distance for each code (0 = distance of 1) */
-
-#else
-# include "trees.h"
-#endif /* GEN_TREES_H */
-
-struct static_tree_desc_s {
- const ct_data *static_tree; /* static tree or NULL */
- const intf *extra_bits; /* extra bits for each code or NULL */
- int extra_base; /* base index for extra_bits */
- int elems; /* max number of elements in the tree */
- int max_length; /* max bit length for the codes */
-};
-
-local static_tree_desc static_l_desc =
-{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
-
-local static_tree_desc static_d_desc =
-{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
-
-local static_tree_desc static_bl_desc =
-{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
-
-/* ===========================================================================
- * Local (static) routines in this file.
- */
-
-local void tr_static_init OF((void));
-local void init_block OF((deflate_state *s));
-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
-local void build_tree OF((deflate_state *s, tree_desc *desc));
-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local int build_bl_tree OF((deflate_state *s));
-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
-local void compress_block OF((deflate_state *s, ct_data *ltree,
- ct_data *dtree));
-local void set_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned value, int length));
-local void bi_windup OF((deflate_state *s));
-local void bi_flush OF((deflate_state *s));
-local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
- int header));
-
-#ifdef GEN_TREES_H
-local void gen_trees_header OF((void));
-#endif
-
-#ifndef DEBUG
-# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
- /* Send a code of the given tree. c and tree must not have side effects */
-
-#else /* DEBUG */
-# define send_code(s, c, tree) \
- { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
- send_bits(s, tree[c].Code, tree[c].Len); }
-#endif
-
-/* ===========================================================================
- * Output a short LSB first on the stream.
- * IN assertion: there is enough room in pendingBuf.
- */
-#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
-}
-
-/* ===========================================================================
- * Send a value on a given number of bits.
- * IN assertion: length <= 16 and value fits in length bits.
- */
-#ifdef DEBUG
-local void send_bits OF((deflate_state *s, int value, int length));
-
-local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
-{
- Tracevv((stderr," l %2d v %4x ", length, value));
- Assert(length > 0 && length <= 15, "invalid length");
- s->bits_sent += (ulg)length;
-
- /* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
- * unused bits in value.
- */
- if (s->bi_valid > (int)Buf_size - length) {
- s->bi_buf |= (value << s->bi_valid);
- put_short(s, s->bi_buf);
- s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
- s->bi_valid += length - Buf_size;
- } else {
- s->bi_buf |= value << s->bi_valid;
- s->bi_valid += length;
- }
-}
-#else /* !DEBUG */
-
-#define send_bits(s, value, length) \
-{ int len = length;\
- if (s->bi_valid > (int)Buf_size - len) {\
- int val = value;\
- s->bi_buf |= (val << s->bi_valid);\
- put_short(s, s->bi_buf);\
- s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
- s->bi_valid += len - Buf_size;\
- } else {\
- s->bi_buf |= (value) << s->bi_valid;\
- s->bi_valid += len;\
- }\
-}
-#endif /* DEBUG */
-
-
-/* the arguments must not have side effects */
-
-/* ===========================================================================
- * Initialize the various 'constant' tables.
- */
-local void tr_static_init()
-{
-#if defined(GEN_TREES_H) || !defined(STDC)
- static int static_init_done = 0;
- int n; /* iterates over tree elements */
- int bits; /* bit counter */
- int length; /* length value */
- int code; /* code value */
- int dist; /* distance index */
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- if (static_init_done) return;
-
- /* For some embedded targets, global variables are not initialized: */
- static_l_desc.static_tree = static_ltree;
- static_l_desc.extra_bits = extra_lbits;
- static_d_desc.static_tree = static_dtree;
- static_d_desc.extra_bits = extra_dbits;
- static_bl_desc.extra_bits = extra_blbits;
-
- /* Initialize the mapping length (0..255) -> length code (0..28) */
- length = 0;
- for (code = 0; code < LENGTH_CODES-1; code++) {
- base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
- _length_code[length++] = (uch)code;
- }
- }
- Assert (length == 256, "tr_static_init: length != 256");
- /* Note that the length 255 (match length 258) can be represented
- * in two different ways: code 284 + 5 bits or code 285, so we
- * overwrite length_code[255] to use the best encoding:
- */
- _length_code[length-1] = (uch)code;
-
- /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
- dist = 0;
- for (code = 0 ; code < 16; code++) {
- base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
- _dist_code[dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: dist != 256");
- dist >>= 7; /* from now on, all distances are divided by 128 */
- for ( ; code < D_CODES; code++) {
- base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
- _dist_code[256 + dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
-
- /* Construct the codes of the static literal tree */
- for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
- n = 0;
- while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
- while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
- while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
- while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
- /* Codes 286 and 287 do not exist, but we must include them in the
- * tree construction to get a canonical Huffman tree (longest code
- * all ones)
- */
- gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
-
- /* The static distance tree is trivial: */
- for (n = 0; n < D_CODES; n++) {
- static_dtree[n].Len = 5;
- static_dtree[n].Code = bi_reverse((unsigned)n, 5);
- }
- static_init_done = 1;
-
-# ifdef GEN_TREES_H
- gen_trees_header();
-# endif
-#endif /* defined(GEN_TREES_H) || !defined(STDC) */
-}
-
-/* ===========================================================================
- * Genererate the file trees.h describing the static trees.
- */
-#ifdef GEN_TREES_H
-# ifndef DEBUG
-# include <stdio.h>
-# endif
-
-# define SEPARATOR(i, last, width) \
- ((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
-
-void gen_trees_header()
-{
- FILE *header = fopen("trees.h", "w");
- int i;
-
- Assert (header != NULL, "Can't open trees.h");
- fprintf(header,
- "/* header created automatically with -DGEN_TREES_H */\n\n");
-
- fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
- for (i = 0; i < L_CODES+2; i++) {
- fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
- static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
- }
-
- fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
- static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
- }
-
- fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
- for (i = 0; i < DIST_CODE_LEN; i++) {
- fprintf(header, "%2u%s", _dist_code[i],
- SEPARATOR(i, DIST_CODE_LEN-1, 20));
- }
-
- fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
- for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
- fprintf(header, "%2u%s", _length_code[i],
- SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
- }
-
- fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
- for (i = 0; i < LENGTH_CODES; i++) {
- fprintf(header, "%1u%s", base_length[i],
- SEPARATOR(i, LENGTH_CODES-1, 20));
- }
-
- fprintf(header, "local const int base_dist[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "%5u%s", base_dist[i],
- SEPARATOR(i, D_CODES-1, 10));
- }
-
- fclose(header);
-}
-#endif /* GEN_TREES_H */
-
-/* ===========================================================================
- * Initialize the tree data structures for a new zlib stream.
- */
-void _tr_init(s)
- deflate_state *s;
-{
- tr_static_init();
-
- s->l_desc.dyn_tree = s->dyn_ltree;
- s->l_desc.stat_desc = &static_l_desc;
-
- s->d_desc.dyn_tree = s->dyn_dtree;
- s->d_desc.stat_desc = &static_d_desc;
-
- s->bl_desc.dyn_tree = s->bl_tree;
- s->bl_desc.stat_desc = &static_bl_desc;
-
- s->bi_buf = 0;
- s->bi_valid = 0;
- s->last_eob_len = 8; /* enough lookahead for inflate */
-#ifdef DEBUG
- s->compressed_len = 0L;
- s->bits_sent = 0L;
-#endif
-
- /* Initialize the first block of the first file: */
- init_block(s);
-}
-
-/* ===========================================================================
- * Initialize a new block.
- */
-local void init_block(s)
- deflate_state *s;
-{
- int n; /* iterates over tree elements */
-
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
-
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->last_lit = s->matches = 0;
-}
-
-#define SMALLEST 1
-/* Index within the heap array of least frequent node in the Huffman tree */
-
-
-/* ===========================================================================
- * Remove the smallest element from the heap and recreate the heap with
- * one less element. Updates heap and heap_len.
- */
-#define pqremove(s, tree, top) \
-{\
- top = s->heap[SMALLEST]; \
- s->heap[SMALLEST] = s->heap[s->heap_len--]; \
- pqdownheap(s, tree, SMALLEST); \
-}
-
-/* ===========================================================================
- * Compares to subtrees, using the tree depth as tie breaker when
- * the subtrees have equal frequency. This minimizes the worst case length.
- */
-#define smaller(tree, n, m, depth) \
- (tree[n].Freq < tree[m].Freq || \
- (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
-
-/* ===========================================================================
- * Restore the heap property by moving down the tree starting at node k,
- * exchanging a node with the smallest of its two sons if necessary, stopping
- * when the heap property is re-established (each father smaller than its
- * two sons).
- */
-local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
-{
- int v = s->heap[k];
- int j = k << 1; /* left son of k */
- while (j <= s->heap_len) {
- /* Set j to the smallest of the two sons: */
- if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
- j++;
- }
- /* Exit if v is smaller than both sons */
- if (smaller(tree, v, s->heap[j], s->depth)) break;
-
- /* Exchange v with the smallest son */
- s->heap[k] = s->heap[j]; k = j;
-
- /* And continue down the tree, setting j to the left son of k */
- j <<= 1;
- }
- s->heap[k] = v;
-}
-
-/* ===========================================================================
- * Compute the optimal bit lengths for a tree and update the total bit length
- * for the current block.
- * IN assertion: the fields freq and dad are set, heap[heap_max] and
- * above are the tree nodes sorted by increasing frequency.
- * OUT assertions: the field len is set to the optimal bit length, the
- * array bl_count contains the frequencies for each bit length.
- * The length opt_len is updated; static_len is also updated if stree is
- * not null.
- */
-local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- int max_code = desc->max_code;
- const ct_data *stree = desc->stat_desc->static_tree;
- const intf *extra = desc->stat_desc->extra_bits;
- int base = desc->stat_desc->extra_base;
- int max_length = desc->stat_desc->max_length;
- int h; /* heap index */
- int n, m; /* iterate over the tree elements */
- int bits; /* bit length */
- int xbits; /* extra bits */
- ush f; /* frequency */
- int overflow = 0; /* number of elements with bit length too large */
-
- for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
-
- /* In a first pass, compute the optimal bit lengths (which may
- * overflow in the case of the bit length tree).
- */
- tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
-
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
- n = s->heap[h];
- bits = tree[tree[n].Dad].Len + 1;
- if (bits > max_length) bits = max_length, overflow++;
- tree[n].Len = (ush)bits;
- /* We overwrite tree[n].Dad which is no longer needed */
-
- if (n > max_code) continue; /* not a leaf node */
-
- s->bl_count[bits]++;
- xbits = 0;
- if (n >= base) xbits = extra[n-base];
- f = tree[n].Freq;
- s->opt_len += (ulg)f * (bits + xbits);
- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
- }
- if (overflow == 0) return;
-
- Trace((stderr,"\nbit length overflow\n"));
- /* This happens for example on obj2 and pic of the Calgary corpus */
-
- /* Find the first bit length which could increase: */
- do {
- bits = max_length-1;
- while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
- s->bl_count[max_length]--;
- /* The brother of the overflow item also moves one step up,
- * but this does not affect bl_count[max_length]
- */
- overflow -= 2;
- } while (overflow > 0);
-
- /* Now recompute all bit lengths, scanning in increasing frequency.
- * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
- * lengths instead of fixing only the wrong ones. This idea is taken
- * from 'ar' written by Haruhiko Okumura.)
- */
- for (bits = max_length; bits != 0; bits--) {
- n = s->bl_count[bits];
- while (n != 0) {
- m = s->heap[--h];
- if (m > max_code) continue;
- if ((unsigned) tree[m].Len != (unsigned) bits) {
- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
- s->opt_len += ((long)bits - (long)tree[m].Len)
- *(long)tree[m].Freq;
- tree[m].Len = (ush)bits;
- }
- n--;
- }
- }
-}
-
-/* ===========================================================================
- * Generate the codes for a given tree and bit counts (which need not be
- * optimal).
- * IN assertion: the array bl_count contains the bit length statistics for
- * the given tree and the field len is set for all tree elements.
- * OUT assertion: the field code is set for all tree elements of non
- * zero code length.
- */
-local void gen_codes (tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
-{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- ush code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
- }
-}
-
-/* ===========================================================================
- * Construct one Huffman tree and assigns the code bit strings and lengths.
- * Update the total bit length for the current block.
- * IN assertion: the field freq is set for all tree elements.
- * OUT assertions: the fields len and code are set to the optimal bit length
- * and corresponding code. The length opt_len is updated; static_len is
- * also updated if stree is not null. The field max_code is set.
- */
-local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- const ct_data *stree = desc->stat_desc->static_tree;
- int elems = desc->stat_desc->elems;
- int n, m; /* iterate over heap elements */
- int max_code = -1; /* largest code with non zero frequency */
- int node; /* new node being created */
-
- /* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
- * heap[0] is not used.
- */
- s->heap_len = 0, s->heap_max = HEAP_SIZE;
-
- for (n = 0; n < elems; n++) {
- if (tree[n].Freq != 0) {
- s->heap[++(s->heap_len)] = max_code = n;
- s->depth[n] = 0;
- } else {
- tree[n].Len = 0;
- }
- }
-
- /* The pkzip format requires that at least one distance code exists,
- * and that at least one bit should be sent even if there is only one
- * possible code. So to avoid special checks later on we force at least
- * two codes of non zero frequency.
- */
- while (s->heap_len < 2) {
- node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
- tree[node].Freq = 1;
- s->depth[node] = 0;
- s->opt_len--; if (stree) s->static_len -= stree[node].Len;
- /* node is 0 or 1 so it does not have extra bits */
- }
- desc->max_code = max_code;
-
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
- * establish sub-heaps of increasing lengths:
- */
- for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
-
- /* Construct the Huffman tree by repeatedly combining the least two
- * frequent nodes.
- */
- node = elems; /* next internal node of the tree */
- do {
- pqremove(s, tree, n); /* n = node of least frequency */
- m = s->heap[SMALLEST]; /* m = node of next least frequency */
-
- s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
- s->heap[--(s->heap_max)] = m;
-
- /* Create a new node father of n and m */
- tree[node].Freq = tree[n].Freq + tree[m].Freq;
- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
- s->depth[n] : s->depth[m]) + 1);
- tree[n].Dad = tree[m].Dad = (ush)node;
-#ifdef DUMP_BL_TREE
- if (tree == s->bl_tree) {
- fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
- node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
- }
-#endif
- /* and insert the new node in the heap */
- s->heap[SMALLEST] = node++;
- pqdownheap(s, tree, SMALLEST);
-
- } while (s->heap_len >= 2);
-
- s->heap[--(s->heap_max)] = s->heap[SMALLEST];
-
- /* At this point, the fields freq and dad are set. We can now
- * generate the bit lengths.
- */
- gen_bitlen(s, (tree_desc *)desc);
-
- /* The field len is now set, we can generate the bit codes */
- gen_codes ((ct_data *)tree, max_code, s->bl_count);
-}
-
-/* ===========================================================================
- * Scan a literal or distance tree to determine the frequencies of the codes
- * in the bit length tree.
- */
-local void scan_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- s->bl_tree[curlen].Freq += count;
- } else if (curlen != 0) {
- if (curlen != prevlen) s->bl_tree[curlen].Freq++;
- s->bl_tree[REP_3_6].Freq++;
- } else if (count <= 10) {
- s->bl_tree[REPZ_3_10].Freq++;
- } else {
- s->bl_tree[REPZ_11_138].Freq++;
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Send a literal or distance tree in compressed form, using the codes in
- * bl_tree.
- */
-local void send_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- /* tree[max_code+1].Len = -1; */ /* guard already set */
- if (nextlen == 0) max_count = 138, min_count = 3;
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
-
- } else if (curlen != 0) {
- if (curlen != prevlen) {
- send_code(s, curlen, s->bl_tree); count--;
- }
- Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
-
- } else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
-
- } else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Construct the Huffman tree for the bit lengths and return the index in
- * bl_order of the last bit length code to send.
- */
-local int build_bl_tree(s)
- deflate_state *s;
-{
- int max_blindex; /* index of last bit length code of non zero freq */
-
- /* Determine the bit length frequencies for literal and distance trees */
- scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
- scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
-
- /* Build the bit length tree: */
- build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
- */
-
- /* Determine the number of bit length codes to send. The pkzip format
- * requires that at least 4 bit length codes be sent. (appnote.txt says
- * 3 but the actual value used is 4.)
- */
- for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
- if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
- }
- /* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*(max_blindex+1) + 5+5+4;
- Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
- s->opt_len, s->static_len));
-
- return max_blindex;
-}
-
-/* ===========================================================================
- * Send the header for a block using dynamic Huffman trees: the counts, the
- * lengths of the bit length codes, the literal tree and the distance tree.
- * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
- */
-local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
-{
- int rank; /* index in bl_order */
-
- Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
- Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
- "too many codes");
- Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
- for (rank = 0; rank < blcodes; rank++) {
- Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
- send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
- }
- Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
- Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
- Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
-}
-
-/* ===========================================================================
- * Send a stored block
- */
-void _tr_stored_block(s, buf, stored_len, eof)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int eof; /* true if this is the last block for a file */
-{
- send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
-#ifdef DEBUG
- s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
- s->compressed_len += (stored_len + 4) << 3;
-#endif
- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
-}
-
-/* ===========================================================================
- * Send one empty static block to give enough lookahead for inflate.
- * This takes 10 bits, of which 7 may remain in the bit buffer.
- * The current inflate code requires 9 bits of lookahead. If the
- * last two codes for the previous block (real code plus EOB) were coded
- * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
- * the last real code. In this case we send two empty static blocks instead
- * of one. (There are no problems if the previous block is stored or fixed.)
- * To simplify the code, we assume the worst case of last real code encoded
- * on one bit only.
- */
-void _tr_align(s)
- deflate_state *s;
-{
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
-#endif
- bi_flush(s);
- /* Of the 10 bits for the empty block, we have already sent
- * (10 - bi_valid) bits. The lookahead for the last real code (before
- * the EOB of the previous block) was thus at least one plus the length
- * of the EOB plus what we have just sent of the empty static block.
- */
- if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L;
-#endif
- bi_flush(s);
- }
- s->last_eob_len = 7;
-}
-
-/* ===========================================================================
- * Determine the best encoding for the current block: dynamic trees, static
- * trees or store, and output the encoded block to the zip file.
- */
-void _tr_flush_block(s, buf, stored_len, eof)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int eof; /* true if this is the last block for a file */
-{
- ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
- int max_blindex = 0; /* index of last bit length code of non zero freq */
-
- /* Build the Huffman trees unless a stored block is forced */
- if (s->level > 0) {
-
- /* Check if the file is binary or text */
- if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN)
- set_data_type(s);
-
- /* Construct the literal and distance trees */
- build_tree(s, (tree_desc *)(&(s->l_desc)));
- Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
-
- build_tree(s, (tree_desc *)(&(s->d_desc)));
- Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
- /* At this point, opt_len and static_len are the total bit lengths of
- * the compressed block data, excluding the tree representations.
- */
-
- /* Build the bit length tree for the above two trees, and get the index
- * in bl_order of the last bit length code to send.
- */
- max_blindex = build_bl_tree(s);
-
- /* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
-
- Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
- opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
- s->last_lit));
-
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
-
- } else {
- Assert(buf != (char*)0, "lost buf");
- opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
- }
-
-#ifdef FORCE_STORED
- if (buf != (char*)0) { /* force stored block */
-#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
- /* 4: two words for the lengths */
-#endif
- /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
- * Otherwise we can't have processed more than WSIZE input bytes since
- * the last block flush, because compression would have been
- * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
- * transform a block into a stored block.
- */
- _tr_stored_block(s, buf, stored_len, eof);
-
-#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
-#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
-#endif
- send_bits(s, (STATIC_TREES<<1)+eof, 3);
- compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->static_len;
-#endif
- } else {
- send_bits(s, (DYN_TREES<<1)+eof, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
- compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->opt_len;
-#endif
- }
- Assert (s->compressed_len == s->bits_sent, "bad compressed size");
- /* The above check is made mod 2^32, for files larger than 512 MB
- * and uLong implemented on 32 bits.
- */
- init_block(s);
-
- if (eof) {
- bi_windup(s);
-#ifdef DEBUG
- s->compressed_len += 7; /* align on byte boundary */
-#endif
- }
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*eof));
-}
-
-/* ===========================================================================
- * Save the match info and tally the frequency counts. Return true if
- * the current block must be flushed.
- */
-int _tr_tally (s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
-{
- s->d_buf[s->last_lit] = (ush)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
- if (dist == 0) {
- /* lc is the unmatched char */
- s->dyn_ltree[lc].Freq++;
- } else {
- s->matches++;
- /* Here, lc is the match length - MIN_MATCH */
- dist--; /* dist = match distance - 1 */
- Assert((ush)dist < (ush)MAX_DIST(s) &&
- (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
- (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
-
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
- s->dyn_dtree[d_code(dist)].Freq++;
- }
-
-#ifdef TRUNCATE_BLOCK
- /* Try to guess if it is profitable to stop the current block here */
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
- /* Compute an upper bound for the compressed length */
- ulg out_length = (ulg)s->last_lit*8L;
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
- int dcode;
- for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
- (5L+extra_dbits[dcode]);
- }
- out_length >>= 3;
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
- s->last_lit, in_length, out_length,
- 100L - out_length*100L/in_length));
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
- }
-#endif
- return (s->last_lit == s->lit_bufsize-1);
- /* We avoid equality with lit_bufsize because of wraparound at 64K
- * on 16 bit machines and because stored blocks are restricted to
- * 64K-1 bytes.
- */
-}
-
-/* ===========================================================================
- * Send the block data compressed using the given Huffman trees
- */
-local void compress_block(s, ltree, dtree)
- deflate_state *s;
- ct_data *ltree; /* literal tree */
- ct_data *dtree; /* distance tree */
-{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned lx = 0; /* running index in l_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->last_lit != 0) do {
- dist = s->d_buf[lx];
- lc = s->l_buf[lx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
- "pendingBuf overflow");
-
- } while (lx < s->last_lit);
-
- send_code(s, END_BLOCK, ltree);
- s->last_eob_len = ltree[END_BLOCK].Len;
-}
-
-/* ===========================================================================
- * Set the data type to BINARY or TEXT, using a crude approximation:
- * set it to Z_TEXT if all symbols are either printable characters (33 to 255)
- * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise.
- * IN assertion: the fields Freq of dyn_ltree are set.
- */
-local void set_data_type(s)
- deflate_state *s;
-{
- int n;
-
- for (n = 0; n < 9; n++)
- if (s->dyn_ltree[n].Freq != 0)
- break;
- if (n == 9)
- for (n = 14; n < 32; n++)
- if (s->dyn_ltree[n].Freq != 0)
- break;
- s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY;
-}
-
-/* ===========================================================================
- * Reverse the first len bits of a code, using straightforward code (a faster
- * method would use a table)
- * IN assertion: 1 <= len <= 15
- */
-local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
-{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
-}
-
-/* ===========================================================================
- * Flush the bit buffer, keeping at most 7 bits in it.
- */
-local void bi_flush(s)
- deflate_state *s;
-{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
-}
-
-/* ===========================================================================
- * Flush the bit buffer and align the output on a byte boundary
- */
-local void bi_windup(s)
- deflate_state *s;
-{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
-#endif
-}
-
-/* ===========================================================================
- * Copy a stored block, storing first the length and its
- * one's complement if requested.
- */
-local void copy_block(s, buf, len, header)
- deflate_state *s;
- charf *buf; /* the input data */
- unsigned len; /* its length */
- int header; /* true if block header must be written */
-{
- bi_windup(s); /* align on byte boundary */
- s->last_eob_len = 8; /* enough lookahead for inflate */
-
- if (header) {
- put_short(s, (ush)len);
- put_short(s, (ush)~len);
-#ifdef DEBUG
- s->bits_sent += 2*16;
-#endif
- }
-#ifdef DEBUG
- s->bits_sent += (ulg)len<<3;
-#endif
- while (len--) {
- put_byte(s, *buf++);
- }
-}
diff --git a/funtools/util/zlib-1.2.3/trees.h b/funtools/util/zlib-1.2.3/trees.h
deleted file mode 100644
index 72facf9..0000000
--- a/funtools/util/zlib-1.2.3/trees.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* header created automatically with -DGEN_TREES_H */
-
-local const ct_data static_ltree[L_CODES+2] = {
-{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
-{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
-{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
-{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
-{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
-{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
-{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
-{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
-{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
-{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
-{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
-{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
-{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
-{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
-{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
-{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
-{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
-{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
-{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
-{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
-{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
-{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
-{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
-{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
-{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
-{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
-{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
-{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
-{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
-{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
-{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
-{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
-{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
-{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
-{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
-{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
-{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
-{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
-{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
-{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
-{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
-{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
-{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
-{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
-{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
-{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
-{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
-{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
-{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
-{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
-{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
-{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
-{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
-{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
-{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
-{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
-{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
-{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
-};
-
-local const ct_data static_dtree[D_CODES] = {
-{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
-{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
-{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
-{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
-{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
-{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
-};
-
-const uch _dist_code[DIST_CODE_LEN] = {
- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
-10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
-18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
-};
-
-const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
-13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
-17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
-19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
-22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
-};
-
-local const int base_length[LENGTH_CODES] = {
-0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
-64, 80, 96, 112, 128, 160, 192, 224, 0
-};
-
-local const int base_dist[D_CODES] = {
- 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
- 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
- 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
-};
-
diff --git a/funtools/util/zlib-1.2.3/uncompr.c b/funtools/util/zlib-1.2.3/uncompr.c
deleted file mode 100644
index b59e3d0..0000000
--- a/funtools/util/zlib-1.2.3/uncompr.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* uncompr.c -- decompress a memory buffer
- * Copyright (C) 1995-2003 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
diff --git a/funtools/util/zlib-1.2.3/win32/DLL_FAQ.txt b/funtools/util/zlib-1.2.3/win32/DLL_FAQ.txt
deleted file mode 100644
index fb18e07..0000000
--- a/funtools/util/zlib-1.2.3/win32/DLL_FAQ.txt
+++ /dev/null
@@ -1,397 +0,0 @@
-
- Frequently Asked Questions about ZLIB1.DLL
-
-
-This document describes the design, the rationale, and the usage
-of the official DLL build of zlib, named ZLIB1.DLL. If you have
-general questions about zlib, you should see the file "FAQ" found
-in the zlib distribution, or at the following location:
- http://www.gzip.org/zlib/zlib_faq.html
-
-
- 1. What is ZLIB1.DLL, and how can I get it?
-
- - ZLIB1.DLL is the official build of zlib as a DLL.
- (Please remark the character '1' in the name.)
-
- Pointers to a precompiled ZLIB1.DLL can be found in the zlib
- web site at:
- http://www.zlib.org/
-
- Applications that link to ZLIB1.DLL can rely on the following
- specification:
-
- * The exported symbols are exclusively defined in the source
- files "zlib.h" and "zlib.def", found in an official zlib
- source distribution.
- * The symbols are exported by name, not by ordinal.
- * The exported names are undecorated.
- * The calling convention of functions is "C" (CDECL).
- * The ZLIB1.DLL binary is linked to MSVCRT.DLL.
-
- The archive in which ZLIB1.DLL is bundled contains compiled
- test programs that must run with a valid build of ZLIB1.DLL.
- It is recommended to download the prebuilt DLL from the zlib
- web site, instead of building it yourself, to avoid potential
- incompatibilities that could be introduced by your compiler
- and build settings. If you do build the DLL yourself, please
- make sure that it complies with all the above requirements,
- and it runs with the precompiled test programs, bundled with
- the original ZLIB1.DLL distribution.
-
- If, for any reason, you need to build an incompatible DLL,
- please use a different file name.
-
-
- 2. Why did you change the name of the DLL to ZLIB1.DLL?
- What happened to the old ZLIB.DLL?
-
- - The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required
- compilation settings that were incompatible to those used by
- a static build. The DLL settings were supposed to be enabled
- by defining the macro ZLIB_DLL, before including "zlib.h".
- Incorrect handling of this macro was silently accepted at
- build time, resulting in two major problems:
-
- * ZLIB_DLL was missing from the old makefile. When building
- the DLL, not all people added it to the build options. In
- consequence, incompatible incarnations of ZLIB.DLL started
- to circulate around the net.
-
- * When switching from using the static library to using the
- DLL, applications had to define the ZLIB_DLL macro and
- to recompile all the sources that contained calls to zlib
- functions. Failure to do so resulted in creating binaries
- that were unable to run with the official ZLIB.DLL build.
-
- The only possible solution that we could foresee was to make
- a binary-incompatible change in the DLL interface, in order to
- remove the dependency on the ZLIB_DLL macro, and to release
- the new DLL under a different name.
-
- We chose the name ZLIB1.DLL, where '1' indicates the major
- zlib version number. We hope that we will not have to break
- the binary compatibility again, at least not as long as the
- zlib-1.x series will last.
-
- There is still a ZLIB_DLL macro, that can trigger a more
- efficient build and use of the DLL, but compatibility no
- longer dependents on it.
-
-
- 3. Can I build ZLIB.DLL from the new zlib sources, and replace
- an old ZLIB.DLL, that was built from zlib-1.1.4 or earlier?
-
- - In principle, you can do it by assigning calling convention
- keywords to the macros ZEXPORT and ZEXPORTVA. In practice,
- it depends on what you mean by "an old ZLIB.DLL", because the
- old DLL exists in several mutually-incompatible versions.
- You have to find out first what kind of calling convention is
- being used in your particular ZLIB.DLL build, and to use the
- same one in the new build. If you don't know what this is all
- about, you might be better off if you would just leave the old
- DLL intact.
-
-
- 4. Can I compile my application using the new zlib interface, and
- link it to an old ZLIB.DLL, that was built from zlib-1.1.4 or
- earlier?
-
- - The official answer is "no"; the real answer depends again on
- what kind of ZLIB.DLL you have. Even if you are lucky, this
- course of action is unreliable.
-
- If you rebuild your application and you intend to use a newer
- version of zlib (post- 1.1.4), it is strongly recommended to
- link it to the new ZLIB1.DLL.
-
-
- 5. Why are the zlib symbols exported by name, and not by ordinal?
-
- - Although exporting symbols by ordinal is a little faster, it
- is risky. Any single glitch in the maintenance or use of the
- DEF file that contains the ordinals can result in incompatible
- builds and frustrating crashes. Simply put, the benefits of
- exporting symbols by ordinal do not justify the risks.
-
- Technically, it should be possible to maintain ordinals in
- the DEF file, and still export the symbols by name. Ordinals
- exist in every DLL, and even if the dynamic linking performed
- at the DLL startup is searching for names, ordinals serve as
- hints, for a faster name lookup. However, if the DEF file
- contains ordinals, the Microsoft linker automatically builds
- an implib that will cause the executables linked to it to use
- those ordinals, and not the names. It is interesting to
- notice that the GNU linker for Win32 does not suffer from this
- problem.
-
- It is possible to avoid the DEF file if the exported symbols
- are accompanied by a "__declspec(dllexport)" attribute in the
- source files. You can do this in zlib by predefining the
- ZLIB_DLL macro.
-
-
- 6. I see that the ZLIB1.DLL functions use the "C" (CDECL) calling
- convention. Why not use the STDCALL convention?
- STDCALL is the standard convention in Win32, and I need it in
- my Visual Basic project!
-
- (For readability, we use CDECL to refer to the convention
- triggered by the "__cdecl" keyword, STDCALL to refer to
- the convention triggered by "__stdcall", and FASTCALL to
- refer to the convention triggered by "__fastcall".)
-
- - Most of the native Windows API functions (without varargs) use
- indeed the WINAPI convention (which translates to STDCALL in
- Win32), but the standard C functions use CDECL. If a user
- application is intrinsically tied to the Windows API (e.g.
- it calls native Windows API functions such as CreateFile()),
- sometimes it makes sense to decorate its own functions with
- WINAPI. But if ANSI C or POSIX portability is a goal (e.g.
- it calls standard C functions such as fopen()), it is not a
- sound decision to request the inclusion of <windows.h>, or to
- use non-ANSI constructs, for the sole purpose to make the user
- functions STDCALL-able.
-
- The functionality offered by zlib is not in the category of
- "Windows functionality", but is more like "C functionality".
-
- Technically, STDCALL is not bad; in fact, it is slightly
- faster than CDECL, and it works with variable-argument
- functions, just like CDECL. It is unfortunate that, in spite
- of using STDCALL in the Windows API, it is not the default
- convention used by the C compilers that run under Windows.
- The roots of the problem reside deep inside the unsafety of
- the K&R-style function prototypes, where the argument types
- are not specified; but that is another story for another day.
-
- The remaining fact is that CDECL is the default convention.
- Even if an explicit convention is hard-coded into the function
- prototypes inside C headers, problems may appear. The
- necessity to expose the convention in users' callbacks is one
- of these problems.
-
- The calling convention issues are also important when using
- zlib in other programming languages. Some of them, like Ada
- (GNAT) and Fortran (GNU G77), have C bindings implemented
- initially on Unix, and relying on the C calling convention.
- On the other hand, the pre- .NET versions of Microsoft Visual
- Basic require STDCALL, while Borland Delphi prefers, although
- it does not require, FASTCALL.
-
- In fairness to all possible uses of zlib outside the C
- programming language, we choose the default "C" convention.
- Anyone interested in different bindings or conventions is
- encouraged to maintain specialized projects. The "contrib/"
- directory from the zlib distribution already holds a couple
- of foreign bindings, such as Ada, C++, and Delphi.
-
-
- 7. I need a DLL for my Visual Basic project. What can I do?
-
- - Define the ZLIB_WINAPI macro before including "zlib.h", when
- building both the DLL and the user application (except that
- you don't need to define anything when using the DLL in Visual
- Basic). The ZLIB_WINAPI macro will switch on the WINAPI
- (STDCALL) convention. The name of this DLL must be different
- than the official ZLIB1.DLL.
-
- Gilles Vollant has contributed a build named ZLIBWAPI.DLL,
- with the ZLIB_WINAPI macro turned on, and with the minizip
- functionality built in. For more information, please read
- the notes inside "contrib/vstudio/readme.txt", found in the
- zlib distribution.
-
-
- 8. I need to use zlib in my Microsoft .NET project. What can I
- do?
-
- - Henrik Ravn has contributed a .NET wrapper around zlib. Look
- into contrib/dotzlib/, inside the zlib distribution.
-
-
- 9. If my application uses ZLIB1.DLL, should I link it to
- MSVCRT.DLL? Why?
-
- - It is not required, but it is recommended to link your
- application to MSVCRT.DLL, if it uses ZLIB1.DLL.
-
- The executables (.EXE, .DLL, etc.) that are involved in the
- same process and are using the C run-time library (i.e. they
- are calling standard C functions), must link to the same
- library. There are several libraries in the Win32 system:
- CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc.
- Since ZLIB1.DLL is linked to MSVCRT.DLL, the executables that
- depend on it should also be linked to MSVCRT.DLL.
-
-
-10. Why are you saying that ZLIB1.DLL and my application should
- be linked to the same C run-time (CRT) library? I linked my
- application and my DLLs to different C libraries (e.g. my
- application to a static library, and my DLLs to MSVCRT.DLL),
- and everything works fine.
-
- - If a user library invokes only pure Win32 API (accessible via
- <windows.h> and the related headers), its DLL build will work
- in any context. But if this library invokes standard C API,
- things get more complicated.
-
- There is a single Win32 library in a Win32 system. Every
- function in this library resides in a single DLL module, that
- is safe to call from anywhere. On the other hand, there are
- multiple versions of the C library, and each of them has its
- own separate internal state. Standalone executables and user
- DLLs that call standard C functions must link to a C run-time
- (CRT) library, be it static or shared (DLL). Intermixing
- occurs when an executable (not necessarily standalone) and a
- DLL are linked to different CRTs, and both are running in the
- same process.
-
- Intermixing multiple CRTs is possible, as long as their
- internal states are kept intact. The Microsoft Knowledge Base
- articles KB94248 "HOWTO: Use the C Run-Time" and KB140584
- "HOWTO: Link with the Correct C Run-Time (CRT) Library"
- mention the potential problems raised by intermixing.
-
- If intermixing works for you, it's because your application
- and DLLs are avoiding the corruption of each of the CRTs'
- internal states, maybe by careful design, or maybe by fortune.
-
- Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such
- as those provided by Borland, raises similar problems.
-
-
-11. Why are you linking ZLIB1.DLL to MSVCRT.DLL?
-
- - MSVCRT.DLL exists on every Windows 95 with a new service pack
- installed, or with Microsoft Internet Explorer 4 or later, and
- on all other Windows 4.x or later (Windows 98, Windows NT 4,
- or later). It is freely distributable; if not present in the
- system, it can be downloaded from Microsoft or from other
- software provider for free.
-
- The fact that MSVCRT.DLL does not exist on a virgin Windows 95
- is not so problematic. Windows 95 is scarcely found nowadays,
- Microsoft ended its support a long time ago, and many recent
- applications from various vendors, including Microsoft, do not
- even run on it. Furthermore, no serious user should run
- Windows 95 without a proper update installed.
-
-
-12. Why are you not linking ZLIB1.DLL to
- <<my favorite C run-time library>> ?
-
- - We considered and abandoned the following alternatives:
-
- * Linking ZLIB1.DLL to a static C library (LIBC.LIB, or
- LIBCMT.LIB) is not a good option. People are using the DLL
- mainly to save disk space. If you are linking your program
- to a static C library, you may as well consider linking zlib
- in statically, too.
-
- * Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because
- CRTDLL.DLL is present on every Win32 installation.
- Unfortunately, it has a series of problems: it does not
- work properly with Microsoft's C++ libraries, it does not
- provide support for 64-bit file offsets, (and so on...),
- and Microsoft discontinued its support a long time ago.
-
- * Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied
- with the Microsoft .NET platform, and Visual C++ 7.0/7.1,
- raises problems related to the status of ZLIB1.DLL as a
- system component. According to the Microsoft Knowledge Base
- article KB326922 "INFO: Redistribution of the Shared C
- Runtime Component in Visual C++ .NET", MSVCR70.DLL and
- MSVCR71.DLL are not supposed to function as system DLLs,
- because they may clash with MSVCRT.DLL. Instead, the
- application's installer is supposed to put these DLLs
- (if needed) in the application's private directory.
- If ZLIB1.DLL depends on a non-system runtime, it cannot
- function as a redistributable system component.
-
- * Linking ZLIB1.DLL to non-Microsoft runtimes, such as
- Borland's, or Cygwin's, raises problems related to the
- reliable presence of these runtimes on Win32 systems.
- It's easier to let the DLL build of zlib up to the people
- who distribute these runtimes, and who may proceed as
- explained in the answer to Question 14.
-
-
-13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL,
- how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0
- (Visual Studio .NET) or newer?
-
- - Due to the problems explained in the Microsoft Knowledge Base
- article KB326922 (see the previous answer), the C runtime that
- comes with the VC7 environment is no longer considered a
- system component. That is, it should not be assumed that this
- runtime exists, or may be installed in a system directory.
- Since ZLIB1.DLL is supposed to be a system component, it may
- not depend on a non-system component.
-
- In order to link ZLIB1.DLL and your application to MSVCRT.DLL
- in VC7, you need the library of Visual C++ 6.0 or older. If
- you don't have this library at hand, it's probably best not to
- use ZLIB1.DLL.
-
- We are hoping that, in the future, Microsoft will provide a
- way to build applications linked to a proper system runtime,
- from the Visual C++ environment. Until then, you have a
- couple of alternatives, such as linking zlib in statically.
- If your application requires dynamic linking, you may proceed
- as explained in the answer to Question 14.
-
-
-14. I need to link my own DLL build to a CRT different than
- MSVCRT.DLL. What can I do?
-
- - Feel free to rebuild the DLL from the zlib sources, and link
- it the way you want. You should, however, clearly state that
- your build is unofficial. You should give it a different file
- name, and/or install it in a private directory that can be
- accessed by your application only, and is not visible to the
- others (e.g. it's not in the SYSTEM or the SYSTEM32 directory,
- and it's not in the PATH). Otherwise, your build may clash
- with applications that link to the official build.
-
- For example, in Cygwin, zlib is linked to the Cygwin runtime
- CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL.
-
-
-15. May I include additional pieces of code that I find useful,
- link them in ZLIB1.DLL, and export them?
-
- - No. A legitimate build of ZLIB1.DLL must not include code
- that does not originate from the official zlib source code.
- But you can make your own private DLL build, under a different
- file name, as suggested in the previous answer.
-
- For example, zlib is a part of the VCL library, distributed
- with Borland Delphi and C++ Builder. The DLL build of VCL
- is a redistributable file, named VCLxx.DLL.
-
-
-16. May I remove some functionality out of ZLIB1.DLL, by enabling
- macros like NO_GZCOMPRESS or NO_GZIP at compile time?
-
- - No. A legitimate build of ZLIB1.DLL must provide the complete
- zlib functionality, as implemented in the official zlib source
- code. But you can make your own private DLL build, under a
- different file name, as suggested in the previous answer.
-
-
-17. I made my own ZLIB1.DLL build. Can I test it for compliance?
-
- - We prefer that you download the official DLL from the zlib
- web site. If you need something peculiar from this DLL, you
- can send your suggestion to the zlib mailing list.
-
- However, in case you do rebuild the DLL yourself, you can run
- it with the test programs found in the DLL distribution.
- Running these test programs is not a guarantee of compliance,
- but a failure can imply a detected problem.
-
-**
-
-This document is written and maintained by
-Cosmin Truta <cosmint@cs.ubbcluj.ro>
diff --git a/funtools/util/zlib-1.2.3/win32/Makefile.bor b/funtools/util/zlib-1.2.3/win32/Makefile.bor
deleted file mode 100644
index b802519..0000000
--- a/funtools/util/zlib-1.2.3/win32/Makefile.bor
+++ /dev/null
@@ -1,107 +0,0 @@
-# Makefile for zlib
-# Borland C++ for Win32
-#
-# Updated for zlib 1.2.x by Cosmin Truta, 11-Mar-2003
-# Last updated: 28-Aug-2003
-#
-# Usage:
-# make -f win32/Makefile.bor
-# make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj
-
-# ------------ Borland C++ ------------
-
-# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
-# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or
-# added to the declaration of LOC here:
-LOC = $(LOCAL_ZLIB)
-
-CC = bcc32
-AS = bcc32
-LD = bcc32
-AR = tlib
-CFLAGS = -a -d -k- -O2 $(LOC)
-ASFLAGS = $(LOC)
-LDFLAGS = $(LOC)
-
-
-# variables
-ZLIB_LIB = zlib.lib
-
-OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj
-OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-#OBJA =
-OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj
-OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
-#OBJPA=
-
-
-# targets
-all: $(ZLIB_LIB) example.exe minigzip.exe
-
-.c.obj:
- $(CC) -c $(CFLAGS) $<
-
-.asm.obj:
- $(AS) -c $(ASFLAGS) $<
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-
-
-# For the sake of the old Borland make,
-# the command line is cut to fit in the MS-DOS 128 byte limit:
-$(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA)
- -del $(ZLIB_LIB)
- $(AR) $(ZLIB_LIB) $(OBJP1)
- $(AR) $(ZLIB_LIB) $(OBJP2)
- $(AR) $(ZLIB_LIB) $(OBJPA)
-
-
-# testing
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-example.exe: example.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
-
-minigzip.exe: minigzip.obj $(ZLIB_LIB)
- $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
-
-
-# cleanup
-clean:
- -del *.obj
- -del *.lib
- -del *.exe
- -del *.tds
- -del zlib.bak
- -del foo.gz
diff --git a/funtools/util/zlib-1.2.3/win32/Makefile.emx b/funtools/util/zlib-1.2.3/win32/Makefile.emx
deleted file mode 100644
index 7b08424..0000000
--- a/funtools/util/zlib-1.2.3/win32/Makefile.emx
+++ /dev/null
@@ -1,69 +0,0 @@
-# Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98.
-# Copyright (C) 1995-1998 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile, or to compile and test, type:
-#
-# make -fmakefile.emx; make test -fmakefile.emx
-#
-
-CC=gcc -Zwin32
-
-#CFLAGS=-MMD -O
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
-#CFLAGS=-MMD -g -DDEBUG
-CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
- -Wstrict-prototypes -Wmissing-prototypes
-
-# If cp.exe is available, replace "copy /Y" with "cp -fp" .
-CP=copy /Y
-# If gnu install.exe is available, replace $(CP) with ginstall.
-INSTALL=$(CP)
-# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
-RM=del
-LDLIBS=-L. -lzlib
-LD=$(CC) -s -o
-LDSHARED=$(CC)
-
-INCL=zlib.h zconf.h
-LIBS=zlib.a
-
-AR=ar rcs
-
-prefix=/usr/local
-exec_prefix = $(prefix)
-
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
- zutil.o inflate.o infback.o inftrees.o inffast.o
-
-TEST_OBJS = example.o minigzip.o
-
-all: example.exe minigzip.exe
-
-test: all
- ./example
- echo hello world | .\minigzip | .\minigzip -d
-
-%.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-zlib.a: $(OBJS)
- $(AR) $@ $(OBJS)
-
-%.exe : %.o $(LIBS)
- $(LD) $@ $< $(LDLIBS)
-
-
-.PHONY : clean
-
-clean:
- $(RM) *.d
- $(RM) *.o
- $(RM) *.exe
- $(RM) zlib.a
- $(RM) foo.gz
-
-DEPS := $(wildcard *.d)
-ifneq ($(DEPS),)
-include $(DEPS)
-endif
diff --git a/funtools/util/zlib-1.2.3/win32/Makefile.gcc b/funtools/util/zlib-1.2.3/win32/Makefile.gcc
deleted file mode 100644
index 62a8430..0000000
--- a/funtools/util/zlib-1.2.3/win32/Makefile.gcc
+++ /dev/null
@@ -1,141 +0,0 @@
-# Makefile for zlib, derived from Makefile.dj2.
-# Modified for mingw32 by C. Spieler, 6/16/98.
-# Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003.
-# Last updated: 1-Aug-2003.
-# Tested under Cygwin and MinGW.
-
-# Copyright (C) 1995-2003 Jean-loup Gailly.
-# For conditions of distribution and use, see copyright notice in zlib.h
-
-# To compile, or to compile and test, type:
-#
-# make -fmakefile.gcc; make test testdll -fmakefile.gcc
-#
-# To use the asm code, type:
-# cp contrib/asm?86/match.S ./match.S
-# make LOC=-DASMV OBJA=match.o -fmakefile.gcc
-#
-# To install libz.a, zconf.h and zlib.h in the system directories, type:
-#
-# make install -fmakefile.gcc
-
-# Note:
-# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
-# the DLL name should be changed from "zlib1.dll".
-
-STATICLIB = libz.a
-SHAREDLIB = zlib1.dll
-IMPLIB = libzdll.a
-
-#LOC = -DASMV
-#LOC = -DDEBUG -g
-
-CC = gcc
-CFLAGS = $(LOC) -O3 -Wall
-
-AS = $(CC)
-ASFLAGS = $(LOC) -Wall
-
-LD = $(CC)
-LDFLAGS = $(LOC) -s
-
-AR = ar
-ARFLAGS = rcs
-
-RC = windres
-RCFLAGS = --define GCC_WINDRES
-
-CP = cp -fp
-# If GNU install is available, replace $(CP) with install.
-INSTALL = $(CP)
-RM = rm -f
-
-prefix = /usr/local
-exec_prefix = $(prefix)
-
-OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \
- inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
-OBJA =
-
-all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d
-
-test: example minigzip
- ./example
- echo hello world | ./minigzip | ./minigzip -d
-
-testdll: example_d minigzip_d
- ./example_d
- echo hello world | ./minigzip_d | ./minigzip_d -d
-
-.c.o:
- $(CC) $(CFLAGS) -c -o $@ $<
-
-.S.o:
- $(AS) $(ASFLAGS) -c -o $@ $<
-
-$(STATICLIB): $(OBJS) $(OBJA)
- $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
-
-$(IMPLIB): $(SHAREDLIB)
-
-$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
- dllwrap --driver-name $(CC) --def win32/zlib.def \
- --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o
- strip $@
-
-example: example.o $(STATICLIB)
- $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
-
-minigzip: minigzip.o $(STATICLIB)
- $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
-
-example_d: example.o $(IMPLIB)
- $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
-
-minigzip_d: minigzip.o $(IMPLIB)
- $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
-
-zlibrc.o: win32/zlib1.rc
- $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
-
-
-# INCLUDE_PATH and LIBRARY_PATH must be set.
-
-.PHONY: install uninstall clean
-
-install: zlib.h zconf.h $(LIB)
- -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH)
- -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH)
- -$(INSTALL) zlib.h $(INCLUDE_PATH)
- -$(INSTALL) zconf.h $(INCLUDE_PATH)
- -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
- -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH)
-
-uninstall:
- -$(RM) $(INCLUDE_PATH)/zlib.h
- -$(RM) $(INCLUDE_PATH)/zconf.h
- -$(RM) $(LIBRARY_PATH)/$(STATICLIB)
- -$(RM) $(LIBRARY_PATH)/$(IMPLIB)
-
-clean:
- -$(RM) $(STATICLIB)
- -$(RM) $(SHAREDLIB)
- -$(RM) $(IMPLIB)
- -$(RM) *.o
- -$(RM) *.exe
- -$(RM) foo.gz
-
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
diff --git a/funtools/util/zlib-1.2.3/win32/Makefile.msc b/funtools/util/zlib-1.2.3/win32/Makefile.msc
deleted file mode 100644
index 528ecaa..0000000
--- a/funtools/util/zlib-1.2.3/win32/Makefile.msc
+++ /dev/null
@@ -1,126 +0,0 @@
-# Makefile for zlib -- Microsoft (Visual) C
-#
-# Authors:
-# Cosmin Truta, 11-Mar-2003
-# Christian Spieler, 19-Mar-2003
-#
-# Last updated:
-# Cosmin Truta, 27-Aug-2003
-#
-# Usage:
-# nmake -f win32/Makefile.msc (standard build)
-# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
-# nmake -f win32/Makefile.msc LOC=-DASMV OBJA=match.obj (use ASM code)
-
-
-# optional build flags
-LOC =
-
-
-# variables
-STATICLIB = zlib.lib
-SHAREDLIB = zlib1.dll
-IMPLIB = zdll.lib
-
-CC = cl
-AS = ml
-LD = link
-AR = lib
-RC = rc
-CFLAGS = -nologo -MD -O2 $(LOC)
-ASFLAGS = -coff
-LDFLAGS = -nologo -release
-ARFLAGS = -nologo
-RCFLAGS = /dWIN32 /r
-
-OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \
- inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
-OBJA =
-
-
-# targets
-all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
- example.exe minigzip.exe example_d.exe minigzip_d.exe
-
-$(STATICLIB): $(OBJS) $(OBJA)
- $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
-
-$(IMPLIB): $(SHAREDLIB)
-
-$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res
- $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \
- -out:$@ $(OBJS) $(OBJA) zlib1.res
-
-example.exe: example.obj $(STATICLIB)
- $(LD) $(LDFLAGS) example.obj $(STATICLIB)
-
-minigzip.exe: minigzip.obj $(STATICLIB)
- $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
-
-example_d.exe: example.obj $(IMPLIB)
- $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
-
-minigzip_d.exe: minigzip.obj $(IMPLIB)
- $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
-
-.c.obj:
- $(CC) -c $(CFLAGS) $<
-
-.asm.obj:
- $(AS) -c $(ASFLAGS) $<
-
-adler32.obj: adler32.c zlib.h zconf.h
-
-compress.obj: compress.c zlib.h zconf.h
-
-crc32.obj: crc32.c zlib.h zconf.h crc32.h
-
-deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
-
-gzio.obj: gzio.c zutil.h zlib.h zconf.h
-
-infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h
-
-inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
- inffast.h inffixed.h
-
-inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
-
-trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
-
-uncompr.obj: uncompr.c zlib.h zconf.h
-
-zutil.obj: zutil.c zutil.h zlib.h zconf.h
-
-example.obj: example.c zlib.h zconf.h
-
-minigzip.obj: minigzip.c zlib.h zconf.h
-
-zlib1.res: win32/zlib1.rc
- $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc
-
-
-# testing
-test: example.exe minigzip.exe
- example
- echo hello world | minigzip | minigzip -d
-
-testdll: example_d.exe minigzip_d.exe
- example_d
- echo hello world | minigzip_d | minigzip_d -d
-
-
-# cleanup
-clean:
- -del $(STATICLIB)
- -del $(SHAREDLIB)
- -del $(IMPLIB)
- -del *.obj
- -del *.res
- -del *.exp
- -del *.exe
- -del foo.gz
diff --git a/funtools/util/zlib-1.2.3/win32/VisualC.txt b/funtools/util/zlib-1.2.3/win32/VisualC.txt
deleted file mode 100644
index 579a5fc..0000000
--- a/funtools/util/zlib-1.2.3/win32/VisualC.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-
-To build zlib using the Microsoft Visual C++ environment,
-use the appropriate project from the projects/ directory.
diff --git a/funtools/util/zlib-1.2.3/win32/zlib.def b/funtools/util/zlib-1.2.3/win32/zlib.def
deleted file mode 100644
index a47cbc1..0000000
--- a/funtools/util/zlib-1.2.3/win32/zlib.def
+++ /dev/null
@@ -1,60 +0,0 @@
-LIBRARY
-; zlib data compression library
-
-EXPORTS
-; basic functions
- zlibVersion
- deflate
- deflateEnd
- inflate
- inflateEnd
-; advanced functions
- deflateSetDictionary
- deflateCopy
- deflateReset
- deflateParams
- deflateBound
- deflatePrime
- inflateSetDictionary
- inflateSync
- inflateCopy
- inflateReset
- inflateBack
- inflateBackEnd
- zlibCompileFlags
-; utility functions
- compress
- compress2
- compressBound
- uncompress
- gzopen
- gzdopen
- gzsetparams
- gzread
- gzwrite
- gzprintf
- gzputs
- gzgets
- gzputc
- gzgetc
- gzungetc
- gzflush
- gzseek
- gzrewind
- gztell
- gzeof
- gzclose
- gzerror
- gzclearerr
-; checksum functions
- adler32
- crc32
-; various hacks, don't look :)
- deflateInit_
- deflateInit2_
- inflateInit_
- inflateInit2_
- inflateBackInit_
- inflateSyncPoint
- get_crc_table
- zError
diff --git a/funtools/util/zlib-1.2.3/win32/zlib1.rc b/funtools/util/zlib-1.2.3/win32/zlib1.rc
deleted file mode 100644
index 99025c9..0000000
--- a/funtools/util/zlib-1.2.3/win32/zlib1.rc
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <windows.h>
-
-#ifdef GCC_WINDRES
-VS_VERSION_INFO VERSIONINFO
-#else
-VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
-#endif
- FILEVERSION 1,2,2,0
- PRODUCTVERSION 1,2,2,0
- FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
- FILEFLAGS 1
-#else
- FILEFLAGS 0
-#endif
- FILEOS VOS_DOS_WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE 0 // not used
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904E4"
- //language ID = U.S. English, char set = Windows, Multilingual
- BEGIN
- VALUE "FileDescription", "zlib data compression library\0"
- VALUE "FileVersion", "1.2.3\0"
- VALUE "InternalName", "zlib1.dll\0"
- VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0"
- VALUE "OriginalFilename", "zlib1.dll\0"
- VALUE "ProductName", "zlib\0"
- VALUE "ProductVersion", "1.2.3\0"
- VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0409, 1252
- END
-END
diff --git a/funtools/util/zlib-1.2.3/zconf.h b/funtools/util/zlib-1.2.3/zconf.h
deleted file mode 100644
index 03a9431..0000000
--- a/funtools/util/zlib-1.2.3/zconf.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define deflateBound z_deflateBound
-# define deflatePrime z_deflatePrime
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateCopy z_inflateCopy
-# define inflateReset z_inflateReset
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-# define zError z_zError
-
-# define alloc_func z_alloc_func
-# define free_func z_free_func
-# define in_func z_in_func
-# define out_func z_out_func
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-# define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-# define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-# ifndef SYS16BIT
-# define SYS16BIT
-# endif
-# endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
-# if __STDC_VERSION__ >= 199901L
-# ifndef STDC99
-# define STDC99
-# endif
-# endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-# define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
-# define SMALL_MEDIUM
-# ifdef __BORLANDC__
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
-# ifdef ZLIB_DLL
-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-# ifdef ZLIB_INTERNAL
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-# endif
-# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
-# ifdef ZLIB_WINAPI
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR CDECL
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# ifdef ZLIB_DLL
-# ifdef ZLIB_INTERNAL
-# define ZEXPORT __declspec(dllexport)
-# define ZEXPORTVA __declspec(dllexport)
-# else
-# define ZEXPORT __declspec(dllimport)
-# define ZEXPORTVA __declspec(dllimport)
-# endif
-# endif
-#endif
-
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-#if defined(__OS400__)
-# define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-# define NO_vsnprintf
-# ifdef FAR
-# undef FAR
-# endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-# pragma map(deflateInit_,"DEIN")
-# pragma map(deflateInit2_,"DEIN2")
-# pragma map(deflateEnd,"DEEND")
-# pragma map(deflateBound,"DEBND")
-# pragma map(inflateInit_,"ININ")
-# pragma map(inflateInit2_,"ININ2")
-# pragma map(inflateEnd,"INEND")
-# pragma map(inflateSync,"INSY")
-# pragma map(inflateSetDictionary,"INSEDI")
-# pragma map(compressBound,"CMBND")
-# pragma map(inflate_table,"INTABL")
-# pragma map(inflate_fast,"INFA")
-# pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/funtools/util/zlib-1.2.3/zconf.in.h b/funtools/util/zlib-1.2.3/zconf.in.h
deleted file mode 100644
index 03a9431..0000000
--- a/funtools/util/zlib-1.2.3/zconf.in.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define deflateBound z_deflateBound
-# define deflatePrime z_deflatePrime
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateCopy z_inflateCopy
-# define inflateReset z_inflateReset
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-# define zError z_zError
-
-# define alloc_func z_alloc_func
-# define free_func z_free_func
-# define in_func z_in_func
-# define out_func z_out_func
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-# define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-# define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-# ifndef SYS16BIT
-# define SYS16BIT
-# endif
-# endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
-# if __STDC_VERSION__ >= 199901L
-# ifndef STDC99
-# define STDC99
-# endif
-# endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-# define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
-# define SMALL_MEDIUM
-# ifdef __BORLANDC__
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
-# ifdef ZLIB_DLL
-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-# ifdef ZLIB_INTERNAL
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-# endif
-# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
-# ifdef ZLIB_WINAPI
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR CDECL
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# ifdef ZLIB_DLL
-# ifdef ZLIB_INTERNAL
-# define ZEXPORT __declspec(dllexport)
-# define ZEXPORTVA __declspec(dllexport)
-# else
-# define ZEXPORT __declspec(dllimport)
-# define ZEXPORTVA __declspec(dllimport)
-# endif
-# endif
-#endif
-
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-#if defined(__OS400__)
-# define NO_vsnprintf
-#endif
-
-#if defined(__MVS__)
-# define NO_vsnprintf
-# ifdef FAR
-# undef FAR
-# endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-# pragma map(deflateInit_,"DEIN")
-# pragma map(deflateInit2_,"DEIN2")
-# pragma map(deflateEnd,"DEEND")
-# pragma map(deflateBound,"DEBND")
-# pragma map(inflateInit_,"ININ")
-# pragma map(inflateInit2_,"ININ2")
-# pragma map(inflateEnd,"INEND")
-# pragma map(inflateSync,"INSY")
-# pragma map(inflateSetDictionary,"INSEDI")
-# pragma map(compressBound,"CMBND")
-# pragma map(inflate_table,"INTABL")
-# pragma map(inflate_fast,"INFA")
-# pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/funtools/util/zlib-1.2.3/zlib.3 b/funtools/util/zlib-1.2.3/zlib.3
deleted file mode 100644
index 90b8162..0000000
--- a/funtools/util/zlib-1.2.3/zlib.3
+++ /dev/null
@@ -1,159 +0,0 @@
-.TH ZLIB 3 "18 July 2005"
-.SH NAME
-zlib \- compression/decompression library
-.SH SYNOPSIS
-[see
-.I zlib.h
-for full description]
-.SH DESCRIPTION
-The
-.I zlib
-library is a general purpose data compression library.
-The code is thread safe.
-It provides in-memory compression and decompression functions,
-including integrity checks of the uncompressed data.
-This version of the library supports only one compression method (deflation)
-but other algorithms will be added later
-and will have the same stream interface.
-.LP
-Compression can be done in a single step if the buffers are large enough
-(for example if an input file is mmap'ed),
-or can be done by repeated calls of the compression function.
-In the latter case,
-the application must provide more input and/or consume the output
-(providing more output space) before each call.
-.LP
-The library also supports reading and writing files in
-.IR gzip (1)
-(.gz) format
-with an interface similar to that of stdio.
-.LP
-The library does not install any signal handler.
-The decoder checks the consistency of the compressed data,
-so the library should never crash even in case of corrupted input.
-.LP
-All functions of the compression library are documented in the file
-.IR zlib.h .
-The distribution source includes examples of use of the library
-in the files
-.I example.c
-and
-.IR minigzip.c .
-.LP
-Changes to this version are documented in the file
-.I ChangeLog
-that accompanies the source,
-and are concerned primarily with bug fixes and portability enhancements.
-.LP
-A Java implementation of
-.I zlib
-is available in the Java Development Kit 1.1:
-.IP
-http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
-.LP
-A Perl interface to
-.IR zlib ,
-written by Paul Marquess (pmqs@cpan.org),
-is available at CPAN (Comprehensive Perl Archive Network) sites,
-including:
-.IP
-http://www.cpan.org/modules/by-module/Compress/
-.LP
-A Python interface to
-.IR zlib ,
-written by A.M. Kuchling (amk@magnet.com),
-is available in Python 1.5 and later versions:
-.IP
-http://www.python.org/doc/lib/module-zlib.html
-.LP
-A
-.I zlib
-binding for
-.IR tcl (1),
-written by Andreas Kupries (a.kupries@westend.com),
-is availlable at:
-.IP
-http://www.westend.com/~kupries/doc/trf/man/man.html
-.LP
-An experimental package to read and write files in .zip format,
-written on top of
-.I zlib
-by Gilles Vollant (info@winimage.com),
-is available at:
-.IP
-http://www.winimage.com/zLibDll/unzip.html
-and also in the
-.I contrib/minizip
-directory of the main
-.I zlib
-web site.
-.SH "SEE ALSO"
-The
-.I zlib
-web site can be found at either of these locations:
-.IP
-http://www.zlib.org
-.br
-http://www.gzip.org/zlib/
-.LP
-The data format used by the zlib library is described by RFC
-(Request for Comments) 1950 to 1952 in the files:
-.IP
-http://www.ietf.org/rfc/rfc1950.txt (concerning zlib format)
-.br
-http://www.ietf.org/rfc/rfc1951.txt (concerning deflate format)
-.br
-http://www.ietf.org/rfc/rfc1952.txt (concerning gzip format)
-.LP
-These documents are also available in other formats from:
-.IP
-ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
-.LP
-Mark Nelson (markn@ieee.org) wrote an article about
-.I zlib
-for the Jan. 1997 issue of Dr. Dobb's Journal;
-a copy of the article is available at:
-.IP
-http://dogma.net/markn/articles/zlibtool/zlibtool.htm
-.SH "REPORTING PROBLEMS"
-Before reporting a problem,
-please check the
-.I zlib
-web site to verify that you have the latest version of
-.IR zlib ;
-otherwise,
-obtain the latest version and see if the problem still exists.
-Please read the
-.I zlib
-FAQ at:
-.IP
-http://www.gzip.org/zlib/zlib_faq.html
-.LP
-before asking for help.
-Send questions and/or comments to zlib@gzip.org,
-or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
-.SH AUTHORS
-Version 1.2.3
-Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org)
-and Mark Adler (madler@alumni.caltech.edu).
-.LP
-This software is provided "as-is,"
-without any express or implied warranty.
-In no event will the authors be held liable for any damages
-arising from the use of this software.
-See the distribution directory with respect to requirements
-governing redistribution.
-The deflate format used by
-.I zlib
-was defined by Phil Katz.
-The deflate and
-.I zlib
-specifications were written by L. Peter Deutsch.
-Thanks to all the people who reported problems and suggested various
-improvements in
-.IR zlib ;
-who are too numerous to cite here.
-.LP
-UNIX manual page by R. P. C. Rodgers,
-U.S. National Library of Medicine (rodgers@nlm.nih.gov).
-.\" end of man page
diff --git a/funtools/util/zlib-1.2.3/zlib.h b/funtools/util/zlib-1.2.3/zlib.h
deleted file mode 100644
index 0228179..0000000
--- a/funtools/util/zlib-1.2.3/zlib.h
+++ /dev/null
@@ -1,1357 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.3, July 18th, 2005
-
- Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.3"
-#define ZLIB_VERNUM 0x1230
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms will be added later and will have the same
- stream interface.
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The compressed data format used by default by the in-memory functions is
- the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
- around a deflate stream, which is itself documented in RFC 1951.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio using the functions that start
- with "gz". The gzip format is different from the zlib format. gzip is a
- gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
- This library can optionally read and write gzip streams in memory as well.
-
- The zlib format was designed to be compact and fast for use in memory
- and on communications channels. The gzip format was designed for single-
- file compression on file systems, has a larger header than zlib to maintain
- directory information, and uses a different, slower check method than zlib.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never
- crash even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: binary or text */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- gzip header information passed to and from zlib routines. See RFC 1952
- for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
- int text; /* true if compressed data believed to be text */
- uLong time; /* modification time */
- int xflags; /* extra flags (not used when writing a gzip file) */
- int os; /* operating system */
- Bytef *extra; /* pointer to extra field or Z_NULL if none */
- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
- uInt extra_max; /* space at extra (only when reading header) */
- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
- uInt name_max; /* space at name (only when reading header) */
- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
- uInt comm_max; /* space at comment (only when reading header) */
- int hcrc; /* true if there was or will be a header crc */
- int done; /* true when done reading gzip header (not used
- when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
- The application must update next_in and avail_in when avail_in has
- dropped to zero. It must update next_out and avail_out when avail_out
- has dropped to zero. The application must initialize zalloc, zfree and
- opaque before calling the init function. All other fields are set by the
- compression library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by zalloc for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or
- progress reports. After compression, total_in holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-#define Z_BLOCK 5
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_RLE 3
-#define Z_FIXED 4
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_TEXT 1
-#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller.
- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
- use default allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
- compression (currently equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- msg is set to null if there is no error message. deflateInit does not
- perform any compression: this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce some
- output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating avail_in or avail_out accordingly; avail_out
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
- and with zero avail_out, it must be called again after making room in the
- output buffer because there might be more output pending.
-
- Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
- decide how much data to accumualte before producing output, in order to
- maximize compression.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In particular
- avail_in is zero after the call if enough output space has been provided
- before the call.) Flushing may degrade compression for some compression
- algorithms and so it should be used only when necessary.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there
- was enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the
- stream are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least
- the value returned by deflateBound (see below). If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update strm->data_type if it can make a good guess about
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
- fatal, and deflate() can be called again with more input and more output
- space to continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- msg may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
- value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller. msg is set to null if there is no error
- message. inflateInit does not perform any decompression apart from reading
- the zlib header if present: this will be done by inflate(). (So next_in and
- avail_in may be modified, but next_out and avail_out are unchanged.)
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing
- will resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there
- is no more input data or no more space in the output buffer (see below
- about the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (avail_out == 0), or after each
- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
- must be called again after making room in the output buffer because there
- might be more output pending.
-
- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
- Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
- output as possible to the output buffer. Z_BLOCK requests that inflate() stop
- if and when it gets to the next deflate block boundary. When decoding the
- zlib or gzip format, this will cause inflate() to return immediately after
- the header and before the first block. When doing a raw inflate, inflate()
- will go ahead and process the first block, and will return when it gets to
- the end of that block, or when it runs out of data.
-
- The Z_BLOCK option assists in appending to or combining deflate streams.
- Also to assist in this, on return inflate() will set strm->data_type to the
- number of unused bits in the last byte taken from strm->next_in, plus 64
- if inflate() is currently decoding the last block in the deflate stream,
- plus 128 if inflate() returned immediately after decoding an end-of-block
- code or decoding the complete header up to just before the first byte of the
- deflate stream. The end-of-block will not be indicated until all of the
- uncompressed data from that block has been written to strm->next_out. The
- number of unused bits may in general be greater than seven, except when
- bit 7 of data_type is set, in which case the number of unused bits will be
- less than eight.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step
- (a single call of inflate), the parameter flush should be set to
- Z_FINISH. In this case all pending input is processed and all pending
- output is flushed; avail_out must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
- is never required, but can be used to inform inflate that a faster approach
- may be used for the single inflate() call.
-
- In this implementation, inflate() always flushes as much output as
- possible to the output buffer, and always uses the faster approach on the
- first call. So the only effect of the flush parameter in this implementation
- is on the return value of inflate(), as noted below, or when it returns early
- because Z_BLOCK is used.
-
- If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm->adler to the adler32 checksum of the dictionary
- chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
- strm->adler to the adler32 checksum of all output produced so far (that is,
- total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
- below. At the end of the stream, inflate() checks that its computed adler32
- checksum is equal to that saved by the compressor and returns Z_STREAM_END
- only if the checksum is correct.
-
- inflate() will decompress and check either zlib-wrapped or gzip-wrapped
- deflate data. The header type is detected automatically. Any information
- contained in the gzip header is not retained, so applications that need that
- information should instead use raw inflate, see inflateInit2() below, or
- inflateBack() and perform their own processing of the gzip header and
- trailer.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect check
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
- if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
- inflate() can be called again with more input and more output space to
- continue decompressing. If Z_DATA_ERROR is returned, the application may then
- call inflateSync() to look for a good compression block if a partial recovery
- of the data is desired.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
- determines the window size. deflate() will then generate raw deflate data
- with no zlib header or trailer, and will not compute an adler32 check value.
-
- windowBits can also be greater than 15 for optional gzip encoding. Add
- 16 to windowBits to write a simple gzip header and trailer around the
- compressed data instead of a zlib wrapper. The gzip header will have no
- file name, no extra data, no comment, no modification time (set to zero),
- no header crc, and the operating system will be set to 255 (unknown). If a
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match), or Z_RLE to limit match distances to one (run-length
- encoding). Filtered data consists mostly of small values with a somewhat
- random distribution. In this case, the compression algorithm is tuned to
- compress them better. The effect of Z_FILTERED is to force more Huffman
- coding and less string matching; it is somewhat intermediate between
- Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
- Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
- parameter only affects the compression ratio but not the correctness of the
- compressed output even if it is not set appropriately. Z_FIXED prevents the
- use of dynamic Huffman codes, allowing for a simpler decoder for special
- applications.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
- method). msg is set to null if there is no error message. deflateInit2 does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any
- call of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- deflate or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front. In addition, the
- current implementation of deflate will use at most the window size minus
- 262 bytes of the provided dictionary.
-
- Upon return of this function, strm->adler is set to the adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.) If a raw deflate was requested, then the
- adler32 value is not computed and strm->adler is not set.
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
- perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
-/*
- Fine tune deflate's internal compression parameters. This should only be
- used by someone who understands the algorithm used by zlib's deflate for
- searching for the best matching string, and even then only by the most
- fanatic optimizer trying to squeeze out the last compressed bit for their
- specific input data. Read the deflate.c source code for the meaning of the
- max_lazy, good_length, nice_length, and max_chain parameters.
-
- deflateTune() can be called after deflateInit() or deflateInit2(), and
- returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
-/*
- deflateBound() returns an upper bound on the compressed size after
- deflation of sourceLen bytes. It must be called after deflateInit()
- or deflateInit2(). This would be used to allocate an output buffer
- for deflation in a single pass, and so would be called before deflate().
-*/
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- deflatePrime() inserts bits in the deflate output stream. The intent
- is that this function is used to start off the deflate output with the
- bits leftover from a previous deflate stream when appending to it. As such,
- this function can only be used for raw deflate, and must be used before the
- first deflate() call after a deflateInit2() or deflateReset(). bits must be
- less than or equal to 16, and that many of the least significant bits of
- value will be inserted in the output.
-
- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- deflateSetHeader() provides gzip header information for when a gzip
- stream is requested by deflateInit2(). deflateSetHeader() may be called
- after deflateInit2() or deflateReset() and before the first call of
- deflate(). The text, time, os, extra field, name, and comment information
- in the provided gz_header structure are written to the gzip header (xflag is
- ignored -- the extra flags are set according to the compression level). The
- caller must assure that, if not Z_NULL, name and comment are terminated with
- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
- available there. If hcrc is true, a gzip header crc is included. Note that
- the current versions of the command-line version of gzip (up through version
- 1.3.x) do not support header crc's, and will report that it is a "multi-part
- gzip file" and give up.
-
- If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
-
- deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. windowBits must be greater than or equal to the windowBits value
- provided to deflateInit2() while compressing, or it must be equal to 15 if
- deflateInit2() was not used. If a compressed stream with a larger window
- size is given as input, inflate() will return with the error code
- Z_DATA_ERROR instead of trying to allocate a larger window.
-
- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
- determines the window size. inflate() will then process raw deflate data,
- not looking for a zlib or gzip header, not generating a check value, and not
- looking for any check values for comparison at the end of the stream. This
- is for use with other formats that use the deflate compressed data format
- such as zip. Those formats provide their own check values. If a custom
- format is developed using the raw deflate format for compressed data, it is
- recommended that a check value such as an adler32 or a crc32 be applied to
- the uncompressed data as is done in the zlib, gzip, and zip formats. For
- most applications, the zlib format should be used as is. Note that comments
- above on the use in deflateInit2() applies to the magnitude of windowBits.
-
- windowBits can also be greater than 15 for optional gzip decoding. Add
- 32 to windowBits to enable zlib and gzip decoding with automatic header
- detection, or add 16 to decode only the gzip format (the zlib format will
- return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
- a crc32 instead of an adler32.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
- is set to null if there is no error message. inflateInit2 does not perform
- any decompression apart from reading the zlib header if present: this will
- be done by inflate(). (So next_in and avail_in may be modified, but next_out
- and avail_out are unchanged.)
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate,
- if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the adler32 value returned by that call of inflate.
- The compressor and decompressor must use exactly the same dictionary (see
- deflateSetDictionary). For raw inflate, this function can be called
- immediately after inflateInit2() or inflateReset() and before any call of
- inflate() to set the dictionary. The application must insure that the
- dictionary that was used for compression is provided.
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when randomly accessing a large stream. The
- first pass through the stream can periodically record the inflate state,
- allowing restarting inflate at those points when randomly accessing the
- stream.
-
- inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- This function inserts bits in the inflate input stream. The intent is
- that this function is used to start inflating at a bit position in the
- middle of a byte. The provided bits will be used before any bytes are used
- from next_in. This function should only be used with raw inflate, and
- should be used before the first inflate() call after inflateInit2() or
- inflateReset(). bits must be less than or equal to 16, and that many of the
- least significant bits of value will be inserted in the input.
-
- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- inflateGetHeader() requests that gzip header information be stored in the
- provided gz_header structure. inflateGetHeader() may be called after
- inflateInit2() or inflateReset(), and before the first call of inflate().
- As inflate() processes the gzip stream, head->done is zero until the header
- is completed, at which time head->done is set to one. If a zlib stream is
- being decoded, then head->done is set to -1 to indicate that there will be
- no gzip header information forthcoming. Note that Z_BLOCK can be used to
- force inflate() to return immediately after header processing is complete
- and before any actual data is decompressed.
-
- The text, time, xflags, and os fields are filled in with the gzip header
- contents. hcrc is set to true if there is a header CRC. (The header CRC
- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
- contains the maximum number of bytes to write to extra. Once done is true,
- extra_len contains the actual extra field length, and extra contains the
- extra field, or that field truncated if extra_max is less than extra_len.
- If name is not Z_NULL, then up to name_max characters are written there,
- terminated with a zero unless the length is greater than name_max. If
- comment is not Z_NULL, then up to comm_max characters are written there,
- terminated with a zero unless the length is greater than comm_max. When
- any of extra, name, or comment are not Z_NULL and the respective field is
- not present in the header, then that field is set to Z_NULL to signal its
- absence. This allows the use of deflateSetHeader() with the returned
- structure to duplicate the header. However if those fields are set to
- allocated memory, then the application will need to save those pointers
- elsewhere so that they can be eventually freed.
-
- If inflateGetHeader is not used, then the header information is simply
- discarded. The header is always checked for validity, including the header
- CRC if present. inflateReset() will reset the process to discard the header
- information. The application would need to call inflateGetHeader() again to
- retrieve the header from the next gzip stream.
-
- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
-
- Initialize the internal stream state for decompression using inflateBack()
- calls. The fields zalloc, zfree and opaque in strm must be initialized
- before the call. If zalloc and zfree are Z_NULL, then the default library-
- derived memory allocation routines are used. windowBits is the base two
- logarithm of the window size, in the range 8..15. window is a caller
- supplied buffer of that size. Except for special applications where it is
- assured that deflate was used with small window sizes, windowBits must be 15
- and a 32K byte window must be supplied to be able to decompress general
- deflate streams.
-
- See inflateBack() for the usage of these routines.
-
- inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the paramaters are invalid, Z_MEM_ERROR if the internal state could not
- be allocated, or Z_VERSION_ERROR if the version of the library does not
- match the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
-/*
- inflateBack() does a raw inflate with a single call using a call-back
- interface for input and output. This is more efficient than inflate() for
- file i/o applications in that it avoids copying between the output and the
- sliding window by simply making the window itself the output buffer. This
- function trusts the application to not change the output buffer passed by
- the output function, at least until inflateBack() returns.
-
- inflateBackInit() must be called first to allocate the internal state
- and to initialize the state with the user-provided window buffer.
- inflateBack() may then be used multiple times to inflate a complete, raw
- deflate stream with each call. inflateBackEnd() is then called to free
- the allocated state.
-
- A raw deflate stream is one with no zlib or gzip header or trailer.
- This routine would normally be used in a utility that reads zip or gzip
- files and writes out uncompressed files. The utility would decode the
- header and process the trailer on its own, hence this routine expects
- only the raw deflate stream to decompress. This is different from the
- normal behavior of inflate(), which expects either a zlib or gzip header and
- trailer around the deflate stream.
-
- inflateBack() uses two subroutines supplied by the caller that are then
- called by inflateBack() for input and output. inflateBack() calls those
- routines until it reads a complete deflate stream and writes out all of the
- uncompressed data, or until it encounters an error. The function's
- parameters and return types are defined above in the in_func and out_func
- typedefs. inflateBack() will call in(in_desc, &buf) which should return the
- number of bytes of provided input, and a pointer to that input in buf. If
- there is no input available, in() must return zero--buf is ignored in that
- case--and inflateBack() will return a buffer error. inflateBack() will call
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
- should return zero on success, or non-zero on failure. If out() returns
- non-zero, inflateBack() will return with an error. Neither in() nor out()
- are permitted to change the contents of the window provided to
- inflateBackInit(), which is also the buffer that out() uses to write from.
- The length written by out() will be at most the window size. Any non-zero
- amount of input may be provided by in().
-
- For convenience, inflateBack() can be provided input on the first call by
- setting strm->next_in and strm->avail_in. If that input is exhausted, then
- in() will be called. Therefore strm->next_in must be initialized before
- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
- must also be initialized, and then if strm->avail_in is not zero, input will
- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
-
- The in_desc and out_desc parameters of inflateBack() is passed as the
- first parameter of in() and out() respectively when they are called. These
- descriptors can be optionally used to pass any information that the caller-
- supplied in() and out() functions need to do their job.
-
- On return, inflateBack() will set strm->next_in and strm->avail_in to
- pass back any unused input that was provided by the last in() call. The
- return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
- if in() or out() returned an error, Z_DATA_ERROR if there was a format
- error in the deflate stream (in which case strm->msg is set to indicate the
- nature of the error), or Z_STREAM_ERROR if the stream was not properly
- initialized. In the case of Z_BUF_ERROR, an input or output error can be
- distinguished using strm->next_in which will be Z_NULL only if in() returned
- an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
- out() returning non-zero. (in() will always be called before out(), so
- strm->next_in is assured to be defined if out() returns non-zero.) Note
- that inflateBack() cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
- All memory allocated by inflateBackInit() is freed.
-
- inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
- state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
- Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
- 1.0: size of uInt
- 3.2: size of uLong
- 5.4: size of voidpf (pointer)
- 7.6: size of z_off_t
-
- Compiler, assembler, and debug options:
- 8: DEBUG
- 9: ASMV or ASMINF -- use ASM code
- 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
- 11: 0 (reserved)
-
- One-time table building (smaller code, but not thread-safe if true):
- 12: BUILDFIXED -- build static block decoding tables when needed
- 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
- 14,15: 0 (reserved)
-
- Library content (indicates missing functionality):
- 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
- deflate code when not needed)
- 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
- and decode gzip streams (to avoid linking crc code)
- 18-19: 0 (reserved)
-
- Operation variations (changes in library functionality):
- 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
- 21: FASTEST -- deflate algorithm with only one, lowest compression level
- 22,23: 0 (reserved)
-
- The sprintf variant used by gzprintf (zero is best):
- 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
- 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
- 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
- Remainder:
- 27-31: 0 (reserved)
- */
-
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least the value returned
- by compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
- compressBound() returns an upper bound on the compressed size after
- compress() or compress2() on sourceLen bytes. It would be used before
- a compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
-*/
-
-
-typedef voidp gzFile;
-
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h", or 'R' for run-length encoding
- as in "wb1R". (See the description of deflateInit2 for more information
- about the strategy parameter.)
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression.
-
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR). */
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error). The number of
- uncompressed bytes written is limited to 4095. The caller should assure that
- this limit is not exceeded. If it is exceeded, then gzprintf() will return
- return an error (0) with nothing written. In this case, there may also be a
- buffer overflow with unpredictable consequences, which is possible only if
- zlib was compiled with the insecure functions sprintf() or vsprintf()
- because the secure snprintf() or vsnprintf() functions were not available.
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- gzgets returns buf, or Z_NULL in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
- Push one character back onto the stream to be read again later.
- Only one character of push-back is allowed. gzungetc() returns the
- character pushed, or -1 on failure. gzungetc() will fail if a
- character has been pushed but not read yet, or if c is -1. The pushed
- character will be discarded if the stream is repositioned with gzseek()
- or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
-*/
-
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-/*
- Sets the starting position for the next gzread or gzwrite on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-/*
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
- Returns 1 if file is being read directly without decompression, otherwise
- zero.
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
- Clears the error and end-of-file flags for file. This is analogous to the
- clearerr() function in stdio. This is useful for continuing to read a gzip
- file that is being written concurrently.
-*/
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
-/*
- Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
- and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
- each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running CRC-32 with the bytes buf[0..len-1] and return the
- updated CRC-32. If buf is NULL, this function returns the required initial
- value for the for the crc. Pre- and post-conditioning (one's complement) is
- performed within this function so it shouldn't be done by the application.
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
-/*
- Combine two CRC-32 check values into one. For two sequences of bytes,
- seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
- calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
- check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
- inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, sizeof(z_stream))
-
-
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/funtools/util/zlib-1.2.3/zutil.c b/funtools/util/zlib-1.2.3/zutil.c
deleted file mode 100644
index d55f594..0000000
--- a/funtools/util/zlib-1.2.3/zutil.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include "zutil.h"
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-const char * const z_errmsg[10] = {
-"need dictionary", /* Z_NEED_DICT 2 */
-"stream end", /* Z_STREAM_END 1 */
-"", /* Z_OK 0 */
-"file error", /* Z_ERRNO (-1) */
-"stream error", /* Z_STREAM_ERROR (-2) */
-"data error", /* Z_DATA_ERROR (-3) */
-"insufficient memory", /* Z_MEM_ERROR (-4) */
-"buffer error", /* Z_BUF_ERROR (-5) */
-"incompatible version",/* Z_VERSION_ERROR (-6) */
-""};
-
-
-const char * ZEXPORT zlibVersion()
-{
- return ZLIB_VERSION;
-}
-
-uLong ZEXPORT zlibCompileFlags()
-{
- uLong flags;
-
- flags = 0;
- switch (sizeof(uInt)) {
- case 2: break;
- case 4: flags += 1; break;
- case 8: flags += 2; break;
- default: flags += 3;
- }
- switch (sizeof(uLong)) {
- case 2: break;
- case 4: flags += 1 << 2; break;
- case 8: flags += 2 << 2; break;
- default: flags += 3 << 2;
- }
- switch (sizeof(voidpf)) {
- case 2: break;
- case 4: flags += 1 << 4; break;
- case 8: flags += 2 << 4; break;
- default: flags += 3 << 4;
- }
- switch (sizeof(z_off_t)) {
- case 2: break;
- case 4: flags += 1 << 6; break;
- case 8: flags += 2 << 6; break;
- default: flags += 3 << 6;
- }
-#ifdef DEBUG
- flags += 1 << 8;
-#endif
-#if defined(ASMV) || defined(ASMINF)
- flags += 1 << 9;
-#endif
-#ifdef ZLIB_WINAPI
- flags += 1 << 10;
-#endif
-#ifdef BUILDFIXED
- flags += 1 << 12;
-#endif
-#ifdef DYNAMIC_CRC_TABLE
- flags += 1 << 13;
-#endif
-#ifdef NO_GZCOMPRESS
- flags += 1L << 16;
-#endif
-#ifdef NO_GZIP
- flags += 1L << 17;
-#endif
-#ifdef PKZIP_BUG_WORKAROUND
- flags += 1L << 20;
-#endif
-#ifdef FASTEST
- flags += 1L << 21;
-#endif
-#ifdef STDC
-# ifdef NO_vsnprintf
- flags += 1L << 25;
-# ifdef HAS_vsprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#else
- flags += 1L << 24;
-# ifdef NO_snprintf
- flags += 1L << 25;
-# ifdef HAS_sprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_snprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#endif
- return flags;
-}
-
-#ifdef DEBUG
-
-# ifndef verbose
-# define verbose 0
-# endif
-int z_verbose = verbose;
-
-void z_error (m)
- char *m;
-{
- fprintf(stderr, "%s\n", m);
- exit(1);
-}
-#endif
-
-/* exported to allow conversion of error code to string for compress() and
- * uncompress()
- */
-const char * ZEXPORT zError(err)
- int err;
-{
- return ERR_MSG(err);
-}
-
-#if defined(_WIN32_WCE)
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used.
- */
- int errno = 0;
-#endif
-
-#ifndef HAVE_MEMCPY
-
-void zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
-}
-
-int zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
-{
- uInt j;
-
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
-}
-
-void zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
-}
-#endif
-
-
-#ifdef SYS16BIT
-
-#ifdef __TURBOC__
-/* Turbo C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
- * and farmalloc(64K) returns a pointer with an offset of 8, so we
- * must fix the pointer. Warning: the pointer must be put back to its
- * original form in order to free it, use zcfree().
- */
-
-#define MAX_PTR 10
-/* 10*64K = 640K */
-
-local int next_ptr = 0;
-
-typedef struct ptr_table_s {
- voidpf org_ptr;
- voidpf new_ptr;
-} ptr_table;
-
-local ptr_table table[MAX_PTR];
-/* This table is used to remember the original form of pointers
- * to large buffers (64K). Such pointers are normalized with a zero offset.
- * Since MSDOS is not a preemptive multitasking OS, this table is not
- * protected from concurrent access. This hack doesn't work anyway on
- * a protected system like OS/2. Use Microsoft C instead.
- */
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- voidpf buf = opaque; /* just to make some compilers happy */
- ulg bsize = (ulg)items*size;
-
- /* If we allocate less than 65520 bytes, we assume that farmalloc
- * will return a usable pointer which doesn't have to be normalized.
- */
- if (bsize < 65520L) {
- buf = farmalloc(bsize);
- if (*(ush*)&buf != 0) return buf;
- } else {
- buf = farmalloc(bsize + 16L);
- }
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
- table[next_ptr].org_ptr = buf;
-
- /* Normalize the pointer to seg:0 */
- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
- *(ush*)&buf = 0;
- table[next_ptr++].new_ptr = buf;
- return buf;
-}
-
-void zcfree (voidpf opaque, voidpf ptr)
-{
- int n;
- if (*(ush*)&ptr != 0) { /* object < 64K */
- farfree(ptr);
- return;
- }
- /* Find the original pointer */
- for (n = 0; n < next_ptr; n++) {
- if (ptr != table[n].new_ptr) continue;
-
- farfree(table[n].org_ptr);
- while (++n < next_ptr) {
- table[n-1] = table[n];
- }
- next_ptr--;
- return;
- }
- ptr = opaque; /* just to make some compilers happy */
- Assert(0, "zcfree: ptr not found");
-}
-
-#endif /* __TURBOC__ */
-
-
-#ifdef M_I86
-/* Microsoft C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
-# define _halloc halloc
-# define _hfree hfree
-#endif
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- return _halloc((long)items, size);
-}
-
-void zcfree (voidpf opaque, voidpf ptr)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- _hfree(ptr);
-}
-
-#endif /* M_I86 */
-
-#endif /* SYS16BIT */
-
-
-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-voidpf zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
- if (opaque) items += size - size; /* make compiler happy */
- return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
- (voidpf)calloc(items, size);
-}
-
-void zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
- free(ptr);
- if (opaque) return; /* make compiler happy */
-}
-
-#endif /* MY_ZCALLOC */
diff --git a/funtools/util/zlib-1.2.3/zutil.h b/funtools/util/zlib-1.2.3/zutil.h
deleted file mode 100644
index b7d5eff..0000000
--- a/funtools/util/zlib-1.2.3/zutil.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZUTIL_H
-#define ZUTIL_H
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-#ifdef STDC
-# ifndef _WIN32_WCE
-# include <stddef.h>
-# endif
-# include <string.h>
-# include <stdlib.h>
-#endif
-#ifdef NO_ERRNO_H
-# ifdef _WIN32_WCE
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used. We rename it to
- * avoid conflict with other libraries that use the same workaround.
- */
-# define errno z_errno
-# endif
- extern int errno;
-#else
-# ifndef _WIN32_WCE
-# include <errno.h>
-# endif
-#endif
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long ulg;
-
-extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
-/* (size given to avoid silly warnings with Visual C++) */
-
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
-
-#define ERR_RETURN(strm,err) \
- return (strm->msg = (char*)ERR_MSG(err), (err))
-/* To be used only when the state is known to be valid */
-
- /* common constants */
-
-#ifndef DEF_WBITS
-# define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES 2
-/* The three kinds of block type */
-
-#define MIN_MATCH 3
-#define MAX_MATCH 258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
- /* target dependencies */
-
-#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
-# define OS_CODE 0x00
-# if defined(__TURBOC__) || defined(__BORLANDC__)
-# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
- /* Allow compilation with ANSI keywords only enabled */
- void _Cdecl farfree( void *block );
- void *_Cdecl farmalloc( unsigned long nbytes );
-# else
-# include <alloc.h>
-# endif
-# else /* MSC or DJGPP */
-# include <malloc.h>
-# endif
-#endif
-
-#ifdef AMIGA
-# define OS_CODE 0x01
-#endif
-
-#if defined(VAXC) || defined(VMS)
-# define OS_CODE 0x02
-# define F_OPEN(name, mode) \
- fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
-#endif
-
-#if defined(ATARI) || defined(atarist)
-# define OS_CODE 0x05
-#endif
-
-#ifdef OS2
-# define OS_CODE 0x06
-# ifdef M_I86
- #include <malloc.h>
-# endif
-#endif
-
-#if defined(MACOS) || defined(TARGET_OS_MAC)
-# define OS_CODE 0x07
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-#endif
-
-#ifdef TOPS20
-# define OS_CODE 0x0a
-#endif
-
-#ifdef WIN32
-# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
-# define OS_CODE 0x0b
-# endif
-#endif
-
-#ifdef __50SERIES /* Prime/PRIMOS */
-# define OS_CODE 0x0f
-#endif
-
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600))
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
- /* common defaults */
-
-#ifndef OS_CODE
-# define OS_CODE 0x03 /* assume Unix */
-#endif
-
-#ifndef F_OPEN
-# define F_OPEN(name, mode) fopen((name), (mode))
-#endif
-
- /* functions */
-
-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-#if defined(__CYGWIN__)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-#ifndef HAVE_VSNPRINTF
-# ifdef MSDOS
- /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
- but for now we just assume it doesn't. */
-# define NO_vsnprintf
-# endif
-# ifdef __TURBOC__
-# define NO_vsnprintf
-# endif
-# ifdef WIN32
- /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-# if !defined(vsnprintf) && !defined(NO_vsnprintf)
-# define vsnprintf _vsnprintf
-# endif
-# endif
-# ifdef __SASC
-# define NO_vsnprintf
-# endif
-#endif
-#ifdef VMS
-# define NO_vsnprintf
-#endif
-
-#if defined(pyr)
-# define NO_MEMCPY
-#endif
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
- * You may have to use the same strategy for Borland C (untested).
- * The __SC__ check is for Symantec.
- */
-# define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-# define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-# define zmemcpy _fmemcpy
-# define zmemcmp _fmemcmp
-# define zmemzero(dest, len) _fmemset(dest, 0, len)
-# else
-# define zmemcpy memcpy
-# define zmemcmp memcmp
-# define zmemzero(dest, len) memset(dest, 0, len)
-# endif
-#else
- extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- extern void zmemzero OF((Bytef* dest, uInt len));
-#endif
-
-/* Diagnostic functions */
-#ifdef DEBUG
-# include <stdio.h>
- extern int z_verbose;
- extern void z_error OF((char *m));
-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-# define Trace(x) {if (z_verbose>=0) fprintf x ;}
-# define Tracev(x) {if (z_verbose>0) fprintf x ;}
-# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
-# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
-# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
-#else
-# define Assert(cond,msg)
-# define Trace(x)
-# define Tracev(x)
-# define Tracevv(x)
-# define Tracec(c,x)
-# define Tracecv(c,x)
-#endif
-
-
-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-void zcfree OF((voidpf opaque, voidpf ptr));
-
-#define ZALLOC(strm, items, size) \
- (*((strm)->zalloc))((strm)->opaque, (items), (size))
-#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
-
-#endif /* ZUTIL_H */
diff --git a/funtools/util/zprocess.c b/funtools/util/zprocess.c
deleted file mode 100644
index 6abf3af..0000000
--- a/funtools/util/zprocess.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * zprocess.c -- routines to start up and communicate with a slave process
- *
- * based on zfiopr.c from NOAO IRAF system (more loosely than previously,
- * since we replaces the fork/exec with our own Launch()).
- *
- */
-
-#include <zprocess.h>
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-/*
- *
- * Private Routines
- *
- *
- */
-
-static int pr_debug = 0;
-
-/*
- *
- * Process table management code
- *
- */
-
-#define MAXPROCS 512
-
-static struct proctable {
- int pr_pid; /* process id */
- int pr_active; /* if YES, process is still active */
- int pr_inchan; /* input IPC channel */
- int pr_outchan; /* output IPC channel */
- int pr_exit_status; /* process exit_status */
-} prtable[MAXPROCS];
-
-/* PR_FINDPID -- Search the process table for a process. NULL is returned if
- * the process cannot be found, otherwise a pointer to the table entry is
- * returned.
- */
-#ifdef ANSI_FUNC
-static struct proctable *pr_findpid(int pid)
-#else
-static struct proctable *pr_findpid(pid)
- int pid;
-#endif
-{
- register int pr;
-
- for (pr=0; pr<MAXPROCS; pr++){
- if (prtable[pr].pr_pid == pid)
- return (&prtable[pr]);
- }
- return (NULL);
-}
-
-/* PR_ENTER -- Make a new entry in the process table. Something is very wrong
- * if the table overflows.
- */
-#ifdef ANSI_FUNC
-static int pr_enter(int pid, int inchan, int outchan)
-#else
-static int pr_enter(pid, inchan, outchan)
- int pid;
- int inchan, outchan;
-#endif
-{
- int pr;
-
- for (pr=0; pr<MAXPROCS; pr++){
- if (prtable[pr].pr_pid == 0){
- prtable[pr].pr_pid = pid;
- prtable[pr].pr_active = 1;
- prtable[pr].pr_inchan = inchan;
- prtable[pr].pr_outchan = outchan;
- return(1);
- }
- }
- return(0);
-}
-
-/* PR_GETCHAN -- Get the codes for the IPC channels assigned to a process.
- */
-#ifdef ANSI_FUNC
-static int pr_getchan (int pid, int *inchan, int *outchan)
-#else
-static int pr_getchan (pid, inchan, outchan)
- int pid;
- int *inchan, *outchan;
-#endif
-{
- register struct proctable *pr;
-
- /* Lookup process in table. Return an error if there is no entry.
- */
- if ((pr = pr_findpid(pid)) == NULL)
- return(-1);
- else {
- *inchan = pr->pr_inchan;
- *outchan = pr->pr_outchan;
- return (pid);
- }
-}
-
-/* PR_RELEASE -- Release the table entry for the process. Used when a process
- * is killed and we do not wish to wait for process termination.
- */
-#ifdef ANSI_FUNC
-static void pr_release (int pid)
-#else
-static void pr_release (pid)
- int pid;
-#endif
-{
- register struct proctable *pr;
-
- if ((pr = pr_findpid (pid)) != NULL){
- pr->pr_pid = 0;
- pr->pr_active = 0;
- pr->pr_inchan = 0;
- pr->pr_outchan = 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------------
- *
- * Routine: PRSleep
- *
- * Purpose: sleep for specified milliseconds
- *
- * Returns: none
- *
- *----------------------------------------------------------------------------
- */
-#ifdef ANSI_FUNC
-static void PRSleep (int msec)
-#else
-static void PRSleep(msec)
- int msec;
-#endif
-{
- struct timeval tv;
-
- if( msec > 0 ){
- tv.tv_sec = msec / 1000;
- tv.tv_usec = (msec % 1000) * 1000;
- select(1, NULL, NULL, NULL, &tv);
- }
-}
-
-/*
- *
- * Public Routines
- *
- *
- */
-
-
-#ifdef ANSI_FUNC
-int ProcessOpen(char *cmd, int *inchan, int *outchan, int *pid)
-#else
-int ProcessOpen(cmd, argv, inchan, outchan, pid)
- char *cmd; /* command line to Launch */
- int *inchan, *outchan; /* IPC channels (parent reads inchan) */
- int *pid; /* returned process id */
-#endif
-{
- int pipes[2];
- if( Launch(cmd, 0, NULL, pipes) != 0 ){
- /* failure */
- *inchan = -1;
- *outchan = -1;
- *pid = 0;
- return 0;
- }
- else{
- /* package up process info for return */
- *inchan = pipes[0];
- *outchan = pipes[1];
- *pid = LaunchPid();
- /* and also save process info for later */
- pr_enter (*pid, *inchan, *outchan);
- /* success */
- return 1;
- }
-}
-
-/*
- *
- * ProcessClose -- Close a connected subprocess and
- * wait for subprocess to terminate.
- *
- */
-#ifdef ANSI_FUNC
-int ProcessClose(int pid, int *exit_status)
-#else
-int ProcessClose(pid, exit_status)
- int pid;
- int *exit_status;
-#endif
-{
- int inchan, outchan;
- int tries=0;
-
- if (pr_getchan (pid, &inchan, &outchan) == -1)
- *exit_status = 0;
- else {
- close (outchan);
- close (inchan);
- pr_release(pid);
-#if HAVE_MINGW32==0
-retry:
- if( (waitpid(pid, exit_status, WNOHANG)==0) && (tries<10) ){
- PRSleep(10);
- tries++;
- goto retry;
- }
-#endif
- }
- if (pr_debug)
- fprintf (stderr, "[%d] terminated, exit code %d\n",
- pid, *exit_status);
- return(*exit_status);
-}
-
-
-/*
- *
- * ProcessRead -- Read next record from an IPC channel.
- *
- * Since UNIX pipes are byte streams we must take special measures to
- * transmit data through a pipe in records.
- * Each block of data is preceded by a header of sizeof(int) consisting
- * containing the number of bytes in the block.
- * To read a block we must read the count and then issue successive read
- * requests until the entire block has been read.
- *
-*/
-#ifdef ANSI_FUNC
-void *ProcessRead(int fd, void *buf, int maxbytes, int *got)
-#else
-void *ProcessRead(fd, buf, maxbytes, got)
- int fd;
- void *buf;
- int maxbytes;
- int *got;
-#endif
-{
- register char *op;
- register int nbytes;
- char *obuf;
- int record_length, status;
- int temp;
-
- /* no data read as yet */
- *got = 0;
-
- if (pr_debug)
- fprintf (stderr,
- "[%d] initiate read for %d bytes from IPC channel %d\n",
- (int)getpid(), maxbytes, fd);
-
- /* Get byte count of record.
- */
- if (read (fd, &temp, sizeof(int)) != sizeof(int))
- return NULL;
-
- record_length = temp;
- if( maxbytes >= 0 )
- nbytes = min(record_length, maxbytes);
- else
- nbytes = record_length;
-
- /* allocate output buffer, if necessary */
- if( buf )
- obuf = buf;
- else{
- obuf = (char *)malloc(nbytes);
- if( !obuf )
- return NULL;
- }
- op = (char *)obuf;
-
- /* Now read exactly nbytes of data from channel into user buffer.
- * Return actual byte count if EOF is seen. If an error is seen, return.
- * If necessary multiple read requests are issued to read the
- * entire record.
- */
- while (nbytes > 0)
- switch (status = read (fd, op, nbytes)) {
- case -1:
- if( !buf ) free(obuf);
- *got = 0;
- return NULL;
- case 0:
- return(obuf);
- default:
- nbytes -= status;
- *got += status;
- op += status;
- }
-
- if (pr_debug) {
- fprintf (stderr, "[%d] read %d bytes from IPC channel %d:\n",
- (int)getpid(), (int)(op - (char *)buf), fd);
- }
-
- /* If the record is larger than maxbytes, we must read and discard
- * the additional bytes. The method used is inefficient but it is
- * unlikely that we will be called to read less than a full record.
- */
- if( maxbytes >= 0 ){
- for (nbytes = maxbytes; nbytes < record_length; nbytes++)
- if (read (fd, &temp, 1) <= 0)
- break;
- }
-
- return(obuf);
-}
-
-/*
- *
- * ProcessWrite -- Write to an IPC channel.
- * Write the IPC block header followed by the data block.
- *
-*/
-#ifdef ANSI_FUNC
-int ProcessWrite(int fd, void *buf, int nbytes)
-#else
-int ProcessWrite(fd, buf, nbytes)
- int fd;
- void *buf;
- int nbytes;
-#endif
-{
- int got;
-
- /* write byte count */
- write(fd, &nbytes, sizeof(int));
-
- /* write data block */
- got = write(fd, buf, nbytes);
-
- if (pr_debug) {
- fprintf (stderr, "[%d] wrote %d bytes to IPC channel %d:\n",
- (int)getpid(), (int)nbytes, fd);
- }
-
- return(got);
-}
-
-/*
- * ProcessGetChan -- Get the codes for the IPC channels assigned to a process.
- */
-#ifdef ANSI_FUNC
-int ProcessGetChan (int pid, int *inchan, int *outchan)
-#else
-int ProcessGetChan (pid, inchan, outchan)
- int pid;
- int *inchan, *outchan;
-#endif
-{
- return pr_getchan(pid, inchan, outchan);
-}
diff --git a/funtools/util/zprocess.h b/funtools/util/zprocess.h
deleted file mode 100644
index a1e3f51..0000000
--- a/funtools/util/zprocess.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory
- */
-
-/*
- *
- * zprocess.h - include file for the process handling
- *
- * (NB: not called process.h because of a name conflict with cygwin)
- *
- */
-
-#ifndef __zprocess_h
-#define __zprocess_h
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <sys/time.h>
-#include <signal.h>
-#include "xlaunch.h"
-#include "find.h"
-
-_PRbeg
-
-int ProcessOpen _PRx((char *cmd, int *inchan, int *outchan, int *pid));
-void *ProcessRead _PRx((int fd, void *buf, int maxbytes, int *got));
-int ProcessWrite _PRx((int fd, void *buf, int nbytes));
-int ProcessClose _PRx((int pid, int *exit_status));
-int ProcessGetChan _PRx((int pid, int *inchan, int *outchan));
-
-_PRend
-
-#endif /* __zprocess.h */
diff --git a/funtools/wcs/COPYING b/funtools/wcs/COPYING
deleted file mode 100644
index 6320024..0000000
--- a/funtools/wcs/COPYING
+++ /dev/null
@@ -1,460 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/funtools/wcs/Files b/funtools/wcs/Files
deleted file mode 100644
index 94d18da..0000000
--- a/funtools/wcs/Files
+++ /dev/null
@@ -1,179 +0,0 @@
-WCSTools libwcs Subroutines (3.9.0, March 11, 2011)
-
-actread.c
- Return stars from the USNO ACT Reference Catalog
-binread.c
- Return stars from catalog files in the TDC binary catalog format
-catread.c
- Return stars from catalog files in the TDC ASCII catalog format
-catutil.c
- Subroutines for catalog identification and number range decoding
-cel.c
- WCSLIB spherical coordinate transformation drivers
-daoread.c
- Read x, y, and magnitude from DAOFIND output file and return x, y, and
- flux for use by IMSTAR or IMWCS.
-dateutil.c
- Subroutines for conversions between various date and time formats
-distort.c
- Subroutines for conversions between image pixel and focal plane coordinates
-dsspos.c
- dsspos() uses the WCS structure to compute sky coordinates given
- image pixel X and Y for images with Digitized Sky Survey plate solutions
- in their headers. dsspix() uses the WCS structure to compute image
- pixel X and Y given sky coordinates for DSS images. Algorithms from
- StSCI CASB.
-fileutil.c
- Subroutines for finding size and contents of ASCII files
-findstar.c
- findStars() gets the location and brightest pixel of stars in the given
- image. Included are subroutines to find and reject bright pixels and
- compute a star centroid.
-fitsfile.c
- FITS header and image reading and writing subroutines, including FITS
- table support.
-fitswcs.c
- GetWCSFITS() returns a WCS structure used by wcs.c subroutines from a FITS
- or IRAF .imh image, reading only the header.
- GetFITShead() returns a FITS header from a FITS or IRAF .imh image.
- DelWCS() delete the WCS keywords in a FITS header.
-fortcat.c
- Fortran wrapper subroutines for catalog reading subroutines ctgread() and ctgrnum()
-fortwcs.c
- Fortran wrapper subroutines for all useful subroutines in wcs.c and wcsinit.c
-gscread.c
- Return HST Guide Stars from standard CDROM format FITS table files for
- a given RA, Dec, and magnitude range or list of star numbers.
-gsc2read.c
- Return GSC II Stars using an HTTP query over the web for
- a given RA, Dec, and magnitude range or list of star numbers.
-hget.c
- Subroutines to extract values from FITS headers by keyword.
- Subroutines for parsing RA and Dec strings are included.
-hput.c
- Subroutines to implant values into FITS headers by keyword (and to
- delete headers).
-iget.c
- Subroutines to extract values from IRAF multi-keyword header parameters
-imhfile.c
- IRAF header and image reading and writing subroutines. IRAF headers
- are converted to FITS headers for use by other programs and can be
- derived from FITS headers for writing.
-imio.c
- Subroutines to get, put, and move pixels of various data types between images
- im memory and a program.
-imrotate.c
- RotFITS() rotates an image by 90, 180, or 270 degrees, with an optional
- left-right reflection before the rotation.
-imgetwcs.c
- GetWCSFITS() reads world coordinate system header information and returns
- the image center coordinates and size as well as the wcs data structure.
-imsetwcs.c
- SetWCSFITS() uses findStars to find the stars in an image, gscread to
- find the Guide Stars in the nominal image region, and findRegisration or
- findCoords to fit plate-tangent WCS to the image.
-lin.c
- WCSLIB linear transformation subroutines
-matchstar.c
- StarMatch() takes a list of reference star positions and a list
- of object coordinates from an image and finds the image pixels
- which correspond to each of the reference stars. It then uses these
- matches to get an image center, plate scale, and rotation. The actual
- fit is based on the amoeba subroutine in Numerical Recipes, and all
- necessary subroutines are included.
-platepos.c
- platepos() uses the WCS structure to compute sky coordinates given
- image pixel X and Y for images with polynomial plate solutions
- in their headers. platepix() uses the WCS structure to compute image
- pixel X and Y given sky coordinates for such images. Algorithms are based
- on those in dsspos.c, but go straight from pixels to angles without an
- intermediate plate coordinate.
-poly.c
- Polynomial evaluation for SCAMP distortion correction
-proj.c
- WCSLIB spherical map projection subroutines
-sdssread.c
- Return Sloan Digital Sky Survey Photometry Catalog sources using an
- HTTP query over the web for a given RA, Dec, and magnitude range.
-sortstars.c
- Subroutines to sort lists of stars by right ascension, magnitude, or flux
-sph.c
- WCSLIB spherical coordinate transformation subroutines
-tabread.c
- Return stars from a tab table format catalog file for a given RA, Dec,
- and magnitude range or list of star numbers. Based on John Roll's
- Starbase format.
-tmcread.c
- Return 2MASS Point Source Catalog stars from the catalog as ungzipped from
- the DVD into (or linked from) a common root directory for a given RA, Dec,
- and magnitude range or list of star numbers. Both IDR2 and All-Sky release
- formats are supported.
-tnxpos.c
- tnxpos() uses the WCS keywords set up for IRAF's TNX projection to compute
- sky coordinates given image pixel X and Y. tnxpix() uses the WCS structure
- to compute image pixel X and Y given sky coordinates for such images. The
- projection is a tangent plane with corrections between the rotation and
- scaling and the actual projection.
-uacread.c
- Return USNO A and SA Catalog stars from their standard CDROM format
- files for a given RA, Dec, and magnitude range or list of star numbers.
-ubcread.c
- Return USNO B Catalog stars from their standard format files for a
- given RA, Dec, and magnitude range or list of star numbers.
-ucacread.c
- Return USNO UCAC1, UCAC2, or UCAC3 Catalog stars from their standard format
- files for a given RA, Dec, and magnitude range or list of star numbers.
-ujcread.c
- Return USNO UJ Catalog stars from its standard CDROM format files for
- a given RA, Dec, and magnitude range or list of star numbers.
-wcs.c
- Subroutines for using FITS or IRAF header spatial world coordinate
- system information.
-wcsinit.c
- Subroutines to initialize WCS structure from a FITS header
-wcscon.c
- Subroutines for converting between B1950, J2000, and galactic
- coordinates, mostly based on Starlink SLA_LIB subroutines.
-webread.c
- Open Starbase files across the Internet using HTTP queries
-worldpos.c
- worldpos() uses the WCS structure to compute sky coordinates given
- image pixel X and Y for images with header information for any of 8
- standard world coordinate systems. worldpix() uses the WCS structure
- to compute image pixel X and Y given sky coordinates for the same images.
- Mostly from NRAO.
-zpxpos.c
- zpxpos() uses the WCS keywords set up for IRAF's ZPX projection to
- compute sky coordinates given image pixel X and Y. zpxpix() uses
- the WCS structure to compute image pixel X and Y given sky coordinates
- for such images. The projection is a tangent plane with corrections
- between the rotation and scaling and the actual projection.
-
-fitshead.h
- Declarations of FITS header access subroutines
-fitsfile.h
- Declarations of image access subroutines and FITS table data structure.
-imio.h
- Declarations of subroutines to convert binary formats of numbers
-lwcs.h
- Constants used by star-finding and WCS-setting subroutines
-wcscat.h
- Declarations for star catalog data structures
-wcs.h
- Declaration of WCS data structure and useful conversions.
-wcslib.h
- Declarations for WCSLIB high level driver subroutines, trig and inverse
- trig functions, spherical map projection subroutines, spherical coordinate
- transformation drivers, and linear transformation subroutines
-
-* Notes:
- WCSLIB subroutines were written by Mark Calabretta of CSIRO and have
- been modified in several ways:
- 1) His distributed wcs.h has been changed to wcslib.h, and
- 2) wcstrig.c subroutine names have been changed from <function>d()
- to <function>deg() to avoid name conflicts on some operating
- systems.
- 3) ifndef's at start of headers files have been named to reflect
- the names of the header files, i.e. wcslib_h_ in wcslib.h.
- 4) All header files have been combined into wcslib.h
- 5) Emmanuel Bertin's SCAMP distortion has been added to proj.c:1
diff --git a/funtools/wcs/Makefile-orig b/funtools/wcs/Makefile-orig
deleted file mode 100644
index 9caa507..0000000
--- a/funtools/wcs/Makefile-orig
+++ /dev/null
@@ -1,36 +0,0 @@
-OBJS = wcsinit.o wcs.o wcscon.o fitsfile.o imhfile.o \
- hget.o hput.o iget.o imio.o worldpos.o platepos.o \
- tnxpos.o zpxpos.o dsspos.o poly.o \
- wcslib.o lin.o cel.o proj.o sph.o wcstrig.o dateutil.o distort.o
-
-libwcs.a: $(OBJS)
- ar rv $@ $?
- ranlib $@
-
-cel.o: wcslib.h
-distort.o: wcs.h fitshead.h wcslib.h
-fitsfile.o: fitsfile.h fitshead.h
-hget.o: fitshead.h
-hput.o: fitshead.h
-iget.o: fitshead.h
-imhfile.o: fitsfile.h fitshead.h
-imio.o: fitshead.h
-lin.o: wcslib.h
-platepos.o: wcs.h fitshead.h wcslib.h
-poly.o: wcslib.h
-proj.o: wcslib.h
-sph.o: wcslib.h
-tnxpos.o: wcs.h fitshead.h wcslib.h
-zpxpos.o: wcs.h fitshead.h wcslib.h
-wcs.o: wcs.h fitshead.h wcslib.h
-wcsinit.o: wcs.h fitshead.h wcslib.h
-wcscon.o: wcs.h fitshead.h wcslib.h
-wcslib.o: wcslib.h
-wcstrig.o: wcslib.h
-worldpos.o: wcs.h fitshead.h wcslib.h
-dateutil.o: fitsfile.h fitshead.h
-fileutil.o: fitsfile.h
-
-clean:
- rm -f *.a *.o
-
diff --git a/funtools/wcs/Makefile.in b/funtools/wcs/Makefile.in
deleted file mode 100644
index 53ed80a..0000000
--- a/funtools/wcs/Makefile.in
+++ /dev/null
@@ -1,206 +0,0 @@
-#
-# This file is a Makefile for wcssubs. If it has the name "Makefile.in"
-# then it is a template for a Makefile; to generate the actual Makefile,
-# run "./configure", which is a configuration script generated by the
-# "autoconf" program (constructs like "@foo@" will get replaced in the
-# actual Makefile.
-#
-
-PACKAGE = @PACKAGE_NAME@
-VERSION = @PACKAGE_VERSION@
-
-DISTNAME = wcs-${VERSION}
-DISTDIR = ../export/${DISTNAME}
-FTPDIR = ../ftp
-
-#----------------------------------------------------------------
-# Things you can change to personalize the Makefile for your own
-# site (you can make these changes in either Makefile.in or
-# Makefile, but changes to Makefile will get lost if you re-run
-# the configuration script).
-#----------------------------------------------------------------
-
-# Default top-level directories in which to install architecture-
-# specific files (exec_prefix) and machine-independent files such
-# as scripts (prefix). The values specified here may be overridden
-# at configure-time with the --exec-prefix and --prefix options
-# to the "configure" script.
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-# The following definition can be set to non-null for special systems
-# like AFS with replication. It allows the pathnames used for installation
-# to be different than those used for actually reference files at
-# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix
-# when installing files.
-INSTALL_ROOT =
-
-# Directory in which to install the .a or .so binary for the WCS library:
-LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib
-
-# Directory in which to install the program wish:
-BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin
-
-# Directory in which to install the include file wcs.h:
-INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include
-
-# To change the compiler switches, for example to change from -O
-# to -g, change the following line:
-CFLAGS = @CFLAGS@
-
-# To add ld switches, change the following line:
-LDFLAGS = @LDFLAGS@
-
-# Some versions of make, like SGI's, use the following variable to
-# determine which shell to use for executing commands:
-SHELL = /bin/sh
-
-# extra modules added by configure.in to fix OS bugs
-EXTRA_OBJS = @EXTRA_OBJS@
-
-# There are just too many different versions of "install" around;
-# better to use the install-sh script that comes with the distribution,
-# which is slower but guaranteed to work.
-
-INSTALL = @srcdir@/install-sh -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-
-#----------------------------------------------------------------
-# The information below is modified by the configure script when
-# Makefile is generated from Makefile.in. You shouldn't normally
-# modify any of this stuff by hand.
-#----------------------------------------------------------------
-
-AC_FLAGS = @DEFS@
-RANLIB = @RANLIB@
-
-#----------------------------------------------------------------
-# The information below should be usable as is. The configure
-# script won't modify it and you shouldn't need to modify it
-# either.
-#----------------------------------------------------------------
-
-CC = @CC@
-
-CC_SWITCHES = -I. ${CFLAGS} -DWCS_VERSION="\"$(VERSION)\"" ${AC_FLAGS}
-
-DEPEND_SWITCHES = -I. ${CFLAGS} ${AC_FLAGS}
-
-SRCS = wcsinit.c wcs.c wcscon.c fitsfile.c imhfile.c fileutil.c \
- hget.c hput.c iget.c imio.c worldpos.c tnxpos.c dsspos.c platepos.c \
- wcslib.c lin.c cel.c proj.c sph.c wcstrig.c dateutil.c distort.c \
- zpxpos.c
-
-OBJS = wcsinit.o wcs.o wcscon.o fitsfile.o imhfile.o \
- hget.o hput.o iget.o imio.o worldpos.o platepos.o \
- tnxpos.o zpxpos.o dsspos.o poly.o \
- wcslib.o lin.o cel.o proj.o sph.o wcstrig.o dateutil.o distort.o
-
-# these are all the modules going into the "normal" wcs library
-LIBOBJS = ${OBJS}
-
-# whether to build library at all
-WHICHLIB = @WHICHLIB@
-EXTLIB = @EXTLIB@
-
-# the default library for this package
-DEFLIB = @DEFLIB@
-# the actual library we are building (if this is a subpackage)
-LIB = @LIB@
-
-PROGS =
-
-TESTPROGS =
-
-all: $(WHICHLIB) $(PROGS)
-
-testall: $(TESTPROGS)
-
-All: all testall
-
-install: install-binaries
-
-extlib:
- @echo "No build needed -- using external WCS library: $(EXTLIB)"
-
-lib: $(LIBOBJS)
- ar cruv $(LIB) $(LIBOBJS)
- $(RANLIB) $(LIB)
-
-# Note: before running ranlib below, must cd to target directory because
-# some ranlibs write to current directory, and this might not always be
-# possible (e.g. if installing as root).
-
-install-binaries: $(LIB) $(PROGS)
- @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \
- do \
- if [ ! -d $$i ] ; then \
- echo "Making directory $$i"; \
- mkdir $$i; \
- chmod 755 $$i; \
- else true; \
- fi; \
- done;
- @if [ "$(LIB)" = "$(DEFLIB)" ] ; then \
- XLIB=`basename $(LIB)`; \
- echo "Installing $$XLIB"; \
- $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \
- (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \
- chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \
- fi;
- @echo "Installing fitshead.h"
- @$(INSTALL_DATA) fitshead.h $(INCLUDE_INSTALL_DIR)/fitshead.h
- @echo "Installing wcs.h"
- @$(INSTALL_DATA) wcs.h $(INCLUDE_INSTALL_DIR)/wcs.h
- @echo "Installing wcslib.h"
- @$(INSTALL_DATA) wcslib.h $(INCLUDE_INSTALL_DIR)/wcslib.h
-
-Makefile: Makefile.in
- $(SHELL) config.status
-
-RM = rm -f
-
-clean:
- $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \
- foo* *~ *.log \#* TAGS *.E a.out errors \
- $(PROGS) $(TESTPROGS) \
- gmon.out *.pg *.bak \
- config.info config.log \
- doc/*~
- $(RM) -r autom4te.cache
-
-distclean: clean
- $(RM) Makefile config.status config.cache config.log
-
-depend:
- makedepend -- $(DEPEND_SWITCHES) -- $(SRCS)
-
-
-.c.o:
- $(CC) -c $(CC_SWITCHES) $<
-
-cel.o: wcslib.h
-distort.o: wcs.h fitshead.h wcslib.h
-fitsfile.o: fitsfile.h fitshead.h
-hget.o: fitshead.h
-hput.o: fitshead.h
-iget.o: fitshead.h
-imhfile.o: fitsfile.h fitshead.h
-imio.o: fitshead.h
-lin.o: wcslib.h
-platepos.o: wcs.h fitshead.h wcslib.h
-proj.o: wcslib.h
-sph.o: wcslib.h
-tnxpos.o: wcs.h fitshead.h wcslib.h
-wcs.o: wcs.h fitshead.h wcslib.h
-wcsinit.o: wcs.h fitshead.h wcslib.h
-wcscon.o: wcs.h fitshead.h wcslib.h
-wcslib.o: wcslib.h
-wcstrig.o: wcslib.h
-worldpos.o: wcs.h fitshead.h wcslib.h
-dateutil.o: fitsfile.h fitshead.h
-fileutil.o: fitsfile.h
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/funtools/wcs/NEWS b/funtools/wcs/NEWS
deleted file mode 100644
index 73db1fe..0000000
--- a/funtools/wcs/NEWS
+++ /dev/null
@@ -1,473 +0,0 @@
-WCSTools WCS subroutine library release history
-
-Version 3.8.7 (October 19, 2012)
-dateutil.c: Unused l0 dropped from jd2lst(); ts2ss from jd2mst()
-imio.c: Fix errors with character images in minvec() and maxvec()
-wcs.c: Drop d1 and d2 from wcsdist(); diffi from wcsdist1()
-wcs.c: Drop depwcs; it's in main wcs structure
-wcsinit.c: Drop unused variable iszpx; fix bug in latmin assignment
-
-catutil.c: Skip trailing right bracket in aget*()
-
-Version 3.8.6 (August 10, 2012)
-All: Update author name
-imio.c: Fix 8-bit variables to be unsigned char
-
-Version 3.8.5 (April 12, 2012)
-imio.c: Change 8-bit pixel values from char to unsigned char
-fitsfile.c: Always check first 8 characters of FITS files for "SIMPLE"
-
-Version 3.8.4 (September 1, 2011)
-imgetwcs.c, wcsinit.c, wcs.c, wcs.h, worldpos.c: Add TPV WCS for TAN with PV terms
-
-Version 3.8.3 (May 20, 2011)
-hget.c: Free allocated memory in strnsrch() to eliminate memory leak (2011-05-19)
-imhfile.c: Free *newpixname* not pixname. (2011-05-20)
-wcsinit.c: Change error() calls to setwcserr()
-wcslib.h: Declare undeclared SCAMP subroutine raw-to-pv()
-wcs.c: Fix wcsfree() so it frees depended-on WCS structures (2011-05-09)
-
-March 18, 2011 - Release 3.8.2
-zpxpos.c, wcs.c, wcsinit.c: Add support for NOAO ZPX protection (Frank Valdes)
-imsetwcs.c: Allocate NMAXMAG instead of number of magnitudes, nmag
-wcsinit.c,wcs.c,proj.c: Support SCAMP TAN distortion correction (Ed Los)
-wcsinit.c: ARSEC and DEG constants used by SCAMP replaced by S2D and D2S
-proj.c: If no PV coefficients in ZPN projection, make it ARC
-wcs.c: Fix bug involving dependent WCS's (Ed Los)
-
-April 30, 2010 - Release 3.8.1
-scat,imcat: Set GSC2 magnitudes > 90 to 99.99
-gethead: Fix buffer reallocation bug which crashed reading very large
- headers
-gethead: Fix trailing spaces on ASCII file quoted string values
-gethead: Fix problems with string value extraction changing ASCII files
-skycoor: Use number of decimal places from -n for -r difference if set
-wcscon.c: Fix bug in fk524() e-term computation; fix J<->B conversions
-fitsfile.c: In fitswhead(), always pad blocks to 2880 bytes with spaces
- and fix bug dealing with large primary headers
-wcscon.c: Fix bug in computing the magnitude of the e-terms in fk524()
- and drop ep1 assignment after line 178 in wcsconp()
-
-
-November 13, 2009 - Release 3.8.0
-dateutil.c: Fix possible bug in nutation subroutine
-fitsfile.c: Add subroutine moveb() and fix binary table calls to it
- Fix lengths for ASCII numeric table entries in fitsrthead()
-fitsfile.h: Add moveb() which is used by binary FITS table code in fitsfile.c
-hget.c: In strfix(), if parentheses enclose a number, drop them
-
-November 21, 2008 - Release 3.7.6
-fitsfile.c: In fitswhead() do not print write error if nw = nbytes
-dateutil.c: Use IAU 2006 nutation for sidereal time computations
-dateutil.c: Add ang2hr(), ang2deg(), deg2ang(), and ang2hr() to
- convert betweem decimal floating point degrees and
- vigesimal hours or degrees
-tnxpos.c: Fix image to world coordinate system transformation and
- WCS to image transformation
-
-July 1, 2008 - Release 3.7.5
-wcsinit.c: Initialize TNX projection when projection types first set and
- check for IMAGEW and IMAGEH if NAXIS1 and NAXIS2 not present,
-fitsfile.c: Drop comma from name when reading file in isfits() and
- do not append primary data header if it is the only header
-
-May 9, 2008 - Release 3.7.4
-fitsfile.c: In isfits(), allow extensions in FITS files without .fit or .fts
-wcsinit.c: Call tnxinit() before any projection calls are made
-
-March 20, 2008 - Release 3.7.3
-wcs.c: Compute angular separation in wcsdist() using arcos
-
-December 31, 2007 - Release 3.7.2
-wcscon.c: In wcsconp, make it clear that proper motion is in spherical coordinates
-fitsfile.c: Add support to BINTABLE in ftget*() and fitsrthead()
-fitsfile.c: Add data heap numerated by PCOUNT when skipping HDU in fitsrhead()
-fitsfile.c: Return NULL pointer if fitsrhead() cannot find requested HDU
-fitswcs.c: Print error message set by fitsrhead()
-
-November 9, 2007 - Release 3.7.1
-wcsinit.c: Fix bug which tested &mchar instead of mchar in if statement
-
-August 24, 2007 - Release 3.7.0
-hget.c: If a closing quote isn't found in a string value, make one up
-hput.c: Fix bug in comment insertion and deal correctly with missing quotes
-
-June 11, 2007 - Release 3.6.9
-imio.c: Add minvec() and speed up maxvec()
-
-April 3, 2007 - Release 3.6.8
-hget.c: Initial header length to zero in hlength() if lhead argument <= 0
-wcs.c: In wcstype(), set to WCS_PIX if CTYPEi starts with "DET"
-wcs.c: In wcspset(), use correct cdelts when converting PC matrix to CD matrix
-wcsinit.c: Fix bug so RA, DEC, SECPIX can be used to set a WCS
-tnxpos.c: Fix bug so it doesn't crash
-
-January 16, 2007 - Release 3.6.7
-wcs.h: Fix and add ANSI C prototypes
-imio.h: Drop as it has been included in fitsfile.h for several releases now
-fitsfile.h, fitshead.h: Add ANSI C prototypes
-wcsinitc(),wcsninitc(),hgeti4c(),hgetr8c(),hgetsc(): Change WCS letter argument
- from char to char*
-hget.c: Declare header and keyword const char in most subroutines
-hput.c: Declare keyword and value const in most subroutines
-hput.c: Fix bug in ra2str() and dec2str() so ndec=0 works
-imio.c: Include fitsfile.h instead of imio.h
-wcslib.h: Drop semicolon at end of c++ ifdef
-wcslib.h: Drop second declaration of SZP subroutines
-
-November 2, 2006 - Release 3.6.6
-fitsfile.c: Use calloc() when reallocating header as it is read
-wcsinit.c: Limit naxes to 2 everywhere; RA and DEC should always be 1st
-wcsinit.c: If either CUNITi is "pixel" set projection to WCS_XY
-wcscon.c: In wcscsys, set system to WCS_XY if PIXEL projection
-wcscon.c: In wcscsys, set system to WCS_LINEAR if LINEAR coordinate system
-dateutil.c, fitshead.h: Add sidereal time to UT and vice versa
-
-June 30, 2006 - Release 3.6.5
-wcsinit.c: Deal with up to 9x9 PC matrix
-wcs.c: Limit WCSLIB dimensions to two (this will change in 4.0)
-hput.c: Fix comment placement and replacement
-hget.c: Add strfix(), a utility to clean up strings
-
-May 3, 2006 - Release 3.6.4
-fileutil.c: Add istiff(), isjpeg(), isgif() to check TIFF, JPEG, GIF files
-fitsfile.c: Add fitsrtail() to read appended FITS headers
-fitsfile.c: Add file name to header-reading error messages
-fitswcs.c: Add code to read FITS header appended to TIFF file
-imio.c: Fix bug of occasional double application of bscale in getvec()
- Clean up arithmetic and increment in addpix() and multpix()
-imsetwcs.c: Allow number of decimal places in image coordinates to be set
-wcsinit.c: Get Epoch of observation from MJD-OBS or DATE-OBS/UT unless DSS
-wcsinit.c: Set wcs->naxes to actual number of image WCS axes, usually 2
-wcscon.c,dateutil.c,fitsfile.c: Drop declarations of unused variables
-wcs.c: Fix calls to avoid type conflicts in Linux
-
-
-January 5, 2006 - Release 3.6.3
-wcs.h: Add WCS_ICRS to list of coordinate systems
-wcsinit.c: Initialize sys to WCS_ICRS if appropriate
-wcscon.c: Avoid precesssing ICRS coordinates
-wcscon.c: Fix precession which broke in 3.6.1
-
-July 21, 2005 - Release 3.6.2
-wcs.c: Fix wcsrange() to return correct range around RA=0
-Clean up accumulated unused and misdeclared variables using lint
-
-April 13, 2005 - Release 3.6.1
-Remove all sla_lib subroutines and calls thereto from wcscon.c, replacing
-them with local code.
-
-March 17, 2005 - Release 3.6.0
-In wcs.c, fix bug in wcsrotset() so angles > 360 are set to angle - 360, not 360
-Use unbuffered read() in isfits() in fitsfile.c
-
-------------------------
-
-November 01, 2004 - Release 3.5.8
-In wcs.c, keep wcs->rot between 0 and 360 degrees (360.0 -> 0.0)
-
-September 21, 2004 - Release 3.5.7
-In pix2wcs(), if spherical coordinate output, keep 0 < long/RA < 360
-Fix bug in wcsfull() when wrapping around RA=0:00
-In hput.c, add fixnegzero() to avoid putting -0.000 in header
-
-September 3, 2004 - Release 3.5.6
-Modify FITS file reading software to get image size from file size if
-SIMPLE is F, so FITS headers with WCS can be used on arbitrary files.
-In hget.c, fix bug so comment is not pushed onto the next line if character
-value string lengthens (off by one bug).
-
-July 13, 2004 - Release 3.5.5
-Add headshrink to hput.c to optionally keep blank lines after
-keywords are deleted.
-Read D, d, E, and e as exponent delimiters in floating point values in hget.c
-
-
-May 6, 2004 - Release 3.5.4
-Add fitswexhead() to fitsfile.c to overwrite FITS extension headers
-
-April 16, 2004 - Release 3.5.3
-Use strncsrch() in hget.c to get differently-cased keywords.
-
-February 3, 2004 - Release 3.5.2
-In worldpix() in worldpos.c, allow ra/long. to exceed 180 if reference
-pixel is more than 180 degrees from image (1,1).
-
-December 12, 2003 - Release 3.5.1
-Change p[0,1,2] initializations to p[1,2,3] in wcsinit.c to match proj.c
-(This affects constants for AZP,SIN,COP,COE,COD,COO,SZP,CEA,CYP,AIR,BON)
-Add wcs->naxes back into wcs structure for backward compatibility; it
-should always be equal to wcs->naxis.
-Fix bug in numdec() to return 0 if no digits after decimal point
-Fix call to setwcserr() with format in it
-
-November 17, 2003 - Release 3.5.0
-Rename mgets() to mgetstr() in iget.c, wcsinit.c and fitshead.h
-Add numdec() to hget.c to return number of decimal places in numeric string
-Change wcs->naxes to wcs->naxis to prepare for WCSLIB 3.*
-In iraf2fits() and irafrimage(), use image, not physical, dimensions.
-In iraf2fits(), set NAXISi to image dimensions, NPAXISi to physical dimensions.
-Fix bugs in wcsfull() in wcs.c
-Move all distortion-related code to distort.c; include unistd.h
-Include stdlib.h instead of malloc.h in lin.c and drop malloc.h from matchstar.c
-
-------------------------
-
-August 22, 2003 - Release 3.4.2
-Add fitsrfull() subroutine to read FITS files with more than 2 dimensions
-Modify fitswimage() to write FITS files with more than 2 dimensions
-
-July 11, 2003 - Release 3.4.1
-Use strncmp to check for both stdin and stdout in fitsfile.c
-
-May 30, 2003 - Release 3.4.0
-Add partial support for ZPX projection
-Fix bug reading COE and other projections when PROJPn coefficients
-were accidently reinitialized
-
-------------------------
-
-May 8, 2003 - Release 3.3.4
-Add two missing semicolons in C++ declarations in wcs.h
-Read prj.p[0] from PROJP0 for ZPN projections, instead of ignoring it
-
-April 3, 2003 - Release 3.3.2
-Add distortion conversion for SIRTF images
-
-March 27, 2003 - Release 3.3.1
-Add conversions to and from Heliocentric Julian Dates to dateutil.c
-Open FITS and IMH files "rb" instead of "r" for Linux compatibility
-Add isimlistd() to fileutil.c to check for list of images in a specified directory
-Fix default center pixel computation in GetFITSWCS(); it was off by half a pixel
-
-January 30, 2003 - Release 3.3.0
-Fix bug in dateutil.c ts2gst() sidereal time conversion.
-
-------------------------
-
-January 3, 2003 - Release 3.2.1
-Fix bug in wcsinit() which failed to read PVi_0, and now initialize
-PVi_j in only once place.
-
-December 6, 2002 - Release 3.2.0
-Add ET/TDT/TT and sidereal time conversion to dateutil.c
-Fix subroutine calls for radvel and latpole and correctly compute pixel
-at center of image for default CRPIX in wcsinit.c
-Add fitsrsect() to fitsfile.c to read a section of an image
-
-------------------------
-
-August 30, 2002 - Release 3.1.3
-Fix bug in imio.c getvec() dealing with scaled images
-Add case-insensitive string search subroutines strcsrch() and strncsrch()
-Accept stdin as file in isfile()
-Add Ephemeris time conversions to dateutil()
-
-July 8, 2002 - Release 3.1.2
-Fix bug in date utilities which always rounded to integer seconds of UT
-Fix bugs in date utilities to handle BC (negative) dates to JD 0.
-
-June 26, 2002 - Release 3.1.1
-Fix bugs which caused TNX projection to fail
-Fix two bugs in wcsinit() which caused setting RADECSYS when
- an EQUINOX keyword is present.
-Write FITS error messages to string accessible by fitserr()
-Put SAO-written software under Gnu Lesser Public License
-
-April 12, 2002 - Release 3.1.0
-Implement WCSLIB 2.9
-Support PV entry of constants and PCi_j rotation matrices in wcsinit.c
-Support inversion (WCS->pix) of multiple dependent WCSs
-Add hgetri4c(), hgetr8c(), and hgetsc() for multiple WCS handling
-Fix bug in TNX projection software which caused an infinite loop during
-coefficient parsing.
-
-------------------------
-
-February 13, 2002 - Release 3.0.7
-Fix bug in ecliptic coordinate conversion in wcscon.c
-Allow "stdin" to include extension and/or WCS selection in fitsfile.c
-Add a global switch to turn off scaling in imio.c
-Add ifdef to lin.c so it will compile under Mac OS/X
-
-December 4, 2001 - Release 3.0.6
-In movepix(), add char to char move
-Always include stdlib.h in lin.c
-
-September 25, 2001 - Release 3.0.5
-Implement WCSLIB version 2.7
-Fix Makefile to include header files appropriately
-Accept FITS dates as yyyy/mm/dd
-Fix bug in str2dec() which misinterpreting strings with leading spaces
-Fix bug in isnum() which caused bad answer if trailing spaces
-Add fileutil.c, which includes various file info utilities
-
-September 7, 2001 - Release 3.0.3
-Disallow files with = in their name in isfits() and isiraf()
-Set coordinate system from CTYPE if not equatorial
-
-July 12, 2001 - Release 3.0
-Read PROJPn projection constants in wcsinit()
-
-------------------------
-
-March 30, 2001 - Release 2.9.4
-Fix possible header length problem in hget.c
-
-March 22, 2001 - Release 2.9.3
-Fix minor bugs in wcs.h, wcs.c, and wcsinit.c, wcslib.c, fitsfile.c, and
-cel.c found by gcc on Linux and possible memory leak in wcs.c
-
-March 9, 2001 - Release 2.9.2
-In fitsfile.c, change multiple WCS separator in FITS file names from : to %
-and fix bug which failed to read multi-extension files if END was not preceded
-by a blank line in the extension's header.
-
-February 28, 2001 - Release 2.9.1
-Fix major bug in wcsinit() which always set CRPIX2 the same as CRPIX1
-
-February 23, 2001 - Release 2.9.0
-FITS reading subroutines are fixed to ignore WCS name or character specified
-as :name or :character at end of filename.
-wcsinit() has new APIs which specify either a WCSNAME, wcsinitn(), or
-a WCS character, wcsinitc(), to allow use of multiple WCS's in a single
-FITS header. The WCSDEPx keyword has been added to indicate dependence
-on another WCS, though this feature has not been thoroughly debugged.
-fitscimage() is fixed so it doesn't overwrite data when overwriting a file
-An off-by-one bug was fixed for some polynomial types in tnxpos().
-The WCSLIB subroutines were brought up to release 2.6 with very minor changes
-
-------------------------
-
-December 29, 2000 - Release 2.8.6
-Fix handling of embedded + or - in isnum() in hget.c
-Default to 2000 for EQUINOX and EPOCH and FK5 for RADECSYS, if keywords not present.
-In wcscon.c, fk425() and fk524() algorithms were updated to include parallax and rv,
-proper motion is added by wcscon*() after fk425() or fk524() from system epoch, and
-proper motion units in fk524p() and fk425p() were fixed.
-In wcsinit.c, a bug initializing CD matrix was fixed.
-In cel.c, include string.h for strcmp().
-
-September 29, 2000 - Release 2.8.5
-wcsinit will now use a CD matrix if ANY CD keywords are present in header
-In getvec() in imio.c, move scaling outside of loop and make it conditional.
-Read .pix files in same directory as .imh file, if not otherwise found.
-
-August 1, 2000 - Release 2.8.3
-Improve handling of 1-D WCS data. Fix numerous warning-generating bugs.
-Fix bug in ep2jd()/jd2ep() so both start year at 1/1 0:00
-
-June 13, 2000 - Release 2.8.2
-If imh pixel file has no directory, *always* use same as header file
-
-June 9, 2000 - Release 2.8.1
-Read keyword values in hget.c even if no equal sign is present.
-
-June 2, 2000 - Release 2.8.0
-Only a few minor changes due to running lint on everything
-
-------------------------
-
-May 10, 2000 - Release 2.7.4
-In wcstype(), default to WCS_LIN, not error (after Bill Joye)
-
-May 1, 2000 - Release 2.7.3
-Bug in hadd() fixed so new line is not overwritten.
-Pixel files whcih are in subdirectories of files where IRAF .imh header
-files reside are now dealt with correctly.
-All dates in the old FITS format (dd/mm/yy) where the year ranges from
- 0 to 999 have 1900 added to them: 01/05/100 becomes 2000-05-01.
-
-March 27, 2000 - Release 2.7.2
-In hputs(), do not add quotes if writing COMMENT or HISTORY
-In fits2iraf(), in imhfile.c, minimize length of path in pixel file name
-Fix code to deal with .imh file paths longer than 67 characters.
-In platepix(), use inverse CD matrix to get better initial x,y value
-Change the maximum header string length in the hget header reading
- subroutines from 57600 to 256000
-Replace oldsys with wcsproj in the WCS data structure so that more options
- are available, such as forcing use of AIPS or WCSLIB projection subroutines
-Add setdatedec() to set the number of decimal places in FITS date strings
- returned by dateutil subroutines
-Fix precession code to deal correctly with equinoxes other than J2000 and
- B1950.
-Move all date operations to dateutil.c, including current time used in imhfile.c
-
-February 23, 2000 - Release 2.7.0
-Upgrade WCSLIB subroutines to WCSLIB 2.5 from 2.4
-Add MJD and Besselian and Julian epoch conversion to dateutil.c
-Use WCSLIB CAR, COE, NCP projections if oldsys is 1, else use worldpos()
-Set CD matrix when using DSS projection
-Change oldwcs in wcs.h from switch to multi-value flag wcsproj, default is same
-Fix minor bug in fitsfile.c fitscimage error returns.
-
-------------------------
-
-January 11, 2000 - Release 2.6.12
-Fix bug in dateutil() to get fractional year to date conversion right
-
-December 20, 1999 - Release 2.6.11
-Fix bug in hgetdate() to get ISO minutes and seconds right
-Upgrade dateutil() to do many date conversions
-
-December 10, 1999 - Release 2.6.10
-Fix bug which caused strings starting with d and e followed by numbers
-to be declared numeric even though they're not really numbers
-Fix bug in dateutil.c ts2jd() which does not affect SAOimage
-Fix bugs dealing with NOAO TNX projection
-
-November 17, 1999 - Release 2.6.9
-Fix bug which caused loss of NCP projection
-
-November 5, 1999 - Release 2.6.8
-Change release number to match WCSTools
-Clean up code in all subroutines using lint
-Add DATE-MOD to FITS header in iraf2fits()
-Added dateutil.c file for conversions between date formats (used by iraf2fits())
-Return error code from hput*() subroutines if header buffer length exceeded.
-
-------------------------
-
-May 5, 1999 - Release 1.26
-hget.c, iget.c Use POSIX-compliant limits.h instead of values.h
-
-April 7, 1999 - Release 1.26
-wcs.c Fix bug in dealing with EPOCHless non-equatorial coordinates
-wcsinit.c Add optional filename to printed error messages
-
-April 5, 1999 - Release 1.26
-hget.c Check all string lengths before copying; ignore ^M at 80th character
-
-February 22, 1999 - Release 1.26
-wcs.c Fix bug dealing with SPA and NPA coordinates
- Use faaces 0-5, not 1-6 for quad cube projections
-wcsinit.c Fix computed rotation angle for DSS projection
-
-February 9, 1999 - Release 1.26
-fitsfile.c: Allow BITPIX=0 dataless images
-wcsinit.c: Fix bug initializing DSS image rotation
-wcs.c: Free lin.imgpix and lin.piximg in wcsfree()
-hput.c: Fix bug to avoid writing HISTORY or COMMENT lines past 80 chars
-
-------------------------
-
-December 8, 1998 - Release 1.25
-fitsfile.c: Fix bug in fitsrhead() reading FITS table files caused by fix below
-
-November 30, 1998 - Release 1.25
-fitsfile.c: Fix bug dealing with very large headers in fitsrhead()
-
-November 12, 1998 - Release 1.25
-dsspos.c: Fix possible divide by zero problems
-fitsfile.c: Add isfits() which checks filename or first line of header
-imhfile.c: Add isiraf() which checks filename for .imh
-hget.c: Assume 2-digit year in hyphen-separated date means FITS, not ISO
-tnxpos.c: Fix multiple bugs
-wcscon.c: Add wcscstr() to get coordinate system as a character string
-wcscon.c: Add subroutine wcsconp() to convert coordinates + proper motions
-wcs.c: Add North and South Polar Angle coordinate systems
-wcs.c: Build WCS command initialization by getenv() into wcs*init()
-wcs.c: Fix bug in wcssize(); fix bug with rotated mirrored images
-wcslib.h: Add cel.h, lin.h, proj.h, and wcstrig.h to wcslib.h
-worldpos.c: Fix bug in inverse (sky to pixel) COE projection
-cel.c, lin.c, proj.c, sph.c, wcstrig.c: Include only wcslib.h
diff --git a/funtools/wcs/Readme b/funtools/wcs/Readme
deleted file mode 100644
index 61107cf..0000000
--- a/funtools/wcs/Readme
+++ /dev/null
@@ -1,36 +0,0 @@
-WCSsubs Subroutines
-
-These subroutines, developed as part of the WCSTools software package,
-constitute a self-contained package for accessing the world coordinate
-systems of FITS or IRAF(.imh) images, with image header I/O contained
-in fitsfile.c and imhfile.c, and WCS initialization and use through the
-subroutines in wcs.c. WCS information for an image is kept in a single
-data structure defined in wcs.h. Pixel to WCS translations are done by
-calls to pix2wcst() or pix2wcs(). WCS to pixel translations are done
-by calls to wcs2pix() or wcsc2pix(). The contents of the files are
-briefly described in Files. Dependencies between these files are given
-in Makefile. Documentation, to some extent, is online at
-
-http://tdc-www.harvard.edu/software/wcstools/libwcs.wcs.html
-
-Documentation for the entire open-source WCSTools package is online at
-
-http://tdc-www.harvard.edu/software/wcstools/
-
-Projection code in wcspos.c is by Bill Cotton of NRAO and is
-protected by the Gnu Lesser General Public License, which is stated
-in the file COPYING. Projection code in wcslib.c,
-cel.c, lin.c, proj.c, wcstrig.c, and sph.c is by Mark Calabretta
-of CSIRO and is also protected by the Gnu Lesser General Public
-License. Code in slasubs.c is by Pat Wallace of the Starlink
-project at Cambridge University. Doug Mink is responsible for
-the rest of the code, unless otherwise noted in the source file.
-Unless otherwise noted, this code is Copyright 2003 by the
-Smithsonian Astrophysical Observatory and protected by the Gnu
-Lesser General Public License.
-
--Jessica Mink (jmink@cfa.harvard.edu)
- Telescope Data Center
- Harvard-Smithsonian Center for Astrophysics
- Cambridge, Massachusetts
- http://tdc-www.harvard.edu/mink
diff --git a/funtools/wcs/cel.c b/funtools/wcs/cel.c
deleted file mode 100644
index 9109284..0000000
--- a/funtools/wcs/cel.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*=============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-*=============================================================================
-*
-* C routines which implement the FITS World Coordinate System (WCS)
-* convention.
-*
-* Summary of routines
-* -------------------
-* These routines are provided as drivers for the lower level spherical
-* coordinate transformation and projection routines. There are separate
-* driver routines for the forward, celfwd(), and reverse, celrev(),
-* transformations.
-*
-* An initialization routine, celset(), computes intermediate values from
-* the transformation parameters but need not be called explicitly - see the
-* explanation of cel.flag below.
-*
-*
-* Initialization routine; celset()
-* --------------------------------
-* Initializes members of a celprm data structure which hold intermediate
-* values. Note that this routine need not be called directly; it will be
-* invoked by celfwd() and celrev() if the "flag" structure member is
-* anything other than a predefined magic value.
-*
-* Given:
-* pcode[4] const char
-* WCS projection code (see below).
-*
-* Given and returned:
-* cel celprm* Spherical coordinate transformation parameters
-* (see below).
-* prj prjprm* Projection parameters (usage is described in the
-* prologue to "proj.c").
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid coordinate transformation parameters.
-* 2: Ill-conditioned coordinate transformation
-* parameters.
-*
-* Forward transformation; celfwd()
-* --------------------------------
-* Compute (x,y) coordinates in the plane of projection from celestial
-* coordinates (lng,lat).
-*
-* Given:
-* pcode[4] const char
-* WCS projection code (see below).
-* lng,lat const double
-* Celestial longitude and latitude of the projected
-* point, in degrees.
-*
-* Given and returned:
-* cel celprm* Spherical coordinate transformation parameters
-* (see below).
-*
-* Returned:
-* phi, double* Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-*
-* Given and returned:
-* prj prjprm* Projection parameters (usage is described in the
-* prologue to "proj.c").
-*
-* Returned:
-* x,y double* Projected coordinates, "degrees".
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid coordinate transformation parameters.
-* 2: Invalid projection parameters.
-* 3: Invalid value of (lng,lat).
-*
-* Reverse transformation; celrev()
-* --------------------------------
-* Compute the celestial coordinates (lng,lat) of the point with projected
-* coordinates (x,y).
-*
-* Given:
-* pcode[4] const char
-* WCS projection code (see below).
-* x,y const double
-* Projected coordinates, "degrees".
-*
-* Given and returned:
-* prj prjprm* Projection parameters (usage is described in the
-* prologue to "proj.c").
-*
-* Returned:
-* phi, double* Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-*
-* Given and returned:
-* cel celprm* Spherical coordinate transformation parameters
-* (see below).
-*
-* Returned:
-* lng,lat double* Celestial longitude and latitude of the projected
-* point, in degrees.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid coordinate transformation parameters.
-* 2: Invalid projection parameters.
-* 3: Invalid value of (x,y).
-*
-* Coordinate transformation parameters
-* ------------------------------------
-* The celprm struct consists of the following:
-*
-* int flag
-* The celprm struct contains pointers to the forward and reverse
-* projection routines as well as intermediaries computed from the
-* reference coordinates (see below). Whenever the projection code
-* (pcode) or any of ref[4] are set or changed then this flag must be
-* set to zero to signal the initialization routine, celset(), to
-* redetermine the function pointers and recompute intermediaries.
-* Once this has been done pcode itself is ignored.
-*
-* double ref[4]
-* The first pair of values should be set to the celestial longitude
-* and latitude (usually right ascension and declination) of the
-* reference point of the projection. These are given by the CRVALn
-* keywords in FITS.
-*
-* The second pair of values are the native longitude of the celestial
-* pole and the celestial latitude of the native pole and correspond to
-* FITS keywords LONPOLE and LATPOLE.
-*
-* LONPOLE defaults to 0 degrees if the celestial latitude of the
-* reference point of the projection is greater than the native
-* latitude, otherwise 180 degrees. (This is the condition for the
-* celestial latitude to increase in the same direction as the native
-* latitude at the reference point.) ref[2] may be set to 999.0 to
-* indicate that the correct default should be substituted.
-*
-* In some circumstances the celestial latitude of the native pole may
-* be determined by the first three values only to within a sign and
-* LATPOLE is used to choose between the two solutions. LATPOLE is
-* set in ref[3] and the solution closest to this value is used to
-* reset ref[3]. It is therefore legitimate, for example, to set
-* ref[3] to 999.0 to choose the more northerly solution - the default
-* if the LATPOLE card is omitted from the FITS header. For the
-* special case where the reference point of the projection is at
-* native latitude zero, its celestial latitude is zero, and
-* LONPOLE = +/- 90 then the celestial latitude of the pole is not
-* determined by the first three reference values and LATPOLE
-* specifies it completely.
-*
-* The remaining members of the celprm struct are maintained by the
-* initialization routines and should not be modified. This is done for the
-* sake of efficiency and to allow an arbitrary number of contexts to be
-* maintained simultaneously.
-*
-* double euler[5]
-* Euler angles and associated intermediaries derived from the
-* coordinate reference values.
-*
-*
-* WCS projection codes
-* --------------------
-* Zenithals/azimuthals:
-* AZP: zenithal/azimuthal perspective
-* TAN: gnomonic
-* STG: stereographic
-* SIN: synthesis (generalized orthographic)
-* ARC: zenithal/azimuthal equidistant
-* ZPN: zenithal/azimuthal polynomial
-* ZEA: zenithal/azimuthal equal area
-* AIR: Airy
-*
-* Cylindricals:
-* CYP: cylindrical perspective
-* CEA: cylindrical equal area
-* CAR: Cartesian
-* MER: Mercator
-*
-* Pseudo-cylindricals:
-* SFL: Sanson-Flamsteed
-* PAR: parabolic
-* MOL: Mollweide
-*
-* Conventional:
-* AIT: Hammer-Aitoff
-*
-* Conics:
-* COP: conic perspective
-* COD: conic equidistant
-* COE: conic equal area
-* COO: conic orthomorphic
-*
-* Polyconics:
-* BON: Bonne
-* PCO: polyconic
-*
-* Quad-cubes:
-* TSC: tangential spherical cube
-* CSC: COBE quadrilateralized spherical cube
-* QSC: quadrilateralized spherical cube
-*
-* Author: Mark Calabretta, Australia Telescope National Facility
-* $Id: cel.c,v 2.14 2002/04/03 01:25:29 mcalabre Exp $
-*===========================================================================*/
-
-#include <math.h>
-#include <string.h>
-#include "wcslib.h"
-
-/* Map error number to error message for each function. */
-const char *celset_errmsg[] = {
- 0,
- "Invalid coordinate transformation parameters",
- "Ill-conditioned coordinate transformation parameters"};
-
-const char *celfwd_errmsg[] = {
- 0,
- "Invalid coordinate transformation parameters",
- "Invalid projection parameters",
- "Invalid value of (lng,lat)"};
-
-const char *celrev_errmsg[] = {
- 0,
- "Invalid coordinate transformation parameters",
- "Invalid projection parameters",
- "Invalid value of (x,y)"};
-
-
-int
-celset(pcode, cel, prj)
-
-const char pcode[4];
-struct celprm *cel;
-struct prjprm *prj;
-
-{
- int dophip;
- const double tol = 1.0e-10;
- double clat0, cphip, cthe0, slat0, sphip, sthe0;
- double latp, latp1, latp2;
- double u, v, x, y, z;
-
- /* Initialize the projection driver routines. */
- if (prjset(pcode, prj)) {
- return 1;
- }
-
- /* Set default for native longitude of the celestial pole? */
- dophip = (cel->ref[2] == 999.0);
-
- /* Compute celestial coordinates of the native pole. */
- if (prj->theta0 == 90.0) {
- /* Reference point is at the native pole. */
-
- if (dophip) {
- /* Set default for longitude of the celestial pole. */
- cel->ref[2] = 180.0;
- }
-
- latp = cel->ref[1];
- cel->ref[3] = latp;
-
- cel->euler[0] = cel->ref[0];
- cel->euler[1] = 90.0 - latp;
- } else {
- /* Reference point away from the native pole. */
-
- /* Set default for longitude of the celestial pole. */
- if (dophip) {
- cel->ref[2] = (cel->ref[1] < prj->theta0) ? 180.0 : 0.0;
- }
-
- clat0 = cosdeg (cel->ref[1]);
- slat0 = sindeg (cel->ref[1]);
- cphip = cosdeg (cel->ref[2]);
- sphip = sindeg (cel->ref[2]);
- cthe0 = cosdeg (prj->theta0);
- sthe0 = sindeg (prj->theta0);
-
- x = cthe0*cphip;
- y = sthe0;
- z = sqrt(x*x + y*y);
- if (z == 0.0) {
- if (slat0 != 0.0) {
- return 1;
- }
-
- /* latp determined by LATPOLE in this case. */
- latp = cel->ref[3];
- } else {
- if (fabs(slat0/z) > 1.0) {
- return 1;
- }
-
- u = atan2deg (y,x);
- v = acosdeg (slat0/z);
-
- latp1 = u + v;
- if (latp1 > 180.0) {
- latp1 -= 360.0;
- } else if (latp1 < -180.0) {
- latp1 += 360.0;
- }
-
- latp2 = u - v;
- if (latp2 > 180.0) {
- latp2 -= 360.0;
- } else if (latp2 < -180.0) {
- latp2 += 360.0;
- }
-
- if (fabs(cel->ref[3]-latp1) < fabs(cel->ref[3]-latp2)) {
- if (fabs(latp1) < 90.0+tol) {
- latp = latp1;
- } else {
- latp = latp2;
- }
- } else {
- if (fabs(latp2) < 90.0+tol) {
- latp = latp2;
- } else {
- latp = latp1;
- }
- }
-
- cel->ref[3] = latp;
- }
-
- cel->euler[1] = 90.0 - latp;
-
- z = cosdeg (latp)*clat0;
- if (fabs(z) < tol) {
- if (fabs(clat0) < tol) {
- /* Celestial pole at the reference point. */
- cel->euler[0] = cel->ref[0];
- cel->euler[1] = 90.0 - prj->theta0;
- } else if (latp > 0.0) {
- /* Celestial pole at the native north pole.*/
- cel->euler[0] = cel->ref[0] + cel->ref[2] - 180.0;
- cel->euler[1] = 0.0;
- } else if (latp < 0.0) {
- /* Celestial pole at the native south pole. */
- cel->euler[0] = cel->ref[0] - cel->ref[2];
- cel->euler[1] = 180.0;
- }
- } else {
- x = (sthe0 - sindeg (latp)*slat0)/z;
- y = sphip*cthe0/clat0;
- if (x == 0.0 && y == 0.0) {
- return 1;
- }
- cel->euler[0] = cel->ref[0] - atan2deg (y,x);
- }
-
- /* Make euler[0] the same sign as ref[0]. */
- if (cel->ref[0] >= 0.0) {
- if (cel->euler[0] < 0.0) cel->euler[0] += 360.0;
- } else {
- if (cel->euler[0] > 0.0) cel->euler[0] -= 360.0;
- }
- }
-
- cel->euler[2] = cel->ref[2];
- cel->euler[3] = cosdeg (cel->euler[1]);
- cel->euler[4] = sindeg (cel->euler[1]);
- cel->flag = CELSET;
-
- /* Check for ill-conditioned parameters. */
- if (fabs(latp) > 90.0+tol) {
- return 2;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int
-celfwd(pcode, lng, lat, cel, phi, theta, prj, x, y)
-
-const char pcode[4];
-const double lng, lat;
-struct celprm *cel;
-double *phi, *theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- int err;
-
- if (cel->flag != CELSET) {
- if (celset(pcode, cel, prj)) return 1;
- }
-
- /* Compute native coordinates. */
- sphfwd(lng, lat, cel->euler, phi, theta);
-
- /* Apply forward projection. */
- if ((err = prj->prjfwd(*phi, *theta, prj, x, y))) {
- return err == 1 ? 2 : 3;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int
-celrev(pcode, x, y, prj, phi, theta, cel, lng, lat)
-
-const char pcode[4];
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-struct celprm *cel;
-double *lng, *lat;
-
-{
- int err;
-
- if (cel->flag != CELSET) {
- if(celset(pcode, cel, prj)) return 1;
- }
-
- /* Apply reverse projection. */
- if ((err = prj->prjrev(x, y, prj, phi, theta))) {
- return err == 1 ? 2 : 3;
- }
-
- /* Compute native coordinates. */
- sphrev(*phi, *theta, cel->euler, lng, lat);
-
- return 0;
-}
-
-/* Dec 20 1999 Doug Mink - Change cosd() and sind() to cosdeg() and sindeg()
- * Dec 20 1999 Doug Mink - Include wcslib.h, which includes wcsmath.h and cel.h
- *
- * Dec 18 2000 Doug Mink - Include string.h for strcmp()
- *
- * Mar 20 2001 Doug Mink - Add () around err assignments in if statements
- * Sep 19 2001 Doug Mink - Add above changes to WCSLIB-2.7 cel.c
- *
- * Mar 12 2002 Doug Mink - Add changes to WCSLIB-2.8.2 cel.c
- */
diff --git a/funtools/wcs/conf.h.in b/funtools/wcs/conf.h.in
deleted file mode 100644
index e60ee1d..0000000
--- a/funtools/wcs/conf.h.in
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Define as 1 if you have string.h */
-#undef HAVE_STRING_H
-
-/* Define as 1 if you have stdlib.h */
-#undef HAVE_STDLIB_H
-
-/* Define as 1 if you have malloc.h */
-#undef HAVE_MALLOC_H
-
-/* Define as 1 if you have unistd.h */
-#undef HAVE_UNISTD_H
-
-/* Define as 1 if you have getopt.h */
-#undef HAVE_GETOPT_H
-
-/* Define as 1 if you have values.h */
-#undef HAVE_VALUES_H
-
-/* Define as 1 if you have dlfcn.h */
-#undef HAVE_DLFCN_H
-
-/* Define as 1 if you have sys/un.h */
-#undef HAVE_SYS_UN_H
-
-/* Define as 1 if you have sys/shm.h */
-#undef HAVE_SYS_SHM_H
-
-/* Define as 1 if you have sys/mman.h */
-#undef HAVE_SYS_MMAN_H
-
-/* Define as 1 if you have sys/ipc.h */
-#undef HAVE_SYS_IPC_H
-
-/* Define as 1 if you have socklen_t */
-#undef HAVE_SOCKLEN_T
-
-/* Define as 1 if you have strchr */
-#undef HAVE_STRCHR
-
-/* Define as 1 if you have memcpy */
-#undef HAVE_MEMCPY
-
-/* Define as 1 if you have snprintf */
-#undef HAVE_SNPRINTF
-
-/* Define as 1 if you have Tcl */
-#undef HAVE_TCL
-
-/* Define as 1 if you have Xt */
-#undef HAVE_XT
-
-/* Define as 1 if you are running Cygwin. */
-#undef HAVE_CYGWIN
-
-/* Define as 1 if you are running MinGW. */
-#undef HAVE_MINGW32
diff --git a/funtools/wcs/config.guess b/funtools/wcs/config.guess
deleted file mode 100644
index 44290b8..0000000
--- a/funtools/wcs/config.guess
+++ /dev/null
@@ -1,1435 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-23'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches to <config-patches@gnu.org>.
-
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
- echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine=${arch}${endian}-unknown
- ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
- earm*)
- expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
- ;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
- x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
-esac
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/wcs/config.sub b/funtools/wcs/config.sub
deleted file mode 100644
index bc855a2..0000000
--- a/funtools/wcs/config.sub
+++ /dev/null
@@ -1,1807 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright 1992-2015 Free Software Foundation, Inc.
-
-timestamp='2015-02-22'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2015 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- moxiebox)
- basic_machine=moxie-unknown
- os=-moxiebox
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
- ;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/funtools/wcs/configure-failsafe b/funtools/wcs/configure-failsafe
deleted file mode 100755
index 4de89e2..0000000
--- a/funtools/wcs/configure-failsafe
+++ /dev/null
@@ -1,6222 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for wcs 3.8.7.
-#
-# Report bugs to <dmink@cfa.harvard.edu>.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-exec 6>&1
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_config_libobj_dir=.
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
-# Identity of this package.
-PACKAGE_NAME='wcs'
-PACKAGE_TARNAME='wcs'
-PACKAGE_VERSION='3.8.7'
-PACKAGE_STRING='wcs 3.8.7'
-PACKAGE_BUGREPORT='dmink@cfa.harvard.edu'
-
-ac_unique_file="./wcs.h"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP WHICHLIB EXTLIB LIB DEFLIB DOSHARED LLIB USE_DL EXTRA_LIBS EXTRA_OBJS LIBOBJS LTLIBOBJS'
-ac_subst_files=''
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-ac_prev=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures wcs 3.8.7 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-_ACEOF
-
- cat <<_ACEOF
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of wcs 3.8.7:";;
- esac
- cat <<\_ACEOF
-
-Optional Features:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-shared build shared libraries
- --enable-dl allow use of dynamic loading if available
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-wcslib=LIB library name
- --with-altlib=LIB library name
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <dmink@cfa.harvard.edu>.
-_ACEOF
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
- else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
- done
-fi
-
-test -n "$ac_init_help" && exit 0
-if $ac_init_version; then
- cat <<\_ACEOF
-wcs configure 3.8.7
-generated by GNU Autoconf 2.59
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit 0
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by wcs $as_me 3.8.7, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_sep=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-{
- (set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
- *)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-}
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- sed "/^$/d" confdefs.h | sort
- echo
- fi
- test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
- ' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
- esac
- fi
-else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
- case $ac_old_set,$ac_new_set in
- set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ac_config_headers="$ac_config_headers conf.h"
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f $ac_dir/shtool; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
- { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
- ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
- { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
- ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
- { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-
-#
-# checks that we use in most projects
-#
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
-
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$ac_ct_CC" && break
-done
-
- CC=$ac_ct_CC
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
- break;;
- * )
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
- * ) break;;
- esac
-done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_prog_cc_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- RANLIB=$ac_ct_RANLIB
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in malloc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in getopt.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in values.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/un.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/mman.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/ipc.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
-
-for ac_header in sys/shm.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to dmink@cfa.harvard.edu ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
- ;;
-esac
-
-echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6
-if test "${ac_cv_type_socklen_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/socket.h>
-
-int
-main ()
-{
-if ((socklen_t *) 0)
- return 0;
-if (sizeof (socklen_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_socklen_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_socklen_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6
-if test $ac_cv_type_socklen_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SOCKLEN_T 1
-_ACEOF
-
-
-fi
-
-
-echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
-if test "${ac_cv_c_const+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- }
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_const=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_c_const=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-
-fi
-
-
-
-
-
-for ac_func in strchr memcpy snprintf
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
-if test "${ac_cv_func_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define connect to an innocuous variant, in case <limits.h> declares connect.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define connect innocuous_connect
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char connect (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef connect
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != connect;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
-
-if test $ac_cv_func_connect = no; then
- echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-if test "${ac_cv_lib_socket_connect+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect ();
-int
-main ()
-{
-connect ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_socket_connect=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_socket_connect=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-if test $ac_cv_lib_socket_connect = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lsocket"
-fi
-
-fi
-echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-if test "${ac_cv_func_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define gethostbyname innocuous_gethostbyname
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char gethostbyname (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef gethostbyname
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != gethostbyname;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_func_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
-
-if test $ac_cv_func_gethostbyname = no; then
- echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname ();
-int
-main ()
-{
-gethostbyname ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_nsl_gethostbyname=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_nsl_gethostbyname=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -lnsl"
-fi
-
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-echo "$as_me:$LINENO: checking for external wcslib" >&5
-echo $ECHO_N "checking for external wcslib... $ECHO_C" >&6
-
-# Check whether --with-wcslib or --without-wcslib was given.
-if test "${with_wcslib+set}" = set; then
- withval="$with_wcslib"
- wcslib=yes WHICHLIB="extlib" EXTLIB=$withval
-else
- wcslib=no WHICHLIB="lib" EXTLIB=""
-fi;
-echo "$as_me:$LINENO: result: $wcslib" >&5
-echo "${ECHO_T}$wcslib" >&6
-
-
-
-DEFLIB="libwcs.a"
-echo "$as_me:$LINENO: checking for alternate target library" >&5
-echo $ECHO_N "checking for alternate target library... $ECHO_C" >&6
-
-# Check whether --with-altlib or --without-altlib was given.
-if test "${with_altlib+set}" = set; then
- withval="$with_altlib"
- alt_lib=yes LIB=$withval
-else
- alt_lib=no LIB=$DEFLIB
-fi;
-echo "$as_me:$LINENO: result: $alt_lib ($LIB)" >&5
-echo "${ECHO_T}$alt_lib ($LIB)" >&6
-
-
-
-echo "$as_me:$LINENO: checking for shared library build" >&5
-echo $ECHO_N "checking for shared library build... $ECHO_C" >&6
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
-
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-
-echo "$as_me:$LINENO: result: $fun_ok" >&5
-echo "${ECHO_T}$fun_ok" >&6
-
-# Check whether --enable-dl or --disable-dl was given.
-if test "${enable_dl+set}" = set; then
- enableval="$enable_dl"
- fun_ok=$enableval
-else
- fun_ok=no
-fi;
-if test "$fun_ok" = "yes"; then
-echo "$as_me:$LINENO: checking for dynamic loading (with gcc) " >&5
-echo $ECHO_N "checking for dynamic loading (with gcc) ... $ECHO_C" >&6
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_dl_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
-if test $ac_cv_lib_dl_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- echo "$as_me:$LINENO: checking for dlopen in -lc" >&5
-echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen ();
-int
-main ()
-{
-dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_c_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_c_dlopen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6
-if test $ac_cv_lib_c_dlopen = yes; then
- have_dl=yes
-else
- have_dl=no
-fi
-
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-echo "$as_me:$LINENO: result: $using_dl ($CC)" >&5
-echo "${ECHO_T}$using_dl ($CC)" >&6
-fi
-
-echo "$as_me:$LINENO: checking $host_os configuration" >&5
-echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CYGWIN
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging Cygwin" >&5
-echo "${ECHO_T}flagging Cygwin" >&6
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MINGW32
-_ACEOF
-
- echo "$as_me:$LINENO: result: flagging MinGW" >&5
-echo "${ECHO_T}flagging MinGW" >&6
- ;;
- *osf*|*Osf*)
- echo "$as_me:$LINENO: checking for snprintf in -ldb" >&5
-echo $ECHO_N "checking for snprintf in -ldb... $ECHO_C" >&6
-if test "${ac_cv_lib_db_snprintf+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldb $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char snprintf ();
-int
-main ()
-{
-snprintf ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_db_snprintf=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_db_snprintf=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_db_snprintf" >&5
-echo "${ECHO_T}$ac_cv_lib_db_snprintf" >&6
-if test $ac_cv_lib_db_snprintf = yes; then
- EXTRA_LIBS="$EXTRA_LIBS -ldb"
-fi
-
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fno-common, -fPIC to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common, -fPIC to CFLAGS" >&6
- else
- echo "$as_me:$LINENO: result: adding -fno-common to CFLAGS" >&5
-echo "${ECHO_T}adding -fno-common to CFLAGS" >&6
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- echo "$as_me:$LINENO: result: adding -fPIC to gcc" >&5
-echo "${ECHO_T}adding -fPIC to gcc" >&6
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- else
- echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6
- fi
- ;;
-esac
-
-
-
-
-
-
- ac_config_files="$ac_config_files Makefile"
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-{
- (set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
- ;;
- esac;
-} |
- sed '
- t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
-do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.file
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_executable_p="test -f"
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
-exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by wcs $as_me 3.8.7, which was
-generated by GNU Autoconf 2.59. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-wcs config.status 3.8.7
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- -*)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
- esac
-
- case $ac_option in
- # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
- ac_need_defaults=false;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1" ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-
-
-
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_config_target in $ac_config_targets
-do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
-$debug ||
-{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
-#
-# CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@WHICHLIB@,$WHICHLIB,;t t
-s,@EXTLIB@,$EXTLIB,;t t
-s,@LIB@,$LIB,;t t
-s,@DEFLIB@,$DEFLIB,;t t
-s,@DOSHARED@,$DOSHARED,;t t
-s,@LLIB@,$LLIB,;t t
-s,@USE_DL@,$USE_DL,;t t
-s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t
-s,@EXTRA_OBJS@,$EXTRA_OBJS,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- ac_builddir=.
-
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
-
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
- esac
-
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- # Do quote $f, to prevent DOS paths from being IFS'd.
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
- rm -f conftest.defines
- mv conftest.tail conftest.defines
-done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
-
-cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
- if test x"$ac_file" != x-; then
- if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
- { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
- else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
- rm -f $ac_file
- mv $tmp/config.h $ac_file
- fi
- else
- cat $tmp/config.h
- rm -f $tmp/config.h
- fi
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-
diff --git a/funtools/wcs/configure.ac b/funtools/wcs/configure.ac
deleted file mode 100644
index f8449c3..0000000
--- a/funtools/wcs/configure.ac
+++ /dev/null
@@ -1,177 +0,0 @@
-# This file is an input file used by the GNU "autoconf" program to
-# generate the file "configure", which is run during XPA installation
-# to configure the system for the local environment.
-AC_INIT(wcs, 3.8.7, dmink@cfa.harvard.edu, wcs)
-
-AC_CONFIG_HEADERS([conf.h])
-AC_CONFIG_SRCDIR(./wcs.h)
-AC_CANONICAL_HOST
-
-#
-# checks that we use in most projects
-#
-AC_PROG_CC
-
-AC_EXEEXT
-if test x"${EXEEXT}" = "xno"; then
- EXEEXT=""
-fi
-
-AC_PROG_RANLIB
-
-AC_HEADER_STDC
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(getopt.h)
-AC_CHECK_HEADERS(values.h)
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_HEADERS(sys/un.h)
-AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_HEADERS(sys/ipc.h)
-case $host_os in
- *cygwin*|*Cygwin* )
- ;;
- * )
- AC_CHECK_HEADERS(sys/shm.h)
- ;;
-esac
-
-AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])
-
-AC_C_CONST
-
-AC_CHECK_FUNCS(strchr memcpy snprintf)
-
-AC_CHECK_FUNC(connect)
-if test $ac_cv_func_connect = no; then
- AC_CHECK_LIB(socket, connect, EXTRA_LIBS="$EXTRA_LIBS -lsocket")
-fi
-AC_CHECK_FUNC(gethostbyname)
-if test $ac_cv_func_gethostbyname = no; then
- AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
-fi
-# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
-
-#
-# checks specific to this project
-#
-
-AC_MSG_CHECKING(for external wcslib)
-AC_ARG_WITH(wcslib, [ --with-wcslib=LIB library name],
- wcslib=yes WHICHLIB="extlib" EXTLIB=$withval, wcslib=no WHICHLIB="lib" EXTLIB="")
-AC_MSG_RESULT($wcslib)
-AC_SUBST(WHICHLIB)
-AC_SUBST(EXTLIB)
-
-DEFLIB="libwcs.a"
-AC_MSG_CHECKING(for alternate target library)
-AC_ARG_WITH(altlib, [ --with-altlib=LIB library name],
- alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB)
-AC_MSG_RESULT($alt_lib ($LIB))
-AC_SUBST(LIB)
-AC_SUBST(DEFLIB)
-
-AC_MSG_CHECKING(for shared library build)
-AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" != "no"; then
- fpic="yes"
- DOSHARED=shlib
- AC_SUBST(DOSHARED)
- if test "$fun_ok" = "link"; then
- LLIB="-L. -l$PACKAGE_NAME"
- else
- LLIB='$(LIB)'
- fi
-else
- LLIB='$(LIB)'
-fi
-AC_SUBST(LLIB)
-AC_MSG_RESULT($fun_ok)
-
-AC_ARG_ENABLE(dl, [ --enable-dl allow use of dynamic loading if available],
- [fun_ok=$enableval], [fun_ok=no])
-if test "$fun_ok" = "yes"; then
-AC_MSG_CHECKING([for dynamic loading (with gcc) ])
-if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- using_dl="yes"
- AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- EXTRA_LIBS="$EXTRA_LIBS -ldl"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
- if test "$have_dl" = yes; then
- USE_DL="-DUSE_DL=1"
- fpic="yes"
- if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
- LDFLAGS="$LDFLAGS -rdynamic"
- fi
- else
- using_dl="no"
- fi
- fi
-else
- using_dl="no"
-fi
-AC_MSG_RESULT([$using_dl ($CC)])
-fi
-
-AC_MSG_CHECKING([$host_os configuration])
-PRE=""
-POST="|\& cat"
-case $host_os in
- *cygwin*|*Cygwin* )
- AC_DEFINE([HAVE_CYGWIN])
- AC_MSG_RESULT(flagging Cygwin)
- PRE="sh -c {"
- POST="}"
- ;;
- *mingw32*|*Mingw32*)
- CFLAGS="$CFLAGS -mconsole -D_WSTRING_DEFINED=1"
- EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
- AC_DEFINE([HAVE_MINGW32])
- AC_MSG_RESULT(flagging MinGW)
- ;;
- *osf*|*Osf*)
- AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
- ;;
- *darwin*|*Darwin*)
- LDFLAGS="$LDFLAGS $CFLAGS"
- G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'`
- if test x"$G" != x -a "$G" -lt 42; then
- CFLAGS="$CFLAGS -no-cpp-precomp"
- fi
- CFLAGS="$CFLAGS -fno-common"
- if test x"$fpic" = x"yes" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT([adding -fno-common, -fPIC to CFLAGS])
- else
- AC_MSG_RESULT([adding -fno-common to CFLAGS])
- fi
- ;;
- * )
- if test x"$fpic" = x"yes" ; then
- if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
- CFLAGS="$CFLAGS -fPIC"
- AC_MSG_RESULT(adding -fPIC to gcc)
- else
- AC_MSG_RESULT(none)
- fi
- else
- AC_MSG_RESULT(none)
- fi
- ;;
-esac
-
-AC_SUBST(USE_DL)
-
-AC_SUBST(EXTRA_LIBS)
-AC_SUBST(EXTRA_OBJS)
-
-AC_CONFIG_FILES(Makefile)
-
-AC_OUTPUT
diff --git a/funtools/wcs/dateutil.c b/funtools/wcs/dateutil.c
deleted file mode 100644
index ada0c95..0000000
--- a/funtools/wcs/dateutil.c
+++ /dev/null
@@ -1,4554 +0,0 @@
-/*** File libwcs/dateutil.c
- *** October 19, 2012
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1999-2012
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-/* Date and time conversion routines using the following conventions:
- ang = Angle in fractional degrees
- deg = Angle in degrees as dd:mm:ss.ss
- doy = 2 floating point numbers: year and day, including fraction, of year
- *** First day of year is 1, not zero.
- dt = 2 floating point numbers: yyyy.mmdd, hh.mmssssss
- ep = fractional year, often epoch of a position including proper motion
- epb = Besselian epoch = 365.242198781-day years based on 1900.0
- epj = Julian epoch = 365.25-day years based on 2000.0
- fd = FITS date string which may be any of the following:
- yyyy.ffff (fractional year)
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard FITS use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999)
- hr = Sexigesimal hours as hh:mm:dd.ss
- jd = Julian Date
- lt = Local time
- mjd = modified Julian Date = JD - 2400000.5
- ofd = FITS date string (dd/mm/yy before 2000, else no return)
- time = use fd2* with no date to convert time as hh:mm:ss.ss to sec, day, year
- ts = UT seconds since 1950-01-01T00:00 (used for ephemeris computations)
- tsi = local seconds since 1980-01-01T00:00 (used by IRAF as a time tag)
- tsu = UT seconds since 1970-01-01T00:00 (used as Unix system time)
- tsd = UT seconds of current day
- ut = Universal Time (UTC)
- et = Ephemeris Time (or TDB or TT) = TAI + 32.184 seconds
- tai = International Atomic Time (Temps Atomique International) = ET - 32.184 seconds
- gps = GPS time = TAI - 19 seconds
- mst = Mean Greenwich Sidereal Time
- gst = Greenwich Sidereal Time (includes nutation)
- lst = Local Sidereal Time (includes nutation) (longitude must be set)
- hjd = Heliocentric Julian Date
- mhjd = modified Heliocentric Julian Date = HJD - 2400000.5
-
- * ang2hr (angle)
- * Convert angle in decimal floating point degrees to hours as hh:mm:ss.ss
- * ang2deg (angle)
- * Convert angle in decimal floating point degrees to degrees as dd:mm:ss.ss
- * deg2ang (angle as dd:mm:ss.ss)
- * Convert angle in degrees as dd:mm:ss.ss to decimal floating point degrees
- * ang2hr (angle)
- * Convert angle in hours as hh:mm:ss.ss to decimal floating point degrees
- *
- * doy2dt (year, doy, date, time)
- * Convert year and day of year to date as yyyy.ddmm and time as hh.mmsss
- * doy2ep, doy2epb, doy2epj (date, time)
- * Convert year and day of year to fractional year
- * doy2fd (year, doy)
- * Convert year and day of year to FITS date string
- * doy2mjd (year, doy)
- * Convert year and day of year to modified Julian date
- *
- * dt2doy (date, time, year, doy)
- * Convert date as yyyy.ddmm and time as hh.mmsss to year and day of year
- * dt2ep, dt2epb, dt2epj (date, time)
- * Convert date as yyyy.ddmm and time as hh.mmsss to fractional year
- * dt2fd (date, time)
- * Convert date as yyyy.ddmm and time as hh.mmsss to FITS date string
- * dt2i (date,time,iyr,imon,iday,ihr,imn,sec, ndsec)
- * Convert yyyy.mmdd hh.mmssss to year month day hours minutes seconds
- * dt2jd (date,time)
- * Convert date as yyyy.ddmm and time as hh.mmsss to Julian date
- * dt2mjd (date,time)
- * Convert date as yyyy.ddmm and time as hh.mmsss to modified Julian date
- * dt2ts (date,time)
- * Convert date (yyyy.ddmm) and time (hh.mmsss) to seconds since 1950-01-01
- * dt2tsi (date,time)
- * Convert date (yyyy.ddmm) and time (hh.mmsss) to seconds since 1980-01-01
- * dt2tsu (date,time)
- * Convert date (yyyy.ddmm) and time (hh.mmsss) to seconds since 1970-01-01
- *
- * ep2dt, epb2dt, epj2dt (epoch,date, time)
- * Convert fractional year to date as yyyy.ddmm and time as hh.mmsss
- * ep2fd, epb2fd, epj2fd (epoch)
- * Convert epoch to FITS ISO date string
- * ep2i, epb2i, epj2i (epoch,iyr,imon,iday,ihr,imn,sec, ndsec)
- * Convert fractional year to year month day hours minutes seconds
- * ep2jd, epb2jd, epj2jd (epoch)
- * Convert fractional year as used in epoch to Julian date
- * ep2mjd, epb2mjd, epj2mjd (epoch)
- * Convert fractional year as used in epoch to modified Julian date
- * ep2ts, epb2ts, epj2ts (epoch)
- * Convert fractional year to seconds since 1950.0
- *
- * et2fd (string)
- * Convert from ET (or TDT or TT) in FITS format to UT in FITS format
- * fd2et (string)
- * Convert from UT in FITS format to ET (or TDT or TT) in FITS format
- * jd2jed (dj)
- * Convert from Julian Date to Julian Ephemeris Date
- * jed2jd (dj)
- * Convert from Julian Ephemeris Date to Julian Date
- * dt2et (date, time)
- * Convert date (yyyy.ddmm) and time (hh.mmsss) to ephemeris time
- * edt2dt (date, time)
- * Convert ephemeris date (yyyy.ddmm) and time (hh.mmsss) to UT
- * dt2tai (date, time)
- * Convert date (yyyy.ddmm) and time (hh.mmsss) to TAI date and time
- * tai2dt (date, time)
- * Convert TAI date (yyyy.ddmm) and time (hh.mmsss) to UT
- * ts2ets (tsec)
- * Convert from UT in seconds since 1950-01-01 to ET in same format
- * ets2ts (tsec)
- * Convert from ET in seconds since 1950-01-01 to UT in same format
- *
- * fd2ep, fd2epb, fd2epj (string)
- * Convert FITS date string to fractional year
- * Convert time alone to fraction of Besselian year
- * fd2doy (string, year, doy)
- * Convert FITS standard date string to year and day of year
- * fd2dt (string, date, time)
- * Convert FITS date string to date as yyyy.ddmm and time as hh.mmsss
- * Convert time alone to hh.mmssss with date set to 0.0
- * fd2i (string,iyr,imon,iday,ihr,imn,sec, ndsec)
- * Convert FITS standard date string to year month day hours min sec
- * Convert time alone to hours min sec, year month day are zero
- * fd2jd (string)
- * Convert FITS standard date string to Julian date
- * Convert time alone to fraction of day
- * fd2mjd (string)
- * Convert FITS standard date string to modified Julian date
- * fd2ts (string)
- * Convert FITS standard date string to seconds since 1950.0
- * Convert time alone to seconds of day
- * fd2fd (string)
- * Convert FITS standard date string to ISO FITS date string
- * fd2of (string)
- * Convert FITS standard date string to old-format FITS date and time
- * fd2ofd (string)
- * Convert FITS standard date string to old-format FITS date string
- * fd2oft (string)
- * Convert time part of FITS standard date string to FITS date string
- *
- * jd2doy (dj, year, doy)
- * Convert Julian date to year and day of year
- * jd2dt (dj,date,time)
- * Convert Julian date to date as yyyy.mmdd and time as hh.mmssss
- * jd2ep, jd2epb, jd2epj (dj)
- * Convert Julian date to fractional year as used in epoch
- * jd2fd (dj)
- * Convert Julian date to FITS ISO date string
- * jd2i (dj,iyr,imon,iday,ihr,imn,sec, ndsec)
- * Convert Julian date to year month day hours min sec
- * jd2mjd (dj)
- * Convert Julian date to modified Julian date
- * jd2ts (dj)
- * Convert Julian day to seconds since 1950.0
- *
- * lt2dt()
- * Return local time as yyyy.mmdd and time as hh.mmssss
- * lt2fd()
- * Return local time as FITS ISO date string
- * lt2tsi()
- * Return local time as IRAF seconds since 1980-01-01 00:00
- * lt2tsu()
- * Return local time as Unix seconds since 1970-01-01 00:00
- * lt2ts()
- * Return local time as Unix seconds since 1950-01-01 00:00
- *
- * mjd2doy (dj,year,doy)
- * Convert modified Julian date to date as year and day of year
- * mjd2dt (dj,date,time)
- * Convert modified Julian date to date as yyyy.mmdd and time as hh.mmssss
- * mjd2ep, mjd2epb, mjd2epj (dj)
- * Convert modified Julian date to fractional year as used in epoch
- * mjd2fd (dj)
- * Convert modified Julian date to FITS ISO date string
- * mjd2i (dj,iyr,imon,iday,ihr,imn,sec, ndsec)
- * Convert modified Julian date to year month day hours min sec
- * mjd2jd (dj)
- * Convert modified Julian date to Julian date
- * mjd2ts (dj)
- * Convert modified Julian day to seconds since 1950.0
- *
- * ts2dt (tsec,date,time)
- * Convert seconds since 1950.0 to date as yyyy.ddmm and time as hh.mmsss
- * ts2ep, ts2epb, ts2epj (tsec)
- * Convert seconds since 1950.0 to fractional year
- * ts2fd (tsec)
- * Convert seconds since 1950.0 to FITS standard date string
- * ts2i (tsec,iyr,imon,iday,ihr,imn,sec, ndsec)
- * Convert sec since 1950.0 to year month day hours minutes seconds
- * ts2jd (tsec)
- * Convert seconds since 1950.0 to Julian date
- * ts2mjd (tsec)
- * Convert seconds since 1950.0 to modified Julian date
- * tsi2fd (tsec)
- * Convert seconds since 1980-01-01 to FITS standard date string
- * tsi2dt (tsec,date,time)
- * Convert seconds since 1980-01-01 to date as yyyy.ddmm, time as hh.mmsss
- * tsu2fd (tsec)
- * Convert seconds since 1970-01-01 to FITS standard date string
- * tsu2tsi (tsec)
- * Convert UT seconds since 1970-01-01 to local seconds since 1980-01-01
- * tsu2dt (tsec,date,time)
- * Convert seconds since 1970-01-01 to date as yyyy.ddmm, time as hh.mmsss
- *
- * tsd2fd (tsec)
- * Convert seconds since start of day to FITS time, hh:mm:ss.ss
- * tsd2dt (tsec)
- * Convert seconds since start of day to hh.mmssss
- *
- * fd2gst (string)
- * convert from FITS date Greenwich Sidereal Time
- * dt2gst (date, time)
- * convert from UT as yyyy.mmdd hh.mmssss to Greenwich Sidereal Time
- * ts2gst (tsec)
- * Calculate Greenwich Sidereal Time given Universal Time
- * in seconds since 1951-01-01T0:00:00
- * fd2mst (string)
- * convert from FITS UT date to Mean Sidereal Time
- * dt2gmt (date, time)
- * convert from UT as yyyy.mmdd hh.mmssss to Mean Sidereal Time
- * ts2mst (tsec)
- * Calculate Mean Sidereal Time given Universal Time
- * in seconds since 1951-01-01T0:00:00
- * jd2mst (string)
- * convert from Julian Date to Mean Sidereal Time
- * mst2fd (string)
- * convert to current UT in FITS format given Greenwich Mean Sidereal Time
- * mst2jd (dj)
- * convert to current UT as Julian Date given Greenwich Mean Sidereal Time
- * jd2lst (dj)
- * Calculate Local Sidereal Time from Julian Date
- * ts2lst (tsec)
- * Calculate Local Sidereal Time given UT in seconds since 1951-01-01T0:00
- * fd2lst (string)
- * Calculate Local Sidereal Time given Universal Time as FITS ISO date
- * lst2jd (dj, lst)
- * Calculate Julian Date given current Julian date and Local Sidereal Time
- * lst2fd (string, lst)
- * Calculate Julian Date given current UT date and Local Sidereal Time
- * gst2fd (string)
- * Calculate current UT given UT date and Greenwich Sidereal Time
- * gst2jd (dj)
- * Calculate current UT given UT date and Greenwich Sidereal Time as JD
- *
- * compnut (dj, dpsi, deps, eps0)
- * Compute the longitude and obliquity components of nutation and
- * mean obliquity from the IAU 1980 theory
- *
- * utdt (dj)
- * Compute difference between UT and dynamical time (ET-UT)
- * ut2dt (year, doy)
- * Current Universal Time to year and day of year
- * ut2dt (date, time)
- * Current Universal Time to date (yyyy.mmdd) and time (hh.mmsss)
- * ut2ep(), ut2epb(), ut2epj()
- * Current Universal Time to fractional year, Besselian, Julian epoch
- * ut2fd()
- * Current Universal Time to FITS ISO date string
- * ut2jd()
- * Current Universal Time to Julian Date
- * ut2mjd()
- * Current Universal Time to Modified Julian Date
- * ut2tsi()
- * Current Universal Time to IRAF seconds since 1980-01-01T00:00
- * ut2tsu()
- * Current Universal Time to Unix seconds since 1970-01-01T00:00
- * ut2ts()
- * Current Universal Time to seconds since 1950-01-01T00:00
- * isdate (string)
- * Return 1 if string is a FITS date (old or ISO)
- *
- * Internally-used subroutines
- *
- * fixdate (iyr, imon, iday, ihr, imn, sec, ndsec)
- * Round seconds and make sure date and time numbers are within limits
- * caldays (year, month)
- * Calculate days in month 1-12 given year (Gregorian calendar only
- * dint (dnum)
- * Return integer part of floating point number
- * dmod (dnum)
- * Return Mod of floating point number
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/time.h>
-#include "wcs.h"
-#include "fitsfile.h"
-
-static double suntl();
-static void fixdate();
-static int caldays();
-static double dint();
-static double dmod();
-
-static double longitude = 0.0; /* longitude of observatory in degrees (+=west) */
-void
-setlongitude (longitude0)
-double longitude0;
-{ longitude = longitude0; return; }
-
-static int ndec = 3;
-void
-setdatedec (nd)
-int nd;
-{ ndec = nd; return; }
-
-/* ANG2HR -- Convert angle in fraction degrees to hours as hh:mm:ss.ss */
-
-void
-ang2hr (angle, lstr, string)
-
-double angle; /* Angle in fractional degrees */
-int lstr; /* Maximum number of characters in string */
-char *string; /* Character string (hh:mm:ss.ss returned) */
-
-{
- angle = angle / 15.0;
- dec2str (string, lstr, angle, ndec);
- return;
-}
-
-
-/* ANG2DEG -- Convert angle in fraction degrees to degrees as dd:mm:ss.ss */
-
-void
-ang2deg (angle, lstr, string)
-
-double angle; /* Angle in fractional degrees */
-int lstr; /* Maximum number of characters in string */
-char *string; /* Character string (dd:mm:ss.ss returned) */
-{
- dec2str (string, lstr, angle, ndec);
- return;
-}
-
-
-/* DEG2ANG -- Convert angle in degrees as dd:mm:ss.ss to fractional degrees */
-
-double
-deg2ang (angle)
-
-char *angle; /* Angle as dd:mm:ss.ss */
-{
- double deg;
-
- deg = str2dec (angle);
- return (deg);
-}
-
-/* HR2ANG -- Convert angle in hours as hh:mm:ss.ss to fractional degrees */
-
-double
-hr2ang (angle)
-
-char *angle; /* Angle in sexigesimal hours (hh:mm:ss.sss) */
-
-{
- double deg;
-
- deg = str2dec (angle);
- deg = deg * 15.0;
- return (deg);
-}
-
-
-/* DT2FD-- convert vigesimal date and time to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-dt2fd (date, time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
- int nf;
- char *string;
- char tstring[32], dstring[32];
- char outform[64];
-
- dt2i (date, time, &iyr,&imon,&iday,&ihr,&imn,&sec, ndec);
-
- /* Convert to ISO date format */
- string = (char *) calloc (32, sizeof (char));
-
- /* Make time string */
- if (time != 0.0 || ndec > 0) {
- if (ndec == 0)
- nf = 2;
- else
- nf = 3 + ndec;
- if (ndec > 0) {
- sprintf (outform, "%%02d:%%02d:%%0%d.%df", nf, ndec);
- sprintf (tstring, outform, ihr, imn, sec);
- }
- else {
- sprintf (outform, "%%02d:%%02d:%%0%dd", nf);
- sprintf (tstring, outform, ihr, imn, (int)(sec+0.5));
- }
- }
-
- /* Make date string */
- if (date != 0.0)
- sprintf (dstring, "%4d-%02d-%02d", iyr, imon, iday);
-
- /* Make FITS (ISO) date string */
- if (date == 0.0)
- strcpy (string, tstring);
- else if (time == 0.0 && ndec < 1)
- strcpy (string, dstring);
- else
- sprintf (string, "%sT%s", dstring, tstring);
-
- return (string);
-}
-
-
-/* DT2JD-- convert from date as yyyy.mmdd and time as hh.mmsss to Julian Date
- * Return fractional days if date is zero */
-
-double
-dt2jd (date,time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj; /* Julian date (returned) */
- double tsec; /* seconds since 1950.0 */
-
- tsec = dt2ts (date, time);
- if (date == 0.0)
- dj = tsec / 86400.0;
- else
- dj = ts2jd (tsec);
-
- return (dj);
-}
-
-
-/* DT2MJD-- convert from date yyyy.mmdd time hh.mmsss to modified Julian Date
- * Return fractional days if date is zero */
-
-double
-dt2mjd (date,time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj; /* Modified Julian date (returned) */
- double tsec; /* seconds since 1950.0 */
-
- tsec = dt2ts (date, time);
- if (date == 0.0)
- dj = tsec / 86400.0;
- else
- dj = ts2jd (tsec);
-
- return (dj - 2400000.5);
-}
-
-
-/* HJD2JD-- convert Heliocentric Julian Date to (geocentric) Julian date */
-
-double
-hjd2jd (dj, ra, dec, sys)
-
-double dj; /* Heliocentric Julian date */
-double ra; /* Right ascension (degrees) */
-double dec; /* Declination (degrees) */
-int sys; /* J2000, B1950, GALACTIC, ECLIPTIC */
-{
- double lt; /* Light travel difference to the Sun (days) */
-
- lt = suntl (dj, ra, dec, sys);
-
- /* Return Heliocentric Julian Date */
- return (dj - lt);
-}
-
-
-/* JD2HJD-- convert (geocentric) Julian date to Heliocentric Julian Date */
-
-double
-jd2hjd (dj, ra, dec, sys)
-
-double dj; /* Julian date (geocentric) */
-double ra; /* Right ascension (degrees) */
-double dec; /* Declination (degrees) */
-int sys; /* J2000, B1950, GALACTIC, ECLIPTIC */
-{
- double lt; /* Light travel difference to the Sun (days) */
-
- lt = suntl (dj, ra, dec, sys);
-
- /* Return Heliocentric Julian Date */
- return (dj + lt);
-}
-
-
-/* MHJD2MJD-- convert modified Heliocentric Julian Date to
- modified geocentric Julian date */
-
-double
-mhjd2mjd (mhjd, ra, dec, sys)
-
-double mhjd; /* Modified Heliocentric Julian date */
-double ra; /* Right ascension (degrees) */
-double dec; /* Declination (degrees) */
-int sys; /* J2000, B1950, GALACTIC, ECLIPTIC */
-{
- double lt; /* Light travel difference to the Sun (days) */
- double hjd; /* Heliocentric Julian date */
-
- hjd = mjd2jd (mhjd);
-
- lt = suntl (hjd, ra, dec, sys);
-
- /* Return Heliocentric Julian Date */
- return (jd2mjd (hjd - lt));
-}
-
-
-/* MJD2MHJD-- convert modified geocentric Julian date tp
- modified Heliocentric Julian Date */
-
-double
-mjd2mhjd (mjd, ra, dec, sys)
-
-double mjd; /* Julian date (geocentric) */
-double ra; /* Right ascension (degrees) */
-double dec; /* Declination (degrees) */
-int sys; /* J2000, B1950, GALACTIC, ECLIPTIC */
-{
- double lt; /* Light travel difference to the Sun (days) */
- double dj; /* Julian date (geocentric) */
-
- dj = mjd2jd (mjd);
-
- lt = suntl (dj, ra, dec, sys);
-
- /* Return Heliocentric Julian Date */
- return (jd2mjd (dj + lt));
-}
-
-
-/* SUNTL-- compute light travel time to heliocentric correction in days */
-/* Translated into C from IRAF SPP noao.astutils.asttools.asthjd.x */
-
-static double
-suntl (dj, ra, dec, sys)
-
-double dj; /* Julian date (geocentric) */
-double ra; /* Right ascension (degrees) */
-double dec; /* Declination (degrees) */
-int sys; /* J2000, B1950, GALACTIC, ECLIPTIC */
-{
- double t; /* Number of Julian centuries since J1900 */
- double manom; /* Mean anomaly of the Earth's orbit (degrees) */
- double lperi; /* Mean longitude of perihelion (degrees) */
- double oblq; /* Mean obliquity of the ecliptic (degrees) */
- double eccen; /* Eccentricity of the Earth's orbit (dimensionless) */
- double eccen2, eccen3;
- double tanom; /* True anomaly (approximate formula) (radians) */
- double slong; /* True longitude of the Sun from the Earth (radians) */
- double rs; /* Distance to the sun (AU) */
- double lt; /* Light travel difference to the Sun (days) */
- double l; /* Longitude of star in orbital plane of Earth (radians) */
- double b; /* Latitude of star in orbital plane of Earth (radians) */
- double epoch; /* Epoch of obervation */
- double rs1,rs2;
-
- t = (dj - 2415020.0) / 36525.0;
-
- /* Compute earth orbital parameters */
- manom = 358.47583 + (t * (35999.04975 - t * (0.000150 + t * 0.000003)));
- lperi = 101.22083 + (t * (1.7191733 + t * (0.000453 + t * 0.000003)));
- oblq = 23.452294 - (t * (0.0130125 + t * (0.00000164 - t * 0.000000503)));
- eccen = 0.01675104 - (t * (0.00004180 + t * 0.000000126));
- eccen2 = eccen * eccen;
- eccen3 = eccen * eccen2;
-
- /* Convert to principle angles */
- manom = manom - (360.0 * (dint) (manom / 360.0));
- lperi = lperi - (360.0 * (dint) (lperi / 360.0));
-
- /* Convert to radians */
- manom = degrad (manom);
- lperi = degrad (lperi);
- oblq = degrad (oblq);
-
- /* True anomaly */
- tanom = manom + (2 * eccen - 0.25 * eccen3) * sin (manom) +
- 1.25 * eccen2 * sin (2 * manom) +
- 13./12. * eccen3 * sin (3 * manom);
-
- /* Distance to the Sun */
- rs1 = 1.0 - eccen2;
- rs2 = 1.0 + (eccen * cos (tanom));
- rs = rs1 / rs2;
-
- /* True longitude of the Sun seen from the Earth */
- slong = lperi + tanom + PI;
-
- /* Longitude and latitude of star in orbital plane of the Earth */
- epoch = jd2ep (dj);
- wcscon (sys, WCS_ECLIPTIC, 0.0, 0.0, &ra, &dec, epoch);
- l = degrad (ra);
- b = degrad (dec);
-
- /* Light travel difference to the Sun */
- lt = -0.005770 * rs * cos (b) * cos (l - slong);
-
- /* Return light travel difference */
- return (lt);
-}
-
-
-/* JD2DT-- convert Julian date to date as yyyy.mmdd and time as hh.mmssss */
-
-void
-jd2dt (dj,date,time)
-
-double dj; /* Julian date */
-double *date; /* Date as yyyy.mmdd (returned) */
-double *time; /* Time as hh.mmssxxxx (returned) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
-
- /* Convert Julian Date to date and time */
- jd2i (dj, &iyr, &imon, &iday, &ihr, &imn, &sec, 4);
-
- /* Convert date to yyyy.mmdd */
- if (iyr < 0) {
- *date = (double) (-iyr) + 0.01 * (double) imon + 0.0001 * (double) iday;
- *date = -(*date);
- }
- else
- *date = (double) iyr + 0.01 * (double) imon + 0.0001 * (double) iday;
-
- /* Convert time to hh.mmssssss */
- *time = (double) ihr + 0.01 * (double) imn + 0.0001 * sec;
-
- return;
-}
-
-
-/* JD2I-- convert Julian date to date as year, month, and day, and time hours,
- minutes, and seconds */
-/* after Fliegel and Van Flander, CACM 11, 657 (1968) */
-
-
-void
-jd2i (dj, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-double dj; /* Julian date */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-
-{
- double tsec;
- double frac, dts, ts, sday;
- int jd, l, n, i, j;
-
- tsec = jd2ts (dj);
- /* ts2i (tsec, iyr, imon, iday, ihr, imn, sec, ndsec); */
-
- /* Round seconds to 0 - 4 decimal places */
- if (tsec < 0.0)
- dts = -0.5;
- else
- dts = 0.5;
- if (ndsec < 1)
- ts = dint (tsec + dts);
- else if (ndsec < 2)
- ts = dint (tsec * 10.0 + dts) / 10.0;
- else if (ndsec < 3)
- ts = dint (tsec * 100.0 + dts) / 100.0;
- else if (ndsec < 4)
- ts = dint (tsec * 1000.0 + dts) / 1000.0;
- else
- ts = dint (tsec * 10000.0 + dts) / 10000.0;
-
- /* Convert back to Julian Date */
- dj = ts2jd (ts);
-
- /* Compute time from fraction of a day */
- frac = dmod (dj, 1.0);
- if (frac < 0.5) {
- jd = (int) (dj - frac);
- sday = (frac + 0.5) * 86400.0;
- }
- else {
- jd = (int) (dj - frac) + 1;
- sday = (frac - 0.5) * 86400.0;
- }
-
- *ihr = (int) (sday / 3600.0);
- sday = sday - (double) (*ihr * 3600);
- *imn = (int) (sday / 60.0);
- *sec = sday - (double) (*imn * 60);
-
- /* Compute day, month, year */
- l = jd + 68569;
- n = (4 * l) / 146097;
- l = l - (146097 * n + 3) / 4;
- i = (4000 * (l + 1)) / 1461001;
- l = l - (1461 * i) / 4 + 31;
- j = (80 * l) / 2447;
- *iday = l - (2447 * j) / 80;
- l = j / 11;
- *imon = j + 2 - (12 * l);
- *iyr = 100 * (n - 49) + i + l;
-
- return;
-}
-
-
-/* JD2MJD-- convert Julian Date to Modified Julian Date */
-
-double
-jd2mjd (dj)
-
-double dj; /* Julian Date */
-
-{
- return (dj - 2400000.5);
-}
-
-
-/* JD2EP-- convert Julian date to fractional year as used in epoch */
-
-double
-jd2ep (dj)
-
-double dj; /* Julian date */
-
-{
- double date, time;
- jd2dt (dj, &date, &time);
- return (dt2ep (date, time));
-}
-
-
-/* JD2EPB-- convert Julian date to Besselian epoch */
-
-double
-jd2epb (dj)
-
-double dj; /* Julian date */
-
-{
- return (1900.0 + (dj - 2415020.31352) / 365.242198781);
-}
-
-
-/* JD2EPJ-- convert Julian date to Julian epoch */
-
-double
-jd2epj (dj)
-
-double dj; /* Julian date */
-
-{
- return (2000.0 + (dj - 2451545.0) / 365.25);
-}
-
-
-/* LT2DT-- Return local time as yyyy.mmdd and time as hh.mmssss */
-
-void
-lt2dt(date, time)
-
-double *date; /* Date as yyyy.mmdd (returned) */
-double *time; /* Time as hh.mmssxxxx (returned) */
-
-{
- time_t tsec;
- struct timeval tp;
- struct timezone tzp;
- struct tm *ts;
-
- gettimeofday (&tp,&tzp);
-
- tsec = tp.tv_sec;
- ts = localtime (&tsec);
-
- if (ts->tm_year < 1000)
- *date = (double) (ts->tm_year + 1900);
- else
- *date = (double) ts->tm_year;
- *date = *date + (0.01 * (double) (ts->tm_mon + 1));
- *date = *date + (0.0001 * (double) ts->tm_mday);
- *time = (double) ts->tm_hour;
- *time = *time + (0.01 * (double) ts->tm_min);
- *time = *time + (0.0001 * (double) ts->tm_sec);
-
- return;
-}
-
-
-/* LT2FD-- Return current local time as FITS ISO date string */
-
-char *
-lt2fd()
-{
- time_t tsec;
- struct tm *ts;
- struct timeval tp;
- struct timezone tzp;
- int month, day, year, hour, minute, second;
- char *isotime;
-
- gettimeofday (&tp,&tzp);
- tsec = tp.tv_sec;
-
- ts = localtime (&tsec);
-
- year = ts->tm_year;
- if (year < 1000)
- year = year + 1900;
- month = ts->tm_mon + 1;
- day = ts->tm_mday;
- hour = ts->tm_hour;
- minute = ts->tm_min;
- second = ts->tm_sec;
-
- isotime = (char *) calloc (32, sizeof (char));
- sprintf (isotime, "%04d-%02d-%02dT%02d:%02d:%02d",
- year, month, day, hour, minute, second);
- return (isotime);
-}
-
-
-/* LT2TSI-- Return local time as IRAF seconds since 1980-01-01 00:00 */
-
-int
-lt2tsi()
-{
- return ((int)(lt2ts() - 946684800.0));
-}
-
-
-/* LT2TSU-- Return local time as Unix seconds since 1970-01-01 00:00 */
-
-time_t
-lt2tsu()
-{
- return ((time_t)(lt2ts() - 631152000.0));
-}
-
-/* LT2TS-- Return local time as Unix seconds since 1950-01-01 00:00 */
-
-double
-lt2ts()
-{
- double tsec;
- char *datestring;
- datestring = lt2fd();
- tsec = fd2ts (datestring);
- free (datestring);
- return (tsec);
-}
-
-
-/* MJD2DT-- convert Modified Julian Date to date (yyyy.mmdd) time (hh.mmssss) */
-
-void
-mjd2dt (dj,date,time)
-
-double dj; /* Modified Julian Date */
-double *date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double *time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double tsec;
-
- tsec = jd2ts (dj + 2400000.5);
- ts2dt (tsec, date, time);
-
- return;
-}
-
-
-/* MJD2I-- convert Modified Julian Date to date as year, month, day and
- time as hours, minutes, seconds */
-
-void
-mjd2i (dj, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-double dj; /* Modified Julian Date */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-
-{
- double tsec;
-
- tsec = jd2ts (dj + 2400000.5);
- ts2i (tsec, iyr, imon, iday, ihr, imn, sec, ndsec);
- return;
-}
-
-
-/* MJD2DOY-- convert Modified Julian Date to Year,Day-of-Year */
-
-void
-mjd2doy (dj, year, doy)
-
-double dj; /* Modified Julian Date */
-int *year; /* Year (returned) */
-double *doy; /* Day of year with fraction (returned) */
-
-{
- jd2doy (dj + 2400000.5, year, doy);
- return;
-}
-
-
-/* MJD2JD-- convert Modified Julian Date to Julian Date */
-
-double
-mjd2jd (dj)
-
-double dj; /* Modified Julian Date */
-
-{
- return (dj + 2400000.5);
-}
-
-
-/* MJD2EP-- convert Modified Julian Date to fractional year */
-
-double
-mjd2ep (dj)
-
-double dj; /* Modified Julian Date */
-
-{
- double date, time;
- jd2dt (dj + 2400000.5, &date, &time);
- return (dt2ep (date, time));
-}
-
-
-/* MJD2EPB-- convert Modified Julian Date to Besselian epoch */
-
-double
-mjd2epb (dj)
-
-double dj; /* Modified Julian Date */
-
-{
- return (1900.0 + (dj - 15019.81352) / 365.242198781);
-}
-
-
-/* MJD2EPJ-- convert Modified Julian Date to Julian epoch */
-
-double
-mjd2epj (dj)
-
-double dj; /* Modified Julian Date */
-
-{
- return (2000.0 + (dj - 51544.5) / 365.25);
-}
-
-
-/* MJD2FD-- convert modified Julian date to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-mjd2fd (dj)
-
-double dj; /* Modified Julian date */
-{
- return (jd2fd (dj + 2400000.5));
-}
-
-
-/* MJD2TS-- convert modified Julian date to seconds since 1950.0 */
-
-double
-mjd2ts (dj)
-
-double dj; /* Modified Julian date */
-{
- return ((dj - 33282.0) * 86400.0);
-}
-
-
-/* EP2FD-- convert fractional year to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-ep2fd (epoch)
-
-double epoch; /* Date as fractional year */
-{
- double tsec; /* seconds since 1950.0 (returned) */
- tsec = ep2ts (epoch);
- return (ts2fd (tsec));
-}
-
-
-/* EPB2FD-- convert Besselian epoch to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-epb2fd (epoch)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-{
- double dj; /* Julian Date */
- dj = epb2jd (epoch);
- return (jd2fd (dj));
-}
-
-
-/* EPJ2FD-- convert Julian epoch to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-epj2fd (epoch)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-{
- double dj; /* Julian Date */
- dj = epj2jd (epoch);
- return (jd2fd (dj));
-}
-
-
-/* EP2TS-- convert fractional year to seconds since 1950.0 */
-
-double
-ep2ts (epoch)
-
-double epoch; /* Date as fractional year */
-{
- double dj;
- dj = ep2jd (epoch);
- return ((dj - 2433282.5) * 86400.0);
-}
-
-
-/* EPB2TS-- convert Besselian epoch to seconds since 1950.0 */
-
-double
-epb2ts (epoch)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-{
- double dj;
- dj = epb2jd (epoch);
- return ((dj - 2433282.5) * 86400.0);
-}
-
-
-/* EPJ2TS-- convert Julian epoch to seconds since 1950.0 */
-
-double
-epj2ts (epoch)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-{
- double dj;
- dj = epj2jd (epoch);
- return ((dj - 2433282.5) * 86400.0);
-}
-
-
-/* EPB2EP-- convert Besselian epoch to fractional years */
-
-double
-epb2ep (epoch)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-{
- double dj;
- dj = epb2jd (epoch);
- return (jd2ep (dj));
-}
-
-
-/* EP2EPB-- convert fractional year to Besselian epoch */
-
-double
-ep2epb (epoch)
-
-double epoch; /* Fractional year */
-{
- double dj;
- dj = ep2jd (epoch);
- return (jd2epb (dj));
-}
-
-
-/* EPJ2EP-- convert Julian epoch to fractional year */
-
-double
-epj2ep (epoch)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-{
- double dj;
- dj = epj2jd (epoch);
- return (jd2ep (dj));
-}
-
-
-/* EP2EPJ-- convert fractional year to Julian epoch */
-
-double
-ep2epj (epoch)
-
-double epoch; /* Fractional year */
-{
- double dj;
- dj = ep2jd (epoch);
- return (jd2epj (dj));
-}
-
-
-/* EP2I-- convert fractional year to year month day hours min sec */
-
-void
-ep2i (epoch, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-double epoch; /* Date as fractional year */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-{
- double date, time;
-
- ep2dt (epoch, &date, &time);
- dt2i (date, time, iyr,imon,iday,ihr,imn,sec, ndsec);
- return;
-}
-
-
-/* EPB2I-- convert Besselian epoch to year month day hours min sec */
-
-void
-epb2i (epoch, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-{
- double date, time;
-
- epb2dt (epoch, &date, &time);
- dt2i (date, time, iyr,imon,iday,ihr,imn,sec, ndsec);
- return;
-}
-
-
-/* EPJ2I-- convert Julian epoch to year month day hours min sec */
-
-void
-epj2i (epoch, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-{
- double date, time;
-
- epj2dt (epoch, &date, &time);
- dt2i (date, time, iyr,imon,iday,ihr,imn,sec, ndsec);
- return;
-}
-
-
-/* EP2JD-- convert fractional year as used in epoch to Julian date */
-
-double
-ep2jd (epoch)
-
-double epoch; /* Date as fractional year */
-
-{
- double dj; /* Julian date (returned)*/
- double date, time;
-
- ep2dt (epoch, &date, &time);
- dj = dt2jd (date, time);
- return (dj);
-}
-
-
-/* EPB2JD-- convert Besselian epoch to Julian Date */
-
-double
-epb2jd (epoch)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-
-{
- return (2415020.31352 + ((epoch - 1900.0) * 365.242198781));
-}
-
-
-/* EPJ2JD-- convert Julian epoch to Julian Date */
-
-double
-epj2jd (epoch)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-
-{
- return (2451545.0 + ((epoch - 2000.0) * 365.25));
-}
-
-
-/* EP2MJD-- convert fractional year as used in epoch to modified Julian date */
-
-double
-ep2mjd (epoch)
-
-double epoch; /* Date as fractional year */
-
-{
- double dj; /* Julian date (returned)*/
- double date, time;
-
- ep2dt (epoch, &date, &time);
- dj = dt2jd (date, time);
- return (dj - 2400000.5);
-}
-
-
-/* EPB2MJD-- convert Besselian epoch to modified Julian Date */
-
-double
-epb2mjd (epoch)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-
-{
- return (15019.81352 + ((epoch - 1900.0) * 365.242198781));
-}
-
-
-/* EPJ2MJD-- convert Julian epoch to modified Julian Date */
-
-double
-epj2mjd (epoch)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-
-{
- return (51544.5 + ((epoch - 2000.0) * 365.25));
-}
-
-
-
-/* EPB2EPJ-- convert Besselian epoch to Julian epoch */
-
-double
-epb2epj (epoch)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-{
- double dj; /* Julian date */
- dj = epb2jd (epoch);
- return (jd2epj (dj));
-}
-
-
-/* EPJ2EPB-- convert Julian epoch to Besselian epoch */
-
-double
-epj2epb (epoch)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-{
- double dj; /* Julian date */
- dj = epj2jd (epoch);
- return (jd2epb (dj));
-}
-
-
-/* JD2FD-- convert Julian date to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-jd2fd (dj)
-
-double dj; /* Julian date */
-{
- double tsec; /* seconds since 1950.0 (returned) */
- tsec = (dj - 2433282.5) * 86400.0;
- return (ts2fd (tsec));
-}
-
-
-/* JD2TS-- convert Julian date to seconds since 1950.0 */
-
-double
-jd2ts (dj)
-
-double dj; /* Julian date */
-{
- return ((dj - 2433282.5) * 86400.0);
-}
-
-
-/* JD2TSI-- convert Julian date to IRAF seconds since 1980-01-01T0:00 */
-
-int
-jd2tsi (dj)
-
-double dj; /* Julian date */
-{
- double ts;
- ts = (dj - 2444239.5) * 86400.0;
- return ((int) ts);
-}
-
-
-/* JD2TSU-- convert Julian date to Unix seconds since 1970-01-01T0:00 */
-
-time_t
-jd2tsu (dj)
-
-double dj; /* Julian date */
-{
- return ((time_t)((dj - 2440587.5) * 86400.0));
-}
-
-
-/* DT2DOY-- convert yyyy.mmdd hh.mmss to year and day of year */
-
-void
-dt2doy (date, time, year, doy)
-
-double date; /* Date as yyyy.mmdd */
-double time; /* Time as hh.mmssxxxx */
-int *year; /* Year (returned) */
-double *doy; /* Day of year with fraction (returned) */
-{
- double dj; /* Julian date */
- double dj0; /* Julian date on January 1 0:00 */
- double date0; /* January first of date's year */
- double dyear;
-
- dyear = floor (date);
- date0 = dyear + 0.0101;
- dj0 = dt2jd (date0, 0.0);
- dj = dt2jd (date, time);
- *year = (int) (dyear + 0.00000001);
- *doy = dj - dj0 + 1.0;
- return;
-}
-
-
-/* DOY2DT-- convert year and day of year to yyyy.mmdd hh.mmss */
-
-void
-doy2dt (year, doy, date, time)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-double *date; /* Date as yyyy.mmdd (returned) */
-double *time; /* Time as hh.mmssxxxx (returned) */
-{
- double dj; /* Julian date */
- double dj0; /* Julian date on January 1 0:00 */
- double date0; /* January first of date's year */
-
- date0 = year + 0.0101;
- dj0 = dt2jd (date0, 0.0);
- dj = dj0 + doy - 1.0;
- jd2dt (dj, date, time);
- return;
-}
-
-
-/* DOY2EP-- convert year and day of year to fractional year as used in epoch */
-
-double
-doy2ep (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double date, time;
- doy2dt (year, doy, &date, &time);
- return (dt2ep (date, time));
-}
-
-
-
-/* DOY2EPB-- convert year and day of year to Besellian epoch */
-
-double
-doy2epb (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj;
- dj = doy2jd (year, doy);
- return (jd2epb (dj));
-}
-
-
-/* DOY2EPJ-- convert year and day of year to Julian epoch */
-
-double
-doy2epj (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj;
- dj = doy2jd (year, doy);
- return (jd2epj (dj));
-}
-
-
-/* DOY2FD-- convert year and day of year to FITS date */
-
-char *
-doy2fd (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj; /* Julian date */
-
- dj = doy2jd (year, doy);
- return (jd2fd (dj));
-}
-
-
-/* DOY2JD-- convert year and day of year to Julian date */
-
-double
-doy2jd (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj0; /* Julian date */
- double date; /* Date as yyyy.mmdd (returned) */
- double time; /* Time as hh.mmssxxxx (returned) */
-
- date = (double) year + 0.0101;
- time = 0.0;
- dj0 = dt2jd (date, time);
- return (dj0 + doy - 1.0);
-}
-
-
-/* DOY2MJD-- convert year and day of year to Julian date */
-
-double
-doy2mjd (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj0; /* Julian date */
- double date; /* Date as yyyy.mmdd (returned) */
- double time; /* Time as hh.mmssxxxx (returned) */
-
- date = (double) year + 0.0101;
- time = 0.0;
- dj0 = dt2jd (date, time);
- return (dj0 + doy - 1.0 - 2400000.5);
-}
-
-
-/* DOY2TSU-- convert from FITS date to Unix seconds since 1970-01-01T0:00 */
-
-time_t
-doy2tsu (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj;
- dj = doy2jd (year, doy);
- return ((time_t)jd2ts (dj));
-}
-
-
-/* DOY2TSI-- convert from FITS date to IRAF seconds since 1980-01-01T0:00 */
-
-int
-doy2tsi (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj;
- dj = doy2jd (year, doy);
- return ((int)jd2tsi (dj));
-}
-
-
-/* DOY2TS-- convert year, day of year to seconds since 1950 */
-
-double
-doy2ts (year, doy)
-
-int year; /* Year */
-double doy; /* Day of year with fraction */
-{
- double dj;
- dj = doy2jd (year, doy);
- return (jd2ts (dj));
-}
-
-
-/* FD2DOY-- convert FITS date to year and day of year */
-
-void
-fd2doy (string, year, doy)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-int *year; /* Year (returned) */
-double *doy; /* Day of year with fraction (returned) */
-{
- double dj; /* Julian date */
-
- dj = fd2jd (string);
- jd2doy (dj, year, doy);
- return;
-}
-
-
-/* JD2DOY-- convert Julian date to year and day of year */
-
-void
-jd2doy (dj, year, doy)
-
-double dj; /* Julian date */
-int *year; /* Year (returned) */
-double *doy; /* Day of year with fraction (returned) */
-{
- double date; /* Date as yyyy.mmdd (returned) */
- double time; /* Time as hh.mmssxxxx (returned) */
- double dj0; /* Julian date at 0:00 on 1/1 */
- double dyear;
-
- jd2dt (dj, &date, &time);
- *year = (int) date;
- dyear = (double) *year;
- dj0 = dt2jd (dyear+0.0101, 0.0);
- *doy = dj - dj0 + 1.0;
- return;
-}
-
-
-/* TS2JD-- convert seconds since 1950.0 to Julian date */
-
-double
-ts2jd (tsec)
-
-double tsec; /* seconds since 1950.0 */
-{
- return (2433282.5 + (tsec / 86400.0));
-}
-
-
-/* TS2MJD-- convert seconds since 1950.0 to modified Julian date */
-
-double
-ts2mjd (tsec)
-
-double tsec; /* seconds since 1950.0 */
-{
- return (33282.0 + (tsec / 86400.0));
-}
-
-
-/* TS2EP-- convert seconds since 1950.0 to fractional year as used in epoch */
-
-double
-ts2ep (tsec)
-
-double tsec; /* Seconds since 1950.0 */
-
-{
- double date, time;
- ts2dt (tsec, &date, &time);
- return (dt2ep (date, time));
-}
-
-
-/* TS2EPB-- convert seconds since 1950.0 to Besselian epoch */
-
-double
-ts2epb (tsec)
-
-double tsec; /* Seconds since 1950.0 */
-
-{
- double dj; /* Julian Date */
- dj = ts2jd (tsec);
- return (jd2epb (dj));
-}
-
-
-/* TS2EPB-- convert seconds since 1950.0 to Julian epoch */
-
-double
-ts2epj (tsec)
-
-double tsec; /* Seconds since 1950.0 */
-
-{
- double dj; /* Julian Date */
- dj = ts2jd (tsec);
- return (jd2epj (dj));
-}
-
-
-/* DT2EP-- convert from date, time as yyyy.mmdd hh.mmsss to fractional year */
-
-double
-dt2ep (date, time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double epoch; /* Date as fractional year (returned) */
- double dj, dj0, dj1, date0, time0, date1;
-
- dj = dt2jd (date, time);
- if (date == 0.0)
- epoch = dj / 365.2422;
- else {
- time0 = 0.0;
- date0 = dint (date) + 0.0101;
- date1 = dint (date) + 1.0101;
- dj0 = dt2jd (date0, time0);
- dj1 = dt2jd (date1, time0);
- epoch = dint (date) + ((dj - dj0) / (dj1 - dj0));
- }
- return (epoch);
-}
-
-
-/* DT2EPB-- convert from date, time as yyyy.mmdd hh.mmsss to Besselian epoch */
-
-double
-dt2epb (date, time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj; /* Julian date */
- double epoch; /* Date as fractional year (returned) */
- dj = dt2jd (date, time);
- if (date == 0.0)
- epoch = dj / 365.242198781;
- else
- epoch = jd2epb (dj);
- return (epoch);
-}
-
-
-/* DT2EPJ-- convert from date, time as yyyy.mmdd hh.mmsss to Julian epoch */
-
-double
-dt2epj (date, time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj; /* Julian date */
- double epoch; /* Date as fractional year (returned) */
- dj = dt2jd (date, time);
- if (date == 0.0)
- epoch = dj / 365.25;
- else
- epoch = jd2epj (dj);
- return (epoch);
-}
-
-
-/* EP2DT-- convert from fractional year to date, time as yyyy.mmdd hh.mmsss */
-
-void
-ep2dt (epoch, date, time)
-
-double epoch; /* Date as fractional year */
-double *date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double *time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj, dj0, dj1, date0, time0, date1, epochi, epochf;
-
- time0 = 0.0;
- epochi = dint (epoch);
- epochf = epoch - epochi;
- date0 = epochi + 0.0101;
- date1 = epochi + 1.0101;
- dj0 = dt2jd (date0, time0);
- dj1 = dt2jd (date1, time0);
- dj = dj0 + epochf * (dj1 - dj0);
- jd2dt (dj, date, time);
- return;
-}
-
-
-/* EPB2DT-- convert from Besselian epoch to date, time as yyyy.mmdd hh.mmsss */
-
-void
-epb2dt (epoch, date, time)
-
-double epoch; /* Besselian epoch (fractional 365.242198781-day years) */
-double *date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double *time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj; /* Julian date */
- dj = epb2jd (epoch);
- jd2dt (dj, date, time);
-}
-
-
-/* EPJ2DT-- convert from Julian epoch to date, time as yyyy.mmdd hh.mmsss */
-
-void
-epj2dt (epoch, date, time)
-
-double epoch; /* Julian epoch (fractional 365.25-day years) */
-double *date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double *time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double dj; /* Julian date */
- dj = epj2jd (epoch);
- jd2dt (dj, date, time);
-}
-
-
-/* FD2JD-- convert FITS standard date to Julian date */
-
-double
-fd2jd (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double date, time;
-
- fd2dt (string, &date, &time);
- return (dt2jd (date, time));
-}
-
-
-/* FD2MJD-- convert FITS standard date to modified Julian date */
-
-double
-fd2mjd (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- return (fd2jd (string) - 2400000.5);
-}
-
-
-/* FD2TSU-- convert from FITS date to Unix seconds since 1970-01-01T0:00 */
-
-time_t
-fd2tsu (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double date, time;
- fd2dt (string, &date, &time);
- return (dt2tsu (date, time));
-}
-
-
-/* FD2TSI-- convert from FITS date to IRAF seconds since 1980-01-01T0:00 */
-
-int
-fd2tsi (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double date, time;
- fd2dt (string, &date, &time);
- return (dt2tsi (date, time));
-}
-
-
-/* FD2TS-- convert FITS standard date to seconds since 1950 */
-
-double
-fd2ts (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double date, time;
- fd2dt (string, &date, &time);
- return (dt2ts (date, time));
-}
-
-
-/* FD2FD-- convert any FITS standard date to ISO FITS standard date */
-
-char *
-fd2fd (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double date, time;
- fd2dt (string, &date, &time);
- return (dt2fd (date, time));
-}
-
-
-/* FD2OF-- convert any FITS standard date to old FITS standard date time */
-
-char *
-fd2of (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
-
- fd2i (string,&iyr,&imon,&iday,&ihr,&imn,&sec, 3);
-
- /* Convert to old FITS date format */
- string = (char *) calloc (32, sizeof (char));
- if (iyr < 1900)
- sprintf (string, "*** date out of range ***");
- else if (iyr < 2000)
- sprintf (string, "%02d/%02d/%02d %02d:%02d:%06.3f",
- iday, imon, iyr-1900, ihr, imn, sec);
- else if (iyr < 2900.0)
- sprintf (string, "%02d/%02d/%3d %02d:%02d:%6.3f",
- iday, imon, iyr-1900, ihr, imn, sec);
- else
- sprintf (string, "*** date out of range ***");
- return (string);
-}
-
-
-/* TAI-UTC from the U.S. Naval Observatory */
-/* ftp://maia.usno.navy.mil/ser7/tai-utc.dat */
-static double taijd[26]={2441317.5, 2441499.5, 2441683.5, 2442048.5, 2442413.5,
- 2442778.5, 2443144.5, 2443509.5, 2443874.5, 2444239.5, 2444786.5,
- 2445151.5, 2445516.5, 2446247.5, 2447161.5, 2447892.5, 2448257.5,
- 2448804.5, 2449169.5, 2449534.5, 2450083.5, 2450630.5, 2451179.5,
- 2453736.5, 2454832.5, 2456293.5};
-static double taidt[26]={10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,
- 20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,
- 33.0,34.0,35.0};
-static double dttab[173]={13.7,13.4,13.1,12.9,12.7,12.6,12.5,12.5,12.5,12.5,
- 12.5,12.5,12.5,12.5,12.5,12.5,12.5,12.4,12.3,12.2,12.0,11.7,11.4,
- 11.1,10.6,10.2, 9.6, 9.1, 8.6, 8.0, 7.5, 7.0, 6.6, 6.3, 6.0, 5.8,
- 5.7, 5.6, 5.6, 5.6, 5.7, 5.8, 5.9, 6.1, 6.2, 6.3, 6.5, 6.6, 6.8,
- 6.9, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.7, 7.8, 7.8,7.88,7.82,
- 7.54, 6.97, 6.40, 6.02, 5.41, 4.10, 2.92, 1.82, 1.61, 0.10,-1.02,
- -1.28,-2.69,-3.24,-3.64,-4.54,-4.71,-5.11,-5.40,-5.42,-5.20,-5.46,
- -5.46,-5.79,-5.63,-5.64,-5.80,-5.66,-5.87,-6.01,-6.19,-6.64,-6.44,
- -6.47,-6.09,-5.76,-4.66,-3.74,-2.72,-1.54,-0.02, 1.24, 2.64, 3.86,
- 5.37, 6.14, 7.75, 9.13,10.46,11.53,13.36,14.65,16.01,17.20,18.24,
- 19.06,20.25,20.95,21.16,22.25,22.41,23.03,23.49,23.62,23.86,24.49,
- 24.34,24.08,24.02,24.00,23.87,23.95,23.86,23.93,23.73,23.92,23.96,
- 24.02,24.33,24.83,25.30,25.70,26.24,26.77,27.28,27.78,28.25,28.71,
- 29.15,29.57,29.97,30.36,30.72,31.07,31.35,31.68,32.18,32.68,33.15,
- 33.59,34.00,34.47,35.03,35.73,36.54,37.43,38.29,39.20,40.18,41.17,
- 42.23};
-
-
-/* TAI2FD-- convert from TAI in FITS format to UT in FITS format */
-
-char *
-tai2fd (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double dj0, dj, tsec, dt;
-
- dj0 = fd2jd (string);
- dt = utdt (dj0);
- dj = dj0 - (dt / 86400.0);
- dt = utdt (dj);
- tsec = fd2ts (string);
- tsec = tsec - dt + 32.184;
- return (ts2fd (tsec));
-}
-
-
-/* FD2TAI-- convert from UT in FITS format to TAI in FITS format */
-
-char *
-fd2tai (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double dj, tsec, dt;
-
- dj = fd2jd (string);
- dt = utdt (dj);
- tsec = fd2ts (string);
- tsec = tsec + dt - 32.184;
- return (ts2fd (tsec));
-}
-
-
-/* DT2TAI-- convert from UT as yyyy.mmdd hh.mmssss to TAI in same format */
-
-void
-dt2tai (date, time)
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double dj, dt, tsec;
-
- dj = dt2jd (*date, *time);
- dt = utdt (dj);
- tsec = dt2ts (*date, *time);
- tsec = tsec + dt - 32.184;
- ts2dt (tsec, date, time);
- return;
-}
-
-
-/* TAI2DT-- convert from TAI as yyyy.mmdd hh.mmssss to UT in same format */
-
-void
-tai2dt (date, time)
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double dj, dt, tsec, tsec0;
-
- dj = dt2jd (*date, *time);
- dt = utdt (dj);
- tsec0 = dt2ts (*date, *time);
- tsec = tsec0 + dt;
- dj = ts2jd (tsec);
- dt = utdt (dj);
- tsec = tsec0 + dt + 32.184;
- ts2dt (tsec, date, time);
- return;
-}
-
-
-/* ET2FD-- convert from ET (or TDT or TT) in FITS format to UT in FITS format */
-
-char *
-et2fd (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double dj0, dj, tsec, dt;
-
- dj0 = fd2jd (string);
- dt = utdt (dj0);
- dj = dj0 - (dt / 86400.0);
- dt = utdt (dj);
- tsec = fd2ts (string);
- tsec = tsec - dt;
- return (ts2fd (tsec));
-}
-
-
-/* FD2ET-- convert from UT in FITS format to ET (or TDT or TT) in FITS format */
-
-char *
-fd2et (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double dj, tsec, dt;
-
- dj = fd2jd (string);
- dt = utdt (dj);
- tsec = fd2ts (string);
- tsec = tsec + dt;
- return (ts2fd (tsec));
-}
-
-
-/* DT2ET-- convert from UT as yyyy.mmdd hh.mmssss to ET in same format */
-
-void
-dt2et (date, time)
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double dj, dt, tsec;
-
- dj = dt2jd (*date, *time);
- dt = utdt (dj);
- tsec = dt2ts (*date, *time);
- tsec = tsec + dt;
- ts2dt (tsec, date, time);
- return;
-}
-
-
-/* EDT2DT-- convert from ET as yyyy.mmdd hh.mmssss to UT in same format */
-
-void
-edt2dt (date, time)
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double dj, dt, tsec, tsec0;
-
- dj = dt2jd (*date, *time);
- dt = utdt (dj);
- tsec0 = dt2ts (*date, *time);
- tsec = tsec0 + dt;
- dj = ts2jd (tsec);
- dt = utdt (dj);
- tsec = tsec0 + dt;
- ts2dt (tsec, date, time);
- return;
-}
-
-
-/* JD2JED-- convert from Julian Date to Julian Ephemeris Date */
-
-double
-jd2jed (dj)
-
-double dj; /* Julian Date */
-{
- double dt;
-
- dt = utdt (dj);
- return (dj + (dt / 86400.0));
-}
-
-
-/* JED2JD-- convert from Julian Ephemeris Date to Julian Date */
-
-double
-jed2jd (dj)
-
-double dj; /* Julian Ephemeris Date */
-{
- double dj0, dt;
-
- dj0 = dj;
- dt = utdt (dj);
- dj = dj0 - (dt / 86400.0);
- dt = utdt (dj);
- return (dj - (dt / 86400.0));
-}
-
-
-/* TS2ETS-- convert from UT in seconds since 1950-01-01 to ET in same format */
-
-double
-ts2ets (tsec)
-
-double tsec;
-{
- double dj, dt;
-
- dj = ts2jd (tsec);
- dt = utdt (dj);
- return (tsec + dt);
-}
-
-
-/* ETS2TS-- convert from ET in seconds since 1950-01-01 to UT in same format */
-
-double
-ets2ts (tsec)
-
-double tsec;
-{
- double dj, dj0, dt;
-
- dj0 = ts2jd (tsec);
- dt = utdt (dj0);
- dj = dj0 - (dt / 86400.0);
- dt = utdt (dj);
- return (tsec - dt);
-}
-
-
-/* UTDT-- Compute difference between UT and dynamical time (ET-UT) */
-
-double
-utdt (dj)
-
-double dj; /* Julian Date (UT) */
-{
- double dt, date, time, ts, ts1, ts0, date0, yfrac, diff, cj;
- int i, iyr, iyear;
-
- /* If after 1972-01-01, use tabulated TAI-UT */
- if (dj >= 2441317.5) {
- dt = 0.0;
- for (i = 22; i > 0; i--) {
- if (dj >= taijd[i])
- dt = taidt[i];
- }
- dt = dt + 32.184;
- }
-
- /* For 1800-01-01 to 1972-01-01, use table of ET-UT from AE */
- else if (dj >= 2378496.5) {
- jd2dt (dj, &date, &time);
- ts = jd2ts (dj);
- iyear = (int) date;
- iyr = iyear - 1800;
- date0 = (double) iyear + 0.0101;
- ts0 = dt2ts (date0, 0.0);
- date0 = (double) (iyear + 1) + 0.0101;
- ts1 = dt2ts (date0, 0.0);
- yfrac = (ts - ts0) / (ts1 - ts0);
- diff = dttab[iyr+1] - dttab[iyr];
- dt = dttab[iyr] + (diff * yfrac);
- }
-
- /* Compute back to 1600 using formula from McCarthy and Babcock (1986) */
- else if (dj >= 2305447.5) {
- cj = (dj - 2378496.5) / 36525.0;
- dt = 5.156 + 13.3066 * (cj - 0.19) * (cj - 0.19);
- }
-
- /* Compute back to 948 using formula from Stephenson and Morrison (1984) */
- else if (dj >= 2067309.5) {
- cj = (dj - 2378496.5) / 36525.0;
- dt = 25.5 * cj * cj;
- }
-
- /*Compute back to 390 BC using formula from Stephenson and Morrison (1984)*/
- else if (dj >= 0.0) {
- cj = (dj = 2378496.5) / 36525.0;
- dt = 1360.0 + (320.0 * cj) + (44.3 * cj * cj);
- }
-
- else
- dt = 0.0;
- return (dt);
-}
-
-
-/* FD2OFD-- convert any FITS standard date to old FITS standard date */
-
-char *
-fd2ofd (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
-
- fd2i (string,&iyr,&imon,&iday,&ihr,&imn,&sec, 3);
-
- /* Convert to old FITS date format */
- string = (char *) calloc (32, sizeof (char));
- if (iyr < 1900)
- sprintf (string, "*** date out of range ***");
- else if (iyr < 2000)
- sprintf (string, "%02d/%02d/%02d", iday, imon, iyr-1900);
- else if (iyr < 2900.0)
- sprintf (string, "%02d/%02d/%3d", iday, imon, iyr-1900);
- else
- sprintf (string, "*** date out of range ***");
- return (string);
-}
-
-
-/* FD2OFT-- convert any FITS standard date to old FITS standard time */
-
-char *
-fd2oft (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
-
- fd2i (string,&iyr,&imon,&iday,&ihr,&imn,&sec, 3);
-
- /* Convert to old FITS date format */
- string = (char *) calloc (32, sizeof (char));
- sprintf (string, "%02d:%02d:%06.3f", ihr, imn, sec);
- return (string);
-}
-
-
-/* FD2DT-- convert FITS standard date to date, time as yyyy.mmdd hh.mmsss */
-
-void
-fd2dt (string, date, time)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-double *date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double *time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
-
- fd2i (string,&iyr,&imon,&iday,&ihr,&imn,&sec, 4);
-
- /* Convert date to yyyy.mmdd */
- if (iyr < 0) {
- *date = (double) (-iyr) + 0.01 * (double) imon + 0.0001 * (double) iday;
- *date = -(*date);
- }
- else
- *date = (double) iyr + 0.01 * (double) imon + 0.0001 * (double) iday;
-
- /* Convert time to hh.mmssssss */
- *time = (double) ihr + 0.01 * (double) imn + 0.0001 * sec;
-
- return;
-}
-
-
-/* FD2EP-- convert from FITS standard date to fractional year */
-
-double
-fd2ep (string)
-
-char *string; /* FITS date string, which may be:
- yyyy.ffff (fractional year)
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard FITS use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-
-{
- double dj; /* Julian date */
- dj = fd2jd (string);
- if (dj < 1.0)
- return (dj / 365.2422);
- else
- return (jd2ep (dj));
-}
-
-
-/* FD2EPB-- convert from FITS standard date to Besselian epoch */
-
-double
-fd2epb (string)
-
-char *string; /* FITS date string, which may be:
- yyyy.ffff (fractional year)
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard FITS use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-
-{
- double dj; /* Julian date */
- dj = fd2jd (string);
- if (dj < 1.0)
- return (dj / 365.242198781);
- else
- return (jd2epb (dj));
-}
-
-
-/* FD2EPJ-- convert from FITS standard date to Julian epoch */
-
-double
-fd2epj (string)
-
-char *string; /* FITS date string, which may be:
- yyyy.ffff (fractional year)
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard FITS use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-
-{
- double dj; /* Julian date */
- dj = fd2jd (string);
- if (dj < 1.0)
- return (dj / 365.25);
- else
- return (jd2epj (dj));
-}
-
-
-/* DT2TSU-- convert from date and time to Unix seconds since 1970-01-01T0:00 */
-
-time_t
-dt2tsu (date,time)
-
-double date; /* Date as yyyy.mmdd */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- return ((time_t)(dt2ts (date, time) - 631152000.0));
-}
-
-
-/* DT2TSI-- convert from date and time to IRAF seconds since 1980-01-01T0:00 */
-
-int
-dt2tsi (date,time)
-
-double date; /* Date as yyyy.mmdd */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- return ((int)(dt2ts (date, time) - 946684800.0));
-}
-
-
-
-/* DT2TS-- convert from date, time as yyyy.mmdd hh.mmsss to sec since 1950.0 */
-
-double
-dt2ts (date,time)
-
-double date; /* Date as yyyy.mmdd
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- double tsec; /* Seconds past 1950.0 (returned) */
-
- double dh,dm,dd;
- int iy,im,id;
-
-/* Calculate the number of full years, months, and days already
- * elapsed since 0h, March 1, -1 (up to most recent midnight). */
-
- /* convert time of day to elapsed seconds */
-
- /* If time is < 0, it is assumed to be a fractional day */
- if (time < 0.0)
- tsec = time * -86400.0;
- else {
- dh = (int) (time + 0.0000000001);
- dm = (int) (((time - dh) * 100.0) + 0.0000000001);
- tsec = (time * 10000.0) - (dh * 10000.0) - (dm * 100.0);
- tsec = (int) (tsec * 100000.0 + 0.0001) / 100000.0;
- tsec = tsec + (dm * 60.0) + (dh * 3600.0);
- }
-
-
- /* Calculate the number of full months elapsed since
- * the current or most recent March */
- if (date >= 0.0301) {
- iy = (int) (date + 0.0000000001);
- im = (int) (((date - (double) (iy)) * 10000.0) + 0.00000001);
- id = im % 100;
- im = (im / 100) + 9;
- if (im < 12) iy = iy - 1;
- im = im % 12;
- id = id - 1;
-
- /* starting with March as month 0 and ending with the following
- * February as month 11, the calculation of the number of days
- * per month reduces to a simple formula. the following statement
- * determines the number of whole days elapsed since 3/1/-1 and then
- * subtracts the 712163 days between then and 1/1/1950. it converts
- * the result to seconds and adds the accumulated seconds above. */
- id = id + ((im+1+im/6+im/11)/2 * 31) + ((im-im/6-im/11)/2 * 30) +
- (iy / 4) - (iy / 100) + (iy / 400);
- dd = (double) id + (365.0 * (double) iy) - 712163.0;
- tsec = tsec + (dd * 86400.0);
- }
-
- return (tsec);
-}
-
-
-/* TS2DT-- convert seconds since 1950.0 to date, time as yyyy.mmdd hh.mmssss */
-
-void
-ts2dt (tsec,date,time)
-
-double tsec; /* Seconds past 1950.0 */
-double *date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double *time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-{
- int iyr,imon,iday,ihr,imn;
- double sec;
-
- ts2i (tsec,&iyr,&imon,&iday,&ihr,&imn,&sec, 4);
-
- /* Convert date to yyyy.mmdd */
- if (iyr < 0) {
- *date = (double) (-iyr) + 0.01 * (double) imon + 0.0001 * (double) iday;
- *date = -(*date);
- }
- else
- *date = (double) iyr + 0.01 * (double) imon + 0.0001 * (double) iday;
-
- /* Convert time to hh.mmssssss */
- *time = (double) ihr + 0.01 * (double) imn + 0.0001 * sec;
-
- return;
-}
-
-
-/* TSI2DT-- Convert seconds since 1980-01-01 to date yyyy.ddmm, time hh.mmsss */
-
-void
-tsi2dt (isec,date,time)
-
-int isec; /* Seconds past 1980-01-01 */
-double *date; /* Date as yyyy.mmdd (returned) */
-double *time; /* Time as hh.mmssxxxx (returned) */
-{
- ts2dt (tsi2ts (isec), date, time);
-}
-
-
-/* TSI2FD-- Convert seconds since 1980-01-01 to FITS standard date string */
-
-char *
-tsi2fd (isec)
-
-int isec; /* Seconds past 1980-01-01 */
-{
- return (ts2fd (tsi2ts (isec)));
-}
-
-
-/* TSI2TS-- Convert seconds since 1980-01-01 to seconds since 1950-01-01 */
-
-double
-tsi2ts (isec)
-int isec; /* Seconds past 1980-01-01 */
-{
- return ((double) isec + 946684800.0);
-}
-
-
-/* TSU2FD-- Convert seconds since 1970-01-01 to FITS standard date string */
-
-char *
-tsu2fd (isec)
-time_t isec; /* Seconds past 1970-01-01 */
-{
- return (ts2fd (tsu2ts (isec)));
-}
-
-
-/* TSU2DT-- Convert seconds since 1970-01-01 to date yyyy.ddmm, time hh.mmsss */
-
-void
-tsu2dt (isec,date,time)
-time_t isec; /* Seconds past 1970-01-01 */
-double *date; /* Date as yyyy.mmdd (returned) */
-double *time; /* Time as hh.mmssxxxx (returned) */
-{
- ts2dt (tsu2ts (isec), date, time);
-}
-
-
-/* TSU2TS-- Convert seconds since 1970-01-01 to seconds since 1950-01-01 */
-
-double
-tsu2ts (isec)
-time_t isec; /* Seconds past 1970-01-01 */
-{
- return ((double) isec + 631152000.0);
-}
-
-/* TSU2TSI-- UT seconds since 1970-01-01 to local seconds since 1980-01-01 */
-
-int
-tsu2tsi (isec)
-time_t isec; /* Seconds past 1970-01-01 */
-{
- double date, time;
- struct tm *ts;
-
- /* Get local time from UT seconds */
- ts = localtime (&isec);
- if (ts->tm_year < 1000)
- date = (double) (ts->tm_year + 1900);
- else
- date = (double) ts->tm_year;
- date = date + (0.01 * (double) (ts->tm_mon + 1));
- date = date + (0.0001 * (double) ts->tm_mday);
- time = (double) ts->tm_hour;
- time = time + (0.01 * (double) ts->tm_min);
- time = time + (0.0001 * (double) ts->tm_sec);
- return ((int)(dt2ts (date, time) - 631152000.0));
-}
-
-
-/* TS2FD-- convert seconds since 1950.0 to FITS date, yyyy-mm-ddThh:mm:ss.ss */
-
-char *
-ts2fd (tsec)
-
-double tsec; /* Seconds past 1950.0 */
-{
- double date, time;
-
- ts2dt (tsec, &date, &time);
- return (dt2fd (date, time));
-}
-
-
-/* TSD2FD-- convert seconds since start of day to FITS time, hh:mm:ss.ss */
-
-char *
-tsd2fd (tsec)
-
-double tsec; /* Seconds since start of day */
-{
- double date, time;
- char *thms, *fdate;
- int lfd, nbc;
-
- ts2dt (tsec, &date, &time);
- fdate = dt2fd (date, time);
- thms = (char *) calloc (16, 1);
- lfd = strlen (fdate);
- nbc = lfd - 11;
- strncpy (thms, fdate+11, nbc);
- return (thms);
-}
-
-
-/* TSD2DT-- convert seconds since start of day to hh.mmssss */
-
-double
-tsd2dt (tsec)
-
-double tsec; /* Seconds since start of day */
-{
- double date, time;
-
- ts2dt (tsec, &date, &time);
- return (time);
-}
-
-
-
-/* DT2I-- convert vigesimal date and time to year month day hours min sec */
-
-void
-dt2i (date, time, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-double date; /* Date as yyyy.mmdd (returned)
- yyyy = calendar year (e.g. 1973)
- mm = calendar month (e.g. 04 = april)
- dd = calendar day (e.g. 15) */
-double time; /* Time as hh.mmssxxxx (returned)
- *if time<0, it is time as -(fraction of a day)
- hh = hour of day (0 .le. hh .le. 23)
- nn = minutes (0 .le. nn .le. 59)
- ss = seconds (0 .le. ss .le. 59)
- xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-
-{
- double t,d;
-
- t = time;
- if (date < 0.0)
- d = -date;
- else
- d = date;
-
- /* Extract components of time */
- *ihr = dint (t + 0.000000001);
- t = 100.0 * (t - (double) *ihr);
- *imn = dint (t + 0.0000001);
- *sec = 100.0 * (t - (double) *imn);
-
- /* Extract components of date */
- *iyr = dint (d + 0.00001);
- d = 100.0 * (d - (double) *iyr);
- if (date < 0.0)
- *iyr = - *iyr;
- *imon = dint (d + 0.001);
- d = 100.0 * (d - (double) *imon);
- *iday = dint (d + 0.1);
-
- /* Make sure date and time are legal */
- fixdate (iyr, imon, iday, ihr, imn, sec, ndsec);
-
- return;
-}
-
-
-/* FD2I-- convert from FITS standard date to year, mon, day, hours, min, sec */
-
-void
-fd2i (string, iyr, imon, iday, ihr, imn, sec, ndsec)
-
-char *string; /* FITS date string, which may be:
- yyyy.ffff (fractional year)
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard FITS use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-
-{
- double tsec, fday, hr, mn;
- int i;
- char *sstr, *dstr, *tstr, *cstr, *nval, *fstr;
-
- /* Initialize all returned data to zero */
- *iyr = 0;
- *imon = 0;
- *iday = 0;
- *ihr = 0;
- *imn = 0;
- *sec = 0.0;
-
- /* Return if no input string */
- if (string == NULL)
- return;
-
- /* Check for various non-numeric characters */
- sstr = strchr (string,'/');
- dstr = strchr (string,'-');
- if (dstr == string)
- dstr = strchr (string+1, '-');
- fstr = strchr (string, '.');
- tstr = strchr (string,'T');
- if (tstr == NULL)
- tstr = strchr (string, 'Z');
- if (tstr == NULL)
- tstr = strchr (string, 'S');
- if (fstr != NULL && tstr != NULL && fstr > tstr)
- fstr = NULL;
- cstr = strchr (string,':');
-
- /* Original FITS date format: dd/mm/yy */
- if (sstr > string) {
- *sstr = '\0';
- *iday = (int) atof (string);
- if (*iday > 31) {
- *iyr = *iday;
- if (*iyr >= 0 && *iyr <= 49)
- *iyr = *iyr + 2000;
- else if (*iyr < 1000)
- *iyr = *iyr + 1900;
- *sstr = '/';
- nval = sstr + 1;
- sstr = strchr (nval,'/');
- if (sstr > string) {
- *sstr = '\0';
- *imon = (int) atof (nval);
- *sstr = '/';
- nval = sstr + 1;
- *iday = (int) atof (nval);
- }
- }
- else {
- *sstr = '/';
- nval = sstr + 1;
- sstr = strchr (nval,'/');
- if (sstr == NULL)
- sstr = strchr (nval,'-');
- if (sstr > string) {
- *sstr = '\0';
- *imon = (int) atof (nval);
- *sstr = '/';
- nval = sstr + 1;
- *iyr = (int) atof (nval);
- if (*iyr >= 0 && *iyr <= 49)
- *iyr = *iyr + 2000;
- else if (*iyr < 1000)
- *iyr = *iyr + 1900;
- }
- }
- tstr = strchr (string,'_');
- if (tstr == NULL)
- return;
- }
-
- /* New FITS date format: yyyy-mm-ddThh:mm:ss[.sss] */
- else if (dstr > string) {
- *dstr = '\0';
- *iyr = (int) atof (string);
- *dstr = '-';
- nval = dstr + 1;
- dstr = strchr (nval,'-');
- *imon = 1;
- *iday = 1;
-
- /* Decode year, month, and day */
- if (dstr > string) {
- *dstr = '\0';
- *imon = (int) atof (nval);
- *dstr = '-';
- nval = dstr + 1;
- if (tstr > string)
- *tstr = '\0';
- *iday = (int) atof (nval);
-
- /* If fraction of a day is present, turn it into a time */
- if (fstr != NULL) {
- fday = atof (fstr);
- hr = fday * 24.0;
- *ihr = (int) hr;
- mn = 60.0 * (hr - (double) *ihr);
- *imn = (int) mn;
- *sec = 60.0 * (mn - (double) *imn);
- }
-
- if (tstr > string)
- *tstr = 'T';
- }
-
- /* If date is > 31, it is really year in old format */
- if (*iday > 31) {
- i = *iyr;
- if (*iday < 100)
- *iyr = *iday + 1900;
- else
- *iyr = *iday;
- *iday = i;
- }
- }
-
- /* In rare cases, a FITS time is entered as an epoch */
- else if (tstr == NULL && cstr == NULL && isnum (string)) {
- tsec = ep2ts (atof (string));
- ts2i (tsec,iyr,imon,iday,ihr,imn,sec, ndsec);
- return;
- }
-
- /* Extract time, if it is present */
- if (tstr > string || cstr > string) {
- if (tstr > string)
- nval = tstr + 1;
- else
- nval = string;
- cstr = strchr (nval,':');
- if (cstr > string) {
- *cstr = '\0';
- *ihr = (int) atof (nval);
- *cstr = ':';
- nval = cstr + 1;
- cstr = strchr (nval,':');
- if (cstr > string) {
- *cstr = '\0';
- *imn = (int) atof (nval);
- *cstr = ':';
- nval = cstr + 1;
- *sec = atof (nval);
- }
- else
- *imn = (int) atof (nval);
- }
- else
- *ihr = (int) atof (nval);
- }
- else
- ndsec = -1;
-
- /* Make sure date and time are legal */
- fixdate (iyr, imon, iday, ihr, imn, sec, ndsec);
-
- return;
-}
-
-
-/* TS2I-- convert sec since 1950.0 to year month day hours minutes seconds */
-
-void
-ts2i (tsec,iyr,imon,iday,ihr,imn,sec, ndsec)
-
-double tsec; /* seconds since 1/1/1950 0:00 */
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-
-{
- double t,days, ts, dts;
- int nc,nc4,nly,ny,m,im;
-
- /* Round seconds to 0 - 4 decimal places */
- ts = tsec + 61530883200.0;
- if (ts < 0.0)
- dts = -0.5;
- else
- dts = 0.5;
- if (ndsec < 1)
- t = dint (ts + dts) * 10000.0;
- else if (ndsec < 2)
- t = dint (ts * 10.0 + dts) * 1000.0;
- else if (ndsec < 3)
- t = dint (ts * 100.0 + dts) * 100.0;
- else if (ndsec < 4)
- t = dint (ts * 1000.0 + dts) * 10.0;
- else
- t = dint (ts * 10000.0 + dts);
- ts = t / 10000.0;
-
- /* Time of day (hours, minutes, seconds */
- *ihr = (int) (dmod (ts/3600.0, 24.0));
- *imn = (int) (dmod (ts/60.0, 60.0));
- *sec = dmod (ts, 60.0);
-
- /* Number of days since 0 hr 0/0/0000 */
- days = dint ((t / 864000000.0) + 0.000001);
-
- /* Number of leap centuries (400 years) */
- nc4 = (int) ((days / 146097.0) + 0.00001);
-
- /* Number of centuries since last /400 */
- days = days - (146097.0 * (double) (nc4));
- nc = (int) ((days / 36524.0) + 0.000001);
- if (nc > 3) nc = 3;
-
- /* Number of leap years since last century */
- days = days - (36524.0 * nc);
- nly = (int) ((days / 1461.0) + 0.0000000001);
-
- /* Number of years since last leap year */
- days = days - (1461.0 * (double) nly);
- ny = (int) ((days / 365.0) + 0.00000001);
- if (ny > 3) ny = 3;
-
- /* Day of month */
- days = days - (365.0 * (double) ny);
- if (days < 0) {
- m = 0;
- *iday = 29;
- }
- else {
- *iday = (int) (days + 0.00000001) + 1;
- for (m = 1; m <= 12; m++) {
- im = (m + ((m - 1) / 5)) % 2;
- /* fprintf (stderr,"%d %d %d %d\n", m, im, *iday, nc); */
- if (*iday-1 < im+30) break;
- *iday = *iday - im - 30;
- }
- }
-
- /* Month */
- *imon = ((m+1) % 12) + 1;
-
- /* Year */
- *iyr = nc4*400 + nc*100 + nly*4 + ny + m/11;
-
- /* Make sure date and time are legal */
- fixdate (iyr, imon, iday, ihr, imn, sec, ndsec);
-
- return;
-}
-
-
-/* UT2DOY-- Current Universal Time as year, day of year */
-
-void
-ut2doy (year, doy)
-
-int *year; /* Year (returned) */
-double *doy; /* Day of year (returned) */
-{
- double date, time;
- ut2dt (&date, &time);
- dt2doy (date, time, year, doy);
- return;
-}
-
-
-/* UT2DT-- Current Universal Time as date (yyyy.mmdd) and time (hh.mmsss) */
-
-void
-ut2dt(date, time)
-
-double *date; /* Date as yyyy.mmdd (returned) */
-double *time; /* Time as hh.mmssxxxx (returned) */
-{
- time_t tsec;
- struct timeval tp;
- struct timezone tzp;
- struct tm *ts;
-
- gettimeofday (&tp,&tzp);
-
- tsec = tp.tv_sec;
- ts = gmtime (&tsec);
-
- if (ts->tm_year < 1000)
- *date = (double) (ts->tm_year + 1900);
- else
- *date = (double) ts->tm_year;
- *date = *date + (0.01 * (double) (ts->tm_mon + 1));
- *date = *date + (0.0001 * (double) ts->tm_mday);
- *time = (double) ts->tm_hour;
- *time = *time + (0.01 * (double) ts->tm_min);
- *time = *time + (0.0001 * (double) ts->tm_sec);
-
- return;
-}
-
-
-/* UT2EP-- Return current Universal Time as fractional year */
-
-double
-ut2ep()
-{
- return (jd2ep (ut2jd()));
-}
-
-
-/* UT2EPB-- Return current Universal Time as Besselian epoch */
-
-double
-ut2epb()
-{
- return (jd2epb (ut2jd()));
-}
-
-
-/* UT2EPJ-- Return current Universal Time as Julian epoch */
-
-double
-ut2epj()
-{
- return (jd2epj (ut2jd()));
-}
-
-
-/* UT2FD-- Return current Universal Time as FITS ISO date string */
-
-char *
-ut2fd()
-{
- int year, month, day, hour, minute, second;
- time_t tsec;
- struct timeval tp;
- struct timezone tzp;
- struct tm *ts;
- char *isotime;
-
- gettimeofday (&tp,&tzp);
- tsec = tp.tv_sec;
- ts = gmtime (&tsec);
-
- year = ts->tm_year;
- if (year < 1000)
- year = year + 1900;
- month = ts->tm_mon + 1;
- day = ts->tm_mday;
- hour = ts->tm_hour;
- minute = ts->tm_min;
- second = ts->tm_sec;
-
- isotime = (char *) calloc (32, sizeof (char));
- sprintf (isotime, "%04d-%02d-%02dT%02d:%02d:%02d",
- year, month, day, hour, minute, second);
- return (isotime);
-}
-
-
-/* UT2JD-- Return current Universal Time as Julian Date */
-
-double
-ut2jd()
-{
- return (fd2jd (ut2fd()));
-}
-
-
-/* UT2MJD-- convert current UT to Modified Julian Date */
-
-double
-ut2mjd ()
-
-{
- return (ut2jd() - 2400000.5);
-}
-
-/* UT2TS-- current Universal Time as IRAF seconds since 1950-01-01T00:00 */
-
-double
-ut2ts()
-{
- double tsec;
- char *datestring;
- datestring = ut2fd();
- tsec = fd2ts (datestring);
- free (datestring);
- return (tsec);
-}
-
-
-/* UT2TSI-- current Universal Time as IRAF seconds since 1980-01-01T00:00 */
-
-int
-ut2tsi()
-{
- return ((int)(ut2ts() - 946684800.0));
-}
-
-
-/* UT2TSU-- current Universal Time as IRAF seconds since 1970-01-01T00:00 */
-
-time_t
-ut2tsu()
-{
- return ((time_t)(ut2ts () - 631152000.0));
-}
-
-
-/* FD2GST-- convert from FITS date to Greenwich Sidereal Time */
-
-char *
-fd2gst (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double dj, gsec, date, time;
-
- dj = fd2jd (string);
- gsec = jd2gst (dj);
- ts2dt (gsec, &date, &time);
- date = 0.0;
- return (dt2fd (date, time));
-}
-
-
-/* DT2GST-- convert from UT as yyyy.mmdd hh.mmssss to Greenwich Sidereal Time*/
-
-void
-dt2gst (date, time)
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double dj, gsec;
-
- dj = dt2ts (*date, *time);
- gsec = jd2gst (dj);
- ts2dt (gsec, date, time);
- *date = 0.0;
- return;
-}
-
-
-/* JD2LST - Local Sidereal Time in seconds from Julian Date */
-
-double
-jd2lst (dj)
-
-double dj; /* Julian Date */
-{
- double gst, lst;
-
- /* Compute Greenwich Sidereal Time at this epoch */
- gst = jd2gst (dj);
-
- /* Subtract longitude (degrees to seconds of time) */
- lst = gst - (240.0 * longitude);
- if (lst < 0.0)
- lst = lst + 86400.0;
- else if (lst > 86400.0)
- lst = lst - 86400.0;
- return (lst);
-}
-
-
-/* FD2LST - Local Sidereal Time as hh:mm:ss.ss
- from Universal Time as FITS ISO date */
-
-char *
-fd2lst (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999) */
-{
- double dj, date, time, lst;
-
- dj = fd2jd (string);
- lst = jd2lst (dj);
- ts2dt (lst, &date, &time);
- date = 0.0;
- return (dt2fd (date, time));
-}
-
-
-/* DT2LST - Local Sidereal Time as hh.mmssss
- from Universal Time as yyyy.mmdd hh.mmssss */
-
-void
-dt2lst (date, time)
-
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double dj, lst, date0;
-
- dj = dt2jd (*date, *time);
- lst = jd2lst (dj);
- date0 = 0.0;
- ts2dt (lst, &date0, time);
- return;
-}
-
-
-/* TS2LST - Local Sidereal Time in seconds of day
- * from Universal Time in seconds since 1951-01-01T0:00:00
- */
-
-double
-ts2lst (tsec)
-
-double tsec; /* time since 1950.0 in UT seconds */
-{
- double gst; /* Greenwich Sidereal Time in seconds since 0:00 */
- double lst; /* Local Sidereal Time in seconds since 0:00 */
- double gsec, date;
-
- /* Greenwich Sidereal Time */
- gsec = ts2gst (tsec);
- date = 0.0;
- ts2dt (gsec, &date, &gst);
-
- lst = gst - (longitude / 15.0);
- if (lst < 0.0)
- lst = lst + 86400.0;
- else if (lst > 86400.0)
- lst = lst - 86400.0;
- return (lst);
-}
-
-
-/* LST2FD - calculate current UT given Local Sidereal Time
- * plus date in FITS ISO format (yyyy-mm-dd)
- * Return UT date and time in FITS ISO format
- */
-
-char *
-lst2fd (string)
-
-char *string; /* UT Date, LST as yyyy-mm-ddShh:mm:ss.ss */
-{
- double sdj, dj;
-
- sdj = fd2jd (string);
-
- dj = lst2jd (sdj);
-
- return (jd2fd (dj));
-}
-
-
-/* LST2JD - calculate current Julian Date given Local Sidereal Time
- * plus current Julian Date (0.5 at 0:00 UT)
- * Return UT date and time as Julian Date
- */
-
-double
-lst2jd (sdj)
-
-double sdj; /* Julian Date of desired day at 0:00 UT + sidereal time */
-{
- double gst; /* Greenwich Sidereal Time in seconds since 0:00 */
- double lsd; /* Local Sidereal Time in seconds since 0:00 */
- double gst0, tsd, dj1, dj0, eqnx;
- int idj;
-
- /* Julian date at 0:00 UT */
- idj = (int) sdj;
- dj0 = (double) idj + 0.5;
- if (dj0 > sdj) dj0 = dj0 - 1.0;
-
- /* Greenwich Sidereal Time at 0:00 UT in seconds */
- gst0 = jd2gst (dj0);
-
- /* Sidereal seconds since 0:00 */
- lsd = (sdj - dj0) * 86400.0;
-
- /* Remove longitude for current Greenwich Sidereal Time in seconds */
- /* (convert longitude from degrees to seconds of time) */
- gst = lsd + (longitude * 240.0);
-
- /* Time since 0:00 UT */
- tsd = (gst - gst0) / 1.0027379093;
-
- /* Julian Date (UT) */
- dj1 = dj0 + (tsd / 86400.0);
-
- /* Equation of the equinoxes converted to UT seconds */
- eqnx = eqeqnx (dj1) / 1.002739093;
-
- /* Remove equation of equinoxes */
- dj1 = dj1 - (eqnx / 86400.0);
- if (dj1 < dj0)
- dj1 = dj1 + 1.0;
-
- return (dj1);
-}
-
-
-/* MST2FD - calculate current UT given Greenwich Mean Sidereal Time
- * plus date in FITS ISO format (yyyy-mm-ddShh:mm:ss.ss)
- * Return UT date and time in FITS ISO format
- */
-
-char *
-mst2fd (string)
-
-char *string; /* UT Date, MST as yyyy-mm-ddShh:mm:ss.ss */
-{
- double sdj, dj;
-
- sdj = fd2jd (string);
-
- dj = mst2jd (sdj);
-
- return (jd2fd (dj));
-}
-
-
-/* MST2JD - calculate current UT given Greenwich Mean Sidereal Time
- * plus date in Julian Date (0:00 UT + Mean Sidereal Time)
- * Return UT date and time as Julian Date
- */
-
-double
-mst2jd (sdj)
-
-double sdj; /* UT Date, MST as Julian Date */
-{
- double tsd, djd, st0, dj0, dj;
-
- dj0 = (double) ((int) sdj) + 0.5;
-
- /* Greenwich Mean Sidereal Time at 0:00 UT in seconds */
- st0 = jd2mst (dj0);
-
- /* Mean Sidereal Time in seconds */
- tsd = (sdj - dj0) * 86400.0;
- if (tsd < 0.0)
- tsd = tsd + 86400.0;
-
- /* Convert to fraction of a day since 0:00 UT */
- djd = ((tsd - st0) / 1.0027379093) / 86400.0;
-
- /* Julian Date */
- dj = dj0 + djd;
- if (dj < dj0)
- dj = dj + (1.0 / 1.0027379093);
-
- return (dj);
-}
-
-
-
-/* GST2FD - calculate current UT given Greenwich Sidereal Time
- * plus date in FITS ISO format (yyyy-mm-ddShh:mm:ss.ss)
- * Return UT date and time in FITS ISO format
- */
-
-char *
-gst2fd (string)
-
-char *string; /* UT Date, GST as yyyy-mm-ddShh:mm:ss.ss */
-{
- double sdj, dj;
-
- sdj = fd2jd (string);
-
- dj = gst2jd (sdj);
-
- return (jd2fd (dj));
-}
-
-
-/* GST2JD - calculate current UT given Greenwich Sidereal Time
- * plus date as Julian Date (JD at 0:00 UT + sidereal time)
- * Return UT date and time as Julian Date
- */
-
-double
-gst2jd (sdj)
-
-double sdj; /* UT Date, GST as Julian Date */
-{
- double dj, tsd, djd, st0, dj0, eqnx;
-
- dj0 = (double) ((int) sdj) + 0.5;
-
- /* Greenwich Mean Sidereal Time at 0:00 UT in seconds */
- st0 = jd2mst (dj0);
-
- /* Mean Sidereal Time in seconds */
- tsd = (sdj - dj0) * 86400.0;
- if (tsd < 0.0)
- tsd = tsd + 86400.0;
-
- /* Convert to fraction of a day since 0:00 UT */
- djd = ((tsd - st0) / 1.0027379093) / 86400.0;
-
- /* Julian Date */
- dj = dj0 + djd;
-
- /* Equation of the equinoxes (converted to UT seconds) */
- eqnx = eqeqnx (dj) / 1.002737909;
-
- dj = dj - eqnx / 86400.0;
- if (dj < dj0)
- dj = dj + 1.0;
-
- return (dj);
-}
-
-
-/* LST2DT - calculate current UT given Local Sidereal Time as hh.mmsss
- * plus date as yyyy.mmdd
- * Return UT time as hh.mmssss
- */
-
-double
-lst2dt (date0, time0)
-
-double date0; /* UT date as yyyy.mmdd */
-double time0; /* LST as hh.mmssss */
-{
- double gst; /* Greenwich Sidereal Time in seconds since 0:00 */
- double lst; /* Local Sidereal Time in seconds since 0:00 */
- double date1; /* UT date as yyyy.mmdd */
- double time1; /* UT as hh.mmssss */
- double tsec0, gst0, tsd, tsec;
-
- /* Greenwich Sidereal Time at 0:00 UT */
- tsec0 = dt2ts (date0, 0.0);
- gst0 = ts2gst (tsec0);
-
- /* Current Greenwich Sidereal Time in seconds */
- /* (convert longitude from degrees to seconds of time) */
- lst = dt2ts (0.0, time0);
- gst = lst + (longitude * 240.0);
-
- /* Time since 0:00 UT */
- tsd = (gst - gst0) / 1.0027379093;
-
- /* UT date and time */
- tsec = tsec0 + tsd;
- ts2dt (tsec, &date1, &time1);
-
- return (time1);
-}
-
-
-/* TS2GST - calculate Greenwich Sidereal Time given Universal Time
- * in seconds since 1951-01-01T0:00:00
- * Return sidereal time of day in seconds
- */
-
-double
-ts2gst (tsec)
-
-double tsec; /* time since 1950.0 in UT seconds */
-{
- double gst; /* Greenwich Sidereal Time in seconds since 0:00 */
- double tsd, eqnx, dj;
- int its;
-
- /* Elapsed time as of 0:00 UT */
- if (tsec >= 0.0) {
- its = (int) (tsec + 0.5);
- tsd = (double) (its % 86400);
- }
- else {
- its = (int) (-tsec + 0.5);
- tsd = (double) (86400 - (its % 86400));
- }
-
- /* Mean sidereal time */
- gst = ts2mst (tsec);
-
- /* Equation of the equinoxes */
- dj = ts2jd (tsec);
- eqnx = eqeqnx (dj);
-
- /* Apparent sidereal time at 0:00 ut */
- gst = gst + eqnx;
-
- /* Current sidereal time */
- gst = gst + (tsd * 1.0027379093);
- gst = dmod (gst,86400.0);
-
- return (gst);
-}
-
-
-/* FD2MST-- convert from FITS date Mean Sidereal Time */
-
-char *
-fd2mst (string)
-
-char *string; /* FITS date string, which may be:
- fractional year
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-{
- double gsec, date, time, dj;
-
- dj = fd2jd (string);
- gsec = jd2mst (dj);
- ts2dt (gsec, &date, &time);
- date = 0.0;
- return (dt2fd (date, time));
-}
-
-
-/* DT2MST-- convert from UT as yyyy.mmdd hh.mmssss to Mean Sidereal Time
- in the same format */
-
-void
-dt2mst (date, time)
-double *date; /* Date as yyyy.mmdd */
-double *time; /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
-{
- double date0, gsec, dj;
- date0 = *date;
- dj = dt2jd (*date, *time);
- gsec = jd2mst (dj);
- ts2dt (gsec, date, time);
- *date = date0;
- return;
-}
-
-
-/* TS2MST - calculate Greenwich Mean Sidereal Time given Universal Time
- * in seconds since 1951-01-01T0:00:00
- */
-
-double
-ts2mst (tsec)
-
-double tsec; /* time since 1950.0 in UT seconds */
-{
- double dj;
-
- dj = ts2jd (tsec);
- return (jd2mst (dj));
-}
-
-
-/* JD2MST - Julian Date to Greenwich Mean Sidereal Time using IAU 2000
- * Return sideral time in seconds of time
- * (from USNO NOVAS package
- * http://aa.usno.navy.mil/software/novas/novas_info.html
- */
-
-double
-jd2mst2 (dj)
-
-double dj; /* Julian Date */
-{
- double dt, t, t2, t3, mst, st;
-
- dt = dj - 2451545.0;
- t = dt / 36525.0;
- t2 = t * t;
- t3 = t2 * t;
-
- /* Compute Greenwich Mean Sidereal Time in seconds */
- st = (8640184.812866 * t) + (3155760000.0 * t) - (0.0000062 * t3)
- + (0.093104 * t2) + 67310.54841;
-
- mst = dmod (st, 86400.0);
- if (mst < 0.0)
- mst = mst + 86400.0;
- return (mst);
-}
-
-
-/* MJD2MST - Modified Julian Date to Greenwich Mean Sidereal Time using IAU 2000
- * Return sideral time in seconds of time
- * (from USNO NOVAS package
- * http://aa.usno.navy.mil/software/novas/novas_info.html
- */
-
-double
-mjd2mst (dj)
-
-double dj; /* Modified Julian Date */
-{
- double dt, t, t2, t3, mst, st;
-
- dt = dj - 51544.5;
- t = dt / 36525.0;
- t2 = t * t;
- t3 = t2 * t;
-
- /* Compute Greenwich Mean Sidereal Time in seconds */
- st = (8640184.812866 * t) + (3155760000.0 * t) - (0.0000062 * t3)
- + (0.093104 * t2) + 67310.54841;
-
- mst = dmod (st, 86400.0);
- if (mst < 0.0)
- mst = mst + 86400.0;
- return (mst);
-}
-
-
-/* JD2GST - Julian Date to Greenwich Sideral Time
- * Return sideral time in seconds of time
- * (Jean Meeus, Astronomical Algorithms, Willmann-Bell, 1991, pp 83-84)
- */
-
-double
-jd2gst (dj)
-
-double dj; /* Julian Date */
-{
- double dj0, gmt, gst, tsd, eqnx, ssd, l0;
- double ts2ss = 1.00273790935;
- int ijd;
-
- /* Julian date at 0:00 UT */
- ijd = (int) dj;
- dj0 = (double) ijd + 0.5;
- if (dj0 > dj) dj0 = dj0 - 1.0;
-
- /* Greenwich mean sidereal time at 0:00 UT in seconds */
- l0 = longitude;
- longitude = 0.0;
- gmt = jd2mst (dj0);
- longitude = l0;
-
- /* Equation of the equinoxes */
- eqnx = eqeqnx (dj);
-
- /* Apparent sidereal time at 0:00 ut */
- gst = gmt + eqnx;
-
- /* UT seconds since 0:00 */
- tsd = (dj - dj0) * 86400.0;
- ssd = tsd * ts2ss;
-
- /* Current sidereal time */
- gst = gst + ssd;
- gst = dmod (gst, 86400.0);
-
- return (gst);
-}
-
-
-/* EQEQNX - Compute equation of the equinoxes for apparent sidereal time */
-
-double
-eqeqnx (dj)
-
-double dj; /* Julian Date */
-
-{
- double dt, edj, dpsi, deps, obl, eqnx;
- double rad2tsec = 13750.98708;
-
- /* Convert UT to Ephemeris Time (TDB or TT)*/
- dt = utdt (dj);
- edj = dj + dt / 86400.0;
-
- /* Nutation and obliquity */
- compnut (edj, &dpsi, &deps, &obl);
-
- /* Correct obliquity for nutation */
- obl = obl + deps;
-
- /* Equation of the equinoxes in seconds */
- eqnx = (dpsi * cos (obl)) * rad2tsec;
-
- return (eqnx);
-}
-
-
-
-/* JD2MST - Julian Date to Mean Sideral Time
- * Return sideral time in seconds of time
- * (Jean Meeus, Astronomical Algorithms, Willmann-Bell, 1991, pp 83-84)
- */
-
-double
-jd2mst (dj)
-
-double dj; /* Julian Date */
-{
- double dt, t, mst;
-
- dt = dj - 2451545.0;
- t = dt / 36525.0;
-
- /* Compute Greenwich mean sidereal time in degrees (Meeus, page 84) */
- mst = 280.46061837 + (360.98564736629 * dt) + (0.000387933 * t * t) -
- (t * t * t / 38710000.0);
-
- /* Keep degrees between 0 and 360 */
- while (mst > 360.0)
- mst = mst - 360.0;
- while (mst < 0.0)
- mst = mst + 360.0;
-
- /* Convert to time in seconds (3600 / 15) */
- mst = mst * 240.0;
-
- /* Subtract longitude (degrees to seconds of time) */
- mst = mst - (240.0 * longitude);
- if (mst < 0.0)
- mst = mst + 86400.0;
- else if (mst > 86400.0)
- mst = mst - 86400.0;
-
- return (mst);
-}
-
-
-/* COMPNUT - Compute nutation using the IAU 2000b model */
-/* Translated from Pat Wallace's Fortran subroutine iau_nut00b (June 26 2007)
- into C by Jessica Mink on September 5, 2008 */
-
-#define NLS 77 /* number of terms in the luni-solar nutation model */
-
-void
-compnut (dj, dpsi, deps, eps0)
-
-double dj; /* Julian Date */
-double *dpsi; /* Nutation in longitude in radians (returned) */
-double *deps; /* Nutation in obliquity in radians (returned) */
-double *eps0; /* Mean obliquity in radians (returned) */
-
-/* This routine is translated from the International Astronomical Union's
- * Fortran SOFA (Standards Of Fundamental Astronomy) software collection.
- *
- * notes:
- *
- * 1) the nutation components in longitude and obliquity are in radians
- * and with respect to the equinox and ecliptic of date. the
- * obliquity at j2000 is assumed to be the lieske et al. (1977) value
- * of 84381.448 arcsec. (the errors that result from using this
- * routine with the iau 2006 value of 84381.406 arcsec can be
- * neglected.)
- *
- * the nutation model consists only of luni-solar terms, but includes
- * also a fixed offset which compensates for certain long-period
- * planetary terms (note 7).
- *
- * 2) this routine is an implementation of the iau 2000b abridged
- * nutation model formally adopted by the iau general assembly in
- * 2000. the routine computes the mhb_2000_short luni-solar nutation
- * series (luzum 2001), but without the associated corrections for
- * the precession rate adjustments and the offset between the gcrs
- * and j2000 mean poles.
- *
- * 3) the full IAU 2000a (mhb2000) nutation model contains nearly 1400
- * terms. the IAU 2000b model (mccarthy & luzum 2003) contains only
- * 77 terms, plus additional simplifications, yet still delivers
- * results of 1 mas accuracy at present epochs. this combination of
- * accuracy and size makes the IAU 2000b abridged nutation model
- * suitable for most practical applications.
- *
- * the routine delivers a pole accurate to 1 mas from 1900 to 2100
- * (usually better than 1 mas, very occasionally just outside 1 mas).
- * the full IAU 2000a model, which is implemented in the routine
- * iau_nut00a (q.v.), delivers considerably greater accuracy at
- * current epochs; however, to realize this improved accuracy,
- * corrections for the essentially unpredictable free-core-nutation
- * (fcn) must also be included.
- *
- * 4) the present routine provides classical nutation. the
- * mhb_2000_short algorithm, from which it is adapted, deals also
- * with (i) the offsets between the gcrs and mean poles and (ii) the
- * adjustments in longitude and obliquity due to the changed
- * precession rates. these additional functions, namely frame bias
- * and precession adjustments, are supported by the sofa routines
- * iau_bi00 and iau_pr00.
- *
- * 6) the mhb_2000_short algorithm also provides "total" nutations,
- * comprising the arithmetic sum of the frame bias, precession
- * adjustments, and nutation (luni-solar + planetary). these total
- * nutations can be used in combination with an existing IAU 1976
- * precession implementation, such as iau_pmat76, to deliver gcrs-to-
- * true predictions of mas accuracy at current epochs. however, for
- * symmetry with the iau_nut00a routine (q.v. for the reasons), the
- * sofa routines do not generate the "total nutations" directly.
- * should they be required, they could of course easily be generated
- * by calling iau_bi00, iau_pr00 and the present routine and adding
- * the results.
- *
- * 7) the IAU 2000b model includes "planetary bias" terms that are fixed
- * in size but compensate for long-period nutations. the amplitudes
- * quoted in mccarthy & luzum (2003), namely dpsi = -1.5835 mas and
- * depsilon = +1.6339 mas, are optimized for the "total nutations"
- * method described in note 6. the luzum (2001) values used in this
- * sofa implementation, namely -0.135 mas and +0.388 mas, are
- * optimized for the "rigorous" method, where frame bias, precession
- * and nutation are applied separately and in that order. during the
- * interval 1995-2050, the sofa implementation delivers a maximum
- * error of 1.001 mas (not including fcn).
- *
- * References from original Fortran subroutines:
- *
- * Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
- *
- * Lieske, J.H., Lederle, T., Fricke, W., Morando, B., "Expressions
- * for the precession quantities based upon the IAU 1976 system of
- * astronomical constants", Astron.Astrophys. 58, 1-2, 1-16. (1977)
- *
- * Luzum, B., private communication, 2001 (Fortran code
- * mhb_2000_short)
- *
- * McCarthy, D.D. & Luzum, B.J., "An abridged model of the
- * precession-nutation of the celestial pole", Cel.Mech.Dyn.Astron.
- * 85, 37-49 (2003)
- *
- * Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
- * Francou, G., Laskar, J., Astron.Astrophys. 282, 663-683 (1994)
- *
- */
-
-{
- double as2r = 0.000004848136811095359935899141; /* arcseconds to radians */
-
- double dmas2r = as2r / 1000.0; /* milliarcseconds to radians */
-
- double as2pi = 1296000.0; /* arc seconds in a full circle */
-
- double d2pi = 6.283185307179586476925287; /* 2pi */
-
- double u2r = as2r / 10000000.0; /* units of 0.1 microarcsecond to radians */
-
- double dj0 = 2451545.0; /* reference epoch (j2000), jd */
-
- double djc = 36525.0; /* Days per julian century */
-
- /* Miscellaneous */
- double t, el, elp, f, d, om, arg, dp, de, sarg, carg;
- double dpsils, depsls, dpsipl, depspl;
- int i, j;
-
- int nls = NLS; /* number of terms in the luni-solar nutation model */
-
- /* Fixed offset in lieu of planetary terms (radians) */
- double dpplan = - 0.135 * dmas2r;
- double deplan = + 0.388 * dmas2r;
-
-/* Tables of argument and term coefficients */
-
- /* Coefficients for fundamental arguments */
- /* Luni-solar argument multipliers: */
- /* l l' f d om */
-static int nals[5*NLS]=
- {0, 0, 0, 0, 1,
- 0, 0, 2, -2, 2,
- 0, 0, 2, 0, 2,
- 0, 0, 0, 0, 2,
- 0, 1, 0, 0, 0,
- 0, 1, 2, -2, 2,
- 1, 0, 0, 0, 0,
- 0, 0, 2, 0, 1,
- 1, 0, 2, 0, 2,
- 0, -1, 2, -2, 2,
- 0, 0, 2, -2, 1,
- -1, 0, 2, 0, 2,
- -1, 0, 0, 2, 0,
- 1, 0, 0, 0, 1,
- -1, 0, 0, 0, 1,
- -1, 0, 2, 2, 2,
- 1, 0, 2, 0, 1,
- -2, 0, 2, 0, 1,
- 0, 0, 0, 2, 0,
- 0, 0, 2, 2, 2,
- 0, -2, 2, -2, 2,
- -2, 0, 0, 2, 0,
- 2, 0, 2, 0, 2,
- 1, 0, 2, -2, 2,
- -1, 0, 2, 0, 1,
- 2, 0, 0, 0, 0,
- 0, 0, 2, 0, 0,
- 0, 1, 0, 0, 1,
- -1, 0, 0, 2, 1,
- 0, 2, 2, -2, 2,
- 0, 0, -2, 2, 0,
- 1, 0, 0, -2, 1,
- 0, -1, 0, 0, 1,
- -1, 0, 2, 2, 1,
- 0, 2, 0, 0, 0,
- 1, 0, 2, 2, 2,
- -2, 0, 2, 0, 0,
- 0, 1, 2, 0, 2,
- 0, 0, 2, 2, 1,
- 0, -1, 2, 0, 2,
- 0, 0, 0, 2, 1,
- 1, 0, 2, -2, 1,
- 2, 0, 2, -2, 2,
- -2, 0, 0, 2, 1,
- 2, 0, 2, 0, 1,
- 0, -1, 2, -2, 1,
- 0, 0, 0, -2, 1,
- -1, -1, 0, 2, 0,
- 2, 0, 0, -2, 1,
- 1, 0, 0, 2, 0,
- 0, 1, 2, -2, 1,
- 1, -1, 0, 0, 0,
- -2, 0, 2, 0, 2,
- 3, 0, 2, 0, 2,
- 0, -1, 0, 2, 0,
- 1, -1, 2, 0, 2,
- 0, 0, 0, 1, 0,
- -1, -1, 2, 2, 2,
- -1, 0, 2, 0, 0,
- 0, -1, 2, 2, 2,
- -2, 0, 0, 0, 1,
- 1, 1, 2, 0, 2,
- 2, 0, 0, 0, 1,
- -1, 1, 0, 1, 0,
- 1, 1, 0, 0, 0,
- 1, 0, 2, 0, 0,
- -1, 0, 2, -2, 1,
- 1, 0, 0, 0, 2,
- -1, 0, 0, 1, 0,
- 0, 0, 2, 1, 2,
- -1, 0, 2, 4, 2,
- -1, 1, 0, 1, 1,
- 0, -2, 2, -2, 1,
- 1, 0, 2, 2, 1,
- -2, 0, 2, 2, 2,
- -1, 0, 0, 0, 2,
- 1, 1, 2, -2, 2};
-
- /* Luni-solar nutation coefficients, in 1e-7 arcsec */
- /* longitude (sin, t*sin, cos), obliquity (cos, t*cos, sin) */
-static double cls[6*NLS]=
- {-172064161.0, -174666.0, 33386.0, 92052331.0, 9086.0, 15377.0,
- -13170906.0, -1675.0, -13696.0, 5730336.0, -3015.0, -4587.0,
- -2276413.0, -234.0, 2796.0, 978459.0, -485.0, 1374.0,
- 2074554.0, 207.0, -698.0, -897492.0, 470.0, -291.0,
- 1475877.0, -3633.0, 11817.0, 73871.0, -184.0, -1924.0,
- -516821.0, 1226.0, -524.0, 224386.0, -677.0, -174.0,
- 711159.0, 73.0, -872.0, -6750.0, 0.0, 358.0,
- -387298.0, -367.0, 380.0, 200728.0, 18.0, 318.0,
- -301461.0, -36.0, 816.0, 129025.0, -63.0, 367.0,
- 215829.0, -494.0, 111.0, -95929.0, 299.0, 132.0,
- 128227.0, 137.0, 181.0, -68982.0, -9.0, 39.0,
- 123457.0, 11.0, 19.0, -53311.0, 32.0, -4.0,
- 156994.0, 10.0, -168.0, -1235.0, 0.0, 82.0,
- 63110.0, 63.0, 27.0, -33228.0, 0.0, -9.0,
- -57976.0, -63.0, -189.0, 31429.0, 0.0, -75.0,
- -59641.0, -11.0, 149.0, 25543.0, -11.0, 66.0,
- -51613.0, -42.0, 129.0, 26366.0, 0.0, 78.0,
- 45893.0, 50.0, 31.0, -24236.0, -10.0, 20.0,
- 63384.0, 11.0, -150.0, -1220.0, 0.0, 29.0,
- -38571.0, -1.0, 158.0, 16452.0, -11.0, 68.0,
- 32481.0, 0.0, 0.0, -13870.0, 0.0, 0.0,
- -47722.0, 0.0, -18.0, 477.0, 0.0, -25.0,
- -31046.0, -1.0, 131.0, 13238.0, -11.0, 59.0,
- 28593.0, 0.0, -1.0, -12338.0, 10.0, -3.0,
- 20441.0, 21.0, 10.0, -10758.0, 0.0, -3.0,
- 29243.0, 0.0, -74.0, -609.0, 0.0, 13.0,
- 25887.0, 0.0, -66.0, -550.0, 0.0, 11.0,
- -14053.0, -25.0, 79.0, 8551.0, -2.0, -45.0,
- 15164.0, 10.0, 11.0, -8001.0, 0.0, -1.0,
- -15794.0, 72.0, -16.0, 6850.0, -42.0, -5.0,
- 21783.0, 0.0, 13.0, -167.0, 0.0, 13.0,
- -12873.0, -10.0, -37.0, 6953.0, 0.0, -14.0,
- -12654.0, 11.0, 63.0, 6415.0, 0.0, 26.0,
- -10204.0, 0.0, 25.0, 5222.0, 0.0, 15.0,
- 16707.0, -85.0, -10.0, 168.0, -1.0, 10.0,
- -7691.0, 0.0, 44.0, 3268.0, 0.0, 19.0,
- -11024.0, 0.0, -14.0, 104.0, 0.0, 2.0,
- 7566.0, -21.0, -11.0, -3250.0, 0.0, -5.0,
- -6637.0, -11.0, 25.0, 3353.0, 0.0, 14.0,
- -7141.0, 21.0, 8.0, 3070.0, 0.0, 4.0,
- -6302.0, -11.0, 2.0, 3272.0, 0.0, 4.0,
- 5800.0, 10.0, 2.0, -3045.0, 0.0, -1.0,
- 6443.0, 0.0, -7.0, -2768.0, 0.0, -4.0,
- -5774.0, -11.0, -15.0, 3041.0, 0.0, -5.0,
- -5350.0, 0.0, 21.0, 2695.0, 0.0, 12.0,
- -4752.0, -11.0, -3.0, 2719.0, 0.0, -3.0,
- -4940.0, -11.0, -21.0, 2720.0, 0.0, -9.0,
- 7350.0, 0.0, -8.0, -51.0, 0.0, 4.0,
- 4065.0, 0.0, 6.0, -2206.0, 0.0, 1.0,
- 6579.0, 0.0, -24.0, -199.0, 0.0, 2.0,
- 3579.0, 0.0, 5.0, -1900.0, 0.0, 1.0,
- 4725.0, 0.0, -6.0, -41.0, 0.0, 3.0,
- -3075.0, 0.0, -2.0, 1313.0, 0.0, -1.0,
- -2904.0, 0.0, 15.0, 1233.0, 0.0, 7.0,
- 4348.0, 0.0, -10.0, -81.0, 0.0, 2.0,
- -2878.0, 0.0, 8.0, 1232.0, 0.0, 4.0,
- -4230.0, 0.0, 5.0, -20.0, 0.0, -2.0,
- -2819.0, 0.0, 7.0, 1207.0, 0.0, 3.0,
- -4056.0, 0.0, 5.0, 40.0, 0.0, -2.0,
- -2647.0, 0.0, 11.0, 1129.0, 0.0, 5.0,
- -2294.0, 0.0, -10.0, 1266.0, 0.0, -4.0,
- 2481.0, 0.0, -7.0, -1062.0, 0.0, -3.0,
- 2179.0, 0.0, -2.0, -1129.0, 0.0, -2.0,
- 3276.0, 0.0, 1.0, -9.0, 0.0, 0.0,
- -3389.0, 0.0, 5.0, 35.0, 0.0, -2.0,
- 3339.0, 0.0, -13.0, -107.0, 0.0, 1.0,
- -1987.0, 0.0, -6.0, 1073.0, 0.0, -2.0,
- -1981.0, 0.0, 0.0, 854.0, 0.0, 0.0,
- 4026.0, 0.0, -353.0, -553.0, 0.0, -139.0,
- 1660.0, 0.0, -5.0, -710.0, 0.0, -2.0,
- -1521.0, 0.0, 9.0, 647.0, 0.0, 4.0,
- 1314.0, 0.0, 0.0, -700.0, 0.0, 0.0,
- -1283.0, 0.0, 0.0, 672.0, 0.0, 0.0,
- -1331.0, 0.0, 8.0, 663.0, 0.0, 4.0,
- 1383.0, 0.0, -2.0, -594.0, 0.0, -2.0,
- 1405.0, 0.0, 4.0, -610.0, 0.0, 2.0,
- 1290.0, 0.0, 0.0, -556.0, 0.0, 0.0};
-
- /* Interval between fundamental epoch J2000.0 and given date (JC) */
- t = (dj - dj0) / djc;
-
-/* Luni-solar nutation */
-
-/* Fundamental (delaunay) arguments from Simon et al. (1994) */
-
- /* Mean anomaly of the moon */
- el = fmod (485868.249036 + (1717915923.2178 * t), as2pi) * as2r;
-
- /* Mean anomaly of the sun */
- elp = fmod (1287104.79305 + (129596581.0481 * t), as2pi) * as2r;
-
- /* Mean argument of the latitude of the moon */
- f = fmod (335779.526232 + (1739527262.8478 * t), as2pi) * as2r;
-
- /* Mean elongation of the moon from the sun */
- d = fmod (1072260.70369 + (1602961601.2090 * t), as2pi ) * as2r;
-
- /* Mean longitude of the ascending node of the moon */
- om = fmod (450160.398036 - (6962890.5431 * t), as2pi ) * as2r;
-
- /* Initialize the nutation values */
- dp = 0.0;
- de = 0.0;
-
- /* Summation of luni-solar nutation series (in reverse order) */
- for (i = nls; i > 0; i=i-1) {
- j = i - 1;
-
- /* Argument and functions */
- arg = fmod ( (double) (nals[5*j]) * el +
- (double) (nals[1+5*j]) * elp +
- (double) (nals[2+5*j]) * f +
- (double) (nals[3+5*j]) * d +
- (double) (nals[4+5*j]) * om, d2pi);
- sarg = sin (arg);
- carg = cos (arg);
-
- /* Terms */
- dp = dp + (cls[6*j] + cls[1+6*j] * t) * sarg + cls[2+6*j] * carg;
- de = de + (cls[3+6*j] + cls[4+6*j] * t) * carg + cls[5+6*j] * sarg;
- }
-
- /* Convert from 0.1 microarcsec units to radians */
- dpsils = dp * u2r;
- depsls = de * u2r;
-
-/* In lieu of planetary nutation */
-
- /* Fixed offset to correct for missing terms in truncated series */
- dpsipl = dpplan;
- depspl = deplan;
-
-/* Results */
-
- /* Add luni-solar and planetary components */
- *dpsi = dpsils + dpsipl;
- *deps = depsls + depspl;
-
- /* Mean Obliquity in radians (IAU 2006, Hilton, et al.) */
- *eps0 = ( 84381.406 +
- ( -46.836769 +
- ( -0.0001831 +
- ( 0.00200340 +
- ( -0.000000576 +
- ( -0.0000000434 ) * t ) * t ) * t ) * t ) * t ) * as2r;
-}
-
-
-/* ISDATE - Return 1 if string is an old or ISO FITS standard date */
-
-int
-isdate (string)
-
-char *string; /* Possible FITS date string, which may be:
- dd/mm/yy (FITS standard before 2000)
- dd-mm-yy (nonstandard FITS use before 2000)
- yyyy-mm-dd (FITS standard after 1999)
- yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-
-{
- int iyr = 0; /* year (returned) */
- int imon = 0; /* month (returned) */
- int iday = 0; /* day (returned) */
- int i;
- char *sstr, *dstr, *tstr, *nval;
-
- /* Translate string from ASCII to binary */
- if (string == NULL)
- return (0);
-
- sstr = strchr (string,'/');
- dstr = strchr (string,'-');
- if (dstr == string)
- dstr = strchr (string+1,'-');
- tstr = strchr (string,'T');
-
- /* Original FITS date format: dd/mm/yy */
- if (sstr > string) {
- *sstr = '\0';
- iday = (int) atof (string);
- *sstr = '/';
- nval = sstr + 1;
- sstr = strchr (nval,'/');
- if (sstr == NULL)
- sstr = strchr (nval,'-');
- if (sstr > string) {
- *sstr = '\0';
- imon = (int) atof (nval);
- *sstr = '/';
- nval = sstr + 1;
- iyr = (int) atof (nval);
- if (iyr < 1000)
- iyr = iyr + 1900;
- }
- if (imon > 0 && iday > 0)
- return (1);
- else
- return (0);
- }
-
- /* New FITS date format: yyyy-mm-ddThh:mm:ss[.sss] */
- else if (dstr > string) {
- *dstr = '\0';
- iyr = (int) atof (string);
- nval = dstr + 1;
- *dstr = '-';
- dstr = strchr (nval,'-');
- imon = 0;
- iday = 0;
-
- /* Decode year, month, and day */
- if (dstr > string) {
- *dstr = '\0';
- imon = (int) atof (nval);
- *dstr = '-';
- nval = dstr + 1;
- if (tstr > string)
- *tstr = '\0';
- iday = (int) atof (nval);
- if (tstr > string)
- *tstr = 'T';
- }
-
- /* If day is > 31, it is really year in old format */
- if (iday > 31) {
- i = iyr;
- if (iday < 100)
- iyr = iday + 1900;
- else
- iyr = iday;
- iday = i;
- }
- if (imon > 0 && iday > 0)
- return (1);
- else
- return (0);
- }
-
- /* If FITS date is entered as an epoch, return 0 anyway */
- else
- return (0);
-}
-
-
-/* Round seconds and make sure date and time numbers are within limits */
-
-static void
-fixdate (iyr, imon, iday, ihr, imn, sec, ndsec)
-
-int *iyr; /* year (returned) */
-int *imon; /* month (returned) */
-int *iday; /* day (returned) */
-int *ihr; /* hours (returned) */
-int *imn; /* minutes (returned) */
-double *sec; /* seconds (returned) */
-int ndsec; /* Number of decimal places in seconds (0=int) */
-{
- double days;
-
- /* Round seconds to 0 - 4 decimal places (no rounding if <0, >4) */
- if (ndsec == 0)
- *sec = dint (*sec + 0.5);
- else if (ndsec < 2)
- *sec = dint (*sec * 10.0 + 0.5) / 10.0;
- else if (ndsec < 3)
- *sec = dint (*sec * 100.0 + 0.5) / 100.0;
- else if (ndsec < 4)
- *sec = dint (*sec * 1000.0 + 0.5) / 1000.0;
- else if (ndsec < 5)
- *sec = dint (*sec * 10000.0 + 0.5) / 10000.0;
-
- /* Adjust minutes and hours */
- if (*sec > 60.0) {
- *sec = *sec - 60.0;
- *imn = *imn + 1;
- }
- if (*imn > 60) {
- *imn = *imn - 60;
- *ihr = *ihr + 1;
- }
-
- /* Return if no date */
- if (*iyr == 0 && *imon == 0 && *iday == 0)
- return;
-
- /* Adjust date */
- if (*ihr > 23) {
- *ihr = *ihr - 24;
- *iday = *iday + 1;
- }
- days = caldays (*iyr, *imon);
- if (*iday > days) {
- *iday = *iday - days;
- *imon = *imon + 1;
- }
- if (*iday < 1) {
- *imon = *imon - 1;
- if (*imon < 1) {
- *imon = *imon + 12;
- *iyr = *iyr - 1;
- }
- days = caldays (*iyr, *imon);
- *iday = *iday + days;
- }
- if (*imon < 1) {
- *imon = *imon + 12;
- *iyr = *iyr - 1;
- days = caldays (*iyr, *imon);
- if (*iday > days) {
- *iday = *iday - days;
- *imon = *imon + 1;
- }
- }
- if (*imon > 12) {
- *imon = *imon - 12;
- *iyr = *iyr + 1;
- }
- return;
-}
-
-
-/* Calculate days in month 1-12 given year (Gregorian calendar only) */
-
-static int
-caldays (year, month)
-
-int year; /* 4-digit year */
-int month; /* Month (1=January, 2=February, etc.) */
-{
- if (month < 1) {
- month = month + 12;
- year = year + 1;
- }
- if (month > 12) {
- month = month - 12;
- year = year + 1;
- }
- switch (month) {
- case 1:
- return (31);
- case 2:
- if (year%400 == 0)
- return (29);
- else if (year%100 == 0)
- return (28);
- else if (year%4 == 0)
- return (29);
- else
- return (28);
- case 3:
- return (31);
- case 4:
- return (30);
- case 5:
- return (31);
- case 6:
- return (30);
- case 7:
- return (31);
- case 8:
- return (31);
- case 9:
- return (30);
- case 10:
- return (31);
- case 11:
- return (30);
- case 12:
- return (31);
- default:
- return (0);
- }
-}
-
-
-static double
-dint (dnum)
-
-double dnum;
-{
- double dn;
-
- if (dnum < 0.0)
- dn = -floor (-dnum);
- else
- dn = floor (dnum);
- return (dn);
-}
-
-
-static double
-dmod (dnum, dm)
-
-double dnum, dm;
-{
- double dnumx, dnumi, dnumf;
- if (dnum < 0.0)
- dnumx = -dnum;
- else
- dnumx = dnum;
- dnumi = dint (dnumx / dm);
- if (dnum < 0.0)
- dnumf = dnum + (dnumi * dm);
- else if (dnum > 0.0)
- dnumf = dnum - (dnumi * dm);
- else
- dnumf = 0.0;
- return (dnumf);
-}
-
-/* Jul 1 1999 New file, based on iolib/jcon.f and iolib/vcon.f and hgetdate()
- * Oct 21 1999 Fix declarations after lint
- * Oct 27 1999 Fix bug to return epoch if fractional year input
- * Dec 9 1999 Fix bug in ts2jd() found by Pete Ratzlaff (SAO)
- * Dec 17 1999 Add all unimplemented conversions
- * Dec 20 1999 Add isdate(); leave date, time strings unchanged in fd2i()
- * Dec 20 1999 Make all fd2*() subroutines deal with time alone
- *
- * Jan 3 2000 In old FITS format, year 100 is assumed to be 2000
- * Jan 11 2000 Fix epoch to date conversion so .0 is 0:00, not 12:00
- * Jan 21 2000 Add separate Besselian and Julian epoch computations
- * Jan 28 2000 Add Modified Julian Date conversions
- * Mar 2 2000 Implement decimal places for FITS date string
- * Mar 14 2000 Fix bug in dealing with 2000-02-29 in ts2i()
- * Mar 22 2000 Add lt2* and ut2* to get current time as local and UT
- * Mar 24 2000 Fix calloc() calls
- * Mar 24 2000 Add tsi2* and tsu2* to convert IRAF and Unix seconds
- * May 1 2000 In old FITS format, all years < 1000 get 1900 added to them
- * Aug 1 2000 Make ep2jd and jd2ep consistently starting at 1/1 0:00
- *
- * Jan 11 2001 Print all messages to stderr
- * May 21 2001 Add day of year conversions
- * May 25 2001 Allow fraction of day in FITS date instead of time
- *
- * Apr 8 2002 Change all long declaration to time_t
- * May 13 2002 Fix bugs found by lint
- * Jul 5 2002 Fix bug in fixdate() so fractional seconds come out
- * Jul 8 2002 Fix rounding bug in t2i()
- * Jul 8 2002 Try Fliegel and Van Flandern's algorithm for JD to UT date
- * Jul 8 2002 If first character of string is -, check for other -'s in isdate
- * Sep 10 2002 Add ET/TDT/TT conversion from UT subroutines
- * Sep 10 2002 Add sidereal time conversions
- *
- * Jan 30 2003 Fix typo in ts2gst()
- * Mar 7 2003 Add conversions for heliocentric julian dates
- * May 20 2003 Declare nd in setdatedec()
- * Jul 18 2003 Add code to parse Las Campanas dates
- *
- * Mar 24 2004 If ndec > 0, add UT to FITS date even if it is 0:00:00
- *
- * Oct 14 2005 Add tsd2fd() and tsd2dt()
- *
- * May 3 2006 Drop declaration of unused variables
- * Jun 20 2006 Initialized uninitialized variables
- * Aug 2 2006 Add local sidereal time
- * Sep 13 2006 Add more local sidereal time subroutines
- * Oct 2 2006 Add UT to old FITS date conversions
- * Oct 6 2006 Add eqeqnx() to compute equation of the equinoxes
- *
- * Jan 8 2007 Remove unused variables
- *
- * Sep 5 2008 Replace nutation with IAU 2006 model translated from SOFA
- * Sep 9 2008 Add ang2hr(), ang2deg(), hr2ang(), deg2ang()
- * Sep 10 2008 Add longitude to mean standard time (default = Greenwich)
- * Oct 8 2008 Clean up sidereal time computations
- *
- * Sep 24 2009 Add end to comment "Coefficients for fundamental arguments"
- *
- * Jan 11 2012 Add TAI, TT, GPS time
- * Oct 19 2012 Unused l0 dropped from jd2lst(); ts2ss from jd2mst()
- */
diff --git a/funtools/wcs/distort.c b/funtools/wcs/distort.c
deleted file mode 100644
index d903dfe..0000000
--- a/funtools/wcs/distort.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*** File libwcs/distort.c
- *** January 4, 2007
- *** By Jessica Mink, jmink@cfa.harvard.edu,
- *** Based on code written by Jing Li, IPAC
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 2004-2007
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: distort.c (World Coordinate Systems)
- * Purpose: Convert focal plane coordinates to pixels and vice versa:
- * Subroutine: distortinit (wcs, hstring) set distortion coefficients from FITS header
- * Subroutine: DelDistort (header, verbose) delete distortion coefficients in FITS header
- * Subroutine: pix2foc (wcs, x, y, u, v) pixel coordinates -> focal plane coordinates
- * Subroutine: foc2pix (wcs, u, v, x, y) focal plane coordinates -> pixel coordinates
- * Subroutine: setdistcode (wcs,ctype) sets distortion code from CTYPEi
- * Subroutine: getdistcode (wcs) returns distortion code string for CTYPEi
- */
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "wcs.h"
-
-void
-distortinit (wcs, hstring)
-struct WorldCoor *wcs; /* World coordinate system structure */
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-{
- int i, j, m;
- char keyword[12];
-
- /* Read distortion coefficients, if present */
- if (wcs->distcode == DISTORT_SIRTF) {
- if (wcs->wcsproj == WCS_OLD) {
- wcs->wcsproj = WCS_NEW;
- wcs->distort.a_order = 0;
- wcs->distort.b_order = 0;
- wcs->distort.ap_order = 0;
- wcs->distort.bp_order = 0;
- }
- else {
- if (!hgeti4 (hstring, "A_ORDER", &wcs->distort.a_order)) {
- setwcserr ("DISTINIT: Missing A_ORDER keyword for Spitzer distortion");
- }
- else {
- m = wcs->distort.a_order;
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m; j++) {
- wcs->distort.a[i][j] = 0.0;
- }
- }
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "A_%d_%d", i, j);
- hgetr8 (hstring, keyword, &wcs->distort.a[i][j]);
- }
- }
- }
- if (!hgeti4 (hstring, "B_ORDER", &wcs->distort.b_order)) {
- setwcserr ("DISTINIT: Missing B_ORDER keyword for Spitzer distortion");
- }
- else {
- m = wcs->distort.b_order;
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m; j++) {
- wcs->distort.b[i][j] = 0.0;
- }
- }
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "B_%d_%d", i, j);
- hgetr8 (hstring, keyword, &wcs->distort.b[i][j]);
- }
- }
- }
- if (!hgeti4 (hstring, "AP_ORDER", &wcs->distort.ap_order)) {
- setwcserr ("DISTINIT: Missing AP_ORDER keyword for Spitzer distortion");
- }
- else {
- m = wcs->distort.ap_order;
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m; j++) {
- wcs->distort.ap[i][j] = 0.0;
- }
- }
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "AP_%d_%d", i, j);
- hgetr8 (hstring, keyword, &wcs->distort.ap[i][j]);
- }
- }
- }
- if (!hgeti4 (hstring, "BP_ORDER", &wcs->distort.bp_order)) {
- setwcserr ("DISTINIT: Missing BP_ORDER keyword for Spitzer distortion");
- }
- else {
- m = wcs->distort.bp_order;
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m; j++) {
- wcs->distort.bp[i][j] = 0.0;
- }
- }
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "BP_%d_%d", i, j);
- hgetr8 (hstring, keyword, &wcs->distort.bp[i][j]);
- }
- }
- }
- }
- }
- return;
-}
-
-
-/* Delete all distortion-related fields.
- * return 0 if at least one such field is found, else -1. */
-
-int
-DelDistort (header, verbose)
-
-char *header;
-int verbose;
-
-{
- char keyword[16];
- char str[32];
- int i, j, m;
- int lctype;
- int n;
-
- n = 0;
-
- if (hgeti4 (header, "A_ORDER", &m)) {
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "A_%d_%d", i, j);
- hdel (header, keyword);
- n++;
- }
- }
- hdel (header, "A_ORDER");
- n++;
- }
-
- if (hgeti4 (header, "AP_ORDER", &m)) {
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "AP_%d_%d", i, j);
- hdel (header, keyword);
- n++;
- }
- }
- hdel (header, "AP_ORDER");
- n++;
- }
-
- if (hgeti4 (header, "B_ORDER", &m)) {
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "B_%d_%d", i, j);
- hdel (header, keyword);
- n++;
- }
- }
- hdel (header, "B_ORDER");
- n++;
- }
-
- if (hgeti4 (header, "BP_ORDER", &m)) {
- for (i = 0; i <= m; i++) {
- for (j = 0; j <= m-i; j++) {
- sprintf (keyword, "BP_%d_%d", i, j);
- hdel (header, keyword);
- n++;
- }
- }
- hdel (header, "BP_ORDER");
- n++;
- }
-
- if (n > 0 && verbose)
- fprintf (stderr,"%d keywords deleted\n", n);
-
- /* Remove WCS distortion code from CTYPEi in FITS header */
- if (hgets (header, "CTYPE1", 31, str)) {
- lctype = strlen (str);
- if (lctype > 8) {
- str[8] = (char) 0;
- hputs (header, "CTYPE1", str);
- }
- }
- if (hgets (header, "CTYPE2", 31, str)) {
- lctype = strlen (str);
- if (lctype > 8) {
- str[8] = (char) 0;
- hputs (header, "CTYPE2", str);
- }
- }
-
- return (n);
-}
-
-void
-foc2pix (wcs, x, y, u, v)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double x, y; /* Focal plane coordinates */
-double *u, *v; /* Image pixel coordinates (returned) */
-{
- int m, n, i, j, k;
- double s[DISTMAX], sum;
- double temp_x, temp_y;
-
- /* Spitzer distortion */
- if (wcs->distcode == DISTORT_SIRTF) {
- m = wcs->distort.ap_order;
- n = wcs->distort.bp_order;
-
- temp_x = x - wcs->xrefpix;
- temp_y = y - wcs->yrefpix;
-
- /* compute u */
- for (j = 0; j <= m; j++) {
- s[j] = wcs->distort.ap[m-j][j];
- for (k = j-1; k >= 0; k--) {
- s[j] = (temp_y * s[j]) + wcs->distort.ap[m-j][k];
- }
- }
-
- sum = s[0];
- for (i=m; i>=1; i--){
- sum = (temp_x * sum) + s[m-i+1];
- }
- *u = sum;
-
- /* compute v*/
- for (j = 0; j <= n; j++) {
- s[j] = wcs->distort.bp[n-j][j];
- for (k = j-1; k >= 0; k--) {
- s[j] = temp_y*s[j] + wcs->distort.bp[n-j][k];
- }
- }
-
- sum = s[0];
- for (i = n; i >= 1; i--)
- sum = temp_x * sum + s[n-i+1];
-
- *v = sum;
-
- *u = x + *u;
- *v = y + *v;
- }
-
- /* If no distortion, return pixel positions unchanged */
- else {
- *u = x;
- *v = y;
- }
-
- return;
-}
-
-
-void
-pix2foc (wcs, u, v, x, y)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double u, v; /* Image pixel coordinates */
-double *x, *y; /* Focal plane coordinates (returned) */
-{
- int m, n, i, j, k;
- double s[DISTMAX], sum;
- double temp_u, temp_v;
-
- /* Spitzer distortion */
- if (wcs->distcode == DISTORT_SIRTF) {
- m = wcs->distort.a_order;
- n = wcs->distort.b_order;
-
- temp_u = u - wcs->xrefpix;
- temp_v = v - wcs->yrefpix;
-
- /* compute u */
- for (j = 0; j <= m; j++) {
- s[j] = wcs->distort.a[m-j][j];
- for (k = j-1; k >= 0; k--) {
- s[j] = (temp_v * s[j]) + wcs->distort.a[m-j][k];
- }
- }
-
- sum = s[0];
- for (i=m; i>=1; i--){
- sum = temp_u*sum + s[m-i+1];
- }
- *x = sum;
-
- /* compute v*/
- for (j=0; j<=n; j++) {
- s[j] = wcs->distort.b[n-j][j];
- for (k=j-1; k>=0; k--) {
- s[j] =temp_v*s[j] + wcs->distort.b[n-j][k];
- }
- }
-
- sum = s[0];
- for (i=n; i>=1; i--)
- sum = temp_u*sum + s[n-i+1];
-
- *y = sum;
-
- *x = u + *x;
- *y = v + *y;
-
-/* *x = u + *x + coeff.crpix1; */
-/* *y = v + *y + coeff.crpix2; */
- }
-
- /* If no distortion, return pixel positions unchanged */
- else {
- *x = u;
- *y = v;
- }
-
- return;
-}
-
-
-/* SETDISTCODE -- Set WCS distortion code from CTYPEi in FITS header */
-
-void
-setdistcode (wcs, ctype)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-char *ctype; /* Value of CTYPEi from FITS header */
-
-{
- char *extension;
- int lctype;
-
- lctype = strlen (ctype);
- if (lctype < 9)
- wcs->distcode = DISTORT_NONE;
- else {
- extension = ctype + 8;
- if (!strncmp (extension, "-SIP", 4))
- wcs->distcode = DISTORT_SIRTF;
- else
- wcs->distcode = DISTORT_NONE;
- }
- return;
-}
-
-
-/* GETDISTCODE -- Return NULL if no distortion or code from wcs.h */
-
-char *
-getdistcode (wcs)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-
-{
- char *dcode; /* Distortion string for CTYPEi */
-
- if (wcs->distcode == DISTORT_SIRTF) {
- dcode = (char *) calloc (8, sizeof (char));
- strcpy (dcode, "-SIP");
- }
- else
- dcode = NULL;
- return (dcode);
-}
-
-/* Apr 2 2003 New subroutines
- * Nov 3 2003 Add getdistcode to return distortion code string
- * Nov 10 2003 Include unistd.h to get definition of NULL
- * Nov 18 2003 Include string.h to get strlen()
- *
- * Jan 9 2004 Add DelDistort() to delete distortion keywords
- *
- * Jan 4 2007 Declare header const char*
- *
- * Feb 25 2011 Change SIRTF to Spitzer (long overdue!)
- */
diff --git a/funtools/wcs/dsspos.c b/funtools/wcs/dsspos.c
deleted file mode 100644
index 3bbd5a0..0000000
--- a/funtools/wcs/dsspos.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*** File saoimage/wcslib/dsspos.c
- *** October 21, 1999
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1995-2002
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: dsspos.c (Plate solution WCS conversion)
- * Purpose: Compute WCS from Digital Sky Survey plate fit
- * Subroutine: dsspos() converts from pixel location to RA,Dec
- * Subroutine: dsspix() converts from RA,Dec to pixel location
-
- These functions are based on the astrmcal.c portion of GETIMAGE by
- J. Doggett and the documentation distributed with the Digital Sky Survey.
-
-*/
-
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include "wcs.h"
-
-int
-dsspos (xpix, ypix, wcs, xpos, ypos)
-
-/* Routine to determine accurate position for pixel coordinates */
-/* returns 0 if successful otherwise 1 = angle too large for projection; */
-/* based on amdpos() from getimage */
-
-/* Input: */
-double xpix; /* x pixel number (RA or long without rotation) */
-double ypix; /* y pixel number (dec or lat without rotation) */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpos; /* Right ascension or longitude in degrees */
-double *ypos; /* Declination or latitude in degrees */
-
-{
- double x, y, xmm, ymm, xmm2, ymm2, xmm3, ymm3, x2y2;
- double xi, xir, eta, etar, raoff, ra, dec;
- double cond2r = 1.745329252e-2;
- double cons2r = 206264.8062470964;
- double twopi = 6.28318530717959;
- double ctan, ccos;
-
-/* Ignore magnitude and color terms
- double mag = 0.0;
- double color = 0.0; */
-
-/* Convert from image pixels to plate pixels */
- x = xpix + wcs->x_pixel_offset - 1.0 + 0.5;
- y = ypix + wcs->y_pixel_offset - 1.0 + 0.5;
-
-/* Convert from pixels to millimeters */
- xmm = (wcs->ppo_coeff[2] - x * wcs->x_pixel_size) / 1000.0;
- ymm = (y * wcs->y_pixel_size - wcs->ppo_coeff[5]) / 1000.0;
- xmm2 = xmm * xmm;
- ymm2 = ymm * ymm;
- xmm3 = xmm * xmm2;
- ymm3 = ymm * ymm2;
- x2y2 = xmm2 + ymm2;
-
-/* Compute coordinates from x,y and plate model */
-
- xi = wcs->x_coeff[ 0]*xmm + wcs->x_coeff[ 1]*ymm +
- wcs->x_coeff[ 2] + wcs->x_coeff[ 3]*xmm2 +
- wcs->x_coeff[ 4]*xmm*ymm + wcs->x_coeff[ 5]*ymm2 +
- wcs->x_coeff[ 6]*(x2y2) + wcs->x_coeff[ 7]*xmm3 +
- wcs->x_coeff[ 8]*xmm2*ymm + wcs->x_coeff[ 9]*xmm*ymm2 +
- wcs->x_coeff[10]*ymm3 + wcs->x_coeff[11]*xmm*(x2y2) +
- wcs->x_coeff[12]*xmm*x2y2*x2y2;
-
-/* Ignore magnitude and color terms
- + wcs->x_coeff[13]*mag + wcs->x_coeff[14]*mag*mag +
- wcs->x_coeff[15]*mag*mag*mag + wcs->x_coeff[16]*mag*xmm +
- wcs->x_coeff[17]*mag*x2y2 + wcs->x_coeff[18]*mag*xmm*x2y2 +
- wcs->x_coeff[19]*color; */
-
- eta = wcs->y_coeff[ 0]*ymm + wcs->y_coeff[ 1]*xmm +
- wcs->y_coeff[ 2] + wcs->y_coeff[ 3]*ymm2 +
- wcs->y_coeff[ 4]*xmm*ymm + wcs->y_coeff[ 5]*xmm2 +
- wcs->y_coeff[ 6]*(x2y2) + wcs->y_coeff[ 7]*ymm3 +
- wcs->y_coeff[ 8]*ymm2*xmm + wcs->y_coeff[ 9]*ymm*xmm2 +
- wcs->y_coeff[10]*xmm3 + wcs->y_coeff[11]*ymm*(x2y2) +
- wcs->y_coeff[12]*ymm*x2y2*x2y2;
-
-/* Ignore magnitude and color terms
- + wcs->y_coeff[13]*mag + wcs->y_coeff[14]*mag*mag +
- wcs->y_coeff[15]*mag*mag*mag + wcs->y_coeff[16]*mag*ymm +
- wcs->y_coeff[17]*mag*x2y2) + wcs->y_coeff[18]*mag*ymm*x2y2 +
- wcs->y_coeff[19]*color; */
-
-/* Convert to radians */
-
- xir = xi / cons2r;
- etar = eta / cons2r;
-
-/* Convert to RA and Dec */
-
- ctan = tan (wcs->plate_dec);
- ccos = cos (wcs->plate_dec);
- raoff = atan2 (xir / ccos, 1.0 - etar * ctan);
- ra = raoff + wcs->plate_ra;
- if (ra < 0.0) ra = ra + twopi;
- *xpos = ra / cond2r;
-
- dec = atan (cos (raoff) * ((etar + ctan) / (1.0 - (etar * ctan))));
- *ypos = dec / cond2r;
- return 0;
-}
-
-
-int
-dsspix (xpos, ypos, wcs, xpix, ypix)
-
-/* Routine to determine pixel coordinates for sky position */
-/* returns 0 if successful otherwise 1 = angle too large for projection; */
-/* based on amdinv() from getimage */
-
-/* Input: */
-double xpos; /* Right ascension or longitude in degrees */
-double ypos; /* Declination or latitude in degrees */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpix; /* x pixel number (RA or long without rotation) */
-double *ypix; /* y pixel number (dec or lat without rotation) */
-
-{
- double div,xi,eta,x,y,xy,x2,y2,x2y,y2x,x3,y3,x4,y4,x2y2,cjunk,dx,dy;
- double sypos,cypos,syplate,cyplate,sxdiff,cxdiff;
- double f,fx,fy,g,gx,gy, xmm, ymm;
- double conr2s = 206264.8062470964;
- double tolerance = 0.0000005;
- int max_iterations = 50;
- int i;
- double xr, yr; /* position in radians */
-
- *xpix = 0.0;
- *ypix = 0.0;
-
-/* Convert RA and Dec in radians to standard coordinates on a plate */
- xr = degrad (xpos);
- yr = degrad (ypos);
- sypos = sin (yr);
- cypos = cos (yr);
- if (wcs->plate_dec == 0.0)
- wcs->plate_dec = degrad (wcs->yref);
- syplate = sin (wcs->plate_dec);
- cyplate = cos (wcs->plate_dec);
- if (wcs->plate_ra == 0.0)
- wcs->plate_ra = degrad (wcs->yref);
- sxdiff = sin (xr - wcs->plate_ra);
- cxdiff = cos (xr - wcs->plate_ra);
- div = (sypos * syplate) + (cypos * cyplate * cxdiff);
- if (div == 0.0)
- return (1);
- xi = cypos * sxdiff * conr2s / div;
- eta = ((sypos * cyplate) - (cypos * syplate * cxdiff)) * conr2s / div;
-
-/* Set initial value for x,y */
- if (wcs->plate_scale == 0.0)
- return (1);
- xmm = xi / wcs->plate_scale;
- ymm = eta / wcs->plate_scale;
-
-/* Iterate by Newton's method */
- for (i = 0; i < max_iterations; i++) {
-
- /* X plate model */
- xy = xmm * ymm;
- x2 = xmm * xmm;
- y2 = ymm * ymm;
- x2y = x2 * ymm;
- y2x = y2 * xmm;
- x2y2 = x2 + y2;
- cjunk = x2y2 * x2y2;
- x3 = x2 * xmm;
- y3 = y2 * ymm;
- x4 = x2 * x2;
- y4 = y2 * y2;
- f = wcs->x_coeff[0]*xmm + wcs->x_coeff[1]*ymm +
- wcs->x_coeff[2] + wcs->x_coeff[3]*x2 +
- wcs->x_coeff[4]*xy + wcs->x_coeff[5]*y2 +
- wcs->x_coeff[6]*x2y2 + wcs->x_coeff[7]*x3 +
- wcs->x_coeff[8]*x2y + wcs->x_coeff[9]*y2x +
- wcs->x_coeff[10]*y3 + wcs->x_coeff[11]*xmm*x2y2 +
- wcs->x_coeff[12]*xmm*cjunk;
- /* magnitude and color terms ignored
- + wcs->x_coeff[13]*mag +
- wcs->x_coeff[14]*mag*mag + wcs->x_coeff[15]*mag*mag*mag +
- wcs->x_coeff[16]*mag*xmm + wcs->x_coeff[17]*mag*(x2+y2) +
- wcs->x_coeff[18]*mag*xmm*(x2+y2) + wcs->x_coeff[19]*color;
- */
-
- /* Derivative of X model wrt x */
- fx = wcs->x_coeff[0] + wcs->x_coeff[3]*2.0*xmm +
- wcs->x_coeff[4]*ymm + wcs->x_coeff[6]*2.0*xmm +
- wcs->x_coeff[7]*3.0*x2 + wcs->x_coeff[8]*2.0*xy +
- wcs->x_coeff[9]*y2 + wcs->x_coeff[11]*(3.0*x2+y2) +
- wcs->x_coeff[12]*(5.0*x4 +6.0*x2*y2+y4);
- /* magnitude and color terms ignored
- wcs->x_coeff[16]*mag + wcs->x_coeff[17]*mag*2.0*xmm +
- wcs->x_coeff[18]*mag*(3.0*x2+y2);
- */
-
- /* Derivative of X model wrt y */
- fy = wcs->x_coeff[1] + wcs->x_coeff[4]*xmm +
- wcs->x_coeff[5]*2.0*ymm + wcs->x_coeff[6]*2.0*ymm +
- wcs->x_coeff[8]*x2 + wcs->x_coeff[9]*2.0*xy +
- wcs->x_coeff[10]*3.0*y2 + wcs->x_coeff[11]*2.0*xy +
- wcs->x_coeff[12]*4.0*xy*x2y2;
- /* magnitude and color terms ignored
- wcs->x_coeff[17]*mag*2.0*ymm +
- wcs->x_coeff[18]*mag*2.0*xy;
- */
-
- /* Y plate model */
- g = wcs->y_coeff[0]*ymm + wcs->y_coeff[1]*xmm +
- wcs->y_coeff[2] + wcs->y_coeff[3]*y2 +
- wcs->y_coeff[4]*xy + wcs->y_coeff[5]*x2 +
- wcs->y_coeff[6]*x2y2 + wcs->y_coeff[7]*y3 +
- wcs->y_coeff[8]*y2x + wcs->y_coeff[9]*x2y +
- wcs->y_coeff[10]*x3 + wcs->y_coeff[11]*ymm*x2y2 +
- wcs->y_coeff[12]*ymm*cjunk;
- /* magnitude and color terms ignored
- wcs->y_coeff[13]*mag + wcs->y_coeff[14]*mag*mag +
- wcs->y_coeff[15]*mag*mag*mag + wcs->y_coeff[16]*mag*ymm +
- wcs->y_coeff[17]*mag*x2y2 +
- wcs->y_coeff[18]*mag*ymm*x2y2 + wcs->y_coeff[19]*color;
- */
-
- /* Derivative of Y model wrt x */
- gx = wcs->y_coeff[1] + wcs->y_coeff[4]*ymm +
- wcs->y_coeff[5]*2.0*xmm + wcs->y_coeff[6]*2.0*xmm +
- wcs->y_coeff[8]*y2 + wcs->y_coeff[9]*2.0*xy +
- wcs->y_coeff[10]*3.0*x2 + wcs->y_coeff[11]*2.0*xy +
- wcs->y_coeff[12]*4.0*xy*x2y2;
- /* magnitude and color terms ignored
- wcs->y_coeff[17]*mag*2.0*xmm +
- wcs->y_coeff[18]*mag*ymm*2.0*xmm;
- */
-
- /* Derivative of Y model wrt y */
- gy = wcs->y_coeff[0] + wcs->y_coeff[3]*2.0*ymm +
- wcs->y_coeff[4]*xmm + wcs->y_coeff[6]*2.0*ymm +
- wcs->y_coeff[7]*3.0*y2 + wcs->y_coeff[8]*2.0*xy +
- wcs->y_coeff[9]*x2 + wcs->y_coeff[11]*(x2+3.0*y2) +
- wcs->y_coeff[12]*(5.0*y4 + 6.0*x2*y2 + x4);
- /* magnitude and color terms ignored
- wcs->y_coeff[16]*mag + wcs->y_coeff[17]*mag*2.0*ymm +
- wcs->y_coeff[18]*mag*(x2+3.0*y2);
- */
-
- f = f - xi;
- g = g - eta;
- dx = ((-f * gy) + (g * fy)) / ((fx * gy) - (fy * gx));
- dy = ((-g * fx) + (f * gx)) / ((fx * gy) - (fy * gx));
- xmm = xmm + dx;
- ymm = ymm + dy;
- if ((fabs(dx) < tolerance) && (fabs(dy) < tolerance)) break;
- }
-
-/* Convert mm from plate center to plate pixels */
- if (wcs->x_pixel_size == 0.0 || wcs->y_pixel_size == 0.0)
- return (1);
- x = (wcs->ppo_coeff[2] - xmm*1000.0) / wcs->x_pixel_size;
- y = (wcs->ppo_coeff[5] + ymm*1000.0) / wcs->y_pixel_size;
-
-/* Convert from plate pixels to image pixels */
- *xpix = x - wcs->x_pixel_offset + 1.0 - 0.5;
- *ypix = y - wcs->y_pixel_offset + 1.0 - 0.5;
-
-/* If position is off of the image, return offscale code */
- if (*xpix < 0.5 || *xpix > wcs->nxpix+0.5)
- return -1;
- if (*ypix < 0.5 || *ypix > wcs->nypix+0.5)
- return -1;
-
- return 0;
-}
-/* Mar 6 1995 Original version of this code
- * May 4 1995 Fix eta cross terms which were all in y
- * Jun 21 1995 Add inverse routine
- * Oct 17 1995 Fix inverse routine (degrees -> radians)
- * Nov 7 1995 Add half pixel to image coordinates to get astrometric
- * plate coordinates
- * Feb 26 1996 Fix plate to image pixel conversion error
- *
- * Mar 23 1998 Change names from plate*() to dss*()
- * Apr 7 1998 Change amd_i_coeff to i_coeff
- * Sep 4 1998 Fix possible divide by zero in dsspos() from Allen Harris, SAO
- * Sep 10 1998 Fix possible divide by zero in dsspix() from Allen Harris, SAO
- *
- * Oct 21 1999 Drop declaration of cond2r in dsspix()
- */
diff --git a/funtools/wcs/fileutil.c b/funtools/wcs/fileutil.c
deleted file mode 100644
index a4189a1..0000000
--- a/funtools/wcs/fileutil.c
+++ /dev/null
@@ -1,818 +0,0 @@
-/*** File libwcs/fileutil.c
- *** January 11, 2007
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1999-2007
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: fileutil.c (ASCII file utilities)
- * Purpose: Find out things about ASCII files
- * Subroutine: getfilelines (filename)
- * Return number of lines in an ASCII file
- * Subroutine: getfilebuff (filename)
- * Return entire file contents in a character string
- * Subroutine: getfilesize (filename)
- * Return size of a binary or ASCII file
- * Subroutine: isimlist (filename)
- * Return 1 if file is list of FITS or IRAF image files, else 0
- * Subroutine: isimlistd (filename, rootdir)
- * Return 1 if file is list of FITS or IRAF image files, else 0
- * Subroutine: isfilelist (filename, rootdir)
- * Return 1 if file is list of readable files, else 0
- * Subroutine: isfile (filename)
- * Return 1 if file is a readable file, else 0
- * Subroutine: first_token (diskfile, ncmax, token)
- * Return first token from the next line of an ASCII file
- * Subroutine: stc2s (spchar, string)
- * Replace character in string with space
- * Subroutine: sts2c (spchar, string)
- * Replace spaces in string with character
- * Subroutine: istiff (filename)
- * Return 1 if file is a readable TIFF graphics file, else 0
- * Subroutine: isjpeg (filename)
- * Return 1 if file is a readable JPEG graphics file, else 0
- * int setoken (tokens, string, cwhite)
- * Tokenize a string for easy decoding
- * int nextoken (tokens, token, maxchars)
- * Get next token from tokenized string
- * int getoken (tokens, itok, token, maxchars)
- * Get specified token from tokenized string
- */
-
-#include <stdlib.h>
-#ifndef VMS
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#include <errno.h>
-#include <string.h>
-#include "fitsfile.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-
-/* GETFILELINES -- return number of lines in one file */
-
-int
-getfilelines (filename)
-
-char *filename; /* Name of file for which to find number of lines */
-{
-
- char *buffer, *bufline;
- int nlines = 0;
- char newline = 10;
-
- /* Read file */
- buffer = getfilebuff (filename);
-
- /* Count lines in file */
- if (buffer != NULL) {
- bufline = buffer;
- nlines = 0;
- while ((bufline = strchr (bufline, newline)) != NULL) {
- bufline = bufline + 1;
- nlines++;
- }
- free (buffer);
- return (nlines);
- }
- else {
- return (0);
- }
-}
-
-
-/* GETFILEBUFF -- return entire file contents in one character string */
-
-char *
-getfilebuff (filename)
-
-char *filename; /* Name of file for which to find number of lines */
-{
-
- FILE *diskfile;
- int lfile, nr, lbuff, ipt, ibuff;
- char *buffer, *newbuff, *nextbuff;
-
- /* Treat stdin differently */
- if (!strcmp (filename, "stdin")) {
- lbuff = 5000;
- lfile = lbuff;
- buffer = NULL;
- ipt = 0;
- for (ibuff = 0; ibuff < 10; ibuff++) {
- if ((newbuff = realloc (buffer, lfile+1)) != NULL) {
- buffer = newbuff;
- nextbuff = buffer + ipt;
- nr = fread (nextbuff, 1, lbuff, stdin);
- if (nr == lbuff)
- break;
- else {
- ipt = ipt + lbuff;
- lfile = lfile + lbuff;
- }
- }
- else {
- fprintf (stderr,"GETFILEBUFF: No room for %d-byte buffer\n",
- lfile);
- break;
- }
- }
- return (buffer);
- }
-
- /* Open file */
- if ((diskfile = fopen (filename, "rb")) == NULL)
- return (NULL);
-
- /* Find length of file */
- if (fseek (diskfile, 0, 2) == 0)
- lfile = ftell (diskfile);
- else
- lfile = 0;
- if (lfile < 1) {
- fprintf (stderr,"GETFILEBUFF: File %s is empty\n", filename);
- fclose (diskfile);
- return (NULL);
- }
-
- /* Allocate buffer to hold entire file and read it */
- if ((buffer = calloc (1, lfile+1)) != NULL) {
- fseek (diskfile, 0, 0);
- nr = fread (buffer, 1, lfile, diskfile);
- if (nr < lfile) {
- fprintf (stderr,"GETFILEBUFF: File %s: read %d / %d bytes\n",
- filename, nr, lfile);
- free (buffer);
- fclose (diskfile);
- return (NULL);
- }
- buffer[lfile] = (char) 0;
- fclose (diskfile);
- return (buffer);
- }
- else {
- fprintf (stderr,"GETFILEBUFF: File %s: no room for %d-byte buffer\n",
- filename, lfile);
- fclose (diskfile);
- return (NULL);
- }
-}
-
-
-/* GETFILESIZE -- return size of one file in bytes */
-
-int
-getfilesize (filename)
-
-char *filename; /* Name of file for which to find size */
-{
- struct stat statbuff;
-
- if (stat (filename, &statbuff))
- return (0);
- else
- return ((int) statbuff.st_size);
-}
-
-int
-getfilesize0 (filename)
-
-char *filename; /* Name of file for which to find size */
-{
- FILE *diskfile;
- long filesize;
-
- /* Open file */
- if ((diskfile = fopen (filename, "rb")) == NULL)
- return (-1);
-
- /* Move to end of the file */
- if (fseek (diskfile, 0, 2) == 0)
-
- /* Position is the size of the file */
- filesize = ftell (diskfile);
-
- else
- filesize = -1;
-
- fclose (diskfile);
-
- return ((int) filesize);
-}
-
-
-/* ISIMLIST -- Return 1 if list of FITS or IRAF files, else 0 */
-int
-isimlist (filename)
-
-char *filename; /* Name of possible list file */
-{
- FILE *diskfile;
- char token[256];
- int ncmax = 254;
-
- if ((diskfile = fopen (filename, "r")) == NULL)
- return (0);
- else {
- first_token (diskfile, ncmax, token);
- fclose (diskfile);
- if (isfits (token) | isiraf (token))
- return (1);
- else
- return (0);
- }
-}
-
-
-/* ISIMLISTD -- Return 1 if list of FITS or IRAF files, else 0 */
-int
-isimlistd (filename, rootdir)
-
-char *filename; /* Name of possible list file */
-char *rootdir; /* Name of root directory for files in list */
-{
- FILE *diskfile;
- char token[256];
- char filepath[256];
- int ncmax = 254;
-
- if ((diskfile = fopen (filename, "r")) == NULL)
- return (0);
- else {
- first_token (diskfile, ncmax, token);
- fclose (diskfile);
- if (rootdir != NULL) {
- strcpy (filepath, rootdir);
- strcat (filepath, "/");
- strcat (filepath, token);
- }
- else
- strcpy (filepath, token);
- if (isfits (filepath) | isiraf (filepath))
- return (1);
- else
- return (0);
- }
-}
-
-
-/* ISFILELIST -- Return 1 if list of readable files, else 0 */
-int
-isfilelist (filename, rootdir)
-
-char *filename; /* Name of possible list file */
-char *rootdir; /* Name of root directory for files in list */
-{
- FILE *diskfile;
- char token[256];
- char filepath[256];
- int ncmax = 254;
-
- if ((diskfile = fopen (filename, "r")) == NULL)
- return (0);
- else {
- first_token (diskfile, ncmax, token);
- fclose (diskfile);
- if (rootdir != NULL) {
- strcpy (filepath, rootdir);
- strcat (filepath, "/");
- strcat (filepath, token);
- }
- else
- strcpy (filepath, token);
- if (isfile (filepath))
- return (1);
- else
- return (0);
- }
-}
-
-
-/* ISFILE -- Return 1 if file is a readable file, else 0 */
-
-int
-isfile (filename)
-
-char *filename; /* Name of file to check */
-{
- if (!strcasecmp (filename, "stdin"))
- return (1);
- else if (access (filename, R_OK))
- return (0);
- else
- return (1);
-}
-
-
-/* FIRST_TOKEN -- Return first token from the next line of an ASCII file */
-
-int
-first_token (diskfile, ncmax, token)
-
-FILE *diskfile; /* File descriptor for ASCII file */
-int ncmax; /* Maximum number of characters returned */
-char *token; /* First token on next line (returned) */
-{
- char *lastchar, *lspace;
-
- /* If line can be read, add null at the end of the first token */
- if (fgets (token, ncmax, diskfile) != NULL) {
- if (token[0] == '#') {
- (void) fgets (token, ncmax, diskfile);
- }
-
- /* If only character is a control character, return a NULL */
- if ((strlen(token)==1) && (token[0]<32)){
- token[0]=0;
- return (1);
- }
- lastchar = token + strlen (token) - 1;
-
- /* Remove trailing spaces or control characters */
- while (*lastchar <= 32)
- *lastchar-- = 0;
-
- if ((lspace = strchr (token, ' ')) != NULL) {
- *lspace = (char) 0;
- }
- return (1);
- }
- else
- return (0);
-}
-
-
-/* Replace character in string with space */
-
-int
-stc2s (spchar, string)
-
-char *spchar; /* Character to replace with spaces */
-char *string;
-{
- int i, lstr, n;
- lstr = strlen (string);
- n = 0;
- for (i = 0; i < lstr; i++) {
- if (string[i] == spchar[0]) {
- n++;
- string[i] = ' ';
- }
- }
- return (n);
-}
-
-
-/* Replace spaces in string with character */
-
-int
-sts2c (spchar, string)
-
-char *spchar; /* Character with which to replace spaces */
-char *string;
-{
- int i, lstr, n;
- lstr = strlen (string);
- n = 0;
- for (i = 0; i < lstr; i++) {
- if (string[i] == ' ') {
- n++;
- string[i] = spchar[0];
- }
- }
- return (n);
-}
-
-
-/* ISTIFF -- Return 1 if TIFF file, else 0 */
-int
-istiff (filename)
-
-char *filename; /* Name of file to check */
-{
- int diskfile;
- char keyword[16];
- int nbr;
-
- /* First check to see if this is an assignment */
- if (strchr (filename, '='))
- return (0);
-
- /* Check file extension */
- if (strsrch (filename, ".tif") ||
- strsrch (filename, ".tiff") ||
- strsrch (filename, ".TIFF") ||
- strsrch (filename, ".TIF"))
- return (1);
-
- /* If no TIFF file suffix, try opening the file */
- else {
- if ((diskfile = open (filename, O_RDONLY)) < 0)
- return (0);
- else {
- nbr = read (diskfile, keyword, 4);
- close (diskfile);
- if (nbr < 4)
- return (0);
- else if (!strncmp (keyword, "II", 2))
- return (1);
- else if (!strncmp (keyword, "MM", 2))
- return (1);
- else
- return (0);
- }
- }
-}
-
-
-/* ISJPEG -- Return 1 if JPEG file, else 0 */
-int
-isjpeg (filename)
-
-char *filename; /* Name of file to check */
-{
- int diskfile;
- char keyword[16];
- int nbr;
-
- /* First check to see if this is an assignment */
- if (strchr (filename, '='))
- return (0);
-
- /* Check file extension */
- if (strsrch (filename, ".jpg") ||
- strsrch (filename, ".jpeg") ||
- strsrch (filename, ".JPEG") ||
- strsrch (filename, ".jfif") ||
- strsrch (filename, ".jfi") ||
- strsrch (filename, ".JFIF") ||
- strsrch (filename, ".JFI") ||
- strsrch (filename, ".JPG"))
- return (1);
-
- /* If no JPEG file suffix, try opening the file */
- else {
- if ((diskfile = open (filename, O_RDONLY)) < 0)
- return (0);
- else {
- nbr = read (diskfile, keyword, 2);
- close (diskfile);
- if (nbr < 4)
- return (0);
- else if (keyword[0] == (char) 0xFF &&
- keyword[1] == (char) 0xD8)
- return (1);
- else
- return (0);
- }
- }
-}
-
-
-/* ISGIF -- Return 1 if GIF file, else 0 */
-int
-isgif (filename)
-
-char *filename; /* Name of file to check */
-{
- int diskfile;
- char keyword[16];
- int nbr;
-
- /* First check to see if this is an assignment */
- if (strchr (filename, '='))
- return (0);
-
- /* Check file extension */
- if (strsrch (filename, ".gif") ||
- strsrch (filename, ".GIF"))
- return (1);
-
- /* If no GIF file suffix, try opening the file */
- else {
- if ((diskfile = open (filename, O_RDONLY)) < 0)
- return (0);
- else {
- nbr = read (diskfile, keyword, 6);
- close (diskfile);
- if (nbr < 4)
- return (0);
- else if (!strncmp (keyword, "GIF", 3))
- return (1);
- else
- return (0);
- }
- }
-}
-
-
-static int maxtokens = MAXTOKENS; /* Set maximum number of tokens from wcscat.h*/
-
-/* -- SETOKEN -- tokenize a string for easy decoding */
-
-int
-setoken (tokens, string, cwhite)
-
-struct Tokens *tokens; /* Token structure returned */
-char *string; /* character string to tokenize */
-char *cwhite; /* additional whitespace characters
- * if = tab, disallow spaces and commas */
-{
- char squote, dquote, jch, newline;
- char *iq, *stri, *wtype, *str0, *inew;
- int i,j,naddw, ltok;
-
- newline = (char) 10;
- squote = (char) 39;
- dquote = (char) 34;
- if (string == NULL)
- return (0);
-
- /* Line is terminated by newline or NULL */
- inew = strchr (string, newline);
- if (inew != NULL)
- tokens->lline = inew - string - 1;
- else
- tokens->lline = strlen (string);
-
- /* Save current line in structure */
- tokens->line = string;
-
- /* Add extra whitespace characters */
- if (cwhite == NULL)
- naddw = 0;
- else
- naddw = strlen (cwhite);
-
- /* if character is tab, allow only tabs and nulls as separators */
- if (naddw > 0 && !strncmp (cwhite, "tab", 3)) {
- tokens->white[0] = (char) 9; /* Tab */
- tokens->white[1] = (char) 0; /* NULL (end of string) */
- tokens->nwhite = 2;
- }
-
- /* if character is bar, allow only bars and nulls as separators */
- else if (naddw > 0 && !strncmp (cwhite, "bar", 3)) {
- tokens->white[0] = '|'; /* Bar */
- tokens->white[1] = (char) 0; /* NULL (end of string) */
- tokens->nwhite = 2;
- }
-
- /* otherwise, allow spaces, tabs, commas, nulls, and cwhite */
- else {
- tokens->nwhite = 4 + naddw;;
- tokens->white[0] = ' '; /* Space */
- tokens->white[1] = (char) 9; /* Tab */
- tokens->white[2] = ','; /* Comma */
- tokens->white[3] = (char) 124; /* Vertical bar */
- tokens->white[4] = (char) 0; /* Null (end of string) */
- if (tokens->nwhite > 20)
- tokens->nwhite = 20;
- if (naddw > 0) {
- i = 0;
- for (j = 4; j < tokens->nwhite; j++) {
- tokens->white[j] = cwhite[i];
- i++;
- }
- }
- }
- tokens->white[tokens->nwhite] = (char) 0;
-
- tokens->ntok = 0;
- tokens->itok = 0;
- iq = string - 1;
- for (i = 0; i < maxtokens; i++) {
- tokens->tok1[i] = NULL;
- tokens->ltok[i] = 0;
- }
-
- /* Process string one character at a time */
- stri = string;
- str0 = string;
- while (stri < string+tokens->lline) {
-
- /* Keep stuff between quotes in one token */
- if (stri <= iq)
- continue;
- jch = *stri;
-
- /* Handle quoted strings */
- if (jch == squote)
- iq = strchr (stri+1, squote);
- else if (jch == dquote)
- iq = strchr (stri+1, dquote);
- else
- iq = stri;
- if (iq > stri) {
- tokens->ntok = tokens->ntok + 1;
- if (tokens->ntok > maxtokens) return (maxtokens);
- tokens->tok1[tokens->ntok] = stri + 1;
- tokens->ltok[tokens->ntok] = (iq - stri) - 1;
- stri = iq + 1;
- str0 = iq + 1;
- continue;
- }
-
- /* Search for unquoted tokens */
- wtype = strchr (tokens->white, jch);
-
- /* If this is one of the additional whitespace characters,
- * pass as a separate token */
- if (wtype > tokens->white + 3) {
-
- /* Terminate token before whitespace */
- if (stri > str0) {
- tokens->ntok = tokens->ntok + 1;
- if (tokens->ntok > maxtokens) return (maxtokens);
- tokens->tok1[tokens->ntok] = str0;
- tokens->ltok[tokens->ntok] = stri - str0;
- }
-
- /* Make whitespace character next token; start new one */
- tokens->ntok = tokens->ntok + 1;
- if (tokens->ntok > maxtokens) return (maxtokens);
- tokens->tok1[tokens->ntok] = stri;
- tokens->ltok[tokens->ntok] = 1;
- stri++;
- str0 = stri;
- }
-
- /* Pass previous token if regular whitespace or NULL */
- else if (wtype != NULL || jch == (char) 0) {
-
- /* Ignore leading whitespace */
- if (stri == str0) {
- stri++;
- str0 = stri;
- }
-
- /* terminate token before whitespace; start new one */
- else {
- tokens->ntok = tokens->ntok + 1;
- if (tokens->ntok > maxtokens) return (maxtokens);
- tokens->tok1[tokens->ntok] = str0;
- tokens->ltok[tokens->ntok] = stri - str0;
- stri++;
- str0 = stri;
- }
- }
-
- /* Keep going if not whitespace */
- else
- stri++;
- }
-
- /* Add token terminated by end of line */
- if (str0 < stri) {
- tokens->ntok = tokens->ntok + 1;
- if (tokens->ntok > maxtokens)
- return (maxtokens);
- tokens->tok1[tokens->ntok] = str0;
- ltok = stri - str0 + 1;
- tokens->ltok[tokens->ntok] = ltok;
-
- /* Deal with white space just before end of line */
- jch = str0[ltok-1];
- if (strchr (tokens->white, jch)) {
- ltok = ltok - 1;
- tokens->ltok[tokens->ntok] = ltok;
- tokens->ntok = tokens->ntok + 1;
- tokens->tok1[tokens->ntok] = str0 + ltok;
- tokens->ltok[tokens->ntok] = 0;
- }
- }
-
- tokens->itok = 0;
-
- return (tokens->ntok);
-}
-
-
-/* NEXTOKEN -- get next token from tokenized string */
-
-int
-nextoken (tokens, token, maxchars)
-
-struct Tokens *tokens; /* Token structure returned */
-char *token; /* token (returned) */
-int maxchars; /* Maximum length of token */
-{
- int ltok; /* length of token string (returned) */
- int it, i;
- int maxc = maxchars - 1;
-
- tokens->itok = tokens->itok + 1;
- it = tokens->itok;
- if (it > tokens->ntok)
- it = tokens->ntok;
- else if (it < 1)
- it = 1;
- ltok = tokens->ltok[it];
- if (ltok > maxc)
- ltok = maxc;
- strncpy (token, tokens->tok1[it], ltok);
- for (i = ltok; i < maxc; i++)
- token[i] = (char) 0;
- return (ltok);
-}
-
-
-/* GETOKEN -- get specified token from tokenized string */
-
-int
-getoken (tokens, itok, token, maxchars)
-
-struct Tokens *tokens; /* Token structure returned */
-int itok; /* token sequence number of token
- * if <0, get whole string after token -itok
- * if =0, get whole string */
-char *token; /* token (returned) */
-int maxchars; /* Maximum length of token */
-{
- int ltok; /* length of token string (returned) */
- int it, i;
- int maxc = maxchars - 1;
-
- it = itok;
- if (it > 0 ) {
- if (it > tokens->ntok)
- it = tokens->ntok;
- ltok = tokens->ltok[it];
- if (ltok > maxc)
- ltok = maxc;
- strncpy (token, tokens->tok1[it], ltok);
- }
- else if (it < 0) {
- if (it < -tokens->ntok)
- it = -tokens->ntok;
- ltok = tokens->line + tokens->lline - tokens->tok1[-it];
- if (ltok > maxc)
- ltok = maxc;
- strncpy (token, tokens->tok1[-it], ltok);
- }
- else {
- ltok = tokens->lline;
- if (ltok > maxc)
- ltok = maxc;
- strncpy (token, tokens->tok1[1], ltok);
- }
- for (i = ltok; i < maxc; i++)
- token[i] = (char) 0;
-
- return (ltok);
-}
-
-/*
- * Jul 14 1999 New subroutines
- * Jul 15 1999 Add getfilebuff()
- * Oct 15 1999 Fix format eror in error message
- * Oct 21 1999 Fix declarations after lint
- * Dec 9 1999 Add next_token(); set pointer to next token in first_token
- *
- * Sep 25 2001 Add isfilelist(); move isfile() from catutil.c
- *
- * Jan 4 2002 Allow getfilebuffer() to read from stdin
- * Jan 8 2002 Add sts2c() and stc2s() for space-replaced strings
- * Mar 22 2002 Clean up isfilelist()
- * Aug 1 2002 Return 1 if file is stdin in isfile()
- *
- * Feb 4 2003 Open catalog file rb instead of r (Martin Ploner, Bern)
- * Mar 5 2003 Add isimlistd() to check image lists with root directory
- * May 27 2003 Use file stat call in getfilesize() instead of opening file
- * Jul 17 2003 Add root directory argument to isfilelist()
- *
- * Sep 29 2004 Drop next_token() to avoid conflict with subroutine in catutil.c
- *
- * Sep 26 2005 In first_token, return NULL if token is only control character
- *
- * Feb 23 2006 Add istiff(), isjpeg(), isgif() to check TIFF, JPEG, GIF files
- * Jun 20 2006 Cast call to fgets() void
- *
- * Jan 5 2007 Change stc2s() and sts2c() to pass single character as pointer
- * Jan 11 2007 Move token access subroutines from catutil.c
- */
diff --git a/funtools/wcs/fitsfile.c b/funtools/wcs/fitsfile.c
deleted file mode 100644
index 0ff9479..0000000
--- a/funtools/wcs/fitsfile.c
+++ /dev/null
@@ -1,2308 +0,0 @@
-/*** File libwcs/fitsfile.c
- *** September 15, 2011
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1996-2011
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: fitsfile.c (FITS file reading and writing)
- * Purpose: Read and write FITS image and table files
- * fitsropen (inpath)
- * Open a FITS file for reading, returning a FILE pointer
- * fitsrhead (filename, lhead, nbhead)
- * Read FITS header and return it
- * fitsrtail (filename, lhead, nbhead)
- * Read appended FITS header and return it
- * fitsrsect (filename, nbhead, header, fd, x0, y0, nx, ny)
- * Read section of a FITS image, having already read the header
- * fitsrimage (filename, nbhead, header)
- * Read FITS image, having already ready the header
- * fitsrfull (filename, nbhead, header)
- * Read a FITS image of any dimension
- * fitsrtopen (inpath, nk, kw, nrows, nchar, nbhead)
- * Open a FITS table file for reading; return header information
- * fitsrthead (header, nk, kw, nrows, nchar, nbhead)
- * Extract FITS table information from a FITS header
- * fitsrtline (fd, nbhead, lbuff, tbuff, irow, nbline, line)
- * Read next line of FITS table file
- * ftgetr8 (entry, kw)
- * Extract column from FITS table line as double
- * ftgetr4 (entry, kw)
- * Extract column from FITS table line as float
- * ftgeti4 (entry, kw)
- * Extract column from FITS table line as int
- * ftgeti2 (entry, kw)
- * Extract column from FITS table line as short
- * ftgetc (entry, kw, string, maxchar)
- * Extract column from FITS table line as a character string
- * fitswimage (filename, header, image)
- * Write FITS header and image
- * fitswext (filename, header, image)
- * Write FITS header and image as extension to existing FITS file
- * fitswhdu (fd, filename, header, image)
- * Write FITS header and image as extension to file descriptor
- * fitscimage (filename, header, filename0)
- * Write FITS header and copy FITS image
- * fitswhead (filename, header)
- * Write FITS header and keep file open for further writing
- * fitswexhead (filename, header)
- * Write FITS header only to FITS extension without writing data
- * isfits (filename)
- * Return 1 if file is a FITS file, else 0
- * fitsheadsize (header)
- * Return size of FITS header in bytes
- */
-
-#include <stdlib.h>
-#ifndef VMS
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#include <errno.h>
-#include <string.h>
-#include "fitsfile.h"
-
-static int verbose=0; /* Print diagnostics */
-static char fitserrmsg[80];
-static int fitsinherit = 1; /* Append primary header to extension header */
-void
-setfitsinherit (inh)
-int inh;
-{fitsinherit = inh; return;}
-
-static off_t ibhead = 0; /* Number of bytes read before header starts */
-
-off_t
-getfitsskip()
-{return (ibhead);}
-
-/* FITSRHEAD -- Read a FITS header */
-
-char *
-fitsrhead (filename, lhead, nbhead)
-
-char *filename; /* Name of FITS image file */
-int *lhead; /* Allocated length of FITS header in bytes (returned) */
-int *nbhead; /* Number of bytes before start of data (returned) */
- /* This includes all skipped image extensions */
-
-{
- int fd;
- char *header; /* FITS image header (filled) */
- int extend;
- int nbytes,naxis, i;
- int ntry,nbr,irec,nrec, nbh, ipos, npos, nbprim, lprim, lext;
- int nax1, nax2, nax3, nax4, nbpix, ibpix, nblock, nbskip;
- char fitsbuf[2884];
- char *headend; /* Pointer to last line of header */
- char *headnext; /* Pointer to next line of header to be added */
- int hdu; /* header/data unit counter */
- int extnum; /* desired header data number
- (0=primary -1=first with data -2=use EXTNAME) */
- char extname[32]; /* FITS extension name */
- char extnam[32]; /* Desired FITS extension name */
- char *ext; /* FITS extension name or number in header, if any */
- char *pheader; /* Primary header (naxis is 0) */
- char cext = 0;
- char *rbrac; /* Pointer to right bracket if present in file name */
- char *mwcs; /* Pointer to WCS name separated by % */
- char *newhead; /* New larger header */
- int nbh0; /* Length of old too small header */
- char *pheadend;
- int inherit = 1; /* Value of INHERIT keyword in FITS extension header */
- int extfound = 0; /* Set to one if desired FITS extension is found */
- int npcount;
-
- pheader = NULL;
- lprim = 0;
- header = NULL;
-
- /* Check for FITS WCS specification and ignore for file opening */
- mwcs = strchr (filename, '%');
- if (mwcs != NULL)
- *mwcs = (char) 0;
-
- /* Check for FITS extension and ignore for file opening */
- rbrac = NULL;
- ext = strchr (filename, ',');
- if (ext == NULL) {
- ext = strchr (filename, '[');
- if (ext != NULL) {
- rbrac = strchr (filename, ']');
- if (rbrac != NULL)
- *rbrac = (char) 0;
- }
- }
- if (ext != NULL) {
- cext = *ext;
- *ext = (char) 0;
- }
-
- /* Open the image file and read the header */
- if (strncasecmp (filename,"stdin",5)) {
- fd = -1;
- fd = fitsropen (filename);
- }
-#ifndef VMS
- else {
- fd = STDIN_FILENO;
- extnum = -1;
- }
-#endif
-
- if (ext != NULL) {
- if (isnum (ext+1))
- extnum = atoi (ext+1);
- else {
- extnum = -2;
- strcpy (extnam, ext+1);
- }
- }
- else
- extnum = -1;
-
- /* Repair the damage done to the file-name string during parsing */
- if (ext != NULL)
- *ext = cext;
- if (rbrac != NULL)
- *rbrac = ']';
- if (mwcs != NULL)
- *mwcs = '%';
-
- if (fd < 0) {
- fprintf (stderr,"FITSRHEAD: cannot read file %s\n", filename);
- return (NULL);
- }
-
- nbytes = FITSBLOCK;
- *nbhead = 0;
- headend = NULL;
- nbh = FITSBLOCK * 20 + 4;
- header = (char *) calloc ((unsigned int) nbh, 1);
- (void) hlength (header, nbh);
- headnext = header;
- nrec = 1;
- hdu = 0;
- ibhead = 0;
-
- /* Read FITS header from input file one FITS block at a time */
- irec = 0;
- ibhead = 0;
- while (irec < 200) {
- nbytes = FITSBLOCK;
- for (ntry = 0; ntry < 10; ntry++) {
- for (i = 0; i < 2884; i++) fitsbuf[i] = 0;
- nbr = read (fd, fitsbuf, nbytes);
-
- /* Short records allowed only if they have the last header line */
- if (nbr < nbytes) {
- headend = ksearch (fitsbuf,"END");
- if (headend == NULL) {
- if (ntry < 9) {
- if (verbose)
- fprintf (stderr,"FITSRHEAD: %d / %d bytes read %d\n",
- nbr,nbytes,ntry);
- }
- else {
- snprintf(fitserrmsg,79,"FITSRHEAD: '%d / %d bytes of header read from %s\n"
- ,nbr,nbytes,filename);
-#ifndef VMS
- if (fd != STDIN_FILENO)
-#endif
- (void)close (fd);
- free (header);
- /* if (pheader != NULL)
- return (pheader); */
- if (extnum != -1 && !extfound) {
- *ext = (char) 0;
- if (extnum < 0) {
- snprintf (fitserrmsg,79,
- "FITSRHEAD: Extension %s not found in file %s",
- extnam, filename);
- }
- else {
- snprintf (fitserrmsg,79,
- "FITSRHEAD: Extension %d not found in file %s",
- extnum, filename);
- }
- *ext = cext;
- }
- else if (hdu > 0) {
- snprintf (fitserrmsg,79,
- "FITSRHEAD: No extensions found in file %s", filename);
- hdu = 0;
- if (pheader != NULL) {
- *lhead = nbprim;
- *nbhead = nbprim;
- return (pheader);
- }
- break;
- }
- else {
- snprintf (fitserrmsg,79,
- "FITSRHEAD: No header found in file %s", filename);
- }
- return (NULL);
- }
- }
- else
- break;
- }
- else
- break;
- }
-
- /* Move current FITS record into header string */
- for (i = 0; i < 2880; i++)
- if (fitsbuf[i] < 32 || i > nbr) fitsbuf[i] = 32;
- if (nbr < 2880)
- nbr = 2880;
- strncpy (headnext, fitsbuf, nbr);
- *nbhead = *nbhead + nbr;
- nrec = nrec + 1;
- *(headnext+nbr) = 0;
- ibhead = ibhead + 2880;
-
- /* Check to see if this is the final record in this header */
- headend = ksearch (fitsbuf,"END");
- if (headend == NULL) {
-
- /* Increase size of header buffer by 4 blocks if too small */
- if (nrec * FITSBLOCK > nbh) {
- nbh0 = nbh;
- nbh = (nrec + 4) * FITSBLOCK + 4;
- newhead = (char *) calloc (1,(unsigned int) nbh);
- for (i = 0; i < nbh0; i++)
- newhead[i] = header[i];
- free (header);
- header = newhead;
- (void) hlength (header, nbh);
- headnext = header + *nbhead - FITSBLOCK;
- }
- headnext = headnext + FITSBLOCK;
- }
-
- else {
- naxis = 0;
- hgeti4 (header,"NAXIS",&naxis);
-
- /* If header has no data, save it for appending to desired header */
- if (naxis < 1) {
- nbprim = nrec * FITSBLOCK;
- headend = ksearch (header,"END");
- lprim = headend + 80 - header;
- pheader = (char *) calloc ((unsigned int) nbprim, 1);
- for (i = 0; i < lprim; i++)
- pheader[i] = header[i];
- strncpy (pheader, header, lprim);
- }
-
- /* If header has no data, start with the next record */
- if (naxis < 1 && extnum == -1) {
- extend = 0;
- hgetl (header,"EXTEND",&extend);
- if (naxis == 0 && extend) {
- headnext = header;
- *headend = ' ';
- headend = NULL;
- nrec = 1;
- hdu = hdu + 1;
- }
- else {
- break;
- }
- }
-
- /* If this is the desired header data unit, keep it */
- else if (extnum != -1) {
- if (extnum > -1 && hdu == extnum) {
- extfound = 1;
- break;
- }
- else if (extnum < 0) {
- extname[0] = 0;
- hgets (header, "EXTNAME", 32, extname);
- if (!strcmp (extnam,extname)) {
- extfound = 1;
- break;
- }
- }
-
- /* If this is not desired header data unit, skip over data */
- hdu = hdu + 1;
- nblock = 0;
- ibhead = 0;
- if (naxis > 0) {
- ibpix = 0;
- hgeti4 (header,"BITPIX",&ibpix);
- if (ibpix < 0) {
- nbpix = -ibpix / 8;
- }
- else {
- nbpix = ibpix / 8;
- }
- nax1 = 1;
- hgeti4 (header,"NAXIS1",&nax1);
- nax2 = 1;
- if (naxis > 1) {
- hgeti4 (header,"NAXIS2",&nax2);
- }
- nax3 = 1;
- if (naxis > 2) {
- hgeti4 (header,"NAXIS3",&nax3);
- }
- nax4 = 1;
- if (naxis > 3) {
- hgeti4 (header,"NAXIS4",&nax4);
- }
- nbskip = nax1 * nax2 * nax3 * nax4 * nbpix;
- nblock = nbskip / 2880;
- if (nblock*2880 < nbskip) {
- nblock = nblock + 1;
- }
- npcount = 0;
- hgeti4 (header,"PCOUNT", &npcount);
- if (npcount > 0) {
- nbskip = nbskip + npcount;
- nblock = nbskip / 2880;
- if (nblock*2880 < nbskip)
- nblock = nblock + 1;
- }
- }
- else {
- nblock = 0;
- }
- *nbhead = *nbhead + (nblock * 2880);
-
- /* Set file pointer to beginning of next header/data unit */
- if (nblock > 0) {
-#ifndef VMS
- if (fd != STDIN_FILENO) {
- ipos = lseek (fd, *nbhead, SEEK_SET);
- npos = *nbhead;
- }
- else {
-#else
- {
-#endif
- ipos = 0;
- for (i = 0; i < nblock; i++) {
- nbytes = FITSBLOCK;
- nbr = read (fd, fitsbuf, nbytes);
- if (nbr < nbytes) {
- ipos = ipos + nbr;
- break;
- }
- else {
- ipos = ipos + nbytes;
- }
- }
- npos = nblock * 2880;
- }
- if (ipos < npos) {
- snprintf (fitserrmsg,79,"FITSRHEAD: %d / %d bytes skipped\n",
- ipos,npos);
- extfound = 0;
- break;
- }
- }
- headnext = header;
- headend = NULL;
- nrec = 1;
- }
- else {
- break;
- }
- }
- }
-
-#ifndef VMS
- if (fd != STDIN_FILENO)
- (void)close (fd);
-#endif
-
-/* Print error message and return null if extension not found */
- if (extnum != -1 && !extfound) {
- if (extnum < 0)
- fprintf (stderr, "FITSRHEAD: Extension %s not found in file %s\n",extnam, filename);
- else
- fprintf (stderr, "FITSRHEAD: Extension %d not found in file %s\n",extnum, filename);
- if (pheader != NULL) {
- free (pheader);
- pheader = NULL;
- }
- return (NULL);
- }
-
- /* Allocate an extra block for good measure */
- *lhead = (nrec + 1) * FITSBLOCK;
- if (*lhead > nbh) {
- newhead = (char *) calloc (1,(unsigned int) *lhead);
- for (i = 0; i < nbh; i++)
- newhead[i] = header[i];
- free (header);
- header = newhead;
- (void) hlength (header, *lhead);
- }
- else
- *lhead = nbh;
-
- /* If INHERIT keyword is FALSE, never append primary header */
- if (hgetl (header, "INHERIT", &inherit)) {
- if (!inherit && fitsinherit)
- fitsinherit = 0;
- }
-
- /* Append primary data header to extension header */
- if (pheader != NULL && extnum != 0 && fitsinherit && hdu > 0) {
- extname[0] = 0;
- hgets (header, "XTENSION", 32, extname);
- if (!strcmp (extname,"IMAGE")) {
- strncpy (header, "SIMPLE ", 8);
- hputl (header, "SIMPLE", 1);
- }
- headend = blsearch (header,"END");
- if (headend == NULL)
- headend = ksearch (header, "END");
- lext = headend - header;
-
- /* Update primary header for inclusion at end of extension header */
- hchange (pheader, "SIMPLE", "ROOTHEAD");
- hchange (pheader, "NEXTEND", "NUMEXT");
- hdel (pheader, "BITPIX");
- hdel (pheader, "NAXIS");
- hdel (pheader, "EXTEND");
- hputl (pheader, "ROOTEND",1);
- pheadend = ksearch (pheader,"END");
- lprim = pheadend + 320 - pheader;
- if (lext + lprim > nbh) {
- nrec = (lext + lprim) / FITSBLOCK;
- if (FITSBLOCK*nrec < lext+lprim)
- nrec = nrec + 1;
- *lhead = (nrec+1) * FITSBLOCK;
- newhead = (char *) calloc (1,(unsigned int) *lhead);
- for (i = 0; i < nbh; i++)
- newhead[i] = header[i];
- free (header);
- header = newhead;
- headend = header + lext;
- (void) hlength (header, *lhead);
- }
- hputs (header,"COMMENT","-------------------------------------------");
- hputs (header,"COMMENT","Information from Primary Header");
- hputs (header,"COMMENT","-------------------------------------------");
- headend = blsearch (header,"END");
- if (headend == NULL)
- headend = ksearch (header, "END");
- pheader[lprim] = 0;
- strncpy (headend, pheader, lprim);
- if (pheader != NULL) {
- free (pheader);
- pheader = NULL;
- }
- }
-
- ibhead = *nbhead - ibhead;
-
- return (header);
-}
-
-
-/* FITSRTAIL -- Read FITS header appended to graphics file */
-
-char *
-fitsrtail (filename, lhead, nbhead)
-
-char *filename; /* Name of image file */
-int *lhead; /* Allocated length of FITS header in bytes (returned) */
-int *nbhead; /* Number of bytes before start of data (returned) */
- /* This includes all skipped image extensions */
-
-{
- int fd;
- char *header; /* FITS image header (filled) */
- int nbytes, i, ndiff;
- int nbr, irec;
- off_t offset;
- char *mwcs; /* Pointer to WCS name separated by % */
- char *headstart;
- char *newhead;
-
- header = NULL;
-
- /* Check for FITS WCS specification and ignore for file opening */
- mwcs = strchr (filename, '%');
- if (mwcs != NULL)
- *mwcs = (char) 0;
-
- /* Open the image file and read the header */
- if (strncasecmp (filename,"stdin",5)) {
- fd = -1;
- fd = fitsropen (filename);
- }
-#ifndef VMS
- else {
- fd = STDIN_FILENO;
- }
-#endif
-
- /* Repair the damage done to the file-name string during parsing */
- if (mwcs != NULL)
- *mwcs = '%';
-
- if (fd < 0) {
- fprintf (stderr,"FITSRTAIL: cannot read file %s\n", filename);
- return (NULL);
- }
-
- nbytes = FITSBLOCK;
- *nbhead = 0;
- *lhead = 0;
-
- /* Read FITS header from end of input file one FITS block at a time */
- irec = 0;
- while (irec < 100) {
- nbytes = FITSBLOCK * (irec + 2);
- header = (char *) calloc ((unsigned int) nbytes, 1);
- offset = lseek (fd, -nbytes, SEEK_END);
- if (offset < 0) {
- free (header);
- header = NULL;
- nbytes = 0;
- break;
- }
- for (i = 0; i < nbytes; i++) header[i] = 0;
- nbr = read (fd, header, nbytes);
-
- /* Check for SIMPLE at start of header */
- for (i = 0; i < nbr; i++)
- if (header[i] < 32) header[i] = 32;
- if ((headstart = ksearch (header,"SIMPLE"))) {
- if (headstart != header) {
- ndiff = headstart - header;
- newhead = (char *) calloc ((unsigned int) nbytes, 1);
- for (i = 0; i < nbytes-ndiff; i++)
- newhead[i] = headstart[i];
- free (header);
- header = newhead;
- }
- *lhead = nbytes;
- *nbhead = nbytes;
- break;
- }
- free (header);
- }
- (void) hlength (header, nbytes);
-
-#ifndef VMS
- if (fd != STDIN_FILENO)
- (void)close (fd);
-#endif
-
- return (header);
-}
-
-
-/* FITSRSECT -- Read a piece of a FITS image, having already read the header */
-
-char *
-fitsrsect (filename, header, nbhead, x0, y0, nx, ny, nlog)
-
-char *filename; /* Name of FITS image file */
-char *header; /* FITS header for image (previously read) */
-int nbhead; /* Actual length of image header(s) in bytes */
-int x0, y0; /* FITS image coordinate of first pixel */
-int nx; /* Number of columns to read (less than NAXIS1) */
-int ny; /* Number of rows to read (less than NAXIS2) */
-int nlog; /* Note progress mod this rows */
-{
- int fd; /* File descriptor */
- int nbimage, naxis1, naxis2, bytepix, nbread;
- int bitpix, naxis, nblocks, nbytes, nbr;
- int x1, y1, nbline, nyleft;
- off_t impos, nblin;
- char *image, *imline, *imlast;
- int ilog = 0;
- int row;
-
- /* Open the image file and read the header */
- if (strncasecmp (filename,"stdin", 5)) {
- fd = -1;
-
- fd = fitsropen (filename);
- if (fd < 0) {
- snprintf (fitserrmsg,79, "FITSRSECT: cannot read file %s\n", filename);
- return (NULL);
- }
-
- /* Skip over FITS header and whatever else needs to be skipped */
- if (lseek (fd, nbhead, SEEK_SET) < 0) {
- (void)close (fd);
- snprintf (fitserrmsg,79, "FITSRSECT: cannot skip header of file %s\n",
- filename);
- return (NULL);
- }
- }
-#ifndef VMS
- else
- fd = STDIN_FILENO;
-#endif
-
- /* Compute size of image in bytes using relevant header parameters */
- naxis = 1;
- hgeti4 (header,"NAXIS",&naxis);
- naxis1 = 1;
- hgeti4 (header,"NAXIS1",&naxis1);
- naxis2 = 1;
- hgeti4 (header,"NAXIS2",&naxis2);
- bitpix = 0;
- hgeti4 (header,"BITPIX",&bitpix);
- if (bitpix == 0) {
- /* snprintf (fitserrmsg,79, "FITSRSECT: BITPIX is 0; image not read\n"); */
- (void)close (fd);
- return (NULL);
- }
- bytepix = bitpix / 8;
- if (bytepix < 0) bytepix = -bytepix;
-
- /* Keep X coordinates within image limits */
- if (x0 < 1)
- x0 = 1;
- else if (x0 > naxis1)
- x0 = naxis1;
- x1 = x0 + nx - 1;
- if (x1 < 1)
- x1 = 1;
- else if (x1 > naxis1)
- x1 = naxis1;
- nx = x1 - x0 + 1;
-
- /* Keep Y coordinates within image limits */
- if (y0 < 1)
- y0 = 1;
- else if (y0 > naxis2)
- y0 = naxis2;
- y1 = y0 + ny - 1;
- if (y1 < 1)
- y1 = 1;
- else if (y1 > naxis2)
- y1 = naxis2;
- ny = y1 - y0 + 1;
-
- /* Number of bytes in output image */
- nbline = nx * bytepix;
- nbimage = nbline * ny;
-
- /* Set number of bytes to integral number of 2880-byte blocks */
- nblocks = nbimage / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbimage)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
-
- /* Allocate image section to be read */
- image = (char *) malloc (nbytes);
- nyleft = ny;
- imline = image;
- nbr = 0;
-
- /* Computer pointer to first byte of input image to read */
- nblin = naxis1 * bytepix;
- impos = ((y0 - 1) * nblin) + ((x0 - 1) * bytepix);
- row = y0 - 1;
-
- /* Read image section one line at a time */
- while (nyleft-- > 0) {
- if (lseek (fd, impos, SEEK_CUR) >= 0) {
- nbread = read (fd, imline, nbline);
- nbr = nbr + nbread;
- impos = nblin - nbread;
- imline = imline + nbline;
- row++;
- if (++ilog == nlog) {
- ilog = 0;
- fprintf (stderr, "Row %5d extracted ", row);
- (void) putc (13,stderr);
- }
- }
- }
- if (nlog)
- fprintf (stderr, "\n");
-
- /* Fill rest of image with zeroes */
- imline = image + nbimage;
- imlast = image + nbytes;
- while (imline++ < imlast)
- *imline = (char) 0;
-
- /* Byte-reverse image, if necessary */
- if (imswapped ())
- imswap (bitpix, image, nbytes);
-
- return (image);
-}
-
-
-/* FITSRIMAGE -- Read a FITS image */
-
-char *
-fitsrimage (filename, nbhead, header)
-
-char *filename; /* Name of FITS image file */
-int nbhead; /* Actual length of image header(s) in bytes */
-char *header; /* FITS header for image (previously read) */
-{
- int fd;
- int nbimage, naxis1, naxis2, bytepix, nbread;
- int bitpix, naxis, nblocks, nbytes, nbleft, nbr;
- int simple;
- char *image, *imleft;
-
- /* Open the image file and read the header */
- if (strncasecmp (filename,"stdin", 5)) {
- fd = -1;
-
- fd = fitsropen (filename);
- if (fd < 0) {
- snprintf (fitserrmsg,79, "FITSRIMAGE: cannot read file %s\n", filename);
- return (NULL);
- }
-
- /* Skip over FITS header and whatever else needs to be skipped */
- if (lseek (fd, nbhead, SEEK_SET) < 0) {
- (void)close (fd);
- snprintf (fitserrmsg,79, "FITSRIMAGE: cannot skip header of file %s\n",
- filename);
- return (NULL);
- }
- }
-#ifndef VMS
- else
- fd = STDIN_FILENO;
-#endif
-
- /* If SIMPLE=F in header, simply put post-header part of file in buffer */
- hgetl (header, "SIMPLE", &simple);
- if (!simple) {
- nbytes = getfilesize (filename) - nbhead;
- if ((image = (char *) malloc (nbytes + 1)) == NULL) {
- /* snprintf (fitserrmsg,79, "FITSRIMAGE: %d-byte image buffer cannot be allocated\n"); */
- (void)close (fd);
- return (NULL);
- }
- hputi4 (header, "NBDATA", nbytes);
- nbread = read (fd, image, nbytes);
- return (image);
- }
-
- /* Compute size of image in bytes using relevant header parameters */
- naxis = 1;
- hgeti4 (header,"NAXIS",&naxis);
- naxis1 = 1;
- hgeti4 (header,"NAXIS1",&naxis1);
- naxis2 = 1;
- hgeti4 (header,"NAXIS2",&naxis2);
- bitpix = 0;
- hgeti4 (header,"BITPIX",&bitpix);
- if (bitpix == 0) {
- /* snprintf (fitserrmsg,79, "FITSRIMAGE: BITPIX is 0; image not read\n"); */
- (void)close (fd);
- return (NULL);
- }
- bytepix = bitpix / 8;
- if (bytepix < 0) bytepix = -bytepix;
-
- /* If either dimension is one and image is 3-D, read all three dimensions */
- if (naxis == 3 && (naxis1 ==1 || naxis2 == 1)) {
- int naxis3;
- hgeti4 (header,"NAXIS3",&naxis3);
- nbimage = naxis1 * naxis2 * naxis3 * bytepix;
- }
- else
- nbimage = naxis1 * naxis2 * bytepix;
-
- /* Set number of bytes to integral number of 2880-byte blocks */
- nblocks = nbimage / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbimage)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
-
- /* Allocate and read image */
- image = (char *) malloc (nbytes);
- nbleft = nbytes;
- imleft = image;
- nbr = 0;
- while (nbleft > 0) {
- nbread = read (fd, imleft, nbleft);
- nbr = nbr + nbread;
-#ifndef VMS
- if (fd == STDIN_FILENO && nbread < nbleft && nbread > 0) {
- nbleft = nbleft - nbread;
- imleft = imleft + nbread;
- }
- else
-#endif
- nbleft = 0;
- }
-#ifndef VMS
- if (fd != STDIN_FILENO)
- (void)close (fd);
-#endif
- if (nbr < nbimage) {
- snprintf (fitserrmsg,79, "FITSRIMAGE: %d of %d bytes read from file %s\n",
- nbr, nbimage, filename);
- return (NULL);
- }
-
- /* Byte-reverse image, if necessary */
- if (imswapped ())
- imswap (bitpix, image, nbytes);
-
- return (image);
-}
-
-
-/* FITSRFULL -- Read a FITS image of any dimension */
-
-char *
-fitsrfull (filename, nbhead, header)
-
-char *filename; /* Name of FITS image file */
-int nbhead; /* Actual length of image header(s) in bytes */
-char *header; /* FITS header for image (previously read) */
-{
- int fd;
- int nbimage, naxisi, iaxis, bytepix, nbread;
- int bitpix, naxis, nblocks, nbytes, nbleft, nbr, simple;
- char keyword[16];
- char *image, *imleft;
-
- /* Open the image file and read the header */
- if (strncasecmp (filename,"stdin", 5)) {
- fd = -1;
-
- fd = fitsropen (filename);
- if (fd < 0) {
- snprintf (fitserrmsg,79, "FITSRFULL: cannot read file %s\n", filename);
- return (NULL);
- }
-
- /* Skip over FITS header and whatever else needs to be skipped */
- if (lseek (fd, nbhead, SEEK_SET) < 0) {
- (void)close (fd);
- snprintf (fitserrmsg,79, "FITSRFULL: cannot skip header of file %s\n",
- filename);
- return (NULL);
- }
- }
-#ifndef VMS
- else
- fd = STDIN_FILENO;
-#endif
-
- /* If SIMPLE=F in header, simply put post-header part of file in buffer */
- hgetl (header, "SIMPLE", &simple);
- if (!simple) {
- nbytes = getfilesize (filename) - nbhead;
- if ((image = (char *) malloc (nbytes + 1)) == NULL) {
- snprintf (fitserrmsg,79, "FITSRFULL: %d-byte image buffer cannot be allocated\n",nbytes+1);
- (void)close (fd);
- return (NULL);
- }
- hputi4 (header, "NBDATA", nbytes);
- nbread = read (fd, image, nbytes);
- return (image);
- }
-
- /* Find number of bytes per pixel */
- bitpix = 0;
- hgeti4 (header,"BITPIX",&bitpix);
- if (bitpix == 0) {
- snprintf (fitserrmsg,79, "FITSRFULL: BITPIX is 0; image not read\n");
- (void)close (fd);
- return (NULL);
- }
- bytepix = bitpix / 8;
- if (bytepix < 0) bytepix = -bytepix;
- nbimage = bytepix;
-
- /* Compute size of image in bytes using relevant header parameters */
- naxis = 1;
- hgeti4 (header,"NAXIS",&naxis);
- for (iaxis = 1; iaxis <= naxis; iaxis++) {
- sprintf (keyword, "NAXIS%d", iaxis);
- naxisi = 1;
- hgeti4 (header,keyword,&naxisi);
- nbimage = nbimage * naxisi;
- }
-
- /* Set number of bytes to integral number of 2880-byte blocks */
- nblocks = nbimage / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbimage)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
-
- /* Allocate and read image */
- image = (char *) malloc (nbytes);
- nbleft = nbytes;
- imleft = image;
- nbr = 0;
- while (nbleft > 0) {
- nbread = read (fd, imleft, nbleft);
- nbr = nbr + nbread;
-#ifndef VMS
- if (fd == STDIN_FILENO && nbread < nbleft && nbread > 0) {
- nbleft = nbleft - nbread;
- imleft = imleft + nbread;
- }
- else
-#endif
- nbleft = 0;
- }
-#ifndef VMS
- if (fd != STDIN_FILENO)
- (void)close (fd);
-#endif
- if (nbr < nbimage) {
- snprintf (fitserrmsg,79, "FITSRFULL: %d of %d image bytes read from file %s\n",
- nbr, nbimage, filename);
- return (NULL);
- }
-
- /* Byte-reverse image, if necessary */
- if (imswapped ())
- imswap (bitpix, image, nbytes);
-
- return (image);
-}
-
-
-/* FITSROPEN -- Open a FITS file, returning the file descriptor */
-
-int
-fitsropen (inpath)
-
-char *inpath; /* Pathname for FITS tables file to read */
-
-{
- int ntry;
- int fd; /* file descriptor for FITS tables file (returned) */
- char *ext; /* extension name or number */
- char cext = 0;
- char *rbrac;
- char *mwcs; /* Pointer to WCS name separated by % */
-
-/* Check for FITS WCS specification and ignore for file opening */
- mwcs = strchr (inpath, '%');
-
-/* Check for FITS extension and ignore for file opening */
- ext = strchr (inpath, ',');
- rbrac = NULL;
- if (ext == NULL) {
- ext = strchr (inpath, '[');
- if (ext != NULL) {
- rbrac = strchr (inpath, ']');
- }
- }
-
-/* Open input file */
- for (ntry = 0; ntry < 3; ntry++) {
- if (ext != NULL) {
- cext = *ext;
- *ext = 0;
- }
- if (rbrac != NULL)
- *rbrac = (char) 0;
- if (mwcs != NULL)
- *mwcs = (char) 0;
- fd = open (inpath, O_RDONLY);
- if (ext != NULL)
- *ext = cext;
- if (rbrac != NULL)
- *rbrac = ']';
- if (mwcs != NULL)
- *mwcs = '%';
- if (fd >= 0)
- break;
- else if (ntry == 2) {
- snprintf (fitserrmsg,79, "FITSROPEN: cannot read file %s\n", inpath);
- return (-1);
- }
- }
-
- if (verbose)
- fprintf (stderr,"FITSROPEN: input file %s opened\n",inpath);
-
- return (fd);
-}
-
-
-static int offset1=0;
-static int offset2=0;
-
-/* FITSRTOPEN -- Open FITS table file and fill structure with
- * pointers to selected keywords
- * Return file descriptor (-1 if unsuccessful)
- */
-
-int
-fitsrtopen (inpath, nk, kw, nrows, nchar, nbhead)
-
-char *inpath; /* Pathname for FITS tables file to read */
-int *nk; /* Number of keywords to use */
-struct Keyword **kw; /* Structure for desired entries */
-int *nrows; /* Number of rows in table (returned) */
-int *nchar; /* Number of characters in one table row (returned) */
-int *nbhead; /* Number of characters before table starts */
-
-{
- char temp[16];
- int fd;
- int lhead; /* Maximum length in bytes of FITS header */
- char *header; /* Header for FITS tables file to read */
-
-/* Read FITS header from input file */
- header = fitsrhead (inpath, &lhead, nbhead);
- if (!header) {
- snprintf (fitserrmsg,79,"FITSRTOPEN: %s is not a FITS file\n",inpath);
- return (0);
- }
-
-/* Make sure this file is really a FITS table file */
- temp[0] = 0;
- (void) hgets (header,"XTENSION",16,temp);
- if (strlen (temp) == 0) {
- snprintf (fitserrmsg,79,
- "FITSRTOPEN: %s is not a FITS table file\n",inpath);
- free ((void *) header);
- return (0);
- }
-
-/* If it is a FITS file, get table information from the header */
- else if (!strcmp (temp, "TABLE") || !strcmp (temp, "BINTABLE")) {
- if (fitsrthead (header, nk, kw, nrows, nchar)) {
- snprintf (fitserrmsg,79,
- "FITSRTOPEN: Cannot read FITS table from %s\n",inpath);
- free ((void *) header);
- return (-1);
- }
- else {
- fd = fitsropen (inpath);
- offset1 = 0;
- offset2 = 0;
- free ((void *) header);
- return (fd);
- }
- }
-
-/* If it is another FITS extension note it and return */
- else {
- snprintf (fitserrmsg,79,
- "FITSRTOPEN: %s is a %s extension, not table\n",
- inpath, temp);
- free ((void *) header);
- return (0);
- }
-}
-
-static struct Keyword *pw; /* Structure for all entries */
-static int *lpnam; /* length of name for each field */
-static int bfields = 0;
-
-/* FITSRTHEAD -- From FITS table header, read pointers to selected keywords */
-
-int
-fitsrthead (header, nk, kw, nrows, nchar)
-
-char *header; /* Header for FITS tables file to read */
-int *nk; /* Number of keywords to use */
-struct Keyword **kw; /* Structure for desired entries */
-int *nrows; /* Number of rows in table (returned) */
-int *nchar; /* Number of characters in one table row (returned) */
-
-{
- struct Keyword *rw; /* Structure for desired entries */
- int nfields;
- int ifield, ik, i, ikf, ltform, kl;
- char *h0, *h1, *tf1, *tf2;
- char tname[12];
- char temp[16];
- char tform[16];
- int tverb;
- int bintable = 0;
-
- h0 = header;
-
-/* Make sure this is really a FITS table file header */
- temp[0] = 0;
- hgets (header,"XTENSION",16,temp);
- if (strlen (temp) == 0) {
- snprintf (fitserrmsg,79, "FITSRTHEAD: Not a FITS table header\n");
- return (-1);
- }
- else if (!strcmp (temp, "BINTABLE")) {
- bintable = 1;
- }
- else if (strcmp (temp, "TABLE")) {
- snprintf (fitserrmsg,79, "FITSRTHEAD: %s extension, not TABLE\n",temp);
- return (-1);
- }
-
-/* Get table size from FITS header */
- *nchar = 0;
- hgeti4 (header,"NAXIS1",nchar);
- *nrows = 0;
- hgeti4 (header,"NAXIS2", nrows);
- if (*nrows <= 0 || *nchar <= 0) {
- snprintf (fitserrmsg,79, "FITSRTHEAD: cannot read %d x %d table\n",
- *nrows,*nchar);
- return (-1);
- }
-
-/* Set up table for access to individual fields */
- nfields = 0;
- hgeti4 (header,"TFIELDS",&nfields);
- if (verbose)
- fprintf (stderr, "FITSRTHEAD: %d fields per table entry\n", nfields);
- if (nfields > bfields) {
- if (bfields > 0)
- free ((void *)pw);
- pw = (struct Keyword *) calloc (nfields, sizeof(struct Keyword));
- if (pw == NULL) {
- snprintf (fitserrmsg,79,"FITSRTHEAD: cannot allocate table structure\n");
- return (-1);
- }
- if (bfields > 0)
- free ((void *)lpnam);
- lpnam = (int *) calloc (nfields, sizeof(int));
- if (lpnam == NULL) {
- snprintf (fitserrmsg,79,"FITSRTHEAD: cannot allocate length structure\n");
- return (-1);
- }
- bfields = nfields;
- }
-
- tverb = verbose;
- verbose = 0;
- ikf = 0;
-
- for (ifield = 0; ifield < nfields; ifield++) {
-
- /* Name of field */
- for (i = 0; i < 12; i++) tname[i] = 0;
- sprintf (tname, "TTYPE%d", ifield+1);;
- temp[0] = 0;
- h1 = ksearch (h0,tname);
- h0 = h1;
- hgets (h0,tname,16,temp);
- strcpy (pw[ifield].kname,temp);
- pw[ifield].lname = strlen (pw[ifield].kname);
-
- /* Sequence of field on line */
- pw[ifield].kn = ifield + 1;
-
- /* First column of field */
- if (bintable)
- pw[ifield].kf = ikf;
- else {
- for (i = 0; i < 12; i++) tname[i] = 0;
- sprintf (tname, "TBCOL%d", ifield+1);
- pw[ifield].kf = 0;
- hgeti4 (h0,tname, &pw[ifield].kf);
- }
-
- /* Length of field */
- for (i = 0; i < 12; i++) tname[i] = 0;
- sprintf (tname, "TFORM%d", ifield+1);;
- tform[0] = 0;
- hgets (h0,tname,16,tform);
- strcpy (pw[ifield].kform, tform);
- ltform = strlen (tform);
- if (tform[ltform-1] == 'A') {
- pw[ifield].kform[0] = 'A';
- for (i = 0; i < ltform-1; i++)
- pw[ifield].kform[i+1] = tform[i];
- pw[ifield].kform[ltform] = (char) 0;
- tf1 = pw[ifield].kform + 1;
- kl = atof (tf1);
- }
- else if (!strcmp (tform,"I"))
- kl = 2;
- else if (!strcmp (tform, "J"))
- kl = 4;
- else if (!strcmp (tform, "E"))
- kl = 4;
- else if (!strcmp (tform, "D"))
- kl = 8;
- else {
- tf1 = tform + 1;
- tf2 = strchr (tform,'.');
- if (tf2 != NULL)
- *tf2 = ' ';
- kl = atoi (tf1);
- }
- pw[ifield].kl = kl;
- ikf = ikf + kl;
- }
-
-/* Set up table for access to desired fields */
- verbose = tverb;
- if (verbose)
- fprintf (stderr, "FITSRTHEAD: %d keywords read\n", *nk);
-
-/* If nk = 0, allocate and return structures for all table fields */
- if (*nk <= 0) {
- *kw = pw;
- *nk = nfields;
- return (0);
- }
- else
- rw = *kw;
-
-/* Find each desired keyword in the header */
- for (ik = 0; ik < *nk; ik++) {
- if (rw[ik].kn <= 0) {
- for (ifield = 0; ifield < nfields; ifield++) {
- if (rw[ik].lname != pw[ifield].lname)
- continue;
- if (strcmp (pw[ifield].kname, rw[ik].kname) == 0) {
- break;
- }
- }
- }
- else
- ifield = rw[ik].kn - 1;
-
-/* Set pointer, lentth, and name in returned array of structures */
- rw[ik].kn = ifield + 1;
- rw[ik].kf = pw[ifield].kf - 1;
- rw[ik].kl = pw[ifield].kl;
- strcpy (rw[ik].kform, pw[ifield].kform);
- strcpy (rw[ik].kname, pw[ifield].kname);
- }
-
- return (0);
-}
-
-
-int
-fitsrtline (fd, nbhead, lbuff, tbuff, irow, nbline, line)
-
-int fd; /* File descriptor for FITS file */
-int nbhead; /* Number of bytes in FITS header */
-int lbuff; /* Number of bytes in table buffer */
-char *tbuff; /* FITS table buffer */
-int irow; /* Number of table row to read */
-int nbline; /* Number of bytes to read for this line */
-char *line; /* One line of FITS table (returned) */
-
-{
- int nbuff, nlbuff;
- int nbr = 0;
- int offset, offend, ntry, ioff;
- char *tbuff1;
-
- offset = nbhead + (nbline * irow);
- offend = offset + nbline - 1;
-
-/* Read a new buffer of the FITS table into memory if needed */
- if (offset < offset1 || offend > offset2) {
- nlbuff = lbuff / nbline;
- nbuff = nlbuff * nbline;
- for (ntry = 0; ntry < 3; ntry++) {
- ioff = lseek (fd, offset, SEEK_SET);
- if (ioff < offset) {
- if (ntry == 2)
- return (0);
- else
- continue;
- }
- nbr = read (fd, tbuff, nbuff);
- if (nbr < nbline) {
- if (verbose)
- fprintf (stderr, "FITSRTLINE: %d / %d bytes read %d\n",
- nbr,nbuff,ntry);
- if (ntry == 2)
- return (nbr);
- }
- else
- break;
- }
- offset1 = offset;
- offset2 = offset + nbr - 1;
- strncpy (line, tbuff, nbline);
- return (nbline);
- }
- else {
- tbuff1 = tbuff + (offset - offset1);
- strncpy (line, tbuff1, nbline);
- return (nbline);
- }
-}
-
-
-void
-fitsrtlset ()
-{
- offset1 = 0;
- offset2 = 0;
- return;
-}
-
-
-/* FTGETI2 -- Extract n'th column from FITS table line as short */
-
-short
-ftgeti2 (entry, kw)
-
-char *entry; /* Row or entry from table */
-struct Keyword *kw; /* Table column information from FITS header */
-{
- char temp[30];
- short i;
- int j;
- float r;
- double d;
-
- if (ftgetc (entry, kw, temp, 30)) {
- if (!strcmp (kw->kform, "I"))
- moveb (temp, (char *) &i, 2, 0, 0);
- else if (!strcmp (kw->kform, "J")) {
- moveb (temp, (char *) &j, 4, 0, 0);
- i = (short) j;
- }
- else if (!strcmp (kw->kform, "E")) {
- moveb (temp, (char *) &r, 4, 0, 0);
- i = (short) r;
- }
- else if (!strcmp (kw->kform, "D")) {
- moveb (temp, (char *) &d, 8, 0, 0);
- i = (short) d;
- }
- else
- i = (short) atof (temp);
- return (i);
- }
- else
- return ((short) 0);
-}
-
-
-/* FTGETI4 -- Extract n'th column from FITS table line as int */
-
-int
-ftgeti4 (entry, kw)
-
-char *entry; /* Row or entry from table */
-struct Keyword *kw; /* Table column information from FITS header */
-{
- char temp[30];
- short i;
- int j;
- float r;
- double d;
-
- if (ftgetc (entry, kw, temp, 30)) {
- if (!strcmp (kw->kform, "I")) {
- moveb (temp, (char *) &i, 2, 0, 0);
- j = (int) i;
- }
- else if (!strcmp (kw->kform, "J"))
- moveb (temp, (char *) &j, 4, 0, 0);
- else if (!strcmp (kw->kform, "E")) {
- moveb (temp, (char *) &r, 4, 0, 0);
- j = (int) r;
- }
- else if (!strcmp (kw->kform, "D")) {
- moveb (temp, (char *) &d, 8, 0, 0);
- j = (int) d;
- }
- else
- j = (int) atof (temp);
- return (j);
- }
- else
- return (0);
-}
-
-
-/* FTGETR4 -- Extract n'th column from FITS table line as float */
-
-float
-ftgetr4 (entry, kw)
-
-char *entry; /* Row or entry from table */
-struct Keyword *kw; /* Table column information from FITS header */
-{
- char temp[30];
- short i;
- int j;
- float r;
- double d;
-
- if (ftgetc (entry, kw, temp, 30)) {
- if (!strcmp (kw->kform, "I")) {
- moveb (temp, (char *) &i, 2, 0, 0);
- r = (float) i;
- }
- else if (!strcmp (kw->kform, "J")) {
- moveb (temp, (char *) &j, 4, 0, 0);
- r = (float) j;
- }
- else if (!strcmp (kw->kform, "E"))
- moveb (temp, (char *) &r, 4, 0, 0);
- else if (!strcmp (kw->kform, "D")) {
- moveb (temp, (char *) &d, 8, 0, 0);
- r = (float) d;
- }
- else
- r = (float) atof (temp);
- return (r);
- }
- else
- return ((float) 0.0);
-}
-
-
-/* FTGETR8 -- Extract n'th column from FITS table line as double */
-
-double
-ftgetr8 (entry, kw)
-
-char *entry; /* Row or entry from table */
-struct Keyword *kw; /* Table column information from FITS header */
-{
- char temp[30];
- short i;
- int j;
- float r;
- double d;
-
- if (ftgetc (entry, kw, temp, 30)) {
- if (!strcmp (kw->kform, "I")) {
- moveb (temp, (char *) &i, 2, 0, 0);
- d = (double) i;
- }
- else if (!strcmp (kw->kform, "J")) {
- moveb (temp, (char *) &j, 4, 0, 0);
- d = (double) j;
- }
- else if (!strcmp (kw->kform, "E")) {
- moveb (temp, (char *) &r, 4, 0, 0);
- d = (double) r;
- }
- else if (!strcmp (kw->kform, "D"))
- moveb (temp, (char *) &d, 8, 0, 0);
- else
- d = atof (temp);
- return (d);
- }
- else
- return ((double) 0.0);
-}
-
-
-/* FTGETC -- Extract n'th column from FITS table line as character string */
-
-int
-ftgetc (entry, kw, string, maxchar)
-
-char *entry; /* Row or entry from table */
-struct Keyword *kw; /* Table column information from FITS header */
-char *string; /* Returned string */
-int maxchar; /* Maximum number of characters in returned string */
-{
- int length = maxchar;
-
- if (kw->kl < length)
- length = kw->kl;
- if (length > 0) {
- strncpy (string, entry+kw->kf, length);
- string[length] = 0;
- return ( 1 );
- }
- else
- return ( 0 );
-}
-
-extern int errno;
-
-
-/*FITSWIMAGE -- Write FITS header and image */
-
-int
-fitswimage (filename, header, image)
-
-char *filename; /* Name of FITS image file */
-char *header; /* FITS image header */
-char *image; /* FITS image pixels */
-
-{
- int fd;
-
- /* Open the output file */
- if (strcasecmp (filename,"stdout") ) {
-
- if (!access (filename, 0)) {
- fd = open (filename, O_WRONLY);
- if (fd < 3) {
- snprintf (fitserrmsg,79, "FITSWIMAGE: file %s not writeable\n", filename);
- return (0);
- }
- }
- else {
- fd = open (filename, O_RDWR+O_CREAT, 0666);
- if (fd < 3) {
- snprintf (fitserrmsg,79, "FITSWIMAGE: cannot create file %s\n", filename);
- return (0);
- }
- }
- }
-#ifndef VMS
- else
- fd = STDOUT_FILENO;
-#endif
-
- return (fitswhdu (fd, filename, header, image));
-}
-
-
-/*FITSWEXT -- Write FITS header and image as extension to a file */
-
-int
-fitswext (filename, header, image)
-
-char *filename; /* Name of IFTS image file */
-char *header; /* FITS image header */
-char *image; /* FITS image pixels */
-
-{
- int fd;
-
- /* Open the output file */
- if (strcasecmp (filename,"stdout") ) {
-
- if (!access (filename, 0)) {
- fd = open (filename, O_WRONLY);
- if (fd < 3) {
- snprintf (fitserrmsg,79, "FITSWEXT: file %s not writeable\n",
- filename);
- return (0);
- }
- }
- else {
- fd = open (filename, O_APPEND, 0666);
- if (fd < 3) {
- snprintf (fitserrmsg,79, "FITSWEXT: cannot append to file %s\n",
- filename);
- return (0);
- }
- }
- }
-#ifndef VMS
- else
- fd = STDOUT_FILENO;
-#endif
-
- return (fitswhdu (fd, filename, header, image));
-}
-
-
-/* FITSWHDU -- Write FITS head and image as extension */
-
-int
-fitswhdu (fd, filename, header, image)
-
-int fd; /* File descriptor */
-char *filename; /* Name of IFTS image file */
-char *header; /* FITS image header */
-char *image; /* FITS image pixels */
-{
- int nbhead, nbimage, nblocks, bytepix, i, nbhw;
- int bitpix, naxis, iaxis, naxisi, nbytes, nbw, nbpad, nbwp, simple;
- char *endhead, *padding;
- double bzero, bscale;
- char keyword[32];
-
- /* Change BITPIX=-16 files to BITPIX=16 with BZERO and BSCALE */
- bitpix = 0;
- hgeti4 (header,"BITPIX",&bitpix);
- if (bitpix == -16) {
- if (!hgetr8 (header, "BZERO", &bzero) &&
- !hgetr8 (header, "BSCALE", &bscale)) {
- bitpix = 16;
- hputi4 (header, "BITPIX", bitpix);
- hputr8 (header, "BZERO", 32768.0);
- hputr8 (header, "BSCALE", 1.0);
- }
- }
-
- /* Write header to file */
- endhead = ksearch (header,"END") + 80;
- nbhead = endhead - header;
- nbhw = write (fd, header, nbhead);
- if (nbhw < nbhead) {
- snprintf (fitserrmsg,79, "FITSWHDU: wrote %d / %d bytes of header to file %s\n",
- nbhw, nbhead, filename);
- (void)close (fd);
- return (0);
- }
-
- /* Write extra spaces to make an integral number of 2880-byte blocks */
- nblocks = nbhead / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbhead)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
- nbpad = nbytes - nbhead;
- padding = (char *)calloc (1, nbpad);
- for (i = 0; i < nbpad; i++)
- padding[i] = ' ';
- nbwp = write (fd, padding, nbpad);
- if (nbwp < nbpad) {
- snprintf (fitserrmsg,79, "FITSWHDU: wrote %d / %d bytes of header padding to file %s\n",
- nbwp, nbpad, filename);
- (void)close (fd);
- return (0);
- }
- nbhw = nbhw + nbwp;
- free (padding);
-
- /* Return if file has no data */
- if (bitpix == 0 || image == NULL) {
- /* snprintf (fitserrmsg,79, "FITSWHDU: BITPIX is 0; image not written\n"); */
- (void)close (fd);
- return (0);
- }
-
- /* If SIMPLE=F in header, just write whatever is in the buffer */
- hgetl (header, "SIMPLE", &simple);
- if (!simple) {
- hgeti4 (header, "NBDATA", &nbytes);
- nbimage = nbytes;
- }
-
- else {
-
- /* Compute size of pixel in bytes */
- bytepix = bitpix / 8;
- if (bytepix < 0) bytepix = -bytepix;
- nbimage = bytepix;
-
- /* Compute size of image in bytes using relevant header parameters */
- naxis = 1;
- hgeti4 (header,"NAXIS",&naxis);
- for (iaxis = 1; iaxis <= naxis; iaxis++) {
- sprintf (keyword, "NAXIS%d", iaxis);
- naxisi = 1;
- hgeti4 (header,keyword,&naxisi);
- nbimage = nbimage * naxisi;
- }
-
- /* Number of bytes to write is an integral number of FITS blocks */
- nblocks = nbimage / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbimage)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
-
- /* Byte-reverse image before writing, if necessary */
- if (imswapped ())
- imswap (bitpix, image, nbimage);
- }
-
- /* Write image to file */
- nbw = write (fd, image, nbimage);
- if (nbw < nbimage) {
- snprintf (fitserrmsg,79, "FITSWHDU: wrote %d / %d bytes of image to file %s\n",
- nbw, nbimage, filename);
- return (0);
- }
-
- /* Write extra zeroes to make an integral number of 2880-byte blocks */
- nbpad = nbytes - nbimage;
- if (nbpad > 0) {
- padding = (char *)calloc (1, nbpad);
- nbwp = write (fd, padding, nbpad);
- if (nbwp < nbpad) {
- snprintf (fitserrmsg,79, "FITSWHDU: wrote %d / %d bytes of image padding to file %s\n",
- nbwp, nbpad, filename);
- (void)close (fd);
- return (0);
- }
- free (padding);
- }
- else
- nbwp = 0;
-
- (void)close (fd);
-
- /* Byte-reverse image after writing, if necessary */
- if (imswapped ())
- imswap (bitpix, image, nbimage);
-
- nbw = nbw + nbwp + nbhw;
- return (nbw);
-}
-
-
-/*FITSCIMAGE -- Write FITS header and copy FITS image
- Return number of bytes in output image, 0 if failure */
-
-int
-fitscimage (filename, header, filename0)
-
-char *filename; /* Name of output FITS image file */
-char *header; /* FITS image header */
-char *filename0; /* Name of input FITS image file */
-
-{
- int fdout, fdin;
- int nbhead, nbimage, nblocks, bytepix;
- int bitpix, naxis, naxis1, naxis2, nbytes, nbw, nbpad, nbwp;
- char *endhead, *lasthead, *padding;
- char *image; /* FITS image pixels */
- char *oldhead; /* Input file image header */
- int nbhead0; /* Length of input file image header */
- int lhead0;
- int nbbuff, nbuff, ibuff, nbr, nbdata;
-
- /* Compute size of image in bytes using relevant header parameters */
- naxis = 1;
- hgeti4 (header, "NAXIS", &naxis);
- naxis1 = 1;
- hgeti4 (header, "NAXIS1", &naxis1);
- naxis2 = 1;
- hgeti4 (header, "NAXIS2", &naxis2);
- hgeti4 (header, "BITPIX", &bitpix);
- bytepix = bitpix / 8;
- if (bytepix < 0) bytepix = -bytepix;
-
- /* If either dimension is one and image is 3-D, read all three dimensions */
- if (naxis == 3 && (naxis1 ==1 || naxis2 == 1)) {
- int naxis3;
- hgeti4 (header,"NAXIS3",&naxis3);
- nbimage = naxis1 * naxis2 * naxis3 * bytepix;
- }
- else
- nbimage = naxis1 * naxis2 * bytepix;
-
- nblocks = nbimage / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbimage)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
-
- /* Allocate image buffer */
- nbbuff = FITSBLOCK * 100;
- if (nbytes < nbbuff)
- nbbuff = nbytes;
- image = (char *) calloc (1, nbbuff);
- nbuff = nbytes / nbbuff;
- if (nbytes > nbuff * nbbuff)
- nbuff = nbuff + 1;
-
- /* Read input file header */
- if ((oldhead = fitsrhead (filename0, &lhead0, &nbhead0)) == NULL) {
- snprintf (fitserrmsg, 79,"FITSCIMAGE: header of input file %s cannot be read\n",
- filename0);
- return (0);
- }
-
- /* Find size of output header */
- nbhead = fitsheadsize (header);
-
- /* If overwriting, be more careful if new header is longer than old */
- if (!strcmp (filename, filename0) && nbhead > nbhead0) {
- if ((image = fitsrimage (filename0, nbhead0, oldhead)) == NULL) {
- snprintf (fitserrmsg,79, "FITSCIMAGE: cannot read image from file %s\n",
- filename0);
- free (oldhead);
- return (0);
- }
- return (fitswimage (filename, header, image));
- }
- free (oldhead);
-
- /* Open the input file and skip over the header */
- if (strcasecmp (filename0,"stdin")) {
- fdin = -1;
- fdin = fitsropen (filename0);
- if (fdin < 0) {
- snprintf (fitserrmsg, 79,"FITSCIMAGE: cannot read file %s\n", filename0);
- return (0);
- }
-
- /* Skip over FITS header */
- if (lseek (fdin, nbhead0, SEEK_SET) < 0) {
- (void)close (fdin);
- snprintf (fitserrmsg,79, "FITSCIMAGE: cannot skip header of file %s\n",
- filename0);
- return (0);
- }
- }
-#ifndef VMS
- else
- fdin = STDIN_FILENO;
-#endif
-
- /* Open the output file */
- if (!access (filename, 0)) {
- fdout = open (filename, O_WRONLY);
- if (fdout < 3) {
- snprintf (fitserrmsg,79, "FITSCIMAGE: file %s not writeable\n", filename);
- return (0);
- }
- }
- else {
- fdout = open (filename, O_RDWR+O_CREAT, 0666);
- if (fdout < 3) {
- snprintf (fitserrmsg,79, "FITSCHEAD: cannot create file %s\n", filename);
- return (0);
- }
- }
-
- /* Pad header with spaces */
- endhead = ksearch (header,"END") + 80;
- lasthead = header + nbhead;
- while (endhead < lasthead)
- *(endhead++) = ' ';
-
- /* Write header to file */
- nbw = write (fdout, header, nbhead);
- if (nbw < nbhead) {
- snprintf (fitserrmsg, 79,"FITSCIMAGE: wrote %d / %d bytes of header to file %s\n",
- nbw, nbytes, filename);
- (void)close (fdout);
- (void)close (fdin);
- return (0);
- }
-
- /* Return if no data */
- if (bitpix == 0) {
- (void)close (fdout);
- (void)close (fdin);
- return (nbhead);
- }
-
- nbdata = 0;
- for (ibuff = 0; ibuff < nbuff; ibuff++) {
- nbr = read (fdin, image, nbbuff);
- if (nbr > 0) {
- nbw = write (fdout, image, nbr);
- nbdata = nbdata + nbw;
- }
- }
-
- /* Write extra to make integral number of 2880-byte blocks */
- nblocks = nbdata / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbdata)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
- nbpad = nbytes - nbdata;
- padding = (char *)calloc (1,nbpad);
- nbwp = write (fdout, padding, nbpad);
- nbw = nbdata + nbwp;
- free (padding);
-
- (void)close (fdout);
- (void)close (fdin);
-
- if (nbw < nbimage) {
- snprintf (fitserrmsg, 79, "FITSWIMAGE: wrote %d / %d bytes of image to file %s\n",
- nbw, nbimage, filename);
- return (0);
- }
- else
- return (nbw);
-}
-
-
-/* FITSWHEAD -- Write FITS header and keep file open for further writing */
-
-int
-fitswhead (filename, header)
-
-char *filename; /* Name of IFTS image file */
-char *header; /* FITS image header */
-
-{
- int fd;
- int nbhead, nblocks;
- int nbytes, nbw;
- char *endhead, *lasthead;
-
- /* Open the output file */
- if (!access (filename, 0)) {
- fd = open (filename, O_WRONLY);
- if (fd < 3) {
- snprintf (fitserrmsg, 79, "FITSWHEAD: file %s not writeable\n", filename);
- return (0);
- }
- }
- else {
- fd = open (filename, O_RDWR+O_CREAT, 0666);
- if (fd < 3) {
- snprintf (fitserrmsg, 79, "FITSWHEAD: cannot create file %s\n", filename);
- return (0);
- }
- }
-
- /* Write header to file */
- endhead = ksearch (header,"END") + 80;
- nbhead = endhead - header;
- nblocks = nbhead / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbhead)
- nblocks = nblocks + 1;
- nbytes = nblocks * FITSBLOCK;
-
- /* Pad header with spaces */
- lasthead = header + nbytes;
- while (endhead < lasthead)
- *(endhead++) = ' ';
-
- nbw = write (fd, header, nbytes);
- if (nbw < nbytes) {
- fprintf (stderr, "FITSWHEAD: wrote %d / %d bytes of header to file %s\n",
- nbw, nbytes, filename);
- (void)close (fd);
- return (0);
- }
- return (fd);
-}
-
-
-/* FITSWEXHEAD -- Write FITS header in place */
-
-int
-fitswexhead (filename, header)
-
-char *filename; /* Name of FITS image file with ,extension */
-char *header; /* FITS image header */
-
-{
- int fd;
- int nbhead, lhead;
- int nbw, nbnew, nbold;
- char *endhead, *lasthead, *oldheader;
- char *ext, cext;
-
- /* Compare size of existing header to size of new header */
- fitsinherit = 0;
- oldheader = fitsrhead (filename, &lhead, &nbhead);
- if (oldheader == NULL) {
- snprintf (fitserrmsg, 79, "FITSWEXHEAD: file %s cannot be read\n", filename);
- return (-1);
- }
- nbold = fitsheadsize (oldheader);
- nbnew = fitsheadsize (header);
-
- /* Return if the new header is bigger than the old header */
- if (nbnew > nbold) {
- snprintf (fitserrmsg, 79, "FITSWEXHEAD: old header %d bytes, new header %d bytes\n", nbold,nbnew);
- free (oldheader);
- oldheader = NULL;
- return (-1);
- }
-
- /* Add blank lines if new header is smaller than the old header */
- else if (nbnew < nbold) {
- strcpy (oldheader, header);
- endhead = ksearch (oldheader,"END");
- lasthead = oldheader + nbold;
- while (endhead < lasthead)
- *(endhead++) = ' ';
- strncpy (lasthead-80, "END", 3);
- }
-
- /* Pad header with spaces */
- else {
- endhead = ksearch (header,"END") + 80;
- lasthead = header + nbnew;
- while (endhead < lasthead)
- *(endhead++) = ' ';
- strncpy (oldheader, header, nbnew);
- }
-
- /* Check for FITS extension and ignore for file opening */
- ext = strchr (filename, ',');
- if (ext == NULL)
- ext = strchr (filename, '[');
- if (ext != NULL) {
- cext = *ext;
- *ext = (char) 0;
- }
-
- /* Open the output file */
- fd = open (filename, O_WRONLY);
- if (ext != NULL)
- *ext = cext;
- if (fd < 3) {
- snprintf (fitserrmsg, 79, "FITSWEXHEAD: file %s not writeable\n", filename);
- return (-1);
- }
-
- /* Skip to appropriate place in file */
- (void) lseek (fd, ibhead, SEEK_SET);
-
- /* Write header to file */
- nbw = write (fd, oldheader, nbold);
- (void)close (fd);
- free (oldheader);
- oldheader = NULL;
- if (nbw < nbold) {
- fprintf (stderr, "FITSWHEAD: wrote %d / %d bytes of header to file %s\n",
- nbw, nbold, filename);
- return (-1);
- }
- return (0);
-}
-
-
-/* ISFITS -- Return 1 if FITS file, else 0 */
-int
-isfits (filename)
-
-char *filename; /* Name of file for which to find size */
-{
- int diskfile;
- char keyword[16];
- char *comma;
- int nbr;
-
- /* First check to see if this is an assignment */
- if (strchr (filename, '='))
- return (0);
-
- /* Check for stdin (input from pipe) */
- else if (!strcasecmp (filename,"stdin"))
- return (1);
-
- /* Then check file extension
- else if (strsrch (filename, ".fit") ||
- strsrch (filename, ".fits") ||
- strsrch (filename, ".fts"))
- return (1); */
-
- /* If no FITS file extension, try opening the file */
- else {
- if ((comma = strchr (filename,',')))
- *comma = (char) 0;
- if ((diskfile = open (filename, O_RDONLY)) < 0) {
- if (comma)
- *comma = ',';
- return (0);
- }
- else {
- nbr = read (diskfile, keyword, 8);
- if (comma)
- *comma = ',';
- close (diskfile);
- if (nbr < 8)
- return (0);
- else if (!strncmp (keyword, "SIMPLE", 6))
- return (1);
- else
- return (0);
- }
- }
-}
-
-
-/* FITSHEADSIZE -- Find size of FITS header */
-
-int
-fitsheadsize (header)
-
-char *header; /* FITS header */
-{
- char *endhead;
- int nbhead, nblocks;
-
- endhead = ksearch (header,"END") + 80;
- nbhead = endhead - header;
- nblocks = nbhead / FITSBLOCK;
- if (nblocks * FITSBLOCK < nbhead)
- nblocks = nblocks + 1;
- return (nblocks * FITSBLOCK);
-}
-
-
-/* Print error message */
-void
-fitserr ()
-{ fprintf (stderr, "%s\n",fitserrmsg);
- return; }
-
-
-/* MOVEB -- Copy nbytes bytes from source+offs to dest+offd (any data type) */
-
-void
-moveb (source, dest, nbytes, offs, offd)
-
-char *source; /* Pointer to source */
-char *dest; /* Pointer to destination */
-int nbytes; /* Number of bytes to move */
-int offs; /* Offset in bytes in source from which to start copying */
-int offd; /* Offset in bytes in destination to which to start copying */
-{
-char *from, *last, *to;
- from = source + offs;
- to = dest + offd;
- last = from + nbytes;
- while (from < last) *(to++) = *(from++);
- return;
-}
-
-/*
- * Feb 8 1996 New subroutines
- * Apr 10 1996 Add subroutine list at start of file
- * Apr 17 1996 Print error message to stderr
- * May 2 1996 Write using stream IO
- * May 14 1996 If FITSRTOPEN NK is zero, return all keywords in header
- * May 17 1996 Make header internal to FITSRTOPEN
- * Jun 3 1996 Use stream I/O for input as well as output
- * Jun 10 1996 Remove unused variables after running lint
- * Jun 12 1996 Deal with byte-swapped images
- * Jul 11 1996 Rewrite code to separate header and data reading
- * Aug 6 1996 Fixed small defects after lint
- * Aug 6 1996 Drop unused NBHEAD argument from FITSRTHEAD
- * Aug 13 1996 If filename is stdin, read from standard input instead of file
- * Aug 30 1996 Use write for output, not fwrite
- * Sep 4 1996 Fix mode when file is created
- * Oct 15 1996 Drop column argument from FGET* subroutines
- * Oct 15 1996 Drop unused variable
- * Dec 17 1996 Add option to skip bytes in file before reading the header
- * Dec 27 1996 Turn nonprinting header characters into spaces
- *
- * Oct 9 1997 Add FITS extension support as filename,extension
- * Dec 15 1997 Fix minor bugs after lint
- *
- * Feb 23 1998 Do not append primary header if getting header for ext. 0
- * Feb 23 1998 Accept either bracketed or comma extension
- * Feb 24 1998 Add SIMPLE keyword to start of extracted extension
- * Apr 30 1998 Fix error return if not table file after Allan Brighton
- * May 4 1998 Fix error in argument sequence in HGETS call
- * May 27 1998 Include fitsio.h and imio.h
- * Jun 1 1998 Add VMS fixes from Harry Payne at STScI
- * Jun 3 1998 Fix bug reading EXTNAME
- * Jun 11 1998 Initialize all header parameters before reading them
- * Jul 13 1998 Clarify argument definitions
- * Aug 6 1998 Rename fitsio.c to fitsfile.c to avoid conflict with CFITSIO
- * Aug 13 1998 Add FITSWHEAD to write only header
- * Sep 25 1998 Allow STDIN or stdin for standard input reading
- * Oct 5 1998 Add isfits() to decide whether a file is FITS
- * Oct 9 1998 Assume stdin and STDIN to be FITS files in isfits()
- * Nov 30 1998 Fix bug found by Andreas Wicenec when reading large headers
- * Dec 8 1998 Fix bug introduced by previous bug fix
- *
- * Jan 4 1999 Do not print error message if BITPIX is 0
- * Jan 27 1999 Read and write all of 3D images if one dimension is 1
- * Jan 27 1999 Pad out data to integral number of 2880-byte blocks
- * Apr 29 1999 Write BITPIX=-16 files as BITPIX=16 with BSCALE and BZERO
- * Apr 30 1999 Add % as alternative to , to denote sub-images
- * May 25 1999 Set buffer offsets to 0 when FITS table file is opened
- * Jul 14 1999 Do not try to write image data if BITPIX is 0
- * Sep 27 1999 Add STDOUT as output filename option in fitswimage()
- * Oct 6 1999 Set header length global variable hget.lhead0 in fitsrhead()
- * Oct 14 1999 Update header length as it is changed in fitsrhead()
- * Oct 20 1999 Change | in if statements to ||
- * Oct 25 1999 Change most malloc() calls to calloc()
- * Nov 24 1999 Add fitscimage()
- *
- * Feb 23 2000 Fix problem with some error returns in fitscimage()
- * Mar 17 2000 Drop unused variables after lint
- * Jul 20 2000 Drop BITPIX and NAXIS from primary header if extension printerd
- * Jul 20 2000 Start primary part of header with ROOTHEAD keyword
- * Jul 28 2000 Add loop to deal with buffered stdin
- *
- * Jan 11 2001 Print all messages to stderr
- * Jan 12 2001 Add extension back onto filename after fitsropen() (Guy Rixon)
- * Jan 18 2001 Drop EXTEND keyword when extracting an extension
- * Jan 18 2001 Add fitswext() to append HDU and fitswhdu() to do actual writing
- * Jan 22 2001 Ignore WCS name or letter following a : in file name in fitsrhead()
- * Jan 30 2001 Fix FITSCIMAGE so it doesn't overwrite data when overwriting a file
- * Feb 20 2001 Ignore WCS name or letter following a : in file name in fitsropen()
- * Feb 23 2001 Initialize rbrac in fitsropen()
- * Mar 8 2001 Use % instead of : for WCS specification in file name
- * Mar 9 2001 Fix bug so primary header is always appended to secondary header
- * Mar 9 2001 Change NEXTEND to NUMEXT in appended primary header
- * Mar 20 2001 Declare fitsheadsize() in fitschead()
- * Apr 24 2001 When matching column names, use longest length
- * Jun 27 2001 In fitsrthead(), allocate pw and lpnam only if more space needed
- * Aug 24 2001 In isfits(), return 0 if argument contains an equal sign
- *
- * Jan 28 2002 In fitsrhead(), allow stdin to include extension and/or WCS selection
- * Jun 18 2002 Save error messages as fitserrmsg and use fitserr() to print them
- * Oct 21 2002 Add fitsrsect() to read a section of an image
- *
- * Feb 4 2003 Open catalog file rb instead of r (Martin Ploner, Bern)
- * Apr 2 2003 Drop unused variable in fitsrsect()
- * Jul 11 2003 Use strcasecmp() to check for stdout and stdin
- * Aug 1 2003 If no other header, return root header from fitsrhead()
- * Aug 20 2003 Add fitsrfull() to read n-dimensional FITS images
- * Aug 21 2003 Modify fitswimage() to always write n-dimensional FITS images
- * Nov 18 2003 Fix minor bug in fitswhdu()
- * Dec 3 2003 Remove unused variable lasthead in fitswhdu()
- *
- * May 3 2004 Do not always append primary header to extension header
- * May 3 2004 Add ibhead as position of header read in file
- * May 19 2004 Do not reset ext if NULL in fitswexhead()
- * Jul 1 2004 Initialize INHERIT to 1
- * Aug 30 2004 Move fitsheadsize() declaration to fitsfile.h
- * Aug 31 2004 If SIMPLE=F, put whatever is in file after header in image
- *
- * Mar 17 2005 Use unbuffered I/O in isfits() for robustness
- * Jun 27 2005 Drop unused variable nblocks in fitswexhead()
- * Aug 8 2005 Fix space-padding bug in fitswexhead() found by Armin Rest
- * Sep 30 2005 Fix fitsrsect() to position relatively, not absolutely
- * Oct 28 2005 Add error message if desired FITS extension is not found
- * Oct 28 2005 Fix initialization problem found by Sergey Koposov
- *
- * Feb 23 2006 Add fitsrtail() to read appended FITS headers
- * Feb 27 2006 Add file name to header-reading error messages
- * May 3 2006 Remove declarations of unused variables
- * Jun 20 2006 Initialize uninitialized variables
- * Nov 2 2006 Change all realloc() calls to calloc()
- *
- * Jan 5 2007 In fitsrtail(), change control characters in header to spaces
- * Apr 30 2007 Improve error reporting in FITSRFULL
- * Nov 28 2007 Add support to BINTABLE in ftget*() and fitsrthead()
- * Dec 20 2007 Add data heap numerated by PCOUNT when skipping HDU in fitsrhead()
- * Dec 20 2007 Return NULL pointer if fitsrhead() cannot find requested HDU
- *
- * Apr 7 2008 Drop comma from name when reading file in isfits()
- * Jun 27 2008 Do not append primary data header if it is the only header
- * Nov 21 2008 In fitswhead(), print message if too few bytes written
- *
- * Sep 18 2009 In fitswexhead() write to error string instead of stderr
- * Sep 22 2009 In fitsrthead(), fix lengths for ASCII numeric table entries
- * Sep 25 2009 Add subroutine moveb() and fix calls to it
- * Sep 25 2009 Fix several small errors found by Jessicalas Burke
- *
- * Mar 29 2010 In fitswhead(), always pad blocks to 2880 bytes with spaces
- * Mar 31 2010 In fitsrhead(), fix bug reading long primary headers
- *
- * Sep 15 2011 In fitsrsect() declare impos and nblin off_t
- * Sep 15 2011 In fitsrtail() declare offset off_t
- * Sep 15 2011 Declare global variable ibhead off_t
- */
diff --git a/funtools/wcs/fitsfile.h b/funtools/wcs/fitsfile.h
deleted file mode 100644
index c000d18..0000000
--- a/funtools/wcs/fitsfile.h
+++ /dev/null
@@ -1,1286 +0,0 @@
-/*** File fitsfile.h FITS and IRAF file access subroutines
- *** September 25, 2009
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1996-2009
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-#ifndef fitsfile_h_
-#define fitsfile_h_
-#include "fitshead.h"
-
-/* Declarations for subroutines in fitsfile.c, imhfile.c, imio.c,
- * fileutil.c, and dateutil.c */
-
-#define FITSBLOCK 2880
-
-/* FITS table keyword structure */
-struct Keyword {
- char kname[10]; /* Keyword for table entry */
- int lname; /* Length of keyword name */
- int kn; /* Index of entry on line */
- int kf; /* Index in line of first character of entry */
- int kl; /* Length of entry value */
- char kform[8]; /* Format for this value */
-};
-
-/* Structure for access to tokens within a string */
-#define MAXTOKENS 1000 /* Maximum number of tokens to parse */
-#define MAXWHITE 20 /* Maximum number of different whitespace characters */
-struct Tokens {
- char *line; /* Line which has been parsed */
- int lline; /* Number of characters in line */
- int ntok; /* Number of tokens on line */
- int nwhite; /* Number of whitespace characters */
- char white[MAXWHITE]; /* Whitespace (separator) characters */
- char *tok1[MAXTOKENS]; /* Pointers to start of tokens */
- int ltok[MAXTOKENS]; /* Lengths of tokens */
- int itok; /* Current token number */
-};
-
-#ifdef __cplusplus /* C++ prototypes */
-extern "C" {
-#endif
-
-
-#ifdef __STDC__ /* Full ANSI prototypes */
-
-/* Declarations for subroutines in fitsfile.c, imhfile.c, imio.c,
- * fileutil.c, and dateutil.c */
-
-/* FITS file access subroutines in fitsfile.c */
- int fitsropen( /* Open a FITS file for reading, returning a FILE pointer */
- char *inpath); /* Pathname for FITS tables file to read */
- char *fitsrhead( /* Read a FITS header */
- char *filename, /* Name of FITS image file */
- int *lhead, /* Allocated length of FITS header in bytes (returned) */
- int *nbhead); /* Number of bytes before start of data (returned) */
- char *fitsrtail( /* Read FITS header appended to graphics file */
- char *filename, /* Name of FITS image file */
- int *lhead, /* Allocated length of FITS header in bytes (returned) */
- int *nbhead); /* Number of bytes before start of data (returned) */
- char *fitsrimage( /* Read a FITS image */
- char *filename, /* Name of FITS image file */
- int nbhead, /* Actual length of image header(s) in bytes */
- char *header); /* FITS header for image (previously read) */
- char *fitsrfull( /* Read a FITS image of any dimension */
- char *filename, /* Name of FITS image file */
- int nbhead, /* Actual length of image header(s) in bytes */
- char *header); /* FITS header for image (previously read) */
- char *fitsrsect( /* Read a piece of a FITS image, header */
- char *filename, /* Name of FITS image file */
- char *header, /* FITS header for image (previously read) */
- int nbhead, /* Actual length of image header(s) in bytes */
- int x0, /* FITS image X coordinate of first pixel */
- int y0, /* FITS image Y coordinate of first pixel */
- int nx, /* Number of columns to read (less than NAXIS1) */
- int ny, /* Number of rows to read (less than NAXIS2) */
- int nlog); /* Note progress mod this rows */
- int fitswhead( /* Write FITS header; keep file open for further writing */
- char *filename, /* Name of FITS image file */
- char *header); /* FITS header for image (previously read) */
- int fitswexhead( /* Write FITS header in place */
- char *filename, /* Name of FITS image file */
- char *header); /* FITS header for image */
- int fitswext( /* Write FITS header and image as extension to a file */
- char *filename, /* Name of FITS image file */
- char *header, /* FITS image header */
- char *image); /* FITS image pixels */
- int fitswhdu( /* Write FITS head and image as extension */
- int fd, /* File descriptor */
- char *filename, /* Name of FITS image file */
- char *header, /* FITS image header */
- char *image); /* FITS image pixels */
- int fitswimage( /* Write FITS header and image */
- char *filename, /* Name of FITS image file */
- char *header, /* FITS image header */
- char *image); /* FITS image pixels */
- int fitscimage( /* Write FITS header and copy FITS image */
- char *filename, /* Name of output FITS image file */
- char *header, /* FITS image header */
- char *filename0); /* Name of input FITS image file */
- int isfits( /* Return 1 if file is a FITS file */
- char *filename); /* Name of file to check */
- void fitserr(); /* Print FITS error message to stderr */
- void setfitsinherit( /* Set flag to append primary data header */
- int inh); /* 1 to inherit primary data header, else 0 */
- int fitsheadsize( /* Return size of fitsheader in bytes */
- char *header); /* FITS image header */
-
-/* FITS table file access subroutines in fitsfile.c */
-
- int fitsrtopen( /* Open FITS table file and fill structure with
- * pointers to selected keywords
- * Return file descriptor (-1 if unsuccessful) */
- char *inpath, /* Pathname for FITS tables file to read */
- int *nk, /* Number of keywords to use */
- struct Keyword **kw, /* Structure for desired entries */
- int *nrows, /* Number of rows in table (returned) */
- int *nchar, /* Number of characters in one table row (returned) */
- int *nbhead); /* Number of characters before table starts */
- int fitsrthead( /* Read pointers to selected keywords
- * from FITS table header */
- char *header, /* Header for FITS tables file */
- int *nk, /* Number of keywords to use */
- struct Keyword **kw, /* Structure for desired entries */
- int *nrows, /* Number of rows in table (returned) */
- int *nchar); /* Number of characters in one table row (returned) */
- void fitsrtlset(void); /* Reset FITS Table buffer limits from start of data */
- int fitsrtline( /* Return specified line of FITS table */
- int fd, /* File descriptor for FITS file */
- int nbhead, /* Number of bytes in FITS header */
- int lbuff, /* Number of bytes in table buffer */
- char *tbuff, /* FITS table buffer */
- int irow, /* Number of table row to read */
- int nbline, /* Number of bytes to read for this line */
- char *line); /* One line of FITS table (returned) */
-short ftgeti2( /* Extract column for keyword from FITS table line
- * as short */
- char *entry, /* Row or entry from table */
- struct Keyword *kw); /* Table column information from FITS header */
- int ftgeti4( /* Extract column for keyword from FITS table line
- * as int */
- char *entry, /* Row or entry from table */
- struct Keyword *kw); /* Table column information from FITS header */
-float ftgetr4( /* Extract column for keyword from FITS table line
- * as float */
- char *entry, /* Row or entry from table */
- struct Keyword *kw); /* Table column information from FITS header */
- double ftgetr8( /* Extract column for keyword from FITS table line
- * as double */
- char *entry, /* Row or entry from table */
- struct Keyword *kw); /* Table column information from FITS header */
- int ftgetc( /* Extract column for keyword from FITS table line
- * as char string */
- char *entry, /* Row or entry from table */
- struct Keyword *kw, /* Table column information from FITS header */
- char *string, /* Returned string */
- int maxchar); /* Maximum number of characters in returned string */
-
- void moveb ( /* Copy nbytes bytes from source+offs to dest+offd */
- char *source, /* Pointer to source */
- char *dest, /* Pointer to destination */
- int nbytes, /* Number of bytes to move */
- int offs, /* Offset in bytes in source from which to start copying */
- int offd); /* Offset in bytes in destination to which to start copying */
-
-
-/* IRAF file access subroutines in imhfile.c */
-
- char *irafrhead( /* Read IRAF .imh header file and translate to FITS header */
- char *filename, /* Name of IRAF header file */
- int *lihead); /* Length of IRAF image header in bytes (returned) */
- char *irafrimage( /* Read IRAF image pixels (call after irafrhead) */
- char *fitsheader); /* FITS image header (filled) */
- int irafwhead( /* Write IRAF .imh header file */
- char *hdrname, /* Name of IRAF header file */
- int lhead, /* Length of IRAF header */
- char *irafheader, /* IRAF header */
- char *fitsheader); /* FITS image header */
- int irafwimage( /* Write IRAF .imh header file and .pix image file */
- char *hdrname, /* Name of IRAF header file */
- int lhead, /* Length of IRAF header */
- char *irafheader, /* IRAF header */
- char *fitsheader, /* FITS image header */
- char *image); /* IRAF image */
- int isiraf( /* return 1 if IRAF imh file, else 0 */
- char *filename); /* Name of file to check */
- char *iraf2fits( /* Convert IRAF image header to FITS image header,
- * returning FITS header */
- char *hdrname, /* IRAF header file name (may be path) */
- char *irafheader, /* IRAF image header */
- int nbiraf, /* Number of bytes in IRAF header */
- int *nbfits); /* Number of bytes in FITS header (returned) */
-
- char *fits2iraf( /* Convert FITS image header to IRAF image header,
- * returning IRAF header */
- char *fitsheader, /* FITS image header */
- char *irafheader, /* IRAF image header (returned updated) */
- int nbhead, /* Length of IRAF header */
- int *nbiraf); /* Length of returned IRAF header */
-
-/* Image pixel access subroutines in imio.c */
-
- double getpix( /* Read one pixel from any data type 2-D array (0,0)*/
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel
- * 16 = short, -16 = unsigned short, 32 = int
- * -32 = float, -64 = double */
- int w, /* Image width in pixels */
- int h, /* Image height in pixels */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int x, /* Zero-based horizontal pixel number */
- int y); /* Zero-based vertical pixel number */
- double getpix1( /* Read one pixel from any data type 2-D array (1,1)*/
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- int w, /* Image width in pixels */
- int h, /* Image height in pixels */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int x, /* One-based horizontal pixel number */
- int y); /* One-based vertical pixel number */
- double maxvec( /* Get maximum value in vector from a image */
- char *image, /* Image array from which to extract vector */
- int bitpix, /* Number of bits per pixel in image */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Offset of first pixel to extract */
- int npix); /* Number of pixels to extract */
- double minvec( /* Get minimum value in vector from a image */
- char *image, /* Image array from which to extract vector */
- int bitpix, /* Number of bits per pixel in image */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Offset of first pixel to extract */
- int npix); /* Number of pixels to extract */
- void putpix( /* Write one pixel to any data type 2-D array (0,0)*/
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- int w, /* Image width in pixels */
- int h, /* Image height in pixels */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int x, /* Zero-based horizontal pixel number */
- int y, /* Zero-based vertical pixel number */
- double dpix); /* Value to put into image pixel */
- void putpix1( /* Write one pixel to any data type 2-D array (1,1) */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- int w, /* Image width in pixels */
- int h, /* Image height in pixels */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int x, /* One-based horizontal pixel number */
- int y, /* One-based vertical pixel number */
- double dpix); /* Value to put into image pixel */
- void addpix( /* Add to one pixel in any data type 2-D array (0,0)*/
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- int w, /* Image width in pixels */
- int h, /* Image height in pixels */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int x, /* Zero-based horizontal pixel number */
- int y, /* Zero-based vertical pixel number */
- double dpix); /* Value to add to image pixel */
- void addpix1( /* Add to one pixel in any data type 2-D array (1,1)*/
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- int w, /* Image width in pixels */
- int h, /* Image height in pixels */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int x, /* One-based horizontal pixel number */
- int y, /* One-based vertical pixel number */
- double dpix); /* Value to add to image pixel */
- void movepix( /* Move one pixel value between two 2-D arrays (0,0) */
- char *image1, /* Pointer to first pixel in input image */
- int bitpix1, /* Bits per input pixel (FITS codes) */
- int w1, /* Number of horizontal pixels in input image */
- int x1, /* Zero-based row for input pixel */
- int y1, /* Zero-based column for input pixel */
- char *image2, /* Pointer to first pixel in output image */
- int bitpix2, /* Bits per output pixel (FITS codes) */
- int w2, /* Number of horizontal pixels in output image */
- int x2, /* Zero-based row for output pixel */
- int y2); /* Zero-based column for output pixel */
- void movepix1( /* Move one pixel value between two 2-D arrays (1,1) */
- char *image1, /* Pointer to first pixel in input image */
- int bitpix1, /* Bits per input pixel (FITS codes) */
- int w1, /* Number of horizontal pixels in input image */
- int x1, /* One-based row for input pixel */
- int y1, /* One-based column for input pixel */
- char *image2, /* Pointer to first pixel in output image */
- int bitpix2, /* Bits per output pixel (FITS codes) */
- int w2, /* Number of horizontal pixels in output image */
- int x2, /* One-based row for output pixel */
- int y2); /* One-based column for output pixel */
-
-/* Image vector processing subroutines in imio.c */
-
- void addvec( /* Add constant to vector from 2-D array */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Offset of first pixel to which to add */
- int npix, /* Number of pixels to which to add */
- double dpix); /* Value to add to pixels */
- void multvec( /* Multiply vector from 2-D array by a constant */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Offset of first pixel to multiply */
- int npix, /* Number of pixels to multiply */
- double dpix); /* Value to add to pixels */
- void getvec( /* Read vector from 2-D array */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Offset of first pixel to extract */
- int npix, /* Number of pixels to extract */
- double *dvec0); /* Vector of pixels (returned) */
- void putvec( /* Write vector into 2-D array */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Offset of first pixel to insert */
- int npix, /* Number of pixels to insert */
- double *dvec0); /* Vector of pixels to insert */
- void fillvec( /* Write constant into a vector */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* Zero-based offset of first pixel to multiply */
- int npix, /* Number of pixels to multiply */
- double dpix); /* Value to which to set pixels */
- void fillvec1( /* Write constant into a vector */
- char *image, /* Image array as 1-D vector */
- int bitpix, /* FITS bits per pixel */
- double bzero, /* Zero point for pixel scaling */
- double bscale, /* Scale factor for pixel scaling */
- int pix1, /* One-based offset of first pixel to multiply */
- int npix, /* Number of pixels to multiply */
- double dpix); /* Value to which to set pixels */
-
-/* Image pixel byte-swapping subroutines in imio.c */
-
- void imswap( /* Swap alternating bytes in a vector */
- int bitpix, /* Number of bits per pixel */
- char *string, /* Address of starting point of bytes to swap */
- int nbytes); /* Number of bytes to swap */
- void imswap2( /* Swap bytes in a vector of 2-byte (short) integers */
- char *string, /* Address of starting point of bytes to swap */
- int nbytes); /* Number of bytes to swap */
- void imswap4( /* Reverse bytes in a vector of 4-byte numbers */
- char *string, /* Address of starting point of bytes to swap */
- int nbytes); /* Number of bytes to swap */
- void imswap8( /* Reverse bytes in a vector of 8-byte numbers */
- char *string, /* Address of starting point of bytes to swap */
- int nbytes); /* Number of bytes to swap */
- int imswapped(void); /* Return 1 if machine byte order is not FITS order */
-
-/* File utilities from fileutil.c */
-
- int getfilelines( /* Return number of lines in an ASCII file */
- char *filename); /* Name of file to check */
- char *getfilebuff( /* Return entire file contents in a character string */
- char *filename); /* Name of file to read */
- int getfilesize( /* Return size of a binary or ASCII file */
- char *filename); /* Name of file to check */
- int isimlist( /* Return 1 if file is list of FITS or IRAF image files, else 0 */
- char *filename); /* Name of file to check */
- int isimlistd( /* Return 1 if file is list of FITS or IRAF image files, else 0 */
- char *filename, /* Name of file to check */
- char *rootdir); /* Name of root directory for files in list */
- int isfilelist( /* Return 1 if list of readable files, else 0 */
- char *filename, /* Name of file to check */
- char *rootdir); /* Name of root directory for files in list */
- int isfile( /* Return 1 if file is a readable file, else 0 */
- char *filename); /* Name of file to check */
- int istiff( /* Return 1 if TIFF image file, else 0 */
- char *filename); /* Name of file to check */
- int isjpeg( /* Return 1 if JPEG image file, else 0 */
- char *filename); /* Name of file to check */
- int isgif( /* Return 1 if GIF image file, else 0 */
- char *filename); /* Name of file to check */
- int first_token( /* Return first token from the next line of an ASCII file */
- FILE *diskfile, /* File descriptor for ASCII file */
- int ncmax, /* Maximum number of characters returned */
- char *token); /* First token on next line (returned) */
- int stc2s ( /* Replace character in string with space */
- char *spchar, /* Character to replace with spaces */
- char *string); /* Character string to process */
- int sts2c ( /* Replace spaces in string with character */
- char *spchar, /* Character with which to replace spaces */
- char *string); /* Character string to process */
-
-/* Subroutines for access to tokens within a string from fileutil.c */
- int setoken( /* Tokenize a string for easy decoding */
- struct Tokens *tokens, /* Token structure returned */
- char *string, /* character string to tokenize */
- char *cwhite); /* additional whitespace characters
- * if = tab, disallow spaces and commas */
- int nextoken( /* Get next token from tokenized string */
- struct Tokens *tokens, /* Token structure returned */
- char *token, /* token (returned) */
- int maxchars); /* Maximum length of token */
- int getoken( /* Get specified token from tokenized string */
- struct Tokens *tokens, /* Token structure returned */
- int itok, /* token sequence number of token
- * if <0, get whole string after token -itok
- * if =0, get whole string */
- char *token, /* token (returned) */
- int maxchars); /* Maximum length of token */
-
-/* Subroutines for translating dates and times in dateutil.c */
-
- /* Subroutines to convert between floating point and vigesimal angles */
-
- void ang2hr ( /* Fractional degrees to hours as hh:mm:ss.ss */
- double angle, /* Angle in fractional degrees */
- int lstr, /* Maximum number of characters in string */
- char *string); /* Character string (hh:mm:ss.ss returned) */
- void ang2deg ( /* Fractional degrees to degrees as dd:mm:ss.ss */
- double angle, /* Angle in fractional degrees */
- int lstr, /* Maximum number of characters in string */
- char *string); /* Character string (dd:mm:ss.ss returned) */
- double deg2ang ( /* Degrees as dd:mm:ss.ss to fractional degrees */
- char *angle); /* Angle as dd:mm:ss.ss */
- double hr2ang ( /* Hours as hh:mm:ss.ss to fractional degrees */
- char *angle); /* Angle in sexigesimal hours (hh:mm:ss.sss) */
-
- /* Subroutines to convert from year and day of year */
-
- void doy2dt( /* Year and day of year to yyyy.mmdd hh.mmss */
- int year, /* Year */
- double doy, /* Day of year with fraction */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
- double doy2ep( /* Year and day of year to fractional year (epoch) */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- double doy2epb( /* year and day of year to Besselian epoch */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- double doy2epj( /* year and day of year to Julian epoch */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- char *doy2fd( /* year and day of year to FITS date */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- double doy2jd( /* year and day of year to Julian Day */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- double doy2mjd( /* year and day of year to Modified Julian Day */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- double doy2ts( /* year and day of year to seconds since 1950.0 */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- int doy2tsi( /* year and day of year to IRAF seconds since 1980-01-01 */
- int year, /* Year */
- double doy); /* Day of year with fraction */
- time_t doy2tsu( /* year and day of year to Unix seconds since 1970-01-01 */
- int year, /* Year */
- double doy); /* Day of year with fraction */
-
- /* Subroutines to convert from date and time */
-
- void dt2doy( /* yyyy.mmdd hh.mmss to year and day of year */
- double date, /* Date as yyyy.mmdd
- * yyyy = calendar year (e.g. 1973)
- * mm = calendar month (e.g. 04 = april)
- * dd = calendar day (e.g. 15) */
- double time, /* Time as hh.mmssxxxx
- * if time<0, it is time as -(fraction of a day)
- * hh = hour of day (0 .le. hh .le. 23)
- * nn = minutes (0 .le. nn .le. 59)
- * ss = seconds (0 .le. ss .le. 59)
- * xxxx = tenths of milliseconds (0 .le. xxxx .le. 9999) */
- int *year, /* Year (returned) */
- double *doy); /* Day of year with fraction (returned) */
- double dt2ep( /* yyyy.ddmm and hh.mmsss to fractional year (epoch) */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- double dt2epb( /* yyyy.ddmm and hh.mmsss to Besselian epoch */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- double dt2epj( /* yyyy.ddmm and hh.mmsss to Julian epoch */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- char *dt2fd( /* yyyy.ddmm and hh.mmsss to FITS date string */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- void dt2i( /* yyyy.ddmm and hh.mmsss to year, month, day, hrs, min, sec */
- double date, /* Date as yyyy.mmdd */
- double time, /* Time as hh.mmssxxxx */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- double dt2jd( /* yyyy.ddmm and hh.mmsss to Julian Day */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- double dt2mjd( /* yyyy.ddmm and hh.mmsss to Modified Julian Day */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- double dt2ts( /* yyyy.ddmm and hh.mmsss to seconds since 1950.0 */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- int dt2tsi( /* yyyy.ddmm and hh.mmsss to IRAF seconds since 1980-01-01 */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
- time_t dt2tsu( /* yyyy.ddmm and hh.mmsss to Unix seconds since 1970-01-01 */
- double date, /* Date as yyyy.mmdd */
- double time); /* Time as hh.mmssxxxx */
-
- /* Subroutines to convert from epoch (various types of fractional year) */
-
- void ep2dt( /* Fractional year to yyyy.mmdd hh.mmssss */
- double epoch, /* Date as fractional year */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
- void epb2dt( /* Besselian epoch to yyyy.mmdd hh.mmssss */
- double epoch, /* Besselian epoch (fractional 365.242198781-day years) */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
- void epj2dt( /* Julian epoch to yyyy.mmdd hh.mmssss */
- double epoch, /* Julian epoch (fractional 365.25-day years) */
- double *date, /* Date as yyyy.mmdd (returned)*/
- double *time); /* Time as hh.mmssxxxx (returned) */
- char *ep2fd( /* Fractional year to FITS date string yyyy-mm-ddThh:mm:ss.ss */
- double epoch); /* Date as fractional year */
- char *epb2fd( /* Besselian epoch to FITS date string yyyy-mm-ddThh:mm:ss.ss */
- double epoch); /* Besselian epoch (fractional 365.242198781-day years) */
- char *epj2fd( /* Julian epoch to FITS date string yyyy-mm-ddThh:mm:ss.ss */
- double epoch); /* Julian epoch (fractional 365.25-day years) */
- void ep2i( /* Fractional year to year, month, day, hours, min., sec. */
- double epoch, /* Date as fractional year */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- void epb2i( /* Besselian epoch to year, month, day, hours, min., sec. */
- double epoch, /* Besselian epoch (fractional 365.242198781-day years) */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- void epj2i( /* Julian epoch to year, month, day, hours, min., sec. */
- double epoch, /* Julian epoch (fractional 365.25-day years) */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- double ep2jd( /* Fractional year to Julian Date */
- double epoch); /* Date as fractional year */
- double epb2jd( /* Besselian epoch to Julian Date */
- double epoch); /* Besselian epoch (fractional 365.242198781-day years) */
- double epj2jd( /* Julian epoch to Julian Date */
- double epoch); /* Julian epoch (fractional 365.25-day years) */
- double ep2mjd( /* Fractional year to Modified Julian Date */
- double epoch); /* Date as fractional year */
- double epb2mjd( /* Besselian epoch to Modified Julian Date */
- double epoch); /* Besselian epoch (fractional 365.242198781-day years) */
- double epj2mjd( /* Julian epoch to Modified Julian Date */
- double epoch); /* Julian epoch (fractional 365.25-day years) */
- double ep2epb( /* Fractional year to Besselian epoch */
- double epoch); /* Date as fractional year */
- double ep2epj( /* Fractional year to Julian epoch */
- double epoch); /* Date as fractional year */
- double epb2epj( /* Besselian epoch to Julian epoch */
- double epoch); /* Besselian epoch (fractional 365.242198781-day years) */
- double epj2epb( /* Julian epoch to Besselian epoch */
- double epoch); /* Julian epoch (fractional 365.25-day years) */
- double epb2ep( /* Besselian epoch to fractional year */
- double epoch); /* Besselian epoch (fractional 365.242198781-day years) */
- double epj2ep( /* Julian epoch to fractional year */
- double epoch); /* Julian epoch (fractional 365.25-day years) */
- double ep2ts( /* Fractional year to seconds since 1950.0 */
- double epoch); /* Date as fractional year */
- double epb2ts( /* Besselian epoch to seconds since 1950.0 */
- double epoch); /* Besselian epoch (fractional 365.242198781-day years) */
- double epj2ts( /* Julian epoch to seconds since 1950.0 */
- double epoch); /* Julian epoch (fractional 365.25-day years) */
-
- /* Convert from FITS standard date string */
-
- void fd2dt( /* FITS standard date string to date and time */
- char *string, /* FITS date string, which may be:
- * fractional year
- * dd/mm/yy (FITS standard before 2000)
- * dd-mm-yy (nonstandard use before 2000)
- * yyyy-mm-dd (FITS standard after 1999)
- * yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
- double *date, /* Date as yyyy.mmdd (returned)*/
- double *time); /* Time as hh.mmssxxxx (returned) */
- void fd2doy( /* FITS standard date string to year, day of year */
- char *string, /* FITS date string */
- int *year, /* Year (returned) */
- double *doy); /* Day of year with fraction (returned) */
- double fd2ep( /* FITS standard date string to fractional year (epoch) */
- char *string); /* FITS date string */
- double fd2epb( /* FITS standard date string to Besselian epoch */
- char *string); /* FITS date string */
- double fd2epj( /* FITS standard date string to Julian epoch */
- char *string); /* FITS date string */
- char *fd2fd( /* Any FITS standard date string to ISO FITS date string */
- char *string); /* FITS date string */
- char *fd2of( /* Any FITS standard date string to old FITS date and time */
- char *string); /* FITS date string */
- char *fd2ofd( /* Any FITS standard date string to old FITS date string */
- char *string); /* FITS date string */
- char *fd2oft( /* Any FITS standard date string to old FITS time string */
- char *string); /* FITS date string */
- void fd2i( /* FITS standard date string to year, mon, day, hrs, min, sec */
- char *string, /* FITS date string */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- double fd2jd( /* FITS standard date string to Julian Day */
- char *string); /* FITS date string */
- double fd2mjd( /* FITS standard date string to Modified Julian Day */
- char *string); /* FITS date string */
- double fd2ts( /* FITS standard date to seconds since 1950-01-01 */
- char *string); /* FITS date string */
- int fd2tsi( /* FITS standard date to IRAF seconds since 1980-01-01 */
- char *string); /* FITS date string */
- time_t fd2tsu( /* FITS standard date to Unix seconds since 1970-01-01 */
- char *string); /* FITS date string */
-
- /* Convert from Julian Day */
-
- void jd2doy( /* Julian Day to year and day of year */
- double dj, /* Julian Day */
- int *year, /* Year (returned) */
- double *doy); /* Day of year with fraction (returned) */
- void jd2dt( /* Julian Day to yyyy.mmdd hh.mmssss */
- double dj, /* Julian Day */
- double *date, /* Date as yyyy.mmdd (returned)*/
- double *time); /* Time as hh.mmssxxxx (returned) */
- double jd2ep( /* Julian Day to fractional year */
- double dj); /* Julian Day */
- double jd2epb( /* Julian Day to Besselian epoch */
- double dj); /* Julian Day */
- double jd2epj( /* Julian Day to Julian epoch */
- double dj); /* Julian Day */
- char *jd2fd( /* Julian Day to FITS date string yyyy-mm-ddThh:mm:ss.ss */
- double dj); /* Julian Day */
- void jd2i( /* Julian Day to year, month, day, hours, min., sec. */
- double dj, /* Julian Day */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- double jd2mjd( /* Julian Day to Modified Julian day */
- double dj); /* Julian Day */
- double jd2ts( /* Julian Day to seconds since 1950.0 */
- double dj); /* Julian Day */
- time_t jd2tsu( /* Julian Day to Unix seconds since 1970-01-01T00:00 */
- double dj); /* Julian Day */
- int jd2tsi( /* Julian Day to IRAF seconds since 1980-01-01T00:00 */
- double dj); /* Julian Day */
-
- /* Convert current local time to various formats */
-
- void lt2dt( /* Current local time to date (yyyy.mmdd), time (hh.mmsss) */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
- char *lt2fd(void); /* Current local time to FITS ISO date string */
- int lt2tsi(void); /* Current local time to IRAF seconds since 1980-01-01T00:00 */
- time_t lt2tsu(void); /* Current local time to Unix seconds since 1970-01-01T00:00 */
- double lt2ts(void); /* Current local time to IRAF seconds since 1950-01-01T00:00 */
-
- /* Convert from Modified Julian Day (JD - 2400000.5) */
-
- void mjd2doy( /* Modified Julian Day to year and day of year */
- double dj, /* Modified Julian Day */
- int *year, /* Year (returned) */
- double *doy); /* Day of year with fraction (returned) */
- void mjd2dt( /* Modified Julian Day to yyyy.mmdd hh.mmssss */
- double dj, /* Modified Julian Date */
- double *date, /* Date as yyyy.mmdd (returned)*/
- double *time); /* Time as hh.mmssxxxx (returned) */
- double mjd2ep( /* Modified Julian Day to fractional year */
- double dj); /* Modified Julian Date */
- double mjd2epb( /* Modified Julian Day to Besselian epoch */
- double dj); /* Modified Julian Date */
- double mjd2epj( /* Modified Julian Day to Julian epoch */
- double dj); /* Modified Julian Date */
- char *mjd2fd( /* Modified Julian Day to FITS date yyyy-mm-ddThh:mm:ss.ss */
- double dj); /* Modified Julian Date */
- void mjd2i( /* Modified Julian Day to year, month, day, hours, min, sec */
- double dj, /* Modified Julian Date */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- double mjd2jd( /* Modified Julian Day to Julian day */
- double dj); /* Modified Julian Date */
- double mjd2ts( /* Modified Julian Day to seconds since 1950.0 */
- double dj); /* Modified Julian Date */
-
- /* Convert from seconds since 1950-01-01 0:00 (JPL Ephemeris time) */
-
- void ts2dt( /* Seconds since 1950.0 to yyyy.mmdd hh.mmssss */
- double tsec, /* seconds since 1950.0 */
- double *date, /* Date as yyyy.mmdd (returned)*/
- double *time); /* Time as hh.mmssxxxx (returned) */
- double ts2ep( /* Seconds since 1950.0 to fractional year */
- double tsec); /* seconds since 1950.0 */
- double ts2epb( /* Seconds since 1950.0 to Besselian epoch */
- double tsec); /* seconds since 1950.0 */
- double ts2epj( /* Seconds since 1950.0 to Julian epoch */
- double tsec); /* seconds since 1950.0 */
- char *ts2fd( /* Seconds since 1950.0 to FITS date, yyyy-mm-ddT00:00:00.000 */
- double tsec); /* seconds since 1950.0 */
- void ts2i( /* Seconds since 1950.0 to year, month, day, hours, min, sec */
- double tsec, /* seconds since 1950.0 */
- int *iyr, /* year (returned) */
- int *imon, /* month (returned) */
- int *iday, /* day (returned) */
- int *ihr, /* hours (returned) */
- int *imn, /* minutes (returned) */
- double *sec, /* seconds (returned) */
- int ndsec); /* Number of decimal places in seconds (0=int) */
- double ts2jd( /* Seconds since 1950.0 to Julian Day */
- double tsec); /* seconds since 1950.0 */
- double ts2mjd( /* Seconds since 1950.0 to Modified Julian Day */
- double tsec); /* seconds since 1950.0 */
-
- /* Convert from IRAF time (seconds since 1980-01-01 0:00 UT) */
-
- char *tsi2fd( /* Seconds since 1980-01-01 to FITS standard date string */
- int isec); /* Seconds past 1980-01-01 */
- double tsi2ts( /* Seconds since 1980-01-01 to seconds since 1950-01-01 */
- int isec); /* Seconds past 1980-01-01 */
- void tsi2dt( /* Seconds since 1980-01-01 to date yyyy.mmdd, time hh.mmssss */
- int isec, /* Seconds past 1980-01-01 */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
-
- /* Convert from Unix time (seconds since 1970-01-01 0:00 UT) */
-
- void tsu2dt( /* Seconds since 1970-01-01 to date yyyy.ddmm, time hh.mmsss */
- time_t isec, /* Seconds past 1970-01-01 */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
- char *tsu2fd( /* Seconds since 1970-01-01 to FITS standard date string */
- time_t isec); /* Seconds past 1970-01-01 */
- double tsu2ts( /* Seconds since 1970-01-01 to seconds since 1950-01-01 */
- time_t isec); /* Seconds past 1970-01-01 */
- int tsu2tsi( /* Seconds since 1970-01-01 to local seconds since 1980-01-01 */
- time_t isec); /* Seconds past 1970-01-01 */
-
- /* Convert times within a day */
-
- char *tsd2fd( /* Seconds since start of day to FITS standard time string */
- double tsec); /* Seconds since start of day */
- double tsd2dt( /* Seconds since start of day to hh.mmsssss */
- double tsec); /* Seconds since start of day */
-
- /* Convert from current Universal Time */
-
- void ut2dt( /* Current Universal Time to date (yyyy.mmdd), time (hh.mmsss) */
- double *date, /* Date as yyyy.mmdd (returned) */
- double *time); /* Time as hh.mmssxxxx (returned) */
- void ut2doy( /* Current Universal Time to year, day of year */
- int *year, /* Year (returned) */
- double *doy); /* Day of year (returned) */
- double ut2ep(void); /* Current Universal Time to fractional year */
- double ut2epb(void); /* Current Universal Time to Besselian Epoch */
- double ut2epj(void); /* Current Universal Time to Julian Epoch */
- char *ut2fd(void); /* Current Universal Time to FITS ISO date string */
- double ut2jd(void); /* Current Universal Time to Julian Date */
- double ut2mjd(void); /* Current Universal Time to Modified Julian Date */
- int ut2tsi(void); /* Current UT to IRAF seconds since 1980-01-01T00:00 */
- time_t ut2tsu(void); /* Current UT to Unix seconds since 1970-01-01T00:00 */
- double ut2ts(void); /* Current UT to seconds since 1950-01-01T00:00 */
-
- int isdate( /* Return 1 if string is FITS old or ISO date */
- char *string); /* Possible FITS date string, which may be:
- * dd/mm/yy (FITS standard before 2000)
- * dd-mm-yy (nonstandard FITS use before 2000)
- * yyyy-mm-dd (FITS standard after 1999)
- * yyyy-mm-ddThh:mm:ss.ss (FITS standard after 1999) */
-
- /* Ephemeris time conversions (ET, TT, and TDT) */
-
- char *et2fd( /* ET (or TDT or TT) in FITS format to UT in FITS format */
- char *string); /* Ephemeris Time as FITS date string (E not T) */
- char *fd2et( /* UT in FITS format to ET (or TDT or TT) in FITS format */
- char *string); /* FITS date string */
- void dt2et( /* yyyy.ddmm and hh.mmsss to Ephemeris Time */
- double *date, /* Date as yyyy.mmdd */
- double *time); /* Time as hh.mmssxxxx
- *if time<0, it is time as -(fraction of a day) */
- double jd2jed( /* Convert from Julian Date to Julian Ephemeris Date */
- double dj); /* Julian Date */
- double jed2jd( /* Convert from Julian Ephemeris Date to Julian Date */
- double dj); /* Julian Ephemeris Date */
- double ets2ts( /* ET in seconds since 1950-01-01 to UT in same format */
- double tsec); /* ET in seconds since 1950-01-01 */
- double ts2ets( /* UT in seconds since 1950-01-01 to ET in same format */
- double tsec); /* UT in seconds since 1950-01-01 */
- void edt2dt( /* yyyy.ddmm and hh.mmsss Ephemeris Time to UT */
- double *date, /* Date as yyyy.mmdd */
- double *time); /* Time as hh.mmssxxxx
- * If time<0, it is time as -(fraction of a day) */
- double utdt( /* Compute difference between UT and dynamical time (ET-UT) */
- double dj); /* Julian Date (UT) */
-
- /* Sidereal Time conversions */
-
- char *fd2gst( /* Convert from FITS UT date to Greenwich Sidereal Time */
- char *string); /* FITS date string */
- void dt2gst( /* Convert from UT as yyyy.mmdd hh.mmssss to Greenwich Sidereal Time */
- double *date, /* Date as yyyy.mmdd */
- double *time); /* Time as hh.mmssxxxx
- * If time<0, it is time as -(fraction of a day) */
- double jd2gst( /* Calculate Greenwich Sidereal Time given Julian Date */
- double dj); /* Julian Date (UT) */
- double ts2gst( /* Calculate Greenwich Sidereal Time given Universal Time */
- double tsec); /* Time since 1950.0 in UT seconds */
- char *fd2lst( /* Convert from FITS UT date to Local Sidereal Time */
- char *string); /* FITS date string */
- void dt2lst( /* Convert from UT as yyyy.mmdd hh.mmssss to Local Sidereal Time */
- double *date, /* Date as yyyy.mmdd */
- double *time); /* Time as hh.mmssxxxx
- * If time<0, it is time as -(fraction of a day) */
- double ts2lst( /* Calculate Local Sidereal Time given Universal Time */
- double tsec); /* Time since 1950.0 in UT seconds */
- double jd2lst( /* Calculate Local Sidereal Time given Julian Date */
- double dj); /* Julian Date (UT) */
- double eqeqnx( /* Compute equation of eqinoxes from Julian Date */
- double dj); /* Julian Date (UT) */
- char *fd2mst( /* Convert from FITS UT date to Mean Sidereal Time */
- char *string); /* FITS date string */
- double jd2mst( /* Convert from Julian Date to Mean Sidereal Time */
- double dj); /* Julian Date (UT) */
- double jd2mst2( /* Convert from Julian Date to Mean Sidereal Time */
- double dj); /* Julian Date (UT) */
- void dt2mst( /* Convert from UT as yyyy.mmdd hh.mmssss to Mean Sidereal Time */
- double *date, /* Date as yyyy.mmdd */
- double *time); /* Time as hh.mmssxxxx
- * If time<0, it is time as -(fraction of a day) */
- double lst2dt( /* Calculate UT as hh.mmsss given UT date and
- * Local Sidereal Time */
- double date0, /* UT date as yyyy.mmdd */
- double time0); /* LST as hh.mmssss */
- double lst2jd( /* Calculate UT as Julian Date given UT date and
- * Local Sidereal Time */
- double sdj); /* Julian Date of desired day at 0:00 UT + sidereal time */
- char *lst2fd( /* Calculate FITS UT date and time given UT date and
- * Local Sidereal Time */
- char *string); /* UT Date, LST as yyyy-mm-ddShh:mm:ss.ss */
- char *gst2fd( /* Calculate FITS UT date and time given Greenwich Sidereal Time */
- char *string); /* UT Date, GST as yyyy-mm-ddShh:mm:ss.ss */
- double gst2jd( /* Calculate FITS UT Julian Date given Greenwich Sidereal Time */
- double sdj); /* UT Date, GST as Julian Date */
- char *mst2fd( /* Calculate FITS UT date and time given Mean Sidereal Time */
- char *string); /* UT Date, MST as yyyy-mm-ddShh:mm:ss.ss */
- double mst2jd( /* Calculate FITS UT Julian Date given Mean Sidereal Time */
- double sdj); /* UT Date, MST as Julian Date */
- double ts2mst( /* Calculate Mean Sidereal Time given Universal Time */
- double tsec); /* time since 1950.0 in UT seconds */
- void setlongitude( /* Longitude for sidereal time in or out */
- double longitude); /* longitude of observatory in degrees (+=west) */
- void compnut( /* Compute nutation in longitude and obliquity and mean obliquity*/
- double dj, /* TDB (loosely ET or TT) as Julian Date */
- double *dpsi, /* Nutation in longitude in radians (returned) */
- double *deps, /* Nutation in obliquity in radians (returned) */
- double *eps0); /* Mean obliquity in radians (returned) */
-
- /* Heliocentric Julian Date conversions */
-
- double mjd2mhjd( /* Convert from Modified Julian Date to Heliocentric MJD */
- double mjd, /* Julian date (geocentric) */
- double ra, /* Right ascension (degrees) */
- double dec, /* Declination (degrees) */
- int sys); /* J2000, B1950, GALACTIC, ECLIPTIC */
- double mjd2hjd( /* Convert from Modified Julian Date to Heliocentric JD */
- double mjd, /* Julian date (geocentric) */
- double ra, /* Right ascension (degrees) */
- double dec, /* Declination (degrees) */
- int sys); /* J2000, B1950, GALACTIC, ECLIPTIC */
- double mhjd2mjd( /* Convert from Heliocentric Modified Julian Date to MJD */
- double mhjd, /* Modified Heliocentric Julian date */
- double ra, /* Right ascension (degrees) */
- double dec, /* Declination (degrees) */
- int sys); /* J2000, B1950, GALACTIC, ECLIPTIC */
- double jd2hjd( /* Convert from Julian Date to Heliocentric Julian Date */
- double dj, /* Julian date (geocentric) */
- double ra, /* Right ascension (degrees) */
- double dec, /* Declination (degrees) */
- int sys); /* J2000, B1950, GALACTIC, ECLIPTIC */
- double hjd2jd( /* Convert from Heliocentric Julian Date to Julian Date */
- double dj, /* Heliocentric Julian date */
- double ra, /* Right ascension (degrees) */
- double dec, /* Declination (degrees) */
- int sys); /* J2000, B1950, GALACTIC, ECLIPTIC */
-
- void setdatedec( /* Set number of decimal places in FITS dates */
- int nd); /* Number of decimal places in FITS dates */
-
-#else /* K&R prototypes */
-
-/* FITS file access subroutines in fitsfile.c */
-extern int fitsropen();
-extern char *fitsrhead();
-extern char *fitsrtail();
-extern char *fitsrimage();
-extern char *fitsrfull();
-extern char *fitsrsect();
-extern int fitswhead();
-extern int fitswexhead();
-extern int fitswext();
-extern int fitswhdu();
-extern int fitswimage();
-extern int fitscimage();
-extern int isfits(); /* Return 1 if file is a FITS file */
-extern void fitserr(); /* Print FITS error message to stderr */
-extern void setfitsinherit(); /* Set flag to append primary data header */
-extern int fitsheadsize(); /* Return size of fitsheader in bytes */
-
-/* FITS table file access subroutines in fitsfile.c */
-extern int fitsrtopen();
-extern int fitsrthead();
-extern void fitsrtlset();
-extern int fitsrtline();
-extern short ftgeti2();
-extern int ftgeti4();
-extern float ftgetr4();
-extern double ftgetr8();
-extern int ftgetc();
-extern void moveb(); /* Copy nbytes bytes from source+offs to dest+offd */
-
-/* IRAF file access subroutines in imhfile.c */
-extern char *irafrhead();
-extern char *irafrimage();
-extern int irafwhead();
-extern int irafwimage();
-extern int isiraf();
-extern char *iraf2fits();
-extern char *fits2iraf();
-
-/* Image pixel access subroutines in imio.c */
-extern double getpix(); /* Read one pixel from any data type 2-D array (0,0)*/
-extern double getpix1(); /* Read one pixel from any data type 2-D array (1,1)*/
-extern double maxvec(); /* Get maximum value in vector from a image */
-extern double minvec(); /* Get minimum value in vector from a image */
-extern void putpix(); /* Write one pixel to any data type 2-D array (0,0)*/
-extern void putpix1(); /* Write one pixel to any data type 2-D array (1,1) */
-extern void addpix(); /* Add to one pixel in any data type 2-D array (0,0)*/
-extern void addpix1(); /* Add to one pixel in any data type 2-D array (1,1)*/
-extern void movepix(); /* Move one pixel value between two 2-D arrays (0,0) */
-extern void movepix1(); /* Move one pixel value between two 2-D arrays (1,1) */
-extern void addvec(); /* Add constant to vector from 2-D array */
-extern void multvec(); /* Multiply vector from 2-D array by a constant */
-extern void getvec(); /* Read vector from 2-D array */
-extern void putvec(); /* Write vector into 2-D array */
-extern void fillvec(); /* Write constant into a vector */
-extern void fillvec1(); /* Write constant into a vector */
-extern void imswap(); /* Swap alternating bytes in a vector */
-extern void imswap2(); /* Swap bytes in a vector of 2-byte (short) integers */
-extern void imswap4(); /* Reverse bytes in a vector of 4-byte numbers */
-extern void imswap8(); /* Reverse bytes in a vector of 8-byte numbers */
-extern int imswapped(); /* Return 1 if machine byte order is not FITS order */
-
-/* File utilities from fileutil.c */
-extern int getfilelines();
-extern char *getfilebuff();
-extern int getfilesize();
-extern int isimlist();
-extern int isimlistd();
-extern int isfilelist();
-extern int isfile();
-extern int istiff();
-extern int isjpeg();
-extern int isgif();
-extern int first_token();
-
-/* Subroutines for access to tokens within a string from fileutil.c */
-int setoken(); /* Tokenize a string for easy decoding */
-int nextoken(); /* Get next token from tokenized string */
-int getoken(); /* Get specified token from tokenized string */
-
-/* Subroutines for translating dates and times in dateutil.c */
-
-void ang2hr(); /* Fractional degrees to hours as hh:mm:ss.ss */
-void ang2deg(); /* Fractional degrees to degrees as dd:mm:ss.ss */
-double deg2ang(); /* Degrees as dd:mm:ss.ss to fractional degrees */
-double hr2ang(); /* Hours as hh:mm:ss.ss to fractional degrees */
-
-void doy2dt(); /* year and day of year to yyyy.mmdd hh.mmss */
-double doy2ep(); /* year and day of year to fractional year (epoch) */
-double doy2epb(); /* year and day of year to Besselian epoch */
-double doy2epj(); /* year and day of year to Julian epoch */
-char *doy2fd(); /* year and day of year to FITS date */
-double doy2jd(); /* year and day of year to Julian date */
-double doy2mjd(); /* year and day of year to modified Julian date */
-double doy2ts(); /* year and day of year to seconds since 1950.0 */
-int doy2tsi(); /* year and day of year to IRAF seconds since 1980-01-01 */
-
-time_t doy2tsu(); /* year and day of year to Unix seconds since 1970-01-01 */
-void dt2doy(); /* yyyy.mmdd hh.mmss to year and day of year */
-double dt2ep(); /* yyyy.ddmm and hh.mmsss to fractional year (epoch) */
-double dt2epb(); /* yyyy.ddmm and hh.mmsss to Besselian epoch */
-double dt2epj(); /* yyyy.ddmm and hh.mmsss to Julian epoch */
-char *dt2fd(); /* yyyy.ddmm and hh.mmsss to FITS date string */
-void dt2i(); /* yyyy.ddmm and hh.mmsss to year, month, day, hrs, min, sec */
-double dt2jd(); /* yyyy.ddmm and hh.mmsss to Julian date */
-double dt2mjd(); /* yyyy.ddmm and hh.mmsss to modified Julian date */
-double dt2ts(); /* yyyy.ddmm and hh.mmsss to seconds since 1950.0 */
-int dt2tsi(); /* yyyy.ddmm and hh.mmsss to IRAF seconds since 1980-01-01 */
-time_t dt2tsu(); /* yyyy.ddmm and hh.mmsss to Unix seconds since 1970-01-01 */
-
-void ep2dt(); /* Fractional year to yyyy.mmdd hh.mmssss */
-void epb2dt(); /* Besselian epoch to yyyy.mmdd hh.mmssss */
-void epj2dt(); /* Julian epoch to yyyy.mmdd hh.mmssss */
-char *ep2fd(); /* Fractional year to FITS date string yyyy-mm-ddThh:mm:ss.ss */
-char *epb2fd(); /* Besselian epoch to FITS date string yyyy-mm-ddThh:mm:ss.ss */
-char *epj2fd(); /* Julian epoch to FITS date string yyyy-mm-ddThh:mm:ss.ss */
-void ep2i(); /* Fractional year to year, month, day, hours, min., sec. */
-void epb2i(); /* Besselian epoch to year, month, day, hours, min., sec. */
-void epj2i(); /* Julian epoch to year, month, day, hours, min., sec. */
-double ep2jd(); /* Fractional year to Julian Date */
-double epb2jd(); /* Besselian epoch to Julian Date */
-double epj2jd(); /* Julian epoch to Julian Date */
-double ep2mjd(); /* Fractional year to modified Julian Date */
-double epb2mjd(); /* Besselian epoch to modified Julian Date */
-double epj2mjd(); /* Julian epoch to modified Julian Date */
-double ep2epb(); /* Fractional year to Besselian epoch */
-double ep2epj(); /* Fractional year to Julian epoch */
-double epb2epj(); /* Besselian epoch to Julian epoch */
-double epj2epb(); /* Julian epoch to Besselian epoch */
-double epb2ep(); /* Besselian epoch to fractional year */
-double epj2ep(); /* Julian epoch to fractional year */
-double ep2ts(); /* Fractional year to seconds since 1950.0 */
-double epb2ts(); /* Besselian epoch to seconds since 1950.0 */
-double epj2ts(); /* Julian epoch to seconds since 1950.0 */
-
-void fd2dt(); /* FITS standard date string to Julian date */
-void fd2doy(); /* FITS standard date string to year, day of year */
-double fd2ep(); /* FITS standard date string to fractional year (epoch) */
-double fd2epb(); /* FITS standard date string to Besselian epoch */
-double fd2epj(); /* FITS standard date string to Julian epoch */
-char *fd2fd(); /* Any FITS standard date string to ISO FITS date string */
-char *fd2of(); /* Any FITS standard date string to old FITS date and time */
-char *fd2ofd(); /* Any FITS standard date string to old FITS date string */
-char *fd2oft(); /* Any FITS standard date string to old FITS time string */
-void fd2i(); /* FITS standard date string to year, mon, day, hrs, min, sec */
-double fd2jd(); /* FITS standard date string to Julian date */
-double fd2mjd(); /* FITS standard date string to modified Julian date */
-double fd2ts(); /* FITS standard date to seconds since 1950-01-01 */
-int fd2tsi(); /* FITS standard date to IRAF seconds since 1980-01-01 */
-time_t fd2tsu(); /* FITS standard date to Unix seconds since 1970-01-01 */
-void jd2doy(); /* Julian date to year and day of year */
-void jd2dt(); /* Julian date to yyyy.mmdd hh.mmssss */
-double jd2ep(); /* Julian date to fractional year */
-double jd2epb(); /* Julian date to Besselian epoch */
-double jd2epj(); /* Julian date to Julian epoch */
-char *jd2fd(); /* Julian date to FITS date string yyyy-mm-ddThh:mm:ss.ss */
-void jd2i(); /* Julian date to year, month, day, hours, min., sec. */
-double jd2mjd(); /* Julian date to modified Julian date */
-double jd2ts(); /* Julian date to seconds since 1950.0 */
-time_t jd2tsu(); /* Julian date to Unix seconds since 1970-01-01T00:00 */
-int jd2tsi(); /* Julian date to IRAF seconds since 1980-01-01T00:00 */
-
-void lt2dt(); /* Current local time to date (yyyy.mmdd), time (hh.mmsss) */
-char *lt2fd(); /* Current local time to FITS ISO date string */
-int lt2tsi(); /* Current local time to IRAF seconds since 1980-01-01T00:00 */
-time_t lt2tsu(); /* Current local time to Unix seconds since 1970-01-01T00:00 */
-double lt2ts(); /* Current local time to IRAF seconds since 1950-01-01T00:00 */
-
-void mjd2doy(); /* Convert from Modified Julian Date to Day of Year */
-void mjd2dt(); /* Modified Julian date to yyyy.mmdd hh.mmssss */
-double mjd2ep(); /* Modified Julian date to fractional year */
-double mjd2epb(); /* Modified Julian date to Besselian epoch */
-double mjd2epj(); /* Modified Julian date to Julian epoch */
-char *mjd2fd(); /* Modified Julian date to FITS date yyyy-mm-ddThh:mm:ss.ss */
-void mjd2i(); /* Modified Julian date to year, month, day, hours, min, sec */
-double mjd2jd(); /* Modified Julian date to Julian date */
-double mjd2ts(); /* Modified Julian date to seconds since 1950.0 */
-
-void ts2dt(); /* Seconds since 1950.0 to yyyy.mmdd hh.mmssss */
-double ts2ep(); /* Seconds since 1950.0 to fractional year */
-double ts2epb(); /* Seconds since 1950.0 to Besselian epoch */
-double ts2epj(); /* Seconds since 1950.0 to Julian epoch */
-char *ts2fd(); /* Seconds since 1950.0 to FITS date, yyyy-mm-ddT00:00:00.000 */
-void ts2i(); /* Seconds since 1950.0 to year, month, day, hours, min, sec */
-double ts2jd(); /* Seconds since 1950.0 to Julian date */
-double ts2mjd(); /* Seconds since 1950.0 to modified Julian date */
-char *tsi2fd(); /* Seconds since 1980-01-01 to FITS standard date string */
-double tsi2ts(); /* Seconds since 1980-01-01 to seconds since 1950-01-01 */
-double tsi2ts(); /* Seconds since 1980-01-01 to seconds since 1950-01-01 */
-void tsi2dt(); /* Seconds since 1980-01-01 to date yyyy.mmdd, time hh.mmssss */
-void tsu2dt(); /* Seconds since 1970-01-01 to date yyyy.ddmm, time hh.mmsss */
-char *tsu2fd(); /* Seconds since 1970-01-01 to FITS standard date string */
-char *tsd2fd(); /* Seconds since start of day to FITS standard time string */
-double tsd2dt(); /* Seconds since start of day to hh.mmsssss */
-double tsu2ts(); /* Seconds since 1970-01-01 to seconds since 1950-01-01 */
-int tsu2tsi(); /* Seconds since 1970-01-01 to local seconds since 1980-01-01 */
-int isdate(); /* Return 1 if string is FITS old or ISO date */
-void ut2dt(); /* Current Universal Time to date (yyyy.mmdd), time (hh.mmsss) */
-void ut2doy(); /* Current Universal Time to year, day of year */
-double ut2ep(); /* Current Universal Time to fractional year */
-double ut2epb(); /* Current Universal Time to Besselian Epoch */
-double ut2epj(); /* Current Universal Time to Julian Epoch */
-char *ut2fd(); /* Current Universal Time to FITS ISO date string */
-double ut2jd(); /* Current Universal Time to Julian Date */
-double ut2mjd(); /* Current Universal Time to Modified Julian Date */
-int ut2tsi(); /* Current UT to IRAF seconds since 1980-01-01T00:00 */
-time_t ut2tsu(); /* Current UT to Unix seconds since 1970-01-01T00:00 */
-double ut2ts(); /* Current UT to IRAF seconds since 1950-01-01T00:00 */
-int sts2c(); /* Replaces spaces in a string with a specified character */
-int stc2s(); /* Replaces a specified character in a string with spaces */
-char *et2fd(); /* ET (or TDT or TT) in FITS format to UT in FITS format */
-char *fd2et(); /* UT in FITS format to ET (or TDT or TT) in FITS format */
-double jd2jed(); /* Convert from Julian Date to Julian Ephemeris Date */
-double jed2jd(); /* Convert from Julian Ephemeris Date to Julian Date */
-double ets2ts(); /* ET in seconds since 1950-01-01 to UT in same format */
-double ts2ets(); /* UT in seconds since 1950-01-01 to ET in same format */
-void dt2et(); /* yyyy.ddmm and hh.mmsss to Ephemeris Time */
-void edt2dt(); /* yyyy.ddmm and hh.mmsss Ephemeris Time to UT */
-double utdt(); /* Compute difference between UT and dynamical time (ET-UT) */
-char *fd2gst(); /* Convert from FITS UT date to Greenwich Sidereal Time */
-void dt2gst(); /* Convert from UT as yyyy.mmdd hh.mmssss to Greenwich Sidereal Time */
-double jd2gst(); /* Calculate Greenwich Sidereal Time given Julian Date */
-double ts2gst(); /* Calculate Greenwich Sidereal Time given Universal Time */
-char *fd2lst(); /* Convert from FITS UT date to Local Sidereal Time */
-void dt2lst(); /* Convert from UT as yyyy.mmdd hh.mmssss to Local Sidereal Time */
-double ts2lst(); /* Calculate Local Sidereal Time given Universal Time */
-double jd2lst(); /* Calculate Local Sidereal Time given Julian Date */
-double eqeqnx(); /* Compute equation of eqinoxes from Julian Date */
-char *fd2mst(); /* Convert from FITS UT date to Mean Sidereal Time */
-double jd2mst(); /* Convert from Julian Date to Mean Sidereal Time */
-double jd2mst2(); /* Convert from Julian Date to Mean Sidereal Time */
-void dt2mst(); /* Convert from UT as yyyy.mmdd hh.mmssss to Mean Sidereal Time */
-double lst2ts(); /* Calculate Universal Time given Local Sidereal Time */
-double lst2dt(); /* Calculate UT as yyyy.mmdd hh.mmsss given UT date and Local Sidereal Time */
-double lst2jd(); /* Calculate UT as Julian Date given UT date and Local Sidereal Time */
-char *lst2fd(); /* Calculate FITS UT date and time given UT date and Local Sidereal Time */
-char *gst2fd(); /* Calculate FITS UT date and time given Greenwich Sidereal Time */
-double gst2jd(); /* Calculate FITS UT Julian Date given Greenwich Sidereal Time */
-char *mst2fd(); /* Calculate FITS UT date and time given Mean Sidereal Time */
-double mst2jd(); /* Calculate FITS UT Julian Date given Mean Sidereal Time */
-char *fd2mst(); /* Convert from FITS UT date to Mean Sidereal Time */
-void dt2mst(); /* Convert from UT as yyyy.mmdd hh.mmssss to Mean Sidereal Time */
-double ts2mst(); /* Calculate Mean Sidereal Time given Universal Time */
-double mjd2mhjd(); /* Convert from Modified Julian Date to Heliocentric MJD */
-double mjd2hjd(); /* Convert from Modified Julian Date to Heliocentric JD */
-double mhjd2mjd(); /* Convert from Heliocentric Modified Julian Date to MJD */
-double jd2hjd(); /* Convert from Julian Date to Heliocentric Julian Date */
-double jd2mhjd(); /* Convert from Julian Date to Modified Heliocentric JD */
-double hjd2jd(); /* Convert from Heliocentric Julian Date to Julian Date */
-double hjd2mjd(); /* Convert from Heliocentric Julian Date to Modified JD */
-double hjd2mhjd(); /* Convert from Heliocentric Julian Date to Modified HJD */
-void setdatedec(); /* Set number of decimal places in FITS dates */
-void setlongitude(); /* Longitude for sidereal time in or out */
-
-void compnut(); /* Compute nutation in longitude and obliquity and mean obliquity*/
-
-#endif /* __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* fitsfile_h_ */
-
-/* May 31 1996 Use stream I/O for reading as well as writing
- * Jun 12 1996 Add byte-swapping subroutines
- * Jul 10 1996 FITS header now allocated in subroutines
- * Jul 17 1996 Add FITS table column extraction subroutines
- * Aug 6 1996 Add MOVEPIX, HDEL and HCHANGE declarations
- *
- * Oct 10 1997 FITS file opening subroutines now return int instead of FILE *
- *
- * May 27 1998 Split off fitsio and imhio subroutines to fitsio.h
- * Jun 4 1998 Change fits2iraf from int to int *
- * Jul 24 1998 Make IRAF header char instead of int
- * Aug 18 1998 Change name to fitsfile.h from fitsio.h
- * Oct 5 1998 Add isiraf() and isfits()
- * Oct 7 1998 Note separation of imhfile.c into two files
- *
- * Jul 15 1999 Add fileutil.c subroutines
- * Sep 28 1999 Add (1,1)-based image access subroutines
- * Oct 21 1999 Add fitswhead()
- * Nov 2 1999 Add date utilities from wcscat.h
- * Nov 23 1999 Add fitscimage()
- * Dec 15 1999 Fix misdeclaration of *2fd() subroutines, add fd2i(), dt2i()
- * Dec 20 1999 Add isdate()
- *
- * Jan 20 2000 Add conversions to and from Besselian and Julian epochs
- * Jan 21 2000 Add conversions to old FITS date and time
- * Jan 26 2000 Add conversion to modified Julian date (JD - 2400000.5
- * Mar 22 2000 Add lt2* and ut2* to get current time as local and UT
- * Mar 24 2000 Add tsi2* and tsu2* to convert IRAF and Unix seconds
- * Sep 8 2000 Improve comments
- *
- * Apr 24 2001 Add length of column name to column data structure
- * May 22 2001 Add day of year date conversion subroutines
- * Sep 25 2001 Add isfilelist() and isfile()
- *
- * Jan 8 2002 Add sts2c() and stc2s()
- * Apr 8 2002 Change all long declarations to time_t for compatibility
- * Jun 18 2002 Add fitserr() to print error messages
- * Aug 30 2002 Add Ephemeris Time date conversions
- * Sep 10 2002 Add Sidereal Time conversions
- * Oct 21 2002 Add fitsrsect() to read sections of FITS images
- *
- * Mar 5 2003 Add isimlistd() to check image lists with root directory
- * Aug 20 2003 Add fitsrfull() to read n-dimensional simple FITS images
- *
- * Feb 27 2004 Add fillvec() and fillvec1()
- * May 3 2004 Add setfitsinherit()
- * May 6 2004 Add fitswexhead()
- * Aug 27 2004 Add fitsheadsize()
- *
- * Oct 14 2005 Add tsd2fd(), tsd2dt(), epj2ep(), epb2ep(), tsi2dt()
- *
- * Feb 23 2006 Add fitsrtail() to read appended FITS header
- * Feb 23 2006 Add istiff(), isjpeg(), isgif() to check TIFF, JPEG, GIF files
- * Sep 6 2006 Add heliocentric time conversions
- * Oct 5 2006 Add local sidereal time conversions
- *
- * Jan 9 2007 Add ANSI prototypes
- * Jan 11 2007 Add token subroutines from catutil.c/wcscat.h to fileutil.c
- * Jun 11 2007 Add minvec() subroutine in imio.c
- * Nov 28 2007 Add kform format to FITS table keyword data structure
- *
- * Sep 8 2008 Add ag2hr(), ang2deg(), deg2ang(), and hr2ang()
- *
- * Sep 25 2009 Add moveb()
- */
diff --git a/funtools/wcs/fitshead.h b/funtools/wcs/fitshead.h
deleted file mode 100644
index 1212709..0000000
--- a/funtools/wcs/fitshead.h
+++ /dev/null
@@ -1,438 +0,0 @@
-/*** File fitshead.h FITS header access subroutines
- *** January 9, 2007
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1996-2007
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-/* Declarations for subroutines in hget.c, hput.c, and iget.c */
-
-#ifndef _fitshead_h_
-#define _fitshead_h_
-
-#include <sys/types.h>
-
-#ifdef __cplusplus /* C++ prototypes */
-extern "C" {
-#endif
-
-
-#ifdef __STDC__ /* Full ANSI prototypes */
-
-/* Subroutines in hget.c */
- int hgeti2( /* Extract short value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- short* val); /* short integer value (returned) */
- int hgeti4c( /* Extract int value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- const char* wchar, /* WCS to use (A-Z or null) */
- int* val); /* integer value (returned) */
- int hgeti4( /* Extract int value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- int* val); /* integer value (returned) */
- int hgetr4( /* Extract float value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- float* val); /* float value (returned) */
- int hgetr8c( /* Extract double value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- const char* wchar, /* WCS to use (A-Z or null) */
- double* val); /* double value (returned) */
- int hgetr8( /* Extract double value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- double* val); /* double value (returned) */
- int hgetra( /* Extract right ascension from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- double* ra); /* RA in degrees (returned) */
- int hgetdec( /* Extract declination from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- double* dec); /* Dec in degrees (returned) */
- int hgetdate( /* Extract date from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- double* date); /* Date in fractional years (returned) */
- int hgetl( /* Extract boolean value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- int* lval); /* 1 if T, 0 if F (returned) */
- int hgetsc( /* Extract string value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- const char* wchar, /* WCS to use (A-Z or null) */
- const int lstr, /* maximum length of returned string */
- char* string); /* null-terminated string value (returned) */
- int hgets( /* Extract string value from FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- const int lstr, /* maximum length of returned string */
- char* string); /* null-terminated string value (returned) */
- int hgetm ( /* Extract string from multiple keywords */
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- const int lstr, /* maximum length of returned string */
- char* string); /* null-terminated string value (returned) */
- int hgetndec( /* Find number of decimal places in FITS value*/
- const char* hstring, /* FITS header string */
- const char* keyword, /* FITS keyword */
- int* ndec); /* number of decimal places (returned) */
-
- char* hgetc( /* Return pointer to value for FITS keyword */
- const char* hstring, /* FITS header string */
- const char* keyword); /* FITS keyword */
-
- char* ksearch( /* Return pointer to keyword in FITS header */
- const char* hstring, /* FITS header string */
- const char* keyword); /* FITS keyword */
- char *blsearch (
- const char* hstring, /* FITS header string */
- const char* keyword); /* FITS keyword */
-
- char *strsrch ( /* Find string s2 within string s1 */
- const char* s1, /* String to search */
- const char* s2); /* String to look for */
- char *strnsrch ( /* Find string s2 within string s1 */
- const char* s1, /* String to search */
- const char* s2, /* String to look for */
- const int ls1); /* Length of string being searched */
-
- char *strcsrch ( /* Find string s2 within string s1 (no case) */
- const char* s1, /* String to search */
- const char* s2); /* String to look for */
- char *strncsrch ( /* Find string s2 within string s1 (no case) */
- const char* s1, /* String to search */
- const char* s2, /* String to look for */
- const int ls1); /* Length of string being searched */
-
- int hlength( /* Set length of unterminated FITS header */
- const char *header, /* FITS header */
- const int lhead); /* Allocated length of FITS header */
- int gethlength( /* Get length of current FITS header */
- char* header); /* FITS header */
-
- double str2ra( /* Return RA in degrees from string */
- const char* in); /* Character string (hh:mm:ss.sss or dd.dddd) */
- double str2dec( /* Return Dec in degrees from string */
- const char* in); /* Character string (dd:mm:ss.sss or dd.dddd) */
-
- int isnum( /* Return 1 if number, else 0 */
- const char* string); /* Character string which may be a number */
- int notnum( /* Return 0 if number, else 1 */
- const char* string); /* Character string which may be a number */
- int numdec( /* Return number of decimal places in number */
- const char* string); /* Character string which may be a number */
- void strfix( /* Clean up extraneous characters in string */
- char* string, /* Character string which may be a number */
- int fillblank, /* If 1, blanks are replaced by underscores */
- int dropzero); /* If 1, drop trailing zeroes from string */
-
- char *getltime(void); /* Return current local time in ISO format */
- char *getutime(void); /* Return current UT as an ISO-format string */
-
-/* Subroutines in iget.c */
- int mgetstr( /* Extract string from multiline FITS keyword */
- const char* hstring, /* FITS header string */
- const char* mkey, /* FITS keyword root _n added for extra lines */
- const char* keyword, /* IRAF keyword */
- const int lstr, /* maximum length of returned string */
- char* string); /* null-terminated string value (returned) */
- int mgeti4( /* Extract int from multiline FITS keyword */
- const char* hstring, /* FITS header string */
- const char* mkey, /* FITS keyword root _n added for extra lines */
- const char* keyword, /* IRAF keyword */
- int* ival); /* int keyword value (returned) */
- int mgetr8( /* Extract double from multiline FITS keyword */
- const char* hstring, /* FITS header string */
- const char* mkey, /* FITS keyword root _n added for extra lines */
- const char* keyword, /* IRAF keyword */
- double* dval); /* double keyword value (returned) */
- int igeti4( /* Extract int from IRAF keyword string */
- const char* hstring, /* Multiline IRAF keyword string value */
- const char* keyword, /* IRAF keyword */
- int* val); /* int value (returned) */
- int igetr4( /* Extract float from IRAF keyword string */
- const char* hstring, /* Multiline IRAF keyword string value */
- const char* keyword, /* IRAF keyword */
- float* val); /* float value (returned) */
- int igetr8( /* Extract double from IRAF keyword string */
- const char* hstring, /* Multiline IRAF keyword string value */
- const char* keyword, /* IRAF keyword */
- double* val); /* double value (returned) */
- int igets( /* Extract string from IRAF keyword string */
- const char* hstring, /* Multiline IRAF keyword string value */
- const char* keyword, /* IRAF keyword */
- const int lstr, /* maximum length of returned string */
- char* string); /* null-terminated string value (returned) */
- char *igetc( /* Extract string from IRAF keyword string */
- const char* hstring, /* Multiline IRAF keyword string value */
- const char* keyword); /* IRAF keyword */
-
-/* Subroutines in hput.c */
-/* All hput* routines return 0 if successful, else -1 */
- int hputi2( /* Implant short value into FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- short ival); /* short value */
- int hputi4( /* Implant int value into FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const int ival); /* int value */
- int hputr4( /* Implant float value into FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const float* rval); /* float (4 byte) value */
- int hputr8( /* Implant short into FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const double dval); /* double value */
- int hputnr8( /* double with specified number of decimal places */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const int ndec, /* Number of decimal places in keyword value */
- const double dval); /* double value */
- int hputs( /* Quoted character string into FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const char* cval); /* Character string value */
- int hputm( /* Quoted character string, mutiple keywords */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const char* cval); /* Character string value */
- int hputcom( /* Add comment to keyword line in FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const char* comment); /* Comment string */
- int hputra( /* Right ascension in degrees into hh:mm:ss.sss */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const double ra); /* Right ascension in degrees */
- int hputdec( /* Declination in degrees into dd:mm:ss.ss */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const double dec); /* Declination in degrees */
- int hputl( /* Implant boolean value into FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const int lval); /* 0->F, else ->T */
- int hputc( /* Implant character string without quotes */
- char* hstring, /* FITS header string (modified) */
- const char* keyword, /* FITS keyword */
- const char* cval); /* Character string value */
-
- int hdel( /* Delete a keyword line from a FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword); /* FITS keyword to delete */
- int hadd( /* Add a keyword line from a FITS header */
- char* hplace, /* Location in FITS header string (modified) */
- const char* keyword); /* FITS keyword to add */
- int hchange( /* Change a keyword name in a FITS header */
- char* hstring, /* FITS header string (modified) */
- const char* keyword1, /* Current FITS keyword name */
- const char* keyword2); /* New FITS keyword name */
-
- void ra2str( /* Convert degrees to hh:mm:ss.ss */
- char *string, /* Character string (returned) */
- int lstr, /* Length of string */
- const double ra, /* Right ascension in degrees */
- const int ndec); /* Number of decimal places in seconds */
- void dec2str( /* Convert degrees to dd:mm:ss.ss */
- char *string, /* Character string (returned) */
- int lstr, /* Length of string */
- const double dec, /* Declination in degrees */
- const int ndec); /* Number of decimal places in arcseconds */
- void deg2str( /* Format angle into decimal degrees string */
- char *string, /* Character string (returned) */
- int lstr, /* Length of string */
- const double deg, /* Angle in degrees */
- const int ndec); /* Number of decimal places in degrees */
- void num2str( /* Format number into string */
- char *string, /* Character string (returned) */
- const double num, /* Number */
- const int field, /* Total field size in characters */
- const int ndec); /* Number of decimal places */
- void setheadshrink( /* 0 to keep blank line when keyword deleted */
- const int hsh); /* 1 to shrink header by one line */
- void setleaveblank( /* 1 to keep blank line where keyword deleted */
- const int hsh); /* 0 to shrink header by one line */
-
-#else /* K&R prototypes */
-
-/* Subroutines in hget.c */
-
-/* Extract a value from a FITS header for given keyword */
-extern int hgeti4(); /* int (Multiple WCS) */
-extern int hgeti4c(); /* int */
-extern int hgeti2(); /* short */
-extern int hgetr4(); /* float */
-extern int hgetr8(); /* double */
-extern int hgetr8c(); /* double (Multiple WCS) */
-extern int hgetra(); /* Right ascension in degrees from string */
-extern int hgetdec(); /* Declination in degrees from string */
-extern int hgetdate(); /* Date in years from FITS date string */
-extern int hgetl(); /* T->1, F->0 from FITS logical entry */
-extern int hgets(); /* Previously allocated string */
-extern int hgetsc(); /* Previously allocated string (Multiple WCS) */
-extern int hgetm(); /* Previously allocated string from multiple keywords */
-extern char *hgetc(); /* Return pointer to string */
-extern int hgetndec(); /* Number of decimal places in keyword value */
-
-/* Subroutines to convert strings to RA and Dec in degrees */
-extern double str2ra();
-extern double str2dec();
-
-/* Check to see whether a string is a number or not */
-extern int isnum();
-extern int notnum();
-extern int decnum();
-
-/* Find given keyword entry in FITS header */
-extern char *ksearch();
-
-/* Find beginning of fillable blank line before FITS header keyword */
-extern char *blsearch();
-
-/* Search for substring s2 within string s1 */
-extern char *strsrch (); /* s1 null-terminated */
-extern char *strnsrch (); /* s1 ls1 characters long */
-extern char *strcsrch (); /* s1 null-terminated (case-insensitive) */
-extern char *strncsrch (); /* s1 ls1 characters long (case-insensitive) */
-extern void strfix(); /* Drop or change extraneous characters in string */
-
-/* Set length of header which is not null-terminated */
-extern int hlength();
-
-/* Get length of current FITS header */
-extern int gethlength();
-
-/* Subroutines in iget.c */
-extern int mgetstr(); /* Previously allocated string from multiline keyword */
-extern int mgetr8(); /* double from multiline keyword */
-extern int mgeti4(); /* int from multiline keyword */
-extern int igeti4(); /* long integer from IRAF compound keyword value */
-extern int igetr4(); /* real from IRAF compound keyword value */
-extern int igetr8(); /* double from IRAF compound keyword value */
-extern int igets(); /* character string from IRAF compound keyword value */
-extern char *igetc(); /* Extract string from IRAF keyword string */
-
-/* Subroutines in hput.c */
-
-/* Implant a value into a FITS header for given keyword */
-extern int hputi4(); /* int */
-extern int hputi2(); /* short */
-extern int hputr4(); /* float */
-extern int hputr8(); /* double */
-extern int hputnr8(); /* double with specified number of decimal places */
-extern int hputra(); /* Right ascension in degrees into hh:mm:ss.sss */
-extern int hputdec(); /* Declination in degrees into dd:mm:ss.ss */
-extern int hputl(); /* 0 -> F, else T FITS logical entry */
-extern int hputs(); /* Quoted character string */
-extern int hputm(); /* Quoted character string into mutiple keywords */
-extern int hputc(); /* Character string without quotes (returns 0 if OK) */
-extern int hputcom(); /* Comment after keyword=value (returns 0 if OK) */
-
-extern int hdel(); /* Delete a keyword line from a FITS header */
-extern int hadd(); /* Add a keyword line to a FITS header */
-extern int hchange(); /* Change a keyword name in a FITS header */
-extern void setheadshrink(); /* Set flag for deleted keyword space disposition*/
-extern void setleaveblank(); /* Set flag for deleted keyword space disposition*/
-
-/* Subroutines to convert RA and Dec in degrees to strings */
-extern void ra2str();
-extern void dec2str();
-
-extern void deg2str();
-extern void num2str();
-extern int numdec(); /* Return number of decimal places in number */
-
-extern char *getltime(); /* Return current local time in ISO format */
-extern char *getutime(); /* Return current UT as an ISO-format string */
-
-#endif /* __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* fitshead_h_ */
-
-/* Apr 26 1996 Add HGETDATE to get year from date string
- * May 22 1996 Return double from STR2RA and STR2DEC
- * May 31 1996 Use stream I/O for reading as well as writing
- * Jun 12 1996 Add byte-swapping subroutines
- * Jul 10 1996 FITS header now allocated in subroutines
- * Jul 17 1996 Add FITS table column extraction subroutines
- * Jul 19 1996 Add declarations for header implanting subroutines
- * Aug 5 1996 Add HLENGTH for FITS headers which are not null-terminated
- * Aug 5 1996 Add STRNSRCH for FITS headers which are not null-terminated
- * Aug 6 1996 Add HPUTNR8 to save a specified number of decimal places
- * Aug 6 1996 Add MOVEPIX, HDEL and HCHANGE declarations
- * Nov 1 1996 Add DEG2STR
- * Dec 12 1996 Add ISNUM
- *
- * Oct 10 1997 FITS file opening subroutines now return int instead of FILE *
- *
- * Mar 12 1998 Add NOTNUM
- * Apr 30 1998 Clean up declarations and add more comments
- * May 12 1998 Add MGETS, MGETR8, MGETI4 for IRAF multi-line keywords
- * May 26 1998 Add HGETNDEC for number of decimal places in keyword value
- * May 27 1998 Add BLSEARCH to find usable blank lines in header
- * May 27 1998 Split off fitsio and imhio subroutines to fitsio.h
- * May 27 1998 Add all subroutines in hget.c, hput.c, and iget.c to C++ dec.
- * Jun 24 1998 Add string lengths to ra2str(), dec2str, and deg2str() calls
- * Jun 25 1998 Fix other C++ declarations with added string lengths
- * Aug 31 1998 Add current date subroutines getltime() and getutime()
- * Oct 28 1998 Add missing hgetc() to non c++ declarations
- *
- * Oct 6 1999 Add gethlength() to return current size of header
- * Oct 14 1999 All HPUT subroutines now return an error code, 0 if OK, else -1
- * Oct 15 1999 Add hputcom() declaration
- * Oct 21 1999 Add hgetm() declaration
- *
- * Mar 22 2000 Add int to iget*() declarations
- * Mar 27 2000 Add hputm() declaration
- *
- * Apr 3 2002 Add hgeti4c(), hgetr8c(), and hgetsc()
- * Apr 8 2002 Include sys/types.h
- * Aug 30 2002 Add strcsrch() and strncsrch()
- *
- * Sep 23 2003 Change mgets() to mgetstr() to avoid name collision at UCO Lick
- * Oct 20 2003 Add numdec() to return the number of decimal places in a string
- *
- * Feb 26 2004 Add igetc(), formerly internal to iget.c
- * Jul 1 2004 Add setheadshrink() for hdel()
- * Aug 30 2004 Add numdec() to non-C++ declarations
- *
- * May 22 2006 Add setleaveblank() to leave blank line where keyword is deleted
- * Jun 28 2006 Add strfix() to clean up characters in strings
- * Nov 29 2006 Drop semicolon at end of C++ ifdef
- *
- * Jan 9 2007 Fix declarations so ANSI prototypes are not just for C++
- */
diff --git a/funtools/wcs/hget.c b/funtools/wcs/hget.c
deleted file mode 100644
index 653e8eb..0000000
--- a/funtools/wcs/hget.c
+++ /dev/null
@@ -1,1913 +0,0 @@
-/*** File libwcs/hget.c
- *** May 19, 2011
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1994-2011
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: hget.c (Get FITS Header parameter values)
- * Purpose: Extract values for variables from FITS header string
- * Subroutine: hgeti2 (hstring,keyword,ival) returns short integer
- * Subroutine: hgeti4c (hstring,keyword,wchar,ival) returns long integer
- * Subroutine: hgeti4 (hstring,keyword,ival) returns long integer
- * Subroutine: hgetr4 (hstring,keyword,rval) returns real
- * Subroutine: hgetra (hstring,keyword,ra) returns double RA in degrees
- * Subroutine: hgetdec (hstring,keyword,dec) returns double Dec in degrees
- * Subroutine: hgetr8c (hstring,keyword,wchar,dval) returns double
- * Subroutine: hgetr8 (hstring,keyword,dval) returns double
- * Subroutine: hgetl (hstring,keyword,lval) returns logical int (0=F, 1=T)
- * Subroutine: hgetsc (hstring,keyword,wchar,lstr,str) returns character string
- * Subroutine: hgets (hstring,keyword, lstr, str) returns character string
- * Subroutine: hgetm (hstring,keyword, lstr, str) returns multi-keyword string
- * Subroutine: hgetdate (hstring,keyword,date) returns date as fractional year
- * Subroutine: hgetndec (hstring, keyword, ndec) returns number of dec. places
- * Subroutine: hgetc (hstring,keyword) returns character string
- * Subroutine: blsearch (hstring,keyword) returns pointer to blank lines
- before keyword
- * Subroutine: ksearch (hstring,keyword) returns pointer to header string entry
- * Subroutine: str2ra (in) converts string to right ascension in degrees
- * Subroutine: str2dec (in) converts string to declination in degrees
- * Subroutine: strsrch (s1, s2) finds string s2 in null-terminated string s1
- * Subroutine: strnsrch (s1, s2, ls1) finds string s2 in ls1-byte string s1
- * Subroutine: hlength (header,lhead) sets length of FITS header for searching
- * Subroutine: isnum (string) returns 1 if integer, 2 if fp number, else 0
- * Subroutine: notnum (string) returns 0 if number, else 1
- * Subroutine: numdec (string) returns number of decimal places in numeric string
- * Subroutine: strfix (string,blankfill,zerodrop) removes extraneous characters
- */
-
-#include <string.h> /* NULL, strlen, strstr, strcpy */
-#include <stdio.h>
-#include "fitshead.h" /* FITS header extraction subroutines */
-#include <stdlib.h>
-#ifndef VMS
-#include <limits.h>
-#else
-#define INT_MAX 2147483647 /* Biggest number that can fit in long */
-#define SHRT_MAX 32767
-#endif
-#define VLENGTH 81
-
-#ifdef USE_SAOLIB
-static int use_saolib=0;
-#endif
-
-char *hgetc ();
-
-static char val[VLENGTH+1];
-static int multiline = 0;
-
-static int lhead0 = 0; /* Length of header string */
-
-/* Set the length of the header string, if not terminated by NULL */
-int
-hlength (header, lhead)
-const char *header; /* FITS header */
-int lhead; /* Maximum length of FITS header */
-{
- char *hend;
- if (lhead > 0)
- lhead0 = lhead;
- else {
- lhead0 = 0;
- hend = ksearch (header,"END");
- lhead0 = hend + 80 - header;
- }
- return (lhead0);
-}
-
-/* Return the length of the header string, computing it if lhead0 not set */
-int
-gethlength (header)
-char *header; /* FITS header */
-{
- if (lhead0 > 0)
- return (lhead0);
- else
- return (hlength (header, 0));
-}
-
-
-/* Extract Integer*4 value for variable from FITS header string */
-
-int
-hgeti4c (hstring,keyword,wchar,ival)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for
- a line beginning with this string. if "[n]" is
- present, the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const char *wchar; /* Character of multiple WCS header; =0 if unused */
-int *ival; /* Keyword value returned */
-{
- char keyword1[16];
- int lkey;
-
- if (wchar[0] < (char) 64)
- return (hgeti4 (hstring, keyword, ival));
- else {
- strcpy (keyword1, keyword);
- lkey = strlen (keyword);
- keyword1[lkey] = wchar[0];
- keyword1[lkey+1] = (char) 0;
- return (hgeti4 (hstring, keyword1, ival));
- }
-}
-
-
-/* Extract long value for variable from FITS header string */
-
-int
-hgeti4 (hstring,keyword,ival)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-int *ival;
-{
- char *value;
- double dval;
- int minint;
- int lval;
- char *dchar;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII to binary */
- if (value != NULL) {
- if (value[0] == '#') value++;
- minint = -INT_MAX - 1;
- lval = strlen (value);
- if (lval > VLENGTH) {
- strncpy (val, value, VLENGTH);
- val[VLENGTH] = (char) 0;
- }
- else
- strcpy (val, value);
- if (isnum (val) == 2) {
- if ((dchar = strchr (val, 'D')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'd')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'E')))
- *dchar = 'e';
- }
- dval = atof (val);
- if (dval+0.001 > INT_MAX)
- *ival = INT_MAX;
- else if (dval >= 0)
- *ival = (int) (dval + 0.001);
- else if (dval-0.001 < minint)
- *ival = minint;
- else
- *ival = (int) (dval - 0.001);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract integer*2 value for variable from fits header string */
-
-int
-hgeti2 (hstring,keyword,ival)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-short *ival;
-{
- char *value;
- double dval;
- int minshort;
- int lval;
- char *dchar;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII to binary */
- if (value != NULL) {
- if (value[0] == '#') value++;
- lval = strlen (value);
- if (lval > VLENGTH) {
- strncpy (val, value, VLENGTH);
- val[VLENGTH] = (char) 0;
- }
- else
- strcpy (val, value);
- if (isnum (val) == 2) {
- if ((dchar = strchr (val, 'D')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'd')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'E')))
- *dchar = 'e';
- }
- dval = atof (val);
- minshort = -SHRT_MAX - 1;
- if (dval+0.001 > SHRT_MAX)
- *ival = SHRT_MAX;
- else if (dval >= 0)
- *ival = (short) (dval + 0.001);
- else if (dval-0.001 < minshort)
- *ival = minshort;
- else
- *ival = (short) (dval - 0.001);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-/* Extract real value for variable from FITS header string */
-
-int
-hgetr4 (hstring,keyword,rval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-float *rval;
-{
- char *value;
- int lval;
- char *dchar;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* translate value from ASCII to binary */
- if (value != NULL) {
- if (value[0] == '#') value++;
- lval = strlen (value);
- if (lval > VLENGTH) {
- strncpy (val, value, VLENGTH);
- val[VLENGTH] = (char) 0;
- }
- else
- strcpy (val, value);
- if (isnum (val) == 2) {
- if ((dchar = strchr (val, 'D')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'd')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'E')))
- *dchar = 'e';
- }
- *rval = (float) atof (val);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract real*8 right ascension in degrees from FITS header string */
-
-int
-hgetra (hstring,keyword,dval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-double *dval; /* Right ascension in degrees (returned) */
-{
- char *value;
-
- /* Get value from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII colon-delimited string to binary */
- if (value != NULL) {
- *dval = str2ra (value);
- return (1);
- }
- else
- return (0);
-}
-
-
-/* Extract real*8 declination in degrees from FITS header string */
-
-int
-hgetdec (hstring,keyword,dval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-double *dval; /* Right ascension in degrees (returned) */
-{
- char *value;
-
- /* Get value from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII colon-delimited string to binary */
- if (value != NULL) {
- *dval = str2dec (value);
- return (1);
- }
- else
- return (0);
-}
-
-
-/* Extract real*8 value for variable from FITS header string */
-
-int
-hgetr8c (hstring,keyword,wchar,dval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for
- a line beginning with this string. if "[n]" is
- present, the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const char *wchar; /* Character of multiple WCS header; =0 if unused */
-double *dval; /* Keyword value returned */
-{
- char keyword1[16];
- int lkey;
-
- if (wchar[0] < (char) 64)
- return (hgetr8 (hstring, keyword, dval));
- else {
- strcpy (keyword1, keyword);
- lkey = strlen (keyword);
- keyword1[lkey] = wchar[0];
- keyword1[lkey+1] = (char) 0;
- return (hgetr8 (hstring, keyword1, dval));
- }
-}
-
-
-
-/* Extract real*8 value for variable from FITS header string */
-
-int
-hgetr8 (hstring,keyword,dval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-double *dval;
-{
- char *value;
- int lval;
- char *dchar;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII to binary */
- if (value != NULL) {
- if (value[0] == '#') value++;
- lval = strlen (value);
- if (lval > VLENGTH) {
- strncpy (val, value, VLENGTH);
- val[VLENGTH] = (char) 0;
- }
- else
- strcpy (val, value);
- if (isnum (val) == 2) {
- if ((dchar = strchr (val, 'D')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'd')))
- *dchar = 'e';
- if ((dchar = strchr (val, 'E')))
- *dchar = 'e';
- }
- *dval = atof (val);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract logical value for variable from FITS header string */
-
-int
-hgetl (hstring,keyword,ival)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-int *ival;
-{
- char *value;
- char newval;
- int lval;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII to binary */
- if (value != NULL) {
- lval = strlen (value);
- if (lval > VLENGTH) {
- strncpy (val, value, VLENGTH);
- val[VLENGTH] = (char) 0;
- }
- else
- strcpy (val, value);
- newval = val[0];
- if (newval == 't' || newval == 'T')
- *ival = 1;
- else
- *ival = 0;
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract real*8 date from FITS header string (dd/mm/yy or dd-mm-yy) */
-
-int
-hgetdate (hstring,keyword,dval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-double *dval;
-{
- double yeardays, seconds, fday;
- char *value,*sstr, *dstr, *tstr, *cstr, *nval;
- int year, month, day, yday, i, hours, minutes;
- static int mday[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* Translate value from ASCII to binary */
- if (value != NULL) {
- sstr = strchr (value,'/');
- dstr = strchr (value,'-');
-
- /* Original FITS date format: dd/mm/yy */
- if (sstr > value) {
- *sstr = '\0';
- day = (int) atof (value);
- *sstr = '/';
- nval = sstr + 1;
- sstr = strchr (nval,'/');
- if (sstr == NULL)
- sstr = strchr (nval,'-');
- if (sstr > value) {
- *sstr = '\0';
- month = (int) atof (nval);
- *sstr = '/';
- nval = sstr + 1;
- year = (int) atof (nval);
- if (day > 31) {
- yday = year;
- year = day;
- day = yday;
- }
- if (year >= 0 && year <= 49)
- year = year + 2000;
- else if (year < 100)
- year = year + 1900;
- if ((year % 4) == 0)
- mday[1] = 29;
- else
- mday[1] = 28;
- if ((year % 100) == 0 && (year % 400) != 0)
- mday[1] = 28;
- if (day > mday[month-1])
- day = mday[month-1];
- else if (day < 1)
- day = 1;
- if (mday[1] == 28)
- yeardays = 365.0;
- else
- yeardays = 366.0;
- yday = day - 1;
- for (i = 0; i < month-1; i++)
- yday = yday + mday[i];
- *dval = (double) year + ((double)yday / yeardays);
- return (1);
- }
- else
- return (0);
- }
-
- /* New FITS date format: yyyy-mm-ddThh:mm:ss[.sss] */
- else if (dstr > value) {
- *dstr = '\0';
- year = (int) atof (value);
- *dstr = '-';
- nval = dstr + 1;
- dstr = strchr (nval,'-');
- month = 1;
- day = 1;
- tstr = NULL;
- if (dstr > value) {
- *dstr = '\0';
- month = (int) atof (nval);
- *dstr = '-';
- nval = dstr + 1;
- tstr = strchr (nval,'T');
- if (tstr > value)
- *tstr = '\0';
- day = (int) atof (nval);
- if (tstr > value)
- *tstr = 'T';
- }
-
- /* If year is < 32, it is really day of month in old format */
- if (year < 32) {
- i = year;
- year = day + 1900;
- day = i;
- }
-
- if ((year % 4) == 0)
- mday[1] = 29;
- else
- mday[1] = 28;
- if ((year % 100) == 0 && (year % 400) != 0)
- mday[1] = 28;
- if (day > mday[month-1])
- day = mday[month-1];
- else if (day < 1)
- day = 1;
- if (mday[1] == 28)
- yeardays = 365.0;
- else
- yeardays = 366.0;
- yday = day - 1;
- for (i = 0; i < month-1; i++)
- yday = yday + mday[i];
- *dval = (double) year + ((double)yday / yeardays);
-
- /* Extract time, if it is present */
- if (tstr > value) {
- nval = tstr + 1;
- hours = 0.0;
- minutes = 0.0;
- seconds = 0.0;
- cstr = strchr (nval,':');
- if (cstr > value) {
- *cstr = '\0';
- hours = (int) atof (nval);
- *cstr = ':';
- nval = cstr + 1;
- cstr = strchr (nval,':');
- if (cstr > value) {
- *cstr = '\0';
- minutes = (int) atof (nval);
- *cstr = ':';
- nval = cstr + 1;
- seconds = atof (nval);
- }
- else {
- minutes = (int) atof (nval);
- seconds = 0.0;
- }
- }
- fday = ((3.6e3 * (double)hours) + (6.e1 * (double)minutes) +
- seconds) / 8.64e4;
- *dval = *dval + (fday / yeardays);
- }
- return (1);
- }
- else
- return (0);
- }
- else
- return (0);
-}
-
-
-/* Extract IRAF multiple-keyword string value from FITS header string */
-
-int
-hgetm (hstring, keyword, lstr, str)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the root name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const int lstr; /* Size of str in characters */
-char *str; /* String (returned) */
-{
- char *value;
- char *stri;
- char keywordi[16];
- int lval, lstri, ikey;
- char keyform[8];
-
- stri = str;
- lstri = lstr;
-
- sprintf (keywordi, "%s_1", keyword);
- if (ksearch (hstring, keywordi))
- strcpy (keyform, "%s_%d");
- else {
- sprintf (keywordi, "%s_01", keyword);
- if (ksearch (hstring, keywordi))
- strcpy (keyform, "%s_%02d");
- else {
- sprintf (keywordi, "%s_001", keyword);
- if (ksearch (hstring, keywordi))
- strcpy (keyform, "%s_%03d");
- else if (ksearch (hstring, keywordi))
- strcpy (keyform, "%s_%03d");
- else
- return (0);
- }
- }
-
- /* Loop through sequentially-named keywords */
- multiline = 1;
- for (ikey = 1; ikey < 500; ikey++) {
- sprintf (keywordi, keyform, keyword, ikey);
-
- /* Get value for this keyword */
- value = hgetc (hstring, keywordi);
- if (value != NULL) {
- lval = strlen (value);
- if (lval < lstri)
- strcpy (stri, value);
- else if (lstri > 1) {
- strncpy (stri, value, lstri-1);
- stri[lstri] = (char) 0;
- break;
- }
- else {
- str[0] = value[0];
- break;
- }
- }
- else
- break;
- stri = stri + lval;
- lstri = lstri - lval;
- }
- multiline = 0;
-
- /* Return 1 if any keyword found, else 0 */
- if (ikey > 1)
- return (1);
- else
- return (0);
-}
-
-
-/* Extract string value for variable from FITS header string */
-
-int
-hgetsc (hstring,keyword,wchar,lstr,str)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for
- a line beginning with this string. if "[n]" is
- present, the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const char *wchar; /* Character of multiple WCS header; =0 if unused */
-const int lstr; /* Size of str in characters */
-char *str; /* String (returned) */
-{
- char keyword1[16];
- int lkey;
-
- if (wchar[0] < (char) 64)
- return (hgets (hstring, keyword, lstr, str));
- else {
- strcpy (keyword1, keyword);
- lkey = strlen (keyword);
- keyword1[lkey] = wchar[0];
- keyword1[lkey+1] = (char) 0;
- return (hgets (hstring, keyword1, lstr, str));
- }
-}
-
-
-/* Extract string value for variable from FITS header string */
-
-int
-hgets (hstring, keyword, lstr, str)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const int lstr; /* Size of str in characters */
-char *str; /* String (returned) */
-{
- char *value;
- int lval;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- if (value != NULL) {
- lval = strlen (value);
- if (lval < lstr)
- strcpy (str, value);
- else if (lstr > 1)
- strncpy (str, value, lstr-1);
- else
- str[0] = value[0];
- return (1);
- }
- else
- return (0);
-}
-
-
-/* Extract number of decimal places for value in FITS header string */
-
-int
-hgetndec (hstring, keyword, ndec)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-int *ndec; /* Number of decimal places in keyword value */
-{
- char *value;
- int i, nchar;
-
- /* Get value and comment from header string */
- value = hgetc (hstring,keyword);
-
- /* Find end of string and count backward to decimal point */
- *ndec = 0;
- if (value != NULL) {
- nchar = strlen (value);
- for (i = nchar-1; i >= 0; i--) {
- if (value[i] == '.')
- return (1);
- *ndec = *ndec + 1;
- }
- return (1);
- }
- else
- return (0);
-}
-
-
-/* Extract character value for variable from FITS header string */
-
-char *
-hgetc (hstring,keyword0)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword0; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-{
- static char cval[80];
- char *value;
- char cwhite[2];
- char squot[2], dquot[2], lbracket[2], rbracket[2], slash[2], comma[2];
- char space;
- char keyword[81]; /* large for ESO hierarchical keywords */
- char line[100];
- char *vpos, *cpar;
- char *q1, *q2, *v1, *v2, *c1, *brack1, *brack2;
- int ipar, i, lkey;
-
-#ifdef USE_SAOLIB
- int iel=1, ip=1, nel, np, ier;
- char *get_fits_head_str();
-
- if( !use_saolib ){
-#endif
-
- squot[0] = (char) 39;
- squot[1] = (char) 0;
- dquot[0] = (char) 34;
- dquot[1] = (char) 0;
- lbracket[0] = (char) 91;
- lbracket[1] = (char) 0;
- comma[0] = (char) 44;
- comma[1] = (char) 0;
- rbracket[0] = (char) 93;
- rbracket[1] = (char) 0;
- slash[0] = (char) 47;
- slash[1] = (char) 0;
- space = (char) 32;
-
- /* Find length of variable name */
- strncpy (keyword,keyword0, sizeof(keyword)-1);
- brack1 = strsrch (keyword,lbracket);
- if (brack1 == NULL)
- brack1 = strsrch (keyword,comma);
- if (brack1 != NULL) {
- *brack1 = '\0';
- brack1++;
- }
-
- /* Search header string for variable name */
- vpos = ksearch (hstring,keyword);
-
- /* Exit if not found */
- if (vpos == NULL)
- return (NULL);
-
- /* Initialize line to nulls */
- for (i = 0; i < 100; i++)
- line[i] = 0;
-
-/* In standard FITS, data lasts until 80th character */
-
- /* Extract entry for this variable from the header */
- strncpy (line,vpos,80);
-
- /* Check for quoted value */
- q1 = strsrch (line,squot);
- c1 = strsrch (line,slash);
- if (q1 != NULL) {
- if (c1 != NULL && q1 < c1) {
- q2 = strsrch (q1+1,squot);
- if (q2 == NULL) {
- q2 = c1 - 1;
- while (*q2 == space)
- q2--;
- q2++;
- }
- else if (c1 < q2)
- c1 = strsrch (q2,slash);
- }
- else if (c1 == NULL) {
- q2 = strsrch (q1+1,squot);
- if (q2 == NULL) {
- q2 = line + 79;
- while (*q2 == space)
- q2--;
- q2++;
- }
- }
- else
- q1 = NULL;
- }
- else {
- q1 = strsrch (line,dquot);
- if (q1 != NULL) {
- if (c1 != NULL && q1 < c1) {
- q2 = strsrch (q1+1,dquot);
- if (q2 == NULL) {
- q2 = c1 - 1;
- while (*q2 == space)
- q2--;
- q2++;
- }
- else if (c1 < q2)
- c1 = strsrch (q2,slash);
- }
- else if (c1 == NULL) {
- q2 = strsrch (q1+1,dquot);
- if (q2 == NULL) {
- q2 = line + 79;
- while (*q2 == space)
- q2--;
- q2++;
- }
- }
- else
- q1 = NULL;
- }
- else {
- q1 = NULL;
- q2 = line + 10;
- }
- }
-
- /* Extract value and remove excess spaces */
- if (q1 != NULL) {
- v1 = q1 + 1;
- v2 = q2;
- }
- else {
- v1 = strsrch (line,"=");
- if (v1 == NULL)
- v1 = line + 9;
- else
- v1 = v1 + 1;
- c1 = strsrch (line,"/");
- if (c1 != NULL)
- v2 = c1;
- else
- v2 = line + 79;
- }
-
- /* Ignore leading spaces if not multiline */
- if (!multiline) {
- while (*v1 == ' ' && v1 < v2) {
- v1++;
- }
- }
-
- /* Drop trailing spaces */
- *v2 = '\0';
- if (!multiline) {
- v2--;
- while ((*v2 == ' ' || *v2 == (char) 13) && v2 > v1) {
- *v2 = '\0';
- v2--;
- }
- }
-
- /* Convert -zero to just plain 0 */
- if (!strcmp (v1, "-0"))
- v1++;
- strcpy (cval,v1);
- value = cval;
-
- /* If keyword has brackets, extract appropriate token from value */
- if (brack1 != NULL) {
- brack2 = strsrch (brack1,rbracket);
- if (brack2 != NULL)
- *brack2 = '\0';
- if (isnum (brack1)) {
- ipar = atoi (brack1);
- cwhite[0] = ' ';
- cwhite[1] = '\0';
- if (ipar > 0) {
- for (i = 1; i <= ipar; i++) {
- cpar = strtok (v1,cwhite);
- v1 = NULL;
- }
- if (cpar != NULL) {
- strcpy (cval,cpar);
- value = cval;
- }
- else
- value = NULL;
- }
-
- /* If token counter is negative, include rest of value */
- else if (ipar < 0) {
- for (i = 1; i < -ipar; i++) {
- v1 = strchr (v1, ' ');
- if (v1 == NULL)
- break;
- else
- v1 = v1 + 1;
- }
- if (v1 != NULL) {
- strcpy (cval, v1);
- value = cval;
- }
- else
- value = NULL;
- }
- }
- else {
- lkey = strlen (brack1);
- for (i = 0; i < lkey; i++) {
- if (brack1[i] > 64 && brack1[i] < 91)
- brack1[i] = brack1[i] + 32;
- }
- v1 = igetc (cval, brack1);
- if (v1) {
- strcpy (cval,v1);
- value = cval;
- }
- else
- value = NULL;
- }
- }
-
- return (value);
-#ifdef USE_SAOLIB
- } else {
- return(get_fits_head_str(keyword0, iel, ip, &nel, &np, &ier, hstring));
- }
-#endif
-}
-
-
-/* Find beginning of fillable blank line before FITS header keyword line */
-
-char *
-blsearch (hstring,keyword)
-
-/* Find entry for keyword keyword in FITS header string hstring.
- (the keyword may have a maximum of eight letters)
- NULL is returned if the keyword is not found */
-
-const char *hstring; /* character string containing fits-style header
- information in the format <keyword>= <value> {/ <comment>}
- the default is that each entry is 80 characters long;
- however, lines may be of arbitrary length terminated by
- nulls, carriage returns or linefeeds, if packed is true. */
-const char *keyword; /* character string containing the name of the variable
- to be returned. ksearch searches for a line beginning
- with this string. The string may be a character
- literal or a character variable terminated by a null
- or '$'. it is truncated to 8 characters. */
-{
- const char *headlast;
- char *loc, *headnext, *pval, *lc, *line;
- char *bval;
- int icol, nextchar, lkey, nleft, lhstr;
-
- pval = 0;
-
- /* Search header string for variable name */
- if (lhead0)
- lhstr = lhead0;
- else {
- lhstr = 0;
- while (lhstr < 256000 && hstring[lhstr] != 0)
- lhstr++;
- }
- headlast = hstring + lhstr;
- headnext = (char *) hstring;
- pval = NULL;
- while (headnext < headlast) {
- nleft = headlast - headnext;
- loc = strncsrch (headnext, keyword, nleft);
-
- /* Exit if keyword is not found */
- if (loc == NULL) {
- break;
- }
-
- icol = (loc - hstring) % 80;
- lkey = strlen (keyword);
- nextchar = (int) *(loc + lkey);
-
- /* If this is not in the first 8 characters of a line, keep searching */
- if (icol > 7)
- headnext = loc + 1;
-
- /* If parameter name in header is longer, keep searching */
- else if (nextchar != 61 && nextchar > 32 && nextchar < 127)
- headnext = loc + 1;
-
- /* If preceeding characters in line are not blanks, keep searching */
- else {
- line = loc - icol;
- for (lc = line; lc < loc; lc++) {
- if (*lc != ' ')
- headnext = loc + 1;
- }
-
- /* Return pointer to start of line if match */
- if (loc >= headnext) {
- pval = line;
- break;
- }
- }
- }
-
- /* Return NULL to calling program if keyword is not found */
- if (pval == NULL)
- return (pval);
-
- /* Return NULL if keyword is found at start of FITS header string */
- if (pval == hstring)
- return (NULL);
-
- /* Find last nonblank in FITS header string line before requested keyword */
- bval = pval - 80;
- while (!strncmp (bval," ",8) && bval >= hstring)
- bval = bval - 80;
- bval = bval + 80;
-
- /* Return pointer to calling program if blank lines found */
- if (bval < pval && bval >= hstring)
- return (bval);
- else
- return (NULL);
-}
-
-
-/* Find FITS header line containing specified keyword */
-
-char *
-ksearch (hstring,keyword)
-
-/* Find entry for keyword keyword in FITS header string hstring.
- (the keyword may have a maximum of eight letters)
- NULL is returned if the keyword is not found */
-
-const char *hstring; /* character string containing fits-style header
- information in the format <keyword>= <value> {/ <comment>}
- the default is that each entry is 80 characters long;
- however, lines may be of arbitrary length terminated by
- nulls, carriage returns or linefeeds, if packed is true. */
-const char *keyword; /* character string containing the name of the variable
- to be returned. ksearch searches for a line beginning
- with this string. The string may be a character
- literal or a character variable terminated by a null
- or '$'. it is truncated to 8 characters. */
-{
- const char *headlast;
- char *loc, *headnext, *pval, *lc, *line;
- int icol, nextchar, lkey, nleft, lhead, lmax;
-
-#ifdef USE_SAOLIB
- int iel=1, ip=1, nel, np, ier;
- char *get_fits_head_str();
-
- if( !use_saolib ){
-#endif
-
- pval = 0;
-
-/* Find current length of header string */
- if (lhead0)
- lmax = lhead0;
- else
- lmax = 256000;
- for (lhead = 0; lhead < lmax; lhead++) {
- if (hstring[lhead] <= (char) 0)
- break;
- }
-
-/* Search header string for variable name */
- headlast = hstring + lhead;
- headnext = (char *) hstring;
- pval = NULL;
- while (headnext < headlast) {
- nleft = headlast - headnext;
- loc = strncsrch (headnext, keyword, nleft);
-
- /* Exit if keyword is not found */
- if (loc == NULL) {
- break;
- }
-
- icol = (loc - hstring) % 80;
- lkey = strlen (keyword);
- nextchar = (int) *(loc + lkey);
-
- /* If this is not in the first 8 characters of a line, keep searching */
- if (icol > 7)
- headnext = loc + 1;
-
- /* If parameter name in header is longer, keep searching */
- else if (nextchar != 61 && nextchar > 32 && nextchar < 127)
- headnext = loc + 1;
-
- /* If preceeding characters in line are not blanks, keep searching */
- else {
- line = loc - icol;
- for (lc = line; lc < loc; lc++) {
- if (*lc != ' ')
- headnext = loc + 1;
- }
-
- /* Return pointer to start of line if match */
- if (loc >= headnext) {
- pval = line;
- break;
- }
- }
- }
-
-/* Return pointer to calling program */
- return (pval);
-
-#ifdef USE_SAOLIB
- }
- else {
- if (get_fits_head_str(keyword,iel,ip,&nel,&np,&ier,hstring) != NULL)
- return(hstring);
- else
- return(NULL);
- }
-#endif
-}
-
-
-/* Return the right ascension in degrees from sexagesimal hours or decimal degrees */
-
-double
-str2ra (in)
-
-const char *in; /* Character string of sexigesimal hours or decimal degrees */
-
-{
- double ra; /* Right ascension in degrees (returned) */
-
- ra = str2dec (in);
- if (strsrch (in,":"))
- ra = ra * 15.0;
-
- return (ra);
-}
-
-
-/* Return the declination in degrees from sexagesimal or decimal degrees */
-
-double
-str2dec (in)
-
-const char *in; /* Character string of sexigesimal or decimal degrees */
-
-{
- double dec; /* Declination in degrees (returned) */
- double deg, min, sec, sign;
- char *value, *c1, *c2;
- int lval;
- char *dchar;
-
- dec = 0.0;
-
- /* Return 0.0 if string is null */
- if (in == NULL)
- return (dec);
-
- /* Translate value from ASCII colon-delimited string to binary */
- if (in[0]) {
- value = (char *) in;
-
- /* Remove leading spaces */
- while (*value == ' ')
- value++;
-
- /* Save sign */
- if (*value == '-') {
- sign = -1.0;
- value++;
- }
- else if (*value == '+') {
- sign = 1.0;
- value++;
- }
- else
- sign = 1.0;
-
- /* Turn comma into space */
- if ((c1 = strsrch (value,",")) != NULL)
- *c1 = ' ';
-
- /* Remove trailing spaces */
- lval = strlen (value);
- while (value[lval-1] == ' ')
- lval--;
-
- if ((c1 = strsrch (value,":")) == NULL)
- c1 = strnsrch (value," ",lval);
- if (c1 != NULL) {
- *c1 = 0;
- deg = (double) atoi (value);
- *c1 = ':';
- value = c1 + 1;
- if ((c2 = strsrch (value,":")) == NULL)
- c2 = strsrch (value," ");
- if (c2 != NULL) {
- *c2 = 0;
- min = (double) atoi (value);
- *c2 = ':';
- value = c2 + 1;
- sec = atof (value);
- }
- else {
- sec = 0.0;
- if ((c1 = strsrch (value,".")) != NULL)
- min = atof (value);
- if (strlen (value) > 0)
- min = (double) atoi (value);
- }
- dec = sign * (deg + (min / 60.0) + (sec / 3600.0));
- }
- else if (isnum (value) == 2) {
- if ((dchar = strchr (value, 'D')))
- *dchar = 'e';
- if ((dchar = strchr (value, 'd')))
- *dchar = 'e';
- if ((dchar = strchr (value, 'E')))
- *dchar = 'e';
- dec = sign * atof (value);
- }
- else
- dec = sign * (double) atoi (value);
- }
- return (dec);
-}
-
-
-/* Find string s2 within null-terminated string s1 */
-
-char *
-strsrch (s1, s2)
-
-const char *s1; /* String to search */
-const char *s2; /* String to look for */
-
-{
- int ls1;
- ls1 = strlen (s1);
- return (strnsrch (s1, s2, ls1));
-}
-
-
-/* Find string s2 within string s1 */
-
-char *
-strnsrch (s1, s2, ls1)
-
-const char *s1; /* String to search */
-const char *s2; /* String to look for */
-const int ls1; /* Length of string being searched */
-
-{
- char *s,*s1e;
- char cfirst,clast;
- int i,ls2;
-
- /* Return null string if either pointer is NULL */
- if (s1 == NULL || s2 == NULL)
- return (NULL);
-
- /* A zero-length pattern is found in any string */
- ls2 = strlen (s2);
- if (ls2 ==0)
- return ((char *) s1);
-
- /* Only a zero-length string can be found in a zero-length string */
- if (ls1 ==0)
- return (NULL);
-
- cfirst = (char) s2[0];
- clast = (char) s2[ls2-1];
- s1e = (char *) s1 + (int) ls1 - ls2 + 1;
- s = (char *) s1;
- while (s < s1e) {
-
- /* Search for first character in pattern string */
- if (*s == cfirst) {
-
- /* If single character search, return */
- if (ls2 == 1)
- return (s);
-
- /* Search for last character in pattern string if first found */
- if (s[ls2-1] == clast) {
-
- /* If two-character search, return */
- if (ls2 == 2)
- return (s);
-
- /* If 3 or more characters, check for rest of search string */
- i = 1;
- while (i < ls2 && s[i] == s2[i])
- i++;
-
- /* If entire string matches, return */
- if (i >= ls2)
- return (s);
- }
- }
- s++;
- }
- return (NULL);
-}
-
-
-/* Find string s2 within null-terminated string s1 (case-free search) */
-
-char *
-strcsrch (s1, s2)
-
-const char *s1; /* String to search */
-const char *s2; /* String to look for */
-
-{
- int ls1;
- ls1 = strlen ((char *) s1);
- return (strncsrch (s1, s2, ls1));
-}
-
-
-/* Find string s2 within string s1 (case-free search) */
-
-char *
-strncsrch (s1, s2, ls1)
-
-const char *s1; /* String to search */
-const char *s2; /* String to look for */
-const int ls1; /* Length of string being searched */
-
-{
- char *s,*s1e, sl, *os2;
- char cfirst,ocfirst;
- char clast = ' ';
- char oclast = ' ';
- int i,ls2;
-
- /* Return null string if either pointer is NULL */
- if (s1 == NULL || s2 == NULL)
- return (NULL);
-
- /* A zero-length pattern is found in any string */
- ls2 = strlen (s2);
- if (ls2 ==0)
- return ((char *) s1);
-
- /* Only a zero-length string can be found in a zero-length string */
- os2 = NULL;
- if (ls1 ==0)
- return (NULL);
-
- /* For one or two characters, set opposite case first and last letters */
- if (ls2 < 3) {
- cfirst = (char) s2[0];
- if (cfirst > 96 && cfirst < 123)
- ocfirst = cfirst - 32;
- else if (cfirst > 64 && cfirst < 91)
- ocfirst = cfirst + 32;
- else
- ocfirst = cfirst;
- if (ls2 > 1) {
- clast = s2[1];
- if (clast > 96 && clast < 123)
- oclast = clast - 32;
- else if (clast > 64 && clast < 91)
- oclast = clast + 32;
- else
- oclast = clast;
- }
- }
-
- /* Else duplicate string with opposite case letters for comparison */
- else {
- os2 = (char *) calloc (ls2, 1);
- for (i = 0; i < ls2; i++) {
- if (s2[i] > 96 && s2[i] < 123)
- os2[i] = s2[i] - 32;
- else if (s2[i] > 64 && s2[i] < 91)
- os2[i] = s2[i] + 32;
- else
- os2[i] = s2[i];
- }
- cfirst = s2[0];
- ocfirst = os2[0];
- clast = s2[ls2-1];
- oclast = os2[ls2-1];
- }
-
- /* Loop through input string, character by character */
- s = (char *) s1;
- s1e = s + (int) ls1 - ls2 + 1;
- while (s < s1e) {
-
- /* Search for first character in pattern string */
- if (*s == cfirst || *s == ocfirst) {
-
- /* If single character search, return */
- if (ls2 == 1) {
- if (os2 != NULL)
- free (os2);
- return (s);
- }
-
- /* Search for last character in pattern string if first found */
- sl = s[ls2-1];
- if (sl == clast || sl == oclast) {
-
- /* If two-character search, return */
- if (ls2 == 2) {
- if (os2 != NULL)
- free (os2);
- return (s);
- }
-
- /* If 3 or more characters, check for rest of search string */
- i = 1;
- while (i < ls2 && (s[i] == (char) s2[i] || s[i] == os2[i]))
- i++;
-
- /* If entire string matches, return */
- if (i >= ls2) {
- if (os2 != NULL)
- free (os2);
- return (s);
- }
- }
- }
- s++;
- }
- if (os2 != NULL)
- free (os2);
- return (NULL);
-}
-
-
-int
-notnum (string)
-
-const char *string; /* Character string */
-{
- if (isnum (string))
- return (0);
- else
- return (1);
-}
-
-
-/* ISNUM-- Return 1 if string is an integer number,
- 2 if floating point,
- 3 if sexigesimal, with or without decimal point
- else 0
- */
-
-int
-isnum (string)
-
-const char *string; /* Character string */
-{
- int lstr, i, nd, cl;
- char cstr, cstr1;
- int fpcode;
-
- /* Return 0 if string is NULL */
- if (string == NULL)
- return (0);
-
- lstr = strlen (string);
- nd = 0;
- cl = 0;
- fpcode = 1;
-
- /* Return 0 if string starts with a D or E */
- cstr = string[0];
- if (cstr == 'D' || cstr == 'd' ||
- cstr == 'E' || cstr == 'e') {
- return (0);
- }
-
- /* Remove trailing spaces */
- while (string[lstr-1] == ' ')
- lstr--;
-
- /* Numeric strings contain 0123456789-+ and d or e for exponents */
- for (i = 0; i < lstr; i++) {
- cstr = string[i];
- if (cstr == '\n')
- break;
-
- /* Ignore leading spaces */
- if (cstr == ' ' && nd == 0)
- continue;
-
- if ((cstr < 48 || cstr > 57) &&
- cstr != '+' && cstr != '-' &&
- cstr != 'D' && cstr != 'd' &&
- cstr != 'E' && cstr != 'e' &&
- cstr != ':' && cstr != '.')
- return (0);
- else if (cstr == '+' || cstr == '-') {
- if (string[i+1] == '-' || string[i+1] == '+')
- return (0);
- else if (i > 0) {
- cstr1 = string[i-1];
- if (cstr1 != 'D' && cstr1 != 'd' &&
- cstr1 != 'E' && cstr1 != 'e' &&
- cstr1 != ':' && cstr1 != ' ')
- return (0);
- }
- }
- else if (cstr >= 47 && cstr <= 57)
- nd++;
-
- /* Check for colon */
- else if (cstr == 58)
- cl++;
- if (cstr=='.' || cstr=='d' || cstr=='e' || cstr=='d' || cstr=='e')
- fpcode = 2;
- }
- if (nd > 0) {
- if (cl)
- fpcode = 3;
- return (fpcode);
- }
- else
- return (0);
-}
-
-
-/* NUMDEC -- Return number of decimal places in numeric string (-1 if not number) */
-
-int
-numdec (string)
-
-const char *string; /* Numeric string */
-{
- char *cdot;
- int lstr;
-
- if (notnum (string) && !strchr (string, ':'))
- return (-1);
- else {
- lstr = strlen (string);
- if ((cdot = strchr (string, '.')) == NULL)
- return (0);
- else
- return (lstr - (cdot - string) - 1);
- }
-}
-
-
-#ifdef USE_SAOLIB
-int set_saolib(hstring)
- void *hstring;
-{
- if( *((int *)hstring) == 142857 )
- use_saolib = 1;
- else
- use_saolib = 0;
-}
-
-#endif
-
-
-/* Remove exponent, leading #, surrounding parentheses,
- and/or trailing zeroes, if reasonable */
-void
-strfix (string, fillblank, dropzero)
-
-char *string; /* String to modify */
-int fillblank; /* If nonzero, fill blanks with underscores */
-int dropzero; /* If nonzero, drop trailing zeroes */
-{
- char *sdot, *s, *strend, *str, ctemp, *slast;
- int ndek, lstr, i;
-
- /* If number, ignore leading # and remove trailing non-numeric character */
- if (string[0] == '#') {
- strend = string + strlen (string);
- str = string + 1;
- strend = str + strlen (str) - 1;
- ctemp = *strend;
- if (!isnum (strend))
- *strend = (char) 0;
- if (isnum (str)) {
- strend = string + strlen (string);
- for (str = string; str < strend; str++)
- *str = *(str + 1);
- }
- else
- *strend = ctemp;
- }
-
- /* Remove parentheses if they enclose the string */
- if (string[0] == '(') {
- lstr = strlen (string);
- if (string[lstr-1] == ')') {
- string[lstr-1] = (char) 0;
- strend = string + lstr - 1;
- for (str = string; str < strend; str++)
- *str = *(str+1);
- string[lstr-2] = (char) 0;
- }
- }
-
- /* Remove positive exponent if there are enough digits given */
- if (isnum (string) > 1 && strsrch (string, "E+") != NULL) {
- lstr = strlen (string);
- ndek = (int) (string[lstr-1] - 48);
- ndek = ndek + (10 * ((int) (string[lstr-2] - 48)));
- if (ndek < lstr - 7) {
- lstr = lstr - 4;
- string[lstr] = (char) 0;
- string[lstr+1] = (char) 0;
- string[lstr+2] = (char) 0;
- string[lstr+3] = (char) 0;
- sdot = strchr (string, '.');
- if (ndek > 0 && sdot != NULL) {
- for (i = 1; i <= ndek; i++) {
- *sdot = *(sdot+1);
- sdot++;
- *sdot = '.';
- }
- }
- }
- }
-
- /* Remove trailing zeroes if they are not significant */
- if (dropzero) {
- if (isnum (string) > 1 && strchr (string, '.') != NULL &&
- strsrch (string, "E-") == NULL &&
- strsrch (string, "E+") == NULL &&
- strsrch (string, "e-") == NULL &&
- strsrch (string, "e+") == NULL) {
- lstr = strlen (string);
- s = string + lstr - 1;
- while (*s == '0' && lstr > 1) {
- if (*(s - 1) != '.') {
- *s = (char) 0;
- lstr --;
- }
- s--;
- }
- }
- }
-
- /* Remove trailing decimal point */
- lstr = strlen (string);
- s = string + lstr - 1;
- if (*s == '.')
- *s = (char) 0;
-
- /* Replace embedded blanks with underscores, if requested to */
- if (fillblank) {
- lstr = strlen (string);
- slast = string + lstr;
- for (s = string; s < slast; s++) {
- if (*s == ' ') *s = '_';
- }
- }
-
- return;
-
-}
-
-/* Oct 28 1994 New program
- *
- * Mar 1 1995 Search for / after second quote, not first one
- * May 2 1995 Initialize line in HGETC; deal with logicals in HGETL better
- * May 4 1995 Declare STRSRCH in KSEARCH
- * Aug 7 1995 Fix line initialization in HGETC
- * Dec 22 1995 Add HGETRA and HGETDEC to get degrees from xx:xx:xx.xxx string
- *
- * Jan 26 1996 Fix HGETL to not crash when parameter is not present
- * Feb 1 1996 Fix HGETC to deal with quotes correctly
- * Feb 1 1996 Fix HGETDEG to deal with sign correctly
- * Feb 6 1996 Add HGETS to update character strings
- * Feb 8 1996 Fix STRSRCH to find final characters in string
- * Feb 23 1996 Add string to degree conversions
- * Apr 26 1996 Add HGETDATE to get fractional year from date string
- * May 22 1996 Fix documentation; return double from STR2RA and STR2DEC
- * May 28 1996 Fix string translation of RA and Dec when no seconds
- * Jun 10 1996 Remove unused variables after running lint
- * Jun 17 1996 Fix bug which failed to return single character strings
- * Jul 1 1996 Skip sign when reading declination after testing for it
- * Jul 19 1996 Do not divide by 15 if RA header value is already in degrees
- * Aug 5 1996 Add STRNSRCH to search strings which are not null-terminated
- * Aug 6 1996 Make minor changes after lint
- * Aug 8 1996 Fix ksearch bug which finds wrong keywords
- * Aug 13 1996 Fix sign bug in STR2DEC for degrees
- * Aug 26 1996 Drop unused variables ICOL0, NLINE, PREVCHAR from KSEARCH
- * Sep 10 1996 Fix header length setting code
- * Oct 15 1996 Clean up loops and fix ICOL assignment
- * Nov 13 1996 Handle integer degrees correctly in STR2DEC
- * Nov 21 1996 Make changes for Linux thanks to Sidik Isani
- * Dec 12 1996 Add ISNUM to check to see whether strings are numbers
- *
- * Jan 22 1997 Add ifdefs for Eric Mandel (SAOtng)
- * Jan 27 1997 Convert to integer through ATOF so exponents are recognized
- * Jul 25 1997 Implement FITS version of ISO date format
- *
- * Feb 24 1998 Implement code to return IRAF multiple-keyword strings
- * Mar 12 1998 Add subroutine NOTNUM
- * Mar 27 1998 Add changes to match SKYCAT version
- * Apr 30 1998 Add BLSEARCH() to find blank lines before END
- * May 27 1998 Add HGETNDEC() to get number of decimal places in entry
- * Jun 1 1998 Add VMS patch from Harry Payne at StSci
- * Jun 18 1998 Fix code which extracts tokens from string values
- * Jul 21 1998 Drop minus sign for values of -0
- * Sep 29 1998 Treat hyphen-separated date as old format if 2-digit year
- * Oct 7 1998 Clean up search for last blank line
- *
- * Apr 5 1999 Check lengths of strings before copying them
- * May 5 1999 values.h -> POSIX limits.h: MAXINT->INT_MAX, MAXSHORT->SHRT_MAX
- * Jul 15 1999 Add hgetm() options of 1- or 2-digit keyword extensions
- * Oct 6 1999 Add gethlength() to return header length
- * Oct 14 1999 In ksearch(), search only to null not to end of buffer
- * Oct 15 1999 Return 1 from hgetndec() if successful
- * Oct 20 1999 Drop unused variable after lint (val in hgetndec)
- * Dec 3 1999 Fix isnum() to reject strings starting with a d or e
- * Dec 20 1999 Update hgetdate() to get minutes and seconds right
- *
- * Feb 10 2000 Parse RA and Dec with spaces as well as colons as separators
- * Feb 11 2000 Add null at end of multi-line keyword value character string
- * Feb 25 2000 Change max search string length from 57600 to 256000
- * Mar 15 2000 Deal with missing second quotes in string values
- * Mar 17 2000 Return 2 from isnum() if number is floating point (.de)
- * Mar 17 2000 Ignore leading # for numeric values in header
- * Mar 21 2000 Implement -n to get string value starting with nth token
- * Apr 5 2000 Reject +- in isnum()
- * Jun 9 2000 Read keyword values even if no equal sign is present
- * Sep 20 2000 Ignore linefeed at end of number in isnum()
- * Oct 23 2000 Fix handling of embedded + or - in isnum()
- *
- * Jan 19 2000 Return 0 from isnum(), str2ra(), and str2dec() if string is null
- * Mar 30 2001 Fix header length finding algorithm in ksearch()
- * Jul 13 2001 Make val[] static int instead of int; drop unused variables
- * Sep 12 2001 Read yyyy/mm/dd dates as well as dd/mm/yyyy
- * Sep 20 2001 Ignore leading spaces in str2dec()
- * Sep 20 2001 Ignore trailing spaces in isnum()
- *
- * Apr 3 2002 Add hgetr8c(), hgeti4c(), and hgetsc() for multiple WCS handling
- * Apr 26 2002 Fix bug in hgetsc(), hgeti4c(), and hgetr8c() found by Bill Joye
- * Jun 26 2002 Do not drop leading or trailing spaces in multi-line values
- * Aug 6 2002 Add strcsrch() and strncsrch() for case-insensitive searches
- * Aug 30 2002 Fix bug so strcsrch() really is case-insensitive
- * Oct 20 2003 Add numdec() to return number of decimal places in a string
- * Dec 9 2003 Fix numdec() to return 0 if no digits after decimal point
- *
- * Feb 26 2004 Extract value from keyword=value strings within a keyword value
- * Apr 9 2004 Use strncsrch() in ksearch() to find differently-cased keywords
- * Apr 28 2004 Free os2 in strncsrch() only if it is allocated
- * Jul 13 2004 Accept D, d, E, or e as exponent delimiter in floating points
- * Aug 30 2004 Change numdec() to accept sexigesimal numbers (:'s)
- *
- * Jun 27 2005 Drop unused variables
- * Aug 30 2005 Adjust code in hlength()
- *
- * Jun 20 2006 Initialize uninitialized variables in strnsrch()
- * Jun 29 2006 Add new subroutine strfix() to clean strings for other uses
- * Jul 13 2006 Increase maximum number of multiline keywords from 20 to 500
- *
- * Jan 4 2007 Declare header, keyword to be const
- * Jan 4 2007 Change WCS letter from char to char*
- * Feb 28 2007 If header length is not set in hlength, set it to 0
- * May 31 2007 Add return value of 3 to isnum() if string has colon(s)
- * Aug 22 2007 If closing quote not found, make one up
- *
- * Nov 12 2009 In strfix(), if drop enclosing parantheses
- *
- * Apr 19 2011 In str2dec(), change comma to space
- * May 19 2011 In strncsrch() always free allocated memory before returning
- */
diff --git a/funtools/wcs/hput.c b/funtools/wcs/hput.c
deleted file mode 100644
index 7ec81ab..0000000
--- a/funtools/wcs/hput.c
+++ /dev/null
@@ -1,1316 +0,0 @@
-/*** File libwcs/hput.c
- *** September 9, 2011
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1995-2011
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: hput.c (Put FITS Header parameter values)
- * Purpose: Implant values for parameters into FITS header string
- * Subroutine: hputi4 (hstring,keyword,ival) sets int ival
- * Subroutine: hputr4 (hstring,keyword,rval) sets real*4 rval
- * Subroutine: hputr8 (hstring,keyword,dval) sets real*8 dval
- * Subroutine: hputnr8 (hstring,keyword,ndec,dval) sets real*8 dval
- * Subroutine: hputra (hstring,keyword,lval) sets right ascension as string
- * Subroutine: hputdec (hstring,keyword,lval) sets declination as string
- * Subroutine: hputl (hstring,keyword,lval) sets logical lval
- * Subroutine: hputs (hstring,keyword,cval) sets character string adding ''
- * Subroutine: hputm (hstring,keyword,cval) sets multi-line character string
- * Subroutine: hputc (hstring,keyword,cval) sets character string cval
- * Subroutine: hdel (hstring,keyword) deletes entry for keyword keyword
- * Subroutine: hadd (hplace,keyword) adds entry for keyword at hplace
- * Subroutine: hchange (hstring,keyword1,keyword2) changes keyword for entry
- * Subroutine: hputcom (hstring,keyword,comment) sets comment for parameter keyword
- * Subroutine: ra2str (out, lstr, ra, ndec) converts RA from degrees to string
- * Subroutine: dec2str (out, lstr, dec, ndec) converts Dec from degrees to string
- * Subroutine: deg2str (out, lstr, deg, ndec) converts degrees to string
- * Subroutine: num2str (out, num, field, ndec) converts number to string
- * Subroutine: getltime () returns current local time as ISO-style string
- * Subroutine: getutime () returns current UT as ISO-style string
- */
-#include <sys/time.h>
-#include <string.h> /* NULL, strlen, strstr, strcpy */
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include "fitshead.h"
-
-static int verbose=0; /* Set to 1 to print error messages and other info */
-
-static void fixnegzero();
-
-
-/* HPUTI4 - Set int keyword = ival in FITS header string */
-
-int
-hputi4 (hstring,keyword,ival)
-
-char *hstring; /* FITS-style header information in the format
- <keyword>= <value> {/ <comment>}
- each entry is padded with spaces to 80 characters */
-
-const char *keyword; /* Name of the variable in header to be returned.
- If no line begins with this string, one is created.
- The first 8 characters of keyword must be unique. */
-int ival; /* int number */
-{
- char value[30];
-
- /* Translate value from binary to ASCII */
- sprintf (value,"%d",ival);
-
- /* Put value into header string */
- return (hputc (hstring,keyword,value));
-}
-
-
-/* HPUTR4 - Set float keyword = rval in FITS header string */
-
-int
-hputr4 (hstring, keyword, rval)
-
-char *hstring; /* FITS header string */
-const char *keyword; /* Keyword name */
-const float *rval; /* float number */
-
-{
- char value[30];
-
- /* Translate value from binary to ASCII */
- sprintf (value, "%f", *rval);
-
- /* Remove sign if string is -0 or extension thereof */
- fixnegzero (value);
-
- /* Put value into header string */
- return (hputc (hstring, keyword, value));
-}
-
-
-/* HPUTR8 - Set double keyword = dval in FITS header string */
-
-int
-hputr8 (hstring, keyword, dval)
-
-char *hstring; /* FITS header string */
-const char *keyword; /* Keyword name */
-const double dval; /* double number */
-{
- char value[30];
-
- /* Translate value from binary to ASCII */
- sprintf (value, "%g", dval);
-
- /* Remove sign if string is -0 or extension thereof */
- fixnegzero (value);
-
- /* Put value into header string */
- return (hputc (hstring, keyword, value));
-}
-
-
-/* HPUTNR8 - Set double keyword = dval in FITS header string */
-
-int
-hputnr8 (hstring, keyword, ndec, dval)
-
-char *hstring; /* FITS header string */
-const char *keyword; /* Keyword name */
-const int ndec; /* Number of decimal places to print */
-const double dval; /* double number */
-{
- char value[30];
- char format[8];
- int i, lval;
-
- /* Translate value from binary to ASCII */
- if (ndec < 0) {
- sprintf (format, "%%.%dg", -ndec);
- sprintf (value, format, dval);
- lval = (int) strlen (value);
- for (i = 0; i < lval; i++)
- if (value[i] == 'e') value[i] = 'E';
- }
- else {
- sprintf (format, "%%.%df", ndec);
- sprintf (value, format, dval);
- }
-
- /* Remove sign if string is -0 or extension thereof */
- fixnegzero (value);
-
- /* Put value into header string */
- return (hputc (hstring, keyword, value));
-}
-
-
-/* HPUTRA - Set double keyword = hh:mm:ss.sss in FITS header string */
-
-int
-hputra (hstring, keyword, ra)
-
-char *hstring; /* FITS header string */
-const char *keyword; /* Keyword name */
-const double ra; /* Right ascension in degrees */
-{
- char value[30];
-
- /* Translate value from binary to ASCII */
- ra2str (value, 30, ra, 3);
-
- /* Remove sign if string is -0 or extension thereof */
- fixnegzero (value);
-
- /* Put value into header string */
- return (hputs (hstring, keyword, value));
-}
-
-
-/* HPUTDEC - Set double keyword = dd:mm:ss.sss in FITS header string */
-
-int
-hputdec (hstring, keyword, dec)
-
-char *hstring; /* FITS header string */
-const char *keyword; /* Keyword name */
-const double dec; /* Declination in degrees */
-{
- char value[30];
-
- /* Translate value from binary to ASCII */
- dec2str (value, 30, dec, 2);
-
- /* Remove sign if string is -0 or extension thereof */
- fixnegzero (value);
-
- /* Put value into header string */
- return (hputs (hstring, keyword, value));
-}
-
-
-/* FIXNEGZERO -- Drop - sign from beginning of any string which is all zeros */
-
-static void
-fixnegzero (string)
-
-char *string;
-{
- int i, lstr;
-
- if (string[0] != '-')
- return;
-
- /* Drop out if any non-zero digits in this string */
- lstr = (int) strlen (string);
- for (i = 1; i < lstr; i++) {
- if (string[i] > '0' && string[i] <= '9')
- return;
- if (string[i] == 'd' || string[i] == 'e' || string[i] == ' ')
- break;
- }
-
- /* Drop - from start of string; overwrite string in place */
- for (i = 1; i < lstr; i++)
- string[i-1] = string[i];
- string[lstr-1] = (char) 0;
-
- return;
-}
-
-
-
-/* HPUTL - Set keyword = F if lval=0, else T, in FITS header string */
-
-int
-hputl (hstring, keyword,lval)
-
-char *hstring; /* FITS header */
-const char *keyword; /* Keyword name */
-const int lval; /* logical variable (0=false, else true) */
-{
- char value[8];
-
- /* Translate value from binary to ASCII */
- if (lval)
- strcpy (value, "T");
- else
- strcpy (value, "F");
-
- /* Put value into header string */
- return (hputc (hstring,keyword,value));
-}
-
-
-/* HPUTM - Set multi-line character string in FITS header string */
-/* return number of keywords written */
-
-int
-hputm (hstring,keyword,cval)
-
-char *hstring; /* FITS header */
-const char *keyword; /* Keyword name root (6 characters or less) */
-const char *cval; /* character string containing the value for variable
- keyword. trailing and leading blanks are removed. */
-{
- int lroot, lcv, i, ii, nkw, lkw, lval;
- int comment = 0;
- const char *v;
- char keyroot[8], newkey[12], value[80];
- char squot = 39;
-
- /* If COMMENT or HISTORY, use the same keyword on every line */
- lkw = (int) strlen (keyword);
- if (lkw == 7 && (strncmp (keyword,"COMMENT",7) == 0 ||
- strncmp (keyword,"HISTORY",7) == 0)) {
- comment = 1;
- lroot = 0;
- }
-
- /* Set up keyword root, shortening it to 6 characters, if necessary */
- else {
- comment = 0;
- strcpy (keyroot, keyword);
- lroot = (int) strlen (keyroot);
- if (lroot > 6) {
- keyroot[6] = (char) 0;
- lroot = 6;
- }
- }
-
- /* Write keyword value one line of up to 67 characters at a time */
- ii = '1';
- nkw = 0;
- lcv = (int) strlen (cval);
- if (!comment) {
- strcpy (newkey, keyroot);
- strcat (newkey, "_");
- newkey[lroot+2] = (char) 0;
- }
- v = cval;
- while (lcv > 0) {
- if (lcv > 67)
- lval = 67;
- else
- lval = lcv;
- value[0] = squot;
- for (i = 1; i <= lval; i++)
- value[i] = *v++;
-
- /* Pad short strings to 8 characters */
- if (lval < 8) {
- for (i = lval+1; i < 9; i++)
- value[i] = ' ';
- lval = 8;
- }
- value[lval+1] = squot;
- value[lval+2] = (char) 0;
-
- /* Add this line to the header */
- if (comment)
- i = hputc (hstring, keyroot, value);
- else {
- newkey[lroot+1] = ii;
- ii++;
- i = hputc (hstring, newkey, value);
- }
- if (i != 0) return (i);
- nkw++;
- if (lcv > 67)
- lcv = lcv - 67;
- else
- break;
- }
- return (nkw);
-}
-
-
-/* HPUTS - Set character string keyword = 'cval' in FITS header string */
-
-int
-hputs (hstring,keyword,cval)
-
-char *hstring; /* FITS header */
-const char *keyword; /* Keyword name */
-const char *cval; /* character string containing the value for variable
- keyword. trailing and leading blanks are removed. */
-{
- char squot = 39;
- char value[80];
- int lcval, i, lkeyword;
-
- /* If COMMENT or HISTORY, just add it as is */
- lkeyword = (int) strlen (keyword);
- if (lkeyword == 7 && (strncmp (keyword,"COMMENT",7) == 0 ||
- strncmp (keyword,"HISTORY",7) == 0))
- return (hputc (hstring,keyword,cval));
-
- /* find length of variable string */
- lcval = (int) strlen (cval);
- if (lcval > 67)
- lcval = 67;
-
- /* Put single quote at start of string */
- value[0] = squot;
- strncpy (&value[1],cval,lcval);
-
- /* If string is less than eight characters, pad it with spaces */
- if (lcval < 8) {
- for (i = lcval; i < 8; i++) {
- value[i+1] = ' ';
- }
- lcval = 8;
- }
-
- /* Add single quote and null to end of string */
- value[lcval+1] = squot;
- value[lcval+2] = (char) 0;
-
- /* Put value into header string */
- return (hputc (hstring,keyword,value));
-}
-
-
-/* HPUTC - Set character string keyword = value in FITS header string */
-/* Return -1 if error, 0 if OK */
-
-int
-hputc (hstring,keyword,value)
-
-char *hstring;
-const char *keyword;
-const char *value; /* character string containing the value for variable
- keyword. trailing and leading blanks are removed. */
-{
- char squot = 39;
- char line[100];
- char newcom[50];
- char *vp, *v1, *v2, *q1, *q2, *c1, *ve;
- int lkeyword, lcom, lval, lc, lv1, lhead, lblank, ln, nc, i;
-
- /* Find length of keyword, value, and header */
- lkeyword = (int) strlen (keyword);
- lval = (int) strlen (value);
- lhead = gethlength (hstring);
-
- /* If COMMENT or HISTORY, always add it just before the END */
- if (lkeyword == 7 && (strncmp (keyword,"COMMENT",7) == 0 ||
- strncmp (keyword,"HISTORY",7) == 0)) {
-
- /* First look for blank lines before END */
- v1 = blsearch (hstring, "END");
-
- /* Otherwise, create a space for it at the end of the header */
- if (v1 == NULL) {
-
- /* Find end of header */
- v1 = ksearch (hstring,"END");
-
- /* Align pointer at start of 80-character line */
- lc = v1 - hstring;
- ln = lc / 80;
- nc = ln * 80;
- v1 = hstring + nc;
- v2 = v1 + 80;
-
- /* If header length is exceeded, return error code */
- if (v2 - hstring > lhead) {
- return (-1);
- }
-
- /* Move END down 80 characters */
- strncpy (v2, v1, 80);
- }
- else
- v2 = v1 + 80;
-
- /* Insert keyword */
- strncpy (v1,keyword,7);
-
- /* Pad with spaces */
- for (vp = v1+lkeyword; vp < v2; vp++)
- *vp = ' ';
-
- if (lval > 71)
- lv1 = 71;
- else
- lv1 = lval;
-
- /* Insert comment */
- strncpy (v1+9,value,lv1);
- return (0);
- }
-
- /* Otherwise search for keyword */
- else
- v1 = ksearch (hstring,keyword);
-
- /* If parameter is not found, find a place to put it */
- if (v1 == NULL) {
-
- /* First look for blank lines before END */
- v1 = blsearch (hstring, "END");
-
- /* Otherwise, create a space for it at the end of the header */
- if (v1 == NULL) {
- ve = ksearch (hstring,"END");
- v1 = ve;
-
- /* Align pointer at start of 80-character line */
- lc = v1 - hstring;
- ln = lc / 80;
- nc = ln * 80;
- v1 = hstring + nc;
- v2 = v1 + 80;
-
- /* If header length is exceeded, return error code */
- if (v2 - hstring > lhead) {
- return (-1);
- }
-
- strncpy (v2, ve, 80);
- }
- else
- v2 = v1 + 80;
- lcom = 0;
- newcom[0] = 0;
- }
-
- /* Otherwise, extract the entry for this keyword from the header */
- else {
-
- /* Align pointer at start of 80-character line */
- lc = v1 - hstring;
- ln = lc / 80;
- nc = ln * 80;
- v1 = hstring + nc;
- v2 = v1 + 80;
-
- strncpy (line, v1, 80);
- line[80] = 0;
- v2 = v1 + 80;
-
- /* check for quoted value */
- q1 = strchr (line, squot);
- if (q1 != NULL) {
- q2 = strchr (q1+1,squot);
- if (q2 != NULL)
- c1 = strchr (q2,'/');
- else
- c1 = strrchr (line+79,'/');
- }
- else
- c1 = strchr (line,'/');
-
- /* extract comment and discount trailing spaces */
- if (c1 != NULL) {
- lcom = 80 - (c1 + 2 - line);
- strncpy (newcom, c1+2, lcom);
- vp = newcom + lcom - 1;
- while (vp-- > newcom && *vp == ' ')
- lcom--;
- }
- else {
- newcom[0] = 0;
- lcom = 0;
- }
- }
-
- /* Fill new entry with spaces */
- for (vp = v1; vp < v2; vp++)
- *vp = ' ';
-
- /* Copy keyword to new entry */
- strncpy (v1, keyword, lkeyword);
-
- /* Add parameter value in the appropriate place */
- vp = v1 + 8;
- *vp = '=';
- vp = v1 + 9;
- *vp = ' ';
- vp = vp + 1;
- if (*value == squot) {
- strncpy (vp, value, lval);
- if (lval+12 > 31)
- lc = lval + 12;
- else
- lc = 30;
- }
- else {
- vp = v1 + 30 - lval;
- strncpy (vp, value, lval);
- lc = 30;
- }
-
- /* Add comment in the appropriate place */
- if (lcom > 0) {
- if (lc+2+lcom > 80)
- lcom = 77 - lc;
- vp = v1 + lc; /* Jul 16 1997: was vp = v1 + lc * 2 */
- *vp++ = ' ';
- *vp++ = '/';
- *vp++ = ' ';
- lblank = v2 - vp;
- for (i = 0; i < lblank; i++)
- vp[i] = ' ';
- if (lcom > lblank)
- lcom = lblank;
- strncpy (vp, newcom, lcom);
- }
-
- if (verbose) {
- if (lcom > 0)
- fprintf (stderr,"HPUT: %s = %s / %s\n",keyword, value, newcom);
- else
- fprintf (stderr,"HPUT: %s = %s\n",keyword, value);
- }
-
- return (0);
-}
-
-
-/* HPUTCOM - Set comment for keyword or on line in FITS header string */
-
-int
-hputcom (hstring,keyword,comment)
-
- char *hstring;
- const char *keyword;
- const char *comment;
-{
- char squot, slash, space;
- char line[100];
- int lkeyword, lcom, lhead, i, lblank, ln, nc, lc;
- char *vp, *v1, *v2, *c0, *c1, *q1, *q2;
-
- squot = (char) 39;
- slash = (char) 47;
- space = (char) 32;
-
- /* Find length of variable name */
- lkeyword = (int) strlen (keyword);
- lhead = gethlength (hstring);
- lcom = (int) strlen (comment);
-
- /* If COMMENT or HISTORY, always add it just before the END */
- if (lkeyword == 7 && (strncmp (keyword,"COMMENT",7) == 0 ||
- strncmp (keyword,"HISTORY",7) == 0)) {
-
- /* Find end of header */
- v1 = ksearch (hstring,"END");
-
- /* Align pointer at start of 80-character line */
- lc = v1 - hstring;
- ln = lc / 80;
- nc = ln * 80;
- v1 = hstring + nc;
- v2 = v1 + 80;
-
- /* If header length is exceeded, return error code */
- if (v2 - hstring > lhead) {
- return (-1);
- }
-
- /* Move END down 80 characters */
- strncpy (v2, v1, 80);
-
- /* blank out new line and insert keyword */
- for (vp = v1; vp < v2; vp++)
- *vp = ' ';
- strncpy (v1, keyword, lkeyword);
- c0 = v1 + lkeyword;
- }
-
- /* Search header string for variable name */
- else {
- v1 = ksearch (hstring,keyword);
-
- /* If parameter is not found, return without doing anything */
- if (v1 == NULL) {
- if (verbose)
- fprintf (stderr,"HPUTCOM: %s not found\n",keyword);
- return (-1);
- }
-
- /* Align pointer at start of 80-character line */
- lc = v1 - hstring;
- ln = lc / 80;
- nc = ln * 80;
- v1 = hstring + nc;
- v2 = v1 + 80;
-
- /* Extract entry for this variable from the header */
- strncpy (line, v1, 80);
- line[80] = '\0'; /* Null-terminate line before strchr call */
-
- /* check for quoted value */
- q1 = strchr (line,squot);
- c1 = strchr (line,slash);
- if (q1 != NULL) {
- if (c1 != NULL && q1 < c1) {
- q2 = strchr (q1+1, squot);
- if (q2 == NULL) {
- q2 = c1 - 1;
- while (*q2 == space)
- q2--;
- q2++;
- }
- else if (c1 < q2)
- c1 = strchr (q2, slash);
- }
- else if (c1 == NULL) {
- q2 = strchr (q1+1, squot);
- if (q2 == NULL) {
- q2 = line + 79;
- while (*q2 == space)
- q2--;
- q2++;
- }
- }
- else
- q1 = NULL;
- q2 = NULL;
- }
-
- else
- q2 = NULL;
-
- if (c1 != NULL)
- c0 = v1 + (c1 - line) - 1;
- else if (q2 == NULL || q2-line < 30)
- c0 = v1 + 30;
- else
- c0 = v1 + (q2 - line) + 1; /* allan: 1997-09-30, was c0=q2+2 */
-
- /* If comment will not fit at all, return */
- if (c0 - v1 > 77)
- return (-1);
- strncpy (c0, " / ",3);
- }
-
- /* Create new entry */
- if (lcom > 0) {
- c1 = c0 + 3;
- lblank = v1 + 79 - c1;
- if (lcom > lblank)
- lcom = lblank;
- for (i = 0; i < lblank; i++)
- c1[i] = ' ';
- strncpy (c1, comment, lcom);
- }
-
- if (verbose) {
- fprintf (stderr,"HPUTCOM: %s / %s\n",keyword,comment);
- }
- return (0);
-}
-
-
-static int leaveblank = 0; /* If 1, leave blank line when deleting */
-void
-setleaveblank (lb)
-int lb; { leaveblank = lb; return; }
-
-static int headshrink=1; /* Set to 1 to drop line after deleting keyword */
-void
-setheadshrink (hsh)
-int hsh;
-{headshrink = hsh; return;}
-
-/* HDEL - Set character string keyword = value in FITS header string
- * returns 1 if entry deleted, else 0
- */
-
-int
-hdel (hstring,keyword)
-
-char *hstring; /* FITS header */
-const char *keyword; /* Keyword of entry to be deleted */
-{
- char *v, *v1, *v2, *ve;
-
- /* Search for keyword */
- v1 = ksearch (hstring,keyword);
-
- /* If keyword is not found, return header unchanged */
- if (v1 == NULL) {
- return (0);
- }
-
- /* Find end of header */
- ve = ksearch (hstring,"END");
-
- /* If headshrink is 0, leave END where it is */
- if (!leaveblank && !headshrink)
- ve = ve - 80;
-
- /* Cover deleted keyword line with spaces */
- if (leaveblank) {
- v2 = v1 + 80;
- for (v = ve; v < v2; v++)
- *v = ' ';
- }
-
- /* Shift rest of header up one line */
- else {
- for (v = v1; v < ve; v = v + 80) {
- v2 = v + 80;
- strncpy (v, v2, 80);
- }
-
- /* Cover former last line with spaces */
- v2 = ve + 80;
- for (v = ve; v < v2; v++)
- *v = ' ';
- }
-
- return (1);
-}
-
-
-/* HADD - Add character string keyword = value to FITS header string
- * returns 1 if entry added, else 0
- * Call hputx() to put value into entry
- */
-
-int
-hadd (hplace, keyword)
-
-char *hplace; /* FITS header position for new keyword */
-const char *keyword; /* Keyword of entry to be deleted */
-{
- char *v, *v1, *v2, *ve;
- int i, lkey;
-
- /* Find end of header */
- ve = ksearch (hplace,"END");
-
- /* If END is not found, return header unchanged */
- if (ve == NULL) {
- return (0);
- }
-
- v1 = hplace;
-
- /* Shift rest of header down one line */
- /* limit bug found by Paolo Montegriffo fixed 2000-04-19 */
- for (v = ve; v >= v1; v = v - 80) {
- v2 = v + 80;
- strncpy (v2, v, 80);
- }
-
- /* Cover former first line with new keyword */
- lkey = (int) strlen (keyword);
- strncpy (hplace, keyword, lkey);
- if (lkey < 8) {
- for (i = lkey; i < 8; i++)
- hplace[i] = ' ';
- hplace[8] = '=';
- }
- for (i = 9; i < 80; i++)
- hplace[i] = ' ';
-
- return (1);
-}
-
-
-/* HCHANGE - Changes keyword for entry from keyword1 to keyword2 in FITS
- header string
- * returns 1 if entry changed, else 0
- */
-
-int
-hchange (hstring, keyword1, keyword2)
-
-char *hstring; /* FITS header */
-const char *keyword1; /* Keyword to be changed */
-const char *keyword2; /* New keyword name */
-{
- char *v, *v1;
- const char *v2;
- int lv2, i;
-
- /* Search for keyword */
- v1 = ksearch (hstring,keyword1);
-
- /* If keyword is not found, return header unchanged */
- if (!v1)
- return (0);
-
- else {
- lv2 = (int) strlen (keyword2);
- v = v1;
- v2 = keyword2;
- for (i = 0; i < 8; i++) {
- if (i < lv2)
- v[i] = v2[i];
- else
- v[i] = ' ';
- }
- }
-
- return (1);
-}
-
-
-/* Write the right ascension ra in sexagesimal format into string*/
-
-void
-ra2str (string, lstr, ra, ndec)
-
-char *string; /* Character string (returned) */
-int lstr; /* Maximum number of characters in string */
-double ra; /* Right ascension in degrees */
-int ndec; /* Number of decimal places in seconds */
-
-{
- double a,b;
- double seconds;
- char tstring[64];
- int hours;
- int minutes;
- int isec, ltstr;
- double dsgn;
-
- /* Keep RA between 0 and 360 */
- if (ra < 0.0 ) {
- ra = -ra;
- dsgn = -1.0;
- }
- else
- dsgn = 1.0;
- ra = fmod(ra, 360.0);
- ra *= dsgn;
- if (ra < 0.0)
- ra = ra + 360.0;
-
- a = ra / 15.0;
-
- /* Convert to hours */
- hours = (int) a;
-
- /* Compute minutes */
- b = (a - (double)hours) * 60.0;
- minutes = (int) b;
-
- /* Compute seconds */
- seconds = (b - (double)minutes) * 60.0;
-
- if (ndec > 5) {
- if (seconds > 59.999999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%09.6f",hours,minutes,seconds);
- }
- else if (ndec > 4) {
- if (seconds > 59.99999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%08.5f",hours,minutes,seconds);
- }
- else if (ndec > 3) {
- if (seconds > 59.9999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%07.4f",hours,minutes,seconds);
- }
- else if (ndec > 2) {
- if (seconds > 59.999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%06.3f",hours,minutes,seconds);
- }
- else if (ndec > 1) {
- if (seconds > 59.99) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%05.2f",hours,minutes,seconds);
- }
- else if (ndec > 0) {
- if (seconds > 59.9) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%04.1f",hours,minutes,seconds);
- }
- else {
- isec = (int)(seconds + 0.5);
- if (isec > 59) {
- isec = 0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- hours = hours + 1;
- }
- hours = hours % 24;
- (void) sprintf (tstring,"%02d:%02d:%02d",hours,minutes,isec);
- }
-
- /* Move formatted string to returned string */
- ltstr = (int) strlen (tstring);
- if (ltstr < lstr-1)
- strcpy (string, tstring);
- else {
- strncpy (string, tstring, lstr-1);
- string[lstr-1] = 0;
- }
- return;
-}
-
-
-/* Write the variable a in sexagesimal format into string */
-
-void
-dec2str (string, lstr, dec, ndec)
-
-char *string; /* Character string (returned) */
-int lstr; /* Maximum number of characters in string */
-double dec; /* Declination in degrees */
-int ndec; /* Number of decimal places in arcseconds */
-
-{
- double a, b, dsgn, deg1;
- double seconds;
- char sign;
- int degrees;
- int minutes;
- int isec, ltstr;
- char tstring[64];
-
- /* Keep angle between -180 and 360 degrees */
- deg1 = dec;
- if (deg1 < 0.0 ) {
- deg1 = -deg1;
- dsgn = -1.0;
- }
- else
- dsgn = 1.0;
- deg1 = fmod(deg1, 360.0);
- deg1 *= dsgn;
- if (deg1 <= -180.0)
- deg1 = deg1 + 360.0;
-
- a = deg1;
-
- /* Set sign and do all the rest with a positive */
- if (a < 0) {
- sign = '-';
- a = -a;
- }
- else
- sign = '+';
-
- /* Convert to degrees */
- degrees = (int) a;
-
- /* Compute minutes */
- b = (a - (double)degrees) * 60.0;
- minutes = (int) b;
-
- /* Compute seconds */
- seconds = (b - (double)minutes) * 60.0;
-
- if (ndec > 5) {
- if (seconds > 59.999999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%09.6f",sign,degrees,minutes,seconds);
- }
- else if (ndec > 4) {
- if (seconds > 59.99999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%08.5f",sign,degrees,minutes,seconds);
- }
- else if (ndec > 3) {
- if (seconds > 59.9999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%07.4f",sign,degrees,minutes,seconds);
- }
- else if (ndec > 2) {
- if (seconds > 59.999) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%06.3f",sign,degrees,minutes,seconds);
- }
- else if (ndec > 1) {
- if (seconds > 59.99) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%05.2f",sign,degrees,minutes,seconds);
- }
- else if (ndec > 0) {
- if (seconds > 59.9) {
- seconds = 0.0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%04.1f",sign,degrees,minutes,seconds);
- }
- else {
- isec = (int)(seconds + 0.5);
- if (isec > 59) {
- isec = 0;
- minutes = minutes + 1;
- }
- if (minutes > 59) {
- minutes = 0;
- degrees = degrees + 1;
- }
- (void) sprintf (tstring,"%c%02d:%02d:%02d",sign,degrees,minutes,isec);
- }
-
- /* Move formatted string to returned string */
- ltstr = (int) strlen (tstring);
- if (ltstr < lstr-1)
- strcpy (string, tstring);
- else {
- strncpy (string, tstring, lstr-1);
- string[lstr-1] = 0;
- }
- return;
-}
-
-
-/* Write the angle a in decimal format into string */
-
-void
-deg2str (string, lstr, deg, ndec)
-
-char *string; /* Character string (returned) */
-int lstr; /* Maximum number of characters in string */
-double deg; /* Angle in degrees */
-int ndec; /* Number of decimal places in degree string */
-
-{
- char degform[8];
- int field, ltstr;
- char tstring[64];
- double deg1;
- double dsgn;
-
- /* Keep angle between -180 and 360 degrees */
- deg1 = deg;
- if (deg1 < 0.0 ) {
- deg1 = -deg1;
- dsgn = -1.0;
- }
- else
- dsgn = 1.0;
- deg1 = fmod(deg1, 360.0);
- deg1 *= dsgn;
- if (deg1 <= -180.0)
- deg1 = deg1 + 360.0;
-
- /* Write angle to string, adding 4 digits to number of decimal places */
- field = ndec + 4;
- if (ndec > 0) {
- sprintf (degform, "%%%d.%df", field, ndec);
- sprintf (tstring, degform, deg1);
- }
- else {
- sprintf (degform, "%%%4d", field);
- sprintf (tstring, degform, (int)deg1);
- }
-
- /* Move formatted string to returned string */
- ltstr = (int) strlen (tstring);
- if (ltstr < lstr-1)
- strcpy (string, tstring);
- else {
- strncpy (string, tstring, lstr-1);
- string[lstr-1] = 0;
- }
- return;
-}
-
-
-/* Write the variable a in decimal format into field-character string */
-
-void
-num2str (string, num, field, ndec)
-
-char *string; /* Character string (returned) */
-double num; /* Number */
-int field; /* Number of characters in output field (0=any) */
-int ndec; /* Number of decimal places in degree string */
-
-{
- char numform[8];
-
- if (field > 0) {
- if (ndec > 0) {
- sprintf (numform, "%%%d.%df", field, ndec);
- sprintf (string, numform, num);
- }
- else {
- sprintf (numform, "%%%dd", field);
- sprintf (string, numform, (int)num);
- }
- }
- else {
- if (ndec > 0) {
- sprintf (numform, "%%.%df", ndec);
- sprintf (string, numform, num);
- }
- else {
- sprintf (string, "%d", (int)num);
- }
- }
- return;
-}
-
-/* Dec 14 1995 Original subroutines
-
- * Feb 5 1996 Added HDEL to delete keyword entry from FITS header
- * Feb 7 1996 Add EOS to LINE in HPUTC
- * Feb 21 1996 Add RA2STR and DEC2STR string routines
- * Jul 19 1996 Add HPUTRA and HPUTDEC
- * Jul 22 1996 Add HCHANGE to change keywords
- * Aug 5 1996 Add HPUTNR8 to save specific number of decimal places
- * Oct 15 1996 Fix spelling
- * Nov 1 1996 Add DEG2STR to set specific number of decimal places
- * Nov 1 1996 Allow DEC2STR to handle upt to 6 decimal places
- *
- * Mar 20 1997 Fix format error in DEG2STR
- * Jul 7 1997 Fix 2 errors in HPUTCOM found by Allan Brighton
- * Jul 16 1997 Fix error in HPUTC found by Allan Brighton
- * Jul 17 1997 Fix error in HPUTC found by Allan Brighton
- * Sep 30 1997 Fix error in HPUTCOM found by Allan Brighton
- * Dec 15 1997 Fix minor bugs after lint
- * Dec 31 1997 Always put two hour digits in RA2STR
- *
- * Feb 25 1998 Add HADD to insert keywords at specific locations
- * Mar 27 1998 If n is negative, write g format in HPUTNR8()
- * Apr 24 1998 Add NUM2STR() for easy output formatting
- * Apr 30 1998 Use BLSEARCH() to overwrite blank lines before END
- * May 27 1998 Keep Dec between -90 and +90 in DEC2STR()
- * May 28 1998 Keep RA between 0 and 360 in RA2STR()
- * Jun 2 1998 Fix bug when filling in blank lines before END
- * Jun 24 1998 Add string length to ra2str(), dec2str(), and deg2str()
- * Jun 25 1998 Make string converstion subroutines more robust
- * Aug 31 1998 Add getltime() and getutime()
- * Sep 28 1998 Null-terminate comment in HPUTCOM (Allan Brighton)
- * Oct 1 1998 Change clock declaration in getltime() from int (Allan Brighton)
- *
- * Jan 28 1999 Fix bug to avoid writing HISTORY or COMMENT past 80 characters
- * Jul 14 1999 Pad string in hputs() to minimum of 8 characters
- * Aug 16 1999 Keep angle between -180 and +360 in dec2str()
- * Oct 6 1999 Reallocate header buffer if it is too small in hputc()
- * Oct 14 1999 Do not reallocate header; return error if not successful
- *
- * Mar 2 2000 Do not add quotes if adding HISTORY or COMMENT with hputs()
- * Mar 22 2000 Move getutime() and getltime() to dateutil.c
- * Mar 27 2000 Add hputm() for muti-line keywords
- * Mar 27 2000 Fix bug testing for space to fit comment in hputcom()
- * Apr 19 2000 Fix bug in hadd() which overwrote line
- * Jun 2 2000 Dropped unused variable lv in hputm() after lint
- * Jul 20 2000 Drop unused variables blank and i in hputc()
- *
- * Jan 11 2001 Print all messages to stderr
- * Jan 18 2001 Drop declaration of blsearch(); it is in fitshead.h
- *
- * Jan 4 2002 Fix placement of comments
- *
- * Jul 1 2004 Add headshrink to optionally keep blank lines in header
- * Sep 3 2004 Fix bug so comments are not pushed onto next line if long value
- * Sep 16 2004 Add fixnegzero() to avoid putting signed zero values in header
- *
- * May 22 2006 Add option to leave blank line when deleting a keyword
- * Jun 15 2006 Fix comment alignment in hputc() and hputcom()
- * Jun 20 2006 Initialized uninitialized variables in hputm() and hputcom()
- *
- * Jan 4 2007 Declare keyword to be const
- * Jan 4 2007 Drop unused subroutine hputi2()
- * Jan 5 2007 Drop ksearch() declarations; it is now in fitshead.h
- * Jan 16 2007 Fix bugs in ra2str() and dec2str() so ndec=0 works
- * Aug 20 2007 Fix bug so comments after quoted keywords work
- * Aug 22 2007 If closing quote not found, make one up
- *
- * Sep 9 2011 Always initialize q2 and lroot
- */
diff --git a/funtools/wcs/iget.c b/funtools/wcs/iget.c
deleted file mode 100644
index 58e54f7..0000000
--- a/funtools/wcs/iget.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/*** File libwcs/iget.c
- *** January 4, 2007
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1998-2007
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: iget.c (Get IRAF FITS Header parameter values)
- * Purpose: Extract values for variables from IRAF keyword value string
- * Subroutine: mgeti4 (hstring,mkey,keyword,ival) returns long integer
- * Subroutine: mgetr8 (hstring,mkey,keyword,dval) returns double
- * Subroutine: mgetstr (hstring,mkey,keyword,lstr,str) returns character string
- * Subroutine: igeti4 (hstring,keyword,ival) returns long integer
- * Subroutine: igetr4 (hstring,keyword,rval) returns real
- * Subroutine: igetr8 (hstring,keyword,dval) returns double
- * Subroutine: igets (hstring,keyword,lstr,str) returns character string
- * Subroutine: igetc (hstring,keyword) returns character string
- * Subroutine: isearch (hstring,keyword) returns pointer to header string entry
- */
-
-#include <string.h> /* NULL, strlen, strstr, strcpy */
-#include <stdio.h>
-#include "fitshead.h" /* FITS header extraction subroutines */
-#include <stdlib.h>
-#ifndef VMS
-#include <limits.h>
-#else
-#define INT_MAX 2147483647 /* Biggest number that can fit in long */
-#define SHRT_MAX 32767
-#endif
-
-#define MAX_LVAL 2000
-
-static char *isearch();
-static char val[30];
-
-/* Extract long value for variable from IRAF multiline keyword value */
-
-int
-mgeti4 (hstring, mkey, keyword, ival)
-
-const char *hstring; /* Character string containing FITS or IRAF header information
- in the format <keyword>= <value> ... */
-const char *mkey; /* Character string containing the name of the multi-line
- keyword, the string value of which contains the desired
- keyword, the value of which is returned. */
-const char *keyword; /* Character string containing the name of the keyword
- within the multiline IRAF keyword */
-int *ival; /* Integer value returned */
-{
- char *mstring;
-
- mstring = malloc (MAX_LVAL);
-
- if (hgetm (hstring, mkey, MAX_LVAL, mstring)) {
- if (igeti4 (mstring, keyword, ival)) {
- free (mstring);
- return (1);
- }
- else {
- free (mstring);
- return (0);
- }
- }
- else {
- free (mstring);
- return (0);
- }
-}
-
-/* Extract double value for variable from IRAF multiline keyword value */
-
-int
-mgetr8 (hstring, mkey, keyword, dval)
-
-const char *hstring; /* Character string containing FITS or IRAF header information
- in the format <keyword>= <value> ... */
-const char *mkey; /* Character string containing the name of the multi-line
- keyword, the string value of which contains the desired
- keyword, the value of which is returned. */
-const char *keyword; /* Character string containing the name of the keyword
- within the multiline IRAF keyword */
-double *dval; /* Integer value returned */
-{
- char *mstring;
- mstring = malloc (MAX_LVAL);
-
- if (hgetm (hstring, mkey, MAX_LVAL, mstring)) {
- if (igetr8 (mstring, keyword, dval)) {
- free (mstring);
- return (1);
- }
- else {
- free (mstring);
- return (0);
- }
- }
- else {
- free (mstring);
- return (0);
- }
-}
-
-
-/* Extract string value for variable from IRAF keyword value string */
-
-int
-mgetstr (hstring, mkey, keyword, lstr, str)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *mkey; /* Character string containing the name of the multi-line
- keyword, the string value of which contains the desired
- keyword, the value of which is returned. */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const int lstr; /* Size of str in characters */
-char *str; /* String (returned) */
-{
- char *mstring;
- mstring = malloc (MAX_LVAL);
-
- if (hgetm (hstring, mkey, MAX_LVAL, mstring)) {
- if (igets (mstring, keyword, lstr, str)) {
- free (mstring);
- return (1);
- }
- else {
- free (mstring);
- return (0);
- }
- }
- else {
- free (mstring);
- return (0);
- }
-}
-
-
-/* Extract long value for variable from IRAF keyword value string */
-
-int
-igeti4 (hstring, keyword, ival)
-
-const char *hstring; /* character string containing IRAF header information
- in the format <keyword>= <value> ... */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-int *ival; /* Integer value returned */
-{
-char *value;
-double dval;
-int minint;
-
-/* Get value from header string */
- value = igetc (hstring,keyword);
-
-/* Translate value from ASCII to binary */
- if (value != NULL) {
- minint = -INT_MAX - 1;
- strcpy (val, value);
- dval = atof (val);
- if (dval+0.001 > INT_MAX)
- *ival = INT_MAX;
- else if (dval >= 0)
- *ival = (int) (dval + 0.001);
- else if (dval-0.001 < minint)
- *ival = minint;
- else
- *ival = (int) (dval - 0.001);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract integer*2 value for variable from IRAF keyword value string */
-
-int
-igeti2 (hstring,keyword,ival)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-short *ival;
-{
-char *value;
-double dval;
-int minshort;
-
-/* Get value from header string */
- value = igetc (hstring,keyword);
-
-/* Translate value from ASCII to binary */
- if (value != NULL) {
- strcpy (val, value);
- dval = atof (val);
- minshort = -SHRT_MAX - 1;
- if (dval+0.001 > SHRT_MAX)
- *ival = SHRT_MAX;
- else if (dval >= 0)
- *ival = (short) (dval + 0.001);
- else if (dval-0.001 < minshort)
- *ival = minshort;
- else
- *ival = (short) (dval - 0.001);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-/* Extract real value for variable from IRAF keyword value string */
-
-int
-igetr4 (hstring,keyword,rval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-float *rval;
-{
- char *value;
-
-/* Get value from header string */
- value = igetc (hstring,keyword);
-
-/* Translate value from ASCII to binary */
- if (value != NULL) {
- strcpy (val, value);
- *rval = (float) atof (val);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract real*8 value for variable from IRAF keyword value string */
-
-int
-igetr8 (hstring,keyword,dval)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-double *dval;
-{
- char *value,val[30];
-
-/* Get value from header string */
- value = igetc (hstring,keyword);
-
-/* Translate value from ASCII to binary */
- if (value != NULL) {
- strcpy (val, value);
- *dval = atof (val);
- return (1);
- }
- else {
- return (0);
- }
-}
-
-
-/* Extract string value for variable from IRAF keyword value string */
-
-int
-igets (hstring, keyword, lstr, str)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword; /* character string containing the name of the keyword
- the value of which is returned. hget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-const int lstr; /* Size of str in characters */
-char *str; /* String (returned) */
-{
- char *value;
- int lval;
-
-/* Get value from header string */
- value = igetc (hstring,keyword);
-
- if (value != NULL) {
- lval = strlen (value);
- if (lval < lstr)
- strcpy (str, value);
- else if (lstr > 1)
- strncpy (str, value, lstr-1);
- else
- str[0] = value[0];
- return (1);
- }
- else
- return (0);
-}
-
-
-/* Extract character value for variable from IRAF keyword value string */
-
-char *
-igetc (hstring,keyword0)
-
-const char *hstring; /* character string containing IRAF keyword value string
- in the format <keyword>= <value> {/ <comment>} */
-const char *keyword0; /* character string containing the name of the keyword
- the value of which is returned. iget searches for a
- line beginning with this string. if "[n]" is present,
- the n'th token in the value is returned.
- (the first 8 characters must be unique) */
-{
- static char cval[MAX_LVAL];
- char *value;
- char cwhite[8];
- char lbracket[2],rbracket[2];
- char keyword[16];
- char line[MAX_LVAL];
- char *vpos,*cpar;
- char *c1, *brack1, *brack2;
- int ipar, i;
-
- lbracket[0] = 91;
- lbracket[1] = 0;
- rbracket[0] = 93;
- rbracket[1] = 0;
-
-/* Find length of variable name */
- strcpy (keyword,keyword0);
- brack1 = strsrch (keyword,lbracket);
- if (brack1 != NULL) *brack1 = '\0';
-
-/* Search header string for variable name */
- vpos = isearch (hstring,keyword);
-
-/* Exit if not found */
- if (vpos == NULL) {
- return (NULL);
- }
-
-/* Initialize returned value to nulls */
- for (i = 0; i < MAX_LVAL; i++)
- line[i] = 0;
-
-/* If quoted value, copy until second quote is reached */
- i = 0;
- if (*vpos == '"') {
- vpos++;
- while (*vpos && *vpos != '"' && i < MAX_LVAL)
- line[i++] = *vpos++;
- }
-
-/* Otherwise copy until next space or tab */
- else {
- while (*vpos != ' ' && *vpos != (char)9 &&
- *vpos > 0 && i < MAX_LVAL)
- line[i++] = *vpos++;
- }
-
-/* If keyword has brackets, extract appropriate token from value */
- if (brack1 != NULL) {
- c1 = (char *) (brack1 + 1);
- brack2 = strsrch (c1, rbracket);
- if (brack2 != NULL) {
- *brack2 = '\0';
- ipar = atoi (c1);
- if (ipar > 0) {
- cwhite[0] = ' ';
- cwhite[1] = ',';
- cwhite[2] = '\0';
- cpar = strtok (line, cwhite);
- for (i = 1; i < ipar; i++) {
- cpar = strtok (NULL, cwhite);
- }
- if (cpar != NULL) {
- strcpy (cval,cpar);
- }
- else
- value = NULL;
- }
- }
- }
- else
- strcpy (cval, line);
-
- value = cval;
-
- return (value);
-}
-
-
-/* Find value for specified IRAF keyword */
-
-static char *
-isearch (hstring,keyword)
-
-/* Find entry for keyword keyword in IRAF keyword value string hstring.
- NULL is returned if the keyword is not found */
-
-const char *hstring; /* character string containing fits-style header
- information in the format <keyword>= <value> {/ <comment>}
- the default is that each entry is 80 characters long;
- however, lines may be of arbitrary length terminated by
- nulls, carriage returns or linefeeds, if packed is true. */
-const char *keyword; /* character string containing the name of the variable
- to be returned. isearch searches for a line beginning
- with this string. The string may be a character
- literal or a character variable terminated by a null
- or '$'. it is truncated to 8 characters. */
-{
- char *loc, *headnext, *headlast, *pval;
- int lastchar, nextchar, lkey, nleft, lhstr;
-
-/* Search header string for variable name */
- lhstr = 0;
- while (lhstr < 57600 && hstring[lhstr] != 0)
- lhstr++;
- headlast = (char *) hstring + lhstr;
- headnext = (char *) hstring;
- pval = NULL;
- lkey = strlen (keyword);
- while (headnext < headlast) {
- nleft = headlast - headnext;
- loc = strnsrch (headnext, keyword, nleft);
-
- /* Exit if keyword is not found */
- if (loc == NULL) {
- break;
- }
-
- nextchar = (int) *(loc + lkey);
- lastchar = (int) *(loc - 1);
-
- /* If parameter name in header is longer, keep searching */
- if (nextchar != 61 && nextchar > 32 && nextchar < 127)
- headnext = loc + 1;
-
- /* If start of string, keep it */
- else if (loc == hstring) {
- pval = loc;
- break;
- }
-
- /* If preceeded by a blank or tab, keep it */
- else if (lastchar == 32 || lastchar == 9) {
- pval = loc;
- break;
- }
-
- else
- headnext = loc + 1;
- }
-
- /* Find start of value string for this keyword */
- if (pval != NULL) {
- pval = pval + lkey;
- while (*pval == ' ' || *pval == '=')
- pval++;
- }
-
- /* Return pointer to calling program */
- return (pval);
-
-}
-
-/* Mar 12 1998 New subroutines
- * Apr 15 1998 Set IGET() and ISEARCH() static when defined
- * Apr 24 1998 Add MGETI4(), MGETR8(), and MGETS() for single step IRAF ext.
- * Jun 1 1998 Add VMS patch from Harry Payne at STScI
- * Jul 9 1998 Fix bracket token extraction after Paul Sydney
-
- * May 5 1999 values.h -> POSIX limits.h: MAXINT->INT_MAX, MAXSHORT->SHRT_MAX
- * Oct 21 1999 Fix declarations after lint
- *
- * Feb 11 2000 Stop search for end of quoted keyword if more than 500 chars
- * Jul 20 2000 Drop unused variables squot, dquot, and slash in igetc()
- *
- * Jun 26 2002 Change maximum string length from 600 to 2000; use MAX_LVAL
- * Jun 26 2002 Stop search for end of quoted keyword if > MAX_LVAL chars
- *
- * Sep 23 2003 Change mgets() to mgetstr() to avoid name collision at UCO Lick
- *
- * Feb 26 2004 Make igetc() accessible from outside this file
- *
- * Jan 4 2007 Declare header, keyword to be const
- */
diff --git a/funtools/wcs/imhfile.c b/funtools/wcs/imhfile.c
deleted file mode 100644
index b618686..0000000
--- a/funtools/wcs/imhfile.c
+++ /dev/null
@@ -1,1941 +0,0 @@
-/*** File imhfile.c
- *** March 27, 2012
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1996-2012
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: imhfile.c (IRAF .imh image file reading and writing)
- * Purpose: Read and write IRAF image files (and translate headers)
- * Subroutine: check_immagic (irafheader, teststring )
- * Verify that file is valid IRAF imhdr or impix
- * Subroutine: irafrhead (filename, lfhead, fitsheader, lihead)
- * Read IRAF image header
- * Subroutine: irafrimage (fitsheader)
- * Read IRAF image pixels (call after irafrhead)
- * Subroutine: same_path (pixname, hdrname)
- * Put filename and header path together
- * Subroutine: iraf2fits (hdrname, irafheader, nbiraf, nbfits)
- * Convert IRAF image header to FITS image header
- * Subroutine: irafwhead (hdrname, irafheader, fitsheader)
- * Write IRAF header file
- * Subroutine: irafwimage (hdrname, irafheader, fitsheader, image )
- * Write IRAF image and header files
- * Subroutine: fits2iraf (fitsheader, irafheader)
- * Convert FITS image header to IRAF image header
- * Subroutine: irafgeti4 (irafheader, offset)
- * Get 4-byte integer from arbitrary part of IRAF header
- * Subroutine: irafgetc2 (irafheader, offset)
- * Get character string from arbitrary part of IRAF v.1 header
- * Subroutine: irafgetc (irafheader, offset)
- * Get character string from arbitrary part of IRAF header
- * Subroutine: iraf2str (irafstring, nchar)
- * Convert 2-byte/char IRAF string to 1-byte/char string
- * Subroutine: str2iraf (string, irafstring, nchar)
- * Convert 1-byte/char string to IRAF 2-byte/char string
- * Subroutine: irafswap (bitpix,string,nbytes)
- * Swap bytes in string in place, with FITS bits/pixel code
- * Subroutine: irafswap2 (string,nbytes)
- * Swap bytes in string in place
- * Subroutine irafswap4 (string,nbytes)
- * Reverse bytes of Integer*4 or Real*4 vector in place
- * Subroutine irafswap8 (string,nbytes)
- * Reverse bytes of Real*8 vector in place
- * Subroutine irafsize (filename)
- * Return length of file in bytes
- * Subroutine isiraf (filename)
- * Return 1 if IRAF .imh file, else 0
-
-
- * Copyright: 2000 Smithsonian Astrophysical Observatory
- * You may do anything you like with this file except remove
- * this copyright. The Smithsonian Astrophysical Observatory
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- */
-
-#include <stdio.h> /* define stderr, FD, and NULL */
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include "fitsfile.h"
-
-/* Parameters from iraf/lib/imhdr.h for IRAF version 1 images */
-#define SZ_IMPIXFILE 79 /* name of pixel storage file */
-#define SZ_IMHDRFILE 79 /* length of header storage file */
-#define SZ_IMTITLE 79 /* image title string */
-#define LEN_IMHDR 2052 /* length of std header */
-
-/* Parameters from iraf/lib/imhdr.h for IRAF version 2 images */
-#define SZ_IM2PIXFILE 255 /* name of pixel storage file */
-#define SZ_IM2HDRFILE 255 /* name of header storage file */
-#define SZ_IM2TITLE 383 /* image title string */
-#define LEN_IM2HDR 2046 /* length of std header */
-
-/* Offsets into header in bytes for parameters in IRAF version 1 images */
-#define IM_HDRLEN 12 /* Length of header in 4-byte ints */
-#define IM_PIXTYPE 16 /* Datatype of the pixels */
-#define IM_NDIM 20 /* Number of dimensions */
-#define IM_LEN 24 /* Length (as stored) */
-#define IM_PHYSLEN 52 /* Physical length (as stored) */
-#define IM_PIXOFF 88 /* Offset of the pixels */
-#define IM_CTIME 108 /* Time of image creation */
-#define IM_MTIME 112 /* Time of last modification */
-#define IM_LIMTIME 116 /* Time of min,max computation */
-#define IM_MAX 120 /* Maximum pixel value */
-#define IM_MIN 124 /* Maximum pixel value */
-#define IM_PIXFILE 412 /* Name of pixel storage file */
-#define IM_HDRFILE 572 /* Name of header storage file */
-#define IM_TITLE 732 /* Image name string */
-
-/* Offsets into header in bytes for parameters in IRAF version 2 images */
-#define IM2_HDRLEN 6 /* Length of header in 4-byte ints */
-#define IM2_PIXTYPE 10 /* Datatype of the pixels */
-#define IM2_SWAPPED 14 /* Pixels are byte swapped */
-#define IM2_NDIM 18 /* Number of dimensions */
-#define IM2_LEN 22 /* Length (as stored) */
-#define IM2_PHYSLEN 50 /* Physical length (as stored) */
-#define IM2_PIXOFF 86 /* Offset of the pixels */
-#define IM2_CTIME 106 /* Time of image creation */
-#define IM2_MTIME 110 /* Time of last modification */
-#define IM2_LIMTIME 114 /* Time of min,max computation */
-#define IM2_MAX 118 /* Maximum pixel value */
-#define IM2_MIN 122 /* Maximum pixel value */
-#define IM2_PIXFILE 126 /* Name of pixel storage file */
-#define IM2_HDRFILE 382 /* Name of header storage file */
-#define IM2_TITLE 638 /* Image name string */
-
-/* Codes from iraf/unix/hlib/iraf.h */
-#define TY_CHAR 2
-#define TY_SHORT 3
-#define TY_INT 4
-#define TY_LONG 5
-#define TY_REAL 6
-#define TY_DOUBLE 7
-#define TY_COMPLEX 8
-#define TY_POINTER 9
-#define TY_STRUCT 10
-#define TY_USHORT 11
-#define TY_UBYTE 12
-
-#define LEN_IRAFHDR 25000
-#define LEN_PIXHDR 1024
-#define LEN_FITSHDR 11520
-
-int check_immagic();
-int irafgeti4();
-float irafgetr4();
-char *irafgetc2();
-char *irafgetc();
-char *iraf2str();
-static char *same_path();
-static void irafputr4();
-static void irafputi4();
-static void irafputc2();
-static void irafputc();
-static void str2iraf();
-static int headswap=-1; /* =1 to swap data bytes of foreign IRAF file */
-static void irafswap();
-static void irafswap2();
-static void irafswap4();
-static void irafswap8();
-int head_version ();
-int pix_version ();
-int irafncmp ();
-static int machswap();
-static int irafsize();
-
-#define SECONDS_1970_TO_1980 315532800L
-
-/* Subroutine: irafrhead
- * Purpose: Open and read the iraf .imh file, translating it to FITS, too.
- * Returns: NULL if failure, else pointer to IRAF .imh image header
- * Notes: The imhdr format is defined in iraf/lib/imhdr.h, some of
- * which defines or mimicked, above.
- */
-
-char *
-irafrhead (filename, lihead)
-
-char *filename; /* Name of IRAF header file */
-int *lihead; /* Length of IRAF image header in bytes (returned) */
-{
- FILE *fd;
- int nbr;
- char *irafheader;
- int nbhead, nbytes;
- int imhver;
-
- headswap = -1;
- *lihead = 0;
-
- /* open the image header file */
- fd = fopen (filename, "rb");
- if (fd == NULL) {
- fprintf (stderr, "IRAFRHEAD: cannot open file %s to read\n", filename);
- return (NULL);
- }
-
- /* Find size of image header file */
- if ((nbhead = irafsize (fd)) <= 0) {
- fprintf (stderr, "IRAFRHEAD: cannot read file %s, size = %d\n",
- filename, nbhead);
- return (NULL);
- }
-
- /* allocate initial sized buffer */
- nbytes = nbhead + 5000;
- irafheader = (char *) calloc (nbytes/4, 4);
- if (irafheader == NULL) {
- (void)fprintf(stderr, "IRAFRHEAD Cannot allocate %d-byte header\n",
- nbytes);
- return (NULL);
- }
- *lihead = nbytes;
-
- /* Read IRAF header */
- nbr = fread (irafheader, 1, nbhead, fd);
- fclose (fd);
-
- /* Reject if header less than minimum length */
- if (nbr < LEN_PIXHDR) {
- (void)fprintf(stderr, "IRAFRHEAD header file %s: %d / %d bytes read.\n",
- filename,nbr,LEN_PIXHDR);
- free (irafheader);
- return (NULL);
- }
-
- /* Check header magic word */
- imhver = head_version (irafheader);
- if (imhver < 1) {
- free (irafheader);
- (void)fprintf(stderr, "IRAFRHEAD: %s is not a valid IRAF image header\n",
- filename);
- return(NULL);
- }
-
- /* check number of image dimensions
- if (imhver == 2)
- ndim = irafgeti4 (irafheader, IM2_NDIM])
- else
- ndim = irafgeti4 (irafheader, IM_NDIM])
- if (ndim < 2) {
- free (irafheader);
- (void)fprintf(stderr, "File %s does not contain 2d image\n", filename);
- return (NULL);
- } */
-
- return (irafheader);
-}
-
-
-char *
-irafrimage (fitsheader)
-
-char *fitsheader; /* FITS image header (filled) */
-{
- FILE *fd;
- char *bang;
- int naxis, naxis1, naxis2, naxis3, npaxis1, npaxis2,bitpix, bytepix, pixswap, i;
- char *image;
- int nbr, nbimage, nbaxis, nbl, nbdiff, lpname;
- char *pixheader;
- char *linebuff, *pixchar;
- int imhver, lpixhead, len;
- char pixname[SZ_IM2PIXFILE+1];
- char newpixname[SZ_IM2HDRFILE+1];
-
- /* Convert pixel file name to character string */
- hgetm (fitsheader, "PIXFIL", SZ_IM2PIXFILE, pixname);
-
- /* Drop trailing spaces */
- lpname = strlen (pixname);
- pixchar = pixname + lpname - 1;
- while (*pixchar == ' ')
- *pixchar = (char) 0;
-
- hgeti4 (fitsheader, "PIXOFF", &lpixhead);
-
- /* Open pixel file, ignoring machine name if present */
- if ((bang = strchr (pixname, '!')) != NULL )
- fd = fopen (bang + 1, "rb");
- else
- fd = fopen (pixname, "rb");
-
- /* If not at pathname in header, try same directory as header file */
- if (!fd) {
- hgetm (fitsheader, "IMHFIL", SZ_IM2HDRFILE, newpixname);
- len = strlen (newpixname);
- newpixname[len-3] = 'p';
- newpixname[len-2] = 'i';
- newpixname[len-1] = 'x';
- fd = fopen (newpixname, "rb");
- }
-
- /* Print error message and exit if pixel file is not found */
- if (!fd) {
- (void)fprintf(stderr,
- "IRAFRIMAGE: Cannot open IRAF pixel file %s\n", pixname);
- return (NULL);
- }
-
- /* Read pixel header */
- pixheader = (char *) calloc (lpixhead/4, 4);
- if (pixheader == NULL) {
- (void)fprintf(stderr, "IRAFRIMAGE Cannot allocate %d-byte pixel header\n",
- lpixhead);
- return (NULL);
- }
- nbr = fread (pixheader, 1, lpixhead, fd);
-
- /* Check size of pixel header */
- if (nbr < lpixhead) {
- (void)fprintf(stderr, "IRAF pixel file %s: %d / %d bytes read.\n",
- pixname,nbr,LEN_PIXHDR);
- free (pixheader);
- fclose (fd);
- return (NULL);
- }
-
- /* check pixel header magic word */
- imhver = pix_version (pixheader);
- if (imhver < 1) {
- (void)fprintf(stderr, "File %s not valid IRAF pixel file.\n", pixname);
- free (pixheader);
- fclose (fd);
- return(NULL);
- }
- free (pixheader);
-
- /* Find number of bytes to read */
- hgeti4 (fitsheader,"NAXIS",&naxis);
- hgeti4 (fitsheader,"NAXIS1",&naxis1);
- hgeti4 (fitsheader,"NAXIS2",&naxis2);
- hgeti4 (fitsheader,"NPAXIS1",&npaxis1);
- hgeti4 (fitsheader,"NPAXIS2",&npaxis2);
- hgeti4 (fitsheader,"BITPIX",&bitpix);
- if (bitpix < 0)
- bytepix = -bitpix / 8;
- else
- bytepix = bitpix / 8;
-
- /* If either dimension is one and image is 3-D, read all three dimensions */
- if (naxis == 3 && ((naxis1 == 1) | (naxis2 == 1))) {
- hgeti4 (fitsheader,"NAXIS3",&naxis3);
- nbimage = naxis1 * naxis2 * naxis3 * bytepix;
- }
- else {
- nbimage = naxis1 * naxis2 * bytepix;
- naxis3 = 1;
- }
-
- if (bytepix > 4)
- image = (char *) calloc (nbimage/8, 8);
- else if (bytepix > 2)
- image = (char *) calloc (nbimage/4, 4);
- else if (bytepix > 1)
- image = (char *) calloc (nbimage/2, 2);
- else
- image = (char *) calloc (nbimage, 1);
- if (image == NULL) {
- (void)fprintf(stderr, "IRAFRIMAGE Cannot allocate %d-byte image buffer\n",
- nbimage);
- return (NULL);
- }
-
- /* Read IRAF image all at once if physical and image dimensions are the same */
- if (npaxis1 == naxis1)
- nbr = fread (image, 1, nbimage, fd);
-
- /* Read IRAF image one line at a time if physical and image dimensions differ */
- else {
- nbdiff = (npaxis1 - naxis1) * bytepix;
- nbaxis = naxis1 * bytepix;
- linebuff = image;
- nbr = 0;
- if (naxis2 == 1 && naxis3 > 1)
- naxis2 = naxis3;
- for (i = 0; i < naxis2; i++) {
- nbl = fread (linebuff, 1, nbaxis, fd);
- nbr = nbr + nbl;
- (void) fseek (fd, nbdiff, SEEK_CUR);
- linebuff = linebuff + nbaxis;
- }
- }
- fclose (fd);
-
- /* Check size of image */
- if (nbr < nbimage) {
- (void)fprintf(stderr, "IRAF pixel file %s: %d / %d bytes read.\n",
- pixname,nbr,nbimage);
- free (image);
- return (NULL);
- }
-
- /* Byte-reverse image, if necessary */
- pixswap = 0;
- hgetl (fitsheader, "PIXSWAP", &pixswap);
- if (pixswap)
- irafswap (bitpix, image, nbimage);
-
- return (image);
-}
-
-
-/* Return IRAF image format version number from magic word in IRAF header*/
-
-int
-head_version (irafheader)
-
-char *irafheader; /* IRAF image header from file */
-
-{
-
- /* Check header file magic word */
- if (irafncmp (irafheader, "imhdr", 5) != 0 ) {
- if (strncmp (irafheader, "imhv2", 5) != 0)
- return (0);
- else
- return (2);
- }
- else
- return (1);
-}
-
-
-/* Return IRAF image format version number from magic word in IRAF pixel file */
-
-int
-pix_version (irafheader)
-
-char *irafheader; /* IRAF image header from file */
-
-{
-
- /* Check pixel file header magic word */
- if (irafncmp (irafheader, "impix", 5) != 0) {
- if (strncmp (irafheader, "impv2", 5) != 0)
- return (0);
- else
- return (2);
- }
- else
- return (1);
-}
-
-
-/* Verify that file is valid IRAF imhdr or impix by checking first 5 chars
- * Returns: 0 on success, 1 on failure */
-
-int
-irafncmp (irafheader, teststring, nc)
-
-char *irafheader; /* IRAF image header from file */
-char *teststring; /* C character string to compare */
-int nc; /* Number of characters to compate */
-
-{
- char *line;
-
- headswap = -1;
- if ((line = iraf2str (irafheader, nc)) == NULL)
- return (1);
- if (strncmp (line, teststring, nc) == 0) {
- free (line);
- return (0);
- }
- else {
- free (line);
- return (1);
- }
-}
-
-/* Convert IRAF image header to FITS image header, returning FITS header */
-
-char *
-iraf2fits (hdrname, irafheader, nbiraf, nbfits)
-
-char *hdrname; /* IRAF header file name (may be path) */
-char *irafheader; /* IRAF image header */
-int nbiraf; /* Number of bytes in IRAF header */
-int *nbfits; /* Number of bytes in FITS header (returned) */
-
-{
- char *objname; /* object name from FITS file */
- int lstr, i, j, k, ib, nax, nbits, nl;
- int lname = 0;
- char *pixname, *newpixname, *bang, *chead;
- char *fitsheader;
- int nblock, nlines;
- char *fhead, *fhead1, *fp, endline[81];
- char irafchar;
- char fitsline[81];
- char *dstring;
- int pixtype;
- int imhver, n, imu, pixoff, impixoff, immax, immin, imtime;
- int imndim, imlen, imphyslen, impixtype, pixswap, hpixswap, mtime;
- float rmax, rmin;
-
- headswap = -1;
-
- /* Set up last line of FITS header */
- (void)strncpy (endline,"END", 3);
- for (i = 3; i < 80; i++)
- endline[i] = ' ';
- endline[80] = 0;
-
- /* Check header magic word */
- imhver = head_version (irafheader);
- if (imhver < 1) {
- (void)fprintf(stderr, "File %s not valid IRAF image header\n",
- hdrname);
- return(NULL);
- }
- if (imhver == 2) {
- nlines = 24 + ((nbiraf - LEN_IM2HDR) / 81);
- imndim = IM2_NDIM;
- imlen = IM2_LEN;
- imphyslen = IM2_PHYSLEN;
- impixtype = IM2_PIXTYPE;
- impixoff = IM2_PIXOFF;
- imtime = IM2_MTIME;
- immax = IM2_MAX;
- immin = IM2_MIN;
- }
- else {
- nlines = 24 + ((nbiraf - LEN_IMHDR) / 162);
- imndim = IM_NDIM;
- imlen = IM_LEN;
- imphyslen = IM_PHYSLEN;
- impixtype = IM_PIXTYPE;
- impixoff = IM_PIXOFF;
- imtime = IM_MTIME;
- immax = IM_MAX;
- immin = IM_MIN;
- }
-
- /* Initialize FITS header */
- nblock = (nlines * 80) / 2880;
- *nbfits = (nblock + 5) * 2880 + 4;
- fitsheader = (char *) calloc (*nbfits, 1);
- if (fitsheader == NULL) {
- (void)fprintf(stderr, "IRAF2FITS Cannot allocate %d-byte FITS header\n",
- *nbfits);
- return (NULL);
- }
- hlength (fitsheader, *nbfits);
- fhead = fitsheader;
- (void)strncpy (fitsheader, endline, 80);
- hputl (fitsheader, "SIMPLE", 1);
- fhead = fhead + 80;
-
- /* Set pixel size in FITS header */
- pixtype = irafgeti4 (irafheader, impixtype);
- switch (pixtype) {
- case TY_CHAR:
- nbits = 8;
- break;
- case TY_UBYTE:
- nbits = 8;
- break;
- case TY_SHORT:
- nbits = 16;
- break;
- case TY_USHORT:
- nbits = -16;
- break;
- case TY_INT:
- case TY_LONG:
- nbits = 32;
- break;
- case TY_REAL:
- nbits = -32;
- break;
- case TY_DOUBLE:
- nbits = -64;
- break;
- default:
- (void)fprintf(stderr,"Unsupported data type: %d\n", pixtype);
- return (NULL);
- }
- hputi4 (fitsheader,"BITPIX",nbits);
- hputcom (fitsheader,"BITPIX", "IRAF .imh pixel type");
- fhead = fhead + 80;
-
- /* Set image dimensions in FITS header */
- nax = irafgeti4 (irafheader, imndim);
- hputi4 (fitsheader,"NAXIS",nax);
- hputcom (fitsheader,"NAXIS", "IRAF .imh naxis");
- fhead = fhead + 80;
-
- n = irafgeti4 (irafheader, imlen);
- hputi4 (fitsheader, "NAXIS1", n);
- hputcom (fitsheader,"NAXIS1", "IRAF .imh image naxis[1]");
- fhead = fhead + 80;
-
- if (nax > 1) {
- n = irafgeti4 (irafheader, imlen+4);
- hputi4 (fitsheader, "NAXIS2", n);
- hputcom (fitsheader,"NAXIS2", "IRAF .imh image naxis[2]");
- }
- else
- hputi4 (fitsheader, "NAXIS2", 1);
- hputcom (fitsheader,"NAXIS2", "IRAF .imh naxis[2]");
- fhead = fhead + 80;
-
- if (nax > 2) {
- n = irafgeti4 (irafheader, imlen+8);
- hputi4 (fitsheader, "NAXIS3", n);
- hputcom (fitsheader,"NAXIS3", "IRAF .imh image naxis[3]");
- fhead = fhead + 80;
- }
- if (nax > 3) {
- n = irafgeti4 (irafheader, imlen+12);
- hputi4 (fitsheader, "NAXIS4", n);
- hputcom (fitsheader,"NAXIS4", "IRAF .imh image naxis[4]");
- fhead = fhead + 80;
- }
-
- /* Set object name in FITS header */
- if (imhver == 2)
- objname = irafgetc (irafheader, IM2_TITLE, SZ_IM2TITLE);
- else
- objname = irafgetc2 (irafheader, IM_TITLE, SZ_IMTITLE);
- if ((lstr = strlen (objname)) < 8) {
- for (i = lstr; i < 8; i++)
- objname[i] = ' ';
- objname[8] = 0;
- }
- hputs (fitsheader,"OBJECT",objname);
- hputcom (fitsheader,"OBJECT", "IRAF .imh title");
- free (objname);
- fhead = fhead + 80;
-
- /* Save physical axis lengths so image file can be read */
- n = irafgeti4 (irafheader, imphyslen);
- hputi4 (fitsheader, "NPAXIS1", n);
- hputcom (fitsheader,"NPAXIS1", "IRAF .imh physical naxis[1]");
- fhead = fhead + 80;
- if (nax > 1) {
- n = irafgeti4 (irafheader, imphyslen+4);
- hputi4 (fitsheader, "NPAXIS2", n);
- hputcom (fitsheader,"NPAXIS2", "IRAF .imh physical naxis[2]");
- fhead = fhead + 80;
- }
- if (nax > 2) {
- n = irafgeti4 (irafheader, imphyslen+8);
- hputi4 (fitsheader, "NPAXIS3", n);
- hputcom (fitsheader,"NPAXIS3", "IRAF .imh physical naxis[3]");
- fhead = fhead + 80;
- }
- if (nax > 3) {
- n = irafgeti4 (irafheader, imphyslen+12);
- hputi4 (fitsheader, "NPAXIS4", n);
- hputcom (fitsheader,"NPAXIS4", "IRAF .imh physical naxis[4]");
- fhead = fhead + 80;
- }
-
- /* Save image minimum and maximum in header */
- rmax = irafgetr4 (irafheader, immax);
- rmin = irafgetr4 (irafheader, immin);
- if (rmin != rmax) {
- hputr4 (fitsheader, "IRAFMIN", &rmin);
- fhead = fhead + 80;
- hputcom (fitsheader,"IRAFMIN", "IRAF .imh minimum");
- hputr4 (fitsheader, "IRAFMAX", &rmax);
- hputcom (fitsheader,"IRAFMAX", "IRAF .imh maximum");
- fhead = fhead + 80;
- }
-
- /* Save image header filename in header */
- nl = hputm (fitsheader,"IMHFIL",hdrname);
- if (nl > 0) {
- lname = strlen (hdrname);
- strcpy (fitsline, "IRAF header file name");
- if (lname < 43)
- hputcom (fitsheader,"IMHFIL_1", fitsline);
- else if (lname > 67 && lname < 110)
- hputcom (fitsheader,"IMHFIL_2", fitsline);
- else if (lname > 134 && lname < 177)
- hputcom (fitsheader,"IMHFIL_3", fitsline);
- }
- if (nl > 0) fhead = fhead + (nl * 80);
-
- /* Save image pixel file pathname in header */
- if (imhver == 2)
- pixname = irafgetc (irafheader, IM2_PIXFILE, SZ_IM2PIXFILE);
- else
- pixname = irafgetc2 (irafheader, IM_PIXFILE, SZ_IMPIXFILE);
- if (strncmp(pixname, "HDR", 3) == 0 ) {
- newpixname = same_path (pixname, hdrname);
- free (pixname);
- pixname = newpixname;
- }
- if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) {
- newpixname = same_path (pixname, hdrname);
- free (pixname);
- pixname = newpixname;
- }
-
- if ((bang = strchr (pixname, '!')) != NULL )
- nl = hputm (fitsheader,"PIXFIL",bang+1);
- else
- nl = hputm (fitsheader,"PIXFIL",pixname);
- free (pixname);
- if (nl > 0) {
- strcpy (fitsline, "IRAF .pix pixel file");
- if (lname < 43)
- hputcom (fitsheader,"PIXFIL_1", fitsline);
- else if (lname > 67 && lname < 110)
- hputcom (fitsheader,"PIXFIL_2", fitsline);
- else if (lname > 134 && lname < 177)
- hputcom (fitsheader,"PIXFIL_3", fitsline);
- }
- if (nl > 0) fhead = fhead + (nl * 80);
-
- /* Save image offset from star of pixel file */
- pixoff = irafgeti4 (irafheader, impixoff);
- pixoff = (pixoff - 1) * 2;
- hputi4 (fitsheader, "PIXOFF", pixoff);
- hputcom (fitsheader,"PIXOFF", "IRAF .pix pixel offset (Do not change!)");
- fhead = fhead + 80;
-
- /* Save IRAF file format version in header */
- hputi4 (fitsheader,"IMHVER",imhver);
- hputcom (fitsheader,"IMHVER", "IRAF .imh format version (1 or 2)");
- fhead = fhead + 80;
-
- /* Set flag if header numbers are byte-reversed on this machine */
- if (machswap() != headswap)
- hputl (fitsheader, "HEADSWAP", 1);
- else
- hputl (fitsheader, "HEADSWAP", 0);
- hputcom (fitsheader,"HEADSWAP", "IRAF header, FITS byte orders differ if T");
- fhead = fhead + 80;
-
- /* Set flag if image pixels are byte-reversed on this machine */
- if (imhver == 2) {
- hpixswap = irafgeti4 (irafheader, IM2_SWAPPED);
- if (headswap && !hpixswap)
- pixswap = 1;
- else if (!headswap && hpixswap)
- pixswap = 1;
- else
- pixswap = 0;
- }
- else
- pixswap = headswap;
- if (machswap() != pixswap)
- hputl (fitsheader, "PIXSWAP", 1);
- else
- hputl (fitsheader, "PIXSWAP", 0);
- hputcom (fitsheader,"PIXSWAP", "IRAF pixels, FITS byte orders differ if T");
- fhead = fhead + 80;
-
- /* Read modification time */
- mtime = irafgeti4 (irafheader, imtime);
- if (mtime == 0)
- dstring = lt2fd ();
- else
- dstring = tsi2fd (mtime);
- hputs (fitsheader, "DATE-MOD", dstring);
- hputcom (fitsheader,"DATE-MOD", "Date of latest file modification");
- free (dstring);
- fhead = fhead + 80;
-
- /* Add user portion of IRAF header to FITS header */
- fitsline[80] = 0;
- if (imhver == 2) {
- imu = LEN_IM2HDR;
- chead = irafheader;
- j = 0;
- for (k = 0; k < 80; k++)
- fitsline[k] = ' ';
- for (i = imu; i < nbiraf; i++) {
- irafchar = chead[i];
- if (irafchar == 0)
- break;
- else if (irafchar == 10) {
- (void)strncpy (fhead, fitsline, 80);
- /* fprintf (stderr,"%80s\n",fitsline); */
- if (strncmp (fitsline, "OBJECT ", 7) != 0) {
- fhead = fhead + 80;
- }
- for (k = 0; k < 80; k++)
- fitsline[k] = ' ';
- j = 0;
- }
- else {
- if (j > 80) {
- if (strncmp (fitsline, "OBJECT ", 7) != 0) {
- (void)strncpy (fhead, fitsline, 80);
- /* fprintf (stderr,"%80s\n",fitsline); */
- j = 9;
- fhead = fhead + 80;
- }
- for (k = 0; k < 80; k++)
- fitsline[k] = ' ';
- }
- if (irafchar > 32 && irafchar < 127)
- fitsline[j] = irafchar;
- j++;
- }
- }
- }
- else {
- imu = LEN_IMHDR;
- chead = irafheader;
- if (headswap == 1)
- ib = 0;
- else
- ib = 1;
- for (k = 0; k < 80; k++)
- fitsline[k] = ' ';
- j = 0;
- for (i = imu; i < nbiraf; i=i+2) {
- irafchar = chead[i+ib];
- if (irafchar == 0)
- break;
- else if (irafchar == 10) {
- if (strncmp (fitsline, "OBJECT ", 7) != 0) {
- (void)strncpy (fhead, fitsline, 80);
- fhead = fhead + 80;
- }
- /* fprintf (stderr,"%80s\n",fitsline); */
- j = 0;
- for (k = 0; k < 80; k++)
- fitsline[k] = ' ';
- }
- else {
- if (j > 80) {
- if (strncmp (fitsline, "OBJECT ", 7) != 0) {
- (void)strncpy (fhead, fitsline, 80);
- j = 9;
- fhead = fhead + 80;
- }
- /* fprintf (stderr,"%80s\n",fitsline); */
- for (k = 0; k < 80; k++)
- fitsline[k] = ' ';
- }
- if (irafchar > 32 && irafchar < 127)
- fitsline[j] = irafchar;
- j++;
- }
- }
- }
-
- /* Add END to last line */
- (void)strncpy (fhead, endline, 80);
-
- /* Find end of last 2880-byte block of header */
- fhead = ksearch (fitsheader, "END") + 80;
- nblock = *nbfits / 2880;
- fhead1 = fitsheader + (nblock * 2880);
-
- /* Pad rest of header with spaces */
- strncpy (endline," ",3);
- for (fp = fhead; fp < fhead1; fp = fp + 80) {
- (void)strncpy (fp, endline,80);
- }
-
- return (fitsheader);
-}
-
-
-int
-irafwhead (hdrname, lhead, irafheader, fitsheader)
-
-char *hdrname; /* Name of IRAF header file */
-int lhead; /* Length of IRAF header */
-char *irafheader; /* IRAF header */
-char *fitsheader; /* FITS image header */
-
-{
- int fd;
- int nbw, nbhead, lphead, pixswap;
-
- /* Get rid of redundant header information */
- hgeti4 (fitsheader, "PIXOFF", &lphead);
- hgeti4 (fitsheader, "PIXSWAP", &pixswap);
-
- /* Write IRAF header file */
-
- /* Convert FITS header to IRAF header */
- irafheader = fits2iraf (fitsheader, irafheader, lhead, &nbhead);
- if (irafheader == NULL) {
- fprintf (stderr, "IRAFWIMAGE: file %s header error\n", hdrname);
- return (-1);
- }
-
- /* Open the output file */
- if (!access (hdrname, 0)) {
- fd = open (hdrname, O_WRONLY);
- if (fd < 3) {
- fprintf (stderr, "IRAFWIMAGE: file %s not writeable\n", hdrname);
- return (0);
- }
- }
- else {
- fd = open (hdrname, O_RDWR+O_CREAT, 0666);
- if (fd < 3) {
- fprintf (stderr, "IRAFWIMAGE: cannot create file %s\n", hdrname);
- return (0);
- }
- }
-
- /* Write IRAF header to disk file */
- nbw = write (fd, irafheader, nbhead);
- (void) ftruncate (fd, nbhead);
- close (fd);
- if (nbw < nbhead) {
- (void)fprintf(stderr, "IRAF header file %s: %d / %d bytes written.\n",
- hdrname, nbw, nbhead);
- return (-1);
- }
-
- return (nbw);
-}
-
-/* IRAFWIMAGE -- write IRAF .imh header file and .pix image file
- * No matter what the input, this always writes in the local byte order */
-
-int
-irafwimage (hdrname, lhead, irafheader, fitsheader, image )
-
-char *hdrname; /* Name of IRAF header file */
-int lhead; /* Length of IRAF header */
-char *irafheader; /* IRAF header */
-char *fitsheader; /* FITS image header */
-char *image; /* IRAF image */
-
-{
- int fd;
- char *bang;
- int nbw, bytepix, bitpix, naxis, naxis1, naxis2, nbimage, lphead;
- char *pixn, *newpixname;
- char pixname[SZ_IM2PIXFILE+1];
- int imhver, pixswap;
-
- hgeti4 (fitsheader, "IMHVER", &imhver);
-
- if (!hgetm (fitsheader, "PIXFIL", SZ_IM2PIXFILE, pixname)) {
- if (imhver == 2)
- pixn = irafgetc (irafheader, IM2_PIXFILE, SZ_IM2PIXFILE);
- else
- pixn = irafgetc2 (irafheader, IM_PIXFILE, SZ_IMPIXFILE);
- if (strncmp(pixn, "HDR", 3) == 0 ) {
- newpixname = same_path (pixn, hdrname);
- strcpy (pixname, newpixname);
- free (newpixname);
- }
- else {
- if ((bang = strchr (pixn, '!')) != NULL )
- strcpy (pixname, bang+1);
- else
- strcpy (pixname, pixn);
- }
- free (pixn);
- }
-
- /* Find number of bytes to write */
- hgeti4 (fitsheader,"NAXIS",&naxis);
- hgeti4 (fitsheader,"NAXIS1",&naxis1);
- hgeti4 (fitsheader,"NAXIS2",&naxis2);
- hgeti4 (fitsheader,"BITPIX",&bitpix);
- if (bitpix < 0)
- bytepix = -bitpix / 8;
- else
- bytepix = bitpix / 8;
-
- /* If either dimension is one and image is 3-D, read all three dimensions */
- if (naxis == 3 && ((naxis1 == 1) | (naxis2 == 1))) {
- int naxis3;
- hgeti4 (fitsheader,"NAXIS3",&naxis3);
- nbimage = naxis1 * naxis2 * naxis3 * bytepix;
- }
- else
- nbimage = naxis1 * naxis2 * bytepix;
-
- /* Read information about pixel file from header */
- hgeti4 (fitsheader, "PIXOFF", &lphead);
- hgeti4 (fitsheader, "PIXSWAP", &pixswap);
-
- /* Write IRAF header file */
- if (irafwhead (hdrname, lhead, irafheader, fitsheader))
- return (0);
-
- /* Open the output file */
- if (!access (pixname, 0)) {
- fd = open (pixname, O_WRONLY);
- if (fd < 3) {
- fprintf (stderr, "IRAFWIMAGE: file %s not writeable\n", pixname);
- return (0);
- }
- }
- else {
- fd = open (pixname, O_RDWR+O_CREAT, 0666);
- if (fd < 3) {
- fprintf (stderr, "IRAFWIMAGE: cannot create file %s\n", pixname);
- return (0);
- }
- }
-
- /* Write header to IRAF pixel file */
- if (imhver == 2)
- irafputc ("impv2", irafheader, 0, 5);
- else
- irafputc2 ("impix", irafheader, 0, 5);
- nbw = write (fd, irafheader, lphead);
-
- /* Byte-reverse image, if necessary */
- if (pixswap)
- irafswap (bitpix, image, nbimage);
-
- /* Write data to IRAF pixel file */
- nbw = write (fd, image, nbimage);
- close (fd);
-
- return (nbw);
-}
-
-
-/* Put filename and header path together */
-
-static char *
-same_path (pixname, hdrname)
-
-char *pixname; /* IRAF pixel file pathname */
-char *hdrname; /* IRAF image header file pathname */
-
-{
- int len, plen;
- char *newpixname;
-
- newpixname = (char *) calloc (SZ_IM2PIXFILE, 1);
-
- /* Pixel file is in same directory as header */
- if (strncmp(pixname, "HDR$", 4) == 0 ) {
- (void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE);
-
- /* find the end of the pathname */
- len = strlen (newpixname);
-#ifndef VMS
- while( (len > 0) && (newpixname[len-1] != '/') )
-#else
- while( (len > 0) && (newpixname[len-1] != ']') && (newpixname[len-1] != ':') )
-#endif
- len--;
-
- /* add name */
- newpixname[len] = '\0';
- plen = strlen (pixname) - 4;
- if (len + plen > SZ_IM2PIXFILE)
- (void)strncat (newpixname, &pixname[4], SZ_IM2PIXFILE - len);
- else
- (void)strncat (newpixname, &pixname[4], plen);
- }
-
- /* Bare pixel file with no path is assumed to be same as HDR$filename */
- else if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) {
- (void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE);
-
- /* find the end of the pathname */
- len = strlen (newpixname);
-#ifndef VMS
- while( (len > 0) && (newpixname[len-1] != '/') )
-#else
- while( (len > 0) && (newpixname[len-1] != ']') && (newpixname[len-1] != ':') )
-#endif
- len--;
-
- /* add name */
- newpixname[len] = '\0';
- (void)strncat (newpixname, pixname, SZ_IM2PIXFILE);
- }
-
- /* Pixel file has same name as header file, but with .pix extension */
- else if (strncmp (pixname, "HDR", 3) == 0) {
-
- /* load entire header name string into name buffer */
- (void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE);
- len = strlen (newpixname);
- newpixname[len-3] = 'p';
- newpixname[len-2] = 'i';
- newpixname[len-1] = 'x';
- }
-
- return (newpixname);
-}
-
-/* Convert FITS image header to IRAF image header, returning IRAF header */
-/* No matter what the input, this always writes in the local byte order */
-
-char *
-fits2iraf (fitsheader, irafheader, nbhead, nbiraf)
-
-char *fitsheader; /* FITS image header */
-char *irafheader; /* IRAF image header (returned updated) */
-int nbhead; /* Length of IRAF header */
-int *nbiraf; /* Length of returned IRAF header */
-
-{
- int i, n, pixoff, lhdrdir;
- short *irafp, *irafs, *irafu;
- char *iraf2u, *iraf2p, *filename, *hdrdir;
- char *fitsend, *fitsp, pixfile[SZ_IM2PIXFILE], hdrfile[SZ_IM2HDRFILE];
- char title[SZ_IM2TITLE], temp[80];
- int nax, nlfits, imhver, nbits, pixtype, hdrlength, mtime;
- int imndim, imlen, imphyslen, impixtype, imhlen, imtime, immax, immin;
- float rmax, rmin;
-
- hgeti4 (fitsheader, "IMHVER", &imhver);
- hdel (fitsheader, "IMHVER");
- hdel (fitsheader, "IMHVER");
- hgetl (fitsheader, "HEADSWAP", &headswap);
- hdel (fitsheader, "HEADSWAP");
- hdel (fitsheader, "HEADSWAP");
- if (imhver == 2) {
- imhlen = IM2_HDRLEN;
- imndim = IM2_NDIM;
- imlen = IM2_LEN;
- imtime = IM2_MTIME;
- imphyslen = IM2_PHYSLEN;
- impixtype = IM2_PIXTYPE;
- immax = IM2_MAX;
- immin = IM2_MIN;
- }
- else {
- imhlen = IM_HDRLEN;
- imndim = IM_NDIM;
- imlen = IM_LEN;
- imtime = IM_MTIME;
- imphyslen = IM_PHYSLEN;
- impixtype = IM_PIXTYPE;
- immax = IM_MAX;
- immin = IM_MIN;
- }
-
- /* Delete FITS header keyword not needed by IRAF */
- hdel (fitsheader,"SIMPLE");
-
- /* Set IRAF image data type */
- hgeti4 (fitsheader,"BITPIX", &nbits);
- switch (nbits) {
- case 8:
- pixtype = TY_CHAR;
- break;
- case -8:
- pixtype = TY_UBYTE;
- break;
- case 16:
- pixtype = TY_SHORT;
- break;
- case -16:
- pixtype = TY_USHORT;
- break;
- case 32:
- pixtype = TY_INT;
- break;
- case -32:
- pixtype = TY_REAL;
- break;
- case -64:
- pixtype = TY_DOUBLE;
- break;
- default:
- (void)fprintf(stderr,"Unsupported data type: %d\n", nbits);
- return (NULL);
- }
- irafputi4 (irafheader, impixtype, pixtype);
- hdel (fitsheader,"BITPIX");
-
- /* Set IRAF image dimensions */
- hgeti4 (fitsheader,"NAXIS",&nax);
- irafputi4 (irafheader, imndim, nax);
- hdel (fitsheader,"NAXIS");
-
- hgeti4 (fitsheader, "NAXIS1", &n);
- irafputi4 (irafheader, imlen, n);
- irafputi4 (irafheader, imphyslen, n);
- hdel (fitsheader,"NAXIS1");
-
- hgeti4 (fitsheader,"NAXIS2",&n);
- irafputi4 (irafheader, imlen+4, n);
- irafputi4 (irafheader, imphyslen+4, n);
- hdel (fitsheader,"NAXIS2");
-
- if (nax > 2) {
- hgeti4 (fitsheader,"NAXIS3",&n);
- irafputi4 (irafheader, imlen+8, n);
- irafputi4 (irafheader, imphyslen+8, n);
- hdel (fitsheader,"NAXIS3");
- }
-
- if (nax > 3) {
- hgeti4 (fitsheader,"NAXIS4",&n);
- irafputi4 (irafheader, imlen+12, n);
- irafputi4 (irafheader, imphyslen+12, n);
- hdel (fitsheader,"NAXIS4");
- }
-
- /* Set image pixel value limits */
- rmin = 0.0;
- hgetr4 (fitsheader, "IRAFMIN", &rmin);
- rmax = 0.0;
- hgetr4 (fitsheader, "IRAFMAX", &rmax);
- if (rmin != rmax) {
- irafputr4 (irafheader, immax, rmax);
- irafputr4 (irafheader, immin, rmin);
- }
- hdel (fitsheader, "IRAFMIN");
- hdel (fitsheader, "IRAFMAX");
-
- /* Replace pixel file name, if it is in the FITS header */
- if (hgetm (fitsheader, "PIXFIL", SZ_IM2PIXFILE, pixfile)) {
- if (strchr (pixfile, '/')) {
- if (hgetm (fitsheader, "IMHFIL", SZ_IM2HDRFILE, hdrfile)) {
- hdrdir = strrchr (hdrfile, '/');
- if (hdrdir != NULL) {
- lhdrdir = hdrdir - hdrfile + 1;
- if (!strncmp (pixfile, hdrfile, lhdrdir)) {
- filename = pixfile + lhdrdir;
- strcpy (temp, "HDR$");
- strcat (temp,filename);
- strcpy (pixfile, temp);
- }
- }
- if (pixfile[0] != '/' && pixfile[0] != 'H') {
- strcpy (temp, "HDR$");
- strcat (temp,pixfile);
- strcpy (pixfile, temp);
- }
- }
- }
-
- if (imhver == 2)
- irafputc (pixfile, irafheader, IM2_PIXFILE, SZ_IM2PIXFILE);
- else
- irafputc2 (pixfile, irafheader, IM_PIXFILE, SZ_IMPIXFILE);
- hdel (fitsheader,"PIXFIL_1");
- hdel (fitsheader,"PIXFIL_2");
- hdel (fitsheader,"PIXFIL_3");
- hdel (fitsheader,"PIXFIL_4");
- }
-
- /* Replace header file name, if it is in the FITS header */
- if (hgetm (fitsheader, "IMHFIL", SZ_IM2HDRFILE, pixfile)) {
- if (!strchr (pixfile,'/') && !strchr (pixfile,'$')) {
- strcpy (temp, "HDR$");
- strcat (temp,pixfile);
- strcpy (pixfile, temp);
- }
- if (imhver == 2)
- irafputc (pixfile, irafheader, IM2_HDRFILE, SZ_IM2HDRFILE);
- else
- irafputc2 (pixfile, irafheader, IM_HDRFILE, SZ_IMHDRFILE);
- hdel (fitsheader, "IMHFIL_1");
- hdel (fitsheader, "IMHFIL_2");
- hdel (fitsheader, "IMHFIL_3");
- hdel (fitsheader, "IMHFIL_4");
- }
-
- /* Replace image title, if it is in the FITS header */
- if (hgets (fitsheader, "OBJECT", SZ_IM2TITLE, title)) {
- if (imhver == 2)
- irafputc (title, irafheader, IM2_TITLE, SZ_IM2TITLE);
- else
- irafputc2 (title, irafheader, IM_TITLE, SZ_IMTITLE);
- hdel (fitsheader, "OBJECT");
- }
- hgeti4 (fitsheader, "PIXOFF", &pixoff);
- hdel (fitsheader, "PIXOFF");
- hdel (fitsheader, "PIXOFF");
- hdel (fitsheader, "PIXSWAP");
- hdel (fitsheader, "PIXSWAP");
- hdel (fitsheader, "DATE-MOD");
- hdel (fitsheader, "DATE-MOD");
- fitsend = ksearch (fitsheader,"END");
-
- /* Find length of FITS header */
- fitsend = ksearch (fitsheader,"END");
- nlfits = ((fitsend - fitsheader) / 80);
-
- /* Find new length of IRAF header */
- if (imhver == 2)
- *nbiraf = LEN_IM2HDR + (81 * nlfits);
- else
- *nbiraf = LEN_IMHDR + (162 * nlfits);
- if (*nbiraf > nbhead)
- irafheader = realloc (irafheader, *nbiraf);
-
- /* Reset modification time */
- mtime = lt2tsi ();
- irafputi4 (irafheader, imtime, mtime);
-
- /* Replace user portion of IRAF header with remaining FITS header */
- if (imhver == 2) {
- iraf2u = irafheader + LEN_IM2HDR;
- iraf2p = iraf2u;
- for (fitsp = fitsheader; fitsp < fitsend; fitsp = fitsp + 80) {
- for (i = 0; i < 80; i++)
- *iraf2p++ = fitsp[i];
- *iraf2p++ = 10;
- }
- *iraf2p++ = 0;
- *nbiraf = iraf2p - irafheader;
- hdrlength = 1 + *nbiraf / 2;
- }
- else {
- irafs = (short *)irafheader;
- irafu = irafs + (LEN_IMHDR / 2);
- irafp = irafu;
- for (fitsp = fitsheader; fitsp < fitsend; fitsp = fitsp + 80) {
- for (i = 0; i < 80; i++)
- *irafp++ = (short) fitsp[i];
- *irafp++ = 10;
- }
- *irafp++ = 0;
- *irafp++ = 32;
- *nbiraf = 2 * (irafp - irafs);
- hdrlength = *nbiraf / 4;
- }
-
- /* Length of header file */
- irafputi4 (irafheader, imhlen, hdrlength);
-
- /* Offset in .pix file to first pixel data
- hputi4 (fitsheader, "PIXOFF", pixoff); */
-
- /* Return number of bytes in new IRAF header */
- return (irafheader);
-}
-
-
-int
-irafgeti4 (irafheader, offset)
-
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before number */
-
-{
- char *ctemp, *cheader;
- int temp;
-
- cheader = irafheader;
- ctemp = (char *) &temp;
-
- /* If header swap flag not set, set it now */
- if (headswap < 0) {
- if (cheader[offset] > 0)
- headswap = 1;
- else
- headswap = 0;
- }
-
- if (machswap() != headswap) {
- ctemp[3] = cheader[offset];
- ctemp[2] = cheader[offset+1];
- ctemp[1] = cheader[offset+2];
- ctemp[0] = cheader[offset+3];
- }
- else {
- ctemp[0] = cheader[offset];
- ctemp[1] = cheader[offset+1];
- ctemp[2] = cheader[offset+2];
- ctemp[3] = cheader[offset+3];
- }
- return (temp);
-}
-
-
-float
-irafgetr4 (irafheader, offset)
-
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before number */
-
-{
- char *ctemp, *cheader;
- float temp;
-
- cheader = irafheader;
- ctemp = (char *) &temp;
-
- /* If header swap flag not set, set it now */
- if (headswap < 0) {
- if (cheader[offset] > 0)
- headswap = 1;
- else
- headswap = 0;
- }
-
- if (machswap() != headswap) {
- ctemp[3] = cheader[offset];
- ctemp[2] = cheader[offset+1];
- ctemp[1] = cheader[offset+2];
- ctemp[0] = cheader[offset+3];
- }
- else {
- ctemp[0] = cheader[offset];
- ctemp[1] = cheader[offset+1];
- ctemp[2] = cheader[offset+2];
- ctemp[3] = cheader[offset+3];
- }
- return (temp);
-}
-
-
-/* IRAFGETC2 -- Get character string from arbitrary part of v.1 IRAF header */
-
-char *
-irafgetc2 (irafheader, offset, nc)
-
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before string */
-int nc; /* Maximum number of characters in string */
-
-{
- char *irafstring, *string;
-
- irafstring = irafgetc (irafheader, offset, 2*(nc+1));
- string = iraf2str (irafstring, nc);
- free (irafstring);
-
- return (string);
-}
-
-
-/* IRAFGETC -- Get character string from arbitrary part of IRAF header */
-
-char *
-irafgetc (irafheader, offset, nc)
-
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before string */
-int nc; /* Maximum number of characters in string */
-
-{
- char *ctemp, *cheader;
- int i;
-
- cheader = irafheader;
- ctemp = (char *) calloc (nc+1, 1);
- if (ctemp == NULL) {
- (void)fprintf(stderr, "IRAFGETC Cannot allocate %d-byte variable\n",
- nc+1);
- return (NULL);
- }
- for (i = 0; i < nc; i++) {
- ctemp[i] = cheader[offset+i];
- if (ctemp[i] > 0 && ctemp[i] < 32)
- ctemp[i] = ' ';
- }
-
- return (ctemp);
-}
-
-
-/* Convert IRAF 2-byte/char string to 1-byte/char string */
-
-char *
-iraf2str (irafstring, nchar)
-
-char *irafstring; /* IRAF 2-byte/character string */
-int nchar; /* Number of characters in string */
-{
- char *string;
- int i, j;
-
- /* Set swap flag according to position of nulls in 2-byte characters */
- if (headswap < 0) {
- if (irafstring[0] != 0 && irafstring[1] == 0)
- headswap = 1;
- else if (irafstring[0] == 0 && irafstring[1] != 0)
- headswap = 0;
- else
- return (NULL);
- }
-
- string = (char *) calloc (nchar+1, 1);
- if (string == NULL) {
- (void)fprintf(stderr, "IRAF2STR Cannot allocate %d-byte variable\n",
- nchar+1);
- return (NULL);
- }
-
- /* Swap bytes, if requested */
- if (headswap)
- j = 0;
- else
- j = 1;
-
- /* Convert appropriate byte of input to output character */
- for (i = 0; i < nchar; i++) {
- string[i] = irafstring[j];
- j = j + 2;
- }
-
- return (string);
-}
-
-
-/* IRAFPUTI4 -- Insert 4-byte integer into arbitrary part of IRAF header */
-
-static void
-irafputi4 (irafheader, offset, inum)
-
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before number */
-int inum; /* Number to put into header */
-
-{
- char *cn, *chead;
-
- chead = irafheader;
- cn = (char *) &inum;
- if (headswap < 0)
- headswap = 0;
- if (headswap != machswap()) {
- chead[offset+3] = cn[0];
- chead[offset+2] = cn[1];
- chead[offset+1] = cn[2];
- chead[offset] = cn[3];
- }
- else {
- chead[offset] = cn[0];
- chead[offset+1] = cn[1];
- chead[offset+2] = cn[2];
- chead[offset+3] = cn[3];
- }
- return;
-}
-
-
-/* IRAFPUTR4 -- Insert 4-byte real number into arbitrary part of IRAF header */
-
-static void
-irafputr4 (irafheader, offset, rnum)
-
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before number */
-float rnum; /* Number to put into header */
-
-{
- char *cn, *chead;
-
- chead = irafheader;
- cn = (char *) &rnum;
- if (headswap < 0)
- headswap = 0;
- if (headswap != machswap()) {
- chead[offset+3] = cn[0];
- chead[offset+2] = cn[1];
- chead[offset+1] = cn[2];
- chead[offset] = cn[3];
- }
- else {
- chead[offset] = cn[0];
- chead[offset+1] = cn[1];
- chead[offset+2] = cn[2];
- chead[offset+3] = cn[3];
- }
- return;
-}
-
-
-/* IRAFPUTC2 -- Insert character string into arbitrary part of v.1 IRAF header */
-
-static void
-irafputc2 (string, irafheader, offset, nc)
-
-char *string; /* String to insert into header */
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before string */
-int nc; /* Maximum number of characters in string */
-
-{
- char *irafstring;
-
- irafstring = (char *) calloc (2 * nc, 1);
- if (irafstring == NULL) {
- (void)fprintf(stderr, "IRAFPUTC2 Cannot allocate %d-byte variable\n",
- 2 * nc);
- }
- str2iraf (string, irafstring, nc);
- irafputc (irafstring, irafheader, offset, 2*nc);
-
- return;
-}
-
-
-/* IRAFPUTC -- Insert character string into arbitrary part of IRAF header */
-
-static void
-irafputc (string, irafheader, offset, nc)
-
-char *string; /* String to insert into header */
-char *irafheader; /* IRAF image header */
-int offset; /* Number of bytes to skip before string */
-int nc; /* Maximum number of characters in string */
-
-{
- char *chead;
- int i;
-
- chead = irafheader;
- for (i = 0; i < nc; i++)
- chead[offset+i] = string[i];
-
- return;
-}
-
-
-/* STR2IRAF -- Convert 1-byte/char string to IRAF 2-byte/char string */
-
-static void
-str2iraf (string, irafstring, nchar)
-
-char *string; /* 1-byte/character string */
-char *irafstring; /* IRAF 2-byte/character string */
-int nchar; /* Maximum number of characters in IRAF string */
-{
- int i, j, nc, nbytes;
-
- nc = strlen (string);
-
- /* Fill output string with zeroes */
- nbytes = nchar * 2;
- for (i = 0; i < nbytes; i++)
- irafstring[i] = 0;
-
- /* If swapped, start with first byte of 2-byte characters */
- if (headswap)
- j = 0;
- else
- j = 1;
-
- /* Move input characters to appropriate bytes of output */
- for (i = 0; i < nchar; i++) {
- if (i > nc)
- irafstring[j] = 0;
- else
- irafstring[j] = string[i];
- j = j + 2;
- }
-
- return;
-}
-
-
-/* IRAFSWAP -- Reverse bytes of any type of vector in place */
-
-static void
-irafswap (bitpix, string, nbytes)
-
-int bitpix; /* Number of bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-char *string; /* Address of starting point of bytes to swap */
-int nbytes; /* Number of bytes to swap */
-
-{
- switch (bitpix) {
-
- case 16:
- if (nbytes < 2) return;
- irafswap2 (string,nbytes);
- break;
-
- case 32:
- if (nbytes < 4) return;
- irafswap4 (string,nbytes);
- break;
-
- case -16:
- if (nbytes < 2) return;
- irafswap2 (string,nbytes);
- break;
-
- case -32:
- if (nbytes < 4) return;
- irafswap4 (string,nbytes);
- break;
-
- case -64:
- if (nbytes < 8) return;
- irafswap8 (string,nbytes);
- break;
-
- }
- return;
-}
-
-
-/* IRAFSWAP2 -- Swap bytes in string in place */
-
-static void
-irafswap2 (string,nbytes)
-
-
-char *string; /* Address of starting point of bytes to swap */
-int nbytes; /* Number of bytes to swap */
-
-{
- char *sbyte, temp, *slast;
-
- slast = string + nbytes;
- sbyte = string;
- while (sbyte < slast) {
- temp = sbyte[0];
- sbyte[0] = sbyte[1];
- sbyte[1] = temp;
- sbyte= sbyte + 2;
- }
- return;
-}
-
-
-/* IRAFSWAP4 -- Reverse bytes of Integer*4 or Real*4 vector in place */
-
-static void
-irafswap4 (string,nbytes)
-
-char *string; /* Address of Integer*4 or Real*4 vector */
-int nbytes; /* Number of bytes to reverse */
-
-{
- char *sbyte, *slast;
- char temp0, temp1, temp2, temp3;
-
- slast = string + nbytes;
- sbyte = string;
- while (sbyte < slast) {
- temp3 = sbyte[0];
- temp2 = sbyte[1];
- temp1 = sbyte[2];
- temp0 = sbyte[3];
- sbyte[0] = temp0;
- sbyte[1] = temp1;
- sbyte[2] = temp2;
- sbyte[3] = temp3;
- sbyte = sbyte + 4;
- }
-
- return;
-}
-
-
-/* IRAFSWAP8 -- Reverse bytes of Real*8 vector in place */
-
-static void
-irafswap8 (string,nbytes)
-
-char *string; /* Address of Real*8 vector */
-int nbytes; /* Number of bytes to reverse */
-
-{
- char *sbyte, *slast;
- char temp[8];
-
- slast = string + nbytes;
- sbyte = string;
- while (sbyte < slast) {
- temp[7] = sbyte[0];
- temp[6] = sbyte[1];
- temp[5] = sbyte[2];
- temp[4] = sbyte[3];
- temp[3] = sbyte[4];
- temp[2] = sbyte[5];
- temp[1] = sbyte[6];
- temp[0] = sbyte[7];
- sbyte[0] = temp[0];
- sbyte[1] = temp[1];
- sbyte[2] = temp[2];
- sbyte[3] = temp[3];
- sbyte[4] = temp[4];
- sbyte[5] = temp[5];
- sbyte[6] = temp[6];
- sbyte[7] = temp[7];
- sbyte = sbyte + 8;
- }
- return;
-}
-
-
-/* Set flag if machine on which program is executing is not FITS byte order
- * ( i.e., if it is an Alpha or PC instead of a Sun ) */
-
-static int
-machswap ()
-
-{
- char *ctest;
- int itest;
-
- itest = 1;
- ctest = (char *)&itest;
- if (*ctest)
- return (1);
- else
- return (0);
-}
-
-
-/* ISIRAF -- return 1 if IRAF imh file, else 0 */
-
-int
-isiraf (filename)
-
-char *filename; /* Name of file for which to find size */
-{
- if (strchr (filename, '='))
- return (0);
- else if (strsrch (filename, ".imh"))
- return (1);
- else
- return (0);
-}
-
-
-/* IRAFSIZE -- return size of file in bytes */
-
-static int
-irafsize (diskfile)
-
-FILE *diskfile; /* Descriptor of file for which to find size */
-{
- long filesize;
- long offset;
-
- offset = (long) 0;
-
- /* Move to end of the file */
- if (fseek (diskfile, offset, SEEK_END) == 0) {
-
- /* Position is the size of the file */
- filesize = ftell (diskfile);
-
- /* Move file pointer back tot he start of the file */
- fseek (diskfile, offset, SEEK_SET);
- }
-
- else
- filesize = -1;
-
- return (filesize);
-}
-
-/* Feb 15 1996 New file
- * Apr 10 1996 Add more documentation
- * Apr 17 1996 Print error message on open failure
- * Jun 5 1996 Add byte swapping (reversal); use streams
- * Jun 10 1996 Make fixes after running lint
- * Jun 12 1996 Use IMSWAP subroutines instead of local ones
- * Jul 3 1996 Go back to using local IRAFSWAP subroutines
- * Jul 3 1996 Write to pixel file from FITS header
- * Jul 10 1996 Allocate all headers
- * Aug 13 1996 Add unistd.h to include list
- * Aug 26 1996 Allow 1-d images; fix comments; fix arguments after lint
- * Aug 26 1996 Add IRAF header lingth argument to IRAFWIMAGE and IRAFWHEAD
- * Aug 28 1996 Clean up code in IRAF2FITS
- * Aug 30 1996 Use write instead of fwrite
- * Sep 4 1996 Fix write mode bug
- * Oct 15 1996 Drop unused variables
- * Oct 17 1996 Minor fix after lint; cast arguments to STR2IRAF
- *
- * May 15 1997 Fix returned header length in IRAF2FITS
- * Dec 19 1997 Add IRAF version 2 .imh files
- *
- * Jan 2 1998 Allow uneven length of user parameter lines in IRAF headers
- * Jan 6 1998 Fix output of imh2 headers; allow newlines in imh1 headers
- * Jan 14 1998 Handle byte reversing correctly
- * Apr 17 1998 Add new IRAF data types unsigned char and unsigned short
- * Apr 30 1998 Fix error return if illegal data type after Allan Brighton
- * May 15 1998 Delete header keywords used for IRAF binary values
- * May 15 1998 Fix bug so FITS OBJECT is put into IRAF title
- * May 26 1998 Fix bug in fits2iraf keeping track of end of header
- * May 27 1998 Include fitsio.h instead of fitshead.h
- * Jun 4 1998 Write comments into header for converted IRAF binary values
- * Jun 4 1998 Pad FITS strings to 8 character minimum
- * Jul 24 1998 Write header file length to IRAF header file
- * Jul 27 1998 Print error messages to stderr for all failed malloc's
- * Jul 27 1998 Fix bug padding FITS header with spaces in iraf2fits
- * Jul 27 1998 Write modification time to IRAF header file
- * Aug 6 1998 Change fitsio.h to fitsfile.h; imhio.c to imhfile.c
- * Oct 1 1998 Set irafswap flag only once per file
- * Oct 5 1998 Add subroutines irafsize() and isiraf()
- * Nov 16 1998 Fix byte-swap checking
- *
- * Jan 27 1999 Read and write all of 3D image if one dimension is =1
- * Jul 13 1999 Improve error messages; change irafsize() argument to fd
- * Sep 22 1999 Don't copy OBJECT keyword from .imh file; use binary title
- * Oct 14 1999 Set FITS header length
- * Oct 20 1999 Allocate 5000 extra bytes for IRAF header
- * Nov 2 1999 Fix getclocktime() to use only time.h subroutines
- * Nov 2 1999 Add modification date and time to FITS header in iraf2fits()
- * Nov 24 1999 Delete HEADSWAP, IMHVER, DATE-MOD from header before writing
- * Nov 29 1999 Delete PIXSWAP, IRAF-MIN, IRAF-MAX from header before writing
- *
- * Jan 13 2000 Fix bug which dropped characters in iraf2fits()
- * Feb 3 2000 Declare timezone long, not time_t; drop unused variable
- * Mar 7 2000 Add more code to keep pixel file path short
- * Mar 10 2000 Fix bugs when writing .imh file headers
- * Mar 21 2000 Change computation of IRAF time tags to use only data structure
- * Mar 22 2000 Move IRAF time tag computation to lt2tsi() in dateutil.c
- * Mar 24 2000 Use Unix file update time if none in header
- * Mar 27 2000 Use hputm() to save file paths up to 256 characters
- * Mar 27 2000 Write filename comments after 1st keyword with short value
- * Mar 27 2000 Allocate pixel file name in same_path to imh2 length
- * Mar 29 2000 Add space after last linefeed of header in fits2iraf()
- * Apr 28 2000 Dimension pixname in irafwimage()
- * May 1 2000 Fix code for updating pixel file name with HDR$ in fits2iraf()
- * Jun 2 2000 Drop unused variables in fits2iraf() after lint
- * Jun 12 2000 If pixel filename has no / or $, use same path as header file
- * Sep 6 2000 Use header directory if pixel file not found at its pathname
- *
- * Jan 11 2001 Print all messages to stderr
- * Aug 24 2001 In isiraf(), return 0 if argument contains an equal sign
- *
- * Apr 8 2002 Fix bug in error message for unidentified nbits in fits2iraf()
- *
- * Feb 4 2003 Open catalog file rb instead of r (Martin Ploner, Bern)
- * Oct 31 2003 Read image only in irafrimage() if physical dimension > image dim.
- * Nov 3 2003 Set NAXISi to image, not physical dimensions in iraf2fits()
- *
- * Jun 13 2005 Drop trailing spaces on pixel file name
- *
- * Jun 20 2006 Initialize uninitialized variables
- *
- * Jan 4 2007 Change hputr4() calls to send pointer to value
- * Jan 8 2007 Drop unused variable nbx in irafrimage()
- * Jan 8 2007 Align header and image buffers properly by 4 and by BITPIX
- *
- * May 20 2011 Free newpixname, not pixname in irafwimage()
- *
- * Mar 27 2012 Fix pixname's appending to newpixname to avoid overflow
- */
diff --git a/funtools/wcs/imio.c b/funtools/wcs/imio.c
deleted file mode 100644
index 9bbf5a4..0000000
--- a/funtools/wcs/imio.c
+++ /dev/null
@@ -1,1543 +0,0 @@
-/*** File wcslib/imio.c
- *** October 30, 2012
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1996-2012
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: imio.c (image pixel manipulation)
- * Purpose: Read and write pixels from arbitrary data type 2D arrays
- * Subroutine: getpix (image, bitpix, w, h, bz, bs, x, y)
- * Read pixel from 2D image of any numeric type (0,0 lower left)
- * Subroutine: getpix1 (image, bitpix, w, h, bz, bs, x, y)
- * Read pixel from 2D image of any numeric type (1,1 lower left)
- * Subroutine: putpix (image, bitpix, w, h, bz, bs, x, y, dpix)
- * Write pixel into 2D image of any numeric type (0,0 lower left)
- * Subroutine: putpix1 (image, bitpix, w, h, bz, bs, x, y, dpix)
- * Write pixel into 2D image of any numeric type (1,1 lower left)
- * Subroutine: addpix (image, bitpix, w, h, bz, bs, x, y, dpix)
- * Copy pixel into 2D image of any numeric type (0,0 lower left)
- * Subroutine: addpix1 (image, bitpix, w, h, bz, bs, x, y, dpix)
- * Add pixel into 2D image of any numeric type (1,1 lower left)
- * Subroutine: maxvec (image, bitpix, bz, bs, pix1, npix)
- * Get maximum of vector from 2D image of any numeric type
- * Subroutine: minvec (image, bitpix, bz, bs, pix1, npix)
- * Get minimum of vector from 2D image of any numeric type
- * Subroutine: getvec (image, bitpix, bz, bs, pix1, npix, dvec)
- * Get vector from 2D image of any numeric type
- * Subroutine: putvec (image, bitpix, bz, bs, pix1, npix, dvec)
- * Copy pixel vector into a vector of any numeric type
- * Subroutine: addvec (image, bitpix, bz, bs, pix1, npix, dpix)
- * Add constant to pixel values in a vector
- * Subroutine: multvec (image, bitpix, bz, bs, pix1, npix, dpix)
- * Multiply pixel values in a vector by a constant
- * Subroutine: fillvec (image, bitpix, bz, bs, pix1, npix, dpix)
- * Copy pixel value in a vector of any numeric type
- * Subroutine: fillvec1 (image, bitpix, bz, bs, pix1, npix, dpix)
- * Copy pixel value int a vector of any numeric type
- * Subroutine: movepix (image1, bitpix, w1, x1, y1, image2, w2, x2, y2)
- * Copy pixel from one image location to another
- * Subroutine: imswap (bitpix,string,nbytes)
- * Swap bytes in string in place, with FITS bits/pixel code
- * Subroutine: imswap2 (string,nbytes)
- * Swap bytes in string in place
- * Subroutine imswap4 (string,nbytes)
- * Reverse bytes of Integer*4 or Real*4 vector in place
- * Subroutine imswap8 (string,nbytes)
- * Reverse bytes of Real*8 vector in place
- * Subroutine imswapped ()
- * Return 1 if PC/DEC byte order, else 0
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "fitsfile.h"
-
-static int scale = 1; /* If 0, skip scaling step */
-void
-setscale (scale0)
-int scale0;
-{scale = scale0; return;}
-
-/* GETPIX1 -- Get pixel from 2D FITS image of any numeric type */
-
-double
-getpix1 (image, bitpix, w, h, bzero, bscale, x, y)
-
-char *image; /* Image array as 1-D vector */
-int bitpix; /* FITS bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w; /* Image width in pixels */
-int h; /* Image height in pixels */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int x; /* One-based horizontal pixel number */
-int y; /* One-based vertical pixel number */
-
-{
- return (getpix (image, bitpix, w, h, bzero, bscale, x-1, y-1));
-}
-
-
-/* GETPIX -- Get pixel from 2D image of any numeric type */
-
-double
-getpix (image, bitpix, w, h, bzero, bscale, x, y)
-
-char *image; /* Image array as 1-D vector */
-int bitpix; /* FITS bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w; /* Image width in pixels */
-int h; /* Image height in pixels */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int x; /* Zero-based horizontal pixel number */
-int y; /* Zero-based vertical pixel number */
-
-{
- short *im2;
- int *im4;
- unsigned char *im1;
- unsigned short *imu;
- float *imr;
- double *imd;
- double dpix;
-
-/* Return 0 if coordinates are not inside image */
- if (x < 0 || x >= w)
- return (0.0);
- if (y < 0 || y >= h)
- return (0.0);
-
-/* Extract pixel from appropriate type of array */
- switch (bitpix) {
-
- case 8:
- im1 = (unsigned char *)image;
- dpix = (double) im1[(y*w) + x];
- break;
-
- case 16:
- im2 = (short *)image;
- dpix = (double) im2[(y*w) + x];
- break;
-
- case 32:
- im4 = (int *)image;
- dpix = (double) im4[(y*w) + x];
- break;
-
- case -16:
- imu = (unsigned short *)image;
- dpix = (double) imu[(y*w) + x];
- break;
-
- case -32:
- imr = (float *)image;
- dpix = (double) imr[(y*w) + x];
- break;
-
- case -64:
- imd = (double *)image;
- dpix = imd[(y*w) + x];
- break;
-
- default:
- dpix = 0.0;
- }
- if (scale)
- return (bzero + (bscale * dpix));
- else
- return (dpix);
-}
-
-
-/* PUTPIX1 -- Copy pixel into 2D FITS image of any numeric type */
-
-void
-putpix1 (image, bitpix, w, h, bzero, bscale, x, y, dpix)
-
-char *image;
-int bitpix; /* Number of bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w; /* Image width in pixels */
-int h; /* Image height in pixels */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int x; /* One-based horizontal pixel number */
-int y; /* One-based vertical pixel number */
-double dpix;
-
-{
- putpix (image, bitpix, w, h, bzero, bscale, x-1, y-1, dpix);
- return;
-}
-
-
-/* PUTPIX -- Copy pixel into 2D image of any numeric type */
-
-void
-putpix (image, bitpix, w, h, bzero, bscale, x, y, dpix)
-
-char *image;
-int bitpix; /* Number of bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w; /* Image width in pixels */
-int h; /* Image height in pixels */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int x;
-int y;
-double dpix;
-
-{
- double *imd;
- float *imr;
- int *im4;
- short *im2;
- unsigned short *imu;
- unsigned char *im1;
-
-/* Return if coordinates are not inside image */
- if (x < 0 || x >= w)
- return;
- if (y < 0 || y >= h)
- return;
-
- if (scale)
- dpix = (dpix - bzero) / bscale;
-
- switch (bitpix) {
-
- case 8:
- im1 = (unsigned char *)image;
- if (dpix < 0)
- im1[(y*w) + x] = (unsigned char) (dpix - 0.5);
- else
- im1[(y*w) + x] = (unsigned char) (dpix + 0.5);
- break;
-
- case 16:
- im2 = (short *)image;
- if (dpix < 0)
- im2[(y*w) + x] = (short) (dpix - 0.5);
- else
- im2[(y*w) + x] = (short) (dpix + 0.5);
- break;
-
- case 32:
- im4 = (int *)image;
- if (dpix < 0)
- im4[(y*w) + x] = (int) (dpix - 0.5);
- else
- im4[(y*w) + x] = (int) (dpix + 0.5);
- break;
-
- case -16:
- imu = (unsigned short *)image;
- if (dpix < 0)
- imu[(y*w) + x] = (unsigned short) 0;
- else
- imu[(y*w) + x] = (unsigned short) (dpix + 0.5);
- break;
-
- case -32:
- imr = (float *)image;
- imr[(y*w) + x] = (float) dpix;
- break;
-
- case -64:
- imd = (double *)image;
- imd[(y*w) + x] = dpix;
- break;
-
- }
- return;
-}
-
-
-/* ADDPIX1 -- Add pixel value into 2D FITS image of any numeric type */
-
-void
-addpix1 (image, bitpix, w, h, bzero, bscale, x, y, dpix)
-
-char *image;
-int bitpix; /* Number of bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w; /* Image width in pixels */
-int h; /* Image height in pixels */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int x; /* One-based horizontal pixel number */
-int y; /* One-based vertical pixel number */
-double dpix; /* Value to add to pixel */
-
-{
- addpix (image, bitpix, w, h, bzero, bscale, x-1, y-1, dpix);
- return;
-}
-
-
-/* ADDPIX -- Add constant to pixel values in 2D image of any numeric type */
-
-void
-addpix (image, bitpix, w, h, bzero, bscale, x, y, dpix)
-
-char *image;
-int bitpix; /* Number of bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w; /* Image width in pixels */
-int h; /* Image height in pixels */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int x; /* Zero-based horizontal pixel number */
-int y; /* Zero-based vertical pixel number */
-double dpix; /* Value to add to pixel */
-
-{
- double *imd;
- float *imr;
- int *im4;
- short *im2;
- unsigned short *imu;
- unsigned char *im1;
- int ipix;
-
-/* Return if coordinates are not inside image */
- if (x < 0 || x >= w)
- return;
- if (y < 0 || y >= h)
- return;
-
- if (scale)
- dpix = (dpix - bzero) / bscale;
- ipix = (y * w) + x;
-
- switch (bitpix) {
-
- case 8:
- im1 = (unsigned char *)image;
- if (dpix < 0)
- image[ipix] = im1[ipix] + (unsigned char) (dpix - 0.5);
- else
- image[ipix] = im1[ipix] + (unsigned char) (dpix + 0.5);
- break;
-
- case 16:
- im2 = (short *)image;
- if (dpix < 0)
- im2[ipix] = im2[ipix] + (short) (dpix - 0.5);
- else
- im2[ipix] = im2[ipix] + (short) (dpix + 0.5);
- break;
-
- case 32:
- im4 = (int *)image;
- if (dpix < 0)
- im4[ipix] = im4[ipix] + (int) (dpix - 0.5);
- else
- im4[ipix] = im4[ipix] + (int) (dpix + 0.5);
- break;
-
- case -16:
- imu = (unsigned short *)image;
- if (dpix > 0)
- imu[ipix] = imu[ipix] + (unsigned short) (dpix + 0.5);
- break;
-
- case -32:
- imr = (float *)image;
- imr[ipix] = imr[ipix] + (float) dpix;
- break;
-
- case -64:
- imd = (double *)image;
- imd[ipix] = imd[ipix] + dpix;
- break;
-
- }
- return;
-}
-
-
-/* MOVEPIX -- Copy pixel between images */
-
-void
-movepix (image1, bitpix1, w1, x1, y1, image2, bitpix2, w2, x2, y2)
-
-char *image1; /* Pointer to first pixel in input image */
-int bitpix1; /* Bits per input pixel (FITS codes) */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w1; /* Number of horizontal pixels in input image */
-int x1, y1; /* Row and column for input pixel */
-
-char *image2; /* Pointer to first pixel in output image */
-int bitpix2; /* Bits per output pixel (FITS codes) */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-int w2; /* Number of horizontal pixels in output image */
-int x2, y2; /* Row and column for output pixel */
-
-{
- double dpix, *imd1, *imd2;
- float rpix, *imr1, *imr2;
- int *imi1, *imi2;
- short *ims1, *ims2;
- unsigned short *imu1, *imu2;
- unsigned char *imc1, *imc2;
-
- if (x1 < 0 || x2 < 0 || x1 >= w1 || x2 >= w2)
- return;
- if (y1 < 0 || y2 < 0)
- return;
-
- switch (bitpix1) {
-
- case 8:
- imc1 = (unsigned char *)image1;
- switch (bitpix2) {
- case 8:
- imc2 = (unsigned char *)image2;
- imc2[(y2*w2) + x2] = imc1[(y1*w1) + x1];
- break;
- case 16:
- ims2 = (short *)image2;
- ims2[(y2*w2) + x2] = (short) imc1[(y1*w1) + x1];
- break;
- case 32:
- imi2 = (int *)image2;
- imi2[(y2*w2) + x2] = (int) imc1[(y1*w1) + x1];
- break;
- case -16:
- imu2 = (unsigned short *)image2;
- imu2[(y2*w2) + x2] = (unsigned short) imc1[(y1*w1) + x1];
- break;
- case -32:
- imr2 = (float *)image2;
- imr2[(y2*w2) + x2] = (float) imc1[(y1*w1) + x1];
- break;
- case -64:
- imd2 = (double *)image2;
- imd2[(y2*w2) + x2] = (double) imc1[(y1*w1) + x1];
- break;
- }
- break;
-
- case 16:
- ims1 = (short *)image1;
- switch (bitpix2) {
- case 8:
- imc2 = (unsigned char *)image1;
- imc2[(y2*w2) + x2] = (unsigned char) ims1[(y1*w1) + x1];
- break;
- case 16:
- ims2 = (short *)image2;
- ims2[(y2*w2) + x2] = ims1[(y1*w1) + x1];
- break;
- case 32:
- imi2 = (int *)image2;
- imi2[(y2*w2) + x2] = (int) ims1[(y1*w1) + x1];
- break;
- case -16:
- imu2 = (unsigned short *)image2;
- imu2[(y2*w2) + x2] = (unsigned short) ims1[(y1*w1) + x1];
- break;
- case -32:
- imr2 = (float *)image2;
- imr2[(y2*w2) + x2] = (float) ims1[(y1*w1) + x1];
- break;
- case -64:
- imd2 = (double *)image2;
- imd2[(y2*w2) + x2] = (double) ims1[(y1*w1) + x1];
- break;
- }
- break;
-
- case 32:
- imi1 = (int *)image1;
- switch (bitpix2) {
- case 8:
- imc2 = (unsigned char *)image2;
- imc2[(y2*w2) + x2] = (unsigned char) imi1[(y1*w1) + x1];
- break;
- case 16:
- ims2 = (short *)image2;
- ims2[(y2*w2) + x2] = (short) imi1[(y1*w1) + x1];
- break;
- case 32:
- imi2 = (int *)image2;
- imi2[(y2*w2) + x2] = imi1[(y1*w1) + x1];
- break;
- case -16:
- imu2 = (unsigned short *)image2;
- imu2[(y2*w2) + x2] = (unsigned short) imi1[(y1*w1) + x1];
- break;
- case -32:
- imr2 = (float *)image2;
- imr2[(y2*w2) + x2] = (float) imi1[(y1*w1) + x1];
- break;
- case -64:
- imd2 = (double *)image2;
- imd2[(y2*w2) + x2] = (double) imi1[(y1*w1) + x1];
- break;
- }
- break;
-
- case -16:
- imu1 = (unsigned short *)image1;
- switch (bitpix2) {
- case 8:
- imc2 = (unsigned char *)image2;
- imc2[(y2*w2) + x2] = (unsigned char) imu1[(y1*w1) + x1];
- break;
- case 16:
- ims2 = (short *)image2;
- ims2[(y2*w2) + x2] = (short) imu1[(y1*w1) + x1];
- break;
- case 32:
- imi2 = (int *)image2;
- imi2[(y2*w2) + x2] = (int) imu1[(y1*w1) + x1];
- break;
- case -16:
- imu2 = (unsigned short *)image2;
- imu2[(y2*w2) + x2] = imu1[(y1*w1) + x1];
- break;
- case -32:
- imr2 = (float *)image2;
- imr2[(y2*w2) + x2] = (float) imu1[(y1*w1) + x1];
- break;
- case -64:
- imd2 = (double *)image2;
- imd2[(y2*w2) + x2] = (double) imu1[(y1*w1) + x1];
- break;
- }
- break;
-
- case -32:
- imr1 = (float *)image1;
- rpix = imr1[(y1*w1) + x1];
- switch (bitpix2) {
- case 8:
- imc2 = (unsigned char *)image2;
- if (rpix < 0.0)
- imc2[(y2*w2) + x2] = (unsigned char) 0;
- else
- imc2[(y2*w2) + x2] = (unsigned char) (rpix + 0.5);
- break;
- case 16:
- ims2 = (short *)image2;
- if (rpix < 0.0)
- ims2[(y2*w2) + x2] = (short) (rpix - 0.5);
- else
- ims2[(y2*w2) + x2] = (short) (rpix + 0.5);
- break;
- case 32:
- imi2 = (int *)image2;
- if (rpix < 0.0)
- imi2[(y2*w2) + x2] = (int) (rpix - 0.5);
- else
- imi2[(y2*w2) + x2] = (int) (rpix + 0.5);
- break;
- case -16:
- imu2 = (unsigned short *)image2;
- if (rpix < 0.0)
- imu2[(y2*w2) + x2] = (unsigned short) 0;
- else
- imu2[(y2*w2) + x2] = (unsigned short) (rpix + 0.5);
- break;
- case -32:
- imr2 = (float *)image2;
- imr2[(y2*w2) + x2] = rpix;
- break;
- case -64:
- imd2 = (double *)image2;
- imd2[(y2*w2) + x2] = (double) rpix;
- break;
- }
- break;
-
- case -64:
- imd1 = (double *)image1;
- dpix = imd1[(y1*w1) + x1];
- switch (bitpix2) {
- case 8:
- imc2 = (unsigned char *)image2;
- if (dpix < 0.0)
- imc2[(y2*w2) + x2] = (unsigned char) 0;
- else
- imc2[(y2*w2) + x2] = (unsigned char) (dpix + 0.5);
- break;
- case 16:
- ims2 = (short *)image2;
- if (dpix < 0.0)
- ims2[(y2*w2) + x2] = (short) (dpix - 0.5);
- else
- ims2[(y2*w2) + x2] = (short) (dpix + 0.5);
- break;
- case 32:
- imi2 = (int *)image2;
- if (dpix < 0.0)
- imi2[(y2*w2) + x2] = (int) (dpix - 0.5);
- else
- imi2[(y2*w2) + x2] = (int) (dpix + 0.5);
- break;
- case -16:
- imu2 = (unsigned short *)image2;
- if (dpix < 0.0)
- imu2[(y2*w2) + x2] = (unsigned short) 0;
- else
- imu2[(y2*w2) + x2] = (unsigned short) (dpix + 0.5);
- break;
- case -32:
- imr2 = (float *)image2;
- imr2[(y2*w2) + x2] = (float) dpix;
- break;
- case -64:
- imd2 = (double *)image2;
- imd2[(y2*w2) + x2] = dpix;
- break;
- }
- break;
- }
- return;
-}
-
-
-/* MAXVEC -- Get maximum value in vector from 2D image of any numeric type */
-
-double
-maxvec (image, bitpix, bzero, bscale, pix1, npix)
-
-char *image; /* Image array from which to read vector */
-int bitpix; /* Number of bits per pixel in image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* Offset of first pixel to check */
-int npix; /* Number of pixels to check */
-
-{
- short *im2, imax2, ip2;
- int *im4, imax4, ip4;
- unsigned short *imu, imaxu, ipu;
- float *imr, imaxr, ipr;
- double *imd;
- double dmax = 0.0;
- double ipd;
- int ipix, pix2;
- unsigned char *imc, imaxc, ipc;
-
- pix2 = pix1 + npix;
-
- switch (bitpix) {
-
- case 8:
- imc = (unsigned char *)(image);
- imaxc = *(imc + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipc = *(imc + ipix);
- if (ipc > imaxc)
- imaxc = ipc;
- }
- dmax = (double) imaxc;
- break;
-
- case 16:
- im2 = (short *)image;
- imax2 = *(im2 + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ip2 = *(im2 + ipix);
- if (ip2 > imax2)
- imax2 = ip2;
- }
- dmax = (double) imax2;
- break;
-
- case 32:
- im4 = (int *)image;
- imax4 = *(im4 + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ip4 = *(im4 + ipix);
- if (ip4 > imax4)
- imax4 = ip4;
- }
- dmax = (double) imax4;
- break;
-
- case -16:
- imu = (unsigned short *)image;
- imaxu = *(imu + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipu = *(imu + ipix);
- if (ipu > imaxu)
- imaxu = ipu;
- }
- dmax = (double) imaxu;
- break;
-
- case -32:
- imr = (float *)image;
- imaxr = *(imr + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipr = *(imr + ipix);
- if (ipr > imaxr)
- imax2 = ipr;
- }
- dmax = (double) imaxr;
- break;
-
- case -64:
- imd = (double *)image;
- dmax = *(imd + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipd = *(imd + ipix);
- if (ipd > dmax)
- dmax = ipd;
- }
- break;
-
- }
-
- /* Scale data if either BZERO or BSCALE keyword has been set */
- if (scale && (bzero != 0.0 || bscale != 1.0))
- dmax = (dmax * bscale) + bzero;
-
- return (dmax);
-}
-
-
-/* MINVEC -- Get minimum value in vector from 2D image of any numeric type */
-
-double
-minvec (image, bitpix, bzero, bscale, pix1, npix)
-
-char *image; /* Image array from which to read vector */
-int bitpix; /* Number of bits per pixel in image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* Offset of first pixel to check */
-int npix; /* Number of pixels to check */
-
-{
- short *im2, imin2, ip2;
- int *im4, imin4, ip4;
- unsigned short *imu, iminu, ipu;
- float *imr, iminr, ipr;
- double *imd, ipd;
- double dmin = 0.0;
- int ipix, pix2;
- unsigned char *imc, cmin, cp;
-
- pix2 = pix1 + npix;
-
- switch (bitpix) {
-
- case 8:
- imc = (unsigned char *)image;
- cmin = *(imc + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- cp = *(imc + ipix);
- if (cp < cmin)
- cmin = cp;
- }
- dmin = (double) cmin;
- break;
-
- case 16:
- im2 = (short *)image + pix1;
- imin2 = *im2;
- for (ipix = pix1; ipix < pix2; ipix++) {
- ip2 = *(im2 + ipix);
- if (ip2 < imin2)
- imin2 = ip2;
- }
- dmin = (double) imin2;
- break;
-
- case 32:
- im4 = (int *)image;
- imin4 = *(im4 + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ip4 = *(im4 + ipix);
- if (ip4 < imin4)
- imin4 = ip4;
- }
- dmin = (double) imin4;
- break;
-
- case -16:
- imu = (unsigned short *)image;
- iminu = *(imu + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipu = *(imu + ipix);
- if (ipu < iminu)
- iminu = ipu;
- }
- dmin = (double) iminu;
- break;
-
- case -32:
- imr = (float *)image;
- iminr = *(imr + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipr = *(imr + ipix);
- if (ipr < iminr)
- iminr = ipr;
- }
- dmin = (double) iminr;
- break;
-
- case -64:
- imd = (double *)image;
- dmin = *(imd + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- ipd = *(imd + ipix);
- if (ipd < dmin)
- dmin = ipd;
- }
- break;
-
- }
-
- /* Scale data if either BZERO or BSCALE keyword has been set */
- if (scale && (bzero != 0.0 || bscale != 1.0))
- dmin = (dmin * bscale) + bzero;
-
- return (dmin);
-}
-
-
-/* ADDVEC -- Add constant to pixel values in 2D image of any numeric type */
-
-void
-addvec (image, bitpix, bzero, bscale, pix1, npix, dpix)
-
-char *image; /* Image array from which to extract vector */
-int bitpix; /* Number of bits per pixel in image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* Offset of first pixel to extract */
-int npix; /* Number of pixels to extract */
-double dpix; /* Value to add to pixels */
-
-{
- unsigned char *imc, ccon;
- short *im2, jcon;
- int *im4, icon;
- unsigned short *imu, ucon;
- float *imr, rcon;
- double *imd;
- int ipix, pix2;
-
- pix2 = pix1 + npix;
-
- if (scale)
- dpix = (dpix - bzero) / bscale;
-
- switch (bitpix) {
-
- case 8:
- imc = (unsigned char *) (image + pix1);
- if (dpix < 0)
- ccon = (unsigned char) (dpix - 0.5);
- else
- ccon = (unsigned char) (dpix + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imc++ += ccon;
- break;
-
- case 16:
- im2 = (short *) (image + pix1);
- if (dpix < 0)
- jcon = (short) (dpix - 0.5);
- else
- jcon = (short) (dpix + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- *im2++ += jcon;
- break;
-
- case 32:
- im4 = (int *) (image + pix1);
- if (dpix < 0)
- icon = (int) (dpix - 0.5);
- else
- icon = (int) (dpix + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- *im4++ += icon;
- break;
-
- case -16:
- imu = (unsigned short *) (image + pix1);
- if (dpix > 0) {
- ucon = (unsigned short) (dpix + 0.5);
- imu = (unsigned short *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imu++ += ucon;
- }
- else {
- icon = (int) (dpix - 0.5);
- imu = (unsigned short *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++) {
- unsigned short tmp = (icon + (int) *imu);
- *imu++ += tmp;
- }
- }
- break;
-
- case -32:
- rcon = (float) dpix;
- imr = (float *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imr++ += rcon;
- break;
-
- case -64:
- imd = (double *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imd++ += dpix;
- break;
- }
- return;
-}
-
-
-/* MULTVEC -- Multiply pixel values in place in 2D image of any numeric type */
-
-void
-multvec (image, bitpix, bzero, bscale, pix1, npix, dpix)
-
-char *image; /* Image array from which to extract vector */
-int bitpix; /* Number of bits per pixel in image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* Offset of first pixel to extract */
-int npix; /* Number of pixels to extract */
-double dpix; /* Value by which to multiply pixels */
-
-{
- char *imc, ccon;
- short *im2, jcon;
- int *im4, icon, isint;
- unsigned short *imu, ucon;
- float *imr, rcon;
- double *imd, dcon, dval;
- int ipix, pix2;
-
- pix2 = pix1 + npix;
-
- if (scale)
- dpix = (dpix - bzero) / bscale;
- ipix = (int) dpix;
- dcon = (double) ipix;
- if (dcon == dpix)
- isint = 1;
- else
- isint = 0;
-
- switch (bitpix) {
-
- case 8:
- imc = image + pix1;
- if (isint) {
- if (dpix < 0)
- ccon = (char) (dpix - 0.5);
- else
- ccon = (char) (dpix + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imc++ *= ccon;
- }
- else {
- for (ipix = pix1; ipix < pix2; ipix++) {
- dval = ((double) *imc) * dpix;
- if (dval < 256.0)
- *imc++ = (char) dval;
- else
- *imc++ = (char) 255;
- }
- }
- break;
-
- case 16:
- im2 = (short *) (image + pix1);
- if (isint) {
- im2 = (short *)image;
- if (dpix < 0)
- jcon = (short) (dpix - 0.5);
- else
- jcon = (short) (dpix + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- *im2++ *= jcon;
- }
- else {
- for (ipix = pix1; ipix < pix2; ipix++) {
- dval = ((double) *im2) * dpix;
- if (dval < 32768.0)
- *im2++ = (short) dval;
- else
- *im2++ = (short) 32767;
- }
- }
- break;
-
- case 32:
- im4 = (int *) (image + pix1);
- if (isint) {
- if (dpix < 0)
- icon = (int) (dpix - 0.5);
- else
- icon = (int) (dpix + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- *im4++ *= icon;
- }
- else {
- for (ipix = pix1; ipix < pix2; ipix++) {
- dval = ((double) *im4) * dpix;
- if (dval < 32768.0)
- *im4++ = (int) dval;
- else
- *im4++ = (int) 32767;
- }
- }
- break;
-
- case -16:
- imu = (unsigned short *) (image + pix1);
- if (dpix > 0) {
- ucon = (unsigned short) (dpix + 0.5);
- imu = (unsigned short *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imu++ *= ucon;
- }
- break;
-
- case -32:
- rcon = (float) dpix;
- imr = (float *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imr++ *= rcon;
- break;
-
- case -64:
- imd = (double *) (image + pix1);
- for (ipix = pix1; ipix < pix2; ipix++)
- *imd++ *= dpix;
- break;
-
- }
- return;
-}
-
-
-/* GETVEC -- Get vector from 2D image of any numeric type */
-
-void
-getvec (image, bitpix, bzero, bscale, pix1, npix, dvec0)
-
-char *image; /* Image array from which to extract vector */
-int bitpix; /* Number of bits per pixel in image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* Offset of first pixel to extract */
-int npix; /* Number of pixels to extract */
-double *dvec0; /* Vector of pixels (returned) */
-
-{
- short *im2;
- int *im4;
- unsigned short *imu;
- float *imr;
- double *imd;
- double *dvec;
- int ipix, pix2;
-
- pix2 = pix1 + npix;
- dvec = dvec0;
-
- switch (bitpix) {
-
- case 8:
- for (ipix = pix1; ipix < pix2; ipix++)
- *dvec++ = (double) *(image + ipix);
- break;
-
- case 16:
- im2 = (short *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *dvec++ = (double) *(im2 + ipix);
- break;
-
- case 32:
- im4 = (int *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *dvec++ = (double) *(im4 + ipix);
- break;
-
- case -16:
- imu = (unsigned short *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *dvec++ = (double) *(imu + ipix);
- break;
-
- case -32:
- imr = (float *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *dvec++ = (double) *(imr + ipix);
- break;
-
- case -64:
- imd = (double *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *dvec++ = (double) *(imd + ipix);
- break;
-
- }
-
- /* Scale data if either BZERO or BSCALE keyword has been set */
- if (scale && (bzero != 0.0 || bscale != 1.0)) {
- dvec = dvec0;
- for (ipix = pix1; ipix < pix2; ipix++) {
- *dvec = (*dvec * bscale) + bzero;
- dvec++;
- }
- }
-
- return;
-}
-
-
-/* PUTVEC -- Copy pixel vector into 2D image of any numeric type */
-
-void
-putvec (image, bitpix, bzero, bscale, pix1, npix, dvec)
-
-char *image; /* Image into which to copy vector */
-int bitpix; /* Number of bits per pixel im image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* Offset of first pixel of vector in image */
-int npix; /* Number of pixels to copy */
-double *dvec; /* Vector of pixels to copy */
-
-{
- short *im2;
- int *im4;
- unsigned short *imu;
- float *imr;
- double *imd;
- int ipix, pix2;
- double *dp = dvec;
-
- pix2 = pix1 + npix;
-
- /* Scale data if either BZERO or BSCALE keyword has been set */
- if (scale && (bzero != 0.0 || bscale != 1.0)) {
- for (ipix = pix1; ipix < pix2; ipix++) {
- *dp = (*dp - bzero) / bscale;
- dp++;
- }
- dp = dvec;
- }
-
- switch (bitpix) {
-
- case 8:
- for (ipix = pix1; ipix < pix2; ipix++)
- *(image+ipix) = (char) *dp++;
- break;
-
- case 16:
- im2 = (short *)image;
- for (ipix = pix1; ipix < pix2; ipix++) {
- if (*dp < 0.0)
- *(im2+ipix) = (short) (*dp++ - 0.5);
- else
- *(im2+ipix) = (short) (*dp++ + 0.5);
- }
- break;
-
- case 32:
- im4 = (int *)image;
- for (ipix = pix1; ipix < pix2; ipix++) {
- if (*dp < 0.0)
- *(im4+ipix) = (int) (*dp++ - 0.5);
- else
- *(im4+ipix) = (int) (*dp++ + 0.5);
- }
- break;
-
- case -16:
- imu = (unsigned short *)image;
- for (ipix = pix1; ipix < pix2; ipix++) {
- if (*dp < 0.0)
- *(imu+ipix) = (unsigned short) 0;
- else
- *(imu+ipix) = (unsigned short) (*dp++ + 0.5);
- }
- break;
-
- case -32:
- imr = (float *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *(imr+ipix) = (float) *dp++;
- break;
-
- case -64:
- imd = (double *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- *(imd+ipix) = (double) *dp++;
- break;
- }
- return;
-}
-
-
-/* FILLVEC1 -- Copy single value into a vector of any numeric type */
-
-void
-fillvec1 (image, bitpix, bzero, bscale, pix1, npix, dpix)
-
-char *image; /* Vector to fill */
-int bitpix; /* Number of bits per pixel im image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* First pixel to fill */
-int npix; /* Number of pixels to fill */
-double dpix; /* Value with which to fill pixels */
-{
- fillvec (image, bitpix, bzero, bscale, pix1-1, npix, dpix);
- return;
-}
-
-
-/* FILLVEC -- Copy single value into a vector of any numeric type */
-
-void
-fillvec (image, bitpix, bzero, bscale, pix1, npix, dpix)
-
-char *image; /* Vector to fill */
-int bitpix; /* Number of bits per pixel im image */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-double bzero; /* Zero point for pixel scaling */
-double bscale; /* Scale factor for pixel scaling */
-int pix1; /* First pixel to fill */
-int npix; /* Number of pixels to fill */
-double dpix; /* Value with which to fill pixels */
-{
- char ipc;
- short *im2, ip2;
- int *im4, ip4;
- unsigned short *imu, ipu;
- float *imr, ipr;
- double *imd;
- int ipix, pix2;
- double dp;
-
- pix2 = pix1 + npix;
-
- /* Scale data if either BZERO or BSCALE keyword has been set */
- dp = dpix;
- if (scale && (bzero != 0.0 || bscale != 1.0))
- dp = (dp - bzero) / bscale;
-
- switch (bitpix) {
-
- case 8:
- if (dp < 0.0)
- ipc = (char) (dp - 0.5);
- else
- ipc = (char) (dp + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- image[ipix] = ipc;
- break;
-
- case 16:
- im2 = (short *)image;
- if (dp < 0.0)
- ip2 = (short) (dp - 0.5);
- else
- ip2 = (short) (dp + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- im2[ipix] = ip2;
- break;
-
- case 32:
- im4 = (int *)image;
- if (dp < 0.0)
- ip4 = (int) (dp - 0.5);
- else
- ip4 = (int) (dp + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- im4[ipix] = ip4;
- break;
-
- case -16:
- imu = (unsigned short *)image;
- if (dp < 0.0)
- ipu = (unsigned short) (dp - 0.5);
- else
- ipu = (unsigned short) (dp + 0.5);
- for (ipix = pix1; ipix < pix2; ipix++)
- imu[ipix] = ipu;
- break;
-
- case -32:
- imr = (float *)image;
- ipr = (float) dp;
- for (ipix = pix1; ipix < pix2; ipix++)
- imr[ipix] = ipr;
- break;
-
- case -64:
- imd = (double *)image;
- for (ipix = pix1; ipix < pix2; ipix++)
- imd[ipix] = dp;
- break;
- }
- return;
-}
-
-
-/* IMSWAP -- Reverse bytes of any type of vector in place */
-
-void
-imswap (bitpix, string, nbytes)
-
-int bitpix; /* Number of bits per pixel */
- /* 16 = short, -16 = unsigned short, 32 = int */
- /* -32 = float, -64 = double */
-char *string; /* Address of starting point of bytes to swap */
-int nbytes; /* Number of bytes to swap */
-
-{
- switch (bitpix) {
-
- case 8:
- break;
-
- case 16:
- if (nbytes < 2) return;
- imswap2 (string,nbytes);
- break;
-
- case 32:
- if (nbytes < 4) return;
- imswap4 (string,nbytes);
- break;
-
- case -16:
- if (nbytes < 2) return;
- imswap2 (string,nbytes);
- break;
-
- case -32:
- if (nbytes < 4) return;
- imswap4 (string,nbytes);
- break;
-
- case -64:
- if (nbytes < 8) return;
- imswap8 (string,nbytes);
- break;
-
- }
- return;
-}
-
-
-/* IMSWAP2 -- Swap bytes in string in place */
-
-void
-imswap2 (string,nbytes)
-
-
-char *string; /* Address of starting point of bytes to swap */
-int nbytes; /* Number of bytes to swap */
-
-{
- char *sbyte, temp, *slast;
-
- slast = string + nbytes;
- sbyte = string;
- while (sbyte < slast) {
- temp = sbyte[0];
- sbyte[0] = sbyte[1];
- sbyte[1] = temp;
- sbyte= sbyte + 2;
- }
- return;
-}
-
-
-/* IMSWAP4 -- Reverse bytes of Integer*4 or Real*4 vector in place */
-
-void
-imswap4 (string,nbytes)
-
-char *string; /* Address of Integer*4 or Real*4 vector */
-int nbytes; /* Number of bytes to reverse */
-
-{
- char *sbyte, *slast;
- char temp0, temp1, temp2, temp3;
-
- slast = string + nbytes;
- sbyte = string;
- while (sbyte < slast) {
- temp3 = sbyte[0];
- temp2 = sbyte[1];
- temp1 = sbyte[2];
- temp0 = sbyte[3];
- sbyte[0] = temp0;
- sbyte[1] = temp1;
- sbyte[2] = temp2;
- sbyte[3] = temp3;
- sbyte = sbyte + 4;
- }
-
- return;
-}
-
-
-/* IMSWAP8 -- Reverse bytes of Real*8 vector in place */
-
-void
-imswap8 (string,nbytes)
-
-char *string; /* Address of Real*8 vector */
-int nbytes; /* Number of bytes to reverse */
-
-{
- char *sbyte, *slast;
- char temp[8];
-
- slast = string + nbytes;
- sbyte = string;
- while (sbyte < slast) {
- temp[7] = sbyte[0];
- temp[6] = sbyte[1];
- temp[5] = sbyte[2];
- temp[4] = sbyte[3];
- temp[3] = sbyte[4];
- temp[2] = sbyte[5];
- temp[1] = sbyte[6];
- temp[0] = sbyte[7];
- sbyte[0] = temp[0];
- sbyte[1] = temp[1];
- sbyte[2] = temp[2];
- sbyte[3] = temp[3];
- sbyte[4] = temp[4];
- sbyte[5] = temp[5];
- sbyte[6] = temp[6];
- sbyte[7] = temp[7];
- sbyte = sbyte + 8;
- }
- return;
-}
-
-/* IMSWAPPED -- Returns 0 if big-endian (Sun,Mac),
- 1 if little-endian(PC,Alpha) */
-
-int
-imswapped ()
-
-{
- char *ctest;
- int itest;
-
- itest = 1;
- ctest = (char *)&itest;
- if (*ctest)
- return (1);
- else
- return (0);
-}
-
-/* Apr 17 1996 New file
- * May 22 1996 Add H so that PUTPIX and GETPIX can check coordinates
- * Jun 11 1996 Simplify NEWIMAGE subroutine
- * Jun 12 1996 Add byte-swapping subroutines
- *
- * Jul 24 1997 Add 8-bit option to subroutines
- *
- * May 27 1998 Include imio.h instead of fitshead.h
- * Jun 17 1998 Fix bug, changing all unsigned int's to unsigned short's
- *
- * Apr 29 1999 Add scaling to getpix, putpix, getvec, and putvec
- * Apr 29 1999 Fix bug in getvec in dealing with 1-byte data
- * Sep 14 1999 Change dp incrementing so it works on Alpha compiler
- * Sep 27 1999 Add interface for 1-based (FITS) image access
- * Sep 27 1999 Add addpix() and addpix1()
- * Dec 14 1999 In putpix(), addpix(), putvec(), round when output is integer
- *
- * Sep 20 2000 In getvec(), scale only if necessary
- *
- * Nov 27 2001 In movepix(), add char to char move
- *
- * Jan 23 2002 Add global scale switch to turn off scaling
- * Jun 4 2002 In getvec() and putvec(), change dpix to dvec
- * Jun 4 2002 Add addvec() to add to a vector
- * Jul 19 2002 Fix getvec() bug rescaling scaled numbers
- *
- * May 20 2003 Declare scale0 in setscale()
- *
- * Jan 28 2004 Add image limit check to movepix()
- * Feb 27 2004 Add fillvec() and fillvec1() to set vector to a constant
- *
- * Jun 27 2005 Fix major bug in fillvec(); pass value dpix in fillvec1(), too
- * Aug 18 2005 Add maxvec(), addvec(), and multvec()
- *
- * Mar 1 2006 Fix bug of occasional double application of bscale in getvec()
- * Apr 3 2006 Fix bad cast in unisigned int section of addvec()
- * May 3 2006 Code fixes in addpix and multpix suggested by Robert Lupton
- * Jun 8 2006 Drop erroneous second im2 assignment without offset in addvec()
- * Jun 20 2006 Fix typos masquerading as unitialized variables
- *
- * Jan 8 2007 Include fitsfile.h instead of imio.h
- * Jun 11 2007 Add minvec() and speed up maxvec()
- *
- * Apr 12 2012 Fix 8-bit variables to be unsigned char
- * Oct 19 2012 Fix errors with character images in minvec() and maxvec()
- * Oct 30 2012 Fix errors with short images in minvec() and maxvec()
- */
diff --git a/funtools/wcs/imio.h b/funtools/wcs/imio.h
deleted file mode 100644
index a12d8e8..0000000
--- a/funtools/wcs/imio.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*** imio.h memory access subroutines
- *** September 27, 1999
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1996-2002
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-#ifndef imio_h_
-#define imio_h_
-
-/* Image pixel access subroutines in imio.c */
-extern double getpix(); /* Read one pixel from any data type 2-D array (0,0)*/
-extern double getpix1(); /* Read one pixel from any data type 2-D array (1,1)*/
-extern void putpix(); /* Write one pixel to any data type 2-D array (0,0)*/
-extern void putpix1(); /* Write one pixel to any data type 2-D array (1,1) */
-extern void addpix(); /* Add to one pixel in any data type 2-D array (0,0)*/
-extern void addpix1(); /* Add to one pixel in any data type 2-D array (1,1)*/
-extern void movepix(); /* Move one pixel value between two 2-D arrays (0,0) */
-extern void movepix1(); /* Move one pixel value between two 2-D arrays (1,1) */
-extern void getvec(); /* Read vector from a 2-D array */
-extern void putvec(); /* Write vector into a 2-D array */
-extern void fillvec(); /* Write constant into a vector */
-extern void fillvec1(); /* Write constant into a vector */
-extern void imswap(); /* Swap alternating bytes in a vector */
-extern void imswap2(); /* Swap bytes in a vector of 2-byte (short) integers */
-extern void imswap4(); /* Reverse bytes in a vector of 4-byte numbers */
-extern void imswap8(); /* Reverse bytes in a vector of 8-byte numbers */
-extern int imswapped(); /* Return 1 if machine byte order is not FITS order */
-
-#endif /* imio_h_ */
-
-/* May 31 1996 Use stream I/O for reading as well as writing
- * Jun 12 1996 Add byte-swapping subroutines
- * Aug 6 1996 Add MOVEPIX, HDEL and HCHANGE declarations
- *
- * May 27 1998 Split off imio subroutines to imio.h
-
- * Sep 27 1999 Add Fortran-indexed (1,1), not (0,0) image access *1()
- * Sep 28 1999 Add addpix()
- *
- * Feb 27 2004 Add fillvec()
- */
diff --git a/funtools/wcs/install-sh b/funtools/wcs/install-sh
deleted file mode 100755
index 36f96f3..0000000
--- a/funtools/wcs/install-sh
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
- shift
-
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
- rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
-
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-
-{
- (exit 0); exit
-}
diff --git a/funtools/wcs/lin.c b/funtools/wcs/lin.c
deleted file mode 100644
index 999a9d0..0000000
--- a/funtools/wcs/lin.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*=============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-*=============================================================================
-*
-* C routines which implement the FITS World Coordinate System (WCS)
-* convention.
-*
-* Summary of routines
-* -------------------
-* These utility routines apply the linear transformation defined by the WCS
-* FITS header cards. There are separate routines for the image-to-pixel,
-* linfwd(), and pixel-to-image, linrev(), transformations.
-*
-* An initialization routine, linset(), computes intermediate values from
-* the transformation parameters but need not be called explicitly - see the
-* explanation of lin.flag below.
-*
-* An auxiliary matrix inversion routine, matinv(), is included. It uses
-* LU-triangular factorization with scaled partial pivoting.
-*
-*
-* Initialization routine; linset()
-* --------------------------------
-* Initializes members of a linprm data structure which hold intermediate
-* values. Note that this routine need not be called directly; it will be
-* invoked by linfwd() and linrev() if the "flag" structure member is
-* anything other than a predefined magic value.
-*
-* Given and/or returned:
-* lin linprm* Linear transformation parameters (see below).
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Memory allocation error.
-* 2: PC matrix is singular.
-*
-* Forward transformation; linfwd()
-* --------------------------------
-* Compute pixel coordinates from image coordinates. Note that where
-* celestial coordinate systems are concerned the image coordinates
-* correspond to (x,y) in the plane of projection, not celestial (lng,lat).
-*
-* Given:
-* imgcrd const double[]
-* Image (world) coordinate.
-*
-* Given and returned:
-* lin linprm* Linear transformation parameters (see below).
-*
-* Returned:
-* pixcrd d[] Pixel coordinate.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: The transformation is not invertible.
-*
-* Reverse transformation; linrev()
-* --------------------------------
-* Compute image coordinates from pixel coordinates. Note that where
-* celestial coordinate systems are concerned the image coordinates
-* correspond to (x,y) in the plane of projection, not celestial (lng,lat).
-*
-* Given:
-* pixcrd const double[]
-* Pixel coordinate.
-*
-* Given and/or returned:
-* lin linprm* Linear transformation parameters (see below).
-*
-* Returned:
-* imgcrd d[] Image (world) coordinate.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Error.
-*
-* Linear transformation parameters
-* --------------------------------
-* The linprm struct consists of the following:
-*
-* int flag
-* This flag must be set to zero whenever any of the following members
-* are set or modified. This signals the initialization routine,
-* linset(), to recompute intermediaries.
-* int naxis
-* Number of image axes.
-* double *crpix
-* Pointer to the first element of an array of double containing the
-* coordinate reference pixel, CRPIXn.
-* double *pc
-* Pointer to the first element of the PC (pixel coordinate)
-* transformation matrix. The expected order is
-*
-* lin.pc = {PC1_1, PC1_2, PC2_1, PC2_2};
-*
-* This may be conveniently constructed from a two-dimensional array
-* via
-*
-* double m[2][2] = {{PC1_1, PC1_2},
-* {PC2_1, PC2_2}};
-*
-* which is equivalent to,
-*
-* double m[2][2];
-* m[0][0] = PC1_1;
-* m[0][1] = PC1_2;
-* m[1][0] = PC2_1;
-* m[1][1] = PC2_2;
-*
-* for which the storage order is
-*
-* PC1_1, PC1_2, PC2_1, PC2_2
-*
-* so it would be legitimate to set lin.pc = *m.
-* double *cdelt
-* Pointer to the first element of an array of double containing the
-* coordinate increments, CDELTn.
-*
-* The remaining members of the linprm struct are maintained by the
-* initialization routine and should not be modified.
-*
-* double *piximg
-* Pointer to the first element of the matrix containing the product
-* of the CDELTn diagonal matrix and the PC matrix.
-* double *imgpix
-* Pointer to the first element of the inverse of the piximg matrix.
-*
-* linset allocates storage for the above arrays using malloc(). Note,
-* however, that these routines do not free this storage so if a linprm
-* variable has itself been malloc'd then these structure members must be
-* explicitly freed before the linprm variable is free'd otherwise a memory
-* leak will result.
-*
-* Author: Mark Calabretta, Australia Telescope National Facility
-* $Id: lin.c,v 2.8 2002/01/30 06:04:03 mcalabre Exp $
-*===========================================================================*/
-
-#include <stdlib.h>
-#include <math.h>
-#include "wcslib.h"
-
-/* Map error number to error message for each function. */
-const char *linset_errmsg[] = {
- 0,
- "Memory allocation error",
- "PC matrix is singular"};
-
-const char *linfwd_errmsg[] = {
- 0,
- "Memory allocation error",
- "PC matrix is singular"};
-
-const char *linrev_errmsg[] = {
- 0,
- "Memory allocation error",
- "PC matrix is singular"};
-
-int linset(lin)
-
-struct linprm *lin;
-
-{
- int i, ij, j, mem, n;
-
- n = lin->naxis;
-
- /* Allocate memory for internal arrays. */
- mem = n * n * sizeof(double);
- lin->piximg = (double*)malloc(mem);
- if (lin->piximg == (double*)0) return 1;
-
- lin->imgpix = (double*)malloc(mem);
- if (lin->imgpix == (double*)0) {
- free(lin->piximg);
- return 1;
- }
-
- /* Compute the pixel-to-image transformation matrix. */
- for (i = 0, ij = 0; i < n; i++) {
- for (j = 0; j < n; j++, ij++) {
- lin->piximg[ij] = lin->cdelt[i] * lin->pc[ij];
- }
- }
-
- /* Compute the image-to-pixel transformation matrix. */
- if (matinv(n, lin->piximg, lin->imgpix)) return 2;
-
- lin->flag = LINSET;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int linfwd(imgcrd, lin, pixcrd)
-
-const double imgcrd[];
-struct linprm *lin;
-double pixcrd[];
-
-{
- int i, ij, j, n;
-
- n = lin->naxis;
-
- if (lin->flag != LINSET) {
- if (linset(lin)) return 1;
- }
-
- for (i = 0, ij = 0; i < n; i++) {
- pixcrd[i] = 0.0;
- for (j = 0; j < n; j++, ij++) {
- pixcrd[i] += lin->imgpix[ij] * imgcrd[j];
- }
- }
-
- for (j = 0; j < n; j++) {
- pixcrd[j] += lin->crpix[j];
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int linrev(pixcrd, lin, imgcrd)
-
-const double pixcrd[];
-struct linprm *lin;
-double imgcrd[];
-
-{
- int i, ij, j, n;
- double temp;
-
- n = lin->naxis;
-
- if (lin->flag != LINSET) {
- if (linset(lin)) return 1;
- }
-
- for (i = 0; i < n; i++) {
- imgcrd[i] = 0.0;
- }
-
- for (j = 0; j < n; j++) {
- temp = pixcrd[j] - lin->crpix[j];
- for (i = 0, ij = j; i < n; i++, ij+=n) {
- imgcrd[i] += lin->piximg[ij] * temp;
- }
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int matinv(n, mat, inv)
-
-const int n;
-const double mat[];
-double inv[];
-
-{
- register int i, ij, ik, j, k, kj, pj;
- int itemp, mem, *mxl, *lxm, pivot;
- double colmax, *lu, *rowmax, dtemp;
-
-
- /* Allocate memory for internal arrays. */
- mem = n * sizeof(int);
- if ((mxl = (int*)malloc(mem)) == (int*)0) return 1;
- if ((lxm = (int*)malloc(mem)) == (int*)0) {
- free(mxl);
- return 1;
- }
-
- mem = n * sizeof(double);
- if ((rowmax = (double*)malloc(mem)) == (double*)0) {
- free(mxl);
- free(lxm);
- return 1;
- }
-
- mem *= n;
- if ((lu = (double*)malloc(mem)) == (double*)0) {
- free(mxl);
- free(lxm);
- free(rowmax);
- return 1;
- }
-
-
- /* Initialize arrays. */
- for (i = 0, ij = 0; i < n; i++) {
- /* Vector which records row interchanges. */
- mxl[i] = i;
-
- rowmax[i] = 0.0;
-
- for (j = 0; j < n; j++, ij++) {
- dtemp = fabs(mat[ij]);
- if (dtemp > rowmax[i]) rowmax[i] = dtemp;
-
- lu[ij] = mat[ij];
- }
-
- /* A row of zeroes indicates a singular matrix. */
- if (rowmax[i] == 0.0) {
- free(mxl);
- free(lxm);
- free(rowmax);
- free(lu);
- return 2;
- }
- }
-
-
- /* Form the LU triangular factorization using scaled partial pivoting. */
- for (k = 0; k < n; k++) {
- /* Decide whether to pivot. */
- colmax = fabs(lu[k*n+k]) / rowmax[k];
- pivot = k;
-
- for (i = k+1; i < n; i++) {
- ik = i*n + k;
- dtemp = fabs(lu[ik]) / rowmax[i];
- if (dtemp > colmax) {
- colmax = dtemp;
- pivot = i;
- }
- }
-
- if (pivot > k) {
- /* We must pivot, interchange the rows of the design matrix. */
- for (j = 0, pj = pivot*n, kj = k*n; j < n; j++, pj++, kj++) {
- dtemp = lu[pj];
- lu[pj] = lu[kj];
- lu[kj] = dtemp;
- }
-
- /* Amend the vector of row maxima. */
- dtemp = rowmax[pivot];
- rowmax[pivot] = rowmax[k];
- rowmax[k] = dtemp;
-
- /* Record the interchange for later use. */
- itemp = mxl[pivot];
- mxl[pivot] = mxl[k];
- mxl[k] = itemp;
- }
-
- /* Gaussian elimination. */
- for (i = k+1; i < n; i++) {
- ik = i*n + k;
-
- /* Nothing to do if lu[ik] is zero. */
- if (lu[ik] != 0.0) {
- /* Save the scaling factor. */
- lu[ik] /= lu[k*n+k];
-
- /* Subtract rows. */
- for (j = k+1; j < n; j++) {
- lu[i*n+j] -= lu[ik]*lu[k*n+j];
- }
- }
- }
- }
-
-
- /* mxl[i] records which row of mat corresponds to row i of lu. */
- /* lxm[i] records which row of lu corresponds to row i of mat. */
- for (i = 0; i < n; i++) {
- lxm[mxl[i]] = i;
- }
-
-
- /* Determine the inverse matrix. */
- for (i = 0, ij = 0; i < n; i++) {
- for (j = 0; j < n; j++, ij++) {
- inv[ij] = 0.0;
- }
- }
-
- for (k = 0; k < n; k++) {
- inv[lxm[k]*n+k] = 1.0;
-
- /* Forward substitution. */
- for (i = lxm[k]+1; i < n; i++) {
- for (j = lxm[k]; j < i; j++) {
- inv[i*n+k] -= lu[i*n+j]*inv[j*n+k];
- }
- }
-
- /* Backward substitution. */
- for (i = n-1; i >= 0; i--) {
- for (j = i+1; j < n; j++) {
- inv[i*n+k] -= lu[i*n+j]*inv[j*n+k];
- }
- inv[i*n+k] /= lu[i*n+i];
- }
- }
-
- free(mxl);
- free(lxm);
- free(rowmax);
- free(lu);
-
- return 0;
-}
-/* Dec 20 1999 Doug Mink - Include wcslib.h, which includes lin.h
- *
- * Feb 15 2001 Doug Mink - Add comments for WCSLIB 2.6; no code changes
- * Sep 19 2001 Doug Mink - Add above change to WCSLIB 2.7 code
- * Nov 20 2001 Doug Mink - Always include stdlib.h
- *
- * Jan 15 2002 Bill Joye - Add ifdef so this compiles on MacOS/X
- *
- * Nov 18 2003 Doug Mink - Include stdlib.h instead of malloc.h
- */
diff --git a/funtools/wcs/platepos.c b/funtools/wcs/platepos.c
deleted file mode 100644
index 8479350..0000000
--- a/funtools/wcs/platepos.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*** File saoimage/wcslib/platepos.c
- *** February 29, 2000
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1998-2002
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: platepos.c (Plate solution WCS conversion
- * Purpose: Compute WCS from plate fit
- * Subroutine: platepos() converts from pixel location to RA,Dec
- * Subroutine: platepix() converts from RA,Dec to pixel location
-
- These functions are based on the astrmcal.c portion of GETIMAGE by
- J. Doggett and the documentation distributed with the Digital Sky Survey.
-
-*/
-
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include "wcs.h"
-
-int
-platepos (xpix, ypix, wcs, xpos, ypos)
-
-/* Routine to determine accurate position for pixel coordinates */
-/* returns 0 if successful otherwise 1 = angle too large for projection; */
-/* based on amdpos() from getimage */
-
-/* Input: */
-double xpix; /* x pixel number (RA or long without rotation) */
-double ypix; /* y pixel number (dec or lat without rotation) */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpos; /* Right ascension or longitude in degrees */
-double *ypos; /* Declination or latitude in degrees */
-
-{
- double x, y, x2, y2, x3, y3, r2;
- double xi, xir, eta, etar, raoff, ra, dec, ra0, dec0;
- double twopi = 6.28318530717959;
- double ctan, ccos;
- int ncoeff1 = wcs->ncoeff1;
- int ncoeff2 = wcs->ncoeff2;
-
- /* Ignore magnitude and color terms
- double mag = 0.0;
- double color = 0.0; */
-
- /* Convert from pixels to millimeters */
- x = xpix - wcs->crpix[0];
- y = ypix - wcs->crpix[1];
- x2 = x * x;
- y2 = y * y;
- x3 = x * x2;
- y3 = y * y2;
- r2 = x2 + y2;
-
- /* Compute xi,eta coordinates in degrees from x,y and plate model */
- xi = wcs->x_coeff[ 0] + wcs->x_coeff[ 1]*x +
- wcs->x_coeff[ 2]*y + wcs->x_coeff[ 3]*x2 +
- wcs->x_coeff[ 4]*y2 + wcs->x_coeff[ 5]*x*y;
-
- if (ncoeff1 > 6)
- xi = xi + wcs->x_coeff[ 6]*x3 + wcs->x_coeff[ 7]*y3;
-
- if (ncoeff1 > 8) {
- xi = xi + wcs->x_coeff[ 8]*x2*y + wcs->x_coeff[ 9]*x*y2 +
- wcs->x_coeff[10]*(r2) + wcs->x_coeff[11]*x*r2 +
- wcs->x_coeff[12]*y*r2;
- }
-
- eta = wcs->y_coeff[ 0] + wcs->y_coeff[ 1]*x +
- wcs->y_coeff[ 2]*y + wcs->y_coeff[ 3]*x2 +
- wcs->y_coeff[ 4]*y2 + wcs->y_coeff[ 5]*x*y;
-
- if (ncoeff2 > 6)
- eta = eta + wcs->y_coeff[ 6]*x3 + wcs->y_coeff[ 7]*y3;
-
- if (ncoeff2 > 8) {
- eta = eta + wcs->y_coeff[ 8]*x2*y + wcs->y_coeff[ 9]*y2*x +
- wcs->y_coeff[10]*r2 + wcs->y_coeff[11]*x*r2 +
- wcs->y_coeff[12]*y*r2;
- }
-
- /* Convert to radians */
- xir = degrad (xi);
- etar = degrad (eta);
-
- /* Convert to RA and Dec */
- ra0 = degrad (wcs->crval[0]);
- dec0 = degrad (wcs->crval[1]);
- ctan = tan (dec0);
- ccos = cos (dec0);
- raoff = atan2 (xir / ccos, 1.0 - etar * ctan);
- ra = raoff + ra0;
- if (ra < 0.0) ra = ra + twopi;
- *xpos = raddeg (ra);
-
- dec = atan (cos (raoff) / ((1.0 - (etar * ctan)) / (etar + ctan)));
- *ypos = raddeg (dec);
- return 0;
-}
-
-
-int
-platepix (xpos, ypos, wcs, xpix, ypix)
-
-/* Routine to determine pixel coordinates for sky position */
-/* returns 0 if successful otherwise 1 = angle too large for projection; */
-/* based on amdinv() from getimage */
-
-/* Input: */
-double xpos; /* Right ascension or longitude in degrees */
-double ypos; /* Declination or latitude in degrees */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpix; /* x pixel number (RA or long without rotation) */
-double *ypix; /* y pixel number (dec or lat without rotation) */
-
-{
- double xi,eta,x,y,xy,x2,y2,x2y,y2x,x3,y3,r2,dx,dy;
- double tdec,ctan,ccos,traoff, craoff, etar, xir;
- double f,fx,fy,g,gx,gy;
- double ra0, dec0, ra, dec;
- double tolerance = 0.0000005;
- int max_iterations = 50;
- int i;
- int ncoeff1 = wcs->ncoeff1;
- int ncoeff2 = wcs->ncoeff2;
-
- /* Convert RA and Dec in radians to standard coordinates on a plate */
- ra = degrad (xpos);
- dec = degrad (ypos);
- tdec = tan (dec);
- ra0 = degrad (wcs->crval[0]);
- dec0 = degrad (wcs->crval[1]);
- ctan = tan (dec0);
- ccos = cos (dec0);
- traoff = tan (ra - ra0);
- craoff = cos (ra - ra0);
- etar = (1.0 - ctan * craoff / tdec) / (ctan + (craoff / tdec));
- xir = traoff * ccos * (1.0 - (etar * ctan));
- xi = raddeg (xir);
- eta = raddeg (etar);
-
- /* Set initial value for x,y */
- x = xi * wcs->dc[0] + eta * wcs->dc[1];
- y = xi * wcs->dc[2] + eta * wcs->dc[3];
-
- /* if (wcs->x_coeff[1] == 0.0)
- x = xi - wcs->x_coeff[0];
- else
- x = (xi - wcs->x_coeff[0]) / wcs->x_coeff[1];
- if (wcs->y_coeff[2] == 0.0)
- y = eta - wcs->y_coeff[0];
- else
- y = (eta - wcs->y_coeff[0]) / wcs->y_coeff[2]; */
-
- /* Iterate by Newton's method */
- for (i = 0; i < max_iterations; i++) {
-
- /* X plate model */
- xy = x * y;
- x2 = x * x;
- y2 = y * y;
- x3 = x2 * x;
- y3 = y2 * y;
- x2y = x2 * y;
- y2x = y2 * x;
- r2 = x2 + y2;
-
- f = wcs->x_coeff[0] + wcs->x_coeff[1]*x +
- wcs->x_coeff[2]*y + wcs->x_coeff[3]*x2 +
- wcs->x_coeff[4]*y2 + wcs->x_coeff[5]*xy;
-
- /* Derivative of X model wrt x */
- fx = wcs->x_coeff[1] + wcs->x_coeff[3]*2.0*x +
- wcs->x_coeff[5]*y;
-
- /* Derivative of X model wrt y */
- fy = wcs->x_coeff[2] + wcs->x_coeff[4]*2.0*y +
- wcs->x_coeff[5]*x;
-
- if (ncoeff1 > 6) {
- f = f + wcs->x_coeff[6]*x3 + wcs->x_coeff[7]*y3;
- fx = fx + wcs->x_coeff[6]*3.0*x2;
- fy = fy + wcs->x_coeff[7]*3.0*y2;
- }
-
- if (ncoeff1 > 8) {
- f = f +
- wcs->x_coeff[8]*x2y + wcs->x_coeff[9]*y2x +
- wcs->x_coeff[10]*r2 + wcs->x_coeff[11]*x*r2 +
- wcs->x_coeff[12]*y*r2;
-
- fx = fx + wcs->x_coeff[8]*2.0*xy +
- wcs->x_coeff[9]*y2 +
- wcs->x_coeff[10]*2.0*x +
- wcs->x_coeff[11]*(3.0*x2+y2) +
- wcs->x_coeff[12]*2.0*xy;
-
- fy = fy + wcs->x_coeff[8]*x2 +
- wcs->x_coeff[9]*2.0*xy +
- wcs->x_coeff[10]*2.0*y +
- wcs->x_coeff[11]*2.0*xy +
- wcs->x_coeff[12]*(3.0*y2+x2);
- }
-
- /* Y plate model */
- g = wcs->y_coeff[0] + wcs->y_coeff[1]*x +
- wcs->y_coeff[2]*y + wcs->y_coeff[3]*x2 +
- wcs->y_coeff[4]*y2 + wcs->y_coeff[5]*xy;
-
- /* Derivative of Y model wrt x */
- gx = wcs->y_coeff[1] + wcs->y_coeff[3]*2.0*x +
- wcs->y_coeff[5]*y;
-
- /* Derivative of Y model wrt y */
- gy = wcs->y_coeff[2] + wcs->y_coeff[4]*2.0*y +
- wcs->y_coeff[5]*x;
-
- if (ncoeff2 > 6) {
- g = g + wcs->y_coeff[6]*x3 + wcs->y_coeff[7]*y3;
- gx = gx + wcs->y_coeff[6]*3.0*x2;
- gy = gy + wcs->y_coeff[7]*3.0*y2;
- }
-
- if (ncoeff2 > 8) {
- g = g +
- wcs->y_coeff[8]*x2y + wcs->y_coeff[9]*y2x +
- wcs->y_coeff[10]*r2 + wcs->y_coeff[11]*x*r2 +
- wcs->y_coeff[12]*y*r2;
-
- gx = gx + wcs->y_coeff[8]*2.0*xy +
- wcs->y_coeff[9]*y2 +
- wcs->y_coeff[10]*2.0*x +
- wcs->y_coeff[11]*(3.0*x2+y2) +
- wcs->y_coeff[12]*2.0*xy;
-
- gy = gy + wcs->y_coeff[8]*x2 +
- wcs->y_coeff[9]*2.0*xy +
- wcs->y_coeff[10]*2.0*y +
- wcs->y_coeff[11]*2.0*xy +
- wcs->y_coeff[12]*(3.0*y2+x2);
- }
-
- f = f - xi;
- g = g - eta;
- dx = ((-f * gy) + (g * fy)) / ((fx * gy) - (fy * gx));
- dy = ((-g * fx) + (f * gx)) / ((fx * gy) - (fy * gx));
- x = x + dx;
- y = y + dy;
- if ((fabs(dx) < tolerance) && (fabs(dy) < tolerance)) break;
- }
-
- /* Convert from plate pixels to image pixels */
- *xpix = x + wcs->crpix[0];
- *ypix = y + wcs->crpix[1];
-
- /* If position is off of the image, return offscale code */
- if (*xpix < 0.5 || *xpix > wcs->nxpix+0.5)
- return -1;
- if (*ypix < 0.5 || *ypix > wcs->nypix+0.5)
- return -1;
-
- return 0;
-}
-
-
-/* Set plate fit coefficients in structure from arguments */
-int
-SetPlate (wcs, ncoeff1, ncoeff2, coeff)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-int ncoeff1; /* Number of coefficients for x */
-int ncoeff2; /* Number of coefficients for y */
-double *coeff; /* Plate fit coefficients */
-
-{
- int i;
-
- if (nowcs (wcs) || (ncoeff1 < 1 && ncoeff2 < 1))
- return 1;
-
- wcs->ncoeff1 = ncoeff1;
- wcs->ncoeff2 = ncoeff2;
- wcs->prjcode = WCS_PLT;
-
- for (i = 0; i < 20; i++) {
- if (i < ncoeff1)
- wcs->x_coeff[i] = coeff[i];
- else
- wcs->x_coeff[i] = 0.0;
- }
-
- for (i = 0; i < 20; i++) {
- if (i < ncoeff2)
- wcs->y_coeff[i] = coeff[ncoeff1+i];
- else
- wcs->y_coeff[i] = 0.0;
- }
- return 0;
-}
-
-
-/* Return plate fit coefficients from structure in arguments */
-int
-GetPlate (wcs, ncoeff1, ncoeff2, coeff)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-int *ncoeff1; /* Number of coefficients for x */
-int *ncoeff2; /* Number of coefficients for y) */
-double *coeff; /* Plate fit coefficients */
-
-{
- int i;
-
- if (nowcs (wcs))
- return 1;
-
- *ncoeff1 = wcs->ncoeff1;
- *ncoeff2 = wcs->ncoeff2;
-
- for (i = 0; i < *ncoeff1; i++)
- coeff[i] = wcs->x_coeff[i];
-
- for (i = 0; i < *ncoeff2; i++)
- coeff[*ncoeff1+i] = wcs->y_coeff[i];
-
- return 0;
-}
-
-
-/* Set FITS header plate fit coefficients from structure */
-void
-SetFITSPlate (header, wcs)
-
-char *header; /* Image FITS header */
-struct WorldCoor *wcs; /* WCS structure */
-
-{
- char keyword[16];
- int i;
-
- for (i = 0; i < wcs->ncoeff1; i++) {
- sprintf (keyword,"CO1_%d",i+1);
- hputnr8 (header, keyword, -15, wcs->x_coeff[i]);
- }
- for (i = 0; i < wcs->ncoeff2; i++) {
- sprintf (keyword,"CO2_%d",i+1);
- hputnr8 (header, keyword, -15, wcs->y_coeff[i]);
- }
- return;
-}
-
-/* Mar 27 1998 New subroutines for direct image pixel <-> sky polynomials
- * Apr 10 1998 Make terms identical for both x and y polynomials
- * Apr 10 1998 Allow different numbers of coefficients for x and y
- * Apr 16 1998 Drom NCOEFF header parameter
- * Apr 28 1998 Change projection flags to WCS_*
- * Sep 10 1998 Check for xc1 and yc2 divide by zero after Allen Harris, SAO
- *
- * Oct 21 1999 Drop unused variables after lint
- *
- * Feb 29 2000 Use inverse CD matrix to get initial X,Y in platepix()
- * as suggested by Paolo Montegriffo from Bologna Ast. Obs.
- */
diff --git a/funtools/wcs/poly.c b/funtools/wcs/poly.c
deleted file mode 100644
index 7e88d95..0000000
--- a/funtools/wcs/poly.c
+++ /dev/null
@@ -1,914 +0,0 @@
- /*
- poly.c
-
-*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-*
-* Part of: A program using Polynomials
-*
-* Author: E.BERTIN (IAP)
-*
-* Contents: Polynomial fitting
-*
-* Last modify: 08/03/2005
-*
-*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-*/
-
-#if HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "wcslib.h"
-
-
-#define QCALLOC(ptr, typ, nel) \
- {if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \
- qerror("Not enough memory for ", \
- #ptr " (" #nel " elements) !");;}
-
-#define QMALLOC(ptr, typ, nel) \
- {if (!(ptr = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
- qerror("Not enough memory for ", \
- #ptr " (" #nel " elements) !");;}
-
-/********************************* qerror ************************************/
-/*
-I hope it will never be used!
-*/
-void qerror(char *msg1, char *msg2)
- {
- fprintf(stderr, "\n> %s%s\n\n",msg1,msg2);
- exit(-1);
- }
-
-
-/****** poly_init ************************************************************
-PROTO polystruct *poly_init(int *group, int ndim, int *degree, int ngroup)
-PURPOSE Allocate and initialize a polynom structure.
-INPUT 1D array containing the group for each parameter,
- number of dimensions (parameters),
- 1D array with the polynomial degree for each group,
- number of groups.
-OUTPUT polystruct pointer.
-NOTES -.
-AUTHOR E. Bertin (IAP)
-VERSION 08/03/2003
- ***/
-polystruct *poly_init(int *group, int ndim, int *degree, int ngroup)
- {
- void qerror(char *msg1, char *msg2);
- polystruct *poly;
- char str[512];
- int nd[POLY_MAXDIM];
- int *groupt,
- d,g,n,num,den;
-
- QCALLOC(poly, polystruct, 1);
- if ((poly->ndim=ndim) > POLY_MAXDIM)
- {
- sprintf(str, "The dimensionality of the polynom (%d) exceeds the maximum\n"
- "allowed one (%d)", ndim, POLY_MAXDIM);
- qerror("*Error*: ", str);
- }
-
- if (ndim)
- QMALLOC(poly->group, int, poly->ndim);
- for (groupt=poly->group, d=ndim; d--;)
- *(groupt++) = *(group++)-1;
-
- poly->ngroup = ngroup;
- if (ngroup)
- {
- group = poly->group; /* Forget the original *group */
-
- QMALLOC(poly->degree, int, poly->ngroup);
-
-/*-- Compute the number of context parameters for each group */
- memset(nd, 0, ngroup*sizeof(int));
- for (d=0; d<ndim; d++)
- {
- if ((g=group[d])>=ngroup)
- qerror("*Error*: polynomial GROUP out of range", "");
- nd[g]++;
- }
- }
-
-/* Compute the total number of coefficients */
- poly->ncoeff = 1;
- for (g=0; g<ngroup; g++)
- {
- if ((d=poly->degree[g]=*(degree++))>POLY_MAXDEGREE)
- {
- sprintf(str, "The degree of the polynom (%d) exceeds the maximum\n"
- "allowed one (%d)", poly->degree[g], POLY_MAXDEGREE);
- qerror("*Error*: ", str);
- }
-
-/*-- There are (n+d)!/(n!d!) coeffs per group, that is Prod_(i<=d) (n+i)/i */
- for (num=den=1, n=nd[g]; d; num*=(n+d), den*=d--);
- poly->ncoeff *= num/den;
- }
-
- QMALLOC(poly->basis, double, poly->ncoeff);
- QCALLOC(poly->coeff, double, poly->ncoeff);
-
- return poly;
- }
-
-
-/****** poly_end *************************************************************
-PROTO void poly_end(polystruct *poly)
-PURPOSE Free a polynom structure and everything it contains.
-INPUT polystruct pointer.
-OUTPUT -.
-NOTES -.
-AUTHOR E. Bertin (IAP, Leiden observatory & ESO)
-VERSION 09/04/2000
- ***/
-void poly_end(polystruct *poly)
- {
- if (poly)
- {
- free(poly->coeff);
- free(poly->basis);
- free(poly->degree);
- free(poly->group);
- free(poly);
- }
- }
-
-
-/****** poly_func ************************************************************
-PROTO double poly_func(polystruct *poly, double *pos)
-PURPOSE Evaluate a multidimensional polynom.
-INPUT polystruct pointer,
- pointer to the 1D array of input vector data.
-OUTPUT Polynom value.
-NOTES Values of the basis functions are updated in poly->basis.
-AUTHOR E. Bertin (IAP)
-VERSION 03/03/2004
- ***/
-double poly_func(polystruct *poly, double *pos)
- {
- double xpol[POLY_MAXDIM+1];
- double *post, *xpolt, *basis, *coeff, xval;
- long double val;
- int expo[POLY_MAXDIM+1], gexpo[POLY_MAXDIM+1];
- int *expot, *degree,*degreet, *group,*groupt, *gexpot,
- d,g,t, ndim;
-
-/* Prepare the vectors and counters */
- ndim = poly->ndim;
- basis = poly->basis;
- coeff = poly->coeff;
- group = poly->group;
- degree = poly->degree;
- if (ndim)
- {
- for (xpolt=xpol, expot=expo, post=pos, d=ndim; --d;)
- {
- *(++xpolt) = 1.0;
- *(++expot) = 0;
- }
- for (gexpot=gexpo, degreet=degree, g=poly->ngroup; g--;)
- *(gexpot++) = *(degreet++);
- if (gexpo[*group])
- gexpo[*group]--;
- }
-
-/* The constant term is handled separately */
- val = *(coeff++);
- *(basis++) = 1.0;
- *expo = 1;
- *xpol = *pos;
-
-/* Compute the rest of the polynom */
- for (t=poly->ncoeff; --t; )
- {
-/*-- xpol[0] contains the current product of the x^n's */
- val += (*(basis++)=*xpol)**(coeff++);
-/*-- A complex recursion between terms of the polynom speeds up computations */
-/*-- Not too good for roundoff errors (prefer Horner's), but much easier for */
-/*-- multivariate polynomials: this is why we use a long double accumulator */
- post = pos;
- groupt = group;
- expot = expo;
- xpolt = xpol;
- for (d=0; d<ndim; d++, groupt++)
- if (gexpo[*groupt]--)
- {
- ++*(expot++);
- xval = (*(xpolt--) *= *post);
- while (d--)
- *(xpolt--) = xval;
- break;
- }
- else
- {
- gexpo[*groupt] = *expot;
- *(expot++) = 0;
- *(xpolt++) = 1.0;
- post++;
- }
- }
-
- return (double)val;
- }
-
-
-/****** poly_fit *************************************************************
-PROTO double poly_fit(polystruct *poly, double *x, double *y, double *w,
- int ndata, double *extbasis)
-PURPOSE Least-Square fit of a multidimensional polynom to weighted data.
-INPUT polystruct pointer,
- pointer to the (pseudo)2D array of inputs to basis functions,
- pointer to the 1D array of data values,
- pointer to the 1D array of data weights,
- number of data points,
- pointer to a (pseudo)2D array of computed basis function values.
-OUTPUT Chi2 of the fit.
-NOTES If different from NULL, extbasis can be provided to store the
- values of the basis functions. If x==NULL and extbasis!=NULL, the
- precomputed basis functions stored in extbasis are used (which saves
- CPU). If w is NULL, all points are given identical weight.
-AUTHOR E. Bertin (IAP, Leiden observatory & ESO)
-VERSION 08/03/2005
- ***/
-void poly_fit(polystruct *poly, double *x, double *y, double *w, int ndata,
- double *extbasis)
- {
- void qerror(char *msg1, char *msg2);
- double /*offset[POLY_MAXDIM],*/x2[POLY_MAXDIM],
- *alpha,*alphat, *beta,*betat, *basis,*basis1,*basis2, *coeff,
- *extbasist,*xt,
- val,wval,yval;
- int ncoeff, ndim, matsize,
- d,i,j,n;
-
- if (!x && !extbasis)
- qerror("*Internal Error*: One of x or extbasis should be "
- "different from NULL\nin ", "poly_func()");
- ncoeff = poly->ncoeff;
- ndim = poly->ndim;
- matsize = ncoeff*ncoeff;
- basis = poly->basis;
- extbasist = extbasis;
- QCALLOC(alpha, double, matsize);
- QCALLOC(beta, double, ncoeff);
-
-/* Subtract an average offset to maintain precision (droped for now ) */
-/*
- if (x)
- {
- for (d=0; d<ndim; d++)
- offset[d] = 0.0;
- xt = x;
- for (n=ndata; n--;)
- for (d=0; d<ndim; d++)
- offset[d] += *(xt++);
- for (d=0; d<ndim; d++)
- offset[d] /= (double)ndata;
- }
-*/
-/* Build the covariance matrix */
- xt = x;
- for (n=ndata; n--;)
- {
- if (x)
- {
-/*---- If x!=NULL, compute the basis functions */
- for (d=0; d<ndim; d++)
- x2[d] = *(xt++)/* - offset[d]*/;
- poly_func(poly, x2);
-/*---- If, in addition, extbasis is provided, then fill it */
- if (extbasis)
- for (basis1=basis,j=ncoeff; j--;)
- *(extbasist++) = *(basis1++);
- }
- else
-/*---- If x==NULL, then rely on pre-computed basis functions */
- for (basis1=basis,j=ncoeff; j--;)
- *(basis1++) = *(extbasist++);
-
- basis1 = basis;
- wval = w? *(w++) : 1.0;
- yval = *(y++);
- betat = beta;
- alphat = alpha;
- for (j=ncoeff; j--;)
- {
- val = *(basis1++)*wval;
- *(betat++) += val*yval;
- for (basis2=basis,i=ncoeff; i--;)
- *(alphat++) += val**(basis2++);
- }
- }
-
-/* Solve the system */
- poly_solve(alpha,beta,ncoeff);
-
- free(alpha);
-
-/* Now fill the coeff array with the result of the fit */
- betat = beta;
- coeff = poly->coeff;
- for (j=ncoeff; j--;)
- *(coeff++) = *(betat++);
-/*
- poly_addcste(poly, offset);
-*/
- free(beta);
-
- return;
- }
-
-
-/****** poly_addcste *********************************************************
-PROTO void poly_addcste(polystruct *poly, double *cste)
-PURPOSE Modify matrix coefficients to mimick the effect of adding a cst to
- the input of a polynomial.
-INPUT Pointer to the polynomial structure,
- Pointer to the vector of cst.
-OUTPUT -.
-NOTES Requires quadruple-precision. **For the time beeing, this function
- returns completely wrong results!!**
-AUTHOR E. Bertin (IAP)
-VERSION 03/03/2004
- ***/
-void poly_addcste(polystruct *poly, double *cste)
- {
- long double *acoeff;
- double *coeff,*mcoeff,*mcoefft,
- val;
- int *mpowers,*powers,*powerst,*powerst2,
- i,j,n,p, denum, flag, maxdegree, ncoeff, ndim;
-
- ncoeff = poly->ncoeff;
- ndim = poly->ndim;
- maxdegree = 0;
- for (j=0; j<poly->ngroup; j++)
- if (maxdegree < poly->degree[j])
- maxdegree = poly->degree[j];
- maxdegree++; /* Actually we need maxdegree+1 terms */
- QCALLOC(acoeff, long double, ncoeff);
- QCALLOC(mcoeff, double, ndim*maxdegree);
- QCALLOC(mpowers, int, ndim);
- mcoefft = mcoeff; /* To avoid gcc -Wall warnings */
- powerst = powers = poly_powers(poly);
- coeff = poly->coeff;
- for (i=0; i<ncoeff; i++)
- {
- for (j=0; j<ndim; j++)
- {
- mpowers[j] = n = *(powerst++);
- mcoefft = mcoeff+j*maxdegree+n;
- denum = 1;
- val = 1.0;
- for (p=n+1; p--;)
- {
- *(mcoefft--) = val;
- val *= (cste[j]*(n--))/(denum++); /* This is C_n^p X^(n-p) */
- }
- }
-/*-- Update all valid coefficients */
- powerst2 = powers;
- for (p=0; p<ncoeff; p++)
- {
-/*---- Check that this combination of powers is included in the series above */
- flag = 0;
- for (j=0; j<ndim; j++)
- if (mpowers[j] < powerst2[j])
- {
- flag = 1;
- powerst2 += ndim;
- break;
- }
- if (flag == 1)
- continue;
- val = 1.0;
- mcoefft = mcoeff;
- for (j=ndim; j--; mcoefft += maxdegree)
- val *= mcoefft[*(powerst2++)];
- acoeff[i] += val*coeff[p];
-/*
-printf("%g \n", val);
-*/
- }
- }
-
-/* Add the new coefficients to the previous ones */
-
- for (i=0; i<ncoeff; i++)
-{
-/*
-printf("%g %g\n", coeff[i], (double)acoeff[i]);
-*/
- coeff[i] = (double)acoeff[i];
-}
-
- free(acoeff);
- free(mcoeff);
- free(mpowers);
- free(powers);
-
- return;
- }
-
-/****** poly_solve ************************************************************
-PROTO void poly_solve(double *a, double *b, int n)
-PURPOSE Solve a system of linear equations, using Cholesky decomposition or
- SVD (if the former fails due to hidden correlation between variables).
-INPUT Pointer to the (pseudo 2D) matrix of coefficients,
- pointer to the 1D column vector,
- matrix size.
-OUTPUT -.
-NOTES -.
-AUTHOR E. Bertin (IAP, Leiden observatory & ESO)
-VERSION 21/09/2004
- ***/
-void poly_solve(double *a, double *b, int n)
- {
- double *vmat,*wmat;
-
- if (cholsolve(a,b,n))
- {
- QMALLOC(vmat, double, n*n);
- QMALLOC(wmat, double, n);
- svdsolve(a, b, n,n, vmat,wmat);
- free(vmat);
- free(wmat);
- }
-
- return;
- }
-
-/****** cholsolve *************************************************************
-PROTO void cholsolve(double *a, double *b, int n)
-PURPOSE Solve a system of linear equations, using Cholesky decomposition.
-INPUT Pointer to the (pseudo 2D) matrix of coefficients,
- pointer to the 1D column vector,
- matrix size.
-OUTPUT -1 if the matrix is not positive-definite, 0 otherwise.
-NOTES Based on Numerical Recipes, 2nd ed. (Chap 2.9). The matrix of
- coefficients must be symmetric and positive definite.
-AUTHOR E. Bertin (IAP, Leiden observatory & ESO)
-VERSION 28/10/2003
- ***/
-int cholsolve(double *a, double *b, int n)
- {
- void qerror(char *msg1, char *msg2);
- double *p, *x, sum;
- int i,j,k;
-
-/* Allocate memory to store the diagonal elements */
- QMALLOC(p, double, n);
-
-/* Cholesky decomposition */
- for (i=0; i<n; i++)
- for (j=i; j<n; j++)
- {
- for (sum=a[i*n+j],k=i-1; k>=0; k--)
- sum -= a[i*n+k]*a[j*n+k];
- if (i==j)
- {
- if (sum <= 0.0)
- {
- free(p);
- return -1;
- }
- p[i] = sqrt(sum);
- }
- else
- a[j*n+i] = sum/p[i];
- }
-
-/* Solve the system */
- x = b; /* Just to save memory: the solution replaces b */
- for (i=0; i<n; i++)
- {
- for (sum=b[i],k=i-1; k>=0; k--)
- sum -= a[i*n+k]*x[k];
- x[i] = sum/p[i];
- }
-
- for (i=n-1; i>=0; i--)
- {
- for (sum=x[i],k=i+1; k<n; k++)
- sum -= a[k*n+i]*x[k];
- x[i] = sum/p[i];
- }
-
- free(p);
-
- return 0;
- }
-
-
-/****** svdsolve *************************************************************
-PROTO void svdsolve(double *a, double *b, int m, int n, double *vmat,
- double *wmat)
-PURPOSE General least-square fit A.x = b, based on Singular Value
- Decomposition (SVD).
- Loosely adapted from Numerical Recipes in C, 2nd Ed. (p. 671).
-INPUT Pointer to the (pseudo 2D) matrix of coefficients,
- pointer to the 1D column vector (replaced by solution in output),
- number of matrix rows,
- number of matrix columns,
- pointer to the (pseudo 2D) SVD matrix,
- pointer to the diagonal (1D) matrix of singular values.
-OUTPUT -.
-NOTES Loosely adapted from Numerical Recipes in C, 2nd Ed. (p. 671). The a
- and v matrices are transposed with respect to the N.R. convention.
-AUTHOR E. Bertin (IAP)
-VERSION 26/12/2003
- ***/
-void svdsolve(double *a, double *b, int m, int n, double *vmat, double *wmat)
- {
-#define MAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1) > (maxarg2) ?\
- (maxarg1) : (maxarg2))
-#define PYTHAG(a,b) ((at=fabs(a)) > (bt=fabs(b)) ? \
- (ct=bt/at,at*sqrt(1.0+ct*ct)) \
- : (bt ? (ct=at/bt,bt*sqrt(1.0+ct*ct)): 0.0))
-#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
-#define TOL 1.0e-11
- void qerror(char *msg1, char *msg2);
-
- int flag,i,its,j,jj,k,l,mmi,nm, nml;
- double *w,*ap,*ap0,*ap1,*ap10,*rv1p,*vp,*vp0,*vp1,*vp10,
- *bp,*tmpp, *rv1,*tmp, *sol,
- c,f,h,s,x,y,z,
- anorm, g, scale,
- at,bt,ct,maxarg1,maxarg2,
- thresh, wmax;
-
- anorm = g = scale = 0.0;
- if (m < n)
- qerror("*Error*: Not enough rows for solving the system ", "in svdfit()");
-
- sol = b; /* The solution overwrites the input column matrix */
- QMALLOC(rv1, double, n);
- QMALLOC(tmp, double, n);
- l = nm = nml = 0; /* To avoid gcc -Wall warnings */
- for (i=0;i<n;i++)
- {
- l = i+1;
- nml = n-l;
- rv1[i] = scale*g;
- g = s = scale = 0.0;
- if ((mmi = m - i) > 0)
- {
- ap = ap0 = a+i*(m+1);
- for (k=mmi;k--;)
- scale += fabs(*(ap++));
- if (scale)
- {
- for (ap=ap0,k=mmi; k--; ap++)
- {
- *ap /= scale;
- s += *ap**ap;
- }
- f = *ap0;
- g = -SIGN(sqrt(s),f);
- h = f*g-s;
- *ap0 = f-g;
- ap10 = a+l*m+i;
- for (j=nml;j--; ap10+=m)
- {
- for (s=0.0,ap=ap0,ap1=ap10,k=mmi; k--;)
- s += *(ap1++)**(ap++);
- f = s/h;
- for (ap=ap0,ap1=ap10,k=mmi; k--;)
- *(ap1++) += f**(ap++);
- }
- for (ap=ap0,k=mmi; k--;)
- *(ap++) *= scale;
- }
- }
- wmat[i] = scale*g;
- g = s = scale = 0.0;
- if (i < m && i+1 != n)
- {
- ap = ap0 = a+i+m*l;
- for (k=nml;k--; ap+=m)
- scale += fabs(*ap);
- if (scale)
- {
- for (ap=ap0,k=nml;k--; ap+=m)
- {
- *ap /= scale;
- s += *ap**ap;
- }
- f=*ap0;
- g = -SIGN(sqrt(s),f);
- h=f*g-s;
- *ap0=f-g;
- rv1p = rv1+l;
- for (ap=ap0,k=nml;k--; ap+=m)
- *(rv1p++) = *ap/h;
- ap10 = a+l+m*l;
- for (j=m-l; j--; ap10++)
- {
- for (s=0.0,ap=ap0,ap1=ap10,k=nml; k--; ap+=m,ap1+=m)
- s += *ap1**ap;
- rv1p = rv1+l;
- for (ap1=ap10,k=nml;k--; ap1+=m)
- *ap1 += s**(rv1p++);
- }
- for (ap=ap0,k=nml;k--; ap+=m)
- *ap *= scale;
- }
- }
- anorm=MAX(anorm,(fabs(wmat[i])+fabs(rv1[i])));
- }
-
- for (i=n-1;i>=0;i--)
- {
- if (i < n-1)
- {
- if (g)
- {
- ap0 = a+l*m+i;
- vp0 = vmat+i*n+l;
- vp10 = vmat+l*n+l;
- g *= *ap0;
- for (ap=ap0,vp=vp0,j=nml; j--; ap+=m)
- *(vp++) = *ap/g;
- for (j=nml; j--; vp10+=n)
- {
- for (s=0.0,ap=ap0,vp1=vp10,k=nml; k--; ap+=m)
- s += *ap**(vp1++);
- for (vp=vp0,vp1=vp10,k=nml; k--;)
- *(vp1++) += s**(vp++);
- }
- }
- vp = vmat+l*n+i;
- vp1 = vmat+i*n+l;
- for (j=nml; j--; vp+=n)
- *vp = *(vp1++) = 0.0;
- }
- vmat[i*n+i]=1.0;
- g=rv1[i];
- l=i;
- nml = n-l;
- }
-
- for (i=(m<n?m:n); --i>=0;)
- {
- l=i+1;
- nml = n-l;
- mmi=m-i;
- g=wmat[i];
- ap0 = a+i*m+i;
- ap10 = ap0 + m;
- for (ap=ap10,j=nml;j--;ap+=m)
- *ap=0.0;
- if (g)
- {
- g=1.0/g;
- for (j=nml;j--; ap10+=m)
- {
- for (s=0.0,ap=ap0,ap1=ap10,k=mmi; --k;)
- s += *(++ap)**(++ap1);
- f = (s/(*ap0))*g;
- for (ap=ap0,ap1=ap10,k=mmi;k--;)
- *(ap1++) += f**(ap++);
- }
- for (ap=ap0,j=mmi;j--;)
- *(ap++) *= g;
- }
- else
- for (ap=ap0,j=mmi;j--;)
- *(ap++)=0.0;
- ++(*ap0);
- }
-
- for (k=n; --k>=0;)
- {
- for (its=0;its<100;its++)
- {
- flag=1;
- for (l=k;l>=0;l--)
- {
- nm=l-1;
- if (fabs(rv1[l])+anorm == anorm)
- {
- flag=0;
- break;
- }
- if (fabs(wmat[nm])+anorm == anorm)
- break;
- }
- if (flag)
- {
- c=0.0;
- s=1.0;
- ap0 = a+nm*m;
- ap10 = a+l*m;
- for (i=l; i<=k; i++,ap10+=m)
- {
- f=s*rv1[i];
- if (fabs(f)+anorm == anorm)
- break;
- g=wmat[i];
- h=PYTHAG(f,g);
- wmat[i]=h;
- h=1.0/h;
- c=g*h;
- s=(-f*h);
- for (ap=ap0,ap1=ap10,j=m; j--;)
- {
- z = *ap1;
- y = *ap;
- *(ap++) = y*c+z*s;
- *(ap1++) = z*c-y*s;
- }
- }
- }
- z=wmat[k];
- if (l == k)
- {
- if (z < 0.0)
- {
- wmat[k] = -z;
- vp = vmat+k*n;
- for (j=n; j--; vp++)
- *vp = (-*vp);
- }
- break;
- }
- if (its == 99)
- qerror("*Error*: No convergence in 100 SVD iterations ",
- "in svdfit()");
- x=wmat[l];
- nm=k-1;
- y=wmat[nm];
- g=rv1[nm];
- h=rv1[k];
- f=((y-z)*(y+z)+(g-h)*(g+h))/(2.0*h*y);
- g=PYTHAG(f,1.0);
- f=((x-z)*(x+z)+h*((y/(f+SIGN(g,f)))-h))/x;
- c=s=1.0;
- ap10 = a+l*m;
- vp10 = vmat+l*n;
- for (j=l;j<=nm;j++,ap10+=m,vp10+=n)
- {
- i=j+1;
- g=rv1[i];
- y=wmat[i];
- h=s*g;
- g=c*g;
- z=PYTHAG(f,h);
- rv1[j]=z;
- c=f/z;
- s=h/z;
- f=x*c+g*s;
- g=g*c-x*s;
- h=y*s;
- y=y*c;
- for (vp=(vp1=vp10)+n,jj=n; jj--;)
- {
- z = *vp;
- x = *vp1;
- *(vp1++) = x*c+z*s;
- *(vp++) = z*c-x*s;
- }
- z=PYTHAG(f,h);
- wmat[j]=z;
- if (z)
- {
- z=1.0/z;
- c=f*z;
- s=h*z;
- }
- f=c*g+s*y;
- x=c*y-s*g;
- for (ap=(ap1=ap10)+m,jj=m; jj--;)
- {
- z = *ap;
- y = *ap1;
- *(ap1++) = y*c+z*s;
- *(ap++) = z*c-y*s;
- }
- }
- rv1[l]=0.0;
- rv1[k]=f;
- wmat[k]=x;
- }
- }
-
- wmax=0.0;
- w = wmat;
- for (j=n;j--; w++)
- if (*w > wmax)
- wmax=*w;
- thresh=TOL*wmax;
- w = wmat;
- for (j=n;j--; w++)
- if (*w < thresh)
- *w = 0.0;
-
- w = wmat;
- ap = a;
- tmpp = tmp;
- for (j=n; j--; w++)
- {
- s=0.0;
- if (*w)
- {
- bp = b;
- for (i=m; i--;)
- s += *(ap++)**(bp++);
- s /= *w;
- }
- else
- ap += m;
- *(tmpp++) = s;
- }
-
- vp0 = vmat;
- for (j=0; j<n; j++,vp0++)
- {
- s=0.0;
- tmpp = tmp;
- for (vp=vp0,jj=n; jj--; vp+=n)
- s += *vp**(tmpp++);
- sol[j]=s;
- }
-/* Free temporary arrays */
- free(tmp);
- free(rv1);
-
- return;
- }
-
-#undef SIGN
-#undef MAX
-#undef PYTHAG
-#undef TOL
-
-/****** poly_powers ***********************************************************
-PROTO int *poly_powers(polystruct *poly)
-PURPOSE Return an array of powers of polynom terms
-INPUT polystruct pointer,
-OUTPUT Pointer to an array of polynom powers (int *), (ncoeff*ndim numbers).
-NOTES The returned pointer is mallocated.
-AUTHOR E. Bertin (IAP)
-VERSION 23/10/2003
- ***/
-int *poly_powers(polystruct *poly)
- {
- int expo[POLY_MAXDIM+1], gexpo[POLY_MAXDIM+1];
- int *expot, *degree,*degreet, *group,*groupt, *gexpot,
- *powers, *powerst,
- d,g,t, ndim;
-
-/* Prepare the vectors and counters */
- ndim = poly->ndim;
- group = poly->group;
- degree = poly->degree;
- QMALLOC(powers, int, ndim*poly->ncoeff);
- if (ndim)
- {
- for (expot=expo, d=ndim; --d;)
- *(++expot) = 0;
- for (gexpot=gexpo, degreet=degree, g=poly->ngroup; g--;)
- *(gexpot++) = *(degreet++);
- if (gexpo[*group])
- gexpo[*group]--;
- }
-
-/* The constant term is handled separately */
- powerst = powers;
- for (d=0; d<ndim; d++)
- *(powerst++) = 0;
- *expo = 1;
-
-/* Compute the rest of the polynom */
- for (t=poly->ncoeff; --t; )
- {
- for (d=0; d<ndim; d++)
- *(powerst++) = expo[d];
-/*-- A complex recursion between terms of the polynom speeds up computations */
- groupt = group;
- expot = expo;
- for (d=0; d<ndim; d++, groupt++)
- if (gexpo[*groupt]--)
- {
- ++*(expot++);
- break;
- }
- else
- {
- gexpo[*groupt] = *expot;
- *(expot++) = 0;
- }
- }
-
- return powers;
- }
-
diff --git a/funtools/wcs/proj.c b/funtools/wcs/proj.c
deleted file mode 100644
index c0264b8..0000000
--- a/funtools/wcs/proj.c
+++ /dev/null
@@ -1,4527 +0,0 @@
-/*============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-*=============================================================================
-*
-* C implementation of the spherical map projections recognized by the FITS
-* "World Coordinate System" (WCS) convention.
-*
-* Summary of routines
-* -------------------
-* Each projection is implemented via separate functions for the forward,
-* *fwd(), and reverse, *rev(), transformation.
-*
-* Initialization routines, *set(), compute intermediate values from the
-* projection parameters but need not be called explicitly - see the
-* explanation of prj.flag below.
-*
-* prjset prjfwd prjrev Driver routines (see below).
-*
-* azpset azpfwd azprev AZP: zenithal/azimuthal perspective
-* szpset szpfwd szprev SZP: slant zenithal perspective
-* tanset tanfwd tanrev TAN: gnomonic
-* stgset stgfwd stgrev STG: stereographic
-* sinset sinfwd sinrev SIN: orthographic/synthesis
-* arcset arcfwd arcrev ARC: zenithal/azimuthal equidistant
-* zpnset zpnfwd zpnrev ZPN: zenithal/azimuthal polynomial
-* zeaset zeafwd zearev ZEA: zenithal/azimuthal equal area
-* airset airfwd airrev AIR: Airy
-* cypset cypfwd cyprev CYP: cylindrical perspective
-* ceaset ceafwd cearev CEA: cylindrical equal area
-* carset carfwd carrev CAR: Cartesian
-* merset merfwd merrev MER: Mercator
-* sflset sflfwd sflrev SFL: Sanson-Flamsteed
-* parset parfwd parrev PAR: parabolic
-* molset molfwd molrev MOL: Mollweide
-* aitset aitfwd aitrev AIT: Hammer-Aitoff
-* copset copfwd coprev COP: conic perspective
-* coeset coefwd coerev COE: conic equal area
-* codset codfwd codrev COD: conic equidistant
-* cooset coofwd coorev COO: conic orthomorphic
-* bonset bonfwd bonrev BON: Bonne
-* pcoset pcofwd pcorev PCO: polyconic
-* tscset tscfwd tscrev TSC: tangential spherical cube
-* cscset cscfwd cscrev CSC: COBE quadrilateralized spherical cube
-* qscset qscfwd qscrev QSC: quadrilateralized spherical cube
-*
-*
-* Driver routines; prjset(), prjfwd() & prjrev()
-* ----------------------------------------------
-* A set of driver routines are available for use as a generic interface to
-* the specific projection routines. The interfaces to prjfwd() and prjrev()
-* are the same as those of the forward and reverse transformation routines
-* for the specific projections (see below).
-*
-* The interface to prjset() differs slightly from that of the initialization
-* routines for the specific projections and unlike them it must be invoked
-* explicitly to use prjfwd() and prjrev().
-*
-* Given:
-* pcode[4] const char
-* WCS projection code.
-*
-* Given and/or returned:
-* prj prjprm* Projection parameters (see below).
-*
-* Function return value:
-* int Error status
-* 0: Success.
-*
-*
-* Initialization routine; *set()
-* ------------------------------
-* Initializes members of a prjprm data structure which hold intermediate
-* values. Note that this routine need not be called directly; it will be
-* invoked by prjfwd() and prjrev() if the "flag" structure member is
-* anything other than a predefined magic value.
-*
-* Given and/or returned:
-* prj prjprm* Projection parameters (see below).
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid projection parameters.
-*
-* Forward transformation; *fwd()
-* -----------------------------
-* Compute (x,y) coordinates in the plane of projection from native spherical
-* coordinates (phi,theta).
-*
-* Given:
-* phi, const double
-* theta Longitude and latitude of the projected point in
-* native spherical coordinates, in degrees.
-*
-* Given and returned:
-* prj prjprm* Projection parameters (see below).
-*
-* Returned:
-* x,y double* Projected coordinates.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid projection parameters.
-* 2: Invalid value of (phi,theta).
-*
-* Reverse transformation; *rev()
-* -----------------------------
-* Compute native spherical coordinates (phi,theta) from (x,y) coordinates in
-* the plane of projection.
-*
-* Given:
-* x,y const double
-* Projected coordinates.
-*
-* Given and returned:
-* prj prjprm* Projection parameters (see below).
-*
-* Returned:
-* phi, double* Longitude and latitude of the projected point in
-* theta native spherical coordinates, in degrees.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid projection parameters.
-* 2: Invalid value of (x,y).
-* 1: Invalid projection parameters.
-*
-* Projection parameters
-* ---------------------
-* The prjprm struct consists of the following:
-*
-* int flag
-* This flag must be set to zero whenever any of p[10] or r0 are set
-* or changed. This signals the initialization routine to recompute
-* intermediaries. flag may also be set to -1 to disable strict bounds
-* checking for the AZP, SZP, TAN, SIN, ZPN, and COP projections.
-*
-* double r0
-* r0; The radius of the generating sphere for the projection, a linear
-* scaling parameter. If this is zero, it will be reset to the default
-* value of 180/pi (the value for FITS WCS).
-*
-* double p[10]
-* The first 10 elements contain projection parameters which correspond
-* to the PROJPn keywords in FITS, so p[0] is PROJP0, and p[9] is
-* PROJP9. Many projections use p[1] (PROJP1) and some also use p[2]
-* (PROJP2). ZPN is the only projection which uses any of the others.
-*
-* The remaining members of the prjprm struct are maintained by the
-* initialization routines and should not be modified. This is done for the
-* sake of efficiency and to allow an arbitrary number of contexts to be
-* maintained simultaneously.
-*
-* char code[4]
-* Three-letter projection code.
-*
-* double phi0, theta0
-* Native longitude and latitude of the reference point, in degrees.
-*
-* double w[10]
-* int n
-* Intermediate values derived from the projection parameters.
-*
-* int (*prjfwd)()
-* int (*prjrev)()
-* Pointers to the forward and reverse projection routines.
-*
-* Usage of the p[] array as it applies to each projection is described in
-* the prologue to each trio of projection routines.
-*
-* Argument checking
-* -----------------
-* Forward routines:
-*
-* The values of phi and theta (the native longitude and latitude)
-* normally lie in the range [-180,180] for phi, and [-90,90] for theta.
-* However, all forward projections will accept any value of phi and will
-* not normalize it.
-*
-* The forward projection routines do not explicitly check that theta lies
-* within the range [-90,90]. They do check for any value of theta which
-* produces an invalid argument to the projection equations (e.g. leading
-* to division by zero). The forward routines for AZP, SZP, TAN, SIN,
-* ZPN, and COP also return error 2 if (phi,theta) corresponds to the
-* overlapped (far) side of the projection but also return the
-* corresponding value of (x,y). This strict bounds checking may be
-* relaxed by setting prj->flag to -1 (rather than 0) when these
-* projections are initialized.
-*
-* Reverse routines:
-*
-* Error checking on the projected coordinates (x,y) is limited to that
-* required to ascertain whether a solution exists. Where a solution does
-* exist no check is made that the value of phi and theta obtained lie
-* within the ranges [-180,180] for phi, and [-90,90] for theta.
-*
-* Accuracy
-* --------
-* Closure to a precision of at least 1E-10 degree of longitude and latitude
-* has been verified for typical projection parameters on the 1 degree grid
-* of native longitude and latitude (to within 5 degrees of any latitude
-* where the projection may diverge).
-*
-* Author: Mark Calabretta, Australia Telescope National Facility
-* $Id: proj.c,v 2.20 2002/04/03 01:25:29 mcalabre Exp $
-*===========================================================================*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "wcslib.h"
-
-int npcode = 26;
-char pcodes[26][4] =
- {"AZP", "SZP", "TAN", "STG", "SIN", "ARC", "ZPN", "ZEA", "AIR", "CYP",
- "CEA", "CAR", "MER", "COP", "COE", "COD", "COO", "SFL", "PAR", "MOL",
- "AIT", "BON", "PCO", "TSC", "CSC", "QSC"};
-
-const int AZP = 101;
-const int SZP = 102;
-const int TAN = 103;
-const int STG = 104;
-const int SIN = 105;
-const int ARC = 106;
-const int ZPN = 107;
-const int ZEA = 108;
-const int AIR = 109;
-const int CYP = 201;
-const int CEA = 202;
-const int CAR = 203;
-const int MER = 204;
-const int SFL = 301;
-const int PAR = 302;
-const int MOL = 303;
-const int AIT = 401;
-const int COP = 501;
-const int COE = 502;
-const int COD = 503;
-const int COO = 504;
-const int BON = 601;
-const int PCO = 602;
-const int TSC = 701;
-const int CSC = 702;
-const int QSC = 703;
-
-/* Map error number to error message for each function. */
-const char *prjset_errmsg[] = {
- 0,
- "Invalid projection parameters"};
-
-const char *prjfwd_errmsg[] = {
- 0,
- "Invalid projection parameters",
- "Invalid value of (phi,theta)"};
-
-const char *prjrev_errmsg[] = {
- 0,
- "Invalid projection parameters",
- "Invalid value of (x,y)"};
-
-#define copysgn(X, Y) ((Y) < 0.0 ? -fabs(X) : fabs(X))
-#define copysgni(X, Y) ((Y) < 0 ? -abs(X) : abs(X))
-
-/*==========================================================================*/
-
-int prjset(pcode, prj)
-
-const char pcode[4];
-struct prjprm *prj;
-
-{
- /* Set pointers to the forward and reverse projection routines. */
- if (strcmp(pcode, "AZP") == 0) {
- azpset(prj);
- } else if (strcmp(pcode, "SZP") == 0) {
- szpset(prj);
- } else if (strcmp(pcode, "TAN") == 0) {
- tanset(prj);
- } else if (strcmp(pcode, "STG") == 0) {
- stgset(prj);
- } else if (strcmp(pcode, "SIN") == 0) {
- sinset(prj);
- } else if (strcmp(pcode, "ARC") == 0) {
- arcset(prj);
- } else if (strcmp(pcode, "ZPN") == 0) {
- zpnset(prj);
- } else if (strcmp(pcode, "ZEA") == 0) {
- zeaset(prj);
- } else if (strcmp(pcode, "AIR") == 0) {
- airset(prj);
- } else if (strcmp(pcode, "CYP") == 0) {
- cypset(prj);
- } else if (strcmp(pcode, "CEA") == 0) {
- ceaset(prj);
- } else if (strcmp(pcode, "CAR") == 0) {
- carset(prj);
- } else if (strcmp(pcode, "MER") == 0) {
- merset(prj);
- } else if (strcmp(pcode, "SFL") == 0) {
- sflset(prj);
- } else if (strcmp(pcode, "PAR") == 0) {
- parset(prj);
- } else if (strcmp(pcode, "MOL") == 0) {
- molset(prj);
- } else if (strcmp(pcode, "AIT") == 0) {
- aitset(prj);
- } else if (strcmp(pcode, "COP") == 0) {
- copset(prj);
- } else if (strcmp(pcode, "COE") == 0) {
- coeset(prj);
- } else if (strcmp(pcode, "COD") == 0) {
- codset(prj);
- } else if (strcmp(pcode, "COO") == 0) {
- cooset(prj);
- } else if (strcmp(pcode, "BON") == 0) {
- bonset(prj);
- } else if (strcmp(pcode, "PCO") == 0) {
- pcoset(prj);
- } else if (strcmp(pcode, "TSC") == 0) {
- tscset(prj);
- } else if (strcmp(pcode, "CSC") == 0) {
- cscset(prj);
- } else if (strcmp(pcode, "QSC") == 0) {
- qscset(prj);
- } else {
- /* Unrecognized projection code. */
- return 1;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int prjfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- return prj->prjfwd(phi, theta, prj, x, y);
-}
-
-/*--------------------------------------------------------------------------*/
-
-int prjrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- return prj->prjrev(x, y, prj, phi, theta);
-}
-
-/*============================================================================
-* AZP: zenithal/azimuthal perspective projection.
-*
-* Given:
-* prj->p[1] Distance parameter, mu in units of r0.
-* prj->p[2] Tilt angle, gamma in degrees.
-*
-* Given and/or returned:
-* prj->flag AZP, or -AZP if prj->flag is given < 0.
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "AZP"
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] r0*(mu+1)
-* prj->w[1] tan(gamma)
-* prj->w[2] sec(gamma)
-* prj->w[3] cos(gamma)
-* prj->w[4] sin(gamma)
-* prj->w[5] asin(-1/mu) for |mu| >= 1, -90 otherwise
-* prj->w[6] mu*cos(gamma)
-* prj->w[7] 1 if |mu*cos(gamma)| < 1, 0 otherwise
-* prj->prjfwd Pointer to azpfwd().
-* prj->prjrev Pointer to azprev().
-*===========================================================================*/
-
-int azpset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "AZP");
- prj->flag = copysgni (AZP, prj->flag);
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = prj->r0*(prj->p[1] + 1.0);
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[3] = cosdeg (prj->p[2]);
- if (prj->w[3] == 0.0) {
- return 1;
- }
-
- prj->w[2] = 1.0/prj->w[3];
- prj->w[4] = sindeg (prj->p[2]);
- prj->w[1] = prj->w[4] / prj->w[3];
-
- if (fabs(prj->p[1]) > 1.0) {
- prj->w[5] = asindeg (-1.0/prj->p[1]);
- } else {
- prj->w[5] = -90.0;
- }
-
- prj->w[6] = prj->p[1] * prj->w[3];
- prj->w[7] = (fabs(prj->w[6]) < 1.0) ? 1.0 : 0.0;
-
- prj->prjfwd = azpfwd;
- prj->prjrev = azprev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int azpfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, b, cphi, cthe, r, s, t;
-
- if (abs(prj->flag) != AZP) {
- if (azpset(prj)) return 1;
- }
-
- cphi = cosdeg (phi);
- cthe = cosdeg (theta);
-
- s = prj->w[1]*cphi;
- t = (prj->p[1] + sindeg (theta)) + cthe*s;
- if (t == 0.0) {
- return 2;
- }
-
- r = prj->w[0]*cthe/t;
- *x = r*sindeg (phi);
- *y = -r*cphi*prj->w[2];
-
- /* Bounds checking. */
- if (prj->flag > 0) {
- /* Overlap. */
- if (theta < prj->w[5]) {
- return 2;
- }
-
- /* Divergence. */
- if (prj->w[7] > 0.0) {
- t = prj->p[1] / sqrt(1.0 + s*s);
-
- if (fabs(t) <= 1.0) {
- s = atandeg (-s);
- t = asindeg (t);
- a = s - t;
- b = s + t + 180.0;
-
- if (a > 90.0) a -= 360.0;
- if (b > 90.0) b -= 360.0;
-
- if (theta < ((a > b) ? a : b)) {
- return 2;
- }
- }
- }
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int azprev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, b, r, s, t, ycosg;
- const double tol = 1.0e-13;
-
- if (abs(prj->flag) != AZP) {
- if (azpset(prj)) return 1;
- }
-
- ycosg = y*prj->w[3];
-
- r = sqrt(x*x + ycosg*ycosg);
- if (r == 0.0) {
- *phi = 0.0;
- *theta = 90.0;
- } else {
- *phi = atan2deg (x, -ycosg);
-
- s = r / (prj->w[0] + y*prj->w[4]);
- t = s*prj->p[1]/sqrt(s*s + 1.0);
-
- s = atan2deg (1.0, s);
-
- if (fabs(t) > 1.0) {
- t = copysgn (90.0,t);
- if (fabs(t) > 1.0+tol) {
- return 2;
- }
- } else {
- t = asindeg (t);
- }
-
- a = s - t;
- b = s + t + 180.0;
-
- if (a > 90.0) a -= 360.0;
- if (b > 90.0) b -= 360.0;
-
- *theta = (a > b) ? a : b;
- }
-
- return 0;
-}
-
-/*============================================================================
-* SZP: slant zenithal perspective projection.
-*
-* Given:
-* prj->p[1] Distance of the point of projection from the centre of the
-* generating sphere, mu in units of r0.
-* prj->p[2] Native longitude, phi_c, and ...
-* prj->p[3] Native latitude, theta_c, on the planewards side of the
-* intersection of the line through the point of projection
-* and the centre of the generating sphere, phi_c in degrees.
-*
-* Given and/or returned:
-* prj->flag SZP, or -SZP if prj->flag is given < 0.
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "SZP"
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] 1/r0
-* prj->w[1] xp = -mu*cos(theta_c)*sin(phi_c)
-* prj->w[2] yp = mu*cos(theta_c)*cos(phi_c)
-* prj->w[3] zp = mu*sin(theta_c) + 1
-* prj->w[4] r0*xp
-* prj->w[5] r0*yp
-* prj->w[6] r0*zp
-* prj->w[7] (zp - 1)^2
-* prj->w[8] asin(1-zp) if |1 - zp| < 1, -90 otherwise
-* prj->prjfwd Pointer to szpfwd().
-* prj->prjrev Pointer to szprev().
-*===========================================================================*/
-
-int szpset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "SZP");
- prj->flag = copysgni (SZP, prj->flag);
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = 1.0/prj->r0;
-
- prj->w[3] = prj->p[1] * sindeg (prj->p[3]) + 1.0;
- if (prj->w[3] == 0.0) {
- return 1;
- }
-
- prj->w[1] = -prj->p[1] * cosdeg (prj->p[3]) * sindeg (prj->p[2]);
- prj->w[2] = prj->p[1] * cosdeg (prj->p[3]) * cosdeg (prj->p[2]);
- prj->w[4] = prj->r0 * prj->w[1];
- prj->w[5] = prj->r0 * prj->w[2];
- prj->w[6] = prj->r0 * prj->w[3];
- prj->w[7] = (prj->w[3] - 1.0) * prj->w[3] - 1.0;
-
- if (fabs(prj->w[3] - 1.0) < 1.0) {
- prj->w[8] = asindeg (1.0 - prj->w[3]);
- } else {
- prj->w[8] = -90.0;
- }
-
- prj->prjfwd = szpfwd;
- prj->prjrev = szprev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int szpfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, b, cphi, cthe, s, sphi, t;
-
- if (abs(prj->flag) != SZP) {
- if (szpset(prj)) return 1;
- }
-
- cphi = cosdeg (phi);
- sphi = sindeg (phi);
- cthe = cosdeg (theta);
- s = 1.0 - sindeg (theta);
-
- t = prj->w[3] - s;
- if (t == 0.0) {
- return 2;
- }
-
- *x = (prj->w[6]*cthe*sphi - prj->w[4]*s)/t;
- *y = -(prj->w[6]*cthe*cphi + prj->w[5]*s)/t;
-
- /* Bounds checking. */
- if (prj->flag > 0) {
- /* Divergence. */
- if (theta < prj->w[8]) {
- return 2;
- }
-
- /* Overlap. */
- if (fabs(prj->p[1]) > 1.0) {
- s = prj->w[1]*sphi - prj->w[2]*cphi;
- t = 1.0/sqrt(prj->w[7] + s*s);
-
- if (fabs(t) <= 1.0) {
- s = atan2deg (s, prj->w[3] - 1.0);
- t = asindeg (t);
- a = s - t;
- b = s + t + 180.0;
-
- if (a > 90.0) a -= 360.0;
- if (b > 90.0) b -= 360.0;
-
- if (theta < ((a > b) ? a : b)) {
- return 2;
- }
- }
- }
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int szprev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, b, c, d, r2, sth1, sth2, sthe, sxy, t, x1, xp, y1, yp, z;
- const double tol = 1.0e-13;
-
- if (abs(prj->flag) != SZP) {
- if (szpset(prj)) return 1;
- }
-
- xp = x*prj->w[0];
- yp = y*prj->w[0];
- r2 = xp*xp + yp*yp;
-
- x1 = (xp - prj->w[1])/prj->w[3];
- y1 = (yp - prj->w[2])/prj->w[3];
- sxy = xp*x1 + yp*y1;
-
- if (r2 < 1.0e-10) {
- /* Use small angle formula. */
- z = r2/2.0;
- *theta = 90.0 - R2D*sqrt(r2/(1.0 + sxy));
-
- } else {
- t = x1*x1 + y1*y1;
- a = t + 1.0;
- b = sxy - t;
- c = r2 - sxy - sxy + t - 1.0;
- d = b*b - a*c;
-
- /* Check for a solution. */
- if (d < 0.0) {
- return 2;
- }
- d = sqrt(d);
-
- /* Choose solution closest to pole. */
- sth1 = (-b + d)/a;
- sth2 = (-b - d)/a;
- sthe = (sth1 > sth2) ? sth1 : sth2;
- if (sthe > 1.0) {
- if (sthe-1.0 < tol) {
- sthe = 1.0;
- } else {
- sthe = (sth1 < sth2) ? sth1 : sth2;
- }
- }
-
- if (sthe < -1.0) {
- if (sthe+1.0 > -tol) {
- sthe = -1.0;
- }
- }
-
- if (sthe > 1.0 || sthe < -1.0) {
- return 2;
- }
-
- *theta = asindeg (sthe);
-
- z = 1.0 - sthe;
- }
-
- *phi = atan2deg (xp - x1*z, -(yp - y1*z));
-
- return 0;
-}
-
-/*============================================================================
-* TAN: gnomonic projection.
-*
-* Given and/or returned:
-* prj->flag TAN, or -TAN if prj->flag is given < 0.
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "TAN"
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->prjfwd Pointer to tanfwd().
-* prj->prjrev Pointer to tanrev().
-*===========================================================================*/
-
-int tanset(prj)
-
-struct prjprm *prj;
-
-{
- int k;
-
- strcpy(prj->code, "TAN");
- prj->flag = copysgni (TAN, prj->flag);
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->prjfwd = tanfwd;
- prj->prjrev = tanrev;
-
- for (k = (MAXPV-1); k >= 0 && prj->ppv[k] == 0.0 && prj->ppv[k+MAXPV] == 0.0; k--);
- if (k < 0)
- k = 0;
- prj->npv = k;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int tanfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double r, s;
- double xp[2];
-
- if (abs(prj->flag) != TAN) {
- if(tanset(prj)) return 1;
- }
-
- s = sindeg (theta);
- if (s <= 0.0) {
- return 2;
- }
-
- r = prj->r0*cosdeg (theta)/s;
- xp[0] = r*sindeg (phi);
- xp[1] = -r*cosdeg (phi);
- *x = prj->inv_x? poly_func(prj->inv_x, xp) : xp[0];
- *y = prj->inv_y? poly_func(prj->inv_y, xp) : xp[1];
-
- if (prj->flag > 0 && s < 0.0) {
- return 2;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int tanrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double r;
- double xp;
- double yp;
-
- if (abs(prj->flag) != TAN) {
- if (tanset(prj)) return 1;
- }
-
- if (prj->npv) {
- raw_to_pv(prj, x,y, &xp, &yp);
- } else {
- xp = x;
- yp = y;
- }
-
- r = sqrt(xp*xp + yp*yp);
- if (r == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (xp, -yp);
- }
-
- *theta = atan2deg (prj->r0, r);
-
- return 0;
-}
-
-/*============================================================================
-* STG: stereographic projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "STG"
-* prj->flag STG
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] 2*r0
-* prj->w[1] 1/(2*r0)
-* prj->prjfwd Pointer to stgfwd().
-* prj->prjrev Pointer to stgrev().
-*===========================================================================*/
-
-int stgset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "STG");
- prj->flag = STG;
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 360.0/PI;
- prj->w[1] = PI/360.0;
- } else {
- prj->w[0] = 2.0*prj->r0;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = stgfwd;
- prj->prjrev = stgrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int stgfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double r, s;
-
- if (prj->flag != STG) {
- if (stgset(prj)) return 1;
- }
-
- s = 1.0 + sindeg (theta);
- if (s == 0.0) {
- return 2;
- }
-
- r = prj->w[0]*cosdeg (theta)/s;
- *x = r*sindeg (phi);
- *y = -r*cosdeg (phi);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int stgrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double r;
-
- if (prj->flag != STG) {
- if (stgset(prj)) return 1;
- }
-
- r = sqrt(x*x + y*y);
- if (r == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (x, -y);
- }
- *theta = 90.0 - 2.0*atandeg (r*prj->w[1]);
-
- return 0;
-}
-
-/*============================================================================
-* SIN: orthographic/synthesis projection.
-*
-* Given:
-* prj->p[1:2] Obliqueness parameters, xi and eta.
-*
-* Given and/or returned:
-* prj->flag SIN, or -SIN if prj->flag is given < 0.
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "SIN"
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] 1/r0
-* prj->w[1] xi**2 + eta**2
-* prj->w[2] xi**2 + eta**2 + 1
-* prj->w[3] xi**2 + eta**2 - 1
-* prj->prjfwd Pointer to sinfwd().
-* prj->prjrev Pointer to sinrev().
-*===========================================================================*/
-
-int sinset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "SIN");
- prj->flag = copysgni (SIN, prj->flag);
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = 1.0/prj->r0;
- prj->w[1] = prj->p[1]*prj->p[1] + prj->p[2]*prj->p[2];
- prj->w[2] = prj->w[1] + 1.0;
- prj->w[3] = prj->w[1] - 1.0;
-
- prj->prjfwd = sinfwd;
- prj->prjrev = sinrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int sinfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double cphi, cthe, sphi, t, z;
-
- if (abs(prj->flag) != SIN) {
- if (sinset(prj)) return 1;
- }
-
- t = (90.0 - fabs(theta))*D2R;
- if (t < 1.0e-5) {
- if (theta > 0.0) {
- z = t*t/2.0;
- } else {
- z = 2.0 - t*t/2.0;
- }
- cthe = t;
- } else {
- z = 1.0 - sindeg (theta);
- cthe = cosdeg (theta);
- }
-
- cphi = cosdeg (phi);
- sphi = sindeg (phi);
- *x = prj->r0*(cthe*sphi + prj->p[1]*z);
- *y = -prj->r0*(cthe*cphi - prj->p[2]*z);
-
- /* Validate this solution. */
- if (prj->flag > 0) {
- if (prj->w[1] == 0.0) {
- /* Orthographic projection. */
- if (theta < 0.0) {
- return 2;
- }
- } else {
- /* "Synthesis" projection. */
- t = -atandeg (prj->p[1]*sphi - prj->p[2]*cphi);
- if (theta < t) {
- return 2;
- }
- }
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int sinrev (x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- const double tol = 1.0e-13;
- double a, b, c, d, r2, sth1, sth2, sthe, sxy, x0, x1, xp, y0, y1, yp, z;
-
- if (abs(prj->flag) != SIN) {
- if (sinset(prj)) return 1;
- }
-
- /* Compute intermediaries. */
- x0 = x*prj->w[0];
- y0 = y*prj->w[0];
- r2 = x0*x0 + y0*y0;
-
- if (prj->w[1] == 0.0) {
- /* Orthographic projection. */
- if (r2 != 0.0) {
- *phi = atan2deg (x0, -y0);
- } else {
- *phi = 0.0;
- }
-
- if (r2 < 0.5) {
- *theta = acosdeg (sqrt(r2));
- } else if (r2 <= 1.0) {
- *theta = asindeg (sqrt(1.0 - r2));
- } else {
- return 2;
- }
-
- } else {
- /* "Synthesis" projection. */
- x1 = prj->p[1];
- y1 = prj->p[2];
- sxy = x0*x1 + y0*y1;
-
- if (r2 < 1.0e-10) {
- /* Use small angle formula. */
- z = r2/2.0;
- *theta = 90.0 - R2D*sqrt(r2/(1.0 + sxy));
-
- } else {
- a = prj->w[2];
- b = sxy - prj->w[1];
- c = r2 - sxy - sxy + prj->w[3];
- d = b*b - a*c;
-
- /* Check for a solution. */
- if (d < 0.0) {
- return 2;
- }
- d = sqrt(d);
-
- /* Choose solution closest to pole. */
- sth1 = (-b + d)/a;
- sth2 = (-b - d)/a;
- sthe = (sth1 > sth2) ? sth1 : sth2;
- if (sthe > 1.0) {
- if (sthe-1.0 < tol) {
- sthe = 1.0;
- } else {
- sthe = (sth1 < sth2) ? sth1 : sth2;
- }
- }
-
- if (sthe < -1.0) {
- if (sthe+1.0 > -tol) {
- sthe = -1.0;
- }
- }
-
- if (sthe > 1.0 || sthe < -1.0) {
- return 2;
- }
-
- *theta = asindeg (sthe);
- z = 1.0 - sthe;
- }
-
- xp = -y0 + prj->p[2]*z;
- yp = x0 - prj->p[1]*z;
- if (xp == 0.0 && yp == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (yp,xp);
- }
- }
-
- return 0;
-}
-
-/*============================================================================
-* ARC: zenithal/azimuthal equidistant projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "ARC"
-* prj->flag ARC
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] (180/pi)/r0
-* prj->prjfwd Pointer to arcfwd().
-* prj->prjrev Pointer to arcrev().
-*===========================================================================*/
-
-int arcset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "ARC");
- prj->flag = ARC;
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = arcfwd;
- prj->prjrev = arcrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int arcfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double r;
-
- if (prj->flag != ARC) {
- if (arcset(prj)) return 1;
- }
-
- r = prj->w[0]*(90.0 - theta);
- *x = r*sindeg (phi);
- *y = -r*cosdeg (phi);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int arcrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double r;
-
- if (prj->flag != ARC) {
- if (arcset(prj)) return 1;
- }
-
- r = sqrt(x*x + y*y);
- if (r == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (x, -y);
- }
- *theta = 90.0 - r*prj->w[1];
-
- return 0;
-}
-
-/*============================================================================
-* ZPN: zenithal/azimuthal polynomial projection.
-*
-* Given:
-* prj->p[0:9] Polynomial coefficients.
-*
-* Given and/or returned:
-* prj->flag ZPN, or -ZPN if prj->flag is given < 0.
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "ZPN"
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->n Degree of the polynomial, N.
-* prj->w[0] Co-latitude of the first point of inflection (N > 2).
-* prj->w[1] Radius of the first point of inflection (N > 2).
-* prj->prjfwd Pointer to zpnfwd().
-* prj->prjrev Pointer to zpnrev().
-*===========================================================================*/
-
-int zpnset(prj)
-
-struct prjprm *prj;
-
-{
- int i, j, k;
- double d, d1, d2, r, zd, zd1, zd2;
- const double tol = 1.0e-13;
-
- strcpy(prj->code, "ZPN");
- prj->flag = copysgni (ZPN, prj->flag);
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- /* Find the highest non-zero coefficient. */
- for (k = 9; k >= 0 && prj->p[k] == 0.0; k--){
- i = 0; }
- /* if (k < 0) return 1; */
-
- /* if (k < 0 switch to ARC projection */
- if (k < 0) {
- return (arcset (prj));
- }
-
- prj->n = k;
-
- /* No negative derivative -> no point of inflection. */
- zd = PI;
-
- /* Processing subroutines */
- prj->prjfwd = zpnfwd;
- prj->prjrev = zpnrev;
-
- if (k >= 3) {
- /* Find the point of inflection closest to the pole. */
- zd1 = 0.0;
- d1 = prj->p[1];
- if (d1 <= 0.0) {
- return 1;
- }
-
- /* Find the point where the derivative first goes negative. */
- for (i = 0; i < 180; i++) {
- zd2 = i*D2R;
- d2 = 0.0;
- for (j = k; j > 0; j--) {
- d2 = d2*zd2 + j*prj->p[j];
- }
-
- if (d2 <= 0.0) break;
- zd1 = zd2;
- d1 = d2;
- }
-
- if (i == 180) {
- /* No negative derivative -> no point of inflection. */
- zd = PI;
- } else {
- /* Find where the derivative is zero. */
- for (i = 1; i <= 10; i++) {
- zd = zd1 - d1*(zd2-zd1)/(d2-d1);
-
- d = 0.0;
- for (j = k; j > 0; j--) {
- d = d*zd + j*prj->p[j];
- }
-
- if (fabs(d) < tol) break;
-
- if (d < 0.0) {
- zd2 = zd;
- d2 = d;
- } else {
- zd1 = zd;
- d1 = d;
- }
- }
- }
-
- r = 0.0;
- for (j = k; j >= 0; j--) {
- r = r*zd + prj->p[j];
- }
- prj->w[0] = zd;
- prj->w[1] = r;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int zpnfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- int j;
- double r, s;
-
- if (abs(prj->flag) != ZPN) {
- if (zpnset(prj)) return 1;
- }
-
- s = (90.0 - theta)*D2R;
-
- r = 0.0;
- for (j = 9; j >= 0; j--) {
- r = r*s + prj->p[j];
- }
- r = prj->r0*r;
-
- *x = r*sindeg (phi);
- *y = -r*cosdeg (phi);
-
- if (prj->flag > 0 && s > prj->w[0]) {
- return 2;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int zpnrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- int i, j, k;
- double a, b, c, d, lambda, r, r1, r2, rt, zd, zd1, zd2;
- const double tol = 1.0e-13;
-
- if (abs(prj->flag) != ZPN) {
- if (zpnset(prj)) return 1;
- }
-
- k = prj->n;
-
- r = sqrt(x*x + y*y)/prj->r0;
-
- if (k < 1) {
- /* Constant - no solution. */
- return 1;
- } else if (k == 1) {
- /* Linear. */
- zd = (r - prj->p[0])/prj->p[1];
- } else if (k == 2) {
- /* Quadratic. */
- a = prj->p[2];
- b = prj->p[1];
- c = prj->p[0] - r;
-
- d = b*b - 4.0*a*c;
- if (d < 0.0) {
- return 2;
- }
- d = sqrt(d);
-
- /* Choose solution closest to pole. */
- zd1 = (-b + d)/(2.0*a);
- zd2 = (-b - d)/(2.0*a);
- zd = (zd1<zd2) ? zd1 : zd2;
- if (zd < -tol) zd = (zd1>zd2) ? zd1 : zd2;
- if (zd < 0.0) {
- if (zd < -tol) {
- return 2;
- }
- zd = 0.0;
- } else if (zd > PI) {
- if (zd > PI+tol) {
- return 2;
- }
- zd = PI;
- }
- } else {
- /* Higher order - solve iteratively. */
- zd1 = 0.0;
- r1 = prj->p[0];
- zd2 = prj->w[0];
- r2 = prj->w[1];
-
- if (r < r1) {
- if (r < r1-tol) {
- return 2;
- }
- zd = zd1;
- } else if (r > r2) {
- if (r > r2+tol) {
- return 2;
- }
- zd = zd2;
- } else {
- /* Disect the interval. */
- for (j = 0; j < 100; j++) {
- lambda = (r2 - r)/(r2 - r1);
- if (lambda < 0.1) {
- lambda = 0.1;
- } else if (lambda > 0.9) {
- lambda = 0.9;
- }
-
- zd = zd2 - lambda*(zd2 - zd1);
-
- rt = 0.0;
- for (i = k; i >= 0; i--) {
- rt = (rt * zd) + prj->p[i];
- }
-
- if (rt < r) {
- if (r-rt < tol) break;
- r1 = rt;
- zd1 = zd;
- } else {
- if (rt-r < tol) break;
- r2 = rt;
- zd2 = zd;
- }
-
- if (fabs(zd2-zd1) < tol) break;
- }
- }
- }
-
- if (r == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (x, -y);
- }
- *theta = 90.0 - zd*R2D;
-
- return 0;
-}
-
-/*============================================================================
-* ZEA: zenithal/azimuthal equal area projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "ZEA"
-* prj->flag ZEA
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] 2*r0
-* prj->w[1] 1/(2*r0)
-* prj->prjfwd Pointer to zeafwd().
-* prj->prjrev Pointer to zearev().
-*===========================================================================*/
-
-int zeaset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "ZEA");
- prj->flag = ZEA;
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 360.0/PI;
- prj->w[1] = PI/360.0;
- } else {
- prj->w[0] = 2.0*prj->r0;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = zeafwd;
- prj->prjrev = zearev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int zeafwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double r;
-
- if (prj->flag != ZEA) {
- if (zeaset(prj)) return 1;
- }
-
- r = prj->w[0]*sindeg ((90.0 - theta)/2.0);
- *x = r*sindeg (phi);
- *y = -r*cosdeg (phi);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int zearev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double r, s;
- const double tol = 1.0e-12;
-
- if (prj->flag != ZEA) {
- if (zeaset(prj)) return 1;
- }
-
- r = sqrt(x*x + y*y);
- if (r == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (x, -y);
- }
-
- s = r*prj->w[1];
- if (fabs(s) > 1.0) {
- if (fabs(r - prj->w[0]) < tol) {
- *theta = -90.0;
- } else {
- return 2;
- }
- } else {
- *theta = 90.0 - 2.0*asindeg (s);
- }
-
- return 0;
-}
-
-/*============================================================================
-* AIR: Airy's projection.
-*
-* Given:
-* prj->p[1] Latitude theta_b within which the error is minimized, in
-* degrees.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "AIR"
-* prj->flag AIR
-* prj->phi0 0.0
-* prj->theta0 90.0
-* prj->w[0] 2*r0
-* prj->w[1] ln(cos(xi_b))/tan(xi_b)**2, where xi_b = (90-theta_b)/2
-* prj->w[2] 1/2 - prj->w[1]
-* prj->w[3] 2*r0*prj->w[2]
-* prj->w[4] tol, cutoff for using small angle approximation, in
-* radians.
-* prj->w[5] prj->w[2]*tol
-* prj->w[6] (180/pi)/prj->w[2]
-* prj->prjfwd Pointer to airfwd().
-* prj->prjrev Pointer to airrev().
-*===========================================================================*/
-
-int airset(prj)
-
-struct prjprm *prj;
-
-{
- const double tol = 1.0e-4;
- double cxi;
-
- strcpy(prj->code, "AIR");
- prj->flag = AIR;
- prj->phi0 = 0.0;
- prj->theta0 = 90.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = 2.0*prj->r0;
- if (prj->p[1] == 90.0) {
- prj->w[1] = -0.5;
- prj->w[2] = 1.0;
- } else if (prj->p[1] > -90.0) {
- cxi = cosdeg ((90.0 - prj->p[1])/2.0);
- prj->w[1] = log(cxi)*(cxi*cxi)/(1.0-cxi*cxi);
- prj->w[2] = 0.5 - prj->w[1];
- } else {
- return 1;
- }
-
- prj->w[3] = prj->w[0] * prj->w[2];
- prj->w[4] = tol;
- prj->w[5] = prj->w[2]*tol;
- prj->w[6] = R2D/prj->w[2];
-
- prj->prjfwd = airfwd;
- prj->prjrev = airrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int airfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double cxi, r, txi, xi;
-
- if (prj->flag != AIR) {
- if (airset(prj)) return 1;
- }
-
- if (theta == 90.0) {
- r = 0.0;
- } else if (theta > -90.0) {
- xi = D2R*(90.0 - theta)/2.0;
- if (xi < prj->w[4]) {
- r = xi*prj->w[3];
- } else {
- cxi = cosdeg ((90.0 - theta)/2.0);
- txi = sqrt(1.0-cxi*cxi)/cxi;
- r = -prj->w[0]*(log(cxi)/txi + prj->w[1]*txi);
- }
- } else {
- return 2;
- }
-
- *x = r*sindeg (phi);
- *y = -r*cosdeg (phi);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int airrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- int j;
- double cxi, lambda, r, r1, r2, rt, txi, x1, x2, xi;
- const double tol = 1.0e-12;
-
- if (prj->flag != AIR) {
- if (airset(prj)) return 1;
- }
-
- r = sqrt(x*x + y*y)/prj->w[0];
-
- if (r == 0.0) {
- xi = 0.0;
- } else if (r < prj->w[5]) {
- xi = r*prj->w[6];
- } else {
- /* Find a solution interval. */
- x1 = 1.0;
- r1 = 0.0;
- for (j = 0; j < 30; j++) {
- x2 = x1/2.0;
- txi = sqrt(1.0-x2*x2)/x2;
- r2 = -(log(x2)/txi + prj->w[1]*txi);
-
- if (r2 >= r) break;
- x1 = x2;
- r1 = r2;
- }
- if (j == 30) return 2;
-
- for (j = 0; j < 100; j++) {
- /* Weighted division of the interval. */
- lambda = (r2-r)/(r2-r1);
- if (lambda < 0.1) {
- lambda = 0.1;
- } else if (lambda > 0.9) {
- lambda = 0.9;
- }
- cxi = x2 - lambda*(x2-x1);
-
- txi = sqrt(1.0-cxi*cxi)/cxi;
- rt = -(log(cxi)/txi + prj->w[1]*txi);
-
- if (rt < r) {
- if (r-rt < tol) break;
- r1 = rt;
- x1 = cxi;
- } else {
- if (rt-r < tol) break;
- r2 = rt;
- x2 = cxi;
- }
- }
- if (j == 100) return 2;
-
- xi = acosdeg (cxi);
- }
-
- if (r == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (x, -y);
- }
- *theta = 90.0 - 2.0*xi;
-
- return 0;
-}
-
-/*============================================================================
-* CYP: cylindrical perspective projection.
-*
-* Given:
-* prj->p[1] Distance of point of projection from the centre of the
-* generating sphere, mu, in units of r0.
-* prj->p[2] Radius of the cylinder of projection, lambda, in units of
-* r0.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "CYP"
-* prj->flag CYP
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*lambda*(pi/180)
-* prj->w[1] (180/pi)/(r0*lambda)
-* prj->w[2] r0*(mu + lambda)
-* prj->w[3] 1/(r0*(mu + lambda))
-* prj->prjfwd Pointer to cypfwd().
-* prj->prjrev Pointer to cyprev().
-*===========================================================================*/
-
-int cypset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "CYP");
- prj->flag = CYP;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
-
- prj->w[0] = prj->p[2];
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[1] = 1.0/prj->w[0];
-
- prj->w[2] = R2D*(prj->p[1] + prj->p[2]);
- if (prj->w[2] == 0.0) {
- return 1;
- }
-
- prj->w[3] = 1.0/prj->w[2];
- } else {
- prj->w[0] = prj->r0*prj->p[2]*D2R;
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[1] = 1.0/prj->w[0];
-
- prj->w[2] = prj->r0*(prj->p[1] + prj->p[2]);
- if (prj->w[2] == 0.0) {
- return 1;
- }
-
- prj->w[3] = 1.0/prj->w[2];
- }
-
- prj->prjfwd = cypfwd;
- prj->prjrev = cyprev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int cypfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double s;
-
- if (prj->flag != CYP) {
- if (cypset(prj)) return 1;
- }
-
- s = prj->p[1] + cosdeg (theta);
- if (s == 0.0) {
- return 2;
- }
-
- *x = prj->w[0]*phi;
- *y = prj->w[2]*sindeg (theta)/s;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int cyprev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double eta;
-
- if (prj->flag != CYP) {
- if (cypset(prj)) return 1;
- }
-
- *phi = x*prj->w[1];
- eta = y*prj->w[3];
- *theta = atan2deg (eta,1.0) + asindeg (eta*prj->p[1]/sqrt(eta*eta+1.0));
-
- return 0;
-}
-
-/*============================================================================
-* CEA: cylindrical equal area projection.
-*
-* Given:
-* prj->p[1] Square of the cosine of the latitude at which the
-* projection is conformal, lambda.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "CEA"
-* prj->flag CEA
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] (180/pi)/r0
-* prj->w[2] r0/lambda
-* prj->w[3] lambda/r0
-* prj->prjfwd Pointer to ceafwd().
-* prj->prjrev Pointer to cearev().
-*===========================================================================*/
-
-int ceaset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "CEA");
- prj->flag = CEA;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- if (prj->p[1] <= 0.0 || prj->p[1] > 1.0) {
- return 1;
- }
- prj->w[2] = prj->r0/prj->p[1];
- prj->w[3] = prj->p[1]/prj->r0;
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = R2D/prj->r0;
- if (prj->p[1] <= 0.0 || prj->p[1] > 1.0) {
- return 1;
- }
- prj->w[2] = prj->r0/prj->p[1];
- prj->w[3] = prj->p[1]/prj->r0;
- }
-
- prj->prjfwd = ceafwd;
- prj->prjrev = cearev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int ceafwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- if (prj->flag != CEA) {
- if (ceaset(prj)) return 1;
- }
-
- *x = prj->w[0]*phi;
- *y = prj->w[2]*sindeg (theta);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int cearev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double s;
- const double tol = 1.0e-13;
-
- if (prj->flag != CEA) {
- if (ceaset(prj)) return 1;
- }
-
- s = y*prj->w[3];
- if (fabs(s) > 1.0) {
- if (fabs(s) > 1.0+tol) {
- return 2;
- }
- s = copysgn (1.0,s);
- }
-
- *phi = x*prj->w[1];
- *theta = asindeg (s);
-
- return 0;
-}
-
-/*============================================================================
-* CAR: Cartesian projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "CAR"
-* prj->flag CAR
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] (180/pi)/r0
-* prj->prjfwd Pointer to carfwd().
-* prj->prjrev Pointer to carrev().
-*===========================================================================*/
-
-int carset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "CAR");
- prj->flag = CAR;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = carfwd;
- prj->prjrev = carrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int carfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- if (prj->flag != CAR) {
- if (carset(prj)) return 1;
- }
-
- *x = prj->w[0]*phi;
- *y = prj->w[0]*theta;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int carrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- if (prj->flag != CAR) {
- if (carset(prj)) return 1;
- }
-
- *phi = prj->w[1]*x;
- *theta = prj->w[1]*y;
-
- return 0;
-}
-
-/*============================================================================
-* MER: Mercator's projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "MER"
-* prj->flag MER
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] (180/pi)/r0
-* prj->prjfwd Pointer to merfwd().
-* prj->prjrev Pointer to merrev().
-*===========================================================================*/
-
-int merset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "MER");
- prj->flag = MER;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = merfwd;
- prj->prjrev = merrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int merfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- if (prj->flag != MER) {
- if (merset(prj)) return 1;
- }
-
- if (theta <= -90.0 || theta >= 90.0) {
- return 2;
- }
-
- *x = prj->w[0]*phi;
- *y = prj->r0*log(tandeg ((90.0+theta)/2.0));
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int merrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- if (prj->flag != MER) {
- if (merset(prj)) return 1;
- }
-
- *phi = x*prj->w[1];
- *theta = 2.0*atandeg (exp(y/prj->r0)) - 90.0;
-
- return 0;
-}
-
-/*============================================================================
-* SFL: Sanson-Flamsteed ("global sinusoid") projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "SFL"
-* prj->flag SFL
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] (180/pi)/r0
-* prj->prjfwd Pointer to sflfwd().
-* prj->prjrev Pointer to sflrev().
-*===========================================================================*/
-
-int sflset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "SFL");
- prj->flag = SFL;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = sflfwd;
- prj->prjrev = sflrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int sflfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- if (prj->flag != SFL) {
- if (sflset(prj)) return 1;
- }
-
- *x = prj->w[0]*phi*cosdeg (theta);
- *y = prj->w[0]*theta;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int sflrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double w;
-
- if (prj->flag != SFL) {
- if (sflset(prj)) return 1;
- }
-
- w = cos(y/prj->r0);
- if (w == 0.0) {
- *phi = 0.0;
- } else {
- *phi = x*prj->w[1]/cos(y/prj->r0);
- }
- *theta = y*prj->w[1];
-
- return 0;
-}
-
-/*============================================================================
-* PAR: parabolic projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "PAR"
-* prj->flag PAR
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] (180/pi)/r0
-* prj->w[2] pi*r0
-* prj->w[3] 1/(pi*r0)
-* prj->prjfwd Pointer to parfwd().
-* prj->prjrev Pointer to parrev().
-*===========================================================================*/
-
-int parset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "PAR");
- prj->flag = PAR;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- prj->w[2] = 180.0;
- prj->w[3] = 1.0/prj->w[2];
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = 1.0/prj->w[0];
- prj->w[2] = PI*prj->r0;
- prj->w[3] = 1.0/prj->w[2];
- }
-
- prj->prjfwd = parfwd;
- prj->prjrev = parrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int parfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double s;
-
- if (prj->flag != PAR) {
- if (parset(prj)) return 1;
- }
-
- s = sindeg (theta/3.0);
- *x = prj->w[0]*phi*(1.0 - 4.0*s*s);
- *y = prj->w[2]*s;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int parrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double s, t;
-
- if (prj->flag != PAR) {
- if (parset(prj)) return 1;
- }
-
- s = y*prj->w[3];
- if (s > 1.0 || s < -1.0) {
- return 2;
- }
-
- t = 1.0 - 4.0*s*s;
- if (t == 0.0) {
- if (x == 0.0) {
- *phi = 0.0;
- } else {
- return 2;
- }
- } else {
- *phi = prj->w[1]*x/t;
- }
-
- *theta = 3.0*asindeg (s);
-
- return 0;
-}
-
-/*============================================================================
-* MOL: Mollweide's projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "MOL"
-* prj->flag MOL
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] sqrt(2)*r0
-* prj->w[1] sqrt(2)*r0/90
-* prj->w[2] 1/(sqrt(2)*r0)
-* prj->w[3] 90/r0
-* prj->prjfwd Pointer to molfwd().
-* prj->prjrev Pointer to molrev().
-*===========================================================================*/
-
-int molset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "MOL");
- prj->flag = MOL;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = SQRT2*prj->r0;
- prj->w[1] = prj->w[0]/90.0;
- prj->w[2] = 1.0/prj->w[0];
- prj->w[3] = 90.0/prj->r0;
- prj->w[4] = 2.0/PI;
-
- prj->prjfwd = molfwd;
- prj->prjrev = molrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int molfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- int j;
- double gamma, resid, u, v, v0, v1;
- const double tol = 1.0e-13;
-
- if (prj->flag != MOL) {
- if (molset(prj)) return 1;
- }
-
- if (fabs(theta) == 90.0) {
- *x = 0.0;
- *y = copysgn (prj->w[0],theta);
- } else if (theta == 0.0) {
- *x = prj->w[1]*phi;
- *y = 0.0;
- } else {
- u = PI*sindeg (theta);
- v0 = -PI;
- v1 = PI;
- v = u;
- for (j = 0; j < 100; j++) {
- resid = (v - u) + sin(v);
- if (resid < 0.0) {
- if (resid > -tol) break;
- v0 = v;
- } else {
- if (resid < tol) break;
- v1 = v;
- }
- v = (v0 + v1)/2.0;
- }
-
- gamma = v/2.0;
- *x = prj->w[1]*phi*cos(gamma);
- *y = prj->w[0]*sin(gamma);
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int molrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double s, y0, z;
- const double tol = 1.0e-12;
-
- if (prj->flag != MOL) {
- if (molset(prj)) return 1;
- }
-
- y0 = y/prj->r0;
- s = 2.0 - y0*y0;
- if (s <= tol) {
- if (s < -tol) {
- return 2;
- }
- s = 0.0;
-
- if (fabs(x) > tol) {
- return 2;
- }
- *phi = 0.0;
- } else {
- s = sqrt(s);
- *phi = prj->w[3]*x/s;
- }
-
- z = y*prj->w[2];
- if (fabs(z) > 1.0) {
- if (fabs(z) > 1.0+tol) {
- return 2;
- }
- z = copysgn (1.0,z) + y0*s/PI;
- } else {
- z = asin(z)*prj->w[4] + y0*s/PI;
- }
-
- if (fabs(z) > 1.0) {
- if (fabs(z) > 1.0+tol) {
- return 2;
- }
- z = copysgn (1.0,z);
- }
-
- *theta = asindeg (z);
-
- return 0;
-}
-
-/*============================================================================
-* AIT: Hammer-Aitoff projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "AIT"
-* prj->flag AIT
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] 2*r0**2
-* prj->w[1] 1/(2*r0)**2
-* prj->w[2] 1/(4*r0)**2
-* prj->w[3] 1/(2*r0)
-* prj->prjfwd Pointer to aitfwd().
-* prj->prjrev Pointer to aitrev().
-*===========================================================================*/
-
-int aitset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "AIT");
- prj->flag = AIT;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = 2.0*prj->r0*prj->r0;
- prj->w[1] = 1.0/(2.0*prj->w[0]);
- prj->w[2] = prj->w[1]/4.0;
- prj->w[3] = 1.0/(2.0*prj->r0);
-
- prj->prjfwd = aitfwd;
- prj->prjrev = aitrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int aitfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double cthe, w;
-
- if (prj->flag != AIT) {
- if (aitset(prj)) return 1;
- }
-
- cthe = cosdeg (theta);
- w = sqrt(prj->w[0]/(1.0 + cthe*cosdeg (phi/2.0)));
- *x = 2.0*w*cthe*sindeg (phi/2.0);
- *y = w*sindeg (theta);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int aitrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double s, u, xp, yp, z;
- const double tol = 1.0e-13;
-
- if (prj->flag != AIT) {
- if (aitset(prj)) return 1;
- }
-
- u = 1.0 - x*x*prj->w[2] - y*y*prj->w[1];
- if (u < 0.0) {
- if (u < -tol) {
- return 2;
- }
-
- u = 0.0;
- }
-
- z = sqrt(u);
- s = z*y/prj->r0;
- if (fabs(s) > 1.0) {
- if (fabs(s) > 1.0+tol) {
- return 2;
- }
- s = copysgn (1.0,s);
- }
-
- xp = 2.0*z*z - 1.0;
- yp = z*x*prj->w[3];
- if (xp == 0.0 && yp == 0.0) {
- *phi = 0.0;
- } else {
- *phi = 2.0*atan2deg (yp, xp);
- }
- *theta = asindeg (s);
-
- return 0;
-}
-
-/*============================================================================
-* COP: conic perspective projection.
-*
-* Given:
-* prj->p[1] sigma = (theta2+theta1)/2
-* prj->p[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the
-* latitudes of the standard parallels, in degrees.
-*
-* Given and/or returned:
-* prj->flag COP, or -COP if prj->flag is given < 0.
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "COP"
-* prj->phi0 0.0
-* prj->theta0 sigma
-* prj->w[0] C = sin(sigma)
-* prj->w[1] 1/C
-* prj->w[2] Y0 = r0*cos(delta)*cot(sigma)
-* prj->w[3] r0*cos(delta)
-* prj->w[4] 1/(r0*cos(delta)
-* prj->w[5] cot(sigma)
-* prj->prjfwd Pointer to copfwd().
-* prj->prjrev Pointer to coprev().
-*===========================================================================*/
-
-int copset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "COP");
- prj->flag = copysgni (COP, prj->flag);
- prj->phi0 = 0.0;
- prj->theta0 = prj->p[1];
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- prj->w[0] = sindeg (prj->p[1]);
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[1] = 1.0/prj->w[0];
-
- prj->w[3] = prj->r0*cosdeg (prj->p[2]);
- if (prj->w[3] == 0.0) {
- return 1;
- }
-
- prj->w[4] = 1.0/prj->w[3];
- prj->w[5] = 1.0/tandeg (prj->p[1]);
-
- prj->w[2] = prj->w[3]*prj->w[5];
-
- prj->prjfwd = copfwd;
- prj->prjrev = coprev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int copfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, r, s, t;
-
- if (abs(prj->flag) != COP) {
- if (copset(prj)) return 1;
- }
-
- t = theta - prj->p[1];
- s = cosdeg (t);
- if (s == 0.0) {
- return 2;
- }
-
- a = prj->w[0]*phi;
- r = prj->w[2] - prj->w[3]*sindeg (t)/s;
-
- *x = r*sindeg (a);
- *y = prj->w[2] - r*cosdeg (a);
-
- if (prj->flag > 0 && r*prj->w[0] < 0.0) {
- return 2;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int coprev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, dy, r;
-
- if (abs(prj->flag) != COP) {
- if (copset(prj)) return 1;
- }
-
- dy = prj->w[2] - y;
- r = sqrt(x*x + dy*dy);
- if (prj->p[1] < 0.0) r = -r;
-
- if (r == 0.0) {
- a = 0.0;
- } else {
- a = atan2deg (x/r, dy/r);
- }
-
- *phi = a*prj->w[1];
- *theta = prj->p[1] + atandeg (prj->w[5] - r*prj->w[4]);
-
- return 0;
-}
-
-/*============================================================================
-* COE: conic equal area projection.
-*
-* Given:
-* prj->p[1] sigma = (theta2+theta1)/2
-* prj->p[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the
-* latitudes of the standard parallels, in degrees.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "COE"
-* prj->flag COE
-* prj->phi0 0.0
-* prj->theta0 sigma
-* prj->w[0] C = (sin(theta1) + sin(theta2))/2
-* prj->w[1] 1/C
-* prj->w[2] Y0 = chi*sqrt(psi - 2C*sindeg (sigma))
-* prj->w[3] chi = r0/C
-* prj->w[4] psi = 1 + sin(theta1)*sin(theta2)
-* prj->w[5] 2C
-* prj->w[6] (1 + sin(theta1)*sin(theta2))*(r0/C)**2
-* prj->w[7] C/(2*r0**2)
-* prj->w[8] chi*sqrt(psi + 2C)
-* prj->prjfwd Pointer to coefwd().
-* prj->prjrev Pointer to coerev().
-*===========================================================================*/
-
-int coeset(prj)
-
-struct prjprm *prj;
-
-{
- double theta1, theta2;
-
- strcpy(prj->code, "COE");
- prj->flag = COE;
- prj->phi0 = 0.0;
- prj->theta0 = prj->p[1];
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- theta1 = prj->p[1] - prj->p[2];
- theta2 = prj->p[1] + prj->p[2];
-
- prj->w[0] = (sindeg (theta1) + sindeg (theta2))/2.0;
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[1] = 1.0/prj->w[0];
-
- prj->w[3] = prj->r0/prj->w[0];
- prj->w[4] = 1.0 + sindeg (theta1)*sindeg (theta2);
- prj->w[5] = 2.0*prj->w[0];
- prj->w[6] = prj->w[3]*prj->w[3]*prj->w[4];
- prj->w[7] = 1.0/(2.0*prj->r0*prj->w[3]);
- prj->w[8] = prj->w[3]*sqrt(prj->w[4] + prj->w[5]);
-
- prj->w[2] = prj->w[3]*sqrt(prj->w[4] - prj->w[5]*sindeg (prj->p[1]));
-
- prj->prjfwd = coefwd;
- prj->prjrev = coerev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int coefwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, r;
-
- if (prj->flag != COE) {
- if (coeset(prj)) return 1;
- }
-
- a = phi*prj->w[0];
- if (theta == -90.0) {
- r = prj->w[8];
- } else {
- r = prj->w[3]*sqrt(prj->w[4] - prj->w[5]*sindeg (theta));
- }
-
- *x = r*sindeg (a);
- *y = prj->w[2] - r*cosdeg (a);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int coerev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, dy, r, w;
- const double tol = 1.0e-12;
-
- if (prj->flag != COE) {
- if (coeset(prj)) return 1;
- }
-
- dy = prj->w[2] - y;
- r = sqrt(x*x + dy*dy);
- if (prj->p[1] < 0.0) r = -r;
-
- if (r == 0.0) {
- a = 0.0;
- } else {
- a = atan2deg (x/r, dy/r);
- }
-
- *phi = a*prj->w[1];
- if (fabs(r - prj->w[8]) < tol) {
- *theta = -90.0;
- } else {
- w = (prj->w[6] - r*r)*prj->w[7];
- if (fabs(w) > 1.0) {
- if (fabs(w-1.0) < tol) {
- *theta = 90.0;
- } else if (fabs(w+1.0) < tol) {
- *theta = -90.0;
- } else {
- return 2;
- }
- } else {
- *theta = asindeg (w);
- }
- }
-
- return 0;
-}
-
-/*============================================================================
-* COD: conic equidistant projection.
-*
-* Given:
-* prj->p[1] sigma = (theta2+theta1)/2
-* prj->p[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the
-* latitudes of the standard parallels, in degrees.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "COD"
-* prj->flag COD
-* prj->phi0 0.0
-* prj->theta0 sigma
-* prj->w[0] C = r0*sin(sigma)*sin(delta)/delta
-* prj->w[1] 1/C
-* prj->w[2] Y0 = delta*cot(delta)*cot(sigma)
-* prj->w[3] Y0 + sigma
-* prj->prjfwd Pointer to codfwd().
-* prj->prjrev Pointer to codrev().
-*===========================================================================*/
-
-int codset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "COD");
- prj->flag = COD;
- prj->phi0 = 0.0;
- prj->theta0 = prj->p[1];
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- if (prj->p[2] == 0.0) {
- prj->w[0] = prj->r0*sindeg (prj->p[1])*D2R;
- } else {
- prj->w[0] = prj->r0*sindeg (prj->p[1])*sindeg (prj->p[2])/prj->p[2];
- }
-
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[1] = 1.0/prj->w[0];
- prj->w[2] = prj->r0*cosdeg (prj->p[2])*cosdeg (prj->p[1])/prj->w[0];
- prj->w[3] = prj->w[2] + prj->p[1];
-
- prj->prjfwd = codfwd;
- prj->prjrev = codrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int codfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, r;
-
- if (prj->flag != COD) {
- if (codset(prj)) return 1;
- }
-
- a = prj->w[0]*phi;
- r = prj->w[3] - theta;
-
- *x = r*sindeg (a);
- *y = prj->w[2] - r*cosdeg (a);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int codrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, dy, r;
-
- if (prj->flag != COD) {
- if (codset(prj)) return 1;
- }
-
- dy = prj->w[2] - y;
- r = sqrt(x*x + dy*dy);
- if (prj->p[1] < 0.0) r = -r;
-
- if (r == 0.0) {
- a = 0.0;
- } else {
- a = atan2deg (x/r, dy/r);
- }
-
- *phi = a*prj->w[1];
- *theta = prj->w[3] - r;
-
- return 0;
-}
-
-/*============================================================================
-* COO: conic orthomorphic projection.
-*
-* Given:
-* prj->p[1] sigma = (theta2+theta1)/2
-* prj->p[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the
-* latitudes of the standard parallels, in degrees.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "COO"
-* prj->flag COO
-* prj->phi0 0.0
-* prj->theta0 sigma
-* prj->w[0] C = ln(cos(theta2)/cos(theta1))/ln(tan(tau2)/tan(tau1))
-* where tau1 = (90 - theta1)/2
-* tau2 = (90 - theta2)/2
-* prj->w[1] 1/C
-* prj->w[2] Y0 = psi*tan((90-sigma)/2)**C
-* prj->w[3] psi = (r0*cos(theta1)/C)/tan(tau1)**C
-* prj->w[4] 1/psi
-* prj->prjfwd Pointer to coofwd().
-* prj->prjrev Pointer to coorev().
-*===========================================================================*/
-
-int cooset(prj)
-
-struct prjprm *prj;
-
-{
- double cos1, cos2, tan1, tan2, theta1, theta2;
-
- strcpy(prj->code, "COO");
- prj->flag = COO;
- prj->phi0 = 0.0;
- prj->theta0 = prj->p[1];
-
- if (prj->r0 == 0.0) prj->r0 = R2D;
-
- theta1 = prj->p[1] - prj->p[2];
- theta2 = prj->p[1] + prj->p[2];
-
- tan1 = tandeg ((90.0 - theta1)/2.0);
- cos1 = cosdeg (theta1);
-
- if (theta1 == theta2) {
- prj->w[0] = sindeg (theta1);
- } else {
- tan2 = tandeg ((90.0 - theta2)/2.0);
- cos2 = cosdeg (theta2);
- prj->w[0] = log(cos2/cos1)/log(tan2/tan1);
- }
- if (prj->w[0] == 0.0) {
- return 1;
- }
-
- prj->w[1] = 1.0/prj->w[0];
-
- prj->w[3] = prj->r0*(cos1/prj->w[0])/pow(tan1,prj->w[0]);
- if (prj->w[3] == 0.0) {
- return 1;
- }
- prj->w[2] = prj->w[3]*pow(tandeg ((90.0 - prj->p[1])/2.0),prj->w[0]);
- prj->w[4] = 1.0/prj->w[3];
-
- prj->prjfwd = coofwd;
- prj->prjrev = coorev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int coofwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, r;
-
- if (prj->flag != COO) {
- if (cooset(prj)) return 1;
- }
-
- a = prj->w[0]*phi;
- if (theta == -90.0) {
- if (prj->w[0] < 0.0) {
- r = 0.0;
- } else {
- return 2;
- }
- } else {
- r = prj->w[3]*pow(tandeg ((90.0 - theta)/2.0),prj->w[0]);
- }
-
- *x = r*sindeg (a);
- *y = prj->w[2] - r*cosdeg (a);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int coorev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, dy, r;
-
- if (prj->flag != COO) {
- if (cooset(prj)) return 1;
- }
-
- dy = prj->w[2] - y;
- r = sqrt(x*x + dy*dy);
- if (prj->p[1] < 0.0) r = -r;
-
- if (r == 0.0) {
- a = 0.0;
- } else {
- a = atan2deg (x/r, dy/r);
- }
-
- *phi = a*prj->w[1];
- if (r == 0.0) {
- if (prj->w[0] < 0.0) {
- *theta = -90.0;
- } else {
- return 2;
- }
- } else {
- *theta = 90.0 - 2.0*atandeg (pow(r*prj->w[4],prj->w[1]));
- }
-
- return 0;
-}
-
-/*============================================================================
-* BON: Bonne's projection.
-*
-* Given:
-* prj->p[1] Bonne conformal latitude, theta1, in degrees.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "BON"
-* prj->flag BON
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[1] r0*pi/180
-* prj->w[2] Y0 = r0*(cot(theta1) + theta1*pi/180)
-* prj->prjfwd Pointer to bonfwd().
-* prj->prjrev Pointer to bonrev().
-*===========================================================================*/
-
-int bonset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "BON");
- prj->flag = BON;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[1] = 1.0;
- prj->w[2] = prj->r0*cosdeg (prj->p[1])/sindeg (prj->p[1]) + prj->p[1];
- } else {
- prj->w[1] = prj->r0*D2R;
- prj->w[2] = prj->r0*(cosdeg (prj->p[1])/sindeg (prj->p[1]) + prj->p[1]*D2R);
- }
-
- prj->prjfwd = bonfwd;
- prj->prjrev = bonrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int bonfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, r;
-
- if (prj->p[1] == 0.0) {
- /* Sanson-Flamsteed. */
- return sflfwd(phi, theta, prj, x, y);
- }
-
- if (prj->flag != BON) {
- if (bonset(prj)) return 1;
- }
-
- r = prj->w[2] - theta*prj->w[1];
- a = prj->r0*phi*cosdeg (theta)/r;
-
- *x = r*sindeg (a);
- *y = prj->w[2] - r*cosdeg (a);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int bonrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double a, cthe, dy, r;
-
- if (prj->p[1] == 0.0) {
- /* Sanson-Flamsteed. */
- return sflrev(x, y, prj, phi, theta);
- }
-
- if (prj->flag != BON) {
- if (bonset(prj)) return 1;
- }
-
- dy = prj->w[2] - y;
- r = sqrt(x*x + dy*dy);
- if (prj->p[1] < 0.0) r = -r;
-
- if (r == 0.0) {
- a = 0.0;
- } else {
- a = atan2deg (x/r, dy/r);
- }
-
- *theta = (prj->w[2] - r)/prj->w[1];
- cthe = cosdeg (*theta);
- if (cthe == 0.0) {
- *phi = 0.0;
- } else {
- *phi = a*(r/prj->r0)/cthe;
- }
-
- return 0;
-}
-
-/*============================================================================
-* PCO: polyconic projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "PCO"
-* prj->flag PCO
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/180)
-* prj->w[1] 1/r0
-* prj->w[2] 2*r0
-* prj->prjfwd Pointer to pcofwd().
-* prj->prjrev Pointer to pcorev().
-*===========================================================================*/
-
-int pcoset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "PCO");
- prj->flag = PCO;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 1.0;
- prj->w[1] = 1.0;
- prj->w[2] = 360.0/PI;
- } else {
- prj->w[0] = prj->r0*D2R;
- prj->w[1] = 1.0/prj->w[0];
- prj->w[2] = 2.0*prj->r0;
- }
-
- prj->prjfwd = pcofwd;
- prj->prjrev = pcorev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int pcofwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- double a, cthe, cotthe, sthe;
-
- if (prj->flag != PCO) {
- if (pcoset(prj)) return 1;
- }
-
- cthe = cosdeg (theta);
- sthe = sindeg (theta);
- a = phi*sthe;
-
- if (sthe == 0.0) {
- *x = prj->w[0]*phi;
- *y = 0.0;
- } else {
- cotthe = cthe/sthe;
- *x = prj->r0*cotthe*sindeg (a);
- *y = prj->r0*(cotthe*(1.0 - cosdeg (a)) + theta*D2R);
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int pcorev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- int j;
- double f, fneg, fpos, lambda, tanthe, theneg, thepos, w, xp, xx, ymthe, yp;
- const double tol = 1.0e-12;
-
- if (prj->flag != PCO) {
- if (pcoset(prj)) return 1;
- }
-
- w = fabs(y*prj->w[1]);
- if (w < tol) {
- *phi = x*prj->w[1];
- *theta = 0.0;
- } else if (fabs(w-90.0) < tol) {
- *phi = 0.0;
- *theta = copysgn (90.0,y);
- } else {
- /* Iterative solution using weighted division of the interval. */
- if (y > 0.0) {
- thepos = 90.0;
- } else {
- thepos = -90.0;
- }
- theneg = 0.0;
-
- xx = x*x;
- ymthe = y - prj->w[0]*thepos;
- fpos = xx + ymthe*ymthe;
- fneg = -999.0;
-
- for (j = 0; j < 64; j++) {
- if (fneg < -100.0) {
- /* Equal division of the interval. */
- *theta = (thepos+theneg)/2.0;
- } else {
- /* Weighted division of the interval. */
- lambda = fpos/(fpos-fneg);
- if (lambda < 0.1) {
- lambda = 0.1;
- } else if (lambda > 0.9) {
- lambda = 0.9;
- }
- *theta = thepos - lambda*(thepos-theneg);
- }
-
- /* Compute the residue. */
- ymthe = y - prj->w[0]*(*theta);
- tanthe = tandeg (*theta);
- f = xx + ymthe*(ymthe - prj->w[2]/tanthe);
-
- /* Check for convergence. */
- if (fabs(f) < tol) break;
- if (fabs(thepos-theneg) < tol) break;
-
- /* Redefine the interval. */
- if (f > 0.0) {
- thepos = *theta;
- fpos = f;
- } else {
- theneg = *theta;
- fneg = f;
- }
- }
-
- xp = prj->r0 - ymthe*tanthe;
- yp = x*tanthe;
- if (xp == 0.0 && yp == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (yp, xp)/sindeg (*theta);
- }
- }
-
- return 0;
-}
-
-/*============================================================================
-* TSC: tangential spherical cube projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "TSC"
-* prj->flag TSC
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/4)
-* prj->w[1] (4/pi)/r0
-* prj->prjfwd Pointer to tscfwd().
-* prj->prjrev Pointer to tscrev().
-*===========================================================================*/
-
-int tscset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "TSC");
- prj->flag = TSC;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 45.0;
- prj->w[1] = 1.0/45.0;
- } else {
- prj->w[0] = prj->r0*PI/4.0;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = tscfwd;
- prj->prjrev = tscrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int tscfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- int face;
- double cthe, l, m, n, rho;
- double x0 = 0.0;
- double y0 = 0.0;
- double xf = 0.0;
- double yf = 0.0;
- const double tol = 1.0e-12;
-
- if (prj->flag != TSC) {
- if (tscset(prj)) return 1;
- }
-
- cthe = cosdeg (theta);
- l = cthe*cosdeg (phi);
- m = cthe*sindeg (phi);
- n = sindeg (theta);
-
- face = 0;
- rho = n;
- if (l > rho) {
- face = 1;
- rho = l;
- }
- if (m > rho) {
- face = 2;
- rho = m;
- }
- if (-l > rho) {
- face = 3;
- rho = -l;
- }
- if (-m > rho) {
- face = 4;
- rho = -m;
- }
- if (-n > rho) {
- face = 5;
- rho = -n;
- }
-
- if (face == 0) {
- xf = m/rho;
- yf = -l/rho;
- x0 = 0.0;
- y0 = 2.0;
- } else if (face == 1) {
- xf = m/rho;
- yf = n/rho;
- x0 = 0.0;
- y0 = 0.0;
- } else if (face == 2) {
- xf = -l/rho;
- yf = n/rho;
- x0 = 2.0;
- y0 = 0.0;
- } else if (face == 3) {
- xf = -m/rho;
- yf = n/rho;
- x0 = 4.0;
- y0 = 0.0;
- } else if (face == 4) {
- xf = l/rho;
- yf = n/rho;
- x0 = 6.0;
- y0 = 0.0;
- } else if (face == 5) {
- xf = m/rho;
- yf = l/rho;
- x0 = 0.0;
- y0 = -2.0;
- }
-
- if (fabs(xf) > 1.0) {
- if (fabs(xf) > 1.0+tol) {
- return 2;
- }
- xf = copysgn (1.0,xf);
- }
- if (fabs(yf) > 1.0) {
- if (fabs(yf) > 1.0+tol) {
- return 2;
- }
- yf = copysgn (1.0,yf);
- }
-
- *x = prj->w[0]*(xf + x0);
- *y = prj->w[0]*(yf + y0);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int tscrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- double l, m, n, xf, yf;
-
- if (prj->flag != TSC) {
- if (tscset(prj)) return 1;
- }
-
- xf = x*prj->w[1];
- yf = y*prj->w[1];
-
- /* Check bounds. */
- if (fabs(xf) <= 1.0) {
- if (fabs(yf) > 3.0) return 2;
- } else {
- if (fabs(xf) > 7.0) return 2;
- if (fabs(yf) > 1.0) return 2;
- }
-
- /* Map negative faces to the other side. */
- if (xf < -1.0) xf += 8.0;
-
- /* Determine the face. */
- if (xf > 5.0) {
- /* face = 4 */
- xf = xf - 6.0;
- m = -1.0/sqrt(1.0 + xf*xf + yf*yf);
- l = -m*xf;
- n = -m*yf;
- } else if (xf > 3.0) {
- /* face = 3 */
- xf = xf - 4.0;
- l = -1.0/sqrt(1.0 + xf*xf + yf*yf);
- m = l*xf;
- n = -l*yf;
- } else if (xf > 1.0) {
- /* face = 2 */
- xf = xf - 2.0;
- m = 1.0/sqrt(1.0 + xf*xf + yf*yf);
- l = -m*xf;
- n = m*yf;
- } else if (yf > 1.0) {
- /* face = 0 */
- yf = yf - 2.0;
- n = 1.0/sqrt(1.0 + xf*xf + yf*yf);
- l = -n*yf;
- m = n*xf;
- } else if (yf < -1.0) {
- /* face = 5 */
- yf = yf + 2.0;
- n = -1.0/sqrt(1.0 + xf*xf + yf*yf);
- l = -n*yf;
- m = -n*xf;
- } else {
- /* face = 1 */
- l = 1.0/sqrt(1.0 + xf*xf + yf*yf);
- m = l*xf;
- n = l*yf;
- }
-
- if (l == 0.0 && m == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (m, l);
- }
- *theta = asindeg (n);
-
- return 0;
-}
-
-/*============================================================================
-* CSC: COBE quadrilateralized spherical cube projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "CSC"
-* prj->flag CSC
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/4)
-* prj->w[1] (4/pi)/r0
-* prj->prjfwd Pointer to cscfwd().
-* prj->prjrev Pointer to cscrev().
-*===========================================================================*/
-
-int cscset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "CSC");
- prj->flag = CSC;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 45.0;
- prj->w[1] = 1.0/45.0;
- } else {
- prj->w[0] = prj->r0*PI/4.0;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = cscfwd;
- prj->prjrev = cscrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int cscfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- int face;
- double cthe, eta=0.0, l, m, n, rho, xi=0.0;
- const float tol = 1.0e-7;
-
- float a, a2, a2b2, a4, ab, b, b2, b4, ca2, cb2;
- float x0 = 0.0;
- float y0 = 0.0;
- float xf = 0.0;
- float yf = 0.0;
- const float gstar = 1.37484847732;
- const float mm = 0.004869491981;
- const float gamma = -0.13161671474;
- const float omega1 = -0.159596235474;
- const float d0 = 0.0759196200467;
- const float d1 = -0.0217762490699;
- const float c00 = 0.141189631152;
- const float c10 = 0.0809701286525;
- const float c01 = -0.281528535557;
- const float c11 = 0.15384112876;
- const float c20 = -0.178251207466;
- const float c02 = 0.106959469314;
-
- if (prj->flag != CSC) {
- if (cscset(prj)) return 1;
- }
-
- cthe = cosdeg (theta);
- l = cthe*cosdeg (phi);
- m = cthe*sindeg (phi);
- n = sindeg (theta);
-
- face = 0;
- rho = n;
- if (l > rho) {
- face = 1;
- rho = l;
- }
- if (m > rho) {
- face = 2;
- rho = m;
- }
- if (-l > rho) {
- face = 3;
- rho = -l;
- }
- if (-m > rho) {
- face = 4;
- rho = -m;
- }
- if (-n > rho) {
- face = 5;
- rho = -n;
- }
-
- if (face == 0) {
- xi = m;
- eta = -l;
- x0 = 0.0;
- y0 = 2.0;
- } else if (face == 1) {
- xi = m;
- eta = n;
- x0 = 0.0;
- y0 = 0.0;
- } else if (face == 2) {
- xi = -l;
- eta = n;
- x0 = 2.0;
- y0 = 0.0;
- } else if (face == 3) {
- xi = -m;
- eta = n;
- x0 = 4.0;
- y0 = 0.0;
- } else if (face == 4) {
- xi = l;
- eta = n;
- x0 = 6.0;
- y0 = 0.0;
- } else if (face == 5) {
- xi = m;
- eta = l;
- x0 = 0.0;
- y0 = -2.0;
- }
-
- a = xi/rho;
- b = eta/rho;
-
- a2 = a*a;
- b2 = b*b;
- ca2 = 1.0 - a2;
- cb2 = 1.0 - b2;
-
- /* Avoid floating underflows. */
- ab = fabs(a*b);
- a4 = (a2 > 1.0e-16) ? a2*a2 : 0.0;
- b4 = (b2 > 1.0e-16) ? b2*b2 : 0.0;
- a2b2 = (ab > 1.0e-16) ? a2*b2 : 0.0;
-
- xf = a*(a2 + ca2*(gstar + b2*(gamma*ca2 + mm*a2 +
- cb2*(c00 + c10*a2 + c01*b2 + c11*a2b2 + c20*a4 + c02*b4)) +
- a2*(omega1 - ca2*(d0 + d1*a2))));
- yf = b*(b2 + cb2*(gstar + a2*(gamma*cb2 + mm*b2 +
- ca2*(c00 + c10*b2 + c01*a2 + c11*a2b2 + c20*b4 + c02*a4)) +
- b2*(omega1 - cb2*(d0 + d1*b2))));
-
- if (fabs(xf) > 1.0) {
- if (fabs(xf) > 1.0+tol) {
- return 2;
- }
- xf = copysgn (1.0,xf);
- }
- if (fabs(yf) > 1.0) {
- if (fabs(yf) > 1.0+tol) {
- return 2;
- }
- yf = copysgn (1.0,yf);
- }
-
- *x = prj->w[0]*(x0 + xf);
- *y = prj->w[0]*(y0 + yf);
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int cscrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- int face;
- double l = 0.0;
- double m = 0.0;
- double n = 0.0;
-
- float a, b, xf, xx, yf, yy, z0, z1, z2, z3, z4, z5, z6;
- const float p00 = -0.27292696;
- const float p10 = -0.07629969;
- const float p20 = -0.22797056;
- const float p30 = 0.54852384;
- const float p40 = -0.62930065;
- const float p50 = 0.25795794;
- const float p60 = 0.02584375;
- const float p01 = -0.02819452;
- const float p11 = -0.01471565;
- const float p21 = 0.48051509;
- const float p31 = -1.74114454;
- const float p41 = 1.71547508;
- const float p51 = -0.53022337;
- const float p02 = 0.27058160;
- const float p12 = -0.56800938;
- const float p22 = 0.30803317;
- const float p32 = 0.98938102;
- const float p42 = -0.83180469;
- const float p03 = -0.60441560;
- const float p13 = 1.50880086;
- const float p23 = -0.93678576;
- const float p33 = 0.08693841;
- const float p04 = 0.93412077;
- const float p14 = -1.41601920;
- const float p24 = 0.33887446;
- const float p05 = -0.63915306;
- const float p15 = 0.52032238;
- const float p06 = 0.14381585;
-
- if (prj->flag != CSC) {
- if (cscset(prj)) return 1;
- }
-
- xf = x*prj->w[1];
- yf = y*prj->w[1];
-
- /* Check bounds. */
- if (fabs(xf) <= 1.0) {
- if (fabs(yf) > 3.0) return 2;
- } else {
- if (fabs(xf) > 7.0) return 2;
- if (fabs(yf) > 1.0) return 2;
- }
-
- /* Map negative faces to the other side. */
- if (xf < -1.0) xf += 8.0;
-
- /* Determine the face. */
- if (xf > 5.0) {
- face = 4;
- xf = xf - 6.0;
- } else if (xf > 3.0) {
- face = 3;
- xf = xf - 4.0;
- } else if (xf > 1.0) {
- face = 2;
- xf = xf - 2.0;
- } else if (yf > 1.0) {
- face = 0;
- yf = yf - 2.0;
- } else if (yf < -1.0) {
- face = 5;
- yf = yf + 2.0;
- } else {
- face = 1;
- }
-
- xx = xf*xf;
- yy = yf*yf;
-
- z0 = p00 + xx*(p10 + xx*(p20 + xx*(p30 + xx*(p40 + xx*(p50 + xx*(p60))))));
- z1 = p01 + xx*(p11 + xx*(p21 + xx*(p31 + xx*(p41 + xx*(p51)))));
- z2 = p02 + xx*(p12 + xx*(p22 + xx*(p32 + xx*(p42))));
- z3 = p03 + xx*(p13 + xx*(p23 + xx*(p33)));
- z4 = p04 + xx*(p14 + xx*(p24));
- z5 = p05 + xx*(p15);
- z6 = p06;
-
- a = z0 + yy*(z1 + yy*(z2 + yy*(z3 + yy*(z4 + yy*(z5 + yy*z6)))));
- a = xf + xf*(1.0 - xx)*a;
-
- z0 = p00 + yy*(p10 + yy*(p20 + yy*(p30 + yy*(p40 + yy*(p50 + yy*(p60))))));
- z1 = p01 + yy*(p11 + yy*(p21 + yy*(p31 + yy*(p41 + yy*(p51)))));
- z2 = p02 + yy*(p12 + yy*(p22 + yy*(p32 + yy*(p42))));
- z3 = p03 + yy*(p13 + yy*(p23 + yy*(p33)));
- z4 = p04 + yy*(p14 + yy*(p24));
- z5 = p05 + yy*(p15);
- z6 = p06;
-
- b = z0 + xx*(z1 + xx*(z2 + xx*(z3 + xx*(z4 + xx*(z5 + xx*z6)))));
- b = yf + yf*(1.0 - yy)*b;
-
- if (face == 0) {
- n = 1.0/sqrt(a*a + b*b + 1.0);
- l = -b*n;
- m = a*n;
- } else if (face == 1) {
- l = 1.0/sqrt(a*a + b*b + 1.0);
- m = a*l;
- n = b*l;
- } else if (face == 2) {
- m = 1.0/sqrt(a*a + b*b + 1.0);
- l = -a*m;
- n = b*m;
- } else if (face == 3) {
- l = -1.0/sqrt(a*a + b*b + 1.0);
- m = a*l;
- n = -b*l;
- } else if (face == 4) {
- m = -1.0/sqrt(a*a + b*b + 1.0);
- l = -a*m;
- n = -b*m;
- } else if (face == 5) {
- n = -1.0/sqrt(a*a + b*b + 1.0);
- l = -b*n;
- m = -a*n;
- }
-
- if (l == 0.0 && m == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (m, l);
- }
- *theta = asindeg (n);
-
- return 0;
-}
-
-/*============================================================================
-* QSC: quadrilaterilized spherical cube projection.
-*
-* Given and/or returned:
-* prj->r0 r0; reset to 180/pi if 0.
-*
-* Returned:
-* prj->code "QSC"
-* prj->flag QSC
-* prj->phi0 0.0
-* prj->theta0 0.0
-* prj->w[0] r0*(pi/4)
-* prj->w[1] (4/pi)/r0
-* prj->prjfwd Pointer to qscfwd().
-* prj->prjrev Pointer to qscrev().
-*===========================================================================*/
-
-int qscset(prj)
-
-struct prjprm *prj;
-
-{
- strcpy(prj->code, "QSC");
- prj->flag = QSC;
- prj->phi0 = 0.0;
- prj->theta0 = 0.0;
-
- if (prj->r0 == 0.0) {
- prj->r0 = R2D;
- prj->w[0] = 45.0;
- prj->w[1] = 1.0/45.0;
- } else {
- prj->w[0] = prj->r0*PI/4.0;
- prj->w[1] = 1.0/prj->w[0];
- }
-
- prj->prjfwd = qscfwd;
- prj->prjrev = qscrev;
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int qscfwd(phi, theta, prj, x, y)
-
-const double phi, theta;
-struct prjprm *prj;
-double *x, *y;
-
-{
- int face;
- double cthe, l, m, n, omega, p, rho, rhu, t, tau;
- double xi = 0.0;
- double eta = 0.0;
- double x0 = 0.0;
- double y0 = 0.0;
- double xf = 0.0;
- double yf = 0.0;
- const double tol = 1.0e-12;
-
- if (prj->flag != QSC) {
- if (qscset(prj)) return 1;
- }
-
- if (fabs(theta) == 90.0) {
- *x = 0.0;
- *y = copysgn (2.0*prj->w[0],theta);
- return 0;
- }
-
- cthe = cosdeg (theta);
- l = cthe*cosdeg (phi);
- m = cthe*sindeg (phi);
- n = sindeg (theta);
-
- face = 0;
- rho = n;
- if (l > rho) {
- face = 1;
- rho = l;
- }
- if (m > rho) {
- face = 2;
- rho = m;
- }
- if (-l > rho) {
- face = 3;
- rho = -l;
- }
- if (-m > rho) {
- face = 4;
- rho = -m;
- }
- if (-n > rho) {
- face = 5;
- rho = -n;
- }
-
- rhu = 1.0 - rho;
-
- if (face == 0) {
- xi = m;
- eta = -l;
- if (rhu < 1.0e-8) {
- /* Small angle formula. */
- t = (90.0 - theta)*D2R;
- rhu = t*t/2.0;
- }
- x0 = 0.0;
- y0 = 2.0;
- } else if (face == 1) {
- xi = m;
- eta = n;
- if (rhu < 1.0e-8) {
- /* Small angle formula. */
- t = theta*D2R;
- p = fmod(phi,360.0);
- if (p < -180.0) p += 360.0;
- if (p > 180.0) p -= 360.0;
- p *= D2R;
- rhu = (p*p + t*t)/2.0;
- }
- x0 = 0.0;
- y0 = 0.0;
- } else if (face == 2) {
- xi = -l;
- eta = n;
- if (rhu < 1.0e-8) {
- /* Small angle formula. */
- t = theta*D2R;
- p = fmod(phi,360.0);
- if (p < -180.0) p += 360.0;
- p = (90.0 - p)*D2R;
- rhu = (p*p + t*t)/2.0;
- }
- x0 = 2.0;
- y0 = 0.0;
- } else if (face == 3) {
- xi = -m;
- eta = n;
- if (rhu < 1.0e-8) {
- /* Small angle formula. */
- t = theta*D2R;
- p = fmod(phi,360.0);
- if (p < 0.0) p += 360.0;
- p = (180.0 - p)*D2R;
- rhu = (p*p + t*t)/2.0;
- }
- x0 = 4.0;
- y0 = 0.0;
- } else if (face == 4) {
- xi = l;
- eta = n;
- if (rhu < 1.0e-8) {
- /* Small angle formula. */
- t = theta*D2R;
- p = fmod(phi,360.0);
- if (p > 180.0) p -= 360.0;
- p *= (90.0 + p)*D2R;
- rhu = (p*p + t*t)/2.0;
- }
- x0 = 6;
- y0 = 0.0;
- } else if (face == 5) {
- xi = m;
- eta = l;
- if (rhu < 1.0e-8) {
- /* Small angle formula. */
- t = (90.0 + theta)*D2R;
- rhu = t*t/2.0;
- }
- x0 = 0.0;
- y0 = -2;
- }
-
- if (xi == 0.0 && eta == 0.0) {
- xf = 0.0;
- yf = 0.0;
- } else if (-xi >= fabs(eta)) {
- omega = eta/xi;
- tau = 1.0 + omega*omega;
- xf = -sqrt(rhu/(1.0-1.0/sqrt(1.0+tau)));
- yf = (xf/15.0)*(atandeg (omega) - asindeg (omega/sqrt(tau+tau)));
- } else if (xi >= fabs(eta)) {
- omega = eta/xi;
- tau = 1.0 + omega*omega;
- xf = sqrt(rhu/(1.0-1.0/sqrt(1.0+tau)));
- yf = (xf/15.0)*(atandeg (omega) - asindeg (omega/sqrt(tau+tau)));
- } else if (-eta > fabs(xi)) {
- omega = xi/eta;
- tau = 1.0 + omega*omega;
- yf = -sqrt(rhu/(1.0-1.0/sqrt(1.0+tau)));
- xf = (yf/15.0)*(atandeg (omega) - asindeg (omega/sqrt(tau+tau)));
- } else if (eta > fabs(xi)) {
- omega = xi/eta;
- tau = 1.0 + omega*omega;
- yf = sqrt(rhu/(1.0-1.0/sqrt(1.0+tau)));
- xf = (yf/15.0)*(atandeg (omega) - asindeg (omega/sqrt(tau+tau)));
- }
-
- if (fabs(xf) > 1.0) {
- if (fabs(xf) > 1.0+tol) {
- return 2;
- }
- xf = copysgn (1.0,xf);
- }
- if (fabs(yf) > 1.0) {
- if (fabs(yf) > 1.0+tol) {
- return 2;
- }
- yf = copysgn (1.0,yf);
- }
-
- *x = prj->w[0]*(xf + x0);
- *y = prj->w[0]*(yf + y0);
-
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int qscrev(x, y, prj, phi, theta)
-
-const double x, y;
-struct prjprm *prj;
-double *phi, *theta;
-
-{
- int direct, face;
- double omega, rho, rhu, tau, xf, yf, w;
- double l = 0.0;
- double m = 0.0;
- double n = 0.0;
- const double tol = 1.0e-12;
-
- if (prj->flag != QSC) {
- if (qscset(prj)) return 1;
- }
-
- xf = x*prj->w[1];
- yf = y*prj->w[1];
-
- /* Check bounds. */
- if (fabs(xf) <= 1.0) {
- if (fabs(yf) > 3.0) return 2;
- } else {
- if (fabs(xf) > 7.0) return 2;
- if (fabs(yf) > 1.0) return 2;
- }
-
- /* Map negative faces to the other side. */
- if (xf < -1.0) xf += 8.0;
-
- /* Determine the face. */
- if (xf > 5.0) {
- face = 4;
- xf = xf - 6.0;
- } else if (xf > 3.0) {
- face = 3;
- xf = xf - 4.0;
- } else if (xf > 1.0) {
- face = 2;
- xf = xf - 2.0;
- } else if (yf > 1.0) {
- face = 0;
- yf = yf - 2.0;
- } else if (yf < -1.0) {
- face = 5;
- yf = yf + 2.0;
- } else {
- face = 1;
- }
-
- direct = (fabs(xf) > fabs(yf));
- if (direct) {
- if (xf == 0.0) {
- omega = 0.0;
- tau = 1.0;
- rho = 1.0;
- rhu = 0.0;
- } else {
- w = 15.0*yf/xf;
- omega = sindeg (w)/(cosdeg (w) - SQRT2INV);
- tau = 1.0 + omega*omega;
- rhu = xf*xf*(1.0 - 1.0/sqrt(1.0 + tau));
- rho = 1.0 - rhu;
- }
- } else {
- if (yf == 0.0) {
- omega = 0.0;
- tau = 1.0;
- rho = 1.0;
- rhu = 0.0;
- } else {
- w = 15.0*xf/yf;
- omega = sindeg (w)/(cosdeg (w) - SQRT2INV);
- tau = 1.0 + omega*omega;
- rhu = yf*yf*(1.0 - 1.0/sqrt(1.0 + tau));
- rho = 1.0 - rhu;
- }
- }
-
- if (rho < -1.0) {
- if (rho < -1.0-tol) {
- return 2;
- }
-
- rho = -1.0;
- rhu = 2.0;
- w = 0.0;
- } else {
- w = sqrt(rhu*(2.0-rhu)/tau);
- }
-
- if (face == 0) {
- n = rho;
- if (direct) {
- m = w;
- if (xf < 0.0) m = -m;
- l = -m*omega;
- } else {
- l = w;
- if (yf > 0.0) l = -l;
- m = -l*omega;
- }
- } else if (face == 1) {
- l = rho;
- if (direct) {
- m = w;
- if (xf < 0.0) m = -m;
- n = m*omega;
- } else {
- n = w;
- if (yf < 0.0) n = -n;
- m = n*omega;
- }
- } else if (face == 2) {
- m = rho;
- if (direct) {
- l = w;
- if (xf > 0.0) l = -l;
- n = -l*omega;
- } else {
- n = w;
- if (yf < 0.0) n = -n;
- l = -n*omega;
- }
- } else if (face == 3) {
- l = -rho;
- if (direct) {
- m = w;
- if (xf > 0.0) m = -m;
- n = -m*omega;
- } else {
- n = w;
- if (yf < 0.0) n = -n;
- m = -n*omega;
- }
- } else if (face == 4) {
- m = -rho;
- if (direct) {
- l = w;
- if (xf < 0.0) l = -l;
- n = l*omega;
- } else {
- n = w;
- if (yf < 0.0) n = -n;
- l = n*omega;
- }
- } else if (face == 5) {
- n = -rho;
- if (direct) {
- m = w;
- if (xf < 0.0) m = -m;
- l = m*omega;
- } else {
- l = w;
- if (yf < 0.0) l = -l;
- m = l*omega;
- }
- }
-
- if (l == 0.0 && m == 0.0) {
- *phi = 0.0;
- } else {
- *phi = atan2deg (m, l);
- }
- *theta = asindeg (n);
-
- return 0;
-}
-
-/* This routine comes from E. Bertin sextractor-2.8.6 */
-
-int
-raw_to_pv(struct prjprm *prj, double x, double y, double *xo, double *yo)
-
-{
- int k;
- double *a,*b,
- r,r3,r5,r7,xy,x2,x3,x4,x5,x6,x7,y2,y3,y4,y5,y6,y7,xp,yp;
-
-
- k=prj->npv;
- a = prj->ppv+MAXPV; /* Latitude comes first for compatibility */
- b = prj->ppv; /* Longitude */
- xp = *(a++);
- xp += *(a++)*x;
- yp = *(b++);
- yp += *(b++)*y;
- if (!--k) goto poly_end;
- xp += *(a++)*y;
- yp += *(b++)*x;
- if (!--k) goto poly_end;
- r = sqrt(x*x + y*y);
- xp += *(a++)*r;
- yp += *(b++)*r;
- if (!--k) goto poly_end;
- xp += *(a++)*(x2=x*x);
- yp += *(b++)*(y2=y*y);
- if (!--k) goto poly_end;
- xp += *(a++)*(xy=x*y);
- yp += *(b++)*xy;
- if (!--k) goto poly_end;
- xp += *(a++)*y2;
- yp += *(b++)*x2;
- if (!--k) goto poly_end;
- xp += *(a++)*(x3=x*x2);
- yp += *(b++)*(y3=y*y2);
- if (!--k) goto poly_end;
- xp += *(a++)*x2*y;
- yp += *(b++)*y2*x;
- if (!--k) goto poly_end;
- xp += *(a++)*x*y2;
- yp += *(b++)*y*x2;
- if (!--k) goto poly_end;
- xp += *(a++)*y3;
- yp += *(b++)*x3;
- if (!--k) goto poly_end;
- xp += *(a++)*(r3=r*r*r);
- yp += *(b++)*r3;
- if (!--k) goto poly_end;
- xp += *(a++)*(x4=x2*x2);
- yp += *(b++)*(y4=y2*y2);
- if (!--k) goto poly_end;
- xp += *(a++)*x3*y;
- yp += *(b++)*y3*x;
- if (!--k) goto poly_end;
- xp += *(a++)*x2*y2;
- yp += *(b++)*x2*y2;
- if (!--k) goto poly_end;
- xp += *(a++)*x*y3;
- yp += *(b++)*y*x3;
- if (!--k) goto poly_end;
- xp += *(a++)*y4;
- yp += *(b++)*x4;
- if (!--k) goto poly_end;
- xp += *(a++)*(x5=x4*x);
- yp += *(b++)*(y5=y4*y);
- if (!--k) goto poly_end;
- xp += *(a++)*x4*y;
- yp += *(b++)*y4*x;
- if (!--k) goto poly_end;
- xp += *(a++)*x3*y2;
- yp += *(b++)*y3*x2;
- if (!--k) goto poly_end;
- xp += *(a++)*x2*y3;
- yp += *(b++)*y2*x3;
- if (!--k) goto poly_end;
- xp += *(a++)*x*y4;
- yp += *(b++)*y*x4;
- if (!--k) goto poly_end;
- xp += *(a++)*y5;
- yp += *(b++)*x5;
- if (!--k) goto poly_end;
- xp += *(a++)*(r5=r3*r*r);
- yp += *(b++)*r5;
- if (!--k) goto poly_end;
- xp += *(a++)*(x6=x5*x);
- yp += *(b++)*(y6=y5*y);
- if (!--k) goto poly_end;
- xp += *(a++)*x5*y;
- yp += *(b++)*y5*x;
- if (!--k) goto poly_end;
- xp += *(a++)*x4*y2;
- yp += *(b++)*y4*x2;
- if (!--k) goto poly_end;
- xp += *(a++)*x3*y3;
- yp += *(b++)*y3*x3;
- if (!--k) goto poly_end;
- xp += *(a++)*x2*y4;
- yp += *(b++)*y2*x4;
- if (!--k) goto poly_end;
- xp += *(a++)*x*y5;
- yp += *(b++)*y*x5;
- if (!--k) goto poly_end;
- xp += *(a++)*y6;
- yp += *(b++)*x6;
- if (!--k) goto poly_end;
- xp += *(a++)*(x7=x6*x);
- yp += *(b++)*(y7=y6*y);
- if (!--k) goto poly_end;
- xp += *(a++)*x6*y;
- yp += *(b++)*y6*x;
- if (!--k) goto poly_end;
- xp += *(a++)*x5*y2;
- yp += *(b++)*y5*x2;
- if (!--k) goto poly_end;
- xp += *(a++)*x4*y3;
- yp += *(b++)*y4*x3;
- if (!--k) goto poly_end;
- xp += *(a++)*x3*y4;
- yp += *(b++)*y3*x4;
- if (!--k) goto poly_end;
- xp += *(a++)*x2*y5;
- yp += *(b++)*y2*x5;
- if (!--k) goto poly_end;
- xp += *(a++)*x*y6;
- yp += *(b++)*y*x6;
- if (!--k) goto poly_end;
- xp += *(a++)*y7;
- yp += *(b++)*x7;
- if (!--k) goto poly_end;
- xp += *a*(r7=r5*r*r);
- yp += *b*r7;
-
-poly_end:
-
- *xo = xp;
- *yo = yp;
-
- return 0;
-}
-
-/* Dec 20 1999 Doug Mink - Change cosd() and sind() to cosdeg() and sindeg()
- * Dec 20 1999 Doug Mink - Include wcslib.h, which includes proj.h, wcsmath.h
- * Dec 20 1999 Doug Mink - Define copysign only if it is not defined
- * Dec 20 1999 Doug Mink - tanfwd() returns error if s<=0.0, not only if s==0.0
- *
- * Jun 2 2000 Doug Mink - include stdlib.h to get abs()
- *
- * Feb 15 2001 Doug Mink - update zearev() for WCSLIB 2.6
- * Sep 19 2001 Doug Mink - Make above changes for WCSLIB 2.7
- *
- * Mar 15 2002 Doug Mink - Make above changes for WCSLIB 2.8.2
- *
- * Feb 3 2003 Doug Mink - Use locally defined copysgn() and copysgni(),
- * not copysign()
- * Apr 1 2003 Doug Mink - include string.h for strcpy() and strcmp()
- *
- * Mar 14 2011 Doug Mink - If no coefficients in ZPN, make ARC
- * Mar 14 2011 Doug Mink - Add Emmanuel Bertin's TAN polynomial from Ed Los
- */
diff --git a/funtools/wcs/slasubs.c b/funtools/wcs/slasubs.c
deleted file mode 100644
index 74ddb88..0000000
--- a/funtools/wcs/slasubs.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/* File slasubs.c
- *** Starlink subroutines by Patrick Wallace used by wcscon.c subroutines
- *** April 13, 1998
- */
-
-#include <math.h>
-#include <string.h>
-
-/* slaDcs2c (a, b, v): Spherical coordinates to direction cosines.
- * slaDcc2s (v, a, b): Direction cosines to spherical coordinates.
- * slaDmxv (dm, va, vb): vector vb = matrix dm * vector va
- * slaImxv (rm, va, vb): vector vb = (inverse of matrix rm) * vector va
- * slaDranrm (angle): Normalize angle into range 0-2 pi.
- * slaDrange (angle): Normalize angle into range +/- pi.
- * slaDeuler (order, phi, theta, psi, rmat)
- * Form a rotation matrix from the Euler angles - three successive
- * rotations about specified Cartesian axes.
- */
-
-void
-slaDcs2c (a, b, v)
-
-double a; /* Right ascension in radians */
-double b; /* Declination in radians */
-double *v; /* x,y,z unit vector (returned) */
-
-/*
-** slaDcs2c: Spherical coordinates to direction cosines.
-**
-** The spherical coordinates are longitude (+ve anticlockwise
-** looking from the +ve latitude pole) and latitude. The
-** Cartesian coordinates are right handed, with the x axis
-** at zero longitude and latitude, and the z axis at the
-** +ve latitude pole.
-**
-** P.T.Wallace Starlink 31 October 1993
-*/
-{
- double cosb;
-
- cosb = cos ( b );
- v[0] = cos ( a ) * cosb;
- v[1] = sin ( a ) * cosb;
- v[2] = sin ( b );
-}
-
-
-void
-slaDcc2s (v, a, b)
-
-double *v; /* x,y,z vector */
-double *a; /* Right ascension in radians */
-double *b; /* Declination in radians */
-
-/*
-** slaDcc2s:
-** Direction cosines to spherical coordinates.
-**
-** Returned:
-** *a,*b double spherical coordinates in radians
-**
-** The spherical coordinates are longitude (+ve anticlockwise
-** looking from the +ve latitude pole) and latitude. The
-** Cartesian coordinates are right handed, with the x axis
-** at zero longitude and latitude, and the z axis at the
-** +ve latitude pole.
-**
-** If v is null, zero a and b are returned.
-** At either pole, zero a is returned.
-**
-** P.T.Wallace Starlink 31 October 1993
-*/
-{
- double x, y, z, r;
-
- x = v[0];
- y = v[1];
- z = v[2];
- r = sqrt ( x * x + y * y );
-
- *a = ( r != 0.0 ) ? atan2 ( y, x ) : 0.0;
- *b = ( z != 0.0 ) ? atan2 ( z, r ) : 0.0;
-}
-
-
-void
-slaDmxv (dm, va, vb)
-
-double (*dm)[3]; /* 3x3 Matrix */
-double *va; /* Vector */
-double *vb; /* Result vector (returned) */
-
-/*
-** slaDmxv:
-** Performs the 3-d forward unitary transformation:
-** vector vb = matrix dm * vector va
-**
-** P.T.Wallace Starlink 31 October 1993
-*/
-{
- int i, j;
- double w, vw[3];
-
- /* Matrix dm * vector va -> vector vw */
- for ( j = 0; j < 3; j++ ) {
- w = 0.0;
- for ( i = 0; i < 3; i++ ) {
- w += dm[j][i] * va[i];
- }
- vw[j] = w;
- }
-
- /* Vector vw -> vector vb */
- for ( j = 0; j < 3; j++ ) {
- vb[j] = vw[j];
- }
-}
-
-
-void slaDimxv (dm, va, vb)
- double (*dm)[3];
- double *va;
- double *vb;
-/*
-** - - - - - - - - -
-** s l a D i m x v
-** - - - - - - - - -
-**
-** Performs the 3-d backward unitary transformation:
-**
-** vector vb = (inverse of matrix dm) * vector va
-**
-** (double precision)
-**
-** (n.b. The matrix must be unitary, as this routine assumes that
-** the inverse and transpose are identical)
-**
-**
-** Given:
-** dm double[3][3] matrix
-** va double[3] vector
-**
-** Returned:
-** vb double[3] result vector
-**
-** P.T.Wallace Starlink 31 October 1993
-*/
-{
- long i, j;
- double w, vw[3];
-
-/* Inverse of matrix dm * vector va -> vector vw */
- for ( j = 0; j < 3; j++ ) {
- w = 0.0;
- for ( i = 0; i < 3; i++ ) {
- w += dm[i][j] * va[i];
- }
- vw[j] = w;
- }
-
-/* Vector vw -> vector vb */
- for ( j = 0; j < 3; j++ ) {
- vb[j] = vw[j];
- }
-}
-
-
-/* 2pi */
-#define D2PI 6.2831853071795864769252867665590057683943387987502
-
-/* pi */
-#define DPI 3.1415926535897932384626433832795028841971693993751
-
-double slaDranrm (angle)
-
-double angle; /* angle in radians */
-
-/*
-** slaDranrm:
-** Normalize angle into range 0-2 pi.
-** The result is angle expressed in the range 0-2 pi (double).
-** Defined in slamac.h: D2PI
-**
-** P.T.Wallace Starlink 30 October 1993
-*/
-{
- double w;
-
- w = fmod ( angle, D2PI );
- return ( w >= 0.0 ) ? w : w + D2PI;
-}
-
-#ifndef dsign
-#define dsign(A,B) ((B)<0.0?-(A):(A))
-#endif
-
-double
-slaDrange (angle)
- double angle;
-/*
-** - - - - - - - - - -
-** s l a D r a n g e
-** - - - - - - - - - -
-**
-** Normalize angle into range +/- pi.
-**
-** (double precision)
-**
-** Given:
-** angle double the angle in radians
-**
-** The result is angle expressed in the +/- pi (double precision).
-**
-** Defined in slamac.h: DPI, D2PI
-**
-** P.T.Wallace Starlink 31 October 1993
-*/
-{
- double w;
-
- w = fmod ( angle, D2PI );
- return ( fabs ( w ) < DPI ) ? w : w - dsign ( D2PI, angle );
-}
-
-
-void
-slaDeuler (order, phi, theta, psi, rmat)
-
-char *order; /* specifies about which axes the rotations occur */
-double phi; /* 1st rotation (radians) */
-double theta; /* 2nd rotation (radians) */
-double psi; /* 3rd rotation (radians) */
-double (*rmat)[3]; /* 3x3 Rotation matrix (returned) */
-
-/*
-** slaDeuler:
-** Form a rotation matrix from the Euler angles - three successive
-** rotations about specified Cartesian axes.
-**
-** A rotation is positive when the reference frame rotates
-** anticlockwise as seen looking towards the origin from the
-** positive region of the specified axis.
-**
-** The characters of order define which axes the three successive
-** rotations are about. A typical value is 'zxz', indicating that
-** rmat is to become the direction cosine matrix corresponding to
-** rotations of the reference frame through phi radians about the
-** old z-axis, followed by theta radians about the resulting x-axis,
-** then psi radians about the resulting z-axis.
-**
-** The axis names can be any of the following, in any order or
-** combination: x, y, z, uppercase or lowercase, 1, 2, 3. Normal
-** axis labelling/numbering conventions apply; the xyz (=123)
-** triad is right-handed. Thus, the 'zxz' example given above
-** could be written 'zxz' or '313' (or even 'zxz' or '3xz'). Order
-** is terminated by length or by the first unrecognised character.
-**
-** Fewer than three rotations are acceptable, in which case the later
-** angle arguments are ignored. Zero rotations produces a unit rmat.
-**
-** P.T.Wallace Starlink 17 November 1993
-*/
-{
- int j, i, l, n, k;
- double result[3][3], rotn[3][3], angle, s, c , w, wm[3][3];
- char axis;
-
-/* Initialize result matrix */
- for ( j = 0; j < 3; j++ ) {
- for ( i = 0; i < 3; i++ ) {
- result[i][j] = ( i == j ) ? 1.0 : 0.0;
- }
- }
-
-/* Establish length of axis string */
- l = strlen ( order );
-
-/* Look at each character of axis string until finished */
- for ( n = 0; n < 3; n++ ) {
- if ( n <= l ) {
-
- /* Initialize rotation matrix for the current rotation */
- for ( j = 0; j < 3; j++ ) {
- for ( i = 0; i < 3; i++ ) {
- rotn[i][j] = ( i == j ) ? 1.0 : 0.0;
- }
- }
-
- /* Pick up the appropriate Euler angle and take sine & cosine */
- switch ( n ) {
- case 0 :
- angle = phi;
- break;
- case 1 :
- angle = theta;
- break;
- case 2 :
- angle = psi;
- break;
- }
- s = sin ( angle );
- c = cos ( angle );
-
- /* Identify the axis */
- axis = order[n];
- if ( ( axis == 'X' ) || ( axis == 'x' ) || ( axis == '1' ) ) {
-
- /* Matrix for x-rotation */
- rotn[1][1] = c;
- rotn[1][2] = s;
- rotn[2][1] = -s;
- rotn[2][2] = c;
- }
- else if ( ( axis == 'Y' ) || ( axis == 'y' ) || ( axis == '2' ) ) {
-
- /* Matrix for y-rotation */
- rotn[0][0] = c;
- rotn[0][2] = -s;
- rotn[2][0] = s;
- rotn[2][2] = c;
- }
- else if ( ( axis == 'Z' ) || ( axis == 'z' ) || ( axis == '3' ) ) {
-
- /* Matrix for z-rotation */
- rotn[0][0] = c;
- rotn[0][1] = s;
- rotn[1][0] = -s;
- rotn[1][1] = c;
- } else {
-
- /* Unrecognized character - fake end of string */
- l = 0;
- }
-
- /* Apply the current rotation (matrix rotn x matrix result) */
- for ( i = 0; i < 3; i++ ) {
- for ( j = 0; j < 3; j++ ) {
- w = 0.0;
- for ( k = 0; k < 3; k++ ) {
- w += rotn[i][k] * result[k][j];
- }
- wm[i][j] = w;
- }
- }
- for ( j = 0; j < 3; j++ ) {
- for ( i= 0; i < 3; i++ ) {
- result[i][j] = wm[i][j];
- }
- }
- }
- }
-
-/* Copy the result */
- for ( j = 0; j < 3; j++ ) {
- for ( i = 0; i < 3; i++ ) {
- rmat[i][j] = result[i][j];
- }
- }
-}
-/*
- * Nov 4 1996 New file
- *
- * Apr 13 1998 Add list of subroutines to start of file
- */
diff --git a/funtools/wcs/sph.c b/funtools/wcs/sph.c
deleted file mode 100644
index b8ba23d..0000000
--- a/funtools/wcs/sph.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-*=============================================================================
-*
-* C routines for the spherical coordinate transformations used by the FITS
-* "World Coordinate System" (WCS) convention.
-*
-* Summary of routines
-* -------------------
-* The spherical coordinate transformations are implemented via separate
-* functions for the transformation in each direction.
-*
-* Forward transformation; sphfwd()
-* --------------------------------
-* Transform celestial coordinates to the native coordinates of a projection.
-*
-* Given:
-* lng,lat double Celestial longitude and latitude, in degrees.
-* eul[5] double Euler angles for the transformation:
-* 0: Celestial longitude of the native pole, in
-* degrees.
-* 1: Celestial colatitude of the native pole, or
-* native colatitude of the celestial pole, in
-* degrees.
-* 2: Native longitude of the celestial pole, in
-* degrees.
-* 3: cos(eul[1])
-* 4: sin(eul[1])
-*
-* Returned:
-* phi, double Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-*
-* Reverse transformation; sphrev()
-* --------------------------------
-* Transform native coordinates of a projection to celestial coordinates.
-*
-* Given:
-* phi, double Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-* eul[5] double Euler angles for the transformation:
-* 0: Celestial longitude of the native pole, in
-* degrees.
-* 1: Celestial colatitude of the native pole, or
-* native colatitude of the celestial pole, in
-* degrees.
-* 2: Native longitude of the celestial pole, in
-* degrees.
-* 3: cos(eul[1])
-* 4: sin(eul[1])
-*
-* Returned:
-* lng,lat double Celestial longitude and latitude, in degrees.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-*
-* Author: Mark Calabretta, Australia Telescope National Facility
-* $Id: sph.c,v 2.7 2002/04/03 01:25:29 mcalabre Exp $
-*===========================================================================*/
-
-#include <math.h>
-#include "wcslib.h"
-
-#ifndef __STDC__
-#ifndef const
-#define const
-#endif
-#endif
-
-const double tol = 1.0e-5;
-
-int sphfwd (lng, lat, eul, phi, theta)
-
-const double lat, lng, eul[5];
-double *phi, *theta;
-
-{
- double coslat, coslng, dlng, dphi, sinlat, sinlng, x, y, z;
-
- coslat = cosdeg (lat);
- sinlat = sindeg (lat);
-
- dlng = lng - eul[0];
- coslng = cosdeg (dlng);
- sinlng = sindeg (dlng);
-
- /* Compute the native longitude. */
- x = sinlat*eul[4] - coslat*eul[3]*coslng;
- if (fabs(x) < tol) {
- /* Rearrange formula to reduce roundoff errors. */
- x = -cosdeg (lat+eul[1]) + coslat*eul[3]*(1.0 - coslng);
- }
- y = -coslat*sinlng;
- if (x != 0.0 || y != 0.0) {
- dphi = atan2deg (y, x);
- } else {
- /* Change of origin of longitude. */
- dphi = dlng - 180.0;
- }
- *phi = eul[2] + dphi;
-
- /* Normalize the native longitude. */
- if (*phi > 180.0) {
- *phi -= 360.0;
- } else if (*phi < -180.0) {
- *phi += 360.0;
- }
-
- /* Compute the native latitude. */
- if (fmod(dlng,180.0) == 0.0) {
- *theta = lat + coslng*eul[1];
- if (*theta > 90.0) *theta = 180.0 - *theta;
- if (*theta < -90.0) *theta = -180.0 - *theta;
- } else {
- z = sinlat*eul[3] + coslat*eul[4]*coslng;
- /* Use an alternative formula for greater numerical accuracy. */
- if (fabs(z) > 0.99) {
- if (z < 0)
- *theta = -acosdeg (sqrt(x*x+y*y));
- else
- *theta = acosdeg (sqrt(x*x+y*y));
- } else {
- *theta = asindeg (z);
- }
- }
-
- return 0;
-}
-
-/*-----------------------------------------------------------------------*/
-
-int sphrev (phi, theta, eul, lng, lat)
-
-const double phi, theta, eul[5];
-double *lng, *lat;
-
-{
- double cosphi, costhe, dlng, dphi, sinphi, sinthe, x, y, z;
-
- costhe = cosdeg (theta);
- sinthe = sindeg (theta);
-
- dphi = phi - eul[2];
- cosphi = cosdeg (dphi);
- sinphi = sindeg (dphi);
-
- /* Compute the celestial longitude. */
- x = sinthe*eul[4] - costhe*eul[3]*cosphi;
- if (fabs(x) < tol) {
- /* Rearrange formula to reduce roundoff errors. */
- x = -cosdeg (theta+eul[1]) + costhe*eul[3]*(1.0 - cosphi);
- }
- y = -costhe*sinphi;
- if (x != 0.0 || y != 0.0) {
- dlng = atan2deg (y, x);
- } else {
- /* Change of origin of longitude. */
- dlng = dphi + 180.0;
- }
- *lng = eul[0] + dlng;
-
- /* Normalize the celestial longitude. */
- if (eul[0] >= 0.0) {
- if (*lng < 0.0) *lng += 360.0;
- } else {
- if (*lng > 0.0) *lng -= 360.0;
- }
-
- if (*lng > 360.0) {
- *lng -= 360.0;
- } else if (*lng < -360.0) {
- *lng += 360.0;
- }
-
- /* Compute the celestial latitude. */
- if (fmod(dphi,180.0) == 0.0) {
- *lat = theta + cosphi*eul[1];
- if (*lat > 90.0) *lat = 180.0 - *lat;
- if (*lat < -90.0) *lat = -180.0 - *lat;
- } else {
- z = sinthe*eul[3] + costhe*eul[4]*cosphi;
-
- /* Use an alternative formula for greater numerical accuracy. */
- if (fabs(z) > 0.99) {
- if (z < 0)
- *lat = -acosdeg (sqrt(x*x+y*y));
- else
- *lat = acosdeg (sqrt(x*x+y*y));
- } else {
- *lat = asindeg (z);
- }
- }
-
- return 0;
-}
-/* Dec 20 1999 Doug Mink - Change cosd() and sind() to cosdeg() and sindeg()
- * Dec 20 1999 Doug Mink - Include wcslib.h, which includes wcstrig.h, sph.h
- * Dec 20 1999 Doug Mink - Define copysign only if it is not already defined
- *
- * Jan 5 2000 Doug Mink - Drop copysign
- *
- * Sep 19 2001 Doug Mink - No change for WCSLIB 2.7
- */
diff --git a/funtools/wcs/tnxpos.c b/funtools/wcs/tnxpos.c
deleted file mode 100644
index e13d78e..0000000
--- a/funtools/wcs/tnxpos.c
+++ /dev/null
@@ -1,1234 +0,0 @@
-/*** File wcslib/tnxpos.c
- *** September 17, 2008
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** After IRAF mwcs/wftnx.x and mwcs/wfgsurfit.x
- *** Copyright (C) 1998-2008
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include "wcs.h"
-
-#define SPHTOL 0.00001
-#define BADCVAL 0.0
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-
-/* wftnx -- wcs function driver for the gnomonic projection with correction.
- * tnxinit (header, wcs)
- * tnxclose (wcs)
- * tnxfwd (xpix, ypix, wcs, xpos, ypos) Pixels to WCS
- * tnxrev (xpos, ypos, wcs, xpix, ypix) WCS to pixels
- */
-
-#define max_niter 500
-#define SZ_ATSTRING 2000
-static void wf_gsclose();
-static void wf_gsb1pol();
-static void wf_gsb1leg();
-static void wf_gsb1cheb();
-
-/* tnxinit -- initialize the gnomonic forward or inverse transform.
- * initialization for this transformation consists of, determining which
- * axis is ra / lon and which is dec / lat, computing the celestial longitude
- * and colatitude of the native pole, reading in the the native longitude
- * of the pole of the celestial coordinate system longpole from the attribute
- * list, precomputing euler angles and various intermediaries derived from the
- * coordinate reference values, and reading in the projection parameter ro
- * from the attribute list. if longpole is undefined then a value of 180.0
- * degrees is assumed. if ro is undefined a value of 180.0 / pi is assumed.
- * the tan projection is equivalent to the azp projection with mu set to 0.0.
- * in order to determine the axis order, the parameter "axtype={ra|dec}
- * {xlon|glat}{xlon|elat}" must have been set in the attribute list for the
- * function. the longpole and ro parameters may be set in either or both of
- * the axes attribute lists, but the value in the ra axis attribute list takes
- * precedence.
- */
-
-int
-tnxinit (header, wcs)
-
-const char *header; /* FITS header */
-struct WorldCoor *wcs; /* pointer to WCS structure */
-{
- struct IRAFsurface *wf_gsopen();
- char *str1, *str2, *lngstr, *latstr;
- extern void wcsrotset();
-
- /* allocate space for the attribute strings */
- str1 = malloc (SZ_ATSTRING);
- str2 = malloc (SZ_ATSTRING);
- hgetm (header, "WAT1", SZ_ATSTRING, str1);
- hgetm (header, "WAT2", SZ_ATSTRING, str2);
-
- lngstr = malloc (SZ_ATSTRING);
- latstr = malloc (SZ_ATSTRING);
-
- /* determine the native longitude of the pole of the celestial
- coordinate system corresponding to the FITS keyword longpole.
- this number has no default and should normally be set to 180
- degrees. search both axes for this quantity. */
-
- if (wcs->longpole > 360.0) {
- if (!igetr8 (str1, "longpole", &wcs->longpole)) {
- if (!igetr8 (str2, "longpole", &wcs->longpole))
- wcs->longpole = 180.0;
- }
- }
-
- /* Fetch the ro projection parameter which is the radius of the
- generating sphere for the projection. if ro is absent which
- is the usual case set it to 180 / pi. search both axes for
- this quantity. */
-
- if (!igetr8 (str1, "ro", &wcs->rodeg)) {
- if (!igetr8 (str2, "ro", &wcs->rodeg))
- wcs->rodeg = 180.0 / PI;
- }
-
- /* Fetch the longitude correction surface. note that the attribute
- string may be of any length so the length of atvalue may have
- to be adjusted. */
-
- if (!igets (str1, "lngcor", SZ_ATSTRING, lngstr)) {
- if (!igets (str2, "lngcor", SZ_ATSTRING, lngstr))
- wcs->lngcor = NULL;
- else
- wcs->lngcor = wf_gsopen (lngstr);
- }
- else
- wcs->lngcor = wf_gsopen (lngstr);
-
- /* Fetch the latitude correction surface. note that the attribute
- string may be of any length so the length of atvalue may have
- to be adjusted. */
-
- if (!igets (str2, "latcor", SZ_ATSTRING, latstr)) {
- if (!igets (str1, "latcor", SZ_ATSTRING, latstr))
- wcs->latcor = NULL;
- else
- wcs->latcor = wf_gsopen (latstr);
- }
- else
- wcs->latcor = wf_gsopen (latstr);
-
- /* Compute image rotation */
- wcsrotset (wcs);
-
- /* free working space. */
- free (str1);
- free (str2);
- free (lngstr);
- free (latstr);
-
- /* Return 1 if there are no correction coefficients */
- if (wcs->latcor == NULL && wcs->lngcor == NULL)
- return (1);
- else
- return (0);
-}
-
-
-/* tnxpos -- forward transform (physical to world) gnomonic projection. */
-
-int
-tnxpos (xpix, ypix, wcs, xpos, ypos)
-
-double xpix, ypix; /*i physical coordinates (x, y) */
-struct WorldCoor *wcs; /*i pointer to WCS descriptor */
-double *xpos, *ypos; /*o world coordinates (ra, dec) */
-{
- int ira, idec;
- double x, y, r, phi, theta, costhe, sinthe, dphi, cosphi, sinphi, dlng, z;
- double colatp, coslatp, sinlatp, longp;
- double xs, ys, ra, dec, xp, yp;
- double wf_gseval();
-
- /* Convert from pixels to image coordinates */
- xpix = xpix - wcs->crpix[0];
- ypix = ypix - wcs->crpix[1];
-
- /* Scale and rotate using CD matrix */
- if (wcs->rotmat) {
- x = xpix * wcs->cd[0] + ypix * wcs->cd[1];
- y = xpix * wcs->cd[2] + ypix * wcs->cd[3];
- }
-
- else {
-
- /* Check axis increments - bail out if either 0 */
- if (wcs->cdelt[0] == 0.0 || wcs->cdelt[1] == 0.0) {
- *xpos = 0.0;
- *ypos = 0.0;
- return 2;
- }
-
- /* Scale using CDELT */
- xs = xpix * wcs->cdelt[0];
- ys = ypix * wcs->cdelt[1];
-
- /* Take out rotation from CROTA */
- if (wcs->rot != 0.0) {
- double cosr = cos (degrad (wcs->rot));
- double sinr = sin (degrad (wcs->rot));
- x = xs * cosr - ys * sinr;
- y = xs * sinr + ys * cosr;
- }
- else {
- x = xs;
- y = ys;
- }
- }
-
- /* get the axis numbers */
- if (wcs->coorflip) {
- ira = 1;
- idec = 0;
- }
- else {
- ira = 0;
- idec = 1;
- }
- colatp = degrad (90.0 - wcs->crval[idec]);
- coslatp = cos(colatp);
- sinlatp = sin(colatp);
- longp = degrad(wcs->longpole);
-
- /* Compute native spherical coordinates phi and theta in degrees from the
- projected coordinates. this is the projection part of the computation */
- if (wcs->lngcor != NULL)
- xp = x + wf_gseval (wcs->lngcor, x, y);
- else
- xp = x;
- if (wcs->latcor != NULL)
- yp = y + wf_gseval (wcs->latcor, x, y);
- else
- yp = y;
- x = xp;
- y = yp;
- r = sqrt (x * x + y * y);
-
- /* Compute phi */
- if (r == 0.0)
- phi = 0.0;
- else
- phi = atan2 (x, -y);
-
- /* Compute theta */
- theta = atan2 (wcs->rodeg, r);
-
- /* Compute the celestial coordinates ra and dec from the native
- coordinates phi and theta. this is the spherical geometry part
- of the computation */
-
- costhe = cos (theta);
- sinthe = sin (theta);
- dphi = phi - longp;
- cosphi = cos (dphi);
- sinphi = sin (dphi);
-
- /* Compute the ra */
- x = sinthe * sinlatp - costhe * coslatp * cosphi;
- if (fabs (x) < SPHTOL)
- x = -cos (theta + colatp) + costhe * coslatp * (1.0 - cosphi);
- y = -costhe * sinphi;
- if (x != 0.0 || y != 0.0)
- dlng = atan2 (y, x);
- else
- dlng = dphi + PI ;
- ra = wcs->crval[ira] + raddeg(dlng);
-
- /* normalize ra */
- if (wcs->crval[ira] >= 0.0) {
- if (ra < 0.0)
- ra = ra + 360.0;
- }
- else {
- if (ra > 0.0)
- ra = ra - 360.0;
- }
- if (ra > 360.0)
- ra = ra - 360.0;
- else if (ra < -360.0)
- ra = ra + 360.0;
-
- /* compute the dec */
- if (fmod (dphi, PI) == 0.0) {
- dec = raddeg(theta + cosphi * colatp);
- if (dec > 90.0)
- dec = 180.0 - dec;
- if (dec < -90.0)
- dec = -180.0 - dec;
- }
- else {
- z = sinthe * coslatp + costhe * sinlatp * cosphi;
- if (fabs(z) > 0.99) {
- if (z >= 0.0)
- dec = raddeg(acos (sqrt(x * x + y * y)));
- else
- dec = raddeg(-acos (sqrt(x * x + y * y)));
- }
- else
- dec = raddeg(asin (z));
- }
-
- /* store the results */
- *xpos = ra;
- *ypos = dec;
- return (0);
-}
-
-
-/* tnxpix -- inverse transform (world to physical) gnomonic projection */
-
-int
-tnxpix (xpos, ypos, wcs, xpix, ypix)
-
-double xpos, ypos; /*i world coordinates (ra, dec) */
-struct WorldCoor *wcs; /*i pointer to WCS descriptor */
-double *xpix, *ypix; /*o physical coordinates (x, y) */
-{
- int ira, idec, niter;
- double ra, dec, cosdec, sindec, cosra, sinra, x, y, phi, theta;
- double s, r, dphi, z, dpi, dhalfpi, twopi, tx;
- double xm, ym, f, fx, fy, g, gx, gy, denom, dx, dy;
- double colatp, coslatp, sinlatp, longp, sphtol;
- double wf_gseval(), wf_gsder();
-
- /* get the axis numbers */
- if (wcs->coorflip) {
- ira = 1;
- idec = 0;
- }
- else {
- ira = 0;
- idec = 1;
- }
-
- /* Compute the transformation from celestial coordinates ra and
- dec to native coordinates phi and theta. this is the spherical
- geometry part of the transformation */
-
- ra = degrad (xpos - wcs->crval[ira]);
- dec = degrad (ypos);
- cosra = cos (ra);
- sinra = sin (ra);
- cosdec = cos (dec);
- sindec = sin (dec);
- colatp = degrad (90.0 - wcs->crval[idec]);
- coslatp = cos (colatp);
- sinlatp = sin (colatp);
- if (wcs->longpole == 999.0)
- longp = degrad (180.0);
- else
- longp = degrad(wcs->longpole);
- dpi = PI;
- dhalfpi = dpi * 0.5;
- twopi = PI + PI;
- sphtol = SPHTOL;
-
- /* Compute phi */
- x = sindec * sinlatp - cosdec * coslatp * cosra;
- if (fabs(x) < sphtol)
- x = -cos (dec + colatp) + cosdec * coslatp * (1.0 - cosra);
- y = -cosdec * sinra;
- if (x != 0.0 || y != 0.0)
- dphi = atan2 (y, x);
- else
- dphi = ra - dpi;
- phi = longp + dphi;
- if (phi > dpi)
- phi = phi - twopi;
- else if (phi < -dpi)
- phi = phi + twopi;
-
- /* Compute theta */
- if (fmod (ra, dpi) == 0.0) {
- theta = dec + cosra * colatp;
- if (theta > dhalfpi)
- theta = dpi - theta;
- if (theta < -dhalfpi)
- theta = -dpi - theta;
- }
- else {
- z = sindec * coslatp + cosdec * sinlatp * cosra;
- if (fabs (z) > 0.99) {
- if (z >= 0.0)
- theta = acos (sqrt(x * x + y * y));
- else
- theta = -acos (sqrt(x * x + y * y));
- }
- else
- theta = asin (z);
- }
-
- /* Compute the transformation from native coordinates phi and theta
- to projected coordinates x and y */
-
- s = sin (theta);
- if (s == 0.0) {
- x = BADCVAL;
- y = BADCVAL;
- }
- else {
- r = wcs->rodeg * cos (theta) / s;
- if (wcs->lngcor == NULL && wcs->latcor == NULL) {
- if (wcs->coorflip) {
- y = r * sin (phi);
- x = -r * cos (phi);
- }
- else {
- x = r * sin (phi);
- y = -r * cos (phi);
- }
- }
- else {
- xm = r * sin (phi);
- ym = -r * cos (phi);
- x = xm;
- y = ym;
- niter = 0;
- while (niter < max_niter) {
- if (wcs->lngcor != NULL) {
- f = x + wf_gseval (wcs->lngcor, x, y) - xm;
- fx = wf_gsder (wcs->lngcor, x, y, 1, 0);
- fx = 1.0 + fx;
- fy = wf_gsder (wcs->lngcor, x, y, 0, 1);
- }
- else {
- f = x - xm;
- fx = 1.0 ;
- fy = 0.0;
- }
- if (wcs->latcor != NULL) {
- g = y + wf_gseval (wcs->latcor, x, y) - ym;
- gx = wf_gsder (wcs->latcor, x, y, 1, 0);
- gy = wf_gsder (wcs->latcor, x, y, 0, 1);
- gy = 1.0 + gy;
- }
- else {
- g = y - ym;
- gx = 0.0 ;
- gy = 1.0;
- }
-
- denom = fx * gy - fy * gx;
- if (denom == 0.0)
- break;
- dx = (-f * gy + g * fy) / denom;
- dy = (-g * fx + f * gx) / denom;
- x = x + dx;
- y = y + dy;
- if (MAX(MAX(fabs(dx),fabs(dy)),MAX(fabs(f),fabs(g))) < 2.80e-8)
- break;
-
- niter = niter + 1;
- }
-
- /* Reverse x and y if axes flipped */
- if (wcs->coorflip) {
- tx = x;
- x = y;
- y = tx;
- }
- }
- }
-
- /* Scale and rotate using CD matrix */
- if (wcs->rotmat) {
- *xpix = x * wcs->dc[0] + y * wcs->dc[1];
- *ypix = x * wcs->dc[2] + y * wcs->dc[3];
- }
-
- else {
-
- /* Correct for rotation */
- if (wcs->rot!=0.0) {
- double cosr = cos (degrad (wcs->rot));
- double sinr = sin (degrad (wcs->rot));
- *xpix = x * cosr + y * sinr;
- *ypix = y * cosr - x * sinr;
- }
- else {
- *xpix = x;
- *ypix = y;
- }
-
- /* Scale using CDELT */
- if (wcs->xinc != 0.)
- *xpix = *xpix / wcs->xinc;
- if (wcs->yinc != 0.)
- *ypix = *ypix / wcs->yinc;
- }
-
- /* Convert to pixels */
- *xpix = *xpix + wcs->xrefpix;
- *ypix = *ypix + wcs->yrefpix;
-
- return (0);
-}
-
-
-/* TNXCLOSE -- free up the distortion surface pointers */
-
-void
-tnxclose (wcs)
-
-struct WorldCoor *wcs; /* pointer to the WCS descriptor */
-
-{
- if (wcs->lngcor != NULL)
- wf_gsclose (wcs->lngcor);
- if (wcs->latcor != NULL)
- wf_gsclose (wcs->latcor);
- return;
-}
-
-/* copyright(c) 1986 association of universities for research in astronomy inc.
- * wfgsurfit.x -- surface fitting package used by wcs function drivers.
- * Translated to C from SPP by Jessica Mink, SAO, May 26, 1998
- *
- * the following routines are used by the experimental function drivers tnx
- * and zpx to decode polynomial fits stored in the image header in the form
- * of a list of parameters and coefficients into surface descriptors in
- * ra / dec or longitude latitude. the polynomial surfaces so encoded consist
- * of corrections to function drivers tan and zpn. the package routines are
- * modelled after the equivalent gsurfit routines and are consistent with them.
- * the routines are:
- *
- * sf = wf_gsopen (wattstr)
- * wf_gsclose (sf)
- *
- * z = wf_gseval (sf, x, y)
- * ncoeff = wf_gscoeff (sf, coeff)
- * zder = wf_gsder (sf, x, y, nxder, nyder)
- *
- * wf_gsopen is used to open a surface fit encoded in a wcs attribute, returning
- * the sf surface fitting descriptor. wf_gsclose should be called later to free
- * the descriptor. wf_gseval is called to evaluate the surface at a point.
- */
-
-
-#define SZ_GSCOEFFBUF 20
-
-/* define the structure elements for the wf_gsrestore task */
-#define TNX_SAVETYPE 0
-#define TNX_SAVEXORDER 1
-#define TNX_SAVEYORDER 2
-#define TNX_SAVEXTERMS 3
-#define TNX_SAVEXMIN 4
-#define TNX_SAVEXMAX 5
-#define TNX_SAVEYMIN 6
-#define TNX_SAVEYMAX 7
-#define TNX_SAVECOEFF 8
-
-
-/* wf_gsopen -- decode the longitude / latitude or ra / dec mwcs attribute
- * and return a gsurfit compatible surface descriptor.
- */
-
-struct IRAFsurface *
-wf_gsopen (astr)
-
-char *astr; /* the input mwcs attribute string */
-
-{
- double dval;
- char *estr;
- int npar, szcoeff;
- double *coeff;
- struct IRAFsurface *gs;
- struct IRAFsurface *wf_gsrestore();
-
- if (astr[1] == 0)
- return (NULL);
-
- gs = NULL;
- npar = 0;
- szcoeff = SZ_GSCOEFFBUF;
- coeff = (double *) malloc (szcoeff * sizeof (double));
-
- estr = astr;
- while (*estr != (char) 0) {
- dval = strtod (astr, &estr);
- if (*estr == '.')
- estr++;
- if (*estr != (char) 0) {
- npar++;
- if (npar >= szcoeff) {
- szcoeff = szcoeff + SZ_GSCOEFFBUF;
- coeff = (double *) realloc (coeff, (szcoeff * sizeof (double)));
- }
- coeff[npar-1] = dval;
- astr = estr;
- while (*astr == ' ') astr++;
- }
- }
-
- gs = wf_gsrestore (coeff);
-
- free (coeff);
-
- if (npar == 0)
- return (NULL);
- else
- return (gs);
-}
-
-
-/* wf_gsclose -- procedure to free the surface descriptor */
-
-static void
-wf_gsclose (sf)
-
-struct IRAFsurface *sf; /* the surface descriptor */
-
-{
- if (sf != NULL) {
- if (sf->xbasis != NULL)
- free (sf->xbasis);
- if (sf->ybasis != NULL)
- free (sf->ybasis);
- if (sf->coeff != NULL)
- free (sf->coeff);
- free (sf);
- }
- return;
-}
-
-
-/* wf_gseval -- procedure to evaluate the fitted surface at a single point.
- * the wf->ncoeff coefficients are stored in the vector pointed to by sf->coeff.
- */
-
-double
-wf_gseval (sf, x, y)
-
-struct IRAFsurface *sf; /* pointer to surface descriptor structure */
-double x; /* x value */
-double y; /* y value */
-{
- double sum, accum;
- int i, ii, k, maxorder, xorder;
-
- /* Calculate the basis functions */
- switch (sf->type) {
- case TNX_CHEBYSHEV:
- wf_gsb1cheb (x, sf->xorder, sf->xmaxmin, sf->xrange, sf->xbasis);
- wf_gsb1cheb (y, sf->yorder, sf->ymaxmin, sf->yrange, sf->ybasis);
- break;
- case TNX_LEGENDRE:
- wf_gsb1leg (x, sf->xorder, sf->xmaxmin, sf->xrange, sf->xbasis);
- wf_gsb1leg (y, sf->yorder, sf->ymaxmin, sf->yrange, sf->ybasis);
- break;
- case TNX_POLYNOMIAL:
- wf_gsb1pol (x, sf->xorder, sf->xbasis);
- wf_gsb1pol (y, sf->yorder, sf->ybasis);
- break;
- default:
- fprintf (stderr,"TNX_GSEVAL: unknown surface type\n");
- return (0.0);
- }
-
- /* Initialize accumulator basis functions */
- sum = 0.0;
-
- /* Loop over y basis functions */
- if (sf->xorder > sf->yorder)
- maxorder = sf->xorder + 1;
- else
- maxorder = sf->yorder + 1;
- xorder = sf->xorder;
- ii = 0;
-
- for (i = 0; i < sf->yorder; i++) {
-
- /* Loop over the x basis functions */
- accum = 0.0;
- for (k = 0; k < xorder; k++) {
- accum = accum + sf->coeff[ii] * sf->xbasis[k];
- ii = ii + 1;
- }
- accum = accum * sf->ybasis[i];
- sum = sum + accum;
-
- /* Elements of the coefficient vector where neither k = 1 or i = 1
- are not calculated if sf->xterms = no. */
- if (sf->xterms == TNX_XNONE)
- xorder = 1;
- else if (sf->xterms == TNX_XHALF) {
- if ((i + 1 + sf->xorder + 1) > maxorder)
- xorder = xorder - 1;
- }
- }
-
- return (sum);
-}
-
-
-/* TNX_GSCOEFF -- procedure to fetch the number and magnitude of the coefficients
- * if the sf->xterms = wf_xbi (yes) then the number of coefficients will be
- * (sf->xorder * sf->yorder); if wf_xterms is wf_xtri then the number
- * of coefficients will be (sf->xorder * sf->yorder - order *
- * (order - 1) / 2) where order is the minimum of the x and yorders; if
- * sf->xterms = TNX_XNONE then the number of coefficients will be
- * (sf->xorder + sf->yorder - 1).
- */
-
-int
-wf_gscoeff (sf, coeff)
-
-struct IRAFsurface *sf; /* pointer to the surface fitting descriptor */
-double *coeff; /* the coefficients of the fit */
-
-{
- int ncoeff; /* the number of coefficients */
- int i;
-
- /* Exctract coefficients from data structure and calculate their number */
- ncoeff = sf->ncoeff;
- for (i = 0; i < ncoeff; i++)
- coeff[i] = sf->coeff[i];
- return (ncoeff);
-}
-
-
-static double *coeff = NULL;
-static int nbcoeff = 0;
-
-/* wf_gsder -- procedure to calculate a new surface which is a derivative of
- * the input surface.
- */
-
-double
-wf_gsder (sf1, x, y, nxd, nyd)
-
-struct IRAFsurface *sf1; /* pointer to the previous surface */
-double x; /* x values */
-double y; /* y values */
-int nxd, nyd; /* order of the derivatives in x and y */
-{
- int nxder, nyder, i, j, k, nbytes;
- int order, maxorder1, maxorder2, nmove1, nmove2;
- struct IRAFsurface *sf2 = 0;
- double *ptr1, *ptr2;
- double zfit, norm;
- double wf_gseval();
-
- if (sf1 == NULL)
- return (0.0);
-
- if (nxd < 0 || nyd < 0) {
- fprintf (stderr, "TNX_GSDER: order of derivatives cannot be < 0\n");
- return (0.0);
- }
-
- if (nxd == 0 && nyd == 0) {
- zfit = wf_gseval (sf1, x, y);
- return (zfit);
- }
-
- /* Allocate space for new surface */
- sf2 = (struct IRAFsurface *) malloc (sizeof (struct IRAFsurface));
-
- /* Check the order of the derivatives */
- nxder = MIN (nxd, sf1->xorder - 1);
- nyder = MIN (nyd, sf1->yorder - 1);
-
- /* Set up new surface */
- sf2->type = sf1->type;
-
- /* Set the derivative surface parameters */
- if (sf2->type == TNX_LEGENDRE ||
- sf2->type == TNX_CHEBYSHEV ||
- sf2->type == TNX_POLYNOMIAL) {
-
- sf2->xterms = sf1->xterms;
-
- /* Find the order of the new surface */
- switch (sf2->xterms) {
- case TNX_XNONE:
- if (nxder > 0 && nyder > 0) {
- sf2->xorder = 1;
- sf2->yorder = 1;
- sf2->ncoeff = 1;
- }
- else if (nxder > 0) {
- sf2->xorder = MAX (1, sf1->xorder - nxder);
- sf2->yorder = 1;
- sf2->ncoeff = sf2->xorder;
- }
- else if (nyder > 0) {
- sf2->xorder = 1;
- sf2->yorder = MAX (1, sf1->yorder - nyder);
- sf2->ncoeff = sf2->yorder;
- }
- break;
-
- case TNX_XHALF:
- maxorder1 = MAX (sf1->xorder+1, sf1->yorder+1);
- order = MAX(1, MIN(maxorder1-1-nyder-nxder,sf1->xorder-nxder));
- sf2->xorder = order;
- order = MAX(1, MIN(maxorder1-1-nyder-nxder,sf1->yorder-nyder));
- sf2->yorder = order;
- order = MIN (sf2->xorder, sf2->yorder);
- sf2->ncoeff = sf2->xorder * sf2->yorder - (order*(order-1)/2);
- break;
-
- default:
- sf2->xorder = MAX (1, sf1->xorder - nxder);
- sf2->yorder = MAX (1, sf1->yorder - nyder);
- sf2->ncoeff = sf2->xorder * sf2->yorder;
- }
-
- /* define the data limits */
- sf2->xrange = sf1->xrange;
- sf2->xmaxmin = sf1->xmaxmin;
- sf2->yrange = sf1->yrange;
- sf2->ymaxmin = sf1->ymaxmin;
- }
-
- else {
- fprintf (stderr, "TNX_GSDER: unknown surface type %d\n", sf2->type);
- return (0.0);
- }
-
- /* Allocate space for coefficients and basis functions */
- nbytes = sf2->ncoeff * sizeof(double);
- sf2->coeff = (double *) malloc (nbytes);
- nbytes = sf2->xorder * sizeof(double);
- sf2->xbasis = (double *) malloc (nbytes);
- nbytes = sf2->yorder * sizeof(double);
- sf2->ybasis = (double *) malloc (nbytes);
-
- /* Get coefficients */
- nbytes = sf1->ncoeff * sizeof(double);
- if (nbytes > nbcoeff) {
- if (nbcoeff > 0)
- coeff = (double *) realloc (coeff, nbytes);
- else
- coeff = (double *) malloc (nbytes);
- nbcoeff = nbytes;
- }
- (void) wf_gscoeff (sf1, coeff);
-
- /* Compute the new coefficients */
- switch (sf2->xterms) {
- case TNX_XFULL:
- ptr2 = sf2->coeff + (sf2->yorder - 1) * sf2->xorder;
- ptr1 = coeff + (sf1->yorder - 1) * sf1->xorder;
- for (i = sf1->yorder - 1; i >= nyder; i--) {
- for (j = i; j >= i-nyder+1; j--) {
- for (k = 0; k < sf2->xorder; k++)
- ptr1[nxder+k] = ptr1[nxder+k] * (double)(j);
- }
- for (j = sf1->xorder; j >= nxder+1; j--) {
- for (k = j; k >= j-nxder+1; k--)
- ptr1[j-1] = ptr1[j-1] * (double)(k - 1);
- }
- for (j = 0; j < sf2->xorder; j++)
- ptr2[j] = ptr1[nxder+j];
- ptr2 = ptr2 - sf2->xorder;
- ptr1 = ptr1 - sf1->xorder;
- }
- break;
-
- case TNX_XHALF:
- maxorder1 = MAX (sf1->xorder + 1, sf1->yorder + 1);
- maxorder2 = MAX (sf2->xorder + 1, sf2->yorder + 1);
- ptr2 = sf2->coeff + sf2->ncoeff;
- ptr1 = coeff + sf1->ncoeff;
- for (i = sf1->yorder; i >= nyder+1; i--) {
- nmove1 = MAX (0, MIN (maxorder1 - i, sf1->xorder));
- nmove2 = MAX (0, MIN (maxorder2 - i + nyder, sf2->xorder));
- ptr1 = ptr1 - nmove1;
- ptr2 = ptr2 - nmove2;
- for (j = i; j > i - nyder + 1; j--) {
- for (k = 0; k < nmove2; k++)
- ptr1[nxder+k] = ptr1[nxder+k] * (double)(j-1);
- }
- for (j = nmove1; j >= nxder+1; j--) {
- for (k = j; k >= j-nxder+1; k--)
- ptr1[j-1] = ptr1[j-1] * (double)(k - 1);
- }
- for (j = 0; j < nmove2; j++)
- ptr2[j] = ptr1[nxder+j];
- }
- break;
-
- default:
- if (nxder > 0 && nyder > 0)
- sf2->coeff[0] = 0.0;
-
- else if (nxder > 0) {
- ptr1 = coeff;
- ptr2 = sf2->coeff + sf2->ncoeff - 1;
- for (j = sf1->xorder; j >= nxder+1; j--) {
- for (k = j; k >= j - nxder + 1; k--)
- ptr1[j-1] = ptr1[j-1] * (double)(k - 1);
- ptr2[0] = ptr1[j-1];
- ptr2 = ptr2 - 1;
- }
- }
-
- else if (nyder > 0) {
- ptr1 = coeff + sf1->ncoeff - 1;
- ptr2 = sf2->coeff;
- for (i = sf1->yorder; i >= nyder + 1; i--) {
- for (j = i; j >= i - nyder + 1; j--)
- *ptr1 = *ptr1 * (double)(j - 1);
- ptr1 = ptr1 - 1;
- }
- for (i = 0; i < sf2->ncoeff; i++)
- ptr2[i] = ptr1[i+1];
- }
- }
-
- /* evaluate the derivatives */
- zfit = wf_gseval (sf2, x, y);
-
- /* normalize */
- if (sf2->type != TNX_POLYNOMIAL) {
- norm = pow (sf2->xrange, (double)nxder) *
- pow (sf2->yrange, (double)nyder);
- zfit = norm * zfit;
- }
-
- /* free the space */
- wf_gsclose (sf2);
-
- return (zfit);
-}
-
-
-/* wf_gsrestore -- procedure to restore the surface fit encoded in the
- image header as a list of double precision parameters and coefficients
- to the surface descriptor for use by the evaluating routines. the
- surface parameters, surface type, xorder (or number of polynomial
- terms in x), yorder (or number of polynomial terms in y), xterms,
- xmin, xmax and ymin and ymax, are stored in the first eight elements
- of the double array fit, followed by the wf->ncoeff surface coefficients.
- */
-
-struct IRAFsurface *
-wf_gsrestore (fit)
-
-double *fit; /* array containing the surface parameters
- and coefficients */
-{
- struct IRAFsurface *sf; /* surface descriptor */
- int surface_type, xorder, yorder, order, i;
- double xmin, xmax, ymin, ymax;
-
- xorder = (int) (fit[TNX_SAVEXORDER] + 0.5);
- if (xorder < 1) {
- fprintf (stderr, "wf_gsrestore: illegal x order %d\n", xorder);
- return (NULL);
- }
-
- yorder = (int) (fit[TNX_SAVEYORDER] + 0.5);
- if (yorder < 1) {
- fprintf (stderr, "wf_gsrestore: illegal y order %d\n", yorder);
- return (NULL);
- }
-
- xmin = fit[TNX_SAVEXMIN];
- xmax = fit[TNX_SAVEXMAX];
- if (xmax <= xmin) {
- fprintf (stderr, "wf_gsrestore: illegal x range %f-%f\n",xmin,xmax);
- return (NULL);
- }
- ymin = fit[TNX_SAVEYMIN];
- ymax = fit[TNX_SAVEYMAX];
- if (ymax <= ymin) {
- fprintf (stderr, "wf_gsrestore: illegal y range %f-%f\n",ymin,ymax);
- return (NULL);
- }
-
- /* Set surface type dependent surface descriptor parameters */
- surface_type = (int) (fit[TNX_SAVETYPE] + 0.5);
-
- if (surface_type == TNX_LEGENDRE ||
- surface_type == TNX_CHEBYSHEV ||
- surface_type == TNX_POLYNOMIAL) {
-
- /* allocate space for the surface descriptor */
- sf = (struct IRAFsurface *) malloc (sizeof (struct IRAFsurface));
- sf->xorder = xorder;
- sf->xrange = 2.0 / (xmax - xmin);
- sf->xmaxmin = - (xmax + xmin) / 2.0;
- sf->yorder = yorder;
- sf->yrange = 2.0 / (ymax - ymin);
- sf->ymaxmin = - (ymax + ymin) / 2.0;
- sf->xterms = fit[TNX_SAVEXTERMS];
- switch (sf->xterms) {
- case TNX_XNONE:
- sf->ncoeff = sf->xorder + sf->yorder - 1;
- break;
- case TNX_XHALF:
- order = MIN (xorder, yorder);
- sf->ncoeff = sf->xorder * sf->yorder - order * (order-1) / 2;
- break;
- case TNX_XFULL:
- sf->ncoeff = sf->xorder * sf->yorder;
- break;
- }
- }
- else {
- fprintf (stderr, "wf_gsrestore: unknown surface type %d\n", surface_type);
- return (NULL);
- }
-
- /* Set remaining curve parameters */
- sf->type = surface_type;
-
- /* Restore coefficient array */
- sf->coeff = (double *) malloc (sf->ncoeff*sizeof (double));
- for (i = 0; i < sf->ncoeff; i++)
- sf->coeff[i] = fit[TNX_SAVECOEFF+i];
-
- /* Allocate space for basis vectors */
- sf->xbasis = (double *) malloc (sf->xorder*sizeof (double));
- sf->ybasis = (double *) malloc (sf->yorder*sizeof (double));
-
- return (sf);
-}
-
-
-/* wf_gsb1pol -- procedure to evaluate all the non-zero polynomial functions
- for a single point and given order. */
-
-static void
-wf_gsb1pol (x, order, basis)
-
-double x; /*i data point */
-int order; /*i order of polynomial, order = 1, constant */
-double *basis; /*o basis functions */
-{
- int i;
-
- basis[0] = 1.0;
- if (order == 1)
- return;
-
- basis[1] = x;
- if (order == 2)
- return;
-
- for (i = 2; i < order; i++)
- basis[i] = x * basis[i-1];
-
- return;
-}
-
-
-/* wf_gsb1leg -- procedure to evaluate all the non-zero legendre functions for
- a single point and given order. */
-
-static void
-wf_gsb1leg (x, order, k1, k2, basis)
-
-double x; /*i data point */
-int order; /*i order of polynomial, order = 1, constant */
-double k1, k2; /*i normalizing constants */
-double *basis; /*o basis functions */
-{
- int i;
- double ri, xnorm;
-
- basis[0] = 1.0;
- if (order == 1)
- return;
-
- xnorm = (x + k1) * k2 ;
- basis[1] = xnorm;
- if (order == 2)
- return;
-
- for (i = 2; i < order; i++) {
- ri = i;
- basis[i] = ((2.0 * ri - 1.0) * xnorm * basis[i-1] -
- (ri - 1.0) * basis[i-2]) / ri;
- }
-
- return;
-}
-
-
-/* wf_gsb1cheb -- procedure to evaluate all the non-zero chebyshev function
- coefficients for a given x and order. */
-
-static void
-wf_gsb1cheb (x, order, k1, k2, basis)
-
-double x; /*i number of data points */
-int order; /*i order of polynomial, 1 is a constant */
-double k1, k2; /*i normalizing constants */
-double *basis; /*o array of basis functions */
-{
- int i;
- double xnorm;
-
- basis[0] = 1.0;
- if (order == 1)
- return;
-
- xnorm = (x + k1) * k2;
- basis[1] = xnorm;
- if (order == 2)
- return;
-
- for (i = 2; i < order; i++)
- basis[i] = 2. * xnorm * basis[i-1] - basis[i-2];
-
- return;
-}
-
-/* Set surface polynomial from arguments */
-
-int
-tnxpset (wcs, xorder, yorder, xterms, coeff)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-int xorder; /* Number of x coefficients (same for x and y) */
-int yorder; /* Number of y coefficients (same for x and y) */
-int xterms; /* Number of xy coefficients (same for x and y) */
-double *coeff; /* Plate fit coefficients */
-
-{
- double *ycoeff;
- struct IRAFsurface *wf_gspset ();
-
- wcs->prjcode = WCS_TNX;
-
- wcs->lngcor = wf_gspset (xorder, yorder, xterms, coeff);
- ycoeff = coeff + wcs->lngcor->ncoeff;
- wcs->latcor = wf_gspset (xorder, yorder, xterms, ycoeff);
-
- return 0;
-}
-
-
-/* wf_gspset -- procedure to set the surface descriptor for use by the
- evaluating routines. from arguments. The surface parameters are
- surface type, xorder (number of polynomial terms in x), yorder (number
- of polynomial terms in y), xterms, and the surface coefficients.
- */
-
-struct IRAFsurface *
-wf_gspset (xorder, yorder, xterms, coeff)
-
-int xorder;
-int yorder;
-int xterms;
-double *coeff;
-{
- struct IRAFsurface *sf; /* surface descriptor */
- int surface_type, order, i;
- double xmin, xmax;
- double ymin, ymax;
-
- surface_type = TNX_POLYNOMIAL;
- xmin = 0.0;
- xmax = 0.0;
- ymin = 0.0;
- ymax = 0.0;
-
- if (surface_type == TNX_LEGENDRE ||
- surface_type == TNX_CHEBYSHEV ||
- surface_type == TNX_POLYNOMIAL) {
-
- /* allocate space for the surface descriptor */
- sf = (struct IRAFsurface *) malloc (sizeof (struct IRAFsurface));
- sf->xorder = xorder;
- sf->xrange = 2.0 / (xmax - xmin);
- sf->xmaxmin = -(xmax + xmin) / 2.0;
- sf->yorder = yorder;
- sf->yrange = 2.0 / (ymax - ymin);
- sf->ymaxmin = - (ymax + ymin) / 2.0;
- sf->xterms = xterms;
- switch (sf->xterms) {
- case TNX_XNONE:
- sf->ncoeff = sf->xorder + sf->yorder - 1;
- break;
- case TNX_XHALF:
- order = MIN (xorder, yorder);
- sf->ncoeff = sf->xorder * sf->yorder - order * (order-1) / 2;
- break;
- case TNX_XFULL:
- sf->ncoeff = sf->xorder * sf->yorder;
- break;
- }
- }
- else {
- fprintf (stderr, "TNX_GSSET: unknown surface type %d\n", surface_type);
- return (NULL);
- }
-
- /* Set remaining curve parameters */
- sf->type = surface_type;
-
- /* Restore coefficient array */
- sf->coeff = (double *) malloc (sf->ncoeff*sizeof (double));
- for (i = 0; i < sf->ncoeff; i++)
- sf->coeff[i] = coeff[i];
-
- /* Allocate space for basis vectors */
- sf->xbasis = (double *) malloc (sf->xorder*sizeof (double));
- sf->ybasis = (double *) malloc (sf->yorder*sizeof (double));
-
- return (sf);
-}
-
-/* Mar 26 1998 New subroutines, translated from SPP
- * Apr 28 1998 Change all local flags to TNX_* and projection flag to WCS_TNX
- * May 11 1998 Fix use of pole longitude default
- * Sep 4 1998 Fix missed assignment in tnxpos from Allen Harris, SAO
- * Sep 10 1998 Fix bugs in tnxpix()
- * Sep 10 1998 Fix missed assignment in tnxpix from Allen Harris, SAO
- *
- * Oct 22 1999 Drop unused variables, fix case statements after lint
- * Dec 10 1999 Fix bug in gsder() which failed to allocate enough memory
- * Dec 10 1999 Compute wcs->rot using wcsrotset() in tnxinit()
- *
- * Feb 14 2001 Fixed off-by-one bug in legendre evaluation (Mike Jarvis)
- *
- * Apr 11 2002 Fix bug when .-terminated substring in wf_gsopen()
- * Apr 29 2002 Clean up code
- * Jun 26 2002 Increase size of WAT strings from 500 to 2000
- *
- * Jun 27 2005 Drop unused arguments k1 and k2 from wf_gsb1pol()
- *
- * Jan 8 2007 Drop unused variable ncoeff in wf_gsder()
- * Jan 9 2007 Declare header const char in tnxinit()
- * Apr 3 2007 Fix offsets to hit last cooefficient in wf_gsder()
- *
- * Sep 5 2008 Fix wf_gseval() call in tnxpos() so unmodified x and y are used
- * Sep 9 2008 Fix loop in TNX_XFULL section of wf_gsder()
- * (last two bugs found by Ed Los)
- * Sep 17 2008 Fix tnxpos for null correction case (fix by Ed Los)
- */
diff --git a/funtools/wcs/wcs.c b/funtools/wcs/wcs.c
deleted file mode 100644
index 32ea3f7..0000000
--- a/funtools/wcs/wcs.c
+++ /dev/null
@@ -1,2994 +0,0 @@
-/*** File libwcs/wcs.c
- *** October 19, 2012
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1994-2012
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: wcs.c (World Coordinate Systems)
- * Purpose: Convert FITS WCS to pixels and vice versa:
- * Subroutine: wcsxinit (cra,cdec,secpix,xrpix,yrpix,nxpix,nypix,rotate,equinox,epoch,proj)
- * sets a WCS structure from arguments
- * Subroutine: wcskinit (nxpix,nypix,ctype1,ctype2,crpix1,crpix2,crval1,crval2,
- cd,cdelt1,cdelt2,crota,equinox,epoch)
- * sets a WCS structure from keyword-based arguments
- * Subroutine: wcsreset (wcs,crpix1,crpix2,crval1,crval2,cdelt1,cdelt2,crota,cd, equinox)
- * resets an existing WCS structure from arguments
- * Subroutine: wcsdeltset (wcs,cdelt1,cdelt2,crota) sets rotation and scaling
- * Subroutine: wcscdset (wcs, cd) sets rotation and scaling from a CD matrix
- * Subroutine: wcspcset (wcs,cdelt1,cdelt2,pc) sets rotation and scaling
- * Subroutine: wcseqset (wcs, equinox) resets an existing WCS structure to new equinox
- * Subroutine: iswcs(wcs) returns 1 if WCS structure is filled, else 0
- * Subroutine: nowcs(wcs) returns 0 if WCS structure is filled, else 1
- * Subroutine: wcscent (wcs) prints the image center and size in WCS units
- * Subroutine: wcssize (wcs, cra, cdec, dra, ddec) returns image center and size
- * Subroutine: wcsfull (wcs, cra, cdec, width, height) returns image center and size
- * Subroutine: wcsrange (wcs, ra1, ra2, dec1, dec2) returns image coordinate limits
-
- * Subroutine: wcsshift (wcs,cra,cdec) resets the center of a WCS structure
- * Subroutine: wcsdist (x1,y1,x2,y2) compute angular distance between ra/dec or lat/long
- * Subroutine: wcsdiff (x1,y1,x2,y2) compute angular distance between ra/dec or lat/long
- * Subroutine: wcscominit (wcs,command) sets up a command format for execution by wcscom
- * Subroutine: wcsoutinit (wcs,coor) sets up the coordinate system used by pix2wcs
- * Subroutine: getwcsout (wcs) returns current output coordinate system used by pix2wcs
- * Subroutine: wcsininit (wcs,coor) sets up the coordinate system used by wcs2pix
- * Subroutine: getwcsin (wcs) returns current input coordinate system used by wcs2pix
- * Subroutine: setwcsdeg(wcs, new) sets WCS output in degrees or hh:mm:ss
- * Subroutine: getradecsys(wcs) returns current coordinate system type
- * Subroutine: wcscom (wcs,file,x,y,wcstr) executes a command using the current world coordinates
- * Subroutine: setwcslin (wcs, mode) sets output string mode for LINEAR
- * Subroutine: pix2wcst (wcs,xpix,ypix,wcstring,lstr) pixels -> sky coordinate string
- * Subroutine: pix2wcs (wcs,xpix,ypix,xpos,ypos) pixel coordinates -> sky coordinates
- * Subroutine: wcsc2pix (wcs,xpos,ypos,coorsys,xpix,ypix,offscl) sky coordinates -> pixel coordinates
- * Subroutine: wcs2pix (wcs,xpos,ypos,xpix,ypix,offscl) sky coordinates -> pixel coordinates
- * Subroutine: wcszin (izpix) sets third dimension for pix2wcs() and pix2wcst()
- * Subroutine: wcszout (wcs) returns third dimension from wcs2pix()
- * Subroutine: setwcsfile (filename) Set file name for error messages
- * Subroutine: setwcserr (errmsg) Set error message
- * Subroutine: wcserr() Print error message
- * Subroutine: setdefwcs (wcsproj) Set flag to choose AIPS or WCSLIB WCS subroutines
- * Subroutine: getdefwcs() Get flag to switch between AIPS and WCSLIB subroutines
- * Subroutine: savewcscoor (wcscoor)
- * Subroutine: getwcscoor() Return preset output default coordinate system
- * Subroutine: savewcscom (i, wcscom) Save specified WCS command
- * Subroutine: setwcscom (wcs) Initialize WCS commands
- * Subroutine: getwcscom (i) Return specified WCS command
- * Subroutine: wcsfree (wcs) Free storage used by WCS structure
- * Subroutine: freewcscom (wcs) Free storage used by WCS commands
- * Subroutine: cpwcs (&header, cwcs)
- */
-
-#include <string.h> /* strstr, NULL */
-#include <stdio.h> /* stderr */
-#include <math.h>
-#include "wcs.h"
-#ifndef VMS
-#include <stdlib.h>
-#endif
-
-static char wcserrmsg[80];
-static char wcsfile[256]={""};
-static void wcslibrot();
-void wcsrotset();
-static int wcsproj0 = 0;
-static int izpix = 0;
-static double zpix = 0.0;
-
-void
-wcsfree (wcs)
-struct WorldCoor *wcs; /* WCS structure */
-{
- if (nowcs (wcs)) {
-
- /* Free WCS structure if allocated but not filled */
- if (wcs)
- free (wcs);
-
- return;
- }
-
- /* Free WCS on which this WCS depends */
- if (wcs->wcs) {
- wcsfree (wcs->wcs);
- wcs->wcs = NULL;
- }
-
- freewcscom (wcs);
- if (wcs->wcsname != NULL)
- free (wcs->wcsname);
- if (wcs->lin.imgpix != NULL)
- free (wcs->lin.imgpix);
- if (wcs->lin.piximg != NULL)
- free (wcs->lin.piximg);
- if (wcs->inv_x != NULL)
- poly_end (wcs->inv_x);
- if (wcs->inv_y != NULL)
- poly_end (wcs->inv_y);
- free (wcs);
- return;
-}
-
-/* Set up a WCS structure from subroutine arguments */
-
-struct WorldCoor *
-wcsxinit (cra,cdec,secpix,xrpix,yrpix,nxpix,nypix,rotate,equinox,epoch,proj)
-
-double cra; /* Center right ascension in degrees */
-double cdec; /* Center declination in degrees */
-double secpix; /* Number of arcseconds per pixel */
-double xrpix; /* Reference pixel X coordinate */
-double yrpix; /* Reference pixel X coordinate */
-int nxpix; /* Number of pixels along x-axis */
-int nypix; /* Number of pixels along y-axis */
-double rotate; /* Rotation angle (clockwise positive) in degrees */
-int equinox; /* Equinox of coordinates, 1950 and 2000 supported */
-double epoch; /* Epoch of coordinates, used for FK4/FK5 conversion
- * no effect if 0 */
-char *proj; /* Projection */
-
-{
- struct WorldCoor *wcs;
- double cdelt1, cdelt2;
-
- wcs = (struct WorldCoor *) calloc (1, sizeof(struct WorldCoor));
-
- /* Set WCSLIB flags so that structures will be reinitialized */
- wcs->cel.flag = 0;
- wcs->lin.flag = 0;
- wcs->wcsl.flag = 0;
-
- /* Image dimensions */
- wcs->naxis = 2;
- wcs->naxes = 2;
- wcs->lin.naxis = 2;
- wcs->nxpix = nxpix;
- wcs->nypix = nypix;
-
- wcs->wcsproj = wcsproj0;
-
- wcs->crpix[0] = xrpix;
- wcs->crpix[1] = yrpix;
- wcs->xrefpix = wcs->crpix[0];
- wcs->yrefpix = wcs->crpix[1];
- wcs->lin.crpix = wcs->crpix;
-
- wcs->crval[0] = cra;
- wcs->crval[1] = cdec;
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- wcs->cel.ref[2] = 999.0;
-
- strcpy (wcs->c1type,"RA");
- strcpy (wcs->c2type,"DEC");
-
-/* Allan Brighton: 28.4.98: for backward compat., remove leading "--" */
- while (proj && *proj == '-')
- proj++;
- strcpy (wcs->ptype,proj);
- strcpy (wcs->ctype[0],"RA---");
- strcpy (wcs->ctype[1],"DEC--");
- strcat (wcs->ctype[0],proj);
- strcat (wcs->ctype[1],proj);
-
- if (wcstype (wcs, wcs->ctype[0], wcs->ctype[1])) {
- wcsfree (wcs);
- return (NULL);
- }
-
- /* Approximate world coordinate system from a known plate scale */
- cdelt1 = -secpix / 3600.0;
- cdelt2 = secpix / 3600.0;
- wcsdeltset (wcs, cdelt1, cdelt2, rotate);
- wcs->lin.cdelt = wcs->cdelt;
- wcs->lin.pc = wcs->pc;
-
- /* Coordinate reference frame and equinox */
- wcs->equinox = (double) equinox;
- if (equinox > 1980)
- strcpy (wcs->radecsys,"FK5");
- else
- strcpy (wcs->radecsys,"FK4");
- if (epoch > 0)
- wcs->epoch = epoch;
- else
- wcs->epoch = 0.0;
- wcs->wcson = 1;
-
- wcs->syswcs = wcscsys (wcs->radecsys);
- wcsoutinit (wcs, wcs->radecsys);
- wcsininit (wcs, wcs->radecsys);
- wcs->eqout = 0.0;
- wcs->printsys = 1;
- wcs->tabsys = 0;
-
- /* Initialize special WCS commands */
- setwcscom (wcs);
-
- return (wcs);
-}
-
-
-/* Set up a WCS structure from subroutine arguments based on FITS keywords */
-
-struct WorldCoor *
-wcskinit (naxis1, naxis2, ctype1, ctype2, crpix1, crpix2, crval1, crval2,
- cd, cdelt1, cdelt2, crota, equinox, epoch)
-
-int naxis1; /* Number of pixels along x-axis */
-int naxis2; /* Number of pixels along y-axis */
-char *ctype1; /* FITS WCS projection for axis 1 */
-char *ctype2; /* FITS WCS projection for axis 2 */
-double crpix1, crpix2; /* Reference pixel coordinates */
-double crval1, crval2; /* Coordinates at reference pixel in degrees */
-double *cd; /* Rotation matrix, used if not NULL */
-double cdelt1, cdelt2; /* scale in degrees/pixel, ignored if cd is not NULL */
-double crota; /* Rotation angle in degrees, ignored if cd is not NULL */
-int equinox; /* Equinox of coordinates, 1950 and 2000 supported */
-double epoch; /* Epoch of coordinates, used for FK4/FK5 conversion
- * no effect if 0 */
-{
- struct WorldCoor *wcs;
-
- wcs = (struct WorldCoor *) calloc (1, sizeof(struct WorldCoor));
-
- /* Set WCSLIB flags so that structures will be reinitialized */
- wcs->cel.flag = 0;
- wcs->lin.flag = 0;
- wcs->wcsl.flag = 0;
-
- /* Image dimensions */
- wcs->naxis = 2;
- wcs->naxes = 2;
- wcs->lin.naxis = 2;
- wcs->nxpix = naxis1;
- wcs->nypix = naxis2;
-
- wcs->wcsproj = wcsproj0;
-
- wcs->crpix[0] = crpix1;
- wcs->crpix[1] = crpix2;
- wcs->xrefpix = wcs->crpix[0];
- wcs->yrefpix = wcs->crpix[1];
- wcs->lin.crpix = wcs->crpix;
-
- if (wcstype (wcs, ctype1, ctype2)) {
- wcsfree (wcs);
- return (NULL);
- }
- if (wcs->latbase == 90)
- crval2 = 90.0 - crval2;
- else if (wcs->latbase == -90)
- crval2 = crval2 - 90.0;
-
- wcs->crval[0] = crval1;
- wcs->crval[1] = crval2;
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- wcs->cel.ref[2] = 999.0;
-
- if (cd != NULL)
- wcscdset (wcs, cd);
-
- else if (cdelt1 != 0.0)
- wcsdeltset (wcs, cdelt1, cdelt2, crota);
-
- else {
- wcsdeltset (wcs, 1.0, 1.0, crota);
- setwcserr ("WCSRESET: setting CDELT to 1");
- }
- wcs->lin.cdelt = wcs->cdelt;
- wcs->lin.pc = wcs->pc;
-
- /* Coordinate reference frame and equinox */
- wcs->equinox = (double) equinox;
- if (equinox > 1980)
- strcpy (wcs->radecsys,"FK5");
- else
- strcpy (wcs->radecsys,"FK4");
- if (epoch > 0)
- wcs->epoch = epoch;
- else
- wcs->epoch = 0.0;
- wcs->wcson = 1;
-
- strcpy (wcs->radecout, wcs->radecsys);
- wcs->syswcs = wcscsys (wcs->radecsys);
- wcsoutinit (wcs, wcs->radecsys);
- wcsininit (wcs, wcs->radecsys);
- wcs->eqout = 0.0;
- wcs->printsys = 1;
- wcs->tabsys = 0;
-
- /* Initialize special WCS commands */
- setwcscom (wcs);
-
- return (wcs);
-}
-
-
-/* Set projection in WCS structure from FITS keyword values */
-
-int
-wcstype (wcs, ctype1, ctype2)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-char *ctype1; /* FITS WCS projection for axis 1 */
-char *ctype2; /* FITS WCS projection for axis 2 */
-
-{
- int i, iproj;
- int nctype = NWCSTYPE;
- char ctypes[NWCSTYPE][4];
- char dtypes[10][4];
-
- /* Initialize projection types */
- strcpy (ctypes[0], "LIN");
- strcpy (ctypes[1], "AZP");
- strcpy (ctypes[2], "SZP");
- strcpy (ctypes[3], "TAN");
- strcpy (ctypes[4], "SIN");
- strcpy (ctypes[5], "STG");
- strcpy (ctypes[6], "ARC");
- strcpy (ctypes[7], "ZPN");
- strcpy (ctypes[8], "ZEA");
- strcpy (ctypes[9], "AIR");
- strcpy (ctypes[10], "CYP");
- strcpy (ctypes[11], "CAR");
- strcpy (ctypes[12], "MER");
- strcpy (ctypes[13], "CEA");
- strcpy (ctypes[14], "COP");
- strcpy (ctypes[15], "COD");
- strcpy (ctypes[16], "COE");
- strcpy (ctypes[17], "COO");
- strcpy (ctypes[18], "BON");
- strcpy (ctypes[19], "PCO");
- strcpy (ctypes[20], "SFL");
- strcpy (ctypes[21], "PAR");
- strcpy (ctypes[22], "AIT");
- strcpy (ctypes[23], "MOL");
- strcpy (ctypes[24], "CSC");
- strcpy (ctypes[25], "QSC");
- strcpy (ctypes[26], "TSC");
- strcpy (ctypes[27], "NCP");
- strcpy (ctypes[28], "GLS");
- strcpy (ctypes[29], "DSS");
- strcpy (ctypes[30], "PLT");
- strcpy (ctypes[31], "TNX");
- strcpy (ctypes[32], "ZPX");
- strcpy (ctypes[33], "TPV");
-
- /* Initialize distortion types */
- strcpy (dtypes[1], "SIP");
-
- if (!strncmp (ctype1, "LONG",4))
- strncpy (ctype1, "XLON",4);
-
- strcpy (wcs->ctype[0], ctype1);
- strcpy (wcs->c1type, ctype1);
- strcpy (wcs->ptype, ctype1);
-
- /* Linear coordinates */
- if (!strncmp (ctype1,"LINEAR",6))
- wcs->prjcode = WCS_LIN;
-
- /* Pixel coordinates */
- else if (!strncmp (ctype1,"PIXEL",6))
- wcs->prjcode = WCS_PIX;
-
- /*Detector pixel coordinates */
- else if (strsrch (ctype1,"DET"))
- wcs->prjcode = WCS_PIX;
-
- /* Set up right ascension, declination, latitude, or longitude */
- else if (ctype1[0] == 'R' || ctype1[0] == 'D' ||
- ctype1[0] == 'A' || ctype1[1] == 'L') {
- wcs->c1type[0] = ctype1[0];
- wcs->c1type[1] = ctype1[1];
- if (ctype1[2] == '-') {
- wcs->c1type[2] = 0;
- iproj = 3;
- }
- else {
- wcs->c1type[2] = ctype1[2];
- iproj = 4;
- if (ctype1[3] == '-') {
- wcs->c1type[3] = 0;
- }
- else {
- wcs->c1type[3] = ctype1[3];
- wcs->c1type[4] = 0;
- }
- }
- if (ctype1[iproj] == '-') iproj = iproj + 1;
- if (ctype1[iproj] == '-') iproj = iproj + 1;
- if (ctype1[iproj] == '-') iproj = iproj + 1;
- if (ctype1[iproj] == '-') iproj = iproj + 1;
- wcs->ptype[0] = ctype1[iproj];
- wcs->ptype[1] = ctype1[iproj+1];
- wcs->ptype[2] = ctype1[iproj+2];
- wcs->ptype[3] = 0;
- sprintf (wcs->ctype[0],"%-4s%4s",wcs->c1type,wcs->ptype);
- for (i = 0; i < 8; i++)
- if (wcs->ctype[0][i] == ' ') wcs->ctype[0][i] = '-';
-
- /* Find projection type */
- wcs->prjcode = 0; /* default type is linear */
- for (i = 1; i < nctype; i++) {
- if (!strncmp(wcs->ptype, ctypes[i], 3))
- wcs->prjcode = i;
- }
-
- /* Handle "obsolete" NCP projection (now WCSLIB should be OK)
- if (wcs->prjcode == WCS_NCP) {
- if (wcs->wcsproj == WCS_BEST)
- wcs->wcsproj = WCS_OLD;
- else if (wcs->wcsproj == WCS_ALT)
- wcs->wcsproj = WCS_NEW;
- } */
-
- /* Work around bug in WCSLIB handling of CAR projection
- else if (wcs->prjcode == WCS_CAR) {
- if (wcs->wcsproj == WCS_BEST)
- wcs->wcsproj = WCS_OLD;
- else if (wcs->wcsproj == WCS_ALT)
- wcs->wcsproj = WCS_NEW;
- } */
-
- /* Work around bug in WCSLIB handling of COE projection
- else if (wcs->prjcode == WCS_COE) {
- if (wcs->wcsproj == WCS_BEST)
- wcs->wcsproj = WCS_OLD;
- else if (wcs->wcsproj == WCS_ALT)
- wcs->wcsproj = WCS_NEW;
- }
-
- else if (wcs->wcsproj == WCS_BEST) */
- if (wcs->wcsproj == WCS_BEST)
- wcs->wcsproj = WCS_NEW;
-
- else if (wcs->wcsproj == WCS_ALT)
- wcs->wcsproj = WCS_OLD;
-
- /* if (wcs->wcsproj == WCS_OLD && (
- wcs->prjcode != WCS_STG && wcs->prjcode != WCS_AIT &&
- wcs->prjcode != WCS_MER && wcs->prjcode != WCS_GLS &&
- wcs->prjcode != WCS_ARC && wcs->prjcode != WCS_TAN &&
- wcs->prjcode != WCS_TNX && wcs->prjcode != WCS_SIN &&
- wcs->prjcode != WCS_PIX && wcs->prjcode != WCS_LIN &&
- wcs->prjcode != WCS_CAR && wcs->prjcode != WCS_COE &&
- wcs->prjcode != WCS_NCP && wcs->prjcode != WCS_ZPX))
- wcs->wcsproj = WCS_NEW; */
-
- /* Handle NOAO corrected TNX as uncorrected TAN if oldwcs is set */
- if (wcs->wcsproj == WCS_OLD && wcs->prjcode == WCS_TNX) {
- wcs->ctype[0][6] = 'A';
- wcs->ctype[0][7] = 'N';
- wcs->prjcode = WCS_TAN;
- }
-
- /* Handle NOAO corrected ZPX as uncorrected ZPN if oldwcs is set */
- if (wcs->wcsproj == WCS_OLD && wcs->prjcode == WCS_ZPX) {
- wcs->ctype[0][6] = 'P';
- wcs->ctype[0][7] = 'N';
- wcs->prjcode = WCS_ZPN;
- }
- }
-
- /* If not sky coordinates, assume linear */
- else {
- wcs->prjcode = WCS_LIN;
- return (0);
- }
-
- /* Second coordinate type */
- if (!strncmp (ctype2, "NPOL",4)) {
- ctype2[0] = ctype1[0];
- strncpy (ctype2+1, "LAT",3);
- wcs->latbase = 90;
- strcpy (wcs->radecsys,"NPOLE");
- wcs->syswcs = WCS_NPOLE;
- }
- else if (!strncmp (ctype2, "SPA-",4)) {
- ctype2[0] = ctype1[0];
- strncpy (ctype2+1, "LAT",3);
- wcs->latbase = -90;
- strcpy (wcs->radecsys,"SPA");
- wcs->syswcs = WCS_SPA;
- }
- else
- wcs->latbase = 0;
- strcpy (wcs->ctype[1], ctype2);
- strcpy (wcs->c2type, ctype2);
-
- /* Linear coordinates */
- if (!strncmp (ctype2,"LINEAR",6))
- wcs->prjcode = WCS_LIN;
-
- /* Pixel coordinates */
- else if (!strncmp (ctype2,"PIXEL",6))
- wcs->prjcode = WCS_PIX;
-
- /* Set up right ascension, declination, latitude, or longitude */
- else if (ctype2[0] == 'R' || ctype2[0] == 'D' ||
- ctype2[0] == 'A' || ctype2[1] == 'L') {
- wcs->c2type[0] = ctype2[0];
- wcs->c2type[1] = ctype2[1];
- if (ctype2[2] == '-') {
- wcs->c2type[2] = 0;
- iproj = 3;
- }
- else {
- wcs->c2type[2] = ctype2[2];
- iproj = 4;
- if (ctype2[3] == '-') {
- wcs->c2type[3] = 0;
- }
- else {
- wcs->c2type[3] = ctype2[3];
- wcs->c2type[4] = 0;
- }
- }
- if (ctype2[iproj] == '-') iproj = iproj + 1;
- if (ctype2[iproj] == '-') iproj = iproj + 1;
- if (ctype2[iproj] == '-') iproj = iproj + 1;
- if (ctype2[iproj] == '-') iproj = iproj + 1;
- wcs->ptype[0] = ctype2[iproj];
- wcs->ptype[1] = ctype2[iproj+1];
- wcs->ptype[2] = ctype2[iproj+2];
- wcs->ptype[3] = 0;
-
- if (!strncmp (ctype1, "DEC", 3) ||
- !strncmp (ctype1+1, "LAT", 3))
- wcs->coorflip = 1;
- else
- wcs->coorflip = 0;
- if (ctype2[1] == 'L' || ctype2[0] == 'A') {
- wcs->degout = 1;
- wcs->ndec = 5;
- }
- else {
- wcs->degout = 0;
- wcs->ndec = 3;
- }
- sprintf (wcs->ctype[1],"%-4s%4s",wcs->c2type,wcs->ptype);
- for (i = 0; i < 8; i++)
- if (wcs->ctype[1][i] == ' ') wcs->ctype[1][i] = '-';
- }
-
- /* If not sky coordinates, assume linear */
- else {
- wcs->prjcode = WCS_LIN;
- }
-
- /* Set distortion code from CTYPE1 extension */
- setdistcode (wcs, ctype1);
-
- return (0);
-}
-
-
-int
-wcsreset (wcs, crpix1, crpix2, crval1, crval2, cdelt1, cdelt2, crota, cd)
-
-struct WorldCoor *wcs; /* World coordinate system data structure */
-double crpix1, crpix2; /* Reference pixel coordinates */
-double crval1, crval2; /* Coordinates at reference pixel in degrees */
-double cdelt1, cdelt2; /* scale in degrees/pixel, ignored if cd is not NULL */
-double crota; /* Rotation angle in degrees, ignored if cd is not NULL */
-double *cd; /* Rotation matrix, used if not NULL */
-{
-
- if (nowcs (wcs))
- return (-1);
-
- /* Set WCSLIB flags so that structures will be reinitialized */
- wcs->cel.flag = 0;
- wcs->lin.flag = 0;
- wcs->wcsl.flag = 0;
-
- /* Reference pixel coordinates and WCS value */
- wcs->crpix[0] = crpix1;
- wcs->crpix[1] = crpix2;
- wcs->xrefpix = wcs->crpix[0];
- wcs->yrefpix = wcs->crpix[1];
- wcs->lin.crpix = wcs->crpix;
-
- wcs->crval[0] = crval1;
- wcs->crval[1] = crval2;
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- if (wcs->coorflip) {
- wcs->cel.ref[1] = wcs->crval[0];
- wcs->cel.ref[0] = wcs->crval[1];
- }
- else {
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- }
- /* Keep ref[2] and ref[3] from input */
-
- /* Initialize to no plate fit */
- wcs->ncoeff1 = 0;
- wcs->ncoeff2 = 0;
-
- if (cd != NULL)
- wcscdset (wcs, cd);
-
- else if (cdelt1 != 0.0)
- wcsdeltset (wcs, cdelt1, cdelt2, crota);
-
- else {
- wcs->xinc = 1.0;
- wcs->yinc = 1.0;
- setwcserr ("WCSRESET: setting CDELT to 1");
- }
-
- /* Coordinate reference frame, equinox, and epoch */
- if (!strncmp (wcs->ptype,"LINEAR",6) ||
- !strncmp (wcs->ptype,"PIXEL",5))
- wcs->degout = -1;
-
- wcs->wcson = 1;
- return (0);
-}
-
-void
-wcseqset (wcs, equinox)
-
-struct WorldCoor *wcs; /* World coordinate system data structure */
-double equinox; /* Desired equinox as fractional year */
-{
-
- if (nowcs (wcs))
- return;
-
- /* Leave WCS alone if already at desired equinox */
- if (wcs->equinox == equinox)
- return;
-
- /* Convert center from B1950 (FK4) to J2000 (FK5) */
- if (equinox == 2000.0 && wcs->equinox == 1950.0) {
- if (wcs->coorflip) {
- fk425e (&wcs->crval[1], &wcs->crval[0], wcs->epoch);
- wcs->cel.ref[1] = wcs->crval[0];
- wcs->cel.ref[0] = wcs->crval[1];
- }
- else {
- fk425e (&wcs->crval[0], &wcs->crval[1], wcs->epoch);
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- }
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- wcs->equinox = 2000.0;
- strcpy (wcs->radecsys, "FK5");
- wcs->syswcs = WCS_J2000;
- wcs->cel.flag = 0;
- wcs->wcsl.flag = 0;
- }
-
- /* Convert center from J2000 (FK5) to B1950 (FK4) */
- else if (equinox == 1950.0 && wcs->equinox == 2000.0) {
- if (wcs->coorflip) {
- fk524e (&wcs->crval[1], &wcs->crval[0], wcs->epoch);
- wcs->cel.ref[1] = wcs->crval[0];
- wcs->cel.ref[0] = wcs->crval[1];
- }
- else {
- fk524e (&wcs->crval[0], &wcs->crval[1], wcs->epoch);
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- }
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- wcs->equinox = 1950.0;
- strcpy (wcs->radecsys, "FK4");
- wcs->syswcs = WCS_B1950;
- wcs->cel.flag = 0;
- wcs->wcsl.flag = 0;
- }
- wcsoutinit (wcs, wcs->radecsys);
- wcsininit (wcs, wcs->radecsys);
- return;
-}
-
-
-/* Set scale and rotation in WCS structure */
-
-void
-wcscdset (wcs, cd)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double *cd; /* CD matrix, ignored if NULL */
-{
- double tcd;
-
- if (cd == NULL)
- return;
-
- wcs->rotmat = 1;
- wcs->cd[0] = cd[0];
- wcs->cd[1] = cd[1];
- wcs->cd[2] = cd[2];
- wcs->cd[3] = cd[3];
- (void) matinv (2, wcs->cd, wcs->dc);
-
- /* Compute scale */
- wcs->xinc = sqrt (cd[0]*cd[0] + cd[2]*cd[2]);
- wcs->yinc = sqrt (cd[1]*cd[1] + cd[3]*cd[3]);
-
- /* Deal with x=Dec/y=RA case */
- if (wcs->coorflip) {
- tcd = cd[1];
- cd[1] = -cd[2];
- cd[2] = -tcd;
- }
- wcslibrot (wcs);
- wcs->wcson = 1;
-
- /* Compute image rotation */
- wcsrotset (wcs);
-
- wcs->cdelt[0] = wcs->xinc;
- wcs->cdelt[1] = wcs->yinc;
-
- return;
-}
-
-
-/* Set scale and rotation in WCS structure from axis scale and rotation */
-
-void
-wcsdeltset (wcs, cdelt1, cdelt2, crota)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double cdelt1; /* degrees/pixel in first axis (or both axes) */
-double cdelt2; /* degrees/pixel in second axis if nonzero */
-double crota; /* Rotation counterclockwise in degrees */
-{
- double *pci;
- double crot, srot;
- int i, j, naxes;
-
- naxes = wcs->naxis;
- if (naxes > 2)
- naxes = 2;
- wcs->cdelt[0] = cdelt1;
- if (cdelt2 != 0.0)
- wcs->cdelt[1] = cdelt2;
- else
- wcs->cdelt[1] = cdelt1;
- wcs->xinc = wcs->cdelt[0];
- wcs->yinc = wcs->cdelt[1];
- pci = wcs->pc;
- for (i = 0; i < naxes; i++) {
- for (j = 0; j < naxes; j++) {
- if (i ==j)
- *pci = 1.0;
- else
- *pci = 0.0;
- pci++;
- }
- }
- wcs->rotmat = 0;
-
- /* If image is reversed, value of CROTA is flipped, too */
- wcs->rot = crota;
- if (wcs->rot < 0.0)
- wcs->rot = wcs->rot + 360.0;
- if (wcs->rot >= 360.0)
- wcs->rot = wcs->rot - 360.0;
- crot = cos (degrad(wcs->rot));
- if (cdelt1 * cdelt2 > 0)
- srot = sin (-degrad(wcs->rot));
- else
- srot = sin (degrad(wcs->rot));
-
- /* Set CD matrix */
- wcs->cd[0] = wcs->cdelt[0] * crot;
- if (wcs->cdelt[0] < 0)
- wcs->cd[1] = -fabs (wcs->cdelt[1]) * srot;
- else
- wcs->cd[1] = fabs (wcs->cdelt[1]) * srot;
- if (wcs->cdelt[1] < 0)
- wcs->cd[2] = fabs (wcs->cdelt[0]) * srot;
- else
- wcs->cd[2] = -fabs (wcs->cdelt[0]) * srot;
- wcs->cd[3] = wcs->cdelt[1] * crot;
- (void) matinv (2, wcs->cd, wcs->dc);
-
- /* Set rotation matrix */
- wcslibrot (wcs);
-
- /* Set image rotation and mirroring */
- if (wcs->coorflip) {
- if (wcs->cdelt[0] < 0 && wcs->cdelt[1] > 0) {
- wcs->imflip = 1;
- wcs->imrot = wcs->rot - 90.0;
- if (wcs->imrot < -180.0) wcs->imrot = wcs->imrot + 360.0;
- wcs->pa_north = wcs->rot;
- wcs->pa_east = wcs->rot - 90.0;
- if (wcs->pa_east < -180.0) wcs->pa_east = wcs->pa_east + 360.0;
- }
- else if (wcs->cdelt[0] > 0 && wcs->cdelt[1] < 0) {
- wcs->imflip = 1;
- wcs->imrot = wcs->rot + 90.0;
- if (wcs->imrot > 180.0) wcs->imrot = wcs->imrot - 360.0;
- wcs->pa_north = wcs->rot;
- wcs->pa_east = wcs->rot - 90.0;
- if (wcs->pa_east < -180.0) wcs->pa_east = wcs->pa_east + 360.0;
- }
- else if (wcs->cdelt[0] > 0 && wcs->cdelt[1] > 0) {
- wcs->imflip = 0;
- wcs->imrot = wcs->rot + 90.0;
- if (wcs->imrot > 180.0) wcs->imrot = wcs->imrot - 360.0;
- wcs->pa_north = wcs->imrot;
- wcs->pa_east = wcs->rot + 90.0;
- if (wcs->pa_east > 180.0) wcs->pa_east = wcs->pa_east - 360.0;
- }
- else if (wcs->cdelt[0] < 0 && wcs->cdelt[1] < 0) {
- wcs->imflip = 0;
- wcs->imrot = wcs->rot - 90.0;
- if (wcs->imrot < -180.0) wcs->imrot = wcs->imrot + 360.0;
- wcs->pa_north = wcs->imrot;
- wcs->pa_east = wcs->rot + 90.0;
- if (wcs->pa_east > 180.0) wcs->pa_east = wcs->pa_east - 360.0;
- }
- }
- else {
- if (wcs->cdelt[0] < 0 && wcs->cdelt[1] > 0) {
- wcs->imflip = 0;
- wcs->imrot = wcs->rot;
- wcs->pa_north = wcs->rot + 90.0;
- if (wcs->pa_north > 180.0) wcs->pa_north = wcs->pa_north - 360.0;
- wcs->pa_east = wcs->rot + 180.0;
- if (wcs->pa_east > 180.0) wcs->pa_east = wcs->pa_east - 360.0;
- }
- else if (wcs->cdelt[0] > 0 && wcs->cdelt[1] < 0) {
- wcs->imflip = 0;
- wcs->imrot = wcs->rot + 180.0;
- if (wcs->imrot > 180.0) wcs->imrot = wcs->imrot - 360.0;
- wcs->pa_north = wcs->imrot + 90.0;
- if (wcs->pa_north > 180.0) wcs->pa_north = wcs->pa_north - 360.0;
- wcs->pa_east = wcs->imrot + 180.0;
- if (wcs->pa_east > 180.0) wcs->pa_east = wcs->pa_east - 360.0;
- }
- else if (wcs->cdelt[0] > 0 && wcs->cdelt[1] > 0) {
- wcs->imflip = 1;
- wcs->imrot = -wcs->rot;
- wcs->pa_north = wcs->imrot + 90.0;
- if (wcs->pa_north > 180.0) wcs->pa_north = wcs->pa_north - 360.0;
- wcs->pa_east = wcs->rot;
- }
- else if (wcs->cdelt[0] < 0 && wcs->cdelt[1] < 0) {
- wcs->imflip = 1;
- wcs->imrot = wcs->rot + 180.0;
- if (wcs->imrot > 180.0) wcs->imrot = wcs->imrot - 360.0;
- wcs->pa_north = wcs->imrot + 90.0;
- if (wcs->pa_north > 180.0) wcs->pa_north = wcs->pa_north - 360.0;
- wcs->pa_east = wcs->rot + 90.0;
- if (wcs->pa_east > 180.0) wcs->pa_east = wcs->pa_east - 360.0;
- }
- }
-
- return;
-}
-
-
-/* Set scale and rotation in WCS structure */
-
-void
-wcspcset (wcs, cdelt1, cdelt2, pc)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double cdelt1; /* degrees/pixel in first axis (or both axes) */
-double cdelt2; /* degrees/pixel in second axis if nonzero */
-double *pc; /* Rotation matrix, ignored if NULL */
-{
- double *pci, *pc0i;
- int i, j, naxes;
-
- if (pc == NULL)
- return;
-
- naxes = wcs->naxis;
-/* if (naxes > 2)
- naxes = 2; */
- if (naxes < 1 || naxes > 9) {
- naxes = wcs->naxes;
- wcs->naxis = naxes;
- }
- wcs->cdelt[0] = cdelt1;
- if (cdelt2 != 0.0)
- wcs->cdelt[1] = cdelt2;
- else
- wcs->cdelt[1] = cdelt1;
- wcs->xinc = wcs->cdelt[0];
- wcs->yinc = wcs->cdelt[1];
-
- /* Set rotation matrix */
- pci = wcs->pc;
- pc0i = pc;
- for (i = 0; i < naxes; i++) {
- for (j = 0; j < naxes; j++) {
- *pci = *pc0i;
- pci++;
- pc0i++;
- }
- }
-
- /* Set CD matrix */
- if (naxes > 1) {
- wcs->cd[0] = pc[0] * wcs->cdelt[0];
- wcs->cd[1] = pc[1] * wcs->cdelt[0];
- wcs->cd[2] = pc[naxes] * wcs->cdelt[1];
- wcs->cd[3] = pc[naxes+1] * wcs->cdelt[1];
- }
- else {
- wcs->cd[0] = pc[0] * wcs->cdelt[0];
- wcs->cd[1] = 0.0;
- wcs->cd[2] = 0.0;
- wcs->cd[3] = 1.0;
- }
- (void) matinv (2, wcs->cd, wcs->dc);
- wcs->rotmat = 1;
-
- (void)linset (&wcs->lin);
- wcs->wcson = 1;
-
- wcsrotset (wcs);
-
- return;
-}
-
-
-/* Set up rotation matrix for WCSLIB projection subroutines */
-
-static void
-wcslibrot (wcs)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-
-{
- int i, mem, naxes;
-
- naxes = wcs->naxis;
- if (naxes > 2)
- naxes = 2;
- if (naxes < 1 || naxes > 9) {
- naxes = wcs->naxes;
- wcs->naxis = naxes;
- }
- mem = naxes * naxes * sizeof(double);
- if (wcs->lin.piximg == NULL)
- wcs->lin.piximg = (double*)malloc(mem);
- if (wcs->lin.piximg != NULL) {
- if (wcs->lin.imgpix == NULL)
- wcs->lin.imgpix = (double*)malloc(mem);
- if (wcs->lin.imgpix != NULL) {
- wcs->lin.flag = LINSET;
- if (naxes == 2) {
- for (i = 0; i < 4; i++) {
- wcs->lin.piximg[i] = wcs->cd[i];
- }
- }
- else if (naxes == 3) {
- for (i = 0; i < 9; i++)
- wcs->lin.piximg[i] = 0.0;
- wcs->lin.piximg[0] = wcs->cd[0];
- wcs->lin.piximg[1] = wcs->cd[1];
- wcs->lin.piximg[3] = wcs->cd[2];
- wcs->lin.piximg[4] = wcs->cd[3];
- wcs->lin.piximg[8] = 1.0;
- }
- else if (naxes == 4) {
- for (i = 0; i < 16; i++)
- wcs->lin.piximg[i] = 0.0;
- wcs->lin.piximg[0] = wcs->cd[0];
- wcs->lin.piximg[1] = wcs->cd[1];
- wcs->lin.piximg[4] = wcs->cd[2];
- wcs->lin.piximg[5] = wcs->cd[3];
- wcs->lin.piximg[10] = 1.0;
- wcs->lin.piximg[15] = 1.0;
- }
- (void) matinv (naxes, wcs->lin.piximg, wcs->lin.imgpix);
- wcs->lin.crpix = wcs->crpix;
- wcs->lin.cdelt = wcs->cdelt;
- wcs->lin.pc = wcs->pc;
- wcs->lin.flag = LINSET;
- }
- }
- return;
-}
-
-
-/* Compute image rotation */
-
-void
-wcsrotset (wcs)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-{
- int off;
- double cra, cdec, xc, xn, xe, yc, yn, ye;
-
- /* If image is one-dimensional, leave rotation angle alone */
- if (wcs->nxpix < 1.5 || wcs->nypix < 1.5) {
- wcs->imrot = wcs->rot;
- wcs->pa_north = wcs->rot + 90.0;
- wcs->pa_east = wcs->rot + 180.0;
- return;
- }
-
-
- /* Do not try anything if image is LINEAR (not Cartesian projection) */
- if (wcs->syswcs == WCS_LINEAR)
- return;
-
- wcs->xinc = fabs (wcs->xinc);
- wcs->yinc = fabs (wcs->yinc);
-
- /* Compute position angles of North and East in image */
- xc = wcs->xrefpix;
- yc = wcs->yrefpix;
- pix2wcs (wcs, xc, yc, &cra, &cdec);
- if (wcs->coorflip) {
- wcs2pix (wcs, cra+wcs->yinc, cdec, &xe, &ye, &off);
- wcs2pix (wcs, cra, cdec+wcs->xinc, &xn, &yn, &off);
- }
- else {
- wcs2pix (wcs, cra+wcs->xinc, cdec, &xe, &ye, &off);
- wcs2pix (wcs, cra, cdec+wcs->yinc, &xn, &yn, &off);
- }
- wcs->pa_north = raddeg (atan2 (yn-yc, xn-xc));
- if (wcs->pa_north < -90.0)
- wcs->pa_north = wcs->pa_north + 360.0;
- wcs->pa_east = raddeg (atan2 (ye-yc, xe-xc));
- if (wcs->pa_east < -90.0)
- wcs->pa_east = wcs->pa_east + 360.0;
-
- /* Compute image rotation angle from North */
- if (wcs->pa_north < -90.0)
- wcs->imrot = 270.0 + wcs->pa_north;
- else
- wcs->imrot = wcs->pa_north - 90.0;
-
- /* Compute CROTA */
- if (wcs->coorflip) {
- wcs->rot = wcs->imrot + 90.0;
- if (wcs->rot < 0.0)
- wcs->rot = wcs->rot + 360.0;
- }
- else
- wcs->rot = wcs->imrot;
- if (wcs->rot < 0.0)
- wcs->rot = wcs->rot + 360.0;
- if (wcs->rot >= 360.0)
- wcs->rot = wcs->rot - 360.0;
-
- /* Set image mirror flag based on axis orientation */
- wcs->imflip = 0;
- if (wcs->pa_east - wcs->pa_north < -80.0 &&
- wcs->pa_east - wcs->pa_north > -100.0)
- wcs->imflip = 1;
- if (wcs->pa_east - wcs->pa_north < 280.0 &&
- wcs->pa_east - wcs->pa_north > 260.0)
- wcs->imflip = 1;
- if (wcs->pa_north - wcs->pa_east > 80.0 &&
- wcs->pa_north - wcs->pa_east < 100.0)
- wcs->imflip = 1;
- if (wcs->coorflip) {
- if (wcs->imflip)
- wcs->yinc = -wcs->yinc;
- }
- else {
- if (!wcs->imflip)
- wcs->xinc = -wcs->xinc;
- }
-
- return;
-}
-
-
-/* Return 1 if WCS structure is filled, else 0 */
-
-int
-iswcs (wcs)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-
-{
- if (wcs == NULL)
- return (0);
- else
- return (wcs->wcson);
-}
-
-
-/* Return 0 if WCS structure is filled, else 1 */
-
-int
-nowcs (wcs)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-
-{
- if (wcs == NULL)
- return (1);
- else
- return (!wcs->wcson);
-}
-
-
-/* Reset the center of a WCS structure */
-
-void
-wcsshift (wcs,rra,rdec,coorsys)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double rra; /* Reference pixel right ascension in degrees */
-double rdec; /* Reference pixel declination in degrees */
-char *coorsys; /* FK4 or FK5 coordinates (1950 or 2000) */
-
-{
- if (nowcs (wcs))
- return;
-
-/* Approximate world coordinate system from a known plate scale */
- wcs->crval[0] = rra;
- wcs->crval[1] = rdec;
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
-
-
-/* Coordinate reference frame */
- strcpy (wcs->radecsys,coorsys);
- wcs->syswcs = wcscsys (coorsys);
- if (wcs->syswcs == WCS_B1950)
- wcs->equinox = 1950.0;
- else
- wcs->equinox = 2000.0;
-
- return;
-}
-
-/* Print position of WCS center, if WCS is set */
-
-void
-wcscent (wcs)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-
-{
- double xpix,ypix, xpos1, xpos2, ypos1, ypos2;
- char wcstring[32];
- double width, height, secpix, secpixh, secpixw;
- int lstr = 32;
-
- if (nowcs (wcs))
- (void)fprintf (stderr,"No WCS information available\n");
- else {
- if (wcs->prjcode == WCS_DSS)
- (void)fprintf (stderr,"WCS plate center %s\n", wcs->center);
- xpix = 0.5 * wcs->nxpix;
- ypix = 0.5 * wcs->nypix;
- (void) pix2wcst (wcs,xpix,ypix,wcstring, lstr);
- (void)fprintf (stderr,"WCS center %s %s %s %s at pixel (%.2f,%.2f)\n",
- wcs->ctype[0],wcs->ctype[1],wcstring,wcs->ptype,xpix,ypix);
-
- /* Image width */
- (void) pix2wcs (wcs,1.0,ypix,&xpos1,&ypos1);
- (void) pix2wcs (wcs,wcs->nxpix,ypix,&xpos2,&ypos2);
- if (wcs->syswcs == WCS_LINEAR) {
- width = xpos2 - xpos1;
- if (width < 100.0)
- (void)fprintf (stderr, "WCS width = %.5f %s ",width, wcs->units[0]);
- else
- (void)fprintf (stderr, "WCS width = %.3f %s ",width, wcs->units[0]);
- }
- else {
- width = wcsdist (xpos1,ypos1,xpos2,ypos2);
- if (width < 1/60.0)
- (void)fprintf (stderr, "WCS width = %.2f arcsec ",width*3600.0);
- else if (width < 1.0)
- (void)fprintf (stderr, "WCS width = %.2f arcmin ",width*60.0);
- else
- (void)fprintf (stderr, "WCS width = %.3f degrees ",width);
- }
- secpixw = width / (wcs->nxpix - 1.0);
-
- /* Image height */
- (void) pix2wcs (wcs,xpix,1.0,&xpos1,&ypos1);
- (void) pix2wcs (wcs,xpix,wcs->nypix,&xpos2,&ypos2);
- if (wcs->syswcs == WCS_LINEAR) {
- height = ypos2 - ypos1;
- if (height < 100.0)
- (void)fprintf (stderr, " height = %.5f %s ",height, wcs->units[1]);
- else
- (void)fprintf (stderr, " height = %.3f %s ",height, wcs->units[1]);
- }
- else {
- height = wcsdist (xpos1,ypos1,xpos2,ypos2);
- if (height < 1/60.0)
- (void) fprintf (stderr, " height = %.2f arcsec",height*3600.0);
- else if (height < 1.0)
- (void) fprintf (stderr, " height = %.2f arcmin",height*60.0);
- else
- (void) fprintf (stderr, " height = %.3f degrees",height);
- }
- secpixh = height / (wcs->nypix - 1.0);
-
- /* Image scale */
- if (wcs->syswcs == WCS_LINEAR) {
- (void) fprintf (stderr,"\n");
- (void) fprintf (stderr,"WCS %.5f %s/pixel, %.5f %s/pixel\n",
- wcs->xinc,wcs->units[0],wcs->yinc,wcs->units[1]);
- }
- else {
- if (wcs->xinc != 0.0 && wcs->yinc != 0.0)
- secpix = (fabs(wcs->xinc) + fabs(wcs->yinc)) * 0.5 * 3600.0;
- else if (secpixh > 0.0 && secpixw > 0.0)
- secpix = (secpixw + secpixh) * 0.5 * 3600.0;
- else if (wcs->xinc != 0.0 || wcs->yinc != 0.0)
- secpix = (fabs(wcs->xinc) + fabs(wcs->yinc)) * 3600.0;
- else
- secpix = (secpixw + secpixh) * 3600.0;
- if (secpix < 100.0)
- (void) fprintf (stderr, " %.3f arcsec/pixel\n",secpix);
- else if (secpix < 3600.0)
- (void) fprintf (stderr, " %.3f arcmin/pixel\n",secpix/60.0);
- else
- (void) fprintf (stderr, " %.3f degrees/pixel\n",secpix/3600.0);
- }
- }
- return;
-}
-
-/* Return RA and Dec of image center, plus size in RA and Dec */
-
-void
-wcssize (wcs, cra, cdec, dra, ddec)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double *cra; /* Right ascension of image center (deg) (returned) */
-double *cdec; /* Declination of image center (deg) (returned) */
-double *dra; /* Half-width in right ascension (deg) (returned) */
-double *ddec; /* Half-width in declination (deg) (returned) */
-
-{
- double width, height;
-
- /* Find right ascension and declination of coordinates */
- if (iswcs(wcs)) {
- wcsfull (wcs, cra, cdec, &width, &height);
- *dra = 0.5 * width / cos (degrad (*cdec));
- *ddec = 0.5 * height;
- }
- else {
- *cra = 0.0;
- *cdec = 0.0;
- *dra = 0.0;
- *ddec = 0.0;
- }
- return;
-}
-
-
-/* Return RA and Dec of image center, plus size in degrees */
-
-void
-wcsfull (wcs, cra, cdec, width, height)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double *cra; /* Right ascension of image center (deg) (returned) */
-double *cdec; /* Declination of image center (deg) (returned) */
-double *width; /* Width in degrees (returned) */
-double *height; /* Height in degrees (returned) */
-
-{
- double xpix, ypix, xpos1, xpos2, ypos1, ypos2, xcpix, ycpix;
- double xcent, ycent;
-
- /* Find right ascension and declination of coordinates */
- if (iswcs(wcs)) {
- xcpix = (0.5 * wcs->nxpix) + 0.5;
- ycpix = (0.5 * wcs->nypix) + 0.5;
- (void) pix2wcs (wcs,xcpix,ycpix,&xcent, &ycent);
- *cra = xcent;
- *cdec = ycent;
-
- /* Compute image width in degrees */
- xpix = 0.500001;
- (void) pix2wcs (wcs,xpix,ycpix,&xpos1,&ypos1);
- xpix = wcs->nxpix + 0.499999;
- (void) pix2wcs (wcs,xpix,ycpix,&xpos2,&ypos2);
- if (strncmp (wcs->ptype,"LINEAR",6) &&
- strncmp (wcs->ptype,"PIXEL",5)) {
- *width = wcsdist (xpos1,ypos1,xpos2,ypos2);
- }
- else
- *width = sqrt (((ypos2-ypos1) * (ypos2-ypos1)) +
- ((xpos2-xpos1) * (xpos2-xpos1)));
-
- /* Compute image height in degrees */
- ypix = 0.5;
- (void) pix2wcs (wcs,xcpix,ypix,&xpos1,&ypos1);
- ypix = wcs->nypix + 0.5;
- (void) pix2wcs (wcs,xcpix,ypix,&xpos2,&ypos2);
- if (strncmp (wcs->ptype,"LINEAR",6) &&
- strncmp (wcs->ptype,"PIXEL",5))
- *height = wcsdist (xpos1,ypos1,xpos2,ypos2);
- else
- *height = sqrt (((ypos2-ypos1) * (ypos2-ypos1)) +
- ((xpos2-xpos1) * (xpos2-xpos1)));
- }
-
- else {
- *cra = 0.0;
- *cdec = 0.0;
- *width = 0.0;
- *height = 0.0;
- }
-
- return;
-}
-
-
-/* Return minimum and maximum RA and Dec of image in degrees */
-
-void
-wcsrange (wcs, ra1, ra2, dec1, dec2)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double *ra1; /* Minimum right ascension of image (deg) (returned) */
-double *ra2; /* Maximum right ascension of image (deg) (returned) */
-double *dec1; /* Minimum declination of image (deg) (returned) */
-double *dec2; /* Maximum declination of image (deg) (returned) */
-
-{
- double xpos1, xpos2, xpos3, xpos4, ypos1, ypos2, ypos3, ypos4, temp;
-
- if (iswcs(wcs)) {
-
- /* Compute image corner coordinates in degrees */
- (void) pix2wcs (wcs,1.0,1.0,&xpos1,&ypos1);
- (void) pix2wcs (wcs,1.0,wcs->nypix,&xpos2,&ypos2);
- (void) pix2wcs (wcs,wcs->nxpix,1.0,&xpos3,&ypos3);
- (void) pix2wcs (wcs,wcs->nxpix,wcs->nypix,&xpos4,&ypos4);
-
- /* Find minimum right ascension or longitude */
- *ra1 = xpos1;
- if (xpos2 < *ra1) *ra1 = xpos2;
- if (xpos3 < *ra1) *ra1 = xpos3;
- if (xpos4 < *ra1) *ra1 = xpos4;
-
- /* Find maximum right ascension or longitude */
- *ra2 = xpos1;
- if (xpos2 > *ra2) *ra2 = xpos2;
- if (xpos3 > *ra2) *ra2 = xpos3;
- if (xpos4 > *ra2) *ra2 = xpos4;
-
- if (wcs->syswcs != WCS_LINEAR && wcs->syswcs != WCS_XY) {
- if (*ra2 - *ra1 > 180.0) {
- temp = *ra1;
- *ra1 = *ra2;
- *ra2 = temp;
- }
- }
-
- /* Find minimum declination or latitude */
- *dec1 = ypos1;
- if (ypos2 < *dec1) *dec1 = ypos2;
- if (ypos3 < *dec1) *dec1 = ypos3;
- if (ypos4 < *dec1) *dec1 = ypos4;
-
- /* Find maximum declination or latitude */
- *dec2 = ypos1;
- if (ypos2 > *dec2) *dec2 = ypos2;
- if (ypos3 > *dec2) *dec2 = ypos3;
- if (ypos4 > *dec2) *dec2 = ypos4;
- }
-
- else {
- *ra1 = 0.0;
- *ra2 = 0.0;
- *dec1 = 0.0;
- *dec2 = 0.0;
- }
-
- return;
-}
-
-
-/* Compute distance in degrees between two sky coordinates */
-
-double
-wcsdist (x1,y1,x2,y2)
-
-double x1,y1; /* (RA,Dec) or (Long,Lat) in degrees */
-double x2,y2; /* (RA,Dec) or (Long,Lat) in degrees */
-
-{
- double r, diffi;
- double pos1[3], pos2[3], w, diff;
- int i;
-
- /* Convert two vectors to direction cosines */
- r = 1.0;
- d2v3 (x1, y1, r, pos1);
- d2v3 (x2, y2, r, pos2);
-
- /* Modulus squared of half the difference vector */
- w = 0.0;
- for (i = 0; i < 3; i++) {
- diffi = pos1[i] - pos2[i];
- w = w + (diffi * diffi);
- }
- w = w / 4.0;
- if (w > 1.0) w = 1.0;
-
- /* Angle beween the vectors */
- diff = 2.0 * atan2 (sqrt (w), sqrt (1.0 - w));
- diff = raddeg (diff);
- return (diff);
-}
-
-
-
-/* Compute distance in degrees between two sky coordinates */
-
-double
-wcsdist1 (x1,y1,x2,y2)
-
-double x1,y1; /* (RA,Dec) or (Long,Lat) in degrees */
-double x2,y2; /* (RA,Dec) or (Long,Lat) in degrees */
-
-{
- double d1, d2, r;
- double pos1[3], pos2[3], w, diff;
- int i;
-
- /* Convert two vectors to direction cosines */
- r = 1.0;
- d2v3 (x1, y1, r, pos1);
- d2v3 (x2, y2, r, pos2);
-
- w = 0.0;
- d1 = 0.0;
- d2 = 0.0;
- for (i = 0; i < 3; i++) {
- w = w + (pos1[i] * pos2[i]);
- d1 = d1 + (pos1[i] * pos1[i]);
- d2 = d2 + (pos2[i] * pos2[i]);
- }
- diff = acosdeg (w / (sqrt (d1) * sqrt (d2)));
- return (diff);
-}
-
-
-/* Compute distance in degrees between two sky coordinates away from pole */
-
-double
-wcsdiff (x1,y1,x2,y2)
-
-double x1,y1; /* (RA,Dec) or (Long,Lat) in degrees */
-double x2,y2; /* (RA,Dec) or (Long,Lat) in degrees */
-
-{
- double xdiff, ydiff, ycos, diff;
-
- ycos = cos (degrad ((y2 + y1) / 2.0));
- xdiff = x2 - x1;
- if (xdiff > 180.0)
- xdiff = xdiff - 360.0;
- if (xdiff < -180.0)
- xdiff = xdiff + 360.0;
- xdiff = xdiff / ycos;
- ydiff = (y2 - y1);
- diff = sqrt ((xdiff * xdiff) + (ydiff * ydiff));
- return (diff);
-}
-
-
-/* Initialize catalog search command set by -wcscom */
-
-void
-wcscominit (wcs, i, command)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-int i; /* Number of command (0-9) to initialize */
-char *command; /* command with %s where coordinates will go */
-
-{
- int lcom,icom;
-
- if (iswcs(wcs)) {
- lcom = strlen (command);
- if (lcom > 0) {
- if (wcs->command_format[i] != NULL)
- free (wcs->command_format[i]);
- wcs->command_format[i] = (char *) calloc (lcom+2, 1);
- if (wcs->command_format[i] == NULL)
- return;
- for (icom = 0; icom < lcom; icom++) {
- if (command[icom] == '_')
- wcs->command_format[i][icom] = ' ';
- else
- wcs->command_format[i][icom] = command[icom];
- }
- wcs->command_format[i][lcom] = 0;
- }
- }
- return;
-}
-
-
-/* Execute Unix command with world coordinates (from x,y) and/or filename */
-
-void
-wcscom ( wcs, i, filename, xfile, yfile, wcstring )
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-int i; /* Number of command (0-9) to execute */
-char *filename; /* Image file name */
-double xfile,yfile; /* Image pixel coordinates for WCS command */
-char *wcstring; /* WCS String from pix2wcst() */
-{
- char command[120];
- char comform[120];
- char xystring[32];
- char *fileform, *posform, *imform;
- int ier;
-
- if (nowcs (wcs)) {
- (void)fprintf(stderr,"WCSCOM: no WCS\n");
- return;
- }
-
- if (wcs->command_format[i] != NULL)
- strcpy (comform, wcs->command_format[i]);
- else
- strcpy (comform, "sgsc -ah %s");
-
- if (comform[0] > 0) {
-
- /* Create and execute search command */
- fileform = strsrch (comform,"%f");
- imform = strsrch (comform,"%x");
- posform = strsrch (comform,"%s");
- if (imform != NULL) {
- *(imform+1) = 's';
- (void)sprintf (xystring, "%.2f %.2f", xfile, yfile);
- if (fileform != NULL) {
- *(fileform+1) = 's';
- if (posform == NULL) {
- if (imform < fileform)
- (void)sprintf(command, comform, xystring, filename);
- else
- (void)sprintf(command, comform, filename, xystring);
- }
- else if (fileform < posform) {
- if (imform < fileform)
- (void)sprintf(command, comform, xystring, filename,
- wcstring);
- else if (imform < posform)
- (void)sprintf(command, comform, filename, xystring,
- wcstring);
- else
- (void)sprintf(command, comform, filename, wcstring,
- xystring);
- }
- else
- if (imform < posform)
- (void)sprintf(command, comform, xystring, wcstring,
- filename);
- else if (imform < fileform)
- (void)sprintf(command, comform, wcstring, xystring,
- filename);
- else
- (void)sprintf(command, comform, wcstring, filename,
- xystring);
- }
- else if (posform == NULL)
- (void)sprintf(command, comform, xystring);
- else if (imform < posform)
- (void)sprintf(command, comform, xystring, wcstring);
- else
- (void)sprintf(command, comform, wcstring, xystring);
- }
- else if (fileform != NULL) {
- *(fileform+1) = 's';
- if (posform == NULL)
- (void)sprintf(command, comform, filename);
- else if (fileform < posform)
- (void)sprintf(command, comform, filename, wcstring);
- else
- (void)sprintf(command, comform, wcstring, filename);
- }
- else
- (void)sprintf(command, comform, wcstring);
- ier = system (command);
- if (ier)
- (void)fprintf(stderr,"WCSCOM: %s failed %d\n",command,ier);
- }
- return;
-}
-
-/* Initialize WCS output coordinate system for use by PIX2WCS() */
-
-void
-wcsoutinit (wcs, coorsys)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-char *coorsys; /* Input world coordinate system:
- FK4, FK5, B1950, J2000, GALACTIC, ECLIPTIC
- fk4, fk5, b1950, j2000, galactic, ecliptic */
-{
- int sysout, i;
-
- if (nowcs (wcs))
- return;
-
- /* If argument is null, set to image system and equinox */
- if (coorsys == NULL || strlen (coorsys) < 1 ||
- !strcmp(coorsys,"IMSYS") || !strcmp(coorsys,"imsys")) {
- sysout = wcs->syswcs;
- strcpy (wcs->radecout, wcs->radecsys);
- wcs->eqout = wcs->equinox;
- if (sysout == WCS_B1950) {
- if (wcs->eqout != 1950.0) {
- wcs->radecout[0] = 'B';
- sprintf (wcs->radecout+1,"%.4f", wcs->equinox);
- i = strlen(wcs->radecout) - 1;
- if (wcs->radecout[i] == '0')
- wcs->radecout[i] = (char)0;
- i = strlen(wcs->radecout) - 1;
- if (wcs->radecout[i] == '0')
- wcs->radecout[i] = (char)0;
- i = strlen(wcs->radecout) - 1;
- if (wcs->radecout[i] == '0')
- wcs->radecout[i] = (char)0;
- }
- else
- strcpy (wcs->radecout, "B1950");
- }
- else if (sysout == WCS_J2000) {
- if (wcs->eqout != 2000.0) {
- wcs->radecout[0] = 'J';
- sprintf (wcs->radecout+1,"%.4f", wcs->equinox);
- i = strlen(wcs->radecout) - 1;
- if (wcs->radecout[i] == '0')
- wcs->radecout[i] = (char)0;
- i = strlen(wcs->radecout) - 1;
- if (wcs->radecout[i] == '0')
- wcs->radecout[i] = (char)0;
- i = strlen(wcs->radecout) - 1;
- if (wcs->radecout[i] == '0')
- wcs->radecout[i] = (char)0;
- }
- else
- strcpy (wcs->radecout, "J2000");
- }
- }
-
- /* Ignore new coordinate system if it is not supported */
- else {
- if ((sysout = wcscsys (coorsys)) < 0)
- return;
-
- /* Do not try to convert linear or alt-az coordinates */
- if (sysout != wcs->syswcs &&
- (wcs->syswcs == WCS_LINEAR || wcs->syswcs == WCS_ALTAZ))
- return;
-
- strcpy (wcs->radecout, coorsys);
- wcs->eqout = wcsceq (coorsys);
- }
-
- wcs->sysout = sysout;
- if (wcs->wcson) {
-
- /* Set output in degrees flag and number of decimal places */
- if (wcs->sysout == WCS_GALACTIC || wcs->sysout == WCS_ECLIPTIC ||
- wcs->sysout == WCS_PLANET) {
- wcs->degout = 1;
- wcs->ndec = 5;
- }
- else if (wcs->sysout == WCS_ALTAZ) {
- wcs->degout = 1;
- wcs->ndec = 5;
- }
- else if (wcs->sysout == WCS_NPOLE || wcs->sysout == WCS_SPA) {
- wcs->degout = 1;
- wcs->ndec = 5;
- }
- else {
- wcs->degout = 0;
- wcs->ndec = 3;
- }
- }
- return;
-}
-
-
-/* Return current value of WCS output coordinate system set by -wcsout */
-char *
-getwcsout(wcs)
-struct WorldCoor *wcs; /* World coordinate system structure */
-{
- if (nowcs (wcs))
- return (NULL);
- else
- return(wcs->radecout);
-}
-
-
-/* Initialize WCS input coordinate system for use by WCS2PIX() */
-
-void
-wcsininit (wcs, coorsys)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-char *coorsys; /* Input world coordinate system:
- FK4, FK5, B1950, J2000, GALACTIC, ECLIPTIC
- fk4, fk5, b1950, j2000, galactic, ecliptic */
-{
- int sysin, i;
-
- if (nowcs (wcs))
- return;
-
- /* If argument is null, set to image system and equinox */
- if (coorsys == NULL || strlen (coorsys) < 1) {
- wcs->sysin = wcs->syswcs;
- strcpy (wcs->radecin, wcs->radecsys);
- wcs->eqin = wcs->equinox;
- if (wcs->sysin == WCS_B1950) {
- if (wcs->eqin != 1950.0) {
- wcs->radecin[0] = 'B';
- sprintf (wcs->radecin+1,"%.4f", wcs->equinox);
- i = strlen(wcs->radecin) - 1;
- if (wcs->radecin[i] == '0')
- wcs->radecin[i] = (char)0;
- i = strlen(wcs->radecin) - 1;
- if (wcs->radecin[i] == '0')
- wcs->radecin[i] = (char)0;
- i = strlen(wcs->radecin) - 1;
- if (wcs->radecin[i] == '0')
- wcs->radecin[i] = (char)0;
- }
- else
- strcpy (wcs->radecin, "B1950");
- }
- else if (wcs->sysin == WCS_J2000) {
- if (wcs->eqin != 2000.0) {
- wcs->radecin[0] = 'J';
- sprintf (wcs->radecin+1,"%.4f", wcs->equinox);
- i = strlen(wcs->radecin) - 1;
- if (wcs->radecin[i] == '0')
- wcs->radecin[i] = (char)0;
- i = strlen(wcs->radecin) - 1;
- if (wcs->radecin[i] == '0')
- wcs->radecin[i] = (char)0;
- i = strlen(wcs->radecin) - 1;
- if (wcs->radecin[i] == '0')
- wcs->radecin[i] = (char)0;
- }
- else
- strcpy (wcs->radecin, "J2000");
- }
- }
-
- /* Ignore new coordinate system if it is not supported */
- if ((sysin = wcscsys (coorsys)) < 0)
- return;
-
- wcs->sysin = sysin;
- wcs->eqin = wcsceq (coorsys);
- strcpy (wcs->radecin, coorsys);
- return;
-}
-
-
-/* Return current value of WCS input coordinate system set by wcsininit */
-char *
-getwcsin (wcs)
-struct WorldCoor *wcs; /* World coordinate system structure */
-{
- if (nowcs (wcs))
- return (NULL);
- else
- return (wcs->radecin);
-}
-
-
-/* Set WCS output in degrees or hh:mm:ss dd:mm:ss, returning old flag value */
-int
-setwcsdeg(wcs, new)
-struct WorldCoor *wcs; /* World coordinate system structure */
-int new; /* 1: degrees, 0: h:m:s d:m:s */
-{
- int old;
-
- if (nowcs (wcs))
- return (0);
- old = wcs->degout;
- wcs->degout = new;
- if (new == 1 && old == 0 && wcs->ndec == 3)
- wcs->ndec = 6;
- if (new == 0 && old == 1 && wcs->ndec == 5)
- wcs->ndec = 3;
- return(old);
-}
-
-
-/* Set number of decimal places in pix2wcst output string */
-int
-wcsndec (wcs, ndec)
-struct WorldCoor *wcs; /* World coordinate system structure */
-int ndec; /* Number of decimal places in output string */
- /* If < 0, return current unchanged value */
-{
- if (nowcs (wcs))
- return (0);
- else if (ndec >= 0)
- wcs->ndec = ndec;
- return (wcs->ndec);
-}
-
-
-
-/* Return current value of coordinate system */
-char *
-getradecsys(wcs)
-struct WorldCoor *wcs; /* World coordinate system structure */
-{
- if (nowcs (wcs))
- return (NULL);
- else
- return (wcs->radecsys);
-}
-
-
-/* Set output string mode for LINEAR coordinates */
-
-void
-setwcslin (wcs, mode)
-struct WorldCoor *wcs; /* World coordinate system structure */
-int mode; /* mode = 0: x y linear
- mode = 1: x units x units
- mode = 2: x y linear units */
-{
- if (iswcs (wcs))
- wcs->linmode = mode;
- return;
-}
-
-
-/* Convert pixel coordinates to World Coordinate string */
-
-int
-pix2wcst (wcs, xpix, ypix, wcstring, lstr)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double xpix,ypix; /* Image coordinates in pixels */
-char *wcstring; /* World coordinate string (returned) */
-int lstr; /* Length of world coordinate string (returned) */
-{
- double xpos,ypos;
- char rastr[32], decstr[32];
- int minlength, lunits, lstring;
-
- if (nowcs (wcs)) {
- if (lstr > 0)
- wcstring[0] = 0;
- return(0);
- }
-
- pix2wcs (wcs,xpix,ypix,&xpos,&ypos);
-
- /* If point is off scale, set string accordingly */
- if (wcs->offscl) {
- (void)sprintf (wcstring,"Off map");
- return (1);
- }
-
- /* Print coordinates in degrees */
- else if (wcs->degout == 1) {
- minlength = 9 + (2 * wcs->ndec);
- if (lstr > minlength) {
- deg2str (rastr, 32, xpos, wcs->ndec);
- deg2str (decstr, 32, ypos, wcs->ndec);
- if (wcs->tabsys)
- (void)sprintf (wcstring,"%s %s", rastr, decstr);
- else
- (void)sprintf (wcstring,"%s %s", rastr, decstr);
- lstr = lstr - minlength;
- }
- else {
- if (wcs->tabsys)
- strncpy (wcstring,"********* **********",lstr);
- else
- strncpy (wcstring,"*******************",lstr);
- lstr = 0;
- }
- }
-
- /* print coordinates in sexagesimal notation */
- else if (wcs->degout == 0) {
- minlength = 18 + (2 * wcs->ndec);
- if (lstr > minlength) {
- if (wcs->sysout == WCS_J2000 || wcs->sysout == WCS_B1950) {
- ra2str (rastr, 32, xpos, wcs->ndec);
- dec2str (decstr, 32, ypos, wcs->ndec-1);
- }
- else {
- dec2str (rastr, 32, xpos, wcs->ndec);
- dec2str (decstr, 32, ypos, wcs->ndec);
- }
- if (wcs->tabsys) {
- (void)sprintf (wcstring,"%s %s", rastr, decstr);
- }
- else {
- (void)sprintf (wcstring,"%s %s", rastr, decstr);
- }
- lstr = lstr - minlength;
- }
- else {
- if (wcs->tabsys) {
- strncpy (wcstring,"************* *************",lstr);
- }
- else {
- strncpy (wcstring,"**************************",lstr);
- }
- lstr = 0;
- }
- }
-
- /* Label galactic coordinates */
- if (wcs->sysout == WCS_GALACTIC) {
- if (lstr > 9 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," galactic");
- else
- strcat (wcstring," galactic");
- }
- }
-
- /* Label ecliptic coordinates */
- else if (wcs->sysout == WCS_ECLIPTIC) {
- if (lstr > 9 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," ecliptic");
- else
- strcat (wcstring," ecliptic");
- }
- }
-
- /* Label planet coordinates */
- else if (wcs->sysout == WCS_PLANET) {
- if (lstr > 9 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," planet");
- else
- strcat (wcstring," planet");
- }
- }
-
- /* Label alt-az coordinates */
- else if (wcs->sysout == WCS_ALTAZ) {
- if (lstr > 7 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," alt-az");
- else
- strcat (wcstring," alt-az");
- }
- }
-
- /* Label north pole angle coordinates */
- else if (wcs->sysout == WCS_NPOLE) {
- if (lstr > 7 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," long-npa");
- else
- strcat (wcstring," long-npa");
- }
- }
-
- /* Label south pole angle coordinates */
- else if (wcs->sysout == WCS_SPA) {
- if (lstr > 7 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," long-spa");
- else
- strcat (wcstring," long-spa");
- }
- }
-
- /* Label equatorial coordinates */
- else if (wcs->sysout==WCS_B1950 || wcs->sysout==WCS_J2000) {
- if (lstr > (int) strlen(wcs->radecout)+1 && wcs->printsys) {
- if (wcs->tabsys)
- strcat (wcstring," ");
- else
- strcat (wcstring," ");
- strcat (wcstring, wcs->radecout);
- }
- }
-
- /* Output linear coordinates */
- else {
- num2str (rastr, xpos, 0, wcs->ndec);
- num2str (decstr, ypos, 0, wcs->ndec);
- lstring = strlen (rastr) + strlen (decstr) + 1;
- lunits = strlen (wcs->units[0]) + strlen (wcs->units[1]) + 2;
- if (wcs->syswcs == WCS_LINEAR && wcs->linmode == 1) {
- if (lstr > lstring + lunits) {
- if (strlen (wcs->units[0]) > 0) {
- strcat (rastr, " ");
- strcat (rastr, wcs->units[0]);
- }
- if (strlen (wcs->units[1]) > 0) {
- strcat (decstr, " ");
- strcat (decstr, wcs->units[1]);
- }
- lstring = lstring + lunits;
- }
- }
- if (lstr > lstring) {
- if (wcs->tabsys)
- (void)sprintf (wcstring,"%s %s", rastr, decstr);
- else
- (void)sprintf (wcstring,"%s %s", rastr, decstr);
- }
- else {
- if (wcs->tabsys)
- strncpy (wcstring,"********** *********",lstr);
- else
- strncpy (wcstring,"*******************",lstr);
- }
- if (wcs->syswcs == WCS_LINEAR && wcs->linmode != 1 &&
- lstr > lstring + 7)
- strcat (wcstring, " linear");
- if (wcs->syswcs == WCS_LINEAR && wcs->linmode == 2 &&
- lstr > lstring + lunits + 7) {
- if (strlen (wcs->units[0]) > 0) {
- strcat (wcstring, " ");
- strcat (wcstring, wcs->units[0]);
- }
- if (strlen (wcs->units[1]) > 0) {
- strcat (wcstring, " ");
- strcat (wcstring, wcs->units[1]);
- }
-
- }
- }
- return (1);
-}
-
-
-/* Convert pixel coordinates to World Coordinates */
-
-void
-pix2wcs (wcs,xpix,ypix,xpos,ypos)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double xpix,ypix; /* x and y image coordinates in pixels */
-double *xpos,*ypos; /* RA and Dec in degrees (returned) */
-{
- double xpi, ypi, xp, yp;
- double eqin, eqout;
- int wcspos();
-
- if (nowcs (wcs))
- return;
- wcs->xpix = xpix;
- wcs->ypix = ypix;
- wcs->zpix = zpix;
- wcs->offscl = 0;
-
- /* If this WCS is converted from another WCS rather than pixels, convert now */
- if (wcs->wcs != NULL) {
- pix2wcs (wcs->wcs, xpix, ypix, &xpi, &ypi);
- }
- else {
- pix2foc (wcs, xpix, ypix, &xpi, &ypi);
- }
-
- /* Convert image coordinates to sky coordinates */
-
- /* Use Digitized Sky Survey plate fit */
- if (wcs->prjcode == WCS_DSS) {
- if (dsspos (xpi, ypi, wcs, &xp, &yp))
- wcs->offscl = 1;
- }
-
- /* Use SAO plate fit */
- else if (wcs->prjcode == WCS_PLT) {
- if (platepos (xpi, ypi, wcs, &xp, &yp))
- wcs->offscl = 1;
- }
-
- /* Use NOAO IRAF corrected plane tangent projection */
- else if (wcs->prjcode == WCS_TNX) {
- if (tnxpos (xpi, ypi, wcs, &xp, &yp))
- wcs->offscl = 1;
- }
-
- /* Use NOAO IRAF corrected zenithal projection */
- else if (wcs->prjcode == WCS_ZPX) {
- if (zpxpos (xpi, ypi, wcs, &xp, &yp))
- wcs->offscl = 1;
- }
-
- /* Use Classic AIPS projections */
- else if (wcs->wcsproj == WCS_OLD || wcs->prjcode <= 0) {
- if (worldpos (xpi, ypi, wcs, &xp, &yp))
- wcs->offscl = 1;
- }
-
- /* Use Mark Calabretta's WCSLIB projections */
- else if (wcspos (xpi, ypi, wcs, &xp, &yp))
- wcs->offscl = 1;
-
-
- /* Do not change coordinates if offscale */
- if (wcs->offscl) {
- *xpos = 0.0;
- *ypos = 0.0;
- }
- else {
-
- /* Convert coordinates to output system, if not LINEAR */
- if (wcs->prjcode > 0) {
-
- /* Convert coordinates to desired output system */
- eqin = wcs->equinox;
- eqout = wcs->eqout;
- wcscon (wcs->syswcs,wcs->sysout,eqin,eqout,&xp,&yp,wcs->epoch);
- }
- if (wcs->latbase == 90)
- yp = 90.0 - yp;
- else if (wcs->latbase == -90)
- yp = yp - 90.0;
- wcs->xpos = xp;
- wcs->ypos = yp;
- *xpos = xp;
- *ypos = yp;
- }
-
- /* Keep RA/longitude within range if spherical coordinate output
- (Not LINEAR or XY) */
- if (wcs->sysout > 0 && wcs->sysout != 6 && wcs->sysout != 10) {
- if (*xpos < 0.0)
- *xpos = *xpos + 360.0;
- else if (*xpos > 360.0)
- *xpos = *xpos - 360.0;
- }
-
- return;
-}
-
-
-/* Convert World Coordinates to pixel coordinates */
-
-void
-wcs2pix (wcs, xpos, ypos, xpix, ypix, offscl)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double xpos,ypos; /* World coordinates in degrees */
-double *xpix,*ypix; /* Image coordinates in pixels */
-int *offscl; /* 0 if within bounds, else off scale */
-{
- wcsc2pix (wcs, xpos, ypos, wcs->radecin, xpix, ypix, offscl);
- return;
-}
-
-/* Convert World Coordinates to pixel coordinates */
-
-void
-wcsc2pix (wcs, xpos, ypos, coorsys, xpix, ypix, offscl)
-
-struct WorldCoor *wcs; /* World coordinate system structure */
-double xpos,ypos; /* World coordinates in degrees */
-char *coorsys; /* Input world coordinate system:
- FK4, FK5, B1950, J2000, GALACTIC, ECLIPTIC
- fk4, fk5, b1950, j2000, galactic, ecliptic
- * If NULL, use image WCS */
-double *xpix,*ypix; /* Image coordinates in pixels */
-int *offscl; /* 0 if within bounds, else off scale */
-{
- double xp, yp, xpi, ypi;
- double eqin, eqout;
- int sysin;
- int wcspix();
-
- if (nowcs (wcs))
- return;
-
- *offscl = 0;
- xp = xpos;
- yp = ypos;
- if (wcs->latbase == 90)
- yp = 90.0 - yp;
- else if (wcs->latbase == -90)
- yp = yp - 90.0;
- if (coorsys == NULL) {
- sysin = wcs->syswcs;
- eqin = wcs->equinox;
- }
- else {
- sysin = wcscsys (coorsys);
- eqin = wcsceq (coorsys);
- }
- wcs->zpix = 1.0;
-
- /* Convert coordinates to same system as image */
- if (sysin > 0 && sysin != 6 && sysin != 10) {
- eqout = wcs->equinox;
- wcscon (sysin, wcs->syswcs, eqin, eqout, &xp, &yp, wcs->epoch);
- }
-
- /* Convert sky coordinates to image coordinates */
-
- /* Use Digitized Sky Survey plate fit */
- if (wcs->prjcode == WCS_DSS) {
- if (dsspix (xp, yp, wcs, &xpi, &ypi))
- *offscl = 1;
- }
-
- /* Use SAO polynomial plate fit */
- else if (wcs->prjcode == WCS_PLT) {
- if (platepix (xp, yp, wcs, &xpi, &ypi))
- *offscl = 1;
- }
-
- /* Use NOAO IRAF corrected plane tangent projection */
- else if (wcs->prjcode == WCS_TNX) {
- if (tnxpix (xp, yp, wcs, &xpi, &ypi))
- *offscl = 1;
- }
-
- /* Use NOAO IRAF corrected zenithal projection */
- else if (wcs->prjcode == WCS_ZPX) {
- if (zpxpix (xp, yp, wcs, &xpi, &ypi))
- *offscl = 1;
- }
-
- /* Use Classic AIPS projections */
- else if (wcs->wcsproj == WCS_OLD || wcs->prjcode <= 0) {
- if (worldpix (xp, yp, wcs, &xpi, &ypi))
- *offscl = 1;
- }
-
- /* Use Mark Calabretta's WCSLIB projections */
- else if (wcspix (xp, yp, wcs, &xpi, &ypi)) {
- *offscl = 1;
- }
-
- /* If this WCS is converted from another WCS rather than pixels, convert now */
- if (wcs->wcs != NULL) {
- wcsc2pix (wcs->wcs, xpi, ypi, NULL, xpix, ypix, offscl);
- }
- else {
- foc2pix (wcs, xpi, ypi, xpix, ypix);
-
- /* Set off-scale flag to 2 if off image but within bounds of projection */
- if (!*offscl) {
- if (*xpix < 0.5 || *ypix < 0.5)
- *offscl = 2;
- else if (*xpix > wcs->nxpix + 0.5 || *ypix > wcs->nypix + 0.5)
- *offscl = 2;
- }
- }
-
- wcs->offscl = *offscl;
- wcs->xpos = xpos;
- wcs->ypos = ypos;
- wcs->xpix = *xpix;
- wcs->ypix = *ypix;
-
- return;
-}
-
-
-int
-wcspos (xpix, ypix, wcs, xpos, ypos)
-
-/* Input: */
-double xpix; /* x pixel number (RA or long without rotation) */
-double ypix; /* y pixel number (dec or lat without rotation) */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpos; /* x (RA) coordinate (deg) */
-double *ypos; /* y (dec) coordinate (deg) */
-{
- int offscl;
- int i;
- int wcsrev();
- double wcscrd[4], imgcrd[4], pixcrd[4];
- double phi, theta;
-
- *xpos = 0.0;
- *ypos = 0.0;
-
- pixcrd[0] = xpix;
- pixcrd[1] = ypix;
- if (wcs->prjcode == WCS_CSC || wcs->prjcode == WCS_QSC ||
- wcs->prjcode == WCS_TSC)
- pixcrd[2] = (double) (izpix + 1);
- else
- pixcrd[2] = zpix;
- pixcrd[3] = 1.0;
- for (i = 0; i < 4; i++)
- imgcrd[i] = 0.0;
- offscl = wcsrev ((void *)&wcs->ctype, &wcs->wcsl, pixcrd, &wcs->lin, imgcrd,
- &wcs->prj, &phi, &theta, wcs->crval, &wcs->cel, wcscrd);
- if (offscl == 0) {
- *xpos = wcscrd[wcs->wcsl.lng];
- *ypos = wcscrd[wcs->wcsl.lat];
- }
-
- return (offscl);
-}
-
-int
-wcspix (xpos, ypos, wcs, xpix, ypix)
-
-/* Input: */
-double xpos; /* x (RA) coordinate (deg) */
-double ypos; /* y (dec) coordinate (deg) */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpix; /* x pixel number (RA or long without rotation) */
-double *ypix; /* y pixel number (dec or lat without rotation) */
-
-{
- int offscl;
- int wcsfwd();
- double wcscrd[4], imgcrd[4], pixcrd[4];
- double phi, theta;
-
- *xpix = 0.0;
- *ypix = 0.0;
- if (wcs->wcsl.flag != WCSSET) {
- if (wcsset (wcs->lin.naxis, (void *)&wcs->ctype, &wcs->wcsl) )
- return (1);
- }
-
- /* Set input for WCSLIB subroutines */
- wcscrd[0] = 0.0;
- wcscrd[1] = 0.0;
- wcscrd[2] = 0.0;
- wcscrd[3] = 0.0;
- wcscrd[wcs->wcsl.lng] = xpos;
- wcscrd[wcs->wcsl.lat] = ypos;
-
- /* Initialize output for WCSLIB subroutines */
- pixcrd[0] = 0.0;
- pixcrd[1] = 0.0;
- pixcrd[2] = 1.0;
- pixcrd[3] = 1.0;
- imgcrd[0] = 0.0;
- imgcrd[1] = 0.0;
- imgcrd[2] = 1.0;
- imgcrd[3] = 1.0;
-
- /* Invoke WCSLIB subroutines for coordinate conversion */
- offscl = wcsfwd ((void *)&wcs->ctype, &wcs->wcsl, wcscrd, wcs->crval, &wcs->cel,
- &phi, &theta, &wcs->prj, imgcrd, &wcs->lin, pixcrd);
-
- if (!offscl) {
- *xpix = pixcrd[0];
- *ypix = pixcrd[1];
- if (wcs->prjcode == WCS_CSC || wcs->prjcode == WCS_QSC ||
- wcs->prjcode == WCS_TSC)
- wcs->zpix = pixcrd[2] - 1.0;
- else
- wcs->zpix = pixcrd[2];
- }
- return (offscl);
-}
-
-
-/* Set third dimension for cube projections */
-
-int
-wcszin (izpix0)
-
-int izpix0; /* coordinate in third dimension
- (if < 0, return current value without changing it */
-{
- if (izpix0 > -1) {
- izpix = izpix0;
- zpix = (double) izpix0;
- }
- return (izpix);
-}
-
-
-/* Return third dimension for cube projections */
-
-int
-wcszout (wcs)
-
-struct WorldCoor *wcs; /* WCS parameter structure */
-{
- return ((int) wcs->zpix);
-}
-
-/* Set file name for error messages */
-void
-setwcsfile (filename)
-char *filename; /* FITS or IRAF file with WCS */
-{ if (strlen (filename) < 256)
- strcpy (wcsfile, filename);
- else
- strncpy (wcsfile, filename, 255);
- return; }
-
-/* Set error message */
-void
-setwcserr (errmsg)
-char *errmsg; /* Error mesage < 80 char */
-{ strcpy (wcserrmsg, errmsg); return; }
-
-/* Print error message */
-void
-wcserr ()
-{ if (strlen (wcsfile) > 0)
- fprintf (stderr, "%s in file %s\n",wcserrmsg, wcsfile);
- else
- fprintf (stderr, "%s\n",wcserrmsg);
- return; }
-
-
-/* Flag to use AIPS WCS subroutines instead of WCSLIB */
-void
-setdefwcs (wp)
-int wp;
-{ wcsproj0 = wp; return; }
-
-int
-getdefwcs ()
-{ return (wcsproj0); }
-
-/* Save output default coordinate system */
-static char wcscoor0[16];
-
-void
-savewcscoor (wcscoor)
-char *wcscoor;
-{ strcpy (wcscoor0, wcscoor); return; }
-
-/* Return preset output default coordinate system */
-char *
-getwcscoor ()
-{ return (wcscoor0); }
-
-
-/* Save default commands */
-static char *wcscom0[10];
-
-void
-savewcscom (i, wcscom)
-int i;
-char *wcscom;
-{
- int lcom;
- if (i < 0) i = 0;
- else if (i > 9) i = 9;
- lcom = strlen (wcscom) + 2;
- wcscom0[i] = (char *) calloc (lcom, 1);
- if (wcscom0[i] != NULL)
- strcpy (wcscom0[i], wcscom);
- return;
-}
-
-void
-setwcscom (wcs)
-struct WorldCoor *wcs; /* WCS parameter structure */
-{
- char envar[16];
- int i;
- char *str;
- if (nowcs(wcs))
- return;
- for (i = 0; i < 10; i++) {
- if (i == 0)
- strcpy (envar, "WCS_COMMAND");
- else
- sprintf (envar, "WCS_COMMAND%d", i);
- if (wcscom0[i] != NULL)
- wcscominit (wcs, i, wcscom0[i]);
- else if ((str = getenv (envar)) != NULL)
- wcscominit (wcs, i, str);
- else if (i == 1)
- wcscominit (wcs, i, "sua2 -ah %s"); /* F1= Search USNO-A2.0 Catalog */
- else if (i == 2)
- wcscominit (wcs, i, "sgsc -ah %s"); /* F2= Search HST GSC */
- else if (i == 3)
- wcscominit (wcs, i, "sty2 -ah %s"); /* F3= Search Tycho-2 Catalog */
- else if (i == 4)
- wcscominit (wcs, i, "sppm -ah %s"); /* F4= Search PPM Catalog */
- else if (i == 5)
- wcscominit (wcs, i, "ssao -ah %s"); /* F5= Search SAO Catalog */
- else
- wcs->command_format[i] = NULL;
- }
- return;
-}
-
-char *
-getwcscom (i)
-int i;
-{ return (wcscom0[i]); }
-
-
-void
-freewcscom (wcs)
-struct WorldCoor *wcs; /* WCS parameter structure */
-{
- int i;
- for (i = 0; i < 10; i++) {
- if (wcscom0[i] != NULL) {
- free (wcscom0[i]);
- wcscom0[i] = NULL;
- }
- }
- if (iswcs (wcs)) {
- for (i = 0; i < 10; i++) {
- if (wcs->command_format[i] != NULL) {
- free (wcs->command_format[i]);
- }
- }
- }
- return;
-}
-
-int
-cpwcs (header, cwcs)
-
-char **header; /* Pointer to start of FITS header */
-char *cwcs; /* Keyword suffix character for output WCS */
-{
- double tnum;
- int dkwd[100];
- int i, maxnkwd, ikwd, nleft, lbuff, lhead, nkwd, nbytes;
- int nkwdw;
- char **kwd;
- char *newhead, *oldhead;
- char kwdc[16], keyword[16];
- char tstr[80];
-
- /* Allocate array of keywords to be transferred */
- maxnkwd = 100;
- kwd = (char **)calloc (maxnkwd, sizeof(char *));
- for (ikwd = 0; ikwd < maxnkwd; ikwd++)
- kwd[ikwd] = (char *) calloc (16, 1);
-
- /* Make list of all possible keywords to be transferred */
- nkwd = 0;
- strcpy (kwd[++nkwd], "EPOCH");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "EQUINOX");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "RADECSYS");
- dkwd[nkwd] = 0;
- strcpy (kwd[++nkwd], "CTYPE1");
- dkwd[nkwd] = 0;
- strcpy (kwd[++nkwd], "CTYPE2");
- dkwd[nkwd] = 0;
- strcpy (kwd[++nkwd], "CRVAL1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CRVAL2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CDELT1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CDELT2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CRPIX1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CRPIX2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CROTA1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CROTA2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CD1_1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CD1_2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CD2_1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "CD2_2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC1_1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC1_2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC2_1");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC2_2");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC001001");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC001002");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC002001");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "PC002002");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "LATPOLE");
- dkwd[nkwd] = 1;
- strcpy (kwd[++nkwd], "LONPOLE");
- dkwd[nkwd] = 1;
- for (i = 1; i < 13; i++) {
- sprintf (keyword,"CO1_%d", i);
- strcpy (kwd[++nkwd], keyword);
- dkwd[nkwd] = 1;
- }
- for (i = 1; i < 13; i++) {
- sprintf (keyword,"CO2_%d", i);
- strcpy (kwd[++nkwd], keyword);
- dkwd[nkwd] = 1;
- }
- for (i = 0; i < 10; i++) {
- sprintf (keyword,"PROJP%d", i);
- strcpy (kwd[++nkwd], keyword);
- dkwd[nkwd] = 1;
- }
- for (i = 0; i < MAXPV; i++) {
- sprintf (keyword,"PV1_%d", i);
- strcpy (kwd[++nkwd], keyword);
- dkwd[nkwd] = 1;
- }
- for (i = 0; i < MAXPV; i++) {
- sprintf (keyword,"PV2_%d", i);
- strcpy (kwd[++nkwd], keyword);
- dkwd[nkwd] = 1;
- }
-
- /* Allocate new header buffer if needed */
- lhead = (ksearch (*header, "END") - *header) + 80;
- lbuff = gethlength (*header);
- nleft = (lbuff - lhead) / 80;
- if (nleft < nkwd) {
- nbytes = lhead + (nkwd * 80) + 400;
- newhead = (char *) calloc (1, nbytes);
- strncpy (newhead, *header, lhead);
- oldhead = *header;
- header = &newhead;
- free (oldhead);
- }
-
- /* Copy keywords to new WCS ID in header */
- nkwdw = 0;
- for (i = 0; i < nkwd; i++) {
- if (dkwd[i]) {
- if (hgetr8 (*header, kwd[i], &tnum)) {
- nkwdw++;
- if (!strncmp (kwd[i], "PC0", 3)) {
- if (!strcmp (kwd[i], "PC001001"))
- strcpy (kwdc, "PC1_1");
- else if (!strcmp (kwd[i], "PC001002"))
- strcpy (kwdc, "PC1_2");
- else if (!strcmp (kwd[i], "PC002001"))
- strcpy (kwdc, "PC2_1");
- else
- strcpy (kwdc, "PC2_2");
- }
- else
- strcpy (kwdc, kwd[i]);
- strncat (kwdc, cwcs, 1);
- (void)hputr8 (*header, kwdc, tnum);
- }
- }
- else {
- if (hgets (*header, kwd[i], 80, tstr)) {
- nkwdw++;
- if (!strncmp (kwd[i], "RADECSYS", 8))
- strcpy (kwdc, "RADECSY");
- else
- strcpy (kwdc, kwd[i]);
- strncat (kwdc, cwcs, 1);
- hputs (*header, kwdc, tstr);
- }
- }
- }
-
- /* Free keyword list array */
- for (ikwd = 0; ikwd < maxnkwd; ikwd++)
- free (kwd[ikwd]);
- free (kwd);
- kwd = NULL;
- return (nkwdw);
-}
-
-
-/* Oct 28 1994 new program
- * Dec 21 1994 Implement CD rotation matrix
- * Dec 22 1994 Allow RA and DEC to be either x,y or y,x
- *
- * Mar 6 1995 Add Digital Sky Survey plate fit
- * May 2 1995 Add prototype of PIX2WCST to WCSCOM
- * May 25 1995 Print leading zero for hours and degrees
- * Jun 21 1995 Add WCS2PIX to get pixels from WCS
- * Jun 21 1995 Read plate scale from FITS header for plate solution
- * Jul 6 1995 Pass WCS structure as argument; malloc it in WCSINIT
- * Jul 6 1995 Check string lengths in PIX2WCST
- * Aug 16 1995 Add galactic coordinate conversion to PIX2WCST
- * Aug 17 1995 Return 0 from iswcs if wcs structure is not yet set
- * Sep 8 1995 Do not include malloc.h if VMS
- * Sep 8 1995 Check for legal WCS before trying anything
- * Sep 8 1995 Do not try to set WCS if missing key keywords
- * Oct 18 1995 Add WCSCENT and WCSDIST to print center and size of image
- * Nov 6 1995 Include stdlib.h instead of malloc.h
- * Dec 6 1995 Fix format statement in PIX2WCST
- * Dec 19 1995 Change MALLOC to CALLOC to initialize array to zeroes
- * Dec 19 1995 Explicitly initialize rotation matrix and yinc
- * Dec 22 1995 If SECPIX is set, use approximate WCS
- * Dec 22 1995 Always print coordinate system
- *
- * Jan 12 1996 Use plane-tangent, not linear, projection if SECPIX is set
- * Jan 12 1996 Add WCSSET to set WCS without an image
- * Feb 15 1996 Replace all calls to HGETC with HGETS
- * Feb 20 1996 Add tab table output from PIX2WCST
- * Apr 2 1996 Convert all equinoxes to B1950 or J2000
- * Apr 26 1996 Get and use image epoch for accurate FK4/FK5 conversions
- * May 16 1996 Clean up internal documentation
- * May 17 1996 Return width in right ascension degrees, not sky degrees
- * May 24 1996 Remove extraneous print command from WCSSIZE
- * May 28 1996 Add NOWCS and WCSSHIFT subroutines
- * Jun 11 1996 Drop unused variables after running lint
- * Jun 12 1996 Set equinox as well as system in WCSSHIFT
- * Jun 14 1996 Make DSS keyword searches more robust
- * Jul 1 1996 Allow for SECPIX1 and SECPIX2 keywords
- * Jul 2 1996 Test for CTYPE1 instead of CRVAL1
- * Jul 5 1996 Declare all subroutines in wcs.h
- * Jul 19 1996 Add subroutine WCSFULL to return real image size
- * Aug 12 1996 Allow systemless coordinates which cannot be converted
- * Aug 15 1996 Allow LINEAR WCS to pass numbers through transparently
- * Aug 15 1996 Add WCSERR to print error message under calling program control
- * Aug 16 1996 Add latitude and longitude as image coordinate types
- * Aug 26 1996 Fix arguments to HLENGTH in WCSNINIT
- * Aug 28 1996 Explicitly set OFFSCL in WCS2PIX if coordinates outside image
- * Sep 3 1996 Return computed pixel values even if they are offscale
- * Sep 6 1996 Allow filename to be passed by WCSCOM
- * Oct 8 1996 Default to 2000 for EQUINOX and EPOCH and FK5 for RADECSYS
- * Oct 8 1996 If EPOCH is 0 and EQUINOX is not set, default to 1950 and FK4
- * Oct 15 1996 Add comparison when testing an assignment
- * Oct 16 1996 Allow PIXEL CTYPE which means WCS is same as image coordinates
- * Oct 21 1996 Add WCS_COMMAND environment variable
- * Oct 25 1996 Add image scale to WCSCENT
- * Oct 30 1996 Fix bugs in WCS2PIX
- * Oct 31 1996 Fix CD matrix rotation angle computation
- * Oct 31 1996 Use inline degree <-> radian conversion functions
- * Nov 1 1996 Add option to change number of decimal places in PIX2WCST
- * Nov 5 1996 Set wcs->crot to 1 if rotation matrix is used
- * Dec 2 1996 Add altitide/azimuth coordinates
- * Dec 13 1996 Fix search format setting from environment
- *
- * Jan 22 1997 Add ifdef for Eric Mandel (SAOtng)
- * Feb 5 1997 Add wcsout for Eric Mandel
- * Mar 20 1997 Drop unused variable STR in WCSCOM
- * May 21 1997 Do not make pixel coordinates mod 360 in PIX2WCST
- * May 22 1997 Add PIXEL prjcode = -1;
- * Jul 11 1997 Get center pixel x and y from header even if no WCS
- * Aug 7 1997 Add NOAO PIXSCALi keywords for default WCS
- * Oct 15 1997 Do not reset reference pixel in WCSSHIFT
- * Oct 20 1997 Set chip rotation
- * Oct 24 1997 Keep longitudes between 0 and 360, not -180 and +180
- * Nov 5 1997 Do no compute crot and srot; they are now computed in worldpos
- * Dec 16 1997 Set rotation and axis increments from CD matrix
- *
- * Jan 6 1998 Deal with J2000 and B1950 as EQUINOX values (from ST)
- * Jan 7 1998 Read INSTRUME and DETECTOR header keywords
- * Jan 7 1998 Fix tab-separated output
- * Jan 9 1998 Precess coordinates if either FITS projection or *DSS plate*
- * Jan 16 1998 Change PTYPE to not include initial hyphen
- * Jan 16 1998 Change WCSSET to WCSXINIT to avoid conflict with Calabretta
- * Jan 23 1998 Change PCODE to PRJCODE to avoid conflict with Calabretta
- * Jan 27 1998 Add LATPOLE and LONGPOLE for Calabretta projections
- * Feb 5 1998 Make cd and dc into vectors; use matinv() to invert cd
- * Feb 5 1998 In wcsoutinit(), check that corsys is a valid pointer
- * Feb 18 1998 Fix bugs for Calabretta projections
- * Feb 19 1998 Add wcs structure access subroutines from Eric Mandel
- * Feb 19 1998 Add wcsreset() to make sure derived values are reset
- * Feb 19 1998 Always set oldwcs to 1 if NCP projection
- * Feb 19 1998 Add subroutine to set oldwcs default
- * Feb 20 1998 Initialize projection types one at a time for SunOS C
- * Feb 23 1998 Add TNX projection from NOAO; treat it as TAN
- * Feb 23 1998 Compute size based on max and min coordinates, not sides
- * Feb 26 1998 Add code to set center pixel if part of detector array
- * Mar 6 1998 Write 8-character values to RADECSYS
- * Mar 9 1998 Add naxis to WCS structure
- * Mar 16 1998 Use separate subroutine for IRAF TNX projection
- * Mar 20 1998 Set PC matrix if more than two axes and it's not in header
- * Mar 20 1998 Reset lin flag in WCSRESET if CDELTn
- * Mar 20 1998 Set CD matrix with CDELTs and CROTA in wcsinit and wcsreset
- * Mar 20 1998 Allow initialization of rotation angle alone
- * Mar 23 1998 Use dsspos() and dsspix() instead of platepos() and platepix()
- * Mar 24 1998 Set up PLT/PLATE plate polynomial fit using platepos() and platepix()
- * Mar 25 1998 Read plate fit coefficients from header in getwcscoeffs()
- * Mar 27 1998 Check for FITS WCS before DSS WCS
- * Mar 27 1998 Compute scale from edges if xinc and yinc not set in wcscent()
- * Apr 6 1998 Change plate coefficient keywords from PLTij to COi_j
- * Apr 6 1998 Read all coefficients in line instead of with subroutine
- * Apr 7 1998 Change amd_i_coeff to i_coeff
- * Apr 8 1998 Add wcseqset to change equinox after wcs has been set
- * Apr 10 1998 Use separate counters for x and y polynomial coefficients
- * Apr 13 1998 Use CD/CDELT+CDROTA if oldwcs is set
- * Apr 14 1998 Use codes instead of strings for various coordinate systems
- * Apr 14 1998 Separate input coordinate conversion from output conversion
- * Apr 14 1998 Use wcscon() for most coordinate conversion
- * Apr 17 1998 Always compute cdelt[]
- * Apr 17 1998 Deal with reversed axis more correctly
- * Apr 17 1998 Compute rotation angle and approximate CDELTn for polynomial
- * Apr 23 1998 Deprecate xref/yref in favor of crval[]
- * Apr 23 1998 Deprecate xrefpix/yrefpix in favor of crpix[]
- * Apr 23 1998 Add LINEAR to coordinate system types
- * Apr 23 1998 Always use AIPS subroutines for LINEAR or PIXEL
- * Apr 24 1998 Format linear coordinates better
- * Apr 28 1998 Change coordinate system flags to WCS_*
- * Apr 28 1998 Change projection flags to WCS_*
- * Apr 28 1998 Add subroutine wcsc2pix for coordinates to pixels with system
- * Apr 28 1998 Add setlinmode() to set output string mode for LINEAR coordinates
- * Apr 30 1998 Fix bug by setting degree flag for lat and long in wcsinit()
- * Apr 30 1998 Allow leading "-"s in projecting in wcsxinit()
- * May 1 1998 Assign new output coordinate system only if legitimate system
- * May 1 1998 Do not allow oldwcs=1 unless allowed projection
- * May 4 1998 Fix bug in units reading for LINEAR coordinates
- * May 6 1998 Initialize to no CD matrix
- * May 6 1998 Use TAN instead of TNX if oldwcs
- * May 12 1998 Set 3rd and 4th coordinates in wcspos()
- * May 12 1998 Return *xpos and *ypos = 0 in pix2wcs() if offscale
- * May 12 1998 Declare undeclared external subroutines after lint
- * May 13 1998 Add equinox conversion to specified output equinox
- * May 13 1998 Set output or input system to image with null argument
- * May 15 1998 Return reference pixel, cdelts, and rotation for DSS
- * May 20 1998 Fix bad bug so setlinmode() is no-op if wcs not set
- * May 20 1998 Fix bug so getwcsout() returns null pointer if wcs not set
- * May 27 1998 Change WCS_LPR back to WCS_LIN; allow CAR in oldwcs
- * May 28 1998 Go back to old WCSFULL, computing height and width from center
- * May 29 1998 Add wcskinit() to initialize WCS from arguments
- * May 29 1998 Add wcstype() to set projection from arguments
- * May 29 1998 Add wcscdset(), and wcsdeltset() to set scale from arguments
- * Jun 1 1998 In wcstype(), reconstruct ctype for WCS structure
- * Jun 11 1998 Split off header-dependent subroutines to wcsinit.c
- * Jun 18 1998 Add wcspcset() for PC matrix initialization
- * Jun 24 1998 Add string lengths to ra2str(), dec2str, and deg2str() calls
- * Jun 25 1998 Use AIPS software for CAR projection
- * Jun 25 1998 Add wcsndec to set number of decimal places in output string
- * Jul 6 1998 Add wcszin() and wcszout() to use third dimension of images
- * Jul 7 1998 Change setlinmode() to setwcslin(); setdegout() to setwcsdeg()
- * Jul 10 1998 Initialize matrices correctly for naxis > 2 in wcs<>set()
- * Jul 16 1998 Initialize coordinates to be returned in wcspos()
- * Jul 17 1998 Link lin structure arrays to wcs structure arrays
- * Jul 20 1998 In wcscdset() compute sign of xinc and yinc from CD1_1, CD 2_2
- * Jul 20 1998 In wcscdset() compute sign of rotation based on CD1_1, CD 1_2
- * Jul 22 1998 Add wcslibrot() to compute lin() rotation matrix
- * Jul 30 1998 Set wcs->naxes and lin.naxis in wcsxinit() and wcskinit()
- * Aug 5 1998 Use old WCS subroutines to deal with COE projection (for ESO)
- * Aug 14 1998 Add option to print image coordinates with wcscom()
- * Aug 14 1998 Add multiple command options to wcscom*()
- * Aug 31 1998 Declare undeclared arguments to wcspcset()
- * Sep 3 1998 Set CD rotation and cdelts from sky axis position angles
- * Sep 16 1998 Add option to use North Polar Angle instead of Latitude
- * Sep 29 1998 Initialize additional WCS commands from the environment
- * Oct 14 1998 Fix bug in wcssize() which didn't divide dra by cos(dec)
- * Nov 12 1998 Fix sign of CROTA when either axis is reflected
- * Dec 2 1998 Fix non-arcsecond scale factors in wcscent()
- * Dec 2 1998 Add PLANET coordinate system to pix2wcst()
-
- * Jan 20 1999 Free lin.imgpix and lin.piximg in wcsfree()
- * Feb 22 1999 Fix bug setting latitude reference value of latbase != 0
- * Feb 22 1999 Fix bug so that quad cube faces are 0-5, not 1-6
- * Mar 16 1999 Always initialize all 4 imgcrds and pixcrds in wcspix()
- * Mar 16 1999 Always return (0,0) from wcs2pix if offscale
- * Apr 7 1999 Add code to put file name in error messages
- * Apr 7 1999 Document utility subroutines at end of file
- * May 6 1999 Fix bug printing height of LINEAR image
- * Jun 16 1999 Add wcsrange() to return image RA and Dec limits
- * Jul 8 1999 Always use FK5 and FK4 instead of J2000 and B1950 in RADECSYS
- * Aug 16 1999 Print dd:mm:ss dd:mm:ss if not J2000 or B1950 output
- * Aug 20 1999 Add WCS string argument to wcscom(); don't compute it there
- * Aug 20 1999 Change F3 WCS command default from Tycho to ACT
- * Oct 15 1999 Free wcs using wcsfree()
- * Oct 21 1999 Drop declarations of unused functions after lint
- * Oct 25 1999 Drop out of wcsfree() if wcs is null pointer
- * Nov 17 1999 Fix bug which caused software to miss NCP projection
- *
- * Jan 24 2000 Default to AIPS for NCP, CAR, and COE proj.; if -z use WCSLIB
- * Feb 24 2000 If coorsys is null in wcsc2pix, wcs->radecin is assumed
- * May 10 2000 In wcstype(), default to WCS_LIN, not error (after Bill Joye)
- * Jun 22 2000 In wcsrotset(), leave rotation angle alone in 1-d image
- * Jul 3 2000 Initialize wcscrd[] to zero in wcspix()
- *
- * Feb 20 2001 Add recursion to wcs2pix() and pix2wcs() for dependent WCS's
- * Mar 20 2001 Add braces to avoid ambiguity in if/else groupings
- * Mar 22 2001 Free WCS structure in wcsfree even if it is not filled
- * Sep 12 2001 Fix bug which omitted tab in pix2wcst() galactic coord output
- *
- * Mar 7 2002 Fix bug which gave wrong pa's and rotation for reflected RA
- * (but correct WCS conversions!)
- * Mar 28 2002 Add SZP projection
- * Apr 3 2002 Synchronize projection types with other subroutines
- * Apr 3 2002 Drop special cases of projections
- * Apr 9 2002 Implement inversion of multiple WCSs in wcsc2pix()
- * Apr 25 2002 Use Tycho-2 catalog instead of ACT in setwcscom()
- * May 13 2002 Free WCSNAME in wcsfree()
- *
- * Mar 31 2003 Add distcode to wcstype()
- * Apr 1 2003 Add calls to foc2pix() in wcs2pix() and pix2foc() in pix2wcs()
- * May 20 2003 Declare argument i in savewcscom()
- * Sep 29 2003 Fix bug to compute width and height correctly in wcsfull()
- * Sep 29 2003 Fix bug to deal with all-sky images orrectly in wcsfull()
- * Oct 1 2003 Rename wcs->naxes to wcs->naxis to match WCSLIB 3.2
- * Nov 3 2003 Set distortion code by calling setdistcode() in wcstype()
- * Dec 3 2003 Add back wcs->naxes for compatibility
- * Dec 3 2003 Add braces in if...else in pix2wcst()
- *
- * Sep 17 2004 If spherical coordinate output, keep 0 < long/RA < 360
- * Sep 17 2004 Fix bug in wcsfull() when wrapping around RA=0:00
- * Nov 1 2004 Keep wcs->rot between 0 and 360
- *
- * Mar 9 2005 Fix bug in wcsrotset() which set rot > 360 to 360
- * Jun 27 2005 Fix ctype in calls to wcs subroutines
- * Jul 21 2005 Fix bug in wcsrange() at RA ~= 0.0
- *
- * Apr 24 2006 Always set inverse CD matrix to 2 dimensions in wcspcset()
- * May 3 2006 (void *) pointers so arguments match type, from Robert Lupton
- * Jun 30 2006 Set only 2-dimensional PC matrix; that is all lin* can deal with
- * Oct 30 2006 In pix2wcs(), do not limit x to between 0 and 360 if XY or LINEAR
- * Oct 30 2006 In wcsc2pix(), do not precess LINEAR or XY coordinates
- * Dec 21 2006 Add cpwcs() to copy WCS keywords to new suffix
- *
- * Jan 4 2007 Fix pointer to header in cpwcs()
- * Jan 5 2007 Drop declarations of wcscon(); it is in wcs.h
- * Jan 9 2006 Drop declarations of fk425e() and fk524e(); moved to wcs.h
- * Jan 9 2006 Drop *pix() and *pos() external declarations; moved to wcs.h
- * Jan 9 2006 Drop matinv() external declaration; it is already in wcslib.h
- * Feb 15 2007 If CTYPEi contains DET, set to WCS_PIX projection
- * Feb 23 2007 Fix bug when checking for "DET" in CTYPEi
- * Apr 2 2007 Fix PC to CD matrix conversion
- * Jul 25 2007 Compute distance between two coordinates using d2v3()
- *
- * Apr 7 2010 In wcstype() set number of WCS projections from NWCSTYPE
- *
- * Mar 11 2011 Add NOAO ZPX projection (Frank Valdes)
- * Mar 14 2011 Delete j<=MAXPV PVi_j parameters (for SCAMP polynomials via Ed Los)
- * Mar 17 2011 Fix WCSDEP bug found by Ed Los
- * May 9 2011 Free WCS structure recursively if WCSDEP is used
- * Sep 1 2011 Add TPV projection type for SCAMP TAN with PVs
- *
- * Oct 19 2012 Drop d1 and d2 from wcsdist(); diffi from wcsdist1()
- * Oct 19 2012 Drop depwcs; it's in main wcs structure
- */
diff --git a/funtools/wcs/wcs.h b/funtools/wcs/wcs.h
deleted file mode 100644
index 1943c8d..0000000
--- a/funtools/wcs/wcs.h
+++ /dev/null
@@ -1,963 +0,0 @@
-/*** File libwcs/wcs.h
- *** September 9, 2011
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1994-2011
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-#ifndef _wcs_h_
-#define _wcs_h_
-
-#include "wcslib.h"
-#include "fitshead.h"
-
-/* SIRTF distortion matrix coefficients */
-#define DISTMAX 10
-struct Distort {
- int a_order; /* max power for the 1st dimension */
- double a[DISTMAX][DISTMAX]; /* coefficient array of 1st dimension */
- int b_order; /* max power for 1st dimension */
- double b[DISTMAX][DISTMAX]; /* coefficient array of 2nd dimension */
- int ap_order; /* max power for the 1st dimension */
- double ap[DISTMAX][DISTMAX]; /* coefficient array of 1st dimension */
- int bp_order; /* max power for 1st dimension */
- double bp[DISTMAX][DISTMAX]; /* coefficient array of 2nd dimension */
-};
-
-struct WorldCoor {
- double xref; /* X reference coordinate value (deg) */
- double yref; /* Y reference coordinate value (deg) */
- double xrefpix; /* X reference pixel */
- double yrefpix; /* Y reference pixel */
- double xinc; /* X coordinate increment (deg) */
- double yinc; /* Y coordinate increment (deg) */
- double rot; /* rotation around axis (deg) (N through E) */
- double cd[4]; /* rotation matrix */
- double dc[4]; /* inverse rotation matrix */
- double equinox; /* Equinox of coordinates default to 1950.0 */
- double epoch; /* Epoch of coordinates default to equinox */
- double nxpix; /* Number of pixels in X-dimension of image */
- double nypix; /* Number of pixels in Y-dimension of image */
- double plate_ra; /* Right ascension of plate center */
- double plate_dec; /* Declination of plate center */
- double plate_scale; /* Plate scale in arcsec/mm */
- double x_pixel_offset; /* X pixel offset of image lower right */
- double y_pixel_offset; /* Y pixel offset of image lower right */
- double x_pixel_size; /* X pixel_size */
- double y_pixel_size; /* Y pixel_size */
- double ppo_coeff[6]; /* pixel to plate coefficients for DSS */
- double x_coeff[20]; /* X coefficients for plate model */
- double y_coeff[20]; /* Y coefficients for plate model */
- double xpix; /* X (RA) coordinate (pixels) */
- double ypix; /* Y (dec) coordinate (pixels) */
- double zpix; /* Z (face) coordinate (pixels) */
- double xpos; /* X (RA) coordinate (deg) */
- double ypos; /* Y (dec) coordinate (deg) */
- double crpix[9]; /* Values of CRPIXn keywords */
- double crval[9]; /* Values of CRVALn keywords */
- double cdelt[9]; /* Values of CDELTn keywords */
- double pc[81]; /* Values of PCiiijjj keywords */
- double projp[10]; /* Constants for various projections */
- int pvfail; /* If non-zero, significant inaccuracy likely to occur in projection */
- double projppv[2*MAXPV]; /* SCAMP constants for the PV coordinates */
- struct poly *inv_x; /* SCAMP projection correction polynom in x */
- struct poly *inv_y; /* SCAMP projection correction polynom in y */
- double longpole; /* Longitude of North Pole in degrees */
- double latpole; /* Latitude of North Pole in degrees */
- double rodeg; /* Radius of the projection generating sphere */
- double imrot; /* Rotation angle of north pole */
- double pa_north; /* Position angle of north (0=horizontal) */
- double pa_east; /* Position angle of east (0=horizontal) */
- double radvel; /* Radial velocity (km/sec away from observer)*/
- double zvel; /* Radial velocity (v/c away from observer)*/
- double zpzd; /* Colat of FIP (degs) */
- double zpr; /* Radius of FIP (degs) */
- int imflip; /* If not 0, image is reflected around axis */
- int prjcode; /* projection code (-1-32) */
- int latbase; /* Latitude base 90 (NPA), 0 (LAT), -90 (SPA) */
- int ncoeff1; /* Number of x-axis plate fit coefficients */
- int ncoeff2; /* Number of y-axis plate fit coefficients */
- int zpnp; /* ZP polynomial order (0-9) */
- int changesys; /* 1 for FK4->FK5, 2 for FK5->FK4 */
- /* 3 for FK4->galactic, 4 for FK5->galactic */
- int printsys; /* 1 to print coordinate system, else 0 */
- int ndec; /* Number of decimal places in PIX2WCST */
- int degout; /* 1 to always print degrees in PIX2WCST */
- int tabsys; /* 1 to put tab between RA & Dec, else 0 */
- int rotmat; /* 0 if CDELT, CROTA; 1 if CD */
- int coorflip; /* 0 if x=RA, y=Dec; 1 if x=Dec, y=RA */
- int offscl; /* 0 if OK, 1 if offscale */
- int wcson; /* 1 if WCS is set, else 0 */
- int naxis; /* Number of axes in image (for WCSLIB 3.0) */
- int naxes; /* Number of axes in image */
- int wcsproj; /* WCS_OLD: AIPS worldpos() and worldpix()
- WCS_NEW: Mark Calabretta's WCSLIB subroutines
- WCS_BEST: WCSLIB for all but CAR,COE,NCP
- WCS_ALT: AIPS for all but CAR,COE,NCP */
- int linmode; /* 0=system only, 1=units, 2=system+units */
- int detector; /* Instrument detector number */
- char instrument[32]; /* Instrument name */
- char ctype[9][9]; /* Values of CTYPEn keywords */
- char c1type[9]; /* 1st coordinate type code:
- RA--, GLON, ELON */
- char c2type[9]; /* 2nd coordinate type code:
- DEC-, GLAT, ELAT */
- char ptype[9]; /* projection type code:
- SIN, TAN, ARC, NCP, GLS, MER, AIT, etc */
- char units[9][32]; /* Units if LINEAR */
- char radecsys[32]; /* Reference frame: FK4, FK4-NO-E, FK5, GAPPT*/
- char radecout[32]; /* Output reference frame: FK4,FK5,GAL,ECL */
- char radecin[32]; /* Input reference frame: FK4,FK5,GAL,ECL */
- double eqin; /* Input equinox (match sysin if 0.0) */
- double eqout; /* Output equinox (match sysout if 0.0) */
- int sysin; /* Input coordinate system code */
- int syswcs; /* WCS coordinate system code */
- int sysout; /* Output coordinate system code */
- /* WCS_B1950, WCS_J2000, WCS_ICRS, WCS_GALACTIC,
- * WCS_ECLIPTIC, WCS_LINEAR, WCS_ALTAZ */
- char center[32]; /* Center coordinates (with frame) */
- struct wcsprm wcsl; /* WCSLIB main projection parameters */
- struct linprm lin; /* WCSLIB image/pixel conversion parameters */
- struct celprm cel; /* WCSLIB projection type */
- struct prjprm prj; /* WCSLIB projection parameters */
- struct IRAFsurface *lngcor; /* RA/longitude correction structure */
- struct IRAFsurface *latcor; /* Dec/latitude correction structure */
- int distcode; /* Distortion code 0=none 1=SIRTF */
- struct Distort distort; /* SIRTF distortion coefficients */
- char *command_format[10]; /* WCS command formats */
- /* where %s is replaced by WCS coordinates */
- /* where %f is replaced by the image filename */
- /* where %x is replaced by image coordinates */
- double ltm[4]; /* Image rotation matrix */
- double ltv[2]; /* Image offset */
- int idpix[2]; /* First pixel to use in image (x, y) */
- int ndpix[2]; /* Number of pixels to use in image (x, y) */
- struct WorldCoor *wcs; /* WCS upon which this WCS depends */
- struct WorldCoor *wcsdep; /* WCS depending on this WCS */
- char *wcsname; /* WCS name (defaults to NULL pointer) */
- char wcschar; /* WCS character (A-Z, null, space) */
- int logwcs; /* 1 if DC-FLAG is set for log wavelength */
-};
-
-/* Projections (1-26 are WCSLIB) (values for wcs->prjcode) */
-#define WCS_PIX -1 /* Pixel WCS */
-#define WCS_LIN 0 /* Linear projection */
-#define WCS_AZP 1 /* Zenithal/Azimuthal Perspective */
-#define WCS_SZP 2 /* Zenithal/Azimuthal Perspective */
-#define WCS_TAN 3 /* Gnomonic = Tangent Plane */
-#define WCS_SIN 4 /* Orthographic/synthesis */
-#define WCS_STG 5 /* Stereographic */
-#define WCS_ARC 6 /* Zenithal/azimuthal equidistant */
-#define WCS_ZPN 7 /* Zenithal/azimuthal PolyNomial */
-#define WCS_ZEA 8 /* Zenithal/azimuthal Equal Area */
-#define WCS_AIR 9 /* Airy */
-#define WCS_CYP 10 /* CYlindrical Perspective */
-#define WCS_CAR 11 /* Cartesian */
-#define WCS_MER 12 /* Mercator */
-#define WCS_CEA 13 /* Cylindrical Equal Area */
-#define WCS_COP 14 /* Conic PerSpective (COP) */
-#define WCS_COD 15 /* COnic equiDistant */
-#define WCS_COE 16 /* COnic Equal area */
-#define WCS_COO 17 /* COnic Orthomorphic */
-#define WCS_BON 18 /* Bonne */
-#define WCS_PCO 19 /* Polyconic */
-#define WCS_SFL 20 /* Sanson-Flamsteed (GLobal Sinusoidal) */
-#define WCS_PAR 21 /* Parabolic */
-#define WCS_AIT 22 /* Hammer-Aitoff */
-#define WCS_MOL 23 /* Mollweide */
-#define WCS_CSC 24 /* COBE quadrilateralized Spherical Cube */
-#define WCS_QSC 25 /* Quadrilateralized Spherical Cube */
-#define WCS_TSC 26 /* Tangential Spherical Cube */
-#define WCS_NCP 27 /* Special case of SIN */
-#define WCS_GLS 28 /* Same as SFL */
-#define WCS_DSS 29 /* Digitized Sky Survey plate solution */
-#define WCS_PLT 30 /* Plate fit polynomials (SAO) */
-#define WCS_TNX 31 /* Gnomonic = Tangent Plane (NOAO with corrections) */
-#define WCS_ZPX 32 /* Gnomonic = Tangent Plane (NOAO with corrections) */
-#define WCS_TPV 33 /* Gnomonic = Tangent Plane (NOAO with corrections) */
-#define NWCSTYPE 34 /* Number of WCS types (-1 really means no WCS) */
-
-/* Coordinate systems */
-#define WCS_J2000 1 /* J2000(FK5) right ascension and declination */
-#define WCS_B1950 2 /* B1950(FK4) right ascension and declination */
-#define WCS_GALACTIC 3 /* Galactic longitude and latitude */
-#define WCS_ECLIPTIC 4 /* Ecliptic longitude and latitude */
-#define WCS_ALTAZ 5 /* Azimuth and altitude/elevation */
-#define WCS_LINEAR 6 /* Linear with optional units */
-#define WCS_NPOLE 7 /* Longitude and north polar angle */
-#define WCS_SPA 8 /* Longitude and south polar angle */
-#define WCS_PLANET 9 /* Longitude and latitude on planet */
-#define WCS_XY 10 /* X-Y Cartesian coordinates */
-#define WCS_ICRS 11 /* ICRS right ascension and declination */
-
-/* Method to use */
-#define WCS_BEST 0 /* Use best WCS projections */
-#define WCS_ALT 1 /* Use not best WCS projections */
-#define WCS_OLD 2 /* Use AIPS WCS projections */
-#define WCS_NEW 3 /* Use WCSLIB 2.5 WCS projections */
-
-/* Distortion codes (values for wcs->distcode) */
-#define DISTORT_NONE 0 /* No distortion coefficients */
-#define DISTORT_SIRTF 1 /* SIRTF distortion matrix */
-
-#ifndef PI
-#define PI 3.141592653589793238462643
-#endif
-
-/* pi/(180*3600): arcseconds to radians */
-#define AS2R 4.8481368110953e-6
-
-/* Conversions among hours of RA, degrees and radians. */
-#define degrad(x) ((x)*PI/180.)
-#define raddeg(x) ((x)*180./PI)
-#define hrdeg(x) ((x)*15.)
-#define deghr(x) ((x)/15.)
-#define hrrad(x) degrad(hrdeg(x))
-#define radhr(x) deghr(raddeg(x))
-#define secrad(x) ((x)*AS2R)
-
-/* TNX/ZPX surface fitting structure and flags */
-struct IRAFsurface {
- double xrange; /* 2. / (xmax - xmin), polynomials */
- double xmaxmin; /* - (xmax + xmin) / 2., polynomials */
- double yrange; /* 2. / (ymax - ymin), polynomials */
- double ymaxmin; /* - (ymax + ymin) / 2., polynomials */
- int type; /* type of curve to be fitted */
- int xorder; /* order of the fit in x */
- int yorder; /* order of the fit in y */
- int xterms; /* cross terms for polynomials */
- int ncoeff; /* total number of coefficients */
- double *coeff; /* pointer to coefficient vector */
- double *xbasis; /* pointer to basis functions (all x) */
- double *ybasis; /* pointer to basis functions (all y) */
-};
-
-/* TNX/ZPX permitted types of surfaces */
-#define TNX_CHEBYSHEV 1
-#define TNX_LEGENDRE 2
-#define TNX_POLYNOMIAL 3
-
-/* TNX/ZPX cross-terms flags */
-#define TNX_XNONE 0 /* no x-terms (old no) */
-#define TNX_XFULL 1 /* full x-terms (new yes) */
-#define TNX_XHALF 2 /* half x-terms (new) */
-
-#ifdef __cplusplus /* C++ prototypes */
-extern "C" {
-#endif
-
-#ifdef __STDC__ /* Full ANSI prototypes */
-
- /* WCS data structure initialization subroutines in wcsinit.c */
- struct WorldCoor *wcsinit ( /* set up WCS structure from a FITS image header */
- const char* hstring);
-
- struct WorldCoor *wcsninit ( /* set up WCS structure from a FITS image header */
- const char* hstring, /* FITS header */
- int len); /* Length of FITS header */
-
- struct WorldCoor *wcsinitn ( /* set up WCS structure from a FITS image header */
- const char* hstring, /* FITS header */
- const char* wcsname); /* WCS name */
-
- struct WorldCoor *wcsninitn ( /* set up WCS structure from a FITS image header */
- const char* hstring, /* FITS header */
- int len, /* Length of FITS header */
- const char* wcsname); /* WCS name */
-
- struct WorldCoor *wcsinitc ( /* set up WCS structure from a FITS image header */
- const char* hstring, /* FITS header */
- char *wcschar); /* WCS character (A-Z) */
-
- struct WorldCoor *wcsninitc ( /* set up WCS structure from a FITS image header */
- const char* hstring, /* FITS header */
- int len, /* Length of FITS header */
- char *wcschar); /* WCS character (A-Z) */
-
- /* WCS subroutines in wcs.c */
- void wcsfree ( /* Free a WCS structure and its contents */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- int wcstype( /* Set projection type from header CTYPEs */
- struct WorldCoor *wcs, /* World coordinate system structure */
- char *ctype1, /* FITS WCS projection for axis 1 */
- char *ctype2); /* FITS WCS projection for axis 2 */
-
- int iswcs( /* Returns 1 if wcs structure set, else 0 */
- struct WorldCoor *wcs); /* World coordinate system structure */
- int nowcs( /* Returns 0 if wcs structure set, else 1 */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- int pix2wcst ( /* Convert pixel coordinates to World Coordinate string */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double xpix, /* Image horizontal coordinate in pixels */
- double ypix, /* Image vertical coordinate in pixels */
- char *wcstring, /* World coordinate string (returned) */
- int lstr); /* Length of world coordinate string (returned) */
-
- void pix2wcs ( /* Convert pixel coordinates to World Coordinates */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double xpix, /* Image horizontal coordinate in pixels */
- double ypix, /* Image vertical coordinate in pixels */
- double *xpos, /* Longitude/Right Ascension in degrees (returned) */
- double *ypos); /* Latitude/Declination in degrees (returned) */
-
- void wcsc2pix ( /* Convert World Coordinates to pixel coordinates */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double xpos, /* Longitude/Right Ascension in degrees */
- double ypos, /* Latitude/Declination in degrees */
- char *coorsys, /* Coordinate system (B1950, J2000, etc) */
- double *xpix, /* Image horizontal coordinate in pixels (returned) */
- double *ypix, /* Image vertical coordinate in pixels (returned) */
- int *offscl);
-
- void wcs2pix ( /* Convert World Coordinates to pixel coordinates */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double xpos, /* Longitude/Right Ascension in degrees */
- double ypos, /* Latitude/Declination in degrees */
- double *xpix, /* Image horizontal coordinate in pixels (returned) */
- double *ypix, /* Image vertical coordinate in pixels (returned) */
- int *offscl);
-
- double wcsdist( /* Compute angular distance between 2 sky positions */
- double ra1, /* First longitude/right ascension in degrees */
- double dec1, /* First latitude/declination in degrees */
- double ra2, /* Second longitude/right ascension in degrees */
- double dec2); /* Second latitude/declination in degrees */
-
- double wcsdist1( /* Compute angular distance between 2 sky positions */
- double ra1, /* First longitude/right ascension in degrees */
- double dec1, /* First latitude/declination in degrees */
- double ra2, /* Second longitude/right ascension in degrees */
- double dec2); /* Second latitude/declination in degrees */
-
- double wcsdiff( /* Compute angular distance between 2 sky positions */
- double ra1, /* First longitude/right ascension in degrees */
- double dec1, /* First latitude/declination in degrees */
- double ra2, /* Second longitude/right ascension in degrees */
- double dec2); /* Second latitude/declination in degrees */
-
- struct WorldCoor* wcsxinit( /* set up a WCS structure from arguments */
- double cra, /* Center right ascension in degrees */
- double cdec, /* Center declination in degrees */
- double secpix, /* Number of arcseconds per pixel */
- double xrpix, /* Reference pixel X coordinate */
- double yrpix, /* Reference pixel X coordinate */
- int nxpix, /* Number of pixels along x-axis */
- int nypix, /* Number of pixels along y-axis */
- double rotate, /* Rotation angle (clockwise positive) in degrees */
- int equinox, /* Equinox of coordinates, 1950 and 2000 supported */
- double epoch, /* Epoch of coordinates, used for FK4/FK5 conversion
- * no effect if 0 */
- char *proj); /* Projection */
-
- struct WorldCoor* wcskinit( /* set up WCS structure from keyword values */
- int naxis1, /* Number of pixels along x-axis */
- int naxis2, /* Number of pixels along y-axis */
- char *ctype1, /* FITS WCS projection for axis 1 */
- char *ctype2, /* FITS WCS projection for axis 2 */
- double crpix1, /* Reference pixel coordinates */
- double crpix2, /* Reference pixel coordinates */
- double crval1, /* Coordinate at reference pixel in degrees */
- double crval2, /* Coordinate at reference pixel in degrees */
- double *cd, /* Rotation matrix, used if not NULL */
- double cdelt1, /* scale in degrees/pixel, if cd is NULL */
- double cdelt2, /* scale in degrees/pixel, if cd is NULL */
- double crota, /* Rotation angle in degrees, if cd is NULL */
- int equinox, /* Equinox of coordinates, 1950 and 2000 supported */
- double epoch); /* Epoch of coordinates, for FK4/FK5 conversion */
-
- void wcsshift( /* Change center of WCS */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double cra, /* New center right ascension in degrees */
- double cdec, /* New center declination in degrees */
- char *coorsys); /* FK4 or FK5 coordinates (1950 or 2000) */
-
- void wcsfull( /* Return RA and Dec of image center, size in degrees */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double *cra, /* Right ascension of image center (deg) (returned) */
- double *cdec, /* Declination of image center (deg) (returned) */
- double *width, /* Width in degrees (returned) */
- double *height); /* Height in degrees (returned) */
-
- void wcscent( /* Print the image center and size in WCS units */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- void wcssize( /* Return image center and size in RA and Dec */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double *cra, /* Right ascension of image center (deg) (returned) */
- double *cdec, /* Declination of image center (deg) (returned) */
- double *dra, /* Half-width in right ascension (deg) (returned) */
- double *ddec); /* Half-width in declination (deg) (returned) */
-
- void wcsrange( /* Return min and max RA and Dec of image in degrees */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double *ra1, /* Min. right ascension of image (deg) (returned) */
- double *ra2, /* Max. right ascension of image (deg) (returned) */
- double *dec1, /* Min. declination of image (deg) (returned) */
- double *dec2); /* Max. declination of image (deg) (returned) */
-
- void wcscdset( /* Set scaling and rotation from CD matrix */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double *cd); /* CD matrix, ignored if NULL */
-
- void wcsdeltset( /* set scaling, rotation from CDELTi, CROTA2 */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double cdelt1, /* degrees/pixel in first axis (or both axes) */
- double cdelt2, /* degrees/pixel in second axis if nonzero */
- double crota); /* Rotation counterclockwise in degrees */
-
- void wcspcset( /* set scaling, rotation from CDELTs and PC matrix */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double cdelt1, /* degrees/pixel in first axis (or both axes) */
- double cdelt2, /* degrees/pixel in second axis if nonzero */
- double *pc); /* Rotation matrix, ignored if NULL */
-
- void setwcserr( /* Set WCS error message for later printing */
- char *errmsg); /* Error mesage < 80 char */
- void wcserr(void); /* Print WCS error message to stderr */
-
- void setdefwcs( /* Set flag to use AIPS WCS instead of WCSLIB */
- int oldwcs); /* 1 for AIPS WCS subroutines, else WCSLIB */
- int getdefwcs(void); /* Return flag for AIPS WCS set by setdefwcs */
-
- char *getradecsys( /* Return name of image coordinate system */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- void wcsoutinit( /* Set output coordinate system for pix2wcs */
- struct WorldCoor *wcs, /* World coordinate system structure */
- char *coorsys); /* Coordinate system (B1950, J2000, etc) */
-
- char *getwcsout( /* Return current output coordinate system */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- void wcsininit( /* Set input coordinate system for wcs2pix */
- struct WorldCoor *wcs, /* World coordinate system structure */
- char *coorsys); /* Coordinate system (B1950, J2000, etc) */
-
- char *getwcsin( /* Return current input coordinate system */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- int setwcsdeg( /* Set WCS coordinate output format */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int degout); /* 1= degrees, 0= hh:mm:ss dd:mm:ss */
-
- int wcsndec( /* Set or get number of output decimal places */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int ndec); /* Number of decimal places in output string
- if < 0, return current ndec unchanged */
-
- int wcsreset( /* Change WCS using arguments */
- struct WorldCoor *wcs, /* World coordinate system data structure */
- double crpix1, /* Horizontal reference pixel */
- double crpix2, /* Vertical reference pixel */
- double crval1, /* Reference pixel horizontal coordinate in degrees */
- double crval2, /* Reference pixel vertical coordinate in degrees */
- double cdelt1, /* Horizontal scale in degrees/pixel, ignored if cd is not NULL */
- double cdelt2, /* Vertical scale in degrees/pixel, ignored if cd is not NULL */
- double crota, /* Rotation angle in degrees, ignored if cd is not NULL */
- double *cd); /* Rotation matrix, used if not NULL */
-
- void wcseqset( /* Change equinox of reference pixel coordinates in WCS */
- struct WorldCoor *wcs, /* World coordinate system data structure */
- double equinox); /* Desired equinox as fractional year */
-
- void setwcslin( /* Set pix2wcst() mode for LINEAR coordinates */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int mode); /* 0: x y linear, 1: x units x units
- 2: x y linear units */
-
- int wcszin( /* Set third dimension for cube projections */
- int izpix); /* Set coordinate in third dimension (face) */
-
- int wcszout ( /* Return coordinate in third dimension */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- void wcscominit( /* Initialize catalog search command set by -wcscom */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int i, /* Number of command (0-9) to initialize */
- char *command); /* command with %s where coordinates will go */
-
- void wcscom( /* Execute catalog search command set by -wcscom */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int i, /* Number of command (0-9) to execute */
- char *filename, /* Image file name */
- double xfile, /* Horizontal image pixel coordinates for WCS command */
- double yfile, /* Vertical image pixel coordinates for WCS command */
- char *wcstring); /* WCS String from pix2wcst() */
-
- void savewcscom( /* Save WCS shell command */
- int i, /* i of 10 possible shell commands */
- char *wcscom); /* Shell command using output WCS string */
- char *getwcscom( /* Return WCS shell command */
- int i); /* i of 10 possible shell commands */
- void setwcscom( /* Set WCS shell commands from stored values */
- struct WorldCoor *wcs); /* World coordinate system structure */
- void freewcscom( /* Free memory storing WCS shell commands */
- struct WorldCoor *wcs); /* World coordinate system structure */
-
- void setwcsfile( /* Set filename for WCS error message */
- char *filename); /* FITS or IRAF file name */
- int cpwcs ( /* Copy WCS keywords with no suffix to ones with suffix */
- char **header, /* Pointer to start of FITS header */
- char *cwcs); /* Keyword suffix character for output WCS */
-
- void savewcscoor( /* Save output coordinate system */
- char *wcscoor); /* coordinate system (J2000, B1950, galactic) */
- char *getwcscoor(void); /* Return output coordinate system */
-
- /* Coordinate conversion subroutines in wcscon.c */
- void wcsconv( /* Convert between coordinate systems and equinoxes */
- int sys1, /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
- int sys2, /* Output coordinate system (J2000, B1950, ECLIPTIC, G ALACTIC */
- double eq1, /* Input equinox (default of sys1 if 0.0) */
- double eq2, /* Output equinox (default of sys2 if 0.0) */
- double ep1, /* Input Besselian epoch in years */
- double ep2, /* Output Besselian epoch in years */
- double *dtheta, /* Longitude or right ascension in degrees
- Input in sys1, returned in sys2 */
- double *dphi, /* Latitude or declination in degrees
- Input in sys1, returned in sys2 */
- double *ptheta, /* Longitude or right ascension proper motion in deg/year
- Input in sys1, returned in sys2 */
- double *pphi, /* Latitude or declination proper motion in deg/year */
- double *px, /* Parallax in arcseconds */
- double *rv); /* Radial velocity in km/sec */
- void wcsconp( /* Convert between coordinate systems and equinoxes */
- int sys1, /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
- int sys2, /* Output coordinate system (J2000, B1950, ECLIPTIC, G ALACTIC */
- double eq1, /* Input equinox (default of sys1 if 0.0) */
- double eq2, /* Output equinox (default of sys2 if 0.0) */
- double ep1, /* Input Besselian epoch in years */
- double ep2, /* Output Besselian epoch in years */
- double *dtheta, /* Longitude or right ascension in degrees
- Input in sys1, returned in sys2 */
- double *dphi, /* Latitude or declination in degrees
- Input in sys1, returned in sys2 */
- double *ptheta, /* Longitude or right ascension proper motion in degrees/year
- Input in sys1, returned in sys2 */
- double *pphi); /* Latitude or declination proper motion in degrees/year
- Input in sys1, returned in sys2 */
- void wcscon( /* Convert between coordinate systems and equinoxes */
- int sys1, /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
- int sys2, /* Output coordinate system (J2000, B1950, ECLIPTIC, G ALACTIC */
- double eq1, /* Input equinox (default of sys1 if 0.0) */
- double eq2, /* Output equinox (default of sys2 if 0.0) */
- double *dtheta, /* Longitude or right ascension in degrees
- Input in sys1, returned in sys2 */
- double *dphi, /* Latitude or declination in degrees
- Input in sys1, returned in sys2 */
- double epoch); /* Besselian epoch in years */
- void fk425e ( /* Convert B1950(FK4) to J2000(FK5) coordinates */
- double *ra, /* Right ascension in degrees (B1950 in, J2000 out) */
- double *dec, /* Declination in degrees (B1950 in, J2000 out) */
- double epoch); /* Besselian epoch in years */
- void fk524e ( /* Convert J2000(FK5) to B1950(FK4) coordinates */
- double *ra, /* Right ascension in degrees (J2000 in, B1950 out) */
- double *dec, /* Declination in degrees (J2000 in, B1950 out) */
- double epoch); /* Besselian epoch in years */
- int wcscsys( /* Return code for coordinate system in string */
- char *coorsys); /* Coordinate system (B1950, J2000, etc) */
- double wcsceq ( /* Set equinox from string (return 0.0 if not obvious) */
- char *wcstring); /* Coordinate system (B1950, J2000, etc) */
- void wcscstr ( /* Set coordinate system type string from system and equinox */
- char *cstr, /* Coordinate system string (returned) */
- int syswcs, /* Coordinate system code */
- double equinox, /* Equinox of coordinate system */
- double epoch); /* Epoch of coordinate system */
- void d2v3 ( /* Convert RA and Dec in degrees and distance to vector */
- double rra, /* Right ascension in degrees */
- double rdec, /* Declination in degrees */
- double r, /* Distance to object in same units as pos */
- double pos[3]); /* x,y,z geocentric equatorial position of object (returned) */
- void s2v3 ( /* Convert RA and Dec in radians and distance to vector */
- double rra, /* Right ascension in radians */
- double rdec, /* Declination in radians */
- double r, /* Distance to object in same units as pos */
- double pos[3]); /* x,y,z geocentric equatorial position of object (returned) */
- void v2d3 ( /* Convert vector to RA and Dec in degrees and distance */
- double pos[3], /* x,y,z geocentric equatorial position of object */
- double *rra, /* Right ascension in degrees (returned) */
- double *rdec, /* Declination in degrees (returned) */
- double *r); /* Distance to object in same units as pos (returned) */
- void v2s3 ( /* Convert vector to RA and Dec in radians and distance */
- double pos[3], /* x,y,z geocentric equatorial position of object */
- double *rra, /* Right ascension in radians (returned) */
- double *rdec, /* Declination in radians (returned) */
- double *r); /* Distance to object in same units as pos (returned) */
-
-/* Distortion model subroutines in distort.c */
- void distortinit ( /* Set distortion coefficients from FITS header */
- struct WorldCoor *wcs, /* World coordinate system structure */
- const char* hstring); /* FITS header */
- void setdistcode ( /* Set WCS distortion code string from CTYPEi value */
- struct WorldCoor *wcs, /* World coordinate system structure */
- char *ctype); /* CTYPE value from FITS header */
- char *getdistcode ( /* Return distortion code string for CTYPEi */
- struct WorldCoor *wcs); /* World coordinate system structure */
- int DelDistort ( /* Delete all distortion-related fields */
- char *header, /* FITS header */
- int verbose); /* If !=0, print keywords as deleted */
- void pix2foc ( /* Convert pixel to focal plane coordinates */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double x, /* Image pixel horizontal coordinate */
- double y, /* Image pixel vertical coordinate */
- double *u, /* Focal plane horizontal coordinate(returned) */
- double *v); /* Focal plane vertical coordinate (returned) */
- void foc2pix ( /* Convert focal plane to pixel coordinates */
- struct WorldCoor *wcs, /* World coordinate system structure */
- double u, /* Focal plane horizontal coordinate */
- double v, /* Focal plane vertical coordinate */
- double *x, /* Image pixel horizontal coordinate(returned) */
- double *y); /* Image pixel vertical coordinate (returned) */
-
-/* Other projection subroutines */
-
-/* 8 projections using AIPS algorithms (worldpos.c) */
- int worldpos ( /* Convert from pixel location to RA,Dec */
- double xpix, /* x pixel number (RA or long without rotation) */
- double ypix, /* y pixel number (Dec or lat without rotation) */
- struct WorldCoor *wcs, /* WCS parameter structure */
- double *xpos, /* x (RA) coordinate (deg) (returned) */
- double *ypos); /* y (dec) coordinate (deg) (returned) */
- int worldpix ( /* Convert from RA,Dec to pixel location */
- double xpos, /* x (RA) coordinate (deg) */
- double ypos, /* y (dec) coordinate (deg) */
- struct WorldCoor *wcs, /* WCS parameter structure */
- double *xpix, /* x pixel number (RA or long without rotation) */
- double *ypix); /* y pixel number (dec or lat without rotation) */
-
-/* Digital Sky Survey projection (dsspos.c) */
- int dsspos ( /* Convert from pixel location to RA,Dec */
- double xpix, /* x pixel number (RA or long without rotation) */
- double ypix, /* y pixel number (Dec or lat without rotation) */
- struct WorldCoor *wcs, /* WCS parameter structure */
- double *xpos, /* x (RA) coordinate (deg) (returned) */
- double *ypos); /* y (dec) coordinate (deg) (returned) */
- int dsspix ( /* Convert from RA,Dec to pixel location */
- double xpos, /* x (RA) coordinate (deg) */
- double ypos, /* y (dec) coordinate (deg) */
- struct WorldCoor *wcs, /* WCS parameter structure */
- double *xpix, /* x pixel number (RA or long without rotation) */
- double *ypix); /* y pixel number (dec or lat without rotation) */
-
-/* SAO TDC TAN projection with higher order terms (platepos.c) */
- int platepos ( /* Convert from pixel location to RA,Dec */
- double xpix, /* x pixel number (RA or long without rotation) */
- double ypix, /* y pixel number (Dec or lat without rotation) */
- struct WorldCoor *wcs, /* WCS parameter structure */
- double *xpos, /* x (RA) coordinate (deg) (returned) */
- double *ypos); /* y (dec) coordinate (deg) (returned) */
- int platepix ( /* Convert from RA,Dec to pixel location */
- double xpos, /* x (RA) coordinate (deg) */
- double ypos, /* y (dec) coordinate (deg) */
- struct WorldCoor *wcs, /* WCS parameter structure */
- double *xpix, /* x pixel number (RA or long without rotation) */
- double *ypix); /* y pixel number (dec or lat without rotation) */
- void SetFITSPlate ( /* Set FITS header plate fit coefficients from structure */
- char *header, /* Image FITS header */
- struct WorldCoor *wcs); /* WCS structure */
- int SetPlate ( /* Set plate fit coefficients in structure from arguments */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int ncoeff1, /* Number of coefficients for x */
- int ncoeff2, /* Number of coefficients for y */
- double *coeff); /* Plate fit coefficients */
- int GetPlate ( /* Return plate fit coefficients from structure in arguments */
- struct WorldCoor *wcs, /* World coordinate system structure */
- int *ncoeff1, /* Number of coefficients for x */
- int *ncoeff2, /* Number of coefficients for y) */
- double *coeff); /* Plate fit coefficients */
-
-/* IRAF TAN projection with higher order terms (tnxpos.c) */
- int tnxinit ( /* initialize the gnomonic forward or inverse transform */
- const char *header, /* FITS header */
- struct WorldCoor *wcs); /* pointer to WCS structure */
- int tnxpos ( /* forward transform (physical to world) gnomonic projection. */
- double xpix, /* Image X coordinate */
- double ypix, /* Image Y coordinate */
- struct WorldCoor *wcs, /* pointer to WCS descriptor */
- double *xpos, /* Right ascension (returned) */
- double *ypos); /* Declination (returned) */
- int tnxpix ( /* Inverse transform (world to physical) gnomonic projection */
- double xpos, /* Right ascension */
- double ypos, /* Declination */
- struct WorldCoor *wcs, /* Pointer to WCS descriptor */
- double *xpix, /* Image X coordinate (returned) */
- double *ypix); /* Image Y coordinate (returned) */
-
-/* IRAF ZPN projection with higher order terms (zpxpos.c) */
- int zpxinit ( /* initialize the zenithal forward or inverse transform */
- const char *header, /* FITS header */
- struct WorldCoor *wcs); /* pointer to WCS structure */
- int zpxpos ( /* forward transform (physical to world) */
- double xpix, /* Image X coordinate */
- double ypix, /* Image Y coordinate */
- struct WorldCoor *wcs, /* pointer to WCS descriptor */
- double *xpos, /* Right ascension (returned) */
- double *ypos); /* Declination (returned) */
- int zpxpix ( /* Inverse transform (world to physical) */
- double xpos, /* Right ascension */
- double ypos, /* Declination */
- struct WorldCoor *wcs, /* Pointer to WCS descriptor */
- double *xpix, /* Image X coordinate (returned) */
- double *ypix); /* Image Y coordinate (returned) */
-
-#else /* K&R prototypes */
-
-/* WCS subroutines in wcs.c */
-struct WorldCoor *wcsinit(); /* set up a WCS structure from a FITS image header */
-struct WorldCoor *wcsninit(); /* set up a WCS structure from a FITS image header */
-struct WorldCoor *wcsinitn(); /* set up a WCS structure from a FITS image header */
-struct WorldCoor *wcsninitn(); /* set up a WCS structure from a FITS image header */
-struct WorldCoor *wcsinitc(); /* set up a WCS structure from a FITS image header */
-struct WorldCoor *wcsninitc(); /* set up a WCS structure from a FITS image header */
-struct WorldCoor *wcsxinit(); /* set up a WCS structure from arguments */
-struct WorldCoor *wcskinit(); /* set up a WCS structure from keyword values */
-void wcsfree(void); /* Free a WCS structure and its contents */
-int wcstype(); /* Set projection type from header CTYPEs */
-void wcscdset(); /* Set scaling and rotation from CD matrix */
-void wcsdeltset(); /* set scaling and rotation from CDELTs and CROTA2 */
-void wcspcset(); /* set scaling and rotation from CDELTs and PC matrix */
-int iswcs(); /* Return 1 if WCS structure is filled, else 0 */
-int nowcs(); /* Return 0 if WCS structure is filled, else 1 */
-void wcsshift(); /* Reset the center of a WCS structure */
-void wcscent(); /* Print the image center and size in WCS units */
-void wcssize(); /* Return RA and Dec of image center, size in RA and Dec */
-void wcsfull(); /* Return RA and Dec of image center, size in degrees */
-void wcsrange(); /* Return min and max RA and Dec of image in degrees */
-double wcsdist(); /* Distance in degrees between two sky coordinates */
-double wcsdist1(); /* Compute angular distance between 2 sky positions */
-double wcsdiff(); /* Distance in degrees between two sky coordinates */
-void wcscominit(); /* Initialize catalog search command set by -wcscom */
-void wcscom(); /* Execute catalog search command set by -wcscom */
-char *getradecsys(); /* Return current value of coordinate system */
-void wcsoutinit(); /* Initialize WCS output coordinate system for use by pix2wcs */
-char *getwcsout(); /* Return current value of WCS output coordinate system */
-void wcsininit(); /* Initialize WCS input coordinate system for use by wcs2pix */
-char *getwcsin(); /* Return current value of WCS input coordinate system */
-int setwcsdeg(); /* Set WCS output in degrees (1) or hh:mm:ss dd:mm:ss (0) */
-int wcsndec(); /* Set or get number of output decimal places */
-int wcsreset(); /* Change WCS using arguments */
-void wcseqset(); /* Change equinox of reference pixel coordinates in WCS */
-void wcscstr(); /* Return system string from system code, equinox, epoch */
-void setwcslin(); /* Set output string mode for LINEAR coordinates */
-int pix2wcst(); /* Convert pixel coordinates to World Coordinate string */
-void pix2wcs(); /* Convert pixel coordinates to World Coordinates */
-void wcsc2pix(); /* Convert World Coordinates to pixel coordinates */
-void wcs2pix(); /* Convert World Coordinates to pixel coordinates */
-void setdefwcs(); /* Call to use AIPS classic WCS (also not PLT/TNX/ZPX */
-int getdefwcs(); /* Call to get flag for AIPS classic WCS */
-int wcszin(); /* Set coordinate in third dimension (face) */
-int wcszout(); /* Return coordinate in third dimension */
-void wcserr(); /* Print WCS error message to stderr */
-void setwcserr(); /* Set WCS error message for later printing */
-void savewcscoor(); /* Save output coordinate system */
-char *getwcscoor(); /* Return output coordinate system */
-void savewcscom(); /* Save WCS shell command */
-char *getwcscom(); /* Return WCS shell command */
-void setwcscom(); /* Set WCS shell commands from stored values */
-void freewcscom(); /* Free memory used to store WCS shell commands */
-void setwcsfile(); /* Set filename for WCS error message */
-int cpwcs(); /* Copy WCS keywords with no suffix to ones with suffix */
-
-/* Coordinate conversion subroutines in wcscon.c */
-void wcscon(); /* Convert between coordinate systems and equinoxes */
-void wcsconp(); /* Convert between coordinate systems and equinoxes */
-void wcsconv(); /* Convert between coordinate systems and equinoxes */
-void fk425e(); /* Convert B1950(FK4) to J2000(FK5) coordinates */
-void fk524e(); /* Convert J2000(FK5) to B1950(FK4) coordinates */
-int wcscsys(); /* Set coordinate system from string */
-double wcsceq(); /* Set equinox from string (return 0.0 if not obvious) */
-void d2v3(); /* Convert RA and Dec in degrees and distance to vector */
-void s2v3(); /* Convert RA and Dec in radians and distance to vector */
-void v2d3(); /* Convert vector to RA and Dec in degrees and distance */
-void v2s3(); /* Convert vector to RA and Dec in radians and distance */
-
-/* Distortion model subroutines in distort.c */
-void distortinit(); /* Set distortion coefficients from FITS header */
-void setdistcode(); /* Set WCS distortion code string from CTYPEi value */
-char *getdistcode(); /* Return distortion code string for CTYPEi */
-int DelDistort(); /* Delete all distortion-related fields */
-void pix2foc(); /* pixel coordinates -> focal plane coordinates */
-void foc2pix(); /* focal plane coordinates -> pixel coordinates */
-
-/* Other projection subroutines */
-
-/* 8 projections using AIPS algorithms (worldpos.c) */
-extern int worldpos(); /* Convert from pixel location to RA,Dec */
-extern int worldpix(); /* Convert from RA,Dec to pixel location */
-
-/* Digital Sky Survey projection (dsspos.c) */
-extern int dsspos(); /* Convert from pixel location to RA,Dec */
-extern int dsspix(); /* Convert from RA,Dec to pixel location */
-
-/* SAO TDC TAN projection with higher order terms (platepos.c) */
-extern int platepos(); /* Convert from pixel location to RA,Dec */
-extern int platepix(); /* Convert from RA,Dec to pixel location */
-extern void SetFITSPlate(); /* Set FITS header plate fit coefficients from structure */
-extern int SetPlate(); /* Set plate fit coefficients in structure from arguments */
-extern int GetPlate(); /* Return plate fit coefficients from structure in arguments */
-
-/* IRAF TAN projection with higher order terms (tnxpos.c) */
-extern int tnxinit(); /* initialize the gnomonic forward or inverse transform */
-extern int tnxpos(); /* forward transform (physical to world) gnomonic projection. */
-extern int tnxpix(); /* Inverse transform (world to physical) gnomonic projection */
-
-/* IRAF ZPN projection with higher order terms (zpxpos.c) */
-extern int zpxinit(); /* initialize the gnomonic forward or inverse transform */
-extern int zpxpos(); /* forward transform (physical to world) gnomonic projection. */
-extern int zpxpix(); /* Inverse transform (world to physical) gnomonic projection */
-
-#endif /* __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _wcs_h_ */
-
-/* Oct 26 1994 New file
- * Dec 21 1994 Add rotation matrix
- * Dec 22 1994 Add flag for coordinate reversal
-
- * Mar 6 1995 Add parameters for Digital Sky Survey plate fit
- * Jun 8 1995 Add parameters for coordinate system change
- * Jun 21 1995 Add parameter for plate scale
- * Jul 6 1995 Add parameter to note whether WCS is set
- * Aug 8 1995 Add parameter to note whether to print coordinate system
- * Oct 16 1995 Add parameters to save image dimensions and center coordinates
-
- * Feb 15 1996 Add coordinate conversion functions
- * Feb 20 1996 Add flag for tab tables
- * Apr 26 1996 Add epoch of positions (actual date of image)
- * Jul 5 1996 Add subroutine declarations
- * Jul 19 1996 Add WCSFULL declaration
- * Aug 5 1996 Add WCSNINIT to initialize WCS for non-terminated header
- * Oct 31 1996 Add DCnn inverse rotation matrix
- * Nov 1 1996 Add NDEC number of decimal places in output
- *
- * May 22 1997 Change range of pcode from 1-8 to -1-8 for linear transform
- * Sep 12 1997 Add chip rotation MROT, XMPIX, YMPIX
- *
- * Jan 7 1998 Add INSTRUME and DETECTOR for HST metric correction
- * Jan 16 1998 Add Mark Calabretta's WCSLIB data structures
- * Jan 16 1998 Add LONGPOLE, LATPOLE, and PROJP constants for Calabretta
- * Jan 22 1998 Add ctype[], crpix[], crval[], and cdelt[] for Calabretta
- * Jan 23 1998 Change wcsset() to wcsxinit() and pcode to prjcode
- * Jan 23 1998 Define projection type flags
- * Jan 26 1998 Remove chip rotation
- * Jan 26 1998 Add chip correction polynomial
- * Feb 3 1998 Add number of coefficients for residual fit
- * Feb 5 1998 Make cd and dc matrices vectors, not individual elements
- * Feb 19 1998 Add projection names
- * Feb 23 1998 Add TNX projection from NOAO
- * Mar 3 1998 Add NOAO plate fit and residual fit
- * Mar 12 1998 Add variables for TNX correction surface
- * Mar 23 1998 Add PLT plate fit polynomial projection; reassign DSS
- * Mar 23 1998 Drop plate_fit flag from structure
- * Mar 25 1998 Add npcoeff to wcs structure for new plate fit WCS
- * Apr 7 1998 Change amd_i_coeff to i_coeff
- * Apr 8 1998 Add wcseqset() and wcsreset() subroutine declarations
- * Apr 10 1998 Rearrange order of nonstandard WCS types
- * Apr 13 1998 Add setdefwcs() subroutine declaration
- * Apr 14 1998 Add coordinate systems and wcscoor()
- * Apr 24 1998 Add units
- * Apr 28 1998 Change coordinate system flags to WCS_*
- * Apr 28 1998 Change projection flags to WCS_*
- * Apr 28 1998 Add wcsc2pix()
- * May 7 1998 Add C++ declarations
- * May 13 1998 Add eqin and eqout for conversions to and from equinoxes
- * May 14 1998 Add declarations for coordinate conversion subroutines
- * May 27 1998 Add blsearch()
- * May 27 1998 Change linear projection back to WCS_LIN from WCS_LPR
- * May 27 1998 Move hget.c and hput.c C++ declarations to fitshead.h
- * May 27 1998 Include fitshead.h
- * May 29 1998 Add wcskinit()
- * Jun 1 1998 Add wcserr()
- * Jun 11 1998 Add initialization support subroutines
- * Jun 18 1998 Add wcspcset()
- * Jun 25 1998 Add wcsndec()
- * Jul 6 1998 Add wcszin() and wcszout() to use third dimension of images
- * Jul 7 1998 Change setdegout() to setwcsdeg(); setlinmode() to setwcslin()
- * Jul 17 1998 Add savewcscoor(), getwcscoor(), savewcscom(), and getwcscom()
- * Aug 14 1998 Add freewcscom(), setwcscom(), and multiple WCS commands
- * Sep 3 1998 Add pa_north, pa_east, imrot and imflip to wcs structure
- * Sep 14 1998 Add latbase for AXAF North Polar angle (NPOL not LAT-)
- * Sep 16 1998 Make WCS_system start at 1; add NPOLE
- * Sep 17 1998 Add wcscstr()
- * Sep 21 1998 Add wcsconp() to convert proper motions, too.
- * Dec 2 1998 Add WCS type for planet surface
-
- * Jan 20 1999 Add declaration of wcsfree()
- * Jun 16 1999 Add declaration of wcsrange()
- * Oct 21 1999 Add declaration of setwcsfile()
- *
- * Jan 28 2000 Add flags for choice of WCS projection subroutines
- * Jun 26 2000 Add XY coordinate system
- * Nov 2 2000 Add wcsconv() to convert coordinates when parallax or rv known
- *
- * Jan 17 2001 Add idpix and ndpix for trim section, ltm for readout rotation
- * Jan 31 2001 Add wcsinitn(), wcsninitn(), wcsinitc(), and wcsninitc()
- * Feb 20 2001 Add wcs->wcs to main data structure
- * Mar 20 2001 Close unclosed comment in wcsconv() argument list
- *
- * Apr 3 2002 Add SZP and second GLS/SFL projection
- * Apr 9 2002 Add wcs->wcsdep for pointer to WCS depending on this WCS
- * Apr 26 2002 Add wcs->wcsname and wcs->wcschar to identify WCS structure
- * May 9 2002 Add wcs->radvel and wcs->zvel for radial velocity in km/sec
- *
- * Apr 1 2003 Add wcs->distort Distort structure for distortion correction
- * Apr 1 2003 Add foc2pix() and pix2foc() subroutines for distortion correction
- * May 1 2003 Add missing semicolons after C++ declarations of previous two functions
- * Oct 1 2003 Rename wcs->naxes to wcs->naxis to match WCSLIB 3.2
- * Nov 3 2003 Add distinit(), setdistcode(), and getdistcode() to distort.c
- * Dec 3 2003 Add back wcs->naxes for backward compatibility
- *
- * Aug 30 2004 Add DelDistort()
- *
- * Nov 1 2005 Add WCS_ICRS
- *
- * Jan 5 2006 Add secrad()
- * Apr 21 2006 Increase maximum number of axes from 4 to 8
- * Apr 24 2006 Increase maximum number of axes to 9
- * Nov 29 2006 Drop semicolon at end of C++ ifdef
- * Dec 21 2006 Add cpwcs()
- *
- * Jan 4 2007 Drop extra declaration of wcscstr()
- * Jan 4 2007 Fix declarations so ANSI prototypes are not just for C++
- * Jan 9 2007 Add fk425e() and fk524e() subroutines
- * Jan 9 2007 Add worldpos.c, dsspos.c, platepos.c, and tnxpos.c subroutines
- * Jan 10 2007 Add ANSI prototypes for all subroutines
- * Feb 1 2007 Add wcs.wcslog for log wavelength
- * Jul 25 2007 Add v2s3(), s2v3(), d2v3(), v2d3() for coordinate-vector conversion
- *
- * Mar 31 2010 Add wcsdist1(), an alternate method
- * Apr 07 2010 Add NWCSTYPE to keep it aligned with actual number of WCS types
- *
- * Mar 11 2011 Add NOAO ZPX projection parameters and subroutines (Frank Valdes)
- * Mar 14 2011 Add SCAMP polynomial projection coefficients
- * Sep 1 2011 Add TPV TAN projectioin with SCAT PV terms
- * Sep 9 2011 Fix comment on TPV declaration
- */
diff --git a/funtools/wcs/wcscon.c b/funtools/wcs/wcscon.c
deleted file mode 100644
index 6e99bd3..0000000
--- a/funtools/wcs/wcscon.c
+++ /dev/null
@@ -1,2328 +0,0 @@
-/*** File wcscon.c
- *** March 30, 2010
- *** Doug Mink, Harvard-Smithsonian Center for Astrophysics
- *** Some subroutines are based on Starlink subroutines by Patrick Wallace
- *** Copyright (C) 1995-2010
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: wcscon.c (World Coordinate System conversion)
- * Purpose: Convert between various sky coordinate systems
- * Subroutine: wcscon (sys1,sys2,eq1,eq2,theta,phi,epoch)
- * convert between coordinate systems
- * Subroutine: wcsconp (sys1,sys2,eq1,eq2,ep1,ep2,dtheta,dphi,ptheta,pphi)
- * convert coordinates and proper motion between coordinate systems
- * Subroutine: wcsconv (sys1,sys2,eq1,eq2,ep1,ep2,dtheta,dphi,ptheta,pphi,px,rv)
- * convert coordinates and proper motion between coordinate systems
- * Subroutine: wcscsys (cstring) returns code for coordinate system in string
- * Subroutine: wcsceq (wcstring) returns equinox in years from system string
- * Subroutine: wcscstr (sys,equinox,epoch) returns system string from equinox
- * Subroutine: fk524 (ra,dec) Convert J2000(FK5) to B1950(FK4) coordinates
- * Subroutine: fk524e (ra, dec, epoch) (more accurate for known position epoch)
- * Subroutine: fk524m (ra,dec,rapm,decpm) exact
- * Subroutine: fk524pv (ra,dec,rapm,decpm,parallax,rv) more exact
- * Subroutine: fk425 (ra,dec) Convert B1950(FK4) to J2000(FK5) coordinates
- * Subroutine: fk425e (ra, dec, epoch) (more accurate for known position epoch)
- * Subroutine: fk425m (ra, dec, rapm, decpm) exact
- * Subroutine: fk425pv (ra,dec,rapm,decpm,parallax,rv) more exact
- * Subroutine: fk42gal (dtheta,dphi) Convert B1950(FK4) to galactic coordinates
- * Subroutine: fk52gal (dtheta,dphi) Convert J2000(FK5) to galactic coordinates
- * Subroutine: gal2fk4 (dtheta,dphi) Convert galactic coordinates to B1950(FK4)
- * Subroutine: gal2fk5 (dtheta,dphi) Convert galactic coordinates to J2000<FK5)
- * Subroutine: fk42ecl (dtheta,dphi,epoch) Convert B1950(FK4) to ecliptic coordinates
- * Subroutine: fk52ecl (dtheta,dphi,epoch) Convert J2000(FK5) to ecliptic coordinates
- * Subroutine: ecl2fk4 (dtheta,dphi,epoch) Convert ecliptic coordinates to B1950(FK4)
- * Subroutine: ecl2fk5 (dtheta,dphi,epoch) Convert ecliptic coordinates to J2000<FK5)
- * Subroutine: fk5prec (ep0, ep1, ra, dec) Precession ep0 to ep1, FK5 system
- * Subroutine: fk4prec (ep0, ep1, ra, dec) Precession ep0 to ep1, FK4 system
- * Subroutine: d2v3 (rra, rdec, r, pos) RA and Dec in degrees, Distance to Cartesian
- * Subroutine: v2d3 (pos, rra, rdec, r) Cartesian to RA and Dec in degrees, Distance
- * Subroutine: s2v3 (rra, rdec, r, pos) RA, Dec, Distance to Cartesian
- * Subroutine: v2s3 (pos, rra, rdec, r) Cartesian to RA, Dec, Distance
- * Subroutine: rotmat (axes, rot1, rot2, rot3, matrix) Rotation angles to matrix
- *
- * Note: Proper motions are always in RA/Dec degrees/year; no cos(Dec) correction
- */
-
-#include <math.h>
-#ifndef VMS
-#include <stdlib.h>
-#endif
-#include <stdio.h> /* for fprintf() and sprintf() */
-#include <ctype.h>
-#include <string.h>
-#include "wcs.h"
-
-void fk524(), fk524e(), fk524m(), fk524pv();
-void fk425(), fk425e(), fk425m(), fk425pv();
-void fk42gal(), fk52gal(), gal2fk4(), gal2fk5();
-void fk42ecl(), fk52ecl(), ecl2fk4(), ecl2fk5();
-
-/* Convert from coordinate system sys1 to coordinate system sys2, converting
- proper motions, too, and adding them if an epoch is specified */
-
-void
-wcsconp (sys1, sys2, eq1, eq2, ep1, ep2, dtheta, dphi, ptheta, pphi)
-
-int sys1; /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
-int sys2; /* Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
-double eq1; /* Input equinox (default of sys1 if 0.0) */
-double eq2; /* Output equinox (default of sys2 if 0.0) */
-double ep1; /* Input Besselian epoch in years (for proper motion) */
-double ep2; /* Output Besselian epoch in years (for proper motion) */
-double *dtheta; /* Longitude or right ascension in degrees
- Input in sys1, returned in sys2 */
-double *dphi; /* Latitude or declination in degrees
- Input in sys1, returned in sys2 */
-double *ptheta; /* Longitude or right ascension proper motion in RA degrees/year
- Input in sys1, returned in sys2 */
-double *pphi; /* Latitude or declination proper motion in Dec degrees/year
- Input in sys1, returned in sys2 */
-
-{
- void fk5prec(), fk4prec();
-
- /* Set equinoxes if 0.0 */
- if (eq1 == 0.0) {
- if (sys1 == WCS_B1950)
- eq1 = 1950.0;
- else
- eq1 = 2000.0;
- }
- if (eq2 == 0.0) {
- if (sys2 == WCS_B1950)
- eq2 = 1950.0;
- else
- eq2 = 2000.0;
- }
-
- /* Set epochs if 0.0 */
- if (ep1 == 0.0) {
- if (sys1 == WCS_B1950)
- ep1 = 1950.0;
- else
- ep1 = 2000.0;
- }
- if (ep2 == 0.0) {
- if (sys2 == WCS_B1950)
- ep2 = 1950.0;
- else
- ep2 = 2000.0;
- }
-
- if (sys1 == WCS_ICRS && sys2 == WCS_ICRS)
- eq2 = eq1;
-
- if (sys1 == WCS_J2000 && sys2 == WCS_ICRS && eq1 == 2000.0) {
- eq2 = eq1;
- sys1 = sys2;
- }
-
- /* Set systems and equinoxes so that ICRS coordinates are not precessed */
- if (sys1 == WCS_ICRS && sys2 == WCS_J2000 && eq2 == 2000.0) {
- eq1 = eq2;
- sys1 = sys2;
- }
-
- /* If systems and equinoxes are the same, add proper motion and return */
- if (sys2 == sys1 && eq1 == eq2) {
- if (ep1 != ep2) {
- if (sys1 == WCS_J2000) {
- *dtheta = *dtheta + ((ep2 - ep1) * *ptheta);
- *dphi = *dphi + ((ep2 - ep1) * *pphi);
- }
- else if (sys1 == WCS_B1950) {
- *dtheta = *dtheta + ((ep2 - ep1) * *ptheta);
- *dphi = *dphi + ((ep2 - ep1) * *pphi);
- }
- }
- if (eq1 != eq2) {
- if (sys1 == WCS_B1950)
- fk4prec (eq1, eq2, dtheta, dphi);
- if (sys1 == WCS_J2000)
- fk5prec (eq1, 2000.0, dtheta, dphi);
- }
- return;
- }
-
- /* Precess from input equinox to input system equinox, if necessary */
- if (sys1 == WCS_B1950 && eq1 != 1950.0)
- fk4prec (eq1, 1950.0, dtheta, dphi);
- if (sys1 == WCS_J2000 && eq1 != 2000.0)
- fk5prec (eq1, 2000.0, dtheta, dphi);
-
- /* Convert to B1950 FK4 */
- if (sys2 == WCS_B1950) {
- if (sys1 == WCS_J2000) {
- if (*ptheta != 0.0 || *pphi != 0.0) {
- fk524m (dtheta, dphi, ptheta, pphi);
- if (ep2 != 1950.0) {
- *dtheta = *dtheta + ((ep2 - 1950.0) * *ptheta);
- *dphi = *dphi + ((ep2 - 1950.0) * *pphi);
- }
- }
- else if (ep2 != 1950.0)
- fk524e (dtheta, dphi, ep2);
- else
- fk524 (dtheta, dphi);
- }
- else if (sys1 == WCS_GALACTIC)
- gal2fk4 (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC)
- ecl2fk4 (dtheta, dphi, ep2);
- }
-
- else if (sys2 == WCS_J2000) {
- if (sys1 == WCS_B1950) {
- if (*ptheta != 0.0 || *pphi != 0.0) {
- fk425m (dtheta, dphi, ptheta, pphi);
- if (ep2 != 2000.0) {
- *dtheta = *dtheta + ((ep2 - 2000.0) * *ptheta);
- *dphi = *dphi + ((ep2 - 2000.0) * *pphi);
- }
- }
- else if (ep2 > 0.0)
- fk425e (dtheta, dphi, ep2);
- else
- fk425 (dtheta, dphi);
- }
- else if (sys1 == WCS_GALACTIC)
- gal2fk5 (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC)
- ecl2fk5 (dtheta, dphi, ep2);
- }
-
- else if (sys2 == WCS_GALACTIC) {
- if (sys1 == WCS_B1950) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- fk42gal (dtheta, dphi);
- }
- else if (sys1 == WCS_J2000) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- fk52gal (dtheta, dphi);
- }
- else if (sys1 == WCS_ECLIPTIC) {
- ecl2fk5 (dtheta, dphi, ep2);
- fk52gal (dtheta, dphi);
- }
- }
-
- else if (sys2 == WCS_ECLIPTIC) {
- if (sys1 == WCS_B1950) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- if (ep2 > 0.0)
- fk42ecl (dtheta, dphi, ep2);
- else
- fk42ecl (dtheta, dphi, 1950.0);
- }
- else if (sys1 == WCS_J2000) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- fk52ecl (dtheta, dphi, ep2);
- }
- else if (sys1 == WCS_GALACTIC) {
- gal2fk5 (dtheta, dphi);
- fk52ecl (dtheta, dphi, ep2);
- }
- }
-
- /* Precess to desired equinox, if necessary */
- if (sys2 == WCS_B1950 && eq2 != 1950.0)
- fk4prec (1950.0, eq2, dtheta, dphi);
- if (sys2 == WCS_J2000 && eq2 != 2000.0)
- fk5prec (2000.0, eq2, dtheta, dphi);
-
- /* Keep latitude/declination between +90 and -90 degrees */
- if (*dphi > 90.0) {
- *dphi = 180.0 - *dphi;
- *dtheta = *dtheta + 180.0;
- }
- else if (*dphi < -90.0) {
- *dphi = -180.0 - *dphi;
- *dtheta = *dtheta + 180.0;
- }
-
- /* Keep longitude/right ascension between 0 and 360 degrees */
- if (*dtheta > 360.0)
- *dtheta = *dtheta - 360.0;
- else if (*dtheta < 0.0)
- *dtheta = *dtheta + 360.0;
- return;
-}
-
-
-/* Convert from coordinate system sys1 to coordinate system sys2, converting
- proper motions, too, and adding them if an epoch is specified */
-
-void
-wcsconv (sys1, sys2, eq1, eq2, ep1, ep2, dtheta, dphi, ptheta, pphi, px, rv)
-
-int sys1; /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
-int sys2; /* Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
-double eq1; /* Input equinox (default of sys1 if 0.0) */
-double eq2; /* Output equinox (default of sys2 if 0.0) */
-double ep1; /* Input Besselian epoch in years (for proper motion) */
-double ep2; /* Output Besselian epoch in years (for proper motion) */
-double *dtheta; /* Longitude or right ascension in degrees
- Input in sys1, returned in sys2 */
-double *dphi; /* Latitude or declination in degrees
- Input in sys1, returned in sys2 */
-double *ptheta; /* Longitude or right ascension proper motion in degrees/year
- Input in sys1, returned in sys2 */
-double *pphi; /* Latitude or declination proper motion in degrees/year
- Input in sys1, returned in sys2 */
-double *px; /* Parallax in arcseconds */
-double *rv; /* Radial velocity in km/sec */
-
-{
- void fk5prec(), fk4prec();
-
- /* Set equinoxes if 0.0 */
- if (eq1 == 0.0) {
- if (sys1 == WCS_B1950)
- eq1 = 1950.0;
- else
- eq1 = 2000.0;
- }
- if (eq2 == 0.0) {
- if (sys2 == WCS_B1950)
- eq2 = 1950.0;
- else
- eq2 = 2000.0;
- }
-
- /* Set epochs if 0.0 */
- if (ep1 == 0.0) {
- if (sys1 == WCS_B1950)
- ep1 = 1950.0;
- else
- ep1 = 2000.0;
- }
- if (ep2 == 0.0) {
- if (sys2 == WCS_B1950)
- ep2 = 1950.0;
- else
- ep2 = 2000.0;
- }
-
- /* Set systems and equinoxes so that ICRS coordinates are not precessed */
- if (sys1 == WCS_ICRS && sys2 == WCS_ICRS)
- eq2 = eq1;
-
- if (sys1 == WCS_J2000 && sys2 == WCS_ICRS && eq1 == 2000.0) {
- eq2 = eq1;
- sys1 = sys2;
- }
-
- if (sys1 == WCS_ICRS && sys2 == WCS_J2000 && eq2 == 2000.0) {
- eq1 = eq2;
- sys1 = sys2;
- }
-
- /* If systems and equinoxes are the same, add proper motion and return */
- if (sys2 == sys1 && eq1 == eq2) {
- if (ep1 != ep2) {
- if (sys1 == WCS_J2000) {
- *dtheta = *dtheta + ((ep2 - ep1) * *ptheta);
- *dphi = *dphi + ((ep2 - ep1) * *pphi);
- }
- else if (sys1 == WCS_B1950) {
- *dtheta = *dtheta + ((ep2 - ep1) * *ptheta);
- *dphi = *dphi + ((ep2 - ep1) * *pphi);
- }
- }
- return;
- }
-
- /* Precess from input equinox to input system equinox, if necessary */
- if (eq1 != eq2) {
- if (sys1 == WCS_B1950 && eq1 != 1950.0)
- fk4prec (eq1, 1950.0, dtheta, dphi);
- if (sys1 == WCS_J2000 && eq1 != 2000.0)
- fk5prec (eq1, 2000.0, dtheta, dphi);
- }
-
- /* Convert to B1950 FK4 */
- if (sys2 == WCS_B1950) {
- if (sys1 == WCS_J2000) {
- if (*ptheta != 0.0 || *pphi != 0.0) {
- if (*px != 0.0 || *rv != 0.0)
- fk524pv (dtheta, dphi, ptheta, pphi, px, rv);
- else
- fk524m (dtheta, dphi, ptheta, pphi);
- if (ep1 == 2000.0)
- ep1 = 1950.0;
- if (ep2 != 1950.0) {
- *dtheta = *dtheta + ((ep2 - 1950.0) * *ptheta);
- *dphi = *dphi + ((ep2 - 1950.0) * *pphi);
- }
- }
- else if (ep2 != 1950.0)
- fk524e (dtheta, dphi, ep2);
- else
- fk524 (dtheta, dphi);
- }
- else if (sys1 == WCS_GALACTIC)
- gal2fk4 (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC)
- ecl2fk4 (dtheta, dphi, ep2);
- }
-
- else if (sys2 == WCS_J2000) {
- if (sys1 == WCS_B1950) {
- if (*ptheta != 0.0 || *pphi != 0.0) {
- if (*px != 0.0 || *rv != 0.0)
- fk425pv (dtheta, dphi, ptheta, pphi, px, rv);
- else
- fk425m (dtheta, dphi, ptheta, pphi);
- if (ep2 != 2000.0) {
- *dtheta = *dtheta + ((ep2 - 2000.0) * *ptheta);
- *dphi = *dphi + ((ep2 - 2000.0) * *pphi);
- }
- }
- else if (ep2 > 0.0)
- fk425e (dtheta, dphi, ep2);
- else
- fk425 (dtheta, dphi);
- }
- else if (sys1 == WCS_GALACTIC)
- gal2fk5 (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC)
- ecl2fk5 (dtheta, dphi, ep2);
- }
-
- else if (sys2 == WCS_GALACTIC) {
- if (sys1 == WCS_B1950) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- fk42gal (dtheta, dphi);
- }
- else if (sys1 == WCS_J2000) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- fk52gal (dtheta, dphi);
- }
- else if (sys1 == WCS_ECLIPTIC) {
- ecl2fk5 (dtheta, dphi, ep2);
- fk52gal (dtheta, dphi);
- }
- }
-
- else if (sys2 == WCS_ECLIPTIC) {
- if (sys1 == WCS_B1950) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- if (ep2 > 0.0)
- fk42ecl (dtheta, dphi, ep2);
- else
- fk42ecl (dtheta, dphi, 1950.0);
- }
- else if (sys1 == WCS_J2000) {
- if (ep2 != 0.0 && (*ptheta != 0.0 || *pphi != 0.0)) {
- *dtheta = *dtheta + (*ptheta * (ep2 - ep1));
- *dphi = *dphi + (*pphi * (ep2 - ep1));
- }
- fk52ecl (dtheta, dphi, ep2);
- }
- else if (sys1 == WCS_GALACTIC) {
- gal2fk5 (dtheta, dphi);
- fk52ecl (dtheta, dphi, ep2);
- }
- }
-
- /* Precess to desired equinox, if necessary */
- if (eq1 != eq2) {
- if (sys2 == WCS_B1950 && eq2 != 1950.0)
- fk4prec (1950.0, eq2, dtheta, dphi);
- if (sys2 == WCS_J2000 && eq2 != 2000.0)
- fk5prec (2000.0, eq2, dtheta, dphi);
- }
-
- /* Keep latitude/declination between +90 and -90 degrees */
- if (*dphi > 90.0) {
- *dphi = 180.0 - *dphi;
- *dtheta = *dtheta + 180.0;
- }
- else if (*dphi < -90.0) {
- *dphi = -180.0 - *dphi;
- *dtheta = *dtheta + 180.0;
- }
-
- /* Keep longitude/right ascension between 0 and 360 degrees */
- if (*dtheta > 360.0)
- *dtheta = *dtheta - 360.0;
- else if (*dtheta < 0.0)
- *dtheta = *dtheta + 360.0;
- return;
-}
-
-
-/* Convert from coordinate system sys1 to coordinate system sys2 */
-
-void
-wcscon (sys1, sys2, eq1, eq2, dtheta, dphi, epoch)
-
-int sys1; /* Input coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
-int sys2; /* Output coordinate system (J2000, B1950, ECLIPTIC, GALACTIC */
-double eq1; /* Input equinox (default of sys1 if 0.0) */
-double eq2; /* Output equinox (default of sys2 if 0.0) */
-double *dtheta; /* Longitude or right ascension in degrees
- Input in sys1, returned in sys2 */
-double *dphi; /* Latitude or declination in degrees
- Input in sys1, returned in sys2 */
-double epoch; /* Besselian epoch in years */
-
-{
- void fk5prec(), fk4prec();
-
- /* Set equinoxes if 0.0 */
- if (eq1 == 0.0) {
- if (sys1 == WCS_B1950)
- eq1 = 1950.0;
- else
- eq1 = 2000.0;
- }
- if (eq2 == 0.0) {
- if (sys2 == WCS_B1950)
- eq2 = 1950.0;
- else
- eq2 = 2000.0;
- }
-
- /* Set systems and equinoxes so that ICRS coordinates are not precessed */
- if (sys1 == WCS_ICRS && sys2 == WCS_ICRS)
- eq2 = eq1;
-
- if (sys1 == WCS_J2000 && sys2 == WCS_ICRS && eq1 == 2000.0) {
- eq2 = eq1;
- sys1 = sys2;
- }
-
- if (sys1 == WCS_ICRS && sys2 == WCS_J2000 && eq2 == 2000.0) {
- eq1 = eq2;
- sys1 = sys2;
- }
-
- /* If systems and equinoxes are the same, return */
- if (sys2 == sys1 && eq1 == eq2)
- return;
-
- /* Precess from input equinox, if necessary */
- if (eq1 != eq2) {
- if (sys1 == WCS_B1950 && eq1 != 1950.0)
- fk4prec (eq1, 1950.0, dtheta, dphi);
- if (sys1 == WCS_J2000 && eq1 != 2000.0)
- fk5prec (eq1, 2000.0, dtheta, dphi);
- }
-
- /* Convert to B1950 FK4 */
- if (sys2 == WCS_B1950) {
- if (sys1 == WCS_J2000) {
- if (epoch > 0)
- fk524e (dtheta, dphi, epoch);
- else
- fk524 (dtheta, dphi);
- }
- else if (sys1 == WCS_GALACTIC)
- gal2fk4 (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC) {
- if (epoch > 0)
- ecl2fk4 (dtheta, dphi, epoch);
- else
- ecl2fk4 (dtheta, dphi, 1950.0);
- }
- }
-
- else if (sys2 == WCS_J2000) {
- if (sys1 == WCS_B1950) {
- if (epoch > 0)
- fk425e (dtheta, dphi, epoch);
- else
- fk425 (dtheta, dphi);
- }
- else if (sys1 == WCS_GALACTIC)
- gal2fk5 (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC) {
- if (epoch > 0)
- ecl2fk5 (dtheta, dphi, epoch);
- else
- ecl2fk5 (dtheta, dphi, 2000.0);
- }
- }
-
- else if (sys2 == WCS_GALACTIC) {
- if (sys1 == WCS_B1950)
- fk42gal (dtheta, dphi);
- else if (sys1 == WCS_J2000)
- fk52gal (dtheta, dphi);
- else if (sys1 == WCS_ECLIPTIC) {
- if (epoch > 0)
- ecl2fk5 (dtheta, dphi, epoch);
- else
- ecl2fk5 (dtheta, dphi, 2000.0);
- fk52gal (dtheta, dphi);
- }
- }
-
- else if (sys2 == WCS_ECLIPTIC) {
- if (sys1 == WCS_B1950) {
- if (epoch > 0)
- fk42ecl (dtheta, dphi, epoch);
- else
- fk42ecl (dtheta, dphi, 1950.0);
- }
- else if (sys1 == WCS_J2000) {
- if (epoch > 0)
- fk52ecl (dtheta, dphi, epoch);
- else
- fk52ecl (dtheta, dphi, 2000.0);
- }
- else if (sys1 == WCS_GALACTIC) {
- gal2fk5 (dtheta, dphi);
- if (epoch > 0)
- fk52ecl (dtheta, dphi, epoch);
- else
- fk52ecl (dtheta, dphi, 2000.0);
- }
- }
-
- /* Precess to desired equinox, if necessary */
- if (eq1 != eq2) {
- if (sys2 == WCS_B1950 && eq2 != 1950.0)
- fk4prec (1950.0, eq2, dtheta, dphi);
- if (sys2 == WCS_J2000 && eq2 != 2000.0)
- fk5prec (2000.0, eq2, dtheta, dphi);
- }
-
- /* Keep latitude/declination between +90 and -90 degrees */
- if (*dphi > 90.0) {
- *dphi = 180.0 - *dphi;
- *dtheta = *dtheta + 180.0;
- }
- else if (*dphi < -90.0) {
- *dphi = -180.0 - *dphi;
- *dtheta = *dtheta + 180.0;
- }
-
- /* Keep longitude/right ascension between 0 and 360 degrees */
- if (*dtheta > 360.0)
- *dtheta = *dtheta - 360.0;
- else if (*dtheta < 0.0)
- *dtheta = *dtheta + 360.0;
-
- return;
-}
-
-
-/* Set coordinate system from string */
-int
-wcscsys (wcstring)
-
-char *wcstring; /* Name of coordinate system */
-{
- double equinox;
-
- if (wcstring[0] == 'J' || wcstring[0] == 'j' ||
- !strcmp (wcstring,"2000") || !strcmp (wcstring, "2000.0") ||
- !strcmp (wcstring,"ICRS") || !strcmp (wcstring, "icrs") ||
- !strncmp (wcstring,"FK5",3) || !strncmp (wcstring, "fk5",3))
- return WCS_J2000;
-
- if (wcstring[0] == 'B' || wcstring[0] == 'b' ||
- !strcmp (wcstring,"1950") || !strcmp (wcstring, "1950.0") ||
- !strncmp (wcstring,"FK4",3) || !strncmp (wcstring, "fk4",3))
- return WCS_B1950;
-
- else if (wcstring[0] == 'I' || wcstring[0] == 'i' )
- return WCS_ICRS;
-
- else if (wcstring[0] == 'G' || wcstring[0] == 'g' )
- return WCS_GALACTIC;
-
- else if (wcstring[0] == 'E' || wcstring[0] == 'e' )
- return WCS_ECLIPTIC;
-
- else if (wcstring[0] == 'A' || wcstring[0] == 'a' )
- return WCS_ALTAZ;
-
- else if (wcstring[0] == 'N' || wcstring[0] == 'n' )
- return WCS_NPOLE;
-
- else if (wcstring[0] == 'L' || wcstring[0] == 'l' )
- return WCS_LINEAR;
-
- else if (!strncasecmp (wcstring, "pixel", 5))
- return WCS_XY;
-
- else if (wcstring[0] == 'P' || wcstring[0] == 'p' )
- return WCS_PLANET;
-
- else if (isnum (wcstring)) {
- equinox = atof (wcstring);
- if (equinox > 1980.0)
- return WCS_J2000;
- else if (equinox > 1900.0)
- return WCS_B1950;
- else
- return -1;
- }
- else
- return -1;
-}
-
-
-/* Set equinox from string (return 0.0 if not obvious) */
-
-double
-wcsceq (wcstring)
-
-char *wcstring; /* Name of coordinate system */
-{
- if (wcstring[0] == 'J' || wcstring[0] == 'j' ||
- wcstring[0] == 'B' || wcstring[0] == 'b')
- return (atof (wcstring+1));
- else if (!strncmp (wcstring, "FK4",3) ||
- !strncmp (wcstring, "fk4",3))
- return (1950.0);
- else if (!strncmp (wcstring, "FK5",3) ||
- !strncmp (wcstring, "fk5",3))
- return (2000.0);
- else if (!strncmp (wcstring, "ICRS",4) ||
- !strncmp (wcstring, "icrs",4))
- return (2000.0);
- else if (wcstring[0] == '1' || wcstring[0] == '2')
- return (atof (wcstring));
- else
- return (0.0);
-}
-
-
-/* Set coordinate system type string from system and equinox */
-
-void
-wcscstr (cstr, syswcs, equinox, epoch)
-
-char *cstr; /* Coordinate system string (returned) */
-int syswcs; /* Coordinate system code */
-double equinox; /* Equinox of coordinate system */
-double epoch; /* Epoch of coordinate system */
-{
-
- char *estr;
-
- if (syswcs == WCS_XY) {
- strcpy (cstr, "XY");
- return;
- }
-
- /* Try to figure out coordinate system if it is not set */
- if (epoch == 0.0)
- epoch = equinox;
- if (syswcs < 0) {
- if (equinox > 0.0) {
- if (equinox == 2000.0)
- syswcs = WCS_J2000;
- else if (equinox == 1950.0)
- syswcs = WCS_B1950;
- }
- else if (epoch > 0.0) {
- if (epoch > 1980.0) {
- syswcs = WCS_J2000;
- equinox = 2000.0;
- }
- else {
- syswcs = WCS_B1950;
- equinox = 1950.0;
- }
- }
- else
- syswcs = WCS_J2000;
- }
-
- /* Set coordinate system string from system flag and epoch */
- if (syswcs == WCS_B1950) {
- if (epoch == 1950.0 || epoch == 0.0)
- strcpy (cstr, "B1950");
- else
- sprintf (cstr, "B%7.2f", equinox);
- if ((estr = strsrch (cstr,".00")) != NULL) {
- estr[0] = (char) 0;
- estr[1] = (char) 0;
- estr[2] = (char) 0;
- }
- }
- else if (syswcs == WCS_GALACTIC)
- strcpy (cstr, "galactic");
- else if (syswcs == WCS_ECLIPTIC)
- strcpy (cstr, "ecliptic");
- else if (syswcs == WCS_J2000) {
- if (epoch == 2000.0 || epoch == 0.0)
- strcpy (cstr, "J2000");
- else
- sprintf (cstr, "J%7.2f", equinox);
- if ((estr = strsrch (cstr,".00")) != NULL) {
- estr[0] = (char) 0;
- estr[1] = (char) 0;
- estr[2] = (char) 0;
- }
- }
- else if (syswcs == WCS_ICRS) {
- strcpy (cstr, "ICRS");
- }
- else if (syswcs == WCS_PLANET) {
- strcpy (cstr, "PLANET");
- }
- else if (syswcs == WCS_LINEAR || syswcs == WCS_XY) {
- strcpy (cstr, "LINEAR");
- }
- return;
-}
-
-
-/* Constant vector and matrix (by columns)
- These values were obtained by inverting C.Hohenkerk's forward matrix
- (private communication), which agrees with the one given in reference
- 2 but which has one additional decimal place. */
-
-static double a[3] = {-1.62557e-6, -0.31919e-6, -0.13843e-6};
-static double ad[3] = {1.245e-3, -1.580e-3, -0.659e-3};
-static double d2pi = 6.283185307179586476925287; /* two PI */
-static double tiny = 1.e-30; /* small number to avoid arithmetic problems */
-
-/* FK524 convert J2000 FK5 star data to B1950 FK4
- based on Starlink sla_fk524 by P.T.Wallace 27 October 1987 */
-
-static double emi[6][6] = {
- { 0.9999256795, /* emi[0][0] */
- 0.0111814828, /* emi[0][1] */
- 0.0048590039, /* emi[0][2] */
- -0.00000242389840, /* emi[0][3] */
- -0.00000002710544, /* emi[0][4] */
- -0.00000001177742 }, /* emi[0][5] */
-
- { -0.0111814828, /* emi[1][0] */
- 0.9999374849, /* emi[1][1] */
- -0.0000271771, /* emi[1][2] */
- 0.00000002710544, /* emi[1][3] */
- -0.00000242392702, /* emi[1][4] */
- 0.00000000006585 }, /* emi[1][5] */
-
- { -0.0048590040, /* emi[2][0] */
- -0.0000271557, /* emi[2][1] */
- 0.9999881946, /* emi[2][2] */
- 0.00000001177742, /* emi[2][3] */
- 0.00000000006585, /* emi[2][4] */
- -0.00000242404995 }, /* emi[2][5] */
-
- { -0.000551, /* emi[3][0] */
- 0.238509, /* emi[3][1] */
- -0.435614, /* emi[3][2] */
- 0.99990432, /* emi[3][3] */
- 0.01118145, /* emi[3][4] */
- 0.00485852 }, /* emi[3][5] */
-
- { -0.238560, /* emi[4][0] */
- -0.002667, /* emi[4][1] */
- 0.012254, /* emi[4][2] */
- -0.01118145, /* emi[4][3] */
- 0.99991613, /* emi[4][4] */
- -0.00002717 }, /* emi[4][5] */
-
- { 0.435730, /* emi[5][0] */
- -0.008541, /* emi[5][1] */
- 0.002117, /* emi[5][2] */
- -0.00485852, /* emi[5][3] */
- -0.00002716, /* emi[5][4] */
- 0.99996684 } /* emi[5][5] */
- };
-
-void
-fk524 (ra,dec)
-
-double *ra; /* Right ascension in degrees (J2000 in, B1950 out) */
-double *dec; /* Declination in degrees (J2000 in, B1950 out) */
-
-{
- double rapm; /* Proper motion in right ascension */
- double decpm; /* Proper motion in declination */
- /* In: deg/jul.yr. Out: deg/trop.yr. */
-
- rapm = (double) 0.0;
- decpm = (double) 0.0;
- fk524m (ra, dec, &rapm, &decpm);
- return;
-}
-
-void
-fk524e (ra, dec, epoch)
-
-double *ra; /* Right ascension in degrees (J2000 in, B1950 out) */
-double *dec; /* Declination in degrees (J2000 in, B1950 out) */
-double epoch; /* Besselian epoch in years */
-
-{
- double rapm; /* Proper motion in right ascension */
- double decpm; /* Proper motion in declination */
- /* In: deg/jul.yr. Out: deg/trop.yr. */
-
- rapm = (double) 0.0;
- decpm = (double) 0.0;
- fk524m (ra, dec, &rapm, &decpm);
- *ra = *ra + (rapm * (epoch - 1950.0));
- *dec = *dec + (decpm * (epoch - 1950.0));
- return;
-}
-
-void
-fk524m (ra,dec,rapm,decpm)
-
-double *ra; /* Right ascension in degrees (J2000 in, B1950 out) */
-double *dec; /* Declination in degrees (J2000 in, B1950 out) */
-double *rapm; /* Proper motion in right ascension */
-double *decpm; /* Proper motion in declination */
- /* In: ra/dec deg/jul.yr. Out: ra/dec deg/trop.yr. */
-
-{
- double parallax = 0.0;
- double rv = 0.0;
-
- fk524pv (ra, dec, rapm, decpm, &parallax, &rv);
- return;
-}
-
-
-void
-fk524pv (ra,dec,rapm,decpm, parallax, rv)
-
-double *ra; /* Right ascension in degrees (J2000 in, B1950 out) */
-double *dec; /* Declination in degrees (J2000 in, B1950 out) */
-double *rapm; /* Proper motion in right ascension */
-double *decpm; /* Proper motion in declination
- * In: ra/dec degrees/Julian year (not ra*cos(dec))
- * Out: ra/dec degrees/tropical year */
-double *parallax; /* Parallax (arcsec) */
-double *rv; /* Rradial velocity (km/s, +ve = moving away) */
-
-/* This routine converts stars from the IAU 1976 FK5 Fricke
- system, to the old Bessel-Newcomb FK4 system, using Yallop's
- implementation (see ref 2) of a matrix method due to Standish
- (see ref 3). The numerical values of ref 2 are used canonically.
-
- * Conversion from other than Julian epoch 2000.0 to other than Besselian
- epoch 1950.0 will require use of the appropriate precession, proper
- motion, and e-terms routines before and/or after fk524 is called.
-
- * In the FK4 catalogue the proper motions of stars within 10 degrees
- of the poles do not embody the differential e-term effect and should,
- strictly speaking, be handled in a different manner from stars outside
- these regions. however, given the general lack of homogeneity of the
- star data available for routine astrometry, the difficulties of handling
- positions that may have been determined from astrometric fields spanning
- the polar and non-polar regions, the likelihood that the differential
- e-terms effect was not taken into account when allowing for proper motion
- in past astrometry, and the undesirability of a discontinuity in the
- algorithm, the decision has been made in this routine to include the
- effect of differential e-terms on the proper motions for all stars,
- whether polar or not, at epoch 2000, and measuring on the sky rather
- than in terms of dra, the errors resulting from this simplification are
- less than 1 milliarcsecond in position and 1 milliarcsecond per century
- in proper motion.
-
- References:
-
- 1 "Mean and apparent place computations in the new IAU System.
- I. The transformation of astrometric catalog systems to the
- equinox J2000.0." Smith, C.A.; Kaplan, G.H.; Hughes, J.A.;
- Seidelmann, P.K.; Yallop, B.D.; Hohenkerk, C.Y.
- Astronomical Journal vol. 97, Jan. 1989, p. 265-273.
-
- 2 "Mean and apparent place computations in the new IAU System.
- II. Transformation of mean star places from FK4 B1950.0 to
- FK5 J2000.0 using matrices in 6-space." Yallop, B.D.;
- Hohenkerk, C.Y.; Smith, C.A.; Kaplan, G.H.; Hughes, J.A.;
- Seidelmann, P.K.; Astronomical Journal vol. 97, Jan. 1989,
- p. 274-279.
-
- 3 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to
- the Astronomical Almanac", ISBN 0-935702-68-7.
-
- 4 "Conversion of positions and proper motions from B1950.0 to the
- IAU system at J2000.0", Standish, E.M. Astronomy and
- Astrophysics, vol. 115, no. 1, Nov. 1982, p. 20-22.
-
- P.T.Wallace Starlink 19 December 1993
- Doug Mink Smithsonian Astrophysical Observatory 1 November 2000 */
-
-{
- double r2000,d2000; /* J2000.0 ra,dec (radians) */
- double r1950,d1950; /* B1950.0 ra,dec (rad) */
-
- /* Miscellaneous */
- double ur,ud;
- double sr, cr, sd, cd, x, y, z, w, wd;
- double v1[6],v2[6];
- double xd,yd,zd;
- double rxyz, rxysq, rxy;
- double dra,ddec;
- int i,j;
- int diag = 0;
-
- /* Constants */
- double zero = (double) 0.0;
- double vf = 21.095; /* Km per sec to AU per tropical century */
- /* = 86400 * 36524.2198782 / 149597870 */
-
- /* Convert J2000 RA and Dec from degrees to radians */
- r2000 = degrad (*ra);
- d2000 = degrad (*dec);
-
- /* Convert J2000 RA and Dec proper motion from degrees/year to arcsec/tc */
- ur = *rapm * 360000.0;
- ud = *decpm * 360000.0;
-
- /* Spherical to Cartesian */
- sr = sin (r2000);
- cr = cos (r2000);
- sd = sin (d2000);
- cd = cos (d2000);
-
- x = cr * cd;
- y = sr * cd;
- z = sd;
-
- v1[0] = x;
- v1[1] = y;
- v1[2] = z;
-
- if (ur != zero || ud != zero) {
- v1[3] = -(ur*y) - (cr*sd*ud);
- v1[4] = (ur*x) - (sr*sd*ud);
- v1[5] = (cd*ud);
- }
- else {
- v1[3] = zero;
- v1[4] = zero;
- v1[5] = zero;
- }
-
- /* Convert position + velocity vector to bn system */
- for (i = 0; i < 6; i++) {
- w = zero;
- for (j = 0; j < 6; j++) {
- w = w + emi[i][j] * v1[j];
- }
- v2[i] = w;
- }
-
- /* Vector components */
- x = v2[0];
- y = v2[1];
- z = v2[2];
-
- /* Magnitude of position vector */
- rxyz = sqrt (x*x + y*y + z*z);
-
- /* Apply e-terms to position */
- w = (x * a[0]) + (y * a[1]) + (z * a[2]);
- x = x + (a[0] * rxyz) - (w * x);
- y = y + (a[1] * rxyz) - (w * y);
- z = z + (a[2] * rxyz) - (w * z);
-
- /* Recompute magnitude of position vector */
- rxyz = sqrt (x*x + y*y + z*z);
-
- /* Apply e-terms to position and velocity */
- x = v2[0];
- y = v2[1];
- z = v2[2];
- w = (x * a[0]) + (y * a[1]) + (z * a[2]);
- wd = (x * ad[0]) + (y * ad[1]) + (z * ad[2]);
- x = x + (a[0] * rxyz) - (w * x);
- y = y + (a[1] * rxyz) - (w * y);
- z = z + (a[2] * rxyz) - (w * z);
- xd = v2[3] + (ad[0] * rxyz) - (wd * x);
- yd = v2[4] + (ad[1] * rxyz) - (wd * y);
- zd = v2[5] + (ad[2] * rxyz) - (wd * z);
-
- /* Convert to spherical */
- rxysq = (x * x) + (y * y);
- rxy = sqrt (rxysq);
-
- /* Convert back to spherical coordinates */
- if (x == zero && y == zero)
- r1950 = zero;
- else {
- r1950 = atan2 (y,x);
- if (r1950 < zero)
- r1950 = r1950 + d2pi;
- }
- d1950 = atan2 (z,rxy);
-
- if (rxy > tiny) {
- ur = (x*yd - y*xd) / rxysq;
- ud = (zd*rxysq - z * (x*xd + y*yd)) / ((rxysq + z*z) * rxy);
- }
-
- if (*parallax > tiny) {
- *rv = ((x * xd) + (y * yd) + (z * zd)) / (*parallax * vf * rxyz);
- *parallax = *parallax / rxyz;
- }
-
- /* Return results */
- *ra = raddeg (r1950);
- *dec = raddeg (d1950);
- *rapm = ur / 360000.0;
- *decpm = ud / 360000.0;
-
- if (diag) {
- dra = 240.0 * raddeg (r1950 - r2000);
- ddec = 3600.0 * raddeg (d1950 - d2000);
- fprintf(stderr,"B1950-J2000: dra= %11.5f sec ddec= %f11.5f arcsec\n",
- dra, ddec);
- }
-
- return;
-}
-
-
-/* Convert B1950.0 FK4 star data to J2000.0 FK5 */
-static double em[6][6] = {
- { 0.9999256782, /* em[0][0] */
- -0.0111820611, /* em[0][1] */
- -0.0048579477, /* em[0][2] */
- 0.00000242395018, /* em[0][3] */
- -0.00000002710663, /* em[0][4] */
- -0.00000001177656 }, /* em[0][5] */
-
- { 0.0111820610, /* em[1][0] */
- 0.9999374784, /* em[1][1] */
- -0.0000271765, /* em[1][2] */
- 0.00000002710663, /* em[1][3] */
- 0.00000242397878, /* em[1][4] */
- -0.00000000006587 }, /* em[1][5] */
-
- { 0.0048579479, /* em[2][0] */
- -0.0000271474, /* em[2][1] */
- 0.9999881997, /* em[2][2] */
- 0.00000001177656, /* em[2][3] */
- -0.00000000006582, /* em[2][4] */
- 0.00000242410173 }, /* em[2][5] */
-
- { -0.000551, /* em[3][0] */
- -0.238565, /* em[3][1] */
- 0.435739, /* em[3][2] */
- 0.99994704, /* em[3][3] */
- -0.01118251, /* em[3][4] */
- -0.00485767 }, /* em[3][5] */
-
- { 0.238514, /* em[4][0] */
- -0.002667, /* em[4][1] */
- -0.008541, /* em[4][2] */
- 0.01118251, /* em[4][3] */
- 0.99995883, /* em[4][4] */
- -0.00002718 }, /* em[4][5] */
-
- { -0.435623, /* em[5][0] */
- 0.012254, /* em[5][1] */
- 0.002117, /* em[5][2] */
- 0.00485767, /* em[5][3] */
- -0.00002714, /* em[5][4] */
- 1.00000956 } /* em[5][5] */
- };
-
-void
-fk425 (ra, dec)
-
-double *ra; /* Right ascension in degrees (B1950 in, J2000 out) */
-double *dec; /* Declination in degrees (B1950 in, J2000 out) */
-
-{
-double rapm; /* Proper motion in right ascension */
-double decpm; /* Proper motion in declination */
- /* In: rad/trop.yr. Out: rad/jul.yr. */
-
- rapm = (double) 0.0;
- decpm = (double) 0.0;
- fk425m (ra, dec, &rapm, &decpm);
- return;
-}
-
-
-void
-fk425e (ra, dec, epoch)
-
-double *ra; /* Right ascension in degrees (B1950 in, J2000 out) */
-double *dec; /* Declination in degrees (B1950 in, J2000 out) */
-double epoch; /* Besselian epoch in years */
-{
-double rapm; /* Proper motion in right ascension */
-double decpm; /* Proper motion in declination */
- /* In: rad/trop.yr. Out: rad/jul.yr. */
-
- rapm = (double) 0.0;
- decpm = (double) 0.0;
- fk425m (ra, dec, &rapm, &decpm);
- *ra = *ra + (rapm * (epoch - 2000.0));
- *dec = *dec + (decpm * (epoch - 2000.0));
- return;
-}
-
-void
-fk425m (ra, dec, rapm, decpm)
-
-double *ra, *dec; /* Right ascension and declination in degrees
- input: B1950.0,FK4 returned: J2000.0,FK5 */
-double *rapm, *decpm; /* Proper motion in right ascension and declination
- input: B1950.0,FK4 returned: J2000.0,FK5
- ra/dec deg/trop.yr. ra/dec deg/jul.yr. */
-{
- double parallax = 0.0;
- double rv = 0.0;
-
- fk425pv (ra, dec, rapm, decpm, &parallax, &rv);
- return;
-}
-
-
-void
-fk425pv (ra,dec,rapm,decpm, parallax, rv)
-
-double *ra; /* Right ascension in degrees (J2000 in, B1950 out) */
-double *dec; /* Declination in degrees (J2000 in, B1950 out) */
-double *rapm; /* Proper motion in right ascension */
-double *decpm; /* Proper motion in declination
- * In: ra/dec degrees/Julian year (not ra*cos(dec))
- * Out: ra/dec degrees/tropical year */
-double *parallax; /* Parallax (arcsec) */
-double *rv; /* Rradial velocity (km/s, +ve = moving away) */
-
-/* This routine converts stars from the old Bessel-Newcomb FK4 system
- to the IAU 1976 FK5 Fricke system, using Yallop's implementation
- (see ref 2) of a matrix method due to Standish (see ref 3). The
- numerical values of ref 2 are used canonically.
-
- * Conversion from other than Besselian epoch 1950.0 to other than Julian
- epoch 2000.0 will require use of the appropriate precession, proper
- motion, and e-terms routines before and/or after fk425 is called.
-
- * In the FK4 catalogue the proper motions of stars within 10 degrees
- of the poles do not embody the differential e-term effect and should,
- strictly speaking, be handled in a different manner from stars outside
- these regions. however, given the general lack of homogeneity of the
- star data available for routine astrometry, the difficulties of handling
- positions that may have been determined from astrometric fields spanning
- the polar and non-polar regions, the likelihood that the differential
- e-terms effect was not taken into account when allowing for proper motion
- in past astrometry, and the undesirability of a discontinuity in the
- algorithm, the decision has been made in this routine to include the
- effect of differential e-terms on the proper motions for all stars,
- whether polar or not, at epoch 2000, and measuring on the sky rather
- than in terms of dra, the errors resulting from this simplification are
- less than 1 milliarcsecond in position and 1 milliarcsecond per century
- in proper motion.
-
- References:
-
- 1 "Mean and apparent place computations in the new IAU System.
- I. The transformation of astrometric catalog systems to the
- equinox J2000.0." Smith, C.A.; Kaplan, G.H.; Hughes, J.A.;
- Seidelmann, P.K.; Yallop, B.D.; Hohenkerk, C.Y.
- Astronomical Journal vol. 97, Jan. 1989, p. 265-273.
-
- 2 "Mean and apparent place computations in the new IAU System.
- II. Transformation of mean star places from FK4 B1950.0 to
- FK5 J2000.0 using matrices in 6-space." Yallop, B.D.;
- Hohenkerk, C.Y.; Smith, C.A.; Kaplan, G.H.; Hughes, J.A.;
- Seidelmann, P.K.; Astronomical Journal vol. 97, Jan. 1989,
- p. 274-279.
-
- 3 "Conversion of positions and proper motions from B1950.0 to the
- IAU system at J2000.0", Standish, E.M. Astronomy and
- Astrophysics, vol. 115, no. 1, Nov. 1982, p. 20-22.
-
- P.T.Wallace Starlink 20 December 1993
- Doug Mink Smithsonian Astrophysical Observatory 7 June 1995 */
-
-{
- double r1950,d1950; /* B1950.0 ra,dec (rad) */
- double r2000,d2000; /* J2000.0 ra,dec (rad) */
-
- /* Miscellaneous */
- double ur,ud,sr,cr,sd,cd,w,wd;
- double x,y,z,xd,yd,zd, dra,ddec;
- double rxyz, rxysq, rxy, rxyzsq, spxy, spxyz;
- int i,j;
- int diag = 0;
-
- double r0[3],rd0[3]; /* star position and velocity vectors */
- double v1[6],v2[6]; /* combined position and velocity vectors */
-
- /* Constants */
- double zero = (double) 0.0;
- double vf = 21.095; /* Km per sec to AU per tropical century */
- /* = 86400 * 36524.2198782 / 149597870 */
-
- /* Convert B1950 RA and Dec from degrees to radians */
- r1950 = degrad (*ra);
- d1950 = degrad (*dec);
-
- /* Convert B1950 RA and Dec proper motion from degrees/year to arcsec/tc */
- ur = *rapm * 360000.0;
- ud = *decpm * 360000.0;
-
- /* Convert direction to Cartesian */
- sr = sin (r1950);
- cr = cos (r1950);
- sd = sin (d1950);
- cd = cos (d1950);
- r0[0] = cr * cd;
- r0[1] = sr * cd;
- r0[2] = sd;
-
- /* Convert motion to Cartesian */
- w = vf * *rv * *parallax;
- if (ur != zero || ud != zero || (*rv != zero && *parallax != zero)) {
- rd0[0] = (-sr * cd * ur) - (cr * sd * ud) + (w * r0[0]);
- rd0[1] = (cr * cd * ur) - (sr * sd * ud) + (w * r0[1]);
- rd0[2] = (cd * ud) + (w * r0[2]);
- }
- else {
- rd0[0] = zero;
- rd0[1] = zero;
- rd0[2] = zero;
- }
-
- /* Remove e-terms from position and express as position+velocity 6-vector */
- w = (r0[0] * a[0]) + (r0[1] * a[1]) + (r0[2] * a[2]);
- for (i = 0; i < 3; i++)
- v1[i] = r0[i] - a[i] + (w * r0[i]);
-
- /* Remove e-terms from proper motion and express as 6-vector */
- wd = (r0[0] * ad[0]) + (r0[1] * ad[1]) + (r0[2] * ad[2]);
- for (i = 0; i < 3; i++)
- v1[i+3] = rd0[i] - ad[i] + (wd * r0[i]);
-
- /* Alternately: Put proper motion in 6-vector without adding e-terms
- for (i = 0; i < 3; i++)
- v1[i+3] = rd0[i]; */
-
- /* Convert position + velocity vector to FK5 system */
- for (i = 0; i < 6; i++) {
- w = zero;
- for (j = 0; j < 6; j++) {
- w += em[i][j] * v1[j];
- }
- v2[i] = w;
- }
-
- /* Vector components */
- x = v2[0];
- y = v2[1];
- z = v2[2];
- xd = v2[3];
- yd = v2[4];
- zd = v2[5];
-
- /* Magnitude of position vector */
- rxysq = x*x + y*y;
- rxy = sqrt (rxysq);
- rxyzsq = rxysq + z*z;
- rxyz = sqrt (rxyzsq);
-
- spxy = (x * xd) + (y * yd);
- spxyz = spxy + (z * zd);
-
- /* Convert back to spherical coordinates */
- if (x == zero && y == zero)
- r2000 = zero;
- else {
- r2000 = atan2 (y,x);
- if (r2000 < zero)
- r2000 = r2000 + d2pi;
- }
- d2000 = atan2 (z,rxy);
-
- if (rxy > tiny) {
- ur = ((x * yd) - (y * xd)) / rxysq;
- ud = ((zd * rxysq) - (z * spxy)) / (rxyzsq * rxy);
- }
-
- if (*parallax > tiny) {
- *rv = spxyz / (*parallax * rxyz * vf);
- *parallax = *parallax / rxyz;
- }
-
- /* Return results */
- *ra = raddeg (r2000);
- *dec = raddeg (d2000);
- *rapm = ur / 360000.0;
- *decpm = ud / 360000.0;
-
- if (diag) {
- dra = 240.0 * raddeg (r2000 - r1950);
- ddec = 3600.0 * raddeg (d2000 - d1950);
- fprintf(stderr,"J2000-B1950: dra= %11.5f sec ddec= %f11.5f arcsec\n",
- dra, ddec);
- }
- return;
-}
-
-int idg=0;
-
-/* l2,b2 system of galactic coordinates
- * p = 192.25 ra of galactic north pole (mean b1950.0)
- * q = 62.6 inclination of galactic to mean b1950.0 equator
- * r = 33 longitude of ascending node
- * p,q,r are degrees
-
- * Equatorial to galactic rotation matrix
- (The Eulerian angles are p, q, 90-r)
- +cp.cq.sr-sp.cr +sp.cq.sr+cp.cr -sq.sr
- -cp.cq.cr-sp.sr -sp.cq.cr+cp.sr +sq.cr
- cp.sq +sp.sq +cq
- */
-
-static
-double bgal[3][3] =
- {{-0.066988739415,-0.872755765852,-0.483538914632},
- {0.492728466075,-0.450346958020, 0.744584633283},
- {-0.867600811151,-0.188374601723, 0.460199784784}};
-
-/*--- Transform B1950.0 FK4 equatorial coordinates to
- * IAU 1958 galactic coordinates */
-
-void
-fk42gal (dtheta,dphi)
-
-double *dtheta; /* B1950.0 FK4 right ascension in degrees
- Galactic longitude (l2) in degrees (returned) */
-double *dphi; /* B1950.0 FK4 declination in degrees
- Galactic latitude (b2) in degrees (returned) */
-
-/* Input equatorial coordinates are B1950 FK4.
- Use fk52gal() to convert from j2000.0 coordinates.
- Reference: Blaauw et al, MNRAS,121,123 (1960) */
-{
- double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
- void v2s3(),s2v3();
- int i;
- char *eqcoor, *eqstrn();
-
- dra = *dtheta;
- ddec = *dphi;
- rra = degrad (dra);
- rdec = degrad (ddec);
-
- /* remove e-terms */
- /* call jpabe (rra,rdec,-1,idg) */
-
- /* Spherical to Cartesian */
- r = 1.;
- s2v3 (rra,rdec,r,pos);
-
- /* rotate to galactic */
- for (i = 0; i<3; i++) {
- pos1[i] = pos[0]*bgal[i][0] + pos[1]*bgal[i][1] + pos[2]*bgal[i][2];
- }
-
- /* Cartesian to spherical */
- v2s3 (pos1,&rl,&rb,&r);
-
- dl = raddeg (rl);
- db = raddeg (rb);
- *dtheta = dl;
- *dphi = db;
-
- /* Print result if in diagnostic mode */
- if (idg) {
- eqcoor = eqstrn (dra,ddec);
- fprintf (stderr,"FK42GAL: B1950 RA,Dec= %s\n",eqcoor);
- fprintf (stderr,"FK42GAL: long = %.5f lat = %.5f\n",dl,db);
- free (eqcoor);
- }
-
- return;
-}
-
-
-/*--- Transform IAU 1958 galactic coordinates to B1950.0 'FK4'
- * equatorial coordinates */
-
-void
-gal2fk4 (dtheta,dphi)
-
-double *dtheta; /* Galactic longitude (l2) in degrees
- B1950 FK4 RA in degrees (returned) */
-double *dphi; /* Galactic latitude (b2) in degrees
- B1950 FK4 Dec in degrees (returned) */
-
-/* Output equatorial coordinates are B1950.0 FK4.
- Use gal2fk5() to convert to J2000 coordinates.
- Reference: Blaauw et al, MNRAS,121,123 (1960) */
-
-{
- double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
- void v2s3(),s2v3();
- char *eqcoor, *eqstrn();
- int i;
-
- /* spherical to cartesian */
- dl = *dtheta;
- db = *dphi;
- rl = degrad (dl);
- rb = degrad (db);
- r = 1.0;
- s2v3 (rl,rb,r,pos);
-
- /* rotate to equatorial coordinates */
- for (i = 0; i < 3; i++) {
- pos1[i] = pos[0]*bgal[0][i] + pos[1]*bgal[1][i] + pos[2]*bgal[2][i];
- }
-
- /* cartesian to spherical */
- v2s3 (pos1,&rra,&rdec,&r);
-
-/* introduce e-terms */
-/* jpabe (rra,rdec,-1,idg); */
-
- dra = raddeg (rra);
- ddec = raddeg (rdec);
- *dtheta = dra;
- *dphi = ddec;
-
- /* print result if in diagnostic mode */
- if (idg) {
- fprintf (stderr,"GAL2FK4: long = %.5f lat = %.5f\n",dl,db);
- eqcoor = eqstrn (dra,ddec);
- fprintf (stderr,"GAL2FK4: B1950 RA,Dec= %s\n",eqcoor);
- free (eqcoor);
- }
-
- return;
-}
-
-
-/* l2,b2 system of galactic coordinates
- p = 192.25 ra of galactic north pole (mean b1950.0)
- q = 62.6 inclination of galactic to mean b1950.0 equator
- r = 33 longitude of ascending node
- p,q,r are degrees */
-
-/* Equatorial to galactic rotation matrix
- The eulerian angles are p, q, 90-r
- +cp.cq.sr-sp.cr +sp.cq.sr+cp.cr -sq.sr
- -cp.cq.cr-sp.sr -sp.cq.cr+cp.sr +sq.cr
- +cp.sq +sp.sq +cq */
-
-static
-double jgal[3][3] =
- {{-0.054875539726,-0.873437108010,-0.483834985808},
- {0.494109453312,-0.444829589425, 0.746982251810},
- {-0.867666135858,-0.198076386122, 0.455983795705}};
-
-/* Transform J2000 equatorial coordinates to IAU 1958 galactic coordinates */
-
-void
-fk52gal (dtheta,dphi)
-
-double *dtheta; /* J2000 right ascension in degrees
- Galactic longitude (l2) in degrees (returned) */
-double *dphi; /* J2000 declination in degrees
- Galactic latitude (b2) in degrees (returned) */
-
-/* Rotation matrices by P.T.Wallace, Starlink eqgal and galeq, March 1986 */
-
-/* Input equatorial coordinates are J2000 FK5.
- Use gal2fk4() if converting from B1950 FK4 coordinates.
- Reference: Blaauw et al, MNRAS,121,123 (1960) */
-{
- double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
- void v2s3(),s2v3();
- char *eqcoor, *eqstrn();
- int i;
-
- /* Spherical to cartesian */
- dra = *dtheta;
- ddec = *dphi;
- rra = degrad (dra);
- rdec = degrad (ddec);
- r = 1.0;
- (void)s2v3 (rra,rdec,r,pos);
-
- /* Rotate to galactic */
- for (i = 0; i < 3; i++) {
- pos1[i] = pos[0]*jgal[i][0] + pos[1]*jgal[i][1] + pos[2]*jgal[i][2];
- }
-
- /* Cartesian to spherical */
- v2s3 (pos1,&rl,&rb,&r);
-
- dl = raddeg (rl);
- db = raddeg (rb);
- *dtheta = dl;
- *dphi = db;
-
- /* Print result if in diagnostic mode */
- if (idg) {
- eqcoor = eqstrn (dra,ddec);
- fprintf (stderr,"FK52GAL: J2000 RA,Dec= %s\n",eqcoor);
- fprintf (stderr,"FK52GAL: long = %.5f lat = %.5f\n",dl,db);
- free (eqcoor);
- }
-
- return;
-}
-
-
-/*--- Transform IAU 1958 galactic coordinates to J2000 equatorial coordinates */
-
-void
-gal2fk5 (dtheta,dphi)
-
-double *dtheta; /* Galactic longitude (l2) in degrees
- J2000.0 ra in degrees (returned) */
-double *dphi; /* Galactic latitude (b2) in degrees
- J2000.0 dec in degrees (returned) */
-
-/* Output equatorial coordinates are J2000.
- Use gal2fk4() to convert to B1950 coordinates.
- Reference: Blaauw et al, MNRAS,121,123 (1960) */
-
-{
- double pos[3],pos1[3],r,dl,db,rl,rb,rra,rdec,dra,ddec;
- void v2s3(),s2v3();
- int i;
- char *eqcoor, *eqstrn();
-
- /* Spherical to Cartesian */
- dl = *dtheta;
- db = *dphi;
- rl = degrad (dl);
- rb = degrad (db);
- r = 1.0;
- s2v3 (rl,rb,r,pos);
-
- /* Rotate to equatorial coordinates */
- for (i = 0; i < 3; i++) {
- pos1[i] = pos[0]*jgal[0][i] + pos[1]*jgal[1][i] + pos[2]*jgal[2][i];
- }
-
- /* Cartesian to Spherical */
- v2s3 (pos1,&rra,&rdec,&r);
- dra = raddeg (rra);
- ddec = raddeg (rdec);
- *dtheta = dra;
- *dphi = ddec;
-
- /* Print result if in diagnostic mode */
- if (idg) {
- fprintf (stderr,"GAL2FK5: long = %.5f lat = %.5f\n",dl,db);
- eqcoor = eqstrn (dra,ddec);
- fprintf (stderr,"GAL2FK5: J2000 RA,Dec= %s\n",eqcoor);
- free (eqcoor);
- }
-
- return;
-}
-
-
-/* Return string with right ascension in hours and declination in degrees */
-
-char *eqstrn (dra, ddec)
-
-double dra; /* Right ascension in degrees */
-double ddec; /* Declination in degrees */
-
-{
-char *eqcoor; /* ASCII character string of position (returned) */
-char decp;
-int rah,irm,decd,decm;
-double xpos,ypos,xp,yp,ras,decs;
-
- /* Right ascension to hours, minutes, and seconds */
- xpos = dra / 15.0;
- rah = (int) xpos;
- xp = (double) 60.0 * (xpos - (double) rah);
- irm = (int) xp;
- ras = (double) 60.0 * (xp - (double) irm);
-
- /* Declination to degrees, minutes, seconds */
- if (ddec < 0) {
- ypos = -ddec;
- decp = '-';
- }
- else {
- decp = '+';
- ypos = ddec;
- }
- decd = (int) ypos;
- yp = (double) 60.0 * (ypos - (double) decd);
- decm = (int) yp;
- decs = (double) 60.0 * (yp - (double) decm);
-
- eqcoor = malloc (32);
- (void)sprintf (eqcoor,"%02d:%02d:%06.3f %c%02d:%02d:%05.2f",
- rah,irm,ras,decp,decd,decm,decs);
- if (eqcoor[6] == ' ')
- eqcoor[6] = '0';
- if (eqcoor[20] == ' ')
- eqcoor[20] = '0';
-
- return (eqcoor);
-}
-
-
-/* Convert geocentric equatorial rectangular coordinates to
- right ascension and declination, and distance */
-
-
-/* These routines are based on similar ones in Pat Wallace's slalib package */
-
-/* Convert B1950 right ascension and declination to ecliptic coordinates */
-
-void
-fk42ecl (dtheta, dphi, epoch)
-
-double *dtheta; /* B1950 right ascension in degrees
- Galactic longitude (l2) in degrees (returned) */
-double *dphi; /* B1950 declination in degrees
- Galactic latitude (b2) in degrees (returned) */
-double epoch; /* Besselian epoch in years */
-
-{
- void fk425e(), fk52ecl();
-
- /* Convert from B1950 to J2000 coordinates */
- fk425e (dtheta, dphi, epoch);
-
- /* Convert from J2000 to ecliptic coordinates */
- fk52ecl (dtheta, dphi, epoch);
-
- return;
-}
-
-/* Convert J2000 right ascension and declination to ecliptic coordinates */
-
-void
-fk52ecl (dtheta, dphi, epoch)
-
-double *dtheta; /* J2000 right ascension in degrees
- Galactic longitude (l2) in degrees (returned) */
-double *dphi; /* J2000 declination in degrees
- Galactic latitude (b2) in degrees (returned) */
-double epoch; /* Besselian epoch in years */
-
-{
- int i, j;
- double t, eps0, rphi, rtheta;
- double v1[3], v2[3], r;
- double rmat[9], *rmati; /* Rotation matrix */
-
- void rotmat(), v2s3(), s2v3(), fk5prec();
-
- /* Precess coordinates from J2000 to epoch */
- if (epoch != 2000.0)
- fk5prec (2000.0, epoch, dtheta, dphi);
-
- /* Convert from degrees to radians */
- rtheta = degrad (*dtheta);
- rphi = degrad (*dphi);
-
- /* Convert RA,Dec to x,y,z */
- r = 1.0;
- s2v3 (rtheta, rphi, r, v1);
-
- /* Interval between basic epoch J2000.0 and current epoch (JC) in centuries*/
- t = (epoch - 2000.0) * 0.01;
-
- /* Mean obliquity */
- eps0 = secrad ((84381.448 + (-46.8150 + (-0.00059 + 0.001813*t) * t) * t));
-
- /* Form the equatorial to ecliptic rotation matrix (IAU 1980 theory).
- * References: Murray, C.A., Vectorial Astrometry, section 4.3.
- * The matrix is in the sense v[ecl] = rmat * v[equ]; the
- * equator, equinox and ecliptic are mean of date. */
- rotmat (1, eps0, 0.0, 0.0, rmat);
-
- /* Multiply position vector by equatoria to eccliptic rotation matrix */
- rmati = rmat;
- for (i = 0; i < 3; i++) {
- v2[i] = 0;
- for (j = 0; j < 3; j++)
- v2[i] = v2[i] + (*rmati++ * v1[j]);
- }
-
- /* Convert x,y,z to latitude, longitude */
- v2s3 (v2, &rtheta, &rphi, &r);
-
- /* Convert from radians to degrees */
- *dtheta = raddeg (rtheta);
- *dphi = raddeg (rphi);
-}
-
-
-/* Convert ecliptic coordinates to B1950 right ascension and declination */
-
-void
-ecl2fk4 (dtheta, dphi, epoch)
-
-double *dtheta; /* Galactic longitude (l2) in degrees
- B1950 right ascension in degrees (returned) */
-double *dphi; /* Galactic latitude (b2) in degrees
- B1950 declination in degrees (returned) */
-double epoch; /* Besselian epoch in years */
-
-{
- void ecl2fk5(), fk524e();
-
- /* Convert from ecliptic to J2000 coordinates */
- ecl2fk5 (dtheta, dphi, epoch);
-
- /* Convert from J2000 to B1950 coordinates */
- fk524e (dtheta, dphi, epoch);
-
- return;
-}
-
-
-
-/* Convert ecliptic coordinates to J2000 right ascension and declination */
-
-void
-ecl2fk5 (dtheta, dphi, epoch)
-
-double *dtheta; /* Galactic longitude (l2) in degrees
- J2000 right ascension in degrees (returned) */
-double *dphi; /* Galactic latitude (b2) in degrees
- J2000 declination in degrees (returned) */
-double epoch; /* Besselian epoch in years */
-
-{
- int i, j;
- double rtheta, rphi, v1[3], v2[3];
- double t, eps0, r;
- double rmat[9]; /* Rotation matrix */
- void v2s3(),s2v3(), fk5prec(), rotmat();
-
- rtheta = degrad (*dtheta);
- rphi = degrad (*dphi);
-
- /* Convert RA,Dec to x,y,z */
- r = 1.0;
- s2v3 (rtheta, rphi, r, v1);
-
- /* Interval between basic epoch J2000.0 and current epoch (JC) in centuries*/
- t = (epoch - 2000.0) * 0.01;
-
- /* Mean obliquity */
- eps0 = secrad ((84381.448 + (-46.8150 + (-0.00059 + 0.001813*t) * t) * t));
-
- /* Form the equatorial to ecliptic rotation matrix (IAU 1980 theory).
- * References: Murray, C.A., Vectorial Astrometry, section 4.3.
- * The matrix is in the sense v[ecl] = rmat * v[equ]; the
- * equator, equinox and ecliptic are mean of date. */
- rotmat (1, eps0, 0.0, 0.0, rmat);
-
- /* Multiply position vector by ecliptic to equatorial rotation matrix */
- for (i = 0; i < 3; i++) {
- v2[i] = 0;
- for (j = 0; j < 3; j++)
- v2[i] = v2[i] + (rmat[3*j + i] * v1[j]);
- }
-
- /* Cartesian to spherical */
- v2s3 (v2, &rtheta, &rphi, &r);
-
- /* Convert from radians to degrees */
- *dtheta = raddeg (rtheta);
- *dphi = raddeg (rphi);
-
- if (epoch != 2000.0)
- fk5prec (epoch, 2000.0, dtheta, dphi);
-}
-
-
-/* The following routines are modified from Patrick Wallace's SLALIB */
-
-/* Precess coordinates between epochs in FK4 */
-void
-fk4prec (ep0, ep1, ra, dec)
-
-double ep0; /* Starting Besselian epoch */
-double ep1; /* Ending Besselian epoch */
-double *ra; /* RA in degrees mean equator & equinox of epoch ep0
- mean equator & equinox of epoch ep1 (returned) */
-double *dec; /* Dec in degrees mean equator & equinox of epoch ep0
- mean equator & equinox of epoch ep1 (returned) */
-/*
-** Precession - FK4 (Bessel-Newcomb, pre-IAU1976)
-**
-** This routine will not correctly convert between FK4 and FK5
-** For output in FK5, precess to 1950.0 and use fk425() on result.
-**
-** Based on slaPreces(), P.T.Wallace Starlink 22 December 1993
-*/
-{
- int i, j;
- double pm[9], *pmi, v1[3], v2[3], rra, rdec, r;
- void v2s3(),s2v3(), mprecfk4();
-
- rra = degrad (*ra);
- rdec = degrad (*dec);
- r = 1.0;
-
- /* Generate appropriate precession matrix */
- mprecfk4 ( ep0, ep1, pm );
-
- /* Convert RA,Dec to x,y,z */
- s2v3 (rra, rdec, r, v1);
-
- /* Multiply position vector by precession matrix */
- pmi = pm;
- for (i = 0; i < 3; i++) {
- v2[i] = 0;
- for (j = 0; j < 3; j++)
- v2[i] = v2[i] + (*pmi++ * v1[j]);
- }
-
- /* Back to RA,Dec */
- v2s3 (v2, &rra, &rdec, &r);
-
- /* Convert from radians to degrees */
- *ra = raddeg (rra);
- *dec = raddeg (rdec);
-}
-
-void
-fk5prec (ep0, ep1, ra, dec)
-
-double ep0; /* Starting epoch */
-double ep1; /* Ending epoch */
-double *ra; /* RA in degrees mean equator & equinox of epoch ep0
- mean equator & equinox of epoch ep1 (returned) */
-double *dec; /* Dec in degrees mean equator & equinox of epoch ep0
- mean equator & equinox of epoch ep1 (returned) */
-/*
-** Precession - FK5 (Fricke, post-IAU1976)
-**
-** This routine will not correctly convert between FK5 and FK4.
-** For output in FK4, precess to 2000.0 and use fk524() on result.
-**
-** Based on slaPreces(), P.T.Wallace Starlink 22 December 1993
-*/
-{
- int i, j;
- double pm[9], *pmi, v1[3], v2[3], rra, rdec, r;
- void v2s3(),s2v3(), mprecfk5();
-
- rra = degrad (*ra);
- rdec = degrad (*dec);
- r = 1.0;
-
- /* Generate appropriate precession matrix */
- mprecfk5 (ep0, ep1, pm);
-
- /* Convert RA,Dec to x,y,z */
- s2v3 (rra, rdec, r, v1);
-
- /* Multiply position vector by precession matrix */
- pmi = pm;
- for (i = 0; i < 3; i++) {
- v2[i] = 0;
- for (j = 0; j < 3; j++)
- v2[i] = v2[i] + ( v1[j] * *pmi++ );
- }
-
- /* Back to RA,Dec */
- v2s3 (v2, &rra, &rdec, &r);
-
- /* Convert from radians to degrees */
- *ra = raddeg (rra);
- *dec = raddeg (rdec);
- return;
-}
-
-
-void
-mprecfk4 (bep0, bep1, rmatp)
-
-double bep0; /* Beginning Besselian epoch */
-double bep1; /* Ending Besselian epoch */
-double rmatp[9]; /* 3x3 Precession matrix (returned) */
-
-/*
-** Generate the matrix of precession between two epochs,
-** using the old, pre-IAU1976, Bessel-Newcomb model, using
-** Kinoshita's formulation (double precision)
-**
-** The matrix is in the sense v(bep1) = rmatp * v(bep0)
-**
-** Reference:
-** Kinoshita, H. (1975) 'Formulas for precession', SAO Special
-** Report No. 364, Smithsonian Institution Astrophysical
-** Observatory, Cambridge, Massachusetts.
-**
-** Based on slaPrebn() by P.T.Wallace Starlink 30 October 1993
-*/
-{
- double bigt, t, tas2r, w, zeta, z, theta;
- void rotmat();
-
- /* Interval between basic epoch B1850.0 and beginning epoch in TC */
- bigt = ( bep0 - 1850.0 ) / 100.0;
-
- /* Interval over which precession required, in tropical centuries */
- t = ( bep1 - bep0 ) / 100.0;
-
- /* Euler angles */
- tas2r = secrad (t);
- w = 2303.5548 + ( 1.39720 + 0.000059 * bigt ) * bigt;
- zeta = (w + ( 0.30242 - 0.000269 * bigt + 0.017996 * t ) * t ) * tas2r;
- z = (w + ( 1.09478 + 0.000387 * bigt + 0.018324 * t ) * t ) * tas2r;
- theta = ( 2005.1125 + ( - 0.85294 - 0.000365* bigt ) * bigt +
- ( - 0.42647 - 0.000365 * bigt - 0.041802 * t ) * t ) * tas2r;
-
- /* Rotation matrix */
- rotmat (323, -zeta, theta, -z, rmatp);
- return;
-}
-
-
-void
-mprecfk5 (ep0, ep1, rmatp)
-
-double ep0; /* Beginning epoch */
-double ep1; /* Ending epoch */
-double rmatp[9]; /* 3x3 Precession matrix (returned) */
-
-/*
-** Form the matrix of precession between two epochs (IAU 1976, FK5).
-** Notes:
-** 1) The epochs are TDB (loosely ET) Julian epochs.
-** 2) The matrix is in the sense v(ep1) = rmatp * v(ep0) .
-**
-** References:
-** Lieske,J.H., 1979. Astron. Astrophys.,73,282.
-** equations (6) & (7), p283.
-** Kaplan,G.H., 1981. USNO circular no. 163, pa2.
-**
-** Based on slaPrec(), P.T.Wallace Starlink 31 October 1993
-*/
-{
- double t0, t, tas2r, w, zeta, z, theta;
- void rotmat();
-
- /* Interval between basic epoch J2000.0 and beginning epoch (JC) */
- t0 = ( ep0 - 2000.0 ) / 100.0;
-
- /* Interval over which precession required (JC) */
- t = ( ep1 - ep0 ) / 100.0;
-
- /* Euler angles */
- tas2r = secrad (t);
- w = 2306.2181 + ( ( 1.39656 - ( 0.000139 * t0 ) ) * t0 );
- zeta = (w + ( ( 0.30188 - 0.000344 * t0 ) + 0.017998 * t ) * t ) * tas2r;
- z = (w + ( ( 1.09468 + 0.000066 * t0 ) + 0.018203 * t ) * t ) * tas2r;
- theta = ( ( 2004.3109 + ( - 0.85330 - 0.000217 * t0 ) * t0 )
- + ( ( -0.42665 - 0.000217 * t0 ) - 0.041833 * t ) * t ) * tas2r;
-
- /* Rotation matrix */
- rotmat (323, -zeta, theta, -z, rmatp);
- return;
-}
-
-
-/* Make 3-D rotation matrix from up to three rotations */
-
-void
-rotmat (axes, rot1, rot2, rot3, matrix)
-
-int axes; /* Axes about which coordinates are rotated (1=x, 2=y, 3=z) */
-double rot1; /* First rotation in degrees */
-double rot2; /* Second rotation in degrees */
-double rot3; /* Third rotation in degrees */
-double *matrix; /* 3x3 rotation matrix (returned) */
-
-{
- int i, j, k, naxis, iaxes, iaxis;
- double rot[3], srot, crot, *mati, w, wm[9], *wmi, matn[9];
- int axis[3];
-
- /* Initial final rotation matrix */
- mati = matrix;
- for (i = 0; i < 3; i++) {
- for (j=0; j < 3; j++) {
- if (i == j)
- *mati++ = 1.0;
- else
- *mati++ = 0.0;
- }
- }
-
- /* Separate digits of rotation axis string and count rotations */
- naxis = 0;
- iaxes = axes;
- axis[0] = iaxes / 100;
- if (axis[0] > 0) {
- naxis++;
- iaxes = iaxes - (100 * axis[0]);
- }
- axis[naxis] = iaxes / 10;
- if (axis[naxis] > 0) {
- iaxes = iaxes - (10 * axis[naxis]);
- naxis++;
- }
- axis[naxis] = iaxes;
- if (axis[naxis] > 0)
- naxis++;
-
- /* Set up rotation angles */
- rot[0] = rot1;
- rot[1] = rot2;
- rot[2] = rot3;
-
- /* For each digit of axis string, set up matrix */
- for (iaxis = 0; iaxis < naxis; iaxis++) {
-
- /* Initialize current rotation matrix */
- mati = matn;
- for (i = 0; i < 3; i++) {
- for (j=0; j < 3; j++) {
- if (i == j)
- *mati++ = 1.0;
- else
- *mati++ = 0.0;
- }
- }
-
- srot = sin (rot[iaxis]);
- crot = cos (rot[iaxis]);
-
- /* Matrix for rotation in X */
- if (axis[iaxis] == 1) {
- matn[4] = crot;
- matn[5] = srot;
- matn[7] = -srot;
- matn[8] = crot;
- }
-
- /* Matrix for rotation in Y */
- else if (axis[iaxis] == 2) {
- matn[0] = crot;
- matn[2] = -srot;
- matn[6] = srot;
- matn[8] = crot;
- }
-
- /* Matrix for rotation in Z */
- else {
- matn[0] = crot;
- matn[1] = srot;
- matn[3] = -srot;
- matn[4] = crot;
- }
-
- /* Multiply existing rotation matrix by new rotation matrix */
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 3; j++) {
- w = 0.0;
- for (k = 0; k < 3; k++)
- w+= matn[3*i + k] * matrix[3*k + j];
- wm[3*i + j] = w;
- }
- }
-
- /* Update output matrix */
- mati = matrix;
- wmi = wm;
- for (i = 0; i < 9; i++) {
- *mati++ = *wmi++;
- }
- }
- return;
-}
-
-
-/* The following routines are from Doug Mink's Fortran ephemeris library */
-
-/* Convert right ascensiona and declination in degrees and distance to
- geocentric equatorial rectangular coordinates */
-
-void
-d2v3 (rra,rdec,r,pos)
-
-double rra; /* Right ascension in degrees */
-double rdec; /* Declination in degrees */
-double r; /* Distance to object in same units as pos */
-double pos[3]; /* x,y,z geocentric equatorial position of object (returned) */
-{
- s2v3 (degrad (rra), degrad (rdec), r, pos);
-
- return;
-}
-
-
-/* Convert right ascension, declination, and distance to
- geocentric equatorial rectangular coordinates */
-
-void
-s2v3 (rra,rdec,r,pos)
-
-double rra; /* Right ascension in radians */
-double rdec; /* Declination in radians */
-double r; /* Distance to object in same units as pos */
-double pos[3]; /* x,y,z geocentric equatorial position of object (returned) */
-{
- pos[0] = r * cos (rra) * cos (rdec);
- pos[1] = r * sin (rra) * cos (rdec);
- pos[2] = r * sin (rdec);
-
- return;
-}
-
-
-/* Convert geocentric equatorial rectangular coordinates to
- right ascension and declination in degrees and distance */
-
-void
-v2d3 (pos,rra,rdec,r)
-
-double pos[3]; /* x,y,z geocentric equatorial position of object */
-double *rra; /* Right ascension in degrees (returned) */
-double *rdec; /* Declination in degrees (returned) */
-double *r; /* Distance to object in same units as pos (returned) */
-{
- v2s3 (pos, rra, rdec, r);
- *rra = raddeg (*rra);
- *rdec = raddeg (*rdec);
- return;
-}
-
-/* Convert geocentric equatorial rectangular coordinates to
- right ascension, declination, and distance */
-
-void
-v2s3 (pos,rra,rdec,r)
-
-double pos[3]; /* x,y,z geocentric equatorial position of object */
-double *rra; /* Right ascension in radians (returned) */
-double *rdec; /* Declination in radians (returned) */
-double *r; /* Distance to object in same units as pos (returned) */
-{
- double x,y,z,rxy,rxy2,z2;
-
- x = pos[0];
- y = pos[1];
- z = pos[2];
-
- *rra = atan2 (y, x);
-
- /* Keep RA within 0 to 2pi range */
- if (*rra < 0.0)
- *rra = *rra + (2.0 * PI);
- if (*rra > 2.0 * PI)
- *rra = *rra - (2.0 * PI);
-
- rxy2 = x*x + y*y;
- rxy = sqrt (rxy2);
- *rdec = atan2 (z, rxy);
-
- z2 = z * z;
- *r = sqrt (rxy2 + z2);
-
- return;
-}
-
-/*
- * Nov 6 1995 Include stdlib.h instead of malloc.h
- * Apr 1 1996 Add arbitrary epoch precession
- * Apr 26 1996 Add FK4 <-> FK5 subroutines for use when epoch is known
- * Aug 6 1996 Clean up after lint
- * Nov 4 1996 Break SLA subroutines into separate file slasubs.c
- * Dec 9 1996 Change arguments to degrees in FK4 and FK5 precession programs
- * Dec 10 1996 All subroutine arguments are degrees except vector conversions
- *
- * Mar 20 1997 Drop unused variables after lint
- *
- * Apr 14 1998 Add ecliptic coordinate conversions and general conversion routines
- * Apr 23 1998 Add LINEAR coordinate system
- * Apr 28 1998 Change coordinate system flags to WCS_*
- * Apr 28 1998 Return -1 from wcscsys if not a legal coordinate system
- * May 7 1998 Keep theta within 0 to 2pi in ecl2fk5()
- * May 13 1998 Add wcsceq()
- * May 13 1998 Add equinox arguments to wcscon()
- * Jun 24 1998 Set J2000 from ICRS in wcscsys()
- * Jul 9 1998 Include stdio.h for fprintf() and sprintf() declarations
- * Sep 17 1998 Add wcscstr() to get coordinate string
- * Sep 21 1998 Fix bug in wcscstr() which returned B2000 instead of J2000
- * Sep 21 1998 Add subroutine to convert proper motions, too.
- * Oct 21 1998 In wcscstr(), drop .00 from returned string
- * Nov 18 1998 Rename jpcop() v2s3() and jpcon() s2v3() (spherical to vector)
- * Dec 2 1998 Add PLANET coordinate system to wcscsys() and wcscstr()
- *
- * Mar 10 2000 Precess coordinates correctly from other than 1950.0 and 2000.0
- * Mar 10 2000 Set coordinate system to J2000 or B1950 if string is numeric
- * Mar 14 2000 Clean up code in fk524m() and fk425m()
- * May 31 2000 Add proper motion correctly if proper motion precessed
- * Jun 26 2000 Add some support for WCS_XY image coordinates
- * Sep 14 2000 Return -1 from wcscsys if equinox is less than 1900.0
- * Oct 31 2000 Add proper motion after fk425 or fk524 from system epoch
- * Oct 31 2000 Fix proper motion units in fk524p() and fk425p()
- * Nov 6 2000 Update fk425 and fk524 algorithms to include parallax and rv
- *
- * Jan 11 2001 Print all messages to stderr
- * Mar 21 2001 Move braces around bgal[] and jgal[] matrix initialization
- *
- * Feb 13 2002 Fix precession units problem in ecl2fk5() and fk52ecl()
- *
- * Apr 13 2005 Replace all sla_lib calls with local code
- * Nov 1 2005 Add WCS_ICRS, and unprecessable system
- *
- * Jan 5 2006 Fix bugs in precession subroutines mprecxxx()
- * May 3 2006 Drop declarations of unused variables suggested by Robert Lupton
- * Oct 6 2006 If pixel coordinates, set system to WCS_XY in wcscsys()
- * Oct 30 2006 Add LINEAR and ICRS to wcscstr() returns
- *
- * Aug 15 2007 Clean up code in rotmat()
- * Nov 8 2007 In wcsconp, make it clear that proper motion is in spherical coordinates
- *
- * Mar 29 2010 Fix bug in computing the magnitude of the e-terms in fk524()
- * Mar 30 2010 Drop ep1 assignment after line 178 in wcsconp()
- */
diff --git a/funtools/wcs/wcsinit.c b/funtools/wcs/wcsinit.c
deleted file mode 100644
index 134c1bf..0000000
--- a/funtools/wcs/wcsinit.c
+++ /dev/null
@@ -1,1611 +0,0 @@
-/*** File libwcs/wcsinit.c
- *** October 19, 2012
- *** By Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** Copyright (C) 1998-2012
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
-
- * Module: wcsinit.c (World Coordinate Systems)
- * Purpose: Convert FITS WCS to pixels and vice versa:
- * Subroutine: wcsinit (hstring) sets a WCS structure from an image header
- * Subroutine: wcsninit (hstring,lh) sets a WCS structure from fixed-length header
- * Subroutine: wcsinitn (hstring, name) sets a WCS structure for specified WCS
- * Subroutine: wcsninitn (hstring,lh, name) sets a WCS structure for specified WCS
- * Subroutine: wcsinitc (hstring, mchar) sets a WCS structure if multiple
- * Subroutine: wcsninitc (hstring,lh,mchar) sets a WCS structure if multiple
- * Subroutine: wcschar (hstring, name) returns suffix for specifed WCS
- * Subroutine: wcseq (hstring, wcs) set radecsys and equinox from image header
- * Subroutine: wcseqm (hstring, wcs, mchar) set radecsys and equinox if multiple
- */
-
-#include <string.h> /* strstr, NULL */
-#include <stdio.h> /* stderr */
-#include <math.h>
-#include "wcs.h"
-#ifndef VMS
-#include <stdlib.h>
-#endif
-
-static void wcseq();
-static void wcseqm();
-static void wcsioset();
-void wcsrotset();
-char wcschar();
-
-/* set up a WCS structure from a FITS image header lhstring bytes long
- * for a specified WCS name */
-
-struct WorldCoor *
-wcsninitn (hstring, lhstring, name)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-int lhstring; /* Length of FITS header in bytes */
-const char *name; /* character string with identifying name of WCS */
-{
- hlength (hstring, lhstring);
- return (wcsinitn (hstring, name));
-}
-
-
-/* set up a WCS structure from a FITS image header for specified WCSNAME */
-
-struct WorldCoor *
-wcsinitn (hstring, name)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-const char *name; /* character string with identifying name of WCS */
-{
- char mchar; /* Suffix character for one of multiple WCS */
-
- mchar = wcschar (hstring, name);
- if (mchar == '_') {
- fprintf (stderr, "WCSINITN: WCS name %s not matched in FITS header\n",
- name);
- return (NULL);
- }
- return (wcsinitc (hstring, &mchar));
-}
-
-
-/* WCSCHAR -- Find the letter for a specific WCS conversion */
-
-char
-wcschar (hstring, name)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-const char *name; /* Name of WCS conversion to be matched
- (case-independent) */
-{
- char *upname, *uppercase();
- char cwcs, charwcs;
- int iwcs;
- char keyword[12];
- char *upval, value[72];
-
- /* If no WCS character, return 0 */
- if (name == NULL)
- return ((char) 0);
-
- /* Convert input name to upper case */
- upname = uppercase (name);
-
- /* If single character name, return that character */
- if (strlen (upname) == 1)
- return (upname[0]);
-
- /* Try to match input name to available WCSNAME names in header */
- strcpy (keyword, "WCSNAME");
- keyword[8] = (char) 0;
- charwcs = '_';
- for (iwcs = 0; iwcs < 27; iwcs++) {
- if (iwcs > 0)
- cwcs = (char) (64 + iwcs);
- else
- cwcs = (char) 0;
- keyword[7] = cwcs;
- if (hgets (hstring, keyword, 72, value)) {
- upval = uppercase (value);
- if (!strcmp (upval, upname))
- charwcs = cwcs;
- free (upval);
- }
- }
- free (upname);
- return (charwcs);
-}
-
-
-/* Make string of arbitrary case all uppercase */
-
-char *
-uppercase (string)
-char *string;
-{
- int lstring, i;
- char *upstring;
-
- lstring = strlen (string);
- upstring = (char *) calloc (1,lstring+1);
- for (i = 0; i < lstring; i++) {
- if (string[i] > 96 && string[i] < 123)
- upstring[i] = string[i] - 32;
- else
- upstring[i] = string[i];
- }
- upstring[lstring] = (char) 0;
- return (upstring);
-}
-
-
-/* set up a WCS structure from a FITS image header lhstring bytes long */
-
-struct WorldCoor *
-wcsninit (hstring, lhstring)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-int lhstring; /* Length of FITS header in bytes */
-{
- char mchar; /* Suffix character for one of multiple WCS */
- mchar = (char) 0;
- hlength (hstring, lhstring);
- return (wcsinitc (hstring, &mchar));
-}
-
-
-/* set up a WCS structure from a FITS image header lhstring bytes long */
-
-struct WorldCoor *
-wcsninitc (hstring, lhstring, mchar)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-int lhstring; /* Length of FITS header in bytes */
-char *mchar; /* Suffix character for one of multiple WCS */
-{
- hlength (hstring, lhstring);
- if (mchar[0] == ' ')
- mchar[0] = (char) 0;
- return (wcsinitc (hstring, mchar));
-}
-
-
-/* set up a WCS structure from a FITS image header */
-
-struct WorldCoor *
-wcsinit (hstring)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-{
- char mchar; /* Suffix character for one of multiple WCS */
- mchar = (char) 0;
- return (wcsinitc (hstring, &mchar));
-}
-
-
-/* set up a WCS structure from a FITS image header for specified suffix */
-
-struct WorldCoor *
-wcsinitc (hstring, wchar)
-
-const char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-char *wchar; /* Suffix character for one of multiple WCS */
-{
- struct WorldCoor *wcs, *depwcs;
- char ctype1[32], ctype2[32], tstring[32];
- char pvkey1[8],pvkey2[8],pvkey3[8];
- char *hcoeff; /* pointer to first coeff's in header */
- char decsign;
- double rah,ram,ras, dsign,decd,decm,decs;
- double dec_deg,ra_hours, secpix, ra0, ra1, dec0, dec1, cvel;
- double cdelt1, cdelt2, cd[4], pc[81];
- char keyword[16];
- int ieq, i, j, k, naxes, cd11p, cd12p, cd21p, cd22p;
- int ilat; /* coordinate for latitude or declination */
- /*
- int ix1, ix2, iy1, iy2, idx1, idx2, idy1, idy2;
- double dxrefpix, dyrefpix;
- */
- char temp[80];
- char wcsname[64]; /* Name of WCS depended on by current WCS */
- char mchar;
- char cspace = (char) ' ';
- char cnull = (char) 0;
- double mjd;
- double rot;
- double ut;
- int nax;
- int twod;
- extern int tnxinit();
- extern int zpxinit();
- extern int platepos();
- extern int dsspos();
- void invert_wcs();
-
- wcs = (struct WorldCoor *) calloc (1, sizeof(struct WorldCoor));
-
- /* Set WCS character and name in structure */
- mchar = wchar[0];
- if (mchar == ' ')
- mchar = cnull;
- wcs->wcschar = mchar;
- if (hgetsc (hstring, "WCSNAME", &mchar, 63, wcsname)) {
- wcs->wcsname = (char *) calloc (strlen (wcsname)+2, 1);
- strcpy (wcs->wcsname, wcsname);
- }
-
-
- /* Set WCSLIB flags so that structures will be reinitialized */
- wcs->cel.flag = 0;
- wcs->lin.flag = 0;
- wcs->wcsl.flag = 0;
- wcs->wcsl.cubeface = -1;
-
- /* Initialize to no plate fit */
- wcs->ncoeff1 = 0;
- wcs->ncoeff2 = 0;
-
- /* Initialize to no CD matrix */
- cdelt1 = 0.0;
- cdelt2 = 0.0;
- cd[0] = 0.0;
- cd[1] = 0.0;
- cd[2] = 0.0;
- cd[3] = 0.0;
- pc[0] = 0.0;
- wcs->rotmat = 0;
- wcs->rot = 0.0;
-
- /* Header parameters independent of projection */
- naxes = 0;
- hgeti4c (hstring, "WCSAXES", &mchar, &naxes);
- if (naxes == 0)
- hgeti4 (hstring, "WCSAXES", &naxes);
- if (naxes == 0)
- hgeti4 (hstring, "NAXIS", &naxes);
- if (naxes == 0)
- hgeti4 (hstring, "WCSDIM", &naxes);
- if (naxes < 1) {
- setwcserr ("WCSINIT: No WCSAXES, NAXIS, or WCSDIM keyword");
- wcsfree (wcs);
- return (NULL);
- }
- if (naxes > 2)
- naxes = 2;
- wcs->naxis = naxes;
- wcs->naxes = naxes;
- wcs->lin.naxis = naxes;
- wcs->nxpix = 0;
- hgetr8 (hstring, "NAXIS1", &wcs->nxpix);
- if (wcs->nxpix < 1)
- hgetr8 (hstring, "IMAGEW", &wcs->nxpix);
- if (wcs->nxpix < 1) {
- setwcserr ("WCSINIT: No NAXIS1 or IMAGEW keyword");
- wcsfree (wcs);
- return (NULL);
- }
- wcs->nypix = 0;
- hgetr8 (hstring, "NAXIS2", &wcs->nypix);
- if (wcs->nypix < 1)
- hgetr8 (hstring, "IMAGEH", &wcs->nypix);
- if (naxes > 1 && wcs->nypix < 1) {
- setwcserr ("WCSINIT: No NAXIS2 or IMAGEH keyword");
- wcsfree (wcs);
- return (NULL);
- }
-
- /* Reset number of axes to only those with dimension greater than one */
- nax = 0;
- for (i = 0; i < naxes; i++) {
-
- /* Check for number of pixels in axis more than one */
- strcpy (keyword, "NAXIS");
- sprintf (temp, "%d", i+1);
- strcat (keyword, temp);
- if (!hgeti4 (hstring, keyword, &j)) {
- if (i == 0 && wcs->nxpix > 1) {
- /* fprintf (stderr,"WCSINIT: Missing keyword %s set to %.0f from IMAGEW\n",
- keyword, wcs->nxpix); */
- j = wcs->nxpix;
- }
- else if (i == 1 && wcs->nypix > 1) {
- /* fprintf (stderr,"WCSINIT: Missing keyword %s set to %.0f from IMAGEH\n",
- keyword, wcs->nypix); */
- j = wcs->nypix;
- }
- else
- fprintf (stderr,"WCSINIT: Missing keyword %s assumed 1\n",keyword);
- }
-
- /* Check for TAB WCS in axis */
- strcpy (keyword, "CTYPE");
- strcat (keyword, temp);
- if (hgets (hstring, keyword, 16, temp)) {
- if (strsrch (temp, "-TAB"))
- j = 0;
- }
- if (j > 1) nax = nax + 1;
- }
- naxes = nax;
- wcs->naxes = nax;
- wcs->naxis = nax;
-
- hgets (hstring, "INSTRUME", 16, wcs->instrument);
- hgeti4 (hstring, "DETECTOR", &wcs->detector);
- wcs->wcsproj = getdefwcs();
- wcs->logwcs = 0;
- hgeti4 (hstring, "DC-FLAG", &wcs->logwcs);
-
- /* Initialize rotation matrices */
- for (i = 0; i < 81; i++) wcs->pc[i] = 0.0;
- for (i = 0; i < 81; i++) pc[i] = 0.0;
- for (i = 0; i < naxes; i++) wcs->pc[(i*naxes)+i] = 1.0;
- for (i = 0; i < naxes; i++) pc[(i*naxes)+i] = 1.0;
- for (i = 0; i < 9; i++) wcs->cdelt[i] = 0.0;
- for (i = 0; i < naxes; i++) wcs->cdelt[i] = 1.0;
-
- /* If the current world coordinate system depends on another, set it now */
- if (hgetsc (hstring, "WCSDEP",&mchar, 63, wcsname)) {
- if ((wcs->wcs = wcsinitn (hstring, wcsname)) == NULL) {
- setwcserr ("WCSINIT: depended on WCS could not be set");
- wcsfree (wcs);
- return (NULL);
- }
- depwcs = wcs->wcs;
- depwcs->wcsdep = wcs;
- }
- else
- wcs->wcs = NULL;
-
- /* Read radial velocity from image header */
- wcs->radvel = 0.0;
- wcs->zvel = 0.0;
- cvel = 299792.5;
- if (hgetr8c (hstring, "VSOURCE", &mchar, &wcs->radvel))
- wcs->zvel = wcs->radvel / cvel;
- else if (hgetr8c (hstring, "ZSOURCE", &mchar, &wcs->zvel))
- wcs->radvel = wcs->zvel * cvel;
- else if (hgetr8 (hstring, "VELOCITY", &wcs->radvel))
- wcs->zvel = wcs->radvel / cvel;
-
- for (i = 0; i < 10; i++) {
- wcs->prj.p[i] = 0.0;
- }
-
- /* World coordinate system reference coordinate information */
- if (hgetsc (hstring, "CTYPE1", &mchar, 16, ctype1)) {
-
- /* Read second coordinate type */
- strcpy (ctype2, ctype1);
- if (!hgetsc (hstring, "CTYPE2", &mchar, 16, ctype2))
- twod = 0;
- else
- twod = 1;
- strcpy (wcs->ctype[0], ctype1);
- strcpy (wcs->ctype[1], ctype2);
- if (strsrch (ctype2, "LAT") || strsrch (ctype2, "DEC"))
- ilat = 2;
- else
- ilat = 1;
-
- /* Read third and fourth coordinate types, if present */
- strcpy (wcs->ctype[2], "");
- hgetsc (hstring, "CTYPE3", &mchar, 9, wcs->ctype[2]);
- strcpy (wcs->ctype[3], "");
- hgetsc (hstring, "CTYPE4", &mchar, 9, wcs->ctype[3]);
-
- /* Set projection type in WCS data structure */
- if (wcstype (wcs, ctype1, ctype2)) {
- wcsfree (wcs);
- return (NULL);
- }
-
- /* Get units, if present, for linear coordinates */
- if (wcs->prjcode == WCS_LIN) {
- if (!hgetsc (hstring, "CUNIT1", &mchar, 16, wcs->units[0])) {
- if (!mgetstr (hstring, "WAT1", "units", 16, wcs->units[0])) {
- wcs->units[0][0] = 0;
- }
- }
- if (!strcmp (wcs->units[0], "pixel"))
- wcs->prjcode = WCS_PIX;
- if (twod) {
- if (!hgetsc (hstring, "CUNIT2", &mchar, 16, wcs->units[1])) {
- if (!mgetstr (hstring, "WAT2", "units", 16, wcs->units[1])) {
- wcs->units[1][0] = 0;
- }
- }
- if (!strcmp (wcs->units[0], "pixel"))
- wcs->prjcode = WCS_PIX;
- }
- }
-
- /* Reference pixel coordinates and WCS value */
- wcs->crpix[0] = 1.0;
- hgetr8c (hstring, "CRPIX1", &mchar, &wcs->crpix[0]);
- wcs->crpix[1] = 1.0;
- hgetr8c (hstring, "CRPIX2", &mchar, &wcs->crpix[1]);
- wcs->xrefpix = wcs->crpix[0];
- wcs->yrefpix = wcs->crpix[1];
- wcs->crval[0] = 0.0;
- hgetr8c (hstring, "CRVAL1", &mchar, &wcs->crval[0]);
- wcs->crval[1] = 0.0;
- hgetr8c (hstring, "CRVAL2", &mchar, &wcs->crval[1]);
- if (wcs->syswcs == WCS_NPOLE)
- wcs->crval[1] = 90.0 - wcs->crval[1];
- if (wcs->syswcs == WCS_SPA)
- wcs->crval[1] = wcs->crval[1] - 90.0;
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- if (wcs->coorflip) {
- wcs->cel.ref[0] = wcs->crval[1];
- wcs->cel.ref[1] = wcs->crval[0];
- }
- else {
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- }
- wcs->longpole = 999.0;
- hgetr8c (hstring, "LONPOLE", &mchar, &wcs->longpole);
- wcs->cel.ref[2] = wcs->longpole;
- wcs->latpole = 999.0;
- hgetr8c (hstring, "LATPOLE", &mchar, &wcs->latpole);
- wcs->cel.ref[3] = wcs->latpole;
- wcs->lin.crpix = wcs->crpix;
- wcs->lin.cdelt = wcs->cdelt;
- wcs->lin.pc = wcs->pc;
-
- /* Projection constants (this should be projection-dependent */
- wcs->prj.r0 = 0.0;
- hgetr8c (hstring, "PROJR0", &mchar, &wcs->prj.r0);
-
- /* FITS WCS interim proposal projection constants */
- for (i = 0; i < 10; i++) {
- sprintf (keyword,"PROJP%d",i);
- hgetr8c (hstring, keyword, &mchar, &wcs->prj.p[i]);
- }
-
- sprintf (pvkey1, "PV%d_1", ilat);
- sprintf (pvkey2, "PV%d_2", ilat);
- sprintf (pvkey3, "PV%d_3", ilat);
-
- /* FITS WCS standard projection constants (projection-dependent) */
- if (wcs->prjcode == WCS_AZP || wcs->prjcode == WCS_SIN ||
- wcs->prjcode == WCS_COP || wcs->prjcode == WCS_COE ||
- wcs->prjcode == WCS_COD || wcs->prjcode == WCS_COO) {
- hgetr8c (hstring, pvkey1, &mchar, &wcs->prj.p[1]);
- hgetr8c (hstring, pvkey2, &mchar, &wcs->prj.p[2]);
- }
- else if (wcs->prjcode == WCS_SZP) {
- hgetr8c (hstring, pvkey1, &mchar, &wcs->prj.p[1]);
- hgetr8c (hstring, pvkey2, &mchar, &wcs->prj.p[2]);
- if (wcs->prj.p[3] == 0.0)
- wcs->prj.p[3] = 90.0;
- hgetr8c (hstring, pvkey3, &mchar, &wcs->prj.p[3]);
- }
- else if (wcs->prjcode == WCS_CEA) {
- if (wcs->prj.p[1] == 0.0)
- wcs->prj.p[1] = 1.0;
- hgetr8c (hstring, pvkey1, &mchar, &wcs->prj.p[1]);
- }
- else if (wcs->prjcode == WCS_CYP) {
- if (wcs->prj.p[1] == 0.0)
- wcs->prj.p[1] = 1.0;
- hgetr8c (hstring, pvkey1, &mchar, &wcs->prj.p[1]);
- if (wcs->prj.p[2] == 0.0)
- wcs->prj.p[2] = 1.0;
- hgetr8c (hstring, pvkey2, &mchar, &wcs->prj.p[2]);
- }
- else if (wcs->prjcode == WCS_AIR) {
- if (wcs->prj.p[1] == 0.0)
- wcs->prj.p[1] = 90.0;
- hgetr8c (hstring, pvkey1, &mchar, &wcs->prj.p[1]);
- }
- else if (wcs->prjcode == WCS_BON) {
- hgetr8c (hstring, pvkey1, &mchar, &wcs->prj.p[1]);
- }
- else if (wcs->prjcode == WCS_ZPN) {
- for (i = 0; i < 10; i++) {
- sprintf (keyword,"PV%d_%d", ilat, i);
- hgetr8c (hstring, keyword, &mchar, &wcs->prj.p[i]);
- }
- }
-
- /* Initialize TNX, defaulting to TAN if there is a problem */
- if (wcs->prjcode == WCS_TNX) {
- if (tnxinit (hstring, wcs)) {
- wcs->ctype[0][6] = 'A';
- wcs->ctype[0][7] = 'N';
- wcs->ctype[1][6] = 'A';
- wcs->ctype[1][7] = 'N';
- wcs->prjcode = WCS_TAN;
- }
- }
-
- /* Initialize ZPX, defaulting to ZPN if there is a problem */
- if (wcs->prjcode == WCS_ZPX) {
- if (zpxinit (hstring, wcs)) {
- wcs->ctype[0][7] = 'N';
- wcs->ctype[1][7] = 'N';
- wcs->prjcode = WCS_ZPN;
- }
- }
-
- /* Set TPV to TAN as SCAMP coefficients will be added below */
- if (wcs->prjcode == WCS_TPV) {
- wcs->ctype[0][6] = 'A';
- wcs->ctype[0][7] = 'N';
- wcs->ctype[1][6] = 'A';
- wcs->ctype[1][7] = 'N';
- wcs->prjcode = WCS_TAN;
- }
-
- /* Coordinate reference frame, equinox, and epoch */
- if (wcs->wcsproj > 0)
- wcseqm (hstring, wcs, &mchar);
- wcsioset (wcs);
-
- /* Read distortion coefficients, if present */
- distortinit (wcs, hstring);
-
- /* Use polynomial fit instead of projection, if present */
- wcs->ncoeff1 = 0;
- wcs->ncoeff2 = 0;
- cd11p = hgetr8c (hstring, "CD1_1", &mchar, &cd[0]);
- cd12p = hgetr8c (hstring, "CD1_2", &mchar, &cd[1]);
- cd21p = hgetr8c (hstring, "CD2_1", &mchar, &cd[2]);
- cd22p = hgetr8c (hstring, "CD2_2", &mchar, &cd[3]);
- if (wcs->wcsproj != WCS_OLD &&
- (hcoeff = ksearch (hstring,"CO1_1")) != NULL) {
- wcs->prjcode = WCS_PLT;
- (void)strcpy (wcs->ptype, "PLATE");
- for (i = 0; i < 20; i++) {
- sprintf (keyword,"CO1_%d", i+1);
- wcs->x_coeff[i] = 0.0;
- if (hgetr8 (hcoeff, keyword, &wcs->x_coeff[i]))
- wcs->ncoeff1 = i + 1;
- }
- hcoeff = ksearch (hstring,"CO2_1");
- for (i = 0; i < 20; i++) {
- sprintf (keyword,"CO2_%d",i+1);
- wcs->y_coeff[i] = 0.0;
- if (hgetr8 (hcoeff, keyword, &wcs->y_coeff[i]))
- wcs->ncoeff2 = i + 1;
- }
-
- /* Compute a nominal scale factor */
- platepos (wcs->crpix[0], wcs->crpix[1], wcs, &ra0, &dec0);
- platepos (wcs->crpix[0], wcs->crpix[1]+1.0, wcs, &ra1, &dec1);
- wcs->yinc = dec1 - dec0;
- wcs->xinc = -wcs->yinc;
-
- /* Compute image rotation angle */
- wcs->wcson = 1;
- wcsrotset (wcs);
- rot = degrad (wcs->rot);
-
- /* Compute scale at reference pixel */
- platepos (wcs->crpix[0], wcs->crpix[1], wcs, &ra0, &dec0);
- platepos (wcs->crpix[0]+cos(rot),
- wcs->crpix[1]+sin(rot), wcs, &ra1, &dec1);
- wcs->cdelt[0] = -wcsdist (ra0, dec0, ra1, dec1);
- wcs->xinc = wcs->cdelt[0];
- platepos (wcs->crpix[0]+sin(rot),
- wcs->crpix[1]+cos(rot), wcs, &ra1, &dec1);
- wcs->cdelt[1] = wcsdist (ra0, dec0, ra1, dec1);
- wcs->yinc = wcs->cdelt[1];
-
- /* Set CD matrix from header */
- wcs->cd[0] = cd[0];
- wcs->cd[1] = cd[1];
- wcs->cd[2] = cd[2];
- wcs->cd[3] = cd[3];
- (void) matinv (2, wcs->cd, wcs->dc);
- }
-
- /* Else use CD matrix, if present */
- else if (cd11p || cd12p || cd21p || cd22p) {
- wcs->rotmat = 1;
- wcscdset (wcs, cd);
- }
-
- /* Else get scaling from CDELT1 and CDELT2 */
- else if (hgetr8c (hstring, "CDELT1", &mchar, &cdelt1) != 0) {
- hgetr8c (hstring, "CDELT2", &mchar, &cdelt2);
-
- /* If CDELT1 or CDELT2 is 0 or missing */
- if (cdelt1 == 0.0 || (wcs->nypix > 1 && cdelt2 == 0.0)) {
- if (ksearch (hstring,"SECPIX") != NULL ||
- ksearch (hstring,"PIXSCALE") != NULL ||
- ksearch (hstring,"PIXSCAL1") != NULL ||
- ksearch (hstring,"XPIXSIZE") != NULL ||
- ksearch (hstring,"SECPIX1") != NULL) {
- secpix = 0.0;
- hgetr8 (hstring,"SECPIX",&secpix);
- if (secpix == 0.0)
- hgetr8 (hstring,"PIXSCALE",&secpix);
- if (secpix == 0.0) {
- hgetr8 (hstring,"SECPIX1",&secpix);
- if (secpix != 0.0) {
- if (cdelt1 == 0.0)
- cdelt1 = -secpix / 3600.0;
- if (cdelt2 == 0.0) {
- hgetr8 (hstring,"SECPIX2",&secpix);
- cdelt2 = secpix / 3600.0;
- }
- }
- else {
- hgetr8 (hstring,"XPIXSIZE",&secpix);
- if (secpix != 0.0) {
- if (cdelt1 == 0.0)
- cdelt1 = -secpix / 3600.0;
- if (cdelt2 == 0.0) {
- hgetr8 (hstring,"YPIXSIZE",&secpix);
- cdelt2 = secpix / 3600.0;
- }
- }
- else {
- hgetr8 (hstring,"PIXSCAL1",&secpix);
- if (secpix != 0.0 && cdelt1 == 0.0)
- cdelt1 = -secpix / 3600.0;
- if (cdelt2 == 0.0) {
- hgetr8 (hstring,"PIXSCAL2",&secpix);
- cdelt2 = secpix / 3600.0;
- }
- }
- }
- }
- else {
- if (cdelt1 == 0.0)
- cdelt1 = -secpix / 3600.0;
- if (cdelt2 == 0.0)
- cdelt2 = secpix / 3600.0;
- }
- }
- }
- if (cdelt2 == 0.0 && wcs->nypix > 1)
- cdelt2 = -cdelt1;
- wcs->cdelt[2] = 1.0;
- wcs->cdelt[3] = 1.0;
-
- /* Initialize rotation matrix */
- for (i = 0; i < 81; i++) {
- pc[i] = 0.0;
- wcs->pc[i] = 0.0;
- }
- for (i = 0; i < naxes; i++)
- pc[(i*naxes)+i] = 1.0;
-
- /* Read FITS WCS interim rotation matrix */
- if (!mchar && hgetr8 (hstring,"PC001001",&pc[0]) != 0) {
- k = 0;
- for (i = 0; i < naxes; i++) {
- for (j = 0; j < naxes; j++) {
- if (i == j)
- pc[k] = 1.0;
- else
- pc[k] = 0.0;
- sprintf (keyword, "PC00%1d00%1d", i+1, j+1);
- hgetr8 (hstring, keyword, &pc[k++]);
- }
- }
- wcspcset (wcs, cdelt1, cdelt2, pc);
- }
-
- /* Read FITS WCS standard rotation matrix */
- else if (hgetr8c (hstring, "PC1_1", &mchar, &pc[0]) != 0) {
- k = 0;
- for (i = 0; i < naxes; i++) {
- for (j = 0; j < naxes; j++) {
- if (i == j)
- pc[k] = 1.0;
- else
- pc[k] = 0.0;
- sprintf (keyword, "PC%1d_%1d", i+1, j+1);
- hgetr8c (hstring, keyword, &mchar, &pc[k++]);
- }
- }
- wcspcset (wcs, cdelt1, cdelt2, pc);
- }
-
- /* Otherwise, use CROTAn */
- else {
- rot = 0.0;
- if (ilat == 2)
- hgetr8c (hstring, "CROTA2", &mchar, &rot);
- else
- hgetr8c (hstring,"CROTA1", &mchar, &rot);
- wcsdeltset (wcs, cdelt1, cdelt2, rot);
- }
- }
-
- /* If no scaling is present, set to 1 per pixel, no rotation */
- else {
- wcs->xinc = 1.0;
- wcs->yinc = 1.0;
- wcs->cdelt[0] = 1.0;
- wcs->cdelt[1] = 1.0;
- wcs->rot = 0.0;
- wcs->rotmat = 0;
- setwcserr ("WCSINIT: setting CDELT to 1");
- }
-
- /* SCAMP convention */
- if (wcs->prjcode == WCS_TAN && wcs->naxis == 2) {
- int n = 0;
- if (wcs->inv_x) {
- poly_end(wcs->inv_x);
- wcs->inv_x = NULL;
- }
- if (wcs->inv_y) {
- poly_end(wcs->inv_y);
- wcs->inv_y = NULL;
- }
- wcs->pvfail = 0;
- for (i = 0; i < (2*MAXPV); i++) {
- wcs->projppv[i] = 0.0;
- wcs->prj.ppv[i] = 0.0;
- }
- for (k = 0; k < 2; k++) {
- for (j = 0; j < MAXPV; j++) {
- sprintf(keyword, "PV%d_%d", k+1, j);
- if (hgetr8c(hstring, keyword,&mchar, &wcs->projppv[j+k*MAXPV]) == 0) {
- wcs->projppv[j+k*MAXPV] = 0.0;
- }
- else
- n++;
- }
- }
-
- /* If any PVi_j are set, add them to the structure */
- if (n > 0) {
- n = 0;
-
- for (k = MAXPV; k >= 0; k--) {
- /* lat comes first for compatibility reasons */
- wcs->prj.ppv[k] = wcs->projppv[k+wcs->wcsl.lat*MAXPV];
- wcs->prj.ppv[k+MAXPV] = wcs->projppv[k+wcs->wcsl.lng*MAXPV];
- if (!n && (wcs->prj.ppv[k] || wcs->prj.ppv[k+MAXPV])) {
- n = k+1;
- }
- }
- invert_wcs(wcs);
-
- /* Need to call tanset again */
- wcs->cel.flag = 0;
- }
- }
-
- /* If linear or pixel WCS, print "degrees" */
- if (!strncmp (wcs->ptype,"LINEAR",6) ||
- !strncmp (wcs->ptype,"PIXEL",5)) {
- wcs->degout = -1;
- wcs->ndec = 5;
- }
-
- /* Epoch of image (from observation date, if possible) */
- if (hgetr8 (hstring, "MJD-OBS", &mjd))
- wcs->epoch = 1900.0 + (mjd - 15019.81352) / 365.242198781;
- else if (!hgetdate (hstring,"DATE-OBS",&wcs->epoch)) {
- if (!hgetdate (hstring,"DATE",&wcs->epoch)) {
- if (!hgetr8 (hstring,"EPOCH",&wcs->epoch))
- wcs->epoch = wcs->equinox;
- }
- }
-
- /* Add time of day if not part of DATE-OBS string */
- else {
- hgets (hstring,"DATE-OBS",32,tstring);
- if (!strchr (tstring,'T')) {
- if (hgetr8 (hstring, "UT",&ut))
- wcs->epoch = wcs->epoch + (ut / (24.0 * 365.242198781));
- else if (hgetr8 (hstring, "UTMID",&ut))
- wcs->epoch = wcs->epoch + (ut / (24.0 * 365.242198781));
- }
- }
-
- wcs->wcson = 1;
- }
-
- else if (mchar != cnull && mchar != cspace) {
- (void) sprintf (temp, "WCSINITC: No image scale for WCS %c", mchar);
- setwcserr (temp);
- wcsfree (wcs);
- return (NULL);
- }
-
- /* Plate solution coefficients */
- else if (ksearch (hstring,"PLTRAH") != NULL) {
- wcs->prjcode = WCS_DSS;
- hcoeff = ksearch (hstring,"PLTRAH");
- hgetr8 (hcoeff,"PLTRAH",&rah);
- hgetr8 (hcoeff,"PLTRAM",&ram);
- hgetr8 (hcoeff,"PLTRAS",&ras);
- ra_hours = rah + (ram / (double)60.0) + (ras / (double)3600.0);
- wcs->plate_ra = hrrad (ra_hours);
- decsign = '+';
- hgets (hcoeff,"PLTDECSN", 1, &decsign);
- if (decsign == '-')
- dsign = -1.;
- else
- dsign = 1.;
- hgetr8 (hcoeff,"PLTDECD",&decd);
- hgetr8 (hcoeff,"PLTDECM",&decm);
- hgetr8 (hcoeff,"PLTDECS",&decs);
- dec_deg = dsign * (decd+(decm/(double)60.0)+(decs/(double)3600.0));
- wcs->plate_dec = degrad (dec_deg);
- hgetr8 (hstring,"EQUINOX",&wcs->equinox);
- hgeti4 (hstring,"EQUINOX",&ieq);
- if (ieq == 1950)
- strcpy (wcs->radecsys,"FK4");
- else
- strcpy (wcs->radecsys,"FK5");
- wcs->epoch = wcs->equinox;
- hgetr8 (hstring,"EPOCH",&wcs->epoch);
- (void)sprintf (wcs->center,"%2.0f:%2.0f:%5.3f %c%2.0f:%2.0f:%5.3f %s",
- rah,ram,ras,decsign,decd,decm,decs,wcs->radecsys);
- hgetr8 (hstring,"PLTSCALE",&wcs->plate_scale);
- hgetr8 (hstring,"XPIXELSZ",&wcs->x_pixel_size);
- hgetr8 (hstring,"YPIXELSZ",&wcs->y_pixel_size);
- hgetr8 (hstring,"CNPIX1",&wcs->x_pixel_offset);
- hgetr8 (hstring,"CNPIX2",&wcs->y_pixel_offset);
- hcoeff = ksearch (hstring,"PPO1");
- for (i = 0; i < 6; i++) {
- sprintf (keyword,"PPO%d", i+1);
- wcs->ppo_coeff[i] = 0.0;
- hgetr8 (hcoeff,keyword,&wcs->ppo_coeff[i]);
- }
- hcoeff = ksearch (hstring,"AMDX1");
- for (i = 0; i < 20; i++) {
- sprintf (keyword,"AMDX%d", i+1);
- wcs->x_coeff[i] = 0.0;
- hgetr8 (hcoeff, keyword, &wcs->x_coeff[i]);
- }
- hcoeff = ksearch (hstring,"AMDY1");
- for (i = 0; i < 20; i++) {
- sprintf (keyword,"AMDY%d",i+1);
- wcs->y_coeff[i] = 0.0;
- hgetr8 (hcoeff, keyword, &wcs->y_coeff[i]);
- }
- wcs->wcson = 1;
- (void)strcpy (wcs->c1type, "RA");
- (void)strcpy (wcs->c2type, "DEC");
- (void)strcpy (wcs->ptype, "DSS");
- wcs->degout = 0;
- wcs->ndec = 3;
-
- /* Compute a nominal reference pixel at the image center */
- strcpy (wcs->ctype[0], "RA---DSS");
- strcpy (wcs->ctype[1], "DEC--DSS");
- wcs->crpix[0] = 0.5 * wcs->nxpix;
- wcs->crpix[1] = 0.5 * wcs->nypix;
- wcs->xrefpix = wcs->crpix[0];
- wcs->yrefpix = wcs->crpix[1];
- dsspos (wcs->crpix[0], wcs->crpix[1], wcs, &ra0, &dec0);
- wcs->crval[0] = ra0;
- wcs->crval[1] = dec0;
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
-
- /* Compute a nominal scale factor */
- dsspos (wcs->crpix[0], wcs->crpix[1]+1.0, wcs, &ra1, &dec1);
- wcs->yinc = dec1 - dec0;
- wcs->xinc = -wcs->yinc;
- wcsioset (wcs);
-
- /* Compute image rotation angle */
- wcs->wcson = 1;
- wcsrotset (wcs);
- rot = degrad (wcs->rot);
-
- /* Compute image scale at center */
- dsspos (wcs->crpix[0]+cos(rot),
- wcs->crpix[1]+sin(rot), wcs, &ra1, &dec1);
- wcs->cdelt[0] = -wcsdist (ra0, dec0, ra1, dec1);
- dsspos (wcs->crpix[0]+sin(rot),
- wcs->crpix[1]+cos(rot), wcs, &ra1, &dec1);
- wcs->cdelt[1] = wcsdist (ra0, dec0, ra1, dec1);
-
- /* Set all other image scale parameters */
- wcsdeltset (wcs, wcs->cdelt[0], wcs->cdelt[1], wcs->rot);
- }
-
- /* Approximate world coordinate system if plate scale is known */
- else if ((ksearch (hstring,"SECPIX") != NULL ||
- ksearch (hstring,"PIXSCALE") != NULL ||
- ksearch (hstring,"PIXSCAL1") != NULL ||
- ksearch (hstring,"XPIXSIZE") != NULL ||
- ksearch (hstring,"SECPIX1") != NULL)) {
- secpix = 0.0;
- hgetr8 (hstring,"SECPIX",&secpix);
- if (secpix == 0.0)
- hgetr8 (hstring,"PIXSCALE",&secpix);
- if (secpix == 0.0) {
- hgetr8 (hstring,"SECPIX1",&secpix);
- if (secpix != 0.0) {
- cdelt1 = -secpix / 3600.0;
- hgetr8 (hstring,"SECPIX2",&secpix);
- cdelt2 = secpix / 3600.0;
- }
- else {
- hgetr8 (hstring,"XPIXSIZE",&secpix);
- if (secpix != 0.0) {
- cdelt1 = -secpix / 3600.0;
- hgetr8 (hstring,"YPIXSIZE",&secpix);
- cdelt2 = secpix / 3600.0;
- }
- else {
- hgetr8 (hstring,"PIXSCAL1",&secpix);
- cdelt1 = -secpix / 3600.0;
- hgetr8 (hstring,"PIXSCAL2",&secpix);
- cdelt2 = secpix / 3600.0;
- }
- }
- }
- else {
- cdelt2 = secpix / 3600.0;
- cdelt1 = -cdelt2;
- }
-
- /* Get rotation angle from the header, if it's there */
- rot = 0.0;
- hgetr8 (hstring,"CROTA1", &rot);
- if (wcs->rot == 0.)
- hgetr8 (hstring,"CROTA2", &rot);
-
- /* Set CD and PC matrices */
- wcsdeltset (wcs, cdelt1, cdelt2, rot);
-
- /* By default, set reference pixel to center of image */
- wcs->crpix[0] = 0.5 + (wcs->nxpix * 0.5);
- wcs->crpix[1] = 0.5 + (wcs->nypix * 0.5);
-
- /* Get reference pixel from the header, if it's there */
- if (ksearch (hstring,"CRPIX1") != NULL) {
- hgetr8 (hstring,"CRPIX1",&wcs->crpix[0]);
- hgetr8 (hstring,"CRPIX2",&wcs->crpix[1]);
- }
-
- /* Use center of detector array as reference pixel
- else if (ksearch (hstring,"DETSIZE") != NULL ||
- ksearch (hstring,"DETSEC") != NULL) {
- char *ic;
- hgets (hstring, "DETSIZE", 32, temp);
- ic = strchr (temp, ':');
- if (ic != NULL)
- *ic = ' ';
- ic = strchr (temp, ',');
- if (ic != NULL)
- *ic = ' ';
- ic = strchr (temp, ':');
- if (ic != NULL)
- *ic = ' ';
- ic = strchr (temp, ']');
- if (ic != NULL)
- *ic = cnull;
- sscanf (temp, "%d %d %d %d", &idx1, &idx2, &idy1, &idy2);
- dxrefpix = 0.5 * (double) (idx1 + idx2 - 1);
- dyrefpix = 0.5 * (double) (idy1 + idy2 - 1);
- hgets (hstring, "DETSEC", 32, temp);
- ic = strchr (temp, ':');
- if (ic != NULL)
- *ic = ' ';
- ic = strchr (temp, ',');
- if (ic != NULL)
- *ic = ' ';
- ic = strchr (temp, ':');
- if (ic != NULL)
- *ic = ' ';
- ic = strchr (temp, ']');
- if (ic != NULL)
- *ic = cnull;
- sscanf (temp, "%d %d %d %d", &ix1, &ix2, &iy1, &iy2);
- wcs->crpix[0] = dxrefpix - (double) (ix1 - 1);
- wcs->crpix[1] = dyrefpix - (double) (iy1 - 1);
- } */
- wcs->xrefpix = wcs->crpix[0];
- wcs->yrefpix = wcs->crpix[1];
-
- wcs->crval[0] = -999.0;
- if (!hgetra (hstring,"RA",&wcs->crval[0])) {
- setwcserr ("WCSINIT: No RA with SECPIX, no WCS");
- wcsfree (wcs);
- return (NULL);
- }
- wcs->crval[1] = -999.0;
- if (!hgetdec (hstring,"DEC",&wcs->crval[1])) {
- setwcserr ("WCSINIT No DEC with SECPIX, no WCS");
- wcsfree (wcs);
- return (NULL);
- }
- wcs->xref = wcs->crval[0];
- wcs->yref = wcs->crval[1];
- wcs->coorflip = 0;
-
- wcs->cel.ref[0] = wcs->crval[0];
- wcs->cel.ref[1] = wcs->crval[1];
- wcs->cel.ref[2] = 999.0;
- if (!hgetr8 (hstring,"LONPOLE",&wcs->cel.ref[2]))
- hgetr8 (hstring,"LONGPOLE",&wcs->cel.ref[2]);
- wcs->cel.ref[3] = 999.0;
- hgetr8 (hstring,"LATPOLE",&wcs->cel.ref[3]);
-
- /* Epoch of image (from observation date, if possible) */
- if (hgetr8 (hstring, "MJD-OBS", &mjd))
- wcs->epoch = 1900.0 + (mjd - 15019.81352) / 365.242198781;
- else if (!hgetdate (hstring,"DATE-OBS",&wcs->epoch)) {
- if (!hgetdate (hstring,"DATE",&wcs->epoch)) {
- if (!hgetr8 (hstring,"EPOCH",&wcs->epoch))
- wcs->epoch = wcs->equinox;
- }
- }
-
- /* Add time of day if not part of DATE-OBS string */
- else {
- hgets (hstring,"DATE-OBS",32,tstring);
- if (!strchr (tstring,'T')) {
- if (hgetr8 (hstring, "UT",&ut))
- wcs->epoch = wcs->epoch + (ut / (24.0 * 365.242198781));
- else if (hgetr8 (hstring, "UTMID",&ut))
- wcs->epoch = wcs->epoch + (ut / (24.0 * 365.242198781));
- }
- }
-
- /* Coordinate reference frame and equinox */
- (void) wcstype (wcs, "RA---TAN", "DEC--TAN");
- wcs->coorflip = 0;
- wcseq (hstring,wcs);
- wcsioset (wcs);
- wcs->degout = 0;
- wcs->ndec = 3;
- wcs->wcson = 1;
- }
-
- else {
- setwcserr ("WCSINIT: No image scale");
- wcsfree (wcs);
- return (NULL);
- }
-
- wcs->lin.crpix = wcs->crpix;
- wcs->lin.cdelt = wcs->cdelt;
- wcs->lin.pc = wcs->pc;
-
- wcs->printsys = 1;
- wcs->tabsys = 0;
- wcs->linmode = 0;
-
- /* Initialize special WCS commands */
- setwcscom (wcs);
-
- return (wcs);
-}
-
-
-/******* invert_wcs ***********************************************************
-PROTO void invert_wcs(wcsstruct *wcs)
-PURPOSE Invert WCS projection mapping (using a polynomial).
-INPUT WCS structure.
-OUTPUT -.
-NOTES .
-AUTHOR E. Bertin (IAP)
-VERSION 06/11/2003
- ***/
-
-void
-invert_wcs( struct WorldCoor *wcs)
-
-{
- polystruct *poly;
- double pixin[NAXISPV],raw[NAXISPV],rawmin[NAXISPV];
- double *outpos,*outpost, *lngpos,*lngpost;
- double *latpos,*latpost,lngstep,latstep, rawsize, epsilon;
- int group[] = {1,1};
- /* Don't ask, this is needed by poly_init()! */
- int i,j,lng,lat,deg, maxflag;
- char errstr[80];
- double xmin;
- double ymin;
- double xmax;
- double ymax;
- double lngmin;
- double latmin;
-
- /* Check first that inversion is not straightforward */
- lng = wcs->wcsl.lng;
- lat = wcs->wcsl.lat;
-
- if (wcs->naxis != NAXISPV) {
- return;
- }
-
- if (strcmp(wcs->wcsl.pcode, "TAN") != 0) {
- return;
- }
-
- if ((wcs->projppv[1+lng*MAXPV] == 0) &&
- (wcs->projppv[1+lat*MAXPV] == 0)) {
- return;
- }
-
- if (wcs->wcs != NULL) {
- pix2wcs(wcs->wcs,0,0,&xmin,&ymin);
- pix2wcs(wcs->wcs,wcs->nxpix,wcs->nypix,&xmax,&ymax);
- }
- else {
- xmin = 0;
- ymin = 0;
- xmax = wcs->nxpix;
- ymax = wcs->nypix;
- }
-
- /* We define x as "longitude" and y as "latitude" projections */
- /* We assume that PCxx cross-terms with additional dimensions are small */
- /* Sample the whole image with a regular grid */
- if (lng == 0) {
- lngstep = (xmax-xmin)/(WCS_NGRIDPOINTS-1.0);
- lngmin = xmin;
- latstep = (ymax-ymin)/(WCS_NGRIDPOINTS-1.0);
- latmin = ymin;
- }
- else {
- lngstep = (ymax-ymin)/(WCS_NGRIDPOINTS-1.0);
- lngmin = ymin;
- latstep = (xmax-xmin)/(WCS_NGRIDPOINTS-1.0);
- latmin = xmin;
- }
-
- outpos = (double *)calloc(2*WCS_NGRIDPOINTS2,sizeof(double));
- lngpos = (double *)calloc(WCS_NGRIDPOINTS2,sizeof(double));
- latpos = (double *)calloc(WCS_NGRIDPOINTS2,sizeof(double));
- raw[lat] = rawmin[lat] = 0.5+latmin;
- raw[lng] = rawmin[lng] = 0.5+lngmin;
- outpost = outpos;
- lngpost = lngpos;
- latpost = latpos;
- for (j=WCS_NGRIDPOINTS; j--; raw[lat]+=latstep) {
- raw[lng] = rawmin[lng];
- for (i=WCS_NGRIDPOINTS; i--; raw[lng]+=lngstep) {
- if (linrev(raw, &wcs->lin, pixin)) {
- sprintf (errstr,"*Error*: incorrect linear conversion in %s",
- wcs->wcsl.pcode);
- setwcserr (errstr);
- }
- *(lngpost++) = pixin[lng];
- *(latpost++) = pixin[lat];
- raw_to_pv (&wcs->prj,pixin[lng],pixin[lat], outpost, outpost+1);
- outpost += 2;
- }
- }
-
- /* Invert "longitude" */
- /* Compute the extent of the pixel in reduced projected coordinates */
- linrev(rawmin, &wcs->lin, pixin);
- pixin[lng] += S2D;
- linfwd(pixin, &wcs->lin, raw);
- rawsize = sqrt((raw[lng]-rawmin[lng])*(raw[lng]-rawmin[lng])
- +(raw[lat]-rawmin[lat])*(raw[lat]-rawmin[lat]))*D2S;
- if (!rawsize) {
- sprintf (errstr,"*Error*: incorrect linear conversion in %s",
- wcs->wcsl.pcode);
- setwcserr (errstr);
- }
- epsilon = WCS_INVACCURACY/rawsize;
-
- /* Find the lowest degree polynom */
- poly = NULL; /* to avoid gcc -Wall warnings */
- maxflag = 1;
- for (deg=1; deg<=WCS_INVMAXDEG && maxflag; deg++) {
- if (deg>1) {
- poly_end(poly);
- }
- poly = poly_init(group, 2, &deg, 1);
- poly_fit(poly, outpos, lngpos, NULL, WCS_NGRIDPOINTS2, NULL);
- maxflag = 0;
- outpost = outpos;
- lngpost = lngpos;
- for (i=WCS_NGRIDPOINTS2; i--; outpost+=2) {
- if (fabs(poly_func(poly, outpost)-*(lngpost++))>epsilon) {
- maxflag = 1;
- break;
- }
- }
- }
- if (maxflag) {
- setwcserr ("WARNING: Significant inaccuracy likely to occur in projection");
- wcs->pvfail = 1;
- }
-
- /* Now link the created structure */
- wcs->prj.inv_x = wcs->inv_x = poly;
-
- /* Invert "latitude" */
- /* Compute the extent of the pixel in reduced projected coordinates */
- linrev(rawmin, &wcs->lin, pixin);
- pixin[lat] += S2D;
- linfwd(pixin, &wcs->lin, raw);
- rawsize = sqrt((raw[lng]-rawmin[lng])*(raw[lng]-rawmin[lng])
- +(raw[lat]-rawmin[lat])*(raw[lat]-rawmin[lat]))*D2S;
- if (!rawsize) {
- sprintf (errstr,"*Error*: incorrect linear conversion in %s",
- wcs->wcsl.pcode);
- setwcserr (errstr);
- }
- epsilon = WCS_INVACCURACY/rawsize;
-
- /* Find the lowest degree polynom */
- maxflag = 1;
- for (deg=1; deg<=WCS_INVMAXDEG && maxflag; deg++) {
- if (deg>1)
- poly_end(poly);
- poly = poly_init(group, 2, &deg, 1);
- poly_fit(poly, outpos, latpos, NULL, WCS_NGRIDPOINTS2, NULL);
- maxflag = 0;
- outpost = outpos;
- latpost = latpos;
- for (i=WCS_NGRIDPOINTS2; i--; outpost+=2) {
- if (fabs(poly_func(poly, outpost)-*(latpost++))>epsilon) {
- maxflag = 1;
- break;
- }
- }
- }
- if (maxflag) {
- setwcserr ("WARNING: Significant inaccuracy likely to occur in projection");
- wcs->pvfail = 1;
- }
-
- /* Now link the created structure */
- wcs->prj.inv_y = wcs->inv_y = poly;
-
- /* Free memory */
- free(outpos);
- free(lngpos);
- free(latpos);
-
- return;
-}
-
-
-/* Set coordinate system of image, input, and output */
-
-static void
-wcsioset (wcs)
-
-struct WorldCoor *wcs;
-{
- if (strlen (wcs->radecsys) == 0 || wcs->prjcode == WCS_LIN)
- strcpy (wcs->radecsys, "LINEAR");
- if (wcs->prjcode == WCS_PIX)
- strcpy (wcs->radecsys, "PIXEL");
- wcs->syswcs = wcscsys (wcs->radecsys);
-
- if (wcs->syswcs == WCS_B1950)
- strcpy (wcs->radecout, "FK4");
- else if (wcs->syswcs == WCS_J2000)
- strcpy (wcs->radecout, "FK5");
- else
- strcpy (wcs->radecout, wcs->radecsys);
- wcs->sysout = wcscsys (wcs->radecout);
- wcs->eqout = wcs->equinox;
- strcpy (wcs->radecin, wcs->radecsys);
- wcs->sysin = wcscsys (wcs->radecin);
- wcs->eqin = wcs->equinox;
- return;
-}
-
-
-static void
-wcseq (hstring, wcs)
-
-char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-struct WorldCoor *wcs; /* World coordinate system data structure */
-{
- char mchar; /* Suffix character for one of multiple WCS */
- mchar = (char) 0;
- wcseqm (hstring, wcs, &mchar);
- return;
-}
-
-
-static void
-wcseqm (hstring, wcs, mchar)
-
-char *hstring; /* character string containing FITS header information
- in the format <keyword>= <value> [/ <comment>] */
-struct WorldCoor *wcs; /* World coordinate system data structure */
-char *mchar; /* Suffix character for one of multiple WCS */
-{
- int ieq = 0;
- int eqhead = 0;
- char systring[32], eqstring[32];
- char radeckey[16], eqkey[16];
- char tstring[32];
- double ut;
-
- /* Set equinox from EQUINOX, EPOCH, or RADECSYS; default to 2000 */
- systring[0] = 0;
- eqstring[0] = 0;
- if (mchar[0]) {
- sprintf (eqkey, "EQUINOX%c", mchar[0]);
- sprintf (radeckey, "RADECSYS%c", mchar[0]);
- }
- else {
- strcpy (eqkey, "EQUINOX");
- sprintf (radeckey, "RADECSYS");
- }
- if (!hgets (hstring, eqkey, 31, eqstring)) {
- if (hgets (hstring, "EQUINOX", 31, eqstring))
- strcpy (eqkey, "EQUINOX");
- }
- if (!hgets (hstring, radeckey, 31, systring)) {
- if (hgets (hstring, "RADECSYS", 31, systring))
- sprintf (radeckey, "RADECSYS");
- }
-
- if (eqstring[0] == 'J') {
- wcs->equinox = atof (eqstring+1);
- ieq = atoi (eqstring+1);
- strcpy (systring, "FK5");
- }
- else if (eqstring[0] == 'B') {
- wcs->equinox = atof (eqstring+1);
- ieq = (int) atof (eqstring+1);
- strcpy (systring, "FK4");
- }
- else if (hgeti4 (hstring, eqkey, &ieq)) {
- hgetr8 (hstring, eqkey, &wcs->equinox);
- eqhead = 1;
- }
-
- else if (hgeti4 (hstring,"EPOCH",&ieq)) {
- if (ieq == 0) {
- ieq = 1950;
- wcs->equinox = 1950.0;
- }
- else {
- hgetr8 (hstring,"EPOCH",&wcs->equinox);
- eqhead = 1;
- }
- }
-
- else if (systring[0] != (char)0) {
- if (!strncmp (systring,"FK4",3)) {
- wcs->equinox = 1950.0;
- ieq = 1950;
- }
- else if (!strncmp (systring,"ICRS",4)) {
- wcs->equinox = 2000.0;
- ieq = 2000;
- }
- else if (!strncmp (systring,"FK5",3)) {
- wcs->equinox = 2000.0;
- ieq = 2000;
- }
- else if (!strncmp (systring,"GAL",3)) {
- wcs->equinox = 2000.0;
- ieq = 2000;
- }
- else if (!strncmp (systring,"ECL",3)) {
- wcs->equinox = 2000.0;
- ieq = 2000;
- }
- }
-
- if (ieq == 0) {
- wcs->equinox = 2000.0;
- ieq = 2000;
- if (!strncmp (wcs->c1type, "RA",2) || !strncmp (wcs->c1type,"DEC",3))
- strcpy (systring,"FK5");
- }
-
- /* Epoch of image (from observation date, if possible) */
- if (!hgetdate (hstring,"DATE-OBS",&wcs->epoch)) {
- if (!hgetdate (hstring,"DATE",&wcs->epoch)) {
- if (!hgetr8 (hstring,"EPOCH",&wcs->epoch))
- wcs->epoch = wcs->equinox;
- }
- }
-
- /* Add time of day if not part of DATE-OBS string */
- else {
- hgets (hstring,"DATE-OBS",32,tstring);
- if (!strchr (tstring,'T')) {
- if (hgetr8 (hstring, "UT",&ut))
- wcs->epoch = wcs->epoch + (ut / (24.0 * 365.242198781));
- else if (hgetr8 (hstring, "UTMID",&ut))
- wcs->epoch = wcs->epoch + (ut / (24.0 * 365.242198781));
- }
- }
- if (wcs->epoch == 0.0)
- wcs->epoch = wcs->equinox;
-
- /* Set coordinate system from keyword, if it is present */
- if (systring[0] == (char) 0)
- hgets (hstring, radeckey, 31, systring);
- if (systring[0] != (char) 0) {
- strcpy (wcs->radecsys,systring);
- if (!eqhead) {
- if (!strncmp (wcs->radecsys,"FK4",3))
- wcs->equinox = 1950.0;
- else if (!strncmp (wcs->radecsys,"FK5",3))
- wcs->equinox = 2000.0;
- else if (!strncmp (wcs->radecsys,"ICRS",4))
- wcs->equinox = 2000.0;
- else if (!strncmp (wcs->radecsys,"GAL",3) && ieq == 0)
- wcs->equinox = 2000.0;
- }
- }
-
- /* Otherwise set coordinate system from equinox */
- /* Systemless coordinates cannot be translated using b, j, or g commands */
- else if (wcs->syswcs != WCS_NPOLE) {
- if (ieq > 1980)
- strcpy (wcs->radecsys,"FK5");
- else
- strcpy (wcs->radecsys,"FK4");
- }
-
- /* Set galactic coordinates if GLON or GLAT are in C1TYPE */
- if (wcs->c1type[0] == 'G')
- strcpy (wcs->radecsys,"GALACTIC");
- else if (wcs->c1type[0] == 'E')
- strcpy (wcs->radecsys,"ECLIPTIC");
- else if (wcs->c1type[0] == 'S')
- strcpy (wcs->radecsys,"SGALACTC");
- else if (wcs->c1type[0] == 'H')
- strcpy (wcs->radecsys,"HELIOECL");
- else if (wcs->c1type[0] == 'A')
- strcpy (wcs->radecsys,"ALTAZ");
- else if (wcs->c1type[0] == 'L')
- strcpy (wcs->radecsys,"LINEAR");
-
- wcs->syswcs = wcscsys (wcs->radecsys);
-
- return;
-}
-
-/* Jun 11 1998 Split off header-dependent WCS initialization from other subs
- * Jun 15 1998 Fix major bug in wcsinit() when synthesizing WCS from header
- * Jun 18 1998 Fix bug in CD initialization; split PC initialization off
- * Jun 18 1998 Split PC initialization off into subroutine wcspcset()
- * Jun 24 1998 Set equinox from RADECSYS only if EQUINOX and EPOCH not present
- * Jul 6 1998 Read third and fourth axis CTYPEs
- * Jul 7 1998 Initialize eqin and eqout to equinox,
- * Jul 9 1998 Initialize rotation matrices correctly
- * Jul 13 1998 Initialize rotation, scale for polynomial and DSS projections
- * Aug 6 1998 Fix CROTA computation for DSS projection
- * Sep 4 1998 Fix CROTA, CDELT computation for DSS and polynomial projections
- * Sep 14 1998 If DATE-OBS not found, check for DATE
- * Sep 14 1998 If B or J present in EQUINOX, use that info to set system
- * Sep 29 1998 Initialize additional WCS commands from the environment
- * Sep 29 1998 Fix bug which read DATE as number rather than formatted date
- * Dec 2 1998 Read projection constants from header (bug fix)
- *
- * Feb 9 1999 Set rotation angle correctly when using DSS projection
- * Feb 19 1999 Fill in CDELTs from scale keyword if absent or zero
- * Feb 19 1999 Add PIXSCALE as possible default arcseconds per pixel
- * Apr 7 1999 Add error checking for NAXIS and NAXIS1 keywords
- * Apr 7 1999 Do not set systring if epoch is 0 and not RA/Dec
- * Jul 8 1999 In RADECSYS, use FK5 and FK4 instead of J2000 and B1950
- * Oct 15 1999 Free wcs using wcsfree()
- * Oct 20 1999 Add multiple WCS support using new subroutine names
- * Oct 21 1999 Delete unused variables after lint; declare dsspos()
- * Nov 9 1999 Add wcschar() to check WCSNAME keywords for desired WCS
- * Nov 9 1999 Check WCSPREx keyword to find out if chained WCS's
- *
- * Jan 6 1999 Add wcsinitn() to initialize from specific WCSNAME
- * Jan 24 2000 Set CD matrix from header even if using polynomial
- * Jan 27 2000 Fix MJD to epoch conversion for when MJD-OBS is the only date
- * Jan 28 2000 Set CD matrix for DSS projection, too
- * Jan 28 2000 Use wcsproj instead of oldwcs
- * Dec 18 2000 Fix error in hgets() call in wcschar()
- * Dec 29 2000 Compute inverse CD matrix even if polynomial solution
- * Dec 29 2000 Add PROJR0 keyword for WCSLIB projections
- * Dec 29 2000 Use CDi_j matrix if any elements are present
- *
- * Jan 31 2001 Fix to allow 1D WCS
- * Jan 31 2001 Treat single character WCS name as WCS character
- * Feb 20 2001 Implement WCSDEPx nested WCS's
- * Feb 23 2001 Initialize all 4 terms of CD matrix
- * Feb 28 2001 Fix bug which read CRPIX1 into CRPIX2
- * Mar 20 2001 Compare mchar to (char)0, not null
- * Mar 21 2001 Move ic declaration into commented out code
- * Jul 12 2001 Read PROJPn constants into proj.p array instead of PVn
- * Sep 7 2001 Set system to galactic or ecliptic based on CTYPE, not RADECSYS
- * Oct 11 2001 Set ctype[0] as well as ctype[1] to TAN for TNX projections
- * Oct 19 2001 WCSDIM keyword overrides zero value of NAXIS
- *
- * Feb 19 2002 Add XPIXSIZE/YPIXSIZE (KPNO) as default image scale keywords
- * Mar 12 2002 Add LONPOLE as well as LONGPOLE for WCSLIB 2.8
- * Apr 3 2002 Implement hget8c() and hgetsc() to simplify code
- * Apr 3 2002 Add PVj_n projection constants in addition to PROJPn
- * Apr 19 2002 Increase numeric keyword value length from 16 to 31
- * Apr 19 2002 Fix bug which didn't set radecsys keyword name
- * Apr 24 2002 If no WCS present for specified letter, return null
- * Apr 26 2002 Implement WCSAXESa keyword as first choice for number of axes
- * Apr 26 2002 Add wcschar and wcsname to WCS structure
- * May 9 2002 Add radvel and zvel to WCS structure
- * May 13 2002 Free everything which is allocated
- * May 28 2002 Read 10 prj.p instead of maximum of 100
- * May 31 2002 Fix bugs with PV reading
- * May 31 2002 Initialize syswcs, sysin, sysout in wcsioset()
- * Sep 25 2002 Fix subroutine calls for radvel and latpole
- * Dec 6 2002 Correctly compute pixel at center of image for default CRPIX
- *
- * Jan 2 2002 Do not reinitialize projection vector for PV input
- * Jan 3 2002 For ZPN, read PVi_0 to PVi_9, not PVi_1 to PVi_10
- * Mar 27 2003 Clean up default center computation
- * Apr 3 2003 Add input for SIRTF distortion coefficients
- * May 8 2003 Change PROJP reading to start with 0 instead of 1
- * May 22 2003 Add ZPX approximation, reading projpn from WATi
- * May 28 2003 Avoid reinitializing coefficients set by PROJP
- * Jun 26 2003 Initialize xref and yref to -999.0
- * Sep 23 2003 Change mgets() to mgetstr() to avoid name collision at UCO Lick
- * Oct 1 2003 Rename wcs->naxes to wcs->naxis to match WCSLIB 3.2
- * Nov 3 2003 Initialize distortion coefficients in distortinit() in distort.c
- * Dec 1 2003 Change p[0,1,2] initializations to p[1,2,3]
- * Dec 3 2003 Add back wcs->naxes for backward compatibility
- * Dec 3 2003 Remove unused variables j,m in wcsinitc()
- * Dec 12 2003 Fix call to setwcserr() with format in it
- *
- * Feb 26 2004 Add parameters for ZPX projection
- *
- * Jun 22 2005 Drop declaration of variable wcserrmsg which is not used
- * Nov 9 2005 Use CROTA1 if CTYPE1 is LAT/DEC, CROTA2 if CTYPE2 is LAT/DEC
- *
- * Mar 9 2006 Get Epoch of observation from MJD-OBS or DATE-OBS/UT unless DSS
- * Apr 24 2006 Initialize rotation matrices
- * Apr 25 2006 Ignore axes with dimension of one
- * May 19 2006 Initialize all of 9x9 PC matrix; read in loops
- * Aug 21 2006 Limit naxes to 2 everywhere; RA and DEC should always be 1st
- * Oct 6 2006 If units are pixels, projection type is PIXEL
- * Oct 30 2006 Initialize cube face to -1, not a cube projection
- *
- * Jan 4 2007 Drop declarations of wcsinitc() and wcsinitn() already in wcs.h
- * Jan 8 2007 Change WCS letter from char to char*
- * Feb 1 2007 Read IRAF log wavelength flag DC-FLAG to wcs.logwcs
- * Feb 15 2007 Check for wcs->wcsproj > 0 instead of CTYPEi != LINEAR or PIXEL
- * Mar 13 2007 Try for RA, DEC, SECPIX if WCS character is space or null
- * Apr 27 2007 Ignore axes with TAB WCS for now
- * Oct 17 2007 Fix bug testing &mchar instead of mchar in if statement
- *
- * May 9 2008 Initialize TNX projection when projection types first set
- * Jun 27 2008 If NAXIS1 and NAXIS2 not present, check for IMAGEW and IMAGEH
- *
- * Mar 24 2009 Fix dimension bug if NAXISi not present (fix from John Burns)
- *
- * Mar 11 2011 Add NOAO ZPX projection (Frank Valdes)
- * Mar 18 2011 Add invert_wcs() by Emmanuel Bertin for SCAMP
- * Mar 18 2011 Change Bertin's ARCSEC/DEG to S2D and DEG/ARCSEC to D2S
- * Sep 1 2011 Add TPV as TAN with SCAMP PVs
- *
- * Oct 19 2012 Drop unused variable iszpx; fix bug in latmin assignment
- */
diff --git a/funtools/wcs/wcslib.c b/funtools/wcs/wcslib.c
deleted file mode 100644
index 31313e1..0000000
--- a/funtools/wcs/wcslib.c
+++ /dev/null
@@ -1,1334 +0,0 @@
-/*=============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-*=============================================================================
-*
-* C routines which implement the FITS World Coordinate System (WCS)
-* convention.
-*
-* Summary of routines
-* -------------------
-* wcsfwd() and wcsrev() are high level driver routines for the WCS linear
-* transformation, spherical coordinate transformation, and spherical
-* projection routines.
-*
-* Given either the celestial longitude or latitude plus an element of the
-* pixel coordinate a hybrid routine, wcsmix(), iteratively solves for the
-* unknown elements.
-*
-* An initialization routine, wcsset(), computes indices from the ctype
-* array but need not be called explicitly - see the explanation of
-* wcs.flag below.
-*
-*
-* Initialization routine; wcsset()
-* --------------------------------
-* Initializes elements of a wcsprm data structure which holds indices into
-* the coordinate arrays. Note that this routine need not be called directly;
-* it will be invoked by wcsfwd() and wcsrev() if the "flag" structure member
-* is anything other than a predefined magic value.
-*
-* Given:
-* naxis const int
-* Number of image axes.
-* ctype[][9]
-* const char
-* Coordinate axis types corresponding to the FITS
-* CTYPEn header cards.
-*
-* Returned:
-* wcs wcsprm* Indices for the celestial coordinates obtained
-* by parsing the ctype[] array (see below).
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Inconsistent or unrecognized coordinate axis
-* types.
-*
-*
-* Forward transformation; wcsfwd()
-* --------------------------------
-* Compute the pixel coordinate for given world coordinates.
-*
-* Given:
-* ctype[][9]
-* const char
-* Coordinate axis types corresponding to the FITS
-* CTYPEn header cards.
-*
-* Given or returned:
-* wcs wcsprm* Indices for the celestial coordinates obtained
-* by parsing the ctype[] array (see below).
-*
-* Given:
-* world const double[]
-* World coordinates. world[wcs->lng] and
-* world[wcs->lat] are the celestial longitude and
-* latitude, in degrees.
-*
-* Given:
-* crval const double[]
-* Coordinate reference values corresponding to the FITS
-* CRVALn header cards (see note 2).
-*
-* Given and returned:
-* cel celprm* Spherical coordinate transformation parameters (usage
-* is described in the prologue to "cel.c").
-*
-* Returned:
-* phi, double* Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-*
-* Given and returned:
-* prj prjprm* Projection parameters (usage is described in the
-* prologue to "proj.c").
-*
-* Returned:
-* imgcrd double[] Image coordinate. imgcrd[wcs->lng] and
-* imgcrd[wcs->lat] are the projected x-, and
-* y-coordinates, in "degrees". For quadcube
-* projections with a CUBEFACE axis the face number is
-* also returned in imgcrd[wcs->cubeface].
-*
-* Given and returned:
-* lin linprm* Linear transformation parameters (usage is described
-* in the prologue to "lin.c").
-*
-* Returned:
-* pixcrd double[] Pixel coordinate.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid coordinate transformation parameters.
-* 2: Invalid projection parameters.
-* 3: Invalid world coordinate.
-* 4: Invalid linear transformation parameters.
-*
-*
-* Reverse transformation; wcsrev()
-* --------------------------------
-* Compute world coordinates for a given pixel coordinate.
-*
-* Given:
-* ctype[][9]
-* const char
-* Coordinate axis types corresponding to the FITS
-* CTYPEn header cards.
-*
-* Given or returned:
-* wcs wcsprm* Indices for the celestial coordinates obtained
-* by parsing the ctype[] array (see below).
-*
-* Given:
-* pixcrd const double[]
-* Pixel coordinate.
-*
-* Given and returned:
-* lin linprm* Linear transformation parameters (usage is described
-* in the prologue to "lin.c").
-*
-* Returned:
-* imgcrd double[] Image coordinate. imgcrd[wcs->lng] and
-* imgcrd[wcs->lat] are the projected x-, and
-* y-coordinates, in "degrees".
-*
-* Given and returned:
-* prj prjprm* Projection parameters (usage is described in the
-* prologue to "proj.c").
-*
-* Returned:
-* phi, double* Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-*
-* Given:
-* crval const double[]
-* Coordinate reference values corresponding to the FITS
-* CRVALn header cards (see note 2).
-*
-* Given and returned:
-* cel celprm* Spherical coordinate transformation parameters
-* (usage is described in the prologue to "cel.c").
-*
-* Returned:
-* world double[] World coordinates. world[wcs->lng] and
-* world[wcs->lat] are the celestial longitude and
-* latitude, in degrees.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid coordinate transformation parameters.
-* 2: Invalid projection parameters.
-* 3: Invalid pixel coordinate.
-* 4: Invalid linear transformation parameters.
-*
-*
-* Hybrid transformation; wcsmix()
-* -------------------------------
-* Given either the celestial longitude or latitude plus an element of the
-* pixel coordinate solve for the remaining elements by iterating on the
-* unknown celestial coordinate element using wcsfwd().
-*
-* Given:
-* ctype[][9]
-* const char
-* Coordinate axis types corresponding to the FITS
-* CTYPEn header cards.
-*
-* Given or returned:
-* wcs wcsprm* Indices for the celestial coordinates obtained
-* by parsing the ctype[] array (see below).
-*
-* Given:
-* mixpix const int
-* Which element of the pixel coordinate is given.
-* mixcel const int
-* Which element of the celestial coordinate is
-* given:
-* 1: Celestial longitude is given in
-* world[wcs->lng], latitude returned in
-* world[wcs->lat].
-* 2: Celestial latitude is given in
-* world[wcs->lat], longitude returned in
-* world[wcs->lng].
-* vspan[2] const double
-* Solution interval for the celestial coordinate, in
-* degrees. The ordering of the two limits is
-* irrelevant. Longitude ranges may be specified with
-* any convenient normalization, for example [-120,+120]
-* is the same as [240,480], except that the solution
-* will be returned with the same normalization, i.e.
-* lie within the interval specified.
-* vstep const double
-* Step size for solution search, in degrees. If zero,
-* a sensible, although perhaps non-optimal default will
-* be used.
-* viter int
-* If a solution is not found then the step size will be
-* halved and the search recommenced. viter controls
-* how many times the step size is halved. The allowed
-* range is 5 - 10.
-*
-* Given and returned:
-* world double[] World coordinates. world[wcs->lng] and
-* world[wcs->lat] are the celestial longitude and
-* latitude, in degrees. Which is given and which
-* returned depends on the value of mixcel. All other
-* elements are given.
-*
-* Given:
-* crval const double[]
-* Coordinate reference values corresponding to the FITS
-* CRVALn header cards (see note 2).
-*
-* Given and returned:
-* cel celprm* Spherical coordinate transformation parameters
-* (usage is described in the prologue to "cel.c").
-*
-* Returned:
-* phi, double* Longitude and latitude in the native coordinate
-* theta system of the projection, in degrees.
-*
-* Given and returned:
-* prj prjprm* Projection parameters (usage is described in the
-* prologue to "proj.c").
-*
-* Returned:
-* imgcrd double[] Image coordinate. imgcrd[wcs->lng] and
-* imgcrd[wcs->lat] are the projected x-, and
-* y-coordinates, in "degrees".
-*
-* Given and returned:
-* lin linprm* Linear transformation parameters (usage is described
-* in the prologue to "lin.c").
-*
-* Given and returned:
-* pixcrd double[] Pixel coordinate. The element indicated by mixpix is
-* given and the remaining elements are returned.
-*
-* Function return value:
-* int Error status
-* 0: Success.
-* 1: Invalid coordinate transformation parameters.
-* 2: Invalid projection parameters.
-* 3: Coordinate transformation error.
-* 4: Invalid linear transformation parameters.
-* 5: No solution found in the specified interval.
-*
-*
-* Notes
-* -----
-* 1) The CTYPEn must in be upper case and there must be 0 or 1 pair of
-* matched celestial axis types. The ctype[][9] should be padded with
-* blanks on the right and null-terminated.
-*
-* 2) Elements of the crval[] array which correspond to celestial axes are
-* ignored, the reference coordinate values in cel->ref[0] and
-* cel->ref[1] are the ones used.
-*
-* 3) These functions recognize the NCP projection and convert it to the
-* equivalent SIN projection.
-*
-* They also recognize GLS as a synonym for SFL.
-*
-* 4) The quadcube projections (TSC, CSC, QSC) may be represented in FITS in
-* either of two ways:
-*
-* a) The six faces may be laid out in one plane and numbered as
-* follows:
-*
-* 0
-*
-* 4 3 2 1 4 3 2
-*
-* 5
-*
-* Faces 2, 3 and 4 may appear on one side or the other (or both).
-* The forward routines map faces 2, 3 and 4 to the left but the
-* inverse routines accept them on either side.
-*
-* b) The "COBE" convention in which the six faces are stored in a
-* three-dimensional structure using a "CUBEFACE" axis indexed from
-* 0 to 5 as above.
-*
-* These routines support both methods; wcsset() determines which is
-* being used by the presence or absence of a CUBEFACE axis in ctype[].
-* wcsfwd() and wcsrev() translate the CUBEFACE axis representation to
-* the single plane representation understood by the lower-level WCSLIB
-* projection routines.
-*
-*
-* WCS indexing parameters
-* -----------------------
-* The wcsprm struct consists of the following:
-*
-* int flag
-* The wcsprm struct contains indexes and other information derived
-* from the CTYPEn. Whenever any of the ctype[] are set or changed
-* this flag must be set to zero to signal the initialization routine,
-* wcsset() to redetermine the indices. The flag is set to 999 if
-* there is no celestial axis pair in the CTYPEn.
-*
-* char pcode[4]
-* The WCS projection code.
-*
-* char lngtyp[5], lattyp[5]
-* WCS celestial axis types.
-*
-* int lng,lat
-* Indices into the imgcrd[], and world[] arrays as described above.
-* These may also serve as indices for the celestial longitude and
-* latitude axes in the pixcrd[] array provided that the PC matrix
-* does not transpose axes.
-*
-* int cubeface
-* Index into the pixcrd[] array for the CUBEFACE axis. This is
-* optionally used for the quadcube projections where each cube face is
-* stored on a separate axis.
-*
-*
-* wcsmix() algorithm
-* ------------------
-* Initially the specified solution interval is checked to see if it's a
-* "crossing" interval. If it isn't, a search is made for a crossing
-* solution by iterating on the unknown celestial coordinate starting at
-* the upper limit of the solution interval and decrementing by the
-* specified step size. A crossing is indicated if the trial value of the
-* pixel coordinate steps through the value specified. If a crossing
-* interval is found then the solution is determined by a modified form of
-* "regula falsi" division of the crossing interval. If no crossing
-* interval was found within the specified solution interval then a search
-* is made for a "non-crossing" solution as may arise from a point of
-* tangency. The process is complicated by having to make allowance for
-* the discontinuities that occur in all map projections.
-*
-* Once one solution has been determined others may be found by subsequent
-* invokations of wcsmix() with suitably restricted solution intervals.
-*
-* Note the circumstance which arises when the solution point lies at a
-* native pole of a projection in which the pole is represented as a
-* finite curve, for example the zenithals and conics. In such cases two
-* or more valid solutions may exist but WCSMIX only ever returns one.
-*
-* Because of its generality wcsmix() is very compute-intensive. For
-* compute-limited applications more efficient special-case solvers could
-* be written for simple projections, for example non-oblique cylindrical
-* projections.
-*
-* Author: Mark Calabretta, Australia Telescope National Facility
-* $Id: wcs.c,v 2.23 2002/04/03 01:25:29 mcalabre Exp $
-*===========================================================================*/
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include "wcslib.h"
-
-/* Map error number to error message for each function. */
-const char *wcsset_errmsg[] = {
- 0,
- "Inconsistent or unrecognized coordinate axis types"};
-
-const char *wcsfwd_errmsg[] = {
- 0,
- "Invalid coordinate transformation parameters",
- "Invalid projection parameters",
- "Invalid world coordinate",
- "Invalid linear transformation parameters"};
-
-const char *wcsrev_errmsg[] = {
- 0,
- "Invalid coordinate transformation parameters",
- "Invalid projection parameters",
- "Invalid pixel coordinate",
- "Invalid linear transformation parameters"};
-
-const char *wcsmix_errmsg[] = {
- 0,
- "Invalid coordinate transformation parameters",
- "Invalid projection parameters",
- "Coordinate transformation error",
- "Invalid linear transformation parameters",
- "No solution found in the specified interval"};
-
-#define signb(X) ((X) < 0.0 ? 1 : 0)
-
-int
-wcsset (naxis, ctype, wcs)
-
-const int naxis;
-const char ctype[][9];
-struct wcsprm *wcs;
-
-{
- int nalias = 2;
- char aliases [2][4] = {"NCP", "GLS"};
-
- int j, k;
- int *ndx = NULL;
- char requir[9];
-
- strcpy(wcs->pcode, "");
- strcpy(requir, "");
- wcs->lng = -1;
- wcs->lat = -1;
- wcs->cubeface = -1;
-
- for (j = 0; j < naxis; j++) {
- if (ctype[j][4] != '-') {
- if (strcmp(ctype[j], "CUBEFACE") == 0) {
- if (wcs->cubeface == -1) {
- wcs->cubeface = j;
- } else {
- /* Multiple CUBEFACE axes! */
- return 1;
- }
- }
- continue;
- }
-
- /* Got an axis qualifier, is it a recognized WCS projection? */
- for (k = 0; k < npcode; k++) {
- if (strncmp(&ctype[j][5], pcodes[k], 3) == 0) break;
- }
-
- if (k == npcode) {
- /* Maybe it's a projection alias. */
- for (k = 0; k < nalias; k++) {
- if (strncmp(&ctype[j][5], aliases[k], 3) == 0) break;
- }
-
- /* Not recognized. */
- if (k == nalias) {
- continue;
- }
- }
-
- /* Parse the celestial axis type. */
- if (strcmp(wcs->pcode, "") == 0) {
- sprintf(wcs->pcode, "%.3s", &ctype[j][5]);
-
- if (strncmp(ctype[j], "RA--", 4) == 0) {
- wcs->lng = j;
- strcpy(wcs->lngtyp, "RA");
- strcpy(wcs->lattyp, "DEC");
- ndx = &wcs->lat;
- sprintf(requir, "DEC--%s", wcs->pcode);
- } else if (strncmp(ctype[j], "DEC-", 4) == 0) {
- wcs->lat = j;
- strcpy(wcs->lngtyp, "RA");
- strcpy(wcs->lattyp, "DEC");
- ndx = &wcs->lng;
- sprintf(requir, "RA---%s", wcs->pcode);
- } else if (strncmp(&ctype[j][1], "LON", 3) == 0) {
- wcs->lng = j;
- sprintf(wcs->lngtyp, "%cLON", ctype[j][0]);
- sprintf(wcs->lattyp, "%cLAT", ctype[j][0]);
- ndx = &wcs->lat;
- sprintf(requir, "%s-%s", wcs->lattyp, wcs->pcode);
- } else if (strncmp(&ctype[j][1], "LAT", 3) == 0) {
- wcs->lat = j;
- sprintf(wcs->lngtyp, "%cLON", ctype[j][0]);
- sprintf(wcs->lattyp, "%cLAT", ctype[j][0]);
- ndx = &wcs->lng;
- sprintf(requir, "%s-%s", wcs->lngtyp, wcs->pcode);
- } else if (strncmp(&ctype[j][2], "LN", 2) == 0) {
- wcs->lng = j;
- sprintf(wcs->lngtyp, "%c%cLN", ctype[j][0], ctype[j][1]);
- sprintf(wcs->lattyp, "%c%cLT", ctype[j][0], ctype[j][1]);
- ndx = &wcs->lat;
- sprintf(requir, "%s-%s", wcs->lattyp, wcs->pcode);
- } else if (strncmp(&ctype[j][2], "LT", 2) == 0) {
- wcs->lat = j;
- sprintf(wcs->lngtyp, "%c%cLN", ctype[j][0], ctype[j][1]);
- sprintf(wcs->lattyp, "%c%cLT", ctype[j][0], ctype[j][1]);
- ndx = &wcs->lng;
- sprintf(requir, "%s-%s", wcs->lngtyp, wcs->pcode);
- } else {
- /* Unrecognized celestial type. */
- return 1;
- }
- } else {
- if (strncmp(ctype[j], requir, 8) != 0) {
- /* Inconsistent projection types. */
- return 1;
- }
-
- if (ndx == NULL)
- return 1;
- *ndx = j;
- strcpy(requir, "");
- }
- }
-
- if (strcmp(requir, "")) {
- /* Unmatched celestial axis. */
- return 1;
- }
-
- /* Do simple alias translations. */
- if (strncmp(wcs->pcode, "GLS", 3) == 0) {
- strcpy(wcs->pcode, "SFL");
- }
-
- if (strcmp(wcs->pcode, "")) {
- wcs->flag = WCSSET;
- } else {
- /* Signal for no celestial axis pair. */
- wcs->flag = 999;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int
-wcsfwd(ctype, wcs, world, crval, cel, phi, theta, prj, imgcrd, lin, pixcrd)
-
-const char ctype[][9];
-struct wcsprm* wcs;
-const double world[];
-const double crval[];
-struct celprm *cel;
-double *phi, *theta;
-struct prjprm *prj;
-double imgcrd[];
-struct linprm *lin;
-double pixcrd[];
-
-{
- int err, j;
- double offset;
-
- /* Initialize if required. */
- if (wcs->flag != WCSSET) {
- if (wcsset(lin->naxis, ctype, wcs)) return 1;
- }
-
- /* Convert to relative physical coordinates. */
- for (j = 0; j < lin->naxis; j++) {
- if (j == wcs->lng) continue;
- if (j == wcs->lat) continue;
- imgcrd[j] = world[j] - crval[j];
- }
-
- if (wcs->flag != 999) {
- /* Compute projected coordinates. */
- if (strcmp(wcs->pcode, "NCP") == 0) {
- /* Convert NCP to SIN. */
- if (cel->ref[1] == 0.0) {
- return 2;
- }
-
- strcpy(wcs->pcode, "SIN");
- prj->p[1] = 0.0;
- prj->p[2] = cosdeg (cel->ref[1])/sindeg (cel->ref[1]);
- prj->flag = (prj->flag < 0) ? -1 : 0;
- }
-
- if ((err = celfwd(wcs->pcode, world[wcs->lng], world[wcs->lat], cel,
- phi, theta, prj, &imgcrd[wcs->lng], &imgcrd[wcs->lat]))) {
- return err;
- }
-
- /* Do we have a CUBEFACE axis? */
- if (wcs->cubeface != -1) {
- /* Separation between faces. */
- if (prj->r0 == 0.0) {
- offset = 90.0;
- } else {
- offset = prj->r0*PI/2.0;
- }
-
- /* Stack faces in a cube. */
- if (imgcrd[wcs->lat] < -0.5*offset) {
- imgcrd[wcs->lat] += offset;
- imgcrd[wcs->cubeface] = 5.0;
- } else if (imgcrd[wcs->lat] > 0.5*offset) {
- imgcrd[wcs->lat] -= offset;
- imgcrd[wcs->cubeface] = 0.0;
- } else if (imgcrd[wcs->lng] > 2.5*offset) {
- imgcrd[wcs->lng] -= 3.0*offset;
- imgcrd[wcs->cubeface] = 4.0;
- } else if (imgcrd[wcs->lng] > 1.5*offset) {
- imgcrd[wcs->lng] -= 2.0*offset;
- imgcrd[wcs->cubeface] = 3.0;
- } else if (imgcrd[wcs->lng] > 0.5*offset) {
- imgcrd[wcs->lng] -= offset;
- imgcrd[wcs->cubeface] = 2.0;
- } else {
- imgcrd[wcs->cubeface] = 1.0;
- }
- }
- }
-
- /* Apply forward linear transformation. */
- if (linfwd(imgcrd, lin, pixcrd)) {
- return 4;
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int
-wcsrev(ctype, wcs, pixcrd, lin, imgcrd, prj, phi, theta, crval, cel, world)
-
-const char ctype[][9];
-struct wcsprm *wcs;
-const double pixcrd[];
-struct linprm *lin;
-double imgcrd[];
-struct prjprm *prj;
-double *phi, *theta;
-const double crval[];
-struct celprm *cel;
-double world[];
-
-{
- int err, face, j;
- double offset;
-
- /* Initialize if required. */
- if (wcs->flag != WCSSET) {
- if (wcsset(lin->naxis, ctype, wcs)) return 1;
- }
-
- /* Apply reverse linear transformation. */
- if (linrev(pixcrd, lin, imgcrd)) {
- return 4;
- }
-
- /* Convert to world coordinates. */
- for (j = 0; j < lin->naxis; j++) {
- if (j == wcs->lng) continue;
- if (j == wcs->lat) continue;
- world[j] = imgcrd[j] + crval[j];
- }
-
-
- if (wcs->flag != 999) {
- /* Do we have a CUBEFACE axis? */
- if (wcs->cubeface != -1) {
- face = (int)(imgcrd[wcs->cubeface] + 0.5);
- if (fabs(imgcrd[wcs->cubeface]-face) > 1e-10) {
- return 3;
- }
-
- /* Separation between faces. */
- if (prj->r0 == 0.0) {
- offset = 90.0;
- } else {
- offset = prj->r0*PI/2.0;
- }
-
- /* Lay out faces in a plane. */
- switch (face) {
- case 0:
- imgcrd[wcs->lat] += offset;
- break;
- case 1:
- break;
- case 2:
- imgcrd[wcs->lng] += offset;
- break;
- case 3:
- imgcrd[wcs->lng] += offset*2;
- break;
- case 4:
- imgcrd[wcs->lng] += offset*3;
- break;
- case 5:
- imgcrd[wcs->lat] -= offset;
- break;
- default:
- return 3;
- }
- }
-
- /* Compute celestial coordinates. */
- if (strcmp(wcs->pcode, "NCP") == 0) {
- /* Convert NCP to SIN. */
- if (cel->ref[1] == 0.0) {
- return 2;
- }
-
- strcpy(wcs->pcode, "SIN");
- prj->p[1] = 0.0;
- prj->p[2] = cosdeg (cel->ref[1])/sindeg (cel->ref[1]);
- prj->flag = (prj->flag < 0) ? -1 : 0;
- }
-
- if ((err = celrev(wcs->pcode, imgcrd[wcs->lng], imgcrd[wcs->lat], prj,
- phi, theta, cel, &world[wcs->lng], &world[wcs->lat]))) {
- return err;
- }
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-int
-wcsmix(ctype, wcs, mixpix, mixcel, vspan, vstep, viter, world, crval, cel,
- phi, theta, prj, imgcrd, lin, pixcrd)
-
-const char ctype[][9];
-struct wcsprm *wcs;
-const int mixpix, mixcel;
-const double vspan[2], vstep;
-int viter;
-double world[];
-const double crval[];
-struct celprm *cel;
-double *phi, *theta;
-struct prjprm *prj;
-double imgcrd[];
-struct linprm *lin;
-double pixcrd[];
-
-{
- const int niter = 60;
- int crossed, err, istep, iter, j, k, nstep, retry;
- const double tol = 1.0e-10;
- const double tol2 = 100.0*tol;
- double lambda, span[2], step;
- double pixmix;
- double dlng, lng, lng0, lng0m, lng1, lng1m;
- double dlat, lat, lat0, lat0m, lat1, lat1m;
- double d, d0, d0m, d1, d1m;
- double dx = 0.0;
- double dabs, dmin, lmin;
- double dphi, phi0, phi1;
- struct celprm cel0;
-
- /* Initialize if required. */
- if (wcs->flag != WCSSET) {
- if (wcsset(lin->naxis, ctype, wcs)) return 1;
- }
-
- /* Check vspan. */
- if (vspan[0] <= vspan[1]) {
- span[0] = vspan[0];
- span[1] = vspan[1];
- } else {
- /* Swap them. */
- span[0] = vspan[1];
- span[1] = vspan[0];
- }
-
- /* Check vstep. */
- step = fabs(vstep);
- if (step == 0.0) {
- step = (span[1] - span[0])/10.0;
- if (step > 1.0 || step == 0.0) step = 1.0;
- }
-
- /* Check viter. */
- nstep = viter;
- if (nstep < 5) {
- nstep = 5;
- } else if (nstep > 10) {
- nstep = 10;
- }
-
- /* Given pixel element. */
- pixmix = pixcrd[mixpix];
-
- /* Iterate on the step size. */
- for (istep = 0; istep <= nstep; istep++) {
- if (istep) step /= 2.0;
-
- /* Iterate on the sky coordinate between the specified range. */
- if (mixcel == 1) {
- /* Celestial longitude is given. */
-
- /* Check whether the solution interval is a crossing interval. */
- lat0 = span[0];
- world[wcs->lat] = lat0;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = pixcrd[mixpix] - pixmix;
-
- dabs = fabs(d0);
- if (dabs < tol) return 0;
-
- lat1 = span[1];
- world[wcs->lat] = lat1;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
- d1 = pixcrd[mixpix] - pixmix;
-
- dabs = fabs(d1);
- if (dabs < tol) return 0;
-
- lmin = lat1;
- dmin = dabs;
-
- /* Check for a crossing point. */
- if (signb(d0) != signb(d1)) {
- crossed = 1;
- dx = d1;
- } else {
- crossed = 0;
- lat0 = span[1];
- }
-
- for (retry = 0; retry < 4; retry++) {
- /* Refine the solution interval. */
- while (lat0 > span[0]) {
- lat0 -= step;
- if (lat0 < span[0]) lat0 = span[0];
- world[wcs->lat] = lat0;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = pixcrd[mixpix] - pixmix;
-
- /* Check for a solution. */
- dabs = fabs(d0);
- if (dabs < tol) return 0;
-
- /* Record the point of closest approach. */
- if (dabs < dmin) {
- lmin = lat0;
- dmin = dabs;
- }
-
- /* Check for a crossing point. */
- if (signb(d0) != signb(d1)) {
- crossed = 2;
- dx = d0;
- break;
- }
-
- /* Advance to the next subinterval. */
- lat1 = lat0;
- d1 = d0;
- }
-
- if (crossed) {
- /* A crossing point was found. */
- for (iter = 0; iter < niter; iter++) {
- /* Use regula falsi division of the interval. */
- lambda = d0/(d0-d1);
- if (lambda < 0.1) {
- lambda = 0.1;
- } else if (lambda > 0.9) {
- lambda = 0.9;
- }
-
- dlat = lat1 - lat0;
- lat = lat0 + lambda*dlat;
- world[wcs->lat] = lat;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
-
- /* Check for a solution. */
- d = pixcrd[mixpix] - pixmix;
- dabs = fabs(d);
- if (dabs < tol) return 0;
-
- if (dlat < tol) {
- /* An artifact of numerical imprecision. */
- if (dabs < tol2) return 0;
-
- /* Must be a discontinuity. */
- break;
- }
-
- /* Record the point of closest approach. */
- if (dabs < dmin) {
- lmin = lat;
- dmin = dabs;
- }
-
- if (signb(d0) == signb(d)) {
- lat0 = lat;
- d0 = d;
- } else {
- lat1 = lat;
- d1 = d;
- }
- }
-
- /* No convergence, must have been a discontinuity. */
- if (crossed == 1) lat0 = span[1];
- lat1 = lat0;
- d1 = dx;
- crossed = 0;
-
- } else {
- /* No crossing point; look for a tangent point. */
- if (lmin == span[0]) break;
- if (lmin == span[1]) break;
-
- lat = lmin;
- lat0 = lat - step;
- if (lat0 < span[0]) lat0 = span[0];
- lat1 = lat + step;
- if (lat1 > span[1]) lat1 = span[1];
-
- world[wcs->lat] = lat0;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = fabs(pixcrd[mixpix] - pixmix);
-
- d = dmin;
-
- world[wcs->lat] = lat1;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d1 = fabs(pixcrd[mixpix] - pixmix);
-
- for (iter = 0; iter < niter; iter++) {
- lat0m = (lat0 + lat)/2.0;
- world[wcs->lat] = lat0m;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d0m = fabs(pixcrd[mixpix] - pixmix);
-
- if (d0m < tol) return 0;
-
- lat1m = (lat1 + lat)/2.0;
- world[wcs->lat] = lat1m;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d1m = fabs(pixcrd[mixpix] - pixmix);
-
- if (d1m < tol) return 0;
-
- if (d0m < d && d0m <= d1m) {
- lat1 = lat;
- d1 = d;
- lat = lat0m;
- d = d0m;
- } else if (d1m < d) {
- lat0 = lat;
- d0 = d;
- lat = lat1m;
- d = d1m;
- } else {
- lat0 = lat0m;
- d0 = d0m;
- lat1 = lat1m;
- d1 = d1m;
- }
- }
- }
- }
-
- } else {
- /* Celestial latitude is given. */
-
- /* Check whether the solution interval is a crossing interval. */
- lng0 = span[0];
- world[wcs->lng] = lng0;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = pixcrd[mixpix] - pixmix;
-
- dabs = fabs(d0);
- if (dabs < tol) return 0;
-
- lng1 = span[1];
- world[wcs->lng] = lng1;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
- d1 = pixcrd[mixpix] - pixmix;
-
- dabs = fabs(d1);
- if (dabs < tol) return 0;
- lmin = lng1;
- dmin = dabs;
-
- /* Check for a crossing point. */
- if (signb(d0) != signb(d1)) {
- crossed = 1;
- dx = d1;
- } else {
- crossed = 0;
- lng0 = span[1];
- }
-
- for (retry = 0; retry < 4; retry++) {
- /* Refine the solution interval. */
- while (lng0 > span[0]) {
- lng0 -= step;
- if (lng0 < span[0]) lng0 = span[0];
- world[wcs->lng] = lng0;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = pixcrd[mixpix] - pixmix;
-
- /* Check for a solution. */
- dabs = fabs(d0);
- if (dabs < tol) return 0;
-
- /* Record the point of closest approach. */
- if (dabs < dmin) {
- lmin = lng0;
- dmin = dabs;
- }
-
- /* Check for a crossing point. */
- if (signb(d0) != signb(d1)) {
- crossed = 2;
- dx = d0;
- break;
- }
-
- /* Advance to the next subinterval. */
- lng1 = lng0;
- d1 = d0;
- }
-
- if (crossed) {
- /* A crossing point was found. */
- for (iter = 0; iter < niter; iter++) {
- /* Use regula falsi division of the interval. */
- lambda = d0/(d0-d1);
- if (lambda < 0.1) {
- lambda = 0.1;
- } else if (lambda > 0.9) {
- lambda = 0.9;
- }
-
- dlng = lng1 - lng0;
- lng = lng0 + lambda*dlng;
- world[wcs->lng] = lng;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
-
- /* Check for a solution. */
- d = pixcrd[mixpix] - pixmix;
- dabs = fabs(d);
- if (dabs < tol) return 0;
-
- if (dlng < tol) {
- /* An artifact of numerical imprecision. */
- if (dabs < tol2) return 0;
-
- /* Must be a discontinuity. */
- break;
- }
-
- /* Record the point of closest approach. */
- if (dabs < dmin) {
- lmin = lng;
- dmin = dabs;
- }
-
- if (signb(d0) == signb(d)) {
- lng0 = lng;
- d0 = d;
- } else {
- lng1 = lng;
- d1 = d;
- }
- }
-
- /* No convergence, must have been a discontinuity. */
- if (crossed == 1) lng0 = span[1];
- lng1 = lng0;
- d1 = dx;
- crossed = 0;
-
- } else {
- /* No crossing point; look for a tangent point. */
- if (lmin == span[0]) break;
- if (lmin == span[1]) break;
-
- lng = lmin;
- lng0 = lng - step;
- if (lng0 < span[0]) lng0 = span[0];
- lng1 = lng + step;
- if (lng1 > span[1]) lng1 = span[1];
-
- world[wcs->lng] = lng0;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = fabs(pixcrd[mixpix] - pixmix);
-
- d = dmin;
-
- world[wcs->lng] = lng1;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d1 = fabs(pixcrd[mixpix] - pixmix);
-
- for (iter = 0; iter < niter; iter++) {
- lng0m = (lng0 + lng)/2.0;
- world[wcs->lng] = lng0m;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d0m = fabs(pixcrd[mixpix] - pixmix);
-
- if (d0m < tol) return 0;
-
- lng1m = (lng1 + lng)/2.0;
- world[wcs->lng] = lng1m;
- if ((err = wcsfwd(ctype, wcs, world, crval, cel, phi, theta,
- prj, imgcrd, lin, pixcrd))) {
- return err;
- }
- d1m = fabs(pixcrd[mixpix] - pixmix);
-
- if (d1m < tol) return 0;
-
- if (d0m < d && d0m <= d1m) {
- lng1 = lng;
- d1 = d;
- lng = lng0m;
- d = d0m;
- } else if (d1m < d) {
- lng0 = lng;
- d0 = d;
- lng = lng1m;
- d = d1m;
- } else {
- lng0 = lng0m;
- d0 = d0m;
- lng1 = lng1m;
- d1 = d1m;
- }
- }
- }
- }
- }
- }
-
-
- /* Set cel0 to the unity transformation. */
- cel0.flag = CELSET;
- cel0.ref[0] = cel->ref[0];
- cel0.ref[1] = cel->ref[1];
- cel0.ref[2] = cel->ref[2];
- cel0.ref[3] = cel->ref[3];
- cel0.euler[0] = -90.0;
- cel0.euler[1] = 0.0;
- cel0.euler[2] = 90.0;
- cel0.euler[3] = 1.0;
- cel0.euler[4] = 0.0;
-
- /* No convergence, check for aberrant behaviour at a native pole. */
- *theta = -90.0;
- for (j = 1; j <= 2; j++) {
- /* Could the celestial coordinate element map to a native pole? */
- *theta = -*theta;
- err = sphrev(0.0, *theta, cel->euler, &lng, &lat);
-
- if (mixcel == 1) {
- if (fabs(fmod(world[wcs->lng]-lng,360.0)) > tol) continue;
- if (lat < span[0]) continue;
- if (lat > span[1]) continue;
- world[wcs->lat] = lat;
- } else {
- if (fabs(world[wcs->lat]-lat) > tol) continue;
- if (lng < span[0]) lng += 360.0;
- if (lng > span[1]) lng -= 360.0;
- if (lng < span[0]) continue;
- if (lng > span[1]) continue;
- world[wcs->lng] = lng;
- }
-
- /* Is there a solution for the given pixel coordinate element? */
- lng = world[wcs->lng];
- lat = world[wcs->lat];
-
- /* Feed native coordinates to wcsfwd() with cel0 set to unity. */
- world[wcs->lng] = -180.0;
- world[wcs->lat] = *theta;
- if ((err = wcsfwd(ctype, wcs, world, crval, &cel0, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
- d0 = pixcrd[mixpix] - pixmix;
-
- /* Check for a solution. */
- if (fabs(d0) < tol) {
- /* Recall saved world coordinates. */
- world[wcs->lng] = lng;
- world[wcs->lat] = lat;
- return 0;
- }
-
- /* Search for a crossing interval. */
- phi0 = -180.0;
- for (k = -179; k <= 180; k++) {
- phi1 = (double) k;
- world[wcs->lng] = phi1;
- if ((err = wcsfwd(ctype, wcs, world, crval, &cel0, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
- d1 = pixcrd[mixpix] - pixmix;
-
- /* Check for a solution. */
- dabs = fabs(d1);
- if (dabs < tol) {
- /* Recall saved world coordinates. */
- world[wcs->lng] = lng;
- world[wcs->lat] = lat;
- return 0;
- }
-
- /* Is it a crossing interval? */
- if (signb(d0) != signb(d1)) break;
-
- phi0 = phi1;
- d0 = d1;
- }
-
- for (iter = 1; iter <= niter; iter++) {
- /* Use regula falsi division of the interval. */
- lambda = d0/(d0-d1);
- if (lambda < 0.1) {
- lambda = 0.1;
- } else if (lambda > 0.9) {
- lambda = 0.9;
- }
-
- dphi = phi1 - phi0;
- world[wcs->lng] = phi0 + lambda*dphi;
- if ((err = wcsfwd(ctype, wcs, world, crval, &cel0, phi, theta, prj,
- imgcrd, lin, pixcrd))) {
- return err;
- }
-
- /* Check for a solution. */
- d = pixcrd[mixpix] - pixmix;
- dabs = fabs(d);
- if (dabs < tol || (dphi < tol && dabs < tol2)) {
- /* Recall saved world coordinates. */
- world[wcs->lng] = lng;
- world[wcs->lat] = lat;
- return 0;
- }
-
- if (signb(d0) == signb(d)) {
- phi0 = world[wcs->lng];
- d0 = d;
- } else {
- phi1 = world[wcs->lng];
- d1 = d;
- }
- }
- }
-
-
- /* No solution. */
- return 5;
-
-}
-/* Dec 20 1999 Doug Mink - Change signbit() to signb() and always define it
- * Dec 20 1999 Doug Mink - Include wcslib.h, which includes wcs.h, wcstrig.h
- *
- * Mar 20 2001 Doug Mink - Include stdio.h for sprintf()
- * Mar 20 2001 Doug Mink - Add () around err assignments in if statements
- * Sep 19 2001 Doug Mink - Add above changes to WCSLIB-2.7 version
- *
- * Mar 15 2002 Doug Mink - Add above changes to WCSLIB-2.8.2
- * Apr 3 2002 Mark Calabretta - Fix bug in code checking section
- *
- * Jun 20 2006 Doug Mink - Initialized uninitialized variables
- */
diff --git a/funtools/wcs/wcslib.h b/funtools/wcs/wcslib.h
deleted file mode 100644
index 75b6ec6..0000000
--- a/funtools/wcs/wcslib.h
+++ /dev/null
@@ -1,476 +0,0 @@
-#ifndef wcslib_h_
-#define wcslib_h_
-
-/*=============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-* Author: Mark Calabretta, Australia Telescope National Facility
-* $Id: wcs.h,v 2.9 2002/04/03 01:25:29 mcalabre Exp $
-*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if !defined(__STDC__) && !defined(__cplusplus)
-#ifndef const
-#define const
-#endif
-#endif
-
-#define MAXPV 100
-
-#define WCS_NGRIDPOINTS 12 /* Number of WCS grid points / axis */
-#define WCS_NGRIDPOINTS2 (WCS_NGRIDPOINTS*WCS_NGRIDPOINTS)
-#define WCS_INVMAXDEG 9 /* Maximum inversion polynom degree */
-#define WCS_INVACCURACY 0.04 /* Maximum inversion error (pixels) */
-#define WCS_NRANGEPOINTS 32 /* Number of WCS range points / axis */
-#ifndef PI
-#define PI 3.1415926535898 /* never met before? */
-#endif
-/* DEG/ARCSEC is now D2S and ARCSEC/DEG is S2D */
-/* #define DEG (PI/180.0) 1 deg in radians */
-/* #define ARCSEC (DEG/3600.0) 1 arcsec in radians */
-#define NAXISPV 2
-
-/* poly.h
-*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-* Part of: A program using polynomial fits
-* Author: E.BERTIN (IAP)
-* Contents: Include for poly.c
-* Last modified: 03/03/2004
-*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-*/
-
-#ifndef _POLY_H_
-#define _POLY_H_
-
-/*--------------------------------- constants -------------------------------*/
-
-#define POLY_MAXDIM 4 /* Max dimensionality of polynom */
-#define POLY_MAXDEGREE 10 /* Max degree of the polynom */
-
-/*---------------------------------- macros ---------------------------------*/
-
-/*--------------------------- structure definitions -------------------------*/
-
-typedef struct poly
- {
- double *basis; /* Current values of the basis functions */
- double *coeff; /* Polynom coefficients */
- int ncoeff; /* Number of coefficients */
- int *group; /* Groups */
- int ndim; /* dimensionality of the polynom */
- int *degree; /* Degree in each group */
- int ngroup; /* Number of different groups */
- } polystruct;
-
-/*---------------------------------- protos --------------------------------*/
-
-extern polystruct *poly_init(int *group,int ndim,int *degree,int ngroup);
-
-extern double poly_func(polystruct *poly, double *pos);
-
-extern int cholsolve(double *a, double *b, int n),
- *poly_powers(polystruct *poly);
-
-extern void poly_addcste(polystruct *poly, double *cste),
- poly_end(polystruct *poly),
- poly_fit(polystruct *poly, double *x, double *y,
- double *w, int ndata, double *extbasis),
- poly_solve(double *a, double *b, int n),
- svdsolve(double *a, double *b, int m, int n,
- double *vmat, double *wmat);
-
-#endif
-
-extern int npcode;
-extern char pcodes[26][4];
-
-struct prjprm {
- char code[4];
- int flag;
- double phi0, theta0;
- double r0;
- double p[10];
- double w[20];
- int n;
- int npv;
- double ppv[2*MAXPV];
- struct poly *inv_x;
- struct poly *inv_y;
-
-#if __STDC__ || defined(__cplusplus)
- int (*prjfwd)(const double, const double,
- struct prjprm *,
- double *, double *);
- int (*prjrev)(const double, const double,
- struct prjprm *,
- double *, double *);
-#else
- int (*prjfwd)();
- int (*prjrev)();
-#endif
-};
-
-#if __STDC__ || defined(__cplusplus)
- int prjset(const char [], struct prjprm *);
- int prjfwd(const double, const double, struct prjprm *, double *, double *);
- int prjrev(const double, const double, struct prjprm *, double *, double *);
- int azpset(struct prjprm *);
- int azpfwd(const double, const double, struct prjprm *, double *, double *);
- int azprev(const double, const double, struct prjprm *, double *, double *);
- int szpset(struct prjprm *);
- int szpfwd(const double, const double, struct prjprm *, double *, double *);
- int szprev(const double, const double, struct prjprm *, double *, double *);
- int tanset(struct prjprm *);
- int tanfwd(const double, const double, struct prjprm *, double *, double *);
- int tanrev(const double, const double, struct prjprm *, double *, double *);
- int stgset(struct prjprm *);
- int stgfwd(const double, const double, struct prjprm *, double *, double *);
- int stgrev(const double, const double, struct prjprm *, double *, double *);
- int sinset(struct prjprm *);
- int sinfwd(const double, const double, struct prjprm *, double *, double *);
- int sinrev(const double, const double, struct prjprm *, double *, double *);
- int arcset(struct prjprm *);
- int arcfwd(const double, const double, struct prjprm *, double *, double *);
- int arcrev(const double, const double, struct prjprm *, double *, double *);
- int zpnset(struct prjprm *);
- int zpnfwd(const double, const double, struct prjprm *, double *, double *);
- int zpnrev(const double, const double, struct prjprm *, double *, double *);
- int zeaset(struct prjprm *);
- int zeafwd(const double, const double, struct prjprm *, double *, double *);
- int zearev(const double, const double, struct prjprm *, double *, double *);
- int airset(struct prjprm *);
- int airfwd(const double, const double, struct prjprm *, double *, double *);
- int airrev(const double, const double, struct prjprm *, double *, double *);
- int cypset(struct prjprm *);
- int cypfwd(const double, const double, struct prjprm *, double *, double *);
- int cyprev(const double, const double, struct prjprm *, double *, double *);
- int ceaset(struct prjprm *);
- int ceafwd(const double, const double, struct prjprm *, double *, double *);
- int cearev(const double, const double, struct prjprm *, double *, double *);
- int carset(struct prjprm *);
- int carfwd(const double, const double, struct prjprm *, double *, double *);
- int carrev(const double, const double, struct prjprm *, double *, double *);
- int merset(struct prjprm *);
- int merfwd(const double, const double, struct prjprm *, double *, double *);
- int merrev(const double, const double, struct prjprm *, double *, double *);
- int sflset(struct prjprm *);
- int sflfwd(const double, const double, struct prjprm *, double *, double *);
- int sflrev(const double, const double, struct prjprm *, double *, double *);
- int parset(struct prjprm *);
- int parfwd(const double, const double, struct prjprm *, double *, double *);
- int parrev(const double, const double, struct prjprm *, double *, double *);
- int molset(struct prjprm *);
- int molfwd(const double, const double, struct prjprm *, double *, double *);
- int molrev(const double, const double, struct prjprm *, double *, double *);
- int aitset(struct prjprm *);
- int aitfwd(const double, const double, struct prjprm *, double *, double *);
- int aitrev(const double, const double, struct prjprm *, double *, double *);
- int copset(struct prjprm *);
- int copfwd(const double, const double, struct prjprm *, double *, double *);
- int coprev(const double, const double, struct prjprm *, double *, double *);
- int coeset(struct prjprm *);
- int coefwd(const double, const double, struct prjprm *, double *, double *);
- int coerev(const double, const double, struct prjprm *, double *, double *);
- int codset(struct prjprm *);
- int codfwd(const double, const double, struct prjprm *, double *, double *);
- int codrev(const double, const double, struct prjprm *, double *, double *);
- int cooset(struct prjprm *);
- int coofwd(const double, const double, struct prjprm *, double *, double *);
- int coorev(const double, const double, struct prjprm *, double *, double *);
- int bonset(struct prjprm *);
- int bonfwd(const double, const double, struct prjprm *, double *, double *);
- int bonrev(const double, const double, struct prjprm *, double *, double *);
- int pcoset(struct prjprm *);
- int pcofwd(const double, const double, struct prjprm *, double *, double *);
- int pcorev(const double, const double, struct prjprm *, double *, double *);
- int tscset(struct prjprm *);
- int tscfwd(const double, const double, struct prjprm *, double *, double *);
- int tscrev(const double, const double, struct prjprm *, double *, double *);
- int cscset(struct prjprm *);
- int cscfwd(const double, const double, struct prjprm *, double *, double *);
- int cscrev(const double, const double, struct prjprm *, double *, double *);
- int qscset(struct prjprm *);
- int qscfwd(const double, const double, struct prjprm *, double *, double *);
- int qscrev(const double, const double, struct prjprm *, double *, double *);
- int raw_to_pv(struct prjprm *prj, double x, double y, double *xo, double *yo);
-#else
- int prjset(), prjfwd(), prjrev();
- int azpset(), azpfwd(), azprev();
- int szpset(), szpfwd(), szprev();
- int tanset(), tanfwd(), tanrev();
- int stgset(), stgfwd(), stgrev();
- int sinset(), sinfwd(), sinrev();
- int arcset(), arcfwd(), arcrev();
- int zpnset(), zpnfwd(), zpnrev();
- int zeaset(), zeafwd(), zearev();
- int airset(), airfwd(), airrev();
- int cypset(), cypfwd(), cyprev();
- int ceaset(), ceafwd(), cearev();
- int carset(), carfwd(), carrev();
- int merset(), merfwd(), merrev();
- int sflset(), sflfwd(), sflrev();
- int parset(), parfwd(), parrev();
- int molset(), molfwd(), molrev();
- int aitset(), aitfwd(), aitrev();
- int copset(), copfwd(), coprev();
- int coeset(), coefwd(), coerev();
- int codset(), codfwd(), codrev();
- int cooset(), coofwd(), coorev();
- int bonset(), bonfwd(), bonrev();
- int pcoset(), pcofwd(), pcorev();
- int tscset(), tscfwd(), tscrev();
- int cscset(), cscfwd(), cscrev();
- int qscset(), qscfwd(), qscrev();
- int raw_to_pv();
-#endif
-
-
-
-extern const char *prjset_errmsg[];
-extern const char *prjfwd_errmsg[];
-extern const char *prjrev_errmsg[];
-
-#define PRJSET 137
-
-struct celprm {
- int flag;
- double ref[4];
- double euler[5];
-};
-
-#if __STDC__ || defined(__cplusplus)
- int celset(const char *, struct celprm *, struct prjprm *);
- int celfwd(const char *,
- const double, const double,
- struct celprm *,
- double *, double *,
- struct prjprm *,
- double *, double *);
- int celrev(const char *,
- const double, const double,
- struct prjprm *,
- double *, double *,
- struct celprm *,
- double *, double *);
-#else
- int celset(), celfwd(), celrev();
-#endif
-
-extern const char *celset_errmsg[];
-extern const char *celfwd_errmsg[];
-extern const char *celrev_errmsg[];
-
-#define CELSET 137
-
-struct linprm {
- int flag;
- int naxis;
- double *crpix;
- double *pc;
- double *cdelt;
-
- /* Intermediates. */
- double *piximg;
- double *imgpix;
-};
-
-#if __STDC__ || defined(__cplusplus)
- int linset(struct linprm *);
- int linfwd(const double[], struct linprm *, double[]);
- int linrev(const double[], struct linprm *, double[]);
- int matinv(const int, const double [], double []);
-#else
- int linset(), linfwd(), linrev(), matinv();
-#endif
-
-extern const char *linset_errmsg[];
-extern const char *linfwd_errmsg[];
-extern const char *linrev_errmsg[];
-
-#define LINSET 137
-
-
-struct wcsprm {
- int flag;
- char pcode[4];
- char lngtyp[5], lattyp[5];
- int lng, lat;
- int cubeface;
-};
-
-#if __STDC__ || defined(__cplusplus)
- int wcsset(const int,
- const char[][9],
- struct wcsprm *);
-
- int wcsfwd(const char[][9],
- struct wcsprm *,
- const double[],
- const double[],
- struct celprm *,
- double *,
- double *,
- struct prjprm *,
- double[],
- struct linprm *,
- double[]);
-
- int wcsrev(const char[][9],
- struct wcsprm *,
- const double[],
- struct linprm *,
- double[],
- struct prjprm *,
- double *,
- double *,
- const double[],
- struct celprm *,
- double[]);
-
- int wcsmix(const char[][9],
- struct wcsprm *,
- const int,
- const int,
- const double[],
- const double,
- int,
- double[],
- const double[],
- struct celprm *,
- double *,
- double *,
- struct prjprm *,
- double[],
- struct linprm *,
- double[]);
-
-#else
- int wcsset(), wcsfwd(), wcsrev(), wcsmix();
-#endif
-
-extern const char *wcsset_errmsg[];
-extern const char *wcsfwd_errmsg[];
-extern const char *wcsrev_errmsg[];
-extern const char *wcsmix_errmsg[];
-
-#define WCSSET 137
-
-
-#if __STDC__ || defined(__cplusplus)
- int sphfwd(const double, const double,
- const double [],
- double *, double *);
- int sphrev(const double, const double,
- const double [],
- double *, double *);
-#else
- int sphfwd(), sphrev();
-#endif
-
-#ifdef PI
-#undef PI
-#endif
-
-#ifdef D2R
-#undef D2R
-#endif
-
-#ifdef R2D
-#undef R2D
-#endif
-
-#ifdef SQRT2
-#undef SQRT2
-#endif
-
-#ifdef SQRT2INV
-#undef SQRT2INV
-#endif
-
-#ifdef D2S
-#undef D2S
-#endif
-
-#ifdef S2D
-#undef S2D
-#endif
-
-#define PI 3.141592653589793238462643
-#define D2R PI/180.0
-#define R2D 180.0/PI
-#define S2D 1.0/3600.0
-#define D2S 3600.0
-#define SQRT2 1.4142135623730950488
-#define SQRT2INV 1.0/SQRT2
-
-#if !defined(__STDC__) && !defined(__cplusplus)
-#ifndef const
-#define const
-#endif
-#endif
-
-#if __STDC__ || defined(__cplusplus)
- double cosdeg(const double);
- double sindeg(const double);
- double tandeg(const double);
- double acosdeg(const double);
- double asindeg(const double);
- double atandeg(const double);
- double atan2deg(const double, const double);
-#else
- double cosdeg();
- double sindeg();
- double tandeg();
- double acosdeg();
- double asindeg();
- double atandeg();
- double atan2deg();
-#endif
-
-/* Domain tolerance for asin and acos functions. */
-#define WCSTRIG_TOL 1e-10
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* wcslib_h_ */
-
-/* Feb 3 2000 Doug Mink - Make cplusplus ifdefs for braces all-inclusive
- *
- * Feb 15 2001 Doug Mink - Undefine math constants if already defined
- * Sep 19 2001 Doug Mink - Update for WCSLIB 2.7, especially proj.h and cel.h
- *
- * Mar 12 2002 Doug Mink - Update for WCSLIB 2.8.2, especially proj.h
- * Nov 29 2006 Doug Mink - Drop semicolon at end of C++ ifdef
- * Jan 4 2007 Doug Mink - Drop extra declarations of SZP subroutines
- *
- * Mar 30 2011 Doug Mink - Add raw_to_pv() subroutine for SCAMP from Ed Los
- */
diff --git a/funtools/wcs/wcstrig.c b/funtools/wcs/wcstrig.c
deleted file mode 100644
index 6a30d03..0000000
--- a/funtools/wcs/wcstrig.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*============================================================================
-*
-* WCSLIB - an implementation of the FITS WCS proposal.
-* Copyright (C) 1995-2002, Mark Calabretta
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*
-* Correspondence concerning WCSLIB may be directed to:
-* Internet email: mcalabre@atnf.csiro.au
-* Postal address: Dr. Mark Calabretta,
-* Australia Telescope National Facility,
-* P.O. Box 76,
-* Epping, NSW, 2121,
-* AUSTRALIA
-*
-*=============================================================================
-*
-* The functions defined herein are trigonometric or inverse trigonometric
-* functions which take or return angular arguments in decimal degrees.
-*
-* $Id: wcstrig.c,v 2.8 2002/04/03 01:25:29 mcalabre Exp $
-*---------------------------------------------------------------------------*/
-
-#include <math.h>
-#include "wcslib.h"
-const double d2r = PI / 180.0;
-const double r2d = 180.0 / PI;
-
-
-double cosdeg (angle)
-
-const double angle;
-
-{
- double resid;
-
- resid = fabs(fmod(angle,360.0));
- if (resid == 0.0) {
- return 1.0;
- } else if (resid == 90.0) {
- return 0.0;
- } else if (resid == 180.0) {
- return -1.0;
- } else if (resid == 270.0) {
- return 0.0;
- }
-
- return cos(angle*d2r);
-}
-
-/*--------------------------------------------------------------------------*/
-
-double sindeg (angle)
-
-const double angle;
-
-{
- double resid;
-
- resid = fmod(angle-90.0,360.0);
- if (resid == 0.0) {
- return 1.0;
- } else if (resid == 90.0) {
- return 0.0;
- } else if (resid == 180.0) {
- return -1.0;
- } else if (resid == 270.0) {
- return 0.0;
- }
-
- return sin(angle*d2r);
-}
-
-/*--------------------------------------------------------------------------*/
-
-double tandeg (angle)
-
-const double angle;
-
-{
- double resid;
-
- resid = fmod(angle,360.0);
- if (resid == 0.0 || fabs(resid) == 180.0) {
- return 0.0;
- } else if (resid == 45.0 || resid == 225.0) {
- return 1.0;
- } else if (resid == -135.0 || resid == -315.0) {
- return -1.0;
- }
-
- return tan(angle*d2r);
-}
-
-/*--------------------------------------------------------------------------*/
-
-double acosdeg(v)
-
-const double v;
-
-{
- if (v >= 1.0) {
- if (v-1.0 < WCSTRIG_TOL) return 0.0;
- } else if (v == 0.0) {
- return 90.0;
- } else if (v <= -1.0) {
- if (v+1.0 > -WCSTRIG_TOL) return 180.0;
- }
-
- return acos(v)*r2d;
-}
-
-/*--------------------------------------------------------------------------*/
-
-double asindeg (v)
-
-const double v;
-
-{
- if (v <= -1.0) {
- if (v+1.0 > -WCSTRIG_TOL) return -90.0;
- } else if (v == 0.0) {
- return 0.0;
- } else if (v >= 1.0) {
- if (v-1.0 < WCSTRIG_TOL) return 90.0;
- }
-
- return asin(v)*r2d;
-}
-
-/*--------------------------------------------------------------------------*/
-
-double atandeg (v)
-
-const double v;
-
-{
- if (v == -1.0) {
- return -45.0;
- } else if (v == 0.0) {
- return 0.0;
- } else if (v == 1.0) {
- return 45.0;
- }
-
- return atan(v)*r2d;
-}
-
-/*--------------------------------------------------------------------------*/
-
-double atan2deg (y, x)
-
-const double x, y;
-
-{
- if (y == 0.0) {
- if (x >= 0.0) {
- return 0.0;
- } else if (x < 0.0) {
- return 180.0;
- }
- } else if (x == 0.0) {
- if (y > 0.0) {
- return 90.0;
- } else if (y < 0.0) {
- return -90.0;
- }
- }
-
- return atan2(y,x)*r2d;
-}
-/* Dec 20 1999 Doug Mink - Change cosd() and sind() to cosdeg() and sindeg()
- * Dec 20 1999 Doug Mink - Include wcslib.h, which includes wcstrig.h
- * Dec 20 1999 Doug Mink - Use PI from wcslib.h, not locally defined
- *
- * Sep 19 2001 Doug Mink - No change for WCSLIB 2.7
- */
diff --git a/funtools/wcs/worldpos.c b/funtools/wcs/worldpos.c
deleted file mode 100644
index 8693789..0000000
--- a/funtools/wcs/worldpos.c
+++ /dev/null
@@ -1,693 +0,0 @@
-/* worldpos.c -- WCS Algorithms from Classic AIPS.
- * September 1, 2011
- * Copyright (C) 1994-2011
- * Associated Universities, Inc. Washington DC, USA.
- * With code added by Jessica Mink, Smithsonian Astrophysical Observatory
- * and Allan Brighton and Andreas Wicenec, ESO
- * and Frank Valdes, NOAO
-
- * Module: worldpos.c
- * Purpose: Perform forward and reverse WCS computations for 8 projections
- * Subroutine: worldpos() converts from pixel location to RA,Dec
- * Subroutine: worldpix() converts from RA,Dec to pixel location
-
- -=-=-=-=-=-=-
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning AIPS should be addressed as follows:
- Internet email: aipsmail@nrao.edu
- Postal address: AIPS Group
- National Radio Astronomy Observatory
- 520 Edgemont Road
- Charlottesville, VA 22903-2475 USA
-
- -=-=-=-=-=-=-
-
- These two ANSI C functions, worldpos() and worldpix(), perform
- forward and reverse WCS computations for 8 types of projective
- geometries ("-SIN", "-TAN", "-ARC", "-NCP", "-GLS" or "-SFL", "-MER",
- "-AIT", "-STG", "CAR", and "COE"):
-
- worldpos() converts from pixel location to RA,Dec
- worldpix() converts from RA,Dec to pixel location
-
- where "(RA,Dec)" are more generically (long,lat). These functions
- are based on the WCS implementation of Classic AIPS, an
- implementation which has been in production use for more than ten
- years. See the two memos by Eric Greisen
-
- ftp://fits.cv.nrao.edu/fits/documents/wcs/aips27.ps.Z
- ftp://fits.cv.nrao.edu/fits/documents/wcs/aips46.ps.Z
-
- for descriptions of the 8 projective geometries and the
- algorithms. Footnotes in these two documents describe the
- differences between these algorithms and the 1993-94 WCS draft
- proposal (see URL below). In particular, these algorithms support
- ordinary field rotation, but not skew geometries (CD or PC matrix
- cases). Also, the MER and AIT algorithms work correctly only for
- CRVALi=(0,0). Users should note that GLS projections with yref!=0
- will behave differently in this code than in the draft WCS
- proposal. The NCP projection is now obsolete (it is a special
- case of SIN). WCS syntax and semantics for various advanced
- features is discussed in the draft WCS proposal by Greisen and
- Calabretta at:
-
- ftp://fits.cv.nrao.edu/fits/documents/wcs/wcs.all.ps.Z
-
- -=-=-=-
-
- The original version of this code was Emailed to D.Wells on
- Friday, 23 September by Bill Cotton <bcotton@gorilla.cv.nrao.edu>,
- who described it as a "..more or less.. exact translation from the
- AIPSish..". Changes were made by Don Wells <dwells@nrao.edu>
- during the period October 11-13, 1994:
- 1) added GNU license and header comments
- 2) added testpos.c program to perform extensive circularity tests
- 3) changed float-->double to get more than 7 significant figures
- 4) testpos.c circularity test failed on MER and AIT. B.Cotton
- found that "..there were a couple of lines of code [in] the wrong
- place as a result of merging several Fortran routines."
- 5) testpos.c found 0h wraparound in worldpix() and worldpos().
- 6) E.Greisen recommended removal of various redundant if-statements,
- and addition of a 360d difference test to MER case of worldpos().
- 7) D.Mink changed input to data structure and implemented rotation matrix.
-*/
-#include <math.h>
-#include <string.h>
-#include <stdio.h>
-#include "wcs.h"
-
-int
-worldpos (xpix, ypix, wcs, xpos, ypos)
-
-/* Routine to determine accurate position for pixel coordinates */
-/* returns 0 if successful otherwise 1 = angle too large for projection; */
-/* does: -SIN, -TAN, -ARC, -NCP, -GLS or -SFL, -MER, -AIT projections */
-/* anything else is linear */
-
-/* Input: */
-double xpix; /* x pixel number (RA or long without rotation) */
-double ypix; /* y pixel number (Dec or lat without rotation) */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpos; /* x (RA) coordinate (deg) */
-double *ypos; /* y (dec) coordinate (deg) */
-
-{
- double cosr, sinr, dx, dy, dz, tx;
- double sins, coss, dt, l, m, mg, da, dd, cos0, sin0;
- double rat = 0.0;
- double dect = 0.0;
- double mt, a, y0, td, r2; /* allan: for COE */
- double dec0, ra0, decout, raout;
- double geo1, geo2, geo3;
- double cond2r=1.745329252e-2;
- double twopi = 6.28318530717959;
- double deps = 1.0e-5;
-
- /* Structure elements */
- double xref; /* X reference coordinate value (deg) */
- double yref; /* Y reference coordinate value (deg) */
- double xrefpix; /* X reference pixel */
- double yrefpix; /* Y reference pixel */
- double xinc; /* X coordinate increment (deg) */
- double yinc; /* Y coordinate increment (deg) */
- double rot; /* Optical axis rotation (deg) (N through E) */
- int itype = wcs->prjcode;
-
- /* Set local projection parameters */
- xref = wcs->xref;
- yref = wcs->yref;
- xrefpix = wcs->xrefpix;
- yrefpix = wcs->yrefpix;
- xinc = wcs->xinc;
- yinc = wcs->yinc;
- rot = degrad (wcs->rot);
- cosr = cos (rot);
- sinr = sin (rot);
-
- /* Offset from ref pixel */
- dx = xpix - xrefpix;
- dy = ypix - yrefpix;
-
- /* Scale and rotate using CD matrix */
- if (wcs->rotmat) {
- tx = dx * wcs->cd[0] + dy * wcs->cd[1];
- dy = dx * wcs->cd[2] + dy * wcs->cd[3];
- dx = tx;
- }
-
- /* Scale and rotate using CDELTn and CROTA2 */
- else {
-
- /* Check axis increments - bail out if either 0 */
- if ((xinc==0.0) || (yinc==0.0)) {
- *xpos=0.0;
- *ypos=0.0;
- return 2;
- }
-
- /* Scale using CDELT */
- dx = dx * xinc;
- dy = dy * yinc;
-
- /* Take out rotation from CROTA */
- if (rot != 0.0) {
- tx = dx * cosr - dy * sinr;
- dy = dx * sinr + dy * cosr;
- dx = tx;
- }
- }
-
- /* Flip coordinates if necessary */
- if (wcs->coorflip) {
- tx = dx;
- dx = dy;
- dy = tx;
- }
-
- /* Default, linear result for error or pixel return */
- *xpos = xref + dx;
- *ypos = yref + dy;
- if (itype <= 0)
- return 0;
-
- /* Convert to radians */
- if (wcs->coorflip) {
- dec0 = degrad (xref);
- ra0 = degrad (yref);
- }
- else {
- ra0 = degrad (xref);
- dec0 = degrad (yref);
- }
- l = degrad (dx);
- m = degrad (dy);
- sins = l*l + m*m;
- decout = 0.0;
- raout = 0.0;
- cos0 = cos (dec0);
- sin0 = sin (dec0);
-
- /* Process by case */
- switch (itype) {
-
- case WCS_CAR: /* -CAR Cartesian (was WCS_PIX pixel and WCS_LIN linear) */
- rat = ra0 + l;
- dect = dec0 + m;
- break;
-
- case WCS_SIN: /* -SIN sin*/
- if (sins>1.0) return 1;
- coss = sqrt (1.0 - sins);
- dt = sin0 * coss + cos0 * m;
- if ((dt>1.0) || (dt<-1.0)) return 1;
- dect = asin (dt);
- rat = cos0 * coss - sin0 * m;
- if ((rat==0.0) && (l==0.0)) return 1;
- rat = atan2 (l, rat) + ra0;
- break;
-
- case WCS_TAN: /* -TAN tan */
- case WCS_TNX: /* -TNX tan with polynomial correction */
- case WCS_TPV: /* -TPV tan with polynomial correction */
- case WCS_ZPX: /* -ZPX zpn with polynomial correction */
- if (sins>1.0) return 1;
- dect = cos0 - m * sin0;
- if (dect==0.0) return 1;
- rat = ra0 + atan2 (l, dect);
- dect = atan (cos(rat-ra0) * (m * cos0 + sin0) / dect);
- break;
-
- case WCS_ARC: /* -ARC Arc*/
- if (sins>=twopi*twopi/4.0) return 1;
- sins = sqrt(sins);
- coss = cos (sins);
- if (sins!=0.0) sins = sin (sins) / sins;
- else
- sins = 1.0;
- dt = m * cos0 * sins + sin0 * coss;
- if ((dt>1.0) || (dt<-1.0)) return 1;
- dect = asin (dt);
- da = coss - dt * sin0;
- dt = l * sins * cos0;
- if ((da==0.0) && (dt==0.0)) return 1;
- rat = ra0 + atan2 (dt, da);
- break;
-
- case WCS_NCP: /* -NCP North celestial pole*/
- dect = cos0 - m * sin0;
- if (dect==0.0) return 1;
- rat = ra0 + atan2 (l, dect);
- dt = cos (rat-ra0);
- if (dt==0.0) return 1;
- dect = dect / dt;
- if ((dect>1.0) || (dect<-1.0)) return 1;
- dect = acos (dect);
- if (dec0<0.0) dect = -dect;
- break;
-
- case WCS_GLS: /* -GLS global sinusoid */
- case WCS_SFL: /* -SFL Samson-Flamsteed */
- dect = dec0 + m;
- if (fabs(dect)>twopi/4.0) return 1;
- coss = cos (dect);
- if (fabs(l)>twopi*coss/2.0) return 1;
- rat = ra0;
- if (coss>deps) rat = rat + l / coss;
- break;
-
- case WCS_MER: /* -MER mercator*/
- dt = yinc * cosr + xinc * sinr;
- if (dt==0.0) dt = 1.0;
- dy = degrad (yref/2.0 + 45.0);
- dx = dy + dt / 2.0 * cond2r;
- dy = log (tan (dy));
- dx = log (tan (dx));
- geo2 = degrad (dt) / (dx - dy);
- geo3 = geo2 * dy;
- geo1 = cos (degrad (yref));
- if (geo1<=0.0) geo1 = 1.0;
- rat = l / geo1 + ra0;
- if (fabs(rat - ra0) > twopi) return 1; /* added 10/13/94 DCW/EWG */
- dt = 0.0;
- if (geo2!=0.0) dt = (m + geo3) / geo2;
- dt = exp (dt);
- dect = 2.0 * atan (dt) - twopi / 4.0;
- break;
-
- case WCS_AIT: /* -AIT Aitoff*/
- dt = yinc*cosr + xinc*sinr;
- if (dt==0.0) dt = 1.0;
- dt = degrad (dt);
- dy = degrad (yref);
- dx = sin(dy+dt)/sqrt((1.0+cos(dy+dt))/2.0) -
- sin(dy)/sqrt((1.0+cos(dy))/2.0);
- if (dx==0.0) dx = 1.0;
- geo2 = dt / dx;
- dt = xinc*cosr - yinc* sinr;
- if (dt==0.0) dt = 1.0;
- dt = degrad (dt);
- dx = 2.0 * cos(dy) * sin(dt/2.0);
- if (dx==0.0) dx = 1.0;
- geo1 = dt * sqrt((1.0+cos(dy)*cos(dt/2.0))/2.0) / dx;
- geo3 = geo2 * sin(dy) / sqrt((1.0+cos(dy))/2.0);
- rat = ra0;
- dect = dec0;
- if ((l==0.0) && (m==0.0)) break;
- dz = 4.0 - l*l/(4.0*geo1*geo1) - ((m+geo3)/geo2)*((m+geo3)/geo2) ;
- if ((dz>4.0) || (dz<2.0)) return 1;;
- dz = 0.5 * sqrt (dz);
- dd = (m+geo3) * dz / geo2;
- if (fabs(dd)>1.0) return 1;;
- dd = asin (dd);
- if (fabs(cos(dd))<deps) return 1;;
- da = l * dz / (2.0 * geo1 * cos(dd));
- if (fabs(da)>1.0) return 1;;
- da = asin (da);
- rat = ra0 + 2.0 * da;
- dect = dd;
- break;
-
- case WCS_STG: /* -STG Sterographic*/
- dz = (4.0 - sins) / (4.0 + sins);
- if (fabs(dz)>1.0) return 1;
- dect = dz * sin0 + m * cos0 * (1.0+dz) / 2.0;
- if (fabs(dect)>1.0) return 1;
- dect = asin (dect);
- rat = cos(dect);
- if (fabs(rat)<deps) return 1;
- rat = l * (1.0+dz) / (2.0 * rat);
- if (fabs(rat)>1.0) return 1;
- rat = asin (rat);
- mg = 1.0 + sin(dect) * sin0 + cos(dect) * cos0 * cos(rat);
- if (fabs(mg)<deps) return 1;
- mg = 2.0 * (sin(dect) * cos0 - cos(dect) * sin0 * cos(rat)) / mg;
- if (fabs(mg-m)>deps) rat = twopi/2.0 - rat;
- rat = ra0 + rat;
- break;
-
- case WCS_COE: /* COE projection code from Andreas Wicenic, ESO */
- td = tan (dec0);
- y0 = 1.0 / td;
- mt = y0 - m;
- if (dec0 < 0.)
- a = atan2 (l,-mt);
- else
- a = atan2 (l, mt);
- rat = ra0 - (a / sin0);
- r2 = (l * l) + (mt * mt);
- dect = asin (1.0 / (sin0 * 2.0) * (1.0 + sin0*sin0 * (1.0 - r2)));
- break;
- }
-
- /* Return RA in range */
- raout = rat;
- decout = dect;
- if (raout-ra0>twopi/2.0) raout = raout - twopi;
- if (raout-ra0<-twopi/2.0) raout = raout + twopi;
- if (raout < 0.0) raout += twopi; /* added by DCW 10/12/94 */
-
- /* Convert units back to degrees */
- *xpos = raddeg (raout);
- *ypos = raddeg (decout);
-
- return 0;
-} /* End of worldpos */
-
-
-int
-worldpix (xpos, ypos, wcs, xpix, ypix)
-
-/*-----------------------------------------------------------------------*/
-/* routine to determine accurate pixel coordinates for an RA and Dec */
-/* returns 0 if successful otherwise: */
-/* 1 = angle too large for projection; */
-/* 2 = bad values */
-/* does: SIN, TAN, ARC, NCP, GLS or SFL, MER, AIT, STG, CAR, COE projections */
-/* anything else is linear */
-
-/* Input: */
-double xpos; /* x (RA) coordinate (deg) */
-double ypos; /* y (dec) coordinate (deg) */
-struct WorldCoor *wcs; /* WCS parameter structure */
-
-/* Output: */
-double *xpix; /* x pixel number (RA or long without rotation) */
-double *ypix; /* y pixel number (dec or lat without rotation) */
-{
- double dx, dy, ra0, dec0, ra, dec, coss, sins, dt, da, dd, sint;
- double l, m, geo1, geo2, geo3, sinr, cosr, tx, x, a2, a3, a4;
- double rthea,gamby2,a,b,c,phi,an,rap,v,tthea,co1,co2,co3,co4,ansq; /* COE */
- double cond2r=1.745329252e-2, deps=1.0e-5, twopi=6.28318530717959;
-
-/* Structure elements */
- double xref; /* x reference coordinate value (deg) */
- double yref; /* y reference coordinate value (deg) */
- double xrefpix; /* x reference pixel */
- double yrefpix; /* y reference pixel */
- double xinc; /* x coordinate increment (deg) */
- double yinc; /* y coordinate increment (deg) */
- double rot; /* Optical axis rotation (deg) (from N through E) */
- int itype;
-
- /* Set local projection parameters */
- xref = wcs->xref;
- yref = wcs->yref;
- xrefpix = wcs->xrefpix;
- yrefpix = wcs->yrefpix;
- xinc = wcs->xinc;
- yinc = wcs->yinc;
- rot = degrad (wcs->rot);
- cosr = cos (rot);
- sinr = sin (rot);
-
- /* Projection type */
- itype = wcs->prjcode;
-
- /* Nonlinear position */
- if (itype > 0) {
- if (wcs->coorflip) {
- dec0 = degrad (xref);
- ra0 = degrad (yref);
- dt = xpos - yref;
- }
- else {
- ra0 = degrad (xref);
- dec0 = degrad (yref);
- dt = xpos - xref;
- }
-
- /* 0h wrap-around tests added by D.Wells 10/12/1994: */
- /* Modified to exclude weird reference pixels by D.Mink 2/3/2004 */
- if (xrefpix*xinc > 180.0 || xrefpix*xinc < -180.0) {
- if (dt > 360.0) xpos -= 360.0;
- if (dt < 0.0) xpos += 360.0;
- }
- else {
- if (dt > 180.0) xpos -= 360.0;
- if (dt < -180.0) xpos += 360.0;
- }
- /* NOTE: changing input argument xpos is OK (call-by-value in C!) */
-
- ra = degrad (xpos);
- dec = degrad (ypos);
-
- /* Compute direction cosine */
- coss = cos (dec);
- sins = sin (dec);
- l = sin(ra-ra0) * coss;
- sint = sins * sin(dec0) + coss * cos(dec0) * cos(ra-ra0);
- }
- else {
- l = 0.0;
- sint = 0.0;
- sins = 0.0;
- coss = 0.0;
- ra = 0.0;
- dec = 0.0;
- ra0 = 0.0;
- dec0 = 0.0;
- m = 0.0;
- }
-
- /* Process by case */
- switch (itype) {
-
- case WCS_CAR: /* -CAR Cartesian */
- l = ra - ra0;
- m = dec - dec0;
- break;
-
- case WCS_SIN: /* -SIN sin*/
- if (sint<0.0) return 1;
- m = sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0);
- break;
-
- case WCS_TNX: /* -TNX tan with polynomial correction */
- case WCS_TPV: /* -TPV tan with polynomial correction */
- case WCS_ZPX: /* -ZPX zpn with polynomial correction */
- case WCS_TAN: /* -TAN tan */
- if (sint<=0.0) return 1;
- m = sins * sin(dec0) + coss * cos(dec0) * cos(ra-ra0);
- l = l / m;
- m = (sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0)) / m;
- break;
-
- case WCS_ARC: /* -ARC Arc*/
- m = sins * sin(dec0) + coss * cos(dec0) * cos(ra-ra0);
- if (m<-1.0) m = -1.0;
- if (m>1.0) m = 1.0;
- m = acos (m);
- if (m!=0)
- m = m / sin(m);
- else
- m = 1.0;
- l = l * m;
- m = (sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0)) * m;
- break;
-
- case WCS_NCP: /* -NCP North celestial pole*/
- if (dec0==0.0)
- return 1; /* can't stand the equator */
- else
- m = (cos(dec0) - coss * cos(ra-ra0)) / sin(dec0);
- break;
-
- case WCS_GLS: /* -GLS global sinusoid */
- case WCS_SFL: /* -SFL Samson-Flamsteed */
- dt = ra - ra0;
- if (fabs(dec)>twopi/4.0) return 1;
- if (fabs(dec0)>twopi/4.0) return 1;
- m = dec - dec0;
- l = dt * coss;
- break;
-
- case WCS_MER: /* -MER mercator*/
- dt = yinc * cosr + xinc * sinr;
- if (dt==0.0) dt = 1.0;
- dy = degrad (yref/2.0 + 45.0);
- dx = dy + dt / 2.0 * cond2r;
- dy = log (tan (dy));
- dx = log (tan (dx));
- geo2 = degrad (dt) / (dx - dy);
- geo3 = geo2 * dy;
- geo1 = cos (degrad (yref));
- if (geo1<=0.0) geo1 = 1.0;
- dt = ra - ra0;
- l = geo1 * dt;
- dt = dec / 2.0 + twopi / 8.0;
- dt = tan (dt);
- if (dt<deps) return 2;
- m = geo2 * log (dt) - geo3;
- break;
-
- case WCS_AIT: /* -AIT Aitoff*/
- l = 0.0;
- m = 0.0;
- da = (ra - ra0) / 2.0;
- if (fabs(da)>twopi/4.0) return 1;
- dt = yinc*cosr + xinc*sinr;
- if (dt==0.0) dt = 1.0;
- dt = degrad (dt);
- dy = degrad (yref);
- dx = sin(dy+dt)/sqrt((1.0+cos(dy+dt))/2.0) -
- sin(dy)/sqrt((1.0+cos(dy))/2.0);
- if (dx==0.0) dx = 1.0;
- geo2 = dt / dx;
- dt = xinc*cosr - yinc* sinr;
- if (dt==0.0) dt = 1.0;
- dt = degrad (dt);
- dx = 2.0 * cos(dy) * sin(dt/2.0);
- if (dx==0.0) dx = 1.0;
- geo1 = dt * sqrt((1.0+cos(dy)*cos(dt/2.0))/2.0) / dx;
- geo3 = geo2 * sin(dy) / sqrt((1.0+cos(dy))/2.0);
- dt = sqrt ((1.0 + cos(dec) * cos(da))/2.0);
- if (fabs(dt)<deps) return 3;
- l = 2.0 * geo1 * cos(dec) * sin(da) / dt;
- m = geo2 * sin(dec) / dt - geo3;
- break;
-
- case WCS_STG: /* -STG Sterographic*/
- da = ra - ra0;
- if (fabs(dec)>twopi/4.0) return 1;
- dd = 1.0 + sins * sin(dec0) + coss * cos(dec0) * cos(da);
- if (fabs(dd)<deps) return 1;
- dd = 2.0 / dd;
- l = l * dd;
- m = dd * (sins * cos(dec0) - coss * sin(dec0) * cos(da));
- break;
-
- case WCS_COE: /* allan: -COE projection added, AW, ESO*/
- gamby2 = sin (dec0);
- tthea = tan (dec0);
- rthea = 1. / tthea;
- a = -2. * tthea;
- b = tthea * tthea;
- c = tthea / 3.;
- a2 = a * a;
- a3 = a2 * a;
- a4 = a2 * a2;
- co1 = a/2.;
- co2 = -0.125 * a2 + b/2.;
- co3 = -0.25 * a*b + 0.0625 * a3 + c/2.0;
- co4 = -0.125 * b*b - 0.25 * a*c + 0.1875 * b*a2 - (5.0/128.0)*a4;
- phi = ra0 - ra;
- an = phi * gamby2;
- v = dec - dec0;
- rap = rthea * (1.0 + v * (co1+v * (co2+v * (co3+v * co4))));
- ansq = an * an;
- if (wcs->rotmat)
- l = rap * an * (1.0 - ansq/6.0) * (wcs->cd[0] / fabs(wcs->cd[0]));
- else
- l = rap * an * (1.0 - ansq/6.0) * (xinc / fabs(xinc));
- m = rthea - (rap * (1.0 - ansq/2.0));
- break;
-
- } /* end of itype switch */
-
- /* Convert back to degrees */
- if (itype > 0) {
- dx = raddeg (l);
- dy = raddeg (m);
- }
-
- /* For linear or pixel projection */
- else {
- dx = xpos - xref;
- dy = ypos - yref;
- }
-
- if (wcs->coorflip) {
- tx = dx;
- dx = dy;
- dy = tx;
- }
-
- /* Scale and rotate using CD matrix */
- if (wcs->rotmat) {
- tx = dx * wcs->dc[0] + dy * wcs->dc[1];
- dy = dx * wcs->dc[2] + dy * wcs->dc[3];
- dx = tx;
- }
-
- /* Scale and rotate using CDELTn and CROTA2 */
- else {
-
- /* Correct for rotation */
- if (rot!=0.0) {
- tx = dx*cosr + dy*sinr;
- dy = dy*cosr - dx*sinr;
- dx = tx;
- }
-
- /* Scale using CDELT */
- if (xinc != 0.)
- dx = dx / xinc;
- if (yinc != 0.)
- dy = dy / yinc;
- }
-
- /* Convert to pixels */
- *xpix = dx + xrefpix;
- if (itype == WCS_CAR) {
- if (*xpix > wcs->nxpix) {
- x = *xpix - (360.0 / xinc);
- if (x > 0.0) *xpix = x;
- }
- else if (*xpix < 0) {
- x = *xpix + (360.0 / xinc);
- if (x <= wcs->nxpix) *xpix = x;
- }
- }
- *ypix = dy + yrefpix;
-
- return 0;
-} /* end worldpix */
-
-
-/* Oct 26 1995 Fix bug which interchanged RA and Dec twice when coorflip
- *
- * Oct 31 1996 Fix CD matrix use in WORLDPIX
- * Nov 4 1996 Eliminate extra code for linear projection in WORLDPIX
- * Nov 5 1996 Add coordinate flip in WORLDPIX
- *
- * May 22 1997 Avoid angle wraparound when CTYPE is pixel
- * Jun 4 1997 Return without angle conversion from worldpos if type is PIXEL
- *
- * Oct 20 1997 Add chip rotation; compute rotation angle trig functions
- * Jan 23 1998 Change PCODE to PRJCODE
- * Jan 26 1998 Remove chip rotation code
- * Feb 5 1998 Make cd[] and dc[] vectors; use xinc, yinc, rot from init
- * Feb 23 1998 Add NOAO TNX projection as TAN
- * Apr 28 1998 Change projection flags to WCS_*
- * May 27 1998 Skip limit checking for linear projection
- * Jun 25 1998 Fix inverse for CAR projection
- * Aug 5 1998 Allan Brighton: Added COE projection (code from A. Wicenec, ESO)
- * Sep 30 1998 Fix bug in COE inverse code to get sign correct
- *
- * Oct 21 1999 Drop unused y from worldpix()
- *
- * Apr 3 2002 Use GLS and SFL interchangeably
- *
- * Feb 3 2004 Let ra be >180 in worldpix() if ref pixel is >180 deg away
- *
- * Jun 20 2006 Initialize uninitialized variables
- *
- * Mar 11 2011 Initialize ZPX
- * Sep 1 2011 Add TPV projection as TAN
- */
diff --git a/funtools/wcs/zpxpos.c b/funtools/wcs/zpxpos.c
deleted file mode 100644
index a6f7168..0000000
--- a/funtools/wcs/zpxpos.c
+++ /dev/null
@@ -1,735 +0,0 @@
-/*** File wcslib/zpxpos.c
- *** October 31, 2012
- *** By Frank Valdes, valdes@noao.edu
- *** Modified from tnxpos.c by Jessica Mink, jmink@cfa.harvard.edu
- *** Harvard-Smithsonian Center for Astrophysics
- *** After IRAF mwcs/wfzpx.x
- *** Copyright (C) 1998-2012
- *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Correspondence concerning WCSTools should be addressed as follows:
- Internet email: jmink@cfa.harvard.edu
- Postal address: Jessica Mink
- Smithsonian Astrophysical Observatory
- 60 Garden St.
- Cambridge, MA 02138 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "wcs.h"
-
-#define TOL 1e-13
-#define SPHTOL 0.00001
-#define BADCVAL 0.0
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-
-/* wfzpx -- wcs function driver for the zenithal / azimuthal polynomial.
- * zpxinit (header, wcs)
- * zpxclose (wcs)
- * zpxfwd (xpix, ypix, wcs, xpos, ypos) Pixels to WCS
- * zpxrev (xpos, ypos, wcs, xpix, ypix) WCS to pixels
- */
-
-#define max_niter 500
-#define SZ_ATSTRING 2000
-static void wf_gsclose();
-
-/* zpxinit -- initialize the zenithal/azimuthal polynomial forward or
- * inverse transform. initialization for this transformation consists of,
- * determining which axis is ra / lon and which is dec / lat, computing the
- * celestial longitude and colatitude of the native pole, reading in the the
- * native longitude of the pole of the celestial coordinate system longpole
- * from the attribute list, precomputing the euler angles and various
- * intermediary functions of the reference coordinates, reading in the
- * projection parameter ro from the attribute list, reading in up to ten
- * polynomial coefficients, and, for polynomial orders greater than 2 computing
- * the colatitude and radius of the first point of inflection. if longpole is
- * undefined then a value of 180.0 degrees is assumed. if ro is undefined a
- * value of 180.0 / pi is assumed. if the polynomial coefficients are all zero
- * then an error condition is posted. if the order of the polynomial is 2 or
- * greater and there is no point of inflection an error condition is posted.
- * the zpx projection with an order of 1 and 0th and 1st coefficients of 0.0
- * and 1.0 respectively is equivalent to the arc projtection. in order to
- * determine the axis order, the parameter "axtype={ra|dec} {xlon|xlat}" must
- * have been set in the attribute list for the function. the longpole and ro
- * parameters may be set in either or both of the axes attribute lists, but the
- * value in the ra axis attribute list takes precedence.
- */
-
-int
-zpxinit (header, wcs)
-
-const char *header; /* FITS header */
-struct WorldCoor *wcs; /* pointer to WCS structure */
-{
- int i, j;
- struct IRAFsurface *wf_gsopen();
- char key[8], *str1, *str2, *lngstr, *latstr, *header1;
- double zd1, d1, zd2,d2, zd, d, r;
- extern void wcsrotset();
-
- /* allocate space for the attribute strings */
- str1 = malloc (SZ_ATSTRING);
- str2 = malloc (SZ_ATSTRING);
- if (!hgetm (header, "WAT1", SZ_ATSTRING, str1)) {
- /* this is a kludge to handle NOAO archived data where the first
- * WAT cards are in the primary header and this code does not
- * implement the inheritance convention. since zpx is largely an
- * NOAO system and it doesn't make sense for WAT1 to be missing if
- * ctype is ZPX, this block is only triggered with this kludge.
- * there had to be a few changes to defeat the caching of the
- * index of the header string so that the added cards are also
- * found.
- */
-
- header1 = malloc (strlen(header)+200);
- strcpy (header1, "WAT1_001= 'wtype=zpx axtype=ra projp0=0. projp1=1. projp2=0. projp3=337.74 proj'WAT2_001= 'wtype=zpx axtype=dec projp0=0. projp1=1. projp2=0. projp3=337.74 pro'");
- strcat (header1, header);
- hgetm (header1, "WAT1", SZ_ATSTRING, str1);
- hgetm (header1, "WAT2", SZ_ATSTRING, str2);
- free (header1);
- }
- hgetm (header, "WAT2", SZ_ATSTRING, str2);
-
- lngstr = malloc (SZ_ATSTRING);
- latstr = malloc (SZ_ATSTRING);
-
- /* determine the native longitude of the pole of the celestial
- coordinate system corresponding to the FITS keyword longpole.
- this number has no default and should normally be set to 180
- degrees. search both axes for this quantity. */
-
- if (wcs->longpole > 360.0) {
- if (!igetr8 (str1, "longpole", &wcs->longpole)) {
- if (!igetr8 (str2, "longpole", &wcs->longpole))
- wcs->longpole = 180.0;
- }
- }
-
- /* Fetch the ro projection parameter which is the radius of the
- generating sphere for the projection. if ro is absent which
- is the usual case set it to 180 / pi. search both axes for
- this quantity. */
-
- if (!igetr8 (str1, "ro", &wcs->rodeg)) {
- if (!igetr8 (str2, "ro", &wcs->rodeg))
- wcs->rodeg = 180.0 / PI;
- }
-
- /* Fetch the zenithal polynomial coefficients. */
- for (i = 0; i < 10; i++) {
- sprintf (key,"projp%d",i);
- if (!igetr8 (str1, key, &wcs->prj.p[i]))
- wcs->prj.p[i] = 0.0;
- }
-
- /* Fetch the longitude correction surface. note that the attribute
- string may be of any length so the length of atvalue may have
- to be adjusted. */
-
- if (!igets (str1, "lngcor", SZ_ATSTRING, lngstr)) {
- if (!igets (str2, "lngcor", SZ_ATSTRING, lngstr))
- wcs->lngcor = NULL;
- else
- wcs->lngcor = wf_gsopen (lngstr);
- }
- else
- wcs->lngcor = wf_gsopen (lngstr);
-
- /* Fetch the latitude correction surface. note that the attribute
- string may be of any length so the length of atvalue may have
- to be adjusted. */
-
- if (!igets (str2, "latcor", SZ_ATSTRING, latstr)) {
- if (!igets (str1, "latcor", SZ_ATSTRING, latstr))
- wcs->latcor = NULL;
- else
- wcs->latcor = wf_gsopen (latstr);
- }
- else
- wcs->latcor = wf_gsopen (latstr);
-
- /* Determine the number of ZP coefficients */
- for (i = 9; i >= 0 && wcs->prj.p[i] == 0.; i--);
- wcs->zpnp = i;
-
- if (i >= 3) {
- /* Find the point of inflection closest to the pole. */
- zd1 = 0.;
- d1 = wcs->prj.p[1];
-
- /* Find the point where the derivative first goes negative. */
- for (i = 1; i<= 180; i++) {
- zd2 = PI * i / 180.0;
- d2 = 0.;
- for (j = wcs->zpnp; j >= 1; j--) {
- d2 = d2 * zd2 + j * wcs->prj.p[j];
- }
- if (d2 <= 0.)
- break;
- zd1 = zd2;
- d1 = d2;
- }
-
- /* Find where the derivative is 0. */
- if (d2 <= 0.0) {
- for (i = 1; i <= 10; i++) {
- zd = zd1 - d1 * (zd2 - zd1) / (d2 - d1);
- d = 0.;
- for (j = wcs->zpnp; j >= 1; j--) {
- d = d * zd + j * wcs->prj.p[j];
- }
- if (fabs(d) < TOL)
- break;
- if (d < 0.) {
- zd2 = zd;
- d2 = d;
- }
- else {
- zd1 = zd;
- d1 = d;
- }
- }
- }
-
- /* No negative derivative. */
- else
- zd = PI;
-
- r = 0.;
- for (j = wcs->zpnp; j >= 0; j--)
- r = r * zd + wcs->prj.p[j];
- wcs->zpzd = zd;
- wcs->zpr = r;
- }
-
- /* Compute image rotation */
- wcsrotset (wcs);
-
- /* free working space. */
- free (str1);
- free (str2);
- free (lngstr);
- free (latstr);
-
- /* Return 1 if there are no correction coefficients */
- if (wcs->latcor == NULL && wcs->lngcor == NULL)
- return (1);
- else
- return (0);
-}
-
-
-/* zpxpos -- forward transform (physical to world) gnomonic projection. */
-
-int
-zpxpos (xpix, ypix, wcs, xpos, ypos)
-
-double xpix, ypix; /*i physical coordinates (x, y) */
-struct WorldCoor *wcs; /*i pointer to WCS descriptor */
-double *xpos, *ypos; /*o world coordinates (ra, dec) */
-{
- int i, j, k, ira, idec;
- double x, y, r, phi, theta, costhe, sinthe, dphi, cosphi, sinphi, dlng, z;
- double colatp, coslatp, sinlatp, longp;
- double xs, ys, ra, dec, xp, yp;
- double a, b, c, d, zd, zd1, zd2, r1, r2, rt, lambda;
- double wf_gseval();
-
- /* Convert from pixels to image coordinates */
- xpix = xpix - wcs->crpix[0];
- ypix = ypix - wcs->crpix[1];
-
- /* Scale and rotate using CD matrix */
- if (wcs->rotmat) {
- x = xpix * wcs->cd[0] + ypix * wcs->cd[1];
- y = xpix * wcs->cd[2] + ypix * wcs->cd[3];
- }
-
- else {
-
- /* Check axis increments - bail out if either 0 */
- if (wcs->cdelt[0] == 0.0 || wcs->cdelt[1] == 0.0) {
- *xpos = 0.0;
- *ypos = 0.0;
- return 2;
- }
-
- /* Scale using CDELT */
- xs = xpix * wcs->cdelt[0];
- ys = ypix * wcs->cdelt[1];
-
- /* Take out rotation from CROTA */
- if (wcs->rot != 0.0) {
- double cosr = cos (degrad (wcs->rot));
- double sinr = sin (degrad (wcs->rot));
- x = xs * cosr - ys * sinr;
- y = xs * sinr + ys * cosr;
- }
- else {
- x = xs;
- y = ys;
- }
- }
-
- /* Get the axis numbers */
- if (wcs->coorflip) {
- ira = 1;
- idec = 0;
- }
- else {
- ira = 0;
- idec = 1;
- }
- colatp = degrad (90.0 - wcs->crval[idec]);
- coslatp = cos(colatp);
- sinlatp = sin(colatp);
- longp = degrad(wcs->longpole);
-
- /* Compute native spherical coordinates phi and theta in degrees from the
- projected coordinates. this is the projection part of the computation */
- k = wcs->zpnp;
- if (wcs->lngcor != NULL)
- xp = x + wf_gseval (wcs->lngcor, x, y);
- else
- xp = x;
- if (wcs->latcor != NULL)
- yp = y + wf_gseval (wcs->latcor, x, y);
- else
- yp = y;
- x = xp;
- y = yp;
- r = sqrt (x * x + y * y) / wcs->rodeg;
-
- /* Solve */
-
- /* Constant no solution */
- if (k < 1) {
- *xpos = BADCVAL;
- *ypos = BADCVAL;
- return (1);
- }
-
- /* Linear */
- else if (k == 1) {
- zd = (r - wcs->prj.p[0]) / wcs->prj.p[1];
- }
-
- /* Quadratic */
- else if (k == 2) {
-
- a = wcs->prj.p[2];
- b = wcs->prj.p[1];
- c = wcs->prj.p[0] - r;
- d = b * b - 4. * a * c;
- if (d < 0.) {
- *xpos = BADCVAL;
- *ypos = BADCVAL;
- return (1);
- }
- d = sqrt (d);
-
- /* Choose solution closest to the pole */
- zd1 = (-b + d) / (2. * a);
- zd2 = (-b - d) / (2. * a);
- if (zd1 < zd2)
- zd = zd1;
- else
- zd = zd2;
- if (zd < -TOL) {
- if (zd1 > zd2)
- zd = zd1;
- else
- zd = zd2;
- }
- if (zd < 0.) {
- if (zd < -TOL) {
- *xpos = BADCVAL;
- *ypos = BADCVAL;
- return (1);
- }
- zd = 0.;
- }
- else if (zd > PI) {
- if (zd > (PI + TOL)) {
- *xpos = BADCVAL;
- *ypos = BADCVAL;
- return (1);
- }
- zd = PI;
- }
- }
-
- /* Higher order solve iteratively */
- else {
-
- zd1 = 0.;
- r1 = wcs->prj.p[0];
- zd2 = wcs->zpzd;
- r2 = wcs->zpr;
-
- if (r < r1) {
- if (r < (r1 - TOL)) {
- *xpos = BADCVAL;
- *ypos = BADCVAL;
- return (1);
- }
- zd = zd1;
- }
- else if (r > r2) {
- if (r > (r2 + TOL)) {
- *xpos = BADCVAL;
- *ypos = BADCVAL;
- return (1);
- }
- zd = zd2;
- }
- else {
- for (j=0; j<100; j++) {
- lambda = (r2 - r) / (r2 - r1);
- if (lambda < 0.1)
- lambda = 0.1;
- else if (lambda > 0.9)
- lambda = 0.9;
- zd = zd2 - lambda * (zd2 - zd1);
- rt = 0.;
- for (i=k; i>=0; i--)
- rt = (rt * zd) + wcs->prj.p[i];
- if (rt < r) {
- if ((r - rt) < TOL)
- break;
- r1 = rt;
- zd1 = zd;
- }
- else {
- if ((rt - r) < TOL)
- break;
- r2 = rt;
- zd2 = zd;
- }
- lambda = zd2 - zd1;
- lambda = fabs (zd2 - zd1);
- if (fabs (zd2 - zd1) < TOL)
- break;
- }
- }
- }
-
- /* Compute phi */
- if (r == 0.0)
- phi = 0.0;
- else
- phi = atan2 (x, -y);
-
- /* Compute theta */
- theta = PI / 2 - zd;
-
- /* Compute the celestial coordinates ra and dec from the native
- coordinates phi and theta. this is the spherical geometry part
- of the computation */
-
- costhe = cos (theta);
- sinthe = sin (theta);
- dphi = phi - longp;
- cosphi = cos (dphi);
- sinphi = sin (dphi);
-
- /* Compute the ra */
- x = sinthe * sinlatp - costhe * coslatp * cosphi;
- if (fabs (x) < SPHTOL)
- x = -cos (theta + colatp) + costhe * coslatp * (1.0 - cosphi);
- y = -costhe * sinphi;
- if (x != 0.0 || y != 0.0)
- dlng = atan2 (y, x);
- else
- dlng = dphi + PI ;
- ra = wcs->crval[ira] + raddeg(dlng);
-
- /* normalize ra */
- if (wcs->crval[ira] >= 0.0) {
- if (ra < 0.0)
- ra = ra + 360.0;
- }
- else {
- if (ra > 0.0)
- ra = ra - 360.0;
- }
- if (ra > 360.0)
- ra = ra - 360.0;
- else if (ra < -360.0)
- ra = ra + 360.0;
-
- /* compute the dec */
- if (fmod (dphi, PI) == 0.0) {
- dec = raddeg(theta + cosphi * colatp);
- if (dec > 90.0)
- dec = 180.0 - dec;
- if (dec < -90.0)
- dec = -180.0 - dec;
- }
- else {
- z = sinthe * coslatp + costhe * sinlatp * cosphi;
- if (fabs(z) > 0.99) {
- if (z >= 0.0)
- dec = raddeg(acos (sqrt(x * x + y * y)));
- else
- dec = raddeg(-acos (sqrt(x * x + y * y)));
- }
- else
- dec = raddeg(asin (z));
- }
-
- /* store the results */
- *xpos = ra;
- *ypos = dec;
- return (0);
-}
-
-
-/* zpxpix -- inverse transform (world to physical) for the zenithal
- * azimuthal polynomial projection.
- */
-
-int
-zpxpix (xpos, ypos, wcs, xpix, ypix)
-
-double xpos, ypos; /*i world coordinates (ra, dec) */
-struct WorldCoor *wcs; /*i pointer to WCS descriptor */
-double *xpix, *ypix; /*o physical coordinates (x, y) */
-{
- int i, ira, idec, niter;
- double ra, dec, cosdec, sindec, cosra, sinra, x, y, phi, theta;
- double s, r, dphi, z, dpi, dhalfpi, twopi, tx;
- double xm, ym, f, fx, fy, g, gx, gy, denom, dx, dy;
- double colatp, coslatp, sinlatp, longp, sphtol;
- double wf_gseval(), wf_gsder();
-
- /* get the axis numbers */
- if (wcs->coorflip) {
- ira = 1;
- idec = 0;
- }
- else {
- ira = 0;
- idec = 1;
- }
-
- /* Compute the transformation from celestial coordinates ra and
- dec to native coordinates phi and theta. this is the spherical
- geometry part of the transformation */
-
- ra = degrad (xpos - wcs->crval[ira]);
- dec = degrad (ypos);
- cosra = cos (ra);
- sinra = sin (ra);
- cosdec = cos (dec);
- sindec = sin (dec);
- colatp = degrad (90.0 - wcs->crval[idec]);
- coslatp = cos (colatp);
- sinlatp = sin (colatp);
- if (wcs->longpole == 999.0)
- longp = degrad (180.0);
- else
- longp = degrad(wcs->longpole);
- dpi = PI;
- dhalfpi = dpi * 0.5;
- twopi = PI + PI;
- sphtol = SPHTOL;
-
- /* Compute phi */
- x = sindec * sinlatp - cosdec * coslatp * cosra;
- if (fabs(x) < sphtol)
- x = -cos (dec + colatp) + cosdec * coslatp * (1.0 - cosra);
- y = -cosdec * sinra;
- if (x != 0.0 || y != 0.0)
- dphi = atan2 (y, x);
- else
- dphi = ra - dpi;
- phi = longp + dphi;
- if (phi > dpi)
- phi = phi - twopi;
- else if (phi < -dpi)
- phi = phi + twopi;
-
- /* Compute theta */
- if (fmod (ra, dpi) == 0.0) {
- theta = dec + cosra * colatp;
- if (theta > dhalfpi)
- theta = dpi - theta;
- if (theta < -dhalfpi)
- theta = -dpi - theta;
- }
- else {
- z = sindec * coslatp + cosdec * sinlatp * cosra;
- if (fabs (z) > 0.99) {
- if (z >= 0.0)
- theta = acos (sqrt(x * x + y * y));
- else
- theta = -acos (sqrt(x * x + y * y));
- }
- else
- theta = asin (z);
- }
-
- /* Compute the transformation from native coordinates phi and theta
- to projected coordinates x and y */
-
- s = dhalfpi - theta;
- r = 0.;
- for (i=9; i>=0; i--)
- r = r * s + wcs->prj.p[i];
- r = wcs->rodeg * r;
-
- if (wcs->lngcor == NULL && wcs->latcor == NULL) {
- if (wcs->coorflip) {
- y = r * sin (phi);
- x = -r * cos (phi);
- } else {
- x = r * sin (phi);
- y = -r * cos (phi);
- }
- } else {
- xm = r * sin (phi);
- ym = -r * cos (phi);
- x = xm;
- y = ym;
- niter = 0;
- while (niter < max_niter) {
- if (wcs->lngcor != NULL) {
- f = x + wf_gseval (wcs->lngcor, x, y) - xm;
- fx = wf_gsder (wcs->lngcor, x, y, 1, 0);
- fx = 1.0 + fx;
- fy = wf_gsder (wcs->lngcor, x, y, 0, 1);
- }
- else {
- f = x - xm;
- fx = 1.0 ;
- fy = 0.0;
- }
- if (wcs->latcor != NULL) {
- g = y + wf_gseval (wcs->latcor, x, y) - ym;
- gx = wf_gsder (wcs->latcor, x, y, 1, 0);
- gy = wf_gsder (wcs->latcor, x, y, 0, 1);
- gy = 1.0 + gy;
- }
- else {
- g = y - ym;
- gx = 0.0 ;
- gy = 1.0;
- }
-
- denom = fx * gy - fy * gx;
- if (denom == 0.0)
- break;
- dx = (-f * gy + g * fy) / denom;
- dy = (-g * fx + f * gx) / denom;
- x = x + dx;
- y = y + dy;
- if (MAX(MAX(fabs(dx),fabs(dy)),MAX(fabs(f),fabs(g))) < 2.80e-8)
- break;
-
- niter = niter + 1;
- }
-
- /* Reverse x and y if axes flipped */
- if (wcs->coorflip) {
- tx = x;
- x = y;
- y = tx;
- }
- }
-
- /* Scale and rotate using CD matrix */
- if (wcs->rotmat) {
- *xpix = x * wcs->dc[0] + y * wcs->dc[1];
- *ypix = x * wcs->dc[2] + y * wcs->dc[3];
- }
-
- else {
-
- /* Correct for rotation */
- if (wcs->rot!=0.0) {
- double cosr = cos (degrad (wcs->rot));
- double sinr = sin (degrad (wcs->rot));
- *xpix = x * cosr + y * sinr;
- *ypix = y * cosr - x * sinr;
- }
- else {
- *xpix = x;
- *ypix = y;
- }
-
- /* Scale using CDELT */
- if (wcs->xinc != 0.)
- *xpix = *xpix / wcs->xinc;
- if (wcs->yinc != 0.)
- *ypix = *ypix / wcs->yinc;
- }
-
- /* Convert to pixels */
- *xpix = *xpix + wcs->xrefpix;
- *ypix = *ypix + wcs->yrefpix;
-
- return (0);
-}
-
-
-/* ZPXCLOSE -- free up the distortion surface pointers */
-
-void
-zpxclose (wcs)
-
-struct WorldCoor *wcs; /* pointer to the WCS descriptor */
-
-{
- if (wcs->lngcor != NULL)
- wf_gsclose (wcs->lngcor);
- if (wcs->latcor != NULL)
- wf_gsclose (wcs->latcor);
- return;
-}
-
-
-/* wf_gsclose -- procedure to free the surface descriptor */
-
-static void
-wf_gsclose (sf)
-
-struct IRAFsurface *sf; /* the surface descriptor */
-
-{
- if (sf != NULL) {
- if (sf->xbasis != NULL)
- free (sf->xbasis);
- if (sf->ybasis != NULL)
- free (sf->ybasis);
- if (sf->coeff != NULL)
- free (sf->coeff);
- free (sf);
- }
- return;
-}
-
-/*
- * Mar 8 2011 Created from tnxpos.c and wfzpx.x
- *
- * Oct 31 2012 End comment on line 346 after pole; fix code thereafter
- */